Skip to content

Commit

Permalink
Merge pull request #4981 from kiva/CORE-1513_thanks_page_ftds
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-in-kiva authored Sep 25, 2023
2 parents 76463d0 + 47cf8f4 commit e906648
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/components/Thanks/ShareStepper.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="tw-my-2 tw-px-2">
<div style="width: 136px;" class="tw-mx-auto tw-px-1">
<div v-if="!isFirstLoan" style="width: 136px;" class="tw-mx-auto tw-px-1">
<div class="tw-flex tw-items-center">
<template v-for="step in steps">
<ShareStepperStep
Expand All @@ -17,6 +17,10 @@
<span v-if="commentsMode">
<span class="data-hj-suppress">{{ lenderName }}</span>, go the extra mile
</span>
<span v-else-if="isFirstLoan">
<!-- eslint-disable-next-line max-len -->
<span class="data-hj-suppress">{{ lenderName }}</span>, You’re support means the world to <span class="data-hj-suppress">{{ loanName }}</span>. Let us help you change another life.
</span>
<span v-else>
<!-- eslint-disable-next-line max-len -->
<span class="data-hj-suppress">{{ lenderName }}</span>, complete your support by sharing {{ subject }}
Expand Down Expand Up @@ -51,7 +55,15 @@ export default {
calculatePeopleQtyToGoal: {
type: Number,
default: 0
}
},
isFirstLoan: {
type: Boolean,
default: false
},
loanName: {
type: String,
default: ''
},
},
data() {
return {
Expand Down
50 changes: 50 additions & 0 deletions src/components/Thanks/ThanksPageCommentAndShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
:calculate-people-qty-to-goal="calculatePeopleQtyToGoal()"
:show-lender-name="!isGuest"
:comments-mode="askForComments"
:is-first-loan="isFirstLoan"
:loan-name="loan.name"
/>
<!-- Image Section -->
<kv-page-container>
Expand Down Expand Up @@ -66,6 +68,44 @@
</div>
</kv-grid>
</kv-page-container>
<!-- First Time Deposit Section -->
<kv-page-container v-if="isFirstLoan">
<kv-grid class="tw-grid-cols-12">
<div class="tw-col-span-12 lg:tw-col-span-8 lg:tw-col-start-3 tw-mb-4 hide-for-print">
<h1 class="tw-mt-1 tw-mb-3 tw-text-left">
Here’s ${{ ftdCreditAmount }} on us <span class="tw-text-brand">toward your next loan</span>.
</h1>
<p class="tw-m-0 tw-text-subhead">
<!-- eslint-disable-next-line max-len -->
As a reward for joining the Kiva community we’d like to give you a leg up on your next loan in your inbox 🥇.
</p>
</div>
</kv-grid>
<div class="tw-flex tw-flex-col tw-gap-y-2 tw-mt-2 tw-mb-4 tw-max-w-sm tw-mx-auto">
<kv-button
variant="primary"
to="/portfolio"
v-kv-track-event="['post-checkout', 'click', 'ftd-portfolio', null, loanId]"
>
Continue to portfolio
</kv-button>
<kv-button
variant="secondary"
:href="shareLink"
v-kv-track-event="['post-checkout', 'share', 'ftd-sharing', null, loanId]"
>
Share this loan with others
</kv-button>
<kv-button
variant="ghost"
to="/lend-by-category"
v-kv-track-event="['post-checkout', 'click', 'ftd-lending-home', null, loanId]"
>
Go to lending home
</kv-button>
</div>
<hr>
</kv-page-container>
<!-- Comments Section -->
<CommentAsk
class="hide-for-print"
Expand Down Expand Up @@ -185,6 +225,7 @@ import KvMaterialIcon from '~/@kiva/kv-components/vue/KvMaterialIcon';
import KvProgressBar from '~/@kiva/kv-components/vue/KvProgressBar';
import KvGrid from '~/@kiva/kv-components/vue/KvGrid';
import KvPageContainer from '~/@kiva/kv-components/vue/KvPageContainer';
import KvButton from '~/@kiva/kv-components/vue/KvButton';
const thanksImgRequire = require.context('@/assets/images/thanks-page', true);
Expand All @@ -200,6 +241,7 @@ export default {
CommentAsk,
KvGrid,
KvPageContainer,
KvButton
},
props: {
receipt: {
Expand All @@ -222,6 +264,14 @@ export default {
type: Boolean,
default: false
},
isFirstLoan: {
type: Boolean,
default: false
},
ftdCreditAmount: {
type: String,
default: ''
},
},
mixins: [socialSharingMixin],
metaInfo() {
Expand Down
8 changes: 8 additions & 0 deletions src/graphql/query/thanksPage.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ query checkoutReceipt($checkoutId: Int!, $visitorId: String) {
key
value
}
ftd_message_enable: uiConfigSetting(key: "thanks_page_ftd_message_enable") {
key
value
}
ftd_amount: uiConfigSetting(key: "thanks_page_ftd_amount") {
key
value
}
}
mySubscriptions(includeDisabled: false) {
values {
Expand Down
18 changes: 17 additions & 1 deletion src/pages/Thanks/ThanksPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
:lender="lender"
:loan="selectedLoan"
:is-guest="isGuest"
:is-first-loan="showFtdMessage"
:ftd-credit-amount="ftdCreditAmount"
@guest-create-account="createGuestAccount"
:ask-for-comments="askForComments"
/>
Expand Down Expand Up @@ -150,7 +152,10 @@ export default {
isGuest: false,
pageData: {},
jumpToGuestUpsell: false,
monthlyDonationAmount: ''
monthlyDonationAmount: '',
isFirstLoan: false,
isFtdMessageEnable: false,
ftdCreditAmount: ''
};
},
apollo: {
Expand Down Expand Up @@ -246,6 +251,9 @@ export default {
// Is a guest checking out only with US loans?
// eslint-disable-next-line no-underscore-dangle
return this.isGuest && this.loans.every(loan => loan?.__typename === 'LoanDirect');
},
showFtdMessage() {
return this.isFirstLoan && this.enableFtdMessage && this.ftdCreditAmount;
}
},
created() {
Expand Down Expand Up @@ -284,6 +292,13 @@ export default {
this.receipt = data?.shop?.receipt ?? null;
this.isGuest = this.receipt && !data?.my?.userAccount;
// Enable FTDs message from settings
const enableFtdMessageData = data?.general?.ftd_message_enable ?? null;
this.enableFtdMessage = enableFtdMessageData ? enableFtdMessageData.value : false;
// Credit amount for FTD message from settings
const ftdCreditAmountData = data?.general?.ftd_amount ?? null;
this.ftdCreditAmount = ftdCreditAmountData ? ftdCreditAmountData.value : '';
const loansResponse = this.receipt?.items?.values ?? [];
this.loans = loansResponse
.filter(item => item.basketItemType === 'loan_reservation')
Expand All @@ -307,6 +322,7 @@ export default {
const totalLoans = data?.my?.loans?.totalCount ?? 0;
const isFirstLoan = this.loans.length && totalLoans === this.loans.length;
this.isFirstLoan = isFirstLoan;
const hasDirectLoan = this.loans.findIndex(loan => loan.distributionModel === 'direct') > -1;
const hasCoreLoan = this.loans.findIndex(loan => loan.distributionModel === 'fieldPartner') > -1;
Expand Down

0 comments on commit e906648

Please sign in to comment.