@kiva/kv-components 4.5.1 → 4.7.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,39 @@
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
+ # [4.7.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@4.6.0...@kiva/kv-components@4.7.0) (2025-01-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * add autoplay button if autoplay plugin is enabled ([8bebbe5](https://github.com/kiva/kv-ui-elements/commit/8bebbe5945dd4e34c922f9f511a4145564ae005a))
12
+
13
+
14
+
15
+
16
+
17
+ # [4.6.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@4.5.1...@kiva/kv-components@4.6.0) (2025-01-08)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * case when unreserved amount is greater first dropdown option ([af7bac1](https://github.com/kiva/kv-ui-elements/commit/af7bac155c18e902c7fe9594d75bd74ee966564a))
23
+ * edge cases for unreserved amount and select dropdown by default ([273e13f](https://github.com/kiva/kv-ui-elements/commit/273e13fa377277bf49684ea3032da56f0e5537ff))
24
+ * new cases for unreserved amount ([2de1302](https://github.com/kiva/kv-ui-elements/commit/2de1302de738d0f2489f56721efc30d1f6ab448a))
25
+ * remove lendCtaSelectedOption modification ([10c98d0](https://github.com/kiva/kv-ui-elements/commit/10c98d04bc72eba67591e6d7dbaf6347f5026bdf))
26
+ * resolve comments and add new cases in stories ([310c152](https://github.com/kiva/kv-ui-elements/commit/310c15273d21e2610f7e7bd67c46e5c6d5bf32d5))
27
+
28
+
29
+ ### Features
30
+
31
+ * add enableHugeAmount option to preset buttons ([c07a4b1](https://github.com/kiva/kv-ui-elements/commit/c07a4b1f74532b57f15a7aef9337659462c57b2e))
32
+ * new lendCta variant with preset options as buttons plus dropdown ([1e464a7](https://github.com/kiva/kv-ui-elements/commit/1e464a7518e77657deb59cadb90f78f1dc0db287))
33
+ * new line for dropdown when huge amount flag is enabled ([c66a90e](https://github.com/kiva/kv-ui-elements/commit/c66a90e6ac0e7b4bdc15ca28f681a97eab43dfca))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [4.5.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@4.5.0...@kiva/kv-components@4.5.1) (2025-01-04)
7
40
 
8
41
  **Note:** Version bump only for package @kiva/kv-components
@@ -54,10 +54,57 @@
54
54
  >
55
55
  <fieldset
56
56
  class="tw-w-full tw-flex"
57
+ :class="{'tw-flex-col tw-gap-1 md:tw-flex-row md:tw-justify-between': showPresetAmounts}"
57
58
  :disabled="isAdding"
58
59
  data-testid="bp-lend-cta-select-and-button"
59
60
  >
60
- <div class="amountDropdownWrapper">
61
+ <div
62
+ v-if="showPresetAmounts"
63
+ class="tw-flex tw-gap-1"
64
+ :class="{'tw-flex-wrap md:tw-flex-nowrap': enableHugeAmount}"
65
+ >
66
+ <template v-if="!isLendAmountButton">
67
+ <kv-ui-button
68
+ v-for="option in presetButtonsPrices"
69
+ :key="option"
70
+ variant="secondary"
71
+ class="tw-inline-flex tw-flex-1 preset-option tw-w-8"
72
+ :class="{'selected-option': selectedOption == option }"
73
+ data-testid="bp-lend-cta-lend-button"
74
+ type="submit"
75
+ @click="clickPresetButton(option)"
76
+ >
77
+ ${{ option }}
78
+ </kv-ui-button>
79
+ </template>
80
+ <kv-ui-select
81
+ v-if="showFilteredDropdown"
82
+ :id="`LoanAmountDropdown_${loanId}`"
83
+ v-model="selectedDropdownOption"
84
+ class="tw-min-w-12 tw-rounded filtered-dropdown"
85
+ :class="{
86
+ 'unselected-dropdown': !selectedDropdown,
87
+ 'selected-dropdown': selectedDropdown,
88
+ 'tw-w-full': enableHugeAmount
89
+ }"
90
+ aria-label="Lend amount"
91
+ @update:modelValue="trackLendAmountSelection"
92
+ @click.native.stop="clickDropdown"
93
+ >
94
+ <option
95
+ v-for="priceOption in presetDropdownPrices"
96
+ :key="priceOption"
97
+ :value="priceOption"
98
+ >
99
+ {{ priceOption !== 'Other' ? `$${priceOption}` : priceOption }}
100
+ </option>
101
+ </kv-ui-select>
102
+ </div>
103
+
104
+ <div
105
+ v-else-if="!showPresetAmounts"
106
+ class="amountDropdownWrapper"
107
+ >
61
108
  <kv-ui-select
62
109
  v-if="hideShowLendDropdown && !isLessThan25"
63
110
  :id="`LoanAmountDropdown_${loanId}`"
@@ -79,11 +126,17 @@
79
126
  </div>
80
127
 
81
128
  <!-- Lend button -->
82
- <div :class="{ 'lendButtonWrapper': hideShowLendDropdown }">
129
+ <div
130
+ :class="{
131
+ 'lendButtonWrapper': hideShowLendDropdown && !showPresetAmounts,
132
+ 'tw-hidden': isAdding && showPresetAmounts
133
+ }"
134
+ >
83
135
  <kv-ui-button
84
136
  v-if="lendButtonVisibility && !isLessThan25"
85
137
  key="lendButton"
86
138
  class="tw-inline-flex tw-flex-1"
139
+ :class="{'tw-w-full': showPresetAmounts }"
87
140
  data-testid="bp-lend-cta-lend-button"
88
141
  type="submit"
89
142
  >
@@ -95,6 +148,7 @@
95
148
  v-else-if="showLendAgain"
96
149
  key="lendAgainButton"
97
150
  class="lend-again"
151
+ :class="{'tw-w-full': showPresetAmounts }"
98
152
  data-testid="bp-lend-cta-lend-again-button"
99
153
  type="submit"
100
154
  >
@@ -218,10 +272,19 @@ export default {
218
272
  type: Function,
219
273
  default: undefined,
220
274
  },
275
+ showPresetAmounts: {
276
+ type: Boolean,
277
+ default: false,
278
+ },
279
+ kvTrackCategory: {
280
+ type: String,
281
+ default: 'Lending',
282
+ },
221
283
  },
222
284
  data() {
223
285
  return {
224
286
  mdiChevronRight,
287
+ defaultAmountOptions: [25, 50, 75],
225
288
  selectedOption: getLendCtaSelectedOption(
226
289
  this.getCookie,
227
290
  this.setCookie,
@@ -231,6 +294,7 @@ export default {
231
294
  this.userBalance,
232
295
  this.fiveDollarsSelected,
233
296
  ),
297
+ selectedDropdownOption: 'Other',
234
298
  };
235
299
  },
236
300
  computed: {
@@ -271,21 +335,49 @@ export default {
271
335
  this.isVisitor,
272
336
  );
273
337
  },
274
- ctaButtonText() {
275
- if (this.isCompleteLoanActive) {
276
- return this.primaryButtonText || 'Lend';
338
+ presetButtonsPrices() {
339
+ const prices = this.prices.slice(0, 3);
340
+
341
+ // Show only one extra option as button
342
+ if (this.prices.length === 4) {
343
+ prices.push(this.prices[3]);
277
344
  }
345
+
346
+ return prices;
347
+ },
348
+ presetDropdownPrices() {
349
+ // Hide dropdown if there is only one option
350
+ if (this.prices.length === 4) {
351
+ return [];
352
+ }
353
+
354
+ const extraDropdownPrices = this.prices.slice(this.defaultAmountOptions.length);
355
+ extraDropdownPrices.unshift('Other');
356
+
357
+ return extraDropdownPrices;
358
+ },
359
+ loanName() {
360
+ return this.loan?.name ?? '';
361
+ },
362
+ presetAmountCtaButtonText() {
363
+ return this.loan?.borrowerCount > 1 ? 'Support' : `Support ${this.loanName}`;
364
+ },
365
+ defaultCtaButtonText() {
366
+ if (this.showPresetAmounts) return this.presetAmountCtaButtonText;
367
+ return this.primaryButtonText || 'Lend';
368
+ },
369
+ ctaButtonText() {
278
370
  switch (this.state) {
279
371
  case 'loading':
280
372
  return 'Loading...';
281
373
  case 'refunded':
282
374
  case 'expired':
283
375
  default:
284
- return this.primaryButtonText || 'Lend';
376
+ return this.defaultCtaButtonText;
285
377
  }
286
378
  },
287
379
  loanInBasketButtonText() {
288
- return this.secondaryButtonText;
380
+ return this.showPresetAmounts ? 'Continue to basket' : this.secondaryButtonText;
289
381
  },
290
382
  useFormSubmit() {
291
383
  if (this.hideShowLendDropdown
@@ -347,18 +439,27 @@ export default {
347
439
  || this.isAmountBetween25And500(this.unreservedAmount));
348
440
  },
349
441
  isLendAmountButton() {
350
- return (this.lendButtonVisibility || this.state === 'lent-to')
351
- && this.isAmountLessThan25(this.unreservedAmount);
442
+ return ((this.lendButtonVisibility || this.state === 'lent-to')
443
+ && this.isAmountLessThan25(this.unreservedAmount));
352
444
  },
353
445
  isFunded() {
354
446
  return this.state === 'funded' || this.state === 'fully-reserved';
355
447
  },
356
448
  amountToLend() {
449
+ if (this.selectedDropdown) {
450
+ return this.selectedDropdownOption;
451
+ }
357
452
  return this.isLessThan25 ? this.unreservedAmount : this.selectedOption;
358
453
  },
359
454
  showLendAgain() {
360
455
  return this.isLentTo && !this.isLessThan25;
361
456
  },
457
+ selectedDropdown() {
458
+ return this.selectedDropdownOption !== 'Other';
459
+ },
460
+ showFilteredDropdown() {
461
+ return this.presetDropdownPrices.length > 1;
462
+ },
362
463
  },
363
464
  watch: {
364
465
  unreservedAmount(newValue, previousValue) {
@@ -371,14 +472,19 @@ export default {
371
472
  newValue,
372
473
  this.userBalance,
373
474
  this.fiveDollarsSelected,
475
+ this.showPresetAmounts,
374
476
  );
375
477
  }
478
+
479
+ if (this.showPresetAmounts) {
480
+ this.selectedOption = 'Other';
481
+ }
376
482
  },
377
483
  },
378
484
  methods: {
379
485
  async addToBasket() {
380
486
  this.kvTrackFunction(
381
- 'Lending',
487
+ this.kvTrackCategory,
382
488
  'Add to basket',
383
489
  this.showLendAgain ? 'Lend again' : 'lend-button-click',
384
490
  this.loanId,
@@ -396,8 +502,12 @@ export default {
396
502
  return unreservedAmount < 500 && unreservedAmount >= 25;
397
503
  },
398
504
  trackLendAmountSelection(selectedDollarAmount) {
505
+ if (this.showPresetAmounts) {
506
+ this.selectedOption = null;
507
+ }
508
+
399
509
  this.kvTrackFunction(
400
- 'Lending',
510
+ this.kvTrackCategory,
401
511
  'Modify lend amount',
402
512
  selectedDollarAmount,
403
513
  this.loanId,
@@ -405,7 +515,9 @@ export default {
405
515
  );
406
516
  },
407
517
  clickDropdown() {
408
- this.kvTrackFunction('Lending', 'click-Modify loan amount', 'open dialog', this.loanId, this.loanId);
518
+ this.kvTrackFunction(
519
+ this.kvTrackCategory, 'click-Modify loan amount', 'open dialog', this.loanId, this.loanId,
520
+ );
409
521
  },
410
522
  clickSecondaryButton(event) {
411
523
  if (this.secondaryButtonHandler) {
@@ -418,9 +530,15 @@ export default {
418
530
  this.handleCheckout();
419
531
  }
420
532
  },
533
+ clickPresetButton(selectedDollarAmount) {
534
+ this.kvTrackFunction(
535
+ this.kvTrackCategory, 'Modify lend amount', selectedDollarAmount, this.loanId, this.loanId,
536
+ );
537
+ this.selectedOption = selectedDollarAmount;
538
+ },
421
539
  handleCheckout() {
422
540
  this.kvTrackFunction(
423
- 'Lending',
541
+ this.kvTrackCategory,
424
542
  'click-Continue-to-checkout',
425
543
  'Continue to checkout',
426
544
  this.loanId,
@@ -448,4 +566,24 @@ export default {
448
566
  .lendButtonWrapper >>> span:first-child {
449
567
  border-radius: 0 14px 14px 0;
450
568
  }
569
+
570
+ .filtered-dropdown >>> select {
571
+ @apply tw-rounded tw-border-2 tw-font-medium tw-cursor-pointer;
572
+ }
573
+
574
+ .unselected-dropdown >>> select {
575
+ @apply tw-border-gray-400;
576
+ }
577
+
578
+ .selected-dropdown >>> select {
579
+ @apply tw-border-eco-green-4;
580
+ }
581
+
582
+ .preset-option >>> span.tw-w-full:first-child {
583
+ @apply tw-border-2 tw-border-gray-400;
584
+ }
585
+
586
+ .selected-option >>> span.tw-w-full:first-child {
587
+ @apply tw-border-eco-green-4;
588
+ }
451
589
  </style>
@@ -29,40 +29,69 @@
29
29
  <!-- Carousel Controls -->
30
30
  <div
31
31
  class="kv-carousel__controls tw-flex
32
- tw-justify-between md:tw-justify-center tw-items-center tw-gap-2
33
- tw-mt-2 tw-w-full"
32
+ tw-items-center tw-gap-2
33
+ tw-mt-2 tw-w-full
34
+ tw-justify-between md:tw-justify-center"
34
35
  >
35
- <button
36
- class="tw-text-primary
36
+ <div
37
+ class="tw-flex tw-gap-2 tw-w-full md:tw-w-auto"
38
+ :class="{'tw-justify-between md:tw-justify-center': !hasAutoplay}"
39
+ >
40
+ <button
41
+ class="tw-text-primary
37
42
  tw-rounded-full
38
43
  tw-border-2 tw-border-primary
39
44
  tw-h-4 tw-w-4
40
45
  tw-flex tw-items-center tw-justify-center
41
46
  disabled:tw-opacity-low disabled:tw-cursor-default"
42
- :disabled="embla && !embla.canScrollPrev()"
43
- @click="handleUserInteraction(previousIndex, 'click-left-arrow')"
44
- >
45
- <kv-material-icon
46
- class="tw-w-4"
47
- :icon="mdiChevronUp"
48
- />
49
- <span class="tw-sr-only">Show previous slide</span>
50
- </button>
47
+ :disabled="embla && !embla.canScrollPrev()"
48
+ @click="handleUserInteraction(previousIndex, 'click-left-arrow')"
49
+ >
50
+ <kv-material-icon
51
+ class="tw-w-4"
52
+ :icon="mdiChevronUp"
53
+ />
54
+ <span class="tw-sr-only">Show previous slide</span>
55
+ </button>
56
+ <button
57
+ class="tw-text-primary
58
+ tw-rounded-full
59
+ tw-border-2 tw-border-primary
60
+ tw-h-4 tw-w-4
61
+ tw-flex tw-items-center tw-justify-center
62
+ disabled:tw-opacity-low disabled:tw-cursor-default"
63
+ :disabled="embla && !embla.canScrollNext()"
64
+ @click="handleUserInteraction(nextIndex, 'click-right-arrow')"
65
+ >
66
+ <kv-material-icon
67
+ class="tw-w-4"
68
+ :icon="mdiChevronDown"
69
+ />
70
+ <span class="tw-sr-only">Show next slide</span>
71
+ </button>
72
+ </div>
73
+
51
74
  <button
75
+ v-if="hasAutoplay"
52
76
  class="tw-text-primary
53
77
  tw-rounded-full
54
78
  tw-border-2 tw-border-primary
55
79
  tw-h-4 tw-w-4
56
80
  tw-flex tw-items-center tw-justify-center
57
81
  disabled:tw-opacity-low disabled:tw-cursor-default"
58
- :disabled="embla && !embla.canScrollNext()"
59
- @click="handleUserInteraction(nextIndex, 'click-right-arrow')"
82
+ @click.native.prevent="toggleAutoPlay()"
60
83
  >
61
84
  <kv-material-icon
85
+ v-if="isAutoplaying"
62
86
  class="tw-w-4"
63
- :icon="mdiChevronDown"
87
+ :icon="mdiPause"
64
88
  />
65
- <span class="tw-sr-only">Show next slide</span>
89
+ <kv-material-icon
90
+ v-else
91
+ class="tw-w-4"
92
+ :icon="mdiPlay"
93
+ />
94
+ <span class="tw-sr-only">Show previous slide</span>
66
95
  </button>
67
96
  </div>
68
97
  </div>
@@ -70,9 +99,15 @@
70
99
 
71
100
  <script>
72
101
  import {
102
+ toRefs,
103
+ } from 'vue-demi';
104
+ import {
105
+ mdiPause,
106
+ mdiPlay,
73
107
  mdiChevronUp,
74
108
  mdiChevronDown,
75
109
  } from '@mdi/js';
110
+ import { computed } from 'vue';
76
111
  import { carouselUtil } from '../utils/carousels';
77
112
  import KvMaterialIcon from './KvMaterialIcon.vue';
78
113
 
@@ -129,6 +164,10 @@ export default {
129
164
  'interact-carousel',
130
165
  ],
131
166
  setup(props, { emit, slots }) {
167
+ const {
168
+ autoplayOptions,
169
+ } = toRefs(props);
170
+
132
171
  const {
133
172
  componentSlotKeys,
134
173
  currentIndex,
@@ -148,7 +187,12 @@ export default {
148
187
  toggleAutoPlay,
149
188
  } = carouselUtil(props, { emit, slots }, { axis: 'y' });
150
189
 
190
+ const hasAutoplay = computed(() => {
191
+ return Object.keys(autoplayOptions.value).length !== 0;
192
+ });
193
+
151
194
  return {
195
+ hasAutoplay,
152
196
  componentSlotKeys,
153
197
  currentIndex,
154
198
  embla,
@@ -156,6 +200,8 @@ export default {
156
200
  handleUserInteraction,
157
201
  isAriaHidden,
158
202
  isAutoplaying,
203
+ mdiPause,
204
+ mdiPlay,
159
205
  mdiChevronDown,
160
206
  mdiChevronUp,
161
207
  nextIndex,
@@ -1,3 +1,4 @@
1
+ import { watch } from 'vue';
1
2
  import KvCarousel from '../KvCarousel.vue';
2
3
  import KvLoadingSpinner from '../KvLoadingSpinner.vue';
3
4
  import KvButton from '../KvButton.vue';
@@ -444,14 +445,12 @@ export const AutoPlayButton = () => ({
444
445
  components: {
445
446
  KvCarousel,
446
447
  },
447
- data() {
448
- return {
449
- isPlaying: false,
450
- };
451
- },
448
+ data: () => ({
449
+ isAutoplaying: false,
450
+ }),
452
451
  mounted() {
453
- this.$nextTick(() => {
454
- this.isPlaying = this.$refs.sampleCarousel.isAutoplaying();
452
+ watch(() => this.$refs?.sampleCarousel?.isAutoplaying, (newValue) => {
453
+ this.isAutoplaying = newValue;
455
454
  });
456
455
  },
457
456
  template: `
@@ -461,34 +460,20 @@ export const AutoPlayButton = () => ({
461
460
  style="max-width: 400px;"
462
461
  :embla-options="{ loop: false }"
463
462
  :autoplay-options="{ playOnInit: true, delay: 3000 }"
464
- @interact-carousel="carouselInteraction"
465
463
  >
466
464
  ${defaultCarouselSlides}
467
465
  </kv-carousel>
468
- <a href="#" @click.native.prevent="toggleAutoPlay()" role="toggleAutoPlayButton">Toggle AutoPlay</a>
466
+ <a href="#" @click.native.prevent="$refs.sampleCarousel.toggleAutoPlay()" role="toggleAutoPlayButton">Toggle AutoPlay</a>
469
467
  <br/>
470
- <p>AutoPlay is: {{ isPlaying ? 'ON' : 'OFF' }}</p>
468
+ <p>AutoPlay is: {{ isAutoplaying ? 'ON' : 'OFF' }}</p>
471
469
  </div>
472
470
  `,
473
- methods: {
474
- toggleAutoPlay() {
475
- this.$refs.sampleCarousel.toggleAutoPlay();
476
- },
477
- carouselInteraction() {
478
- this.isPlaying = this.$refs.sampleCarousel.isAutoplaying();
479
- },
480
- },
481
471
  });
482
472
 
483
473
  export const Fade = () => ({
484
474
  components: {
485
475
  KvCarousel,
486
476
  },
487
- mounted() {
488
- this.$nextTick(() => {
489
- this.isPlaying = this.$refs.sampleCarousel.isAutoplaying();
490
- });
491
- },
492
477
  template: `
493
478
  <div>
494
479
  <kv-carousel
@@ -164,3 +164,169 @@ export const ViewLoanFunded = story({
164
164
  kvTrackFunction,
165
165
  showViewLoan: true,
166
166
  });
167
+
168
+ export const WithPresetOptions = story({
169
+ isLoading: false,
170
+ loan: {
171
+ id: 1,
172
+ name: 'John',
173
+ unreservedAmount: '150.00',
174
+ borrowerCount: 1,
175
+ },
176
+ kvTrackFunction,
177
+ showPresetAmounts: true,
178
+ });
179
+
180
+ export const WithPresetOptionsGroup = story({
181
+ isLoading: false,
182
+ loan: {
183
+ id: 1,
184
+ unreservedAmount: '150.00',
185
+ borrowerCount: 2,
186
+ },
187
+ kvTrackFunction,
188
+ showPresetAmounts: true,
189
+ });
190
+
191
+ export const WithPresetOptionsEqualThanLastAmount = story({
192
+ isLoading: false,
193
+ loan: {
194
+ id: 1,
195
+ unreservedAmount: '75.00',
196
+ borrowerCount: 2,
197
+ },
198
+ kvTrackFunction,
199
+ showPresetAmounts: true,
200
+ });
201
+
202
+ export const WithPresetOptionsLessThanLastAmount = story({
203
+ isLoading: false,
204
+ loan: {
205
+ id: 1,
206
+ unreservedAmount: '50.00',
207
+ borrowerCount: 2,
208
+ },
209
+ kvTrackFunction,
210
+ showPresetAmounts: true,
211
+ });
212
+
213
+ export const WithPresetOptionsLessThan25 = story({
214
+ isLoading: false,
215
+ loan: {
216
+ id: 1,
217
+ unreservedAmount: '10.00',
218
+ borrowerCount: 2,
219
+ },
220
+ kvTrackFunction,
221
+ showPresetAmounts: true,
222
+ });
223
+
224
+ export const WithPresetOptionsLessThan50 = story({
225
+ isLoading: false,
226
+ loan: {
227
+ id: 1,
228
+ unreservedAmount: '40.00',
229
+ borrowerCount: 2,
230
+ },
231
+ kvTrackFunction,
232
+ showPresetAmounts: true,
233
+ });
234
+
235
+ export const WithPresetOptionsLessThan100 = story({
236
+ isLoading: false,
237
+ loan: {
238
+ id: 1,
239
+ unreservedAmount: '80.00',
240
+ borrowerCount: 2,
241
+ },
242
+ kvTrackFunction,
243
+ showPresetAmounts: true,
244
+ });
245
+
246
+ export const WithPresetOptionsLessThan200 = story({
247
+ isLoading: false,
248
+ loan: {
249
+ id: 1,
250
+ unreservedAmount: '190.00',
251
+ borrowerCount: 2,
252
+ },
253
+ kvTrackFunction,
254
+ showPresetAmounts: true,
255
+ });
256
+
257
+ export const WithPresetOptionsHugeAmount = story({
258
+ isLoading: false,
259
+ loan: {
260
+ id: 1,
261
+ unreservedAmount: '12850.00',
262
+ },
263
+ kvTrackFunction,
264
+ enableHugeAmount: true,
265
+ isVisitor: false,
266
+ showPresetAmounts: true,
267
+ });
268
+
269
+ export const WithPresetOptionsLoading = story({
270
+ isLoading: true,
271
+ kvTrackFunction,
272
+ loan: {
273
+ id: 1,
274
+ unreservedAmount: '150.00',
275
+ borrowerCount: 2,
276
+ },
277
+ showPresetAmounts: true,
278
+ });
279
+
280
+ export const WithPresetOptionsAdding = story({
281
+ isLoading: false,
282
+ isAdding: true,
283
+ kvTrackFunction,
284
+ loan: {
285
+ id: 1,
286
+ unreservedAmount: '150.00',
287
+ borrowerCount: 2,
288
+ },
289
+ showPresetAmounts: true,
290
+ });
291
+
292
+ export const WithPresetOptionsBasketed = story({
293
+ isLoading: false,
294
+ loan: { id: 1 },
295
+ basketItems: [
296
+ {
297
+ __typename: 'LoanReservation',
298
+ id: 1,
299
+ },
300
+ ],
301
+ showPresetAmounts: true,
302
+ kvTrackFunction,
303
+ });
304
+
305
+ export const WithPresetOptionsBasketedWithSecondaryAction = story({
306
+ isLoading: false,
307
+ loan: { id: 1 },
308
+ basketItems: [
309
+ {
310
+ __typename: 'LoanReservation',
311
+ id: 1,
312
+ },
313
+ ],
314
+ externalLinks: true,
315
+ kvTrackFunction,
316
+ secondaryButtonHandler,
317
+ showPresetAmounts: true,
318
+ });
319
+
320
+ export const WithPresetOptionsFunded = story({
321
+ isLoading: false,
322
+ loan: { status: 'funded' },
323
+ kvTrackFunction,
324
+ showPresetAmounts: true,
325
+ });
326
+
327
+ export const WithPresetOptionsNonActionable = story({
328
+ isLoading: false,
329
+ loan: { status: 'refunded' },
330
+ kvTrackFunction,
331
+ showPresetAmounts: true,
332
+ });