@liquidcommerce/elements-sdk 2.6.0-beta.6 → 2.6.0-beta.61

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 (226) hide show
  1. package/README.md +83 -2519
  2. package/dist/index.checkout.esm.js +16576 -0
  3. package/dist/index.esm.js +23632 -21083
  4. package/dist/ssr-stub.checkout.esm.js +18 -0
  5. package/dist/ssr-stub.esm.js +270 -0
  6. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  7. package/dist/types/auto-initialize/shared-utils.d.ts +46 -0
  8. package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +15 -2
  9. package/dist/types/clients/builder.d.ts +3 -0
  10. package/dist/types/clients/checkout.d.ts +6 -0
  11. package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +2 -1
  12. package/dist/types/clients/main.d.ts +3 -0
  13. package/dist/types/constants/core.constant.d.ts +2 -6
  14. package/dist/types/core/api/api-client.service.d.ts +21 -20
  15. package/dist/types/core/api/api-result.d.ts +19 -0
  16. package/dist/types/core/api/auth-client.service.d.ts +40 -13
  17. package/dist/types/core/api/http-client.service.d.ts +0 -1
  18. package/dist/types/core/base-component.service.d.ts +2 -1
  19. package/dist/types/core/client/actions/base-action.service.d.ts +15 -0
  20. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  21. package/dist/types/core/client/actions/client-cart-action.service.d.ts +37 -0
  22. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +56 -0
  23. package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
  24. package/dist/types/core/client/client-action.service.d.ts +6 -70
  25. package/dist/types/core/client/client-config.service.d.ts +8 -2
  26. package/dist/types/core/command/common-command.service.d.ts +2 -1
  27. package/dist/types/core/google-tag-manager.service.d.ts +4 -1
  28. package/dist/types/core/logger/logger.service.d.ts +1 -1
  29. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +27 -64
  30. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +45 -50
  31. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +9 -4
  32. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -75
  33. package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
  34. package/dist/types/core/singleton-manager.service.d.ts +12 -8
  35. package/dist/types/core/store/interfaces/cart.interface.d.ts +16 -56
  36. package/dist/types/core/store/interfaces/checkout.interface.d.ts +17 -108
  37. package/dist/types/core/store/interfaces/core.interface.d.ts +14 -3
  38. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  39. package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
  40. package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
  41. package/dist/types/core/store/store.constant.d.ts +5 -0
  42. package/dist/types/core/store/store.service.d.ts +1 -0
  43. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  44. package/dist/types/enums/core.enum.d.ts +39 -1
  45. package/dist/types/enums/index.d.ts +0 -1
  46. package/dist/types/index.checkout.d.ts +8 -0
  47. package/dist/types/index.checkout.umd.d.ts +4 -0
  48. package/dist/types/index.d.ts +8 -3
  49. package/dist/types/interfaces/api/cart.interface.d.ts +95 -0
  50. package/dist/types/interfaces/api/checkout.interface.d.ts +238 -0
  51. package/dist/types/interfaces/api/index.d.ts +5 -0
  52. package/dist/types/interfaces/api/product-list.interface.d.ts +39 -0
  53. package/dist/types/interfaces/api/product.interface.d.ts +9 -4
  54. package/dist/types/interfaces/client.interface.d.ts +72 -0
  55. package/dist/types/interfaces/component.interface.d.ts +7 -0
  56. package/dist/types/interfaces/config.interface.d.ts +41 -0
  57. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  58. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  59. package/dist/types/interfaces/configs/checkout.interface.d.ts +2 -1
  60. package/dist/types/interfaces/configs/global.interface.d.ts +5 -3
  61. package/dist/types/interfaces/configs/index.d.ts +1 -0
  62. package/dist/types/interfaces/configs/product-list.interface.d.ts +47 -0
  63. package/dist/types/interfaces/configs/product.interface.d.ts +2 -1
  64. package/dist/types/interfaces/injection.interface.d.ts +47 -0
  65. package/dist/types/modules/address/address.command.d.ts +2 -1
  66. package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
  67. package/dist/types/modules/cart/cart.commands.d.ts +4 -5
  68. package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
  69. package/dist/types/modules/cart/components/cart-footer.component.d.ts +0 -1
  70. package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +0 -2
  71. package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
  72. package/dist/types/modules/checkout/checkout.commands.d.ts +23 -9
  73. package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
  74. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  75. package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +3 -0
  76. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  77. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  78. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
  79. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  80. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  81. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
  82. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  83. package/dist/types/modules/checkout/constant.d.ts +3 -0
  84. package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
  85. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
  86. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
  87. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +5 -2
  88. package/dist/types/modules/product/product.commands.d.ts +2 -3
  89. package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
  90. package/dist/types/modules/product-list/components/card-components/index.d.ts +5 -0
  91. package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
  92. package/dist/types/modules/product-list/components/card-components/product-button.d.ts +9 -0
  93. package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -0
  94. package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +9 -0
  95. package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +13 -0
  96. package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
  97. package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
  98. package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
  99. package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
  100. package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +14 -0
  101. package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-price-filter.components.d.ts → filter-components/product-list-price-filter.d.ts} +1 -1
  102. package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
  103. package/dist/types/modules/product-list/components/index.d.ts +6 -2
  104. package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +2 -1
  105. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +27 -30
  106. package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
  107. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +55 -36
  108. package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
  109. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +47 -0
  110. package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-search.component.d.ts → product-list-search.component.d.ts} +11 -4
  111. package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
  112. package/dist/types/modules/product-list/product-list.commands.d.ts +23 -8
  113. package/dist/types/modules/product-list/product-list.component.d.ts +10 -45
  114. package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
  115. package/dist/types/modules/product-list/product-list.interface.d.ts +20 -35
  116. package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
  117. package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
  118. package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
  119. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
  120. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
  121. package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
  122. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
  123. package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
  124. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
  125. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
  126. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +6 -1
  127. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +5 -1
  128. package/dist/types/modules/ui-components/input/index.d.ts +0 -1
  129. package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
  130. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  131. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
  132. package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +0 -1
  133. package/dist/types/modules/ui-components/ui.commands.d.ts +5 -1
  134. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  135. package/dist/types/ssr/stub.d.ts +10 -0
  136. package/dist/types/static/icon/check.icon.d.ts +2 -0
  137. package/dist/types/static/icon/index.d.ts +1 -0
  138. package/dist/types/utils/dom-compat.d.ts +2 -0
  139. package/dist/types/utils/format.d.ts +0 -14
  140. package/dist/types/utils/product-selection.d.ts +16 -0
  141. package/dist/types/utils/product.d.ts +10 -0
  142. package/docs/v1/README.md +210 -0
  143. package/docs/v1/api/actions/address-actions.md +281 -0
  144. package/docs/v1/api/actions/cart-actions.md +337 -0
  145. package/docs/v1/api/actions/checkout-actions.md +387 -0
  146. package/docs/v1/api/actions/product-actions.md +115 -0
  147. package/docs/v1/api/client.md +482 -0
  148. package/docs/v1/api/configuration.md +1 -0
  149. package/docs/v1/api/injection-methods.md +247 -0
  150. package/docs/v1/api/typescript-types.md +1 -0
  151. package/docs/v1/api/ui-helpers.md +200 -0
  152. package/docs/v1/examples/advanced-patterns.md +96 -0
  153. package/docs/v1/examples/checkout-flow.md +91 -0
  154. package/docs/v1/examples/custom-theming.md +63 -0
  155. package/docs/v1/examples/multi-product-page.md +90 -0
  156. package/docs/v1/examples/simple-product-page.md +89 -0
  157. package/docs/v1/getting-started/concepts.md +507 -0
  158. package/docs/v1/getting-started/installation.md +328 -0
  159. package/docs/v1/getting-started/quick-start.md +405 -0
  160. package/docs/v1/guides/address-component.md +431 -0
  161. package/docs/v1/guides/best-practices.md +324 -0
  162. package/docs/v1/guides/cart-component.md +737 -0
  163. package/docs/v1/guides/checkout-component.md +672 -0
  164. package/docs/v1/guides/events.md +926 -0
  165. package/docs/v1/guides/product-component.md +686 -0
  166. package/docs/v1/guides/product-list-component.md +598 -0
  167. package/docs/v1/guides/theming.md +216 -0
  168. package/docs/v1/integration/angular.md +39 -0
  169. package/docs/v1/integration/laravel.md +41 -0
  170. package/docs/v1/integration/nextjs.md +69 -0
  171. package/docs/v1/integration/proxy-setup.md +89 -0
  172. package/docs/v1/integration/react.md +64 -0
  173. package/docs/v1/integration/vanilla-js.md +84 -0
  174. package/docs/v1/integration/vue.md +58 -0
  175. package/docs/v1/reference/browser-support.md +44 -0
  176. package/docs/v1/reference/error-handling.md +70 -0
  177. package/docs/v1/reference/performance.md +54 -0
  178. package/docs/v1/reference/troubleshooting.md +72 -0
  179. package/package.json +28 -17
  180. package/dist/types/elements-builder-client.d.ts +0 -2
  181. package/dist/types/elements-client.d.ts +0 -2
  182. package/dist/types/enums/cloud.enum.d.ts +0 -106
  183. package/dist/types/interfaces/cloud/cart.interface.d.ts +0 -132
  184. package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -42
  185. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -211
  186. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  187. package/dist/types/interfaces/cloud/index.d.ts +0 -5
  188. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  189. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  190. package/dist/types/interfaces/core.interface.d.ts +0 -111
  191. package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -9
  192. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  193. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
  194. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
  195. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
  196. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
  197. package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
  198. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
  199. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
  200. package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
  201. package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
  202. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
  203. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
  204. package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +0 -7
  205. package/dist/types/utils/helper.d.ts +0 -27
  206. package/docs/ACTIONS.md +0 -1300
  207. package/docs/BROWSER_SUPPORT.md +0 -279
  208. package/docs/CONFIGURATION.md +0 -853
  209. package/docs/DOCUMENTATION_INDEX.md +0 -311
  210. package/docs/EVENTS.md +0 -798
  211. package/docs/PROXY.md +0 -228
  212. package/docs/THEMING.md +0 -592
  213. package/docs/TROUBLESHOOTING.md +0 -793
  214. package/umd/elements.js +0 -1
  215. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  216. /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
  217. /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
  218. /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
  219. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
  220. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
  221. /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
  222. /package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts → filter-components/product-list-checkbox-filter.d.ts} +0 -0
  223. /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
  224. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
  225. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
  226. /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
