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

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 (88) hide show
  1. package/README.md +7 -7
  2. package/dist/index.esm.js +11630 -11155
  3. package/dist/types/constants/core.constant.d.ts +11 -0
  4. package/dist/types/core/api/api-client.service.d.ts +15 -15
  5. package/dist/types/core/api/auth-client.service.d.ts +34 -23
  6. package/dist/types/core/api/http-client.service.d.ts +0 -1
  7. package/dist/types/core/client/client-action.service.d.ts +18 -12
  8. package/dist/types/core/client/client-config.service.d.ts +3 -0
  9. package/dist/types/core/command/base-command.service.d.ts +2 -2
  10. package/dist/types/core/command/common-command.service.d.ts +2 -1
  11. package/dist/types/core/google-tag-manager.service.d.ts +14 -11
  12. package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -12
  13. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +27 -64
  14. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +44 -50
  15. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +5 -4
  16. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -81
  17. package/dist/types/core/store/interfaces/address.interface.d.ts +3 -12
  18. package/dist/types/core/store/interfaces/cart.interface.d.ts +16 -55
  19. package/dist/types/core/store/interfaces/checkout.interface.d.ts +16 -107
  20. package/dist/types/core/store/interfaces/core.interface.d.ts +7 -5
  21. package/dist/types/core/store/interfaces/product.interface.d.ts +12 -66
  22. package/dist/types/core/store/store.constant.d.ts +1 -1
  23. package/dist/types/core/telemetry/telemetry.interface.d.ts +0 -1
  24. package/dist/types/elements-base-client.d.ts +1 -1
  25. package/dist/types/enums/cloud.enum.d.ts +19 -76
  26. package/dist/types/enums/core.enum.d.ts +25 -0
  27. package/dist/types/interfaces/api/address.interface.d.ts +28 -0
  28. package/dist/types/interfaces/api/cart.interface.d.ts +95 -0
  29. package/dist/types/interfaces/api/checkout.interface.d.ts +213 -0
  30. package/dist/types/interfaces/api/product-list.interface.d.ts +30 -0
  31. package/dist/types/interfaces/api/product.interface.d.ts +106 -0
  32. package/dist/types/interfaces/configs/configurations.interface.d.ts +5 -5
  33. package/dist/types/interfaces/configs/product.interface.d.ts +1 -0
  34. package/dist/types/interfaces/core.interface.d.ts +7 -1
  35. package/dist/types/modules/address/address.command.d.ts +3 -3
  36. package/dist/types/modules/address/address.interface.d.ts +0 -7
  37. package/dist/types/modules/cart/cart.commands.d.ts +4 -5
  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/checkout/checkout.commands.d.ts +18 -9
  42. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +2 -2
  43. package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
  44. package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +14 -1
  45. package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
  46. package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +2 -2
  47. package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
  48. package/dist/types/modules/checkout/constant.d.ts +3 -0
  49. package/dist/types/modules/product/components/components.d.ts +2 -4
  50. package/dist/types/modules/product/product.commands.d.ts +3 -2
  51. package/dist/types/modules/product-list/components/index.d.ts +2 -0
  52. package/dist/types/modules/product-list/components/product-list-card.component.d.ts +3 -2
  53. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +6 -0
  54. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +1 -0
  55. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts +7 -0
  56. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +16 -0
  57. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-price-filter.components.d.ts +22 -0
  58. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +16 -0
  59. package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +18 -0
  60. package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +27 -5
  61. package/dist/types/modules/product-list/product-list.commands.d.ts +4 -2
  62. package/dist/types/modules/product-list/product-list.component.d.ts +13 -5
  63. package/dist/types/modules/product-list/product-list.interface.d.ts +77 -0
  64. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -0
  65. package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +0 -1
  66. package/dist/types/static/icon/chevron-up.icon.d.ts +2 -0
  67. package/dist/types/static/icon/filter.icon.d.ts +2 -0
  68. package/dist/types/static/icon/index.d.ts +1 -0
  69. package/dist/types/utils/format.d.ts +0 -13
  70. package/docs/ACTIONS.md +13 -13
  71. package/docs/EVENTS.md +7 -7
  72. package/package.json +8 -9
  73. package/umd/elements.js +1 -1
  74. package/dist/types/interfaces/cloud/address.interface.d.ts +0 -36
  75. package/dist/types/interfaces/cloud/cart.interface.d.ts +0 -132
  76. package/dist/types/interfaces/cloud/catalog.interface.d.ts +0 -43
  77. package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -214
  78. package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
  79. package/dist/types/interfaces/cloud/index.d.ts +0 -7
  80. package/dist/types/interfaces/cloud/product.interface.d.ts +0 -158
  81. package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
  82. package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
  83. package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -9
  84. package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
  85. package/dist/types/modules/product/utils/helpers.d.ts +0 -3
  86. package/dist/types/modules/product/utils/retailer-hours.d.ts +0 -9
  87. package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +0 -7
  88. package/dist/types/utils/helper.d.ts +0 -27
