@kiva/kv-components 6.13.2 → 6.14.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/assets/icons/bluesky.js +8 -7
- package/dist/index.js +178 -163
- package/dist/utils/loanCard.js +128 -87
- package/dist/vue/KvClassicLoanCard.css +1 -1
- package/dist/vue/KvClassicLoanCard.js +144 -100
- package/dist/vue/KvIntroductionLoanCard.css +1 -1
- package/dist/vue/KvIntroductionLoanCard.js +135 -95
- package/dist/vue/KvLendCta.css +1 -1
- package/dist/vue/KvLendCta.js +98 -81
- package/dist/vue/KvLoanActivities.css +1 -1
- package/dist/vue/KvLoanActivities.js +49 -36
- package/dist/vue/KvLoanBookmark.js +24 -15
- package/dist/vue/KvLoanTag.js +51 -28
- package/dist/vue/KvLoanUse.js +24 -10
- package/dist/vue/KvWideLoanCard.css +1 -1
- package/dist/vue/KvWideLoanCard.js +134 -99
- package/package.json +4 -2
package/dist/utils/loanCard.js
CHANGED
|
@@ -1,124 +1,165 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import R from "graphql-tag";
|
|
2
|
+
import ee from "numeral";
|
|
3
|
+
import { toRefs as ne, computed as n } from "vue";
|
|
4
|
+
import { mdiMapMarker as Le } from "@mdi/js";
|
|
5
|
+
const ye = "N/A", te = "ECO-FRIENDLY", ae = "SUSTAINABLE AG", oe = "SINGLE PARENT", Ee = "REFUGEES/DISPLACED", P = (c, p) => (c == null ? void 0 : c.find((v) => v.name.replace("#", "").toUpperCase() === p.toUpperCase())) ?? {}, Pe = R`
|
|
6
|
+
fragment LoanCallouts on LoanBasic {
|
|
7
|
+
id
|
|
8
|
+
activity {
|
|
9
|
+
id
|
|
10
|
+
name
|
|
11
|
+
}
|
|
12
|
+
sector {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
}
|
|
16
|
+
tags
|
|
17
|
+
... on LoanPartner {
|
|
18
|
+
partnerName
|
|
19
|
+
themes
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`, Re = R`
|
|
23
|
+
fragment LoanGeocode on LoanBasic {
|
|
24
|
+
id
|
|
25
|
+
geocode {
|
|
26
|
+
city
|
|
27
|
+
state
|
|
28
|
+
country {
|
|
29
|
+
name
|
|
30
|
+
isoCode
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`, Me = R`
|
|
35
|
+
fragment LoanProgress on LoanBasic {
|
|
36
|
+
id
|
|
37
|
+
loanAmount
|
|
38
|
+
loanFundraisingInfo {
|
|
39
|
+
id
|
|
40
|
+
fundedAmount
|
|
41
|
+
reservedAmount
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
function Fe(c, p = !1) {
|
|
5
46
|
const {
|
|
6
|
-
externalLinks:
|
|
7
|
-
customLoanDetails:
|
|
8
|
-
loanId:
|
|
47
|
+
externalLinks: v,
|
|
48
|
+
customLoanDetails: L,
|
|
49
|
+
loanId: h,
|
|
9
50
|
loan: t,
|
|
10
|
-
categoryPageName:
|
|
11
|
-
customCallouts:
|
|
12
|
-
} =
|
|
51
|
+
categoryPageName: d,
|
|
52
|
+
customCallouts: y
|
|
53
|
+
} = ne(c), se = n(() => v.value ? "a" : "router-link"), le = n(() => L.value ? "" : `/lend/${h.value}`), M = n(() => !h.value || !t.value), re = n(() => {
|
|
13
54
|
var e;
|
|
14
55
|
return ((e = t.value) == null ? void 0 : e.name) || "";
|
|
15
|
-
}),
|
|
16
|
-
var e, a,
|
|
17
|
-
return ((
|
|
18
|
-
}),
|
|
19
|
-
var e, a,
|
|
20
|
-
return ((
|
|
21
|
-
}),
|
|
56
|
+
}), f = n(() => {
|
|
57
|
+
var e, a, s;
|
|
58
|
+
return ((s = (a = (e = t.value) == null ? void 0 : e.geocode) == null ? void 0 : a.country) == null ? void 0 : s.name) || "";
|
|
59
|
+
}), ue = n(() => {
|
|
60
|
+
var e, a, s;
|
|
61
|
+
return ((s = (a = (e = t.value) == null ? void 0 : e.geocode) == null ? void 0 : a.country) == null ? void 0 : s.isoCode) || "";
|
|
62
|
+
}), E = n(() => {
|
|
22
63
|
var e, a;
|
|
23
64
|
return ((a = (e = t.value) == null ? void 0 : e.geocode) == null ? void 0 : a.city) || "";
|
|
24
|
-
}),
|
|
65
|
+
}), F = n(() => {
|
|
25
66
|
var e, a;
|
|
26
67
|
return ((a = (e = t.value) == null ? void 0 : e.geocode) == null ? void 0 : a.state) || "";
|
|
27
|
-
}),
|
|
68
|
+
}), _ = n(() => {
|
|
28
69
|
var e;
|
|
29
70
|
return ((e = t.value) == null ? void 0 : e.distributionModel) || "";
|
|
30
|
-
}),
|
|
71
|
+
}), ie = n(() => {
|
|
31
72
|
var e, a;
|
|
32
73
|
return ((a = (e = t.value) == null ? void 0 : e.image) == null ? void 0 : a.hash) ?? "";
|
|
33
|
-
}),
|
|
34
|
-
var e, a;
|
|
35
|
-
return typeof ((e = t.value) == null ? void 0 : e.
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var a;
|
|
41
|
-
const e = ((a = t.value) == null ? void 0 : a.unreservedAmount) ?? "0";
|
|
42
|
-
return Number(e);
|
|
43
|
-
}), ue = n(() => {
|
|
44
|
-
if (P.value === "direct") {
|
|
45
|
-
const e = p && v.value.toLowerCase() === "united states" ? "" : `, ${v.value}`;
|
|
46
|
-
return `${y.value}, ${N.value}${e}`;
|
|
74
|
+
}), U = n(() => {
|
|
75
|
+
var e, a, s, u, m;
|
|
76
|
+
return typeof ((e = t.value) == null ? void 0 : e.loanAmount) < "u" && typeof ((s = (a = t.value) == null ? void 0 : a.loanFundraisingInfo) == null ? void 0 : s.fundedAmount) < "u" && typeof ((m = (u = t.value) == null ? void 0 : u.loanFundraisingInfo) == null ? void 0 : m.reservedAmount) < "u";
|
|
77
|
+
}), ce = n(() => !M.value && U.value), de = n(() => {
|
|
78
|
+
if (_.value === "direct") {
|
|
79
|
+
const e = p && f.value.toLowerCase() === "united states" ? "" : `, ${f.value}`;
|
|
80
|
+
return `${E.value}, ${F.value}${e}`;
|
|
47
81
|
}
|
|
48
|
-
return
|
|
49
|
-
}),
|
|
82
|
+
return f.value === "Puerto Rico" ? `${E.value}, PR` : f.value;
|
|
83
|
+
}), pe = n(() => {
|
|
50
84
|
var e;
|
|
51
85
|
return ((e = t.value) == null ? void 0 : e.use) ?? "";
|
|
52
|
-
}),
|
|
86
|
+
}), ve = n(() => {
|
|
53
87
|
var e;
|
|
54
88
|
return ((e = t.value) == null ? void 0 : e.status) ?? "";
|
|
55
|
-
}),
|
|
89
|
+
}), C = n(() => {
|
|
56
90
|
var e;
|
|
57
91
|
return ((e = t.value) == null ? void 0 : e.loanAmount) ?? "0";
|
|
58
|
-
}),
|
|
92
|
+
}), N = n(() => {
|
|
93
|
+
var e, a, s, u;
|
|
94
|
+
return ee(((a = (e = t.value) == null ? void 0 : e.loanFundraisingInfo) == null ? void 0 : a.reservedAmount) ?? "0").add(((u = (s = t.value) == null ? void 0 : s.loanFundraisingInfo) == null ? void 0 : u.fundedAmount) ?? "0");
|
|
95
|
+
}), fe = n(() => N.value.clone().divide(C.value).value()), S = n(() => U.value && C.value - N.value.value() > 0), me = n(() => S.value ? ee(C.value).subtract(N.value.value()).format("0.00") : "0"), ge = n(() => {
|
|
59
96
|
var e;
|
|
60
97
|
return ((e = t.value) == null ? void 0 : e.borrowerCount) ?? 0;
|
|
61
|
-
}),
|
|
62
|
-
var
|
|
63
|
-
const e = [], a = ((
|
|
64
|
-
ecoFriendly: !!
|
|
65
|
-
refugeesIdps: !!
|
|
66
|
-
singleParents: !!
|
|
67
|
-
}, D = (
|
|
68
|
-
if (D &&
|
|
69
|
-
const o = Math.floor(Math.random() *
|
|
70
|
-
e.push({ label:
|
|
98
|
+
}), he = n(() => {
|
|
99
|
+
var G, O, k, Y, B, $, w, K, x, q, H, j, z, J, Q, V, W, X, Z;
|
|
100
|
+
const e = [], a = ((O = (G = t.value) == null ? void 0 : G.activity) == null ? void 0 : O.name) ?? "", s = ((Y = (k = t.value) == null ? void 0 : k.activity) == null ? void 0 : Y.id) ?? null, u = (($ = (B = t.value) == null ? void 0 : B.sector) == null ? void 0 : $.name) ?? "", m = ((K = (w = t.value) == null ? void 0 : w.sector) == null ? void 0 : K.id) ?? null, i = ((q = (x = t.value) == null ? void 0 : x.tags) == null ? void 0 : q.filter((o) => o.charAt(0) === "#").map((o) => o.substring(1))) ?? [], A = ((H = t.value) == null ? void 0 : H.themes) ?? [], b = {
|
|
101
|
+
ecoFriendly: !!i.filter((o) => o.toUpperCase() === te || o.toUpperCase() === ae).length,
|
|
102
|
+
refugeesIdps: !!A.filter((o) => o.toUpperCase() === Ee).length,
|
|
103
|
+
singleParents: !!i.filter((o) => o.toUpperCase() === oe).length
|
|
104
|
+
}, D = (z = (j = t.value) == null ? void 0 : j.partnerName) == null ? void 0 : z.toUpperCase().includes(ye), T = ((J = t.value) == null ? void 0 : J.tagsData) ?? [], Ce = ((Q = t.value) == null ? void 0 : Q.themesData) ?? [];
|
|
105
|
+
if (D && i.length) {
|
|
106
|
+
const o = Math.floor(Math.random() * i.length), l = i[o], r = P(T, l), g = (r == null ? void 0 : r.id) ?? null;
|
|
107
|
+
e.push({ label: l, type: "tag", id: g });
|
|
71
108
|
}
|
|
72
|
-
if (
|
|
73
|
-
const o = Math.floor(Math.random() *
|
|
74
|
-
e.filter((
|
|
109
|
+
if (d.value || (b.ecoFriendly && !e.find((o) => o.label.toUpperCase() === te || o.label.toUpperCase() === ae) ? e.push({ label: "Eco-friendly", type: "tag", id: 9 }) : b.refugeesIdps ? e.push({ label: "Refugees and IDPs", type: "attribute", id: 28 }) : b.singleParents && !e.find((o) => o.label.toUpperCase() === oe) && e.push({ label: "Single Parent", type: "tag", id: 17 })), a && s && ((V = d.value) == null ? void 0 : V.toUpperCase()) !== a.toUpperCase() && e.push({ id: s, label: a, type: "activity" }), u && m && a.toUpperCase() !== u.toUpperCase() && u.toUpperCase() !== ((W = d.value) == null ? void 0 : W.toUpperCase()) && e.length < 2 && e.push({ id: m, label: u, type: "sector" }), i.length && e.length < 2) {
|
|
110
|
+
const o = Math.floor(Math.random() * i.length), l = i[o], r = P(T, l), g = (r == null ? void 0 : r.id) ?? null;
|
|
111
|
+
e.filter((I) => I.label.toUpperCase() === l.toUpperCase()).length || e.push({ label: l, type: "tag", id: g });
|
|
75
112
|
}
|
|
76
|
-
if (
|
|
77
|
-
const o = Math.floor(Math.random() *
|
|
78
|
-
!e.filter((
|
|
113
|
+
if (A.length && e.length < 2) {
|
|
114
|
+
const o = Math.floor(Math.random() * A.length), l = A[o], r = P(Ce, l), g = (r == null ? void 0 : r.id) ?? null;
|
|
115
|
+
!e.filter((I) => I.label.toUpperCase() === l.toUpperCase()).length && l.toUpperCase() !== ((X = d.value) == null ? void 0 : X.toUpperCase()) && e.push({ label: l, type: "attribute", id: g });
|
|
79
116
|
}
|
|
80
117
|
if (D && e.length > 1) return [e.shift()];
|
|
81
|
-
const
|
|
82
|
-
return e.push(...
|
|
118
|
+
const Ae = ((Z = y.value) == null ? void 0 : Z.map((o) => ({ label: o }))) ?? [];
|
|
119
|
+
return e.push(...Ae), e;
|
|
83
120
|
});
|
|
84
121
|
return {
|
|
85
|
-
tag:
|
|
86
|
-
readMorePath:
|
|
87
|
-
isLoading:
|
|
88
|
-
borrowerName:
|
|
89
|
-
countryName:
|
|
90
|
-
countryCode:
|
|
91
|
-
city:
|
|
92
|
-
state:
|
|
93
|
-
distributionModel:
|
|
94
|
-
imageHash:
|
|
95
|
-
hasProgressData:
|
|
96
|
-
allDataLoaded:
|
|
97
|
-
fundraisingPercent:
|
|
98
|
-
unreservedAmount:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
tag: se,
|
|
123
|
+
readMorePath: le,
|
|
124
|
+
isLoading: M,
|
|
125
|
+
borrowerName: re,
|
|
126
|
+
countryName: f,
|
|
127
|
+
countryCode: ue,
|
|
128
|
+
city: E,
|
|
129
|
+
state: F,
|
|
130
|
+
distributionModel: _,
|
|
131
|
+
imageHash: ie,
|
|
132
|
+
hasProgressData: U,
|
|
133
|
+
allDataLoaded: ce,
|
|
134
|
+
fundraisingPercent: fe,
|
|
135
|
+
unreservedAmount: me,
|
|
136
|
+
sharesAvailable: S,
|
|
137
|
+
formattedLocation: de,
|
|
138
|
+
loanUse: pe,
|
|
139
|
+
loanStatus: ve,
|
|
140
|
+
loanAmount: C,
|
|
141
|
+
loanBorrowerCount: ge,
|
|
142
|
+
mdiMapMarker: Le,
|
|
143
|
+
loanCallouts: he
|
|
106
144
|
};
|
|
107
145
|
}
|
|
108
|
-
function
|
|
146
|
+
function _e(c, p) {
|
|
109
147
|
const {
|
|
110
|
-
loanId:
|
|
111
|
-
customLoanDetails:
|
|
112
|
-
kvTrackFunction:
|
|
113
|
-
} =
|
|
114
|
-
function t(
|
|
115
|
-
|
|
148
|
+
loanId: v,
|
|
149
|
+
customLoanDetails: L,
|
|
150
|
+
kvTrackFunction: h
|
|
151
|
+
} = ne(c);
|
|
152
|
+
function t(d, y) {
|
|
153
|
+
h.value("Lending", "click-Read more", d, v.value), L.value && (y.preventDefault(), p("show-loan-details"));
|
|
116
154
|
}
|
|
117
155
|
return {
|
|
118
156
|
clickReadMore: t
|
|
119
157
|
};
|
|
120
158
|
}
|
|
121
159
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
160
|
+
Pe as LOAN_CALLOUTS_FRAGMENT,
|
|
161
|
+
Re as LOAN_GEOCODE_FRAGMENT,
|
|
162
|
+
Me as LOAN_PROGRESS_FRAGMENT,
|
|
163
|
+
Fe as loanCardComputedProperties,
|
|
164
|
+
_e as loanCardMethods
|
|
124
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.loan-card-use[data-v-
|
|
1
|
+
.loan-card-use[data-v-fcb027fa]:hover,.loan-card-use[data-v-fcb027fa]:focus{--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1))}.loan-card-active-hover:hover .loan-card-use[data-v-fcb027fa]{text-decoration-line:underline}.loan-card-progress[data-v-fcb027fa]:hover,.loan-card-progress[data-v-fcb027fa]:focus{text-decoration-line:none}
|