Skip to content

Commit

Permalink
fix: hide badge experiment when user checkouts with a printable card
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Sep 9, 2024
1 parent f683109 commit f765b23
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/pages/Thanks/ThanksPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ export default {
showNewTYPage() {
return !this.landedOnUSLoan && !this.optedIn && this.loans.length > 0;
},
receiptValues() {
return this.receipt?.items?.values ?? [];
},
kivaCards() {
if (!this.receiptValues.length) return [];
return this.receipt.items.values.filter(item => item.basketItemType === 'kiva_card');
},
printableKivaCards() {
if (!this.receiptValues.length) return [];
return this.kivaCards.filter(card => card.kivaCardObject.deliveryType === 'print');
},
},
created() {
// Retrieve and apply Page level data + experiment state
Expand Down Expand Up @@ -546,10 +557,8 @@ export default {
this.enableMayChallengeHeader = shareChallengeExpData?.version === 'b';
this.optedIn = data?.my?.communicationSettings?.lenderNews || this.$route.query?.optedIn === 'true';
const usedKivaCard = Number(this.receipt?.totals?.kivaCardTotal);
// Thanks Badges Experiment
if (this.optedIn && !usedKivaCard) {
if (this.optedIn && !this.printableKivaCards.length) {
const { version } = trackExperimentVersion(
this.apollo,
this.$kvTrackEvent,
Expand Down

0 comments on commit f765b23

Please sign in to comment.