@zonos/elements 1.3.6 → 1.3.7-alpha.0

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 (188) hide show
  1. package/dist/cjs/{localization-2c9f5765.js → cart-ecc80eb0.js} +721 -2
  2. package/dist/cjs/{getBorderRadius-b252096d.js → getBorderRadius-834c321d.js} +1 -1
  3. package/dist/cjs/{isDarkColor-168002d6.js → isDarkColor-924e6a7a.js} +1 -1
  4. package/dist/cjs/{submitGtag-792fe45d.js → submitGtag-907e71d3.js} +3 -3
  5. package/dist/cjs/zonos-address_4.cjs.entry.js +22 -10
  6. package/dist/cjs/zonos-badge_2.cjs.entry.js +1 -1
  7. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  9. package/dist/cjs/zonos-card_2.cjs.entry.js +7 -5
  10. package/dist/cjs/zonos-cart-items_9.cjs.entry.js +39 -31
  11. package/dist/cjs/zonos-checkout.cjs.entry.js +20 -21
  12. package/dist/cjs/zonos-controller.cjs.entry.js +27 -28
  13. package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -3
  14. package/dist/cjs/zonos-country-select_3.cjs.entry.js +9 -8
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +18 -16
  16. package/dist/cjs/zonos-hello.cjs.entry.js +34 -32
  17. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  18. package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
  19. package/dist/cjs/zonos-payment.cjs.entry.js +4 -5
  20. package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  23. package/dist/cjs/{zonosStore-5d94dabb.js → zonosStore-49d4c92a.js} +4 -4
  24. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +9 -4
  25. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +2 -1
  26. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +15 -2
  27. package/dist/collection/components/store/checkout/stripe.js +3 -0
  28. package/dist/collection/components/store/hello/localization.js +27 -1
  29. package/dist/collection/components/store/zonosStore.js +4 -4
  30. package/dist/collection/types/generated/graphql.customer.types.js +6 -0
  31. package/dist/components/stripe.js +4040 -2
  32. package/dist/components/submitGtag.js +1 -1
  33. package/dist/components/zonos-address2.js +1 -2
  34. package/dist/components/zonos-cart-subtotal2.js +1 -2
  35. package/dist/components/zonos-checkout-finish2.js +14 -6
  36. package/dist/components/zonos-checkout-footer2.js +1 -1
  37. package/dist/components/zonos-checkout-payment2.js +1 -2
  38. package/dist/components/zonos-checkout.js +1 -2
  39. package/dist/components/zonos-collapse2.js +15 -2
  40. package/dist/components/zonos-controller.js +1 -2
  41. package/dist/components/zonos-country-flag2.js +1 -1
  42. package/dist/components/zonos-country-select2.js +1 -1
  43. package/dist/components/zonos-customer-info2.js +2 -3
  44. package/dist/components/zonos-hello-dialog-footer2.js +1 -1
  45. package/dist/components/zonos-hello-dialog2.js +1 -1
  46. package/dist/components/zonos-hello.js +1 -1
  47. package/dist/components/zonos-language-select2.js +1 -1
  48. package/dist/components/zonos-review2.js +1 -2
  49. package/dist/components/zonos-shipping2.js +1 -2
  50. package/dist/components/zonosStore.js +4 -4
  51. package/dist/esm/{localization-d8f6453b.js → cart-2a0a6871.js} +707 -3
  52. package/dist/esm/{getBorderRadius-e9736f7e.js → getBorderRadius-0c7dfcf0.js} +1 -1
  53. package/dist/esm/{isDarkColor-e982fa09.js → isDarkColor-d0a57fd2.js} +1 -1
  54. package/dist/esm/{submitGtag-bebe2cb0.js → submitGtag-a38aed23.js} +2 -2
  55. package/dist/esm/zonos-address_4.entry.js +19 -7
  56. package/dist/esm/zonos-badge_2.entry.js +1 -1
  57. package/dist/esm/zonos-banner.entry.js +1 -1
  58. package/dist/esm/zonos-button_3.entry.js +3 -3
  59. package/dist/esm/zonos-card_2.entry.js +4 -2
  60. package/dist/esm/zonos-cart-items_9.entry.js +19 -11
  61. package/dist/esm/zonos-checkout.entry.js +5 -6
  62. package/dist/esm/zonos-controller.entry.js +4 -5
  63. package/dist/esm/zonos-country-flag.entry.js +4 -2
  64. package/dist/esm/zonos-country-select_3.entry.js +4 -3
  65. package/dist/esm/zonos-hello-dialog.entry.js +4 -2
  66. package/dist/esm/zonos-hello.entry.js +4 -2
  67. package/dist/esm/zonos-logo.entry.js +1 -1
  68. package/dist/esm/zonos-notification.entry.js +1 -1
  69. package/dist/esm/zonos-payment.entry.js +4 -5
  70. package/dist/esm/zonos-select-dialog-header_2.entry.js +1 -1
  71. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  72. package/dist/esm/zonos-text.entry.js +1 -1
  73. package/dist/esm/{zonosStore-e6c7be3a.js → zonosStore-dec6bd7e.js} +4 -4
  74. package/dist/esm-es5/cart-2a0a6871.js +1 -0
  75. package/dist/esm-es5/{getBorderRadius-e9736f7e.js → getBorderRadius-0c7dfcf0.js} +1 -1
  76. package/dist/esm-es5/{isDarkColor-e982fa09.js → isDarkColor-d0a57fd2.js} +1 -1
  77. package/dist/esm-es5/submitGtag-a38aed23.js +1 -0
  78. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  79. package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
  80. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  81. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  82. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  83. package/dist/esm-es5/zonos-cart-items_9.entry.js +1 -1
  84. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  85. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  86. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  87. package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
  88. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  89. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  90. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  91. package/dist/esm-es5/zonos-notification.entry.js +1 -1
  92. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  93. package/dist/esm-es5/zonos-select-dialog-header_2.entry.js +1 -1
  94. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  95. package/dist/esm-es5/zonos-text.entry.js +1 -1
  96. package/dist/esm-es5/{zonosStore-e6c7be3a.js → zonosStore-dec6bd7e.js} +1 -1
  97. package/dist/scripts/loadZonos.js +1 -1
  98. package/dist/scripts/zonos.js +1 -1
  99. package/dist/scripts/zonosBase.js +1 -1
  100. package/dist/types/components/store/checkout/stripe.d.ts +4 -0
  101. package/dist/types/components/store/zonosStore.d.ts +1 -1
  102. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  103. package/dist/types/components/utils/hello/currencyConversion/getLanguageCode.d.ts +1 -1
  104. package/dist/types/types/ICountryJson.d.ts +2 -1
  105. package/dist/types/types/generated/graphql.customer.types.d.ts +15 -0
  106. package/dist/types/types/generated/graphql.customer.types.ts +24 -0
  107. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  108. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  109. package/dist/zonos-elements/p-0057e374.entry.js +1 -0
  110. package/dist/zonos-elements/p-066c5893.system.js +1 -1
  111. package/dist/zonos-elements/p-0c72fb79.system.entry.js +1 -0
  112. package/dist/zonos-elements/p-1f85a98c.system.entry.js +1 -0
  113. package/dist/zonos-elements/{p-96aabe02.entry.js → p-290c3670.entry.js} +1 -1
  114. package/dist/zonos-elements/{p-e8a9bc56.entry.js → p-2d2e1831.entry.js} +1 -1
  115. package/dist/zonos-elements/p-2f1e1cbb.system.entry.js +1 -0
  116. package/dist/zonos-elements/{p-a682fd38.system.entry.js → p-33080cde.system.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-17550a10.js → p-34c03be2.js} +1 -1
  118. package/dist/zonos-elements/{p-a33745e9.entry.js → p-34efed1d.entry.js} +1 -1
  119. package/dist/zonos-elements/p-375c472a.system.entry.js +1 -0
  120. package/dist/zonos-elements/{p-fcc4f140.system.js → p-549c181b.system.js} +1 -1
  121. package/dist/zonos-elements/{p-32bca9c8.system.entry.js → p-55970b10.system.entry.js} +1 -1
  122. package/dist/zonos-elements/p-561e44d6.entry.js +1 -0
  123. package/dist/zonos-elements/{p-50287643.system.js → p-591eb6dd.system.js} +1 -1
  124. package/dist/zonos-elements/p-5b44abc8.system.js +1 -0
  125. package/dist/zonos-elements/p-5c4dc123.js +1 -0
  126. package/dist/zonos-elements/{p-ec25f180.entry.js → p-656c836b.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-49a764e9.system.entry.js → p-67737613.system.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-dd7729fd.system.entry.js → p-79b910bf.system.entry.js} +1 -1
  129. package/dist/zonos-elements/p-7d1d862f.system.entry.js +1 -0
  130. package/dist/zonos-elements/{p-5a113c3d.system.entry.js → p-88a55076.system.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-7dd8e8ba.system.entry.js → p-8aeb4679.system.entry.js} +1 -1
  132. package/dist/zonos-elements/p-8d645a00.entry.js +1 -0
  133. package/dist/zonos-elements/p-9878a770.js +1 -0
  134. package/dist/zonos-elements/p-a219689f.entry.js +1 -0
  135. package/dist/zonos-elements/p-a3d72a33.entry.js +1 -0
  136. package/dist/zonos-elements/p-a93c594f.entry.js +1 -0
  137. package/dist/zonos-elements/{p-0c7480a5.entry.js → p-a95c034c.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-7a6144b1.entry.js → p-afe40057.entry.js} +1 -1
  139. package/dist/zonos-elements/p-b10ff468.entry.js +1 -0
  140. package/dist/zonos-elements/p-b6992dc2.system.entry.js +1 -0
  141. package/dist/zonos-elements/{p-3ef27745.js → p-bce46c41.js} +1 -1
  142. package/dist/zonos-elements/p-c56d4a44.entry.js +1 -0
  143. package/dist/zonos-elements/{p-bd6a2095.entry.js → p-c7098c3b.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-f49dfd06.system.js → p-cbb1e700.system.js} +1 -1
  145. package/dist/zonos-elements/p-cc63a29f.system.entry.js +1 -0
  146. package/dist/zonos-elements/p-cd8bd5e9.system.entry.js +1 -0
  147. package/dist/zonos-elements/p-d36faf87.system.entry.js +1 -0
  148. package/dist/zonos-elements/p-dfd3edcf.entry.js +1 -0
  149. package/dist/zonos-elements/{p-ba43275e.entry.js → p-e161a08c.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-9cbbf261.system.entry.js → p-e2770968.system.entry.js} +1 -1
  151. package/dist/zonos-elements/p-e2c6ad57.entry.js +1 -0
  152. package/dist/zonos-elements/{p-b81a0577.system.entry.js → p-e855966f.system.entry.js} +1 -1
  153. package/dist/zonos-elements/p-ea93943a.system.entry.js +1 -0
  154. package/dist/zonos-elements/{p-e99d79d9.system.js → p-ec4d08b3.system.js} +1 -1
  155. package/dist/zonos-elements/{p-47fac33f.js → p-f455e08c.js} +1 -1
  156. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  157. package/package.json +1 -1
  158. package/dist/cjs/cart-b8bbf22d.js +0 -698
  159. package/dist/components/localization.js +0 -4016
  160. package/dist/esm/cart-bc3bb22e.js +0 -682
  161. package/dist/esm-es5/cart-bc3bb22e.js +0 -1
  162. package/dist/esm-es5/localization-d8f6453b.js +0 -1
  163. package/dist/esm-es5/submitGtag-bebe2cb0.js +0 -1
  164. package/dist/zonos-elements/p-00d63df1.system.entry.js +0 -1
  165. package/dist/zonos-elements/p-04f63cea.entry.js +0 -1
  166. package/dist/zonos-elements/p-16b74c31.system.js +0 -1
  167. package/dist/zonos-elements/p-1d16a6fb.js +0 -1
  168. package/dist/zonos-elements/p-1ea68e3b.entry.js +0 -1
  169. package/dist/zonos-elements/p-1ed530cc.entry.js +0 -1
  170. package/dist/zonos-elements/p-289c8b1a.system.entry.js +0 -1
  171. package/dist/zonos-elements/p-2a00c270.system.entry.js +0 -1
  172. package/dist/zonos-elements/p-37f53a79.entry.js +0 -1
  173. package/dist/zonos-elements/p-394cf1cf.js +0 -1
  174. package/dist/zonos-elements/p-458fd100.system.entry.js +0 -1
  175. package/dist/zonos-elements/p-4fafb2a5.system.entry.js +0 -1
  176. package/dist/zonos-elements/p-4fb71a93.js +0 -1
  177. package/dist/zonos-elements/p-5276c61b.system.entry.js +0 -1
  178. package/dist/zonos-elements/p-6308b347.entry.js +0 -1
  179. package/dist/zonos-elements/p-63d1b1fe.entry.js +0 -1
  180. package/dist/zonos-elements/p-7347ee7c.system.entry.js +0 -1
  181. package/dist/zonos-elements/p-8c26a080.system.js +0 -1
  182. package/dist/zonos-elements/p-ba1a111a.system.entry.js +0 -1
  183. package/dist/zonos-elements/p-c4321084.system.entry.js +0 -1
  184. package/dist/zonos-elements/p-cdf114a2.entry.js +0 -1
  185. package/dist/zonos-elements/p-d5ae3cbb.system.entry.js +0 -1
  186. package/dist/zonos-elements/p-d5d7c8f5.entry.js +0 -1
  187. package/dist/zonos-elements/p-de339fb6.entry.js +0 -1
  188. package/dist/zonos-elements/p-f6f5f644.entry.js +0 -1
