@liquidcommerce/elements-sdk 2.5.6-beta.1 → 2.5.6-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 (60) hide show
  1. package/README.md +99 -25
  2. package/dist/index.esm.js +11375 -10521
  3. package/dist/types/constants/core.constant.d.ts +1 -0
  4. package/dist/types/core/auth.service.d.ts +0 -1
  5. package/dist/types/core/client/client-action.service.d.ts +0 -4
  6. package/dist/types/core/google-tag-manager.service.d.ts +0 -19
  7. package/dist/types/core/logger/logger.service.d.ts +0 -2
  8. package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +0 -2
  9. package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +0 -10
  10. package/dist/types/core/pubsub/interfaces/core.interface.d.ts +14 -8
  11. package/dist/types/core/pubsub/interfaces/product.interface.d.ts +0 -6
  12. package/dist/types/core/singleton-manager.service.d.ts +6 -1
  13. package/dist/types/core/store/interfaces/checkout.interface.d.ts +72 -80
  14. package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
  15. package/dist/types/core/telemetry/telemetry.interface.d.ts +1 -1
  16. package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
  17. package/dist/types/enums/core.enum.d.ts +15 -10
  18. package/dist/types/interfaces/cloud/checkout.interface.d.ts +1 -1
  19. package/dist/types/interfaces/configs/checkout.interface.d.ts +0 -1
  20. package/dist/types/interfaces/core.interface.d.ts +3 -1
  21. package/dist/types/modules/cart/components/cart-retailer.component.d.ts +0 -2
  22. package/dist/types/modules/checkout/checkout.commands.d.ts +25 -23
  23. package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +14 -0
  24. package/dist/types/modules/checkout/components/checkout-buyer-summary.component.d.ts +7 -0
  25. package/dist/types/modules/checkout/components/{checkout-information-section.component.d.ts → checkout-buyer.component.d.ts} +5 -5
  26. package/dist/types/modules/checkout/components/checkout-deliver-to-summary.component.d.ts +7 -0
  27. package/dist/types/modules/checkout/components/checkout-deliver-to.component.d.ts +13 -0
  28. package/dist/types/modules/checkout/components/checkout-information.component.d.ts +17 -0
  29. package/dist/types/modules/checkout/components/{checkout-summary-section.component.d.ts → checkout-order-summary.component.d.ts} +1 -1
  30. package/dist/types/modules/checkout/components/checkout-payment-summary.component.d.ts +7 -0
  31. package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +47 -0
  32. package/dist/types/modules/checkout/components/{summary/checkout-place-order-button.component.d.ts → checkout-place-order-button.component.d.ts} +1 -5
  33. package/dist/types/modules/checkout/components/checkout-send-as-gift.component.d.ts +7 -0
  34. package/dist/types/modules/checkout/components/{information/checkout-stripe-form.component.d.ts → checkout-stripe-form.component.d.ts} +5 -3
  35. package/dist/types/modules/checkout/components/index.d.ts +22 -18
  36. package/dist/types/modules/checkout/constant.d.ts +0 -1
  37. package/dist/types/modules/product/utils/helpers.d.ts +0 -7
  38. package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +4 -4
  39. package/dist/types/modules/ui-components/input/input.component.d.ts +4 -4
  40. package/docs/ACTIONS.md +29 -29
  41. package/docs/CONFIGURATION.md +20 -1
  42. package/docs/EVENTS.md +62 -29
  43. package/docs/THEMING.md +2 -5
  44. package/package.json +7 -7
  45. package/umd/elements.js +1 -1
  46. package/dist/types/modules/checkout/checkout.commands.helper.d.ts +0 -13
  47. package/dist/types/modules/checkout/components/information/checkout-billing-form.component.d.ts +0 -18
  48. package/dist/types/modules/checkout/components/information/checkout-buyer-information-form.component.d.ts +0 -12
  49. package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +0 -17
  50. package/dist/types/modules/checkout/components/information/checkout-payment-form.component.d.ts +0 -21
  51. /package/dist/types/modules/checkout/components/{summary/checkout-amounts.component.d.ts → checkout-amounts.component.d.ts} +0 -0
  52. /package/dist/types/modules/checkout/components/{summary/checkout-completed.component.d.ts → checkout-completed.component.d.ts} +0 -0
  53. /package/dist/types/modules/checkout/components/{summary/checkout-gift-cards.component.d.ts → checkout-gift-cards.component.d.ts} +0 -0
  54. /package/dist/types/modules/checkout/components/{summary/checkout-item-quantity.component.d.ts → checkout-item-quantity.component.d.ts} +0 -0
  55. /package/dist/types/modules/checkout/components/{summary/checkout-item.component.d.ts → checkout-item.component.d.ts} +0 -0
  56. /package/dist/types/modules/checkout/components/{summary/checkout-items.component.d.ts → checkout-items.component.d.ts} +0 -0
  57. /package/dist/types/modules/checkout/components/{summary/checkout-presale-expired.component.d.ts → checkout-presale-expired.component.d.ts} +0 -0
  58. /package/dist/types/modules/checkout/components/{summary/checkout-promo-code.component.d.ts → checkout-promo-code.component.d.ts} +0 -0
  59. /package/dist/types/modules/checkout/components/{summary/checkout-tips.component.d.ts → checkout-tips.component.d.ts} +0 -0
  60. /package/dist/types/modules/checkout/components/{summary/promo-pc-gc.component.d.ts → promo-pc-gc.component.d.ts} +0 -0
