@liquidcommerce/elements-sdk 2.7.6 → 2.7.7

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,12 +1,22 @@
1
+ import type { IAddProductParams } from '@/core/client/actions/client-cart-action.service';
2
+ import type { IAnonymousCheckoutAddProductItem } from '@/interfaces/api/checkout.interface';
1
3
  import type { IInjectedComponent } from '@/interfaces/component.interface';
2
4
  import type { ILiquidCommerceElementsDevelopmentConfig } from '@/interfaces/config.interface';
3
5
  import type { IInjectCheckoutParams } from '@/interfaces/injection.interface';
6
+ export interface IQueryParamActions {
7
+ addProduct: (params: IAddProductParams[], open?: boolean) => Promise<void>;
8
+ applyPromoCode: (promoCode: string) => Promise<void>;
9
+ }
4
10
  export declare const SHARED_ATTR: {
5
11
  readonly SCRIPT: {
6
12
  readonly MAIN: "data-liquid-commerce-elements";
7
13
  readonly TOKEN: "data-token";
8
14
  readonly ENV: "data-env";
9
15
  readonly DEBUG_MODE: "data-debug-mode";
16
+ readonly PRODUCT_PARAM: "data-product-param";
17
+ readonly PRODUCT_FULFILLMENT_TYPE_PARAM: "data-product-fulfillment-type-param";
18
+ readonly PRODUCT_QUANTITY_PARAM: "data-product-quantity-param";
19
+ readonly PROMO_CODE_PARAM: "data-promo-code-param";
10
20
  readonly CHECKOUT_PARAM: "data-checkout-param";
11
21
  readonly CHECKOUT_URL: "data-checkout-url";
12
22
  };
@@ -27,3 +37,9 @@ export declare function setupCheckout(script: HTMLScriptElement, injectFn: (para
27
37
  errorPrefix: string;
28
38
  }): Promise<void>;
29
39
  export declare function setupExitCheckoutHandlers(exitCheckoutFn: () => void): void;
40
+ export declare function addProductViaQueryParam(actions: IQueryParamActions, script: HTMLScriptElement, errorPrefix: string): Promise<void>;
41
+ export declare function extractAnonymousProductFromQueryParams(script: HTMLScriptElement, errorPrefix: string): {
42
+ item: IAnonymousCheckoutAddProductItem;
43
+ promoCode?: string;
44
+ } | null;
45
+ export declare function applyPromoCodeViaQueryParam(actions: IQueryParamActions, script: HTMLScriptElement, errorPrefix: string): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import type { IElementsCheckoutClient } from '@/interfaces/client.interface';
2
2
  import type { ILiquidCommerceElementsCheckoutClientConfig } from '@/interfaces/config.interface';
3
3
  import '@/modules/theme-provider/styles/register-styles';
4
+ import '@/modules/address/styles/register-styles';
4
5
  import '@/modules/checkout/styles/register-styles';
5
6
  export declare function ElementsCheckout(apiKey: string, config: ILiquidCommerceElementsCheckoutClientConfig): Promise<IElementsCheckoutClient | null>;
@@ -1,4 +1,5 @@
1
1
  import { type ComponentType } from '@/enums';
2
+ export declare function normalizeProductListLists<T extends Record<string, any>>(data: T): T;
2
3
  export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>, currentPath?: string): T;
3
4
  export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
4
5
  export declare function getComponentTypesForLayoutFields(parentPath: string, layoutFields: Record<string, any>): ComponentType[];
@@ -3,7 +3,7 @@ import type { AuthClientService } from '@/core/api/auth-client.service';
3
3
  import type { IPersistedStore, IPersistedStoreAction } from '@/core/store/interfaces/core.interface';
4
4
  import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
5
5
  import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
