@liquidcommerce/elements-sdk 2.2.0-beta.4 → 2.2.0-beta.40

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 (79) hide show
  1. package/README.md +1715 -569
  2. package/dist/index.esm.js +11813 -9048
  3. package/dist/types/core/auth.service.d.ts +10 -4
  4. package/dist/types/core/base-component.service.d.ts +3 -0
  5. package/dist/types/core/circuit-breaker.service.d.ts +54 -0
  6. package/dist/types/core/client/client-action.service.d.ts +16 -13
  7. package/dist/types/core/client/client-config.service.d.ts +5 -3
  8. package/dist/types/core/command/common-command.service.d.ts +2 -1
  9. package/dist/types/core/debug-panel/debug-panel.service.d.ts +43 -0
  10. package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -0
  11. package/dist/types/core/fingerprint.service.d.ts +4 -9
  12. package/dist/types/core/google-tag-manager.service.d.ts +127 -2
  13. package/dist/types/core/logger/logger-factory.d.ts +3 -0
  14. package/dist/types/core/logger/logger.service.d.ts +8 -5
  15. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -0
  16. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +46 -6
  17. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -3
  18. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +43 -6
  19. package/dist/types/core/pubsub/pubsub.service.d.ts +2 -1
  20. package/dist/types/core/singleton-manager.service.d.ts +3 -3
  21. package/dist/types/core/store/interfaces/cart.interface.d.ts +1 -1
  22. package/dist/types/core/store/interfaces/checkout.interface.d.ts +0 -1
  23. package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
  24. package/dist/types/core/store/interfaces/product.interface.d.ts +18 -7
  25. package/dist/types/core/store/store.service.d.ts +2 -1
  26. package/dist/types/core/telemetry/telemetry.interface.d.ts +80 -0
  27. package/dist/types/core/telemetry/telemetry.service.d.ts +27 -0
  28. package/dist/types/elements-base-client.d.ts +49 -0
  29. package/dist/types/elements-builder-client.d.ts +2 -0
  30. package/dist/types/elements-client-helper.d.ts +3 -0
  31. package/dist/types/enums/core.enum.d.ts +0 -1
  32. package/dist/types/enums/debug.enum.d.ts +6 -0
  33. package/dist/types/enums/index.d.ts +1 -0
  34. package/dist/types/index.d.ts +1 -0
  35. package/dist/types/index.umd.d.ts +2 -2
  36. package/dist/types/interfaces/cloud/product.interface.d.ts +2 -0
  37. package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
  38. package/dist/types/interfaces/configs/product.interface.d.ts +2 -0
  39. package/dist/types/interfaces/core.interface.d.ts +34 -19
  40. package/dist/types/modules/address/address.command.d.ts +1 -3
  41. package/dist/types/modules/api-client/api-client.service.d.ts +1 -0
  42. package/dist/types/modules/cart/cart.commands.d.ts +1 -1
  43. package/dist/types/modules/cart/cart.component.d.ts +1 -2
  44. package/dist/types/modules/cart/components/cart-footer.component.d.ts +1 -0
  45. package/dist/types/modules/cart/components/cart-item.component.d.ts +2 -6
  46. package/dist/types/modules/cart/components/index.d.ts +2 -0
  47. package/dist/types/modules/checkout/checkout.commands.d.ts +3 -2
  48. package/dist/types/modules/checkout/checkout.component.d.ts +1 -2
  49. package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +2 -0
  50. package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +1 -1
  51. package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +0 -2
  52. package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +2 -1
  53. package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +1 -0
  54. package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +0 -1
  55. package/dist/types/modules/checkout/constant.d.ts +0 -1
  56. package/dist/types/modules/product/components/index.d.ts +1 -0
  57. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  58. package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
  59. package/dist/types/modules/product/components/product-price.component.d.ts +1 -0
  60. package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
  61. package/dist/types/modules/product/product.commands.d.ts +1 -1
  62. package/dist/types/modules/theme-provider/services/font-manager.service.d.ts +1 -0
  63. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -11
  64. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -9
  65. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -0
  66. package/dist/types/static/icon/index.d.ts +0 -1
  67. package/dist/types/utils/format.d.ts +2 -1
  68. package/docs/ACTIONS.md +1300 -0
  69. package/docs/BROWSER_SUPPORT.md +279 -0
  70. package/docs/CONFIGURATION.md +740 -0
  71. package/docs/DOCUMENTATION_INDEX.md +311 -0
  72. package/docs/EVENTS.md +765 -0
  73. package/docs/PROXY.md +228 -0
  74. package/docs/THEMING.md +592 -0
  75. package/docs/TROUBLESHOOTING.md +793 -0
  76. package/package.json +18 -18
  77. package/umd/elements.js +1 -1
  78. package/dist/types/modules/product/constant.d.ts +0 -2
  79. package/dist/types/static/icon/completed.icon.d.ts +0 -2