@@ -1,12 +1,12 @@
1
1
  import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
2
2
  import type { ICheckoutComponent } from '@/interfaces/configs';
3
- export interface ICheckoutInformationSectionComponentParams {
4
- isIndependentComponent: boolean;
5
- }
6
- export declare class CheckoutInformationSectionComponent extends BaseComponent<ICheckoutInformationSectionComponentParams, ICheckoutComponent> {
3
+ export declare class CheckoutBuyer extends BaseComponent<null, ICheckoutComponent> {
4
+ private customerData;
5
+ private saveButtonText;
6
+ private saveButton;
7
7
  get hostClasses(): string[];
8
8
  constructor();
9
9
  onStoreWatch(changes: IOnStoreChanged[]): void;
10
- private handleBuyerInformationVisibility;
10
+ private updateSaveButtonState;
11
11
  protected template(): HTMLElement[];
12
12
  }
@@ -0,0 +1,7 @@
1
+ import { BaseComponent } from '@/core/base-component.service';
2
+ import type { ICheckoutComponent } from '@/interfaces/configs';
3
+ export declare class CheckoutDeliverToSummaryComponent extends BaseComponent<null, ICheckoutComponent> {
4
+ get hostClasses(): string[];
5
+ constructor();
6
+ protected template(): HTMLElement[];
7
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
2
+ import type { ICheckoutComponent } from '@/interfaces/configs';
3
+ export declare class CheckoutDeliverToComponent extends BaseComponent<null, ICheckoutComponent> {
4
+ private customerData;
5
+ private giftData;
6
+ private saveButtonText;
7
+ private saveButton;
8
+ get hostClasses(): string[];
9
+ constructor();
10
+ onStoreWatch(changes: IOnStoreChanged[]): void;
11
+ private updateSaveButtonState;
12
+ protected template(): HTMLElement[];
13
+ }
@@ -0,0 +1,17 @@
1
+ import { BaseComponent } from '@/core/base-component.service';
2
+ import type { ICheckoutComponent } from '@/interfaces/configs';
3
+ export interface ICheckoutInformationSectionComponentParams {
4
+ isIndependentComponent: boolean;
5
+ }
6
+ export declare class CheckoutInformationComponent extends BaseComponent<ICheckoutInformationSectionComponentParams, ICheckoutComponent> {
7
+ private deliveryToForm;
8
+ private deliverToSummary;
9
+ private buyerForm;
10
+ private buyerSummary;
11
+ private paymentForm;
12
+ private paymentSummary;
13
+ get hostClasses(): string[];
14
+ constructor();
15
+ onStoreWatch(): void;
16
+ protected template(): HTMLElement[];
17
+ }
@@ -1,6 +1,6 @@
1
1
  import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
2
2
  import type { ICheckoutComponent } from '@/interfaces/configs';
3
- export declare class CheckoutSummarySectionComponent extends BaseComponent<null, ICheckoutComponent> {
3
+ export declare class CheckoutOrderSummaryComponent extends BaseComponent<null, ICheckoutComponent> {
4
4
  get hostClasses(): string[];
5
5
  constructor();
6
6
  onStoreWatch(changes: IOnStoreChanged[]): void;
@@ -0,0 +1,7 @@
1
+ import { BaseComponent } from '@/core/base-component.service';
2
+ import type { ICheckoutComponent } from '@/interfaces/configs';
3
+ export declare class CheckoutPaymentSummaryComponent extends BaseComponent<null, ICheckoutComponent> {
4
+ get hostClasses(): string[];
5
+ constructor();
6
+ protected template(): HTMLElement[];
7
+ }
@@ -0,0 +1,47 @@
1
+ import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
2
+ import type { ICheckoutComponent } from '@/interfaces/configs';
3
+ export interface ICheckoutSendToFormComponentParams {
4
+ isIndependentComponent: boolean;
5
+ }
6
+ export declare class CheckoutPaymentComponent extends BaseComponent<ICheckoutSendToFormComponentParams, ICheckoutComponent> {
7
+ private stripeFormElement;
8
+ private rootComponent;
9
+ private isCreatingStripeForm;
10
+ private saveButton;
11
+ private errorMessageElement;
12
+ private stripeFormContainer;
13
+ private stripeSummaryContainer;
14
+ private billingFormData;
15
+ private isValidBillingForm;
16
+ private isBillingSameAsShipping;
17
+ private stripeFormStatus;
18
+ private isSavingPayment;
19
+ private isInEditMode;
20
+ private savedCardInfo;
21
+ private isChangingPayment;
22
+ get hostClasses(): string[];
23
+ constructor();
24
+ onStoreWatch(changes: IOnStoreChanged[]): void;
25
+ private handleSavingStateChange;
26
+ private handleBillingSameAsShippingChange;
27
+ private handleSavedCardChange;
28
+ private handleEditModeChange;
29
+ afterRender(): Promise<void>;
30
+ private setupStripeFormEventListeners;
31
+ private showStripeSummary;
32
+ private hideStripeSummary;
33
+ private showStripeForm;
34
+ private hideStripeForm;
35
+ private handleChangePayment;
36
+ private updateSaveButtonState;
37
+ private updateErrorMessage;
38
+ private showError;
39
+ protected template(): HTMLElement[];
40
+ private handleSaveButtonClick;
41
+ private validatePrerequisites;
42
+ private findRootComponent;
43
+ private removeExistingStripeForm;
44
+ private doStripeConfig;
45
+ private createAndMountStripeForm;
46
+ disconnected(): void;
47
+ }
@@ -8,15 +8,11 @@ export declare class CheckoutPlaceOrderButtonComponent extends BaseComponent<nul
8
8
  constructor();
9
9
  afterRender(): void;
10
10
  disconnected(): void;
11
- onStoreChanged(changes: IOnStoreChanged[]): boolean;
11
+ onStoreWatch(changes: IOnStoreChanged[]): void;
12
12
  private updateButtonState;
13
- private determineErrorMessage;
14
13
  private clearErrorTimeout;
15
14
  private updateErrorDisplay;
16
15
  private determineButtonState;
17
- private applyButtonState;
18
16
  private handlePlaceOrderClick;
19
- private showPaymentError;
20
- private handleCheckoutReadyForSubmit;
21
17
  protected template(): HTMLElement[];
22
18
  }
@@ -0,0 +1,7 @@
1
+ import { BaseComponent } from '@/core/base-component.service';
2
+ import type { ICheckoutComponent } from '@/interfaces/configs';
3
+ export declare class CheckoutSendAsGiftComponent extends BaseComponent<null, ICheckoutComponent> {
4
+ get hostClasses(): string[];
5
+ constructor();
6
+ protected template(): HTMLElement[];
7
+ }
@@ -17,9 +17,10 @@ export interface IStripeConfig {
17
17
  elementOptions?: Record<string, any>;
18
18
  }
19
19
  export interface IStripeFormStatus {
20
- isComplete: boolean;
21
- hasError: boolean;
20
+ isFormComplete: boolean;
22
21
  isProcessing: boolean;
22
+ hasCompletedPayment: boolean;
23
+ hasError: boolean;
23
24
  errorMessage: string | null;
24
25
  }
25
26
  export declare class CheckoutStripeFormComponent extends HTMLElement {
@@ -31,6 +32,7 @@ export declare class CheckoutStripeFormComponent extends HTMLElement {
31
32
  private _isFormComplete;
32
33
  private _hasUsedCurrentSession;
33
34
  private _stripeConfig;
35
+ private _sessionRefreshPromise;
34
36
  initialize({ data }: {
35
37
  data: {
36
38
  stripeConfig: IStripeConfig;
@@ -38,11 +40,11 @@ export declare class CheckoutStripeFormComponent extends HTMLElement {
38
40
  }): Promise<void>;
39
41
  private initializeStripe;
40
42
  private setupEventListeners;
41
- private handleSubmitEvent;
42
43
  private handleRefreshSession;
43
44
  private handleSubmit;
44
45
  private requestSessionRefresh;
45
46
  private refreshPaymentSession;
47
+ private resetForm;
46
48
  private updateStripeFormStatus;
47
49
  private createConfirmationTokenId;
48
50
  disconnected(): Promise<void>;
@@ -1,20 +1,24 @@
1
+ export * from './checkout-amounts.component';
2
+ export * from './checkout-billing.component';
3
+ export * from './checkout-buyer.component';
4
+ export * from './checkout-buyer-summary.component';
5
+ export * from './checkout-completed.component';
6
+ export * from './checkout-deliver-to.component';
7
+ export * from './checkout-deliver-to-summary.component';
8
+ export * from './checkout-gift-cards.component';
1
9
  export * from './checkout-header.component';
2
- export * from './checkout-information-section.component';
10
+ export * from './checkout-information.component';
11
+ export * from './checkout-item.component';
12
+ export * from './checkout-item-quantity.component';
13
+ export * from './checkout-items.component';
14
+ export * from './checkout-order-summary.component';
15
+ export * from './checkout-payment.component';
16
+ export * from './checkout-payment-summary.component';
17
+ export * from './checkout-place-order-button.component';
3
18
  export * from './checkout-presale-countdown.component';
4
- export * from './checkout-summary-section.component';
5
- export * from './information/checkout-billing-form.component';
6
- export * from './information/checkout-buyer-information-form.component';
7
- export * from './information/checkout-delivery-information-form.component';
8
- export * from './information/checkout-payment-form.component';
9
- export * from './information/checkout-stripe-form.component';
10
- export * from './summary/checkout-amounts.component';
11
- export * from './summary/checkout-completed.component';
12
- export * from './summary/checkout-gift-cards.component';
13
- export * from './summary/checkout-item.component';
14
- export * from './summary/checkout-item-quantity.component';
15
- export * from './summary/checkout-items.component';
16
- export * from './summary/checkout-place-order-button.component';
17
- export * from './summary/checkout-presale-expired.component';
18
- export * from './summary/checkout-promo-code.component';
19
- export * from './summary/checkout-tips.component';
20
- export * from './summary/promo-pc-gc.component';
19
+ export * from './checkout-presale-expired.component';
20
+ export * from './checkout-promo-code.component';
21
+ export * from './checkout-send-as-gift.component';
22
+ export * from './checkout-stripe-form.component';
23
+ export * from './checkout-tips.component';
24
+ export * from './promo-pc-gc.component';
@@ -13,7 +13,6 @@ export declare const giftFormFields: {
13
13
  readonly lastName: "lastName";
14
14
  readonly email: "email";
15
15
  readonly phone: "phone";
16
- readonly birthDate: "birthDate";
17
16
  readonly addressTwo: "addressTwo";
18
17
  readonly message: "message";
19
18
  };
@@ -1,10 +1,3 @@
1
1
  import type { IProductFulfillmentStore } from '@/core/store/interfaces/product.interface';
2
2
  import { type FulfillmentType } from '@/enums';
3
- import type { IProductSize, IRetailer } from '@/interfaces/cloud';
4
- export declare const filterRetailersByFulfillmentType: ({ retailers, selectedSize, engravingLines, fulfillmentType, }: {
5
- retailers: IRetailer[];
6
- selectedSize: IProductSize | null;
7
- engravingLines: string[];
8
- fulfillmentType: FulfillmentType;
9
- }) => IRetailer[];
10
3
  export declare function fulfillmentAddress(address: IProductFulfillmentStore['retailerAddress'], selectedFulfillmentType: FulfillmentType): string;
@@ -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 IBirthdateValidation {
3
3
  required?: boolean;
4
4
  minYear?: number;
@@ -16,7 +16,6 @@ export interface IBirthdateInputComponentParams {
16
16
  label?: string;
17
17
  name: string;
18
18
  disabled?: boolean;
19
- storePath?: string;
20
19
  }
21
20
  export declare class BirthdateInputComponent extends BaseComponent<IBirthdateInputComponentParams, null> {
22
21
  get hostClasses(): string[];
@@ -24,8 +23,7 @@ export declare class BirthdateInputComponent extends BaseComponent<IBirthdateInp
24
23
  private dayInput;
25
24
  private yearInput;
26
25
  private errorContainer;
27
- constructor();
28
- onStoreWatch(changes: IOnStoreChanged[]): void;
26
+ private validationTimeout;
29
27
  afterRender(): void;
30
28
  private populateInitialValue;
31
29
  private setupEventListeners;
@@ -34,6 +32,8 @@ export declare class BirthdateInputComponent extends BaseComponent<IBirthdateInp
34
32
  private formatYear;
35
33
  private handleNavigation;
36
34
  private handleChange;
35
+ private isFieldsComplete;
36
+ private scheduleValidation;
37
37
  private getFormattedValue;
38
38
  private validateDate;
39
39
  private calculateAge;
@@ -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 IInputValidation {
3
3
  required?: boolean;
4
4
  min?: number;
@@ -19,21 +19,21 @@ export interface IInputComponentParams {
19
19
  name: string;
20
20
  autocomplete?: boolean;
21
21
  disabled?: boolean;
22
- storePath?: string;
23
22
  }
24
23
  export declare class InputComponent extends BaseComponent<IInputComponentParams, null> {
25
24
  get hostClasses(): string[];
26
25
  private inputElement;
27
26
  private errorContainer;
28
- constructor();
29
- onStoreChanged(changes: IOnStoreChanged[]): boolean;
27
+ private validationTimeout;
30
28
  private handlePhoneKeydown;
31
29
  private formatPhoneNumber;
32
30
  private formatDate;
33
31
  private validateEmail;
34
32
  private validateTel;
35
33
  private validateDate;
34
+ private isFieldComplete;
36
35
  private validateInput;
36
+ private scheduleValidation;
37
37
  private showErrors;
38
38
  private clearErrors;
39
39
  getValue(): string;
package/docs/ACTIONS.md CHANGED
@@ -24,15 +24,15 @@ const actions = window.elements.actions;
24
24
  // 1. Fire the action (simple, clean)
25
25
  await actions.cart.applyPromoCode('SAVE20');
26
26
 
27
- // 2. Listen for success/failure feedback via events
27
+ // 2. Listen for success/failure feedback via events
28
28
  window.addEventListener('lce:actions.cart_promo_code_applied', function(event) {
29
- const { applied, discountAmount, newTotal } = event.detail.data;
29
+ const { discountAmount, newTotal } = event.detail.data;
30
30
  showSuccessMessage(`🎉 Promo applied! You saved $${discountAmount}!`);
31
31
  updateCartDisplay(newTotal);
32
32
  });
33
33
 
34
34
  window.addEventListener('lce:actions.cart_promo_code_failed', function(event) {
35
- const { attempted, error } = event.detail.data;
35
+ const { error } = event.detail.data;
36
36
  showErrorMessage('Promo code could not be applied. Please try again.');
37
37
  });
38
38
  ```
@@ -262,26 +262,26 @@ All actions provide feedback through events. Here are all available success/fail
262
262
  'lce:actions.cart_product_add_failed' // { identifiers: string[], error: string }
263
263
 
264
264
  // Promo code management
265
- 'lce:actions.cart_promo_code_applied' // { applied: true, discountAmount?: number, newTotal?: number }
266
- 'lce:actions.cart_promo_code_removed' // { applied: false }
267
- 'lce:actions.cart_promo_code_failed' // { attempted: true, error: string }
265
+ 'lce:actions.cart_promo_code_applied' // { discountAmount?: number, newTotal?: number }
266
+ 'lce:actions.cart_promo_code_removed' // { newTotal?: number }
267
+ 'lce:actions.cart_promo_code_failed' // { error: string }
268
268
  ```
269
269
 
270
270
  ### **Checkout Action Events**
271
271
  ```javascript
272
- // Product management
273
- 'lce:actions.checkout_product_add_success' // { itemsAdded: number, identifiers: string[] }
274
- 'lce:actions.checkout_product_add_failed' // { identifiers: string[], error: string }
272
+ // Product management
273
+ 'lce:actions.checkout_product_add_success' // { itemsAdded: number, identifiers: string[], isPresale?: boolean }
274
+ 'lce:actions.checkout_product_add_failed' // { identifiers: string[], error: string, isPresale?: boolean }
275
275
 
276
276
  // Promo code management
277
- 'lce:actions.checkout_promo_code_applied' // { applied: true, discountAmount?: number, newTotal?: number }
278
- 'lce:actions.checkout_promo_code_removed' // { applied: false }
279
- 'lce:actions.checkout_promo_code_failed' // { attempted: true, error: string }
277
+ 'lce:actions.checkout_promo_code_applied' // { discountAmount?: number, newTotal?: number }
278
+ 'lce:actions.checkout_promo_code_removed' // { newTotal?: number }
279
+ 'lce:actions.checkout_promo_code_failed' // { error: string }
280
280
 
281
281
  // Gift card management
282
- 'lce:actions.checkout_gift_card_applied' // { applied: true, newTotal?: number }
283
- 'lce:actions.checkout_gift_card_removed' // { applied: false }
284
- 'lce:actions.checkout_gift_card_failed' // { attempted: true, error: string }
282
+ 'lce:actions.checkout_gift_card_applied' // { newTotal?: number }
283
+ 'lce:actions.checkout_gift_card_removed' // { newTotal?: number }
284
+ 'lce:actions.checkout_gift_card_failed' // { error: string }
285
285
  ```
286
286
 
287
287
  ### **Address Action Events**
@@ -335,14 +335,14 @@ window.addEventListener('lce:actions.cart_product_add_success', function(event)
335
335
  ```javascript
336
336
  // ✅ Create reusable handlers
337
337
  const handlePromoSuccess = (event) => {
338
- const { applied, discountAmount, newTotal } = event.detail.data;
338
+ const { discountAmount, newTotal } = event.detail.data;
339
339
  showSuccessMessage(`Discount applied! Saved: $${discountAmount}`);
340
340
  updatePriceDisplay(newTotal);
341
341
  trackPromoSuccess(discountAmount);
342
342
  };
343
343
 
344
344
  const handlePromoFailure = (event) => {
345
- const { attempted, error } = event.detail.data;
345
+ const { error } = event.detail.data;
346
346
  showErrorMessage('Promo code could not be applied');
347
347
  trackPromoFailure();
348
348
  };
@@ -472,19 +472,19 @@ await actions.cart.applyPromoCode('WELCOME10');
472
472
 
473
473
  // Listen for success
474
474
  window.addEventListener('lce:actions.cart_promo_code_applied', function(event) {
475
- const { applied, discountAmount, newTotal } = event.detail.data;
475
+ const { discountAmount, newTotal } = event.detail.data;
476
476
  showMessage(`Welcome discount applied! You saved $${discountAmount}!`);
477
477
  updateCartDisplay(newTotal);
478
-
478
+
479
479
  // Track successful promo usage
480
480
  analytics.track('Promo Applied', { discount: discountAmount });
481
481
  });
482
482
 
483
483
  // Listen for failure and try fallback
484
484
  window.addEventListener('lce:actions.cart_promo_code_failed', function(event) {
485
- const { attempted, error } = event.detail.data;
485
+ const { error } = event.detail.data;
486
486
  console.log('First promo failed, trying backup promo');
487
-
487
+
488
488
  // Try another strategy
489
489
  actions.cart.applyPromoCode('FIRSTTIME');
490
490
  });
@@ -494,9 +494,9 @@ await actions.cart.removePromoCode();
494
494
 
495
495
  // Listen for removal confirmation
496
496
  window.addEventListener('lce:actions.cart_promo_code_removed', function(event) {
497
- const { applied } = event.detail.data;
497
+ const { newTotal } = event.detail.data;
498
498
  showMessage("Previous promo removed. Applying better discount...");
499
-
499
+
500
500
  // Apply better deal
501
501
  actions.cart.applyPromoCode('BETTER20');
502
502
  });
@@ -624,31 +624,31 @@ const customer = getCurrentCustomer();
624
624
 
625
625
  // Set up event listeners first
626
626
  window.addEventListener('lce:actions.checkout_promo_code_applied', function(event) {
627
- const { applied, discountAmount, newTotal } = event.detail.data;
627
+ const { discountAmount, newTotal } = event.detail.data;
628
628
  showCheckoutSuccess(`Discount applied! You saved $${discountAmount}`);
629
629
  updateCheckoutTotal(newTotal);
630
-
630
+
631
631
  // Track successful conversion optimization
632
632
  analytics.track('Checkout Discount Applied', { discount: discountAmount });
633
633
  });
634
634
 
635
635
  window.addEventListener('lce:actions.checkout_promo_code_failed', function(event) {
636
- const { attempted, error } = event.detail.data;
636
+ const { error } = event.detail.data;
637
637
  console.log('Promo code failed:', error);
638
-
638
+
639
639
  // Try fallback strategies or notify user
640
640
  showCheckoutError('Discount could not be applied');
641
641
  });
642
642
 
643
643
  // Apply gift card event listeners
644
644
  window.addEventListener('lce:actions.checkout_gift_card_applied', function(event) {
645
- const { applied, newTotal } = event.detail.data;
645
+ const { newTotal } = event.detail.data;
646
646
  showCheckoutSuccess('Gift card applied to your order!');
647
647
  updateCheckoutTotal(newTotal);
648
648
  });
649
649
 
650
650
  window.addEventListener('lce:actions.checkout_gift_card_failed', function(event) {
651
- const { attempted, error } = event.detail.data;
651
+ const { error } = event.detail.data;
652
652
  showCheckoutError('Gift card could not be applied. Please check and try again.');
653
653
  });
654
654
 
@@ -329,8 +329,16 @@ data-cart-button="below:#main-navigation" <!-- Place below the target -->
329
329
  data-cart-button="below:main-navigation" <!-- Also works without # prefix -->
330
330
  data-cart-button="replace:.old-cart" <!-- Replace the target -->
331
331
  data-cart-button="inside:.header .nav" <!-- Place inside the target (default) -->
332
+
333
+ <!-- Floating cart button (no badge) -->
334
+ data-cart-button="" <!-- Empty value = floating button -->
332
335
  ```
333
336
 
337
+ **Smart Fallback Behavior:**
338
+ - If the target element is not found, automatically falls back to floating cart button
339
+ - If attribute is present but empty (`data-cart-button=""`), creates floating cart button without badge
340
+ - Element IDs are automatically prefixed with `#` if needed (e.g., `header-cart` becomes `#header-cart`)
341
+
334
342
  #### `data-cart-badge-button`
335
343
 
336
344
  **Type:** `string`
@@ -351,8 +359,17 @@ data-cart-badge-button="above:.header .logo" <!-- Place above the target --
351
359
  data-cart-badge-button="below:#main-navigation" <!-- Place below the target -->
352
360
  data-cart-badge-button="replace:.old-cart" <!-- Replace the target -->
353
361
  data-cart-badge-button="inside:.header .nav" <!-- Place inside the target (default) -->
362
+
363
+ <!-- Floating cart button with badge (default) -->
364
+ data-cart-badge-button="" <!-- Empty value = floating button with badge -->
354
365
  ```
355
366
 
367
+ **Smart Fallback Behavior:**
368
+ - If the target element is not found, automatically falls back to floating cart button with badge
369
+ - If attribute is present but empty (`data-cart-badge-button=""`), creates floating cart button with badge
370
+ - Element IDs are automatically prefixed with `#` if needed
371
+ - If neither `data-cart-button` nor `data-cart-badge-button` is provided, defaults to floating cart button with badge
372
+
356
373
  **Position Prefixes:**
357
374
  - `above:` - Place above the target element
358
375
  - `below:` - Place below the target element
@@ -363,12 +380,14 @@ data-cart-badge-button="inside:.header .nav" <!-- Place inside the target (d
363
380
 
364
381
  **Type:** flag (no value)
365
382
 
366
- Hide cart button completely.
383
+ Hide cart button completely. Use this when you want to manage cart display manually via `client.actions.cart.openCart()`.
367
384
 
368
385
  ```html
369
386
  data-cart-button-hidden
370
387
  ```
371
388
 
389
+ **Important:** When this attribute is present, the SDK will skip all cart button setup, including floating buttons. This takes precedence over `data-cart-button` and `data-cart-badge-button` attributes.
390
+
372
391
  ### Cart Button Examples
373
392
 
374
393
  **Simple cart button (no badge):**