From 11c206a90305d69a41cc50317072ad602f4c76e1 Mon Sep 17 00:00:00 2001 From: Christian Bedon Date: Wed, 19 Jun 2024 11:49:09 -0500 Subject: [PATCH] fix: enable new ty page when guest checkout happens --- src/components/Checkout/CheckoutDropInPaymentWrapper.vue | 1 + src/pages/Checkout/CheckoutPage.vue | 9 ++++++++- src/pages/Checkout/PostPurchase.vue | 5 +++++ src/pages/Thanks/ThanksPage.vue | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/Checkout/CheckoutDropInPaymentWrapper.vue b/src/components/Checkout/CheckoutDropInPaymentWrapper.vue index 1df2fa0b4a..d7021b2234 100644 --- a/src/components/Checkout/CheckoutDropInPaymentWrapper.vue +++ b/src/components/Checkout/CheckoutDropInPaymentWrapper.vue @@ -241,6 +241,7 @@ export default { if (this.enableRadioBtnExperiment) { emailUpdates = this.selectedComms === '1'; } + this.$emit('opt-in', emailUpdates); const validationPayload = { email: this.email, diff --git a/src/pages/Checkout/CheckoutPage.vue b/src/pages/Checkout/CheckoutPage.vue index e0655f352c..4538d9a360 100644 --- a/src/pages/Checkout/CheckoutPage.vue +++ b/src/pages/Checkout/CheckoutPage.vue @@ -112,6 +112,7 @@ @updating-totals="setUpdatingTotals" @complete-transaction="completeTransaction" :use-async-checkout="asyncCheckoutActive" + @opt-in="($event) => userOptedIn = $event" /> @@ -436,6 +437,7 @@ export default { depositIncentiveAmountToLend: 0, depositIncentiveExperimentEnabled: false, checkoutStickyExperimentEnabled: false, + userOptedIn: false, }; }, apollo: { @@ -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 ); diff --git a/src/pages/Checkout/PostPurchase.vue b/src/pages/Checkout/PostPurchase.vue index 93720a7b1f..781a300eae 100644 --- a/src/pages/Checkout/PostPurchase.vue +++ b/src/pages/Checkout/PostPurchase.vue @@ -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 @@ -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, diff --git a/src/pages/Thanks/ThanksPage.vue b/src/pages/Thanks/ThanksPage.vue index 09fe3f9104..0904afb864 100644 --- a/src/pages/Thanks/ThanksPage.vue +++ b/src/pages/Thanks/ThanksPage.vue @@ -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)) {