@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.
@@ -1,124 +1,165 @@
1
- import { toRefs as Z, computed as n } from "vue";
2
- import { mdiMapMarker as he } from "@mdi/js";
3
- const me = "N/A", V = "ECO-FRIENDLY", W = "SUSTAINABLE AG", X = "SINGLE PARENT", Ce = "REFUGEES/DISPLACED", L = (i, p) => (i == null ? void 0 : i.find((d) => d.name.replace("#", "").toUpperCase() === p.toUpperCase())) ?? {};
4
- function Ee(i, p = !1) {
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: d,
7
- customLoanDetails: C,
8
- loanId: g,
47
+ externalLinks: v,
48
+ customLoanDetails: L,
49
+ loanId: h,
9
50
  loan: t,
10
- categoryPageName: c,
11
- customCallouts: U
12
- } = Z(i), ee = n(() => d.value ? "a" : "router-link"), te = n(() => C.value ? "" : `/lend/${g.value}`), A = n(() => !g.value || !t.value), ae = n(() => {
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
- }), v = n(() => {
16
- var e, a, r;
17
- return ((r = (a = (e = t.value) == null ? void 0 : e.geocode) == null ? void 0 : a.country) == null ? void 0 : r.name) || "";
18
- }), oe = n(() => {
19
- var e, a, r;
20
- return ((r = (a = (e = t.value) == null ? void 0 : e.geocode) == null ? void 0 : a.country) == null ? void 0 : r.isoCode) || "";
21
- }), y = n(() => {
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
- }), N = n(() => {
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
- }), P = n(() => {
68
+ }), _ = n(() => {
28
69
  var e;
29
70
  return ((e = t.value) == null ? void 0 : e.distributionModel) || "";
30
- }), ne = n(() => {
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
- }), I = n(() => {
34
- var e, a;
35
- return typeof ((e = t.value) == null ? void 0 : e.unreservedAmount) < "u" && typeof ((a = t.value) == null ? void 0 : a.fundraisingPercent) < "u";
36
- }), se = n(() => !A.value && I.value), le = n(() => {
37
- var e;
38
- return ((e = t.value) == null ? void 0 : e.fundraisingPercent) ?? 0;
39
- }), re = n(() => {
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 v.value === "Puerto Rico" ? `${y.value}, PR` : v.value;
49
- }), ie = n(() => {
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
- }), ce = n(() => {
86
+ }), ve = n(() => {
53
87
  var e;
54
88
  return ((e = t.value) == null ? void 0 : e.status) ?? "";
55
- }), pe = n(() => {
89
+ }), C = n(() => {
56
90
  var e;
57
91
  return ((e = t.value) == null ? void 0 : e.loanAmount) ?? "0";
58
- }), de = n(() => {
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
- }), ve = n(() => {
62
- var S, T, _, k, F, Y, G, $, w, K, x, B, O, H, j, q, z, J, Q;
63
- const e = [], a = ((T = (S = t.value) == null ? void 0 : S.activity) == null ? void 0 : T.name) ?? "", r = ((k = (_ = t.value) == null ? void 0 : _.activity) == null ? void 0 : k.id) ?? null, h = ((Y = (F = t.value) == null ? void 0 : F.sector) == null ? void 0 : Y.name) ?? "", M = (($ = (G = t.value) == null ? void 0 : G.sector) == null ? void 0 : $.id) ?? null, u = ((K = (w = t.value) == null ? void 0 : w.tags) == null ? void 0 : K.filter((o) => o.charAt(0) === "#").map((o) => o.substring(1))) ?? [], m = ((x = t.value) == null ? void 0 : x.themes) ?? [], E = {
64
- ecoFriendly: !!u.filter((o) => o.toUpperCase() === V || o.toUpperCase() === W).length,
65
- refugeesIdps: !!m.filter((o) => o.toUpperCase() === Ce).length,
66
- singleParents: !!u.filter((o) => o.toUpperCase() === X).length
67
- }, D = (O = (B = t.value) == null ? void 0 : B.partnerName) == null ? void 0 : O.toUpperCase().includes(me), R = ((H = t.value) == null ? void 0 : H.tagsData) ?? [], fe = ((j = t.value) == null ? void 0 : j.themesData) ?? [];
68
- if (D && u.length) {
69
- const o = Math.floor(Math.random() * u.length), s = u[o], l = L(R, s), f = (l == null ? void 0 : l.id) ?? null;
70
- e.push({ label: s, type: "tag", id: f });
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 (c.value || (E.ecoFriendly && !e.find((o) => o.label.toUpperCase() === V || o.label.toUpperCase() === W) ? e.push({ label: "Eco-friendly", type: "tag", id: 9 }) : E.refugeesIdps ? e.push({ label: "Refugees and IDPs", type: "attribute", id: 28 }) : E.singleParents && !e.find((o) => o.label.toUpperCase() === X) && e.push({ label: "Single Parent", type: "tag", id: 17 })), a && r && ((q = c.value) == null ? void 0 : q.toUpperCase()) !== a.toUpperCase() && e.push({ id: r, label: a, type: "activity" }), h && M && a.toUpperCase() !== h.toUpperCase() && h.toUpperCase() !== ((z = c.value) == null ? void 0 : z.toUpperCase()) && e.length < 2 && e.push({ id: M, label: h, type: "sector" }), u.length && e.length < 2) {
73
- const o = Math.floor(Math.random() * u.length), s = u[o], l = L(R, s), f = (l == null ? void 0 : l.id) ?? null;
74
- e.filter((b) => b.label.toUpperCase() === s.toUpperCase()).length || e.push({ label: s, type: "tag", id: f });
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 (m.length && e.length < 2) {
77
- const o = Math.floor(Math.random() * m.length), s = m[o], l = L(fe, s), f = (l == null ? void 0 : l.id) ?? null;
78
- !e.filter((b) => b.label.toUpperCase() === s.toUpperCase()).length && s.toUpperCase() !== ((J = c.value) == null ? void 0 : J.toUpperCase()) && e.push({ label: s, type: "attribute", id: f });
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 ge = ((Q = U.value) == null ? void 0 : Q.map((o) => ({ label: o }))) ?? [];
82
- return e.push(...ge), e;
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: ee,
86
- readMorePath: te,
87
- isLoading: A,
88
- borrowerName: ae,
89
- countryName: v,
90
- countryCode: oe,
91
- city: y,
92
- state: N,
93
- distributionModel: P,
94
- imageHash: ne,
95
- hasProgressData: I,
96
- allDataLoaded: se,
97
- fundraisingPercent: le,
98
- unreservedAmount: re,
99
- formattedLocation: ue,
100
- loanUse: ie,
101
- loanStatus: ce,
102
- loanAmount: pe,
103
- loanBorrowerCount: de,
104
- mdiMapMarker: he,
105
- loanCallouts: ve
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 be(i, p) {
146
+ function _e(c, p) {
109
147
  const {
110
- loanId: d,
111
- customLoanDetails: C,
112
- kvTrackFunction: g
113
- } = Z(i);
114
- function t(c, U) {
115
- g.value("Lending", "click-Read more", c, d.value), C.value && (U.preventDefault(), p("show-loan-details"));
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
- Ee as loanCardComputedProperties,
123
- be as loanCardMethods
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-d014fd7b]:hover,.loan-card-use[data-v-d014fd7b]: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-d014fd7b]{text-decoration-line:underline}.loan-card-progress[data-v-d014fd7b]:hover,.loan-card-progress[data-v-d014fd7b]:focus{text-decoration-line:none}
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}