Skip to content

Commit

Permalink
feat: almost funded row test added to lending home page (#5034)
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-in-kiva authored Oct 18, 2023
1 parent 5eebefd commit 702b54b
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions src/pages/LoanFinding/LoanFinding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
}"
/>

<!-- Almost Funded loans row -->
<lending-category-section
id="almost-funded-section"
v-if="enableAlmostFundedRow"
:title="almostFundedRowTitle"
:subtitle="almostFundedRowSubtitle"
:loans="almostFundedLoans"
:enable-five-dollars-notes="enableFiveDollarsNotes"
:enable-relending-exp="enableRelendingExp"
:user-balance="userBalance"
@add-to-basket="trackCategory($event, 'almost-funded')"
class="tw-pt-3 tw-mb-2"
/>

<!-- Five dollars row -->
<lending-category-section
id="five-dollars-section"
Expand Down Expand Up @@ -135,6 +149,7 @@ export default {
return {
userInfo: {},
firstRowLoans: [],
almostFundedLoans: new Array(9).fill({ id: 0 }),
secondCategoryLoans: new Array(9).fill({ id: 0 }),
fiveDollarsRowLoans: new Array(30).fill({ id: 0 }),
matchedLoansTotal: 0,
Expand Down Expand Up @@ -222,7 +237,13 @@ export default {
},
perStepRecommendedRow() {
return !this.enableThreeLoansRecommended ? 2 : 3;
}
},
almostFundedRowTitle() {
return 'Loans that are <span class="tw-text-action">almost funded</span>';
},
almostFundedRowSubtitle() {
return 'Be the difference maker for these borrowers who only have a small amount remaining to be funded.';
},
},
methods: {
async getRecommendedLoans() {
Expand Down Expand Up @@ -261,11 +282,8 @@ export default {
{ sortBy: 'expiringSoon', pageLimit: 5 },
FLSS_ORIGIN_LEND_BY_CATEGORY
);
const almostFundedData = await runLoansQuery(
this.apollo,
{ sortBy: 'amountLeft', pageLimit: 4 },
FLSS_ORIGIN_LEND_BY_CATEGORY
);
const almostFundedData = await this.almostFundedQuery(4);
return [...expiringSoonData.loans, ...almostFundedData.loans];
},
async getMatchedLoans() {
Expand Down Expand Up @@ -299,6 +317,17 @@ export default {
this.trackSpotlightDisplayedLoans();
},
async getAlmostFundedLoans() {
const { loans } = await this.almostFundedQuery(9);
this.almostFundedLoans = loans ?? [];
},
almostFundedQuery(pageLimit) {
return runLoansQuery(
this.apollo,
{ sortBy: 'amountLeft', pageLimit },
FLSS_ORIGIN_LEND_BY_CATEGORY
);
},
trackCategory({ success }, category) {
if (success) this.$kvTrackEvent('loan-card', 'add-to-basket', `${category}-lending-home`);
},
Expand Down Expand Up @@ -467,6 +496,8 @@ export default {
if (this.enableFiveDollarsNotes) this.getFiveDollarsLoans();
if (this.enableAlmostFundedRow) this.getAlmostFundedLoans();
// create observer for spotlight loans
this.createSpotlightViewportObserver();
Expand Down

0 comments on commit 702b54b

Please sign in to comment.