@liquidcommerce/elements-sdk 2.6.0-beta.41 → 2.6.0-beta.43

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 (73) hide show
  1. package/README.md +1 -1
  2. package/dist/index.checkout.esm.js +6634 -6615
  3. package/dist/index.esm.js +11209 -11112
  4. package/dist/ssr-stub.checkout.esm.js +18 -0
  5. package/dist/ssr-stub.esm.js +269 -0
  6. package/dist/types/auto-initialize/shared-utils.d.ts +3 -1
  7. package/dist/types/clients/base.d.ts +4 -1
  8. package/dist/types/clients/builder.d.ts +2 -1
  9. package/dist/types/clients/checkout.d.ts +2 -10
  10. package/dist/types/clients/main.d.ts +2 -1
  11. package/dist/types/core/base-component.service.d.ts +2 -1
  12. package/dist/types/core/client/client-action.service.d.ts +1 -1
  13. package/dist/types/core/client/client-config.service.d.ts +1 -1
  14. package/dist/types/core/pubsub/pubsub.service.d.ts +0 -2
  15. package/dist/types/core/singleton-manager.service.d.ts +1 -1
  16. package/dist/types/index.checkout.d.ts +3 -2
  17. package/dist/types/index.checkout.umd.d.ts +1 -1
  18. package/dist/types/index.d.ts +4 -1
  19. package/dist/types/interfaces/client.interface.d.ts +62 -0
  20. package/dist/types/interfaces/component.interface.d.ts +7 -0
  21. package/dist/types/interfaces/config.interface.d.ts +45 -0
  22. package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
  23. package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
  24. package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
  25. package/dist/types/interfaces/configs/global.interface.d.ts +1 -1
  26. package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -1
  27. package/dist/types/interfaces/configs/product.interface.d.ts +1 -1
  28. package/dist/types/interfaces/injection.interface.d.ts +44 -0
  29. package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
  30. package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
  31. package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
  32. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +3 -1
  33. package/dist/types/modules/product-list/product-list.commands.d.ts +1 -1
  34. package/dist/types/modules/product-list/product-list.component.d.ts +1 -1
  35. package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
  36. package/dist/types/ssr/stub.checkout.d.ts +6 -0
  37. package/dist/types/ssr/stub.d.ts +10 -0
  38. package/dist/types/utils/dom-compat.d.ts +2 -0
  39. package/docs/v1/README.md +2 -2
  40. package/docs/v1/api/actions/address-actions.md +11 -11
  41. package/docs/v1/api/actions/cart-actions.md +13 -13
  42. package/docs/v1/api/actions/checkout-actions.md +23 -23
  43. package/docs/v1/api/actions/product-actions.md +6 -6
  44. package/docs/v1/api/client.md +11 -11
  45. package/docs/v1/api/ui-helpers.md +11 -11
  46. package/docs/v1/examples/advanced-patterns.md +1 -1
  47. package/docs/v1/examples/checkout-flow.md +1 -1
  48. package/docs/v1/getting-started/concepts.md +7 -7
  49. package/docs/v1/getting-started/installation.md +2 -2
  50. package/docs/v1/getting-started/quick-start.md +3 -3
  51. package/docs/v1/guides/address-component.md +11 -11
  52. package/docs/v1/guides/best-practices.md +14 -14
  53. package/docs/v1/guides/cart-component.md +23 -23
  54. package/docs/v1/guides/checkout-component.md +24 -24
  55. package/docs/v1/guides/events.md +812 -77
  56. package/docs/v1/guides/product-component.md +5 -5
  57. package/docs/v1/integration/nextjs.md +11 -2
  58. package/docs/v1/integration/react.md +3 -3
  59. package/docs/v1/integration/vanilla-js.md +1 -1
  60. package/docs/v1/integration/vue.md +24 -0
  61. package/docs/v1/reference/browser-support.md +9 -0
  62. package/docs/v1/reference/error-handling.md +2 -2
  63. package/docs/v1/reference/troubleshooting.md +10 -2
  64. package/package.json +13 -9
  65. package/dist/types/interfaces/core.interface.d.ts +0 -139
  66. package/docs/gitbook/actions.md +0 -160
  67. package/docs/gitbook/address.md +0 -48
  68. package/docs/gitbook/cart.md +0 -65
  69. package/docs/gitbook/checkout.md +0 -131
  70. package/docs/gitbook/events.md +0 -137
  71. package/docs/gitbook/overview.md +0 -166
  72. package/docs/gitbook/product.md +0 -64
  73. package/docs/gitbook/quick-start-guide.md +0 -393