@@ -1,682 +0,0 @@
1
- import { z as zonosStore, c as createStore } from './zonosStore-e6c7be3a.js';
2
- import { h as handleFetch, a as log, l as localizationStore, b as logError, t as translate } from './localization-d8f6453b.js';
3
- import { i as isDarkColor } from './isDarkColor-e982fa09.js';
4
- import { g as getBorderRadius } from './getBorderRadius-e9736f7e.js';
5
-
6
- const prepCalculateLandedCost = () => {
7
- // maybe we don't need email now for prefetch the landed cost
8
- const stripeLinkData = stripeStore.stripeLinkEventData;
9
- const stripeAddressData = stripeStore.stripeAddressEventData;
10
- const stripeBillingAddressData = stripeStore.stripeShippingSameAsBilling
11
- ? stripeStore.stripeAddressEventData
12
- : stripeStore.stripeBillingAddressEventData;
13
- if (!(stripeAddressData === null || stripeAddressData === void 0 ? void 0 : stripeAddressData.complete) || !(stripeBillingAddressData === null || stripeBillingAddressData === void 0 ? void 0 : stripeBillingAddressData.complete)) {
14
- throw new Error('Missing stripe address data');
15
- }
16
- return {
17
- billingAddress: {
18
- addressLine1: stripeBillingAddressData.value.address.line1,
19
- addressLine2: stripeBillingAddressData.value.address.line2 || '',
20
- city: stripeBillingAddressData.value.address.city,
21
- country: stripeBillingAddressData.value.address.country,
22
- postalCode: stripeBillingAddressData.value.address.postal_code,
23
- state: stripeBillingAddressData.value.address.state,
24
- },
25
- billingContact: {
26
- // firstName and lastName should be valid now since stripe only mark
27
- // the address as complete when both fields are filled.
28
- firstName: stripeBillingAddressData.value.firstName || '',
29
- lastName: stripeBillingAddressData.value.lastName || '',
30
- phone: stripeBillingAddressData.value.phone || '',
31
- },
32
- checkoutSessionId: cartStore.checkoutSessionId || '',
33
- contact: {
34
- email: (stripeLinkData === null || stripeLinkData === void 0 ? void 0 : stripeLinkData.value.email) || '',
35
- // firstName and lastName should be valid now since stripe only mark
36
- // the address as complete when both fields are filled.
37
- firstName: stripeAddressData.value.firstName || '',
38
- lastName: stripeAddressData.value.lastName || '',
39
- phone: stripeAddressData.value.phone || '',
40
- },
41
- items: cartStore.items.map(item => item),
42
- shippingAddress: {
43
- addressLine1: stripeAddressData.value.address.line1,
44
- addressLine2: stripeAddressData.value.address.line2 || '',
45
- city: stripeAddressData.value.address.city,
46
- country: stripeAddressData.value.address.country,
47
- postalCode: stripeAddressData.value.address.postal_code,
48
- state: stripeAddressData.value.address.state,
49
- },
50
- };
51
- };
52
-
53
- const triggerBuildLandedCost = async (buildLandedCost) => {
54
- var _a, _b, _c, _d;
55
- const data = prepCalculateLandedCost();
56
- const landedCost = await buildLandedCost({
57
- billingAddress: data.billingAddress,
58
- billingContact: data.billingContact,
59
- checkoutSessionId: data.checkoutSessionId,
60
- contact: data.contact,
61
- shippingAddress: data.shippingAddress,
62
- });
63
- if (!landedCost || ((_a = landedCost.errors) === null || _a === void 0 ? void 0 : _a.length)) {
64
- throw new Error(`Failed to build landed cost: ${((_c = (_b = landedCost === null || landedCost === void 0 ? void 0 : landedCost.errors) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) || 'Unknown error'}`);
65
- }
66
- // Validate the landed cost object to make sure the returned value from buildLandedCost has a valid schema
67
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/validate-landed-cost`, {
68
- body: landedCost,
69
- headers: {
70
- 'Content-Type': 'application/json',
71
- },
72
- method: 'POST',
73
- });
74
- if (!json || errors.length) {
75
- throw new Error(`Invalid landed cost object: ${((_d = errors.find(Boolean)) === null || _d === void 0 ? void 0 : _d.message) || 'Unknown error'}`);
76
- }
77
- return landedCost;
78
- };
79
-
80
- const calculateLandedCost = async (abortController) => {
81
- var _a;
82
- // If buildLandedCost callback is supplied, use that instead of our regular request to '/calculate-landed-cost'
83
- const buildLandedCost = zonosStore.checkoutSettings.buildLandedCost;
84
- if (buildLandedCost) {
85
- const json = await triggerBuildLandedCost(buildLandedCost);
86
- return json;
87
- }
88
- // request to get landed cost info
89
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/calculate-landed-cost`;
90
- const { errors, json } = await handleFetch(url, {
91
- body: prepCalculateLandedCost(),
92
- method: 'POST',
93
- signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
94
- });
95
- if (errors.length || !json) {
96
- const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.';
97
- const errorMessage = isAbortedRequest
98
- ? 'The landed cost calculation request was aborted to initiate a new one.'
99
- : 'Failed to calculate landed cost';
100
- throw new Error(errorMessage);
101
- }
102
- return json;
103
- };
104
-
105
- const addressRuleStyle = ({ theme, }) => {
106
- switch (theme) {
107
- default:
108
- return {
109
- '.Input': {
110
- // need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.
111
- padding: '0',
112
- paddingBottom: '8px',
113
- paddingLeft: '16px',
114
- paddingRight: '8px',
115
- // any value here will be add up to the default paddingTop (20px).
116
- paddingTop: '6px',
117
- },
118
- };
119
- }
120
- };
121
-
122
- const defaultVariable = ({ borderStyle, theme, }) => {
123
- switch (theme) {
124
- case 'DARK':
125
- return {
126
- borderRadius: getBorderRadius(borderStyle),
127
- colorBackground: '#101117',
128
- colorBackgroundText: '#C5C6CA',
129
- colorText: '#C5C6CA',
130
- colorTextPlaceholder: '#C5C6CA',
131
- };
132
- default:
133
- return {
134
- borderRadius: getBorderRadius(borderStyle),
135
- };
136
- }
137
- };
138
-
139
- const { onChange: onChange$1, reset: reset$1, state: stripeStore, } = createStore(() => ({
140
- clientSecret: sessionStorage.getItem('zonos--client-secret') || null,
141
- fetchingLandedCostAbordController: null,
142
- isFetchingLandedCost: false,
143
- isFetchingSession: false,
144
- stripe: null,
145
- stripeAddressElement: null,
146
- stripeAddressEventData: null,
147
- stripeAddressUsedWhenFetchingLC: null,
148
- stripeBillingAddressElement: null,
149
- stripeBillingAddressEventData: null,
150
- stripeBillingAddressUsedWhenFetchingLC: null,
151
- stripeElements: null,
152
- stripeElementsForBillingAddress: null,
153
- stripeElementsOptions: null,
154
- stripeLinkElement: null,
155
- stripeLinkEventData: null,
156
- stripeLinkUsedWhenFetchingLC: null,
157
- stripePaymentElement: null,
158
- stripePaymentEventData: null,
159
- stripeShippingSameAsBilling: true,
160
- }));
161
- const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideSecondaryColor, overrideTheme, }) => {
162
- const primaryColor = overridePrimaryColor || zonosStore.appearance.colorPrimary;
163
- const secondaryColor = overrideSecondaryColor || zonosStore.appearance.colorSecondary;
164
- const themeBasedColor = primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';
165
- // if overrideTheme is provided, use it. Otherwise, use theme based on primary color
166
- const theme = overrideTheme === 'DARK' ? 'night' : 'flat';
167
- return {
168
- appearance: {
169
- labels: 'floating',
170
- rules: Object.assign({}, addressRuleStyle({ theme: 'LIGHT' })),
171
- // get contrast theme color base on primary color
172
- theme: overrideTheme ? theme : themeBasedColor,
173
- variables: Object.assign(Object.assign({}, defaultVariable({
174
- borderStyle: overrideBorderRaidus,
175
- theme: 'LIGHT',
176
- })), {
177
- // use the button background color for input glow color
178
- colorPrimary: secondaryColor }),
179
- },
180
- clientSecret,
181
- locale: localizationStore.selectedLocale,
182
- };
183
- };
184
- const initStripeElements = async (props) => {
185
- var _a, _b;
186
- const clientSecret = stripeStore.clientSecret;
187
- if (!stripeStore.stripe) {
188
- log('Skip. Stripe is not initialized');
189
- return;
190
- }
191
- if (clientSecret) {
192
- const stripeOptions = getStripeOptions({
193
- clientSecret,
194
- overrideBorderRaidus: props === null || props === void 0 ? void 0 : props.overrideBorderRaidus,
195
- overridePrimaryColor: props === null || props === void 0 ? void 0 : props.overridePrimaryColor,
196
- overrideSecondaryColor: props === null || props === void 0 ? void 0 : props.overrideSecondaryColor,
197
- overrideTheme: props === null || props === void 0 ? void 0 : props.overrideTheme,
198
- });
199
- // compare with the previous options to see if we need to update
200
- const isSameOptions = JSON.stringify(stripeOptions) ===
201
- JSON.stringify(stripeStore.stripeElementsOptions);
202
- if (!stripeStore.stripeElements ||
203
- !stripeStore.stripeElementsForBillingAddress) {
204
- // init stripe elements if it doesn't exist
205
- stripeStore.stripeElements = (_a = stripeStore.stripe) === null || _a === void 0 ? void 0 : _a.elements(stripeOptions);
206
- // save stripe elements options for later comparison
207
- stripeStore.stripeElementsOptions = stripeOptions;
208
- log('Stripe elements initialized');
209
- // init stripe elements for billing address
210
- stripeStore.stripeElementsForBillingAddress =
211
- (_b = stripeStore.stripe) === null || _b === void 0 ? void 0 : _b.elements(stripeOptions);
212
- log('Stripe elements for billing address initialized');
213
- return;
214
- }
215
- if (!isSameOptions) {
216
- // update elements with new option if it already exists
217
- stripeStore.stripeElements.update(stripeOptions);
218
- // update elements for stripe billing address
219
- stripeStore.stripeElementsForBillingAddress.update(stripeOptions);
220
- // save stripe elements options for later comparison
221
- stripeStore.stripeElementsOptions = stripeOptions;
222
- }
223
- log('Stripe elements initialized');
224
- }
225
- };
226
- const stripeStoreReset = () => {
227
- // clean clientSecret so that we can start the new one.
228
- sessionStorage.removeItem('zonos--client-secret');
229
- // cleanup stripe elements
230
- reset$1();
231
- // set stripe back to window.Zonos.stripe
232
- stripeStore.stripe = window.Zonos.stripe;
233
- };
234
- /**
235
- * Check if the address and email info used when fetching landed cost with the current email and address info are different
236
- * Purpose is to resend the request if the info used when fetching landed cost is different from the current info
237
- */
238
- const isPrefetchInfoOutdated = () => {
239
- var _a, _b, _c, _d, _e, _f;
240
- const hasAbortController = stripeStore.fetchingLandedCostAbordController;
241
- if (!hasAbortController) {
242
- // if there is no abort controller, this is a new request
243
- return false;
244
- }
245
- const isLinkDataDirty = JSON.stringify((_a = stripeStore.stripeLinkUsedWhenFetchingLC) === null || _a === void 0 ? void 0 : _a.value) !==
246
- JSON.stringify((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value);
247
- const isAddressDataDirty = JSON.stringify((_c = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _c === void 0 ? void 0 : _c.value) !==
248
- JSON.stringify((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value);
249
- const isBillingAddressDataDirty = !stripeStore.stripeShippingSameAsBilling &&
250
- JSON.stringify((_e = stripeStore.stripeBillingAddressEventData) === null || _e === void 0 ? void 0 : _e.value) !==
251
- JSON.stringify((_f = stripeStore.stripeBillingAddressUsedWhenFetchingLC) === null || _f === void 0 ? void 0 : _f.value);
252
- return isLinkDataDirty || isAddressDataDirty || isBillingAddressDataDirty;
253
- };
254
- const stripeStorePrefetchLandedCost = async () => {
255
- var _a, _b, _c, _d, _e, _f;
256
- const stripeAddressReady = !!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete);
257
- const stripeLinkReady = !!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
258
- const stripeBillingAddressReady = stripeStore.stripeShippingSameAsBilling
259
- ? !!((_c = stripeStore.stripeLinkEventData) === null || _c === void 0 ? void 0 : _c.complete)
260
- : !!((_d = stripeStore.stripeBillingAddressEventData) === null || _d === void 0 ? void 0 : _d.complete);
261
- const shouldRefetch = isPrefetchInfoOutdated();
262
- if (shouldRefetch) {
263
- // if the info used when fetching landed cost is different from the current info, abort the previous request
264
- (_e = stripeStore.fetchingLandedCostAbordController) === null || _e === void 0 ? void 0 : _e.abort();
265
- stripeStore.fetchingLandedCostAbordController = null;
266
- }
267
- // only fetch if we are not fetching or we need to refetch
268
- if (stripeAddressReady &&
269
- stripeLinkReady &&
270
- stripeBillingAddressReady &&
271
- (shouldRefetch || !stripeStore.isFetchingLandedCost)) {
272
- stripeStore.isFetchingLandedCost = true;
273
- if (stripeStore.stripeAddressEventData) {
274
- stripeStore.stripeAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeAddressEventData);
275
- }
276
- if (stripeStore.stripeBillingAddressEventData) {
277
- stripeStore.stripeBillingAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeBillingAddressEventData);
278
- }
279
- if (stripeStore.stripeLinkEventData) {
280
- stripeStore.stripeLinkUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeLinkEventData);
281
- }
282
- try {
283
- const abortController = new AbortController();
284
- stripeStore.fetchingLandedCostAbordController = abortController;
285
- const { checkoutSessionWorkflow, shipmentRatingCalculateWorkflow } = await calculateLandedCost(abortController);
286
- // reset abort controller after we are done
287
- stripeStore.fetchingLandedCostAbordController = null;
288
- // update cart store with landed cost info
289
- cartStore.landedCostData =
290
- (checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.filter(Boolean)) || null;
291
- cartStore.shippingData =
292
- (shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || null;
293
- // apply new subtotal and total, this is mainly to show items in the presentment currency
294
- const firstLandedCostData = (_f = cartStore.landedCostData) === null || _f === void 0 ? void 0 : _f.find(Boolean);
295
- const subtotals = !!firstLandedCostData
296
- ? firstLandedCostData.subtotals
297
- : null;
298
- if (subtotals) {
299
- // prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
300
- cartStoreApplySubtotals({
301
- exchangeRate: subtotals.exchangeRate,
302
- items: subtotals.items,
303
- landedCostTotal: 0,
304
- presentmentCurrencyCode: subtotals.presentmentCurrencyCode,
305
- shipping: 0,
306
- total: subtotals.items,
307
- });
308
- }
309
- }
310
- catch (err) {
311
- logError(err);
312
- }
313
- stripeStore.isFetchingLandedCost = false;
314
- }
315
- };
316
- const getStripeMessageBasedOnStatus = (status) => {
317
- let messages = [];
318
- let isError = true;
319
- // Inspect the PaymentIntent `status` to indicate the status of the payment
320
- // to your customer.
321
- //
322
- // Some payment methods will [immediately succeed or fail][0] upon
323
- // confirmation, while others will first enter a `processing` state.
324
- //
325
- // [0]: https://stripe.com/docs/payments/payment-methods#payment-notification
326
- switch (status) {
327
- case 'succeeded': {
328
- messages = [
329
- translate('Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.'),
330
- '',
331
- '',
332
- translate("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time."),
333
- ];
334
- isError = false;
335
- break;
336
- }
337
- case 'requires_capture':
338
- case 'processing': {
339
- messages = [
340
- translate("Payment processing. We'll update you when payment is received."),
341
- ];
342
- isError = false;
343
- break;
344
- }
345
- case 'requires_payment_method': {
346
- messages = [
347
- translate('Payment failed. Please try another payment method.'),
348
- ];
349
- break;
350
- }
351
- default: {
352
- messages = [translate('Something went wrong.')];
353
- break;
354
- }
355
- }
356
- return {
357
- isError,
358
- messages,
359
- };
360
- };
361
- const stripeStoreRetrievePayment = async ({ clientSecret: _clientSecret, storybookForceStatus, }) => {
362
- if (storybookForceStatus) {
363
- // return status right away if we are in storybook mode
364
- const { isError, messages } = getStripeMessageBasedOnStatus(storybookForceStatus);
365
- return { error: isError, messages };
366
- }
367
- const clientSecret = _clientSecret || stripeStore.clientSecret;
368
- if (!stripeStore.stripe || !clientSecret) {
369
- logError('Failed to retrieve payment intent. Stripe is not initialized');
370
- return { error: true, message: [translate('Something went wrong.')] };
371
- }
372
- const { paymentIntent } = await stripeStore.stripe.retrievePaymentIntent(clientSecret);
373
- const status = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status;
374
- const { isError, messages } = getStripeMessageBasedOnStatus(status);
375
- return { error: isError, messages };
376
- };
377
- const stripeStoreConfirmPayment = async () => {
378
- var _a, _b, _c;
379
- const stripePaymentReady = !!((_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.complete);
380
- const stripeElements = stripeStore.stripeElements;
381
- const stripe = stripeStore.stripe;
382
- const stripeClientSecret = stripeStore.clientSecret;
383
- if (stripe && stripeElements && stripePaymentReady && stripeClientSecret) {
384
- const { error } = await stripe.confirmPayment({
385
- confirmParams: {
386
- receipt_email: (_c = (_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.email,
387
- return_url: window.location.href,
388
- },
389
- elements: stripeElements,
390
- redirect: 'if_required',
391
- });
392
- if (error) {
393
- if (error.type === 'card_error' || error.type === 'validation_error') {
394
- throw new Error(error.message);
395
- }
396
- if (error.type === 'invalid_request_error') {
397
- if (error.code === 'payment_intent_unexpected_state') {
398
- // PaymentIntent was canceled or expired, or status is `require_capture`.
399
- // don't throw error here because we will reset the checkout session last step
400
- return;
401
- }
402
- }
403
- throw new Error('An unexpected error occurred.');
404
- }
405
- }
406
- };
407
- /**
408
- * Init checkout session
409
- * @returns {boolean} whether or not the checkout session is successfully created
410
- */
411
- const stripeStoreInitCheckoutSession = async () => {
412
- var _a;
413
- const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
414
- if (!total || !localizationStore.targetCurrency) {
415
- logError('Fail to create checkout session - invalid total or currency');
416
- return false;
417
- }
418
- stripeStore.isFetchingSession = true;
419
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/create-checkout-session`, {
420
- body: {
421
- currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
422
- itemsAmount: total,
423
- presentmentCountryCode: localizationStore.selectedCountryCode || null,
424
- },
425
- method: 'POST',
426
- });
427
- stripeStore.isFetchingSession = false;
428
- if (errors.length || !json) {
429
- logError('Error occurs when creating checkout session', JSON.stringify(errors, null, 2));
430
- return false;
431
- }
432
- const result = json.checkoutSessionCreate;
433
- stripeStore.clientSecret = result.clientSecret;
434
- // update cart store with updated informations
435
- cartStore.checkoutSessionId = result.id;
436
- cartStoreApplySubtotals(Object.assign(Object.assign({}, result.subtotals), { landedCostTotal: 0, shipping: 0, total: result.subtotals.items }));
437
- log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
438
- log('done-init-checkout-session');
439
- return true;
440
- };
441
- /**
442
- * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
443
- */
444
- const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
445
- // No need to set loading state here because this function will be called under the hood to update
446
- // landed cost id for the section.
447
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/update-checkout-session`, {
448
- body: {
449
- currency,
450
- id,
451
- itemsAmount,
452
- landedCostId,
453
- presentmentCountryCode,
454
- },
455
- method: 'POST',
456
- });
457
- if (errors.length || !json) {
458
- logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
459
- return { errors, json };
460
- }
461
- return { errors: [], json };
462
- };
463
- onChange$1('clientSecret', clientSecret => {
464
- // update stripe elements when client secret changes
465
- if (clientSecret && stripeStore.stripe) {
466
- sessionStorage.setItem('zonos--client-secret', clientSecret);
467
- }
468
- if (!clientSecret) {
469
- sessionStorage.removeItem('zonos--client-secret');
470
- }
471
- });
472
-
473
- const formatDate = ({ date, formatOptions = { day: 'numeric', weekday: 'long', year: 'numeric' }, }) => {
474
- // format date to Thursday 3, 2023
475
- return new Intl.DateTimeFormat('en-US', formatOptions).format(date);
476
- };
477
-
478
- const getDaysDifference = (targetDate) => {
479
- const currentDate = new Date();
480
- const timeDifference = targetDate.getTime() - currentDate.getTime();
481
- const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); // Convert milliseconds to days
482
- return daysDifference;
483
- };
484
-
485
- const { onChange, reset, state: cartStore, } = createStore(() => ({
486
- checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id') || null,
487
- currency: 'USD',
488
- dutiesTaxFees: 0,
489
- error: null,
490
- exchangeRate: null,
491
- isSelectedShippingAboveDeminimis: false,
492
- isSelectedShippingGuarantee: false,
493
- items: [],
494
- landedCostData: null,
495
- selectedLandedCost: null,
496
- selectedShippingOption: null,
497
- selectedShippingOptionExpectedDate: '',
498
- selectedShippingOptionTransitTime: '',
499
- shipping: 0,
500
- shippingData: null,
501
- step: 'customer-info',
502
- subtotal: 0,
503
- total: 0,
504
- }));
505
- /**
506
- * Format shipping transit info to be displayed on UI
507
- * @returns
508
- * - expectedDate: Thursday, Aug 12
509
- * - maxTransit: 5
510
- * - minTransit: 3
511
- */
512
- const cartStoreGetShippingTransitInfo = (item) => {
513
- const minTransit = item.minTransitAt
514
- ? getDaysDifference(new Date(item.minTransitAt))
515
- : '';
516
- const maxTransit = item.maxTransitAt
517
- ? getDaysDifference(new Date(item.maxTransitAt))
518
- : '';
519
- const expectedDate = item.minTransitAt
520
- ? formatDate({
521
- date: new Date(item.minTransitAt),
522
- })
523
- : '';
524
- return {
525
- expectedDate,
526
- maxTransit,
527
- minTransit,
528
- };
529
- };
530
- const cartStoreReset = () => {
531
- sessionStorage.removeItem('zonos--checkout-session-id');
532
- // reset cart store
533
- reset();
534
- };
535
- const cartStoreUpdateToErrorState = ({ messages, title, }) => {
536
- cartStoreReset();
537
- stripeStoreReset();
538
- cartStore.step = 'error';
539
- cartStore.error = {
540
- messages,
541
- title,
542
- };
543
- };
544
- const cartStoreApplySubtotals = (subtotals) => {
545
- // update exchange rate so we can use it to display cart items
546
- cartStore.exchangeRate = subtotals.exchangeRate;
547
- cartStore.dutiesTaxFees = subtotals.landedCostTotal;
548
- cartStore.subtotal = subtotals.items;
549
- cartStore.total = subtotals.total;
550
- cartStore.currency = subtotals.presentmentCurrencyCode;
551
- };
552
- const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId, }) => {
553
- if (landedCostId && cartStore.selectedLandedCost) {
554
- // update cart total right away if we have landed cost id to avoid order total flickering
555
- const subtotals = cartStore.selectedLandedCost.subtotals;
556
- cartStoreApplySubtotals(subtotals);
557
- log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
558
- }
559
- // update checkout session
560
- if (!cartStore.checkoutSessionId) {
561
- logError('Could not update cart total without checkout session id');
562
- return false;
563
- }
564
- const { json } = await stripeStoreUpdateCheckoutSession({
565
- currency,
566
- id: cartStore.checkoutSessionId,
567
- itemsAmount,
568
- landedCostId,
569
- presentmentCountryCode: localizationStore.selectedCountryCode,
570
- });
571
- if (!json) {
572
- // do nothing if we can't get checkout session
573
- logError('Error occurs when updating checkout session');
574
- cartStoreUpdateToErrorState({
575
- messages: [
576
- translate("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists"),
577
- ],
578
- title: translate('Error updating Checkout'),
579
- });
580
- return false;
581
- }
582
- if (!landedCostId) {
583
- // This is when first open the checkout modal and we just want to get info from the old cart session.
584
- // use subtotals from checkout session to update cart total
585
- cartStoreApplySubtotals(json.checkoutSessionUpdate.subtotals);
586
- log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
587
- }
588
- return true;
589
- };
590
- const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption) => {
591
- var _a, _b, _c, _d, _e;
592
- cartStore.selectedShippingOption = selectedShippingOption;
593
- // update shipping transit info
594
- const { expectedDate, maxTransit, minTransit } = cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);
595
- cartStore.selectedShippingOptionExpectedDate = expectedDate;
596
- cartStore.selectedShippingOptionTransitTime =
597
- minTransit && maxTransit
598
- ? `${minTransit}-${maxTransit}`
599
- : `${minTransit || maxTransit}`;
600
- const selectedLandedCost = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(checkoutSessionPresentment => {
601
- var _a, _b, _c;
602
- return ((_b = (_a = checkoutSessionPresentment.landedCost) === null || _a === void 0 ? void 0 : _a.shipmentRating) === null || _b === void 0 ? void 0 : _b.id) ===
603
- ((_c = cartStore.selectedShippingOption) === null || _c === void 0 ? void 0 : _c.id);
604
- });
605
- // save selected landed cost for later use
606
- cartStore.selectedLandedCost = selectedLandedCost || null;
607
- if (!selectedLandedCost) {
608
- // do nothing if we can't find landed cost for selected shipping option
609
- return false;
610
- }
611
- // update shipping value and dutiesTaxFees on selectedShippingOption change
612
- cartStore.shipping = selectedLandedCost.subtotals.shipping;
613
- // update deminimis status
614
- const isGuarantee = ((_b = selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCost) === null || _b === void 0 ? void 0 : _b.landedCostGuaranteeCode) === 'ZONOS';
615
- // one item in deminimis with type of duty and tax has threshold value is "ABOVE"
616
- const isAboveDeminimis = !!((_d = (_c = selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCost) === null || _c === void 0 ? void 0 : _c.deMinimis) === null || _d === void 0 ? void 0 : _d.find(item => ['DUTY', 'TAX'].includes(item.type) && item.threshold === 'ABOVE'));
617
- cartStore.isSelectedShippingAboveDeminimis = isAboveDeminimis;
618
- cartStore.isSelectedShippingGuarantee = isGuarantee;
619
- // update session with selected landed cost
620
- const updateCalulateStatus = await cartStoreReCalculateTotal({
621
- landedCostId: (_e = selectedLandedCost.landedCost) === null || _e === void 0 ? void 0 : _e.id,
622
- });
623
- return updateCalulateStatus;
624
- };
625
- onChange('checkoutSessionId', () => {
626
- if (!cartStore.checkoutSessionId) {
627
- sessionStorage.removeItem('zonos--checkout-session-id');
628
- return;
629
- }
630
- sessionStorage.setItem('zonos--checkout-session-id', cartStore.checkoutSessionId);
631
- });
632
- const cartStoreUpdateItems = async (items) => {
633
- var _a;
634
- cartStore.items = items;
635
- const currency = (_a = items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode;
636
- const total = items.reduce((amt, item) => {
637
- return amt + item.amount * item.quantity;
638
- }, 0);
639
- if (!currency || !total) {
640
- // do nothing if we can't get currency or total
641
- return;
642
- }
643
- cartStore.currency = currency;
644
- // set loading state here because this is first load checkout session when we already have checkout session id stored
645
- stripeStore.isFetchingSession = true;
646
- await cartStoreReCalculateTotal({
647
- currency: currency,
648
- itemsAmount: total,
649
- });
650
- stripeStore.isFetchingSession = false;
651
- };
652
- const cartStoreResetSelectedShippingOption = () => {
653
- cartStore.selectedShippingOption = null;
654
- cartStore.isSelectedShippingAboveDeminimis = false;
655
- cartStore.isSelectedShippingGuarantee = false;
656
- cartStore.selectedShippingOptionExpectedDate = '';
657
- cartStore.selectedShippingOptionTransitTime = '';
658
- cartStore.shipping = 0;
659
- };
660
- const cartStoreNextStep = () => {
661
- if (cartStore.step === 'customer-info') {
662
- cartStore.step = 'shipping';
663
- }
664
- else if (cartStore.step === 'shipping') {
665
- cartStore.step = 'payment';
666
- }
667
- else if (cartStore.step === 'payment') {
668
- cartStore.step = 'finish';
669
- }
670
- };
671
- const cartStorePreviousStep = () => {
672
- if (cartStore.step === 'payment') {
673
- cartStore.step = 'shipping';
674
- }
675
- else if (cartStore.step === 'shipping') {
676
- cartStore.step = 'customer-info';
677
- // reset selected shipping option
678
- cartStoreResetSelectedShippingOption();
679
- }
680
- };
681
-
682
- export { cartStoreUpdateItems as a, cartStoreReset as b, cartStore as c, stripeStoreInitCheckoutSession as d, cartStoreUpdateToErrorState as e, stripeStorePrefetchLandedCost as f, cartStoreNextStep as g, stripeStoreConfirmPayment as h, initStripeElements as i, stripeStoreReset as j, cartStorePreviousStep as k, stripeStoreRetrievePayment as l, cartStoreUpdateSelectedShippingOption as m, cartStoreGetShippingTransitInfo as n, stripeStore as s };