6
- import type { ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
6
+ import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse, ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
7
7
  import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
8
8
  import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
9
9
  export declare class ApiClientService {
@@ -19,11 +19,13 @@ export declare class ApiClientService {
19
19
  getAddressDetails(id: string): Promise<ApiResult<IAddressDetailsResult>>;
20
20
  getProductsData(identifier: string[], location?: ILocation): Promise<ApiResult<IProductAvailabilityResponse>>;
21
21
  productListSearch(params: IProductSearchParams): Promise<ApiResult<IProductSearchResponse>>;
22
+ getProductAvailabilityByState(identifiers: string[], state?: string): Promise<ApiResult<IProductAvailabilityResponse>>;
22
23
  getCartData(id: string | null): Promise<ApiResult<ICart>>;
23
24
  updateCart(params: ICartUpdateParams): Promise<ApiResult<ICart>>;
24
25
  prepareCheckout(params: ICheckoutPrepareParams): Promise<ApiResult<ICheckoutPrepare>>;
25
26
  updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ApiResult<ICheckoutItemsUpdateResponse>>;
26
27
  getPaymentSession(cartId: string): Promise<ApiResult<ICheckoutPaymentSession>>;
27
28
  confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ApiResult<ICheckoutPaymentConfirm>>;
29
+ addAnonymousProduct(params: IAnonymousCheckoutAddProductParams): Promise<ApiResult<IAnonymousCheckoutAddProductResponse>>;
28
30
  checkoutComplete(token: string): Promise<ApiResult<ICheckoutComplete>>;
29
31
  }
@@ -1,4 +1,6 @@
1
1
  import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
2
+ import type { IAnonymousCheckoutAddProductParams, IAnonymousCheckoutAddProductResponse } from '@/interfaces/api/checkout.interface';
3
+ import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
2
4
  import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/constant';
3
5
  import { BaseActionService } from './base-action.service';
4
6
  import type { IAddProductParams } from './client-cart-action.service';
@@ -19,6 +21,8 @@ export interface ICheckoutActions {
19
21
  updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
20
22
  updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
21
23
  getDetails: () => ICheckoutDetailsEventData;
24
+ getProductAvailabilityByState: (identifiers: string[], state?: string) => Promise<IProductAvailabilityResponse>;
25
+ addAnonymousProduct: (params: IAnonymousCheckoutAddProductParams) => Promise<IAnonymousCheckoutAddProductResponse>;
22
26
  }
23
27
  export declare class ClientCheckoutActionService extends BaseActionService {
24
28
  private readonly command;
@@ -47,4 +51,6 @@ export declare class ClientCheckoutActionService extends BaseActionService {
47
51
  private updateBillingInfo;
48
52
  private updateGiftInfo;
49
53
  private getDetails;
54
+ private addAnonymousProduct;
55
+ private getProductAvailabilityByState;
50
56
  }
@@ -1,7 +1,9 @@
1
1
  import type { IBaseProductEventData } from '@/core/pubsub/interfaces/product.interface';
2
+ import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
2
3
  import { BaseActionService } from './base-action.service';
3
4
  export interface IProductActions {
4
5
  getDetails: (identifier: string) => IBaseProductEventData;
6
+ getProductAvailabilityByState: (identifiers: string[], state?: string) => Promise<IProductAvailabilityResponse>;
5
7
  }
6
8
  export declare class ClientProductActionService extends BaseActionService {
7
9
  private readonly command;
@@ -9,4 +11,5 @@ export declare class ClientProductActionService extends BaseActionService {
9
11
  static getInstance(): ClientProductActionService;
10
12
  get actions(): IProductActions;
11
13
  private getDetails;
14
+ private getProductAvailabilityByState;
12
15
  }
@@ -22,7 +22,9 @@ export interface IClientConfigs {
22
22
  paymentMethodId?: string;
23
23
  openShadowDom?: boolean;
24
24
  hasCustomApiUrl?: boolean;
25
+ mockMode: boolean;
25
26
  checkout: ILiquidCommerceElementsCheckoutConfig | null;
27
+ isCheckoutOnly: boolean;
26
28
  }
27
29
  export interface IClientConfigInput {
28
30
  env?: ElementsEnv;
@@ -35,8 +37,10 @@ export interface IClientConfigInput {
35
37
  customApiUrl?: string;
36
38
  paymentMethodId?: string;
37
39
  openShadowDom?: boolean;
40
+ mockMode?: boolean;
38
41
  };
39
42
  checkout?: ILiquidCommerceElementsCheckoutConfig;
43
+ isCheckoutOnly?: boolean;
40
44
  }
41
45
  export declare class ClientConfigService {
42
46
  private config;
@@ -49,6 +53,7 @@ export declare class ClientConfigService {
49
53
  isStaging(): boolean;
50
54
  isProduction(): boolean;
51
55
  isBuilder(): boolean;
56
+ isCheckoutOnly(): boolean;
52
57
  isDebuggingEnabled(): boolean;
53
58
  isDebugPanelEnabled(): boolean;
54
59
  debuggingDisabled(): boolean;
@@ -2,6 +2,8 @@ export * from './clients/builder';
2
2
  export * from './clients/main';
3
3
  export * from './core/sdk-error-handler';
4
4
  export * from './enums';
5
+ export type { LiquidCommerceGlobal } from './global';
6
+ export * from './interfaces/api';
5
7
  export * from './interfaces/client.interface';
6
8
  export * from './interfaces/component.interface';
7
9
  export * from './interfaces/config.interface';
@@ -1,6 +1,6 @@
1
1
  import type { CheckoutEventLevel, CheckoutEventType, FulfillmentType } from '@/enums';
2
2
  import type { IAddressAddress, IAddressCoordinates, ILocation } from '@/interfaces/api/address.interface';
3
- import type { ICart } from '@/interfaces/api/cart.interface';
3
+ import type { ICart, ICartUpdateItem } from '@/interfaces/api/cart.interface';
4
4
  import type { IProductPresale } from '@/interfaces/api/product.interface';
5
5
  export interface ICheckoutComplete {
6
6
  orderNumber: string;
@@ -94,6 +94,27 @@ export interface ICheckoutItemsUpdateResponse {
94
94
  cart: ICart;
95
95
  checkout: ICheckoutPrepare;
96
96
  }
97
+ export interface IAnonymousCheckoutAddProductItem {
98
+ identifier: string;
99
+ fulfillmentType: FulfillmentType;
100
+ quantity: number;
101
+ }
102
+ export interface IAnonymousCheckoutAddProductParams {
103
+ items?: IAnonymousCheckoutAddProductItem[];
104
+ cartItems?: ICartUpdateItem[];
105
+ location: ILocation;
106
+ promoCode?: string;
107
+ }
108
+ export interface IAnonymousCheckoutUnavailableItem {
109
+ identifier: string;
110
+ productName: string | null;
111
+ fulfillmentType: FulfillmentType;
112
+ reason: 'product_not_available' | 'fulfillment_not_available';
113
+ }
114
+ export interface IAnonymousCheckoutAddProductResponse {
115
+ checkout: ICheckoutPrepare | null;
116
+ unavailableItems: IAnonymousCheckoutUnavailableItem[];
117
+ }
97
118
  export interface ICheckoutAmounts {
98
119
  subtotal: number;
99
120
  engraving: number;
@@ -0,0 +1,5 @@
1
+ export * from './address.interface';
2
+ export * from './cart.interface';
3
+ export * from './checkout.interface';
4
+ export * from './product.interface';
5
+ export * from './product-list.interface';
@@ -8,6 +8,12 @@ export interface IProductAvailabilityResponse {
8
8
  products: IProduct[];
9
9
  retailers: Record<string, IRetailer>;
10
10
  }
11
+ export interface IProductPriceInfo {
12
+ currency: string;
13
+ minimum: number;
14
+ average: number;
15
+ maximum: number;
16
+ }
11
17
  export interface IProductVariant {
12
18
  retailerId: string;
13
19
  shippingFulfillmentId: string;
@@ -64,7 +70,7 @@ export interface IProduct {
64
70
  type: string;
65
71
  subType: string;
66
72
  salsifyGrouping: string;
67
- noAvailabilityPrice: number;
73
+ priceInfo: IProductPriceInfo | null;
68
74
  sizes: Record<string, IProductSize>;
69
75
  }
70
76
  export interface IFulfillment {
@@ -11,6 +11,7 @@ export interface ILiquidCommerceElementsDevelopmentConfig {
11
11
  customApiUrl?: string;
12
12
  paymentMethodId?: string;
13
13
  openShadowDom?: boolean;
14
+ mockMode?: boolean;
14
15
  }
15
16
  export interface IClientCustomThemeConfig {
16
17
  global?: UpdateComponentGlobalConfigs;
@@ -21,7 +22,7 @@ export interface IClientCustomThemeConfig {
21
22
  productList?: UpdateProductListComponent;
22
23
  }
23
24
  export interface ILiquidCommerceElementsCheckoutConfig {
24
- pageUrl: string;
25
+ pageUrl?: string;
25
26
  }
26
27
  export interface ILiquidCommerceElementsBaseConfig {
27
28
  env?: ElementsEnv;
@@ -29,18 +30,12 @@ export interface ILiquidCommerceElementsBaseConfig {
29
30
  customTheme?: IClientCustomThemeConfig;
30
31
  debugMode?: DebugMode;
31
32
  checkout?: ILiquidCommerceElementsCheckoutConfig;
33
+ proxy?: IElementsProxyConfig;
34
+ development?: ILiquidCommerceElementsDevelopmentConfig;
32
35
  }
33
36
  export interface ILiquidCommerceElementsBuilderConfig extends ILiquidCommerceElementsBaseConfig {
34
37
  }
35
38
  export interface ILiquidCommerceElementsConfig extends ILiquidCommerceElementsBaseConfig {
36
- proxy?: IElementsProxyConfig;
37
- development?: ILiquidCommerceElementsDevelopmentConfig;
38
39
  }
39
- export interface ILiquidCommerceElementsCheckoutClientConfig {
40
- env?: ElementsEnv;
41
- customTheme?: IClientCustomThemeConfig;
42
- debugMode?: DebugMode;
43
- checkout?: ILiquidCommerceElementsCheckoutConfig;
44
- proxy?: IElementsProxyConfig;
45
- development?: ILiquidCommerceElementsDevelopmentConfig;
40
+ export interface ILiquidCommerceElementsCheckoutClientConfig extends ILiquidCommerceElementsBaseConfig {
46
41
  }
@@ -39,4 +39,9 @@ export interface IProductListComponent {
39
39
  theme: IProductListTheme;
40
40
  layout: IProductListLayout;
41
41
  }
42
- export type UpdateProductListComponent = DeepPartial<IProductListComponent>;
42
+ export interface UpdateProductListComponent {
43
+ theme?: DeepPartial<IProductListTheme>;
44
+ layout?: {
45
+ lists?: Record<string, DeepPartial<IPLCList>>;
46
+ };
47
+ }
@@ -1,7 +1,7 @@
1
1
  import { BaseCommand } from '@/core/command/base-command.service';
2
2
  import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
3
3
  import type { ICheckoutPaymentMethodStore } from '@/core/store/interfaces/checkout.interface';
4
- import type { ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient } from '@/interfaces/api/checkout.interface';
4
+ import type { ICheckoutBilling, ICheckoutCustomer, ICheckoutGiftRecipient, ICheckoutPrepare } from '@/interfaces/api/checkout.interface';
5
5
  import type { AddItemParams } from '@/modules/cart/cart.commands';
6
6
  import type { PresaleExpiredReason } from '@/modules/checkout/components';
7
7
  export declare class CheckoutCommands extends BaseCommand {
@@ -14,6 +14,7 @@ export declare class CheckoutCommands extends BaseCommand {
14
14
  cartId?: string;
15
15
  isForPresale?: boolean;
16
16
  }): Promise<void>;
17
+ loadCheckoutFromResponse(response: ICheckoutPrepare): void;
17
18
  toggleIsGift(active?: boolean): Promise<void>;
18
19
  toggleBillingSameAsShipping(active?: boolean): Promise<void>;
19
20
  toggleMarketingPreferences(fieldName: 'canEmail' | 'canSms', active?: boolean): Promise<void>;
@@ -19,5 +19,4 @@ export declare class ThemeProviderService {
19
19
  getComponentConfig(componentType: ComponentType): ConfigsType | undefined;
20
20
  getStylesheet(componentType: ComponentType): GeneratedStylesheet[];
21
21
  private getBaseStylesheets;
22
- private deepMerge;
23
22
  }
@@ -29,7 +29,7 @@ Use data attributes to configure the product list:
29
29
  ></script>
30
30
 
31
31
  <div
32
- data-liquid-commerce-elements-products-list
32
+ data-liquid-commerce-elements-products-list="my-collection-slug"
33
33
  data-rows="3"
34
34
  data-columns="4"
35
35
  data-filters="price,brand,category"
@@ -38,7 +38,7 @@ Use data attributes to configure the product list:
38
38
  ```
39
39
 
40
40
  **Attributes:**
41
- - `data-liquid-commerce-elements-products-list`: Marks element as product list container
41
+ - `data-liquid-commerce-elements-products-list`: Product list container; value is the collection slug
42
42
  - `data-rows`: Number of rows to display (default: 3)
43
43
  - `data-columns`: Number of columns (default: 4)
44
44
  - `data-filters`: Comma-separated filter types
@@ -52,14 +52,14 @@ Separate containers for search and filters:
52
52
 
53
53
  ```html
54
54
  <!-- Search container -->
55
- <div data-search-container></div>
55
+ <div data-liquid-commerce-elements-products-list-search="my-collection-slug"></div>
56
56
 
57
57
  <!-- Filters container -->
58
- <div data-filters-container data-filters="price,brand,fulfillment"></div>
58
+ <div data-liquid-commerce-elements-products-list-filters="my-collection-slug" data-filters="price,brand,fulfillment"></div>
59
59
 
60
60
  <!-- Product list -->
61
61
  <div
62
- data-liquid-commerce-elements-products-list
62
+ data-liquid-commerce-elements-products-list="my-collection-slug"
63
63
  data-rows="4"
64
64
  data-columns="3"
65
65
  data-product-url="/products/{identifier}"
@@ -343,18 +343,18 @@ const client = await Elements('YOUR_API_KEY', {
343
343
  <h1>Whiskey Collection</h1>
344
344
 
345
345
  <!-- Search -->
346
- <div data-search-container></div>
347
-
346
+ <div data-liquid-commerce-elements-products-list-search="whiskey-collection"></div>
347
+
348
348
  <div class="catalog">
349
349
  <!-- Filters sidebar -->
350
350
  <aside>
351
- <div data-filters-container data-filters="price,brand,size"></div>
351
+ <div data-liquid-commerce-elements-products-list-filters="whiskey-collection" data-filters="price,brand,size"></div>
352
352
  </aside>
353
-
353
+
354
354
  <!-- Product grid -->
355
355
  <main>
356
356
  <div
357
- data-liquid-commerce-elements-products-list
357
+ data-liquid-commerce-elements-products-list="whiskey-collection"
358
358
  data-rows="4"
359
359
  data-columns="3"
360
360
  data-product-url="/whiskey/{identifier}"
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LiquidCommerce Elements SDK",
4
4
  "license": "UNLICENSED",
5
5
  "author": "LiquidCommerce Team",
6
- "version": "2.7.6",
6
+ "version": "2.7.7",
7
7
  "homepage": "https://docs.liquidcommerce.co/elements-sdk",
8
8
  "repository": {
9
9
  "type": "git",
@@ -81,9 +81,9 @@
81
81
  "embeddable commerce"
82
82
  ],
83
83
  "devDependencies": {
84
- "@biomejs/biome": "^2.4.2",
85
- "@commitlint/cli": "^20.4.1",
86
- "@commitlint/config-conventional": "^20.4.1",
84
+ "@biomejs/biome": "^2.4.4",
85
+ "@commitlint/cli": "^20.4.2",
86
+ "@commitlint/config-conventional": "^20.4.2",
87
87
  "@rollup/plugin-alias": "^6.0.0",
88
88
  "@rollup/plugin-commonjs": "^29.0.0",
89
89
  "@rollup/plugin-json": "^6.1.0",
@@ -97,11 +97,11 @@
97
97
  "@semantic-release/npm": "^13.1.4",
98
98
  "@semantic-release/release-notes-generator": "^14.1.0",
99
99
  "@types/core-js": "^2.5.8",
100
- "@types/node": "^25.2.3",
100
+ "@types/node": "^25.3.0",
101
101
  "conventional-changelog-cli": "^5.0.0",
102
102
  "husky": "^9.1.7",
103
103
  "process": "^0.11.10",
104
- "rollup": "^4.57.1",
104
+ "rollup": "^4.59.0",
105
105
  "rollup-obfuscator": "^4.1.1",
106
106
  "rollup-plugin-typescript2": "^0.36.0",
107
107
  "semantic-release": "^25.0.3",