@liquidcommerce/elements-sdk 2.7.8 → 2.7.10

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 (36) hide show
  1. package/README.md +1 -1
  2. package/dist/index.checkout.esm.js +6884 -6883
  3. package/dist/index.esm.js +11255 -11181
  4. package/dist/types/index.checkout.d.ts +1 -1
  5. package/dist/types/index.checkout.umd.d.ts +1 -1
  6. package/dist/types/interfaces/api/cart.interface.d.ts +1 -0
  7. package/dist/types/interfaces/api/checkout.interface.d.ts +1 -0
  8. package/dist/types/interfaces/api/product.interface.d.ts +1 -0
  9. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  10. package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +3 -0
  11. package/dist/types/modules/product-list/product-list.component.d.ts +0 -1
  12. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +1 -0
  13. package/docs/v1/README.md +1 -1
  14. package/docs/v1/api/actions/checkout-actions.md +40 -0
  15. package/docs/v1/api/actions/product-actions.md +44 -1
  16. package/docs/v1/api/client.md +13 -0
  17. package/docs/v1/api/configuration.md +528 -1
  18. package/docs/v1/api/injection-methods.md +18 -4
  19. package/docs/v1/api/typescript-types.md +398 -1
  20. package/docs/v1/examples/advanced-patterns.md +102 -0
  21. package/docs/v1/examples/checkout-flow.md +2 -2
  22. package/docs/v1/examples/multi-product-page.md +2 -2
  23. package/docs/v1/examples/simple-product-page.md +1 -1
  24. package/docs/v1/getting-started/concepts.md +3 -3
  25. package/docs/v1/getting-started/installation.md +3 -3
  26. package/docs/v1/getting-started/quick-start.md +6 -6
  27. package/docs/v1/guides/address-component.md +1 -1
  28. package/docs/v1/guides/best-practices.md +29 -0
  29. package/docs/v1/guides/cart-component.md +7 -7
  30. package/docs/v1/guides/checkout-component.md +2 -2
  31. package/docs/v1/guides/product-component.md +5 -5
  32. package/docs/v1/guides/product-list-component.md +72 -163
  33. package/docs/v1/integration/laravel.md +1 -1
  34. package/docs/v1/integration/vanilla-js.md +2 -2
  35. package/docs/v1/reference/troubleshooting.md +64 -0
  36. package/package.json +14 -21
@@ -4,5 +4,5 @@ import { DEBUG_MODE, ELEMENTS_ENV } from '@/enums';
4
4
  import type { IElementsCheckoutActions, IElementsCheckoutClient } from '@/interfaces/client.interface';
5
5
  import type { IInjectedComponent } from '@/interfaces/component.interface';
6
6
  import type { ILiquidCommerceElementsCheckoutClientConfig } from '@/interfaces/config.interface';
7
- export { DEBUG_MODE, ELEMENTS_ENV, ElementsCheckout };
8
7
  export type { DebugMode, ElementsEnv, IElementsCheckoutActions, IElementsCheckoutClient, IInjectedComponent, ILiquidCommerceElementsCheckoutClientConfig, };
8
+ export { DEBUG_MODE, ELEMENTS_ENV, ElementsCheckout };
@@ -1,4 +1,4 @@
1
1
  import type { IElementsCheckoutActions, IElementsCheckoutClient } from '@/interfaces/client.interface';
2
2
  import { ElementsCheckout } from './clients/checkout';
3
- export { ElementsCheckout };
4
3
  export type { IElementsCheckoutActions, IElementsCheckoutClient };
4
+ export { ElementsCheckout };
@@ -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;
@@ -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;
@@ -31,10 +31,13 @@ export declare class ProductListProductPreCartComponent extends BaseComponent<IP
31
31
  private updateAddToCartButton;
32
32
  private getEngravingFee;
33
33
  protected template(): HTMLElement[];
34
+ private createAnimatedContentElement;
35
+ private buildLayout;
34
36
  private createEngravingFormContent;
35
37
  private renderPreCartContent;
36
38
  private createDeliversToSectionWrapper;
37
39
  private createShippingFromSectionWrapper;
40
+ private createDescriptionSection;
38
41
  private createCartHeader;
39
42
  private createImageSection;
40
43
  private createPricePersonalizationSection;
@@ -31,7 +31,6 @@ export declare class ProductListComponent extends BaseComponent<IProductListComp
31
31
  private renderLoadingState;
32
32
  private renderProducts;
33
33
  private appendNewProducts;
34
- private getResponsiveColumns;
35
34
  private setupInfiniteScroll;
36
35
  private createScrollSentinel;
37
36
  private updateSentinel;
@@ -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;
package/docs/v1/README.md CHANGED
@@ -108,7 +108,7 @@ Practical examples with working code:
108
108
  data-container-1="product"
109
109
  data-product-1="00619947000020"
110
110
  type="text/javascript"
111
- src="https://assets-elements.liquidcommerce.us/all/elements.js"
111
+ src="https://elements.reservebar-worker.workers.dev/all/elements.js"
112
112
  ></script>
113
113
 
114
114
  <div id="product"></div>
@@ -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