@kiva/kv-components 3.82.0 → 3.83.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
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.83.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.82.1...@kiva/kv-components@3.83.0) (2024-06-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* implement custom loan details on loan card ([#416](https://github.com/kiva/kv-ui-elements/issues/416)) ([13a7a39](https://github.com/kiva/kv-ui-elements/commit/13a7a39ed9d073aa3ee7319b69c6b46f26d45d5b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.82.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.82.0...@kiva/kv-components@3.82.1) (2024-06-03)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* loan card button secondary action and destination ([#411](https://github.com/kiva/kv-ui-elements/issues/411)) ([9cf20db](https://github.com/kiva/kv-ui-elements/commit/9cf20dbd9865a685ae19a5a4d553bb3345c680b8))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.82.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.81.0...@kiva/kv-components@3.82.0) (2024-06-03)
|
|
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.83.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": "a248af9b1215451e5b121939976b5340cf3b00bd"
|
|
79
79
|
}
|
package/utils/loanCard.js
CHANGED
|
@@ -179,22 +179,26 @@ export function loanCardComputedProperties(props) {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
export function loanCardMethods(props) {
|
|
182
|
+
export function loanCardMethods(props, emit) {
|
|
183
183
|
const {
|
|
184
184
|
loanId,
|
|
185
185
|
customLoanDetails,
|
|
186
186
|
kvTrackFunction,
|
|
187
187
|
} = toRefs(props);
|
|
188
188
|
|
|
189
|
-
function showLoanDetails(
|
|
189
|
+
function showLoanDetails(event) {
|
|
190
190
|
if (customLoanDetails.value) {
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
emit('show-loan-details');
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
function clickReadMore(target) {
|
|
196
|
+
function clickReadMore(target, event) {
|
|
197
197
|
kvTrackFunction.value('Lending', 'click-Read more', target, loanId.value);
|
|
198
|
+
if (customLoanDetails.value) {
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
emit('show-loan-details');
|
|
201
|
+
}
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
return {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
:href="readMorePath"
|
|
26
26
|
class="tw-flex"
|
|
27
27
|
aria-label="Borrower image"
|
|
28
|
-
@click="clickReadMore('Photo')"
|
|
28
|
+
@click.native="clickReadMore('Photo', $event)"
|
|
29
29
|
>
|
|
30
30
|
<kv-borrower-image
|
|
31
31
|
class="
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
class="tw-flex hover:tw-no-underline focus:tw-no-underline"
|
|
94
94
|
:class="{ 'tw-px-1': largeCard }"
|
|
95
95
|
aria-label="Loan tag"
|
|
96
|
-
@click="clickReadMore('Tag')"
|
|
96
|
+
@click.native="clickReadMore('Tag', $event)"
|
|
97
97
|
>
|
|
98
98
|
<kv-loan-tag
|
|
99
99
|
v-if="showTags && !isLoading"
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
:href="readMorePath"
|
|
109
109
|
class="loan-card-use tw-text-primary"
|
|
110
110
|
aria-label="Loan use"
|
|
111
|
-
@click="clickReadMore('Use')"
|
|
111
|
+
@click.native="clickReadMore('Use', $event)"
|
|
112
112
|
>
|
|
113
113
|
<!-- Loan use -->
|
|
114
114
|
<div class="tw-mb-1.5 tw-pt-1">
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
:href="readMorePath"
|
|
188
188
|
class="loan-card-progress tw-mt-1"
|
|
189
189
|
aria-label="Loan progress"
|
|
190
|
-
@click="clickReadMore('Progress')"
|
|
190
|
+
@click.native="clickReadMore('Progress', $event)"
|
|
191
191
|
>
|
|
192
192
|
<kv-loan-progress-group
|
|
193
193
|
id="loanProgress"
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
class="tw-mt-auto"
|
|
230
230
|
:class="{ 'tw-w-full' : unreservedAmount <= 0 }"
|
|
231
231
|
@add-to-basket="$emit('add-to-basket', $event)"
|
|
232
|
-
@show-loan-details="clickReadMore('ViewLoan')"
|
|
232
|
+
@show-loan-details="clickReadMore('ViewLoan', $event)"
|
|
233
233
|
@remove-from-basket="$emit('remove-from-basket', $event)"
|
|
234
234
|
/>
|
|
235
235
|
</div>
|
|
@@ -429,7 +429,7 @@ export default {
|
|
|
429
429
|
default: false,
|
|
430
430
|
},
|
|
431
431
|
},
|
|
432
|
-
setup(props) {
|
|
432
|
+
setup(props, { emit }) {
|
|
433
433
|
const {
|
|
434
434
|
allDataLoaded,
|
|
435
435
|
borrowerName,
|
|
@@ -456,7 +456,7 @@ export default {
|
|
|
456
456
|
const {
|
|
457
457
|
clickReadMore,
|
|
458
458
|
showLoanDetails,
|
|
459
|
-
} = loanCardMethods(props);
|
|
459
|
+
} = loanCardMethods(props, emit);
|
|
460
460
|
|
|
461
461
|
return {
|
|
462
462
|
allDataLoaded,
|
package/vue/KvLendCta.vue
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
variant="secondary"
|
|
7
7
|
class="tw-inline-flex tw-flex-1"
|
|
8
8
|
data-testid="bp-lend-cta-checkout-button"
|
|
9
|
-
:to="!externalLinks
|
|
10
|
-
:href="externalLinks
|
|
11
|
-
@click.native="clickSecondaryButton"
|
|
9
|
+
:to="!externalLinks ? '/basket' : undefined"
|
|
10
|
+
:href="externalLinks ? '/basket' : undefined"
|
|
11
|
+
@click.native="clickSecondaryButton($event)"
|
|
12
12
|
>
|
|
13
13
|
{{ loanInBasketButtonText }}
|
|
14
14
|
</kv-ui-button>
|
|
@@ -407,8 +407,10 @@ export default {
|
|
|
407
407
|
clickDropdown() {
|
|
408
408
|
this.kvTrackFunction('Lending', 'click-Modify loan amount', 'open dialog', this.loanId, this.loanId);
|
|
409
409
|
},
|
|
410
|
-
clickSecondaryButton() {
|
|
410
|
+
clickSecondaryButton(event) {
|
|
411
411
|
if (this.secondaryButtonHandler) {
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
event.stopPropagation();
|
|
412
414
|
// Custom secondary button behavior
|
|
413
415
|
this.secondaryButtonHandler();
|
|
414
416
|
} else {
|
package/vue/KvWideLoanCard.vue
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
:href="readMorePath"
|
|
36
36
|
class="tw-flex"
|
|
37
37
|
aria-label="Borrower image"
|
|
38
|
-
@click="clickReadMore('Photo')"
|
|
38
|
+
@click.native="clickReadMore('Photo', $event)"
|
|
39
39
|
>
|
|
40
40
|
<kv-borrower-image
|
|
41
41
|
class="
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
:href="readMorePath"
|
|
103
103
|
class="tw-flex hover:tw-no-underline focus:tw-no-underline"
|
|
104
104
|
aria-label="Loan tag"
|
|
105
|
-
@click="clickReadMore('Tag')"
|
|
105
|
+
@click.native="clickReadMore('Tag', $event)"
|
|
106
106
|
>
|
|
107
107
|
<kv-loan-tag
|
|
108
108
|
v-if="showTags && !isLoading"
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
:href="readMorePath"
|
|
183
183
|
class="loan-card-progress tw-mt-1 tw-flex-grow"
|
|
184
184
|
aria-label="Loan progress"
|
|
185
|
-
@click="clickReadMore('Progress')"
|
|
185
|
+
@click.native="clickReadMore('Progress', $event)"
|
|
186
186
|
>
|
|
187
187
|
<kv-loan-progress-group
|
|
188
188
|
id="loanProgress"
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
class="tw-mt-auto tw-self-end"
|
|
221
221
|
:class="{'tw-flex-grow' : unreservedAmount === 0, 'tw-flex-shrink-0' : unreservedAmount > 0}"
|
|
222
222
|
@add-to-basket="$emit('add-to-basket', $event)"
|
|
223
|
-
@show-loan-details="clickReadMore('ViewLoan')"
|
|
223
|
+
@show-loan-details="clickReadMore('ViewLoan', $event)"
|
|
224
224
|
/>
|
|
225
225
|
</div>
|
|
226
226
|
</div>
|
|
@@ -338,7 +338,7 @@ export default {
|
|
|
338
338
|
default: false,
|
|
339
339
|
},
|
|
340
340
|
},
|
|
341
|
-
setup(props) {
|
|
341
|
+
setup(props, { emit }) {
|
|
342
342
|
const {
|
|
343
343
|
allDataLoaded,
|
|
344
344
|
borrowerName,
|
|
@@ -365,7 +365,7 @@ export default {
|
|
|
365
365
|
const {
|
|
366
366
|
clickReadMore,
|
|
367
367
|
showLoanDetails,
|
|
368
|
-
} = loanCardMethods(props);
|
|
368
|
+
} = loanCardMethods(props, emit);
|
|
369
369
|
|
|
370
370
|
return {
|
|
371
371
|
allDataLoaded,
|
|
@@ -37,9 +37,15 @@ const story = (args) => {
|
|
|
37
37
|
:primary-button-text="primaryButtonText"
|
|
38
38
|
:secondary-button-text="secondaryButtonText"
|
|
39
39
|
:secondary-button-handler="secondaryButtonHandler"
|
|
40
|
+
@show-loan-details="showLoanDetails"
|
|
40
41
|
/>
|
|
41
42
|
</div>
|
|
42
43
|
`,
|
|
44
|
+
methods: {
|
|
45
|
+
showLoanDetails() {
|
|
46
|
+
console.log('show-loan-details');
|
|
47
|
+
},
|
|
48
|
+
},
|
|
43
49
|
});
|
|
44
50
|
template.args = args;
|
|
45
51
|
return template;
|
|
@@ -421,6 +427,18 @@ export const SupportAgain = story({
|
|
|
421
427
|
photoPath,
|
|
422
428
|
});
|
|
423
429
|
|
|
430
|
+
export const CustomShowLoanDetails = story({
|
|
431
|
+
loanId: loan.id,
|
|
432
|
+
loan: {
|
|
433
|
+
...loan,
|
|
434
|
+
userProperties: { lentTo: true },
|
|
435
|
+
},
|
|
436
|
+
primaryButtonText: 'Support',
|
|
437
|
+
kvTrackFunction,
|
|
438
|
+
photoPath,
|
|
439
|
+
customLoanDetails: true,
|
|
440
|
+
});
|
|
441
|
+
|
|
424
442
|
export const RemoveButton = story({
|
|
425
443
|
loanId: loan.id,
|
|
426
444
|
loan,
|
|
@@ -428,7 +446,7 @@ export const RemoveButton = story({
|
|
|
428
446
|
photoPath,
|
|
429
447
|
basketItems: [{ id: loan.id, __typename: 'LoanReservation' }],
|
|
430
448
|
secondaryButtonText: 'Remove Loan',
|
|
431
|
-
secondaryButtonHandler: () => {},
|
|
449
|
+
secondaryButtonHandler: () => { },
|
|
432
450
|
});
|
|
433
451
|
|
|
434
452
|
export const ContributorsAndAmount = story({
|
|
@@ -23,6 +23,8 @@ const story = (args) => {
|
|
|
23
23
|
:custom-loan-details="customLoanDetails"
|
|
24
24
|
:enable-huge-amount="enableHugeAmount"
|
|
25
25
|
:is-visitor="isVisitor"
|
|
26
|
+
:secondary-button-handler="secondaryButtonHandler"
|
|
27
|
+
:external-links="externalLinks"
|
|
26
28
|
/>
|
|
27
29
|
</div>
|
|
28
30
|
`,
|
|
@@ -33,6 +35,8 @@ const story = (args) => {
|
|
|
33
35
|
|
|
34
36
|
const kvTrackFunction = () => { };
|
|
35
37
|
|
|
38
|
+
const secondaryButtonHandler = () => { console.log('secondary button handler'); };
|
|
39
|
+
|
|
36
40
|
export const Loading = story({ isLoading: true, kvTrackFunction });
|
|
37
41
|
|
|
38
42
|
export const Adding = story({ isLoading: false, isAdding: true, kvTrackFunction });
|
|
@@ -49,6 +53,20 @@ export const Basketed = story({
|
|
|
49
53
|
kvTrackFunction,
|
|
50
54
|
});
|
|
51
55
|
|
|
56
|
+
export const BasketedWithSecondaryAction = story({
|
|
57
|
+
isLoading: false,
|
|
58
|
+
loan: { id: 1 },
|
|
59
|
+
basketItems: [
|
|
60
|
+
{
|
|
61
|
+
__typename: 'LoanReservation',
|
|
62
|
+
id: 1,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
externalLinks: true,
|
|
66
|
+
kvTrackFunction,
|
|
67
|
+
secondaryButtonHandler,
|
|
68
|
+
});
|
|
69
|
+
|
|
52
70
|
export const Funded = story({
|
|
53
71
|
isLoading: false,
|
|
54
72
|
loan: { status: 'funded' },
|