Skip to content

Commit

Permalink
fix: show new thank you page to users who made first transaction and …
Browse files Browse the repository at this point in the history
…do not opted in
  • Loading branch information
Christian Bedon committed Jun 17, 2024
1 parent 8533482 commit 1b516cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/components/Thanks/WhatIsNextTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ export default {
type: Object,
default: () => ({})
},
borrowerName: {
type: String,
default: ''
},
isGuest: {
type: Boolean,
default: false
Expand Down Expand Up @@ -333,6 +329,9 @@ export default {
};
},
computed: {
borrowerName() {
return this.selectedLoan?.name ?? '';
},
filteredLoans() {
const filteredLoans = [...this.loans];
if (this.loans.length === 3) {
Expand Down
3 changes: 3 additions & 0 deletions src/graphql/query/thanksPage.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ query checkoutReceipt($checkoutId: Int!, $visitorId: String) {
loans {
totalCount
}
communicationSettings {
lenderNews
}
}
general {
shareAskCopy: uiExperimentSetting(key: "share_ask_copy") {
Expand Down
19 changes: 9 additions & 10 deletions src/pages/Thanks/ThanksPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<www-page data-testid="thanks-page" :class="{'tw-bg-eco-green-1': !showOldThanksPage && !isOnlyDonation}">
<www-page data-testid="thanks-page" :class="{'tw-bg-eco-green-1': showNewTYPage && !isOnlyDonation}">
<template v-if="isOnlyDonation">
<thanks-page-donation-only
:monthly-donation-amount="monthlyDonationAmount"
Expand All @@ -10,8 +10,6 @@
:selected-loan="selectedLoan"
:loans="loans"
:receipt="receipt"
:borrower-name="borrowerName"
:hash="hash"
:lender="lender"
:is-guest="isGuest"
:opted-in="optedIn"
Expand Down Expand Up @@ -368,7 +366,7 @@ export default {
},
teamName() {
return this.loans?.[0]?.team?.name ?? '';
}
},
},
created() {
// Retrieve and apply Page level data + experiment state
Expand Down Expand Up @@ -494,16 +492,17 @@ export default {
}) || {};
this.enableMayChallengeHeader = shareChallengeExpData?.version === 'b';
// Only show the old page if the first page is a borrower page and feature flag is enabled
const newThanksPageEnabled = data?.general?.newThanksPageEnabled?.value === 'true';
const bpPattern = /^\/lend\/(\d+)\/$/;
this.optedIn = data?.my?.communicationSettings?.lenderNews ?? false;
const bpPattern = /^\/lend\/(\d+)/;
if (newThanksPageEnabled && bpPattern.test(this.$appConfig.firstPage)) {
if (bpPattern.test(this.$appConfig.firstPage)) {
const url = this.$appConfig.firstPage?.split('/');
const firstVisitloanId = url?.[2] ?? null;
const landedLoan = this.loans.find(loan => loan.id === firstVisitloanId);
this.showNewTYPage = landedLoan?.geocode?.country?.isoCode !== 'US';
const landedLoan = this.loans.find(loan => loan.id === Number(firstVisitloanId));
this.showNewTYPage = landedLoan?.geocode?.country?.isoCode !== 'US'
&& isFirstLoan
&& !this.optedIn;
}
// New Thanks Page Experiment
Expand Down

0 comments on commit 1b516cb

Please sign in to comment.