Skip to content

Commit

Permalink
feat: show 'just 1 dollar' modal once per 24 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Aug 7, 2023
1 parent 383ef8a commit 8d44a7f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default {
title: 'We rely on donations to reach the people who need it the most',
};
},
inject: ['cookieStore'],
components: {
KvButton,
KvLightbox,
Expand Down Expand Up @@ -169,9 +170,15 @@ export default {
},
methods: {
setDonationAndClose(amount, source) {
if (amount === 0 && !this.zeroUpsellVisible) {
const zeroUpsellCookie = this.cookieStore.get('zero_upsell_visible') || true;
if (amount === 0 && !this.zeroUpsellVisible && zeroUpsellCookie !== 'false') {
this.zeroUpsellVisible = true;
} else {
if (amount === 0) {
const expires = new Date();
expires.setTime(expires.getTime() + (24 * 60 * 60 * 1000));
this.cookieStore.set('zero_upsell_visible', false, { expires });
}
const clickSource = source ? ` - ${source}` : '';
this.updateDonationTo(amount);
this.$kvTrackEvent('basket', 'Update Nudge Donation', `Update Success${clickSource}`, amount * 100);
Expand Down

0 comments on commit 8d44a7f

Please sign in to comment.