@kiva/kv-components 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/package.json +2 -2
- package/utils/loanUtils.js +26 -8
- package/vue/KvKivaPartnerHeader.vue +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.34.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.33.0...@kiva/kv-components@3.34.0) (2023-08-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* balance campaign prices added to loan utility ([#277](https://github.com/kiva/kv-ui-elements/issues/277)) ([319707e](https://github.com/kiva/kv-ui-elements/commit/319707e525865077e531ab6f4c378676da7ee53b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.33.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.32.0...@kiva/kv-components@3.33.0) (2023-08-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* cleanup unneeded code in kiva partner header ([ff39945](https://github.com/kiva/kv-ui-elements/commit/ff39945d649a010105a44762b3662acfd38b9dcd))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.32.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.31.0...@kiva/kv-components@3.32.0) (2023-07-31)
|
|
7
29
|
|
|
8
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"optional": true
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d09d1371289d921d7189df632461ca29568e56a8"
|
|
79
79
|
}
|
package/utils/loanUtils.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export const ERL_COOKIE_NAME = 'kverlfivedollarnotes';
|
|
2
2
|
export const TOP_UP_CAMPAIGN = 'TOPUP-VB-BALANCE-MPV1';
|
|
3
3
|
export const BASE_CAMPAIGN = 'BASE-VB_BALANCE_MPV1';
|
|
4
|
+
export const BALANCE_CAMPAIGN = 'REPAYMENT-NOTIFICATION_BALANCE_MPV1';
|
|
5
|
+
export const NO_BALANCE_CAMPAIGN = 'REPAYMENT-NOTIFICATION_NO-BALANCE_MPV1';
|
|
6
|
+
|
|
7
|
+
function balanceCampaignOptions(val) {
|
|
8
|
+
if (val > 20) return 25;
|
|
9
|
+
if (val > 15) return 20;
|
|
10
|
+
if (val > 10) return 15;
|
|
11
|
+
if (val > 5) return 10;
|
|
12
|
+
return 5;
|
|
13
|
+
}
|
|
4
14
|
|
|
5
15
|
/**
|
|
6
16
|
* Checks if the unreserved amount is between 25 and 50
|
|
@@ -42,6 +52,11 @@ export function getLendCtaSelectedOption(
|
|
|
42
52
|
userBalance,
|
|
43
53
|
fiveDollarsSelected,
|
|
44
54
|
) {
|
|
55
|
+
// defaulted to $5 for fiveDollarsSelected flag even when users come from email with a different balance
|
|
56
|
+
if (enableFiveDollarsNotes && fiveDollarsSelected) {
|
|
57
|
+
return '5';
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
// Don't enable the campaign changes when the user balance is undefined (user not logged in)
|
|
46
61
|
if (enableFiveDollarsNotes && typeof userBalance !== 'undefined') {
|
|
47
62
|
let currentCampaign = getCookie?.(ERL_COOKIE_NAME);
|
|
@@ -56,7 +71,9 @@ export function getLendCtaSelectedOption(
|
|
|
56
71
|
// eslint-disable-next-line no-nested-ternary
|
|
57
72
|
currentCampaign = campaignToCheck.includes(TOP_UP_CAMPAIGN)
|
|
58
73
|
? TOP_UP_CAMPAIGN
|
|
59
|
-
:
|
|
74
|
+
: campaignToCheck.includes(BASE_CAMPAIGN) ? BASE_CAMPAIGN // eslint-disable-line no-nested-ternary
|
|
75
|
+
: campaignToCheck.includes(BALANCE_CAMPAIGN) ? BALANCE_CAMPAIGN // eslint-disable-line no-nested-ternary
|
|
76
|
+
: (campaignToCheck.includes(NO_BALANCE_CAMPAIGN) ? NO_BALANCE_CAMPAIGN : '');
|
|
60
77
|
|
|
61
78
|
if (currentCampaign && setCookie) {
|
|
62
79
|
setCookie(ERL_COOKIE_NAME, currentCampaign, { expires });
|
|
@@ -64,25 +81,26 @@ export function getLendCtaSelectedOption(
|
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
if (currentCampaign) {
|
|
84
|
+
let val = Math.floor(userBalance / 5) * 5;
|
|
85
|
+
|
|
67
86
|
// Base campaign gets largest increment of $5 under the user's balance up to $25 or the unreserved amount
|
|
68
87
|
if (currentCampaign === BASE_CAMPAIGN) {
|
|
69
|
-
let val = Math.floor(userBalance / 5) * 5;
|
|
70
|
-
|
|
71
88
|
// eslint-disable-next-line no-nested-ternary
|
|
72
89
|
val = val === 0 ? 5 : (val > 25 ? 25 : val);
|
|
73
90
|
|
|
74
91
|
return Number(val <= unreservedAmount ? val : unreservedAmount).toFixed();
|
|
75
92
|
}
|
|
76
93
|
|
|
77
|
-
|
|
94
|
+
if (currentCampaign === BALANCE_CAMPAIGN) {
|
|
95
|
+
val = balanceCampaignOptions(val);
|
|
96
|
+
return Number(val).toFixed();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Top up and no balance campaigns defaults to $5
|
|
78
100
|
return Number(unreservedAmount > 5 ? 5 : unreservedAmount).toFixed();
|
|
79
101
|
}
|
|
80
102
|
}
|
|
81
103
|
|
|
82
|
-
if (enableFiveDollarsNotes && fiveDollarsSelected) {
|
|
83
|
-
return '5';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
104
|
// Handle when $5 notes isn't enabled
|
|
87
105
|
if (isBetween25And50(unreservedAmount) || isLessThan25(unreservedAmount)) {
|
|
88
106
|
return Number(unreservedAmount).toFixed();
|