@liquidcommerce/elements-sdk 2.6.0-beta.1 → 2.6.0-beta.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 (71) hide show
  1. package/README.md +1 -0
  2. package/dist/index.esm.js +10477 -10038
  3. package/dist/types/constants/core.constant.d.ts +11 -0
  4. package/dist/types/core/api/api-client.service.d.ts +11 -11
  5. package/dist/types/core/api/auth-client.service.d.ts +3 -14
  6. package/dist/types/core/client/client-action.service.d.ts +18 -11
  7. package/dist/types/core/client/client-config.service.d.ts +1 -0
  8. package/dist/types/core/command/base-command.service.d.ts +2 -2
  9. package/dist/types/core/command/common-command.service.d.ts +2 -1
  10. package/dist/types/core/google-tag-manager.service.d.ts +12 -10
  11. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -12
  12. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +26 -63
  13. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +11 -1
  14. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -81
  15. package/dist/types/core/store/interfaces/address.interface.d.ts +3 -12
  16. package/dist/types/core/store/interfaces/cart.interface.d.ts +16 -54
  17. package/dist/types/core/store/interfaces/checkout.interface.d.ts +2 -2
  18. package/dist/types/core/store/interfaces/core.interface.d.ts +5 -4
  19. package/dist/types/core/store/interfaces/product.interface.d.ts +12 -66
  20. package/dist/types/core/store/store.constant.d.ts +1 -1
  21. package/dist/types/core/telemetry/telemetry.interface.d.ts +0 -1
  22. package/dist/types/elements-base-client.d.ts +1 -1
  23. package/dist/types/enums/cloud.enum.d.ts +20 -0
  24. package/dist/types/enums/core.enum.d.ts +1 -0
  25. package/dist/types/interfaces/api/address.interface.d.ts +28 -0
  26. package/dist/types/interfaces/api/cart.interface.d.ts +91 -0
  27. package/dist/types/interfaces/api/product-list.interface.d.ts +30 -0
  28. package/dist/types/interfaces/api/product.interface.d.ts +106 -0
  29. package/dist/types/interfaces/cloud/checkout.interface.d.ts +14 -10
  30. package/dist/types/interfaces/cloud/index.d.ts +0 -4
  31. package/dist/types/interfaces/cloud/retailer.interface.d.ts +2 -2
  32. package/dist/types/interfaces/configs/configurations.interface.d.ts +5 -5
  33. package/dist/types/interfaces/configs/global.interface.d.ts +1 -0
  34. package/dist/types/interfaces/configs/product.interface.d.ts +1 -0
  35. package/dist/types/modules/address/address.command.d.ts +2 -3
  36. package/dist/types/modules/address/address.interface.d.ts +0 -7
  37. package/dist/types/modules/cart/cart.commands.d.ts +0 -1
  38. package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
  39. package/dist/types/modules/cart/components/cart-footer.component.d.ts +0 -1
  40. package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +0 -2
  41. package/dist/types/modules/product/components/components.d.ts +2 -4
  42. package/dist/types/modules/product/product.commands.d.ts +2 -2
  43. package/dist/types/modules/product-list/components/index.d.ts +2 -0
  44. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +3 -2
  45. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +6 -0
  46. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +1 -0
  47. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts +7 -0
  48. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +16 -0
  49. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-price-filter.components.d.ts +22 -0
  50. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +16 -0
  51. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +18 -0
  52. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +27 -5
  53. package/dist/types/modules/product-list/product-list.commands.d.ts +3 -2
  54. package/dist/types/modules/product-list/product-list.component.d.ts +13 -5
  55. package/dist/types/modules/product-list/product-list.interface.d.ts +77 -0
  56. package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +0 -1
  57. package/dist/types/static/icon/chevron-up.icon.d.ts +2 -0
  58. package/dist/types/static/icon/filter.icon.d.ts +2 -0
  59. package/dist/types/static/icon/index.d.ts +1 -0
  60. package/dist/types/utils/helper.d.ts +2 -1
  61. package/docs/THEMING.md +3 -0
  62. package/package.json +4 -5
  63. package/umd/elements.js +1 -1
  64. package/dist/types/interfaces/cloud/address.interface.d.ts +0 -36
  65. package/dist/types/interfaces/cloud/cart.interface.d.ts +0 -132
  66. package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -43
  67. package/dist/types/interfaces/cloud/product.interface.d.ts +0 -158
  68. package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -9
  69. package/dist/types/modules/product/utils/helpers.d.ts +0 -3
  70. package/dist/types/modules/product/utils/retailer-hours.d.ts +0 -9
  71. package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +0 -7
