@kiva/kv-components 3.106.0 → 3.107.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.
Files changed (179) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/CHANGELOG.md +22 -0
  3. package/dist/components/.storybook/main.js +85 -0
  4. package/dist/components/.storybook/package.json +3 -0
  5. package/dist/components/.storybook/preview.js +61 -0
  6. package/dist/components/.storybook/tailwind.css +5 -0
  7. package/dist/components/KvAccordionItem.vue +130 -0
  8. package/dist/components/KvActivityRow.vue +33 -0
  9. package/dist/components/KvBorrowerImage.vue +179 -0
  10. package/dist/components/KvButton.vue +287 -0
  11. package/dist/components/KvCarousel.vue +297 -0
  12. package/dist/components/KvCartModal.vue +365 -0
  13. package/dist/components/KvCheckbox.vue +203 -0
  14. package/dist/components/KvChip.vue +54 -0
  15. package/dist/components/KvClassicLoanCard.vue +527 -0
  16. package/dist/components/KvCommentsAdd.vue +135 -0
  17. package/dist/components/KvCommentsContainer.vue +84 -0
  18. package/dist/components/KvCommentsHeartButton.vue +70 -0
  19. package/dist/components/KvCommentsList.vue +68 -0
  20. package/dist/components/KvCommentsListItem.vue +241 -0
  21. package/dist/components/KvCommentsReplyButton.vue +52 -0
  22. package/dist/components/KvContentfulImg.vue +273 -0
  23. package/dist/components/KvCountdownTimer.vue +59 -0
  24. package/dist/components/KvExpandable.vue +84 -0
  25. package/dist/components/KvExpandableQuestion.vue +120 -0
  26. package/dist/components/KvFlag.vue +120 -0
  27. package/dist/components/KvGrid.vue +28 -0
  28. package/dist/components/KvImpactDashboardHeader.vue +40 -0
  29. package/dist/components/KvInlineActivityCard.vue +55 -0
  30. package/dist/components/KvInlineActivityFeed.vue +38 -0
  31. package/dist/components/KvIntroductionLoanCard.vue +446 -0
  32. package/dist/components/KvLendAmountButton.vue +65 -0
  33. package/dist/components/KvLendCta.vue +451 -0
  34. package/dist/components/KvLightbox.vue +334 -0
  35. package/dist/components/KvLineGraph.vue +128 -0
  36. package/dist/components/KvLoadingPlaceholder.vue +38 -0
  37. package/dist/components/KvLoadingSpinner.vue +81 -0
  38. package/dist/components/KvLoanActivities.vue +268 -0
  39. package/dist/components/KvLoanBookmark.vue +39 -0
  40. package/dist/components/KvLoanCallouts.vue +53 -0
  41. package/dist/components/KvLoanProgressGroup.vue +76 -0
  42. package/dist/components/KvLoanTag.vue +88 -0
  43. package/dist/components/KvLoanTeamPick.vue +44 -0
  44. package/dist/components/KvLoanUse.vue +92 -0
  45. package/dist/components/KvMap.vue +599 -0
  46. package/dist/components/KvMaterialIcon.vue +47 -0
  47. package/dist/components/KvPageContainer.vue +15 -0
  48. package/dist/components/KvPagination.vue +198 -0
  49. package/dist/components/KvPieChart.vue +257 -0
  50. package/dist/components/KvPopper.vue +178 -0
  51. package/dist/components/KvProgressBar.vue +149 -0
  52. package/dist/components/KvRadio.vue +198 -0
  53. package/dist/components/KvSelect.vue +114 -0
  54. package/dist/components/KvSideSheet.vue +134 -0
  55. package/dist/components/KvSwitch.vue +143 -0
  56. package/dist/components/KvTab.vue +90 -0
  57. package/dist/components/KvTabPanel.vue +64 -0
  58. package/dist/components/KvTabs.vue +182 -0
  59. package/dist/components/KvTextInput.vue +247 -0
  60. package/dist/components/KvTextLink.vue +138 -0
  61. package/dist/components/KvThemeProvider.vue +122 -0
  62. package/dist/components/KvToast.vue +221 -0
  63. package/dist/components/KvTooltip.vue +168 -0
  64. package/dist/components/KvTreeMapChart.vue +229 -0
  65. package/dist/components/KvUserAvatar.vue +132 -0
  66. package/dist/components/KvVerticalCarousel.vue +156 -0
  67. package/dist/components/KvVotingCard.vue +160 -0
  68. package/dist/components/KvVotingCardV2.vue +154 -0
  69. package/dist/components/KvWideLoanCard.vue +432 -0
  70. package/dist/components/stories/Forms.stories.js +62 -0
  71. package/dist/components/stories/KvAccordionItem.stories.js +24 -0
  72. package/dist/components/stories/KvActivityRow.stories.js +25 -0
  73. package/dist/components/stories/KvBorrowerImage.stories.js +68 -0
  74. package/dist/components/stories/KvButton.stories.js +144 -0
  75. package/dist/components/stories/KvCarousel.stories.js +426 -0
  76. package/dist/components/stories/KvCartModal.stories.js +54 -0
  77. package/dist/components/stories/KvCheckbox.stories.js +163 -0
  78. package/dist/components/stories/KvChip.stories.js +43 -0
  79. package/dist/components/stories/KvClassicLoanCard.stories.js +480 -0
  80. package/dist/components/stories/KvCommentsAdd.stories.js +32 -0
  81. package/dist/components/stories/KvCommentsContainer.stories.js +42 -0
  82. package/dist/components/stories/KvCommentsHeartButton.stories.js +25 -0
  83. package/dist/components/stories/KvCommentsList.stories.js +39 -0
  84. package/dist/components/stories/KvCommentsListItem.stories.js +45 -0
  85. package/dist/components/stories/KvCommentsReplyButton.stories.js +21 -0
  86. package/dist/components/stories/KvContentfulImg.stories.js +196 -0
  87. package/dist/components/stories/KvCountdownTimer.stories.js +30 -0
  88. package/dist/components/stories/KvExpandableQuestion.stories.js +129 -0
  89. package/dist/components/stories/KvFlag.stories.js +36 -0
  90. package/dist/components/stories/KvGrid.stories.js +97 -0
  91. package/dist/components/stories/KvImpactDashboardHeader.stories.js +22 -0
  92. package/dist/components/stories/KvInlineActivityCard.stories.js +69 -0
  93. package/dist/components/stories/KvInlineActivityFeed.stories.js +76 -0
  94. package/dist/components/stories/KvIntroductionLoanCard.stories.js +208 -0
  95. package/dist/components/stories/KvLendAmountButton.stories.js +31 -0
  96. package/dist/components/stories/KvLendCta.stories.js +177 -0
  97. package/dist/components/stories/KvLightbox.stories.js +304 -0
  98. package/dist/components/stories/KvLineGraph.stories.js +52 -0
  99. package/dist/components/stories/KvLoadingPlaceholder.stories.js +17 -0
  100. package/dist/components/stories/KvLoadingSpinner.stories.js +52 -0
  101. package/dist/components/stories/KvLoanActivities.stories.js +104 -0
  102. package/dist/components/stories/KvLoanBookmark.stories.js +22 -0
  103. package/dist/components/stories/KvLoanCallouts.stories.js +22 -0
  104. package/dist/components/stories/KvLoanProgressGroup.stories.js +29 -0
  105. package/dist/components/stories/KvLoanTag.stories.js +61 -0
  106. package/dist/components/stories/KvLoanTeamPick.stories.js +20 -0
  107. package/dist/components/stories/KvLoanUse.stories.js +60 -0
  108. package/dist/components/stories/KvMap.stories.js +121 -0
  109. package/dist/components/stories/KvMaterialIcon.stories.js +201 -0
  110. package/dist/components/stories/KvPageContainer.stories.js +50 -0
  111. package/dist/components/stories/KvPagination.stories.js +70 -0
  112. package/dist/components/stories/KvPieChart.stories.js +47 -0
  113. package/dist/components/stories/KvProgressBar.stories.js +53 -0
  114. package/dist/components/stories/KvRadio.stories.js +140 -0
  115. package/dist/components/stories/KvSelect.stories.js +125 -0
  116. package/dist/components/stories/KvSideSheet.stories.js +50 -0
  117. package/dist/components/stories/KvSwitch.stories.js +66 -0
  118. package/dist/components/stories/KvTabs.stories.js +106 -0
  119. package/dist/components/stories/KvTextInput.stories.js +194 -0
  120. package/dist/components/stories/KvTextLink.stories.js +55 -0
  121. package/dist/components/stories/KvThemeProvider.stories.js +178 -0
  122. package/dist/components/stories/KvToast.stories.js +117 -0
  123. package/dist/components/stories/KvTooltip.stories.js +26 -0
  124. package/dist/components/stories/KvTreeMapChart.stories.js +42 -0
  125. package/dist/components/stories/KvUserAvatar.stories.js +47 -0
  126. package/dist/components/stories/KvVerticalCarousel.stories.js +168 -0
  127. package/dist/components/stories/KvVotingCard.stories.js +33 -0
  128. package/dist/components/stories/KvVotingCardV2.stories.js +89 -0
  129. package/dist/components/stories/KvWideLoanCard.stories.js +292 -0
  130. package/dist/components/stories/StyleguidePrimitives.stories.js +499 -0
  131. package/dist/components/stories/StyleguideProse.stories.js +215 -0
  132. package/dist/data/countries-borders.json +1 -0
  133. package/dist/data/ne_110m_admin_0_countries.json +1 -0
  134. package/dist/utils/Alea.cjs +87 -0
  135. package/dist/utils/Alea.js +9 -0
  136. package/dist/utils/attrs.cjs +50 -0
  137. package/dist/utils/attrs.js +7 -0
  138. package/dist/utils/carousels.cjs +184 -0
  139. package/dist/utils/carousels.js +8 -0
  140. package/dist/utils/chunk-3HK4G4NT.js +27 -0
  141. package/dist/utils/chunk-55HF2ORX.js +201 -0
  142. package/dist/utils/chunk-AY3PR5S4.js +54 -0
  143. package/dist/utils/chunk-AZPWOFD5.js +148 -0
  144. package/dist/utils/chunk-B5J5WLAH.js +18 -0
  145. package/dist/utils/chunk-GPSH6OPA.js +64 -0
  146. package/dist/utils/chunk-HIY5IW65.js +28 -0
  147. package/dist/utils/chunk-HV3AUBFT.js +15 -0
  148. package/dist/utils/chunk-MSMZIN54.js +110 -0
  149. package/dist/utils/chunk-OXJCCNNW.js +30 -0
  150. package/dist/utils/chunk-S3MABILA.js +22 -0
  151. package/dist/utils/chunk-VIGEMAKO.js +249 -0
  152. package/dist/utils/chunk-YCNMJ4YV.js +37 -0
  153. package/dist/utils/chunk-YFEC5ODJ.js +129 -0
  154. package/dist/utils/expander.cjs +78 -0
  155. package/dist/utils/expander.js +9 -0
  156. package/dist/utils/imageUtils.cjs +54 -0
  157. package/dist/utils/imageUtils.js +9 -0
  158. package/dist/utils/index.cjs +1118 -0
  159. package/dist/utils/index.js +166 -0
  160. package/dist/utils/loanCard.cjs +222 -0
  161. package/dist/utils/loanCard.js +9 -0
  162. package/dist/utils/loanUtils.cjs +170 -0
  163. package/dist/utils/loanUtils.js +23 -0
  164. package/dist/utils/mapUtils.cjs +276 -0
  165. package/dist/utils/mapUtils.js +15 -0
  166. package/dist/utils/printing.cjs +42 -0
  167. package/dist/utils/printing.js +9 -0
  168. package/dist/utils/scrollLock.cjs +54 -0
  169. package/dist/utils/scrollLock.js +13 -0
  170. package/dist/utils/throttle.cjs +38 -0
  171. package/dist/utils/throttle.js +7 -0
  172. package/dist/utils/touchEvents.cjs +47 -0
  173. package/dist/utils/touchEvents.js +11 -0
  174. package/dist/utils/treemap.cjs +133 -0
  175. package/dist/utils/treemap.js +7 -0
  176. package/package.json +12 -4
  177. package/utils/index.js +14 -0
  178. package/vue/KvVerticalCarousel.vue +1 -1
  179. package/index.js +0 -3