@@ -1,3 +1,4 @@
1
+ import { SafeHTMLElement } from '@/utils/dom-compat';
1
2
  declare global {
2
3
  interface Window {
3
4
  Stripe: any;
@@ -23,7 +24,7 @@ export interface IStripeFormStatus {
23
24
  hasError: boolean;
24
25
  errorMessage: string | null;
25
26
  }
26
- export declare class CheckoutStripeFormComponent extends HTMLElement {
27
+ export declare class CheckoutStripeFormComponent extends SafeHTMLElement {
27
28
  private _initialized;
28
29
  private _stripe;
29
30
  private _stripeElements;
@@ -17,6 +17,8 @@ export declare class ProductImageCarouselComponent extends BaseComponent<IImageC
17
17
  private startX;
18
18
  private currentTranslateX;
19
19
  private translateX;
20
+ private boundDragMove;
21
+ private boundDragEnd;
20
22
  constructor();
21
23
  afterRender(): void;
22
24
  onStoreWatch(changes: IOnStoreChanged[]): void;
@@ -26,6 +28,7 @@ export declare class ProductImageCarouselComponent extends BaseComponent<IImageC
26
28
  private scrollToIndex;
27
29
  private setupMainImageSwipe;
28
30
  private setupGalleryDrag;
31
+ protected disconnected(): void;
29
32
  private handleDragStart;
30
33
  private handleDragMove;
31
34
  private handleDragEnd;
@@ -13,6 +13,8 @@ export declare class ProductRetailersCarouselComponent extends BaseComponent<IPr
13
13
  private startX;
14
14
  private currentTranslateX;
15
15
  private translateX;
16
+ private boundDragMove;
17
+ private boundDragEnd;
16
18
  constructor();
17
19
  afterRender(): void;
18
20
  private cacheElements;
@@ -21,6 +23,7 @@ export declare class ProductRetailersCarouselComponent extends BaseComponent<IPr
21
23
  private updateSelectedCard;
22
24
  private scrollToIndex;
23
25
  private setupDrag;
26
+ protected disconnected(): void;
24
27
  private handleDragStart;
25
28
  private handleDragMove;
26
29
  private handleDragEnd;
@@ -1,5 +1,5 @@
1
1
  import { BaseComponent } from 'core/base-component.service';
2
- import type { ProductListFilterType } from 'interfaces/core.interface';
2
+ import type { ProductListFilterType } from 'interfaces/injection.interface';
3
3
  export interface IProductListFiltersParams {
4
4
  filters: ProductListFilterType[];
5
5
  }
@@ -25,11 +25,13 @@ export declare class ProductListFiltersComponent extends BaseComponent<IProductL
25
25
  private fulfillmentFilterChevronIcon?;
26
26
  private priceSliderWrapper?;
27
27
  private resizeHandler;
28
+ private boundDrawerClosedHandler;
28
29
  private priceFilterDebounceTimer;
29
30
  constructor();
30
31
  get hostClasses(): string[];
31
32
  protected connected(): Promise<void>;
32
33
  private setupDrawerCloseListener;
34
+ protected disconnected(): void;
33
35
  private setupResizeListener;
34
36
  private detectIfRenderedInDrawer;
35
37
  onStoreWatch(): void;
@@ -5,7 +5,7 @@ import { BaseCommand } from '@/core/command/base-command.service';
5
5
  import { type FulfillmentType } from '@/enums';
6
6
  import type { IFulfillment, IProduct, IProductSizeAttributes, IRetailer } from '@/interfaces/api/product.interface';
7
7
  import type { IFilterSchema, INavigationResponse, IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
8
- import type { ProductListFilterType } from '@/interfaces/core.interface';
8
+ import type { ProductListFilterType } from '@/interfaces/injection.interface';
9
9
  import { type AddItemParams } from '@/modules/cart/cart.commands';
10
10
  import type { IExtendedFilterSchema, IPagination, IProductAvailabilityData, IProductListFilters } from './product-list.interface';
11
11
  type StateListener = (state: IProductListStore) => void;
@@ -1,6 +1,6 @@
1
1
  import type { IProductListComponent } from 'interfaces/configs';
2
2
  import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
3
- import type { ProductListFilterType } from '@/interfaces/core.interface';
3
+ import type { ProductListFilterType } from '@/interfaces/injection.interface';
4
4
  export interface IProductListComponentParams {
5
5
  rows: number;
6
6
  columns: number;
@@ -1,5 +1,6 @@
1
1
  import type { ComponentType } from '@/enums';
2
- export declare class LceElementComponent extends HTMLElement {
2
+ import { SafeHTMLElement } from '@/utils/dom-compat';
3
+ export declare class LceElementComponent extends SafeHTMLElement {
3
4
  private _initialized;
4
5
  protected _container: ShadowRoot | null;
5
6
  private _wrappedComponentRerender;
@@ -0,0 +1,6 @@
1
+ export type { DebugMode, ElementsEnv } from '../enums/core.enum';
2
+ export { DEBUG_MODE, ELEMENTS_ENV } from '../enums/core.enum';
3
+ export type { IElementsCheckoutActions, IElementsCheckoutClient, } from '../interfaces/client.interface';
4
+ export type { IInjectedComponent } from '../interfaces/component.interface';
5
+ export type { ILiquidCommerceElementsCheckoutClientConfig } from '../interfaces/config.interface';
6
+ export declare function ElementsCheckout(..._args: any[]): Promise<null>;
@@ -0,0 +1,10 @@
1
+ export { SDKError, isSDKError } from '../core/sdk-error-handler';
2
+ export type { CartEventLevel, CartEventType, CheckoutEventLevel, CheckoutEventType, ComponentType, DebugMode, DisplayModeType, ElementsEnv, FulfillmentType, NavigationSourceType, } from '../enums/core.enum';
3
+ 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, FULFILLMENT_TYPE, NAVIGATION_SOURCE, } from '../enums/core.enum';
4
+ export type { ILiquidCommerceElementsActions, ILiquidCommerceElementsBuilderClient, ILiquidCommerceElementsClient, } from '../interfaces/client.interface';
5
+ export type { IInjectedComponent } from '../interfaces/component.interface';
6
+ export type { IElementsProxyConfig, ILiquidCommerceElementsBuilderConfig, ILiquidCommerceElementsCheckoutConfig, ILiquidCommerceElementsConfig, ILiquidCommerceElementsDevelopmentConfig, } from '../interfaces/config.interface';
7
+ export type * from '../interfaces/configs';
8
+ export type { IBuilderInjectElementParams, IInjectCheckoutBuilderParams, IInjectCheckoutParams, IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams, ProductListFilterType, } from '../interfaces/injection.interface';
9
+ export declare function Elements(..._args: any[]): Promise<null>;
10
+ export declare function ElementsBuilder(..._args: any[]): Promise<null>;
@@ -0,0 +1,2 @@
1
+ export declare const SafeHTMLElement: typeof HTMLElement;
2
+ export declare function isHTMLElement(value: unknown): value is HTMLElement;
package/docs/v1/README.md CHANGED
@@ -125,13 +125,13 @@ await client.injectProductElement([
125
125
  ### Opening the Cart
126
126
 
127
127
  ```javascript
128
- window.elements.actions.cart.openCart();
128
+ window.LiquidCommerce.elements.actions.cart.openCart();
129
129
  ```
130
130
 
131
131
  ### Adding to Cart Programmatically
132
132
 
133
133
  ```javascript
134
- await window.elements.actions.cart.addProduct([
134
+ await window.LiquidCommerce.elements.actions.cart.addProduct([
135
135
  {
136
136
  identifier: '00619947000020',
137
137
  fulfillmentType: 'shipping',
@@ -21,7 +21,7 @@ setAddressByPlacesId(placesId: string): Promise<void>
21
21
  ### Example
22
22
 
23
23
  ```javascript
24
- await window.elements.actions.address.setAddressByPlacesId(
24
+ await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(
25
25
  'ChIJOwg_06VPwokRYv534QaPC8g'
26
26
  );
27
27
  ```
@@ -65,7 +65,7 @@ interface IAddressCoordinates {
65
65
  ### Example
66
66
 
67
67
  ```javascript
68
- await window.elements.actions.address.setAddressManually(
68
+ await window.LiquidCommerce.elements.actions.address.setAddressManually(
69
69
  {
70
70
  one: '123 Main Street',
71
71
  two: 'Apt 4',
@@ -110,7 +110,7 @@ clear(): Promise<void>
110
110
  ### Example
111
111
 
112
112
  ```javascript
113
- await window.elements.actions.address.clear();
113
+ await window.LiquidCommerce.elements.actions.address.clear();
114
114
  ```
115
115
 
116
116
  ### Effects
@@ -156,7 +156,7 @@ Returns `null` if no address is set.
156
156
  ### Example
157
157
 
158
158
  ```javascript
159
- const address = window.elements.actions.address.getDetails();
159
+ const address = window.LiquidCommerce.elements.actions.address.getDetails();
160
160
 
161
161
  if (address) {
162
162
  console.log('Current address:', address.formattedAddress);
@@ -171,7 +171,7 @@ if (address) {
171
171
  #### Check if Address is Set
172
172
 
173
173
  ```javascript
174
- if (!window.elements.actions.address.getDetails()) {
174
+ if (!window.LiquidCommerce.elements.actions.address.getDetails()) {
175
175
  // Prompt user to set address
176
176
  showAddressPrompt();
177
177
  }
@@ -180,7 +180,7 @@ if (!window.elements.actions.address.getDetails()) {
180
180
  #### Display Current Address
181
181
 
182
182
  ```javascript
183
- const address = window.elements.actions.address.getDetails();
183
+ const address = window.LiquidCommerce.elements.actions.address.getDetails();
184
184
 
185
185
  if (address) {
186
186
  document.getElementById('current-address').textContent =
@@ -217,10 +217,10 @@ Google Places provides accurate geocoding:
217
217
 
218
218
  ```javascript
219
219
  // Good - accurate and validated
220
- await window.elements.actions.address.setAddressByPlacesId(placesId);
220
+ await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(placesId);
221
221
 
222
222
  // Less ideal - requires manual geocoding
223
- await window.elements.actions.address.setAddressManually(address, coords);
223
+ await window.LiquidCommerce.elements.actions.address.setAddressManually(address, coords);
224
224
  ```
225
225
 
226
226
  ### Validate Manual Addresses
@@ -244,7 +244,7 @@ async function setManualAddress(address, coords) {
244
244
  throw new Error('Invalid ZIP code');
245
245
  }
246
246
 
247
- await window.elements.actions.address.setAddressManually(address, coords);
247
+ await window.LiquidCommerce.elements.actions.address.setAddressManually(address, coords);
248
248
  }
249
249
  ```
250
250
 
@@ -252,7 +252,7 @@ async function setManualAddress(address, coords) {
252
252
 
253
253
  ```javascript
254
254
  try {
255
- await window.elements.actions.address.setAddressByPlacesId(placesId);
255
+ await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(placesId);
256
256
  showSuccess('Address saved!');
257
257
  } catch (error) {
258
258
  console.error('Failed to set address:', error);
@@ -266,7 +266,7 @@ Set address as soon as possible in user flow:
266
266
 
267
267
  ```javascript
268
268
  window.addEventListener('lce:actions.client_ready', () => {
269
- if (!window.elements.actions.address.getDetails()) {
269
+ if (!window.LiquidCommerce.elements.actions.address.getDetails()) {
270
270
  // Prompt for address on first visit
271
271
  showAddressModal();
272
272
  }
@@ -15,7 +15,7 @@ openCart(): void
15
15
  ### Example
16
16
 
17
17
  ```javascript
18
- window.elements.actions.cart.openCart();
18
+ window.LiquidCommerce.elements.actions.cart.openCart();
19
19
  ```
20
20
 
21
21
  ---
@@ -33,7 +33,7 @@ closeCart(): void
33
33
  ### Example
34
34
 
35
35
  ```javascript
36
- window.elements.actions.cart.closeCart();
36
+ window.LiquidCommerce.elements.actions.cart.closeCart();
37
37
  ```
38
38
 
39
39
  ---
@@ -53,7 +53,7 @@ toggleCart(): void
53
53
  ```javascript
54
54
  // Add to your cart button
55
55
  document.getElementById('cart-btn').addEventListener('click', () => {
56
- window.elements.actions.cart.toggleCart();
56
+ window.LiquidCommerce.elements.actions.cart.toggleCart();
57
57
  });
58
58
  ```
59
59
 
@@ -88,7 +88,7 @@ interface IAddProductParams {
88
88
 
89
89
  ```javascript
90
90
  // Add single product
91
- await window.elements.actions.cart.addProduct([
91
+ await window.LiquidCommerce.elements.actions.cart.addProduct([
92
92
  {
93
93
  identifier: '00619947000020',
94
94
  fulfillmentType: 'shipping',
@@ -97,7 +97,7 @@ await window.elements.actions.cart.addProduct([
97
97
  ], true); // Open cart after adding
98
98
 
99
99
  // Add multiple products
100
- await window.elements.actions.cart.addProduct([
100
+ await window.LiquidCommerce.elements.actions.cart.addProduct([
101
101
  {
102
102
  identifier: '00619947000020',
103
103
  fulfillmentType: 'shipping',
@@ -149,7 +149,7 @@ applyPromoCode(promoCode: string): Promise<void>
149
149
 
150
150
  ```javascript
151
151
  try {
152
- await window.elements.actions.cart.applyPromoCode('SUMMER20');
152
+ await window.LiquidCommerce.elements.actions.cart.applyPromoCode('SUMMER20');
153
153
  console.log('Promo code applied successfully');
154
154
  } catch (error) {
155
155
  console.error('Invalid promo code:', error);
@@ -178,7 +178,7 @@ removePromoCode(): Promise<void>
178
178
  ### Example
179
179
 
180
180
  ```javascript
181
- await window.elements.actions.cart.removePromoCode();
181
+ await window.LiquidCommerce.elements.actions.cart.removePromoCode();
182
182
  ```
183
183
 
184
184
  ---
@@ -196,7 +196,7 @@ resetCart(): Promise<void>
196
196
  ### Example
197
197
 
198
198
  ```javascript
199
- await window.elements.actions.cart.resetCart();
199
+ await window.LiquidCommerce.elements.actions.cart.resetCart();
200
200
  console.log('Cart cleared');
201
201
  ```
202
202
 
@@ -238,7 +238,7 @@ interface IBaseCartEventData {
238
238
  ### Example
239
239
 
240
240
  ```javascript
241
- const cart = window.elements.actions.cart.getDetails();
241
+ const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
242
242
 
243
243
  console.log(`Cart ID: ${cart.cartId}`);
244
244
  console.log(`Items: ${cart.itemsCount}`);
@@ -256,7 +256,7 @@ if (cart.promoCode) {
256
256
 
257
257
  ```javascript
258
258
  function updateCartSummary() {
259
- const cart = window.elements.actions.cart.getDetails();
259
+ const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
260
260
 
261
261
  document.getElementById('cart-count').textContent = cart.itemsCount;
262
262
  document.getElementById('cart-total').textContent = `$${cart.total / 100}`;
@@ -270,21 +270,21 @@ window.addEventListener('lce:actions.cart_updated', updateCartSummary);
270
270
 
271
271
  ```javascript
272
272
  document.getElementById('checkout-btn').addEventListener('click', () => {
273
- const cart = window.elements.actions.cart.getDetails();
273
+ const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
274
274
 
275
275
  if (cart.itemsCount === 0) {
276
276
  alert('Your cart is empty');
277
277
  return;
278
278
  }
279
279
 
280
- window.elements.actions.checkout.openCheckout();
280
+ window.LiquidCommerce.elements.actions.checkout.openCheckout();
281
281
  });
282
282
  ```
283
283
 
284
284
  #### Track Cart Value
285
285
 
286
286
  ```javascript
287
- const cart = window.elements.actions.cart.getDetails();
287
+ const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
288
288
 
289
289
  gtag('event', 'view_cart', {
290
290
  value: cart.total / 100,
@@ -13,7 +13,7 @@ openCheckout(): void
13
13
  Opens the checkout drawer or navigates to checkout page.
14
14
 
15
15
  ```javascript
16
- window.elements.actions.checkout.openCheckout();
16
+ window.LiquidCommerce.elements.actions.checkout.openCheckout();
17
17
  ```
18
18
 
19
19
  ### actions.checkout.closeCheckout()
@@ -25,7 +25,7 @@ closeCheckout(): void
25
25
  Closes the checkout drawer.
26
26
 
27
27
  ```javascript
28
- window.elements.actions.checkout.closeCheckout();
28
+ window.LiquidCommerce.elements.actions.checkout.closeCheckout();
29
29
  ```
30
30
 
31
31
  ### actions.checkout.toggleCheckout()
@@ -37,7 +37,7 @@ toggleCheckout(): void
37
37
  Toggles checkout open/closed.
38
38
 
39
39
  ```javascript
40
- window.elements.actions.checkout.toggleCheckout();
40
+ window.LiquidCommerce.elements.actions.checkout.toggleCheckout();
41
41
  ```
42
42
 
43
43
  ### actions.checkout.exitCheckout()
@@ -49,7 +49,7 @@ exitCheckout(): void
49
49
  Navigates away from checkout (requires `exitUrl` configuration).
50
50
 
51
51
  ```javascript
52
- window.elements.actions.checkout.exitCheckout();
52
+ window.LiquidCommerce.elements.actions.checkout.exitCheckout();
53
53
  ```
54
54
 
55
55
  ## Product Actions
@@ -63,7 +63,7 @@ addProduct(params: IAddProductParams[], openCheckout?: boolean): Promise<void>
63
63
  Add products directly to checkout, bypassing the cart.
64
64
 
65
65
  ```javascript
66
- await window.elements.actions.checkout.addProduct([
66
+ await window.LiquidCommerce.elements.actions.checkout.addProduct([
67
67
  {
68
68
  identifier: '00619947000020',
69
69
  fulfillmentType: 'shipping',
@@ -83,7 +83,7 @@ applyPromoCode(promoCode: string): Promise<void>
83
83
  Apply a promo code during checkout.
84
84
 
85
85
  ```javascript
86
- await window.elements.actions.checkout.applyPromoCode('WELCOME10');
86
+ await window.LiquidCommerce.elements.actions.checkout.applyPromoCode('WELCOME10');
87
87
  ```
88
88
 
89
89
  ### actions.checkout.removePromoCode()
@@ -95,7 +95,7 @@ removePromoCode(): Promise<void>
95
95
  Remove the active promo code.
96
96
 
97
97
  ```javascript
98
- await window.elements.actions.checkout.removePromoCode();
98
+ await window.LiquidCommerce.elements.actions.checkout.removePromoCode();
99
99
  ```
100
100
 
101
101
  ### actions.checkout.applyGiftCard()
@@ -107,7 +107,7 @@ applyGiftCard(code: string): Promise<void>
107
107
  Apply a gift card.
108
108
 
109
109
  ```javascript
110
- await window.elements.actions.checkout.applyGiftCard('GIFT-1234-5678-9012');
110
+ await window.LiquidCommerce.elements.actions.checkout.applyGiftCard('GIFT-1234-5678-9012');
111
111
  ```
112
112
 
113
113
  ### actions.checkout.removeGiftCard()
@@ -119,7 +119,7 @@ removeGiftCard(code: string): Promise<void>
119
119
  Remove a gift card.
120
120
 
121
121
  ```javascript
122
- await window.elements.actions.checkout.removeGiftCard('GIFT-1234-5678-9012');
122
+ await window.LiquidCommerce.elements.actions.checkout.removeGiftCard('GIFT-1234-5678-9012');
123
123
  ```
124
124
 
125
125
  ## Toggle Actions
@@ -134,13 +134,13 @@ Enable/disable gift mode.
134
134
 
135
135
  ```javascript
136
136
  // Enable
137
- await window.elements.actions.checkout.toggleIsGift(true);
137
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(true);
138
138
 
139
139
  // Disable
140
- await window.elements.actions.checkout.toggleIsGift(false);
140
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(false);
141
141
 
142
142
  // Toggle
143
- await window.elements.actions.checkout.toggleIsGift();
143
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift();
144
144
  ```
145
145
 
146
146
  ### actions.checkout.toggleBillingSameAsShipping()
@@ -153,10 +153,10 @@ Set whether billing address matches shipping.
153
153
 
154
154
  ```javascript
155
155
  // Use shipping address for billing
156
- await window.elements.actions.checkout.toggleBillingSameAsShipping(true);
156
+ await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(true);
157
157
 
158
158
  // Use different billing address
159
- await window.elements.actions.checkout.toggleBillingSameAsShipping(false);
159
+ await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(false);
160
160
  ```
161
161
 
162
162
  ### actions.checkout.toggleMarketingPreferences()
@@ -169,10 +169,10 @@ Set marketing opt-in preferences.
169
169
 
170
170
  ```javascript
171
171
  // Opt into email marketing
172
- await window.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
172
+ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
173
173
 
174
174
  // Opt into SMS marketing
175
- await window.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
175
+ await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
176
176
  ```
177
177
 
178
178
  ## Form Update Actions
@@ -192,7 +192,7 @@ Pre-fill customer information.
192
192
  - `company`
193
193
 
194
194
  ```javascript
195
- window.elements.actions.checkout.updateCustomerInfo({
195
+ window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
196
196
  firstName: 'John',
197
197
  lastName: 'Doe',
198
198
  email: 'john@example.com',
@@ -218,7 +218,7 @@ Pre-fill billing address.
218
218
  - `city`, `state`, `zipCode`
219
219
 
220
220
  ```javascript
221
- window.elements.actions.checkout.updateBillingInfo({
221
+ window.LiquidCommerce.elements.actions.checkout.updateBillingInfo({
222
222
  firstName: 'John',
223
223
  lastName: 'Doe',
224
224
  email: 'john@example.com',
@@ -246,7 +246,7 @@ Pre-fill gift recipient information.
246
246
  - `message`, `addressTwo`
247
247
 
248
248
  ```javascript
249
- window.elements.actions.checkout.updateGiftInfo({
249
+ window.LiquidCommerce.elements.actions.checkout.updateGiftInfo({
250
250
  firstName: 'Jane',
251
251
  lastName: 'Smith',
252
252
  email: 'jane@example.com',
@@ -267,7 +267,7 @@ getDetails(): ICheckoutDetailsEventData
267
267
  Retrieve current checkout information.
268
268
 
269
269
  ```javascript
270
- const checkout = window.elements.actions.checkout.getDetails();
270
+ const checkout = window.LiquidCommerce.elements.actions.checkout.getDetails();
271
271
 
272
272
  console.log(`Cart ID: ${checkout.cartId}`);
273
273
  console.log(`Total: $${checkout.amounts.total / 100}`);
@@ -306,7 +306,7 @@ interface ICheckoutDetailsEventData {
306
306
  ```javascript
307
307
  window.addEventListener('lce:actions.checkout_opened', () => {
308
308
  if (userIsLoggedIn) {
309
- window.elements.actions.checkout.updateCustomerInfo({
309
+ window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
310
310
  firstName: currentUser.firstName,
311
311
  lastName: currentUser.lastName,
312
312
  email: currentUser.email,
@@ -342,7 +342,7 @@ window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
342
342
 
343
343
  ```javascript
344
344
  document.getElementById('gift-checkbox').addEventListener('change', async (e) => {
345
- await window.elements.actions.checkout.toggleIsGift(e.target.checked);
345
+ await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(e.target.checked);
346
346
 
347
347
  if (e.target.checked) {
348
348
  showGiftForm();
@@ -361,7 +361,7 @@ const campaignCode = params.get('promo');
361
361
  if (campaignCode) {
362
362
  window.addEventListener('lce:actions.checkout_opened', async () => {
363
363
  try {
364
- await window.elements.actions.checkout.applyPromoCode(campaignCode);
364
+ await window.LiquidCommerce.elements.actions.checkout.applyPromoCode(campaignCode);
365
365
  } catch (error) {
366
366
  console.log('Invalid campaign code');
367
367
  }
@@ -40,7 +40,7 @@ interface IBaseProductEventData {
40
40
  ### Example
41
41
 
42
42
  ```javascript
43
- const productData = window.elements.actions.product.getDetails('00619947000020');
43
+ const productData = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
44
44
 
45
45
  console.log(productData.name); // "Premium Whiskey"
46
46
  console.log(productData.price / 100); // 49.99
@@ -57,7 +57,7 @@ console.log(productData.quantity); // 1
57
57
 
58
58
  ```javascript
59
59
  try {
60
- const data = window.elements.actions.product.getDetails('invalid_id');
60
+ const data = window.LiquidCommerce.elements.actions.product.getDetails('invalid_id');
61
61
  } catch (error) {
62
62
  console.error('Product not found:', error.message);
63
63
  }
@@ -68,7 +68,7 @@ try {
68
68
  #### Display Product Info Elsewhere
69
69
 
70
70
  ```javascript
71
- const product = window.elements.actions.product.getDetails('00619947000020');
71
+ const product = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
72
72
 
73
73
  document.getElementById('product-name').textContent = product.name;
74
74
  document.getElementById('product-price').textContent = `$${product.price / 100}`;
@@ -78,7 +78,7 @@ document.getElementById('product-price').textContent = `$${product.price / 100}`
78
78
 
79
79
  ```javascript
80
80
  window.addEventListener('lce:actions.product_loaded', () => {
81
- const product = window.elements.actions.product.getDetails('00619947000020');
81
+ const product = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
82
82
 
83
83
  gtag('event', 'view_item', {
84
84
  items: [{
@@ -94,8 +94,8 @@ window.addEventListener('lce:actions.product_loaded', () => {
94
94
  #### Custom Product Comparison
95
95
 
96
96
  ```javascript
97
- const product1 = window.elements.actions.product.getDetails('00619947000020');
98
- const product2 = window.elements.actions.product.getDetails('08504405135');
97
+ const product1 = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
98
+ const product2 = window.LiquidCommerce.elements.actions.product.getDetails('08504405135');
99
99
 
100
100
  if (product1.price < product2.price) {
101
101
  console.log(`${product1.name} is cheaper`);
@@ -201,17 +201,17 @@ development: {
201
201
 
202
202
  ## Global Access
203
203
 
204
- After initialization, the client is available globally:
204
+ After initialization, the client is available globally under the `window.LiquidCommerce` namespace:
205
205
 
206
206
  ```javascript
207
- window.elements
207
+ window.LiquidCommerce.elements
208
208
  ```
209
209
 
210
210
  This allows access from anywhere in your application:
211
211
 
212
212
  ```javascript
213
213
  // From any script
214
- window.elements.actions.cart.openCart();
214
+ window.LiquidCommerce.elements.actions.cart.openCart();
215
215
  ```
216
216
 
217
217
  ## Client Ready Event
@@ -225,7 +225,7 @@ window.addEventListener('lce:actions.client_ready', ( event ) => {
225
225
  console.log(`Elements SDK v${version} ready`);
226
226
 
227
227
  // Safe to use client
228
- window.elements.injectProductElement([...]);
228
+ window.LiquidCommerce.elements.injectProductElement([...]);
229
229
  });
230
230
  ```
231
231
 
@@ -345,7 +345,7 @@ The SDK catches and contains its own errors:
345
345
 
346
346
  ```javascript
347
347
  // Even if SDK throws, your app continues
348
- window.elements.actions.cart.addProduct([/* invalid */]);
348
+ window.LiquidCommerce.elements.actions.cart.addProduct([/* invalid */]);
349
349
 
350
350
  // Your code still runs
351
351
  console.log('App still working');
@@ -430,15 +430,15 @@ await Elements('KEY', { env: 'production' });
430
430
 
431
431
  ### Use Global Access
432
432
 
433
- After initialization, use `window.elements`:
433
+ After initialization, use `window.LiquidCommerce.elements`:
434
434
 
435
435
  ```javascript
436
436
  // Initialize once
437
437
  await Elements('KEY', { env: 'production' });
438
438
 
439
439
  // Use globally
440
- window.elements.actions.cart.openCart();
441
- window.elements.ui.cartButton('cart-btn');
440
+ window.LiquidCommerce.elements.actions.cart.openCart();
441
+ window.LiquidCommerce.elements.ui.cartButton('cart-btn');
442
442
  ```
443
443
 
444
444
  ### Check Client Ready
@@ -446,13 +446,13 @@ window.elements.ui.cartButton('cart-btn');
446
446
  Wait for client ready before using:
447
447
 
448
448
  ```javascript
449
- if (window.elements) {
449
+ if (window.LiquidCommerce?.elements) {
450
450
  // Client is ready
451
- window.elements.actions.cart.openCart();
451
+ window.LiquidCommerce.elements.actions.cart.openCart();
452
452
  } else {
453
453
  // Wait for client ready
454
454
  window.addEventListener('lce:actions.client_ready', () => {
455
- window.elements.actions.cart.openCart();
455
+ window.LiquidCommerce.elements.actions.cart.openCart();
456
456
  });
457
457
  }
458
458
  ```