@merchi/cart 1.4.4

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 (372) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -0
  3. package/esm/Cart.js +62 -0
  4. package/esm/CartAlert.js +47 -0
  5. package/esm/CartHeader.js +29 -0
  6. package/esm/CartProvider.js +1101 -0
  7. package/esm/CartTotals.js +89 -0
  8. package/esm/assets/merchi-monster-loader.gif +0 -0
  9. package/esm/assets/merchi-swipe-outline.png +0 -0
  10. package/esm/assets/product-not-found.png +0 -0
  11. package/esm/assets/stripe-payment-secure.png +0 -0
  12. package/esm/buttons/Button.js +23 -0
  13. package/esm/buttons/ButtonBack.js +35 -0
  14. package/esm/buttons/ButtonClearCart.js +17 -0
  15. package/esm/buttons/ButtonInvoiceDownload.js +88 -0
  16. package/esm/buttons/ButtonNext.js +39 -0
  17. package/esm/buttons/ButtonNextDynamic.js +19 -0
  18. package/esm/buttons/ButtonOpenCartMerchiCartModal.js +47 -0
  19. package/esm/buttons/ButtonPay.js +26 -0
  20. package/esm/buttons/ButtonShipmentTabNext.js +28 -0
  21. package/esm/buttons/index.js +7 -0
  22. package/esm/components/Alert.js +26 -0
  23. package/esm/components/CartBody.js +14 -0
  24. package/esm/components/CartClient.js +62 -0
  25. package/esm/components/CartFooter.js +12 -0
  26. package/esm/components/CartItemRow.js +230 -0
  27. package/esm/components/CartPaymentSettingsInvalid.js +13 -0
  28. package/esm/components/CartShipment.js +52 -0
  29. package/esm/components/CartTabContent.js +12 -0
  30. package/esm/components/CartTabPanel.js +25 -0
  31. package/esm/components/CartTableContainer.js +12 -0
  32. package/esm/components/CartTitle.js +26 -0
  33. package/esm/components/CartTotalsListGroup.js +71 -0
  34. package/esm/components/Collapse.js +32 -0
  35. package/esm/components/CustomCartProductForm.js +128 -0
  36. package/esm/components/CustomerCheckoutMethodTabs.js +94 -0
  37. package/esm/components/DiscountInputGroup.js +293 -0
  38. package/esm/components/LoadingTemplate.js +23 -0
  39. package/esm/components/NoCartItems.js +20 -0
  40. package/esm/components/ShipmentGroupCard.js +207 -0
  41. package/esm/components/Table.js +13 -0
  42. package/esm/components/containers.js +31 -0
  43. package/esm/components/index.js +18 -0
  44. package/esm/components/product-form-sdk-externals.js +36 -0
  45. package/esm/forms/FormNewCustomer.js +243 -0
  46. package/esm/forms/FormReturningCustomer.js +165 -0
  47. package/esm/forms/FormShipmentAddressAndNotes.js +195 -0
  48. package/esm/forms/FormSquarePayment.js +19 -0
  49. package/esm/forms/FormStripePayment.js +19 -0
  50. package/esm/forms/FormWhatsappCustomer.js +253 -0
  51. package/esm/forms/InputAcceptUserTermsAndConditions.js +35 -0
  52. package/esm/forms/InputError.js +16 -0
  53. package/esm/forms/InputSelect.js +48 -0
  54. package/esm/forms/InputText.js +56 -0
  55. package/esm/forms/InputsAddress.js +476 -0
  56. package/esm/forms/index.js +8 -0
  57. package/esm/index.js +13 -0
  58. package/esm/modals.js +51 -0
  59. package/esm/panels/PanelCartItems.js +49 -0
  60. package/esm/panels/PanelCartShipment.js +66 -0
  61. package/esm/panels/PanelClearCart.js +56 -0
  62. package/esm/panels/PanelClientCheckout.js +81 -0
  63. package/esm/panels/PanelEditCartItem.js +199 -0
  64. package/esm/panels/PanelPaymentSuccess.js +63 -0
  65. package/esm/panels/index.js +7 -0
  66. package/esm/square/SquareCard.js +106 -0
  67. package/esm/stripe/LegacyStripeCardForm.js +157 -0
  68. package/esm/stripe/StripeCardFields.js +126 -0
  69. package/esm/stripe/StripeCardForm.js +33 -0
  70. package/esm/stripe/StripePaymentButtons.js +98 -0
  71. package/esm/stripe/actions.js +192 -0
  72. package/esm/stripe/utils.js +20 -0
  73. package/esm/styles/globals.css +463 -0
  74. package/esm/styles/globals.css.map +1 -0
  75. package/esm/tabs/CartNav.js +28 -0
  76. package/esm/tabs/NavTab.js +31 -0
  77. package/esm/types/assets.d.js +0 -0
  78. package/esm/types/index.js +1 -0
  79. package/esm/types/merchi_product_form/index.d.js +0 -0
  80. package/esm/types/merchi_sdk_ts/index.d.js +0 -0
  81. package/esm/types/react-redux/index.d.js +0 -0
  82. package/esm/utilities/address.js +457 -0
  83. package/esm/utilities/area.js +297 -0
  84. package/esm/utilities/cart.js +95 -0
  85. package/esm/utilities/company.js +6 -0
  86. package/esm/utilities/cookie.js +156 -0
  87. package/esm/utilities/currency.js +219 -0
  88. package/esm/utilities/customForm.js +57 -0
  89. package/esm/utilities/helpers.js +229 -0
  90. package/esm/utilities/index.js +14 -0
  91. package/esm/utilities/invoice.js +112 -0
  92. package/esm/utilities/job.js +9 -0
  93. package/esm/utilities/local_storage.js +85 -0
  94. package/esm/utilities/product.js +13 -0
  95. package/esm/utilities/shipment.js +11 -0
  96. package/esm/utilities/tabs.js +51 -0
  97. package/esm/utilities/user.js +65 -0
  98. package/esm/utilities/variations.js +58 -0
  99. package/lib/Cart.d.ts +9 -0
  100. package/lib/Cart.js +69 -0
  101. package/lib/CartAlert.d.ts +3 -0
  102. package/lib/CartAlert.js +53 -0
  103. package/lib/CartHeader.d.ts +3 -0
  104. package/lib/CartHeader.js +37 -0
  105. package/lib/CartProvider.d.ts +236 -0
  106. package/lib/CartProvider.js +1107 -0
  107. package/lib/CartTotals.d.ts +7 -0
  108. package/lib/CartTotals.js +96 -0
  109. package/lib/assets/merchi-monster-loader.gif +0 -0
  110. package/lib/assets/merchi-swipe-outline.png +0 -0
  111. package/lib/assets/product-not-found.png +0 -0
  112. package/lib/assets/stripe-payment-secure.png +0 -0
  113. package/lib/buttons/Button.d.ts +11 -0
  114. package/lib/buttons/Button.js +31 -0
  115. package/lib/buttons/ButtonBack.d.ts +6 -0
  116. package/lib/buttons/ButtonBack.js +44 -0
  117. package/lib/buttons/ButtonClearCart.d.ts +3 -0
  118. package/lib/buttons/ButtonClearCart.js +24 -0
  119. package/lib/buttons/ButtonInvoiceDownload.d.ts +3 -0
  120. package/lib/buttons/ButtonInvoiceDownload.js +96 -0
  121. package/lib/buttons/ButtonNext.d.ts +3 -0
  122. package/lib/buttons/ButtonNext.js +48 -0
  123. package/lib/buttons/ButtonNextDynamic.d.ts +3 -0
  124. package/lib/buttons/ButtonNextDynamic.js +28 -0
  125. package/lib/buttons/ButtonOpenCartMerchiCartModal.d.ts +9 -0
  126. package/lib/buttons/ButtonOpenCartMerchiCartModal.js +57 -0
  127. package/lib/buttons/ButtonPay.d.ts +7 -0
  128. package/lib/buttons/ButtonPay.js +35 -0
  129. package/lib/buttons/ButtonShipmentTabNext.d.ts +2 -0
  130. package/lib/buttons/ButtonShipmentTabNext.js +37 -0
  131. package/lib/buttons/index.d.ts +7 -0
  132. package/lib/buttons/index.js +48 -0
  133. package/lib/components/Alert.d.ts +7 -0
  134. package/lib/components/Alert.js +34 -0
  135. package/lib/components/CartBody.d.ts +7 -0
  136. package/lib/components/CartBody.js +22 -0
  137. package/lib/components/CartClient.d.ts +4 -0
  138. package/lib/components/CartClient.js +71 -0
  139. package/lib/components/CartFooter.d.ts +6 -0
  140. package/lib/components/CartFooter.js +20 -0
  141. package/lib/components/CartItemRow.d.ts +7 -0
  142. package/lib/components/CartItemRow.js +236 -0
  143. package/lib/components/CartPaymentSettingsInvalid.d.ts +2 -0
  144. package/lib/components/CartPaymentSettingsInvalid.js +21 -0
  145. package/lib/components/CartShipment.d.ts +6 -0
  146. package/lib/components/CartShipment.js +59 -0
  147. package/lib/components/CartTabContent.d.ts +6 -0
  148. package/lib/components/CartTabContent.js +20 -0
  149. package/lib/components/CartTabPanel.d.ts +7 -0
  150. package/lib/components/CartTabPanel.js +31 -0
  151. package/lib/components/CartTableContainer.d.ts +6 -0
  152. package/lib/components/CartTableContainer.js +20 -0
  153. package/lib/components/CartTitle.d.ts +2 -0
  154. package/lib/components/CartTitle.js +34 -0
  155. package/lib/components/CartTotalsListGroup.d.ts +3 -0
  156. package/lib/components/CartTotalsListGroup.js +78 -0
  157. package/lib/components/Collapse.d.ts +3 -0
  158. package/lib/components/Collapse.js +40 -0
  159. package/lib/components/CustomCartProductForm.d.ts +18 -0
  160. package/lib/components/CustomCartProductForm.js +136 -0
  161. package/lib/components/CustomerCheckoutMethodTabs.d.ts +6 -0
  162. package/lib/components/CustomerCheckoutMethodTabs.js +103 -0
  163. package/lib/components/DiscountInputGroup.d.ts +2 -0
  164. package/lib/components/DiscountInputGroup.js +301 -0
  165. package/lib/components/LoadingTemplate.d.ts +7 -0
  166. package/lib/components/LoadingTemplate.js +30 -0
  167. package/lib/components/NoCartItems.d.ts +3 -0
  168. package/lib/components/NoCartItems.js +27 -0
  169. package/lib/components/ShipmentGroupCard.d.ts +7 -0
  170. package/lib/components/ShipmentGroupCard.js +215 -0
  171. package/lib/components/Table.d.ts +7 -0
  172. package/lib/components/Table.js +19 -0
  173. package/lib/components/containers.d.ts +14 -0
  174. package/lib/components/containers.js +40 -0
  175. package/lib/components/index.d.ts +18 -0
  176. package/lib/components/index.js +133 -0
  177. package/lib/components/product-form-sdk-externals.d.ts +46 -0
  178. package/lib/components/product-form-sdk-externals.js +43 -0
  179. package/lib/forms/FormNewCustomer.d.ts +4 -0
  180. package/lib/forms/FormNewCustomer.js +252 -0
  181. package/lib/forms/FormReturningCustomer.d.ts +3 -0
  182. package/lib/forms/FormReturningCustomer.js +173 -0
  183. package/lib/forms/FormShipmentAddressAndNotes.d.ts +15 -0
  184. package/lib/forms/FormShipmentAddressAndNotes.js +203 -0
  185. package/lib/forms/FormSquarePayment.d.ts +3 -0
  186. package/lib/forms/FormSquarePayment.js +27 -0
  187. package/lib/forms/FormStripePayment.d.ts +3 -0
  188. package/lib/forms/FormStripePayment.js +27 -0
  189. package/lib/forms/FormWhatsappCustomer.d.ts +3 -0
  190. package/lib/forms/FormWhatsappCustomer.js +261 -0
  191. package/lib/forms/InputAcceptUserTermsAndConditions.d.ts +7 -0
  192. package/lib/forms/InputAcceptUserTermsAndConditions.js +41 -0
  193. package/lib/forms/InputError.d.ts +8 -0
  194. package/lib/forms/InputError.js +24 -0
  195. package/lib/forms/InputSelect.d.ts +14 -0
  196. package/lib/forms/InputSelect.js +55 -0
  197. package/lib/forms/InputText.d.ts +12 -0
  198. package/lib/forms/InputText.js +63 -0
  199. package/lib/forms/InputsAddress.d.ts +11 -0
  200. package/lib/forms/InputsAddress.js +485 -0
  201. package/lib/forms/index.d.ts +8 -0
  202. package/lib/forms/index.js +63 -0
  203. package/lib/index.d.ts +13 -0
  204. package/lib/index.js +93 -0
  205. package/lib/modals.d.ts +17 -0
  206. package/lib/modals.js +59 -0
  207. package/lib/panels/PanelCartItems.d.ts +3 -0
  208. package/lib/panels/PanelCartItems.js +56 -0
  209. package/lib/panels/PanelCartShipment.d.ts +3 -0
  210. package/lib/panels/PanelCartShipment.js +72 -0
  211. package/lib/panels/PanelClearCart.d.ts +3 -0
  212. package/lib/panels/PanelClearCart.js +62 -0
  213. package/lib/panels/PanelClientCheckout.d.ts +3 -0
  214. package/lib/panels/PanelClientCheckout.js +88 -0
  215. package/lib/panels/PanelEditCartItem.d.ts +6 -0
  216. package/lib/panels/PanelEditCartItem.js +206 -0
  217. package/lib/panels/PanelPaymentSuccess.d.ts +3 -0
  218. package/lib/panels/PanelPaymentSuccess.js +69 -0
  219. package/lib/panels/index.d.ts +7 -0
  220. package/lib/panels/index.js +48 -0
  221. package/lib/square/SquareCard.d.ts +3 -0
  222. package/lib/square/SquareCard.js +114 -0
  223. package/lib/stripe/LegacyStripeCardForm.d.ts +3 -0
  224. package/lib/stripe/LegacyStripeCardForm.js +166 -0
  225. package/lib/stripe/StripeCardFields.d.ts +15 -0
  226. package/lib/stripe/StripeCardFields.js +135 -0
  227. package/lib/stripe/StripeCardForm.d.ts +2 -0
  228. package/lib/stripe/StripeCardForm.js +42 -0
  229. package/lib/stripe/StripePaymentButtons.d.ts +8 -0
  230. package/lib/stripe/StripePaymentButtons.js +106 -0
  231. package/lib/stripe/actions.d.ts +4 -0
  232. package/lib/stripe/actions.js +200 -0
  233. package/lib/stripe/utils.d.ts +18 -0
  234. package/lib/stripe/utils.js +27 -0
  235. package/lib/styles/globals.css +463 -0
  236. package/lib/styles/globals.css.map +1 -0
  237. package/lib/tabs/CartNav.d.ts +3 -0
  238. package/lib/tabs/CartNav.js +36 -0
  239. package/lib/tabs/NavTab.d.ts +9 -0
  240. package/lib/tabs/NavTab.js +39 -0
  241. package/lib/types/index.d.ts +13 -0
  242. package/lib/types/index.js +1 -0
  243. package/lib/utilities/address.d.ts +30 -0
  244. package/lib/utilities/address.js +468 -0
  245. package/lib/utilities/area.d.ts +77 -0
  246. package/lib/utilities/area.js +328 -0
  247. package/lib/utilities/cart.d.ts +9 -0
  248. package/lib/utilities/cart.js +108 -0
  249. package/lib/utilities/company.d.ts +2 -0
  250. package/lib/utilities/company.js +13 -0
  251. package/lib/utilities/cookie.d.ts +4 -0
  252. package/lib/utilities/cookie.js +165 -0
  253. package/lib/utilities/currency.d.ts +5 -0
  254. package/lib/utilities/currency.js +229 -0
  255. package/lib/utilities/customForm.d.ts +17 -0
  256. package/lib/utilities/customForm.js +64 -0
  257. package/lib/utilities/helpers.d.ts +24 -0
  258. package/lib/utilities/helpers.js +240 -0
  259. package/lib/utilities/index.d.ts +14 -0
  260. package/lib/utilities/index.js +159 -0
  261. package/lib/utilities/invoice.d.ts +3 -0
  262. package/lib/utilities/invoice.js +118 -0
  263. package/lib/utilities/job.d.ts +1 -0
  264. package/lib/utilities/job.js +15 -0
  265. package/lib/utilities/local_storage.d.ts +31 -0
  266. package/lib/utilities/local_storage.js +96 -0
  267. package/lib/utilities/product.d.ts +2 -0
  268. package/lib/utilities/product.js +21 -0
  269. package/lib/utilities/shipment.d.ts +2 -0
  270. package/lib/utilities/shipment.js +18 -0
  271. package/lib/utilities/tabs.d.ts +14 -0
  272. package/lib/utilities/tabs.js +60 -0
  273. package/lib/utilities/user.d.ts +5 -0
  274. package/lib/utilities/user.js +75 -0
  275. package/lib/utilities/variations.d.ts +18 -0
  276. package/lib/utilities/variations.js +66 -0
  277. package/package.json +109 -0
  278. package/src/Cart.tsx +96 -0
  279. package/src/CartAlert.tsx +35 -0
  280. package/src/CartHeader.tsx +28 -0
  281. package/src/CartProvider.tsx +992 -0
  282. package/src/CartTotals.tsx +102 -0
  283. package/src/assets/merchi-monster-loader.gif +0 -0
  284. package/src/assets/merchi-swipe-outline.png +0 -0
  285. package/src/assets/product-not-found.png +0 -0
  286. package/src/assets/stripe-payment-secure.png +0 -0
  287. package/src/buttons/Button.tsx +35 -0
  288. package/src/buttons/ButtonBack.tsx +42 -0
  289. package/src/buttons/ButtonClearCart.tsx +17 -0
  290. package/src/buttons/ButtonInvoiceDownload.tsx +60 -0
  291. package/src/buttons/ButtonNext.tsx +35 -0
  292. package/src/buttons/ButtonNextDynamic.tsx +31 -0
  293. package/src/buttons/ButtonOpenCartMerchiCartModal.tsx +61 -0
  294. package/src/buttons/ButtonPay.tsx +32 -0
  295. package/src/buttons/ButtonShipmentTabNext.tsx +24 -0
  296. package/src/buttons/index.ts +15 -0
  297. package/src/components/Alert.tsx +31 -0
  298. package/src/components/CartBody.tsx +16 -0
  299. package/src/components/CartClient.tsx +52 -0
  300. package/src/components/CartFooter.tsx +15 -0
  301. package/src/components/CartItemRow.tsx +212 -0
  302. package/src/components/CartPaymentSettingsInvalid.tsx +12 -0
  303. package/src/components/CartShipment.tsx +56 -0
  304. package/src/components/CartTabContent.tsx +15 -0
  305. package/src/components/CartTabPanel.tsx +25 -0
  306. package/src/components/CartTableContainer.tsx +15 -0
  307. package/src/components/CartTitle.tsx +22 -0
  308. package/src/components/CartTotalsListGroup.tsx +58 -0
  309. package/src/components/Collapse.tsx +23 -0
  310. package/src/components/CustomCartProductForm.tsx +123 -0
  311. package/src/components/CustomerCheckoutMethodTabs.tsx +106 -0
  312. package/src/components/DiscountInputGroup.tsx +160 -0
  313. package/src/components/LoadingTemplate.tsx +22 -0
  314. package/src/components/NoCartItems.tsx +20 -0
  315. package/src/components/ShipmentGroupCard.tsx +170 -0
  316. package/src/components/Table.tsx +15 -0
  317. package/src/components/containers.tsx +40 -0
  318. package/src/components/index.ts +38 -0
  319. package/src/components/product-form-sdk-externals.ts +67 -0
  320. package/src/forms/FormNewCustomer.tsx +170 -0
  321. package/src/forms/FormReturningCustomer.tsx +117 -0
  322. package/src/forms/FormShipmentAddressAndNotes.tsx +165 -0
  323. package/src/forms/FormSquarePayment.tsx +19 -0
  324. package/src/forms/FormStripePayment.tsx +19 -0
  325. package/src/forms/FormWhatsappCustomer.tsx +179 -0
  326. package/src/forms/InputAcceptUserTermsAndConditions.tsx +43 -0
  327. package/src/forms/InputError.tsx +23 -0
  328. package/src/forms/InputSelect.tsx +58 -0
  329. package/src/forms/InputText.tsx +56 -0
  330. package/src/forms/InputsAddress.tsx +438 -0
  331. package/src/forms/index.ts +18 -0
  332. package/src/index.ts +31 -0
  333. package/src/modals.tsx +65 -0
  334. package/src/panels/PanelCartItems.tsx +56 -0
  335. package/src/panels/PanelCartShipment.tsx +86 -0
  336. package/src/panels/PanelClearCart.tsx +50 -0
  337. package/src/panels/PanelClientCheckout.tsx +102 -0
  338. package/src/panels/PanelEditCartItem.tsx +172 -0
  339. package/src/panels/PanelPaymentSuccess.tsx +66 -0
  340. package/src/panels/index.ts +15 -0
  341. package/src/square/SquareCard.tsx +84 -0
  342. package/src/stripe/LegacyStripeCardForm.tsx +91 -0
  343. package/src/stripe/StripeCardFields.tsx +173 -0
  344. package/src/stripe/StripeCardForm.tsx +18 -0
  345. package/src/stripe/StripePaymentButtons.tsx +117 -0
  346. package/src/stripe/actions.ts +94 -0
  347. package/src/stripe/utils.ts +22 -0
  348. package/src/styles/globals.scss +475 -0
  349. package/src/tabs/CartNav.tsx +18 -0
  350. package/src/tabs/NavTab.tsx +36 -0
  351. package/src/types/assets.d.ts +4 -0
  352. package/src/types/index.ts +15 -0
  353. package/src/types/merchi_product_form/index.d.ts +1 -0
  354. package/src/types/merchi_sdk_ts/index.d.ts +1 -0
  355. package/src/types/react-redux/index.d.ts +0 -0
  356. package/src/utilities/address.ts +463 -0
  357. package/src/utilities/area.ts +359 -0
  358. package/src/utilities/cart.ts +80 -0
  359. package/src/utilities/company.ts +8 -0
  360. package/src/utilities/cookie.ts +58 -0
  361. package/src/utilities/currency.ts +216 -0
  362. package/src/utilities/customForm.ts +71 -0
  363. package/src/utilities/helpers.ts +213 -0
  364. package/src/utilities/index.ts +14 -0
  365. package/src/utilities/invoice.ts +60 -0
  366. package/src/utilities/job.ts +13 -0
  367. package/src/utilities/local_storage.ts +130 -0
  368. package/src/utilities/product.ts +14 -0
  369. package/src/utilities/shipment.ts +11 -0
  370. package/src/utilities/tabs.ts +38 -0
  371. package/src/utilities/user.ts +33 -0
  372. package/src/utilities/variations.ts +80 -0
