@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.
@@ -1,325 +1,382 @@
1
- import B from "./KvCompactLoanCard2.js";
2
- import { KV_COMPACT_LOAN_CARD_FRAGMENT as nt, KV_COMPACT_LOAN_CARD_USER_FRAGMENT as lt } from "./KvCompactLoanCard2.js";
3
- import { resolveComponent as d, openBlock as o, createElementBlock as l, normalizeClass as s, createVNode as i, createCommentVNode as m, createElementVNode as r, normalizeStyle as b, createBlock as w, resolveDynamicComponent as u, withCtx as k, toDisplayString as c, withModifiers as R, Fragment as g, renderList as v } from "vue";
4
- import "./KvCompactLoanCard.css";
5
- import G from "../_virtual/_plugin-vue_export-helper.js";
6
- const S = ["aria-busy"], D = { class: "tw-flex tw-flex-col tw-items-start tw-w-full" }, U = {
7
- key: 1,
8
- class: "tw-flex-shrink-0 tw-overflow-hidden"
9
- }, I = {
10
- key: 0,
11
- class: "tw-mb-0.5 tw-w-full"
12
- }, W = { class: "tw-text-primary !tw-font-medium tw-text-base tw-leading-normal tw-truncate" }, E = ["href"], F = { class: "tw-truncate" }, O = ["title"], j = { class: "tw-font-medium" }, K = {
13
- key: 0,
14
- class: "loan-card-use-text tw-w-full tw-overflow-hidden"
15
- }, z = { class: "tw-flex-1 tw-min-w-0 tw-mr-1" }, H = {
16
- class: "tw-flex-1 tw-min-w-0",
17
- style: { "max-width": "6.5rem" }
18
- }, Z = ["value"], q = { class: "tw-flex-1 tw-min-w-0" }, J = { class: "tw-p-1 tw-rounded-l-sm tw-border tw-border-gray-100 tw-border-r-0" };
19
- function Q(f, n, e, t, X, y) {
20
- var L;
21
- const _ = d("kv-material-icon"), h = d("kv-loading-placeholder"), P = d("kv-borrower-image"), C = d("kv-loan-tag"), V = d("kv-loan-use"), M = d("kv-loan-callouts"), x = d("kv-loan-progress-group"), N = d("kv-select"), A = d("kv-lend-cta");
22
- return o(), l("div", {
23
- class: s(["tw-flex tw-flex-col tw-items-start tw-justify-between tw-p-1 tw-bg-white tw-rounded-md tw-shadow-lg tw-w-full", {
24
- "tw-relative": e.showRefreshButton,
25
- "!tw-p-1.5": e.showLightView || t.isPostGoalVariant
26
- }]),
27
- "aria-busy": t.isLoading ? "true" : "false"
28
- }, [
29
- e.showRefreshButton ? (o(), l("button", {
30
- key: 0,
31
- class: "tw-absolute tw--top-1 tw--right-1 tw-bg-white tw-rounded-full tw-w-2.5 tw-h-2.5 tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-drop-shadow-sm",
32
- onClick: n[0] || (n[0] = (...a) => t.handleRefreshButton && t.handleRefreshButton(...a))
33
- }, [
34
- i(_, {
35
- icon: t.mdiCached,
36
- class: "tw-w-2.5 tw-h-2.5 tw--scale-x-100 tw-text-gray-500"
37
- }, null, 8, ["icon"])
38
- ])) : m("", !0),
39
- r("div", D, [
40
- r("div", {
41
- class: s(["tw-flex tw-items-start tw-gap-2 tw-w-full loan-card-active-hover", {
42
- "!tw-gap-1": e.showLightView,
43
- "!tw-gap-1.5 md:!tw-gap-2.5": t.isPostGoalVariant
44
- }]),
45
- style: b(t.customStyle)
46
- }, [
47
- t.isLoading ? (o(), w(h, {
48
- key: 0,
49
- "aria-hidden": "true",
50
- class: s({
51
- "!tw-w-7.5 !tw-h-7.5": e.showLightView,
52
- "!tw-w-7.5 !tw-h-7.5 md:!tw-w-12.5 md:!tw-h-12.5": t.isPostGoalVariant
53
- }),
54
- style: b(t.borrowerImageStyle)
55
- }, null, 8, ["class", "style"])) : (o(), l("div", U, [
56
- (o(), w(u(t.tag), {
57
- to: t.readMorePath,
58
- href: t.readMorePath,
59
- target: e.externalLinksNewTab ? "_blank" : void 0,
60
- rel: e.externalLinksNewTab ? "noopener noreferrer" : void 0,
61
- class: "tw-flex",
62
- "aria-label": "Borrower image",
63
- onClick: n[1] || (n[1] = (a) => t.clickReadMore("Photo", a))
64
- }, {
65
- default: k(() => [
66
- i(P, {
67
- class: s(["tw-bg-gray-300 tw-rounded-sm tw-object-cover tw-bg-clip-content", {
68
- "!tw-w-7.5 !tw-h-7.5": e.showLightView,
69
- "!tw-w-7.5 !tw-h-7.5 md:!tw-w-12.5 md:!tw-h-12.5": t.isPostGoalVariant
70
- }]),
71
- style: b(t.borrowerImageStyle),
72
- alt: `Photo of ${t.borrowerName}`,
73
- "aspect-ratio": 1,
74
- "default-image": { width: 200, faceZoom: 50 },
75
- hash: t.imageHash,
76
- images: [{ width: 200, faceZoom: 50 }],
77
- "photo-path": e.photoPath
78
- }, null, 8, ["class", "style", "alt", "hash", "photo-path"])
79
- ]),
80
- _: 1
81
- }, 8, ["to", "href", "target", "rel"]))
82
- ])),
83
- r("div", {
84
- class: s(["tw-flex tw-flex-col tw-items-start tw-gap-1 tw-flex-1 tw-min-w-0", { "!tw-gap-0": t.isPostGoalVariant }])
85
- }, [
86
- e.businessName ? (o(), l("div", I, [
87
- (o(), w(u(t.tag), {
88
- to: t.readMorePath,
89
- href: t.readMorePath,
90
- target: e.externalLinksNewTab ? "_blank" : void 0,
91
- rel: e.externalLinksNewTab ? "noopener noreferrer" : void 0,
92
- class: "tw-no-underline hover:tw-underline focus:tw-no-underline",
93
- "aria-label": "Business name",
94
- onClick: n[2] || (n[2] = (a) => t.clickReadMore("Business", a))
95
- }, {
96
- default: k(() => [
97
- r("h3", W, c(e.businessName), 1)
98
- ]),
99
- _: 1
100
- }, 8, ["to", "href", "target", "rel"])),
101
- e.website ? (o(), l("a", {
102
- key: 0,
103
- href: t.formattedWebsite,
104
- target: "_blank",
105
- class: "tw-flex tw-items-center tw-gap-0.5 tw-text-secondary tw-text-small tw-font-light tw-leading-normal tw-no-underline hover:tw-underline",
106
- onClick: n[3] || (n[3] = R((...a) => t.trackWebsiteClick && t.trackWebsiteClick(...a), ["stop"]))
107
- }, [
108
- i(_, {
109
- icon: t.mdiLink,
110
- class: "tw-w-2 tw-h-2"
111
- }, null, 8, ["icon"]),
112
- r("span", F, c(e.website), 1)
113
- ], 8, E)) : m("", !0)
114
- ])) : m("", !0),
115
- t.isLoading ? m("", !0) : (o(), w(u(t.tag), {
116
- key: 1,
117
- to: t.readMorePath,
118
- href: t.readMorePath,
119
- target: e.externalLinksNewTab ? "_blank" : void 0,
120
- rel: e.externalLinksNewTab ? "noopener noreferrer" : void 0,
121
- class: "tw-flex tw-no-underline hover:tw-no-underline focus:tw-no-underline -tw-mt-1",
122
- "aria-label": "Loan tag",
123
- onClick: n[4] || (n[4] = (a) => t.clickReadMore("Tag", a))
124
- }, {
125
- default: k(() => [
126
- e.showTags ? (o(), w(C, {
127
- key: 0,
128
- class: s({
129
- "tw-mb-1 !tw-font-medium": t.isPostGoalVariant
130
- }),
131
- loan: e.loan,
132
- "enable-multi-matching": e.enableMultiMatching
133
- }, null, 8, ["class", "loan", "enable-multi-matching"])) : m("", !0)
134
- ]),
135
- _: 1
136
- }, 8, ["to", "href", "target", "rel"])),
137
- t.isPostGoalVariant ? (o(), l(g, { key: 2 }, [
138
- t.isLoading ? (o(), l(g, { key: 0 }, v(4, (a) => i(h, {
139
- key: a,
140
- class: "tw-mb-0.5 md:!tw-mb-1.5 !tw-w-full !tw-h-1.5 md:!tw-h-2"
141
- })), 64)) : (o(), l("p", {
142
- key: 1,
143
- class: "tw-text-small tw-mb-0 tw-leading-normal",
144
- style: { "line-height": "150%" },
145
- title: t.statementTitle,
146
- "data-testid": "loan-use-statement"
147
- }, [
148
- r("span", null, c(t.loanUsePrefixStart), 1),
149
- r("span", j, c(t.borrowerNameWithCountry), 1),
150
- r("span", null, c(t.loanUsePrefixEnd), 1),
151
- r("span", null, c(t.visibleUseStatement), 1)
152
- ], 8, O))
153
- ], 64)) : e.showLoanUse ? (o(), w(u(t.tag), {
154
- key: 3,
155
- to: t.readMorePath,
156
- href: t.readMorePath,
157
- target: e.externalLinksNewTab ? "_blank" : void 0,
158
- rel: e.externalLinksNewTab ? "noopener noreferrer" : void 0,
159
- class: "loan-card-use tw-no-underline tw-text-primary tw-block tw-w-full",
160
- "aria-label": "Loan use",
161
- onClick: n[5] || (n[5] = (a) => t.clickReadMore("Use", a))
162
- }, {
163
- default: k(() => [
164
- t.isLoading ? (o(), l("div", K, [
165
- (o(!0), l(g, null, v([...Array(t.loanUseLoadingRows)], (a, T) => (o(), l("div", {
166
- key: T,
167
- class: "tw-h-2 tw-mb-1"
168
- }, [
169
- i(h)
170
- ]))), 128))
171
- ])) : (o(), l("div", {
172
- key: 1,
173
- class: s(["loan-card-use-text tw-w-full tw-overflow-hidden", { "!tw--mt-1": e.showTags && y.hasMatchingInfo && e.showLightView }])
174
- }, [
175
- i(V, {
176
- use: t.loanUse,
177
- "loan-amount": t.loanAmount,
178
- status: t.loanStatus,
179
- "borrower-count": t.loanBorrowerCount,
180
- name: t.borrowerName,
181
- "distribution-model": t.distributionModel,
182
- "bold-name": !0,
183
- country: t.formattedLocation,
184
- "show-read-more": e.showLightView,
185
- "truncate-words-number": e.truncateWordsNumber,
186
- class: "tw-text-small tw-leading-tight"
187
- }, null, 8, ["use", "loan-amount", "status", "borrower-count", "name", "distribution-model", "country", "show-read-more", "truncate-words-number"])
188
- ], 2))
189
- ]),
190
- _: 1
191
- }, 8, ["to", "href", "target", "rel"])) : m("", !0)
192
- ], 2)
193
- ], 6),
194
- t.isLoading || typeof t.loanCallouts > "u" ? (o(), w(h, {
195
- key: 0,
196
- class: "tw-mt-1.5 tw-mb-1 tw-rounded-full",
197
- style: { width: "60%", height: "1.5rem" }
198
- })) : (o(), w(M, {
199
- key: 1,
200
- callouts: t.loanCallouts,
201
- class: s(["tw-mt-1.5", { "goal-variant-callouts": t.isPostGoalVariant }]),
202
- onClick: n[6] || (n[6] = (a) => f.$emit("jump-filter-page", a))
203
- }, null, 8, ["callouts", "class"]))
204
- ]),
205
- r("div", {
206
- class: s(["tw-flex tw-items-center tw-justify-between tw-w-full tw-mt-1", {
207
- "tw-gap-1": t.sharesAvailable,
208
- "!tw-items-end !tw-gap-2": t.isPostGoalVariant
209
- }])
210
- }, [
211
- t.hasProgressData ? t.isPostGoalVariant ? (o(), l(g, { key: 1 }, [
212
- r("div", H, [
213
- i(x, {
214
- "money-left": t.unreservedAmount,
215
- "progress-percent": t.fundraisingPercent,
216
- class: "tw-text-black goal-variant-progress-group"
217
- }, null, 8, ["money-left", "progress-percent"])
218
- ]),
219
- r("div", null, [
220
- i(N, {
221
- id: `PostGoalAmountDropdown_${((L = e.loan) == null ? void 0 : L.id) ?? e.loanId}`,
222
- modelValue: t.selectedAmount,
223
- "onUpdate:modelValue": [
224
- n[7] || (n[7] = (a) => t.selectedAmount = a),
225
- t.handleSelectedAmount
226
- ],
227
- "aria-label": "Lend amount",
228
- disabled: !t.amountOptions.length || y.isInBasket,
229
- class: "amount-dropdown"
230
- }, {
231
- default: k(() => [
232
- (o(!0), l(g, null, v(t.amountOptions, (a) => (o(), l("option", {
233
- key: a,
234
- value: a
235
- }, " $" + c(a), 9, Z))), 128))
236
- ]),
237
- _: 1
238
- }, 8, ["id", "modelValue", "disabled", "onUpdate:modelValue"])
239
- ])
240
- ], 64)) : (o(), l(g, { key: 2 }, [
241
- r("div", q, [
242
- t.sharesAvailable ? (o(), w(u(t.tag), {
243
- key: 0,
244
- to: t.readMorePath,
245
- href: t.readMorePath,
246
- target: e.externalLinksNewTab ? "_blank" : void 0,
247
- rel: e.externalLinksNewTab ? "noopener noreferrer" : void 0,
248
- class: "loan-card-progress tw-no-underline tw-block",
249
- "aria-label": "Loan progress",
250
- onClick: n[8] || (n[8] = (a) => t.clickReadMore("Progress", a))
251
- }, {
252
- default: k(() => [
253
- i(x, {
254
- id: "loanProgress",
255
- "money-left": t.unreservedAmount,
256
- "progress-percent": t.fundraisingPercent,
257
- class: "tw-text-black"
258
- }, null, 8, ["money-left", "progress-percent"])
259
- ]),
260
- _: 1
261
- }, 8, ["to", "href", "target", "rel"])) : m("", !0)
262
- ]),
263
- e.showLightView ? (o(), l("button", {
264
- key: 0,
265
- class: "tw-ml-2",
266
- onClick: n[9] || (n[9] = (a) => t.clickReadMore("View", a))
267
- }, [
268
- r("span", J, " $" + c(e.customAmountLent), 1),
269
- n[13] || (n[13] = r("span", { class: "tw-bg-gray-100 tw-px-1.5 tw-py-1 tw-rounded-r-sm tw-border tw-border-gray-100 tw-text-action tw-font-medium hover:tw-underline tw-text-center tw-cursor-pointer" }, " View ", -1))
270
- ])) : (o(), l("div", {
271
- key: 1,
272
- class: s(["tw-flex-shrink-0 loan-card-cta", { "tw-w-full": !t.sharesAvailable }]),
273
- style: { height: "40px" }
274
- }, [
275
- i(A, {
276
- loan: e.loan,
277
- "unreserved-amount": t.unreservedAmount,
278
- "basket-items": e.basketItems,
279
- "is-loading": t.isLoading,
280
- "is-adding": e.isAdding,
281
- "enable-five-dollars-notes": e.enableFiveDollarsNotes,
282
- "five-dollars-selected": e.fiveDollarsSelected,
283
- "kv-track-function": e.kvTrackFunction,
284
- "show-view-loan": e.showViewLoan,
285
- "custom-loan-details": e.customLoanDetails,
286
- "external-links": e.externalLinks,
287
- route: e.route,
288
- "user-balance": e.userBalance,
289
- "get-cookie": e.getCookie,
290
- "set-cookie": e.setCookie,
291
- "is-visitor": e.isVisitor,
292
- "primary-button-text": e.primaryButtonText,
293
- "secondary-button-text": e.secondaryButtonText,
294
- "secondary-button-handler": e.secondaryButtonHandler,
295
- onAddToBasket: n[10] || (n[10] = (a) => f.$emit("add-to-basket", a)),
296
- onShowLoanDetails: n[11] || (n[11] = (a) => t.clickReadMore("ViewLoan", a)),
297
- onRemoveFromBasket: n[12] || (n[12] = (a) => f.$emit("remove-from-basket", a))
298
- }, null, 8, ["loan", "unreserved-amount", "basket-items", "is-loading", "is-adding", "enable-five-dollars-notes", "five-dollars-selected", "kv-track-function", "show-view-loan", "custom-loan-details", "external-links", "route", "user-balance", "get-cookie", "set-cookie", "is-visitor", "primary-button-text", "secondary-button-text", "secondary-button-handler"])
299
- ], 2))
300
- ], 64)) : (o(), l(g, { key: 0 }, [
301
- r("div", z, [
302
- i(h, {
303
- class: "tw-mb-0.5",
304
- style: { width: "100%", maxWidth: "11rem", height: "1rem" }
305
- }),
306
- i(h, {
307
- class: "tw-rounded",
308
- style: { width: "100%", maxWidth: "11rem", height: "0.5rem" }
309
- })
310
- ]),
311
- t.allDataLoaded ? m("", !0) : (o(), w(h, {
312
- key: 0,
313
- class: "tw-rounded tw-flex-shrink-0",
314
- style: { width: "8rem", height: "2.5rem" }
315
- }))
316
- ], 64))
317
- ], 2)
318
- ], 10, S);
319
- }
320
- const et = /* @__PURE__ */ G(B, [["render", Q], ["__scopeId", "data-v-02aa45c6"]]);
1
+ import b from "graphql-tag";
2
+ import $ from "numeral";
3
+ import { ref as j, computed as a, watch as q } from "vue";
4
+ import { mdiArrowRight as H, mdiCached as z, mdiLink as J } from "@mdi/js";
5
+ import { LOAN_CALLOUTS_FRAGMENT as Q, LOAN_GEOCODE_FRAGMENT as X, LOAN_PROGRESS_FRAGMENT as Y, loanCardComputedProperties as Z, loanCardMethods as ee } from "../utils/loanCard.js";
6
+ import { getDropdownPriceArray as te, getLendCtaSelectedOption as ae, isLessThan25 as oe } from "../utils/loanUtils.js";
7
+ import { computePostGoalLoanCardStatement as ne } from "../utils/postGoalStatement.js";
8
+ import le from "./KvLoanUse2.js";
9
+ import ie from "./KvBorrowerImage.js";
10
+ import re from "./KvLoanCallouts.js";
11
+ import se from "./KvLendCta2.js";
12
+ import ue from "./KvLoanProgressGroup.js";
13
+ import de from "./KvLoanTag2.js";
14
+ import me from "./KvMaterialIcon.js";
15
+ import fe from "./KvLoadingPlaceholder.js";
16
+ import ce from "./KvLoanTeamPick.js";
17
+ import he from "./KvSelect.js";
18
+ import { KV_LEND_CTA_FRAGMENT as ve, KV_LEND_CTA_USER_FRAGMENT as ge } from "./KvLendCta.js";
19
+ import { KV_LOAN_TAG_FRAGMENT as Le } from "./KvLoanTag.js";
20
+ import { KV_LOAN_USE_FRAGMENT as ye } from "./KvLoanUse.js";
21
+ const d = {
22
+ default: "default",
23
+ postGoal: "post-goal",
24
+ lightDetailed: "light-detailed"
25
+ }, Ae = (e) => e < 500 && e >= 25, Ce = (e) => oe(e) || Ae(e), $e = b`
26
+ fragment KvCompactLoanCard on LoanBasic {
27
+ id
28
+ image {
29
+ id
30
+ hash
31
+ }
32
+ lenders(limit: 0) {
33
+ totalCount
34
+ }
35
+ loanFundraisingInfo {
36
+ id
37
+ fundedAmount
38
+ }
39
+ name
40
+ ...KvLendCta
41
+ ...KvLoanTag
42
+ ...KvLoanUse
43
+ ...LoanCallouts
44
+ ...LoanGeocode
45
+ ...LoanProgress
46
+ }
47
+ ${ve}
48
+ ${Le}
49
+ ${ye}
50
+ ${Q}
51
+ ${X}
52
+ ${Y}
53
+ `, je = b`
54
+ fragment KvCompactLoanCardUser on LoanBasic {
55
+ id
56
+ ...KvLendCtaUser
57
+ }
58
+ ${ge}
59
+ `, qe = {
60
+ name: "KvCompactLoanCard",
61
+ components: {
62
+ KvBorrowerImage: ie,
63
+ KvLoadingPlaceholder: fe,
64
+ KvLoanUse: le,
65
+ KvMaterialIcon: me,
66
+ KvLendCta: se,
67
+ KvLoanTag: de,
68
+ KvLoanCallouts: re,
69
+ KvLoanTeamPick: ce,
70
+ KvLoanProgressGroup: ue,
71
+ KvSelect: he
72
+ },
73
+ props: {
74
+ variant: {
75
+ type: String,
76
+ default: d.default,
77
+ validator: (e) => Object.values(d).includes(e)
78
+ },
79
+ loanId: {
80
+ type: Number,
81
+ default: void 0
82
+ },
83
+ loan: {
84
+ type: Object,
85
+ default: null
86
+ },
87
+ customLoanDetails: {
88
+ type: Boolean,
89
+ default: !1
90
+ },
91
+ showTags: {
92
+ type: Boolean,
93
+ default: !0
94
+ },
95
+ categoryPageName: {
96
+ type: String,
97
+ default: ""
98
+ },
99
+ enableFiveDollarsNotes: {
100
+ type: Boolean,
101
+ default: !1
102
+ },
103
+ isAdding: {
104
+ type: Boolean,
105
+ default: !1
106
+ },
107
+ isVisitor: {
108
+ type: Boolean,
109
+ default: !0
110
+ },
111
+ basketItems: {
112
+ type: Array,
113
+ default: () => []
114
+ },
115
+ kvTrackFunction: {
116
+ type: Function,
117
+ required: !0
118
+ },
119
+ photoPath: {
120
+ type: String,
121
+ required: !0
122
+ },
123
+ showViewLoan: {
124
+ type: Boolean,
125
+ default: !1
126
+ },
127
+ externalLinks: {
128
+ type: Boolean,
129
+ default: !1
130
+ },
131
+ externalLinksNewTab: {
132
+ type: Boolean,
133
+ default: !1
134
+ },
135
+ route: {
136
+ type: Object,
137
+ default: void 0
138
+ },
139
+ userBalance: {
140
+ type: String,
141
+ default: void 0
142
+ },
143
+ getCookie: {
144
+ type: Function,
145
+ default: void 0
146
+ },
147
+ setCookie: {
148
+ type: Function,
149
+ default: void 0
150
+ },
151
+ fiveDollarsSelected: {
152
+ type: Boolean,
153
+ default: !1
154
+ },
155
+ customCallouts: {
156
+ type: Array,
157
+ default: () => []
158
+ },
159
+ isTeamPick: {
160
+ type: Boolean,
161
+ default: !1
162
+ },
163
+ primaryButtonText: {
164
+ type: String,
165
+ default: "Lend"
166
+ },
167
+ secondaryButtonHandler: {
168
+ type: Function,
169
+ default: void 0
170
+ },
171
+ secondaryButtonText: {
172
+ type: String,
173
+ default: "Checkout now"
174
+ },
175
+ showContributors: {
176
+ type: Boolean,
177
+ default: !1
178
+ },
179
+ customHref: {
180
+ type: String,
181
+ default: ""
182
+ },
183
+ businessName: {
184
+ type: String,
185
+ default: ""
186
+ },
187
+ website: {
188
+ type: String,
189
+ default: ""
190
+ },
191
+ showLoanUse: {
192
+ type: Boolean,
193
+ default: !0
194
+ },
195
+ showLightView: {
196
+ type: Boolean,
197
+ default: !1
198
+ },
199
+ truncateWordsNumber: {
200
+ type: Number,
201
+ default: 0
202
+ },
203
+ showRefreshButton: {
204
+ type: Boolean,
205
+ default: !1
206
+ },
207
+ customAmountLent: {
208
+ type: String,
209
+ default: "25"
210
+ },
211
+ enableMultiMatching: {
212
+ type: Boolean,
213
+ default: !1
214
+ }
215
+ },
216
+ emits: [
217
+ "refresh-button",
218
+ "jump-filter-page",
219
+ "add-to-basket",
220
+ "remove-from-basket",
221
+ "show-loan-details",
222
+ "update:selected-amount"
223
+ ],
224
+ setup(e, { emit: o }) {
225
+ const l = j(""), m = a(
226
+ () => e.variant === d.postGoal
227
+ ), s = a(
228
+ () => e.variant === d.lightDetailed
229
+ ), c = a(
230
+ () => m.value || s.value
231
+ ), w = a(
232
+ () => e.showRefreshButton && !s.value
233
+ ), {
234
+ allDataLoaded: S,
235
+ borrowerName: h,
236
+ distributionModel: v,
237
+ formattedLocation: g,
238
+ fundraisingPercent: B,
239
+ hasProgressData: _,
240
+ imageHash: N,
241
+ isLoading: T,
242
+ loanAmount: f,
243
+ loanBorrowerCount: L,
244
+ loanCallouts: k,
245
+ loanStatus: y,
246
+ loanUse: A,
247
+ readMorePath: R,
248
+ tag: F,
249
+ unreservedAmount: u,
250
+ sharesAvailable: M
251
+ } = Z(e), { clickReadMore: K } = ee(e, o), P = a(() => c.value ? void 0 : { width: "100px", height: "100px" }), D = a(() => {
252
+ if (!e.website)
253
+ return "";
254
+ const t = e.website.trim();
255
+ return t.startsWith("http://") || t.startsWith("https://") ? t : `https://${t}`;
256
+ }), E = a(() => {
257
+ if (c.value) return {};
258
+ const t = e.showLightView ? "auto" : "6.75rem", n = e.showLightView ? "none" : "6.75rem";
259
+ return { height: t, maxHeight: n };
260
+ }), G = a(() => $(f.value).format("$0,0")), i = a(() => {
261
+ var t;
262
+ return ne({
263
+ anonymizationLevel: (t = e.loan) == null ? void 0 : t.anonymizationLevel,
264
+ borrowerName: h.value,
265
+ distributionModel: v.value,
266
+ formattedLocation: g.value,
267
+ loanAmount: f.value,
268
+ loanBorrowerCount: L.value,
269
+ loanStatus: y.value,
270
+ loanUse: A.value
271
+ });
272
+ }), O = a(() => i.value.borrowerNameWithCountry), U = a(() => i.value.loanUsePrefixStart), V = a(() => i.value.loanUsePrefixEnd), x = a(() => i.value.statementTitle), I = a(() => i.value.visibleUseStatement), C = a(() => {
273
+ var r;
274
+ const t = parseFloat(u.value);
275
+ if (!t) return [];
276
+ const n = t < 25 ? parseFloat(`${((r = e.loan) == null ? void 0 : r.minNoteSize) ?? 25}`) : 25;
277
+ return te(
278
+ u.value,
279
+ Ce(t),
280
+ n,
281
+ e.enableFiveDollarsNotes,
282
+ e.isVisitor
283
+ );
284
+ });
285
+ q(
286
+ C,
287
+ (t) => {
288
+ var r, p;
289
+ if (!m.value) return;
290
+ if (!t.length) {
291
+ l.value = "";
292
+ return;
293
+ }
294
+ const n = ae(
295
+ e.getCookie,
296
+ e.setCookie,
297
+ e.enableFiveDollarsNotes,
298
+ (p = (r = e.route) == null ? void 0 : r.query) == null ? void 0 : p.utm_campaign,
299
+ u.value,
300
+ e.userBalance ? parseFloat(e.userBalance) : void 0,
301
+ e.fiveDollarsSelected
302
+ );
303
+ l.value = t.includes(n) ? n : t[0];
304
+ },
305
+ { immediate: !0 }
306
+ );
307
+ const W = a(() => s.value ? 2 : e.showLightView ? 3 : 4);
308
+ return {
309
+ allDataLoaded: S,
310
+ amountOptions: C,
311
+ borrowerImageStyle: P,
312
+ borrowerName: h,
313
+ borrowerNameWithCountry: O,
314
+ lightDetailedAmount: G,
315
+ distributionModel: v,
316
+ formattedLocation: g,
317
+ formattedWebsite: D,
318
+ fundraisingPercent: B,
319
+ hasProgressData: _,
320
+ imageHash: N,
321
+ isLightDetailedVariant: s,
322
+ isLoading: T,
323
+ isPostGoalVariant: m,
324
+ loanAmount: f,
325
+ loanBorrowerCount: L,
326
+ loanCallouts: k,
327
+ loanStatus: y,
328
+ loanUse: A,
329
+ loanUsePrefixEnd: V,
330
+ loanUsePrefixStart: U,
331
+ mdiLink: J,
332
+ mdiCached: z,
333
+ mdiArrowRight: H,
334
+ readMorePath: R,
335
+ shouldShowRefreshButton: w,
336
+ tag: F,
337
+ unreservedAmount: u,
338
+ sharesAvailable: M,
339
+ selectedAmount: l,
340
+ statementTitle: x,
341
+ customStyle: E,
342
+ loanUseLoadingRows: W,
343
+ visibleUseStatement: I,
344
+ clickReadMore: K,
345
+ trackWebsiteClick: () => {
346
+ e.kvTrackFunction(
347
+ "Lending",
348
+ "click-Business Website",
349
+ "Website",
350
+ e.loanId
351
+ );
352
+ },
353
+ handleRefreshButton: (t) => {
354
+ o("refresh-button", t);
355
+ },
356
+ handleSelectedAmount: (t) => {
357
+ var n;
358
+ l.value = t, o("update:selected-amount", t), e.kvTrackFunction(
359
+ "Lending",
360
+ "Modify lend amount",
361
+ t,
362
+ e.loanId ?? ((n = e.loan) == null ? void 0 : n.id)
363
+ );
364
+ }
365
+ };
366
+ },
367
+ computed: {
368
+ isInBasket() {
369
+ var e;
370
+ return ((e = this.basketItems) == null ? void 0 : e.some((o) => o.__typename === "LoanReservation" && o.id === this.loanId)) ?? !1;
371
+ },
372
+ hasMatchingInfo() {
373
+ var e, o, l;
374
+ return !!((e = this.loan) != null && e.matchingText) || this.enableMultiMatching && (((l = (o = this.loan) == null ? void 0 : o.simultaneousMatching) == null ? void 0 : l.length) ?? 0) > 0;
375
+ }
376
+ }
377
+ };
321
378
  export {
322
- nt as KV_COMPACT_LOAN_CARD_FRAGMENT,
323
- lt as KV_COMPACT_LOAN_CARD_USER_FRAGMENT,
324
- et as default
379
+ $e as KV_COMPACT_LOAN_CARD_FRAGMENT,
380
+ je as KV_COMPACT_LOAN_CARD_USER_FRAGMENT,
381
+ qe as default
325
382
  };