@@ -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,10 @@
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 { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
5
+ import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
6
+ import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
7
+ import type { ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
4
8
  import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
5
9
  import type { IAllConfigs } from '@/interfaces/configs';
6
10
  export declare class ApiClientService {
@@ -13,18 +17,14 @@ export declare class ApiClientService {
13
17
  setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
14
18
  getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
15
19
  deletePersistedStore(userDeviceId: string): Promise<void>;
16
- getProductsData(identifier: string[], location?: ILoc): Promise<IProductData | null>;
17
- getCartData(id: string | null): Promise<ICart>;
18
- updateCart(params: ICartUpdateParams & {
19
- loc?: ILoc;
20
- }): Promise<ICart>;
21
- getAddressSuggestions(query: string): Promise<IAddressAutocompleteResult[]>;
20
+ getAddressSuggestions(input: string): Promise<IAddressAutocompleteResult[]>;
22
21
  getAddressDetails(id: string): Promise<IAddressDetailsResult>;
22
+ getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse | null>;
23
+ catalogSearch(params: IProductSearchParams): Promise<IProductSearchResponse>;
24
+ getCartData(id: string | null): Promise<ICart>;
25
+ updateCart(params: ICartUpdateParams): Promise<ICart>;
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,22 +2,19 @@ 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';
7
- export interface IProductActions {
8
- getDetails: (identifier: string) => IBaseProductEventData;
5
+ import type { IAddressAddress, IAddressCoordinates, IAddressData } from '@/interfaces/api/address.interface';
6
+ import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
7
+ export interface IAddProductParams {
8
+ identifier: string;
9
+ fulfillmentType: FulfillmentType;
10
+ quantity: number;
9
11
  }
10
12
  export interface IAddressActions {
11
13
  setAddressByPlacesId: (placesId: string) => Promise<void>;
12
- setAddressManually: (address: Omit<IAddress, 'id'>, coordinates: ICoords) => Promise<void>;
14
+ setAddressManually: (address: IAddressAddress, coordinates: IAddressCoordinates) => Promise<void>;
13
15
  clear: () => Promise<void>;
14
16
  getDetails: () => IAddressData | null;
15
17
  }
16
- export interface IAddProductParams {
17
- identifier: string;
18
- fulfillmentType: FulfillmentType;
19
- quantity: number;
20
- }
21
18
  export interface ICartActions {
22
19
  openCart: () => void;
23
20
  closeCart: () => void;
@@ -40,9 +37,15 @@ export interface ICheckoutActions {
40
37
  removeGiftCard: (code: string) => Promise<void>;
41
38
  toggleIsGift: (active?: boolean) => Promise<void>;
42
39
  toggleBillingSameAsShipping: (active?: boolean) => Promise<void>;
43
- toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => void;
40
+ toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => Promise<void>;
41
+ updateCustomerInfo: (params: Record<CustomerFieldName, string>) => void;
42
+ updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
43
+ updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
44
44
  getDetails: () => ICheckoutDetailsEventData;
45
45
  }
46
+ export interface IProductActions {
47
+ getDetails: (identifier: string) => IBaseProductEventData;
48
+ }
46
49
  export declare class ClientActionService {
47
50
  private readonly pubSub;
48
51
  private readonly command;
@@ -50,6 +53,9 @@ export declare class ClientActionService {
50
53
  private readonly api;
51
54
  private readonly themeProvider;
52
55
  private readonly logger;
56
+ private readonly allowedCustomerFields;
57
+ private readonly allowedBillingFields;
58
+ private readonly allowedGiftFields;
53
59
  private pendingCartParams;
54
60
  private pendingCartOpenFlag;
55
61
  constructor();
@@ -58,6 +64,7 @@ export declare class ClientActionService {
58
64
  private retryPendingCartOperation;
59
65
  private clearPendingCartOperation;
60
66
  private getLocation;
67
+ private normalizeCheckoutFieldValue;
61
68
  private productActions;
62
69
  private addressActions;
63
70
  private cartActions;
@@ -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
  }
@@ -1,7 +1,8 @@
1
- import type { ICart } from '@/interfaces/cloud';
1
+ import type { ICart } from '@/interfaces/api/cart.interface';
2
2
  import { BaseCommand } from './base-command.service';
3
3
  export declare class CommonCommands extends BaseCommand {
4
4
  static getInstance(): CommonCommands;
5
5
  syncCartFromResponse(cartApi: ICart, publishEvent?: boolean): void;
6
+ private buildCartLoadedEventData;
6
7
  loadCart(): Promise<void>;
7
8
  }
@@ -6,10 +6,11 @@ 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
+ partnerCode: string;
10
+ partnerGTMId?: string;
11
+ enablePartnerGTM: boolean;
12
+ enableLiquidCommerceGTM: boolean;
13
+ liquidCommerceGTMId: string;
13
14
  }
14
15
  interface BaseItem {
15
16
  item_id?: string;
@@ -47,10 +48,11 @@ interface PurchaseData {
47
48
  }
48
49
  export declare class GoogleTagManagerService {
49
50
  private partnerName?;
50
- private partnerGtmId?;
51
- private liquidCommerceGtmId?;
52
- private partnerEnableGaTracking;
53
- private liquidCommerceEnableGaTracking;
51
+ private partnerCode?;
52
+ private partnerGTMId?;
53
+ private liquidCommerceGTMId?;
54
+ private enablePartnerGTM;
55
+ private enableLiquidCommerceGTM;
54
56
  private isInitialized;
55
57
  private isInitializing;
56
58
  private initializationPromise?;
@@ -108,8 +110,8 @@ export declare class GoogleTagManagerService {
108
110
  country?: string;
109
111
  };
110
112
  coordinates?: {
111
- lat: number;
112
- long: number;
113
+ latitude: number;
114
+ longitude: number;
113
115
  };
114
116
  }): void;
115
117
  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,67 +1,23 @@
1
- import type { ICartItemAttributes } from '@/interfaces/cloud';
2
- export interface ICartItemEventData {
3
- id: string;
4
- variantId: string;
5
- liquidId: string;
6
- retailerId: string;
7
- partNumber: string;
8
- fulfillmentId: string;
9
- upc: string;
10
- sku: string;
11
- salsifyGrouping: string;
12
- catPath: string;
13
- volume: string;
14
- uom: string;
15
- pack: boolean;
16
- packDesc: string;
17
- container: string;
18
- containerType: string;
19
- name: string;
20
- brand: string;
21
- size: string;
22
- price: number;
23
- quantity: number;
24
- maxQuantity: number;
25
- unitPrice: number;
26
- mainImage: string;
27
- attributes: ICartItemAttributes;
28
- }
1
+ import type { IAddressAddress, IAddressCoordinates } from '@/interfaces/api/address.interface';
2
+ import type { ICartItem, ICartRetailer } from '@/interfaces/api/cart.interface';
29
3
  export interface IBaseCartEventData {
30
- id: string | null;
31
- promoCode: string;
32
- items: Record<string, ICartItemEventData>;
4
+ cartId: string;
5
+ promoCodeDiscount: number | null;
6
+ subtotal: number;
7
+ itemCount: number;
8
+ items: Record<string, ICartItem>;
9
+ retailers: Record<string, ICartRetailer>;
33
10
  location: {
34
11
  placesId: string;
35
- address: {
36
- one: string;
37
- two: string;
38
- city: string;
39
- state: string;
40
- zip: string;
41
- country: string;
42
- };
43
- coordinates: {
44
- latitude: number;
45
- longitude: number;
46
- };
47
- };
48
- amounts: {
49
- deliveryFee: number;
50
- discounts: number;
51
- engravingFee: number;
52
- giftCardTotal: number;
53
- platformFee: number;
54
- shippingFee: number;
55
- subtotal: number;
56
- total: number;
57
- };
58
- itemCount: number;
59
- updatedAt: string;
60
- createdAt: string;
12
+ formattedAddress: string;
13
+ address: IAddressAddress;
14
+ coordinates: IAddressCoordinates;
15
+ } | null;
61
16
  }
62
17
  export interface ICartLoadedEventData extends IBaseCartEventData {
63
18
  }
64
19
  export interface ICartFailedEventData {
20
+ cartId: string;
65
21
  message: string;
66
22
  }
67
23
  export interface ICartUpdatedEventData {
@@ -69,38 +25,45 @@ export interface ICartUpdatedEventData {
69
25
  current: IBaseCartEventData;
70
26
  }
71
27
  export interface ICartItemAddedEventData {
72
- id: string;
73
- upc: string;
28
+ cartId: string;
29
+ itemId: string;
74
30
  fulfillmentId: string;
75
31
  partNumber: string;
76
32
  quantity: number;
77
33
  engravingLines?: string[];
78
34
  }
79
35
  export interface ICartItemRemovedEventData {
80
- id: string;
36
+ cartId: string;
37
+ itemId: string;
81
38
  }
82
39
  export interface ICartItemQuantityChangedEventData {
83
- id: string;
40
+ cartId: string;
41
+ itemId: string;
84
42
  quantity: number;
85
43
  previousQuantity: number;
86
44
  }
87
45
  export interface ICartItemEngravingUpdatedEventData {
88
- id: string;
46
+ cartId: string;
47
+ itemId: string;
89
48
  engravingLines: string[];
90
49
  previousEngravingLines: string[];
91
50
  }
92
51
  export interface ICartPromoCodeEventData {
52
+ cartId: string;
93
53
  discountAmount?: number;
94
- newTotal?: number;
54
+ newSubtotal?: number;
95
55
  }
96
56
  export interface ICartPromoCodeFailedEventData {
57
+ cartId: string;
97
58
  error: string;
98
59
  }
99
60
  export interface ICartProductAddEventData {
61
+ cartId: string;
100
62
  itemsAdded: number;
101
63
  identifiers: string[];
102
64
  }
103
65
  export interface ICartProductAddFailedEventData {
66
+ cartId: string;
104
67
  identifiers: string[];
105
68
  error: string;
106
69
  }
@@ -1,4 +1,5 @@
1
- import type { ICartItemAttributes, ICheckoutTotalAmounts } from '@/interfaces/cloud';
1
+ import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
2
+ import type { ICheckoutTotalAmounts } from '@/interfaces/cloud';
2
3
  export interface IBaseCheckoutEventData {
3
4
  cartId: string;
4
5
  }
@@ -31,37 +32,46 @@ export interface ICheckoutSubmitFailedEventData {
31
32
  message: string;
32
33
  }
33
34
  export interface ICheckoutItemQuantityChangedEventData {
35
+ cartId: string;
34
36
  cartItemId: string;
35
37
  quantity: number;
36
38
  previousQuantity: number;
37
39
  }
38
40
  export interface ICheckoutItemRemovedEventData {
41
+ cartId: string;
39
42
  cartItemId: string;
40
43
  }
41
44
  export interface ICheckoutItemEngravingUpdatedEventData {
45
+ cartId: string;
42
46
  cartItemId: string;
43
47
  engravingLines: string[];
44
48
  previousEngravingLines: string[];
45
49
  }
46
50
  export interface ICheckoutPromoCodeEventData {
51
+ cartId: string;
47
52
  discountAmount?: number;
48
53
  newTotal?: number;
49
54
  }
50
55
  export interface ICheckoutPromoCodeFailedEventData {
56
+ cartId: string;
51
57
  error: string;
52
58
  }
53
59
  export interface ICheckoutGiftCardEventData {
60
+ cartId: string;
54
61
  newTotal?: number;
55
62
  }
56
63
  export interface ICheckoutGiftCardFailedEventData {
64
+ cartId: string;
57
65
  error: string;
58
66
  }
59
67
  export interface ICheckoutProductAddEventData {
68
+ cartId: string;
60
69
  itemsAdded: number;
61
70
  identifiers: string[];
62
71
  isPresale?: boolean;
63
72
  }
64
73
  export interface ICheckoutProductAddFailedEventData {
74
+ cartId: string;
65
75
  identifiers: string[];
66
76
  error: string;
67
77
  isPresale?: boolean;
@@ -1,87 +1,23 @@
1
1
  import type { FulfillmentType } from '@/enums';
2
- import type { IAddress, ICoords } from '@/interfaces/cloud';
3
- export interface IBaseProductFulfillmentEventData {
4
- price: number;
5
- partNumber: string;
6
- stock: number;
7
- isEngravable: boolean;
8
- fulfillmentId: string;
9
- fulfillmentType: FulfillmentType;
10
- modalities: FulfillmentType[];
11
- retailerId: string;
2
+ import type { IFulfillment, IProduct, IProductSize, IProductVariant, IRetailerAddress } from '@/interfaces/api/product.interface';
3
+ export type IProductFulfillmentEventData = IFulfillment & {
12
4
  retailerName: string;
13
- retailerAddress: (IAddress & ICoords) | null;
14
- retailerTimezone: string;
15
- }
16
- export interface IBaseProductSizeAttributesEventData {
17
- engraving?: {
18
- status: boolean;
19
- maxLines: number;
20
- maxCharsPerLine: number;
21
- fee: number;
22
- location: string;
23
- };
24
- presale?: {
25
- canPurchaseOn: null | string;
26
- estimatedShipBy: null | string;
27
- isActive: boolean;
28
- language: string;
29
- presaleLimit: number;
30
- price: number;
31
- };
32
- }
33
- export interface IBaseProductSizeEventData {
34
- id: string;
35
- upc: string;
36
- size: string;
37
- pack: boolean;
38
- packDesc: string;
39
- container: string;
40
- containerType: string;
41
- maxQuantityPerOrder: number;
42
- image: string;
43
- uom: string;
44
- volume: string;
45
- attributes: IBaseProductSizeAttributesEventData;
46
- shippingFulfillments: Record<string, IBaseProductFulfillmentEventData>;
47
- onDemandFulfillments: Record<string, IBaseProductFulfillmentEventData>;
48
- }
49
- export interface IBaseProductEventData {
5
+ retailerAddress: IRetailerAddress;
6
+ retailerAddressFormatted: string;
7
+ variant: IProductVariant;
8
+ };
9
+ export interface IProductSizeEventData extends Omit<IProductSize, 'shippingVariants' | 'onDemandVariants'> {
10
+ onDemandFulfillments: Record<string, IProductFulfillmentEventData>;
11
+ shippingFulfillments: Record<string, IProductFulfillmentEventData>;
12
+ }
13
+ export interface IBaseProductEventData extends Omit<IProduct, 'sizes'> {
50
14
  identifier: string;
51
15
  selectedSizeId: string | null;
52
- selectedFulfillmentId: string | null;
53
16
  selectedFulfillmentType: FulfillmentType;
54
- id: string;
55
- name: string;
56
- brand: string;
57
- catPath: string;
58
- category: string;
59
- classification: string;
60
- type: string;
61
- salsifyGrouping: string;
62
- subType: string;
63
- mainImage: string | null;
64
- images: string[];
65
- region: string;
66
- country: string;
67
- material: string;
68
- abv: string;
69
- proof: string;
70
- age: string;
71
- color: string;
72
- flavor: string;
73
- variety: string;
74
- appellation: string;
75
- vintage: string;
76
- description: string;
77
- htmlDescription: string;
78
- tastingNotes: string;
79
- priceInfo: {
80
- min: number;
81
- max: number;
82
- avg: number;
83
- } | null;
84
- sizes: Record<string, IBaseProductSizeEventData>;
17
+ selectedFulfillmentId: string | null;
18
+ productHasAvailability: boolean;
19
+ fulfillmentHasAvailability: boolean;
20
+ sizes: Record<string, IProductSizeEventData>;
85
21
  }
86
22
  export interface IProductLoadedEventData extends IBaseProductEventData {
87
23
  }
@@ -92,7 +28,6 @@ export interface IProductQuantityChangedEventData {
92
28
  }
93
29
  export interface IProductAddToCartEventData {
94
30
  identifier: string;
95
- upc: string;
96
31
  fulfillmentId: string;
97
32
  partNumber: string;
98
33
  quantity: number;
@@ -101,7 +36,7 @@ export interface IProductAddToCartEventData {
101
36
  export interface IProductSizeChangedEventData {
102
37
  identifier: string;
103
38
  selectedSizeId: string;
104
- size: string;
39
+ selectedSize: string;
105
40
  previousSizeId: string;
106
41
  previousSize: string;
107
42
  }
@@ -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,5 @@
1
1
  import type { IElementsCartEvent } from 'utils/helper';
2
- import type { FulfillmentType } from '@/enums';
3
- import type { IAddress, ICartItemAttributes, IRetailerExpectation, IRetailerFees } from '@/interfaces/cloud';
2
+ import type { ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
4
3
  export interface ICartItemStore {
5
4
  id: string;
6
5
  variantId: string;
@@ -31,64 +30,27 @@ export interface ICartItemStore {
31
30
  updating: boolean;
32
31
  error: string | null;
33
32
  }
34
- export interface ICartTotalsStore {
35
- subtotal: number;
36
- total: number;
37
- shippingFee: number;
38
- platformFee: number;
39
- giftCardTotal: number;
40
- engravingFee: number;
41
- deliveryFee: number;
42
- discounts: number;
43
- quantity: number;
33
+ export interface ICartFulfillmentStore extends ICartFulfillment {
34
+ loading: boolean;
35
+ error: string | null;
36
+ updating: boolean;
44
37
  }
45
- export interface IRetailerFulfillmentStore {
46
- id: string;
47
- canEngrave: boolean;
48
- type: FulfillmentType;
49
- fees: IRetailerFees;
50
- expectation: IRetailerExpectation;
51
- shippingFee: number;
52
- subtotal: number;
53
- items: string[];
54
- engravingFee: number;
55
- deliveryFee: number;
56
- retailerId: string;
57
- loading?: boolean;
58
- error?: string | null;
59
- updating?: boolean;
38
+ export interface ICartRetailerStore extends ICartRetailer {
39
+ loading: boolean;
40
+ error: string | null;
41
+ updating: boolean;
60
42
  }
61
- export interface IRetailerStore {
43
+ export interface ICartStore {
62
44
  id: string;
63
- name: string;
64
- platformFee: number;
65
- shippingFee: number;
66
45
  subtotal: number;
67
- address?: IAddress;
68
- deliveryFee: number;
69
- engravingFee: number;
70
- total: number;
71
- fulfillments: string[];
72
- loading?: boolean;
73
- error?: string | null;
74
- updating?: boolean;
75
- }
76
- export interface ICartPromoCodeStore {
77
- code: string;
78
- discountAmount: number;
79
- }
80
- export interface ICartStore {
81
- id: string | null;
46
+ itemsQuantity: number;
47
+ items: Record<string, ICartItemStore>;
48
+ fulfillments: Record<string, ICartFulfillmentStore>;
49
+ retailers: Record<string, ICartRetailerStore>;
50
+ promoCode: ICartPromoCode | null;
51
+ events: IElementsCartEvent[];
82
52
  loading: boolean;
83
53
  error: string | null;
84
- items: Record<string, ICartItemStore>;
85
- totals: ICartTotalsStore;
86
- retailers: Record<string, IRetailerStore>;
87
- promoCode: ICartPromoCodeStore | null;
88
- fulfillments: Record<string, IRetailerFulfillmentStore>;
89
54
  rerender: boolean;
90
55
  shouldReset: boolean;
91
- updatedAt: string;
92
- createdAt: string;
93
- events: IElementsCartEvent[];
94
56
  }