@liquidcommerce/elements-sdk 2.1.0-beta.49

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 (201) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +1183 -0
  3. package/dist/index.esm.js +16834 -0
  4. package/dist/types/auto-initialize.d.ts +2 -0
  5. package/dist/types/constants/core.constant.d.ts +6 -0
  6. package/dist/types/constants/index.d.ts +2 -0
  7. package/dist/types/constants/z-index.constant.d.ts +24 -0
  8. package/dist/types/core/auth.service.d.ts +29 -0
  9. package/dist/types/core/base-component.service.d.ts +93 -0
  10. package/dist/types/core/client/client-action.service.d.ts +70 -0
  11. package/dist/types/core/client/client-config.service.d.ts +47 -0
  12. package/dist/types/core/command/base-command.service.d.ts +17 -0
  13. package/dist/types/core/command/command.service.d.ts +16 -0
  14. package/dist/types/core/command/common-command.service.d.ts +5 -0
  15. package/dist/types/core/component-factory.service.d.ts +27 -0
  16. package/dist/types/core/fingerprint.service.d.ts +28 -0
  17. package/dist/types/core/google-tag-manager.service.d.ts +93 -0
  18. package/dist/types/core/logger/logger-factory.d.ts +8 -0
  19. package/dist/types/core/logger/logger.service.d.ts +17 -0
  20. package/dist/types/core/pubsub/index.d.ts +2 -0
  21. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +16 -0
  22. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +107 -0
  23. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +84 -0
  24. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +81 -0
  25. package/dist/types/core/pubsub/interfaces/index.d.ts +5 -0
  26. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +91 -0
  27. package/dist/types/core/pubsub/pubsub.service.d.ts +12 -0
  28. package/dist/types/core/singleton-manager.service.d.ts +12 -0
  29. package/dist/types/core/store/index.d.ts +2 -0
  30. package/dist/types/core/store/interfaces/address.interface.d.ts +16 -0
  31. package/dist/types/core/store/interfaces/cart.interface.d.ts +94 -0
  32. package/dist/types/core/store/interfaces/checkout.interface.d.ts +154 -0
  33. package/dist/types/core/store/interfaces/core.interface.d.ts +40 -0
  34. package/dist/types/core/store/interfaces/index.d.ts +5 -0
  35. package/dist/types/core/store/interfaces/product.interface.d.ts +81 -0
  36. package/dist/types/core/store/store.constant.d.ts +8 -0
  37. package/dist/types/core/store/store.service.d.ts +41 -0
  38. package/dist/types/core/utils.d.ts +27 -0
  39. package/dist/types/elements-client-helper.d.ts +1 -0
  40. package/dist/types/elements-client.d.ts +2 -0
  41. package/dist/types/enums/cloud.enum.d.ts +77 -0
  42. package/dist/types/enums/core.enum.d.ts +134 -0
  43. package/dist/types/enums/index.d.ts +2 -0
  44. package/dist/types/index.d.ts +4 -0
  45. package/dist/types/index.umd.d.ts +2 -0
  46. package/dist/types/interfaces/cloud/address.interface.d.ts +36 -0
  47. package/dist/types/interfaces/cloud/cart.interface.d.ts +132 -0
  48. package/dist/types/interfaces/cloud/checkout.interface.d.ts +214 -0
  49. package/dist/types/interfaces/cloud/core.interface.d.ts +22 -0
  50. package/dist/types/interfaces/cloud/index.d.ts +6 -0
  51. package/dist/types/interfaces/cloud/product.interface.d.ts +156 -0
  52. package/dist/types/interfaces/cloud/retailer.interface.d.ts +66 -0
  53. package/dist/types/interfaces/cloud/user.interface.d.ts +100 -0
  54. package/dist/types/interfaces/configs/address.interface.d.ts +8 -0
  55. package/dist/types/interfaces/configs/cart.interface.d.ts +15 -0
  56. package/dist/types/interfaces/configs/checkout.interface.d.ts +34 -0
  57. package/dist/types/interfaces/configs/configurations.interface.d.ts +13 -0
  58. package/dist/types/interfaces/configs/global.interface.d.ts +46 -0
  59. package/dist/types/interfaces/configs/index.d.ts +6 -0
  60. package/dist/types/interfaces/configs/product.interface.d.ts +25 -0
  61. package/dist/types/interfaces/core.interface.d.ts +81 -0
  62. package/dist/types/modules/address/address-display.component.d.ts +13 -0
  63. package/dist/types/modules/address/address-input.component.d.ts +40 -0
  64. package/dist/types/modules/address/address.command.d.ts +15 -0
  65. package/dist/types/modules/address/address.component.d.ts +12 -0
  66. package/dist/types/modules/address/address.interface.d.ts +10 -0
  67. package/dist/types/modules/address/index.d.ts +4 -0
  68. package/dist/types/modules/api-client/api-client.interface.d.ts +21 -0
  69. package/dist/types/modules/api-client/api-client.service.d.ts +28 -0
  70. package/dist/types/modules/api-client/index.d.ts +2 -0
  71. package/dist/types/modules/cart/cart.commands.d.ts +36 -0
  72. package/dist/types/modules/cart/cart.commands.helper.d.ts +8 -0
  73. package/dist/types/modules/cart/cart.component.d.ts +11 -0
  74. package/dist/types/modules/cart/components/cart-body.component.d.ts +24 -0
  75. package/dist/types/modules/cart/components/cart-footer.component.d.ts +21 -0
  76. package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +26 -0
  77. package/dist/types/modules/cart/components/cart-header.component.d.ts +6 -0
  78. package/dist/types/modules/cart/components/cart-item-quantity-price.component.d.ts +21 -0
  79. package/dist/types/modules/cart/components/cart-item.component.d.ts +13 -0
  80. package/dist/types/modules/cart/components/cart-promo-code.component.d.ts +17 -0
  81. package/dist/types/modules/cart/components/cart-retailer-subtotal.component.d.ts +10 -0
  82. package/dist/types/modules/cart/components/cart-retailer.component.d.ts +23 -0
  83. package/dist/types/modules/cart/components/index.d.ts +8 -0
  84. package/dist/types/modules/cart/index.d.ts +1 -0
  85. package/dist/types/modules/checkout/checkout.commands.d.ts +50 -0
  86. package/dist/types/modules/checkout/checkout.commands.helper.d.ts +13 -0
  87. package/dist/types/modules/checkout/checkout.component.d.ts +11 -0
  88. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +9 -0
  89. package/dist/types/modules/checkout/components/checkout-information-section.component.d.ts +12 -0
  90. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +26 -0
  91. package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +12 -0
  92. package/dist/types/modules/checkout/components/checkout.type.d.ts +4 -0
  93. package/dist/types/modules/checkout/components/index.d.ts +20 -0
  94. package/dist/types/modules/checkout/components/information/checkout-billing-form.component.d.ts +18 -0
  95. package/dist/types/modules/checkout/components/information/checkout-buyer-information-form.component.d.ts +12 -0
  96. package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +17 -0
  97. package/dist/types/modules/checkout/components/information/checkout-payment-form.component.d.ts +21 -0
  98. package/dist/types/modules/checkout/components/information/checkout-stripe-form.component.d.ts +52 -0
  99. package/dist/types/modules/checkout/components/summary/checkout-amounts.component.d.ts +7 -0
  100. package/dist/types/modules/checkout/components/summary/checkout-completed.component.d.ts +12 -0
  101. package/dist/types/modules/checkout/components/summary/checkout-gift-cards.component.d.ts +14 -0
  102. package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +19 -0
  103. package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +21 -0
  104. package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +16 -0
  105. package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +23 -0
  106. package/dist/types/modules/checkout/components/summary/checkout-presale-expired.component.d.ts +16 -0
  107. package/dist/types/modules/checkout/components/summary/checkout-promo-code.component.d.ts +17 -0
  108. package/dist/types/modules/checkout/components/summary/checkout-tips.component.d.ts +19 -0
  109. package/dist/types/modules/checkout/components/summary/promo-pc-gc.component.d.ts +16 -0
  110. package/dist/types/modules/checkout/constant.d.ts +32 -0
  111. package/dist/types/modules/checkout/index.d.ts +1 -0
  112. package/dist/types/modules/product/components/components.d.ts +20 -0
  113. package/dist/types/modules/product/components/index.d.ts +13 -0
  114. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +26 -0
  115. package/dist/types/modules/product/components/product-description.component.d.ts +9 -0
  116. package/dist/types/modules/product/components/product-drawer.component.d.ts +19 -0
  117. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +36 -0
  118. package/dist/types/modules/product/components/product-interactions.component.d.ts +14 -0
  119. package/dist/types/modules/product/components/product-options.component.d.ts +12 -0
  120. package/dist/types/modules/product/components/product-price.component.d.ts +11 -0
  121. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +32 -0
  122. package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +13 -0
  123. package/dist/types/modules/product/components/product-retailers-popup.component.d.ts +11 -0
  124. package/dist/types/modules/product/components/product-retailers.component.d.ts +11 -0
  125. package/dist/types/modules/product/constant.d.ts +2 -0
  126. package/dist/types/modules/product/index.d.ts +1 -0
  127. package/dist/types/modules/product/product.commands.d.ts +29 -0
  128. package/dist/types/modules/product/product.component.d.ts +13 -0
  129. package/dist/types/modules/product/utils/helpers.d.ts +10 -0
  130. package/dist/types/modules/product/utils/index.d.ts +2 -0
  131. package/dist/types/modules/product/utils/retailer-hours.d.ts +9 -0
  132. package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +7 -0
  133. package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +2 -0
  134. package/dist/types/modules/theme-provider/index.d.ts +2 -0
  135. package/dist/types/modules/theme-provider/services/css-variable-processor.service.d.ts +20 -0
  136. package/dist/types/modules/theme-provider/services/font-manager.service.d.ts +9 -0
  137. package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +13 -0
  138. package/dist/types/modules/theme-provider/styles/address/address.style.d.ts +1 -0
  139. package/dist/types/modules/theme-provider/styles/address/index.d.ts +1 -0
  140. package/dist/types/modules/theme-provider/styles/cart/cart.style.d.ts +1 -0
  141. package/dist/types/modules/theme-provider/styles/cart/index.d.ts +1 -0
  142. package/dist/types/modules/theme-provider/styles/checkout/checkout.style.d.ts +1 -0
  143. package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +1 -0
  144. package/dist/types/modules/theme-provider/styles/global.style.d.ts +1 -0
  145. package/dist/types/modules/theme-provider/styles/product/image-carousel.style.d.ts +1 -0
  146. package/dist/types/modules/theme-provider/styles/product/index.d.ts +3 -0
  147. package/dist/types/modules/theme-provider/styles/product/product.style.d.ts +1 -0
  148. package/dist/types/modules/theme-provider/styles/product/retailers.style.d.ts +1 -0
  149. package/dist/types/modules/theme-provider/styles/ui/drawer.style.d.ts +1 -0
  150. package/dist/types/modules/theme-provider/styles/ui/index.d.ts +3 -0
  151. package/dist/types/modules/theme-provider/styles/ui/loading.style.d.ts +1 -0
  152. package/dist/types/modules/theme-provider/styles/ui/promo-code-ticker.style.d.ts +1 -0
  153. package/dist/types/modules/theme-provider/theme-provider.service.d.ts +22 -0
  154. package/dist/types/modules/ui-components/alert/alert.component.d.ts +24 -0
  155. package/dist/types/modules/ui-components/alert/index.d.ts +1 -0
  156. package/dist/types/modules/ui-components/buttons/buttons-open-cart.component.d.ts +11 -0
  157. package/dist/types/modules/ui-components/buttons/index.d.ts +1 -0
  158. package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +23 -0
  159. package/dist/types/modules/ui-components/drawer/index.d.ts +1 -0
  160. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +24 -0
  161. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +19 -0
  162. package/dist/types/modules/ui-components/engraving/index.d.ts +2 -0
  163. package/dist/types/modules/ui-components/error-view/error-view.d.ts +9 -0
  164. package/dist/types/modules/ui-components/error-view/index.d.ts +1 -0
  165. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +51 -0
  166. package/dist/types/modules/ui-components/input/index.d.ts +2 -0
  167. package/dist/types/modules/ui-components/input/input.component.d.ts +46 -0
  168. package/dist/types/modules/ui-components/lce-element/index.d.ts +1 -0
  169. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +11 -0
  170. package/dist/types/modules/ui-components/loading/index.d.ts +1 -0
  171. package/dist/types/modules/ui-components/loading/product-loading.component.d.ts +6 -0
  172. package/dist/types/modules/ui-components/powered-by/index.d.ts +1 -0
  173. package/dist/types/modules/ui-components/powered-by/powered-by.component.d.ts +13 -0
  174. package/dist/types/modules/ui-components/promo-code-ticker/index.d.ts +1 -0
  175. package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +17 -0
  176. package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +8 -0
  177. package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +2 -0
  178. package/dist/types/modules/ui-components/purchase-min-alert/purchase-min-alert.component.d.ts +16 -0
  179. package/dist/types/modules/ui-components/ui.commands.d.ts +7 -0
  180. package/dist/types/static/icon/arrow-right.icon.d.ts +2 -0
  181. package/dist/types/static/icon/bag.icon.d.ts +2 -0
  182. package/dist/types/static/icon/checkbox.icon.d.ts +2 -0
  183. package/dist/types/static/icon/chevron-down.icon.d.ts +2 -0
  184. package/dist/types/static/icon/chevron-left.icon.d.ts +2 -0
  185. package/dist/types/static/icon/close.icon.d.ts +2 -0
  186. package/dist/types/static/icon/completed.icon.d.ts +2 -0
  187. package/dist/types/static/icon/error-info.icon.d.ts +2 -0
  188. package/dist/types/static/icon/icon.types.d.ts +6 -0
  189. package/dist/types/static/icon/index.d.ts +15 -0
  190. package/dist/types/static/icon/info.icon.d.ts +2 -0
  191. package/dist/types/static/icon/loading-spinner.icon.d.ts +2 -0
  192. package/dist/types/static/icon/search.icon.d.ts +2 -0
  193. package/dist/types/static/icon/success.icon.d.ts +2 -0
  194. package/dist/types/static/icon/trash.icon.d.ts +2 -0
  195. package/dist/types/static/icon/warning.icon.d.ts +2 -0
  196. package/dist/types/utils/dom-polyfills.d.ts +10 -0
  197. package/dist/types/utils/format.d.ts +23 -0
  198. package/dist/types/utils/helper.d.ts +27 -0
  199. package/dist/types/utils/html-sanitizer.d.ts +2 -0
  200. package/package.json +110 -0
  201. package/umd/elements.js +1 -0