@@ -0,0 +1,468 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addressComponentsSettingsBackend = exports.addressComponentsSettings = void 0;
7
+ exports.addressInOneLine = addressInOneLine;
8
+ exports.geoSuggestResultAsNewAddress = geoSuggestResultAsNewAddress;
9
+ exports.googlePlacesResultAsNewAddress = googlePlacesResultAsNewAddress;
10
+ exports.makeAddress = makeAddress;
11
+ exports.sanitizeAddressFields = sanitizeAddressFields;
12
+ var _sdk = require("@merchi/sdk");
13
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
17
+ var merchi = new _sdk.Merchi();
18
+ function makeAddress(addressJson, makeDirty) {
19
+ var address = new merchi.Address();
20
+ return address.fromJson(addressJson, {
21
+ makeDirty: makeDirty
22
+ });
23
+ }
24
+
25
+ /** Plain address fields only — never reuse an existing address id (cart-token auth cannot PATCH it). */
26
+ function sanitizeAddressFields(address) {
27
+ var a = address && _typeof(address) === 'object' ? address : {};
28
+ return {
29
+ city: a.city || '',
30
+ country: a.country || '',
31
+ lineOne: a.lineOne || '',
32
+ lineTwo: a.lineTwo || '',
33
+ postcode: a.postcode || '',
34
+ state: a.state || ''
35
+ };
36
+ }
37
+ var isoCountries = {
38
+ AF: "Afghanistan",
39
+ AX: "Aland Islands",
40
+ AL: "Albania",
41
+ DZ: "Algeria",
42
+ AS: "American Samoa",
43
+ AD: "Andorra",
44
+ AO: "Angola",
45
+ AI: "Anguilla",
46
+ AQ: "Antarctica",
47
+ AG: "Antigua And Barbuda",
48
+ AR: "Argentina",
49
+ AM: "Armenia",
50
+ AW: "Aruba",
51
+ AU: "Australia",
52
+ AT: "Austria",
53
+ AZ: "Azerbaijan",
54
+ BS: "Bahamas",
55
+ BH: "Bahrain",
56
+ BD: "Bangladesh",
57
+ BB: "Barbados",
58
+ BY: "Belarus",
59
+ BE: "Belgium",
60
+ BZ: "Belize",
61
+ BJ: "Benin",
62
+ BM: "Bermuda",
63
+ BT: "Bhutan",
64
+ BO: "Bolivia",
65
+ BA: "Bosnia And Herzegovina",
66
+ BW: "Botswana",
67
+ BV: "Bouvet Island",
68
+ BR: "Brazil",
69
+ IO: "British Indian Ocean Territory",
70
+ BN: "Brunei Darussalam",
71
+ BG: "Bulgaria",
72
+ BF: "Burkina Faso",
73
+ BI: "Burundi",
74
+ KH: "Cambodia",
75
+ CM: "Cameroon",
76
+ CA: "Canada",
77
+ CV: "Cape Verde",
78
+ KY: "Cayman Islands",
79
+ CF: "Central African Republic",
80
+ TD: "Chad",
81
+ CL: "Chile",
82
+ CN: "China",
83
+ CX: "Christmas Island",
84
+ CC: "Cocos (Keeling) Islands",
85
+ CO: "Colombia",
86
+ KM: "Comoros",
87
+ CG: "Congo",
88
+ CD: "Congo, Democratic Republic",
89
+ CK: "Cook Islands",
90
+ CR: "Costa Rica",
91
+ CI: "Cote D'Ivoire",
92
+ HR: "Croatia",
93
+ CU: "Cuba",
94
+ CY: "Cyprus",
95
+ CZ: "Czech Republic",
96
+ DK: "Denmark",
97
+ DJ: "Djibouti",
98
+ DM: "Dominica",
99
+ DO: "Dominican Republic",
100
+ EC: "Ecuador",
101
+ EG: "Egypt",
102
+ SV: "El Salvador",
103
+ GQ: "Equatorial Guinea",
104
+ ER: "Eritrea",
105
+ EE: "Estonia",
106
+ ET: "Ethiopia",
107
+ FK: "Falkland Islands (Malvinas)",
108
+ FO: "Faroe Islands",
109
+ FJ: "Fiji",
110
+ FI: "Finland",
111
+ FR: "France",
112
+ GF: "French Guiana",
113
+ PF: "French Polynesia",
114
+ TF: "French Southern Territories",
115
+ GA: "Gabon",
116
+ GM: "Gambia",
117
+ GE: "Georgia",
118
+ DE: "Germany",
119
+ GH: "Ghana",
120
+ GI: "Gibraltar",
121
+ GR: "Greece",
122
+ GL: "Greenland",
123
+ GD: "Grenada",
124
+ GP: "Guadeloupe",
125
+ GU: "Guam",
126
+ GT: "Guatemala",
127
+ GG: "Guernsey",
128
+ GN: "Guinea",
129
+ GW: "Guinea-Bissau",
130
+ GY: "Guyana",
131
+ HT: "Haiti",
132
+ HM: "Heard Island & Mcdonald Islands",
133
+ VA: "Holy See (Vatican City State)",
134
+ HN: "Honduras",
135
+ HK: "Hong Kong",
136
+ HU: "Hungary",
137
+ IS: "Iceland",
138
+ IN: "India",
139
+ ID: "Indonesia",
140
+ IR: "Iran, Islamic Republic Of",
141
+ IQ: "Iraq",
142
+ IE: "Ireland",
143
+ IM: "Isle Of Man",
144
+ IL: "Israel",
145
+ IT: "Italy",
146
+ JM: "Jamaica",
147
+ JP: "Japan",
148
+ JE: "Jersey",
149
+ JO: "Jordan",
150
+ KZ: "Kazakhstan",
151
+ KE: "Kenya",
152
+ KI: "Kiribati",
153
+ KR: "Korea",
154
+ KW: "Kuwait",
155
+ KG: "Kyrgyzstan",
156
+ LA: "Lao People's Democratic Republic",
157
+ LV: "Latvia",
158
+ LB: "Lebanon",
159
+ LS: "Lesotho",
160
+ LR: "Liberia",
161
+ LY: "Libyan Arab Jamahiriya",
162
+ LI: "Liechtenstein",
163
+ LT: "Lithuania",
164
+ LU: "Luxembourg",
165
+ MO: "Macao",
166
+ MK: "Macedonia",
167
+ MG: "Madagascar",
168
+ MW: "Malawi",
169
+ MY: "Malaysia",
170
+ MV: "Maldives",
171
+ ML: "Mali",
172
+ MT: "Malta",
173
+ MH: "Marshall Islands",
174
+ MQ: "Martinique",
175
+ MR: "Mauritania",
176
+ MU: "Mauritius",
177
+ YT: "Mayotte",
178
+ MX: "Mexico",
179
+ FM: "Micronesia, Federated States Of",
180
+ MD: "Moldova",
181
+ MC: "Monaco",
182
+ MN: "Mongolia",
183
+ ME: "Montenegro",
184
+ MS: "Montserrat",
185
+ MA: "Morocco",
186
+ MZ: "Mozambique",
187
+ MM: "Myanmar",
188
+ NA: "Namibia",
189
+ NR: "Nauru",
190
+ NP: "Nepal",
191
+ NL: "Netherlands",
192
+ AN: "Netherlands Antilles",
193
+ NC: "New Caledonia",
194
+ NZ: "New Zealand",
195
+ NI: "Nicaragua",
196
+ NE: "Niger",
197
+ NG: "Nigeria",
198
+ NU: "Niue",
199
+ NF: "Norfolk Island",
200
+ MP: "Northern Mariana Islands",
201
+ NO: "Norway",
202
+ OM: "Oman",
203
+ PK: "Pakistan",
204
+ PW: "Palau",
205
+ PS: "Palestinian Territory, Occupied",
206
+ PA: "Panama",
207
+ PG: "Papua New Guinea",
208
+ PY: "Paraguay",
209
+ PE: "Peru",
210
+ PH: "Philippines",
211
+ PN: "Pitcairn",
212
+ PL: "Poland",
213
+ PT: "Portugal",
214
+ PR: "Puerto Rico",
215
+ QA: "Qatar",
216
+ RE: "Reunion",
217
+ RO: "Romania",
218
+ RU: "Russian Federation",
219
+ RW: "Rwanda",
220
+ BL: "Saint Barthelemy",
221
+ SH: "Saint Helena",
222
+ KN: "Saint Kitts And Nevis",
223
+ LC: "Saint Lucia",
224
+ MF: "Saint Martin",
225
+ PM: "Saint Pierre And Miquelon",
226
+ VC: "Saint Vincent And Grenadines",
227
+ WS: "Samoa",
228
+ SM: "San Marino",
229
+ ST: "Sao Tome And Principe",
230
+ SA: "Saudi Arabia",
231
+ SN: "Senegal",
232
+ RS: "Serbia",
233
+ SC: "Seychelles",
234
+ SL: "Sierra Leone",
235
+ SG: "Singapore",
236
+ SK: "Slovakia",
237
+ SI: "Slovenia",
238
+ SB: "Solomon Islands",
239
+ SO: "Somalia",
240
+ ZA: "South Africa",
241
+ GS: "South Georgia And Sandwich Isl.",
242
+ ES: "Spain",
243
+ LK: "Sri Lanka",
244
+ SD: "Sudan",
245
+ SR: "Suriname",
246
+ SJ: "Svalbard And Jan Mayen",
247
+ SZ: "Swaziland",
248
+ SE: "Sweden",
249
+ CH: "Switzerland",
250
+ SY: "Syrian Arab Republic",
251
+ TW: "Taiwan",
252
+ TJ: "Tajikistan",
253
+ TZ: "Tanzania",
254
+ TH: "Thailand",
255
+ TL: "Timor-Leste",
256
+ TG: "Togo",
257
+ TK: "Tokelau",
258
+ TO: "Tonga",
259
+ TT: "Trinidad And Tobago",
260
+ TN: "Tunisia",
261
+ TR: "Turkey",
262
+ TM: "Turkmenistan",
263
+ TC: "Turks And Caicos Islands",
264
+ TV: "Tuvalu",
265
+ UG: "Uganda",
266
+ UA: "Ukraine",
267
+ AE: "United Arab Emirates",
268
+ GB: "United Kingdom",
269
+ US: "United States",
270
+ UM: "United States Outlying Islands",
271
+ UY: "Uruguay",
272
+ UZ: "Uzbekistan",
273
+ VU: "Vanuatu",
274
+ VE: "Venezuela",
275
+ VN: "Viet Nam",
276
+ VG: "Virgin Islands, British",
277
+ VI: "Virgin Islands, U.S.",
278
+ WF: "Wallis And Futuna",
279
+ EH: "Western Sahara",
280
+ YE: "Yemen",
281
+ ZM: "Zambia",
282
+ ZW: "Zimbabwe"
283
+ };
284
+ function addressInOneLine(address) {
285
+ var a = address ? address : {};
286
+ var city = a.city,
287
+ country = a.country,
288
+ lineOne = a.lineOne,
289
+ lineTwo = a.lineTwo,
290
+ postcode = a.postcode,
291
+ state = a.state;
292
+ var l1 = lineOne ? "".concat(lineOne, " ") : '';
293
+ var l2 = lineTwo ? "".concat(lineTwo, " ") : '';
294
+ var c = city ? "".concat(city, " ") : '';
295
+ var s = state ? "".concat(state, " ") : '';
296
+ var p = postcode ? "".concat(postcode, " ") : '';
297
+ var countryFull = country ? isoCountries[country] : '';
298
+ return l1 + l2 + c + s + p + countryFull;
299
+ }
300
+ var addressComponentsSettings = exports.addressComponentsSettings = {
301
+ administrative_area_level_1: 'short_name',
302
+ administrative_area_level_2: 'short_name',
303
+ country: 'short_name',
304
+ establishment: 'long_name',
305
+ floor: 'short_name',
306
+ locality: 'long_name',
307
+ postal_code: 'short_name',
308
+ premise: 'short_name',
309
+ room: 'long_name',
310
+ route: 'short_name',
311
+ street_number: 'short_name',
312
+ sublocality: 'long_name',
313
+ subpremise: 'short_name'
314
+ };
315
+ var addressComponentsSettingsBackend = exports.addressComponentsSettingsBackend = {
316
+ administrative_area_level_1: 'shortName',
317
+ administrative_area_level_2: 'shortName',
318
+ country: 'shortName',
319
+ establishment: 'longName',
320
+ floor: 'shortName',
321
+ locality: 'longName',
322
+ postal_code: 'shortName',
323
+ premise: 'shortName',
324
+ room: 'longName',
325
+ route: 'shortName',
326
+ street_number: 'shortName',
327
+ sublocality: 'longName',
328
+ subpremise: 'shortName'
329
+ };
330
+ function googlePlacesResultAsNewAddress(placeDetails) {
331
+ var addressComponents = (placeDetails === null || placeDetails === void 0 ? void 0 : placeDetails.addressComponents) || [];
332
+ var name = (placeDetails === null || placeDetails === void 0 ? void 0 : placeDetails.name) || '';
333
+ var address = {
334
+ city: '',
335
+ country: '',
336
+ lineOne: name ? name : '',
337
+ lineTwo: '',
338
+ postcode: '',
339
+ state: ''
340
+ };
341
+ if (addressComponents && addressComponents.length > 0) {
342
+ for (var i = 0; i < addressComponents.length; i++) {
343
+ var addrComponent = addressComponents[i];
344
+ var addrTypes = addrComponent.types;
345
+ var addrType = null;
346
+ var componentSetting = null;
347
+ var _iterator = _createForOfIteratorHelper(addrTypes),
348
+ _step;
349
+ try {
350
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
351
+ var type = _step.value;
352
+ if (addressComponentsSettingsBackend[type]) {
353
+ addrType = type;
354
+ componentSetting = addressComponentsSettingsBackend[type];
355
+ break;
356
+ }
357
+ }
358
+ } catch (err) {
359
+ _iterator.e(err);
360
+ } finally {
361
+ _iterator.f();
362
+ }
363
+ if (componentSetting && addrType) {
364
+ var addressVal = addrComponent[componentSetting];
365
+ switch (addrType) {
366
+ case 'establishment':
367
+ case 'room':
368
+ case 'floor':
369
+ case 'street_number':
370
+ case 'premise':
371
+ case 'subpremise':
372
+ case 'route':
373
+ {
374
+ var oldLineOne = address.lineOne;
375
+ address.lineOne = oldLineOne.includes(addressVal) ? oldLineOne : "".concat(oldLineOne, " ").concat(addressVal).trim();
376
+ }
377
+ break;
378
+ case 'locality':
379
+ case 'sublocality':
380
+ {
381
+ var oldCity = address.city ? "".concat(address.city, " ") : '';
382
+ address.city = (oldCity + addressVal).trim();
383
+ }
384
+ break;
385
+ case 'administrative_area_level_1':
386
+ address.state = addressVal;
387
+ break;
388
+ case 'administrative_area_level_2':
389
+ break;
390
+ case 'country':
391
+ address.country = addressVal;
392
+ break;
393
+ case 'postal_code':
394
+ address.postcode = addressVal;
395
+ break;
396
+ default:
397
+ break;
398
+ }
399
+ }
400
+ }
401
+ if (!address.lineOne.trim() && placeDetails !== null && placeDetails !== void 0 && placeDetails.formattedAddress) {
402
+ var parts = placeDetails.formattedAddress.split(',');
403
+ if (parts.length > 0) {
404
+ address.lineOne = parts[0].trim();
405
+ }
406
+ }
407
+ return address;
408
+ }
409
+ return null;
410
+ }
411
+
412
+ /** @deprecated Legacy react-geosuggest parser; use googlePlacesResultAsNewAddress instead. */
413
+ function geoSuggestResultAsNewAddress(resp) {
414
+ var addressComponents = resp && resp.gmaps ? resp.gmaps.address_components : null;
415
+ var name = resp && resp.gmaps && resp.gmaps.name;
416
+ var address = {
417
+ city: '',
418
+ country: '',
419
+ lineOne: name ? name : '',
420
+ lineTwo: '',
421
+ postcode: '',
422
+ state: ''
423
+ };
424
+ var i;
425
+ if (addressComponents) {
426
+ for (i = 0; i < addressComponents.length; i++) {
427
+ var addrComponent = addressComponents[i];
428
+ var addrTypes = addrComponent.types;
429
+ var addrType = addrTypes.length > 0 ? addrTypes[0] : null;
430
+ var componentSetting = addrType ? addressComponentsSettings[addrType] : null;
431
+ if (componentSetting) {
432
+ var addressVal = addrComponent[componentSetting];
433
+ switch (addrType) {
434
+ case 'establishment':
435
+ case 'room':
436
+ case 'floor':
437
+ case 'street_number':
438
+ case 'premise':
439
+ case 'subpremise':
440
+ case 'route':
441
+ var oldLineOne = address.lineOne;
442
+ address.lineOne = oldLineOne.includes(addressVal) ? oldLineOne : "".concat(oldLineOne, " ").concat(addressVal);
443
+ break;
444
+ case 'locality':
445
+ case 'sublocality':
446
+ var oldCity = address.city ? "".concat(address.city, " ") : '';
447
+ address.city = oldCity + addressVal;
448
+ break;
449
+ case 'administrative_area_level_1':
450
+ address.state = addressVal;
451
+ break;
452
+ case 'administrative_area_level_2':
453
+ break;
454
+ case 'country':
455
+ address.country = addressVal;
456
+ break;
457
+ case 'postal_code':
458
+ address.postcode = addressVal;
459
+ break;
460
+ default:
461
+ break;
462
+ }
463
+ }
464
+ }
465
+ return address;
466
+ }
467
+ return null;
468
+ }
@@ -0,0 +1,77 @@
1
+ /** Shared helpers for Area (height × width) variation fields. Stored value is always millimetres. */
2
+ export type AreaUnit = 'mm' | 'cm' | 'm' | 'in' | 'ft';
3
+ export type AreaInputType = 'input' | 'slider';
4
+ export type DisplayModality = 'metric' | 'imperial';
5
+ export declare function parseAreaValue(value: string | null | undefined): {
6
+ heightMm: number;
7
+ widthMm: number;
8
+ } | null;
9
+ export declare function formatAreaValue(heightMm: number, widthMm: number): string;
10
+ export declare function isImperialUnit(unit: AreaUnit | string | null | undefined): boolean;
11
+ export declare function normaliseAreaUnit(unit?: string | null): AreaUnit;
12
+ /** Imperial for en-US / en-LR / en-MM; otherwise metric (incl. en-GB). */
13
+ export declare function localePrefersImperial(locale?: string): boolean;
14
+ /** Millimetres per one unit of the given area unit. */
15
+ export declare function unitFactorMm(unit?: AreaUnit | string): number;
16
+ /** @deprecated use unitFactorMm */
17
+ export declare function metricUnitFactor(unit?: AreaUnit): number;
18
+ export declare function mmToUnit(mm: number, unit?: AreaUnit | string): number;
19
+ export declare function unitToMm(value: number, unit?: AreaUnit | string): number;
20
+ /** @deprecated use mmToUnit */
21
+ export declare function mmToMetricDisplay(mm: number, unit?: AreaUnit): number;
22
+ /** @deprecated use unitToMm */
23
+ export declare function metricDisplayToMm(value: number, unit?: AreaUnit): number;
24
+ export declare function mmToInches(mm: number): number;
25
+ export declare function inchesToMm(inches: number): number;
26
+ /**
27
+ * Unit shown for the current buyer modality.
28
+ * Metric → field unit if metric, else mm.
29
+ * Imperial → field unit if imperial, else inches.
30
+ */
31
+ export declare function activeDisplayUnit(modality: DisplayModality, areaUnit?: AreaUnit | string): AreaUnit;
32
+ export declare function defaultModalityForAreaUnit(areaUnit?: AreaUnit | string): DisplayModality;
33
+ export declare function mmToDisplay(mm: number, modality: DisplayModality, areaUnit?: AreaUnit | string): number;
34
+ export declare function displayToMm(value: number, modality: DisplayModality, areaUnit?: AreaUnit | string): number;
35
+ export declare function unitLabel(modality: DisplayModality, areaUnit?: AreaUnit | string): string;
36
+ export declare function defaultAreaStep(unit?: AreaUnit | string): number;
37
+ /**
38
+ * Step for inputs/sliders in the current display unit.
39
+ * `stepMm` is the admin-configured step stored in millimetres.
40
+ */
41
+ export declare function stepInDisplayUnit(stepMm: number | null | undefined, modality: DisplayModality, areaUnit?: AreaUnit | string): number;
42
+ /** Format a length in mm for buyer-facing summary. */
43
+ export declare function formatLengthFromMm(mm: number, modality: DisplayModality, areaUnit?: AreaUnit | string): string;
44
+ export declare function formatAreaParts(value: string | null | undefined, modality?: DisplayModality, areaUnit?: AreaUnit | string): {
45
+ width: string;
46
+ height: string;
47
+ areaLabel: string;
48
+ } | null;
49
+ export declare function formatAreaSummary(value: string | null | undefined, modality?: DisplayModality, areaUnit?: AreaUnit | string): string | null;
50
+ export declare function clamp(n: number, min?: number | null, max?: number | null): number;
51
+ /**
52
+ * Client-side Area cost estimate (pre-discount), matching API formula:
53
+ * onceOff = heightCost × widthCost × height_u × width_u
54
+ * unitCost = heightUnit × widthUnit × height_u × width_u
55
+ * (dimensions expressed in the field's areaUnit)
56
+ */
57
+ export declare function estimateAreaCosts(variationField: any, value: string | null | undefined): {
58
+ onceOffCost: number;
59
+ unitCost: number;
60
+ } | null;
61
+ /**
62
+ * Keep width/height linked by aspectRatio (width/height).
63
+ * `changed` indicates which dimension the user edited.
64
+ */
65
+ export declare function clampWithAspectRatio(args: {
66
+ heightMm: number;
67
+ widthMm: number;
68
+ changed: 'height' | 'width';
69
+ aspectRatio: number;
70
+ heightMin?: number | null;
71
+ heightMax?: number | null;
72
+ widthMin?: number | null;
73
+ widthMax?: number | null;
74
+ }): {
75
+ heightMm: number;
76
+ widthMm: number;
77
+ };