@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
package/docs/PROXY.md
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
# Proxy Configuration Guide
|
|
2
|
-
|
|
3
|
-
Configure the LiquidCommerce Elements SDK to route API requests through your own server to avoid ad blockers.
|
|
4
|
-
|
|
5
|
-
## Quick Setup
|
|
6
|
-
|
|
7
|
-
### 1. Configure the SDK
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
const elements = await Elements('your-api-key', {
|
|
11
|
-
env: 'production',
|
|
12
|
-
proxy: {
|
|
13
|
-
baseUrl: 'https://yourdomain.com/api/liquidcommerce'
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### 2. How It Works
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
Without Proxy: Your App → LiquidCommerce API
|
|
22
|
-
With Proxy: Your App → Your Server → LiquidCommerce API
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The SDK automatically:
|
|
26
|
-
- Changes API calls from `https://elements.liquidcommerce.us/api/*` to `https://yourdomain.com/api/liquidcommerce/api/*`
|
|
27
|
-
- Adds `X-Liquid-Proxy-Target` header with the original LiquidCommerce URL
|
|
28
|
-
- Sends all required LiquidCommerce headers that your proxy must forward
|
|
29
|
-
|
|
30
|
-
## Required Headers
|
|
31
|
-
|
|
32
|
-
The SDK sends these headers that **must be forwarded** to LiquidCommerce:
|
|
33
|
-
|
|
34
|
-
### Authentication Headers
|
|
35
|
-
- `X-Liquid-Api-Key` - Your LiquidCommerce API key
|
|
36
|
-
- `X-Liquid-Api-Env` - Environment (staging, production, development)
|
|
37
|
-
- `Authorization` - Bearer token (added automatically after authentication)
|
|
38
|
-
|
|
39
|
-
### Tracking Headers
|
|
40
|
-
- `X-Liquid-Api-Sdk` - Source URL (usually `window.location.href`)
|
|
41
|
-
- `X-Liquid-Sdk-Version` - SDK version for debugging
|
|
42
|
-
- `X-Liquid-Proxy` - Always `true` when using a proxy
|
|
43
|
-
|
|
44
|
-
### Proxy Headers
|
|
45
|
-
- `X-Liquid-Proxy-Target` - Original LiquidCommerce API URL to forward to
|
|
46
|
-
- `Content-Type` - Always `application/json`
|
|
47
|
-
|
|
48
|
-
### Your Custom Headers (optional)
|
|
49
|
-
- Any headers you add in `proxy.headers` config
|
|
50
|
-
|
|
51
|
-
## Next.js Implementation
|
|
52
|
-
|
|
53
|
-
### API Route: `pages/api/liquidcommerce/[...path].js`
|
|
54
|
-
|
|
55
|
-
```javascript
|
|
56
|
-
export default async function handler(req, res) {
|
|
57
|
-
// Get the API path from the dynamic route
|
|
58
|
-
const { path } = req.query;
|
|
59
|
-
const apiPath = Array.isArray(path) ? path.join('/') : path;
|
|
60
|
-
|
|
61
|
-
// Get target URL from SDK header
|
|
62
|
-
const targetUrl = req.headers['x-liquid-proxy-target'];
|
|
63
|
-
|
|
64
|
-
if (!targetUrl) {
|
|
65
|
-
return res.status(400).json({ error: 'Missing target URL' });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Security: Validate target URL
|
|
69
|
-
const allowedTargets = [
|
|
70
|
-
'https://elements.liquidcommerce.us',
|
|
71
|
-
'https://staging-elements.liquidcommerce.us'
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
if (!allowedTargets.includes(targetUrl)) {
|
|
75
|
-
return res.status(400).json({ error: 'Invalid target URL' });
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
// Forward the request to LiquidCommerce with ALL required headers
|
|
80
|
-
const response = await fetch(`${targetUrl}/api/${apiPath}`, {
|
|
81
|
-
method: req.method,
|
|
82
|
-
headers: {
|
|
83
|
-
// Required LiquidCommerce headers
|
|
84
|
-
'Content-Type': 'application/json',
|
|
85
|
-
'X-Liquid-Api-Key': req.headers['x-liquid-api-key'],
|
|
86
|
-
'X-Liquid-Api-Env': req.headers['x-liquid-api-env'],
|
|
87
|
-
'X-Liquid-Api-Sdk': req.headers['x-liquid-api-sdk'],
|
|
88
|
-
'X-Liquid-Sdk-Version': req.headers['x-liquid-sdk-version'],
|
|
89
|
-
'X-Liquid-Proxy': req.headers['x-liquid-proxy'],
|
|
90
|
-
'Authorization': req.headers['authorization'],
|
|
91
|
-
// Don't forward the proxy target header to LiquidCommerce
|
|
92
|
-
// 'X-Liquid-Proxy-Target': NOT forwarded
|
|
93
|
-
},
|
|
94
|
-
body: req.method !== 'GET' ? JSON.stringify(req.body) : undefined,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const data = await response.json();
|
|
98
|
-
res.status(response.status).json(data);
|
|
99
|
-
|
|
100
|
-
} catch (error) {
|
|
101
|
-
console.error('Proxy error:', error);
|
|
102
|
-
res.status(500).json({ error: 'Proxy error' });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### App Router: `app/api/liquidcommerce/[...path]/route.js`
|
|
108
|
-
|
|
109
|
-
```javascript
|
|
110
|
-
export async function GET(request, { params }) {
|
|
111
|
-
return handleRequest(request, params, 'GET');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export async function POST(request, { params }) {
|
|
115
|
-
return handleRequest(request, params, 'POST');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export async function PUT(request, { params }) {
|
|
119
|
-
return handleRequest(request, params, 'PUT');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async function handleRequest(request, params, method) {
|
|
123
|
-
const apiPath = params.path.join('/');
|
|
124
|
-
const targetUrl = request.headers.get('x-liquid-proxy-target');
|
|
125
|
-
|
|
126
|
-
if (!targetUrl) {
|
|
127
|
-
return Response.json({ error: 'Missing target URL' }, { status: 400 });
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Security check
|
|
131
|
-
const allowedTargets = [
|
|
132
|
-
'https://elements.liquidcommerce.us',
|
|
133
|
-
'https://staging-elements.liquidcommerce.us'
|
|
134
|
-
];
|
|
135
|
-
|
|
136
|
-
if (!allowedTargets.includes(targetUrl)) {
|
|
137
|
-
return Response.json({ error: 'Invalid target URL' }, { status: 400 });
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
try {
|
|
141
|
-
const body = method !== 'GET' ? await request.json() : undefined;
|
|
142
|
-
|
|
143
|
-
const response = await fetch(`${targetUrl}/api/${apiPath}`, {
|
|
144
|
-
method,
|
|
145
|
-
headers: {
|
|
146
|
-
// Required LiquidCommerce headers
|
|
147
|
-
'Content-Type': 'application/json',
|
|
148
|
-
'X-Liquid-Api-Key': request.headers.get('x-liquid-api-key'),
|
|
149
|
-
'X-Liquid-Api-Env': request.headers.get('x-liquid-api-env'),
|
|
150
|
-
'X-Liquid-Api-Sdk': request.headers.get('x-liquid-api-sdk'),
|
|
151
|
-
'X-Liquid-Sdk-Version': request.headers.get('x-liquid-sdk-version'),
|
|
152
|
-
'Authorization': request.headers.get('authorization'),
|
|
153
|
-
// Don't forward the proxy target header to LiquidCommerce
|
|
154
|
-
// 'X-Liquid-Proxy-Target': NOT forwarded
|
|
155
|
-
},
|
|
156
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const data = await response.json();
|
|
160
|
-
return Response.json(data, { status: response.status });
|
|
161
|
-
|
|
162
|
-
} catch (error) {
|
|
163
|
-
console.error('Proxy error:', error);
|
|
164
|
-
return Response.json({ error: 'Proxy error' }, { status: 500 });
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Testing
|
|
170
|
-
|
|
171
|
-
### 1. Test the proxy endpoint directly:
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
curl -X GET "https://yourdomain.com/api/liquidcommerce/configs" \
|
|
175
|
-
-H "Content-Type: application/json" \
|
|
176
|
-
-H "X-Liquid-Proxy-Target: https://staging-elements.liquidcommerce.us" \
|
|
177
|
-
-H "X-Liquid-Api-Key: your-api-key" \
|
|
178
|
-
-H "X-Liquid-Api-Env: staging" \
|
|
179
|
-
-H "X-Liquid-Api-Sdk: https://yoursite.com" \
|
|
180
|
-
-H "X-Liquid-Sdk-Version: 1.0.0"
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### 2. Use the SDK with proxy:
|
|
184
|
-
|
|
185
|
-
```javascript
|
|
186
|
-
// This will automatically use your proxy
|
|
187
|
-
const elements = await Elements('your-api-key', {
|
|
188
|
-
env: 'staging',
|
|
189
|
-
proxy: {
|
|
190
|
-
baseUrl: 'https://yourdomain.com/api/liquidcommerce'
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
await elements.prepare(); // Uses proxy for all API calls
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
## Security
|
|
198
|
-
|
|
199
|
-
1. **Validate target URLs** - Only allow known LiquidCommerce domains
|
|
200
|
-
2. **Forward required headers only** - Forward the headers listed above, exclude internal ones
|
|
201
|
-
3. **Don't forward `X-Liquid-Proxy-Target`** - This is for your proxy only, not LiquidCommerce
|
|
202
|
-
4. **Add rate limiting** if needed
|
|
203
|
-
5. **Log requests** for monitoring
|
|
204
|
-
|
|
205
|
-
## Important Notes
|
|
206
|
-
|
|
207
|
-
- **All SDK headers must be forwarded** - Missing headers will cause authentication failures
|
|
208
|
-
- **`Authorization` header is added automatically** - After the SDK authenticates with your API key
|
|
209
|
-
- **`X-Liquid-Proxy-Target` stays with your proxy** - Don't send this to LiquidCommerce
|
|
210
|
-
- **Content-Type must be `application/json`** - Required for all API requests
|
|
211
|
-
|
|
212
|
-
## Benefits
|
|
213
|
-
|
|
214
|
-
- ✅ **Bypass ad blockers** - Requests come from your domain
|
|
215
|
-
- ✅ **Control requests** - Monitor and modify API calls
|
|
216
|
-
- ✅ **Add authentication** - Include your own auth headers
|
|
217
|
-
- ✅ **Zero client changes** - Transparent to the SDK
|
|
218
|
-
|
|
219
|
-
## Configuration Options
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
proxy: {
|
|
223
|
-
baseUrl: 'https://yourdomain.com/api/liquidcommerce', // Required: Full proxy endpoint URL
|
|
224
|
-
headers: { // Optional: Custom headers
|
|
225
|
-
'X-Custom-Header': 'value'
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
```
|