@@ -0,0 +1,2 @@
1
+ export declare function ElementsAutoInitialize(): Promise<void>;
2
+ export declare function triggerElementsAutoInit(): void;
@@ -0,0 +1,6 @@
1
+ export declare const API_CLIENT_URL: {
2
+ local: string;
3
+ development: string;
4
+ staging: string;
5
+ production: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ export * from './core.constant';
2
+ export * from './z-index.constant';
@@ -0,0 +1,24 @@
1
+ export declare const Z_INDEX: {
2
+ readonly DRAWER_WRAPPER: 2147483640;
3
+ readonly DRAWER_CONTENT: 5952;
4
+ readonly DRAWER_BACKDROP: 5951;
5
+ readonly ADDRESS_SUGGESTIONS: 5850;
6
+ readonly PRODUCT_DRAWER: 5840;
7
+ readonly CART_LOADING: 5750;
8
+ readonly LOADING_SPINNER: 5740;
9
+ readonly LOADING_INDICATOR: 5730;
10
+ readonly ERROR_MESSAGE: 5650;
11
+ readonly ALERT_BANNER: 5640;
12
+ readonly NOTIFICATION: 5630;
13
+ readonly CAROUSEL_CONTROLS: 5580;
14
+ readonly TOOLTIP: 5570;
15
+ readonly PROGRESS_BAR: 5560;
16
+ readonly CHECKOUT_HEADER: 5540;
17
+ readonly INDEPENDENT_BUTTON: 5530;
18
+ readonly CART_HEADER: 5540;
19
+ readonly TOGGLE_SLIDER: 5150;
20
+ readonly FORM_CONTROLS: 5130;
21
+ readonly ADDRESS_ACTIONS: 5050;
22
+ readonly SKELETON_WAVE: 5040;
23
+ readonly CONTENT_OVERLAY: 5030;
24
+ };
@@ -0,0 +1,29 @@
1
+ import type { ElementsEnv } from '@/enums';
2
+ export interface IAuthConfig {
3
+ apiKey: string;
4
+ env: ElementsEnv;
5
+ baseUrl: string;
6
+ }
7
+ export declare class AuthService {
8
+ private readonly apiKey;
9
+ private readonly baseUrl;
10
+ private readonly env;
11
+ private accessToken;
12
+ private tokenExpiration;
13
+ private isAuthenticating;
14
+ private readonly httpClient;
15
+ private readonly logger;
16
+ private readonly clientConfig;
17
+ private constructor();
18
+ static getInstance(config: IAuthConfig): AuthService;
19
+ authenticate(): Promise<boolean>;
20
+ private requestWithoutAuth;
21
+ isTokenExpired(): boolean;
22
+ private request;
23
+ private buildUrl;
24
+ private getProxyHeaders;
25
+ get<T = any>(path: string, headers?: Record<string, string>): Promise<T>;
26
+ post<T = any>(path: string, body?: any, headers?: Record<string, string>): Promise<T>;
27
+ put<T = any>(path: string, body?: any, headers?: Record<string, string>): Promise<T>;
28
+ delete<T = any>(path: string, headers?: Record<string, string>): Promise<T>;
29
+ }
@@ -0,0 +1,93 @@
1
+ import { ClientConfigService } from '@/core/client/client-config.service';
2
+ import { LoggerFactory } from '@/core/logger/logger-factory';
3
+ import { PubSubService } from '@/core/pubsub';
4
+ import { type StorePaths, StoreService } from '@/core/store';
5
+ import type { ComponentType } from '@/enums';
6
+ import type { ConfigsKeyType, ConfigsType } from '@/interfaces/configs';
7
+ import { ThemeProviderService } from '@/modules/theme-provider';
8
+ import { CommandService } from './command/command.service';
9
+ export interface IBaseComponentConfig {
10
+ type: ComponentType;
11
+ tagName: string;
12
+ useShadowDom?: boolean;
13
+ }
14
+ export interface ReactiveOptions {
15
+ watchStorePaths?: StorePaths[];
16
+ watchOnlyStorePaths?: StorePaths[];
17
+ autoDestroy?: boolean;
18
+ autoDestroyPath?: StorePaths;
19
+ autoDestroyDelay?: number;
20
+ }
21
+ export interface IOnStoreChanged {
22
+ path: string;
23
+ value: any;
24
+ oldValue: any;
25
+ }
26
+ export declare abstract class BaseComponent<TParams = Record<string, any>, TConfig = ConfigsType> extends HTMLElement {
27
+ protected readonly store: StoreService;
28
+ protected readonly commands: CommandService;
29
+ protected readonly themeProvider: ThemeProviderService;
30
+ protected readonly pubSub: PubSubService;
31
+ protected readonly logger: ReturnType<typeof LoggerFactory.get>;
32
+ protected readonly clientConfig: ClientConfigService;
33
+ private initialized;
34
+ private isDestroyed;
35
+ private renderScheduled;
36
+ private unsubscribers;
37
+ private renderTimeout?;
38
+ private autoDestroyTimeout?;
39
+ private lastRenderTrigger;
40
+ private renderCount;
41
+ private _initParams;
42
+ private _elementConfig;
43
+ protected container: HTMLElement | ShadowRoot;
44
+ protected reactiveOptions: ReactiveOptions;
45
+ protected get hostClasses(): string[];
46
+ protected get hostAttributes(): Record<string, string>;
47
+ constructor(reactiveOptions?: ReactiveOptions);
48
+ initialize({ data, config }: {
49
+ data: TParams;
50
+ config: IBaseComponentConfig;
51
+ }): void;
52
+ private interpolateStorePaths;
53
+ private interpolatePath;
54
+ connectedCallback(): void;
55
+ disconnectedCallback(): void;
56
+ private setup;
57
+ private cleanup;
58
+ private setupAutoDestroy;
59
+ private handleAutoDestroy;
60
+ private destroyComponent;
61
+ private setupStoreWatchers;
62
+ private setupNonRenderingWatchers;
63
+ private triggerRender;
64
+ private scheduleRender;
65
+ private render;
66
+ private logRenderInfo;
67
+ protected rerender(context?: string): void;
68
+ private updateHostClasses;
69
+ addHostClasses(...classes: string[]): void;
70
+ removeHostClasses(...classes: string[]): void;
71
+ toggleHostClasses(...classes: string[]): void;
72
+ addHostAttribute(key: string, value: string): void;
73
+ removeHostAttribute(key: string): void;
74
+ private updateHostAttributes;
75
+ protected get params(): TParams;
76
+ protected get config(): TConfig;
77
+ protected get elementConfig(): IBaseComponentConfig;
78
+ protected getConfigs<T = any>(type: ConfigsKeyType): T;
79
+ protected getStoreValue<T>(path: StorePaths): T;
80
+ protected setStoreValue<T>(path: StorePaths, value: T): boolean;
81
+ protected watchStore(path: StorePaths, callback: (value: any, oldValue: any) => void): () => void;
82
+ protected abstract template(): HTMLElement | HTMLElement[] | string;
83
+ protected beforeSetupStoreWatchers?(): void;
84
+ protected beforeConnected?(): void;
85
+ protected connected?(): void;
86
+ protected disconnected?(): void;
87
+ protected afterRender?(): void;
88
+ protected onStoreChanged?(changes: IOnStoreChanged[]): boolean | undefined;
89
+ protected onStoreWatch?(changes: IOnStoreChanged[]): void;
90
+ protected onError?(error: any, context: string): void;
91
+ protected beforeAutoDestroy?(path: StorePaths): void;
92
+ protected onAutoDestroy?(): void;
93
+ }
@@ -0,0 +1,70 @@
1
+ import type { IBaseCartEventData, IBaseProductEventData, ICheckoutDetails } from '@/core/pubsub';
2
+ import { type FulfillmentType } from '@/enums';
3
+ import type { IAddress, ICoords } from '@/interfaces/cloud';
4
+ import type { IAddressData } from '@/modules/address';
5
+ import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
6
+ export interface IProductActions {
7
+ getDetails: (identifier: string) => IBaseProductEventData;
8
+ }
9
+ export interface IAddressActions {
10
+ setAddressByPlacesId: (placesId: string) => Promise<void>;
11
+ setAddressManually: (address: Omit<IAddress, 'id'>, coordinates: ICoords) => Promise<void>;
12
+ clear: () => void;
13
+ getDetails: () => IAddressData | null;
14
+ }
15
+ export interface ICartActions {
16
+ openCart: () => void;
17
+ closeCart: () => void;
18
+ toggleCart: () => void;
19
+ addProduct: (params: Array<{
20
+ identifier: string;
21
+ fulfillmentType: FulfillmentType;
22
+ quantity: number;
23
+ }>, openCart?: boolean) => Promise<void>;
24
+ applyPromoCode: (promoCode: string) => Promise<void>;
25
+ removePromoCode: () => Promise<void>;
26
+ resetCart: () => Promise<void>;
27
+ getDetails: () => IBaseCartEventData;
28
+ }
29
+ export interface ICheckoutActions {
30
+ openCheckout: () => void;
31
+ closeCheckout: () => void;
32
+ toggleCheckout: () => void;
33
+ addProduct: (params: Array<{
34
+ identifier: string;
35
+ fulfillmentType: FulfillmentType;
36
+ quantity: number;
37
+ }>, openCheckout?: boolean) => Promise<void>;
38
+ applyPromoCode: (promoCode: string) => Promise<void>;
39
+ removePromoCode: () => Promise<void>;
40
+ applyGiftCard: (code: string) => Promise<void>;
41
+ removeGiftCard: (code: string) => Promise<void>;
42
+ toggleIsGift: (active?: boolean) => Promise<void>;
43
+ toggleBillingSameAsShipping: (active?: boolean) => Promise<void>;
44
+ toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => void;
45
+ updateCustomerInfo: (params: Record<CustomerFieldName, string>) => void;
46
+ updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
47
+ updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
48
+ getDetails: () => ICheckoutDetails;
49
+ }
50
+ export declare class ClientActionService {
51
+ private readonly pubSub;
52
+ private readonly command;
53
+ private readonly store;
54
+ private readonly api;
55
+ private readonly themeProvider;
56
+ private readonly logger;
57
+ constructor();
58
+ static getInstance(): ClientActionService;
59
+ private getLocation;
60
+ private productActions;
61
+ private addressActions;
62
+ private cartActions;
63
+ private checkoutActions;
64
+ actions: {
65
+ product: IProductActions;
66
+ address: IAddressActions;
67
+ cart: ICartActions;
68
+ checkout: ICheckoutActions;
69
+ };
70
+ }
@@ -0,0 +1,47 @@
1
+ import { type ElementsEnv } from '@/enums';
2
+ import type { IClientCustomThemeConfig, IElementsProxyConfig, IPromoTicker } from '@/interfaces/core.interface';
3
+ export type DeviceType = 'desktop' | 'tablet' | 'mobile';
4
+ export interface IClientConfigs {
5
+ apiKey: string;
6
+ env: ElementsEnv;
7
+ isBuilder: boolean;
8
+ enableDebugging: boolean;
9
+ baseUrl: string;
10
+ customTheme: IClientCustomThemeConfig | null;
11
+ proxy: IElementsProxyConfig | null;
12
+ deviceType: DeviceType;
13
+ userDeviceId?: string;
14
+ isLocalStorageAvailable?: boolean;
15
+ version?: string;
16
+ clientPrepared: boolean;
17
+ promoTicker: IPromoTicker | null;
18
+ }
19
+ export interface IClientConfigInput {
20
+ env?: ElementsEnv;
21
+ isBuilder?: boolean;
22
+ enableDebugging?: boolean;
23
+ customTheme?: IClientCustomThemeConfig;
24
+ proxy?: IElementsProxyConfig;
25
+ promoTicker?: IPromoTicker;
26
+ }
27
+ export declare class ClientConfigService {
28
+ private config;
29
+ static getInstance(): ClientConfigService;
30
+ initialize(apiKey: string, configInput?: IClientConfigInput): void;
31
+ getConfigs(): IClientConfigs;
32
+ get<K extends keyof IClientConfigs>(key: K): IClientConfigs[K];
33
+ set<K extends keyof IClientConfigs>(key: K, value: IClientConfigs[K]): void;
34
+ isDevelopment(): boolean;
35
+ isStaging(): boolean;
36
+ isProduction(): boolean;
37
+ isBuilder(): boolean;
38
+ isDebuggingEnabled(): boolean;
39
+ debuggingDisabled(): boolean;
40
+ hasCustomTheme(): boolean;
41
+ isMobile(): boolean;
42
+ isLocalStorageAvailable(): boolean;
43
+ getProxyConfig(): IElementsProxyConfig | null;
44
+ private validateInputs;
45
+ private buildConfiguration;
46
+ private detectDeviceType;
47
+ }
@@ -0,0 +1,17 @@
1
+ import { ClientConfigService } from '@/core/client/client-config.service';
2
+ import { GoogleTagManagerService } from '@/core/google-tag-manager.service';
3
+ import { LoggerFactory } from '@/core/logger/logger-factory';
4
+ import { PubSubService } from '@/core/pubsub';
5
+ import { StoreService } from '@/core/store';
6
+ import type { ILoc } from '@/interfaces/cloud';
7
+ import { ApiClientService } from '@/modules/api-client/api-client.service';
8
+ export declare abstract class BaseCommand {
9
+ protected store: StoreService;
10
+ protected api: ApiClientService;
11
+ protected logger: ReturnType<typeof LoggerFactory.get>;
12
+ protected pubSub: PubSubService;
13
+ protected googleTagManager: GoogleTagManagerService;
14
+ protected clientConfig: ClientConfigService;
15
+ constructor();
16
+ protected getLocation(): ILoc | undefined;
17
+ }
@@ -0,0 +1,16 @@
1
+ import { AddressCommands } from '@/modules/address/address.command';
2
+ import { CartCommands } from '@/modules/cart/cart.commands';
3
+ import { CheckoutCommands } from '@/modules/checkout/checkout.commands';
4
+ import { ProductCommands } from '@/modules/product/product.commands';
5
+ import { UICommands } from '@/modules/ui-components/ui.commands';
6
+ import { CommonCommands } from './common-command.service';
7
+ export declare class CommandService {
8
+ readonly ui: UICommands;
9
+ readonly address: AddressCommands;
10
+ readonly product: ProductCommands;
11
+ readonly cart: CartCommands;
12
+ readonly checkout: CheckoutCommands;
13
+ readonly common: CommonCommands;
14
+ constructor();
15
+ static getInstance(): CommandService;
16
+ }
@@ -0,0 +1,5 @@
1
+ import { BaseCommand } from './base-command.service';
2
+ export declare class CommonCommands extends BaseCommand {
3
+ static getInstance(): CommonCommands;
4
+ loadCart(): Promise<void>;
5
+ }
@@ -0,0 +1,27 @@
1
+ import { type ComponentType } from '@/enums';
2
+ import type { IBaseComponentConfig } from './base-component.service';
3
+ interface ICreateComponentParams extends Omit<IBaseComponentConfig, 'tagName'> {
4
+ tagName?: string;
5
+ productId?: string;
6
+ cartId?: string;
7
+ checkoutId?: string;
8
+ isIndependentComponent?: boolean;
9
+ wrapInLceElement?: boolean;
10
+ [key: string]: any;
11
+ }
12
+ export declare class ComponentFactoryService {
13
+ private static _logger;
14
+ private static _clientConfig;
15
+ private static componentRegistry;
16
+ private static get logger();
17
+ private static get clientConfig();
18
+ private static getComponentRegistry;
19
+ static registerComponent(type: ComponentType, componentClass: any): void;
20
+ static createElement<T = any>(params: ICreateComponentParams & T): HTMLElement;
21
+ static componentError({ componentType, message }: {
22
+ componentType: ComponentType;
23
+ message: string;
24
+ }): HTMLElement;
25
+ static getDefaultTagName(type: ComponentType): string;
26
+ }
27
+ export {};
@@ -0,0 +1,28 @@
1
+ interface FingerprintData {
2
+ screen: string;
3
+ webgl: string;
4
+ canvas: string;
5
+ browser: string;
6
+ timezone: string;
7
+ }
8
+ export declare class FingerPrintService {
9
+ private readonly keyPrefix;
10
+ private isLocalStorageAvailable;
11
+ static getInstance(): FingerPrintService;
12
+ getId(partnerCode: string): Promise<string>;
13
+ getFingerprintData(): Promise<FingerprintData>;
14
+ isLocalStorageWebApiAvailable(): boolean;
15
+ private _createComposedId;
16
+ private _checkLocalStorageAvailability;
17
+ private _findIdByPrefix;
18
+ private _generateFingerprint;
19
+ private _getScreen;
20
+ private _getWebGL;
21
+ private _getCanvas;
22
+ private _getBrowser;
23
+ private _getTimezone;
24
+ private _hash;
25
+ private _quickHash;
26
+ private _simpleHash;
27
+ }
28
+ export {};
@@ -0,0 +1,93 @@
1
+ declare global {
2
+ interface Window {
3
+ dataLayer: any[];
4
+ gtag: (...args: any[]) => void;
5
+ }
6
+ }
7
+ interface GTMConfig {
8
+ partnerName: string;
9
+ partnerGtmId?: string;
10
+ partnerEnableGaTracking: boolean;
11
+ liquidCommerceEnableGaTracking: boolean;
12
+ liquidCommerceGtmId: string;
13
+ }
14
+ interface BaseItem {
15
+ item_id?: string;
16
+ item_name?: string;
17
+ affiliation?: string;
18
+ coupon?: string;
19
+ discount?: number;
20
+ index?: number;
21
+ item_brand?: string;
22
+ item_category?: string;
23
+ item_category2?: string;
24
+ item_category3?: string;
25
+ item_category4?: string;
26
+ item_category5?: string;
27
+ item_list_id?: string;
28
+ item_list_name?: string;
29
+ item_variant?: string;
30
+ location_id?: string;
31
+ price?: number;
32
+ quantity?: number;
33
+ item_type?: string;
34
+ item_subtype?: string;
35
+ upc?: string;
36
+ grouping_id?: string;
37
+ product_id?: string;
38
+ }
39
+ interface PurchaseData {
40
+ transaction_id: string;
41
+ items: BaseItem[];
42
+ value: number;
43
+ tax?: number;
44
+ shipping?: number;
45
+ coupon?: string;
46
+ }
47
+ export declare class GoogleTagManagerService {
48
+ private partnerName?;
49
+ private partnerGtmId?;
50
+ private liquidCommerceGtmId?;
51
+ private partnerEnableGaTracking;
52
+ private liquidCommerceEnableGaTracking;
53
+ private isInitialized;
54
+ private isInitializing;
55
+ private initializationPromise?;
56
+ private readonly currency;
57
+ private readonly logger;
58
+ private eventQueue;
59
+ private readonly clientConfigService;
60
+ constructor();
61
+ static getInstance(): GoogleTagManagerService;
62
+ private waitForDOMReady;
63
+ private isGTMAlreadyLoaded;
64
+ private isContainerLoaded;
65
+ private initializeGtag;
66
+ private loadGTMScript;
67
+ private processEventQueue;
68
+ private getSendToTargets;
69
+ initialize(config: GTMConfig): Promise<void>;
70
+ private doInitialize;
71
+ private executeEvent;
72
+ private calculateValue;
73
+ viewItem(item: BaseItem): void;
74
+ viewItemList(items: BaseItem[], listId?: string, listName?: string): void;
75
+ selectItem(item: BaseItem, listId?: string, listName?: string): void;
76
+ addToCart(item: BaseItem): void;
77
+ viewCart(items: BaseItem[]): void;
78
+ removeFromCart(item: BaseItem): void;
79
+ beginCheckout(items: BaseItem[], coupon?: string): void;
80
+ addShippingInfo(items: BaseItem[], coupon?: string): void;
81
+ addShippingInfoWithCustomerData(value: number, coupon?: string, customerData?: {
82
+ phone?: string;
83
+ email?: string;
84
+ birth_date?: string;
85
+ customer_id?: string;
86
+ }): void;
87
+ addPaymentInfo(items: BaseItem[], paymentType?: string, coupon?: string): void;
88
+ addPaymentInfoWithoutItems(value: number, paymentType?: string, coupon?: string): void;
89
+ purchase(purchaseData: PurchaseData): void;
90
+ increaseQuantity(item: BaseItem): void;
91
+ decreaseQuantity(item: BaseItem): void;
92
+ }
93
+ export {};
@@ -0,0 +1,8 @@
1
+ import { LoggerService } from './logger.service';
2
+ export declare class LoggerFactory {
3
+ private static instances;
4
+ private static enableLoggingGlobally;
5
+ private static getInstances;
6
+ static get(context: string): LoggerService;
7
+ static setEnableLogging(enable: boolean): void;
8
+ }
@@ -0,0 +1,17 @@
1
+ export declare class LoggerService {
2
+ private readonly prefix;
3
+ private readonly colors;
4
+ private readonly context;
5
+ private enableLogging;
6
+ private constructor();
7
+ static getInstance(context: string): LoggerService;
8
+ setEnableLogging(enable: boolean): void;
9
+ private getPrefix;
10
+ debug(...args: any[]): void;
11
+ log(...args: any[]): void;
12
+ info(...args: any[]): void;
13
+ warn(...args: any[]): void;
14
+ error(...args: any[]): void;
15
+ group(label: string, collapsed?: boolean): void;
16
+ groupEnd(): void;
17
+ }
@@ -0,0 +1,2 @@
1
+ export * from './interfaces';
2
+ export * from './pubsub.service';
@@ -0,0 +1,16 @@
1
+ export interface IAddressActionEventData {
2
+ googlePlacesId: string;
3
+ formattedAddress: string;
4
+ address: {
5
+ one: string;
6
+ two: string;
7
+ city: string;
8
+ state: string;
9
+ zip: string;
10
+ country: string;
11
+ };
12
+ coordinates: {
13
+ lat: number;
14
+ long: number;
15
+ };
16
+ }
@@ -0,0 +1,107 @@
1
+ import type { ICartItemAttributes } from '@/interfaces/cloud';
2
+ export interface ICartItemEventData {
3
+ id: string;
4
+ variantId: string;
5
+ liquidId: string;
6
+ retailerId: string;
7
+ partNumber: string;
8
+ fulfillmentId: string;
9
+ upc: string;
10
+ sku: string;
11
+ salsifyGrouping: string;
12
+ catPath: string;
13
+ volume: string;
14
+ uom: string;
15
+ pack: boolean;
16
+ packDesc: string;
17
+ container: string;
18
+ containerType: string;
19
+ name: string;
20
+ brand: string;
21
+ size: string;
22
+ price: number;
23
+ quantity: number;
24
+ maxQuantity: number;
25
+ unitPrice: number;
26
+ mainImage: string;
27
+ attributes: ICartItemAttributes;
28
+ }
29
+ export interface IBaseCartEventData {
30
+ id: string | null;
31
+ promoCode: string;
32
+ items: Record<string, ICartItemEventData>;
33
+ location: {
34
+ placesId: string;
35
+ address: {
36
+ one: string;
37
+ two: string;
38
+ city: string;
39
+ state: string;
40
+ zip: string;
41
+ country: string;
42
+ };
43
+ coordinates: {
44
+ latitude: number;
45
+ longitude: number;
46
+ };
47
+ };
48
+ amounts: {
49
+ deliveryFee: number;
50
+ discounts: number;
51
+ engravingFee: number;
52
+ giftCardTotal: number;
53
+ platformFee: number;
54
+ shippingFee: number;
55
+ subtotal: number;
56
+ total: number;
57
+ };
58
+ updatedAt: string;
59
+ createdAt: string;
60
+ }
61
+ export interface ICartLoadedEventData extends IBaseCartEventData {
62
+ }
63
+ export interface ICartFailedEventData {
64
+ message: string;
65
+ }
66
+ export interface ICartUpdatedEventData {
67
+ previous: IBaseCartEventData;
68
+ current: IBaseCartEventData;
69
+ }
70
+ export interface ICartItemAddedEventData {
71
+ id: string;
72
+ upc: string;
73
+ fulfillmentId: string;
74
+ partNumber: string;
75
+ quantity: number;
76
+ engravingLines?: string[];
77
+ }
78
+ export interface ICartItemRemovedEventData {
79
+ id: string;
80
+ }
81
+ export interface ICartItemQuantityChangedEventData {
82
+ id: string;
83
+ quantity: number;
84
+ previousQuantity: number;
85
+ }
86
+ export interface ICartItemEngravingUpdatedEventData {
87
+ id: string;
88
+ engravingLines: string[];
89
+ previousEngravingLines: string[];
90
+ }
91
+ export interface ICartPromoCodeEventData {
92
+ discountAmount?: number;
93
+ newTotal?: number;
94
+ applied: boolean;
95
+ }
96
+ export interface ICartPromoCodeFailedEventData {
97
+ error: string;
98
+ attempted: boolean;
99
+ }
100
+ export interface ICartProductAddEventData {
101
+ itemsAdded: number;
102
+ identifiers: string[];
103
+ }
104
+ export interface ICartProductAddFailedEventData {
105
+ identifiers: string[];
106
+ error: string;
107
+ }