Skip to content

Commit

Permalink
fix: enable new ty page when guest checkout happens
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Jun 19, 2024
1 parent cbdcc13 commit 11c206a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Checkout/CheckoutDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export default {
if (this.enableRadioBtnExperiment) {
emailUpdates = this.selectedComms === '1';
}
this.$emit('opt-in', emailUpdates);
const validationPayload = {
email: this.email,
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Checkout/CheckoutPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
@updating-totals="setUpdatingTotals"
@complete-transaction="completeTransaction"
:use-async-checkout="asyncCheckoutActive"
@opt-in="($event) => userOptedIn = $event"
/>
</div>

Expand Down Expand Up @@ -436,6 +437,7 @@ export default {
depositIncentiveAmountToLend: 0,
depositIncentiveExperimentEnabled: false,
checkoutStickyExperimentEnabled: false,
userOptedIn: false,
};
},
apollo: {
Expand Down Expand Up @@ -899,10 +901,15 @@ export default {
// fire transaction events
this.$kvTrackTransaction(transactionData);
let checkoutAdditionalQueryParams = this.challengeRedirectQueryParam;
if (this.checkingOutAsGuest) {
checkoutAdditionalQueryParams += `&optedIn=${this.userOptedIn}`;
}
// redirect to thanks
window.setTimeout(
() => {
this.redirectToThanks(transactionId, this.challengeRedirectQueryParam);
this.redirectToThanks(transactionId, checkoutAdditionalQueryParams);
},
800
);
Expand Down
5 changes: 5 additions & 0 deletions src/pages/Checkout/PostPurchase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
} else {
const transactionId = numeral(route.query.kiva_transaction_id).value();
const valetInviter = route?.query?.valet_inviter ?? '';
const optedIn = route?.query?.optedIn ?? '';
if (!transactionId) {
// redirect to thanks page if no transaction id was provided
// currently resolves to portfolio via ThanksView getCheckoutId method
Expand Down Expand Up @@ -52,6 +53,10 @@ export default {
successRoute.query.valet_inviter = valetInviter;
}
if (optedIn) {
successRoute.query.optedIn = optedIn;
}
// track the transaction event
client.mutate({
mutation: trackTransactionMutation,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Thanks/ThanksPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export default {
}) || {};
this.enableMayChallengeHeader = shareChallengeExpData?.version === 'b';
this.optedIn = data?.my?.communicationSettings?.lenderNews ?? false;
this.optedIn = data?.my?.communicationSettings?.lenderNews || this.$route.query?.optedIn === 'true';
const bpPattern = /^\/lend\/(\d+)/;
if (bpPattern.test(this.$appConfig.firstPage)) {
Expand Down

0 comments on commit 11c206a

Please sign in to comment.