@vtex/faststore 0.0.1
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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/actions.json +334 -0
- package/dist/catalog.json +6615 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.js +8 -0
- package/dist/components.d.ts +87 -0
- package/dist/components.js +87 -0
- package/dist/content-types.json +684 -0
- package/dist/core/dist/actions/mock-action.d.ts +24 -0
- package/dist/core/dist/actions/mock-action.js +28 -0
- package/dist/core/dist/actions/mock-action.js.map +1 -0
- package/dist/core/dist/actions/registry.d.ts +24 -0
- package/dist/core/dist/actions/registry.js +28 -0
- package/dist/core/dist/actions/registry.js.map +1 -0
- package/dist/core/dist/define-component.d.ts +100 -0
- package/dist/core/dist/define-component.js +8 -0
- package/dist/core/dist/define-component.js.map +1 -0
- package/dist/core/dist/define-content-type.d.ts +95 -0
- package/dist/core/dist/define-content-type.js +283 -0
- package/dist/core/dist/define-content-type.js.map +1 -0
- package/dist/core/dist/index.d.ts +7 -0
- package/dist/core/dist/index.js +5 -0
- package/dist/core/dist/schema/generated/schema.d.ts +28 -0
- package/dist/core/dist/types.d.ts +1 -0
- package/dist/docs/access-code-field.md +100 -0
- package/dist/docs/access-code-sign-in.md +174 -0
- package/dist/docs/account-entry-point.md +155 -0
- package/dist/docs/address-summary.md +50 -0
- package/dist/docs/buy-button.md +162 -0
- package/dist/docs/carousel.md +105 -0
- package/dist/docs/cart-item.md +162 -0
- package/dist/docs/cart-totalizer.md +197 -0
- package/dist/docs/cart.md +495 -0
- package/dist/docs/client-preferences.md +184 -0
- package/dist/docs/client-profile-form.md +192 -0
- package/dist/docs/client-profile.md +117 -0
- package/dist/docs/container.md +97 -0
- package/dist/docs/document-field.md +97 -0
- package/dist/docs/email-field.md +93 -0
- package/dist/docs/email-identification.md +102 -0
- package/dist/docs/footer-copyright.md +112 -0
- package/dist/docs/footer-link-group.md +162 -0
- package/dist/docs/footer-root.md +145 -0
- package/dist/docs/footer-social.md +151 -0
- package/dist/docs/free-shipping-progress.md +87 -0
- package/dist/docs/gallery.md +84 -0
- package/dist/docs/header-root.md +150 -0
- package/dist/docs/identity-edit.md +88 -0
- package/dist/docs/identity-summary.md +106 -0
- package/dist/docs/incentives.md +151 -0
- package/dist/docs/logo.md +135 -0
- package/dist/docs/meter.md +67 -0
- package/dist/docs/navigation-link-list.md +171 -0
- package/dist/docs/navigation-link.md +163 -0
- package/dist/docs/navigation-menu.md +264 -0
- package/dist/docs/payment-methods.md +139 -0
- package/dist/docs/phone-field.md +106 -0
- package/dist/docs/postal-code-field.md +126 -0
- package/dist/docs/pricing.md +499 -0
- package/dist/docs/product-gallery.md +409 -0
- package/dist/docs/product-information.md +295 -0
- package/dist/docs/product-list.md +170 -0
- package/dist/docs/product-quantity.md +88 -0
- package/dist/docs/product-shelf.md +141 -0
- package/dist/docs/promotion.md +109 -0
- package/dist/docs/region.md +225 -0
- package/dist/docs/session.md +123 -0
- package/dist/docs/shipping-address.md +390 -0
- package/dist/docs/shipping-simulator.md +147 -0
- package/dist/docs/sign-in-form.md +117 -0
- package/dist/docs/tabs.md +176 -0
- package/dist/docs/toast.md +124 -0
- package/dist/docs/variant-selector.md +450 -0
- package/dist/graphql/define-subgraph.d.ts +12 -0
- package/dist/graphql/define-subgraph.js +15 -0
- package/dist/graphql/define-subgraph.js.map +1 -0
- package/dist/graphql/gql.d.ts +10 -0
- package/dist/graphql/gql.js +16 -0
- package/dist/graphql/gql.js.map +1 -0
- package/dist/graphql/types.d.ts +88 -0
- package/dist/graphql.d.ts +4 -0
- package/dist/graphql.js +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +5 -0
- package/dist/internal/client.d.ts +24 -0
- package/dist/internal/client.js +23 -0
- package/dist/internal/content.d.ts +2 -0
- package/dist/internal/content.js +2 -0
- package/dist/internal/server.d.ts +7 -0
- package/dist/internal/server.js +6 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +111 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +387 -0
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.d.ts +64 -0
- package/dist/matter/account-entry-point/account-entry-point.js +151 -0
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -0
- package/dist/matter/breadcrumb/breadcrumb.d.ts +40 -0
- package/dist/matter/breadcrumb/breadcrumb.js +155 -0
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/matter/buy-button/buy-button.d.ts +95 -0
- package/dist/matter/buy-button/buy-button.js +259 -0
- package/dist/matter/buy-button/buy-button.js.map +1 -0
- package/dist/matter/cart/cart-namespace.d.ts +48 -0
- package/dist/matter/cart/cart-namespace.js +50 -0
- package/dist/matter/cart/cart-namespace.js.map +1 -0
- package/dist/matter/cart/cart.d.ts +312 -0
- package/dist/matter/cart/cart.js +1034 -0
- package/dist/matter/cart/cart.js.map +1 -0
- package/dist/matter/cart-item/cart-item.d.ts +103 -0
- package/dist/matter/cart-item/cart-item.js +672 -0
- package/dist/matter/cart-item/cart-item.js.map +1 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.d.ts +49 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +165 -0
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.d.ts +28 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +73 -0
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.d.ts +33 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +70 -0
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.d.ts +24 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +54 -0
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -0
- package/dist/matter/cart-item-variations/cart-item-variations.d.ts +27 -0
- package/dist/matter/cart-item-variations/cart-item-variations.js +69 -0
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -0
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +78 -0
- package/dist/matter/cart-totalizer/cart-totalizer.js +220 -0
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -0
- package/dist/matter/client-preferences/client-preferences.js +206 -0
- package/dist/matter/client-preferences/client-preferences.js.map +1 -0
- package/dist/matter/client-profile/client-profile.d.ts +59 -0
- package/dist/matter/client-profile/client-profile.js +185 -0
- package/dist/matter/client-profile/client-profile.js.map +1 -0
- package/dist/matter/client-profile-form/client-profile-form.d.ts +126 -0
- package/dist/matter/client-profile-form/client-profile-form.js +660 -0
- package/dist/matter/client-profile-form/client-profile-form.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +30 -0
- package/dist/matter/delivery-options/delivery-options-accordion.js +189 -0
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +49 -0
- package/dist/matter/delivery-options/delivery-options-controller.js +203 -0
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options.d.ts +31 -0
- package/dist/matter/delivery-options/delivery-options.js +103 -0
- package/dist/matter/delivery-options/delivery-options.js.map +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +9 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +76 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -0
- package/dist/matter/email-identification/email-identification.d.ts +37 -0
- package/dist/matter/email-identification/email-identification.js +111 -0
- package/dist/matter/email-identification/email-identification.js.map +1 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +44 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +170 -0
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -0
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -0
- package/dist/matter/identity-edit/identity-edit.js +148 -0
- package/dist/matter/identity-edit/identity-edit.js.map +1 -0
- package/dist/matter/identity-summary/identity-summary.d.ts +128 -0
- package/dist/matter/identity-summary/identity-summary.js +344 -0
- package/dist/matter/identity-summary/identity-summary.js.map +1 -0
- package/dist/matter/pricing/pricing.d.ts +162 -0
- package/dist/matter/pricing/pricing.js +793 -0
- package/dist/matter/pricing/pricing.js.map +1 -0
- package/dist/matter/product-gallery/product-gallery.d.ts +23 -0
- package/dist/matter/product-gallery/product-gallery.js +188 -0
- package/dist/matter/product-gallery/product-gallery.js.map +1 -0
- package/dist/matter/product-information/product-information.d.ts +61 -0
- package/dist/matter/product-information/product-information.js +355 -0
- package/dist/matter/product-information/product-information.js.map +1 -0
- package/dist/matter/product-list/product-list.d.ts +86 -0
- package/dist/matter/product-list/product-list.js +342 -0
- package/dist/matter/product-list/product-list.js.map +1 -0
- package/dist/matter/product-quantity/product-quantity.d.ts +50 -0
- package/dist/matter/product-quantity/product-quantity.js +111 -0
- package/dist/matter/product-quantity/product-quantity.js.map +1 -0
- package/dist/matter/product-shelf/product-shelf.d.ts +125 -0
- package/dist/matter/product-shelf/product-shelf.js +376 -0
- package/dist/matter/product-shelf/product-shelf.js.map +1 -0
- package/dist/matter/region/region.d.ts +211 -0
- package/dist/matter/region/region.js +579 -0
- package/dist/matter/region/region.js.map +1 -0
- package/dist/matter/session/session.d.ts +58 -0
- package/dist/matter/session/session.js +112 -0
- package/dist/matter/session/session.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +101 -0
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +284 -0
- package/dist/matter/shipping-address/shipping-address.js +1036 -0
- package/dist/matter/shipping-address/shipping-address.js.map +1 -0
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +143 -0
- package/dist/matter/shipping-simulator/shipping-simulator.js +644 -0
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +79 -0
- package/dist/matter/sign-in-form/sign-in-form.js +226 -0
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -0
- package/dist/matter/variant-selector/variant-selector.d.ts +183 -0
- package/dist/matter/variant-selector/variant-selector.js +840 -0
- package/dist/matter/variant-selector/variant-selector.js.map +1 -0
- package/dist/message-locales.json +7 -0
- package/dist/particles/access-code-field/access-code-field.d.ts +33 -0
- package/dist/particles/access-code-field/access-code-field.js +95 -0
- package/dist/particles/access-code-field/access-code-field.js.map +1 -0
- package/dist/particles/accordion/accordion.d.ts +45 -0
- package/dist/particles/accordion/accordion.js +156 -0
- package/dist/particles/accordion/accordion.js.map +1 -0
- package/dist/particles/address-summary/address-summary.d.ts +50 -0
- package/dist/particles/address-summary/address-summary.js +129 -0
- package/dist/particles/address-summary/address-summary.js.map +1 -0
- package/dist/particles/badge/badge.d.ts +10 -0
- package/dist/particles/badge/badge.js +27 -0
- package/dist/particles/badge/badge.js.map +1 -0
- package/dist/particles/button/button.d.ts +18 -0
- package/dist/particles/button/button.js +37 -0
- package/dist/particles/button/button.js.map +1 -0
- package/dist/particles/carousel/carousel.d.ts +60 -0
- package/dist/particles/carousel/carousel.js +335 -0
- package/dist/particles/carousel/carousel.js.map +1 -0
- package/dist/particles/checkbox/checkbox.d.ts +40 -0
- package/dist/particles/checkbox/checkbox.js +82 -0
- package/dist/particles/checkbox/checkbox.js.map +1 -0
- package/dist/particles/container/container.d.ts +20 -0
- package/dist/particles/container/container.js +36 -0
- package/dist/particles/container/container.js.map +1 -0
- package/dist/particles/dialog/dialog.d.ts +54 -0
- package/dist/particles/dialog/dialog.js +192 -0
- package/dist/particles/dialog/dialog.js.map +1 -0
- package/dist/particles/document-field/document-field.d.ts +61 -0
- package/dist/particles/document-field/document-field.js +146 -0
- package/dist/particles/document-field/document-field.js.map +1 -0
- package/dist/particles/drawer/drawer.d.ts +52 -0
- package/dist/particles/drawer/drawer.js +183 -0
- package/dist/particles/drawer/drawer.js.map +1 -0
- package/dist/particles/email-field/email-field.d.ts +37 -0
- package/dist/particles/email-field/email-field.js +106 -0
- package/dist/particles/email-field/email-field.js.map +1 -0
- package/dist/particles/field/field.d.ts +50 -0
- package/dist/particles/field/field.js +133 -0
- package/dist/particles/field/field.js.map +1 -0
- package/dist/particles/fieldset/fieldset.d.ts +16 -0
- package/dist/particles/fieldset/fieldset.js +52 -0
- package/dist/particles/fieldset/fieldset.js.map +1 -0
- package/dist/particles/footer-copyright/footer-copyright.d.ts +32 -0
- package/dist/particles/footer-copyright/footer-copyright.js +50 -0
- package/dist/particles/footer-copyright/footer-copyright.js.map +1 -0
- package/dist/particles/footer-link-group/footer-link-group.d.ts +66 -0
- package/dist/particles/footer-link-group/footer-link-group.js +154 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -0
- package/dist/particles/footer-root/footer-root.d.ts +21 -0
- package/dist/particles/footer-root/footer-root.js +38 -0
- package/dist/particles/footer-root/footer-root.js.map +1 -0
- package/dist/particles/footer-social/footer-social.d.ts +79 -0
- package/dist/particles/footer-social/footer-social.js +176 -0
- package/dist/particles/footer-social/footer-social.js.map +1 -0
- package/dist/particles/gallery/gallery.d.ts +181 -0
- package/dist/particles/gallery/gallery.js +920 -0
- package/dist/particles/gallery/gallery.js.map +1 -0
- package/dist/particles/header-root/header-root.d.ts +21 -0
- package/dist/particles/header-root/header-root.js +38 -0
- package/dist/particles/header-root/header-root.js.map +1 -0
- package/dist/particles/icon/icon.d.ts +22 -0
- package/dist/particles/icon/icon.js +48 -0
- package/dist/particles/icon/icon.js.map +1 -0
- package/dist/particles/image/image.d.ts +13 -0
- package/dist/particles/image/image.js +59 -0
- package/dist/particles/image/image.js.map +1 -0
- package/dist/particles/incentives/incentives.d.ts +85 -0
- package/dist/particles/incentives/incentives.js +200 -0
- package/dist/particles/incentives/incentives.js.map +1 -0
- package/dist/particles/input/input.d.ts +9 -0
- package/dist/particles/input/input.js +28 -0
- package/dist/particles/input/input.js.map +1 -0
- package/dist/particles/logo/logo.d.ts +55 -0
- package/dist/particles/logo/logo.js +96 -0
- package/dist/particles/logo/logo.js.map +1 -0
- package/dist/particles/menu/menu.d.ts +103 -0
- package/dist/particles/menu/menu.js +409 -0
- package/dist/particles/menu/menu.js.map +1 -0
- package/dist/particles/menubar/menubar.d.ts +18 -0
- package/dist/particles/menubar/menubar.js +42 -0
- package/dist/particles/menubar/menubar.js.map +1 -0
- package/dist/particles/meter/meter.d.ts +36 -0
- package/dist/particles/meter/meter.js +132 -0
- package/dist/particles/meter/meter.js.map +1 -0
- package/dist/particles/navigation-link/navigation-link.d.ts +43 -0
- package/dist/particles/navigation-link/navigation-link.js +82 -0
- package/dist/particles/navigation-link/navigation-link.js.map +1 -0
- package/dist/particles/navigation-link-list/navigation-link-list.d.ts +59 -0
- package/dist/particles/navigation-link-list/navigation-link-list.js +103 -0
- package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -0
- package/dist/particles/navigation-menu/navigation-menu.d.ts +78 -0
- package/dist/particles/navigation-menu/navigation-menu.js +295 -0
- package/dist/particles/navigation-menu/navigation-menu.js.map +1 -0
- package/dist/particles/number-field/number-field.d.ts +46 -0
- package/dist/particles/number-field/number-field.js +169 -0
- package/dist/particles/number-field/number-field.js.map +1 -0
- package/dist/particles/password-field/password-field.d.ts +31 -0
- package/dist/particles/password-field/password-field.js +109 -0
- package/dist/particles/password-field/password-field.js.map +1 -0
- package/dist/particles/payment-methods/payment-methods.d.ts +72 -0
- package/dist/particles/payment-methods/payment-methods.js +151 -0
- package/dist/particles/payment-methods/payment-methods.js.map +1 -0
- package/dist/particles/phone-field/phone-field.d.ts +67 -0
- package/dist/particles/phone-field/phone-field.js +250 -0
- package/dist/particles/phone-field/phone-field.js.map +1 -0
- package/dist/particles/popover/popover.d.ts +68 -0
- package/dist/particles/popover/popover.js +284 -0
- package/dist/particles/popover/popover.js.map +1 -0
- package/dist/particles/postal-code-field/postal-code-field.d.ts +75 -0
- package/dist/particles/postal-code-field/postal-code-field.js +169 -0
- package/dist/particles/postal-code-field/postal-code-field.js.map +1 -0
- package/dist/particles/promotion/promotion.d.ts +46 -0
- package/dist/particles/promotion/promotion.js +78 -0
- package/dist/particles/promotion/promotion.js.map +1 -0
- package/dist/particles/quantity-selector/quantity-selector.d.ts +30 -0
- package/dist/particles/quantity-selector/quantity-selector.js +116 -0
- package/dist/particles/quantity-selector/quantity-selector.js.map +1 -0
- package/dist/particles/radio/radio.d.ts +36 -0
- package/dist/particles/radio/radio.js +76 -0
- package/dist/particles/radio/radio.js.map +1 -0
- package/dist/particles/scroll-area/scroll-area.d.ts +36 -0
- package/dist/particles/scroll-area/scroll-area.js +145 -0
- package/dist/particles/scroll-area/scroll-area.js.map +1 -0
- package/dist/particles/select/select.d.ts +125 -0
- package/dist/particles/select/select.js +478 -0
- package/dist/particles/select/select.js.map +1 -0
- package/dist/particles/separator/separator.d.ts +12 -0
- package/dist/particles/separator/separator.js +33 -0
- package/dist/particles/separator/separator.js.map +1 -0
- package/dist/particles/shared/input-mask.d.ts +5 -0
- package/dist/particles/shared/input-mask.js +58 -0
- package/dist/particles/shared/input-mask.js.map +1 -0
- package/dist/particles/spinner/spinner.d.ts +13 -0
- package/dist/particles/spinner/spinner.js +31 -0
- package/dist/particles/spinner/spinner.js.map +1 -0
- package/dist/particles/switch/switch.d.ts +27 -0
- package/dist/particles/switch/switch.js +59 -0
- package/dist/particles/switch/switch.js.map +1 -0
- package/dist/particles/tabs/tabs.d.ts +45 -0
- package/dist/particles/tabs/tabs.js +164 -0
- package/dist/particles/tabs/tabs.js.map +1 -0
- package/dist/particles/text/text.d.ts +24 -0
- package/dist/particles/text/text.js +40 -0
- package/dist/particles/text/text.js.map +1 -0
- package/dist/particles/toast/toast.d.ts +83 -0
- package/dist/particles/toast/toast.js +194 -0
- package/dist/particles/toast/toast.js.map +1 -0
- package/dist/particles/toggle/toggle.d.ts +26 -0
- package/dist/particles/toggle/toggle.js +61 -0
- package/dist/particles/toggle/toggle.js.map +1 -0
- package/dist/particles/tooltip/tooltip.d.ts +61 -0
- package/dist/particles/tooltip/tooltip.js +240 -0
- package/dist/particles/tooltip/tooltip.js.map +1 -0
- package/dist/schema.graphql +2953 -0
- package/dist/sdk/actions/cart-action-provider.d.ts +19 -0
- package/dist/sdk/actions/cart-action-provider.js +23 -0
- package/dist/sdk/actions/cart-action-provider.js.map +1 -0
- package/dist/sdk/actions/identity-action-provider.d.ts +15 -0
- package/dist/sdk/actions/identity-action-provider.js +19 -0
- package/dist/sdk/actions/identity-action-provider.js.map +1 -0
- package/dist/sdk/actions/index.d.ts +7 -0
- package/dist/sdk/actions/index.js +6 -0
- package/dist/sdk/actions/inject-actions.d.ts +14 -0
- package/dist/sdk/actions/inject-actions.js +36 -0
- package/dist/sdk/actions/inject-actions.js.map +1 -0
- package/dist/sdk/actions/region-action-provider.d.ts +15 -0
- package/dist/sdk/actions/region-action-provider.js +19 -0
- package/dist/sdk/actions/region-action-provider.js.map +1 -0
- package/dist/sdk/actions/session-action-provider.d.ts +15 -0
- package/dist/sdk/actions/session-action-provider.js +19 -0
- package/dist/sdk/actions/session-action-provider.js.map +1 -0
- package/dist/sdk/actions/shipping-action-provider.d.ts +15 -0
- package/dist/sdk/actions/shipping-action-provider.js +19 -0
- package/dist/sdk/actions/shipping-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +21 -0
- package/dist/sdk/cache/storefront-cache.js +35 -0
- package/dist/sdk/cache/storefront-cache.js.map +1 -0
- package/dist/sdk/cart/operations.d.ts +31 -0
- package/dist/sdk/cart/operations.js +215 -0
- package/dist/sdk/cart/operations.js.map +1 -0
- package/dist/sdk/cart/optimistic.d.ts +24 -0
- package/dist/sdk/cart/optimistic.js +164 -0
- package/dist/sdk/cart/optimistic.js.map +1 -0
- package/dist/sdk/cart/use-cart-actions.d.ts +56 -0
- package/dist/sdk/cart/use-cart-actions.js +348 -0
- package/dist/sdk/cart/use-cart-actions.js.map +1 -0
- package/dist/sdk/cart/use-cart-validate-on-open.js +50 -0
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -0
- package/dist/sdk/cart/write-gate.js +54 -0
- package/dist/sdk/cart/write-gate.js.map +1 -0
- package/dist/sdk/client/assert-api-url.js +20 -0
- package/dist/sdk/client/assert-api-url.js.map +1 -0
- package/dist/sdk/client/create-client.d.ts +23 -0
- package/dist/sdk/client/create-client.js +46 -0
- package/dist/sdk/client/create-client.js.map +1 -0
- package/dist/sdk/client/fetch-page-data.d.ts +39 -0
- package/dist/sdk/client/fetch-page-data.js +33 -0
- package/dist/sdk/client/fetch-page-data.js.map +1 -0
- package/dist/sdk/client/register-preload-query.d.ts +24 -0
- package/dist/sdk/client/register-preload-query.js +33 -0
- package/dist/sdk/client/register-preload-query.js.map +1 -0
- package/dist/sdk/content/create-content-runtime.d.ts +68 -0
- package/dist/sdk/content/create-content-runtime.js +503 -0
- package/dist/sdk/content/create-content-runtime.js.map +1 -0
- package/dist/sdk/context/headers.d.ts +15 -0
- package/dist/sdk/context/headers.js +21 -0
- package/dist/sdk/context/headers.js.map +1 -0
- package/dist/sdk/context/storefront-context.d.ts +11 -0
- package/dist/sdk/context/storefront-context.js +29 -0
- package/dist/sdk/context/storefront-context.js.map +1 -0
- package/dist/sdk/data/data-override-context.d.ts +12 -0
- package/dist/sdk/data/data-override-context.js +19 -0
- package/dist/sdk/data/data-override-context.js.map +1 -0
- package/dist/sdk/data/entity-subscriber.js +28 -0
- package/dist/sdk/data/entity-subscriber.js.map +1 -0
- package/dist/sdk/data/hot-data-provider.d.ts +19 -0
- package/dist/sdk/data/hot-data-provider.js +33 -0
- package/dist/sdk/data/hot-data-provider.js.map +1 -0
- package/dist/sdk/data/index.d.ts +8 -0
- package/dist/sdk/data/index.js +8 -0
- package/dist/sdk/data/list-item-ref-context.d.ts +20 -0
- package/dist/sdk/data/list-item-ref-context.js +11 -0
- package/dist/sdk/data/list-item-ref-context.js.map +1 -0
- package/dist/sdk/data/multiple-reactive-data-provider.d.ts +32 -0
- package/dist/sdk/data/multiple-reactive-data-provider.js +20 -0
- package/dist/sdk/data/multiple-reactive-data-provider.js.map +1 -0
- package/dist/sdk/data/page-reactive-data-root.d.ts +53 -0
- package/dist/sdk/data/page-reactive-data-root.js +153 -0
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -0
- package/dist/sdk/data/reactive-data-provider.d.ts +25 -0
- package/dist/sdk/data/reactive-data-provider.js +24 -0
- package/dist/sdk/data/reactive-data-provider.js.map +1 -0
- package/dist/sdk/data/reactive-list-item-data-provider.d.ts +26 -0
- package/dist/sdk/data/reactive-list-item-data-provider.js +42 -0
- package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -0
- package/dist/sdk/data/use-reactive-entity.js +40 -0
- package/dist/sdk/data/use-reactive-entity.js.map +1 -0
- package/dist/sdk/format/client.d.ts +12 -0
- package/dist/sdk/format/client.js +20 -0
- package/dist/sdk/format/client.js.map +1 -0
- package/dist/sdk/format/formatters.d.ts +32 -0
- package/dist/sdk/format/formatters.js +45 -0
- package/dist/sdk/format/formatters.js.map +1 -0
- package/dist/sdk/generated/fragment-types.js +23 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -0
- package/dist/sdk/generated/gql.js +51 -0
- package/dist/sdk/generated/gql.js.map +1 -0
- package/dist/sdk/generated/graphql.d.ts +622 -0
- package/dist/sdk/generated/graphql.js +11917 -0
- package/dist/sdk/generated/graphql.js.map +1 -0
- package/dist/sdk/graphql-tag.d.ts +10 -0
- package/dist/sdk/graphql-tag.js +21 -0
- package/dist/sdk/graphql-tag.js.map +1 -0
- package/dist/sdk/i18n/client.d.ts +4 -0
- package/dist/sdk/i18n/client.js +4 -0
- package/dist/sdk/i18n/locales.d.ts +8 -0
- package/dist/sdk/i18n/locales.js +57 -0
- package/dist/sdk/i18n/locales.js.map +1 -0
- package/dist/sdk/i18n/messages/en-US.js +24 -0
- package/dist/sdk/i18n/messages/en-US.js.map +1 -0
- package/dist/sdk/i18n/messages/en-US.json +19 -0
- package/dist/sdk/i18n/messages/en-US.json.d.ts +23 -0
- package/dist/sdk/i18n/messages/es-ES.js +24 -0
- package/dist/sdk/i18n/messages/es-ES.js.map +1 -0
- package/dist/sdk/i18n/messages/es-ES.json +19 -0
- package/dist/sdk/i18n/messages/pt-BR.js +24 -0
- package/dist/sdk/i18n/messages/pt-BR.js.map +1 -0
- package/dist/sdk/i18n/messages/pt-BR.json +19 -0
- package/dist/sdk/i18n/provider.d.ts +1 -0
- package/dist/sdk/i18n/provider.js +30 -0
- package/dist/sdk/i18n/provider.js.map +1 -0
- package/dist/sdk/i18n/server.d.ts +28 -0
- package/dist/sdk/i18n/server.js +59 -0
- package/dist/sdk/i18n/server.js.map +1 -0
- package/dist/sdk/identity/operations.d.ts +34 -0
- package/dist/sdk/identity/operations.js +78 -0
- package/dist/sdk/identity/operations.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.d.ts +62 -0
- package/dist/sdk/identity/use-identity-actions.js +180 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -0
- package/dist/sdk/provider/index.d.ts +2 -0
- package/dist/sdk/provider/index.js +2 -0
- package/dist/sdk/provider/storefront-provider.d.ts +32 -0
- package/dist/sdk/provider/storefront-provider.js +111 -0
- package/dist/sdk/provider/storefront-provider.js.map +1 -0
- package/dist/sdk/region/operations.d.ts +6 -0
- package/dist/sdk/region/region-operations.d.ts +30 -0
- package/dist/sdk/region/region-operations.js +23 -0
- package/dist/sdk/region/region-operations.js.map +1 -0
- package/dist/sdk/region/use-region-actions.d.ts +23 -0
- package/dist/sdk/region/use-region-actions.js +66 -0
- package/dist/sdk/region/use-region-actions.js.map +1 -0
- package/dist/sdk/seller.js +11 -0
- package/dist/sdk/seller.js.map +1 -0
- package/dist/sdk/session/auth-operations.d.ts +47 -0
- package/dist/sdk/session/auth-operations.js +79 -0
- package/dist/sdk/session/auth-operations.js.map +1 -0
- package/dist/sdk/session/operations.d.ts +6 -0
- package/dist/sdk/session/use-session-actions.d.ts +27 -0
- package/dist/sdk/session/use-session-actions.js +126 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -0
- package/dist/sdk/shipping/cart-operations.d.ts +3 -0
- package/dist/sdk/shipping/cart-operations.js +33 -0
- package/dist/sdk/shipping/cart-operations.js.map +1 -0
- package/dist/sdk/shipping/operations.d.ts +3 -0
- package/dist/sdk/shipping/operations.js +33 -0
- package/dist/sdk/shipping/operations.js.map +1 -0
- package/dist/sdk/shipping/option-select-operations.d.ts +24 -0
- package/dist/sdk/shipping/option-select-operations.js +45 -0
- package/dist/sdk/shipping/option-select-operations.js.map +1 -0
- package/dist/sdk/shipping/request-timeout.js +41 -0
- package/dist/sdk/shipping/request-timeout.js.map +1 -0
- package/dist/sdk/shipping/shipping-operations.d.ts +38 -0
- package/dist/sdk/shipping/shipping-operations.js +77 -0
- package/dist/sdk/shipping/shipping-operations.js.map +1 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.d.ts +7 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.js +72 -0
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-actions.d.ts +27 -0
- package/dist/sdk/shipping/use-shipping-actions.js +113 -0
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -0
- package/dist/sdk/shipping/use-shipping-simulation.d.ts +7 -0
- package/dist/sdk/shipping/use-shipping-simulation.js +72 -0
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -0
- package/dist/sdk/state/cart.d.ts +42 -0
- package/dist/sdk/state/cart.js +64 -0
- package/dist/sdk/state/cart.js.map +1 -0
- package/dist/sdk/state/index.js +3 -0
- package/dist/sdk/state/variant-selector.d.ts +17 -0
- package/dist/sdk/state/variant-selector.js +14 -0
- package/dist/sdk/state/variant-selector.js.map +1 -0
- package/dist/utils/safe-href.js +63 -0
- package/dist/utils/safe-href.js.map +1 -0
- package/package.json +84 -0
- package/src/styles/tailwind.css +32 -0
package/dist/graphql.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ActionSelector } from "./core/dist/actions/registry.js";
|
|
2
|
+
import { MockActions, mockAction } from "./core/dist/actions/mock-action.js";
|
|
3
|
+
import { JsonValue, StorefrontContext } from "./core/dist/schema/generated/schema.js";
|
|
4
|
+
import { ContentArraySchema, ContentNestedObjectShape, ContentObjectPropertySchema, ContentObjectSchema, ContentPropertySchema, ContentPropertyType, ContentScalarSchema, ContentScalarType, ContentTypeDefinition, ContentValue, defineContentType } from "./core/dist/define-content-type.js";
|
|
5
|
+
import { ComponentDefinition, EditorMetadata, FetchStrategy, PropSchema, PropSchemaField, PropType, defineComponent } from "./core/dist/define-component.js";
|
|
6
|
+
import "./core/dist/index.js";
|
|
7
|
+
import { CartUserError } from "./sdk/cart/operations.js";
|
|
8
|
+
import { AddItemPayload, CartActions, CartCouponPayload, CartLinePayload, CartLinesPayload, CartQuantityPayload } from "./sdk/cart/use-cart-actions.js";
|
|
9
|
+
import { ClientPreferenceKey, ClientProfileUserError, CustomerProfileUserError } from "./sdk/identity/operations.js";
|
|
10
|
+
import { ClientPreferencesUpdatePayload, ClientProfileUpdatePayload, CustomerProfileUpdatePayload, IdentityActions } from "./sdk/identity/use-identity-actions.js";
|
|
11
|
+
import { RegionUserError } from "./sdk/region/region-operations.js";
|
|
12
|
+
import { RegionActions } from "./sdk/region/use-region-actions.js";
|
|
13
|
+
import { SessionAccessCodeRequestResult, SessionPasswordLoginPayload, SessionRequestAccessCodePayload, SessionUserError, SessionValidateAccessCodePayload } from "./sdk/session/auth-operations.js";
|
|
14
|
+
import { SessionActions } from "./sdk/session/use-session-actions.js";
|
|
15
|
+
import { ShippingOptionSelectUserError } from "./sdk/shipping/option-select-operations.js";
|
|
16
|
+
import { ShippingAddressInput, ShippingAddressUpdateErrorEntity } from "./sdk/shipping/shipping-operations.js";
|
|
17
|
+
import { ShippingActions } from "./sdk/shipping/use-shipping-actions.js";
|
|
18
|
+
import { ComponentActions } from "./sdk/actions/types.js";
|
|
19
|
+
export { type ActionSelector, type AddItemPayload, type CartActions, type CartCouponPayload, type CartLinePayload, type CartLinesPayload, type CartQuantityPayload, type CartUserError, type ClientPreferenceKey, type ClientPreferencesUpdatePayload, type ClientProfileUpdatePayload, type ClientProfileUserError, type ComponentActions, type ComponentDefinition, type ContentArraySchema, type ContentNestedObjectShape, type ContentObjectPropertySchema, type ContentObjectSchema, type ContentPropertySchema, type ContentPropertyType, type ContentScalarSchema, type ContentScalarType, type ContentTypeDefinition, type ContentValue, type CustomerProfileUpdatePayload, type CustomerProfileUserError, type EditorMetadata, type FetchStrategy, type IdentityActions, type JsonValue, type MockActions, type PropSchema, type PropSchemaField, type PropType, type RegionActions, type RegionUserError, type SessionAccessCodeRequestResult, type SessionActions, type SessionPasswordLoginPayload, type SessionRequestAccessCodePayload, type SessionUserError, type SessionValidateAccessCodePayload, type ShippingActions, type ShippingAddressInput, type ShippingAddressUpdateErrorEntity, type ShippingOptionSelectUserError, type StorefrontContext, defineComponent, defineContentType, mockAction };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mockAction } from "./core/dist/actions/mock-action.js";
|
|
2
|
+
import { defineComponent } from "./core/dist/define-component.js";
|
|
3
|
+
import { defineContentType } from "./core/dist/define-content-type.js";
|
|
4
|
+
import "./core/dist/index.js";
|
|
5
|
+
export { defineComponent, defineContentType, mockAction };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MessageId, Messages } from "../sdk/i18n/locales.js";
|
|
2
|
+
import "../sdk/i18n/client.js";
|
|
3
|
+
import { gql } from "../sdk/graphql-tag.js";
|
|
4
|
+
import { CartActionProvider, CartActionProviderProps } from "../sdk/actions/cart-action-provider.js";
|
|
5
|
+
import { IdentityActionProvider, IdentityActionProviderProps } from "../sdk/actions/identity-action-provider.js";
|
|
6
|
+
import { RegionActionProvider, RegionActionProviderProps } from "../sdk/actions/region-action-provider.js";
|
|
7
|
+
import { SessionActionProvider, SessionActionProviderProps } from "../sdk/actions/session-action-provider.js";
|
|
8
|
+
import { ShippingActionProvider, ShippingActionProviderProps } from "../sdk/actions/shipping-action-provider.js";
|
|
9
|
+
import "../sdk/actions/index.js";
|
|
10
|
+
import { buildOptimisticDecrease, buildOptimisticIncrease, buildOptimisticRemove } from "../sdk/cart/optimistic.js";
|
|
11
|
+
import { buildStorefrontContextHeaders } from "../sdk/context/headers.js";
|
|
12
|
+
import { DataOverrideContext, useDataOverride } from "../sdk/data/data-override-context.js";
|
|
13
|
+
import { HotDataProvider, HotDataProviderProps } from "../sdk/data/hot-data-provider.js";
|
|
14
|
+
import { ListItemRef, ListItemRefContext, useListItemRef } from "../sdk/data/list-item-ref-context.js";
|
|
15
|
+
import { MultipleReactiveDataProvider, MultipleReactiveDataProviderEntity, MultipleReactiveDataProviderProps } from "../sdk/data/multiple-reactive-data-provider.js";
|
|
16
|
+
import { ClientVariablesMap, PageReactiveDataRoot, PageReactiveDataRootProps, ReactiveRootContext, ReactiveRootContextValue } from "../sdk/data/page-reactive-data-root.js";
|
|
17
|
+
import { ReactiveDataProvider, ReactiveDataProviderProps } from "../sdk/data/reactive-data-provider.js";
|
|
18
|
+
import { ReactiveListItemDataProvider, ReactiveListItemDataProviderProps } from "../sdk/data/reactive-list-item-data-provider.js";
|
|
19
|
+
import "../sdk/data/index.js";
|
|
20
|
+
import { StorefrontProvider, StorefrontProviderProps } from "../sdk/provider/storefront-provider.js";
|
|
21
|
+
import "../sdk/provider/index.js";
|
|
22
|
+
import { cartCouponErrorsVar, cartLastAddVar, cartUserErrorsVar, miniCartOpenVar, orderFormIdVar } from "../sdk/state/cart.js";
|
|
23
|
+
import { SelectedVariant, publishedVariantIdFor, selectedVariantVar } from "../sdk/state/variant-selector.js";
|
|
24
|
+
export { CartActionProvider, type CartActionProviderProps, type ClientVariablesMap, DataOverrideContext, HotDataProvider, type HotDataProviderProps, IdentityActionProvider, type IdentityActionProviderProps, type ListItemRef, ListItemRefContext, type MessageId, type Messages, MultipleReactiveDataProvider, type MultipleReactiveDataProviderEntity, type MultipleReactiveDataProviderProps, PageReactiveDataRoot, type PageReactiveDataRootProps, ReactiveDataProvider, type ReactiveDataProviderProps, ReactiveListItemDataProvider, type ReactiveListItemDataProviderProps, ReactiveRootContext, type ReactiveRootContextValue, RegionActionProvider, type RegionActionProviderProps, type SelectedVariant, SessionActionProvider, type SessionActionProviderProps, ShippingActionProvider, type ShippingActionProviderProps, StorefrontProvider, type StorefrontProviderProps, buildOptimisticDecrease, buildOptimisticIncrease, buildOptimisticRemove, buildStorefrontContextHeaders, cartCouponErrorsVar, cartLastAddVar, cartUserErrorsVar, gql, miniCartOpenVar, orderFormIdVar, publishedVariantIdFor, selectedVariantVar, useDataOverride, useListItemRef };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { gql } from "../sdk/graphql-tag.js";
|
|
2
|
+
import { DataOverrideContext, useDataOverride } from "../sdk/data/data-override-context.js";
|
|
3
|
+
import { HotDataProvider } from "../sdk/data/hot-data-provider.js";
|
|
4
|
+
import { publishedVariantIdFor, selectedVariantVar } from "../sdk/state/variant-selector.js";
|
|
5
|
+
import { cartCouponErrorsVar, cartLastAddVar, cartUserErrorsVar, miniCartOpenVar, orderFormIdVar } from "../sdk/state/cart.js";
|
|
6
|
+
import { buildOptimisticDecrease, buildOptimisticIncrease, buildOptimisticRemove } from "../sdk/cart/optimistic.js";
|
|
7
|
+
import { ListItemRefContext, useListItemRef } from "../sdk/data/list-item-ref-context.js";
|
|
8
|
+
import { PageReactiveDataRoot, ReactiveRootContext } from "../sdk/data/page-reactive-data-root.js";
|
|
9
|
+
import { CartActionProvider } from "../sdk/actions/cart-action-provider.js";
|
|
10
|
+
import { IdentityActionProvider } from "../sdk/actions/identity-action-provider.js";
|
|
11
|
+
import { RegionActionProvider } from "../sdk/actions/region-action-provider.js";
|
|
12
|
+
import { SessionActionProvider } from "../sdk/actions/session-action-provider.js";
|
|
13
|
+
import { ShippingActionProvider } from "../sdk/actions/shipping-action-provider.js";
|
|
14
|
+
import "../sdk/actions/index.js";
|
|
15
|
+
import { buildStorefrontContextHeaders } from "../sdk/context/headers.js";
|
|
16
|
+
import { MultipleReactiveDataProvider } from "../sdk/data/multiple-reactive-data-provider.js";
|
|
17
|
+
import { ReactiveDataProvider } from "../sdk/data/reactive-data-provider.js";
|
|
18
|
+
import { ReactiveListItemDataProvider } from "../sdk/data/reactive-list-item-data-provider.js";
|
|
19
|
+
import "../sdk/data/index.js";
|
|
20
|
+
import { StorefrontProvider } from "../sdk/provider/storefront-provider.js";
|
|
21
|
+
import "../sdk/provider/index.js";
|
|
22
|
+
import "../sdk/state/index.js";
|
|
23
|
+
export { CartActionProvider, DataOverrideContext, HotDataProvider, IdentityActionProvider, ListItemRefContext, MultipleReactiveDataProvider, PageReactiveDataRoot, ReactiveDataProvider, ReactiveListItemDataProvider, ReactiveRootContext, RegionActionProvider, SessionActionProvider, ShippingActionProvider, StorefrontProvider, buildOptimisticDecrease, buildOptimisticIncrease, buildOptimisticRemove, buildStorefrontContextHeaders, cartCouponErrorsVar, cartLastAddVar, cartUserErrorsVar, gql, miniCartOpenVar, orderFormIdVar, publishedVariantIdFor, selectedVariantVar, useDataOverride, useListItemRef };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ContentEntryBoundaryProps, ContentEntryResult, ContentRuntime, ContentRuntimeConfig, ContentSlices, ReadContentSlicesArgs, createContentRuntime } from "../sdk/content/create-content-runtime.js";
|
|
2
|
+
export { type ContentEntryBoundaryProps, type ContentEntryResult, type ContentRuntime, type ContentRuntimeConfig, type ContentSlices, type ReadContentSlicesArgs, createContentRuntime };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { buildStorefrontContextHeaders } from "../sdk/context/headers.js";
|
|
2
|
+
import { CreateClientOptions, createClient } from "../sdk/client/create-client.js";
|
|
3
|
+
import { FetchPageDataOptions, FetchPageDataResult, fetchPageData } from "../sdk/client/fetch-page-data.js";
|
|
4
|
+
import { PreloadQueryRegistry, RegisterPreloadQueryOptions, registerPreloadQuery } from "../sdk/client/register-preload-query.js";
|
|
5
|
+
import { getIntl, loadMessages } from "../sdk/i18n/server.js";
|
|
6
|
+
import { PreloadQueryProps } from "@apollo/client-integration-nextjs";
|
|
7
|
+
export { type CreateClientOptions, type FetchPageDataOptions, type FetchPageDataResult, type PreloadQueryProps, type PreloadQueryRegistry, type RegisterPreloadQueryOptions, buildStorefrontContextHeaders, createClient, fetchPageData, getIntl, loadMessages, registerPreloadQuery };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { buildStorefrontContextHeaders } from "../sdk/context/headers.js";
|
|
2
|
+
import { createClient } from "../sdk/client/create-client.js";
|
|
3
|
+
import { fetchPageData } from "../sdk/client/fetch-page-data.js";
|
|
4
|
+
import { registerPreloadQuery } from "../sdk/client/register-preload-query.js";
|
|
5
|
+
import { getIntl, loadMessages } from "../sdk/i18n/server.js";
|
|
6
|
+
export { buildStorefrontContextHeaders, createClient, fetchPageData, getIntl, loadMessages, registerPreloadQuery };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentActions } from "../../sdk/actions/types.js";
|
|
4
|
+
import { ComponentPropsWithRef } from "react";
|
|
5
|
+
//#region src/matter/access-code-sign-in/access-code-sign-in.d.ts
|
|
6
|
+
/** Colocated fragment slice forwarded by the reactive runtime — `null` until both fields resolve. */
|
|
7
|
+
export type AccessCodeSignInSlice = {
|
|
8
|
+
clientProfile: {
|
|
9
|
+
email: string | null;
|
|
10
|
+
} | null;
|
|
11
|
+
sessionAuthProviders: {
|
|
12
|
+
accessKeyAuthentication: boolean;
|
|
13
|
+
} | null;
|
|
14
|
+
};
|
|
15
|
+
export type AccessCodeSignInStep = 'request' | 'validate';
|
|
16
|
+
export type AccessCodeSignInContextValue = Readonly<{
|
|
17
|
+
/** The shopper's locally-typed draft email — never written to the cart; only ever an argument to
|
|
18
|
+
* requestAccessCode/validateAccessCode. Pre-fills from `clientProfile.email` when known, but a
|
|
19
|
+
* shopper edit is never persisted anywhere by this family. */
|
|
20
|
+
email: string;
|
|
21
|
+
/** Updates the draft email; marks it as shopper-touched so pre-fill no longer overwrites it. */
|
|
22
|
+
setEmail: (email: string) => void;
|
|
23
|
+
step: AccessCodeSignInStep;
|
|
24
|
+
/** Opaque token round-tripped from requestAccessCode into validateAccessCode. */
|
|
25
|
+
authenticationToken: string | null;
|
|
26
|
+
/** Called by AccessCodeRequestControl on a successful requestAccessCode. */
|
|
27
|
+
startValidation: (authenticationToken: string) => void;
|
|
28
|
+
}>;
|
|
29
|
+
export type AccessCodeSignInRootProps = ComponentPropsWithRef<'div'> & {
|
|
30
|
+
$data?: AccessCodeSignInSlice | null;
|
|
31
|
+
};
|
|
32
|
+
export type AccessCodeEmailControlProps = ComponentPropsWithRef<'div'> & {
|
|
33
|
+
label?: string;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
invalidEmailMessage?: string;
|
|
36
|
+
};
|
|
37
|
+
export type AccessCodeRequestControlProps = ComponentPropsWithRef<'div'> & {
|
|
38
|
+
label?: string;
|
|
39
|
+
pendingLabel?: string;
|
|
40
|
+
sendLimitMessage?: string;
|
|
41
|
+
blockedMessage?: string;
|
|
42
|
+
networkErrorMessage?: string;
|
|
43
|
+
onRequested?: (authenticationToken: string) => void;
|
|
44
|
+
$actions?: ComponentActions;
|
|
45
|
+
};
|
|
46
|
+
export type AccessCodeValidateControlProps = ComponentPropsWithRef<'div'> & {
|
|
47
|
+
label?: string;
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
submitLabel?: string;
|
|
50
|
+
codeLength?: number;
|
|
51
|
+
invalidCodeMessage?: string;
|
|
52
|
+
blockedMessage?: string;
|
|
53
|
+
missingAuthContextMessage?: string;
|
|
54
|
+
networkErrorMessage?: string;
|
|
55
|
+
onValidated?: () => void;
|
|
56
|
+
$actions?: ComponentActions;
|
|
57
|
+
};
|
|
58
|
+
export declare const AccessCodeSignInRootDefinition: ComponentDefinition<AccessCodeSignInRootProps>;
|
|
59
|
+
export declare const AccessCodeEmailControlDefinition: ComponentDefinition<AccessCodeEmailControlProps>;
|
|
60
|
+
export declare const AccessCodeRequestControlDefinition: ComponentDefinition<AccessCodeRequestControlProps>;
|
|
61
|
+
export declare const AccessCodeValidateControlDefinition: ComponentDefinition<AccessCodeValidateControlProps>;
|
|
62
|
+
/**
|
|
63
|
+
* Data-owning root of the access-code sign-in flow. Self-gates on two signals:
|
|
64
|
+
* `useSession().state !== 'loggedIn'` (available from anonymous through identified; hides once
|
|
65
|
+
* signed in) and `sessionAuthProviders.accessKeyAuthentication === true`. An unresolved fragment
|
|
66
|
+
* read (`$data` still `null`) is treated as "provider not enabled" — the flow stays hidden rather
|
|
67
|
+
* than flashing. Owns the `step`/`authenticationToken` stepper plus a locally-typed draft `email`
|
|
68
|
+
* as local state, broadcasting all of it through context to its children. The draft email pre-fills
|
|
69
|
+
* from `clientProfile.email` once (for an already-identified shopper) but a shopper edit is never
|
|
70
|
+
* persisted anywhere by this family — it is purely the requestAccessCode/validateAccessCode
|
|
71
|
+
* argument; the server sets clientProfileData.email as a side effect of a successful validate.
|
|
72
|
+
* Reacts automatically once `useSession()` flips to `loggedIn` — no manual unmount call anywhere in
|
|
73
|
+
* this family.
|
|
74
|
+
*/
|
|
75
|
+
export declare function AccessCodeSignInRoot({ $data: $dataProp, className, children, ...props }: AccessCodeSignInRootProps): import("react/jsx-runtime").JSX.Element | null;
|
|
76
|
+
/**
|
|
77
|
+
* The draft email input for the access-code flow. Renders only at the request step. Bound to the
|
|
78
|
+
* Root's local `email`/`setEmail` — never a fragment, never a mutation of its own; typing here
|
|
79
|
+
* never touches the cart. Format validation is `EmailField`'s own blur-triggered check (never
|
|
80
|
+
* per-keystroke); `invalidEmailMessage` is only its fallback text, mirroring how
|
|
81
|
+
* `EmailIdentificationControl` defers to the same particle for the same reason.
|
|
82
|
+
*/
|
|
83
|
+
export declare function AccessCodeEmailControl({ label, placeholder, invalidEmailMessage, className, ...props }: AccessCodeEmailControlProps): import("react/jsx-runtime").JSX.Element | null;
|
|
84
|
+
/**
|
|
85
|
+
* Renders only while the Root's stepper is at `step === 'request'`. Reads the draft email from
|
|
86
|
+
* context and dispatches `$actions.session.requestAccessCode({ email })` once it is a valid,
|
|
87
|
+
* non-empty address (no account-existence pre-check beyond that format gate). On a result with a
|
|
88
|
+
* non-null token and no `userErrors`, advances the Root's stepper. Every `userErrors` entry renders
|
|
89
|
+
* inline via a host-supplied, per-code message; the step never changes on error, so the shopper can
|
|
90
|
+
* retry or abandon the method and continue as a guest.
|
|
91
|
+
*/
|
|
92
|
+
export declare function AccessCodeRequestControl({ label, pendingLabel, sendLimitMessage, blockedMessage, networkErrorMessage, onRequested, $actions, className, ...props }: AccessCodeRequestControlProps): import("react/jsx-runtime").JSX.Element | null;
|
|
93
|
+
/**
|
|
94
|
+
* Renders only while the Root's stepper is at `step === 'validate'`. Composes `AccessCodeField` for
|
|
95
|
+
* the code value and a submit control, disabled below `codeLength` (a UX courtesy, never a
|
|
96
|
+
* validity claim). Dispatches `$actions.session.validateAccessCode` with the email and
|
|
97
|
+
* `authenticationToken` read from context. On a non-empty `userErrors` result, sets the field's
|
|
98
|
+
* `invalid`/`errorMessage` from a host-supplied per-code message and retains the code/token so the
|
|
99
|
+
* shopper can retry without re-requesting. On success it calls the optional `onValidated` and renders
|
|
100
|
+
* no local "success" UI — `useSession()` flipping to `loggedIn` is what makes the whole Root
|
|
101
|
+
* disappear.
|
|
102
|
+
*/
|
|
103
|
+
export declare function AccessCodeValidateControl({ label, placeholder, submitLabel, codeLength, invalidCodeMessage, blockedMessage, missingAuthContextMessage, networkErrorMessage, onValidated, $actions, className, ...props }: AccessCodeValidateControlProps): import("react/jsx-runtime").JSX.Element | null;
|
|
104
|
+
export declare const AccessCodeSignIn: {
|
|
105
|
+
Root: typeof AccessCodeSignInRoot;
|
|
106
|
+
Email: typeof AccessCodeEmailControl;
|
|
107
|
+
Request: typeof AccessCodeRequestControl;
|
|
108
|
+
Validate: typeof AccessCodeValidateControl;
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
//# sourceMappingURL=access-code-sign-in.d.ts.map
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { AccessCodeField } from "../../particles/access-code-field/access-code-field.js";
|
|
5
|
+
import { EmailField, isValidEmail } from "../../particles/email-field/email-field.js";
|
|
6
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
7
|
+
import { useSession } from "../session/session.js";
|
|
8
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/matter/access-code-sign-in/access-code-sign-in.tsx
|
|
11
|
+
const fragment = `
|
|
12
|
+
fragment AccessCodeSignInData on Query {
|
|
13
|
+
clientProfile {
|
|
14
|
+
__typename
|
|
15
|
+
id
|
|
16
|
+
email
|
|
17
|
+
}
|
|
18
|
+
sessionAuthProviders {
|
|
19
|
+
accessKeyAuthentication
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const ACCESS_CODE_SIGN_IN_CONTEXT_UNSET = Symbol("AccessCodeSignInContextUnset");
|
|
24
|
+
const AccessCodeSignInContext = createContext(ACCESS_CODE_SIGN_IN_CONTEXT_UNSET);
|
|
25
|
+
/**
|
|
26
|
+
* Read the stepper state (email, step, authenticationToken) from the nearest `AccessCodeSignInRoot`.
|
|
27
|
+
* Throws when called outside that subtree — a misplaced control is a composition bug that should
|
|
28
|
+
* surface immediately, mirroring `useShippingSimulator()`/`useSession()`.
|
|
29
|
+
*/
|
|
30
|
+
function useAccessCodeSignIn() {
|
|
31
|
+
const ctx = useContext(AccessCodeSignInContext);
|
|
32
|
+
if (ctx === ACCESS_CODE_SIGN_IN_CONTEXT_UNSET) throw new Error("AccessCodeSignIn components must be used inside AccessCodeSignInRoot.");
|
|
33
|
+
return ctx;
|
|
34
|
+
}
|
|
35
|
+
function requestErrorMessage(error, props) {
|
|
36
|
+
switch (error.code) {
|
|
37
|
+
case "ACCESS_CODE_SEND_LIMIT": return props.sendLimitMessage ?? error.message;
|
|
38
|
+
case "BLOCKED": return props.blockedMessage ?? error.message;
|
|
39
|
+
case "NETWORK_ERROR": return props.networkErrorMessage ?? error.message;
|
|
40
|
+
default: return error.message;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function validateErrorMessage(error, props) {
|
|
44
|
+
switch (error.code) {
|
|
45
|
+
case "INVALID_ACCESS_CODE": return props.invalidCodeMessage ?? error.message;
|
|
46
|
+
case "BLOCKED": return props.blockedMessage ?? error.message;
|
|
47
|
+
case "MISSING_AUTH_CONTEXT": return props.missingAuthContextMessage ?? error.message;
|
|
48
|
+
case "NETWORK_ERROR": return props.networkErrorMessage ?? error.message;
|
|
49
|
+
default: return error.message;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const AccessCodeSignInRootDefinition = defineComponent({
|
|
53
|
+
name: "AccessCodeSignInRoot",
|
|
54
|
+
importPath: "@vtex/faststore/components",
|
|
55
|
+
component: AccessCodeSignInRoot,
|
|
56
|
+
fragment,
|
|
57
|
+
fetchStrategy: "reactive",
|
|
58
|
+
requiresContext: "session",
|
|
59
|
+
editor: {
|
|
60
|
+
label: "Access Code Sign-In",
|
|
61
|
+
category: "identity"
|
|
62
|
+
},
|
|
63
|
+
schema: {},
|
|
64
|
+
guideline: "Self-gating root of the anonymous-or-identified, email + access-code sign-in: renders nothing once loggedIn or when the account disables accessKeyAuthentication, but is available from the anonymous state onward. Owns a locally-typed draft email (never written to the cart) and the request/validate stepper. Must be inside SessionRoot. See access-code-sign-in.md."
|
|
65
|
+
});
|
|
66
|
+
const AccessCodeEmailControlDefinition = defineComponent({
|
|
67
|
+
name: "AccessCodeEmailControl",
|
|
68
|
+
importPath: "@vtex/faststore/components",
|
|
69
|
+
component: AccessCodeEmailControl,
|
|
70
|
+
editor: {
|
|
71
|
+
label: "Access Code Email",
|
|
72
|
+
category: "identity"
|
|
73
|
+
},
|
|
74
|
+
schema: {
|
|
75
|
+
label: {
|
|
76
|
+
type: "string",
|
|
77
|
+
label: "Label"
|
|
78
|
+
},
|
|
79
|
+
placeholder: {
|
|
80
|
+
type: "string",
|
|
81
|
+
label: "Placeholder"
|
|
82
|
+
},
|
|
83
|
+
invalidEmailMessage: {
|
|
84
|
+
type: "string",
|
|
85
|
+
label: "Invalid email message"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
guideline: "The draft email input for the access-code flow: visible only at the request step, pre-fills from clientProfile.email when known but never persists an edit anywhere — it is purely the argument requestAccessCode/validateAccessCode dispatch with. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md."
|
|
89
|
+
});
|
|
90
|
+
const AccessCodeRequestControlDefinition = defineComponent({
|
|
91
|
+
name: "AccessCodeRequestControl",
|
|
92
|
+
importPath: "@vtex/faststore/components",
|
|
93
|
+
component: AccessCodeRequestControl,
|
|
94
|
+
actions: { session: ["requestAccessCode"] },
|
|
95
|
+
editor: {
|
|
96
|
+
label: "Access Code Request",
|
|
97
|
+
category: "identity"
|
|
98
|
+
},
|
|
99
|
+
schema: {
|
|
100
|
+
label: {
|
|
101
|
+
type: "string",
|
|
102
|
+
label: "Label"
|
|
103
|
+
},
|
|
104
|
+
sendLimitMessage: {
|
|
105
|
+
type: "string",
|
|
106
|
+
label: "Send-limit message"
|
|
107
|
+
},
|
|
108
|
+
blockedMessage: {
|
|
109
|
+
type: "string",
|
|
110
|
+
label: "Blocked message"
|
|
111
|
+
},
|
|
112
|
+
networkErrorMessage: {
|
|
113
|
+
type: "string",
|
|
114
|
+
label: "Network error message"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
guideline: "Send-code step: disabled until the Root-owned draft email is a valid, non-empty address; dispatches $actions.session.requestAccessCode with it and advances the stepper on success. Failures render inline, never as a blocking error. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md."
|
|
118
|
+
});
|
|
119
|
+
const AccessCodeValidateControlDefinition = defineComponent({
|
|
120
|
+
name: "AccessCodeValidateControl",
|
|
121
|
+
importPath: "@vtex/faststore/components",
|
|
122
|
+
component: AccessCodeValidateControl,
|
|
123
|
+
actions: { session: ["validateAccessCode"] },
|
|
124
|
+
editor: {
|
|
125
|
+
label: "Access Code Validate",
|
|
126
|
+
category: "identity"
|
|
127
|
+
},
|
|
128
|
+
schema: {
|
|
129
|
+
label: {
|
|
130
|
+
type: "string",
|
|
131
|
+
label: "Label"
|
|
132
|
+
},
|
|
133
|
+
placeholder: {
|
|
134
|
+
type: "string",
|
|
135
|
+
label: "Placeholder"
|
|
136
|
+
},
|
|
137
|
+
submitLabel: {
|
|
138
|
+
type: "string",
|
|
139
|
+
label: "Submit label"
|
|
140
|
+
},
|
|
141
|
+
codeLength: {
|
|
142
|
+
type: "number",
|
|
143
|
+
default: 6,
|
|
144
|
+
label: "Code length"
|
|
145
|
+
},
|
|
146
|
+
invalidCodeMessage: {
|
|
147
|
+
type: "string",
|
|
148
|
+
label: "Invalid code message"
|
|
149
|
+
},
|
|
150
|
+
blockedMessage: {
|
|
151
|
+
type: "string",
|
|
152
|
+
label: "Blocked message"
|
|
153
|
+
},
|
|
154
|
+
networkErrorMessage: {
|
|
155
|
+
type: "string",
|
|
156
|
+
label: "Network error message"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
guideline: "Code-entry step: composes AccessCodeField and dispatches $actions.session.validateAccessCode with the Root-owned email and authenticationToken; a successful validate flips the session reactively and hides the Root. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md."
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* Data-owning root of the access-code sign-in flow. Self-gates on two signals:
|
|
163
|
+
* `useSession().state !== 'loggedIn'` (available from anonymous through identified; hides once
|
|
164
|
+
* signed in) and `sessionAuthProviders.accessKeyAuthentication === true`. An unresolved fragment
|
|
165
|
+
* read (`$data` still `null`) is treated as "provider not enabled" — the flow stays hidden rather
|
|
166
|
+
* than flashing. Owns the `step`/`authenticationToken` stepper plus a locally-typed draft `email`
|
|
167
|
+
* as local state, broadcasting all of it through context to its children. The draft email pre-fills
|
|
168
|
+
* from `clientProfile.email` once (for an already-identified shopper) but a shopper edit is never
|
|
169
|
+
* persisted anywhere by this family — it is purely the requestAccessCode/validateAccessCode
|
|
170
|
+
* argument; the server sets clientProfileData.email as a side effect of a successful validate.
|
|
171
|
+
* Reacts automatically once `useSession()` flips to `loggedIn` — no manual unmount call anywhere in
|
|
172
|
+
* this family.
|
|
173
|
+
*/
|
|
174
|
+
function AccessCodeSignInRoot({ $data: $dataProp, className, children, ...props }) {
|
|
175
|
+
const $data = useDataOverride($dataProp);
|
|
176
|
+
const { state } = useSession();
|
|
177
|
+
const [step, setStep] = useState("request");
|
|
178
|
+
const [authenticationToken, setAuthenticationToken] = useState(null);
|
|
179
|
+
const startValidation = useCallback((token) => {
|
|
180
|
+
setAuthenticationToken(token);
|
|
181
|
+
setStep("validate");
|
|
182
|
+
}, []);
|
|
183
|
+
const savedEmail = $data?.clientProfile?.email ?? "";
|
|
184
|
+
const [email, setEmailState] = useState("");
|
|
185
|
+
const [touched, setTouched] = useState(false);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (step === "request" && !touched) setEmailState(savedEmail);
|
|
188
|
+
}, [
|
|
189
|
+
savedEmail,
|
|
190
|
+
touched,
|
|
191
|
+
step
|
|
192
|
+
]);
|
|
193
|
+
const setEmail = useCallback((next) => {
|
|
194
|
+
setTouched(true);
|
|
195
|
+
setEmailState(next);
|
|
196
|
+
}, []);
|
|
197
|
+
const providerEnabled = $data?.sessionAuthProviders?.accessKeyAuthentication ?? false;
|
|
198
|
+
const contextValue = useMemo(() => ({
|
|
199
|
+
email,
|
|
200
|
+
setEmail,
|
|
201
|
+
step,
|
|
202
|
+
authenticationToken,
|
|
203
|
+
startValidation
|
|
204
|
+
}), [
|
|
205
|
+
email,
|
|
206
|
+
setEmail,
|
|
207
|
+
step,
|
|
208
|
+
authenticationToken,
|
|
209
|
+
startValidation
|
|
210
|
+
]);
|
|
211
|
+
if (!(state !== "loggedIn" && providerEnabled)) return null;
|
|
212
|
+
return /* @__PURE__ */ jsx(AccessCodeSignInContext, {
|
|
213
|
+
value: contextValue,
|
|
214
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
215
|
+
...props,
|
|
216
|
+
className,
|
|
217
|
+
"data-fs-access-code-sign-in-root": "",
|
|
218
|
+
children
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The draft email input for the access-code flow. Renders only at the request step. Bound to the
|
|
224
|
+
* Root's local `email`/`setEmail` — never a fragment, never a mutation of its own; typing here
|
|
225
|
+
* never touches the cart. Format validation is `EmailField`'s own blur-triggered check (never
|
|
226
|
+
* per-keystroke); `invalidEmailMessage` is only its fallback text, mirroring how
|
|
227
|
+
* `EmailIdentificationControl` defers to the same particle for the same reason.
|
|
228
|
+
*/
|
|
229
|
+
function AccessCodeEmailControl({ label, placeholder, invalidEmailMessage, className, ...props }) {
|
|
230
|
+
const { step, email, setEmail } = useAccessCodeSignIn();
|
|
231
|
+
if (step !== "request") return null;
|
|
232
|
+
return /* @__PURE__ */ jsx("div", {
|
|
233
|
+
...props,
|
|
234
|
+
className,
|
|
235
|
+
"data-fs-access-code-email-control": "",
|
|
236
|
+
children: /* @__PURE__ */ jsx(EmailField, {
|
|
237
|
+
label,
|
|
238
|
+
placeholder,
|
|
239
|
+
value: email,
|
|
240
|
+
onValueChange: setEmail,
|
|
241
|
+
errorMessage: invalidEmailMessage
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Renders only while the Root's stepper is at `step === 'request'`. Reads the draft email from
|
|
247
|
+
* context and dispatches `$actions.session.requestAccessCode({ email })` once it is a valid,
|
|
248
|
+
* non-empty address (no account-existence pre-check beyond that format gate). On a result with a
|
|
249
|
+
* non-null token and no `userErrors`, advances the Root's stepper. Every `userErrors` entry renders
|
|
250
|
+
* inline via a host-supplied, per-code message; the step never changes on error, so the shopper can
|
|
251
|
+
* retry or abandon the method and continue as a guest.
|
|
252
|
+
*/
|
|
253
|
+
function AccessCodeRequestControl({ label, pendingLabel, sendLimitMessage, blockedMessage, networkErrorMessage, onRequested, $actions, className, ...props }) {
|
|
254
|
+
const { step, email, startValidation } = useAccessCodeSignIn();
|
|
255
|
+
const [pending, setPending] = useState(false);
|
|
256
|
+
const [error, setError] = useState(null);
|
|
257
|
+
if (step !== "request") return null;
|
|
258
|
+
const canSubmit = !pending && isValidEmail(email);
|
|
259
|
+
async function handleClick() {
|
|
260
|
+
if (!canSubmit) return;
|
|
261
|
+
setPending(true);
|
|
262
|
+
setError(null);
|
|
263
|
+
try {
|
|
264
|
+
const result = await $actions?.session?.requestAccessCode?.({ email }) ?? {
|
|
265
|
+
authenticationToken: null,
|
|
266
|
+
userErrors: []
|
|
267
|
+
};
|
|
268
|
+
if (result.authenticationToken && result.userErrors.length === 0) {
|
|
269
|
+
startValidation(result.authenticationToken);
|
|
270
|
+
onRequested?.(result.authenticationToken);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const [firstError] = result.userErrors;
|
|
274
|
+
if (firstError) setError(firstError);
|
|
275
|
+
} finally {
|
|
276
|
+
setPending(false);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const message = error ? requestErrorMessage(error, {
|
|
280
|
+
sendLimitMessage,
|
|
281
|
+
blockedMessage,
|
|
282
|
+
networkErrorMessage
|
|
283
|
+
}) : null;
|
|
284
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
285
|
+
...props,
|
|
286
|
+
className,
|
|
287
|
+
"data-fs-access-code-request-control": "",
|
|
288
|
+
...pending ? { "data-fs-access-code-request-pending": "" } : {},
|
|
289
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
290
|
+
type: "button",
|
|
291
|
+
onClick: handleClick,
|
|
292
|
+
disabled: !canSubmit,
|
|
293
|
+
"aria-busy": pending || void 0,
|
|
294
|
+
"data-fs-access-code-request-submit": "",
|
|
295
|
+
"data-fs-button": "",
|
|
296
|
+
children: pending ? pendingLabel ?? label : label
|
|
297
|
+
}), message ? /* @__PURE__ */ jsx("div", {
|
|
298
|
+
role: "alert",
|
|
299
|
+
"data-fs-access-code-request-error": "",
|
|
300
|
+
children: message
|
|
301
|
+
}) : null]
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Renders only while the Root's stepper is at `step === 'validate'`. Composes `AccessCodeField` for
|
|
306
|
+
* the code value and a submit control, disabled below `codeLength` (a UX courtesy, never a
|
|
307
|
+
* validity claim). Dispatches `$actions.session.validateAccessCode` with the email and
|
|
308
|
+
* `authenticationToken` read from context. On a non-empty `userErrors` result, sets the field's
|
|
309
|
+
* `invalid`/`errorMessage` from a host-supplied per-code message and retains the code/token so the
|
|
310
|
+
* shopper can retry without re-requesting. On success it calls the optional `onValidated` and renders
|
|
311
|
+
* no local "success" UI — `useSession()` flipping to `loggedIn` is what makes the whole Root
|
|
312
|
+
* disappear.
|
|
313
|
+
*/
|
|
314
|
+
function AccessCodeValidateControl({ label, placeholder, submitLabel, codeLength = 6, invalidCodeMessage, blockedMessage, missingAuthContextMessage, networkErrorMessage, onValidated, $actions, className, ...props }) {
|
|
315
|
+
const { step, email, authenticationToken } = useAccessCodeSignIn();
|
|
316
|
+
const [code, setCode] = useState("");
|
|
317
|
+
const [pending, setPending] = useState(false);
|
|
318
|
+
const [error, setError] = useState(null);
|
|
319
|
+
if (step !== "validate") return null;
|
|
320
|
+
const canSubmit = !pending && code.length >= codeLength && authenticationToken != null;
|
|
321
|
+
async function handleSubmit(event) {
|
|
322
|
+
event.preventDefault();
|
|
323
|
+
if (!canSubmit || authenticationToken == null) return;
|
|
324
|
+
setPending(true);
|
|
325
|
+
setError(null);
|
|
326
|
+
try {
|
|
327
|
+
const [firstError] = await $actions?.session?.validateAccessCode?.({
|
|
328
|
+
email,
|
|
329
|
+
accessCode: code,
|
|
330
|
+
authenticationToken
|
|
331
|
+
}) ?? [];
|
|
332
|
+
if (firstError) {
|
|
333
|
+
setError(firstError);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
} finally {
|
|
337
|
+
setPending(false);
|
|
338
|
+
}
|
|
339
|
+
onValidated?.();
|
|
340
|
+
}
|
|
341
|
+
function handleCodeChange(next) {
|
|
342
|
+
setCode(next);
|
|
343
|
+
if (error) setError(null);
|
|
344
|
+
}
|
|
345
|
+
const errorMessage = error ? validateErrorMessage(error, {
|
|
346
|
+
invalidCodeMessage,
|
|
347
|
+
blockedMessage,
|
|
348
|
+
missingAuthContextMessage,
|
|
349
|
+
networkErrorMessage
|
|
350
|
+
}) : void 0;
|
|
351
|
+
return /* @__PURE__ */ jsx("div", {
|
|
352
|
+
...props,
|
|
353
|
+
className,
|
|
354
|
+
"data-fs-access-code-validate-control": "",
|
|
355
|
+
...pending ? { "data-fs-access-code-validate-pending": "" } : {},
|
|
356
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
357
|
+
onSubmit: handleSubmit,
|
|
358
|
+
children: [/* @__PURE__ */ jsx(AccessCodeField, {
|
|
359
|
+
label,
|
|
360
|
+
placeholder,
|
|
361
|
+
value: code,
|
|
362
|
+
maxLength: codeLength,
|
|
363
|
+
onValueChange: handleCodeChange,
|
|
364
|
+
disabled: pending,
|
|
365
|
+
invalid: error != null,
|
|
366
|
+
errorMessage
|
|
367
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
368
|
+
type: "submit",
|
|
369
|
+
disabled: !canSubmit,
|
|
370
|
+
"aria-busy": pending || void 0,
|
|
371
|
+
"data-fs-access-code-validate-submit": "",
|
|
372
|
+
"data-fs-button": "",
|
|
373
|
+
children: submitLabel
|
|
374
|
+
})]
|
|
375
|
+
})
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
const AccessCodeSignIn = {
|
|
379
|
+
Root: AccessCodeSignInRoot,
|
|
380
|
+
Email: AccessCodeEmailControl,
|
|
381
|
+
Request: AccessCodeRequestControl,
|
|
382
|
+
Validate: AccessCodeValidateControl
|
|
383
|
+
};
|
|
384
|
+
//#endregion
|
|
385
|
+
export { AccessCodeEmailControl, AccessCodeEmailControlDefinition, AccessCodeRequestControl, AccessCodeRequestControlDefinition, AccessCodeSignIn, AccessCodeSignInRoot, AccessCodeSignInRootDefinition, AccessCodeValidateControl, AccessCodeValidateControlDefinition };
|
|
386
|
+
|
|
387
|
+
//# sourceMappingURL=access-code-sign-in.js.map
|