@liquidcommerce/elements-sdk 2.7.9 → 2.7.11

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.
@@ -1,4 +1,5 @@
1
1
  import { type ComponentType } from '@/enums';
2
+ export declare function applyConfigDefaults<T extends Record<string, any>>(data: T): T;
2
3
  export declare function normalizeProductListLists<T extends Record<string, any>>(data: T): T;
3
4
  export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>, currentPath?: string): T;
4
5
  export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
@@ -86,6 +86,7 @@ export interface ICart {
86
86
  }
87
87
  export interface ICartItemEngraving {
88
88
  isEngravable: boolean;
89
+ isRequired: boolean;
89
90
  hasEngraving: boolean;
90
91
  fee: number;
91
92
  maxCharsPerLine: number;
@@ -146,6 +146,7 @@ export interface ICheckoutShippingAddress {
146
146
  }
147
147
  export interface ICheckoutItemEngraving {
148
148
  isEngravable: boolean;
149
+ isRequired: boolean;
149
150
  hasEngraving: boolean;
150
151
  fee: number;
151
152
  maxCharsPerLine: number;
@@ -98,6 +98,7 @@ export interface IProductSizeEngraving {
98
98
  maxCharsPerLine: number;
99
99
  fee: number;
100
100
  location: string;
101
+ isRequired: boolean;
101
102
  }
102
103
  export interface IProductSizeAttributes {
103
104
  presale: IProductPresale;
@@ -1,10 +1,12 @@
1
1
  import type { DeepPartial } from '@/interfaces/config.interface';
2
2
  export type FulfillmentDisplayType = 'carousel' | 'popup';
3
+ export type DescriptionPosition = 'above' | 'below';
3
4
  export interface IProductLayout {
4
5
  showImages: boolean;
5
6
  showOnlyMainImage: boolean;
6
7
  showTitle: boolean;
7
8
  showDescription: boolean;
9
+ descriptionPosition: DescriptionPosition;
8
10
  showQuantityCounter: boolean;
9
11
  showOffHours: boolean;
10
12
  quantityCounterStyle: 'outlined' | 'ghost';
@@ -21,6 +21,7 @@ export declare class ProductAddToCartSectionComponent extends BaseComponent<IAdd
21
21
  private calculateTotalPrice;
22
22
  private createQuantityContainer;
23
23
  private getSizeAttributes;
24
+ private openEngravingForm;
24
25
  private isPresaleActive;
25
26
  private createAddToCartButton;
26
27
  protected template(): HTMLElement[] | string;
@@ -1,6 +1,7 @@
1
1
  import { BaseComponent } from '@/core/base-component.service';
2
2
  export interface IProductDescriptionComponentParams {
3
3
  productId: string;
4
+ hideTitle?: boolean;
4
5
  }
5
6
  export declare class ProductDescriptionComponent extends BaseComponent<IProductDescriptionComponentParams, null> {
6
7
  get hostClasses(): string[];
@@ -8,5 +8,6 @@ export declare class ProductOptionsComponent extends BaseComponent<IProductOptio
8
8
  constructor();
9
9
  private getProductId;
10
10
  onStoreWatch(changes: IOnStoreChanged[]): void;
11
- protected template(): HTMLElement;
11
+ protected template(): HTMLElement | HTMLElement[];
12
+ private buildDescriptionElement;
12
13
  }
@@ -12,6 +12,7 @@ export declare class EngravingViewComponent extends BaseComponent<IEngravingView
12
12
  get hostClasses(): string[];
13
13
  private engravingQuantityFee;
14
14
  private engravingLines;
15
+ private isEngravingRequired;
15
16
  private handleEdit;
16
17
  private handleRemove;
17
18
  protected template(): HTMLElement | HTMLElement[] | string;
@@ -72,6 +72,25 @@ await window.LiquidCommerce.elements.actions.checkout.addProduct([
72
72
  ], true); // Open checkout after adding
73
73
  ```
74
74
 
75
+ ### actions.checkout.addAnonymousProduct()
76
+
77
+ ```typescript
78
+ addAnonymousProduct(
79
+ params: IAnonymousCheckoutAddProductParams
80
+ ): Promise<IAnonymousCheckoutAddProductResponse>
81
+ ```
82
+
83
+ Add a product to checkout without requiring a cart session. Used for direct-to-checkout flows.
84
+
85
+ ```javascript
86
+ const result = await window.LiquidCommerce.elements.actions.checkout
87
+ .addAnonymousProduct({
88
+ identifier: '00619947000020',
89
+ fulfillmentType: 'shipping',
90
+ quantity: 1
91
+ });
92
+ ```
93
+
75
94
  ## Promo & Gift Card Actions
76
95
 
77
96
  ### actions.checkout.applyPromoCode()
@@ -299,6 +318,27 @@ interface ICheckoutDetailsEventData {
299
318
  }
300
319
  ```
301
320
 
321
+ ### actions.checkout.getProductAvailabilityByState()
322
+
323
+ ```typescript
324
+ getProductAvailabilityByState(
325
+ identifiers: string[],
326
+ state?: string
327
+ ): Promise<IProductAvailabilityResponse>
328
+ ```
329
+
330
+ Check product availability across states from the checkout context.
331
+
332
+ ```javascript
333
+ const availability = await window.LiquidCommerce.elements.actions.checkout
334
+ .getProductAvailabilityByState(['00619947000020'], 'CA');
335
+ ```
336
+
337
+ | Parameter | Type | Required | Description |
338
+ |---------------|----------|----------|--------------------------------------|
339
+ | `identifiers` | string[] | Yes | Array of product UPCs, SKUs, or IDs |
340
+ | `state` | string | No | Two-letter state code (e.g., `'NY'`) |
341
+
302
342
  ## Use Cases
303
343
 
304
344
  ### Pre-fill for Logged-In Users
@@ -102,10 +102,53 @@ if (product1.price < product2.price) {
102
102
  }
103
103
  ```
104
104
 
105
+ ---
106
+
107
+ ## actions.product.getProductAvailabilityByState()
108
+
109
+ Check product availability across states.
110
+
111
+ ### Signature
112
+
113
+ ```typescript
114
+ getProductAvailabilityByState(
115
+ identifiers: string[],
116
+ state?: string
117
+ ): Promise<IProductAvailabilityResponse>
118
+ ```
119
+
120
+ ### Parameters
121
+
122
+ | Parameter | Type | Required | Description |
123
+ |---------------|----------|----------|------------------------------------------|
124
+ | `identifiers` | string[] | Yes | Array of product UPCs, SKUs, or IDs |
125
+ | `state` | string | No | Two-letter state code (e.g., `'NY'`) |
126
+
127
+ ### Example
128
+
129
+ ```javascript
130
+ // Check availability in a specific state
131
+ const availability = await window.LiquidCommerce.elements.actions.product
132
+ .getProductAvailabilityByState(['00619947000020', '08504405135'], 'CA');
133
+
134
+ // Check availability in the user's current state (uses address if set)
135
+ const availability = await window.LiquidCommerce.elements.actions.product
136
+ .getProductAvailabilityByState(['00619947000020']);
137
+ ```
138
+
139
+ ### Errors
140
+
141
+ **Throws `SDKError` if:**
142
+ - No identifiers provided or array is empty
143
+ - API request fails
144
+
145
+ ---
146
+
105
147
  ## Notes
106
148
 
107
149
  - Product must be injected and loaded before calling `getDetails()`
108
- - Data is synchronous - returns immediately
150
+ - `getDetails()` is synchronous - returns immediately
151
+ - `getProductAvailabilityByState()` is async - returns a Promise
109
152
  - Prices are always in cents (divide by 100 for dollars)
110
153
  - Selected values reflect current user selection in the component
111
154
 
@@ -112,6 +112,7 @@ interface IClientCustomThemeConfig {
112
112
  address?: UpdateAddressComponent;
113
113
  cart?: UpdateCartComponent;
114
114
  checkout?: UpdateCheckoutComponent;
115
+ productList?: UpdateProductListComponent;
115
116
  }
116
117
  ```
117
118
 
@@ -260,6 +261,9 @@ interface ILiquidCommerceElementsClient {
260
261
 
261
262
  // Component management
262
263
  getInjectedComponents(): Map<string, IInjectedComponent>;
264
+
265
+ // Cleanup
266
+ destroy(): void;
263
267
  }
264
268
  ```
265
269
 
@@ -308,6 +312,15 @@ const productComponent = components.get('product-1');
308
312
  productComponent.getType(); // 'product'
309
313
  productComponent.getElement(); // <div id="product-1">...</div>
310
314
  productComponent.rerender(); // Force rerender
315
+ productComponent.destroy(); // Remove from DOM and clean up
316
+ ```
317
+
318
+ ### destroy()
319
+
320
+ Remove the client and all injected components, cleaning up event listeners and internal state.
321
+
322
+ ```javascript
323
+ client.destroy();
311
324
  ```
312
325
 
313
326
  ## Error Handling