@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,66 @@
1
+ import { faTruck } from '@fortawesome/free-solid-svg-icons';
2
+ import { ActiveFormShipmentAddressAndNotes } from '../forms/FormShipmentAddressAndNotes';
3
+ import { CheckoutContainer, InnerContainer } from '../components/containers';
4
+ import { Alert, CartBody, CartTabPanel, LoadingTemplateSm, ShipmentGroupCard, Title } from '../components';
5
+ import { tabIdShipment } from '../utilities/tabs';
6
+ import { useCartContext } from '../CartProvider';
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ function PanelCartShipment() {
9
+ var _useCartContext = useCartContext(),
10
+ cart = _useCartContext.cart,
11
+ fetchingShipmentGroups = _useCartContext.fetchingShipmentGroups;
12
+ var _cart$shipmentGroups = cart.shipmentGroups,
13
+ shipmentGroups = _cart$shipmentGroups === void 0 ? [] : _cart$shipmentGroups;
14
+ return /*#__PURE__*/_jsx(CartTabPanel, {
15
+ tabId: tabIdShipment,
16
+ children: /*#__PURE__*/_jsx(CartBody, {
17
+ style: {
18
+ paddingTop: '2rem'
19
+ },
20
+ children: /*#__PURE__*/_jsxs("div", {
21
+ className: "merchi-cart-tab-content",
22
+ children: [/*#__PURE__*/_jsx(CheckoutContainer, {
23
+ textAlign: "left",
24
+ children: /*#__PURE__*/_jsx(InnerContainer, {
25
+ width: 700,
26
+ paddingBottom: "3rem",
27
+ children: /*#__PURE__*/_jsx(ActiveFormShipmentAddressAndNotes, {})
28
+ })
29
+ }), /*#__PURE__*/_jsx(CheckoutContainer, {
30
+ textAlign: "center",
31
+ children: /*#__PURE__*/_jsx(InnerContainer, {
32
+ paddingBottom: "0px",
33
+ width: 700,
34
+ children: /*#__PURE__*/_jsx(Title, {
35
+ icon: faTruck,
36
+ title: shipmentGroups.length > 1 ? 'Select shipment methods' : shipmentGroups.length ? 'Select a shipment method' : ''
37
+ })
38
+ })
39
+ }), fetchingShipmentGroups ? /*#__PURE__*/_jsx(CheckoutContainer, {
40
+ children: /*#__PURE__*/_jsxs(InnerContainer, {
41
+ width: 700,
42
+ children: [/*#__PURE__*/_jsx(LoadingTemplateSm, {}), /*#__PURE__*/_jsx("p", {
43
+ children: "Fetching shipping options."
44
+ })]
45
+ })
46
+ }) : /*#__PURE__*/_jsx(CheckoutContainer, {
47
+ textAlign: "left",
48
+ children: /*#__PURE__*/_jsxs(InnerContainer, {
49
+ paddingBottom: "1rem",
50
+ width: 700,
51
+ children: [shipmentGroups.length > 1 && /*#__PURE__*/_jsx(Alert, {
52
+ alertType: "warning",
53
+ children: "Items within this cart are warehoused in different locations and will be shipped separately. Please select how you would like your items to be shipped."
54
+ }), shipmentGroups.map(function (group, index) {
55
+ return /*#__PURE__*/_jsx(ShipmentGroupCard, {
56
+ group: group,
57
+ groupIndex: index
58
+ }, "".concat(index, "-shipment-group"));
59
+ })]
60
+ })
61
+ })]
62
+ })
63
+ })
64
+ });
65
+ }
66
+ export default PanelCartShipment;
@@ -0,0 +1,56 @@
1
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
+ import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
3
+ import { tabIdClearCart } from '../utilities/tabs';
4
+ import { Button } from '../buttons';
5
+ import { CartBody, CartTabPanel } from '../components';
6
+ import { useCartContext } from '../CartProvider';
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ function PanelClearCart() {
9
+ var _useCartContext = useCartContext(),
10
+ classNameBtnDanger = _useCartContext.classNameBtnDanger,
11
+ classNameBtnDefault = _useCartContext.classNameBtnDefault,
12
+ classNameClearCartContainer = _useCartContext.classNameClearCartContainer,
13
+ classNameClearCartText = _useCartContext.classNameClearCartText,
14
+ clearCart = _useCartContext.clearCart,
15
+ closeClearCart = _useCartContext.closeClearCart;
16
+ return /*#__PURE__*/_jsx(CartTabPanel, {
17
+ tabId: tabIdClearCart,
18
+ children: /*#__PURE__*/_jsx(CartBody, {
19
+ children: /*#__PURE__*/_jsx("div", {
20
+ style: {
21
+ display: 'flex',
22
+ justifyContent: 'center',
23
+ minHeight: '450px'
24
+ },
25
+ children: /*#__PURE__*/_jsxs("div", {
26
+ className: classNameClearCartContainer,
27
+ children: [/*#__PURE__*/_jsx("h2", {
28
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
29
+ icon: faTrashAlt
30
+ })
31
+ }), /*#__PURE__*/_jsx("h3", {
32
+ children: "Clear Cart"
33
+ }), /*#__PURE__*/_jsx("p", {
34
+ className: classNameClearCartText,
35
+ children: "Are you sure you would like to clear this cart?"
36
+ }), /*#__PURE__*/_jsx("p", {
37
+ children: /*#__PURE__*/_jsx(Button, {
38
+ className: classNameBtnDefault,
39
+ onClick: closeClearCart,
40
+ children: "Cancel"
41
+ })
42
+ }), /*#__PURE__*/_jsx("p", {
43
+ children: /*#__PURE__*/_jsx(Button, {
44
+ className: classNameBtnDanger,
45
+ onClick: function onClick() {
46
+ return clearCart();
47
+ },
48
+ children: "Yes, clear cart"
49
+ })
50
+ })]
51
+ })
52
+ })
53
+ })
54
+ });
55
+ }
56
+ export default PanelClearCart;
@@ -0,0 +1,81 @@
1
+ import { tabIdCheckout } from '../utilities/tabs';
2
+ import { CheckoutContainer, InnerContainer } from '../components/containers';
3
+ import CartClient from '../components/CartClient';
4
+ import CartShipment from '../components/CartShipment';
5
+ import { CartBody, CartTabPanel, CustomerCheckoutMethodTabs, Title } from '../components';
6
+ import FormSquarePayment from '../forms/FormSquarePayment';
7
+ import FormStripePayment from '../forms/FormStripePayment';
8
+ import { faCoins, faCreditCard } from '@fortawesome/free-solid-svg-icons';
9
+ import { useCartContext } from '../CartProvider';
10
+ import DiscountInputGroup from '../components/DiscountInputGroup';
11
+ import CartTotalsListGroup from '../components/CartTotalsListGroup';
12
+ import { cartItemsNeedShipment } from '../utilities/shipment';
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ function PanelClientCheckout() {
15
+ var _useCartContext = useCartContext(),
16
+ cart = _useCartContext.cart,
17
+ cartClient = _useCartContext.cartClient,
18
+ showDiscountCode = _useCartContext.showDiscountCode;
19
+ var needsShipping = cartItemsNeedShipment(cart);
20
+ var domain = cart.domain;
21
+ var company = domain && domain.company;
22
+ var whatsappEnabled = Boolean(domain === null || domain === void 0 ? void 0 : domain.enableWhatsappNotifications);
23
+ return /*#__PURE__*/_jsx(CartTabPanel, {
24
+ tabId: tabIdCheckout,
25
+ children: /*#__PURE__*/_jsx(CartBody, {
26
+ style: {
27
+ paddingTop: '2rem'
28
+ },
29
+ children: cartClient && cartClient.id > -1 ? /*#__PURE__*/_jsxs(_Fragment, {
30
+ children: [/*#__PURE__*/_jsx(CheckoutContainer, {
31
+ children: /*#__PURE__*/_jsx(InnerContainer, {
32
+ paddingBottom: "3rem",
33
+ children: /*#__PURE__*/_jsx(CartClient, {})
34
+ })
35
+ }), needsShipping && /*#__PURE__*/_jsx(CheckoutContainer, {
36
+ children: /*#__PURE__*/_jsx(InnerContainer, {
37
+ paddingBottom: "3rem",
38
+ children: /*#__PURE__*/_jsx(CartShipment, {
39
+ cart: cart
40
+ })
41
+ })
42
+ }), showDiscountCode && /*#__PURE__*/_jsx(CheckoutContainer, {
43
+ children: /*#__PURE__*/_jsx(InnerContainer, {
44
+ paddingBottom: "3rem",
45
+ children: /*#__PURE__*/_jsx(DiscountInputGroup, {})
46
+ })
47
+ }), Boolean(company) && company.acceptSquare && /*#__PURE__*/_jsx(CheckoutContainer, {
48
+ children: /*#__PURE__*/_jsx(InnerContainer, {
49
+ paddingTop: "3rem",
50
+ paddingBottom: "3rem",
51
+ children: /*#__PURE__*/_jsx(FormSquarePayment, {})
52
+ })
53
+ }), /*#__PURE__*/_jsx(CheckoutContainer, {
54
+ children: /*#__PURE__*/_jsxs(InnerContainer, {
55
+ paddingBottom: "3rem",
56
+ children: [/*#__PURE__*/_jsx(Title, {
57
+ icon: faCoins,
58
+ title: "Cart total"
59
+ }), /*#__PURE__*/_jsx(CartTotalsListGroup, {})]
60
+ })
61
+ }), /*#__PURE__*/_jsx(CheckoutContainer, {
62
+ children: /*#__PURE__*/_jsxs(InnerContainer, {
63
+ paddingBottom: "3rem",
64
+ children: [/*#__PURE__*/_jsx(Title, {
65
+ icon: faCreditCard,
66
+ title: "Credit card payment"
67
+ }), /*#__PURE__*/_jsx(FormStripePayment, {})]
68
+ })
69
+ })]
70
+ }) : /*#__PURE__*/_jsx(CheckoutContainer, {
71
+ children: /*#__PURE__*/_jsx(InnerContainer, {
72
+ paddingBottom: "0px",
73
+ children: /*#__PURE__*/_jsx(CustomerCheckoutMethodTabs, {
74
+ whatsappEnabled: whatsappEnabled
75
+ })
76
+ })
77
+ })
78
+ })
79
+ });
80
+ }
81
+ export default PanelClientCheckout;
@@ -0,0 +1,199 @@
1
+ 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); }
2
+ 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 }; })(); }
3
+ 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); }
4
+ 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); }
5
+ 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); }); }; }
6
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ 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; } }
9
+ 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; }
10
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
11
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
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
+ import { Suspense, lazy, useState } from 'react';
18
+ import { tabIdItem, tabIdItems } from '../utilities/tabs';
19
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
20
+ import { faCircleNotch } from '@fortawesome/free-solid-svg-icons';
21
+ import { Button, ButtonBack } from '../buttons';
22
+ import { CartBody, CartFooter, CartTabPanel } from '../components';
23
+ import { LoadingTemplateSm } from '../components/LoadingTemplate';
24
+ import { useCartContext } from '../CartProvider';
25
+ import { makeCartItem } from '../utilities/cart';
26
+ import { getCartCookieToken } from '../utilities/cookie';
27
+ import { publishedFormBundle } from '../utilities/customForm';
28
+ import CustomCartProductForm from '../components/CustomCartProductForm';
29
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
+ var MerchiProductForm = /*#__PURE__*/lazy(function () {
31
+ return import('@merchi/product-form');
32
+ });
33
+ function cleanVariation(variation) {
34
+ var _variation$variationF = variation.variationField,
35
+ variationField = _variation$variationF === void 0 ? {} : _variation$variationF,
36
+ _variation$variationF2 = variation.variationFiles,
37
+ variationFiles = _variation$variationF2 === void 0 ? [] : _variation$variationF2;
38
+ return _objectSpread(_objectSpread({}, variation), {}, {
39
+ id: undefined,
40
+ value: variation.value,
41
+ variationField: {
42
+ id: variationField.id
43
+ },
44
+ variationFiles: variationFiles.map(function (f) {
45
+ return {
46
+ id: f.id
47
+ };
48
+ })
49
+ });
50
+ }
51
+ function cleanVariationGroups(variationsGroup) {
52
+ var _variationsGroup$quan = variationsGroup.quantity,
53
+ quantity = _variationsGroup$quan === void 0 ? 0 : _variationsGroup$quan,
54
+ _variationsGroup$vari = variationsGroup.variations,
55
+ variations = _variationsGroup$vari === void 0 ? [] : _variationsGroup$vari;
56
+ return {
57
+ idL: undefined,
58
+ quantity: quantity,
59
+ variations: variations === null || variations === void 0 ? void 0 : variations.map(cleanVariation)
60
+ };
61
+ }
62
+ function PanelEditCartItem(_ref) {
63
+ var _cartItem$product;
64
+ var cart = _ref.cart;
65
+ var _useCartContext = useCartContext(),
66
+ activeTabIndex = _useCartContext.activeTabIndex,
67
+ alertError = _useCartContext.alertError,
68
+ alertSuccess = _useCartContext.alertSuccess,
69
+ cartItem = _useCartContext.cartItem,
70
+ domainId = _useCartContext.domainId,
71
+ productFormClassNames = _useCartContext.productFormClassNames,
72
+ classNameBtnEditCartItem = _useCartContext.classNameBtnEditCartItem,
73
+ apiUrl = _useCartContext.apiUrl,
74
+ refetchCart = _useCartContext.refetchCart,
75
+ setActiveTabIndex = _useCartContext.setActiveTabIndex,
76
+ setCartItem = _useCartContext.setCartItem;
77
+ var _useState = useState(false),
78
+ _useState2 = _slicedToArray(_useState, 2),
79
+ loading = _useState2[0],
80
+ setLoading = _useState2[1];
81
+ var _useState3 = useState(false),
82
+ _useState4 = _slicedToArray(_useState3, 2),
83
+ customFormActive = _useState4[0],
84
+ setCustomFormActive = _useState4[1];
85
+ var formId = 'edit-cart-item-form';
86
+
87
+ // This action patches the cart item
88
+ function actionCartItemEdit(_x) {
89
+ return _actionCartItemEdit.apply(this, arguments);
90
+ }
91
+ function _actionCartItemEdit() {
92
+ _actionCartItemEdit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(cartItemJson) {
93
+ var cartToken, product, _cartItemJson$quantit, quantity, taxType, _cartItemJson$variati, variations, _cartItemJson$variati2, variationsGroups, cartItemEnt, _t;
94
+ return _regenerator().w(function (_context) {
95
+ while (1) switch (_context.p = _context.n) {
96
+ case 0:
97
+ setLoading(true);
98
+ _context.n = 1;
99
+ return getCartCookieToken(domainId);
100
+ case 1:
101
+ cartToken = _context.v;
102
+ _context.p = 2;
103
+ product = cartItemJson.product, _cartItemJson$quantit = cartItemJson.quantity, quantity = _cartItemJson$quantit === void 0 ? 0 : _cartItemJson$quantit, taxType = cartItemJson.taxType, _cartItemJson$variati = cartItemJson.variations, variations = _cartItemJson$variati === void 0 ? [] : _cartItemJson$variati, _cartItemJson$variati2 = cartItemJson.variationsGroups, variationsGroups = _cartItemJson$variati2 === void 0 ? [] : _cartItemJson$variati2;
104
+ cartItemEnt = makeCartItem(_objectSpread(_objectSpread({}, cartItem), {}, {
105
+ id: cartItem.id,
106
+ cart: {
107
+ id: cart.id
108
+ },
109
+ product: product ? {
110
+ id: product.id
111
+ } : undefined,
112
+ taxType: taxType ? {
113
+ id: taxType.id
114
+ } : undefined,
115
+ quantity: quantity,
116
+ variations: variations.map(cleanVariation),
117
+ variationsGroups: variationsGroups.map(cleanVariationGroups)
118
+ }), true, cartToken); // Save changes to the Cart Item
119
+ _context.n = 3;
120
+ return cartItemEnt.save();
121
+ case 3:
122
+ _context.n = 4;
123
+ return refetchCart();
124
+ case 4:
125
+ // Show success alert
126
+ alertSuccess('Item updated.');
127
+
128
+ // Set active Cart tab
129
+ setActiveTabIndex(tabIdItems);
130
+
131
+ // Clear Cart Item from state
132
+ setCartItem({});
133
+ _context.n = 6;
134
+ break;
135
+ case 5:
136
+ _context.p = 5;
137
+ _t = _context.v;
138
+ alertError(_t.errorMessage || _t.message || 'Unable to edit Cart Item.');
139
+ case 6:
140
+ _context.p = 6;
141
+ setLoading(false);
142
+ return _context.f(6);
143
+ case 7:
144
+ return _context.a(2);
145
+ }
146
+ }, _callee, null, [[2, 5, 6, 7]]);
147
+ }));
148
+ return _actionCartItemEdit.apply(this, arguments);
149
+ }
150
+ function onSubmit(jobJson) {
151
+ actionCartItemEdit(jobJson);
152
+ }
153
+ var cleanCartItem = _objectSpread(_objectSpread({}, cartItem), {}, {
154
+ id: undefined
155
+ });
156
+ var showForm = activeTabIndex === tabIdItem && !!(cartItem !== null && cartItem !== void 0 && cartItem.id) && !!(cartItem !== null && cartItem !== void 0 && (_cartItem$product = cartItem.product) !== null && _cartItem$product !== void 0 && _cartItem$product.id);
157
+ var hasPublishedCustomForm = !!publishedFormBundle(cartItem === null || cartItem === void 0 ? void 0 : cartItem.product);
158
+ var defaultForm = /*#__PURE__*/_jsx(Suspense, {
159
+ fallback: /*#__PURE__*/_jsx(LoadingTemplateSm, {}),
160
+ children: /*#__PURE__*/_jsx(MerchiProductForm, _objectSpread({
161
+ apiUrl: apiUrl,
162
+ isCartItem: true,
163
+ initJob: _objectSpread({}, cleanCartItem),
164
+ initProduct: cartItem.product,
165
+ onSubmit: onSubmit,
166
+ productFormId: formId,
167
+ hideRequestQuotationButton: true,
168
+ hidePaymentUpfrontButton: true
169
+ }, productFormClassNames))
170
+ });
171
+ return /*#__PURE__*/_jsxs(CartTabPanel, {
172
+ tabId: tabIdItem,
173
+ children: [/*#__PURE__*/_jsx(CartBody, {
174
+ style: {
175
+ padding: '2rem'
176
+ },
177
+ children: showForm && (hasPublishedCustomForm ? /*#__PURE__*/_jsx(CustomCartProductForm, {
178
+ product: cartItem.product,
179
+ initialJob: cleanCartItem,
180
+ apiUrl: apiUrl,
181
+ onSave: onSubmit,
182
+ fallback: defaultForm,
183
+ onActiveChange: setCustomFormActive
184
+ }) : defaultForm)
185
+ }), /*#__PURE__*/_jsxs(CartFooter, {
186
+ children: [/*#__PURE__*/_jsx(ButtonBack, {}), !customFormActive && /*#__PURE__*/_jsxs(Button, {
187
+ className: classNameBtnEditCartItem,
188
+ disabled: loading,
189
+ form: formId,
190
+ type: "submit",
191
+ children: [loading && /*#__PURE__*/_jsx(FontAwesomeIcon, {
192
+ icon: faCircleNotch,
193
+ spin: true
194
+ }), loading ? ' Loading...' : 'Save']
195
+ })]
196
+ })]
197
+ });
198
+ }
199
+ export default PanelEditCartItem;
@@ -0,0 +1,63 @@
1
+ import { CheckoutContainer, InnerContainer } from '../components/containers';
2
+ import { tabIdPaymentSuccess } from '../utilities/tabs';
3
+ import { companyPrimaryAddress } from '../utilities/company';
4
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
+ import { faCheckCircle } from '@fortawesome/free-solid-svg-icons';
6
+ import { Button, ButtonInvoiceDownload } from '../buttons';
7
+ import { CartBody, CartTabPanel } from '../components';
8
+ import { useCartContext } from '../CartProvider';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ function PanelPaymentSuccess() {
11
+ var _useCartContext = useCartContext(),
12
+ classNameBtnPrimary = _useCartContext.classNameBtnPrimary,
13
+ customSuccessMessage = _useCartContext.customSuccessMessage,
14
+ fetchingCart = _useCartContext.fetchingCart,
15
+ invoiceJson = _useCartContext.invoiceJson,
16
+ setCartComplete = _useCartContext.setCartComplete,
17
+ urlTrackingPage = _useCartContext.urlTrackingPage;
18
+ var domain = invoiceJson.domain,
19
+ id = invoiceJson.id,
20
+ unpaid = invoiceJson.unpaid;
21
+ var email = domain && domain.company ? companyPrimaryAddress(domain.company) : null;
22
+ return /*#__PURE__*/_jsx(CartTabPanel, {
23
+ tabId: tabIdPaymentSuccess,
24
+ children: /*#__PURE__*/_jsxs(CartBody, {
25
+ children: [/*#__PURE__*/_jsx(CheckoutContainer, {
26
+ children: /*#__PURE__*/_jsxs(InnerContainer, {
27
+ children: [/*#__PURE__*/_jsx("h2", {
28
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
29
+ icon: faCheckCircle
30
+ })
31
+ }), /*#__PURE__*/_jsxs("h3", {
32
+ children: ["Order #", id]
33
+ }), /*#__PURE__*/_jsx("h4", {
34
+ children: "Payment Received!"
35
+ }), customSuccessMessage ? /*#__PURE__*/_jsx("p", {
36
+ className: "merchi-cart-success-message ",
37
+ children: customSuccessMessage
38
+ }) : /*#__PURE__*/_jsxs("p", {
39
+ className: "merchi-cart-success-message ",
40
+ children: ["Your order #", id, " is being processed and you should receive an email from us shortly. If you haven't heard from us within 24 hours please feel free to contact us", email ? " at ".concat(email.emailAddress, ".") : '.']
41
+ }), !unpaid && /*#__PURE__*/_jsx("p", {
42
+ children: /*#__PURE__*/_jsx(ButtonInvoiceDownload, {})
43
+ }), /*#__PURE__*/_jsx("p", {
44
+ children: /*#__PURE__*/_jsx(Button, {
45
+ className: classNameBtnPrimary,
46
+ disabled: fetchingCart,
47
+ onClick: setCartComplete,
48
+ children: fetchingCart ? 'Loading...' : 'Done'
49
+ })
50
+ })]
51
+ })
52
+ }), urlTrackingPage && /*#__PURE__*/_jsx("iframe", {
53
+ style: {
54
+ height: '1px',
55
+ left: '0px',
56
+ width: '1px'
57
+ },
58
+ src: urlTrackingPage
59
+ })]
60
+ })
61
+ });
62
+ }
63
+ export default PanelPaymentSuccess;
@@ -0,0 +1,7 @@
1
+ import PanelCartItems from "./PanelCartItems";
2
+ import PanelCartShipment from "./PanelCartShipment";
3
+ import PanelClearCart from "./PanelClearCart";
4
+ import PanelClientCheckout from "./PanelClientCheckout";
5
+ import PanelEditCartItem from "./PanelEditCartItem";
6
+ import PanelPaymentSuccess from "./PanelPaymentSuccess";
7
+ export { PanelCartItems, PanelCartShipment, PanelClearCart, PanelClientCheckout, PanelPaymentSuccess, PanelEditCartItem };
@@ -0,0 +1,106 @@
1
+ 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 }; })(); }
2
+ 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); }
3
+ 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); }
4
+ 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); }); }; }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ 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; } }
8
+ 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; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import * as React from 'react';
12
+ import { CreditCard, PaymentForm } from 'react-square-web-payments-sdk';
13
+ import { currencyMap } from '../utilities/currency';
14
+ import { useCartContext } from '../CartProvider';
15
+ import { tabIdPaymentSuccess } from '../utilities/tabs';
16
+ import { Merchi } from '@merchi/sdk';
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ function SquareCard() {
19
+ var _useCartContext = useCartContext(),
20
+ alertError = _useCartContext.alertError,
21
+ cart = _useCartContext.cart,
22
+ setActiveTabIndex = _useCartContext.setActiveTabIndex,
23
+ setInvoiceJson = _useCartContext.setInvoiceJson;
24
+ var currency = cart.currency,
25
+ domain = cart.domain,
26
+ totalCost = cart.totalCost;
27
+ var _React$useState = React.useState(false),
28
+ _React$useState2 = _slicedToArray(_React$useState, 2),
29
+ loading = _React$useState2[0],
30
+ setLoading = _React$useState2[1];
31
+ var company = domain.company;
32
+ function ButtonText() {
33
+ return /*#__PURE__*/_jsxs("span", {
34
+ children: ["Pay ", currencyMap[currency], totalCost, /*#__PURE__*/_jsx("small", {
35
+ children: " / inc tax"
36
+ })]
37
+ });
38
+ }
39
+ var squareWebLocationId = company.squareWebLocationId;
40
+ function callbackCreditCardPaymentSuccess(invoiceJson) {
41
+ setInvoiceJson(invoiceJson);
42
+ setActiveTabIndex(tabIdPaymentSuccess);
43
+ }
44
+ function actionSquarePaymentProcess(_x, _x2) {
45
+ return _actionSquarePaymentProcess.apply(this, arguments);
46
+ }
47
+ function _actionSquarePaymentProcess() {
48
+ _actionSquarePaymentProcess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sourceId, callbackPaymentSuccess) {
49
+ var url, fetchOptions, merchi, r, _t;
50
+ return _regenerator().w(function (_context) {
51
+ while (1) switch (_context.p = _context.n) {
52
+ case 0:
53
+ setLoading(true);
54
+ url = "/cart/".concat(cart.id, "/square/payment/");
55
+ fetchOptions = {
56
+ method: 'GET',
57
+ query: [['sourceId', sourceId], ['cart_token', cart.token]]
58
+ };
59
+ _context.p = 1;
60
+ merchi = new Merchi();
61
+ _context.n = 2;
62
+ return merchi.authenticatedFetch(url, fetchOptions);
63
+ case 2:
64
+ r = _context.v;
65
+ callbackPaymentSuccess(r.invoice);
66
+ _context.n = 4;
67
+ break;
68
+ case 3:
69
+ _context.p = 3;
70
+ _t = _context.v;
71
+ alertError(_t.errorMessage || _t.message || 'Server eror.');
72
+ case 4:
73
+ _context.p = 4;
74
+ setLoading(false);
75
+ return _context.f(4);
76
+ case 5:
77
+ return _context.a(2);
78
+ }
79
+ }, _callee, null, [[1, 3, 4, 5]]);
80
+ }));
81
+ return _actionSquarePaymentProcess.apply(this, arguments);
82
+ }
83
+ return squareWebLocationId ? /*#__PURE__*/_jsx(PaymentForm
84
+ /**
85
+ * Identifies the calling form with a verified application ID generated from
86
+ * the Square Application Dashboard.
87
+ */, {
88
+ applicationId: SQUARE_APPLICATION_ID
89
+ /**
90
+ * Invoked when payment form receives the result of a tokenize generation
91
+ * request. The result will be a valid credit card or wallet token, or an error.
92
+ */,
93
+ cardTokenizeResponseReceived: function cardTokenizeResponseReceived(token, buyer) {
94
+ return actionSquarePaymentProcess(token.token, callbackCreditCardPaymentSuccess);
95
+ }
96
+ /**
97
+ * Identifies the location of the merchant that is taking the payment.
98
+ * Obtained from the Square Application Dashboard - Locations tab.
99
+ */,
100
+ locationId: squareWebLocationId,
101
+ children: /*#__PURE__*/_jsx(CreditCard, {
102
+ children: /*#__PURE__*/_jsx(ButtonText, {})
103
+ })
104
+ }) : /*#__PURE__*/_jsx(_Fragment, {});
105
+ }
106
+ export default SquareCard;