@liquidcommerce/elements-sdk 2.6.0-beta.13 → 2.6.0-beta.131
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 +102 -2518
- package/dist/index.checkout.esm.js +22524 -0
- package/dist/index.esm.js +30689 -20632
- package/dist/ssr-stub.checkout.esm.js +17 -0
- package/dist/ssr-stub.esm.js +281 -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 +20 -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-analytics-action.service.d.ts +35 -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 +81 -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 +7 -74
- package/dist/types/core/client/client-config.service.d.ts +12 -5
- package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -1
- package/dist/types/core/google-tag-manager.service.d.ts +13 -3
- 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 +54 -48
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +18 -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 +40 -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 +51 -2
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/index.checkout.d.ts +11 -0
- package/dist/types/index.checkout.umd.d.ts +4 -0
- package/dist/types/index.d.ts +9 -3
- package/dist/types/interfaces/analytics.interface.d.ts +41 -0
- package/dist/types/interfaces/api/cart.interface.d.ts +14 -7
- package/dist/types/interfaces/api/checkout.interface.d.ts +277 -0
- package/dist/types/interfaces/api/delivery.interface.d.ts +24 -0
- package/dist/types/interfaces/api/index.d.ts +6 -0
- package/dist/types/interfaces/api/product-list.interface.d.ts +15 -6
- package/dist/types/interfaces/api/product.interface.d.ts +12 -4
- package/dist/types/interfaces/client.interface.d.ts +79 -0
- package/dist/types/interfaces/component.interface.d.ts +7 -0
- package/dist/types/interfaces/config.interface.d.ts +45 -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 +11 -1
- package/dist/types/modules/address/address.command.d.ts +3 -2
- package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/cart/cart.commands.d.ts +11 -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 +8 -0
- package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +134 -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 +9 -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 +24 -0
- package/dist/types/modules/checkout/components/checkout-delivery-scheduling.component.d.ts +53 -0
- package/dist/types/modules/checkout/components/checkout-express-checkout.component.d.ts +63 -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-item.component.d.ts +2 -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 +9 -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 -3
- package/dist/types/modules/checkout/components/checkout-stripe-handler.component.d.ts +4 -0
- package/dist/types/modules/checkout/components/checkout-tips.component.d.ts +4 -2
- package/dist/types/modules/checkout/components/index.d.ts +5 -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/stripe-js.d.ts +2 -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 +27 -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 +8 -0
- package/dist/types/ssr/stub.d.ts +12 -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/delivery-scheduling.d.ts +72 -0
- 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/places-session-token.d.ts +1 -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 +214 -0
- package/docs/v1/api/actions/address-actions.md +290 -0
- package/docs/v1/api/actions/analytics-actions.md +326 -0
- package/docs/v1/api/actions/cart-actions.md +364 -0
- package/docs/v1/api/actions/checkout-actions.md +629 -0
- package/docs/v1/api/actions/product-actions.md +205 -0
- package/docs/v1/api/client.md +671 -0
- package/docs/v1/api/configuration.md +587 -0
- package/docs/v1/api/injection-methods.md +331 -0
- package/docs/v1/api/typescript-types.md +610 -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 +298 -0
- package/docs/v1/guides/address-component.md +441 -0
- package/docs/v1/guides/best-practices.md +365 -0
- package/docs/v1/guides/cart-component.md +802 -0
- package/docs/v1/guides/checkout-component.md +920 -0
- package/docs/v1/guides/events.md +1061 -0
- package/docs/v1/guides/product-component.md +767 -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 +176 -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,610 @@
|
|
|
1
|
+
# TypeScript Types Reference
|
|
2
|
+
|
|
3
|
+
All public types are exported from the main package entry point. Import them using the `type` keyword for optimal tree-shaking.
|
|
4
|
+
|
|
5
|
+
## Importing Types
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Elements } from '@liquidcommerce/elements-sdk';
|
|
9
|
+
import type {
|
|
10
|
+
ILiquidCommerceElementsClient,
|
|
11
|
+
ILiquidCommerceElementsConfig,
|
|
12
|
+
IInjectProductElement,
|
|
13
|
+
IInjectedComponent
|
|
14
|
+
} from '@liquidcommerce/elements-sdk';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
For the checkout-only build:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
|
|
21
|
+
import type {
|
|
22
|
+
IElementsCheckoutClient,
|
|
23
|
+
IElementsCheckoutActions,
|
|
24
|
+
IAnalyticsActions,
|
|
25
|
+
IAnalyticsItem,
|
|
26
|
+
ILiquidCommerceElementsCheckoutClientConfig,
|
|
27
|
+
IInjectedComponent
|
|
28
|
+
} from '@liquidcommerce/elements-sdk/checkout';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Client Types
|
|
34
|
+
|
|
35
|
+
### ILiquidCommerceElementsClient
|
|
36
|
+
|
|
37
|
+
Main SDK client interface returned by `Elements()`.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
interface ILiquidCommerceElementsClient {
|
|
41
|
+
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
42
|
+
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
43
|
+
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
44
|
+
injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
45
|
+
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
46
|
+
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
47
|
+
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
48
|
+
ui: ILiquidCommerceElementsUIMethod;
|
|
49
|
+
actions: ILiquidCommerceElementsActions;
|
|
50
|
+
getInjectedComponents(): Map<string, IInjectedComponent>;
|
|
51
|
+
destroy(): void;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### ILiquidCommerceElementsBuilderClient
|
|
56
|
+
|
|
57
|
+
Builder-pattern client interface returned by `ElementsBuilder()`.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
interface ILiquidCommerceElementsBuilderClient {
|
|
61
|
+
updateComponentGlobalConfigs(configs: UpdateComponentGlobalConfigs): Promise<void>;
|
|
62
|
+
updateProductComponent(configs: UpdateProductComponent): Promise<void>;
|
|
63
|
+
updateAddressComponent(configs: UpdateAddressComponent): void;
|
|
64
|
+
updateCartComponent(configs: UpdateCartComponent): void;
|
|
65
|
+
updateCheckoutComponent(configs: UpdateCheckoutComponent): void;
|
|
66
|
+
updateProductListComponent(configs: UpdateProductListComponent): void;
|
|
67
|
+
injectElement(params: IBuilderInjectElementParams): Promise<IInjectedComponent | null>;
|
|
68
|
+
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
69
|
+
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
70
|
+
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
71
|
+
injectCheckoutElement(params: IInjectCheckoutBuilderParams): Promise<IInjectedComponent | null>;
|
|
72
|
+
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
73
|
+
actions: ILiquidCommerceElementsActions;
|
|
74
|
+
destroy(): void;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### IElementsCheckoutClient
|
|
79
|
+
|
|
80
|
+
Checkout-only client interface returned by `ElementsCheckout()`.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
interface IElementsCheckoutClient {
|
|
84
|
+
injectCheckout(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
85
|
+
injectExpressCheckout(params: IInjectExpressCheckoutParams): Promise<IInjectedComponent | null>;
|
|
86
|
+
actions: { checkout: IElementsCheckoutActions; analytics: IAnalyticsActions };
|
|
87
|
+
destroy(): void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface IInjectExpressCheckoutParams {
|
|
91
|
+
containerId: string;
|
|
92
|
+
checkoutId?: string; // omit to use the checkout already loaded
|
|
93
|
+
variant?: 'section' | 'buttons'; // 'buttons' is the default outside the checkout element
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Configuration Types
|
|
100
|
+
|
|
101
|
+
### ILiquidCommerceElementsConfig
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
interface ILiquidCommerceElementsConfig {
|
|
105
|
+
env?: ElementsEnv;
|
|
106
|
+
promoTicker?: IPromoTicker[];
|
|
107
|
+
customTheme?: IClientCustomThemeConfig;
|
|
108
|
+
debugMode?: DebugMode;
|
|
109
|
+
checkout?: ILiquidCommerceElementsCheckoutConfig;
|
|
110
|
+
proxy?: IElementsProxyConfig;
|
|
111
|
+
gtm?: IElementsGTMConfig;
|
|
112
|
+
development?: ILiquidCommerceElementsDevelopmentConfig;
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### ILiquidCommerceElementsBuilderConfig
|
|
117
|
+
|
|
118
|
+
Same shape as `ILiquidCommerceElementsConfig`, used by `ElementsBuilder()`.
|
|
119
|
+
|
|
120
|
+
### ILiquidCommerceElementsCheckoutClientConfig
|
|
121
|
+
|
|
122
|
+
Same shape as `ILiquidCommerceElementsConfig`, used for the checkout-only client.
|
|
123
|
+
|
|
124
|
+
### IClientCustomThemeConfig
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
interface IClientCustomThemeConfig {
|
|
128
|
+
global?: UpdateComponentGlobalConfigs;
|
|
129
|
+
product?: UpdateProductComponent;
|
|
130
|
+
address?: UpdateAddressComponent;
|
|
131
|
+
cart?: UpdateCartComponent;
|
|
132
|
+
checkout?: UpdateCheckoutComponent;
|
|
133
|
+
productList?: UpdateProductListComponent;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### IElementsProxyConfig
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
interface IElementsProxyConfig {
|
|
141
|
+
baseUrl: string;
|
|
142
|
+
headers?: Record<string, string>;
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### IElementsGTMConfig
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
interface IElementsGTMConfig {
|
|
150
|
+
gatewayUrl?: string;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`gatewayUrl` is the Google tag gateway path your own GTM container is served from (see [Analytics → Google tag gateway](../reference/analytics.md#google-tag-gateway)).
|
|
155
|
+
|
|
156
|
+
### ILiquidCommerceElementsDevelopmentConfig
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
interface ILiquidCommerceElementsDevelopmentConfig {
|
|
160
|
+
customApiUrl?: string;
|
|
161
|
+
openShadowDom?: boolean;
|
|
162
|
+
mockMode?: boolean; // when true, sends an 'X-Liquid-Api-Mock-Mode' header to receive mock data
|
|
163
|
+
enableExpressCheckout?: boolean; // show express checkout and the delivery-method switch; off by default, honoured in production
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### ILiquidCommerceElementsCheckoutConfig
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
interface ILiquidCommerceElementsCheckoutConfig {
|
|
171
|
+
pageUrl?: string;
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
See [Configuration Reference](./configuration.md) for detailed property descriptions.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Injection Types
|
|
180
|
+
|
|
181
|
+
### IInjectProductElement
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
interface IInjectProductElement {
|
|
185
|
+
containerId: string;
|
|
186
|
+
identifier: string;
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### IInjectCheckoutParams
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
interface IInjectCheckoutParams {
|
|
194
|
+
containerId: string;
|
|
195
|
+
checkoutId?: string;
|
|
196
|
+
hideHeader?: boolean;
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### IInjectCheckoutBuilderParams
|
|
201
|
+
|
|
202
|
+
`simulatePresale` and `presaleExpiresInMinutes` are builder-only preview controls (presale lock defaults to 15 minutes) and only take effect via `ElementsBuilder().injectCheckoutElement()`.
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
interface IInjectCheckoutBuilderParams extends IInjectCheckoutParams {
|
|
206
|
+
simulatePresale?: boolean;
|
|
207
|
+
presaleExpiresInMinutes?: number;
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### IInjectProductListParams
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
interface IInjectProductListParams {
|
|
215
|
+
containerId: string;
|
|
216
|
+
slug: string;
|
|
217
|
+
rows?: number;
|
|
218
|
+
columns?: number;
|
|
219
|
+
filters?: ProductListFilterType[];
|
|
220
|
+
productUrl?: PLCProductUrl;
|
|
221
|
+
productOrder?: string[]; // display order, by UPC or grouping ID
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### PLCProductUrl
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
/**
|
|
229
|
+
* Product card link configuration.
|
|
230
|
+
*
|
|
231
|
+
* - String: template with `{upc}` (selected size's UPC) or `{grouping}`
|
|
232
|
+
* (product's salsifyGrouping ID). Replaced per product card.
|
|
233
|
+
* - Map: keyed by product identifier (UPC or salsifyGrouping ID — same
|
|
234
|
+
* identifier types accepted by `injectProductElement`). The card looks up
|
|
235
|
+
* UPC first, then grouping ID. Use this when partner PDPs have
|
|
236
|
+
* hand-curated URLs that aren't derivable from a single token.
|
|
237
|
+
*/
|
|
238
|
+
type PLCProductUrl = string | Record<string, string>;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### IInjectProductListSearchParams
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
interface IInjectProductListSearchParams {
|
|
245
|
+
containerId: string;
|
|
246
|
+
slug: string;
|
|
247
|
+
filters?: ProductListFilterType[];
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### IInjectProductListFiltersParams
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
interface IInjectProductListFiltersParams {
|
|
255
|
+
containerId: string;
|
|
256
|
+
slug: string;
|
|
257
|
+
filters?: ProductListFilterType[];
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### IBuilderInjectElementParams
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
interface IBuilderInjectElementParams {
|
|
265
|
+
type: ComponentType;
|
|
266
|
+
containerId: string;
|
|
267
|
+
[key: string]: any;
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Component Types
|
|
274
|
+
|
|
275
|
+
### IInjectedComponent
|
|
276
|
+
|
|
277
|
+
Returned by all injection methods. Provides control over the injected component.
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
interface IInjectedComponent {
|
|
281
|
+
getType(): ComponentType;
|
|
282
|
+
getElement(): HTMLElement;
|
|
283
|
+
rerender(): void;
|
|
284
|
+
destroy(): void;
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## UI Types
|
|
291
|
+
|
|
292
|
+
### ILiquidCommerceElementsUIMethod
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
interface ILiquidCommerceElementsUIMethod {
|
|
296
|
+
cartButton(containerId: string, showItemsCount?: boolean): void;
|
|
297
|
+
floatingCartButton(showItemsCount?: boolean): void;
|
|
298
|
+
cartSubtotal(elementId: string): void;
|
|
299
|
+
cartItemsCount(elementId: string, options?: { hideZero: boolean }): void;
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Action Types
|
|
306
|
+
|
|
307
|
+
### ILiquidCommerceElementsActions
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
interface ILiquidCommerceElementsActions {
|
|
311
|
+
product: IProductActions;
|
|
312
|
+
address: IAddressActions;
|
|
313
|
+
cart: ICartActions;
|
|
314
|
+
checkout: ICheckoutActions;
|
|
315
|
+
analytics: IAnalyticsActions;
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### IElementsCheckoutActions
|
|
320
|
+
|
|
321
|
+
Checkout actions available in the checkout-only client. This is `ICheckoutActions` with `openCheckout`, `closeCheckout`, and `toggleCheckout` omitted -- the checkout-only client renders checkout independently and has no drawer navigation to open, close, or toggle.
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
interface IElementsCheckoutActions extends Omit<ICheckoutActions, 'openCheckout' | 'closeCheckout' | 'toggleCheckout'> {}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### IAnalyticsActions
|
|
328
|
+
|
|
329
|
+
Reports steps a host renders with its own UI to the SDK's GTM / GA4 stream. On both the full client
|
|
330
|
+
and the checkout-only client. See [Analytics Actions](./actions/analytics-actions.md).
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
interface IAnalyticsActions {
|
|
334
|
+
search(searchTerm: string): void;
|
|
335
|
+
viewItem(item: IAnalyticsItem): void;
|
|
336
|
+
viewItemList(items: IAnalyticsItem[], list?: IAnalyticsItemList): void;
|
|
337
|
+
selectItem(item: IAnalyticsItem, list?: IAnalyticsItemList): void;
|
|
338
|
+
addToCart(item: IAnalyticsItem): void;
|
|
339
|
+
removeFromCart(item: IAnalyticsItem): void;
|
|
340
|
+
viewCart(items: IAnalyticsItem[]): void;
|
|
341
|
+
beginCheckout(items: IAnalyticsItem[], options?: { coupon?: string }): void;
|
|
342
|
+
addressUpdated(address: IAnalyticsAddress): void;
|
|
343
|
+
addressFailed(failure: IAnalyticsAddressFailure): void;
|
|
344
|
+
productNoAvailability(details: IAnalyticsAvailability): void;
|
|
345
|
+
productSizeNoAvailability(details: IAnalyticsAvailability): void;
|
|
346
|
+
productFulfillmentNoAvailability(details: IAnalyticsFulfillmentAvailability): void;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
interface IAnalyticsItem {
|
|
350
|
+
id: string; // the selected size's id
|
|
351
|
+
name: string;
|
|
352
|
+
brand?: string;
|
|
353
|
+
size?: string;
|
|
354
|
+
categoryPath?: string; // product catPath
|
|
355
|
+
price?: number; // cents
|
|
356
|
+
quantity?: number;
|
|
357
|
+
type?: string;
|
|
358
|
+
subType?: string;
|
|
359
|
+
image?: string;
|
|
360
|
+
upc?: string;
|
|
361
|
+
groupingId?: string;
|
|
362
|
+
index?: number;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface IAnalyticsItemList {
|
|
366
|
+
id?: string;
|
|
367
|
+
name?: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
interface IAnalyticsAddress {
|
|
371
|
+
placesId?: string;
|
|
372
|
+
formattedAddress?: string;
|
|
373
|
+
address: Partial<IAddressAddress>;
|
|
374
|
+
coordinates?: IAddressCoordinates;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface IAnalyticsAddressFailure {
|
|
378
|
+
placesId?: string;
|
|
379
|
+
formattedAddress?: string;
|
|
380
|
+
address?: Partial<IAddressAddress>;
|
|
381
|
+
error: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
interface IAnalyticsAvailability {
|
|
385
|
+
item: IAnalyticsItem;
|
|
386
|
+
reason: string;
|
|
387
|
+
address?: Partial<IAddressAddress>;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface IAnalyticsFulfillmentAvailability extends IAnalyticsAvailability {
|
|
391
|
+
fulfillmentType: FulfillmentType;
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
See [Actions API](./actions/) for detailed method signatures.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Enum Types
|
|
400
|
+
|
|
401
|
+
### ElementsEnv
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
type ElementsEnv = 'staging' | 'production';
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### DebugMode
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
type DebugMode = 'none' | 'console' | 'panel';
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### FulfillmentType
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
type FulfillmentType = 'onDemand' | 'shipping';
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### ComponentType
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
type ComponentType =
|
|
423
|
+
| 'address' | 'product' | 'cart' | 'checkout'
|
|
424
|
+
| 'product-list' | 'product-list-card' | 'product-list-filters' | 'product-list-search'
|
|
425
|
+
| 'drawer' | 'input' | 'engraving-form' | 'engraving-view'
|
|
426
|
+
| 'buttons-cart-open' | 'powered-by' | 'lce-element'
|
|
427
|
+
| 'purchase-min-alert' | 'alert' | 'promo-code-ticker'
|
|
428
|
+
| 'checkout-delivery-scheduling' // Internal child of checkout
|
|
429
|
+
// ...and additional internal component types
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### DisplayModeType
|
|
433
|
+
|
|
434
|
+
```typescript
|
|
435
|
+
type DisplayModeType = 'modal' | 'drawer';
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Theme Configuration Types
|
|
441
|
+
|
|
442
|
+
### UpdateComponentGlobalConfigs
|
|
443
|
+
|
|
444
|
+
`DeepPartial<IComponentGlobalConfigs>` -- all properties optional.
|
|
445
|
+
|
|
446
|
+
### UpdateProductComponent
|
|
447
|
+
|
|
448
|
+
`DeepPartial<IProductComponent>` -- all properties optional.
|
|
449
|
+
|
|
450
|
+
### UpdateCartComponent
|
|
451
|
+
|
|
452
|
+
`DeepPartial<ICartComponent>` -- all properties optional.
|
|
453
|
+
|
|
454
|
+
### UpdateCheckoutComponent
|
|
455
|
+
|
|
456
|
+
`DeepPartial<ICheckoutComponent>` -- all properties optional.
|
|
457
|
+
|
|
458
|
+
### UpdateAddressComponent
|
|
459
|
+
|
|
460
|
+
`DeepPartial<IAddressComponent>` -- all properties optional.
|
|
461
|
+
|
|
462
|
+
### UpdateProductListComponent
|
|
463
|
+
|
|
464
|
+
Special structure for updating product list configuration by slug:
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
interface UpdateProductListComponent {
|
|
468
|
+
theme?: { backgroundColor?: string };
|
|
469
|
+
layout?: {
|
|
470
|
+
lists?: Record<string, DeepPartial<IPLCList>>;
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
These `Update*Component` types are the arguments to the `ElementsBuilder()` client's `update*Component` methods; see [Client API](./client.md) for their behavior and usage.
|
|
476
|
+
|
|
477
|
+
See [Configuration Reference](./configuration.md) for detailed theme property descriptions.
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## Promo Ticker Type
|
|
482
|
+
|
|
483
|
+
### IPromoTicker
|
|
484
|
+
|
|
485
|
+
```typescript
|
|
486
|
+
interface IPromoTicker {
|
|
487
|
+
promoCode: string;
|
|
488
|
+
text: string[];
|
|
489
|
+
separator: string;
|
|
490
|
+
activeFrom: string; // ISO 8601 UTC
|
|
491
|
+
activeUntil: string; // ISO 8601 UTC
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Utility Types
|
|
498
|
+
|
|
499
|
+
### DeepPartial
|
|
500
|
+
|
|
501
|
+
Used internally for theme update types. Makes all properties in `T` recursively optional.
|
|
502
|
+
|
|
503
|
+
```typescript
|
|
504
|
+
type DeepPartial<T> = {
|
|
505
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
506
|
+
};
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
## See Also
|
|
512
|
+
|
|
513
|
+
- [Client API](./client.md) - Client initialization and usage
|
|
514
|
+
- [Configuration Reference](./configuration.md) - Detailed config options
|
|
515
|
+
- [Injection Methods](./injection-methods.md) - Component injection API
|
|
516
|
+
|
|
517
|
+
### Preparing complete account delivery details
|
|
518
|
+
|
|
519
|
+
After `lce:actions.checkout_loaded`, call
|
|
520
|
+
`await elements.actions.checkout.updateCustomerInfo(fields, { saveIfValid: true })`
|
|
521
|
+
to validate and prepare complete account details, then show their editable summary.
|
|
522
|
+
Supply names, email, a US phone number, and a real `birthDate` in `MM/DD/YYYY` format
|
|
523
|
+
(age 21+, year 1930 or later). The `birthDate` may be blank when the partner does not require a
|
|
524
|
+
date of birth (`checkout.layout.requireBirthDate: false`); a supplied one is still validated.
|
|
525
|
+
A shipping street must already be selected.
|
|
526
|
+
Omitted apartment and delivery instructions retain their existing checkout values.
|
|
527
|
+
Partial or invalid details stay in the form; backend validation failures reject the
|
|
528
|
+
promise, show the checkout error, and keep details editable. The host should handle that rejection.
|
|
529
|
+
|
|
530
|
+
The option skips gifts, saved forms, in-flight saves, and customer forms the shopper
|
|
531
|
+
has edited during the current checkout. It does not overwrite those forms. Edits or
|
|
532
|
+
address/checkout changes during preparation prevent a stale response from closing
|
|
533
|
+
the form. Without the option, this action only prefills fields, as before.
|
|
534
|
+
|
|
535
|
+
Apple Pay and Google Pay selection displays **Continue with Apple Pay** or
|
|
536
|
+
**Continue with Google Pay**. This opens the wallet to save a payment method; the
|
|
537
|
+
shopper still reviews and places the order afterward. It is not express checkout.
|
|
538
|
+
|
|
539
|
+
After wallet cancellation, the same Continue action remains available. If authorization
|
|
540
|
+
succeeded but saving the method failed, **Retry saving Apple Pay/Google Pay** reuses
|
|
541
|
+
the existing authorization rather than opening the wallet again.
|
|
542
|
+
|
|
543
|
+
### Saved account marketing preferences
|
|
544
|
+
|
|
545
|
+
```ts
|
|
546
|
+
setSavedMarketingPreferences(preferences: { canEmail?: boolean; canSms?: boolean }): Promise<void>
|
|
547
|
+
clearSavedMarketingPreferences(): void
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
Call `actions.checkout.setSavedMarketingPreferences()` with known recorded account
|
|
551
|
+
choices, including `false`, before checkout loads. Only boolean values are used;
|
|
552
|
+
missing/null/unrecognized values remain unknown. The first checkout prepare uses
|
|
553
|
+
saved values instead of tenant defaults. Each channel's prompt is hidden only
|
|
554
|
+
after the server confirms that saved choice. Unknown channels retain their normal
|
|
555
|
+
checkout prompts. The actions are available in both full and checkout-only clients.
|
|
556
|
+
|
|
557
|
+
Calling the setter during an active checkout prepares untouched channels and
|
|
558
|
+
preserves shopper checkbox edits. Backend failure rejects the promise, displays
|
|
559
|
+
an error, and leaves prompts available; the host should catch the rejection.
|
|
560
|
+
The same call can retry. Applying values does not call a subscription service.
|
|
561
|
+
It supplies the account's recorded choices to this checkout.
|
|
562
|
+
|
|
563
|
+
Saved choices persist across cart resets in the same SDK session. Call
|
|
564
|
+
`clearSavedMarketingPreferences()` on sign-out, account change, and host cleanup.
|
|
565
|
+
Clearing reveals the prompts and restores configured guest defaults. It invalidates
|
|
566
|
+
stale responses while draining outstanding preference requests; checkout completion
|
|
567
|
+
prepares the current choices before submitting the checkout token. A load already
|
|
568
|
+
in progress still finishes and reconciles the current account's values. Bind a new
|
|
569
|
+
account only to its own checkout; the host remains responsible for account/cart
|
|
570
|
+
ownership and for reloading checkout when identity changes.
|
|
571
|
+
|
|
572
|
+
Order completion waits for queued preference work. It cannot race a late saved
|
|
573
|
+
opt-out or proceed with an unconfirmed saved choice. If applying a known choice
|
|
574
|
+
fails, the shopper can retry or explicitly choose the visible channel preference.
|
|
575
|
+
|
|
576
|
+
## Delivery scheduling types
|
|
577
|
+
|
|
578
|
+
The main and checkout-only entries, and their Node/SSR stubs, export these types.
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
export interface DeliverySlot {
|
|
582
|
+
id: string; // server-issued, `<fulfillmentOptionId>:<window start, Unix seconds>`
|
|
583
|
+
start: string; // ISO-8601 UTC
|
|
584
|
+
end: string; // ISO-8601 UTC
|
|
585
|
+
cutoff: string; // ISO-8601 UTC, latest time to order for this window ("Order by")
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface DeliveryAvailability {
|
|
589
|
+
status: 'available' | 'unavailable'; // available when the store can deliver now or offers windows
|
|
590
|
+
canDeliverNow: boolean;
|
|
591
|
+
canSchedule: boolean;
|
|
592
|
+
timezone: string | null; // store IANA time zone; null when the server has none (the SDK then shows UTC)
|
|
593
|
+
nextSlot: DeliverySlot | null; // null on a product fulfillment of a closed store: checkout gives the windows
|
|
594
|
+
checkedAt: string;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export interface CheckoutDeliveryScheduling {
|
|
598
|
+
availability: DeliveryAvailability;
|
|
599
|
+
slots: DeliverySlot[]; // only in answer to deliverySlotsFulfillmentId; empty otherwise
|
|
600
|
+
selectedSlotId: string | null; // null = as soon as possible / no window
|
|
601
|
+
selectedSlot?: DeliverySlot | null; // the accepted window with its real end and cutoff; null when none
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export interface CheckoutDeliverySelection {
|
|
605
|
+
fulfillmentId: string;
|
|
606
|
+
slotId: string | null;
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
`ICheckoutFulfillment.deliveryScheduling` is optional. `ICheckoutPrepareParams` takes `deliverySelections?: CheckoutDeliverySelection[]` and `deliverySlotsFulfillmentId?: string`. `actions.checkout` adds `loadDeliverySlots(fulfillmentId: string): Promise<DeliverySlot[]>` and `chooseDeliverySlot(fulfillmentId: string, slotId: string | null): Promise<void>` on both clients, and `ICheckoutDetailsEventData` adds `deliveryScheduling: Record<string, CheckoutDeliveryScheduling>`.
|