@@ -0,0 +1,18 @@
1
+ const ELEMENTS_ENV = {
2
+ DEVELOPMENT: 'development',
3
+ STAGING: 'staging',
4
+ PRODUCTION: 'production',
5
+ };
6
+ const DEBUG_MODE = {
7
+ NONE: 'none',
8
+ CONSOLE: 'console',
9
+ PANEL: 'panel',
10
+ };
11
+
12
+ const SSR_WARN = '[LiquidCommerce Checkout] This SDK is designed for the browser. ' + 'Calls made during SSR return null. The SDK will initialize on the client.';
13
+ async function ElementsCheckout(..._args) {
14
+ console.warn(SSR_WARN);
15
+ return null;
16
+ }
17
+
18
+ export { DEBUG_MODE, ELEMENTS_ENV, ElementsCheckout };
@@ -0,0 +1,270 @@
1
+ class SDKError extends Error {
2
+ constructor(message, reThrow = false) {
3
+ super(message);
4
+ this.name = 'SDKError';
5
+ this.isSdk = true;
6
+ this.reThrow = reThrow;
7
+ if (Error.captureStackTrace) {
8
+ Error.captureStackTrace(this, SDKError);
9
+ }
10
+ Object.setPrototypeOf(this, SDKError.prototype);
11
+ }
12
+ }
13
+ function isSDKError(error, source) {
14
+ if ((error === null || error === void 0 ? void 0 : error.isSdk) === true) {
15
+ if (error instanceof SDKError && error.reThrow) {
16
+ return false;
17
+ }
18
+ return true;
19
+ }
20
+ if (!error || typeof error !== 'object') {
21
+ return source ? isSDKSource(source) : false;
22
+ }
23
+ const message = String((error === null || error === void 0 ? void 0 : error.message) || '');
24
+ const hasSDKMessage = /liquidcommerce\s+elements/i.test(message);
25
+ const stack = String((error === null || error === void 0 ? void 0 : error.stack) || '');
26
+ const errorSource = (error === null || error === void 0 ? void 0 : error.source) || source || '';
27
+ const sdkPathPatterns = [
28
+ /@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,
29
+ /[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,
30
+ /node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,
31
+ /elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,
32
+ /chunk-[a-z0-9]+.*elements/i,
33
+ ];
34
+ const sdkClassPatterns = [
35
+ /\bElements\b(?!\w)/,
36
+ /\bElementsBuilder\b/,
37
+ /\bLiquidCommerceElements\b/,
38
+ /BaseComponent/,
39
+ /Elements(?:Base)?Client/,
40
+ /(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,
41
+ /(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,
42
+ /(?:Product|Cart|Checkout|Address|ProductList).*Component/,
43
+ ];
44
+ const sdkFilePatterns = [
45
+ /(?:service|commands|component)\.(?:ts|js)/,
46
+ /auto-initialize\/(?:main|checkout)\.(?:ts|js)/,
47
+ /elements-(?:base-|builder-)?client\.(?:ts|js)/,
48
+ ];
49
+ const sdkDirPatterns = [
50
+ /elements-sdk[/\\]/i,
51
+ /modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,
52
+ /core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,
53
+ /@liquidcommerce[/\\]elements-sdk/i,
54
+ ];
55
+ const hasSDKSource = isSDKSource(errorSource);
56
+ const hasSDKPathPattern = sdkPathPatterns.some((p) => p.test(stack));
57
+ const hasSDKClassPattern = sdkClassPatterns.some((p) => p.test(stack));
58
+ const hasSDKFilePattern = sdkFilePatterns.some((p) => p.test(stack));
59
+ const hasSDKDirPattern = sdkDirPatterns.some((p) => p.test(stack));
60
+ return hasSDKMessage || hasSDKSource || hasSDKPathPattern || hasSDKClassPattern || hasSDKFilePattern || hasSDKDirPattern;
61
+ }
62
+ function isSDKSource(source) {
63
+ if (!source || typeof source !== 'string') {
64
+ return false;
65
+ }
66
+ const sdkSourcePatterns = [
67
+ /\/elements\.js$/i,
68
+ /\/index\.esm\.js$/i,
69
+ /@liquidcommerce\/elements-sdk/i,
70
+ /node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,
71
+ /@liquidcommerce[/\\]elements-sdk[/\\]/i,
72
+ /\/elements-sdk[/\\]/i,
73
+ /elements-sdk[/\\]src/i,
74
+ /elements[-.]?[a-z0-9]*\.js$/i,
75
+ /chunk.*elements/i,
76
+ /elements.*chunk/i,
77
+ /\?.*elements\.js/i,
78
+ /#.*elements\.js/i,
79
+ ];
80
+ return sdkSourcePatterns.some((pattern) => pattern.test(source));
81
+ }
82
+
83
+ const ELEMENTS_ENV = {
84
+ DEVELOPMENT: 'development',
85
+ STAGING: 'staging',
86
+ PRODUCTION: 'production',
87
+ };
88
+ const ELEMENTS_ACTIONS_EVENT = {
89
+ CLIENT_READY: 'client_ready',
90
+ ADDRESS_UPDATED: 'address_updated',
91
+ ADDRESS_CLEARED: 'address_cleared',
92
+ ADDRESS_FAILED: 'address_failed',
93
+ PRODUCT_LOADED: 'product_loaded',
94
+ PRODUCT_QUANTITY_INCREASE: 'product_quantity_increase',
95
+ PRODUCT_QUANTITY_DECREASE: 'product_quantity_decrease',
96
+ PRODUCT_ADD_TO_CART: 'product_add_to_cart',
97
+ PRODUCT_SIZE_CHANGED: 'product_size_changed',
98
+ PRODUCT_FULFILLMENT_TYPE_CHANGED: 'product_fulfillment_type_changed',
99
+ PRODUCT_FULFILLMENT_CHANGED: 'product_fulfillment_changed',
100
+ CART_LOADED: 'cart_loaded',
101
+ CART_CLOSED: 'cart_closed',
102
+ CART_OPENED: 'cart_opened',
103
+ CART_UPDATED: 'cart_updated',
104
+ CART_FAILED: 'cart_failed',
105
+ CART_RESET: 'cart_reset',
106
+ CART_ITEM_ADDED: 'cart_item_added',
107
+ CART_ITEM_REMOVED: 'cart_item_removed',
108
+ CART_ITEM_QUANTITY_INCREASE: 'cart_item_quantity_increase',
109
+ CART_ITEM_QUANTITY_DECREASE: 'cart_item_quantity_decrease',
110
+ CART_ITEM_ENGRAVING_UPDATED: 'cart_item_engraving_updated',
111
+ CART_PROMO_CODE_APPLIED: 'cart_promo_code_applied',
112
+ CART_PROMO_CODE_REMOVED: 'cart_promo_code_removed',
113
+ CART_PROMO_CODE_FAILED: 'cart_promo_code_failed',
114
+ CART_PRODUCT_ADD_SUCCESS: 'cart_product_add_success',
115
+ CART_PRODUCT_ADD_FAILED: 'cart_product_add_failed',
116
+ INTERNAL_CART_TO_CHECKOUT: 'internal_cart_to_checkout',
117
+ CHECKOUT_LOADED: 'checkout_loaded',
118
+ CHECKOUT_OPENED: 'checkout_opened',
119
+ CHECKOUT_CLOSED: 'checkout_closed',
120
+ CHECKOUT_FAILED: 'checkout_failed',
121
+ CHECKOUT_IS_GIFT_TOGGLED: 'checkout_is_gift_toggled',
122
+ CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED: 'checkout_billing_same_as_shipping_toggled',
123
+ CHECKOUT_MARKETING_PREFERENCES_TOGGLED: 'checkout_marketing_preferences_toggled',
124
+ CHECKOUT_CUSTOMER_INFORMATION_UPDATED: 'checkout_customer_information_updated',
125
+ CHECKOUT_GIFT_INFORMATION_UPDATED: 'checkout_gift_information_updated',
126
+ CHECKOUT_BILLING_INFORMATION_UPDATED: 'checkout_billing_information_updated',
127
+ CHECKOUT_ITEM_REMOVED: 'checkout_item_removed',
128
+ CHECKOUT_ITEM_QUANTITY_INCREASE: 'checkout_item_quantity_increase',
129
+ CHECKOUT_ITEM_QUANTITY_DECREASE: 'checkout_item_quantity_decrease',
130
+ CHECKOUT_ITEM_ENGRAVING_UPDATED: 'checkout_item_engraving_updated',
131
+ CHECKOUT_TIP_UPDATED: 'checkout_tip_updated',
132
+ CHECKOUT_SUBMIT_STARTED: 'checkout_submit_started',
133
+ CHECKOUT_SUBMIT_COMPLETED: 'checkout_submit_completed',
134
+ CHECKOUT_SUBMIT_FAILED: 'checkout_submit_failed',
135
+ CHECKOUT_PROMO_CODE_APPLIED: 'checkout_promo_code_applied',
136
+ CHECKOUT_PROMO_CODE_REMOVED: 'checkout_promo_code_removed',
137
+ CHECKOUT_PROMO_CODE_FAILED: 'checkout_promo_code_failed',
138
+ CHECKOUT_GIFT_CARD_APPLIED: 'checkout_gift_card_applied',
139
+ CHECKOUT_GIFT_CARD_REMOVED: 'checkout_gift_card_removed',
140
+ CHECKOUT_GIFT_CARD_FAILED: 'checkout_gift_card_failed',
141
+ CHECKOUT_PRODUCT_ADD_SUCCESS: 'checkout_product_add_success',
142
+ CHECKOUT_PRODUCT_ADD_FAILED: 'checkout_product_add_failed',
143
+ };
144
+ const ELEMENTS_FORM = {
145
+ CUSTOMER: 'customer',
146
+ GIFT: 'gift',
147
+ BILLING: 'billing',
148
+ };
149
+ const COMPONENT_TYPE = {
150
+ DRAWER: 'drawer',
151
+ INPUT: 'input',
152
+ ENGRAVING_FORM: 'engraving-form',
153
+ ENGRAVING_VIEW: 'engraving-view',
154
+ BUTTONS_CART_OPEN: 'buttons-cart-open',
155
+ POWERED_BY: 'powered-by',
156
+ LCE_ELEMENT: 'lce-element',
157
+ PURCHASE_MIN_ALERT: 'purchase-min-alert',
158
+ ALERT: 'alert',
159
+ PROMO_CODE_TICKER: 'promo-code-ticker',
160
+ ADDRESS: 'address',
161
+ ADDRESS_INPUT: 'address-input',
162
+ ADDRESS_DISPLAY: 'address-display',
163
+ PRODUCT: 'product',
164
+ PRODUCT_IMAGE_CAROUSEL: 'product-image-carousel',
165
+ PRODUCT_OPTIONS: 'product-options',
166
+ PRODUCT_INTERACTIONS: 'product-interactions',
167
+ PRODUCT_DESCRIPTION: 'product-description',
168
+ PRODUCT_RETAILERS: 'product-retailers',
169
+ PRODUCT_RETAILERS_CAROUSEL: 'product-retailers-carousel',
170
+ PRODUCT_RETAILERS_POPUP: 'product-retailers-popup',
171
+ PRODUCT_RETAILERS_POPUP_LIST: 'product-retailers-popup-list',
172
+ PRODUCT_PRICE: 'product-price',
173
+ PRODUCT_ADD_TO_CART_SECTION: 'product-add-to-cart-section',
174
+ PRODUCT_DRAWER: 'product-drawer',
175
+ PRODUCT_LOADING: 'product-loading',
176
+ PRODUCT_LIST: 'product-list',
177
+ PRODUCT_LIST_CARD: 'product-list-card',
178
+ PRODUCT_LIST_FILTERS: 'product-list-filters',
179
+ PRODUCT_LIST_SEARCH: 'product-list-search',
180
+ PRODUCT_LIST_CARD_LOADING: 'product-list-card-loading',
181
+ PRODUCT_LIST_ENGRAVING_FORM: 'product-list-engraving-form',
182
+ PRODUCT_LIST_PRODUCT_PRE_CART: 'product-list-product-pre-cart',
183
+ PRODUCT_LIST_PRODUCT_ENGRAVING_LINES: 'product-list-product-engraving-lines',
184
+ PRODUCT_LIST_SIZE_SELECTOR: 'product-list-size-selector',
185
+ CART: 'cart',
186
+ CART_RETAILER: 'cart-retailer',
187
+ CART_ITEM: 'cart-item',
188
+ CART_FOOTER: 'cart-footer',
189
+ CART_ITEM_QUANTITY_PRICE: 'cart-item-quantity-price',
190
+ CART_RETAILER_SUBTOTAL: 'cart-retailer-subtotal',
191
+ CART_PROMO_CODE: 'cart-promo-code',
192
+ CART_HEADER: 'cart-header',
193
+ CART_BODY: 'cart-body',
194
+ CART_FULFILLMENT: 'cart-fulfillment',
195
+ CHECKOUT: 'checkout',
196
+ CHECKOUT_INFORMATION: 'checkout-information',
197
+ CHECKOUT_STRIPE_HANDLER: 'checkout-stripe-handler',
198
+ CHECKOUT_STRIPE_FORM: 'checkout-stripe-form',
199
+ CHECKOUT_PAYMENT: 'checkout-payment',
200
+ CHECKOUT_PAYMENT_SUMMARY: 'checkout-payment-summary',
201
+ CHECKOUT_BILLING: 'checkout-billing',
202
+ CHECKOUT_ORDER_SUMMARY: 'checkout-order-summary',
203
+ CHECKOUT_PROMO_CODE: 'checkout-promo-code',
204
+ CHECKOUT_GIFT_CARDS: 'checkout-gift-cards',
205
+ CHECKOUT_AMOUNTS: 'checkout-amounts',
206
+ CHECKOUT_ITEMS: 'checkout-items',
207
+ CHECKOUT_COMPLETED: 'checkout-completed',
208
+ CHECKOUT_DELIVER_TO: 'checkout-deliver-to',
209
+ CHECKOUT_DELIVER_TO_SUMMARY: 'checkout-deliver-to-summary',
210
+ CHECKOUT_BUYER: 'checkout-buyer',
211
+ CHECKOUT_BUYER_SUMMARY: 'checkout-buyer-summary',
212
+ CHECKOUT_TIPS: 'checkout-tips',
213
+ CHECKOUT_PC_GC: 'checkout-pc-gc',
214
+ CHECKOUT_ITEM: 'checkout-item',
215
+ CHECKOUT_ITEM_QUANTITY: 'checkout-item-quantity',
216
+ CHECKOUT_PLACE_ORDER_BUTTON: 'checkout-place-order-button',
217
+ CHECKOUT_HEADER: 'checkout-header',
218
+ CHECKOUT_PRESALE_COUNTDOWN: 'checkout-presale-countdown',
219
+ CHECKOUT_PRESALE_EXPIRED: 'checkout-presale-expired',
220
+ CHECKOUT_SEND_AS_GIFT: 'checkout-send-as-gift',
221
+ };
222
+ const FULFILLMENT_TYPE = {
223
+ ON_DEMAND: 'onDemand',
224
+ SHIPPING: 'shipping',
225
+ };
226
+ const DEBUG_MODE = {
227
+ NONE: 'none',
228
+ CONSOLE: 'console',
229
+ PANEL: 'panel',
230
+ };
231
+ const CART_EVENT_TYPE = {
232
+ GENERIC: 'generic',
233
+ PROMO_CODE: 'promo-code',
234
+ };
235
+ const CART_EVENT_LEVEL = {
236
+ SUCCESS: 'success',
237
+ WARNING: 'warning',
238
+ ERROR: 'error',
239
+ };
240
+ const CHECKOUT_EVENT_TYPE = {
241
+ GENERIC: 'generic',
242
+ PROMO_CODE: 'promo-code',
243
+ GIFT_CARD: 'gift-card',
244
+ };
245
+ const CHECKOUT_EVENT_LEVEL = {
246
+ SUCCESS: 'success',
247
+ WARNING: 'warning',
248
+ ERROR: 'error',
249
+ };
250
+ const DISPLAY_MODE = {
251
+ MODAL: 'modal',
252
+ DRAWER: 'drawer',
253
+ };
254
+ const NAVIGATION_SOURCE = {
255
+ PRODUCT: 'product',
256
+ PRODUCT_LIST_CARD: 'product-list-card',
257
+ PRE_CART: 'pre-cart',
258
+ };
259
+
260
+ const SSR_WARN = '[LiquidCommerce Elements] This SDK is designed for the browser. ' + 'Calls made during SSR return null. The SDK will initialize on the client.';
261
+ async function Elements(..._args) {
262
+ console.warn(SSR_WARN);
263
+ return null;
264
+ }
265
+ async function ElementsBuilder(..._args) {
266
+ console.warn(SSR_WARN);
267
+ return null;
268
+ }
269
+
270
+ export { CART_EVENT_LEVEL, CART_EVENT_TYPE, CHECKOUT_EVENT_LEVEL, CHECKOUT_EVENT_TYPE, COMPONENT_TYPE, DEBUG_MODE, DISPLAY_MODE, ELEMENTS_ACTIONS_EVENT, ELEMENTS_ENV, ELEMENTS_FORM, Elements, ElementsBuilder, FULFILLMENT_TYPE, NAVIGATION_SOURCE, SDKError, isSDKError };
@@ -0,0 +1,2 @@
1
+ export declare function ElementsCheckoutAutoInitialize(): Promise<void>;
2
+ export declare function triggerElementsCheckoutAutoInit(): void;
@@ -0,0 +1,46 @@
1
+ import type { IAddProductParams } from '@/core/client/actions/client-cart-action.service';
2
+ import type { IAnonymousCheckoutAddProductItem } from '@/interfaces/api/checkout.interface';
3
+ import type { IInjectedComponent } from '@/interfaces/component.interface';
4
+ import type { IClientCustomThemeConfig, ILiquidCommerceElementsDevelopmentConfig } from '@/interfaces/config.interface';
5
+ import type { IInjectCheckoutParams } from '@/interfaces/injection.interface';
6
+ export interface IQueryParamActions {
7
+ addProduct: (params: IAddProductParams[], open?: boolean) => Promise<void>;
8
+ applyPromoCode: (promoCode: string) => Promise<void>;
9
+ }
10
+ export declare const SHARED_ATTR: {
11
+ readonly SCRIPT: {
12
+ readonly MAIN: "data-liquid-commerce-elements";
13
+ readonly TOKEN: "data-token";
14
+ readonly ENV: "data-env";
15
+ readonly DEBUG_MODE: "data-debug-mode";
16
+ readonly PRODUCT_PARAM: "data-product-param";
17
+ readonly PRODUCT_FULFILLMENT_TYPE_PARAM: "data-product-fulfillment-type-param";
18
+ readonly PRODUCT_QUANTITY_PARAM: "data-product-quantity-param";
19
+ readonly PROMO_CODE_PARAM: "data-promo-code-param";
20
+ readonly CHECKOUT_PARAM: "data-checkout-param";
21
+ readonly CHECKOUT_URL: "data-checkout-url";
22
+ };
23
+ readonly ELEMENT: {
24
+ readonly CHECKOUT: "data-lce-checkout";
25
+ readonly HIDE_HEADER: "hide-header";
26
+ readonly EXIT_CHECKOUT: "data-lce-exit-checkout";
27
+ };
28
+ readonly JSON_SCRIPT: {
29
+ readonly DEVELOPMENT: "data-liquid-commerce-elements-development";
30
+ readonly CUSTOM_THEME: "data-liquid-commerce-elements-custom-theme";
31
+ };
32
+ };
33
+ export declare function startsWithLcePrefix(value: string | null): boolean;
34
+ export declare function getDevelopmentConfigs(): ILiquidCommerceElementsDevelopmentConfig | undefined;
35
+ export declare function getCustomThemeConfig(): IClientCustomThemeConfig | undefined;
36
+ export declare function triggerAutoInit(initFunction: () => Promise<void>, errorPrefix: string): void;
37
+ export declare function setupCheckout(script: HTMLScriptElement, injectFn: (params: IInjectCheckoutParams) => Promise<IInjectedComponent | null>, exitCheckoutFn: () => void, options: {
38
+ errorPrefix: string;
39
+ }): Promise<void>;
40
+ export declare function setupExitCheckoutHandlers(exitCheckoutFn: () => void): void;
41
+ export declare function addProductViaQueryParam(actions: IQueryParamActions, script: HTMLScriptElement, errorPrefix: string): Promise<void>;
42
+ export declare function extractAnonymousProductFromQueryParams(script: HTMLScriptElement, errorPrefix: string): {
43
+ item: IAnonymousCheckoutAddProductItem;
44
+ promoCode?: string;
45
+ } | null;
46
+ export declare function applyPromoCodeViaQueryParam(actions: IQueryParamActions, script: HTMLScriptElement, errorPrefix: string): Promise<void>;
@@ -1,3 +1,9 @@
1
+ import '@/modules/theme-provider/styles/register-styles';
2
+ import '@/modules/address/styles/register-styles';
3
+ import '@/modules/cart/styles/register-styles';
4
+ import '@/modules/checkout/styles/register-styles';
5
+ import '@/modules/product/styles/register-styles';
6
+ import '@/modules/product-list/styles/register-styles';
1
7
  import { ApiClientService } from '@/core/api/api-client.service';
2
8
  import { AuthClientService } from '@/core/api/auth-client.service';
3
9
  import { ClientActionService } from '@/core/client/client-action.service';
@@ -10,7 +16,9 @@ import { LoggerFactory } from '@/core/logger/logger-factory';
10
16
  import { StoreService } from '@/core/store/store.service';
11
17
  import { TelemetryService } from '@/core/telemetry/telemetry.service';
12
18
  import { type ComponentType } from '@/enums';
13
- import type { IInjectedComponent, IInjectProductElement, IInjectProductListParams, ILiquidCommerceElementsActions, IProcessInjectElementParams } from '@/interfaces/core.interface';
19
+ import type { ILiquidCommerceElementsActions } from '@/interfaces/client.interface';
20
+ import type { IInjectedComponent } from '@/interfaces/component.interface';
21
+ import type { IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams, IProcessInjectElementParams } from '@/interfaces/injection.interface';
14
22
  import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
15
23
  export declare abstract class ElementsBaseClient {
16
24
  protected readonly authClient: AuthClientService;
@@ -27,7 +35,8 @@ export declare abstract class ElementsBaseClient {
27
35
  protected readonly logger: ReturnType<typeof LoggerFactory.get>;
28
36
  protected clientPrepared: boolean;
29
37
  protected componentFactoryInitialized: boolean;
30
- protected cartDrawerCreated: boolean;
38
+ protected cartDrawerElement: HTMLElement | null;
39
+ private heavyInitTimeoutId;
31
40
  protected injectedComponents: Map<string, IInjectedComponent>;
32
41
  constructor(clientConfigs: IClientConfigs);
33
42
  prepare(): Promise<void>;
@@ -38,9 +47,13 @@ export declare abstract class ElementsBaseClient {
38
47
  protected processInjectElement(params: IProcessInjectElementParams): Promise<IInjectedComponent | null>;
39
48
  protected processInjectProduct(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
40
49
  injectProductList(params: IInjectProductListParams): Promise<void>;
50
+ injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
51
+ injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
41
52
  protected ensureCartDrawerExists(): void;
42
53
  protected ensureAllComponentsRegistered(): void;
54
+ private getServerListConfig;
43
55
  protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
56
+ destroy(): void;
44
57
  protected rerenderInjectedComponentsByType(type: ComponentType): void;
45
58
  protected isElementsEnabled(): boolean;
46
59
  protected injectDisabledElementsError(containerId: string, componentName: ComponentType): void;
@@ -0,0 +1,3 @@
1
+ import type { ILiquidCommerceElementsBuilderClient } from '@/interfaces/client.interface';
2
+ import type { ILiquidCommerceElementsBuilderConfig } from '@/interfaces/config.interface';
3
+ export declare function ElementsBuilder(apiKey: string, config: ILiquidCommerceElementsBuilderConfig): Promise<ILiquidCommerceElementsBuilderClient | null>;
@@ -0,0 +1,6 @@
1
+ import type { IElementsCheckoutClient } from '@/interfaces/client.interface';
2
+ import type { ILiquidCommerceElementsCheckoutClientConfig } from '@/interfaces/config.interface';
3
+ import '@/modules/theme-provider/styles/register-styles';
4
+ import '@/modules/address/styles/register-styles';
5
+ import '@/modules/checkout/styles/register-styles';
6
+ export declare function ElementsCheckout(apiKey: string, config: ILiquidCommerceElementsCheckoutClientConfig): Promise<IElementsCheckoutClient | null>;
@@ -1,4 +1,5 @@
1
1
  import { type ComponentType } from '@/enums';
2
- export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>): T;
2
+ export declare function normalizeProductListLists<T extends Record<string, any>>(data: T): T;
3
+ export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>, currentPath?: string): T;
3
4
  export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
4
5
  export declare function getComponentTypesForLayoutFields(parentPath: string, layoutFields: Record<string, any>): ComponentType[];
@@ -0,0 +1,3 @@
1
+ import type { ILiquidCommerceElementsClient } from '@/interfaces/client.interface';
2
+ import type { ILiquidCommerceElementsConfig } from '@/interfaces/config.interface';
3
+ export declare function Elements(apiKey: string, config: ILiquidCommerceElementsConfig): Promise<ILiquidCommerceElementsClient | null>;
@@ -3,13 +3,9 @@ export declare const API_CLIENT_URL: {
3
3
  staging: string;
4
4
  production: string;
5
5
  };
6
- export declare const PRODUCT_LIST_CARD_VARIANT: {
7
- STANDARD: string;
8
- };
9
6
  export declare const PRODUCT_LIST_FILTER_TYPES: {
10
- PERSONALIZATION: string;
11
- PRE_ORDER: string;
12
- DELIVERY_OPTIONS: string;
7
+ ENGRAVING: string;
8
+ FULFILLMENT: string;
13
9
  PRICE: string;
14
10
  BRANDS: string;
15
11
  CATEGORIES: string;
@@ -1,30 +1,31 @@
1
+ import type { ApiResult } from '@/core/api/api-result';
1
2
  import type { AuthClientService } from '@/core/api/auth-client.service';
2
- import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
3
+ import type { IPersistedStore, IPersistedStoreAction } from '@/core/store/interfaces/core.interface';
3
4
  import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
5
+ import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
6
+ import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse, ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
4
7
  import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
5
- import type { ICart, ICartUpdateParams, ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
6
- import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
7
- import type { IAllConfigs } from '@/interfaces/configs';
8
+ import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
8
9
  export declare class ApiClientService {
9
10
  private client;
10
11
  private readonly logger;
11
12
  constructor();
12
13
  static getInstance(): ApiClientService;
13
14
  setClient(client: AuthClientService): Promise<void>;
14
- getAllConfigs(): Promise<IAllConfigs>;
15
- setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
16
- getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
17
- deletePersistedStore(userDeviceId: string): Promise<void>;
18
- getAddressSuggestions(input: string): Promise<IAddressAutocompleteResult[]>;
19
- getAddressDetails(id: string): Promise<IAddressDetailsResult>;
20
- getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse | null>;
21
- catalogSearch(params: ICatalogParams): Promise<ICatalog>;
22
- getCartData(id: string | null): Promise<ICart>;
23
- updateCart(params: ICartUpdateParams & {
24
- loc?: ILocation;
25
- }): Promise<ICart>;
26
- prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
27
- getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
28
- confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ILiquidPaymentToken>;
29
- checkoutComplete(params: Partial<ICheckoutCompleteParams>): Promise<ICheckoutCompleteResponse>;
15
+ setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<ApiResult<IPersistedStoreAction>>;
16
+ getPersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStore>>;
17
+ deletePersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStoreAction>>;
18
+ getAddressSuggestions(input: string): Promise<ApiResult<IAddressAutocompleteResult[]>>;
19
+ getAddressDetails(id: string): Promise<ApiResult<IAddressDetailsResult>>;
20
+ getProductsData(identifier: string[], location?: ILocation): Promise<ApiResult<IProductAvailabilityResponse>>;
21
+ productListSearch(params: IProductSearchParams): Promise<ApiResult<IProductSearchResponse>>;
22
+ getProductAvailabilityByState(identifiers: string[], state?: string): Promise<ApiResult<IProductAvailabilityResponse>>;
23
+ getCartData(id: string | null): Promise<ApiResult<ICart>>;
24
+ updateCart(params: ICartUpdateParams): Promise<ApiResult<ICart>>;
25
+ prepareCheckout(params: ICheckoutPrepareParams): Promise<ApiResult<ICheckoutPrepare>>;
26
+ updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ApiResult<ICheckoutItemsUpdateResponse>>;
27
+ getPaymentSession(cartId: string): Promise<ApiResult<ICheckoutPaymentSession>>;
28
+ confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ApiResult<ICheckoutPaymentConfirm>>;
29
+ addAnonymousProduct(params: IAnonymousCheckoutAddProductParams): Promise<ApiResult<IAnonymousCheckoutAddProductResponse>>;
30
+ checkoutComplete(token: string): Promise<ApiResult<ICheckoutComplete>>;
30
31
  }
@@ -0,0 +1,19 @@
1
+ export interface IApiErrorDetail {
2
+ field?: string;
3
+ message: string;
4
+ code?: string;
5
+ }
6
+ export interface ApiError {
7
+ status: number;
8
+ message: string;
9
+ errors: IApiErrorDetail[];
10
+ }
11
+ export type ApiResult<T> = {
12
+ success: true;
13
+ data: T;
14
+ } | {
15
+ success: false;
16
+ error: ApiError;
17
+ };
18
+ export declare function apiSuccess<T>(data: T): ApiResult<T>;
19
+ export declare function apiError<T = never>(status: number, message: string, errors?: IApiErrorDetail[]): ApiResult<T>;
@@ -1,4 +1,6 @@
1
+ import { type ApiResult } from '@/core/api/api-result';
1
2
  import type { ElementsEnv } from '@/enums';
3
+ import type { IAllConfigs } from '@/interfaces/configs/global.interface';
2
4
  export interface IAuthConfig {
3
5
  apiKey: string;
4
6
  env: ElementsEnv;
@@ -9,34 +11,59 @@ export interface IHttpRequestOptions {
9
11
  body?: any;
10
12
  }
11
13
  export interface IAuth {
12
- token: string;
13
- exp: number;
14
- type: 'ACCESS_TOKEN';
15
- }
16
- export interface IApiResponseBase {
17
- message: string;
14
+ accessToken: string;
15
+ expiration: number;
18
16
  }
19
17
  export interface IApiResponse<T> {
20
18
  message: string;
21
19
  data: T;
22
20
  }
21
+ export interface IApiErrorDetail {
22
+ field?: string;
23
+ message: string;
24
+ code?: string;
25
+ }
26
+ export interface IApiError {
27
+ statusCode: number;
28
+ message: string;
29
+ errors: IApiErrorDetail[];
30
+ }
31
+ export interface IAuthWithConfigs {
32
+ auth: IAuth;
33
+ configs: IAllConfigs;
34
+ }
23
35
  export declare class AuthClientService {
36
+ private static readonly TOKEN_EXPIRATION_BUFFER_MS;
37
+ private static readonly MAX_RETRIES;
38
+ private static readonly RETRY_DELAY_MS;
24
39
  private readonly apiKey;
25
40
  private readonly baseUrl;
26
41
  private readonly env;
27
- private accessToken;
28
- private tokenExpiration;
29
- private isAuthenticating;
30
42
  private readonly httpClient;
31
43
  private readonly logger;
32
44
  private readonly clientConfig;
45
+ private accessToken;
46
+ private tokenExpiration;
47
+ private refreshPromise;
33
48
  private constructor();
34
49
  static getInstance(config: IAuthConfig): AuthClientService;
35
- authenticate(): Promise<boolean>;
36
- isTokenExpired(): boolean;
50
+ authenticateAndGetConfigs(): Promise<{
51
+ success: boolean;
52
+ configs?: IAllConfigs;
53
+ }>;
54
+ refreshToken(): Promise<boolean>;
55
+ get<TData = unknown>(path: string, options?: IHttpRequestOptions): Promise<ApiResult<TData>>;
56
+ post<TData = unknown>(path: string, options?: IHttpRequestOptions): Promise<ApiResult<TData>>;
57
+ private performTokenRefresh;
37
58
  private request;
59
+ private handleSuccessResponse;
60
+ private handleAuthError;
61
+ private handleErrorResponse;
62
+ private isTokenExpired;
63
+ private clearToken;
38
64
  private buildUrl;
65
+ private buildHeaders;
39
66
  private getProxyHeaders;
40
- get<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
41
- post<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
67
+ private isAuthError;
68
+ private shouldRetryNonAuth;
42
69
  }
@@ -37,7 +37,6 @@ export declare class HttpClientService {
37
37
  private logNetworkError;
38
38
  private diagnosePossibleCauses;
39
39
  private enhanceError;
40
- private sanitizeHeaders;
41
40
  private delay;
42
41
  private getFetchImplementation;
43
42
  private fetchAdapter;
@@ -7,6 +7,7 @@ import { TelemetryService } from '@/core/telemetry/telemetry.service';
7
7
  import type { ComponentType } from '@/enums';
8
8
  import type { ConfigsKeyType, ConfigsType } from '@/interfaces/configs';
9
9
  import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
10
+ import { SafeHTMLElement } from '@/utils/dom-compat';
10
11
  import { CommandService } from './command/command.service';
11
12
  export interface IBaseComponentConfig {
12
13
  type: ComponentType;
@@ -25,7 +26,7 @@ export interface IOnStoreChanged {
25
26
  value: any;
26
27
  oldValue: any;
27
28
  }
28
- export declare abstract class BaseComponent<TParams = Record<string, any>, TConfig = ConfigsType> extends HTMLElement {
29
+ export declare abstract class BaseComponent<TParams = Record<string, any>, TConfig = ConfigsType> extends SafeHTMLElement {
29
30
  protected readonly store: StoreService;
30
31
  protected readonly commands: CommandService;
31
32
  protected readonly themeProvider: ThemeProviderService;
@@ -0,0 +1,15 @@
1
+ import { ApiClientService } from '@/core/api/api-client.service';
2
+ import { LoggerFactory } from '@/core/logger/logger-factory';
3
+ import { PubSubService } from '@/core/pubsub/pubsub.service';
4
+ import { StoreService } from '@/core/store/store.service';
5
+ import type { ILocation } from '@/interfaces/api/address.interface';
6
+ import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
7
+ export declare abstract class BaseActionService {
8
+ protected readonly pubSub: PubSubService;
9
+ protected readonly store: StoreService;
10
+ protected readonly api: ApiClientService;
11
+ protected readonly themeProvider: ThemeProviderService;
12
+ protected readonly logger: ReturnType<typeof LoggerFactory.get>;
13
+ constructor(loggerName: string);
14
+ protected getLocation(): ILocation | undefined;
15
+ }
@@ -0,0 +1,18 @@
1
+ import type { IAddressAddress, IAddressCoordinates, IAddressData } from '@/interfaces/api/address.interface';
2
+ import { BaseActionService } from './base-action.service';
3
+ export interface IAddressActions {
4
+ setAddressByPlacesId: (placesId: string) => Promise<void>;
5
+ setAddressManually: (address: IAddressAddress, coordinates: IAddressCoordinates) => Promise<void>;
6
+ clear: () => Promise<void>;
7
+ getDetails: () => IAddressData | null;
8
+ }
9
+ export declare class ClientAddressActionService extends BaseActionService {
10
+ private readonly command;
11
+ constructor();
12
+ static getInstance(): ClientAddressActionService;
13
+ get actions(): IAddressActions;
14
+ private setAddressByPlacesId;
15
+ private setAddressManually;
16
+ private clear;
17
+ private getDetails;
18
+ }