@kiva/kv-components 3.78.2 → 3.79.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 +19 -0
- package/package.json +2 -2
- package/vue/KvClassicLoanCard.vue +16 -0
- package/vue/KvLendCta.vue +30 -6
- package/vue/stories/KvClassicLoanCard.stories.js +32 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.79.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.78.2...@kiva/kv-components@3.79.0) (2024-05-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* change cta2ButtonText to loanInBasketButtonText ([f052b7b](https://github.com/kiva/kv-ui-elements/commit/f052b7bdee874b5e2447b437cd90c7751ced4bce))
|
|
12
|
+
* remove button story edits ([9dfbf98](https://github.com/kiva/kv-ui-elements/commit/9dfbf981adc2f90384650044f35e6179dbbd851f))
|
|
13
|
+
* remove showSecondaryButton in favor of condition to make code more readable ([8223460](https://github.com/kiva/kv-ui-elements/commit/8223460d56480267b2d4f16e99c7becc1e72b40e))
|
|
14
|
+
* set consistent default values for buttons ([041fef2](https://github.com/kiva/kv-ui-elements/commit/041fef2cc21b11b4b4d11f342c8fb7a7dcee222f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* loan card primary and secondary button customization options ([77ecb2e](https://github.com/kiva/kv-ui-elements/commit/77ecb2e90c1df81201029ba8906f217cf9f9d6b2))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.78.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.78.1...@kiva/kv-components@3.78.2) (2024-05-20)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @kiva/kv-components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.79.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": "dcf6cda7c9e7fc9437c2f5e0a607cebeb503eea2"
|
|
79
79
|
}
|
|
@@ -223,10 +223,14 @@
|
|
|
223
223
|
:set-cookie="setCookie"
|
|
224
224
|
:enable-huge-amount="enableHugeAmount"
|
|
225
225
|
:is-visitor="isVisitor"
|
|
226
|
+
:primary-button-text="primaryButtonText"
|
|
227
|
+
:secondary-button-text="secondaryButtonText"
|
|
228
|
+
:secondary-button-handler="secondaryButtonHandler"
|
|
226
229
|
class="tw-mt-auto"
|
|
227
230
|
:class="{ 'tw-w-full' : unreservedAmount <= 0 }"
|
|
228
231
|
@add-to-basket="$emit('add-to-basket', $event)"
|
|
229
232
|
@show-loan-details="clickReadMore('ViewLoan')"
|
|
233
|
+
@remove-from-basket="$emit('remove-from-basket', $event)"
|
|
230
234
|
/>
|
|
231
235
|
</div>
|
|
232
236
|
<div
|
|
@@ -397,6 +401,18 @@ export default {
|
|
|
397
401
|
type: Boolean,
|
|
398
402
|
default: false,
|
|
399
403
|
},
|
|
404
|
+
primaryButtonText: {
|
|
405
|
+
type: String,
|
|
406
|
+
default: 'Lend',
|
|
407
|
+
},
|
|
408
|
+
secondaryButtonHandler: {
|
|
409
|
+
type: Function,
|
|
410
|
+
default: undefined,
|
|
411
|
+
},
|
|
412
|
+
secondaryButtonText: {
|
|
413
|
+
type: String,
|
|
414
|
+
default: 'Checkout now',
|
|
415
|
+
},
|
|
400
416
|
},
|
|
401
417
|
setup(props) {
|
|
402
418
|
const {
|
package/vue/KvLendCta.vue
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
data-testid="bp-lend-cta-checkout-button"
|
|
9
9
|
:to="!externalLinks ? '/basket' : undefined"
|
|
10
10
|
:href="externalLinks ? '/basket' : undefined"
|
|
11
|
-
@click.native="
|
|
11
|
+
@click.native="clickSecondaryButton"
|
|
12
12
|
>
|
|
13
|
-
|
|
13
|
+
{{ loanInBasketButtonText }}
|
|
14
14
|
</kv-ui-button>
|
|
15
15
|
|
|
16
16
|
<!-- Refunded, allSharesReserved button -->
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
data-testid="bp-lend-cta-lend-again-button"
|
|
99
99
|
type="submit"
|
|
100
100
|
>
|
|
101
|
-
Lend again
|
|
101
|
+
{{ primaryButtonText || 'Lend' }} again
|
|
102
102
|
</kv-ui-button>
|
|
103
103
|
</div>
|
|
104
104
|
|
|
@@ -206,6 +206,18 @@ export default {
|
|
|
206
206
|
type: Boolean,
|
|
207
207
|
default: true,
|
|
208
208
|
},
|
|
209
|
+
primaryButtonText: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: 'Lend',
|
|
212
|
+
},
|
|
213
|
+
secondaryButtonText: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: 'Checkout now',
|
|
216
|
+
},
|
|
217
|
+
secondaryButtonHandler: {
|
|
218
|
+
type: Function,
|
|
219
|
+
default: undefined,
|
|
220
|
+
},
|
|
209
221
|
},
|
|
210
222
|
data() {
|
|
211
223
|
return {
|
|
@@ -261,7 +273,7 @@ export default {
|
|
|
261
273
|
},
|
|
262
274
|
ctaButtonText() {
|
|
263
275
|
if (this.isCompleteLoanActive) {
|
|
264
|
-
return 'Lend';
|
|
276
|
+
return this.primaryButtonText || 'Lend';
|
|
265
277
|
}
|
|
266
278
|
switch (this.state) {
|
|
267
279
|
case 'loading':
|
|
@@ -269,9 +281,12 @@ export default {
|
|
|
269
281
|
case 'refunded':
|
|
270
282
|
case 'expired':
|
|
271
283
|
default:
|
|
272
|
-
return 'Lend';
|
|
284
|
+
return this.primaryButtonText || 'Lend';
|
|
273
285
|
}
|
|
274
286
|
},
|
|
287
|
+
loanInBasketButtonText() {
|
|
288
|
+
return this.secondaryButtonText;
|
|
289
|
+
},
|
|
275
290
|
useFormSubmit() {
|
|
276
291
|
if (this.hideShowLendDropdown
|
|
277
292
|
|| this.lendButtonVisibility
|
|
@@ -392,7 +407,16 @@ export default {
|
|
|
392
407
|
clickDropdown() {
|
|
393
408
|
this.kvTrackFunction('Lending', 'click-Modify loan amount', 'open dialog', this.loanId, this.loanId);
|
|
394
409
|
},
|
|
395
|
-
|
|
410
|
+
clickSecondaryButton() {
|
|
411
|
+
if (this.secondaryButtonHandler) {
|
|
412
|
+
// Custom secondary button behavior
|
|
413
|
+
this.secondaryButtonHandler();
|
|
414
|
+
} else {
|
|
415
|
+
// Default secondary button behavior
|
|
416
|
+
this.handleCheckout();
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
handleCheckout() {
|
|
396
420
|
this.kvTrackFunction(
|
|
397
421
|
'Lending',
|
|
398
422
|
'click-Continue-to-checkout',
|
|
@@ -33,6 +33,9 @@ const story = (args) => {
|
|
|
33
33
|
:combined-activities="combinedActivities"
|
|
34
34
|
:enable-huge-amount="enableHugeAmount"
|
|
35
35
|
:enable-clickable-tags="enableClickableTags"
|
|
36
|
+
:primary-button-text="primaryButtonText"
|
|
37
|
+
:secondary-button-text="secondaryButtonText"
|
|
38
|
+
:secondary-button-handler="secondaryButtonHandler"
|
|
36
39
|
/>
|
|
37
40
|
</div>
|
|
38
41
|
`,
|
|
@@ -397,3 +400,32 @@ export const ClickableTags = story({
|
|
|
397
400
|
photoPath,
|
|
398
401
|
enableClickableTags: true,
|
|
399
402
|
});
|
|
403
|
+
|
|
404
|
+
export const SupportButton = story({
|
|
405
|
+
loanId: loan.id,
|
|
406
|
+
loan,
|
|
407
|
+
primaryButtonText: 'Support',
|
|
408
|
+
kvTrackFunction,
|
|
409
|
+
photoPath,
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
export const SupportAgain = story({
|
|
413
|
+
loanId: loan.id,
|
|
414
|
+
loan: {
|
|
415
|
+
...loan,
|
|
416
|
+
userProperties: { lentTo: true },
|
|
417
|
+
},
|
|
418
|
+
primaryButtonText: 'Support',
|
|
419
|
+
kvTrackFunction,
|
|
420
|
+
photoPath,
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
export const RemoveButton = story({
|
|
424
|
+
loanId: loan.id,
|
|
425
|
+
loan,
|
|
426
|
+
kvTrackFunction,
|
|
427
|
+
photoPath,
|
|
428
|
+
basketItems: [{ id: loan.id, __typename: 'LoanReservation' }],
|
|
429
|
+
secondaryButtonText: 'Remove Loan',
|
|
430
|
+
secondaryButtonHandler: () => {},
|
|
431
|
+
});
|