@liquidcommerce/elements-sdk 2.6.0-beta.2 → 2.6.0-beta.4

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 (52) hide show
  1. package/dist/index.esm.js +10877 -10037
  2. package/dist/types/constants/core.constant.d.ts +11 -0
  3. package/dist/types/core/api/api-client.service.d.ts +9 -9
  4. package/dist/types/core/api/auth-client.service.d.ts +3 -14
  5. package/dist/types/core/client/client-action.service.d.ts +7 -4
  6. package/dist/types/core/client/client-config.service.d.ts +1 -0
  7. package/dist/types/core/command/base-command.service.d.ts +2 -2
  8. package/dist/types/core/google-tag-manager.service.d.ts +10 -10
  9. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -12
  10. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +3 -9
  11. package/dist/types/core/store/interfaces/address.interface.d.ts +3 -12
  12. package/dist/types/core/store/interfaces/cart.interface.d.ts +3 -2
  13. package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
  14. package/dist/types/core/store/interfaces/product.interface.d.ts +11 -66
  15. package/dist/types/core/store/store.constant.d.ts +1 -1
  16. package/dist/types/core/telemetry/telemetry.interface.d.ts +0 -1
  17. package/dist/types/enums/cloud.enum.d.ts +326 -0
  18. package/dist/types/enums/core.enum.d.ts +1 -0
  19. package/dist/types/interfaces/api/address.interface.d.ts +28 -0
  20. package/dist/types/interfaces/api/product.interface.d.ts +107 -0
  21. package/dist/types/interfaces/cloud/cart.interface.d.ts +4 -4
  22. package/dist/types/interfaces/cloud/catalog.interface.d.ts +3 -3
  23. package/dist/types/interfaces/cloud/checkout.interface.d.ts +5 -8
  24. package/dist/types/interfaces/cloud/index.d.ts +0 -2
  25. package/dist/types/interfaces/cloud/retailer.interface.d.ts +2 -2
  26. package/dist/types/interfaces/configs/configurations.interface.d.ts +5 -5
  27. package/dist/types/modules/address/address.command.d.ts +2 -3
  28. package/dist/types/modules/address/address.interface.d.ts +0 -7
  29. package/dist/types/modules/product/components/components.d.ts +2 -4
  30. package/dist/types/modules/product/product.commands.d.ts +2 -2
  31. package/dist/types/modules/product-list/components/index.d.ts +2 -0
  32. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +2 -1
  33. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +6 -0
  34. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +1 -0
  35. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts +7 -0
  36. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +16 -0
  37. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-price-filter.components.d.ts +22 -0
  38. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +16 -0
  39. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +18 -0
  40. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +27 -5
  41. package/dist/types/modules/product-list/product-list.commands.d.ts +2 -1
  42. package/dist/types/modules/product-list/product-list.component.d.ts +14 -5
  43. package/dist/types/modules/product-list/product-list.interface.d.ts +80 -0
  44. package/dist/types/static/icon/chevron-up.icon.d.ts +2 -0
  45. package/dist/types/static/icon/filter.icon.d.ts +2 -0
  46. package/dist/types/static/icon/index.d.ts +1 -0
  47. package/package.json +2 -3
  48. package/umd/elements.js +1 -1
  49. package/dist/types/interfaces/cloud/address.interface.d.ts +0 -36
  50. package/dist/types/interfaces/cloud/product.interface.d.ts +0 -158
  51. package/dist/types/modules/product/utils/helpers.d.ts +0 -3
  52. package/dist/types/modules/product/utils/retailer-hours.d.ts +0 -9
@@ -10,6 +10,17 @@ export declare const PRODUCT_LIST_FILTER_TYPES: {
10
10
  PERSONALIZATION: string;
11
11
  PRE_ORDER: string;
12
12
  DELIVERY_OPTIONS: string;
13
+ PRICE: string;
14
+ BRANDS: string;
15
+ CATEGORIES: string;
16
+ FLAVOR: string;
17
+ REGION: string;
18
+ VARIETY: string;
19
+ VINTAGE: string;
20
+ COUNTRY: string;
21
+ APPELLATION: string;
22
+ MATERIALS: string;
23
+ SIZES: string;
13
24
  };