@@ -0,0 +1,166 @@
1
+ import {
2
+ animationCoordinator,
3
+ generateMapMarkers,
4
+ getCoordinatesBetween,
5
+ getCountryColor,
6
+ getLoansIntervals
7
+ } from "./chunk-VIGEMAKO.js";
8
+ import {
9
+ lockPrintSingleEl,
10
+ unlockPrintSingleEl
11
+ } from "./chunk-B5J5WLAH.js";
12
+ import {
13
+ lockScroll,
14
+ lockScrollSmallOnly,
15
+ unlockScroll,
16
+ unlockScrollSmallOnly
17
+ } from "./chunk-HIY5IW65.js";
18
+ import {
19
+ isTargetElement,
20
+ offBodyTouchstart,
21
+ onBodyTouchstart
22
+ } from "./chunk-S3MABILA.js";
23
+ import {
24
+ getTreemap
25
+ } from "./chunk-MSMZIN54.js";
26
+ import {
27
+ Mash
28
+ } from "./chunk-GPSH6OPA.js";
29
+ import {
30
+ useAttrs
31
+ } from "./chunk-3HK4G4NT.js";
32
+ import {
33
+ carouselUtil
34
+ } from "./chunk-AZPWOFD5.js";
35
+ import {
36
+ throttle
37
+ } from "./chunk-HV3AUBFT.js";
38
+ import {
39
+ collapse,
40
+ expand
41
+ } from "./chunk-AY3PR5S4.js";
42
+ import {
43
+ isLegacyPlaceholderAvatar,
44
+ randomizedUserAvatarClass
45
+ } from "./chunk-OXJCCNNW.js";
46
+ import {
47
+ loanCardComputedProperties,
48
+ loanCardMethods
49
+ } from "./chunk-55HF2ORX.js";
50
+ import {
51
+ BALANCE_CAMPAIGN,
52
+ BASE_CAMPAIGN,
53
+ ERL_COOKIE_NAME,
54
+ NO_BALANCE_CAMPAIGN,
55
+ TOP_UP_CAMPAIGN,
56
+ getDropdownPriceArray,
57
+ getLendCtaSelectedOption,
58
+ isBetween25And50,
59
+ isLessThan25
60
+ } from "./chunk-YFEC5ODJ.js";
61
+ import {
62
+ __commonJS,
63
+ __export,
64
+ __reExport,
65
+ __toESM
66
+ } from "./chunk-YCNMJ4YV.js";
67
+
68
+ // utils/themeUtils.cjs
69
+ var require_themeUtils = __commonJS({
70
+ "utils/themeUtils.cjs"(exports, module) {
71
+ var headerNumberCase = (str) => str.replace("h-1", "h1").replace("h-2", "h2").replace("h-3", "h3").replace("h-4", "h4").replace("h-5", "h5");
72
+ var buildTailwindClassName = (prefix, value) => {
73
+ let name = `${prefix}-${value}`;
74
+ name = name.replace("-DEFAULT", "");
75
+ return name;
76
+ };
77
+ var kebabCase = (str) => str.split("").map((letter, idx) => letter.toUpperCase() === letter ? `${idx !== 0 ? "-" : ""}${letter.toLowerCase()}` : letter).join("");
78
+ var removeObjectProperty = (object, key) => {
79
+ const ret = { ...object };
80
+ delete ret[key];
81
+ return ret;
82
+ };
83
+ module.exports = {
84
+ buildTailwindClassName,
85
+ headerNumberCase,
86
+ kebabCase,
87
+ removeObjectProperty
88
+ };
89
+ }
90
+ });
91
+
92
+ // utils/index.js
93
+ var utils_exports = {};
94
+ __export(utils_exports, {
95
+ BALANCE_CAMPAIGN: () => BALANCE_CAMPAIGN,
96
+ BASE_CAMPAIGN: () => BASE_CAMPAIGN,
97
+ ERL_COOKIE_NAME: () => ERL_COOKIE_NAME,
98
+ Mash: () => Mash,
99
+ NO_BALANCE_CAMPAIGN: () => NO_BALANCE_CAMPAIGN,
100
+ TOP_UP_CAMPAIGN: () => TOP_UP_CAMPAIGN,
101
+ animationCoordinator: () => animationCoordinator,
102
+ carouselUtil: () => carouselUtil,
103
+ collapse: () => collapse,
104
+ expand: () => expand,
105
+ generateMapMarkers: () => generateMapMarkers,
106
+ getCoordinatesBetween: () => getCoordinatesBetween,
107
+ getCountryColor: () => getCountryColor,
108
+ getDropdownPriceArray: () => getDropdownPriceArray,
109
+ getLendCtaSelectedOption: () => getLendCtaSelectedOption,
110
+ getLoansIntervals: () => getLoansIntervals,
111
+ getTreemap: () => getTreemap,
112
+ isBetween25And50: () => isBetween25And50,
113
+ isLegacyPlaceholderAvatar: () => isLegacyPlaceholderAvatar,
114
+ isLessThan25: () => isLessThan25,
115
+ isTargetElement: () => isTargetElement,
116
+ loanCardComputedProperties: () => loanCardComputedProperties,
117
+ loanCardMethods: () => loanCardMethods,
118
+ lockPrintSingleEl: () => lockPrintSingleEl,
119
+ lockScroll: () => lockScroll,
120
+ lockScrollSmallOnly: () => lockScrollSmallOnly,
121
+ offBodyTouchstart: () => offBodyTouchstart,
122
+ onBodyTouchstart: () => onBodyTouchstart,
123
+ randomizedUserAvatarClass: () => randomizedUserAvatarClass,
124
+ throttle: () => throttle,
125
+ unlockPrintSingleEl: () => unlockPrintSingleEl,
126
+ unlockScroll: () => unlockScroll,
127
+ unlockScrollSmallOnly: () => unlockScrollSmallOnly,
128
+ useAttrs: () => useAttrs
129
+ });
130
+ __reExport(utils_exports, __toESM(require_themeUtils(), 1));
131
+ export {
132
+ BALANCE_CAMPAIGN,
133
+ BASE_CAMPAIGN,
134
+ ERL_COOKIE_NAME,
135
+ Mash,
136
+ NO_BALANCE_CAMPAIGN,
137
+ TOP_UP_CAMPAIGN,
138
+ animationCoordinator,
139
+ carouselUtil,
140
+ collapse,
141
+ expand,
142
+ generateMapMarkers,
143
+ getCoordinatesBetween,
144
+ getCountryColor,
145
+ getDropdownPriceArray,
146
+ getLendCtaSelectedOption,
147
+ getLoansIntervals,
148
+ getTreemap,
149
+ isBetween25And50,
150
+ isLegacyPlaceholderAvatar,
151
+ isLessThan25,
152
+ isTargetElement,
153
+ loanCardComputedProperties,
154
+ loanCardMethods,
155
+ lockPrintSingleEl,
156
+ lockScroll,
157
+ lockScrollSmallOnly,
158
+ offBodyTouchstart,
159
+ onBodyTouchstart,
160
+ randomizedUserAvatarClass,
161
+ throttle,
162
+ unlockPrintSingleEl,
163
+ unlockScroll,
164
+ unlockScrollSmallOnly,
165
+ useAttrs
166
+ };
@@ -0,0 +1,222 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/loanCard.js
20
+ var loanCard_exports = {};
21
+ __export(loanCard_exports, {
22
+ loanCardComputedProperties: () => loanCardComputedProperties,
23
+ loanCardMethods: () => loanCardMethods
24
+ });
25
+ module.exports = __toCommonJS(loanCard_exports);
26
+ var import_vue_demi = require("vue-demi");
27
+ var import_js = require("@mdi/js");
28
+ var LSE_LOAN_KEY = "N/A";
29
+ var ECO_FRIENDLY_KEY = "ECO-FRIENDLY";
30
+ var SUSTAINABLE_AG_KEY = "SUSTAINABLE AG";
31
+ var SINGLE_PARENT_KEY = "SINGLE PARENT";
32
+ var REFUGEE_KEY = "REFUGEES/DISPLACED";
33
+ var findCalloutData = (tags, tagName) => (tags == null ? void 0 : tags.find((t) => t.name.replace("#", "").toUpperCase() === tagName.toUpperCase())) ?? {};
34
+ function loanCardComputedProperties(props, hideUnitedStatesText = false) {
35
+ const {
36
+ externalLinks,
37
+ customLoanDetails,
38
+ loanId,
39
+ loan,
40
+ categoryPageName,
41
+ customCallouts
42
+ } = (0, import_vue_demi.toRefs)(props);
43
+ const tag = (0, import_vue_demi.computed)(() => externalLinks.value ? "a" : "router-link");
44
+ const readMorePath = (0, import_vue_demi.computed)(() => customLoanDetails.value ? "" : `/lend/${loanId.value}`);
45
+ const isLoading = (0, import_vue_demi.computed)(() => !loanId.value || !loan.value);
46
+ const borrowerName = (0, import_vue_demi.computed)(() => {
47
+ var _a;
48
+ return ((_a = loan.value) == null ? void 0 : _a.name) || "";
49
+ });
50
+ const countryName = (0, import_vue_demi.computed)(() => {
51
+ var _a, _b, _c;
52
+ return ((_c = (_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.country) == null ? void 0 : _c.name) || "";
53
+ });
54
+ const countryCode = (0, import_vue_demi.computed)(() => {
55
+ var _a, _b, _c;
56
+ return ((_c = (_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.country) == null ? void 0 : _c.isoCode) || "";
57
+ });
58
+ const city = (0, import_vue_demi.computed)(() => {
59
+ var _a, _b;
60
+ return ((_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.city) || "";
61
+ });
62
+ const state = (0, import_vue_demi.computed)(() => {
63
+ var _a, _b;
64
+ return ((_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.state) || "";
65
+ });
66
+ const distributionModel = (0, import_vue_demi.computed)(() => {
67
+ var _a;
68
+ return ((_a = loan.value) == null ? void 0 : _a.distributionModel) || "";
69
+ });
70
+ const imageHash = (0, import_vue_demi.computed)(() => {
71
+ var _a, _b;
72
+ return ((_b = (_a = loan.value) == null ? void 0 : _a.image) == null ? void 0 : _b.hash) ?? "";
73
+ });
74
+ const hasProgressData = (0, import_vue_demi.computed)(() => {
75
+ var _a, _b;
76
+ return typeof ((_a = loan.value) == null ? void 0 : _a.unreservedAmount) !== "undefined" && typeof ((_b = loan.value) == null ? void 0 : _b.fundraisingPercent) !== "undefined";
77
+ });
78
+ const allDataLoaded = (0, import_vue_demi.computed)(() => !isLoading.value && hasProgressData.value);
79
+ const fundraisingPercent = (0, import_vue_demi.computed)(() => {
80
+ var _a;
81
+ return ((_a = loan.value) == null ? void 0 : _a.fundraisingPercent) ?? 0;
82
+ });
83
+ const unreservedAmount = (0, import_vue_demi.computed)(() => {
84
+ var _a;
85
+ const stringAmount = ((_a = loan.value) == null ? void 0 : _a.unreservedAmount) ?? "0";
86
+ return Number(stringAmount);
87
+ });
88
+ const formattedLocation = (0, import_vue_demi.computed)(() => {
89
+ if (distributionModel.value === "direct") {
90
+ const countryText = hideUnitedStatesText && countryName.value.toLowerCase() === "united states" ? "" : `, ${countryName.value}`;
91
+ return `${city.value}, ${state.value}${countryText}`;
92
+ }
93
+ if (countryName.value === "Puerto Rico") {
94
+ return `${city.value}, PR`;
95
+ }
96
+ return countryName.value;
97
+ });
98
+ const loanUse = (0, import_vue_demi.computed)(() => {
99
+ var _a;
100
+ return ((_a = loan.value) == null ? void 0 : _a.use) ?? "";
101
+ });
102
+ const loanStatus = (0, import_vue_demi.computed)(() => {
103
+ var _a;
104
+ return ((_a = loan.value) == null ? void 0 : _a.status) ?? "";
105
+ });
106
+ const loanAmount = (0, import_vue_demi.computed)(() => {
107
+ var _a;
108
+ return ((_a = loan.value) == null ? void 0 : _a.loanAmount) ?? "0";
109
+ });
110
+ const loanBorrowerCount = (0, import_vue_demi.computed)(() => {
111
+ var _a;
112
+ return ((_a = loan.value) == null ? void 0 : _a.borrowerCount) ?? 0;
113
+ });
114
+ const loanCallouts = (0, import_vue_demi.computed)(() => {
115
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
116
+ const callouts = [];
117
+ const activityName = ((_b = (_a = loan.value) == null ? void 0 : _a.activity) == null ? void 0 : _b.name) ?? "";
118
+ const activityId = ((_d = (_c = loan.value) == null ? void 0 : _c.activity) == null ? void 0 : _d.id) ?? null;
119
+ const sectorName = ((_f = (_e = loan.value) == null ? void 0 : _e.sector) == null ? void 0 : _f.name) ?? "";
120
+ const sectorId = ((_h = (_g = loan.value) == null ? void 0 : _g.sector) == null ? void 0 : _h.id) ?? null;
121
+ const tags = ((_j = (_i = loan.value) == null ? void 0 : _i.tags) == null ? void 0 : _j.filter((loantag) => loantag.charAt(0) === "#").map((loantag) => loantag.substring(1))) ?? [];
122
+ const themes = ((_k = loan.value) == null ? void 0 : _k.themes) ?? [];
123
+ const categories = {
124
+ ecoFriendly: !!tags.filter((t) => t.toUpperCase() === ECO_FRIENDLY_KEY || t.toUpperCase() === SUSTAINABLE_AG_KEY).length,
125
+ refugeesIdps: !!themes.filter((t) => t.toUpperCase() === REFUGEE_KEY).length,
126
+ singleParents: !!tags.filter((t) => t.toUpperCase() === SINGLE_PARENT_KEY).length
127
+ };
128
+ const isLseLoan = (_m = (_l = loan.value) == null ? void 0 : _l.partnerName) == null ? void 0 : _m.toUpperCase().includes(LSE_LOAN_KEY);
129
+ const tagsData = ((_n = loan.value) == null ? void 0 : _n.tagsData) ?? [];
130
+ const themesData = ((_o = loan.value) == null ? void 0 : _o.themesData) ?? [];
131
+ if (isLseLoan && tags.length) {
132
+ const position = Math.floor(Math.random() * tags.length);
133
+ const p1Tag = tags[position];
134
+ const tagData = findCalloutData(tagsData, p1Tag);
135
+ const id = (tagData == null ? void 0 : tagData.id) ?? null;
136
+ callouts.push({ label: p1Tag, type: "tag", id });
137
+ }
138
+ if (!categoryPageName.value) {
139
+ if (categories.ecoFriendly && !callouts.find((c) => c.label.toUpperCase() === ECO_FRIENDLY_KEY || c.label.toUpperCase() === SUSTAINABLE_AG_KEY)) {
140
+ callouts.push({ label: "Eco-friendly", type: "tag", id: 9 });
141
+ } else if (categories.refugeesIdps) {
142
+ callouts.push({ label: "Refugees and IDPs", type: "attribute", id: 28 });
143
+ } else if (categories.singleParents && !callouts.find((c) => c.label.toUpperCase() === SINGLE_PARENT_KEY)) {
144
+ callouts.push({ label: "Single Parent", type: "tag", id: 17 });
145
+ }
146
+ }
147
+ if (activityName && activityId && ((_p = categoryPageName.value) == null ? void 0 : _p.toUpperCase()) !== activityName.toUpperCase()) {
148
+ callouts.push({ id: activityId, label: activityName, type: "activity" });
149
+ }
150
+ if (sectorName && sectorId && activityName.toUpperCase() !== sectorName.toUpperCase() && sectorName.toUpperCase() !== ((_q = categoryPageName.value) == null ? void 0 : _q.toUpperCase()) && callouts.length < 2) {
151
+ callouts.push({ id: sectorId, label: sectorName, type: "sector" });
152
+ }
153
+ if (!!tags.length && callouts.length < 2) {
154
+ const position = Math.floor(Math.random() * tags.length);
155
+ const p4Tag = tags[position];
156
+ const tagData = findCalloutData(tagsData, p4Tag);
157
+ const id = (tagData == null ? void 0 : tagData.id) ?? null;
158
+ if (!callouts.filter((c) => c.label.toUpperCase() === p4Tag.toUpperCase()).length) {
159
+ callouts.push({ label: p4Tag, type: "tag", id });
160
+ }
161
+ }
162
+ if (!!themes.length && callouts.length < 2) {
163
+ const position = Math.floor(Math.random() * themes.length);
164
+ const theme = themes[position];
165
+ const themeData = findCalloutData(themesData, theme);
166
+ const id = (themeData == null ? void 0 : themeData.id) ?? null;
167
+ if (!callouts.filter((c) => c.label.toUpperCase() === theme.toUpperCase()).length && theme.toUpperCase() !== ((_r = categoryPageName.value) == null ? void 0 : _r.toUpperCase())) {
168
+ callouts.push({ label: theme, type: "attribute", id });
169
+ }
170
+ }
171
+ if (isLseLoan && callouts.length > 1)
172
+ return [callouts.shift()];
173
+ const customTags = ((_s = customCallouts.value) == null ? void 0 : _s.map((c) => ({ label: c }))) ?? [];
174
+ callouts.push(...customTags);
175
+ return callouts;
176
+ });
177
+ return {
178
+ tag,
179
+ readMorePath,
180
+ isLoading,
181
+ borrowerName,
182
+ countryName,
183
+ countryCode,
184
+ city,
185
+ state,
186
+ distributionModel,
187
+ imageHash,
188
+ hasProgressData,
189
+ allDataLoaded,
190
+ fundraisingPercent,
191
+ unreservedAmount,
192
+ formattedLocation,
193
+ loanUse,
194
+ loanStatus,
195
+ loanAmount,
196
+ loanBorrowerCount,
197
+ mdiMapMarker: import_js.mdiMapMarker,
198
+ loanCallouts
199
+ };
200
+ }
201
+ function loanCardMethods(props, emit) {
202
+ const {
203
+ loanId,
204
+ customLoanDetails,
205
+ kvTrackFunction
206
+ } = (0, import_vue_demi.toRefs)(props);
207
+ function clickReadMore(target, event) {
208
+ kvTrackFunction.value("Lending", "click-Read more", target, loanId.value);
209
+ if (customLoanDetails.value) {
210
+ event.preventDefault();
211
+ emit("show-loan-details");
212
+ }
213
+ }
214
+ return {
215
+ clickReadMore
216
+ };
217
+ }
218
+ // Annotate the CommonJS export names for ESM import in node:
219
+ 0 && (module.exports = {
220
+ loanCardComputedProperties,
221
+ loanCardMethods
222
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ loanCardComputedProperties,
3
+ loanCardMethods
4
+ } from "./chunk-55HF2ORX.js";
5
+ import "./chunk-YCNMJ4YV.js";
6
+ export {
7
+ loanCardComputedProperties,
8
+ loanCardMethods
9
+ };
@@ -0,0 +1,170 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // utils/loanUtils.js
30
+ var loanUtils_exports = {};
31
+ __export(loanUtils_exports, {
32
+ BALANCE_CAMPAIGN: () => BALANCE_CAMPAIGN,
33
+ BASE_CAMPAIGN: () => BASE_CAMPAIGN,
34
+ ERL_COOKIE_NAME: () => ERL_COOKIE_NAME,
35
+ NO_BALANCE_CAMPAIGN: () => NO_BALANCE_CAMPAIGN,
36
+ TOP_UP_CAMPAIGN: () => TOP_UP_CAMPAIGN,
37
+ getDropdownPriceArray: () => getDropdownPriceArray,
38
+ getLendCtaSelectedOption: () => getLendCtaSelectedOption,
39
+ isBetween25And50: () => isBetween25And50,
40
+ isLessThan25: () => isLessThan25
41
+ });
42
+ module.exports = __toCommonJS(loanUtils_exports);
43
+ var import_numeral = __toESM(require("numeral"), 1);
44
+ var ERL_COOKIE_NAME = "kverlfivedollarnotes";
45
+ var TOP_UP_CAMPAIGN = "TOPUP-VB-BALANCE-MPV1";
46
+ var BASE_CAMPAIGN = "BASE-VB_BALANCE_MPV1";
47
+ var BALANCE_CAMPAIGN = "REPAYMENT-NOTIFICATION_BALANCE_MPV1";
48
+ var NO_BALANCE_CAMPAIGN = "REPAYMENT-NOTIFICATION_NO-BALANCE_MPV1";
49
+ function balanceCampaignOptions(val) {
50
+ if (val > 20)
51
+ return 25;
52
+ if (val > 15)
53
+ return 20;
54
+ if (val > 10)
55
+ return 15;
56
+ if (val > 5)
57
+ return 10;
58
+ return 5;
59
+ }
60
+ function isBetween25And50(unreservedAmount) {
61
+ return unreservedAmount <= 50 && unreservedAmount > 25;
62
+ }
63
+ function isLessThan25(unreservedAmount) {
64
+ return unreservedAmount < 25 && unreservedAmount > 0;
65
+ }
66
+ function getLendCtaSelectedOption(getCookie, setCookie, enableFiveDollarsNotes, campaign, unreservedAmount, userBalance, fiveDollarsSelected) {
67
+ if (enableFiveDollarsNotes && fiveDollarsSelected) {
68
+ return "5";
69
+ }
70
+ if (enableFiveDollarsNotes && typeof userBalance !== "undefined") {
71
+ let currentCampaign = getCookie == null ? void 0 : getCookie(ERL_COOKIE_NAME);
72
+ if (campaign && typeof campaign === "string" && !currentCampaign) {
73
+ const expires = /* @__PURE__ */ new Date();
74
+ expires.setHours(expires.getHours() + 24);
75
+ const campaignToCheck = campaign.toUpperCase();
76
+ currentCampaign = campaignToCheck.includes(TOP_UP_CAMPAIGN) ? TOP_UP_CAMPAIGN : campaignToCheck.includes(BASE_CAMPAIGN) ? BASE_CAMPAIGN : campaignToCheck.includes(BALANCE_CAMPAIGN) ? BALANCE_CAMPAIGN : campaignToCheck.includes(NO_BALANCE_CAMPAIGN) ? NO_BALANCE_CAMPAIGN : "";
77
+ if (currentCampaign && setCookie) {
78
+ setCookie(ERL_COOKIE_NAME, currentCampaign, { expires });
79
+ }
80
+ }
81
+ if (currentCampaign) {
82
+ let val = Math.floor(userBalance / 5) * 5;
83
+ if (currentCampaign === BASE_CAMPAIGN) {
84
+ val = val === 0 ? 5 : val > 25 ? 25 : val;
85
+ return Number(val <= unreservedAmount ? val : unreservedAmount).toFixed();
86
+ }
87
+ if (currentCampaign === BALANCE_CAMPAIGN) {
88
+ val = balanceCampaignOptions(val);
89
+ return Number(val).toFixed();
90
+ }
91
+ return Number(unreservedAmount > 5 ? 5 : unreservedAmount).toFixed();
92
+ }
93
+ }
94
+ if (isBetween25And50(unreservedAmount) || isLessThan25(unreservedAmount)) {
95
+ return Number(unreservedAmount).toFixed();
96
+ }
97
+ return "25";
98
+ }
99
+ function buildHugePriceArray(amountLeft) {
100
+ const priceArray = [];
101
+ let minAmount = 100;
102
+ let limitAmount = amountLeft > 1e3 ? 1e3 : amountLeft;
103
+ let optionCount = limitAmount / minAmount;
104
+ for (let i = 1; i <= optionCount; i += 1) {
105
+ const price = minAmount * i + 500;
106
+ if (price > limitAmount)
107
+ break;
108
+ priceArray.push((0, import_numeral.default)(price).format("0,0"));
109
+ }
110
+ minAmount = 1e3;
111
+ limitAmount = amountLeft > 1e4 ? 1e4 : amountLeft;
112
+ optionCount = limitAmount / minAmount;
113
+ for (let i = 1; i <= optionCount; i += 1) {
114
+ const price = minAmount * i + 1e3;
115
+ if (price > limitAmount)
116
+ break;
117
+ priceArray.push((0, import_numeral.default)(price).format("0,0"));
118
+ }
119
+ if (!priceArray.includes((0, import_numeral.default)(limitAmount).format("0,0"))) {
120
+ priceArray.push((0, import_numeral.default)(limitAmount).format("0,0"));
121
+ }
122
+ return priceArray;
123
+ }
124
+ function build5DollarsPriceArray(amountLeft) {
125
+ const limit5Notes = amountLeft < 50 ? amountLeft : 50;
126
+ const numberOf5 = limit5Notes / 5;
127
+ const numberOf25 = Math.ceil((amountLeft - limit5Notes) / 25) + 1;
128
+ const priceArray = [];
129
+ for (let i = 1; i <= numberOf5; i += 1) {
130
+ priceArray.push((0, import_numeral.default)(5 * i).format("0,0"));
131
+ }
132
+ if (amountLeft > limit5Notes) {
133
+ for (let i = 3; i <= numberOf25; i += 1) {
134
+ priceArray.push((0, import_numeral.default)(25 * i).format("0,0"));
135
+ }
136
+ }
137
+ return priceArray;
138
+ }
139
+ function buildPriceArray(amountLeft, minAmount) {
140
+ const optionCount = amountLeft / minAmount;
141
+ const priceArray = [];
142
+ for (let i = 1; i <= optionCount; i += 1) {
143
+ priceArray.push((0, import_numeral.default)(minAmount * i).format("0,0"));
144
+ }
145
+ return priceArray;
146
+ }
147
+ function getDropdownPriceArray(unreservedAmount, isCompleteLoanActive = false, minAmount = 25, enableFiveDollarsNotes = false, enableHugeAmount = false, isVisitor = true, inPfp = false) {
148
+ const parsedAmountLeft = parseFloat(unreservedAmount);
149
+ let priceArray = enableFiveDollarsNotes && !inPfp ? build5DollarsPriceArray(parsedAmountLeft).slice(0, 28) : buildPriceArray(parsedAmountLeft, minAmount).slice(0, 20);
150
+ if (enableHugeAmount && parsedAmountLeft > 500 && !isVisitor) {
151
+ const hugePriceArray = buildHugePriceArray(parsedAmountLeft);
152
+ priceArray = priceArray.concat(hugePriceArray);
153
+ }
154
+ if (isCompleteLoanActive && !priceArray.includes(Number(unreservedAmount).toFixed())) {
155
+ priceArray.push(Number(unreservedAmount).toFixed());
156
+ }
157
+ return priceArray;
158
+ }
159
+ // Annotate the CommonJS export names for ESM import in node:
160
+ 0 && (module.exports = {
161
+ BALANCE_CAMPAIGN,
162
+ BASE_CAMPAIGN,
163
+ ERL_COOKIE_NAME,
164
+ NO_BALANCE_CAMPAIGN,
165
+ TOP_UP_CAMPAIGN,
166
+ getDropdownPriceArray,
167
+ getLendCtaSelectedOption,
168
+ isBetween25And50,
169
+ isLessThan25
170
+ });
@@ -0,0 +1,23 @@
1
+ import {
2
+ BALANCE_CAMPAIGN,
3
+ BASE_CAMPAIGN,
4
+ ERL_COOKIE_NAME,
5
+ NO_BALANCE_CAMPAIGN,
6
+ TOP_UP_CAMPAIGN,
7
+ getDropdownPriceArray,
8
+ getLendCtaSelectedOption,
9
+ isBetween25And50,
10
+ isLessThan25
11
+ } from "./chunk-YFEC5ODJ.js";
12
+ import "./chunk-YCNMJ4YV.js";
13
+ export {
14
+ BALANCE_CAMPAIGN,
15
+ BASE_CAMPAIGN,
16
+ ERL_COOKIE_NAME,
17
+ NO_BALANCE_CAMPAIGN,
18
+ TOP_UP_CAMPAIGN,
19
+ getDropdownPriceArray,
20
+ getLendCtaSelectedOption,
21
+ isBetween25And50,
22
+ isLessThan25
23
+ };