@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,159 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _address = require("./address");
7
+ Object.keys(_address).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _address[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _address[key];
14
+ }
15
+ });
16
+ });
17
+ var _cart = require("./cart");
18
+ Object.keys(_cart).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _cart[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _cart[key];
25
+ }
26
+ });
27
+ });
28
+ var _company = require("./company");
29
+ Object.keys(_company).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _company[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _company[key];
36
+ }
37
+ });
38
+ });
39
+ var _cookie = require("./cookie");
40
+ Object.keys(_cookie).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _cookie[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function get() {
46
+ return _cookie[key];
47
+ }
48
+ });
49
+ });
50
+ var _currency = require("./currency");
51
+ Object.keys(_currency).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _currency[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _currency[key];
58
+ }
59
+ });
60
+ });
61
+ var _helpers = require("./helpers");
62
+ Object.keys(_helpers).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _helpers[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function get() {
68
+ return _helpers[key];
69
+ }
70
+ });
71
+ });
72
+ var _invoice = require("./invoice");
73
+ Object.keys(_invoice).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _invoice[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _invoice[key];
80
+ }
81
+ });
82
+ });
83
+ var _job = require("./job");
84
+ Object.keys(_job).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _job[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function get() {
90
+ return _job[key];
91
+ }
92
+ });
93
+ });
94
+ var _local_storage = require("./local_storage");
95
+ Object.keys(_local_storage).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _local_storage[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function get() {
101
+ return _local_storage[key];
102
+ }
103
+ });
104
+ });
105
+ var _product = require("./product");
106
+ Object.keys(_product).forEach(function (key) {
107
+ if (key === "default" || key === "__esModule") return;
108
+ if (key in exports && exports[key] === _product[key]) return;
109
+ Object.defineProperty(exports, key, {
110
+ enumerable: true,
111
+ get: function get() {
112
+ return _product[key];
113
+ }
114
+ });
115
+ });
116
+ var _shipment = require("./shipment");
117
+ Object.keys(_shipment).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ if (key in exports && exports[key] === _shipment[key]) return;
120
+ Object.defineProperty(exports, key, {
121
+ enumerable: true,
122
+ get: function get() {
123
+ return _shipment[key];
124
+ }
125
+ });
126
+ });
127
+ var _tabs = require("./tabs");
128
+ Object.keys(_tabs).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _tabs[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function get() {
134
+ return _tabs[key];
135
+ }
136
+ });
137
+ });
138
+ var _user = require("./user");
139
+ Object.keys(_user).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _user[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function get() {
145
+ return _user[key];
146
+ }
147
+ });
148
+ });
149
+ var _variations = require("./variations");
150
+ Object.keys(_variations).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _variations[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function get() {
156
+ return _variations[key];
157
+ }
158
+ });
159
+ });
@@ -0,0 +1,3 @@
1
+ export declare function generatePublicInvoicePdf(apiUrl: string, invoice: any, receipt?: boolean): Promise<{
2
+ success: boolean;
3
+ }>;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generatePublicInvoicePdf = generatePublicInvoicePdf;
7
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
8
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
9
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
+ var urlToFile = /*#__PURE__*/function () {
12
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url, filename, type) {
13
+ var res, buf;
14
+ return _regenerator().w(function (_context) {
15
+ while (1) switch (_context.n) {
16
+ case 0:
17
+ _context.n = 1;
18
+ return fetch(url);
19
+ case 1:
20
+ res = _context.v;
21
+ _context.n = 2;
22
+ return res.arrayBuffer();
23
+ case 2:
24
+ buf = _context.v;
25
+ return _context.a(2, new File([buf], filename, {
26
+ type: type
27
+ }));
28
+ }
29
+ }, _callee);
30
+ }));
31
+ return function urlToFile(_x, _x2, _x3) {
32
+ return _ref.apply(this, arguments);
33
+ };
34
+ }();
35
+ var urlToFilePdf = /*#__PURE__*/function () {
36
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(url, filename) {
37
+ var file;
38
+ return _regenerator().w(function (_context2) {
39
+ while (1) switch (_context2.n) {
40
+ case 0:
41
+ _context2.n = 1;
42
+ return urlToFile(url, filename, 'application/pdf');
43
+ case 1:
44
+ file = _context2.v;
45
+ return _context2.a(2, file);
46
+ }
47
+ }, _callee2);
48
+ }));
49
+ return function urlToFilePdf(_x4, _x5) {
50
+ return _ref2.apply(this, arguments);
51
+ };
52
+ }();
53
+ function generatePublicInvoicePdf(_x6, _x7, _x8) {
54
+ return _generatePublicInvoicePdf.apply(this, arguments);
55
+ }
56
+ function _generatePublicInvoicePdf() {
57
+ _generatePublicInvoicePdf = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(apiUrl, invoice, receipt) {
58
+ var id, domain, queryString, fetchOptions, uri, response, r, pdf, url, doc, anchor, _t;
59
+ return _regenerator().w(function (_context3) {
60
+ while (1) switch (_context3.p = _context3.n) {
61
+ case 0:
62
+ id = invoice.id;
63
+ domain = invoice.domain.emailDomain;
64
+ queryString = new URLSearchParams({
65
+ invoice_token: invoice.invoiceToken
66
+ }).toString();
67
+ fetchOptions = {
68
+ method: 'GET',
69
+ mode: 'cors'
70
+ };
71
+ uri = receipt ? '/generate/receipt/pdf/' : '/generate/pdf/';
72
+ _context3.p = 1;
73
+ _context3.n = 2;
74
+ return fetch("".concat(apiUrl, "invoices/").concat(id).concat(uri, "?").concat(queryString), fetchOptions);
75
+ case 2:
76
+ response = _context3.v;
77
+ if (response.ok) {
78
+ _context3.n = 3;
79
+ break;
80
+ }
81
+ throw new Error("Error fetching PDF.");
82
+ case 3:
83
+ _context3.n = 4;
84
+ return response.json();
85
+ case 4:
86
+ r = _context3.v;
87
+ _context3.n = 5;
88
+ return urlToFilePdf("data:application/pdf;base64,".concat(r.pdf), "".concat(domain, "-invoice-").concat(id, ".pdf"));
89
+ case 5:
90
+ pdf = _context3.v;
91
+ url = URL.createObjectURL(pdf);
92
+ doc = document;
93
+ anchor = doc.createElement('a');
94
+ anchor.href = url;
95
+ anchor.download = pdf.name;
96
+
97
+ // Append to the DOM
98
+ doc.body.appendChild(anchor);
99
+
100
+ // Trigger `click` event
101
+ anchor.click();
102
+
103
+ // Remove element from DOM
104
+ doc.body.removeChild(anchor);
105
+ return _context3.a(2, {
106
+ success: true
107
+ });
108
+ case 6:
109
+ _context3.p = 6;
110
+ _t = _context3.v;
111
+ throw _t;
112
+ case 7:
113
+ return _context3.a(2);
114
+ }
115
+ }, _callee3, null, [[1, 6]]);
116
+ }));
117
+ return _generatePublicInvoicePdf.apply(this, arguments);
118
+ }
@@ -0,0 +1 @@
1
+ export declare function makeJob(jobJson: any, makeDirty?: boolean, arrayValueStrict?: boolean): any;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeJob = makeJob;
7
+ var _sdk = require("@merchi/sdk");
8
+ function makeJob(jobJson, makeDirty, arrayValueStrict) {
9
+ var merchi = new _sdk.Merchi();
10
+ var job = new merchi.Job();
11
+ return job.fromJson(jobJson, {
12
+ makeDirty: !!makeDirty,
13
+ arrayValueStrict: !!arrayValueStrict
14
+ });
15
+ }
@@ -0,0 +1,31 @@
1
+ export interface SavedCheckoutCustomer {
2
+ id?: number;
3
+ name?: string;
4
+ emailAddress?: string;
5
+ phoneNumbers?: Array<{
6
+ code?: string;
7
+ number?: string;
8
+ }>;
9
+ }
10
+ export interface SavedCheckoutAddress {
11
+ city?: string;
12
+ country?: string;
13
+ lineOne?: string;
14
+ lineTwo?: string;
15
+ postcode?: string;
16
+ state?: string;
17
+ }
18
+ export interface SavedCheckoutDraft {
19
+ customer?: SavedCheckoutCustomer;
20
+ address?: SavedCheckoutAddress;
21
+ receiverNotes?: string;
22
+ }
23
+ export declare function getSavedCheckoutDraft(domainId?: number | string | null): SavedCheckoutDraft;
24
+ export declare function getSavedCheckoutCustomer(domainId?: number | string | null): SavedCheckoutCustomer | undefined;
25
+ export declare function getSavedCheckoutAddress(domainId?: number | string | null): {
26
+ address?: SavedCheckoutAddress;
27
+ receiverNotes?: string;
28
+ };
29
+ export declare function saveCheckoutCustomer(domainId: number | string | undefined | null, customer: SavedCheckoutCustomer): void;
30
+ export declare function saveCheckoutAddress(domainId: number | string | undefined | null, address: SavedCheckoutAddress | null | undefined, receiverNotes?: string): void;
31
+ export declare function addressHasContent(address?: SavedCheckoutAddress | null): boolean;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addressHasContent = addressHasContent;
7
+ exports.getSavedCheckoutAddress = getSavedCheckoutAddress;
8
+ exports.getSavedCheckoutCustomer = getSavedCheckoutCustomer;
9
+ exports.getSavedCheckoutDraft = getSavedCheckoutDraft;
10
+ exports.saveCheckoutAddress = saveCheckoutAddress;
11
+ exports.saveCheckoutCustomer = saveCheckoutCustomer;
12
+ var _browserOrNode = require("browser-or-node");
13
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ 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); }
19
+ function storageKey(domainId) {
20
+ return "merchi-cart-checkout-".concat(domainId);
21
+ }
22
+ function readDraft(domainId) {
23
+ if (!_browserOrNode.isBrowser || domainId === undefined || domainId === null) {
24
+ return {};
25
+ }
26
+ try {
27
+ var raw = localStorage.getItem(storageKey(domainId));
28
+ if (!raw) return {};
29
+ var parsed = JSON.parse(raw);
30
+ return parsed && _typeof(parsed) === 'object' ? parsed : {};
31
+ } catch (_unused) {
32
+ return {};
33
+ }
34
+ }
35
+ function writeDraft(domainId, draft) {
36
+ if (!_browserOrNode.isBrowser || domainId === undefined || domainId === null) {
37
+ return;
38
+ }
39
+ try {
40
+ localStorage.setItem(storageKey(domainId), JSON.stringify(draft));
41
+ } catch (_unused2) {
42
+ // Ignore quota / private-mode failures.
43
+ }
44
+ }
45
+ function getSavedCheckoutDraft(domainId) {
46
+ return readDraft(domainId);
47
+ }
48
+ function getSavedCheckoutCustomer(domainId) {
49
+ return readDraft(domainId).customer;
50
+ }
51
+ function getSavedCheckoutAddress(domainId) {
52
+ var draft = readDraft(domainId);
53
+ return {
54
+ address: draft.address,
55
+ receiverNotes: draft.receiverNotes
56
+ };
57
+ }
58
+ function saveCheckoutCustomer(domainId, customer) {
59
+ var draft = readDraft(domainId);
60
+ var nextCustomer = _objectSpread(_objectSpread({}, draft.customer), customer);
61
+ // Drop empty phone entries.
62
+ if (nextCustomer.phoneNumbers) {
63
+ nextCustomer.phoneNumbers = nextCustomer.phoneNumbers.filter(function (phone) {
64
+ return phone && (phone.number || phone.code);
65
+ });
66
+ if (!nextCustomer.phoneNumbers.length) {
67
+ delete nextCustomer.phoneNumbers;
68
+ }
69
+ }
70
+ writeDraft(domainId, _objectSpread(_objectSpread({}, draft), {}, {
71
+ customer: nextCustomer
72
+ }));
73
+ }
74
+ function saveCheckoutAddress(domainId, address, receiverNotes) {
75
+ if (!address) return;
76
+ var draft = readDraft(domainId);
77
+ var nextAddress = {
78
+ city: address.city || '',
79
+ country: address.country || '',
80
+ lineOne: address.lineOne || '',
81
+ lineTwo: address.lineTwo || '',
82
+ postcode: address.postcode || '',
83
+ state: address.state || ''
84
+ };
85
+ var next = _objectSpread(_objectSpread({}, draft), {}, {
86
+ address: nextAddress
87
+ });
88
+ if (receiverNotes !== undefined) {
89
+ next.receiverNotes = receiverNotes;
90
+ }
91
+ writeDraft(domainId, next);
92
+ }
93
+ function addressHasContent(address) {
94
+ if (!address) return false;
95
+ return Boolean(address.lineOne || address.lineTwo || address.city || address.state || address.postcode || address.country);
96
+ }
@@ -0,0 +1,2 @@
1
+ export declare function productFeatureImageUrl(product: any): any;
2
+ export declare const makeProduct: (json: any, makeDirty?: boolean) => any;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeProduct = void 0;
7
+ exports.productFeatureImageUrl = productFeatureImageUrl;
8
+ var _sdk = require("@merchi/sdk");
9
+ var _productNotFound = _interopRequireDefault(require("../assets/product-not-found.png"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function productFeatureImageUrl(product) {
12
+ var featureImage = product.featureImage;
13
+ return featureImage && featureImage.viewUrl ? featureImage.viewUrl : _productNotFound["default"].src || _productNotFound["default"];
14
+ }
15
+ var makeProduct = exports.makeProduct = function makeProduct(json, makeDirty) {
16
+ var merchi = new _sdk.Merchi();
17
+ var product = new merchi.Product();
18
+ return product.fromJson(json, {
19
+ makeDirty: makeDirty
20
+ });
21
+ };
@@ -0,0 +1,2 @@
1
+ export declare const shipmentFormId = "_shipment-address-form-id";
2
+ export declare function cartItemsNeedShipment(cart: any): boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cartItemsNeedShipment = cartItemsNeedShipment;
7
+ exports.shipmentFormId = void 0;
8
+ var shipmentFormId = exports.shipmentFormId = '_shipment-address-form-id';
9
+ function cartItemsNeedShipment(cart) {
10
+ var _cart$cartItems = cart.cartItems,
11
+ cartItems = _cart$cartItems === void 0 ? [] : _cart$cartItems;
12
+ for (var i = 0; i < cartItems.length; i++) {
13
+ if (cartItems[i].product && cartItems[i].product.needsShipping) {
14
+ return true;
15
+ }
16
+ }
17
+ return false;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { Tab } from '../types';
2
+ export declare const tabIdClearCart = -2;
3
+ export declare const tabIdItem = -1;
4
+ export declare const tabIdItems = 0;
5
+ export declare const tabIdShipment = 1;
6
+ export declare const tabIdCheckout = 2;
7
+ export declare const tabIdPaymentSuccess = 3;
8
+ export declare const tabItems: Tab;
9
+ export declare const tabShipment: Tab;
10
+ export declare const tabCheckout: Tab;
11
+ export declare const initTabs: Tab[];
12
+ export declare const tabsWithShipment: Tab[];
13
+ export declare function setDisableTab(tab: any, disabled: boolean): any;
14
+ export declare function cartHasShippmentGroupsAndAllHaveSelectedGroups(cart: any): boolean;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cartHasShippmentGroupsAndAllHaveSelectedGroups = cartHasShippmentGroupsAndAllHaveSelectedGroups;
7
+ exports.initTabs = void 0;
8
+ exports.setDisableTab = setDisableTab;
9
+ exports.tabsWithShipment = exports.tabShipment = exports.tabItems = exports.tabIdShipment = exports.tabIdPaymentSuccess = exports.tabIdItems = exports.tabIdItem = exports.tabIdClearCart = exports.tabIdCheckout = exports.tabCheckout = void 0;
10
+ var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
11
+ 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); }
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ var tabIdClearCart = exports.tabIdClearCart = -2;
18
+ var tabIdItem = exports.tabIdItem = -1;
19
+ var tabIdItems = exports.tabIdItems = 0;
20
+ var tabIdShipment = exports.tabIdShipment = 1;
21
+ var tabIdCheckout = exports.tabIdCheckout = 2;
22
+ var tabIdPaymentSuccess = exports.tabIdPaymentSuccess = 3;
23
+ var tabItems = exports.tabItems = {
24
+ disabled: false,
25
+ icon: _freeSolidSvgIcons.faShoppingCart,
26
+ tabId: tabIdItems,
27
+ name: 'Items'
28
+ };
29
+ var tabShipment = exports.tabShipment = {
30
+ disabled: true,
31
+ icon: _freeSolidSvgIcons.faMapMarkerAlt,
32
+ tabId: tabIdShipment,
33
+ name: 'Address'
34
+ };
35
+ var tabCheckout = exports.tabCheckout = {
36
+ disabled: true,
37
+ icon: _freeSolidSvgIcons.faCreditCard,
38
+ tabId: tabIdCheckout,
39
+ name: 'Checkout'
40
+ };
41
+ var tabCheckoutSuccess = {
42
+ disabled: true,
43
+ icon: _freeSolidSvgIcons.faCheckCircle,
44
+ tabId: tabIdPaymentSuccess,
45
+ name: 'Success'
46
+ };
47
+ var initTabs = exports.initTabs = [tabItems, tabCheckout, tabCheckoutSuccess];
48
+ var tabsWithShipment = exports.tabsWithShipment = [tabItems, tabShipment, tabCheckout, tabCheckoutSuccess];
49
+ function setDisableTab(tab, disabled) {
50
+ return _objectSpread(_objectSpread({}, tab), {}, {
51
+ disabled: disabled
52
+ });
53
+ }
54
+ function cartHasShippmentGroupsAndAllHaveSelectedGroups(cart) {
55
+ var shipmentGroups = cart.shipmentGroups ? cart.shipmentGroups : [];
56
+ var haveSelectedQuotes = shipmentGroups.map(function (g) {
57
+ return Boolean(g.selectedQuote);
58
+ });
59
+ return shipmentGroups.length && !haveSelectedQuotes.includes(false);
60
+ }
@@ -0,0 +1,5 @@
1
+ export declare function makeUser(userJson: any, makeDirty?: boolean): any;
2
+ export declare function primaryEmail(user: any): any;
3
+ export declare function primaryPhone(user: any): any;
4
+ export declare function tryReturningCustomerEmail(emailAddress: string): Promise<any>;
5
+ export declare function createNewCustomer(customerJson: any): Promise<any>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createNewCustomer = createNewCustomer;
7
+ exports.makeUser = makeUser;
8
+ exports.primaryEmail = primaryEmail;
9
+ exports.primaryPhone = primaryPhone;
10
+ exports.tryReturningCustomerEmail = tryReturningCustomerEmail;
11
+ var _sdk = require("@merchi/sdk");
12
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
13
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
14
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
15
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
16
+ var merchi = new _sdk.Merchi();
17
+ function makeUser(userJson, makeDirty) {
18
+ var user = new merchi.User();
19
+ return user.fromJson(userJson, {
20
+ makeDirty: makeDirty
21
+ });
22
+ }
23
+ function primaryEmail(user) {
24
+ var _user$emailAddresses = user.emailAddresses,
25
+ emailAddresses = _user$emailAddresses === void 0 ? [] : _user$emailAddresses;
26
+ return emailAddresses[0] ? emailAddresses[0].emailAddress : '';
27
+ }
28
+ function primaryPhone(user) {
29
+ var _user$phoneNumbers = user.phoneNumbers,
30
+ phoneNumbers = _user$phoneNumbers === void 0 ? [] : _user$phoneNumbers;
31
+ return phoneNumbers[0] ? phoneNumbers[0].internationalFormatNumber : '';
32
+ }
33
+ function tryReturningCustomerEmail(_x) {
34
+ return _tryReturningCustomerEmail.apply(this, arguments);
35
+ }
36
+ function _tryReturningCustomerEmail() {
37
+ _tryReturningCustomerEmail = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(emailAddress) {
38
+ var merchi, query;
39
+ return _regenerator().w(function (_context) {
40
+ while (1) switch (_context.n) {
41
+ case 0:
42
+ merchi = new _sdk.Merchi();
43
+ query = [];
44
+ query.push(['email_address', emailAddress]);
45
+ _context.n = 1;
46
+ return merchi.authenticatedFetch('/user-check-email/', {
47
+ method: 'POST',
48
+ query: query
49
+ });
50
+ case 1:
51
+ return _context.a(2, _context.v);
52
+ }
53
+ }, _callee);
54
+ }));
55
+ return _tryReturningCustomerEmail.apply(this, arguments);
56
+ }
57
+ function createNewCustomer(_x2) {
58
+ return _createNewCustomer.apply(this, arguments);
59
+ }
60
+ function _createNewCustomer() {
61
+ _createNewCustomer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(customerJson) {
62
+ var user;
63
+ return _regenerator().w(function (_context2) {
64
+ while (1) switch (_context2.n) {
65
+ case 0:
66
+ user = makeUser(customerJson, true);
67
+ return _context2.a(2, merchi.authenticatedFetch('/public_user_create/', {
68
+ body: user.toFormData(),
69
+ method: 'POST'
70
+ }));
71
+ }
72
+ }, _callee2);
73
+ }));
74
+ return _createNewCustomer.apply(this, arguments);
75
+ }
@@ -0,0 +1,18 @@
1
+ export declare enum FieldType {
2
+ TEXT_INPUT = 1,
3
+ SELECT = 2,
4
+ FILE_UPLOAD = 3,
5
+ TEXT_AREA = 4,
6
+ NUMBER_INPUT = 5,
7
+ CHECKBOX = 6,
8
+ RADIO = 7,
9
+ FIELD_INSTRUCTIONS = 8,
10
+ IMAGE_SELECT = 9,
11
+ COLOUR_PICKER = 10,
12
+ COLOUR_SELECT = 11,
13
+ TURNAROUND_TIME = 12,
14
+ COLOUR_EXTRACT = 13,
15
+ AREA = 14
16
+ }
17
+ export declare function isSelectable(fieldType: number): boolean;
18
+ export declare function valueString(variation: any): any;