14
25
  export declare const Z_INDEX: {
15
26
  readonly DRAWER_WRAPPER: 2147483640;
@@ -1,6 +1,8 @@
1
1
  import type { AuthClientService } from '@/core/api/auth-client.service';
2
2
  import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
3
- import type { IAddressAutocompleteResult, IAddressDetailsResult, ICart, ICartUpdateParams, ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken, ILoc, IProductData } from '@/interfaces/cloud';
3
+ import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
4
+ import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
5
+ import type { ICart, ICartUpdateParams, ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
4
6
  import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
5
7
  import type { IAllConfigs } from '@/interfaces/configs';
6
8
  export declare class ApiClientService {
@@ -13,18 +15,16 @@ export declare class ApiClientService {
13
15
  setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
14
16
  getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
15
17
  deletePersistedStore(userDeviceId: string): Promise<void>;
16
- getProductsData(identifier: string[], location?: ILoc): Promise<IProductData | null>;
18
+ getAddressSuggestions(input: string): Promise<IAddressAutocompleteResult[]>;
19
+ getAddressDetails(id: string): Promise<IAddressDetailsResult>;
20
+ getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse | null>;
21
+ catalogSearch(params: ICatalogParams): Promise<ICatalog>;
17
22
  getCartData(id: string | null): Promise<ICart>;
18
23
  updateCart(params: ICartUpdateParams & {
19
- loc?: ILoc;
24
+ loc?: ILocation;
20
25
  }): Promise<ICart>;
21
- getAddressSuggestions(query: string): Promise<IAddressAutocompleteResult[]>;
22
- getAddressDetails(id: string): Promise<IAddressDetailsResult>;
23
26
  prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
24
27
  getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
25
28
  confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ILiquidPaymentToken>;
26
- checkoutComplete(params: Partial<ICheckoutCompleteParams>): Promise<ICheckoutCompleteResponse['order']>;
27
- catalogSearch(params: ICatalogParams): Promise<ICatalog>;
28
- private validResponseData;
29
- private ensureClientInitialized;
29
+ checkoutComplete(params: Partial<ICheckoutCompleteParams>): Promise<ICheckoutCompleteResponse>;
30
30
  }
@@ -13,22 +13,13 @@ export interface IAuth {
13
13
  exp: number;
14
14
  type: 'ACCESS_TOKEN';
15
15
  }
16
- export interface IResponseMetadata {
17
- languages: string[];
18
- timestamp: number;
19
- timezone: string;
20
- requestId: string;
21
- path: string;
22
- version: string;
23
- }
24
16
  export interface IApiResponseBase {
25
- statusCode: number;
26
17
  message: string;
27
- metadata: IResponseMetadata;
28
18
  }
29
- export type IApiResponseWithData<T> = IApiResponseBase & {
19
+ export interface IApiResponse<T> {
20
+ message: string;
30
21
  data: T;
31
- };
22
+ }
32
23
  export declare class AuthClientService {
33
24
  private readonly apiKey;
34
25
  private readonly baseUrl;
@@ -48,6 +39,4 @@ export declare class AuthClientService {
48
39
  private getProxyHeaders;
49
40
  get<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
50
41
  post<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
51
- put<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
52
- delete<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
53
42
  }
@@ -2,14 +2,14 @@ import type { IBaseCartEventData } from '@/core/pubsub/interfaces/cart.interface
2
2
  import type { ICheckoutDetailsEventData } from '@/core/pubsub/interfaces/checkout.interface';
3
3
  import type { IBaseProductEventData } from '@/core/pubsub/interfaces/product.interface';
4
4
  import { type FulfillmentType } from '@/enums';
5
- import type { IAddress, ICoords } from '@/interfaces/cloud';
6
- import type { IAddressData } from '@/modules/address/address.interface';
5
+ import type { IAddressAddress, IAddressCoordinates, IAddressData } from '@/interfaces/api/address.interface';
6
+ import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
7
7
  export interface IProductActions {
8
8
  getDetails: (identifier: string) => IBaseProductEventData;
9
9
  }
10
10
  export interface IAddressActions {
11
11
  setAddressByPlacesId: (placesId: string) => Promise<void>;
12
- setAddressManually: (address: Omit<IAddress, 'id'>, coordinates: ICoords) => Promise<void>;
12
+ setAddressManually: (address: IAddressAddress, coordinates: IAddressCoordinates) => Promise<void>;
13
13
  clear: () => Promise<void>;
14
14
  getDetails: () => IAddressData | null;
15
15
  }
@@ -40,7 +40,10 @@ export interface ICheckoutActions {
40
40
  removeGiftCard: (code: string) => Promise<void>;
41
41
  toggleIsGift: (active?: boolean) => Promise<void>;
42
42
  toggleBillingSameAsShipping: (active?: boolean) => Promise<void>;
43
- toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => void;
43
+ toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => Promise<void>;
44
+ updateCustomerInfo: (params: Record<CustomerFieldName, string>) => void;
45
+ updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
46
+ updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
44
47
  getDetails: () => ICheckoutDetailsEventData;
45
48
  }
46
49
  export declare class ClientActionService {
@@ -21,6 +21,7 @@ export interface IClientConfigs {
21
21
  promoTicker: IPromoTicker[] | null;
22
22
  paymentMethodId?: string;
23
23
  openShadowDom?: boolean;
24
+ hasCustomApiUrl?: boolean;
24
25
  }
25
26
  export interface IClientConfigInput {
26
27
  env?: ElementsEnv;
@@ -4,7 +4,7 @@ import { GoogleTagManagerService } from '@/core/google-tag-manager.service';
4
4
  import { LoggerFactory } from '@/core/logger/logger-factory';
5
5
  import { PubSubService } from '@/core/pubsub/pubsub.service';
6
6
  import { StoreService } from '@/core/store/store.service';
7
- import type { ILoc } from '@/interfaces/cloud';
7
+ import type { ILocation } from '@/interfaces/api/address.interface';
8
8
  import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
9
9
  export declare abstract class BaseCommand {
10
10
  protected store: StoreService;
@@ -15,5 +15,5 @@ export declare abstract class BaseCommand {
15
15
  protected clientConfig: ClientConfigService;
16
16
  protected themeProvider: ThemeProviderService;
17
17
  constructor();
18
- protected getLocation(): ILoc | undefined;
18
+ protected getLocation(): ILocation | undefined;
19
19
  }
@@ -6,10 +6,10 @@ declare global {
6
6
  }
7
7
  interface GTMConfig {
8
8
  partnerName: string;
9
- partnerGtmId?: string;
10
- partnerEnableGaTracking: boolean;
11
- liquidCommerceEnableGaTracking: boolean;
12
- liquidCommerceGtmId: string;
9
+ partnerGTMId?: string;
10
+ enablePartnerGTM: boolean;
11
+ enableLiquidCommerceGTM: boolean;
12
+ liquidCommerceGTMId: string;
13
13
  }
14
14
  interface BaseItem {
15
15
  item_id?: string;
@@ -47,10 +47,10 @@ interface PurchaseData {
47
47
  }
48
48
  export declare class GoogleTagManagerService {
49
49
  private partnerName?;
50
- private partnerGtmId?;
51
- private liquidCommerceGtmId?;
52
- private partnerEnableGaTracking;
53
- private liquidCommerceEnableGaTracking;
50
+ private partnerGTMId?;
51
+ private liquidCommerceGTMId?;
52
+ private enablePartnerGTM;
53
+ private enableLiquidCommerceGTM;
54
54
  private isInitialized;
55
55
  private isInitializing;
56
56
  private initializationPromise?;
@@ -108,8 +108,8 @@ export declare class GoogleTagManagerService {
108
108
  country?: string;
109
109
  };
110
110
  coordinates?: {
111
- lat: number;
112
- long: number;
111
+ latitude: number;
112
+ longitude: number;
113
113
  };
114
114
  }): void;
115
115
  addressFailed(errorData: {
@@ -1,16 +1,7 @@
1
+ import type { IAddressAddress, IAddressCoordinates } from '@/interfaces/api/address.interface';
1
2
  export interface IAddressActionEventData {
2
3
  googlePlacesId: string;
3
4
  formattedAddress: string;
4
- address: {
5
- one: string;
6
- two: string;
7
- city: string;
8
- state: string;
9
- zip: string;
10
- country: string;
11
- };
12
- coordinates: {
13
- lat: number;
14
- long: number;
15
- };
5
+ address: IAddressAddress;
6
+ coordinates: IAddressCoordinates;
16
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { FulfillmentType } from '@/enums';
2
- import type { IAddress, ICoords } from '@/interfaces/cloud';
2
+ import type { IAddressAddress, IAddressCoordinates } from '@/interfaces/api/address.interface';
3
3
  export interface IBaseProductFulfillmentEventData {
4
4
  price: number;
5
5
  partNumber: string;
@@ -7,10 +7,9 @@ export interface IBaseProductFulfillmentEventData {
7
7
  isEngravable: boolean;
8
8
  fulfillmentId: string;
9
9
  fulfillmentType: FulfillmentType;
10
- modalities: FulfillmentType[];
11
10
  retailerId: string;
12
11
  retailerName: string;
13
- retailerAddress: (IAddress & ICoords) | null;
12
+ retailerAddress: (IAddressAddress & IAddressCoordinates) | null;
14
13
  retailerTimezone: string;
15
14
  }
16
15
  export interface IBaseProductSizeAttributesEventData {
@@ -60,7 +59,6 @@ export interface IBaseProductEventData {
60
59
  type: string;
61
60
  salsifyGrouping: string;
62
61
  subType: string;
63
- mainImage: string | null;
64
62
  images: string[];
65
63
  region: string;
66
64
  country: string;
@@ -76,11 +74,7 @@ export interface IBaseProductEventData {
76
74
  description: string;
77
75
  htmlDescription: string;
78
76
  tastingNotes: string;
79
- priceInfo: {
80
- min: number;
81
- max: number;
82
- avg: number;
83
- } | null;
77
+ noAvailabilityPrice: number;
84
78
  sizes: Record<string, IBaseProductSizeEventData>;
85
79
  }
86
80
  export interface IProductLoadedEventData extends IBaseProductEventData {
@@ -1,16 +1,7 @@
1
+ import type { IAddressAddress, IAddressCoordinates } from '@/interfaces/api/address.interface';
1
2
  export interface IAddressStore {
2
3
  id: string;
3
4
  formattedAddress: string;
4
- address: {
5
- one: string;
6
- two: string;
7
- city: string;
8
- state: string;
9
- zip: string;
10
- country: string;
11
- };
12
- coordinates: {
13
- lat: number;
14
- long: number;
15
- };
5
+ address: IAddressAddress;
6
+ coordinates: IAddressCoordinates;
16
7
  }
@@ -1,6 +1,7 @@
1
1
  import type { IElementsCartEvent } from 'utils/helper';
2
2
  import type { FulfillmentType } from '@/enums';
3
- import type { IAddress, ICartItemAttributes, IRetailerExpectation, IRetailerFees } from '@/interfaces/cloud';
3
+ import type { IAddressAddress } from '@/interfaces/api/address.interface';
4
+ import type { ICartItemAttributes, IRetailerExpectation, IRetailerFees } from '@/interfaces/cloud';
4
5
  export interface ICartItemStore {
5
6
  id: string;
6
7
  variantId: string;
@@ -64,7 +65,7 @@ export interface IRetailerStore {
64
65
  platformFee: number;
65
66
  shippingFee: number;
66
67
  subtotal: number;
67
- address?: IAddress;
68
+ address?: IAddressAddress;
68
69
  deliveryFee: number;
69
70
  engravingFee: number;
70
71
  total: number;
@@ -15,11 +15,11 @@ export interface IUIStore {
15
15
  drawer: IDrawerStore;
16
16
  }
17
17
  export interface IGlobalStore {
18
- cart: ICartStore;
19
18
  address: IAddressStore;
19
+ products: Record<string, IProductStore>;
20
+ cart: ICartStore;
20
21
  checkout: ICheckoutStore;
21
22
  ui: IUIStore;
22
- products: Record<string, IProductStore>;
23
23
  }
24
24
  export interface IPersistedStore {
25
25
  p?: string;
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType, FulfillmentType } from '@/enums';
2
- import type { IAddress, ICoords, IProductSizeAttributes, IRetailerExpectation, IRetailerFees, RetailerHours } from '@/interfaces/cloud';
2
+ import type { IFulfillment, IProduct, IProductSize, IProductVariant, IRetailerAddress } from '@/interfaces/api/product.interface';
3
3
  export interface IProductDrawerContentConfig {
4
4
  type: ComponentType;
5
5
  data?: Record<string, any>;
@@ -8,85 +8,30 @@ export interface IProductDrawerStore {
8
8
  isOpen: boolean;
9
9
  contentConfig: IProductDrawerContentConfig | null;
10
10
  }
11
- export interface IProductFulfillmentStore {
12
- isVariantEngravable: boolean;
13
- stock: number;
14
- price: number;
15
- retailerId: string;
16
- partNumber: string;
17
- fulfillmentId: string;
18
- fulfillmentType: FulfillmentType;
19
- modalities: FulfillmentType[];
11
+ export type IProductFulfillmentStore = IProductVariant & IFulfillment & {
20
12
  retailerName: string;
21
- retailerAddress: (IAddress & ICoords) | null;
22
- type: FulfillmentType;
23
- timezone: string;
24
- canEngrave: boolean;
25
- expectation: IRetailerExpectation;
26
- fees: IRetailerFees;
27
- hours: RetailerHours;
28
- }
29
- export interface IProductSizeStore {
30
- id: string;
31
- upc: string;
32
- size: string;
33
- pack: boolean;
34
- packDesc: string | null;
35
- container: string;
36
- containerType: string;
37
- maxQuantityPerOrder: number;
38
- image: string;
39
- uom: string;
40
- volume: string;
41
- attributes: IProductSizeAttributes;
13
+ retailerAddress: IRetailerAddress;
14
+ retailerAddressFormatted: string;
15
+ };
16
+ export interface IProductSizeStore extends Omit<IProductSize, 'shippingVariants' | 'onDemandVariants'> {
42
17
  onDemandFulfillments: Record<string, IProductFulfillmentStore>;
43
18
  shippingFulfillments: Record<string, IProductFulfillmentStore>;
44
19
  loading: boolean;
45
20
  error: string | null;
46
21
  }
47
- export interface IProductStore {
22
+ export interface IProductStore extends Omit<IProduct, 'sizes'> {
48
23
  identifier: string;
49
- id: string;
50
- name: string;
51
- brand: string;
52
- catPath: string;
53
- category: string;
54
- classification: string;
55
- type: string;
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;
74
- priceInfo?: {
75
- min: number;
76
- max: number;
77
- avg: number;
78
- };
79
- quantity: number;
80
24
  sizes: Record<string, IProductSizeStore>;
81
- productHasAvailability: boolean;
25
+ quantity: number;
82
26
  selectedSizeId: string | null;
83
27
  selectedFulfillmentType: FulfillmentType;
84
28
  selectedFulfillmentId: string | null;
85
29
  selectedFulfillment: IProductFulfillmentStore | null;
30
+ productHasAvailability: boolean;
86
31
  fulfillmentHasAvailability: boolean;
32
+ drawer: IProductDrawerStore;
87
33
  loading: boolean;
88
34
  updating: boolean;
89
- error: string | null;
90
- drawer: IProductDrawerStore;
91
35
  rerender: boolean;
36
+ error: string | null;
92
37
  }
@@ -4,9 +4,9 @@ import type { ICheckoutStore } from '@/core/store/interfaces/checkout.interface'
4
4
  import type { IGlobalStore, IUIStore } from '@/core/store/interfaces/core.interface';
5
5
  import type { IProductStore } from '@/core/store/interfaces/product.interface';
6
6
  export declare const LOCAL_STORAGE_PREFIX = "lce";
7
+ export declare const initialAddressState: IAddressStore;
7
8
  export declare const initialProductState: IProductStore;
8
9
  export declare const initialCartState: ICartStore;
9
10
  export declare const initialCheckoutState: ICheckoutStore;
10
11
  export declare const initialUIState: IUIStore;
11
- export declare const initialAddressState: IAddressStore;
12
12
  export declare const initialStoreState: IGlobalStore;
@@ -37,7 +37,6 @@ export interface ITelemetryError {
37
37
  message: string;
38
38
  stack?: string;
39
39
  code?: string | number;
40
- statusCode?: number;
41
40
  }
42
41
  export interface ITelemetrySDKContext {
43
42
  version: string;