@kiva/kv-components 10.4.1 → 10.5.1
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/dist/index.js +271 -271
- package/dist/vue/KvClassicLoanCard.js +295 -252
- package/dist/vue/KvClassicLoanCard2.js +252 -295
- package/dist/vue/KvCompactLoanCard.css +1 -1
- package/dist/vue/KvCompactLoanCard.js +380 -323
- package/dist/vue/KvCompactLoanCard.vue.d.ts +14 -8
- package/dist/vue/KvCompactLoanCard2.js +416 -386
- package/dist/vue/KvIntroductionLoanCard.js +220 -247
- package/dist/vue/KvIntroductionLoanCard2.js +247 -220
- package/dist/vue/KvLendCta.js +389 -355
- package/dist/vue/KvLendCta2.js +355 -389
- package/dist/vue/KvLoanActivities.js +149 -75
- package/dist/vue/KvLoanActivities2.js +75 -149
- package/dist/vue/KvLoanBookmark.js +33 -22
- package/dist/vue/KvLoanBookmark2.js +22 -33
- package/dist/vue/KvLoanInfoCard.js +2 -2
- package/dist/vue/KvLoanTag.js +123 -44
- package/dist/vue/KvLoanTag2.js +44 -123
- package/dist/vue/KvLoanUse.js +111 -14
- package/dist/vue/KvLoanUse.vue.d.ts +9 -0
- package/dist/vue/KvLoanUse2.js +14 -104
- package/dist/vue/KvWideLoanCard.js +232 -206
- package/dist/vue/KvWideLoanCard2.js +206 -232
- package/dist/vue/KvWwwHeader/KvHeaderLinkBar2.js +1 -1
- package/dist/vue/KvWwwHeaderBasic/LinkBar2.js +1 -1
- package/package.json +8 -4
package/dist/vue/KvLendCta.js
CHANGED
|
@@ -1,357 +1,391 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
|
|
1
|
+
import u from "graphql-tag";
|
|
2
|
+
import { mdiChevronRight as d } from "@mdi/js";
|
|
3
|
+
import { throttle as h } from "../utils/throttle.js";
|
|
4
|
+
import { getLendCtaSelectedOption as o, getDropdownPriceArray as l } from "../utils/loanUtils.js";
|
|
5
|
+
import c from "./KvLendAmountButton.js";
|
|
6
|
+
import p from "./KvSelect.js";
|
|
7
|
+
import m from "./KvButton.js";
|
|
8
|
+
import f from "./KvMaterialIcon.js";
|
|
9
|
+
const n = "Other", v = 360, r = 480, a = 380, O = u`
|
|
10
|
+
fragment KvLendCta on LoanBasic {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
status
|
|
14
|
+
minNoteSize
|
|
15
|
+
}
|
|
16
|
+
`, b = u`
|
|
17
|
+
fragment KvLendCtaUser on LoanBasic {
|
|
18
|
+
id
|
|
19
|
+
userProperties {
|
|
20
|
+
lentTo
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`, D = {
|
|
24
|
+
name: "KvLendCta",
|
|
25
|
+
components: {
|
|
26
|
+
KvLendAmountButton: c,
|
|
27
|
+
KvUiButton: m,
|
|
28
|
+
KvUiSelect: p,
|
|
29
|
+
KvMaterialIcon: f
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
loan: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({})
|
|
35
|
+
},
|
|
36
|
+
unreservedAmount: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
},
|
|
40
|
+
basketItems: {
|
|
41
|
+
type: Array,
|
|
42
|
+
default: () => []
|
|
43
|
+
},
|
|
44
|
+
isLoading: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: !0
|
|
47
|
+
},
|
|
48
|
+
isAdding: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
enableFiveDollarsNotes: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
kvTrackFunction: {
|
|
57
|
+
type: Function,
|
|
58
|
+
required: !0
|
|
59
|
+
},
|
|
60
|
+
showViewLoan: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !1
|
|
63
|
+
},
|
|
64
|
+
customLoanDetails: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !1
|
|
67
|
+
},
|
|
68
|
+
externalLinks: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !1
|
|
71
|
+
},
|
|
72
|
+
route: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
userBalance: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: void 0
|
|
79
|
+
},
|
|
80
|
+
getCookie: {
|
|
81
|
+
type: Function,
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
84
|
+
setCookie: {
|
|
85
|
+
type: Function,
|
|
86
|
+
default: void 0
|
|
87
|
+
},
|
|
88
|
+
fiveDollarsSelected: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !1
|
|
91
|
+
},
|
|
92
|
+
isVisitor: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: !0
|
|
95
|
+
},
|
|
96
|
+
primaryButtonText: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: "Lend"
|
|
99
|
+
},
|
|
100
|
+
secondaryButtonText: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: void 0
|
|
103
|
+
},
|
|
104
|
+
secondaryButtonHandler: {
|
|
105
|
+
type: Function,
|
|
106
|
+
default: void 0
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* Hide preset buttons under this amount when
|
|
110
|
+
* showPresetAmounts is true
|
|
111
|
+
* */
|
|
112
|
+
maxAmount: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: ""
|
|
115
|
+
},
|
|
116
|
+
showPresetAmounts: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: !1
|
|
119
|
+
},
|
|
120
|
+
kvTrackCategory: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: "Lending"
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Breakpoint for narrow desktop layout (default: 480px)
|
|
126
|
+
* When component width is below this, it will use stacked layout even on desktop
|
|
127
|
+
*/
|
|
128
|
+
narrowSidebarBreakpoint: {
|
|
129
|
+
type: Number,
|
|
130
|
+
default: r
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* Breakpoint for narrow desktop dropdown layout (default: 380px)
|
|
134
|
+
* When component width is below this in narrow desktop mode, dropdown moves to second row
|
|
135
|
+
*/
|
|
136
|
+
narrowSidebarDropdownBreakpoint: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: a
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
emits: [
|
|
142
|
+
"show-loan-details",
|
|
143
|
+
"add-to-basket"
|
|
144
|
+
],
|
|
145
|
+
data() {
|
|
146
|
+
var t, e;
|
|
147
|
+
return {
|
|
148
|
+
mdiChevronRight: d,
|
|
149
|
+
defaultAmountOptions: [25, 50, 75],
|
|
150
|
+
selectedOption: o(
|
|
151
|
+
this.getCookie,
|
|
152
|
+
this.setCookie,
|
|
153
|
+
this.enableFiveDollarsNotes,
|
|
154
|
+
(e = (t = this.route) == null ? void 0 : t.query) == null ? void 0 : e.utm_campaign,
|
|
155
|
+
this.unreservedAmount,
|
|
156
|
+
this.userBalance ? parseFloat(this.userBalance) : void 0,
|
|
157
|
+
this.fiveDollarsSelected
|
|
158
|
+
),
|
|
159
|
+
selectedDropdownOption: n,
|
|
160
|
+
OTHER_OPTION: n,
|
|
161
|
+
// SSR-safe viewport width initialization
|
|
162
|
+
viewportWidth: typeof window < "u" ? window.innerWidth : 1024,
|
|
163
|
+
componentWidth: 1024,
|
|
164
|
+
resizeObserver: null,
|
|
165
|
+
MOBILE_DROPDOWN_BREAKPOINT: v,
|
|
166
|
+
NARROW_SIDEBAR_BREAKPOINT: r,
|
|
167
|
+
NARROW_SIDEBAR_DROPDOWN_BREAKPOINT: a
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
computed: {
|
|
171
|
+
readMorePath() {
|
|
172
|
+
return this.customLoanDetails ? "" : `/lend/${this.loanId}`;
|
|
173
|
+
},
|
|
174
|
+
loanId() {
|
|
175
|
+
var t;
|
|
176
|
+
return (t = this.loan) == null ? void 0 : t.id;
|
|
177
|
+
},
|
|
178
|
+
status() {
|
|
179
|
+
var t;
|
|
180
|
+
return ((t = this.loan) == null ? void 0 : t.status) ?? "";
|
|
181
|
+
},
|
|
182
|
+
minNoteSize() {
|
|
183
|
+
var t;
|
|
184
|
+
return ((t = this.loan) == null ? void 0 : t.minNoteSize) ?? "";
|
|
185
|
+
},
|
|
186
|
+
lentPreviously() {
|
|
187
|
+
var t, e;
|
|
188
|
+
return ((e = (t = this.loan) == null ? void 0 : t.userProperties) == null ? void 0 : e.lentTo) ?? !1;
|
|
189
|
+
},
|
|
190
|
+
isInBasket() {
|
|
191
|
+
var t;
|
|
192
|
+
return ((t = this.basketItems) == null ? void 0 : t.some((e) => e.__typename === "LoanReservation" && e.id === this.loanId)) ?? !1;
|
|
193
|
+
},
|
|
194
|
+
prices() {
|
|
195
|
+
const t = parseFloat(this.unreservedAmount < 25 ? this.minNoteSize : 25), e = l(
|
|
196
|
+
this.unreservedAmount,
|
|
197
|
+
this.isCompleteLoanActive,
|
|
198
|
+
t,
|
|
199
|
+
this.enableFiveDollarsNotes,
|
|
200
|
+
this.isVisitor
|
|
201
|
+
);
|
|
202
|
+
return this.maxAmount ? e.filter((s) => parseFloat(s) <= parseFloat(this.maxAmount)) : e;
|
|
203
|
+
},
|
|
204
|
+
presetButtonsPrices() {
|
|
205
|
+
const t = this.prices.slice(0, 3);
|
|
206
|
+
return this.prices.length === 4 && t.push(this.prices[3]), t;
|
|
207
|
+
},
|
|
208
|
+
presetDropdownPrices() {
|
|
209
|
+
if (this.prices.length === 4)
|
|
210
|
+
return [];
|
|
211
|
+
const t = this.prices.slice(this.defaultAmountOptions.length);
|
|
212
|
+
return t.unshift(n), t;
|
|
213
|
+
},
|
|
214
|
+
loanName() {
|
|
215
|
+
var t;
|
|
216
|
+
return ((t = this.loan) == null ? void 0 : t.name) ?? "";
|
|
217
|
+
},
|
|
218
|
+
presetAmountCtaButtonText() {
|
|
219
|
+
var t;
|
|
220
|
+
return ((t = this.loan) == null ? void 0 : t.borrowerCount) > 1 ? "Support" : `Support ${this.loanName}`;
|
|
221
|
+
},
|
|
222
|
+
defaultCtaButtonText() {
|
|
223
|
+
return this.showPresetAmounts ? this.presetAmountCtaButtonText : this.primaryButtonText || "Lend";
|
|
224
|
+
},
|
|
225
|
+
ctaButtonText() {
|
|
226
|
+
switch (this.state) {
|
|
227
|
+
case "loading":
|
|
228
|
+
return "Loading...";
|
|
229
|
+
case "refunded":
|
|
230
|
+
case "expired":
|
|
231
|
+
default:
|
|
232
|
+
return this.defaultCtaButtonText;
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
loanInBasketButtonText() {
|
|
236
|
+
return this.secondaryButtonText ? this.secondaryButtonText : this.showPresetAmounts ? "Continue to basket" : "Checkout now";
|
|
237
|
+
},
|
|
238
|
+
useFormSubmit() {
|
|
239
|
+
return !!(this.hideShowLendDropdown || this.lendButtonVisibility || this.showLendAgain || this.state === "lent-to" || this.isAdding);
|
|
240
|
+
},
|
|
241
|
+
state() {
|
|
242
|
+
return this.isLoading ? "loading" : this.isAdding ? "adding" : this.isInBasket ? "basketed" : this.status === "funded" || this.status === "refunded" || this.status === "expired" ? this.status : this.allSharesReserved ? "fully-reserved" : this.lentPreviously ? "lent-to" : "lend";
|
|
243
|
+
},
|
|
244
|
+
lendButtonVisibility() {
|
|
245
|
+
return this.state === "lend" || this.state === "loading";
|
|
246
|
+
},
|
|
247
|
+
showNonActionableLoanButton() {
|
|
248
|
+
return this.state === "refunded" || this.state === "expired";
|
|
249
|
+
},
|
|
250
|
+
hideShowLendDropdown() {
|
|
251
|
+
return this.state === "lend" || this.state === "lent-to";
|
|
252
|
+
},
|
|
253
|
+
allSharesReserved() {
|
|
254
|
+
return parseFloat(this.unreservedAmount) === 0;
|
|
255
|
+
},
|
|
256
|
+
isLessThan25() {
|
|
257
|
+
return this.enableFiveDollarsNotes ? !1 : this.isAmountLessThan25(this.unreservedAmount);
|
|
258
|
+
},
|
|
259
|
+
isLentTo() {
|
|
260
|
+
return this.state === "lent-to";
|
|
261
|
+
},
|
|
262
|
+
isCompleteLoanActive() {
|
|
263
|
+
return this.isAmountLessThan25(this.unreservedAmount) || this.isAmountBetween25And500(this.unreservedAmount);
|
|
264
|
+
},
|
|
265
|
+
isLendAmountButton() {
|
|
266
|
+
const t = this.maxAmount ? this.maxAmount : this.unreservedAmount;
|
|
267
|
+
return (this.lendButtonVisibility || this.state === "lent-to") && this.isAmountLessThan25(t) || this.showPresetAmounts && this.presetButtonsPrices.length === 1 && !this.isAdding;
|
|
268
|
+
},
|
|
269
|
+
isFunded() {
|
|
270
|
+
return this.state === "funded" || this.state === "fully-reserved";
|
|
271
|
+
},
|
|
272
|
+
amountToLend() {
|
|
273
|
+
return this.selectedDropdown ? this.selectedDropdownOption : this.isLessThan25 ? this.unreservedAmount : this.selectedOption;
|
|
274
|
+
},
|
|
275
|
+
amountForLendAmountButton() {
|
|
276
|
+
return this.maxAmount && parseFloat(this.maxAmount) === 25 ? Math.min(parseFloat(this.maxAmount), parseFloat(this.unreservedAmount)) : this.unreservedAmount;
|
|
277
|
+
},
|
|
278
|
+
showLendAgain() {
|
|
279
|
+
return this.isLentTo && !this.isLessThan25;
|
|
280
|
+
},
|
|
281
|
+
selectedDropdown() {
|
|
282
|
+
return this.selectedDropdownOption !== n;
|
|
283
|
+
},
|
|
284
|
+
showFilteredDropdown() {
|
|
285
|
+
return this.presetDropdownPrices.length > 1;
|
|
286
|
+
},
|
|
287
|
+
hideLendButton() {
|
|
288
|
+
return this.showPresetAmounts && (this.isAdding || this.presetButtonsPrices.length === 1);
|
|
289
|
+
},
|
|
290
|
+
/**
|
|
291
|
+
* Determines if component should use narrow desktop layout
|
|
292
|
+
* This is true when we're in desktop viewport but component width is narrow
|
|
293
|
+
*/
|
|
294
|
+
isNarrowDesktop() {
|
|
295
|
+
return this.viewportWidth >= 768 && this.componentWidth < this.narrowSidebarBreakpoint;
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
watch: {
|
|
299
|
+
unreservedAmount(t, e) {
|
|
300
|
+
var s, i;
|
|
301
|
+
t !== e && e === "" && (this.selectedOption = o(
|
|
302
|
+
this.getCookie,
|
|
303
|
+
this.setCookie,
|
|
304
|
+
this.enableFiveDollarsNotes,
|
|
305
|
+
(i = (s = this.route) == null ? void 0 : s.query) == null ? void 0 : i.utm_campaign,
|
|
306
|
+
t,
|
|
307
|
+
this.userBalance ? parseFloat(this.userBalance) : void 0,
|
|
308
|
+
this.fiveDollarsSelected
|
|
309
|
+
)), this.showPresetAmounts && (this.selectedOption = n);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
mounted() {
|
|
313
|
+
const t = () => {
|
|
314
|
+
var e;
|
|
315
|
+
this.viewportWidth = window.innerWidth, this.componentWidth = ((e = this.$refs.root) == null ? void 0 : e.offsetWidth) || 1024;
|
|
316
|
+
};
|
|
317
|
+
typeof window < "u" && (this.viewportWidth = window.innerWidth, window.ResizeObserver && this.$nextTick(() => {
|
|
318
|
+
this.resizeObserver = new window.ResizeObserver(h(t, 50)), this.$refs.root && (this.resizeObserver.observe(this.$refs.root), t());
|
|
319
|
+
}));
|
|
320
|
+
},
|
|
321
|
+
beforeUnmount() {
|
|
322
|
+
this.resizeHandler && typeof window < "u" && window.removeEventListener("resize", this.resizeHandler), this.resizeObserver && this.$refs.root && this.resizeObserver.disconnect();
|
|
323
|
+
},
|
|
324
|
+
methods: {
|
|
325
|
+
async addToBasket() {
|
|
326
|
+
this.kvTrackFunction(
|
|
327
|
+
this.kvTrackCategory,
|
|
328
|
+
"Add to basket",
|
|
329
|
+
this.showLendAgain ? "Lend again" : "lend-button-click",
|
|
330
|
+
this.loanId,
|
|
331
|
+
this.amountToLend
|
|
332
|
+
), this.$emit("add-to-basket", this.amountToLend);
|
|
333
|
+
},
|
|
334
|
+
isAmountLessThan25(t) {
|
|
335
|
+
return t < 25 && t > 0;
|
|
336
|
+
},
|
|
337
|
+
isAmountBetween25And50(t) {
|
|
338
|
+
return t <= 50 && t > 25;
|
|
339
|
+
},
|
|
340
|
+
isAmountBetween25And500(t) {
|
|
341
|
+
return t < 500 && t >= 25;
|
|
342
|
+
},
|
|
343
|
+
trackLendAmountSelection(t) {
|
|
344
|
+
this.showPresetAmounts && (this.selectedOption = null), this.kvTrackFunction(
|
|
345
|
+
this.kvTrackCategory,
|
|
346
|
+
"Modify lend amount",
|
|
347
|
+
t,
|
|
348
|
+
this.loanId,
|
|
349
|
+
this.loanId
|
|
350
|
+
);
|
|
351
|
+
},
|
|
352
|
+
clickDropdown() {
|
|
353
|
+
this.kvTrackFunction(
|
|
354
|
+
this.kvTrackCategory,
|
|
355
|
+
"click-Modify loan amount",
|
|
356
|
+
"open dialog",
|
|
357
|
+
this.loanId,
|
|
358
|
+
this.loanId
|
|
359
|
+
);
|
|
360
|
+
},
|
|
361
|
+
clickSecondaryButton(t) {
|
|
362
|
+
this.secondaryButtonHandler ? (t.preventDefault(), t.stopPropagation(), this.secondaryButtonHandler()) : this.handleCheckout();
|
|
363
|
+
},
|
|
364
|
+
clickPresetButton(t) {
|
|
365
|
+
this.kvTrackFunction(
|
|
366
|
+
this.kvTrackCategory,
|
|
367
|
+
"Modify lend amount",
|
|
368
|
+
t,
|
|
369
|
+
this.loanId,
|
|
370
|
+
this.loanId
|
|
371
|
+
), this.selectedOption = t, this.selectedDropdownOption = n;
|
|
372
|
+
},
|
|
373
|
+
handleCheckout() {
|
|
374
|
+
this.kvTrackFunction(
|
|
375
|
+
this.kvTrackCategory,
|
|
376
|
+
"click-Continue-to-checkout",
|
|
377
|
+
"Continue to checkout",
|
|
378
|
+
this.loanId,
|
|
379
|
+
this.loanId
|
|
380
|
+
);
|
|
381
|
+
},
|
|
382
|
+
isNarrowComponent() {
|
|
383
|
+
return this.componentWidth < 430;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
353
387
|
export {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
388
|
+
O as KV_LEND_CTA_FRAGMENT,
|
|
389
|
+
b as KV_LEND_CTA_USER_FRAGMENT,
|
|
390
|
+
D as default
|
|
357
391
|
};
|