@@ -9,6 +9,8 @@ export interface IElementsClientIsReadyEventData {
9
9
  export interface IBaseProductFulfillmentEventData {
10
10
  price: number;
11
11
  partNumber: string;
12
+ stock: number;
13
+ isEngravable: boolean;
12
14
  fulfillmentId: string;
13
15
  fulfillmentType: FulfillmentType;
14
16
  modalities: FulfillmentType[];
@@ -17,6 +19,23 @@ export interface IBaseProductFulfillmentEventData {
17
19
  retailerAddress: (IAddress & ICoords) | null;
18
20
  retailerTimezone: string;
19
21
  }
22
+ export interface IBaseProductSizeAttributesEventData {
23
+ engraving?: {
24
+ status: boolean;
25
+ maxLines: number;
26
+ maxCharsPerLine: number;
27
+ fee: number;
28
+ location: string;
29
+ };
30
+ presale?: {
31
+ canPurchaseOn: null | string;
32
+ estimatedShipBy: null | string;
33
+ isActive: boolean;
34
+ language: string;
35
+ presaleLimit: number;
36
+ price: number;
37
+ };
38
+ }
20
39
  export interface IBaseProductSizeEventData {
21
40
  id: string;
22
41
  upc: string;
@@ -29,17 +48,40 @@ export interface IBaseProductSizeEventData {
29
48
  image: string;
30
49
  uom: string;
31
50
  volume: string;
51
+ attributes: IBaseProductSizeAttributesEventData;
32
52
  shippingFulfillments: Record<string, IBaseProductFulfillmentEventData>;
33
53
  onDemandFulfillments: Record<string, IBaseProductFulfillmentEventData>;
34
54
  }
35
55
  export interface IBaseProductEventData {
36
56
  identifier: string;
57
+ selectedSizeId: string | null;
58
+ selectedFulfillmentId: string | null;
59
+ selectedFulfillmentType: FulfillmentType;
37
60
  id: string;
38
61
  name: string;
39
62
  brand: string;
40
- category: string;
41
63
  catPath: string;
64
+ category: string;
42
65
  classification: string;
66
+ type: string;
67
+ salsifyGrouping: string;
68
+ subType: string;
69
+ mainImage: string | null;
70
+ images: string[];
71
+ region: string;
72
+ country: string;
73
+ material: string;
74
+ abv: string;
75
+ proof: string;
76
+ age: string;
77
+ color: string;
78
+ flavor: string;
79
+ variety: string;
80
+ appellation: string;
81
+ vintage: string;
82
+ description: string;
83
+ htmlDescription: string;
84
+ tastingNotes: string;
43
85
  priceInfo: {
44
86
  min: number;
45
87
  max: number;
@@ -84,8 +126,3 @@ export interface IProductFulfillmentChangedEventData {
84
126
  previousFulfillmentId: string;
85
127
  previousFulfillmentType: FulfillmentType;
86
128
  }
87
- export interface IProductEngravingUpdatedEventData {
88
- identifier: string;
89
- engravingLines: string[];
90
- previousEngravingLines: string[];
91
- }
@@ -1,6 +1,7 @@
1
1
  import type { IElementsActionsEventsMap, IElementsFormsEventsMap, SpecificActionEvent, SpecificFormEvent } from '@/core/pubsub/interfaces';
2
2
  export declare class PubSubService {
3
3
  private readonly logger;
4
+ private clientReadyEvent;
4
5
  constructor();
5
6
  private readonly eventPrefix;
6
7
  static getInstance(): PubSubService;
@@ -8,5 +9,5 @@ export declare class PubSubService {
8
9
  publishForm<K extends SpecificFormEvent>(eventType: K, data: IElementsFormsEventsMap[K]): void;
9
10
  private publishSpecific;
10
11
  private dispatchNativeEvents;
11
- private generateEventId;
12
+ private setupClientReadyBuffering;
12
13
  }
@@ -1,12 +1,12 @@
1
1
  import type { IClientConfigs } from '@/core/client/client-config.service';
2
- import type { LiquidCommerceElementsClientConstructor } from '@/interfaces/core.interface';
2
+ import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/core.interface';
3
3
  export declare class SingletonManager {
4
4
  private static instances;
5
5
  private static clientConstructor;
6
6
  private static getInstances;
7
7
  private constructor();
8
- static setClientConstructor(lceConstructor: LiquidCommerceElementsClientConstructor): void;
9
- static getClientConstructor(): LiquidCommerceElementsClientConstructor | null;
8
+ static setClientConstructor(lceConstructor: LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor): void;
9
+ static getClientConstructor(): LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor | null;
10
10
  static getClassInstance<T>(className: string, instanceCreator: () => T): T;
11
11
  static getClient<T>(clientConfigs: IClientConfigs): Promise<T>;
12
12
  }
@@ -36,6 +36,7 @@ export interface ICartTotalsStore {
36
36
  total: number;
37
37
  shippingFee: number;
38
38
  platformFee: number;
39
+ giftCardTotal: number;
39
40
  engravingFee: number;
40
41
  deliveryFee: number;
41
42
  discounts: number;
@@ -75,7 +76,6 @@ export interface IRetailerStore {
75
76
  export interface ICartPromoCodeStore {
76
77
  code: string;
77
78
  discountAmount: number;
78
- error: string | null;
79
79
  }
80
80
  export interface ICartStore {
81
81
  id: string | null;
@@ -25,7 +25,6 @@ export interface ICheckoutGiftRecipientStore {
25
25
  phone: string;
26
26
  birthDate: string;
27
27
  addressTwo: string | null;
28
- company: string | null;
29
28
  message: string | null;
30
29
  }
31
30
  export interface ICheckoutCustomerStore {
@@ -1,4 +1,4 @@
1
- import type { IAddressStore, ICheckoutBillingStore, ICheckoutCustomerStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentStore, ICheckoutStore, IProductSizeStore, IProductStore } from '@/core/store';
1
+ import type { IAddressStore, ICartPromoCodeStore, ICheckoutBillingStore, ICheckoutCustomerStore, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentStore, ICheckoutPromoCodeStore, ICheckoutReadyForSubmitStore, ICheckoutStore, ICheckoutStripeFormStatusStore, IProductSizeStore, IProductStore } from '@/core/store';
2
2
  import type { ComponentType } from '@/enums';
3
3
  import type { ICartItemStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from './cart.interface';
4
4
  export interface IDrawerContentConfig {
@@ -23,7 +23,7 @@ export interface IPersistedStore {
23
23
  p: string;
24
24
  c: string;
25
25
  }
26
- export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof ICartStore['promoCode']}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customer.${keyof ICheckoutCustomerStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.payment.${keyof ICheckoutPaymentStore}` | `checkout.billing.${keyof ICheckoutBillingStore}` | `checkout.giftRecipient.${keyof ICheckoutStore['giftRecipient']}` | `checkout.giftCards.${string}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.readyForSubmit.${keyof ICheckoutStore['readyForSubmit']}` | `checkout.onDemandFulfillmentTipInfo.${string}` | `checkout.readyForSubmit.${string}` | `checkout.stripeFormStatus.${keyof ICheckoutStore['stripeFormStatus']}`;
26
+ export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCodeStore}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customer.${keyof ICheckoutCustomerStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.payment.${keyof ICheckoutPaymentStore}` | `checkout.billing.${keyof ICheckoutBillingStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.readyForSubmit.${keyof ICheckoutReadyForSubmitStore}` | `checkout.onDemandFulfillmentTipInfo.${string}` | `checkout.readyForSubmit.${string}` | `checkout.stripeFormStatus.${keyof ICheckoutStripeFormStatusStore}`;
27
27
  interface MiddlewareContext {
28
28
  action: string;
29
29
  payload: any;
@@ -49,20 +49,33 @@ export interface IProductStore {
49
49
  id: string;
50
50
  name: string;
51
51
  brand: string;
52
- category: string;
53
52
  catPath: string;
53
+ category: string;
54
54
  classification: string;
55
55
  type: string;
56
- subType: string;
57
56
  salsifyGrouping: string;
57
+ subType: string;
58
+ mainImage: string | null;
59
+ images: string[];
60
+ region: string;
61
+ country: string;
62
+ material: string;
63
+ abv: string;
64
+ proof: string;
65
+ age: string;
66
+ color: string;
67
+ flavor: string;
68
+ variety: string;
69
+ appellation: string;
70
+ vintage: string;
71
+ description: string;
72
+ htmlDescription: string;
73
+ tastingNotes: string;
58
74
  priceInfo?: {
59
75
  min: number;
60
76
  max: number;
61
77
  avg: number;
62
78
  };
63
- description: string;
64
- htmlDescription: string;
65
- images: string[];
66
79
  quantity: number;
67
80
  sizes: Record<string, IProductSizeStore>;
68
81
  productHasAvailability: boolean;
@@ -74,8 +87,6 @@ export interface IProductStore {
74
87
  loading: boolean;
75
88
  updating: boolean;
76
89
  error: string | null;
77
- engravingLines: string[];
78
90
  drawer: IProductDrawerStore;
79
91
  rerender: boolean;
80
- mainImage: string | null;
81
92
  }
@@ -36,9 +36,10 @@ export declare class StoreService {
36
36
  private notifyListeners;
37
37
  private debouncedSave;
38
38
  forceSave(): void;
39
+ persist(): Promise<void>;
40
+ clearLocalStorage(): void;
39
41
  private saveStore;
40
42
  private loadPersistedState;
41
43
  private loadFromDBPersistence;
42
- private addBeforeUnloadHandler;
43
44
  private getAddressDataFromId;
44
45
  }
@@ -0,0 +1,80 @@
1
+ import type { DeviceType } from '@/core/client/client-config.service';
2
+ import type { ComponentType, ElementsEnv } from '@/enums';
3
+ export type TelemetryLevel = 'debug' | 'log' | 'info' | 'warn' | 'error' | 'fatal';
4
+ export interface ITelemetryConfig {
5
+ enabled: boolean;
6
+ endpoint: string;
7
+ batchSize: number;
8
+ batchInterval: number;
9
+ includeDebugLogs: boolean;
10
+ includeWarnings: boolean;
11
+ includeErrors: boolean;
12
+ maxQueueSize: number;
13
+ }
14
+ export interface ITelemetryEventOptions {
15
+ context?: string;
16
+ error?: Error;
17
+ component?: ITelemetryComponentContext;
18
+ data?: Record<string, any>;
19
+ }
20
+ export interface ITelemetryEvent {
21
+ eventId: string;
22
+ timestamp: number;
23
+ level: TelemetryLevel;
24
+ message: string;
25
+ context?: string;
26
+ error?: ITelemetryError;
27
+ component?: ITelemetryComponentContext;
28
+ data?: Record<string, any>;
29
+ metadata: {
30
+ sdk: ITelemetrySDKContext;
31
+ user: ITelemetryUserContext;
32
+ browser: ITelemetryBrowserContext;
33
+ };
34
+ }
35
+ export interface ITelemetryError {
36
+ name: string;
37
+ message: string;
38
+ stack?: string;
39
+ code?: string | number;
40
+ statusCode?: number;
41
+ }
42
+ export interface ITelemetrySDKContext {
43
+ version: string;
44
+ env: ElementsEnv;
45
+ isBuilder: boolean;
46
+ partnerCode?: string;
47
+ }
48
+ export interface ITelemetryComponentContext {
49
+ type: ComponentType;
50
+ tagName: string;
51
+ renderCount?: number;
52
+ renderTrigger?: string;
53
+ renderDuration?: number;
54
+ useShadowDom?: boolean;
55
+ }
56
+ export interface ITelemetryUserContext {
57
+ deviceId: string;
58
+ sessionId?: string;
59
+ isLocalStorageAvailable: boolean;
60
+ }
61
+ export interface ITelemetryBrowserContext {
62
+ userAgent: string;
63
+ deviceType: DeviceType;
64
+ url: string;
65
+ referrer?: string;
66
+ timezone?: string;
67
+ }
68
+ export interface ITelemetryBatchPayload {
69
+ batchId: string;
70
+ timestamp: number;
71
+ events: ITelemetryEvent[];
72
+ }
73
+ export interface ITelemetryStats {
74
+ totalEvents: number;
75
+ eventsByLevel: Record<TelemetryLevel, number>;
76
+ batchesSent: number;
77
+ failedBatches: number;
78
+ queuedEvents: number;
79
+ droppedEvents: number;
80
+ }
@@ -0,0 +1,27 @@
1
+ import type { ITelemetryEventOptions, TelemetryLevel } from './telemetry.interface';
2
+ export declare class TelemetryService {
3
+ private config;
4
+ private eventQueue;
5
+ private batchTimer;
6
+ private readonly clientConfig;
7
+ private stats;
8
+ private isShuttingDown;
9
+ constructor();
10
+ static getInstance(): TelemetryService;
11
+ isEnabled(): boolean;
12
+ captureEvent(level: TelemetryLevel, message: string, options?: ITelemetryEventOptions): void;
13
+ private buildErrorContext;
14
+ private buildSDKContext;
15
+ private buildUserContext;
16
+ private buildBrowserContext;
17
+ private shouldCapture;
18
+ private addToQueue;
19
+ private startBatchTimer;
20
+ private flushQueue;
21
+ private createBatch;
22
+ private sendBatch;
23
+ private sendBatchViaXHR;
24
+ private truncateStackTrace;
25
+ private handleInternalError;
26
+ private shutdown;
27
+ }
@@ -0,0 +1,49 @@
1
+ import { AuthService } from '@/core/auth.service';
2
+ import { ClientActionService } from '@/core/client/client-action.service';
3
+ import { ClientConfigService, type IClientConfigs } from '@/core/client/client-config.service';
4
+ import { CommandService } from '@/core/command/command.service';
5
+ import { DebugPanelService } from '@/core/debug-panel/debug-panel.service';
6
+ import { FingerPrintService } from '@/core/fingerprint.service';
7
+ import { GoogleTagManagerService } from '@/core/google-tag-manager.service';
8
+ import { LoggerFactory } from '@/core/logger/logger-factory';
9
+ import { StoreService } from '@/core/store';
10
+ import { TelemetryService } from '@/core/telemetry/telemetry.service';
11
+ import { type ComponentType } from '@/enums';
12
+ import type { IInjectedComponent, ILiquidCommerceElementsActions, IProcessInjectElementParams } from '@/interfaces/core.interface';
13
+ import { ApiClientService } from '@/modules/api-client';
14
+ import { ThemeProviderService } from '@/modules/theme-provider';
15
+ export declare abstract class ElementsBaseClient {
16
+ protected readonly authService: AuthService;
17
+ protected readonly clientConfig: ClientConfigService;
18
+ protected readonly store: StoreService;
19
+ protected readonly commands: CommandService;
20
+ protected readonly apiClient: ApiClientService;
21
+ protected readonly themeProvider: ThemeProviderService;
22
+ protected readonly fingerPrintService: FingerPrintService;
23
+ protected readonly googleTagManager: GoogleTagManagerService;
24
+ protected readonly clientAction: ClientActionService;
25
+ protected readonly telemetry: TelemetryService;
26
+ protected readonly debugPanel: DebugPanelService;
27
+ protected readonly logger: ReturnType<typeof LoggerFactory.get>;
28
+ protected clientPrepared: boolean;
29
+ protected componentFactoryInitialized: boolean;
30
+ protected cartDrawerCreated: boolean;
31
+ protected gtmInitialized: boolean;
32
+ protected injectedComponents: Map<string, IInjectedComponent>;
33
+ constructor(clientConfigs: IClientConfigs);
34
+ prepare(): Promise<void>;
35
+ private prepareEssentialServices;
36
+ private deferHeavyInitialization;
37
+ private initializeHeavyServices;
38
+ get actions(): ILiquidCommerceElementsActions;
39
+ protected processInjectElement(params: IProcessInjectElementParams): Promise<IInjectedComponent | null>;
40
+ protected ensureCartDrawerExists(): void;
41
+ protected ensureAllComponentsRegistered(): void;
42
+ protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
43
+ protected rerenderInjectedComponentsByType(type: ComponentType): void;
44
+ protected isElementsEnabled(): boolean;
45
+ protected injectDisabledElementsError(containerId: string, componentName: ComponentType): void;
46
+ private registerEssentialComponents;
47
+ protected registerComponents(): void;
48
+ protected registerAllComponents(): void;
49
+ }
@@ -0,0 +1,2 @@
1
+ import type { ILiquidCommerceElementsBuilderClient, ILiquidCommerceElementsBuilderConfig } from '@/interfaces/core.interface';
2
+ export declare function ElementsBuilder(apiKey: string, config: ILiquidCommerceElementsBuilderConfig): Promise<ILiquidCommerceElementsBuilderClient | null>;
@@ -1 +1,4 @@
1
+ import { type ComponentType } from '@/enums';
1
2
  export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>): T;
3
+ export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
4
+ export declare function getComponentTypesForLayoutFields(parentPath: string, layoutFields: Record<string, any>): ComponentType[];
@@ -14,7 +14,6 @@ export declare const ELEMENTS_ACTIONS_EVENT: {
14
14
  readonly PRODUCT_SIZE_CHANGED: "product_size_changed";
15
15
  readonly PRODUCT_FULFILLMENT_TYPE_CHANGED: "product_fulfillment_type_changed";
16
16
  readonly PRODUCT_FULFILLMENT_CHANGED: "product_fulfillment_changed";
17
- readonly PRODUCT_ENGRAVING_UPDATED: "product_engraving_updated";
18
17
  readonly CART_LOADED: "cart_loaded";
19
18
  readonly CART_CLOSED: "cart_closed";
20
19
  readonly CART_OPENED: "cart_opened";
@@ -0,0 +1,6 @@
1
+ export declare const DEBUG_MODE: {
2
+ readonly NONE: "none";
3
+ readonly CONSOLE: "console";
4
+ readonly PANEL: "panel";
5
+ };
6
+ export type DebugMode = (typeof DEBUG_MODE)[keyof typeof DEBUG_MODE];
@@ -1,2 +1,3 @@
1
1
  export * from './cloud.enum';
2
2
  export * from './core.enum';
3
+ export * from './debug.enum';
@@ -1,3 +1,4 @@
1
+ export * from './elements-builder-client';
1
2
  export * from './elements-client';
2
3
  export * from './enums';
3
4
  export * from './interfaces/configs';
@@ -1,2 +1,2 @@
1
- import { Elements } from './index';
2
- export { Elements };
1
+ import { Elements, ElementsBuilder } from './index';
2
+ export { Elements, ElementsBuilder };
@@ -153,4 +153,6 @@ export interface IProductPresale {
153
153
  estimatedShipBy: null | string;
154
154
  isActive: boolean;
155
155
  language: string;
156
+ presaleLimit: number;
157
+ price: number;
156
158
  }
@@ -18,6 +18,7 @@ export interface ICheckoutLayout {
18
18
  drawerHeaderText: string;
19
19
  placeOrderButtonText: string;
20
20
  placeOrderButtonShowRequiredFields: boolean;
21
+ checkoutCompleted: ICheckoutCompleted;
21
22
  }
22
23
  export interface ICheckoutCompleted {
23
24
  customLogo: string;
@@ -25,7 +26,6 @@ export interface ICheckoutCompleted {
25
26
  }
26
27
  export interface ICheckoutTheme {
27
28
  backgroundColor: string;
28
- checkoutCompleted: ICheckoutCompleted;
29
29
  }
30
30
  export interface ICheckoutComponent {
31
31
  theme: ICheckoutTheme;
@@ -14,6 +14,8 @@ export interface IProductLayout {
14
14
  addToCartButtonShowTotalPrice: boolean;
15
15
  buyNowButtonText: string;
16
16
  preSaleButtonText: string;
17
+ prioritizeEngraving: boolean;
18
+ noAvailabilityText: string;
17
19
  }
18
20
  export interface IProductTheme {
19
21
  backgroundColor: string;
@@ -1,6 +1,6 @@
1
1
  import type { IAddressActions, ICartActions, ICheckoutActions, IProductActions } from '@/core/client/client-action.service';
2
2
  import type { IClientConfigs } from '@/core/client/client-config.service';
3
- import type { ComponentType, ElementsEnv } from '@/enums';
3
+ import type { ComponentType, DebugMode, ElementsEnv } from '@/enums';
4
4
  import type { IAddressOptions } from '@/modules/address/address.interface';
5
5
  import type { IPromoTicker, UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent } from './configs';
6
6
  export type DeepPartial<T> = {
@@ -17,13 +17,18 @@ export interface IClientCustomThemeConfig {
17
17
  cart?: UpdateCartComponent;
18
18
  checkout?: UpdateCheckoutComponent;
19
19
  }
20
+ export interface ILiquidCommerceElementsBuilderConfig {
21
+ env?: ElementsEnv;
22
+ promoTicker?: IPromoTicker[];
23
+ customTheme?: IClientCustomThemeConfig;
24
+ debugMode?: DebugMode;
25
+ }
20
26
  export interface ILiquidCommerceElementsConfig {
21
27
  env?: ElementsEnv;
22
28
  promoTicker?: IPromoTicker[];
23
29
  customTheme?: IClientCustomThemeConfig;
24
30
  proxy?: IElementsProxyConfig;
25
- isBuilder?: boolean;
26
- enableDebugging?: boolean;
31
+ debugMode?: DebugMode;
27
32
  }
28
33
  export interface IInjectProductElement {
29
34
  containerId: string;
@@ -34,17 +39,10 @@ export interface IBuilderInjectElementParams {
34
39
  containerId: string;
35
40
  [key: string]: any;
36
41
  }
37
- export interface ILiquidCommerceElementsBuilderMethod {
38
- updateComponentGlobalConfigs(configs: UpdateComponentGlobalConfigs): Promise<void>;
39
- updateProductComponent(configs: UpdateProductComponent): Promise<void>;
40
- updateAddressComponent(configs: UpdateAddressComponent): void;
41
- updateCartComponent(configs: UpdateCartComponent): void;
42
- updateCheckoutComponent(configs: UpdateCheckoutComponent): void;
43
- injectElement(params: IBuilderInjectElementParams): Promise<void>;
44
- injectProductElement(params: IInjectProductElement[]): Promise<void>;
45
- injectAddressElement(containerId: string, options?: IAddressOptions): Promise<void>;
46
- injectCartElement(containerId: string): Promise<void>;
47
- injectCheckoutElement(containerId: string): Promise<void>;
42
+ export interface IInjectedComponent {
43
+ getType(): ComponentType;
44
+ getElement(): HTMLElement;
45
+ rerender(): void;
48
46
  }
49
47
  export interface IProcessInjectElementParams {
50
48
  type: ComponentType;
@@ -64,13 +62,30 @@ export interface ILiquidCommerceElementsActions {
64
62
  cart: ICartActions;
65
63
  checkout: ICheckoutActions;
66
64
  }
65
+ export interface ILiquidCommerceElementsBuilderClient {
66
+ updateComponentGlobalConfigs(configs: UpdateComponentGlobalConfigs): Promise<void>;
67
+ updateProductComponent(configs: UpdateProductComponent): Promise<void>;
68
+ updateAddressComponent(configs: UpdateAddressComponent): void;
69
+ updateCartComponent(configs: UpdateCartComponent): void;
70
+ updateCheckoutComponent(configs: UpdateCheckoutComponent): void;
71
+ injectElement(params: IBuilderInjectElementParams): Promise<IInjectedComponent | null>;
72
+ injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
73
+ injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
74
+ injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
75
+ injectCheckoutElement(containerId: string, options?: {
76
+ simulatePresale?: boolean;
77
+ presaleExpiresInMinutes?: number;
78
+ }): Promise<IInjectedComponent | null>;
79
+ actions: ILiquidCommerceElementsActions;
80
+ }
67
81
  export interface ILiquidCommerceElementsClient {
68
- builder: ILiquidCommerceElementsBuilderMethod;
69
- injectProductElement(params: IInjectProductElement[]): Promise<void>;
70
- injectAddressElement(containerId: string, options?: IAddressOptions): Promise<void>;
71
- injectCartElement(containerId: string): Promise<void>;
72
- injectCheckoutElement(containerId: string): Promise<void>;
82
+ injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
83
+ injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
84
+ injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
85
+ injectCheckoutElement(containerId: string): Promise<IInjectedComponent | null>;
73
86
  ui: ILiquidCommerceElementsUIMethod;
74
87
  actions: ILiquidCommerceElementsActions;
88
+ getInjectedComponents(): Map<string, IInjectedComponent>;
75
89
  }
76
90
  export type LiquidCommerceElementsClientConstructor = new (clientConfigs: IClientConfigs) => ILiquidCommerceElementsClient;
91
+ export type LiquidCommerceElementsBuilderClientConstructor = new (clientConfigs: IClientConfigs) => ILiquidCommerceElementsBuilderClient;
@@ -10,8 +10,6 @@ export declare class AddressCommands extends BaseCommand {
10
10
  getAddressDetails(addressId: string): Promise<IAddressDetailsResult>;
11
11
  setSelectedAddress(addressData: IAddressData): Promise<void>;
12
12
  setAddressManually(address: Omit<IAddress, 'id'>, coordinates: ICoords): Promise<void>;
13
- clearSelectedAddress(): void;
14
- private shouldResetCartForAddressChange;
15
- private persistSessionData;
13
+ clearSelectedAddress(): Promise<void>;
16
14
  getDetails(): IAddressData | null;
17
15
  }
@@ -12,6 +12,7 @@ export declare class ApiClientService {
12
12
  getAllConfigs(): Promise<IAllConfigs>;
13
13
  setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
14
14
  getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
15
+ deletePersistedStore(userDeviceId: string): Promise<void>;
15
16
  getProductsData(identifier: string[], location?: ILoc): Promise<IProductData | null>;
16
17
  getCartData(id: string | null): Promise<ICart>;
17
18
  updateCart(params: ICartUpdateParams & {
@@ -23,13 +23,13 @@ export declare class CartCommands extends BaseCommand {
23
23
  handleGoToCheckout(): Promise<void>;
24
24
  applyPromoCode(promoCode: string): Promise<void>;
25
25
  removePromoCode(): Promise<void>;
26
- clearPromoCodeError(): Promise<void>;
27
26
  rerenderCart(): void;
28
27
  resetCart(): Promise<void>;
29
28
  getDetails(): IBaseCartEventData;
30
29
  private buildItemUpdate;
31
30
  private syncItemsFromApiResponse;
32
31
  private syncCartMetaFromApiResponse;
32
+ private syncRetailersFromApiResponse;
33
33
  private updateFulfillment;
34
34
  private addNewFulfillmentAndRetailer;
35
35
  private cleanupAfterItemRemoval;
@@ -1,4 +1,4 @@
1
- import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
1
+ import { BaseComponent } from '@/core/base-component.service';
2
2
  import type { ICartComponent } from '@/interfaces/configs';
3
3
  export interface ICartComponentParams {
4
4
  isIndependentComponent: boolean;
@@ -6,6 +6,5 @@ export interface ICartComponentParams {
6
6
  export declare class CartComponent extends BaseComponent<ICartComponentParams, ICartComponent> {
7
7
  get hostClasses(): string[];
8
8
  constructor();
9
- onStoreWatch(changes: IOnStoreChanged[]): void;
10
9
  protected template(): HTMLElement[];
11
10
  }
@@ -16,5 +16,6 @@ export declare class CartFooterComponent extends BaseComponent<ICartFooterCompon
16
16
  private shouldDisableCheckout;
17
17
  private updateCheckoutButtonState;
18
18
  private updateSubtotalItemsCount;
19
+ private handleCheckout;
19
20
  protected template(): HTMLElement[];
20
21
  }
@@ -1,4 +1,4 @@
1
- import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
1
+ import { BaseComponent } from '@/core/base-component.service';
2
2
  export interface ICartItemComponentParams {
3
3
  itemId: string;
4
4
  }
@@ -6,10 +6,6 @@ export declare class CartItemComponent extends BaseComponent<ICartItemComponentP
6
6
  get hostClasses(): string[];
7
7
  get hostAttributes(): Record<string, string>;
8
8
  constructor();
9
- private getItemId;
10
- onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
11
- private handleEngravingElement;
12
- private updateShippingTime;
9
+ private handleOpenEngravingForm;
13
10
  protected template(): HTMLElement[];
14
- afterRender(): void;
15
11
  }
@@ -1,5 +1,7 @@
1
1
  export * from './cart-body.component';
2
2
  export * from './cart-footer.component';
3
+ export * from './cart-fulfillment.component';
4
+ export * from './cart-fulfillment.component';
3
5
  export * from './cart-header.component';
4
6
  export * from './cart-item.component';
5
7
  export * from './cart-item-quantity-price.component';