@liquidcommerce/elements-sdk 2.6.0-beta.6 → 2.6.0-beta.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,8 +1,9 @@
1
1
  import type { AuthClientService } from '@/core/api/auth-client.service';
2
2
  import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
3
3
  import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
4
+ import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
4
5
  import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
5
- import type { ICart, ICartUpdateParams, ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
6
+ import type { ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
6
7
  import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
7
8
  import type { IAllConfigs } from '@/interfaces/configs';
8
9
  export declare class ApiClientService {
@@ -20,9 +21,7 @@ export declare class ApiClientService {
20
21
  getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse | null>;
21
22
  catalogSearch(params: ICatalogParams): Promise<ICatalog>;
22
23
  getCartData(id: string | null): Promise<ICart>;
23
- updateCart(params: ICartUpdateParams & {
24
- loc?: ILocation;
25
- }): Promise<ICart>;
24
+ updateCart(params: ICartUpdateParams): Promise<ICart>;
26
25
  prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
27
26
  getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
28
27
  confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ILiquidPaymentToken>;
@@ -1,4 +1,4 @@
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;
@@ -6,6 +6,7 @@ declare global {
6
6
  }
7
7
  interface GTMConfig {
8
8
  partnerName: string;
9
+ partnerCode: string;
9
10
  partnerGTMId?: string;
10
11
  enablePartnerGTM: boolean;
11
12
  enableLiquidCommerceGTM: boolean;
@@ -47,6 +48,7 @@ interface PurchaseData {
47
48
  }
48
49
  export declare class GoogleTagManagerService {
49
50
  private partnerName?;
51
+ private partnerCode?;
50
52
  private partnerGTMId?;
51
53
  private liquidCommerceGTMId?;
52
54
  private enablePartnerGTM;
@@ -1,4 +1,4 @@
1
- import type { ICartItemAttributes } from '@/interfaces/cloud';
1
+ import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
2
2
  export interface ICartItemEventData {
3
3
  id: string;
4
4
  variantId: string;
@@ -45,19 +45,8 @@ export interface IBaseCartEventData {
45
45
  longitude: number;
46
46
  };
47
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
- };
48
+ subtotal: number;
58
49
  itemCount: number;
59
- updatedAt: string;
60
- createdAt: string;
61
50
  }
62
51
  export interface ICartLoadedEventData extends IBaseCartEventData {
63
52
  }
@@ -70,7 +59,6 @@ export interface ICartUpdatedEventData {
70
59
  }
71
60
  export interface ICartItemAddedEventData {
72
61
  id: string;
73
- upc: string;
74
62
  fulfillmentId: string;
75
63
  partNumber: string;
76
64
  quantity: number;
@@ -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
  }
@@ -86,7 +86,6 @@ export interface IProductQuantityChangedEventData {
86
86
  }
87
87
  export interface IProductAddToCartEventData {
88
88
  identifier: string;
89
- upc: string;
90
89
  fulfillmentId: string;
91
90
  partNumber: string;
92
91
  quantity: number;
@@ -1,7 +1,5 @@
1
1
  import type { IElementsCartEvent } from 'utils/helper';
2
- import type { FulfillmentType } from '@/enums';
3
- import type { IAddressAddress } from '@/interfaces/api/address.interface';
4
- import type { ICartItemAttributes, IRetailerExpectation, IRetailerFees } from '@/interfaces/cloud';
2
+ import type { ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
5
3
  export interface ICartItemStore {
6
4
  id: string;
7
5
  variantId: string;
@@ -32,64 +30,27 @@ export interface ICartItemStore {
32
30
  updating: boolean;
33
31
  error: string | null;
34
32
  }
35
- export interface ICartTotalsStore {
36
- subtotal: number;
37
- total: number;
38
- shippingFee: number;
39
- platformFee: number;
40
- giftCardTotal: number;
41
- engravingFee: number;
42
- deliveryFee: number;
43
- discounts: number;
44
- quantity: number;
45
- }
46
- export interface IRetailerFulfillmentStore {
47
- id: string;
48
- canEngrave: boolean;
49
- type: FulfillmentType;
50
- fees: IRetailerFees;
51
- expectation: IRetailerExpectation;
52
- shippingFee: number;
53
- subtotal: number;
54
- items: string[];
55
- engravingFee: number;
56
- deliveryFee: number;
57
- retailerId: string;
58
- loading?: boolean;
59
- error?: string | null;
60
- updating?: boolean;
61
- }
62
- export interface IRetailerStore {
63
- id: string;
64
- name: string;
65
- platformFee: number;
66
- shippingFee: number;
67
- subtotal: number;
68
- address?: IAddressAddress;
69
- deliveryFee: number;
70
- engravingFee: number;
71
- total: number;
72
- fulfillments: string[];
73
- loading?: boolean;
74
- error?: string | null;
75
- updating?: boolean;
33
+ export interface ICartFulfillmentStore extends ICartFulfillment {
34
+ loading: boolean;
35
+ error: string | null;
36
+ updating: boolean;
76
37
  }
77
- export interface ICartPromoCodeStore {
78
- code: string;
79
- discountAmount: number;
38
+ export interface ICartRetailerStore extends ICartRetailer {
39
+ loading: boolean;
40
+ error: string | null;
41
+ updating: boolean;
80
42
  }
81
43
  export interface ICartStore {
82
44
  id: string | null;
45
+ subtotal: number;
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[];
83
52
  loading: boolean;
84
53
  error: string | null;
85
- items: Record<string, ICartItemStore>;
86
- totals: ICartTotalsStore;
87
- retailers: Record<string, IRetailerStore>;
88
- promoCode: ICartPromoCodeStore | null;
89
- fulfillments: Record<string, IRetailerFulfillmentStore>;
90
54
  rerender: boolean;
91
55
  shouldReset: boolean;
92
- updatedAt: string;
93
- createdAt: string;
94
- events: IElementsCartEvent[];
95
56
  }
@@ -1,5 +1,5 @@
1
1
  import type { IElementsCheckoutEvents } from 'utils/helper';
2
- import type { ICartItemAttributes, ICheckoutTotalAmounts } from '@/interfaces/cloud';
2
+ import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
3
3
  export interface ICheckoutMarketingPreferencesStore {
4
4
  canEmail: boolean;
5
5
  canSms: boolean;
@@ -134,7 +134,7 @@ export interface ICheckoutStore {
134
134
  promoCode: ICheckoutPromoCodeStore | null;
135
135
  giftCards: ICheckoutGiftCardStore[];
136
136
  items: Record<string, ICheckoutItemStore>;
137
- amounts: ICheckoutTotalAmounts;
137
+ amounts: any;
138
138
  orderNumber: string | null;
139
139
  onDemandFulfillmentTipInfo: Record<string, IOnDemandFulfillmentTipInfo>;
140
140
  tipSelection: number;
@@ -1,8 +1,9 @@
1
1
  import type { IAddressStore } from '@/core/store/interfaces/address.interface';
2
+ import type { ICartFulfillmentStore, ICartItemStore, ICartRetailerStore, ICartStore } from '@/core/store/interfaces/cart.interface';
2
3
  import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutPresaleStore, ICheckoutPromoCodeStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
3
4
  import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
4
5
  import type { ComponentType } from '@/enums';
5
- import type { ICartItemStore, ICartPromoCodeStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from './cart.interface';
6
+ import type { ICartPromoCode } from '@/interfaces/api/cart.interface';
6
7
  export interface IDrawerContentConfig {
7
8
  type: ComponentType;
8
9
  data?: Record<string, any>;
@@ -25,7 +26,7 @@ export interface IPersistedStore {
25
26
  p?: string;
26
27
  c?: string;
27
28
  }
28
- export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCodeStore}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresaleStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.onDemandFulfillmentTipInfo.${string}`;
29
+ export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof ICartRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof ICartFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCode}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresaleStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.onDemandFulfillmentTipInfo.${string}`;
29
30
  interface MiddlewareContext {
30
31
  action: string;
31
32
  payload: any;
@@ -0,0 +1,91 @@
1
+ import type { CartEventEnum, FulfillmentType } from '@/enums';
2
+ import type { ILocation } from '@/interfaces/api/address.interface';
3
+ import type { IProductPresale } from '@/interfaces/api/product.interface';
4
+ export interface ICartUpdateItem {
5
+ id?: string;
6
+ partNumber: string;
7
+ quantity: number;
8
+ fulfillmentId: string;
9
+ engravingLines?: string[];
10
+ }
11
+ export interface ICartUpdateParams {
12
+ id: string;
13
+ items: ICartUpdateItem[];
14
+ promoCode?: string;
15
+ location?: ILocation;
16
+ }
17
+ export interface ICartFulfillment {
18
+ id: string;
19
+ canEngrave: boolean;
20
+ type: FulfillmentType;
21
+ expectation: string;
22
+ itemIds: string[];
23
+ subtotal: number;
24
+ hasUnmetMinimumPurchaseAmount: boolean;
25
+ minimumPurchaseAmount: number;
26
+ }
27
+ export interface ICartRetailer {
28
+ id: string;
29
+ name: string;
30
+ subtotal: number;
31
+ itemsQuantity: number;
32
+ fulfillments: Record<string, ICartFulfillment>;
33
+ }
34
+ export interface ICartItemAttributes {
35
+ engraving: ICartItemEngraving;
36
+ presale: IProductPresale;
37
+ }
38
+ export interface ICartItem {
39
+ id: string;
40
+ variantId: string;
41
+ liquidId: string;
42
+ retailerId: string;
43
+ partNumber: string;
44
+ fulfillmentId: string;
45
+ upc: string;
46
+ sku: string;
47
+ salsifyGrouping: string;
48
+ catPath: string;
49
+ volume: string;
50
+ uom: string;
51
+ pack: boolean;
52
+ packDesc: string;
53
+ container: string;
54
+ containerType: string;
55
+ name: string;
56
+ brand: string;
57
+ size: string;
58
+ price: number;
59
+ quantity: number;
60
+ maxQuantity: number;
61
+ unitPrice: number;
62
+ mainImage: string;
63
+ attributes: ICartItemAttributes;
64
+ }
65
+ export interface ICartPromoCode {
66
+ code: string;
67
+ discountAmount: number;
68
+ }
69
+ export interface ICart {
70
+ id: string;
71
+ subtotal: number;
72
+ itemsQuantity: number;
73
+ items: Record<string, ICartItem>;
74
+ retailers: Record<string, ICartRetailer>;
75
+ promoCode: ICartPromoCode | null;
76
+ events: any[];
77
+ }
78
+ export interface ICartItemEngraving {
79
+ isEngravable: boolean;
80
+ hasEngraving: boolean;
81
+ fee: number;
82
+ maxCharsPerLine: number;
83
+ maxLines: number;
84
+ location: string;
85
+ lines: string[];
86
+ }
87
+ export interface ICartEvent {
88
+ type: CartEventEnum;
89
+ message: string;
90
+ items?: Array<Partial<ICartItem>>;
91
+ }
@@ -1,7 +1,7 @@
1
1
  import type { CheckoutEventEnum } from '@/enums';
2
2
  import type { IAddressAddress } from '@/interfaces/api/address.interface';
3
+ import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
3
4
  import type { ICoreParams } from '@/interfaces/cloud/core.interface';
4
- import type { ICartAttributesPromoCode, ICartItemAttributes } from './cart.interface';
5
5
  import type { IRetailerExpectation } from './retailer.interface';
6
6
  export interface ICheckoutRecipient {
7
7
  firstName?: string;
@@ -175,6 +175,13 @@ export interface ICheckoutEvents {
175
175
  type: CheckoutEventEnum;
176
176
  message: string;
177
177
  }
178
+ export interface ICheckoutAttributesPromoCode {
179
+ value: string;
180
+ discount: number;
181
+ freeDelivery: boolean;
182
+ freeServiceFee: boolean;
183
+ freeShipping: boolean;
184
+ }
178
185
  export interface ICheckoutPrepareResponse {
179
186
  token: string;
180
187
  cartId: string;
@@ -196,7 +203,7 @@ export interface ICheckoutPrepareResponse {
196
203
  payment?: string;
197
204
  giftCards: ICheckoutGiftCard[];
198
205
  events: ICheckoutEvents[];
199
- promoCode: ICartAttributesPromoCode;
206
+ promoCode: ICheckoutAttributesPromoCode;
200
207
  isPresaleLocked: boolean;
201
208
  presaleExpiresAt: string | null;
202
209
  }
@@ -1,4 +1,3 @@
1
- export * from './cart.interface';
2
1
  export * from './catalog.interface';
3
2
  export * from './checkout.interface';
4
3
  export * from './core.interface';
@@ -1,7 +1,6 @@
1
1
  import { BaseCommand } from '@/core/command/base-command.service';
2
2
  import type { IBaseCartEventData } from '@/core/pubsub/interfaces/cart.interface';
3
3
  export interface AddItemParams {
4
- upc: string;
5
4
  fulfillmentId: string;
6
5
  partNumber: string;
7
6
  quantity: number;
@@ -1,9 +1,4 @@
1
1
  import type { IBaseCartEventData } from '@/core/pubsub/interfaces/cart.interface';
2
2
  import type { IAddressStore } from '@/core/store/interfaces/address.interface';
3
- import type { ICartItemStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from '@/core/store/interfaces/cart.interface';
4
- import type { ICart, ICartItem, ICartRetailer, IRetailerFulfillments } from '@/interfaces/cloud';
5
- export declare function buildCartItemStore(apiItem: ICartItem): ICartItemStore;
6
- export declare function buildCartTotals(cart: ICart): ICartTotalsStore;
7
- export declare function buildRetailerStore(retailer: ICartRetailer): IRetailerStore;
8
- export declare function buildFulfillmentStore(fulfillment: IRetailerFulfillments, retailer: ICartRetailer): IRetailerFulfillmentStore;
3
+ import type { ICartStore } from '@/core/store/interfaces/cart.interface';
9
4
  export declare function cartDataForEventFromStore(cartStore: ICartStore, addressStore: IAddressStore): IBaseCartEventData;
@@ -12,7 +12,6 @@ export declare class CartFooterComponent extends BaseComponent<ICartFooterCompon
12
12
  onStoreWatch(changes: IOnStoreChanged[]): void;
13
13
  afterRender(): void;
14
14
  private isAnythingLoading;
15
- private hasUnmetMinimum;
16
15
  private shouldDisableCheckout;
17
16
  private updateCheckoutButtonState;
18
17
  private updateSubtotalItemsCount;
@@ -6,7 +6,6 @@ export declare class CartFulfillmentComponent extends BaseComponent<ICartFulfill
6
6
  get hostClasses(): string[];
7
7
  constructor();
8
8
  private getFulfillmentId;
9
- private getProductStore;
10
9
  private handleItemsUpdate;
11
10
  private setupItemElements;
12
11
  private setupMinimumPurchaseAlert;
@@ -17,7 +16,6 @@ export declare class CartFulfillmentComponent extends BaseComponent<ICartFulfill
17
16
  private isAnyItemUpdating;
18
17
  private checkAndUpdateLoadingState;
19
18
  onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
20
- private hasFulfillmentFeesChanged;
21
19
  private hasFulfillmentDataChanged;
22
20
  protected afterRender(): void;
23
21
  protected disconnected(): void;
@@ -1,2 +1 @@
1
- export * from './helpers';
2
1
  export * from './purchase-min-alert.component';
@@ -1,5 +1,6 @@
1
1
  import type { CartEventEnum, CheckoutEventEnum } from 'enums';
2
- import type { ICartEvent, ICheckoutEvents } from 'interfaces/cloud';
2
+ import type { ICheckoutEvents } from 'interfaces/cloud';
3
+ import type { ICartEvent } from '@/interfaces/api/cart.interface';
3
4
  export type ElementEventLevel = 'success' | 'warning' | 'error';
4
5
  export interface IElementsCartEvent {
5
6
  type: CartEventEnum;
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.6.0-beta.6",
6
+ "version": "2.6.0-beta.7",
7
7
  "homepage": "https://docs.liquidcommerce.co/elements-sdk",
8
8
  "repository": {
9
9
  "type": "git",
@@ -71,8 +71,8 @@
71
71
  ],
72
72
  "devDependencies": {
73
73
  "@biomejs/biome": "2.3.5",
74
- "@commitlint/cli": "^20.1.0",
75
- "@commitlint/config-conventional": "^20.0.0",
74
+ "@commitlint/cli": "^20.2.0",
75
+ "@commitlint/config-conventional": "^20.2.0",
76
76
  "@rollup/plugin-alias": "^6.0.0",
77
77
  "@rollup/plugin-commonjs": "^29.0.0",
78
78
  "@rollup/plugin-json": "^6.1.0",