@@ -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,7 +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';
4
- import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
3
+ import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
4
+ import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
5
+ import type { ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
6
+ import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
7
+ import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
5
8
  import type { IAllConfigs } from '@/interfaces/configs';
6
9
  export declare class ApiClientService {
7
10
  private client;
@@ -13,18 +16,15 @@ export declare class ApiClientService {
13
16
  setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
14
17
  getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
15
18
  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[]>;
19
+ getAddressSuggestions(input: string): Promise<IAddressAutocompleteResult[]>;
22
20
  getAddressDetails(id: string): Promise<IAddressDetailsResult>;
23
- prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
24
- getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
25
- 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;
21
+ getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse | null>;
22
+ catalogSearch(params: IProductSearchParams): Promise<IProductSearchResponse>;
23
+ getCartData(id: string | null): Promise<ICart>;
24
+ updateCart(params: ICartUpdateParams): Promise<ICart>;
25
+ prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepare>;
26
+ updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ICheckoutItemsUpdateResponse>;
27
+ getPaymentSession(cartId: string): Promise<ICheckoutPaymentSession>;
28
+ confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ICheckoutPaymentConfirm>;
29
+ checkoutComplete(token: string): Promise<ICheckoutComplete>;
30
30
  }
@@ -1,4 +1,5 @@
1
1
  import type { ElementsEnv } from '@/enums';
2
+ import type { IAllConfigs } from '@/interfaces/configs/global.interface';
2
3
  export interface IAuthConfig {
3
4
  apiKey: string;
4
5
  env: ElementsEnv;
@@ -9,45 +10,55 @@ export interface IHttpRequestOptions {
9
10
  body?: any;
10
11
  }
11
12
  export interface IAuth {
12
- token: string;
13
- exp: number;
14
- type: 'ACCESS_TOKEN';
15
- }
16
- export interface IResponseMetadata {
17
- languages: string[];
18
- timestamp: number;
19
- timezone: string;
20
- requestId: string;
21
- path: string;
22
- version: string;
13
+ accessToken: string;
14
+ expiration: number;
23
15
  }
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
+ }
23
+ export interface IAuthWithConfigs {
24
+ auth: IAuth;
25
+ configs: IAllConfigs;
26
+ }
32
27
  export declare class AuthClientService {
28
+ private static readonly TOKEN_EXPIRATION_BUFFER_MS;
29
+ private static readonly MAX_RETRIES;
30
+ private static readonly RETRY_DELAY_MS;
33
31
  private readonly apiKey;
34
32
  private readonly baseUrl;
35
33
  private readonly env;
36
- private accessToken;
37
- private tokenExpiration;
38
- private isAuthenticating;
39
34
  private readonly httpClient;
40
35
  private readonly logger;
41
36
  private readonly clientConfig;
37
+ private accessToken;
38
+ private tokenExpiration;
39
+ private authPromise;
40
+ private refreshPromise;
42
41
  private constructor();
43
42
  static getInstance(config: IAuthConfig): AuthClientService;
43
+ authenticateAndGetConfigs(): Promise<{
44
+ success: boolean;
45
+ configs?: IAllConfigs;
46
+ }>;
44
47
  authenticate(): Promise<boolean>;
45
- isTokenExpired(): boolean;
48
+ refreshToken(): Promise<boolean>;
49
+ get<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
50
+ post<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
51
+ private performAuthentication;
52
+ private performTokenRefresh;
46
53
  private request;
54
+ private handleSuccessResponse;
55
+ private handleAuthError;
56
+ private handleErrorResponse;
57
+ private isTokenExpired;
58
+ private clearToken;
47
59
  private buildUrl;
60
+ private buildHeaders;
48
61
  private getProxyHeaders;
49
- get<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
50
- 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>;
62
+ private isAuthError;
63
+ private shouldRetryNonAuth;
53
64
  }
@@ -37,7 +37,6 @@ export declare class HttpClientService {
37
37
  private logNetworkError;
38
38
  private diagnosePossibleCauses;
39
39
  private enhanceError;
40
- private sanitizeHeaders;
41
40
  private delay;
42
41
  private getFetchImplementation;
43
42
  private fetchAdapter;
@@ -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/constant';
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;
@@ -33,16 +30,21 @@ export interface ICheckoutActions {
33
30
  closeCheckout: () => void;
34
31
  toggleCheckout: () => void;
35
32
  addProduct: (params: IAddProductParams[], openCheckout?: boolean) => Promise<void>;
36
- addPresaleProduct: (params: IAddProductParams) => Promise<void>;
37
33
  applyPromoCode: (promoCode: string) => Promise<void>;
38
34
  removePromoCode: () => Promise<void>;
39
35
  applyGiftCard: (code: string) => Promise<void>;
40
36
  removeGiftCard: (code: string) => Promise<void>;
41
37
  toggleIsGift: (active?: boolean) => Promise<void>;
42
38
  toggleBillingSameAsShipping: (active?: boolean) => Promise<void>;
43
- toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => void;
39
+ toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => Promise<void>;
40
+ updateCustomerInfo: (params: Record<CustomerFieldName, string>) => void;
41
+ updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
42
+ updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
44
43
  getDetails: () => ICheckoutDetailsEventData;
45
44
  }
45
+ export interface IProductActions {
46
+ getDetails: (identifier: string) => IBaseProductEventData;
47
+ }
46
48
  export declare class ClientActionService {
47
49
  private readonly pubSub;
48
50
  private readonly command;
@@ -50,6 +52,9 @@ export declare class ClientActionService {
50
52
  private readonly api;
51
53
  private readonly themeProvider;
52
54
  private readonly logger;
55
+ private readonly allowedCustomerFields;
56
+ private readonly allowedBillingFields;
57
+ private readonly allowedGiftFields;
53
58
  private pendingCartParams;
54
59
  private pendingCartOpenFlag;
55
60
  constructor();
@@ -58,6 +63,7 @@ export declare class ClientActionService {
58
63
  private retryPendingCartOperation;
59
64
  private clearPendingCartOperation;
60
65
  private getLocation;
66
+ private normalizeCheckoutFieldValue;
61
67
  private productActions;
62
68
  private addressActions;
63
69
  private cartActions;
@@ -21,6 +21,8 @@ export interface IClientConfigs {
21
21
  promoTicker: IPromoTicker[] | null;
22
22
  paymentMethodId?: string;
23
23
  openShadowDom?: boolean;
24
+ hasCustomApiUrl?: boolean;
25
+ checkoutUrl: string | null;
24
26
  }
25
27
  export interface IClientConfigInput {
26
28
  env?: ElementsEnv;
@@ -34,6 +36,7 @@ export interface IClientConfigInput {
34
36
  paymentMethodId?: string;
35
37
  openShadowDom?: boolean;
36
38
  };
39
+ checkoutUrl?: string;
37
40
  }
38
41
  export declare class ClientConfigService {
39
42
  private config;
@@ -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;
@@ -32,6 +33,7 @@ interface BaseItem {
32
33
  quantity?: number;
33
34
  item_type?: string;
34
35
  item_subtype?: string;
36
+ item_image?: string;
35
37
  upc?: string;
36
38
  grouping_id?: string;
37
39
  product_id?: string;
@@ -47,10 +49,11 @@ interface PurchaseData {
47
49
  }
48
50
  export declare class GoogleTagManagerService {
49
51
  private partnerName?;
50
- private partnerGtmId?;
51
- private liquidCommerceGtmId?;
52
- private partnerEnableGaTracking;
53
- private liquidCommerceEnableGaTracking;
52
+ private partnerCode?;
53
+ private partnerGTMId?;
54
+ private liquidCommerceGTMId?;
55
+ private enablePartnerGTM;
56
+ private enableLiquidCommerceGTM;
54
57
  private isInitialized;
55
58
  private isInitializing;
56
59
  private initializationPromise?;
@@ -91,7 +94,7 @@ export declare class GoogleTagManagerService {
91
94
  net_total?: number;
92
95
  }): void;
93
96
  promoCodeAttempt(code: string): void;
94
- promoCodeApplied(code: string, discountAmount?: number): void;
97
+ promoCodeApplied(code: string, discount?: number): void;
95
98
  promoCodeFailed(code: string, reason?: string): void;
96
99
  giftCardAttempt(code: string): void;
97
100
  giftCardApplied(code: string, appliedAmount?: number): void;
@@ -108,8 +111,8 @@ export declare class GoogleTagManagerService {
108
111
  country?: string;
109
112
  };
110
113
  coordinates?: {
111
- lat: number;
112
- long: number;
114
+ latitude: number;
115
+ longitude: number;
113
116
  };
114
117
  }): void;
115
118
  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 {
93
- discountAmount?: number;
94
- newTotal?: number;
52
+ cartId: string;
53
+ discount?: 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,24 +1,55 @@
1
- import type { ICartItemAttributes, ICheckoutTotalAmounts } from '@/interfaces/cloud';
1
+ import type { ICheckoutAmounts, ICheckoutItem } from '@/interfaces/api/checkout.interface';
2
2
  export interface IBaseCheckoutEventData {
3
3
  cartId: string;
4
+ isGift: boolean;
5
+ billingSameAsShipping: boolean;
6
+ marketingPreferences: {
7
+ canEmail: boolean;
8
+ canSms: boolean;
9
+ };
10
+ hasPromoCode: boolean;
11
+ hasGiftCards: boolean;
12
+ amounts: ICheckoutAmounts;
13
+ itemCount: number;
14
+ items: Record<string, ICheckoutItem>;
4
15
  }
5
16
  export interface ICheckoutLoadedEventData extends IBaseCheckoutEventData {
6
17
  }
18
+ export interface ICheckoutDetailsEventData extends IBaseCheckoutEventData {
19
+ }
20
+ export interface ICheckoutCustomerInformationUpdatedEventData {
21
+ cartId: string;
22
+ }
23
+ export interface ICheckoutGiftInformationUpdatedEventData {
24
+ cartId: string;
25
+ }
26
+ export interface ICheckoutBillingInformationUpdatedEventData {
27
+ cartId: string;
28
+ }
7
29
  export interface ICheckoutTipUpdatedEventData {
30
+ cartId: string;
8
31
  deliveryTips: Array<{
9
- fulfillmentId?: string;
10
- tipAmount?: number;
32
+ fulfillmentId: string;
33
+ tip: number;
34
+ }>;
35
+ previousDeliveryTips: Array<{
36
+ fulfillmentId: string;
37
+ tip: number;
11
38
  }>;
12
39
  }
13
40
  export interface ICheckoutFailedEventData {
14
41
  message: string;
15
42
  }
16
43
  export interface ICheckoutToggleEventData {
44
+ cartId: string;
17
45
  isActive: boolean;
46
+ previousIsActive: boolean;
18
47
  }
19
48
  export interface ICheckoutMarketingPreferencesToggleEventData {
49
+ cartId: string;
20
50
  fieldName: 'canEmail' | 'canSms';
21
51
  isActive: boolean;
52
+ previousIsActive: boolean;
22
53
  }
23
54
  export interface ICheckoutSubmitStartedEventData {
24
55
  started: boolean;
@@ -31,84 +62,47 @@ export interface ICheckoutSubmitFailedEventData {
31
62
  message: string;
32
63
  }
33
64
  export interface ICheckoutItemQuantityChangedEventData {
65
+ cartId: string;
34
66
  cartItemId: string;
35
67
  quantity: number;
36
68
  previousQuantity: number;
37
69
  }
38
70
  export interface ICheckoutItemRemovedEventData {
71
+ cartId: string;
39
72
  cartItemId: string;
40
73
  }
41
74
  export interface ICheckoutItemEngravingUpdatedEventData {
75
+ cartId: string;
42
76
  cartItemId: string;
43
77
  engravingLines: string[];
44
78
  previousEngravingLines: string[];
45
79
  }
46
80
  export interface ICheckoutPromoCodeEventData {
47
- discountAmount?: number;
81
+ cartId: string;
82
+ discount?: number;
48
83
  newTotal?: number;
49
84
  }
50
85
  export interface ICheckoutPromoCodeFailedEventData {
86
+ cartId: string;
51
87
  error: string;
52
88
  }
53
89
  export interface ICheckoutGiftCardEventData {
90
+ cartId: string;
54
91
  newTotal?: number;
55
92
  }
56
93
  export interface ICheckoutGiftCardFailedEventData {
94
+ cartId: string;
57
95
  error: string;
58
96
  }
59
97
  export interface ICheckoutProductAddEventData {
98
+ cartId: string;
60
99
  itemsAdded: number;
61
100
  identifiers: string[];
62
101
  isPresale?: boolean;
63
102
  }
64
103
  export interface ICheckoutProductAddFailedEventData {
104
+ cartId: string;
65
105
  identifiers: string[];
66
106
  error: string;
67
107
  isPresale?: boolean;
68
108
  }
69
- export interface ICheckoutItemEventData {
70
- liquidId: string;
71
- variantId: string;
72
- cartItemId: string;
73
- retailerId: string;
74
- fulfillmentId: string;
75
- salsifyGrouping: string;
76
- name: string;
77
- catPath: string;
78
- volume: string;
79
- uom: string;
80
- proof: string;
81
- abv: string;
82
- containerType: string;
83
- container: string;
84
- size: string;
85
- pack: boolean;
86
- packDesc: string;
87
- mainImage: string;
88
- brand: string;
89
- partNumber: string;
90
- upc: string;
91
- sku: string;
92
- price: number;
93
- unitPrice: number;
94
- quantity: number;
95
- unitTax: number;
96
- bottleDeposits: number;
97
- attributes: ICartItemAttributes;
98
- retailerName: string;
99
- expectationDetail: string;
100
- }
101
- export interface ICheckoutDetailsEventData {
102
- cartId: string;
103
- isGift: boolean;
104
- billingSameAsShipping: boolean;
105
- marketingPreferences: {
106
- canEmail: boolean;
107
- canSms: boolean;
108
- };
109
- hasPromoCode: boolean;
110
- hasGiftCards: boolean;
111
- amounts: ICheckoutTotalAmounts;
112
- itemCount: number;
113
- items: Record<string, ICheckoutItemEventData>;
114
- }
@@ -1,6 +1,6 @@
1
1
  import type { IAddressActionEventData } from '@/core/pubsub/interfaces/address.interface';
2
2
  import type { ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartUpdatedEventData } from '@/core/pubsub/interfaces/cart.interface';
3
- import type { ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData } from '@/core/pubsub/interfaces/checkout.interface';
3
+ import type { ICheckoutBillingInformationUpdatedEventData, ICheckoutCustomerInformationUpdatedEventData, ICheckoutFailedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutGiftInformationUpdatedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData } from '@/core/pubsub/interfaces/checkout.interface';
4
4
  import type { IProductAddToCartEventData, IProductFulfillmentChangedEventData, IProductFulfillmentTypeChangedEventData, IProductLoadedEventData, IProductQuantityChangedEventData, IProductSizeChangedEventData } from '@/core/pubsub/interfaces/product.interface';
5
5
  import { ELEMENTS_ACTIONS_EVENT } from '@/enums';
6
6
  export interface IElementsClientIsReadyEventData {
@@ -49,6 +49,7 @@ export interface IElementsActionsEventsMap {
49
49
  [ELEMENTS_ACTIONS_EVENT.CART_PROMO_CODE_FAILED]: ICartPromoCodeFailedEventData;
50
50
  [ELEMENTS_ACTIONS_EVENT.CART_PRODUCT_ADD_SUCCESS]: ICartProductAddEventData;
51
51
  [ELEMENTS_ACTIONS_EVENT.CART_PRODUCT_ADD_FAILED]: ICartProductAddFailedEventData;
52
+ [ELEMENTS_ACTIONS_EVENT.INTERNAL_CART_TO_CHECKOUT]: object;
52
53
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_OPENED]: boolean;
53
54
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_CLOSED]: boolean;
54
55
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_LOADED]: ICheckoutLoadedEventData;
@@ -56,9 +57,9 @@ export interface IElementsActionsEventsMap {
56
57
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_IS_GIFT_TOGGLED]: ICheckoutToggleEventData;
57
58
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED]: ICheckoutToggleEventData;
58
59
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_MARKETING_PREFERENCES_TOGGLED]: ICheckoutMarketingPreferencesToggleEventData;
59
- [ELEMENTS_ACTIONS_EVENT.CHECKOUT_CUSTOMER_INFORMATION_UPDATED]: boolean;
60
- [ELEMENTS_ACTIONS_EVENT.CHECKOUT_GIFT_INFORMATION_UPDATED]: boolean;
61
- [ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_INFORMATION_UPDATED]: boolean;
60
+ [ELEMENTS_ACTIONS_EVENT.CHECKOUT_CUSTOMER_INFORMATION_UPDATED]: ICheckoutCustomerInformationUpdatedEventData;
61
+ [ELEMENTS_ACTIONS_EVENT.CHECKOUT_GIFT_INFORMATION_UPDATED]: ICheckoutGiftInformationUpdatedEventData;
62
+ [ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_INFORMATION_UPDATED]: ICheckoutBillingInformationUpdatedEventData;
62
63
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_REMOVED]: ICheckoutItemRemovedEventData;
63
64
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_QUANTITY_INCREASE]: ICheckoutItemQuantityChangedEventData;
64
65
  [ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_QUANTITY_DECREASE]: ICheckoutItemQuantityChangedEventData;