@liquidcommerce/elements-sdk 2.2.2 → 2.4.0

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 (62) hide show
  1. package/README.md +1608 -557
  2. package/dist/index.esm.js +10170 -8144
  3. package/dist/types/core/auth.service.d.ts +10 -4
  4. package/dist/types/core/base-component.service.d.ts +3 -0
  5. package/dist/types/core/circuit-breaker.service.d.ts +54 -0
  6. package/dist/types/core/client/client-action.service.d.ts +13 -11
  7. package/dist/types/core/client/client-config.service.d.ts +5 -3
  8. package/dist/types/core/command/common-command.service.d.ts +2 -1
  9. package/dist/types/core/debug-panel/debug-panel.service.d.ts +43 -0
  10. package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -0
  11. package/dist/types/core/fingerprint.service.d.ts +4 -9
  12. package/dist/types/core/google-tag-manager.service.d.ts +127 -2
  13. package/dist/types/core/logger/logger-factory.d.ts +3 -0
  14. package/dist/types/core/logger/logger.service.d.ts +8 -5
  15. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -3
  16. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +0 -5
  17. package/dist/types/core/store/interfaces/cart.interface.d.ts +0 -1
  18. package/dist/types/core/store/interfaces/checkout.interface.d.ts +0 -1
  19. package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
  20. package/dist/types/core/store/interfaces/product.interface.d.ts +0 -1
  21. package/dist/types/core/store/store.service.d.ts +1 -0
  22. package/dist/types/core/telemetry/telemetry.interface.d.ts +80 -0
  23. package/dist/types/core/telemetry/telemetry.service.d.ts +27 -0
  24. package/dist/types/enums/core.enum.d.ts +0 -1
  25. package/dist/types/enums/debug.enum.d.ts +6 -0
  26. package/dist/types/enums/index.d.ts +1 -0
  27. package/dist/types/interfaces/core.interface.d.ts +2 -2
  28. package/dist/types/modules/address/address.command.d.ts +1 -3
  29. package/dist/types/modules/cart/cart.commands.d.ts +1 -1
  30. package/dist/types/modules/cart/cart.component.d.ts +1 -2
  31. package/dist/types/modules/cart/components/cart-footer.component.d.ts +1 -0
  32. package/dist/types/modules/cart/components/cart-item.component.d.ts +2 -6
  33. package/dist/types/modules/checkout/checkout.commands.d.ts +3 -2
  34. package/dist/types/modules/checkout/checkout.component.d.ts +1 -2
  35. package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +2 -0
  36. package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +1 -1
  37. package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +0 -2
  38. package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +2 -1
  39. package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +1 -0
  40. package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +0 -1
  41. package/dist/types/modules/checkout/constant.d.ts +0 -1
  42. package/dist/types/modules/product/components/index.d.ts +1 -0
  43. package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
  44. package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
  45. package/dist/types/modules/product/components/product-price.component.d.ts +1 -0
  46. package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
  47. package/dist/types/modules/product/product.commands.d.ts +1 -1
  48. package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -11
  49. package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -9
  50. package/dist/types/static/icon/index.d.ts +0 -1
  51. package/dist/types/utils/format.d.ts +2 -1
  52. package/docs/ACTIONS.md +1235 -0
  53. package/docs/BROWSER_SUPPORT.md +279 -0
  54. package/docs/CONFIGURATION.md +613 -0
  55. package/docs/DOCUMENTATION_INDEX.md +311 -0
  56. package/docs/EVENTS.md +532 -0
  57. package/docs/PROXY.md +228 -0
  58. package/docs/THEMING.md +592 -0
  59. package/docs/TROUBLESHOOTING.md +755 -0
  60. package/package.json +17 -17
  61. package/umd/elements.js +1 -1
  62. package/dist/types/static/icon/completed.icon.d.ts +0 -2
