@liquidcommerce/elements-sdk 2.6.0-beta.12 → 2.6.0-beta.121
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.
- package/README.md +100 -2518
- package/dist/index.checkout.esm.js +20445 -0
- package/dist/index.esm.js +28574 -20597
- package/dist/ssr-stub.checkout.esm.js +17 -0
- package/dist/ssr-stub.esm.js +277 -0
- package/dist/types/auto-initialize/checkout.d.ts +2 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +51 -0
- package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +16 -2
- package/dist/types/clients/builder.d.ts +3 -0
- package/dist/types/clients/checkout.d.ts +6 -0
- package/dist/types/clients/helpers.d.ts +8 -0
- package/dist/types/clients/main.d.ts +3 -0
- package/dist/types/constants/core.constant.d.ts +13 -18
- package/dist/types/constants/index.d.ts +1 -0
- package/dist/types/constants/prop65.constant.d.ts +8 -0
- package/dist/types/core/a11y/announcer.service.d.ts +16 -0
- package/dist/types/core/a11y/focus-manager.service.d.ts +21 -0
- package/dist/types/core/a11y/focusable.d.ts +5 -0
- package/dist/types/core/a11y/glyph-button.d.ts +8 -0
- package/dist/types/core/a11y/index.d.ts +6 -0
- package/dist/types/core/a11y/required.d.ts +1 -0
- package/dist/types/core/a11y/single-select.d.ts +20 -0
- package/dist/types/core/api/api-client.service.d.ts +23 -18
- package/dist/types/core/api/api-result.d.ts +19 -0
- package/dist/types/core/api/auth-client.service.d.ts +37 -13
- package/dist/types/core/api/http-client.service.d.ts +0 -8
- package/dist/types/core/base-component.service.d.ts +4 -1
- package/dist/types/core/client/actions/base-action.service.d.ts +22 -0
- package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
- package/dist/types/core/client/actions/client-cart-action.service.d.ts +38 -0
- package/dist/types/core/client/actions/client-checkout-action.service.d.ts +75 -0
- package/dist/types/core/client/actions/client-product-action.service.d.ts +15 -0
- package/dist/types/core/client/client-action.service.d.ts +6 -74
- package/dist/types/core/client/client-config.service.d.ts +10 -5
- package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -1
- package/dist/types/core/google-tag-manager.service.d.ts +10 -1
- package/dist/types/core/logger/logger.service.d.ts +1 -1
- package/dist/types/core/pubsub/interfaces/address.interface.d.ts +3 -0
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +6 -1
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +45 -49
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +15 -7
- package/dist/types/core/pubsub/pubsub.service.d.ts +1 -2
- package/dist/types/core/singleton-manager.service.d.ts +12 -8
- package/dist/types/core/store/interfaces/cart.interface.d.ts +2 -3
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +36 -107
- package/dist/types/core/store/interfaces/core.interface.d.ts +12 -2
- package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +30 -0
- package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
- package/dist/types/core/store/store.constant.d.ts +5 -0
- package/dist/types/core/store/store.service.d.ts +1 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +47 -2
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/index.checkout.d.ts +9 -0
- package/dist/types/index.checkout.umd.d.ts +4 -0
- package/dist/types/index.d.ts +8 -3
- package/dist/types/interfaces/api/cart.interface.d.ts +12 -7
- package/dist/types/interfaces/api/checkout.interface.d.ts +271 -0
- package/dist/types/interfaces/api/index.d.ts +5 -0
- package/dist/types/interfaces/api/product-list.interface.d.ts +15 -6
- package/dist/types/interfaces/api/product.interface.d.ts +10 -4
- package/dist/types/interfaces/client.interface.d.ts +74 -0
- package/dist/types/interfaces/component.interface.d.ts +7 -0
- package/dist/types/interfaces/config.interface.d.ts +44 -0
- package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/cart.interface.d.ts +2 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +3 -1
- package/dist/types/interfaces/configs/global.interface.d.ts +9 -3
- package/dist/types/interfaces/configs/index.d.ts +1 -0
- package/dist/types/interfaces/configs/product-list.interface.d.ts +49 -0
- package/dist/types/interfaces/configs/product.interface.d.ts +7 -1
- package/dist/types/interfaces/injection.interface.d.ts +56 -0
- package/dist/types/modules/address/address-display.component.d.ts +3 -1
- package/dist/types/modules/address/address-input.component.d.ts +10 -1
- package/dist/types/modules/address/address.command.d.ts +2 -1
- package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/cart/cart.commands.d.ts +9 -5
- package/dist/types/modules/cart/components/cart-body.component.d.ts +1 -0
- package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +1 -1
- package/dist/types/modules/cart/components/cart-item-quantity-price.component.d.ts +5 -0
- package/dist/types/modules/cart/components/cart-item.component.d.ts +6 -0
- package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +95 -12
- package/dist/types/modules/checkout/checkout.component.d.ts +7 -1
- package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +5 -2
- package/dist/types/modules/checkout/components/checkout-buyer.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +5 -0
- package/dist/types/modules/checkout/components/checkout-deliver-to.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-delivery-method.component.d.ts +22 -0
- package/dist/types/modules/checkout/components/checkout-express-checkout.component.d.ts +61 -0
- package/dist/types/modules/checkout/components/checkout-express-completion.component.d.ts +21 -0
- package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-item-quantity.component.d.ts +4 -0
- package/dist/types/modules/checkout/components/checkout-items.component.d.ts +4 -3
- package/dist/types/modules/checkout/components/checkout-order-summary.component.d.ts +3 -0
- package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +6 -1
- package/dist/types/modules/checkout/components/checkout-place-order-button.component.d.ts +1 -5
- package/dist/types/modules/checkout/components/checkout-presale-countdown.component.d.ts +15 -1
- package/dist/types/modules/checkout/components/checkout-presale-expired.component.d.ts +7 -1
- package/dist/types/modules/checkout/components/checkout-prop65-warning.component.d.ts +8 -0
- package/dist/types/modules/checkout/components/checkout-send-as-gift.component.d.ts +3 -0
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +7 -2
- package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +4 -2
- package/dist/types/modules/checkout/components/index.d.ts +4 -0
- package/dist/types/modules/checkout/components/promo-pc-gc.component.d.ts +0 -2
- package/dist/types/modules/checkout/components/required-fields-legend.d.ts +1 -0
- package/dist/types/modules/checkout/constant.d.ts +15 -0
- package/dist/types/modules/checkout/customer-prefill.d.ts +5 -0
- package/dist/types/modules/checkout/express-wallet.d.ts +12 -0
- package/dist/types/modules/checkout/payment-session-error.d.ts +4 -0
- package/dist/types/modules/checkout/styles/delivery-method.style.d.ts +1 -0
- package/dist/types/modules/checkout/styles/express-checkout.style.d.ts +1 -0
- package/dist/types/modules/checkout/styles/express-completion.style.d.ts +1 -0
- package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product/components/components.d.ts +26 -2
- package/dist/types/modules/product/components/index.d.ts +1 -0
- package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +8 -1
- package/dist/types/modules/product/components/product-delivery-estimate.component.d.ts +11 -0
- package/dist/types/modules/product/components/product-description.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-drawer.component.d.ts +6 -0
- package/dist/types/modules/product/components/product-image-carousel.component.d.ts +5 -0
- package/dist/types/modules/product/components/product-options.component.d.ts +2 -1
- package/dist/types/modules/product/components/product-prop65-warning.d.ts +1 -0
- package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +6 -0
- package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +12 -2
- package/dist/types/modules/product/components/product-retailers-popup.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
- package/dist/types/modules/product/product.commands.d.ts +5 -5
- package/dist/types/modules/product/product.component.d.ts +3 -0
- package/dist/types/modules/product/styles/prop65-warning.style.d.ts +1 -0
- package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/index.d.ts +6 -0
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +9 -0
- package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
- package/dist/types/modules/product-list/components/card-components/product-fulfillment-text.d.ts +2 -0
- package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +14 -0
- package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +11 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +14 -0
- package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
- package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts → filter-components/product-list-checkbox-filter.d.ts} +1 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +15 -0
- package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-price-filter.components.d.ts → filter-components/product-list-price-filter.d.ts} +2 -1
- package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +7 -0
- package/dist/types/modules/product-list/components/index.d.ts +6 -2
- package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +3 -1
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +39 -31
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +12 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +58 -36
- package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +22 -0
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +54 -0
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +25 -0
- package/dist/types/modules/product-list/product-list-filter.registry.d.ts +42 -0
- package/dist/types/modules/product-list/product-list-filter.utils.d.ts +7 -0
- package/dist/types/modules/product-list/product-list-order.utils.d.ts +3 -0
- package/dist/types/modules/product-list/product-list-query-params.utils.d.ts +3 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +22 -7
- package/dist/types/modules/product-list/product-list.component.d.ts +23 -47
- package/dist/types/modules/product-list/product-list.constants.d.ts +38 -0
- package/dist/types/modules/product-list/product-list.interface.d.ts +17 -28
- package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
- package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
- package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
- package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -2
- package/dist/types/modules/ui-components/alert/alert.component.d.ts +10 -10
- package/dist/types/modules/ui-components/buttons/buttons-open-cart.component.d.ts +5 -0
- package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +15 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +9 -1
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +7 -1
- package/dist/types/modules/ui-components/input/index.d.ts +0 -1
- package/dist/types/modules/ui-components/input/input.component.d.ts +15 -2
- package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
- package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +7 -1
- package/dist/types/ssr/stub.checkout.d.ts +6 -0
- package/dist/types/ssr/stub.d.ts +10 -0
- package/dist/types/static/icon/arrow-right.icon.d.ts +1 -1
- package/dist/types/static/icon/bag.icon.d.ts +1 -1
- package/dist/types/static/icon/check.icon.d.ts +2 -0
- package/dist/types/static/icon/checkbox.icon.d.ts +1 -1
- package/dist/types/static/icon/chevron-down.icon.d.ts +1 -1
- package/dist/types/static/icon/chevron-left.icon.d.ts +1 -1
- package/dist/types/static/icon/chevron-up.icon.d.ts +1 -1
- package/dist/types/static/icon/close.icon.d.ts +1 -1
- package/dist/types/static/icon/error-info.icon.d.ts +1 -1
- package/dist/types/static/icon/filter.icon.d.ts +1 -1
- package/dist/types/static/icon/icon.a11y.d.ts +1 -0
- package/dist/types/static/icon/icon.types.d.ts +1 -0
- package/dist/types/static/icon/index.d.ts +2 -0
- package/dist/types/static/icon/info.icon.d.ts +1 -1
- package/dist/types/static/icon/loading-spinner.icon.d.ts +1 -1
- package/dist/types/static/icon/search.icon.d.ts +1 -1
- package/dist/types/static/icon/success.icon.d.ts +1 -1
- package/dist/types/static/icon/trash.icon.d.ts +1 -1
- package/dist/types/static/icon/warning.icon.d.ts +1 -1
- package/dist/types/utils/dom-compat.d.ts +2 -0
- package/dist/types/utils/format.d.ts +9 -14
- package/dist/types/utils/image-bg-removal.d.ts +3 -0
- package/dist/types/utils/product-selection.d.ts +16 -0
- package/dist/types/utils/product.d.ts +21 -0
- package/dist/types/utils/timezone.d.ts +6 -0
- package/docs/v1/README.md +213 -0
- package/docs/v1/api/actions/address-actions.md +286 -0
- package/docs/v1/api/actions/cart-actions.md +364 -0
- package/docs/v1/api/actions/checkout-actions.md +586 -0
- package/docs/v1/api/actions/product-actions.md +204 -0
- package/docs/v1/api/client.md +664 -0
- package/docs/v1/api/configuration.md +583 -0
- package/docs/v1/api/injection-methods.md +331 -0
- package/docs/v1/api/typescript-types.md +501 -0
- package/docs/v1/api/ui-helpers.md +200 -0
- package/docs/v1/examples/advanced-patterns.md +199 -0
- package/docs/v1/examples/checkout-flow.md +90 -0
- package/docs/v1/examples/custom-theming.md +76 -0
- package/docs/v1/examples/multi-product-page.md +90 -0
- package/docs/v1/examples/simple-product-page.md +89 -0
- package/docs/v1/getting-started/concepts.md +521 -0
- package/docs/v1/getting-started/installation.md +351 -0
- package/docs/v1/getting-started/quick-start.md +410 -0
- package/docs/v1/guides/accessibility.md +288 -0
- package/docs/v1/guides/address-component.md +435 -0
- package/docs/v1/guides/best-practices.md +365 -0
- package/docs/v1/guides/cart-component.md +800 -0
- package/docs/v1/guides/checkout-component.md +817 -0
- package/docs/v1/guides/events.md +1004 -0
- package/docs/v1/guides/product-component.md +761 -0
- package/docs/v1/guides/product-list-component.md +730 -0
- package/docs/v1/guides/theming.md +243 -0
- package/docs/v1/integration/angular.md +39 -0
- package/docs/v1/integration/laravel.md +41 -0
- package/docs/v1/integration/nextjs.md +69 -0
- package/docs/v1/integration/proxy-setup.md +106 -0
- package/docs/v1/integration/react.md +64 -0
- package/docs/v1/integration/vanilla-js.md +84 -0
- package/docs/v1/integration/vue.md +58 -0
- package/docs/v1/reference/analytics.md +133 -0
- package/docs/v1/reference/browser-support.md +47 -0
- package/docs/v1/reference/error-handling.md +83 -0
- package/docs/v1/reference/performance.md +52 -0
- package/docs/v1/reference/telemetry.md +85 -0
- package/docs/v1/reference/troubleshooting.md +135 -0
- package/package.json +75 -45
- package/dist/types/elements-builder-client.d.ts +0 -2
- package/dist/types/elements-client-helper.d.ts +0 -4
- package/dist/types/elements-client.d.ts +0 -2
- package/dist/types/enums/cloud.enum.d.ts +0 -97
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +0 -218
- package/dist/types/interfaces/cloud/core.interface.d.ts +0 -22
- package/dist/types/interfaces/cloud/index.d.ts +0 -3
- package/dist/types/interfaces/cloud/retailer.interface.d.ts +0 -67
- package/dist/types/interfaces/cloud/user.interface.d.ts +0 -100
- package/dist/types/interfaces/core.interface.d.ts +0 -111
- package/dist/types/modules/checkout/components/checkout.type.d.ts +0 -4
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
- package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
- package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
- package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
- package/dist/types/utils/helper.d.ts +0 -28
- package/docs/ACTIONS.md +0 -1300
- package/docs/BROWSER_SUPPORT.md +0 -279
- package/docs/CONFIGURATION.md +0 -853
- package/docs/DOCUMENTATION_INDEX.md +0 -311
- package/docs/EVENTS.md +0 -798
- package/docs/PROXY.md +0 -228
- package/docs/THEMING.md +0 -592
- package/docs/TROUBLESHOOTING.md +0 -793
- package/umd/elements.js +0 -1
- /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
- /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
# Checkout Actions API
|
|
2
|
+
|
|
3
|
+
Checkout actions allow you to programmatically control the checkout flow.
|
|
4
|
+
|
|
5
|
+
## Navigation Actions
|
|
6
|
+
|
|
7
|
+
> **Note:** `openCheckout()`, `closeCheckout()`, and `toggleCheckout()` are only available on the full `Elements()` client's `actions.checkout`. They are **not** present on the checkout-only client (`ElementsCheckout()`), whose `actions.checkout` is typed `IElementsCheckoutActions = Omit<ICheckoutActions, 'openCheckout' | 'closeCheckout' | 'toggleCheckout'>`. The remaining checkout actions are available on both clients.
|
|
8
|
+
|
|
9
|
+
### actions.checkout.openCheckout()
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
openCheckout(): void
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Opens the checkout drawer or navigates to checkout page.
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
window.LiquidCommerce.elements.actions.checkout.openCheckout();
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### actions.checkout.closeCheckout()
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
closeCheckout(): void
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Closes the checkout drawer.
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
window.LiquidCommerce.elements.actions.checkout.closeCheckout();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### actions.checkout.toggleCheckout()
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
toggleCheckout(): void
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Toggles checkout open/closed.
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
window.LiquidCommerce.elements.actions.checkout.toggleCheckout();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### actions.checkout.exitCheckout()
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
exitCheckout(): void
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Navigates away from checkout (requires `exitUrl` configuration).
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
window.LiquidCommerce.elements.actions.checkout.exitCheckout();
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Product Actions
|
|
58
|
+
|
|
59
|
+
### actions.checkout.addProduct()
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
addProduct(params: IAddProductParams[], openCheckout?: boolean): Promise<void>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Add products and open checkout in one call. Products are added to the cart (via the cart action, or directly when none is wired up), then checkout is prepared and opened. For a checkout without a cart session, use `addAnonymousProduct`.
|
|
66
|
+
|
|
67
|
+
`IAddProductParams.engravingLines?: string[]` — optional engraving. Same rules as [`actions.cart.addProduct()`](./cart-actions.md#actionscartaddproduct): invalid input is ignored, blanks stripped, lines clamped to the product's `maxLines` / `maxCharsPerLine`, and engraving is dropped (without failing) when the product, variant, or fulfillment doesn't support it.
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
await window.LiquidCommerce.elements.actions.checkout.addProduct([
|
|
71
|
+
{
|
|
72
|
+
identifier: '00619947000020',
|
|
73
|
+
fulfillmentType: 'shipping',
|
|
74
|
+
quantity: 1
|
|
75
|
+
}
|
|
76
|
+
], true); // Open checkout after adding
|
|
77
|
+
|
|
78
|
+
// With engraving
|
|
79
|
+
await window.LiquidCommerce.elements.actions.checkout.addProduct([
|
|
80
|
+
{
|
|
81
|
+
identifier: '00619947000020',
|
|
82
|
+
fulfillmentType: 'shipping',
|
|
83
|
+
quantity: 1,
|
|
84
|
+
engravingLines: ['For Dad']
|
|
85
|
+
}
|
|
86
|
+
], true);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### actions.checkout.addAnonymousProduct()
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
addAnonymousProduct(
|
|
93
|
+
params: IAnonymousCheckoutAddProductParams
|
|
94
|
+
): Promise<IAnonymousCheckoutAddProductResponse>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Add a product to checkout without requiring a cart session. Used for direct-to-checkout flows.
|
|
98
|
+
|
|
99
|
+
**Parameters** (`IAnonymousCheckoutAddProductParams`):
|
|
100
|
+
|
|
101
|
+
| Field | Type | Required | Description |
|
|
102
|
+
|-------|------|----------|-------------|
|
|
103
|
+
| `location` | `ILocation` | Yes | `{ address: IAddressAddress; coordinates: IAddressCoordinates }` |
|
|
104
|
+
| `items` | `IAnonymousCheckoutAddProductItem[]` | No | Products to add: `{ identifier, fulfillmentType, quantity }`. Provide `items` **or** `cartItems`. |
|
|
105
|
+
| `cartItems` | `ICartUpdateItem[]` | No | Pre-resolved cart line items: `{ id?, partNumber, quantity, fulfillmentId, engravingLines? }` (alternative to `items`). |
|
|
106
|
+
| `promoCode` | `string` | No | Promo code applied while creating the anonymous checkout. |
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
const result = await window.LiquidCommerce.elements.actions.checkout
|
|
110
|
+
.addAnonymousProduct({
|
|
111
|
+
items: [
|
|
112
|
+
{ identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 }
|
|
113
|
+
],
|
|
114
|
+
location: {
|
|
115
|
+
address: { one: '123 Main St', two: '', city: 'New York', state: 'NY', zip: '10001', country: 'US' },
|
|
116
|
+
coordinates: { latitude: 40.7128, longitude: -74.006 }
|
|
117
|
+
},
|
|
118
|
+
promoCode: 'WELCOME10' // optional
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Returns** (`IAnonymousCheckoutAddProductResponse`):
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
interface IAnonymousCheckoutAddProductResponse {
|
|
126
|
+
checkout: ICheckoutPrepare | null; // the prepared checkout (see below), or null on failure
|
|
127
|
+
unavailableItems: IAnonymousCheckoutUnavailableItem[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface IAnonymousCheckoutUnavailableItem {
|
|
131
|
+
identifier: string;
|
|
132
|
+
productName: string | null;
|
|
133
|
+
fulfillmentType: FulfillmentType; // 'shipping' | 'onDemand'
|
|
134
|
+
reason: 'product_not_available' | 'fulfillment_not_available';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface ICheckoutPrepare {
|
|
138
|
+
token: string;
|
|
139
|
+
cartId: string;
|
|
140
|
+
customer: ICheckoutCustomer;
|
|
141
|
+
isGift: boolean;
|
|
142
|
+
billingSameAsShipping: boolean;
|
|
143
|
+
payment?: string;
|
|
144
|
+
giftOptions: ICheckoutGiftRecipient;
|
|
145
|
+
marketingPreferences: ICheckoutMarketingPreferences;
|
|
146
|
+
shippingAddress: ICheckoutShippingAddress;
|
|
147
|
+
billingAddress: ICheckoutBilling;
|
|
148
|
+
promoCode: ICheckoutPromoCode | null;
|
|
149
|
+
amounts: ICheckoutAmounts;
|
|
150
|
+
giftCards: ICheckoutGiftCard[];
|
|
151
|
+
presale: ICheckoutPresale | null;
|
|
152
|
+
itemsQuantity: number;
|
|
153
|
+
items: Record<string /* cart item ID */, ICheckoutItem>;
|
|
154
|
+
retailers: Record<string /* retailer ID */, ICheckoutRetailer>;
|
|
155
|
+
events: ICheckoutEvent[];
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Promo & Gift Card Actions
|
|
160
|
+
|
|
161
|
+
### actions.checkout.applyPromoCode()
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
applyPromoCode(promoCode: string): Promise<void>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Apply a promo code during checkout.
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
await window.LiquidCommerce.elements.actions.checkout.applyPromoCode('WELCOME10');
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### actions.checkout.removePromoCode()
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
removePromoCode(): Promise<void>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Remove the active promo code.
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
await window.LiquidCommerce.elements.actions.checkout.removePromoCode();
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### actions.checkout.applyGiftCard()
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
applyGiftCard(code: string): Promise<void>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Apply a gift card.
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
await window.LiquidCommerce.elements.actions.checkout.applyGiftCard('GIFT-1234-5678-9012');
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### actions.checkout.removeGiftCard()
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
removeGiftCard(code: string): Promise<void>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Remove a gift card.
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
await window.LiquidCommerce.elements.actions.checkout.removeGiftCard('GIFT-1234-5678-9012');
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Toggle Actions
|
|
210
|
+
|
|
211
|
+
### actions.checkout.toggleIsGift()
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
toggleIsGift(active?: boolean): Promise<void>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Enable/disable gift mode.
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
// Enable
|
|
221
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(true);
|
|
222
|
+
|
|
223
|
+
// Disable
|
|
224
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(false);
|
|
225
|
+
|
|
226
|
+
// Toggle
|
|
227
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift();
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### actions.checkout.toggleBillingSameAsShipping()
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
toggleBillingSameAsShipping(active?: boolean): Promise<void>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Set whether billing address matches shipping.
|
|
237
|
+
|
|
238
|
+
```javascript
|
|
239
|
+
// Use shipping address for billing
|
|
240
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(true);
|
|
241
|
+
|
|
242
|
+
// Use different billing address
|
|
243
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(false);
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### actions.checkout.toggleMarketingPreferences()
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
toggleMarketingPreferences(field: 'canEmail' | 'canSms', active: boolean): Promise<void>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Set marketing opt-in preferences.
|
|
253
|
+
|
|
254
|
+
```javascript
|
|
255
|
+
// Opt into email marketing
|
|
256
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
|
|
257
|
+
|
|
258
|
+
// Opt into SMS marketing
|
|
259
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Form Update Actions
|
|
263
|
+
|
|
264
|
+
### actions.checkout.updateCustomerInfo()
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
updateCustomerInfo(params: Record<CustomerFieldName, string>, options?: { saveIfValid?: boolean }): Promise<void>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Pre-fill customer information.
|
|
271
|
+
|
|
272
|
+
**Available fields:**
|
|
273
|
+
- `firstName`, `lastName`
|
|
274
|
+
- `email`, `phone`
|
|
275
|
+
- `birthDate`, `addressTwo`
|
|
276
|
+
- `company`
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
|
|
280
|
+
firstName: 'John',
|
|
281
|
+
lastName: 'Doe',
|
|
282
|
+
email: 'john@example.com',
|
|
283
|
+
phone: '+15551234567',
|
|
284
|
+
birthDate: '1990-01-01',
|
|
285
|
+
addressTwo: 'Apt 4B',
|
|
286
|
+
company: 'Acme Corp'
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### actions.checkout.updateBillingInfo()
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
updateBillingInfo(params: Record<BillingFieldName, string>): void
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Pre-fill billing address.
|
|
297
|
+
|
|
298
|
+
**Available fields:**
|
|
299
|
+
- `firstName`, `lastName`
|
|
300
|
+
- `email`, `phone`, `company`
|
|
301
|
+
- `addressOne`, `addressTwo`
|
|
302
|
+
- `city`, `state`, `zipCode`
|
|
303
|
+
|
|
304
|
+
```javascript
|
|
305
|
+
window.LiquidCommerce.elements.actions.checkout.updateBillingInfo({
|
|
306
|
+
firstName: 'John',
|
|
307
|
+
lastName: 'Doe',
|
|
308
|
+
email: 'john@example.com',
|
|
309
|
+
phone: '+15551234567',
|
|
310
|
+
company: 'Acme Corp',
|
|
311
|
+
addressOne: '123 Main St',
|
|
312
|
+
addressTwo: 'Apt 4B',
|
|
313
|
+
city: 'New York',
|
|
314
|
+
state: 'NY',
|
|
315
|
+
zipCode: '10001'
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### actions.checkout.updateGiftInfo()
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
updateGiftInfo(params: Record<GiftFieldName, string>): void
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Pre-fill gift recipient information.
|
|
326
|
+
|
|
327
|
+
**Available fields:**
|
|
328
|
+
- `firstName`, `lastName`
|
|
329
|
+
- `email`, `phone`
|
|
330
|
+
- `message`, `addressTwo`
|
|
331
|
+
|
|
332
|
+
```javascript
|
|
333
|
+
window.LiquidCommerce.elements.actions.checkout.updateGiftInfo({
|
|
334
|
+
firstName: 'Jane',
|
|
335
|
+
lastName: 'Smith',
|
|
336
|
+
email: 'jane@example.com',
|
|
337
|
+
phone: '+15559876543',
|
|
338
|
+
addressTwo: 'Suite 200',
|
|
339
|
+
message: 'Happy Birthday!',
|
|
340
|
+
});
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Payment Method
|
|
344
|
+
|
|
345
|
+
### actions.checkout.setSavedPaymentMethod()
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
setSavedPaymentMethod(params: {
|
|
349
|
+
id: string;
|
|
350
|
+
card: {
|
|
351
|
+
brand: string;
|
|
352
|
+
last4: string;
|
|
353
|
+
expMonth?: string | number;
|
|
354
|
+
expYear?: string | number;
|
|
355
|
+
};
|
|
356
|
+
}): void
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Pre-select a saved payment method for the checkout. When set, the payment step renders a read-only card summary (e.g. `Visa ending in 4242`) instead of the Stripe card form, and the shopper places the order without re-entering card details. The `id` is bound to the checkout when the payment form is saved.
|
|
360
|
+
|
|
361
|
+
`id` must be a payment method the backend already holds for the checkout's customer (for example, a card fetched server-side and handed to the page). If the backend does not recognize the `id` for this checkout's customer, saving the payment step fails with an error (`The selected payment method could not be applied to this checkout.`) and the order cannot be placed — pass only a payment method confirmed to belong to the customer. The `card` fields are used only to render the summary. It can be set at any time — before opening checkout, or while it is open — and the payment step updates accordingly. The selection persists across a cart reset within the session.
|
|
362
|
+
|
|
363
|
+
```javascript
|
|
364
|
+
window.LiquidCommerce.elements.actions.checkout.setSavedPaymentMethod({
|
|
365
|
+
id: 'pm_123',
|
|
366
|
+
card: { brand: 'Visa', last4: '4242', expMonth: '12', expYear: '30' }
|
|
367
|
+
});
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### actions.checkout.clearSavedPaymentMethod()
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
clearSavedPaymentMethod(): void
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Remove a previously set saved payment method, restoring the Stripe card-entry form.
|
|
377
|
+
|
|
378
|
+
```javascript
|
|
379
|
+
window.LiquidCommerce.elements.actions.checkout.clearSavedPaymentMethod();
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Data Retrieval
|
|
383
|
+
|
|
384
|
+
### actions.checkout.getDetails()
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
getDetails(): ICheckoutDetailsEventData
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Retrieve current checkout information.
|
|
391
|
+
|
|
392
|
+
```javascript
|
|
393
|
+
const checkout = window.LiquidCommerce.elements.actions.checkout.getDetails();
|
|
394
|
+
|
|
395
|
+
console.log(`Cart ID: ${checkout.cartId}`);
|
|
396
|
+
console.log(`Total: $${checkout.amounts.total / 100}`);
|
|
397
|
+
console.log(`Items: ${checkout.itemCount}`);
|
|
398
|
+
console.log(`Is Gift: ${checkout.isGift}`);
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**Returns:**
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
interface ICheckoutDetailsEventData {
|
|
405
|
+
token: string;
|
|
406
|
+
cartId: string;
|
|
407
|
+
isGift: boolean;
|
|
408
|
+
billingSameAsShipping: boolean;
|
|
409
|
+
marketingPreferences: {
|
|
410
|
+
canEmail: boolean;
|
|
411
|
+
canSms: boolean;
|
|
412
|
+
};
|
|
413
|
+
hasPromoCode: boolean;
|
|
414
|
+
hasGiftCards: boolean;
|
|
415
|
+
amounts: ICheckoutAmounts;
|
|
416
|
+
itemCount: number;
|
|
417
|
+
items: Record<string, ICheckoutItem>;
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### actions.checkout.getProductAvailabilityByState()
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
getProductAvailabilityByState(
|
|
425
|
+
identifiers: string[],
|
|
426
|
+
state?: string
|
|
427
|
+
): Promise<IProductAvailabilityResponse>
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Check product availability across states from the checkout context.
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
const availability = await window.LiquidCommerce.elements.actions.checkout
|
|
434
|
+
.getProductAvailabilityByState(['00619947000020'], 'CA');
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
| Parameter | Type | Required | Description |
|
|
438
|
+
|---------------|----------|----------|--------------------------------------|
|
|
439
|
+
| `identifiers` | string[] | Yes | Array of product UPCs, SKUs, or IDs |
|
|
440
|
+
| `state` | string | No | Two-letter state code (e.g., `'NY'`) |
|
|
441
|
+
|
|
442
|
+
## Use Cases
|
|
443
|
+
|
|
444
|
+
### Pre-fill for Logged-In Users
|
|
445
|
+
|
|
446
|
+
```javascript
|
|
447
|
+
window.addEventListener('lce:actions.checkout_opened', () => {
|
|
448
|
+
if (userIsLoggedIn) {
|
|
449
|
+
window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
|
|
450
|
+
firstName: currentUser.firstName,
|
|
451
|
+
lastName: currentUser.lastName,
|
|
452
|
+
email: currentUser.email,
|
|
453
|
+
phone: currentUser.phone
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Track Checkout Progress
|
|
460
|
+
|
|
461
|
+
```javascript
|
|
462
|
+
window.addEventListener('lce:actions.checkout_customer_information_updated', () => {
|
|
463
|
+
gtag('event', 'checkout_progress', { step: 'customer_info' });
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
window.addEventListener('lce:actions.checkout_submit_started', () => {
|
|
467
|
+
gtag('event', 'checkout_progress', { step: 'payment' });
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
window.addEventListener('lce:actions.checkout_submit_completed', (event) => {
|
|
471
|
+
const { orderNumber, orderTotal } = event.detail.data;
|
|
472
|
+
|
|
473
|
+
gtag('event', 'purchase', {
|
|
474
|
+
transaction_id: orderNumber,
|
|
475
|
+
value: orderTotal / 100,
|
|
476
|
+
currency: 'USD'
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Gift Flow
|
|
482
|
+
|
|
483
|
+
```javascript
|
|
484
|
+
document.getElementById('gift-checkbox').addEventListener('change', async (e) => {
|
|
485
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(e.target.checked);
|
|
486
|
+
|
|
487
|
+
if (e.target.checked) {
|
|
488
|
+
showGiftForm();
|
|
489
|
+
} else {
|
|
490
|
+
hideGiftForm();
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Auto-Apply Campaign Codes
|
|
496
|
+
|
|
497
|
+
```javascript
|
|
498
|
+
const params = new URLSearchParams(window.location.search);
|
|
499
|
+
const campaignCode = params.get('promo');
|
|
500
|
+
|
|
501
|
+
if (campaignCode) {
|
|
502
|
+
window.addEventListener('lce:actions.checkout_opened', async () => {
|
|
503
|
+
try {
|
|
504
|
+
await window.LiquidCommerce.elements.actions.checkout.applyPromoCode(campaignCode);
|
|
505
|
+
} catch (error) {
|
|
506
|
+
console.log('Invalid campaign code');
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
## Events
|
|
513
|
+
|
|
514
|
+
Checkout actions trigger numerous events. See [Checkout Events](../../guides/events.md#checkout-events) for complete list.
|
|
515
|
+
|
|
516
|
+
Key events:
|
|
517
|
+
- `checkout_opened`, `checkout_closed`
|
|
518
|
+
- `checkout_customer_information_updated`
|
|
519
|
+
- `checkout_submit_started`, `checkout_submit_completed`, `checkout_submit_failed`
|
|
520
|
+
- `checkout_promo_code_applied`, `checkout_promo_code_failed`
|
|
521
|
+
- `checkout_gift_card_applied`, `checkout_gift_card_failed`
|
|
522
|
+
|
|
523
|
+
## See Also
|
|
524
|
+
|
|
525
|
+
- [Checkout Component Guide](../../guides/checkout-component.md)
|
|
526
|
+
- [Checkout Events](../../guides/events.md#checkout-events)
|
|
527
|
+
- [Cart Actions](./cart-actions.md)
|
|
528
|
+
|
|
529
|
+
### Preparing complete account delivery details
|
|
530
|
+
|
|
531
|
+
After `lce:actions.checkout_loaded`, call
|
|
532
|
+
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
533
|
+
to validate and prepare complete account details, then show their editable summary.
|
|
534
|
+
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
535
|
+
(age 21+, year 1930 or later). The `birthDate` may be blank when the partner does not require a
|
|
536
|
+
date of birth (`checkout.layout.requireBirthDate: false`); a supplied one is still validated.
|
|
537
|
+
A shipping street must already be selected.
|
|
538
|
+
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
539
|
+
Partial or invalid details stay in the form; backend validation failures reject the
|
|
540
|
+
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
|
541
|
+
|
|
542
|
+
The option skips gifts, saved forms, in-flight saves, and customer forms the shopper
|
|
543
|
+
has edited during the current checkout. It does not overwrite those forms. Edits or
|
|
544
|
+
address/checkout changes during preparation prevent a stale response from closing
|
|
545
|
+
the form. Without the option, this action only prefills fields, as before.
|
|
546
|
+
|
|
547
|
+
Apple Pay and Google Pay selection displays **Continue with Apple Pay** or
|
|
548
|
+
**Continue with Google Pay**. This opens the wallet to save a payment method; the
|
|
549
|
+
shopper still reviews and places the order afterward. It is not express checkout.
|
|
550
|
+
|
|
551
|
+
After wallet cancellation, the same Continue action remains available. If authorization
|
|
552
|
+
succeeded but saving the method failed, **Retry saving Apple Pay/Google Pay** reuses
|
|
553
|
+
the existing authorization rather than opening the wallet again.
|
|
554
|
+
|
|
555
|
+
### Saved account marketing preferences
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
setSavedMarketingPreferences(preferences: { canEmail?: boolean; canSms?: boolean }): Promise<void>
|
|
559
|
+
clearSavedMarketingPreferences(): void
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
Call `actions.checkout.setSavedMarketingPreferences()` with known recorded account
|
|
563
|
+
choices, including `false`, before checkout loads. Only boolean values are used;
|
|
564
|
+
missing/null/unrecognized values remain unknown. The first checkout prepare uses
|
|
565
|
+
saved values instead of tenant defaults. Each channel's prompt is hidden only
|
|
566
|
+
after the server confirms that saved choice. Unknown channels retain their normal
|
|
567
|
+
checkout prompts. The actions are available in both full and checkout-only clients.
|
|
568
|
+
|
|
569
|
+
Calling the setter during an active checkout prepares untouched channels and
|
|
570
|
+
preserves shopper checkbox edits. Backend failure rejects the promise, displays
|
|
571
|
+
an error, and leaves prompts available; the host should catch the rejection.
|
|
572
|
+
The same call can retry. Applying values does not call a subscription service.
|
|
573
|
+
It supplies the account's recorded choices to this checkout.
|
|
574
|
+
|
|
575
|
+
Saved choices persist across cart resets in the same SDK session. Call
|
|
576
|
+
`clearSavedMarketingPreferences()` on sign-out, account change, and host cleanup.
|
|
577
|
+
Clearing reveals the prompts and restores configured guest defaults. It invalidates
|
|
578
|
+
stale responses while draining outstanding preference requests; checkout completion
|
|
579
|
+
prepares the current choices before submitting the checkout token. A load already
|
|
580
|
+
in progress still finishes and reconciles the current account's values. Bind a new
|
|
581
|
+
account only to its own checkout; the host remains responsible for account/cart
|
|
582
|
+
ownership and for reloading checkout when identity changes.
|
|
583
|
+
|
|
584
|
+
Order completion waits for queued preference work. It cannot race a late saved
|
|
585
|
+
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
586
|
+
fails, the shopper can retry or explicitly choose the visible channel preference.
|