@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
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
# ShippingAddress
|
|
2
|
+
|
|
3
|
+
**Category:** commerce
|
|
4
|
+
**Purpose:** Country-adaptive single-address delivery form. Batches all address fields and writes them once via `shipping.setAddress`; optionally lets a logged-in shopper pick a saved address instead of typing one.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Visual cues (how to identify in an image)
|
|
9
|
+
|
|
10
|
+
Use these signals to detect that a ShippingAddress block is present. Position on the page is irrelevant for detection — it can appear anywhere, in any orientation. The image is the source of truth for layout.
|
|
11
|
+
|
|
12
|
+
A ShippingAddress block contains any combination of:
|
|
13
|
+
|
|
14
|
+
- A **country dropdown** listing country names (e.g. "Brazil", "United States").
|
|
15
|
+
- An optional **"select a saved address"** button (drawer trigger) — shown only for logged-in shoppers; opens a drawer listing saved addresses to select quickly without typing the full form.
|
|
16
|
+
- A list of **saved-address options** above or alongside the form, each rendered as a radio button or selectable card showing a street + number summary — shown only for logged-in shoppers (in the drawer or inline).
|
|
17
|
+
- Labeled **input fields** for street, number, city, state, and postal code.
|
|
18
|
+
- A **recipient name** field, often showing a pre-filled name as its value.
|
|
19
|
+
- An optional **"Complement"** field (apartment, suite, unit).
|
|
20
|
+
- A **"Neighborhood"** field — present only for Brazil-shaped forms, absent for US-shaped forms.
|
|
21
|
+
- A **"Save address"** (or similar) submit button, possibly showing a "Saving..." pending label.
|
|
22
|
+
- An **error banner** with either a specific validation message (e.g. "Saved address is no longer available") or a generic retry message (e.g. "We couldn't save this address. Please review and retry.").
|
|
23
|
+
|
|
24
|
+
If the image shows **any one** of the above, use `ShippingAddressRoot`. Pick only the sub-components that match what's visible — never include a sub-component for data that isn't shown.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## When to use
|
|
29
|
+
|
|
30
|
+
- The delivery/shipping step of checkout where a shopper enters or confirms a single delivery address for the whole order.
|
|
31
|
+
- Anywhere a shopper needs to choose between a saved address and a manually-entered one before proceeding to delivery-option selection.
|
|
32
|
+
|
|
33
|
+
## When NOT to use
|
|
34
|
+
|
|
35
|
+
- Address autocomplete, postal-code lookup, or search-as-you-type flows — this form is manual entry only; no lookup provider is wired in.
|
|
36
|
+
- Profile management screens (editing a shopper's saved addresses in account settings) — this form is order-scoped; selecting or editing a saved address here never writes back to the saved profile.
|
|
37
|
+
- Per-item / per-line delivery address selection — this component addresses the whole cart with one address, not split shipments.
|
|
38
|
+
- The delivery-options (shipping method) selection step → that is a separate section that extends the same `shipping` action namespace with `selectOption`.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Composition
|
|
43
|
+
|
|
44
|
+
`ShippingAddressRoot` is the only entry point. All Controls, the saved-address list, the submit, and the error banner must be descendants of it.
|
|
45
|
+
|
|
46
|
+
The **summary/form toggle** (`EditController`, `SummaryView`, `EditForm`, `EditButton`) is an optional composable layer that splits the Controls and SelectedSummary into a summary branch and a form branch, letting a shopper review a saved address before deciding to edit it. There is one component per state rather than one component taking a state name, so a page cannot misspell the state it means. See the dedicated section below.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
ShippingAddressRoot
|
|
50
|
+
├── EditController (optional; owns the summary/form state; compose its two panels inside)
|
|
51
|
+
│ ├── SummaryView (optional; renders only while the section shows the summary)
|
|
52
|
+
│ │ ├── SelectedSummary (read-only formatted address)
|
|
53
|
+
│ │ └── EditButton (CTA to open the form)
|
|
54
|
+
│ └── EditForm (optional; renders only while the section shows the form)
|
|
55
|
+
│ ├── [form controls/submit/error]
|
|
56
|
+
│ └── CancelButton (returns to the summary without writing)
|
|
57
|
+
├── CountryControl (selector; lists only countries with a descriptor)
|
|
58
|
+
├── SavedAddressDrawerController (optional; wraps a DrawerRoot for the saved-address selection drawer — US-8)
|
|
59
|
+
│ └── DrawerRoot (generic Drawer particle; composed directly, no wrapper)
|
|
60
|
+
│ ├── DrawerTrigger (button labeled "selecione um endereço salvo", etc.)
|
|
61
|
+
│ └── DrawerPortal
|
|
62
|
+
│ ├── DrawerBackdrop
|
|
63
|
+
│ └── DrawerPopup
|
|
64
|
+
│ ├── DrawerTitle
|
|
65
|
+
│ ├── DrawerClose
|
|
66
|
+
│ ├── SavedList (renders only when savedAddresses is non-empty)
|
|
67
|
+
│ │ └── SavedOption (one per saved address; id required; isCurrent variant marks current address)
|
|
68
|
+
│ ├── Error
|
|
69
|
+
│ └── SavedAddressSubmit (dispatches drawer submit; no-op if reselecting current address — US-8)
|
|
70
|
+
├── RecipientNameControl (required; defaults from ClientProfile)
|
|
71
|
+
├── StreetControl
|
|
72
|
+
├── NumberControl
|
|
73
|
+
├── ComplementControl
|
|
74
|
+
├── NeighborhoodControl (renders only for countries whose descriptor includes it, e.g. Brazil)
|
|
75
|
+
├── CityControl
|
|
76
|
+
├── StateControl
|
|
77
|
+
├── PostalCodeControl
|
|
78
|
+
├── SavedList (optional; renders only when savedAddresses is non-empty)
|
|
79
|
+
│ └── SavedOption (one per saved address; id required)
|
|
80
|
+
├── Submit (dispatches the batched write; exposes pending state)
|
|
81
|
+
├── SelectedSummary (optional; read-only formatted current address; self-gates to null when there is none)
|
|
82
|
+
└── Error (domain userErrors inline, or a generic upstream-error state)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Child order reflects visual order — place Controls in the same sequence they appear in the image. The country descriptor also governs field order (see Common mistakes for what happens when a field is descriptor-less for the active country).
|
|
86
|
+
|
|
87
|
+
**Composition rules:**
|
|
88
|
+
|
|
89
|
+
- Every Control, `SavedList`, `Submit`, `SelectedSummary`, and `Error` must be a descendant of `ShippingAddressRoot` — each throws if rendered outside it.
|
|
90
|
+
- `SavedAddressDrawerController` (optional, US-8) wraps a `DrawerRoot` and must be a descendant of `ShippingAddressRoot`. The drawer trigger and popup (including `SavedList`, `SavedAddressSubmit`, and error/state) are `DrawerRoot` descendants inside `SavedAddressDrawerController`.
|
|
91
|
+
- `SavedOption` must be a descendant of `SavedList` (which itself renders only when `savedAddresses` is non-empty).
|
|
92
|
+
- `SavedAddressSubmit` (US-8) must be a descendant of the `SavedAddressDrawerController`'s `DrawerRoot` (typically inside `DrawerPopup`).
|
|
93
|
+
- `NeighborhoodControl` renders `null` when the active country's descriptor omits it (e.g. United States in v1) — safe to include speculatively, but only place it in the schema if the target country is expected to show it.
|
|
94
|
+
- Only one `ShippingAddressRoot` per section; do not nest a second one inside it.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Components
|
|
99
|
+
|
|
100
|
+
### ShippingAddressRoot
|
|
101
|
+
|
|
102
|
+
Root container. Owns the batched draft state (keyed by canonical field name, not by descriptor), the current country descriptor, saved-address list, submit/error state, and provides context to all descendants. Declares `actions: { shipping: ['setAddress'] }`.
|
|
103
|
+
|
|
104
|
+
| Prop | Type | Default | Notes |
|
|
105
|
+
|------|------|---------|-------|
|
|
106
|
+
| `defaultCountry` | string | `"BRA"` | ISO alpha-3 country code used when no address exists yet |
|
|
107
|
+
|
|
108
|
+
**Data:** declares `fragment ShippingAddressData on Query` (`shipping { address savedAddresses }` + `clientProfile { firstName lastName }`), `fetchStrategy: 'reactive'`. The compiler merges it into the page query — no explicit `dataSources` entry needed.
|
|
109
|
+
|
|
110
|
+
### RecipientNameControl
|
|
111
|
+
|
|
112
|
+
The recipient-name input. The only client-validated field: submit is blocked while it is blank. Defaults from `clientProfile.firstName`/`lastName` (joined) as a real, editable value — not a placeholder hint — whenever the address (current or a selected saved address) has no recipient name yet; degrades to an empty required field when the profile has neither part. No props beyond `className`.
|
|
113
|
+
|
|
114
|
+
### StreetControl / NumberControl / CityControl / StateControl / PostalCodeControl / ComplementControl
|
|
115
|
+
|
|
116
|
+
Thin field Controls; each renders `null` when the active country's descriptor omits that field. No props beyond `className`.
|
|
117
|
+
|
|
118
|
+
### NeighborhoodControl
|
|
119
|
+
|
|
120
|
+
Same shape as the other field Controls. Renders only for countries whose descriptor includes a neighborhood field (Brazil in v1); renders `null` for others (United States in v1). Its draft value is retained (not cleared) when hidden, so it reappears with the same value if the shopper switches back to a country that shows it.
|
|
121
|
+
|
|
122
|
+
### CountryControl
|
|
123
|
+
|
|
124
|
+
Country selector. Lists only countries with an implemented descriptor (Brazil and United States in v1) — a descriptor-less country is unreachable. Switching country preserves the values of fields the two descriptors share (keyed by canonical field name) and only adds/removes country-specific fields. Disabled while a submit is in flight. No props beyond `className`.
|
|
125
|
+
|
|
126
|
+
### SavedList
|
|
127
|
+
|
|
128
|
+
Container for saved-address options. Renders only when `savedAddresses` is non-empty — this is the logged-in signal; anonymous shoppers get an empty list and the container renders nothing. No props beyond `className`.
|
|
129
|
+
|
|
130
|
+
### SavedOption
|
|
131
|
+
|
|
132
|
+
A single selectable saved address. Selecting it populates the batched draft (still editable before submit) and retains its ID through submit so VTEX maintains the saved-address reference for this order.
|
|
133
|
+
|
|
134
|
+
Renders the saved address using the same formatted display as `SelectedSummary` — both compose the `AddressSummary` particle (recipient, street/number/complement, neighborhood/city/state/postal code) via its own `AddressSummaryRoot` context provider, so they share one formatting implementation without code duplication. Falls back to a generic "Endereço {id}" label only when the saved record has no recognizable content (no recipient name, street, city, or neighborhood).
|
|
135
|
+
|
|
136
|
+
Includes an `isCurrent` state: when the saved address's ID matches `currentAddressId` (the current cart address), it renders the `data-fs-shipping-address-saved-option-current` attribute, signaling that this is the already-selected delivery address. The component renders no default visual styling for this state itself — it's a pure styling hook, left to the merchant/page to style (or not) via that attribute.
|
|
137
|
+
|
|
138
|
+
| Prop | Type | Default | Notes |
|
|
139
|
+
|------|------|---------|-------|
|
|
140
|
+
| `id` | string | — | Required. The saved address's ID; must match an entry in `savedAddresses` |
|
|
141
|
+
|
|
142
|
+
### SavedAddressDrawerController
|
|
143
|
+
|
|
144
|
+
Wraps a single `DrawerRoot` child (the saved-address selection drawer) and makes it controlled by a dedicated drawer-flow context, kept separate from the main `ShippingAddressContext` that every field Control reads (so the Root's data/actions context stays unaware of this one downstream UI surface). Open state and blocked dismissal while submitting are handled here. Do not set raw `open` or `onOpenChange` on the wrapped `DrawerRoot` — pass them through `SavedAddressDrawerController` instead (the same pattern as `CartOpenOnAdd` in the mini-cart).
|
|
145
|
+
|
|
146
|
+
Blocks drawer dismissal (Escape, backdrop click, close button) while a drawer submit is in flight (`drawerSubmitting` is true) to prevent accidental loss of an in-flight submission.
|
|
147
|
+
|
|
148
|
+
| Prop | Type | Default | Notes |
|
|
149
|
+
|------|------|---------|-------|
|
|
150
|
+
| `children` | ReactNode | — | Required. A single `DrawerRoot` element; other elements are passed through unchanged. |
|
|
151
|
+
|
|
152
|
+
**Composition rules:**
|
|
153
|
+
|
|
154
|
+
- Must be a descendant of `ShippingAddressRoot`.
|
|
155
|
+
- Must be the parent of `DrawerRoot` (the drawer trigger and popup are `DrawerRoot` descendants).
|
|
156
|
+
- The wrapped `DrawerRoot` must have `DrawerTrigger`, `DrawerPortal`, `DrawerBackdrop`, `DrawerPopup`, `DrawerTitle`, and `DrawerClose` descendants inside it, using the standard `Drawer` particle architecture.
|
|
157
|
+
|
|
158
|
+
### SavedAddressSubmit
|
|
159
|
+
|
|
160
|
+
The drawer's "selecionar" (select) submit button; independent submitting state from the main form's `Submit` button (Decision 7 in the spec). Dispatches the drawer submit via `handleDrawerSubmit`.
|
|
161
|
+
|
|
162
|
+
**Special behavior (Decision 8 in the spec):** when a saved address is selected and submitted, if it is already the current cart address (its ID matches `currentAddressId`), the drawer closes silently with no action — reselecting the current address is a no-op.
|
|
163
|
+
|
|
164
|
+
**Special behavior (Decision 9 in the spec):** when the selected saved address has a blank `recipientName`, no mutation is dispatched either — the drawer closes and the main form (already populated with that address's fields, since selecting a saved option always seeds the draft) is left for the shopper to add the missing name and submit themselves, rather than auto-submitting into a guaranteed `MISSING_RECIPIENT_NAME` rejection.
|
|
165
|
+
|
|
166
|
+
| Prop | Type | Default | Notes |
|
|
167
|
+
|------|------|---------|-------|
|
|
168
|
+
| `label` | string | `"selecionar"` | Button label shown when not submitting |
|
|
169
|
+
| `pendingLabel` | string | `"selecionando..."` | Button label shown while the drawer submit is in flight |
|
|
170
|
+
|
|
171
|
+
### Submit
|
|
172
|
+
|
|
173
|
+
Dispatches the batched write through `shipping.setAddress` exactly once per click, including when the shopper changed nothing: the component cannot tell whether the stored address would be accepted, so it lets the server decide rather than deciding on its behalf. Disabled while the recipient name is blank or a submit is already in flight; shows a pending label/attribute while in flight, and re-enables once the write resolves.
|
|
174
|
+
|
|
175
|
+
| Prop | Type | Default | Notes |
|
|
176
|
+
|------|------|---------|-------|
|
|
177
|
+
| `label` | string | `"salvar endereço"` | Button label shown when not submitting |
|
|
178
|
+
| `pendingLabel` | string | `"salvando..."` | Button label shown while the submit is in flight |
|
|
179
|
+
|
|
180
|
+
### SelectedSummary
|
|
181
|
+
|
|
182
|
+
Provides the current delivery address to the generic `AddressSummary` particle via `AddressSummaryRoot` context, and renders it by default. Self-gates to `null` when there is none yet (e.g. a first-time order with an empty `Shipping.address`), rather than an empty provider.
|
|
183
|
+
|
|
184
|
+
The `AddressSummary` particle it composes displays the address in read-only format (recipient name, street/number/complement, neighborhood/city/state/postal code). `SavedOption` uses the same `AddressSummary` particle (with its own `AddressSummaryRoot`) so both the "current address" display and each saved-address option in the list/drawer share one formatting implementation without duplication.
|
|
185
|
+
|
|
186
|
+
A future alternative presentation component (e.g., `LeanAddressSummary`) could read the same `AddressSummaryRoot` context and be composed as a child, without any change to this component — exemplifying the Free Particle Model.
|
|
187
|
+
|
|
188
|
+
| Prop | Type | Default | Notes |
|
|
189
|
+
|------|------|---------|-------|
|
|
190
|
+
| `className` | string | — | Optional CSS classes applied to the `AddressSummary` container, whether the lines are the default ones or composed |
|
|
191
|
+
| `children` | ReactNode | — | Optional line composition, rendered *inside* the `AddressSummary` container in place of its default lines. Must be a descendant of the provided `AddressSummaryRoot` context. |
|
|
192
|
+
|
|
193
|
+
### EditController
|
|
194
|
+
|
|
195
|
+
Optional composable component that owns the summary/form toggle. Opens on the summary when a current address exists, on the form otherwise. When a successful `setAddress` completes (via the main form's `Submit` or the drawer's `SavedAddressSubmit`), it returns to the summary on its own without either submit component needing to know this section collapses around it (mirrors the `cartLastAddVar` pulse-signal pattern in the mini-cart). Everything it does it decides from its own data and the shopper's own presses; it reports to nothing, so finishing it opens no other section, and no other section opens it.
|
|
196
|
+
|
|
197
|
+
Once a shopper explicitly opens the form (via `EditButton`), the explicit choice takes over until either a successful submit or a press of `CancelButton` returns the section to the summary. Does not render any DOM itself; wraps children and provides the `shipping-address-section` context to descendant `SummaryView`, `EditForm`, `EditButton` and `CancelButton` components.
|
|
198
|
+
|
|
199
|
+
| Prop | Type | Default | Notes |
|
|
200
|
+
|------|------|---------|-------|
|
|
201
|
+
| `children` | ReactNode | — | Required. Typically holds a `SummaryView` and an `EditForm`. |
|
|
202
|
+
|
|
203
|
+
**Composition rules:**
|
|
204
|
+
- Must be a descendant of `ShippingAddressRoot`.
|
|
205
|
+
- Typically wraps the whole delivery-address section (all form Controls, Submit, Error, SelectedSummary) so all of it can be split between the two panels.
|
|
206
|
+
- Compose `SummaryView` and `EditForm` children to place the parts that belong to each state.
|
|
207
|
+
|
|
208
|
+
### SummaryView / EditForm
|
|
209
|
+
|
|
210
|
+
The section's two panels. `SummaryView` renders its children only while the section shows the saved-address summary; `EditForm` only while it shows the editable form. Neither takes a state prop — which state it gates is which component it is, so a page cannot name a state that has no branch and blank the section.
|
|
211
|
+
|
|
212
|
+
| Prop | Type | Default | Notes |
|
|
213
|
+
|------|------|---------|-------|
|
|
214
|
+
| `children` | ReactNode | — | Rendered only while the section is in this component's state. |
|
|
215
|
+
|
|
216
|
+
**Composition rules:**
|
|
217
|
+
- Both must be descendants of `EditController`.
|
|
218
|
+
- Typically, `SummaryView` holds `SelectedSummary` + `EditButton` (read-only branch) and `EditForm` holds the form Controls, Submit, Error, and `CancelButton`.
|
|
219
|
+
|
|
220
|
+
### EditButton
|
|
221
|
+
|
|
222
|
+
CTA that opens the form. Has no knowledge of why the section might currently be on the summary (a current address exists, or a just-completed submit returned to it) — it only writes the state forward. Usually placed inside a `SummaryView`, next to `SelectedSummary`.
|
|
223
|
+
|
|
224
|
+
| Prop | Type | Default | Notes |
|
|
225
|
+
|------|------|---------|-------|
|
|
226
|
+
| `label` | string | `"editar"` | Button label shown when no children are composed |
|
|
227
|
+
|
|
228
|
+
### CancelButton
|
|
229
|
+
|
|
230
|
+
Returns the section to its summary without writing. Compose it inside the `EditForm` whenever the
|
|
231
|
+
`EditButton` is reachable: a shopper who opens the form otherwise has no way back except a successful
|
|
232
|
+
`setAddress`, and blanking the recipient name disables Submit, which strands them on a form covering the
|
|
233
|
+
summary they came from.
|
|
234
|
+
|
|
235
|
+
| Prop | Type | Default | Notes |
|
|
236
|
+
|------|------|---------|-------|
|
|
237
|
+
| `label` | string | `"cancelar"` | Button label shown when no children are composed |
|
|
238
|
+
| `children` | ReactNode | — | Custom content, e.g. an `Icon` plus text; falls back to `label` |
|
|
239
|
+
| `className` | string | — | Optional CSS classes |
|
|
240
|
+
|
|
241
|
+
**Composition rules:**
|
|
242
|
+
- Must be a descendant of `EditController`.
|
|
243
|
+
- Compose it inside the `EditForm`. Inside a `SummaryView` it renders only while the form is closed,
|
|
244
|
+
which is precisely when there is nothing to cancel.
|
|
245
|
+
|
|
246
|
+
### Error
|
|
247
|
+
|
|
248
|
+
Renders domain `userErrors` returned by `setAddress` (e.g. `MISSING_RECIPIENT_NAME`, `INVALID_SAVED_ADDRESS_ID`) as an inline list, or a single generic message when the mutation throws (surfaced as a synthetic upstream/network error). Form values are retained in either case. No props beyond `className`.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Canonical schema example
|
|
253
|
+
|
|
254
|
+
A full delivery-address step with saved addresses, all field Controls, and the error/submit pair:
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"shipping-address": {
|
|
259
|
+
"type": "ShippingAddressRoot",
|
|
260
|
+
"props": { "defaultCountry": "BRA" },
|
|
261
|
+
"children": [
|
|
262
|
+
"shipping-address-saved-list",
|
|
263
|
+
"shipping-address-country",
|
|
264
|
+
"shipping-address-recipient",
|
|
265
|
+
"shipping-address-street",
|
|
266
|
+
"shipping-address-number",
|
|
267
|
+
"shipping-address-complement",
|
|
268
|
+
"shipping-address-neighborhood",
|
|
269
|
+
"shipping-address-city",
|
|
270
|
+
"shipping-address-state",
|
|
271
|
+
"shipping-address-postal-code",
|
|
272
|
+
"shipping-address-error",
|
|
273
|
+
"shipping-address-submit"
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"shipping-address-saved-list": {
|
|
277
|
+
"type": "ShippingAddressSavedList",
|
|
278
|
+
"children": ["shipping-address-saved-option"]
|
|
279
|
+
},
|
|
280
|
+
"shipping-address-saved-option": {
|
|
281
|
+
"type": "ShippingAddressSavedOption",
|
|
282
|
+
"props": { "id": "addr-1" }
|
|
283
|
+
},
|
|
284
|
+
"shipping-address-country": { "type": "ShippingAddressCountryControl" },
|
|
285
|
+
"shipping-address-recipient": { "type": "ShippingAddressRecipientNameControl" },
|
|
286
|
+
"shipping-address-street": { "type": "ShippingAddressStreetControl" },
|
|
287
|
+
"shipping-address-number": { "type": "ShippingAddressNumberControl" },
|
|
288
|
+
"shipping-address-complement": { "type": "ShippingAddressComplementControl" },
|
|
289
|
+
"shipping-address-neighborhood": { "type": "ShippingAddressNeighborhoodControl" },
|
|
290
|
+
"shipping-address-city": { "type": "ShippingAddressCityControl" },
|
|
291
|
+
"shipping-address-state": { "type": "ShippingAddressStateControl" },
|
|
292
|
+
"shipping-address-postal-code": { "type": "ShippingAddressPostalCodeControl" },
|
|
293
|
+
"shipping-address-error": { "type": "ShippingAddressError" },
|
|
294
|
+
"shipping-address-submit": {
|
|
295
|
+
"type": "ShippingAddressSubmit",
|
|
296
|
+
"props": { "label": "Save address" }
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Minimal variant (manual entry only, no saved addresses visible)
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"shipping-address": {
|
|
306
|
+
"type": "ShippingAddressRoot",
|
|
307
|
+
"children": [
|
|
308
|
+
"shipping-address-recipient",
|
|
309
|
+
"shipping-address-street",
|
|
310
|
+
"shipping-address-postal-code",
|
|
311
|
+
"shipping-address-submit"
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
"shipping-address-recipient": { "type": "ShippingAddressRecipientNameControl" },
|
|
315
|
+
"shipping-address-street": { "type": "ShippingAddressStreetControl" },
|
|
316
|
+
"shipping-address-postal-code": { "type": "ShippingAddressPostalCodeControl" },
|
|
317
|
+
"shipping-address-submit": { "type": "ShippingAddressSubmit" }
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Common mistakes
|
|
324
|
+
|
|
325
|
+
- **Inventing `ShippingAddressSaveOption`.** The correct name is `ShippingAddressSavedOption`.
|
|
326
|
+
- **Inventing `ShippingAddressForm`.** There is no separate `Form` sub-component — `ShippingAddressRoot` is the form container.
|
|
327
|
+
- **Putting `SavedOption` directly under `ShippingAddressRoot`.** It must be inside `SavedList`, which itself only renders when `savedAddresses` is non-empty.
|
|
328
|
+
- **Including `NeighborhoodControl` for a form that only ever shows US fields.** It renders `null` for countries without a neighborhood field, but including it still signals wrong intent when the image never shows it.
|
|
329
|
+
- **Assuming this form writes back to the shopper's saved-address book.** It never does — edits, including edits to a selected saved address, apply to this order only.
|
|
330
|
+
- **Using this component for address autocomplete or postal-code-only entry.** No lookup provider is wired in; all fields are manual, and field-format validation is deferred to the backend.
|
|
331
|
+
- **Placing field Controls outside `ShippingAddressRoot`.** Every Control throws if rendered without an ancestor `ShippingAddressRoot`.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Styling
|
|
336
|
+
|
|
337
|
+
Style `ShippingAddressRoot` as a vertical form stack; field Controls each pair a label above an input. Saved-address options read as a short selectable list above the manual-entry fields.
|
|
338
|
+
|
|
339
|
+
| Component | What you style | Plausible classes |
|
|
340
|
+
|---|---|---|
|
|
341
|
+
| `ShippingAddressRoot` | Stacks the whole form vertically | `flex flex-col gap-[16px] w-full` |
|
|
342
|
+
| Field Controls (`RecipientNameControl`, `StreetControl`, `NumberControl`, `CityControl`, `StateControl`, `PostalCodeControl`, `ComplementControl`, `NeighborhoodControl`, `CountryControl`) | Label-above-input field wrapper | `flex flex-col gap-[6px]` |
|
|
343
|
+
| `ShippingAddressSavedList` | Stacks saved-address options with spacing between them | `flex flex-col gap-[8px] mb-[16px]` |
|
|
344
|
+
| `ShippingAddressSavedOption` | A single selectable row: radio + summary label | `flex items-center gap-[8px] rounded-[6px] border border-[#E2E2E2] p-[12px]` |
|
|
345
|
+
| `ShippingAddressSubmit` | The primary call-to-action button | `px-[16px] py-[10px] bg-[#1D4ED8] text-white font-semibold rounded-[6px] disabled:opacity-50` |
|
|
346
|
+
| `ShippingAddressError` | Inline error/alert banner | `rounded-[6px] border border-[#FCA5A5] bg-[#FEF2F2] p-[12px] text-[13px] text-[#991B1B]` |
|
|
347
|
+
|
|
348
|
+
Styled minimal example (recipient name + street + submit):
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"shipping-address": {
|
|
353
|
+
"type": "ShippingAddressRoot",
|
|
354
|
+
"children": ["shipping-address-recipient", "shipping-address-street", "shipping-address-submit"],
|
|
355
|
+
"style": ["flex", "flex-col", "gap-[16px]", "w-full"]
|
|
356
|
+
},
|
|
357
|
+
"shipping-address-recipient": {
|
|
358
|
+
"type": "ShippingAddressRecipientNameControl",
|
|
359
|
+
"style": ["flex", "flex-col", "gap-[6px]"]
|
|
360
|
+
},
|
|
361
|
+
"shipping-address-street": {
|
|
362
|
+
"type": "ShippingAddressStreetControl",
|
|
363
|
+
"style": ["flex", "flex-col", "gap-[6px]"]
|
|
364
|
+
},
|
|
365
|
+
"shipping-address-submit": {
|
|
366
|
+
"type": "ShippingAddressSubmit",
|
|
367
|
+
"props": { "label": "Save address" },
|
|
368
|
+
"style": ["px-[16px]", "py-[10px]", "bg-[#1D4ED8]", "text-white", "font-semibold", "rounded-[6px]"]
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Known gaps
|
|
376
|
+
|
|
377
|
+
Found by review and deliberately left for the dedicated revision of these components, rather than patched
|
|
378
|
+
here. Read this before assuming a behaviour is intentional.
|
|
379
|
+
|
|
380
|
+
- **The controller and the summary disagree about what "has an address" means.** `EditController` derives its
|
|
381
|
+
initial mode from `address.id` alone, while `SelectedSummary` gates on the formatted address object. An
|
|
382
|
+
address carrying an `id` but almost no content — the shape a postcode-only shipping simulation returns —
|
|
383
|
+
therefore opens on the summary and renders a near-empty one, with no form and no way to complete it. The
|
|
384
|
+
inverse also fails: an address object with `id: null` holds the section in `edit` forever, so a successful
|
|
385
|
+
save never collapses it.
|
|
386
|
+
|
|
387
|
+
## Related
|
|
388
|
+
|
|
389
|
+
- [[client-profile-form]] — collects identity fields (first name, phone, email) that feed the recipient-name default here. Distinct block; do not nest.
|
|
390
|
+
- [[shipping-simulator]] — a separate delivery-estimate/rate lookup surface keyed by postal code, used before an address is saved. `ShippingAddress` persists the full address for the order; `ShippingSimulator` only estimates rates for a candidate postal code.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# ShippingSimulator
|
|
2
|
+
|
|
3
|
+
**Category:** commerce
|
|
4
|
+
**Purpose:** A postal-code (CEP) driven shipping calculator. The shopper types a destination and sees the available shipping options — name, delivery estimate, and price — for either **one product** (on a PDP) or the **whole cart** (in a cart/mini-cart). Two Roots back the same presentational leaves: `ShippingSimulatorRoot` (per-product, PDP) and `CartShippingSimulatorRoot` (whole-cart). Every leaf below the Root is shared and reads from the same context, so the two Roots differ only in what they query.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Visual cues (how to identify in an image)
|
|
9
|
+
|
|
10
|
+
Look for a **CEP / postal-code input with a "Calculate" button**, and — after submitting — a short list of shipping options each showing a carrier name, an ETA, and a price. Examples:
|
|
11
|
+
|
|
12
|
+
- On a **product page**, below the price / buy button: a "Calcule o frete" block with a CEP field and a list of delivery options for that product.
|
|
13
|
+
- In a **mini-cart drawer footer**, between the coupon block and the order summary: a CEP field that returns the delivery options for the whole cart, each with a summed price.
|
|
14
|
+
- A "no delivery available" message when a submitted CEP returns no options.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
There are two contexts, one Root each. Pick by what the calculator ships.
|
|
21
|
+
|
|
22
|
+
### 1. Product shipping preview on a PDP — `ShippingSimulatorRoot`
|
|
23
|
+
|
|
24
|
+
Use on a **product detail page** to preview how *one product* ships to a CEP. `ShippingSimulatorRoot` carries a product fragment (`productBySlug(slug: $slug)`) and `fetchStrategy: 'reactive'`, resolves the variant + seller from that fragment, and submits a per-variant `shippingSimulation`. It therefore requires a page with a `$slug` variable (a PDP). Compose it as `ShippingSimulatorRoot > Form > … > Options > Option > …`.
|
|
25
|
+
|
|
26
|
+
### 2. Whole-cart shipping calculator in the cart/mini-cart — `CartShippingSimulatorRoot`
|
|
27
|
+
|
|
28
|
+
Use in a **cart or mini-cart drawer footer** to calculate shipping for the *whole cart*. `CartShippingSimulatorRoot` has **no fragment** and **no `fetchStrategy`**: it selects nothing on `Query`, takes only a destination, and submits `cartShippingSimulation({ postalCode, country })`. The cart's items are sourced server-side from the `x-order-form-id` context, so the Root needs **no `CartRoot` ancestor** and no product context — it composes in any layout. The API returns the options common to every item with prices summed across items. Compose it as `CartShippingSimulatorRoot > Form > … > Options > Option > … > Empty`; the sub-components are the same shared leaves, re-exported under the `CartShippingSimulator` namespace.
|
|
29
|
+
|
|
30
|
+
## When NOT to use
|
|
31
|
+
|
|
32
|
+
- `ShippingSimulatorRoot` in a cart/mini-cart layout — there is no `$slug`, so its fragment cannot compose. Use `CartShippingSimulatorRoot`.
|
|
33
|
+
- `CartShippingSimulatorRoot` on a PDP to answer "how does *this product* ship?" — it ships the whole cart, not the viewed product. Use `ShippingSimulatorRoot`.
|
|
34
|
+
- Do not wrap `CartShippingSimulatorRoot` in a `CartRoot` to "provide the cart" — cart identity travels in the transport header, not through React context.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## The Empty sub-component and the idle-vs-empty distinction
|
|
39
|
+
|
|
40
|
+
`ShippingSimulatorEmpty` is a shared, self-hiding leaf that shows a friendly message when a simulation ran and returned **no** shipping options (for a cart, this is the "no carrier common to all items" case). It is available in both namespaces.
|
|
41
|
+
|
|
42
|
+
The context distinguishes three states via `shippingOptions`:
|
|
43
|
+
|
|
44
|
+
- **`null`** — idle (before the first submit) or loading. `Options`, `Empty`, and `Error` all render nothing.
|
|
45
|
+
- **`[]`** — a simulation ran and returned an empty list. `Empty` renders its message; `Options` renders nothing.
|
|
46
|
+
- **`[...]`** — options available. `Options` renders one `Option` per row; `Empty` renders nothing.
|
|
47
|
+
|
|
48
|
+
`ShippingSimulatorError` shows the first `userError`'s message. A transport failure has no upstream message, so the component supplies `fs/shipping.calculation-failed` from the catalog — built in the `.catch()` handler, where only a string fits.
|
|
49
|
+
|
|
50
|
+
`Empty` renders **only** for `[]` with no `userErrors` — so it never flashes on first paint, and an error path defers to `ShippingSimulatorError`. Its copy comes from the message catalog (`fs/shipping.no-options`), per locale, and `children` overrides it. It renders a polite live region (an `<output aria-live="polite">`, matching `Loading`), so it is announced when it appears.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Composition
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
CartShippingSimulatorRoot ← whole-cart calculator (no fragment, no CartRoot needed)
|
|
58
|
+
├── ShippingSimulatorForm ← wraps input + submit
|
|
59
|
+
│ ├── ShippingSimulatorInput props: format (auto-hyphenate CEP)
|
|
60
|
+
│ └── ShippingSimulatorSubmit children: "Calcular"
|
|
61
|
+
├── ShippingSimulatorLoading ← shows while a simulation is pending (`fs/shipping.calculating`)
|
|
62
|
+
├── ShippingSimulatorError ← shows a validation/transport error
|
|
63
|
+
├── ShippingSimulatorOptions ← renders one Option per available option
|
|
64
|
+
│ │ props: sortBy ("price" | "estimate"), maxOptions
|
|
65
|
+
│ └── ShippingSimulatorOption
|
|
66
|
+
│ ├── ShippingSimulatorOptionName
|
|
67
|
+
│ ├── ShippingSimulatorOptionEstimate ← one whole sentence per unit, from the catalog
|
|
68
|
+
│ └── ShippingSimulatorOptionPrice ← "Grátis" from the catalog when the amount is 0
|
|
69
|
+
└── ShippingSimulatorEmpty ← shows only when a simulation returned []
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The PDP composition is identical, with `ShippingSimulatorRoot` in place of `CartShippingSimulatorRoot` (and no need for `Empty`, though it may be added there too).
|
|
73
|
+
|
|
74
|
+
### Key components
|
|
75
|
+
|
|
76
|
+
| Component | Props | Notes |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `ShippingSimulatorRoot` | `country`, `quantity` | PDP Root; carries a product fragment + `fetchStrategy: 'reactive'`; needs a `$slug` page |
|
|
79
|
+
| `CartShippingSimulatorRoot` | `country` | Cart Root; no fragment, no `fetchStrategy`, no `CartRoot` ancestor; submits `{ postalCode, country }` only |
|
|
80
|
+
| `ShippingSimulatorInput` | `format` | `format` auto-hyphenates the CEP (01310-100). The placeholder and the default `aria-label` come from the message catalog (`fs/shipping.postal-code.*`); `aria-label` stays a DOM pass-through, so a store can still set its own |
|
|
81
|
+
| `ShippingSimulatorOptions` | `sortBy`, `maxOptions` | Both optional; omitted = every option in API order. `sortBy="price"` orders cheapest first, `"estimate"` fastest first (business days weigh as calendar days); `maxOptions` caps the rendered rows — `sortBy="price"` + `maxOptions=1` shows only the cheapest option. Works identically under either Root |
|
|
82
|
+
| `ShippingSimulatorOptionEstimate` | — | One whole sentence per unit (`fs/shipping.estimate.in-*`), so the plural agrees with the locale; a zero value reads `fs/shipping.estimate.today` |
|
|
83
|
+
| `ShippingSimulatorOptionPrice` | — | Renders `fs/shipping.free-price` when the amount is 0; otherwise formats via `Intl` from the active storefront context |
|
|
84
|
+
| `ShippingSimulatorEmpty` | — | Renders only for a simulated-empty result (`fs/shipping.no-options`); `children` overrides it |
|
|
85
|
+
|
|
86
|
+
Prices format from the **active storefront context's currency** (not the payload `currencyCode`); the binding's currency must match the payload currency.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Schema
|
|
91
|
+
|
|
92
|
+
### Mini-cart drawer footer (whole-cart, `cart-filled` only)
|
|
93
|
+
|
|
94
|
+
Place the calculator inside `cart-filled` (an empty cart has nothing to ship), between the coupon block and the order summary.
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"cart-shipping": {
|
|
99
|
+
"type": "CartShippingSimulatorRoot",
|
|
100
|
+
"props": { "country": "BRA" },
|
|
101
|
+
"children": [
|
|
102
|
+
"cart-shipping-form",
|
|
103
|
+
"cart-shipping-loading",
|
|
104
|
+
"cart-shipping-error",
|
|
105
|
+
"cart-shipping-options",
|
|
106
|
+
"cart-shipping-empty"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"cart-shipping-form": {
|
|
110
|
+
"type": "ShippingSimulatorForm",
|
|
111
|
+
"children": ["cart-shipping-input", "cart-shipping-submit"]
|
|
112
|
+
},
|
|
113
|
+
"cart-shipping-input": {
|
|
114
|
+
"type": "ShippingSimulatorInput",
|
|
115
|
+
"props": { "format": true }
|
|
116
|
+
},
|
|
117
|
+
"cart-shipping-submit": { "type": "ShippingSimulatorSubmit", "props": { "children": "Calcular" } },
|
|
118
|
+
"cart-shipping-loading": { "type": "ShippingSimulatorLoading" },
|
|
119
|
+
"cart-shipping-error": { "type": "ShippingSimulatorError" },
|
|
120
|
+
"cart-shipping-options": {
|
|
121
|
+
"type": "ShippingSimulatorOptions",
|
|
122
|
+
"children": ["cart-shipping-option"]
|
|
123
|
+
},
|
|
124
|
+
"cart-shipping-option": {
|
|
125
|
+
"type": "ShippingSimulatorOption",
|
|
126
|
+
"children": ["cart-shipping-option-name", "cart-shipping-option-estimate", "cart-shipping-option-price"]
|
|
127
|
+
},
|
|
128
|
+
"cart-shipping-option-name": { "type": "ShippingSimulatorOptionName" },
|
|
129
|
+
"cart-shipping-option-estimate": { "type": "ShippingSimulatorOptionEstimate" },
|
|
130
|
+
"cart-shipping-option-price": { "type": "ShippingSimulatorOptionPrice" },
|
|
131
|
+
"cart-shipping-empty": { "type": "ShippingSimulatorEmpty" }
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Product page preview (single product)
|
|
136
|
+
|
|
137
|
+
Identical shape, with `ShippingSimulatorRoot` as the Root and `quantity` available as a prop. It lives on a PDP where a `$slug` variable resolves the product fragment.
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"pdp-shipping": {
|
|
142
|
+
"type": "ShippingSimulatorRoot",
|
|
143
|
+
"props": { "country": "BRA", "quantity": 1 },
|
|
144
|
+
"children": ["pdp-shipping-form", "pdp-shipping-loading", "pdp-shipping-error", "pdp-shipping-options"]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|