@@ -0,0 +1,27 @@
1
+ import type { ITelemetryEventOptions, TelemetryLevel } from './telemetry.interface';
2
+ export declare class TelemetryService {
3
+ private config;
4
+ private eventQueue;
5
+ private batchTimer;
6
+ private readonly clientConfig;
7
+ private stats;
8
+ private isShuttingDown;
9
+ constructor();
10
+ static getInstance(): TelemetryService;
11
+ isEnabled(): boolean;
12
+ captureEvent(level: TelemetryLevel, message: string, options?: ITelemetryEventOptions): void;
13
+ private buildErrorContext;
14
+ private buildSDKContext;
15
+ private buildUserContext;
16
+ private buildBrowserContext;
17
+ private shouldCapture;
18
+ private addToQueue;
19
+ private startBatchTimer;
20
+ private flushQueue;
21
+ private createBatch;
22
+ private sendBatch;
23
+ private sendBatchViaXHR;
24
+ private truncateStackTrace;
25
+ private handleInternalError;
26
+ private shutdown;
27
+ }
@@ -14,7 +14,6 @@ export declare const ELEMENTS_ACTIONS_EVENT: {
14
14
  readonly PRODUCT_SIZE_CHANGED: "product_size_changed";
15
15
  readonly PRODUCT_FULFILLMENT_TYPE_CHANGED: "product_fulfillment_type_changed";
16
16
  readonly PRODUCT_FULFILLMENT_CHANGED: "product_fulfillment_changed";
17
- readonly PRODUCT_ENGRAVING_UPDATED: "product_engraving_updated";
18
17
  readonly CART_LOADED: "cart_loaded";
19
18
  readonly CART_CLOSED: "cart_closed";
20
19
  readonly CART_OPENED: "cart_opened";
@@ -0,0 +1,6 @@
1
+ export declare const DEBUG_MODE: {
2
+ readonly NONE: "none";
3
+ readonly CONSOLE: "console";
4
+ readonly PANEL: "panel";
5
+ };
6
+ export type DebugMode = (typeof DEBUG_MODE)[keyof typeof DEBUG_MODE];
@@ -1,2 +1,3 @@
1
1
  export * from './cloud.enum';
2
2
  export * from './core.enum';
3
+ export * from './debug.enum';
@@ -1,6 +1,6 @@
1
1
  import type { IAddressActions, ICartActions, ICheckoutActions, IProductActions } from '@/core/client/client-action.service';
2
2
  import type { IClientConfigs } from '@/core/client/client-config.service';
3
- import type { ComponentType, ElementsEnv } from '@/enums';
3
+ import type { ComponentType, DebugMode, ElementsEnv } from '@/enums';
4
4
  import type { IAddressOptions } from '@/modules/address/address.interface';
5
5
  import type { IPromoTicker, UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent } from './configs';
6
6
  export type DeepPartial<T> = {
@@ -23,7 +23,7 @@ export interface ILiquidCommerceElementsConfig {
23
23
  customTheme?: IClientCustomThemeConfig;
24
24
  proxy?: IElementsProxyConfig;
25
25
  isBuilder?: boolean;
26
- enableDebugging?: boolean;
26
+ debugMode?: DebugMode;
27
27
  }
28
28
  export interface IInjectProductElement {
29
29
  containerId: string;
@@ -10,8 +10,6 @@ export declare class AddressCommands extends BaseCommand {
10
10
  getAddressDetails(addressId: string): Promise<IAddressDetailsResult>;
11
11
  setSelectedAddress(addressData: IAddressData): Promise<void>;
12
12
  setAddressManually(address: Omit<IAddress, 'id'>, coordinates: ICoords): Promise<void>;
13
- clearSelectedAddress(): void;
14
- private shouldResetCartForAddressChange;
15
- private persistSessionData;
13
+ clearSelectedAddress(): Promise<void>;
16
14
  getDetails(): IAddressData | null;
17
15
  }
@@ -23,13 +23,13 @@ export declare class CartCommands extends BaseCommand {
23
23
  handleGoToCheckout(): Promise<void>;
24
24
  applyPromoCode(promoCode: string): Promise<void>;
25
25
  removePromoCode(): Promise<void>;
26
- clearPromoCodeError(): Promise<void>;
27
26
  rerenderCart(): void;
28
27
  resetCart(): Promise<void>;
29
28
  getDetails(): IBaseCartEventData;
30
29
  private buildItemUpdate;
31
30
  private syncItemsFromApiResponse;
32
31
  private syncCartMetaFromApiResponse;
32
+ private syncRetailersFromApiResponse;
33
33
  private updateFulfillment;
34
34
  private addNewFulfillmentAndRetailer;
35
35
  private cleanupAfterItemRemoval;
@@ -1,4 +1,4 @@
1
- import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
1
+ import { BaseComponent } from '@/core/base-component.service';
2
2
  import type { ICartComponent } from '@/interfaces/configs';
3
3
  export interface ICartComponentParams {
4
4
  isIndependentComponent: boolean;
@@ -6,6 +6,5 @@ export interface ICartComponentParams {
6
6
  export declare class CartComponent extends BaseComponent<ICartComponentParams, ICartComponent> {
7
7
  get hostClasses(): string[];
8
8
  constructor();
9
- onStoreWatch(changes: IOnStoreChanged[]): void;
10
9
  protected template(): HTMLElement[];
11
10
  }
@@ -16,5 +16,6 @@ export declare class CartFooterComponent extends BaseComponent<ICartFooterCompon
16
16
  private shouldDisableCheckout;
17
17
  private updateCheckoutButtonState;
18
18
  private updateSubtotalItemsCount;
19
+ private handleCheckout;
19
20
  protected template(): HTMLElement[];
20
21
  }
@@ -1,4 +1,4 @@
1
- import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
1
+ import { BaseComponent } from '@/core/base-component.service';
2
2
  export interface ICartItemComponentParams {
3
3
  itemId: string;
4
4
  }
@@ -6,10 +6,6 @@ export declare class CartItemComponent extends BaseComponent<ICartItemComponentP
6
6
  get hostClasses(): string[];
7
7
  get hostAttributes(): Record<string, string>;
8
8
  constructor();
9
- private getItemId;
10
- onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
11
- private handleEngravingElement;
12
- private updateShippingTime;
9
+ private handleOpenEngravingForm;
13
10
  protected template(): HTMLElement[];
14
- afterRender(): void;
15
11
  }
@@ -1,6 +1,6 @@
1
1
  import { BaseCommand } from '@/core/command/base-command.service';
2
2
  import type { ICheckoutItemStore, ICheckoutStripeFormStatusStore } from '@/core/store';
3
- import type { ICheckoutFulfillment, ICheckoutItem, ICheckoutPrepareResponse, ICheckoutRetailer } from '@/interfaces/cloud';
3
+ import type { ICart, ICheckoutFulfillment, ICheckoutItem, ICheckoutPrepareResponse, ICheckoutRetailer } from '@/interfaces/cloud';
4
4
  import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
5
5
  export declare function buildCheckoutItemStore(apiItem: ICheckoutItem, retailer: ICheckoutRetailer, fulfillment: ICheckoutFulfillment): ICheckoutItemStore;
6
6
  export declare class CheckoutCommands extends BaseCommand {
@@ -13,6 +13,7 @@ export declare class CheckoutCommands extends BaseCommand {
13
13
  partialLoadCheckout(params?: {
14
14
  cartId?: string;
15
15
  response?: ICheckoutPrepareResponse;
16
+ cartResponse?: ICart;
16
17
  }): Promise<void>;
17
18
  toggleIsGift(active?: boolean): Promise<void>;
18
19
  toggleBillingSameAsShipping(active?: boolean): Promise<void>;
@@ -22,7 +23,7 @@ export declare class CheckoutCommands extends BaseCommand {
22
23
  applyPromoCode(code: string): Promise<void>;
23
24
  clearPromoCodeError(): Promise<void>;
24
25
  removePromoCode(): Promise<void>;
25
- applyGiftCard(code?: string): Promise<void>;
26
+ applyGiftCard(code: string): Promise<void>;
26
27
  clearGiftCardError(): Promise<void>;
27
28
  removeGiftCard(code: string): Promise<void>;
28
29
  updateCustomerInfo(fieldName: CustomerFieldName, fieldValue: string): void;
@@ -1,4 +1,4 @@
1
- import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
1
+ import { BaseComponent } from '@/core/base-component.service';
2
2
  import type { ICheckoutComponent } from '@/interfaces/configs';
3
3
  export interface ICheckoutComponentParams {
4
4
  checkoutId: string;
@@ -6,6 +6,5 @@ export interface ICheckoutComponentParams {
6
6
  }
7
7
  export declare class CheckoutComponent extends BaseComponent<ICheckoutComponentParams, ICheckoutComponent> {
8
8
  constructor();
9
- onStoreWatch(changes: IOnStoreChanged[]): void;
10
9
  protected template(): HTMLElement[];
11
10
  }
@@ -6,6 +6,8 @@ export declare class CheckoutSummarySectionComponent extends BaseComponent<null,
6
6
  onStoreWatch(changes: IOnStoreChanged[]): void;
7
7
  private updateZeroAmountElement;
8
8
  protected afterRender(): void;
9
+ private handleEmailToggle;
10
+ private handleSmsToggle;
9
11
  private marketingOptInsContainer;
10
12
  private hasOnDemandOrder;
11
13
  protected template(): HTMLElement[];
@@ -1,8 +1,8 @@
1
1
  import { BaseComponent } from '@/core/base-component.service';
2
2
  import type { ICheckoutComponent } from '@/interfaces/configs';
3
3
  export declare class CheckoutDeliveryInformationComponent extends BaseComponent<null, ICheckoutComponent> {
4
- constructor();
5
4
  get hostClasses(): string[];
5
+ constructor();
6
6
  private hasOnDemandFulfillments;
7
7
  private handleDeliveryInstructionsChange;
8
8
  private handleFirstNameChange;
@@ -9,11 +9,9 @@ export declare class CheckoutItemQuantityComponent extends BaseComponent<IChecko
9
9
  get hostClasses(): string[];
10
10
  constructor();
11
11
  onStoreWatch(changes: IOnStoreChanged[]): void;
12
- private getCheckoutItemStore;
13
12
  private getAvailableQuantity;
14
13
  private calculateQuantityLimits;
15
14
  private updateButtonStates;
16
15
  private handleQuantityChange;
17
- private createQuantityContainer;
18
16
  protected template(): HTMLElement[];
19
17
  }
@@ -6,7 +6,8 @@ export declare class CheckoutItemComponent extends BaseComponent<ICheckoutItemCo
6
6
  private trashButton;
7
7
  get hostClasses(): string[];
8
8
  constructor();
9
- onStoreWatch(changes: IOnStoreChanged[]): void;
9
+ onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
10
+ private updateEngravingElement;
10
11
  private setupMinimumPurchaseAlert;
11
12
  private updateTrashButtonState;
12
13
  private createLoadingOverlay;
@@ -10,6 +10,7 @@ export declare class CheckoutItemsComponent extends BaseComponent<null, ICheckou
10
10
  private syncItemsWithStore;
11
11
  private updateItemCount;
12
12
  onStoreChanged(changes: IOnStoreChanged[]): boolean | undefined;
13
+ private handleToggle;
13
14
  private setupToggler;
14
15
  protected afterRender(): void;
15
16
  protected template(): HTMLElement[];
@@ -16,7 +16,6 @@ export declare class CheckoutPlaceOrderButtonComponent extends BaseComponent<nul
16
16
  private determineButtonState;
17
17
  private applyButtonState;
18
18
  private handlePlaceOrderClick;
19
- private focusFirstInvalidField;
20
19
  private showPaymentError;
21
20
  private handleCheckoutReadyForSubmit;
22
21
  protected template(): HTMLElement[];
@@ -15,7 +15,6 @@ export declare const giftFormFields: {
15
15
  readonly phone: "phone";
16
16
  readonly birthDate: "birthDate";
17
17
  readonly addressTwo: "addressTwo";
18
- readonly company: "company";
19
18
  readonly message: "message";
20
19
  };
21
20
  export declare const billingFormFields: {
@@ -1,3 +1,4 @@
1
+ export * from '../../ui-components/engraving/engraving-form.component';
1
2
  export * from '../../ui-components/engraving/engraving-view.component';
2
3
  export * from './components';
3
4
  export * from './product-add-to-cart-section.component';
@@ -9,6 +9,7 @@ export declare class ProductAddToCartSectionComponent extends BaseComponent<IAdd
9
9
  private qtyDecreaseButton;
10
10
  private quantityText;
11
11
  get hostClasses(): string[];
12
+ get hostAttributes(): Record<string, string>;
12
13
  constructor();
13
14
  private getProductId;
14
15
  private getAvailableQuantity;
@@ -1,10 +1,13 @@
1
- import { BaseComponent } from '@/core/base-component.service';
1
+ import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
2
2
  import type { IProductComponent } from '@/interfaces/configs';
3
3
  export interface IProductInteractionsComponent {
4
4
  productId: string;
5
5
  }
6
6
  export declare class ProductInteractionsComponent extends BaseComponent<IProductInteractionsComponent, IProductComponent> {
7
7
  get hostClasses(): string[];
8
+ private addPersonalizationSpan;
9
+ constructor();
10
+ onStoreWatch(changedPaths: IOnStoreChanged[]): void;
8
11
  private getProductId;
9
12
  afterRender(): void;
10
13
  private setupSizeButtonsEventListener;
@@ -5,6 +5,7 @@ export interface IProductPriceComponentParams {
5
5
  }
6
6
  export declare class ProductPriceComponent extends BaseComponent<IProductPriceComponentParams, IProductComponent> {
7
7
  get hostClasses(): string[];
8
+ get hostAttributes(): Record<string, string>;
8
9
  constructor();
9
10
  private getProductId;
10
11
  protected template(): string;
@@ -6,6 +6,7 @@ export interface IProductRetailersComponent {
6
6
  export declare class ProductRetailersComponent extends BaseComponent<IProductRetailersComponent, IProductComponent> {
7
7
  get hostClasses(): string[];
8
8
  constructor();
9
+ get hostAttributes(): Record<string, string>;
9
10
  private getProductId;
10
11
  protected template(): HTMLElement | HTMLElement[];
11
12
  }
@@ -18,12 +18,12 @@ export declare class ProductCommands extends BaseCommand {
18
18
  updateQuantity(productId: string, delta: number): Promise<void>;
19
19
  changeFulfillmentType(productId: string, selectedFulfillmentType: FulfillmentType): Promise<void>;
20
20
  removeProduct(productId: string): Promise<void>;
21
- updateEngravingLines(productId: string, engravingLines: string[]): Promise<void>;
22
21
  openProductDrawer(productId: string, contentType: IProductDrawerContentConfig['type'], data?: Record<string, any>): Promise<void>;
23
22
  closeProductDrawer(productId: string): Promise<void>;
24
23
  rerenderAllProducts(): Promise<void>;
25
24
  addToCart(productId: string, params: AddItemParams): Promise<void>;
26
25
  addPresaleToCart(productId: string, params: AddItemParams): Promise<void>;
27
26
  productDataForEventFromStore(identifier: string): IBaseProductEventData;
27
+ private findFirstAvailableSize;
28
28
  private loadProductStoreUpdate;
29
29
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseComponent } from '@/core/base-component.service';
2
2
  export interface IEngravingFormComponentParams {
3
3
  identifier: string;
4
- context: 'product' | 'cart' | 'checkout';
4
+ context: 'product' | 'cart';
5
5
  lines: string[];
6
6
  maxLines: number;
7
7
  maxCharsPerLine: number;
@@ -9,16 +9,18 @@ export interface IEngravingFormComponentParams {
9
9
  location?: string;
10
10
  }
11
11
  export declare class EngravingFormComponent extends BaseComponent<IEngravingFormComponentParams, null> {
12
- private inputs;
13
- private charCountElements;
14
12
  get hostClasses(): string[];
15
- protected afterRender(): void;
16
- private handleClick;
17
- private handleInput;
18
- private updateCharacterCount;
19
- private initializeCharacterCounts;
20
- private closeDrawer;
21
- private collectEngravingLines;
22
- private handleSave;
13
+ private engravingLines;
14
+ private productPriceSpan;
15
+ private addToCartButton;
16
+ private fulfillmentId;
17
+ private partNumber;
18
+ beforeConnected(): void;
19
+ private calculateTotalPrice;
20
+ private productInformationSection;
21
+ private addToCartButtonText;
22
+ private retailersSection;
23
+ private engravingLinesSection;
24
+ private actionButtonsSection;
23
25
  protected template(): HTMLElement[];
24
26
  }
@@ -1,19 +1,14 @@
1
1
  import { BaseComponent } from '@/core/base-component.service';
2
- import type { StorePaths } from '@/core/store';
3
2
  import type { IProductComponent } from '@/interfaces/configs';
4
3
  export interface IEngravingViewComponentParams {
5
4
  identifier: string;
6
- context: 'product' | 'cart' | 'checkout';
7
- watchStorePaths?: StorePaths[];
5
+ context: 'cart' | 'checkout';
8
6
  }
9
7
  export declare class EngravingViewComponent extends BaseComponent<IEngravingViewComponentParams, IProductComponent> {
10
8
  get hostClasses(): string[];
11
- beforeSetupStoreWatchers(): void;
12
- private createEngravingFormParams;
13
- private openEngravingDrawer;
14
- private createEngravingContainer;
15
- private isEngravingAvailable;
16
- private engravingFee;
9
+ private engravingQuantityFee;
17
10
  private engravingLines;
11
+ private handleEdit;
12
+ private handleRemove;
18
13
  protected template(): HTMLElement | HTMLElement[] | string;
19
14
  }
@@ -4,7 +4,6 @@ export * from './checkbox.icon';
4
4
  export * from './chevron-down.icon';
5
5
  export * from './chevron-left.icon';
6
6
  export * from './close.icon';
7
- export * from './completed.icon';
8
7
  export * from './error-info.icon';
9
8
  export * from './icon.types';
10
9
  export * from './info.icon';
@@ -16,7 +16,8 @@ export declare function buildFormattedAddressString(address: {
16
16
  zip: string;
17
17
  country?: string;
18
18
  }): string;
19
- export declare function splitCategoryPath(catPath: string): {
19
+ export declare function capitalizeFirstLetter(text: string): string;
20
+ export declare function splitCategoryPath(catPath?: string): {
20
21
  category: string;
21
22
  category2: string;
22
23
  category3: string;