@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,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { graphql } from "../../sdk/generated/gql.js";
|
|
5
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/matter/cart-item-seller-info/cart-item-seller-info.tsx
|
|
8
|
+
const cartItemSellerInfoFragment = graphql(`
|
|
9
|
+
fragment CartItemSellerInfoData on Query {
|
|
10
|
+
cart {
|
|
11
|
+
items {
|
|
12
|
+
__typename
|
|
13
|
+
id
|
|
14
|
+
variant {
|
|
15
|
+
__typename
|
|
16
|
+
variantId
|
|
17
|
+
seller {
|
|
18
|
+
sellerId
|
|
19
|
+
name
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`);
|
|
26
|
+
const CartItemSellerInfoDefinition = defineComponent({
|
|
27
|
+
name: "CartItemSellerInfo",
|
|
28
|
+
importPath: "@vtex/faststore/components",
|
|
29
|
+
component: CartItemSellerInfo,
|
|
30
|
+
fragment: cartItemSellerInfoFragment,
|
|
31
|
+
fetchStrategy: "reactive-list-item",
|
|
32
|
+
requiresContext: "cart-item",
|
|
33
|
+
editor: {
|
|
34
|
+
label: "Cart Item Seller Info",
|
|
35
|
+
category: "commerce"
|
|
36
|
+
},
|
|
37
|
+
schema: {},
|
|
38
|
+
guideline: "Renders the marketplace seller name for a cart line; renders null when the line has no seller. Optional per-item data owned by its own fragment (ADR-0011). Must be inside CartList."
|
|
39
|
+
});
|
|
40
|
+
function CartItemSellerInfo({ className, children, $data: $dataProp, ...props }) {
|
|
41
|
+
const sellerName = useDataOverride($dataProp)?.variant?.seller?.name;
|
|
42
|
+
if (!sellerName) return null;
|
|
43
|
+
return /* @__PURE__ */ jsx("span", {
|
|
44
|
+
...props,
|
|
45
|
+
className,
|
|
46
|
+
"data-fs-cart-item-seller-info": "",
|
|
47
|
+
"data-fs-text": "",
|
|
48
|
+
children: children ?? sellerName
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { CartItemSellerInfo, CartItemSellerInfoDefinition };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=cart-item-seller-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-item-seller-info.js","names":[],"sources":["../../../src/matter/cart-item-seller-info/cart-item-seller-info.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { graphql } from '../../sdk/generated/gql.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — typed via @graphql-codegen client-preset (T7)\n// ---------------------------------------------------------------------------\n\n// ADR-0011: CartItemSellerInfo is a per-item sub-matter that OWNS its (optional) seller data.\n// Decomposed out of the monolithic CartItemFragment, the seller subtree is fetched only on pages\n// that place this matter — over-fetch elimination by data ownership. The author writes one uniform\n// `on Query` fragment drilling the list; the compiler re-roots it to\n// `CartItemSellerInfoData_CartItem on CartItem`. Fields are inlined (no `...` spread) so the derived\n// per-item fragment is self-contained for `useFragment`.\nconst cartItemSellerInfoFragment = graphql(`\n fragment CartItemSellerInfoData on Query {\n cart {\n items {\n __typename\n id\n variant {\n __typename\n variantId\n seller {\n sellerId\n name\n }\n }\n }\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * Per-line slice delivered by the `reactive-list-item` runtime: the value the wrapper publishes\n * through `DataOverrideContext`, read via `useDataOverride`. Only the fields the component renders\n * are typed; the resolved cache slice carries the full fragment selection.\n */\nexport type CartItemSellerInfoSlice = {\n variant: { seller: { name: string } | null } | null;\n};\n\nexport type CartItemSellerInfoProps = ComponentPropsWithRef<'span'> & {\n /** Per-item slice from the reactive-list-item runtime; injected/overridden by the wrapper. */\n $data?: CartItemSellerInfoSlice | null;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const CartItemSellerInfoDefinition = defineComponent<CartItemSellerInfoProps>({\n name: 'CartItemSellerInfo',\n importPath: '@vtex/faststore/components',\n component: CartItemSellerInfo,\n fragment: cartItemSellerInfoFragment,\n fetchStrategy: 'reactive-list-item',\n // requiresContext pairs with CartList (provides 'cart-item') so the context-constraints walk\n // rejects placing this matter outside its iterator.\n requiresContext: 'cart-item',\n editor: { label: 'Cart Item Seller Info', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders the marketplace seller name for a cart line; renders null when the line has no seller. Optional per-item data owned by its own fragment (ADR-0011). Must be inside CartList.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function CartItemSellerInfo({ className, children, $data: $dataProp, ...props }: CartItemSellerInfoProps) {\n // Delivery-agnostic: the slice arrives through the DataOverrideContext seam the reactive-list-item\n // wrapper publishes (or via $data in tests); the component calls no data hook.\n const slice = useDataOverride<CartItemSellerInfoSlice | null | undefined>($dataProp);\n const sellerName = slice?.variant?.seller?.name;\n\n if (!sellerName) {\n return null;\n }\n\n return (\n <span {...props} className={className} data-fs-cart-item-seller-info=\"\" data-fs-text=\"\">\n {children ?? sellerName}\n </span>\n );\n}\n"],"mappings":";;;;;;;AAiBA,MAAM,6BAA6B,QAAQ;;;;;;;;;;;;;;;;;CAiB1C;AAwBD,MAAa,+BAA+B,gBAAyC;CACnF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,UAAU;CACV,eAAe;CAGf,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAyB,UAAU;CAAW;CAC/D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAMD,SAAgB,mBAAmB,EAAE,WAAW,UAAU,OAAO,WAAW,GAAG,SAAkC;CAI/G,MAAM,aADQ,gBAA4D,SACnD,CAAC,EAAE,SAAS,QAAQ;CAE3C,IAAI,CAAC,YACH,OAAO;CAGT,OACE,oBAAC,QAAD;EAAM,GAAI;EAAkB;EAAW,iCAA8B;EAAG,gBAAa;EAClF,UAAA,YAAY;CACT,CAAA;AAEV"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef } from "react";
|
|
4
|
+
//#region src/matter/cart-item-variations/cart-item-variations.d.ts
|
|
5
|
+
/** One selected variation on the current cart line (e.g. `{ name: 'Cor', value: 'Vermelho' }`). */
|
|
6
|
+
export type CartItemVariationEntry = {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Per-line slice delivered by the `reactive-list-item` runtime: the value the wrapper publishes
|
|
12
|
+
* through `DataOverrideContext`, read via `useDataOverride`. Only the fields the component renders
|
|
13
|
+
* are typed; the resolved cache slice carries the full fragment selection.
|
|
14
|
+
*/
|
|
15
|
+
export type CartItemVariationsSlice = {
|
|
16
|
+
variant: {
|
|
17
|
+
selectedOptions: CartItemVariationEntry[];
|
|
18
|
+
} | null;
|
|
19
|
+
};
|
|
20
|
+
export type CartItemVariationsProps = ComponentPropsWithRef<'div'> & {
|
|
21
|
+
/** Per-item slice from the reactive-list-item runtime; injected/overridden by the wrapper. */
|
|
22
|
+
$data?: CartItemVariationsSlice | null;
|
|
23
|
+
};
|
|
24
|
+
export declare const CartItemVariationsDefinition: ComponentDefinition<CartItemVariationsProps>;
|
|
25
|
+
export declare function CartItemVariations({ className, $data: $dataProp, ...props }: CartItemVariationsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
+
//#endregion
|
|
27
|
+
//# sourceMappingURL=cart-item-variations.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { graphql } from "../../sdk/generated/gql.js";
|
|
5
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/matter/cart-item-variations/cart-item-variations.tsx
|
|
8
|
+
const cartItemVariationsFragment = graphql(`
|
|
9
|
+
fragment CartItemVariationsData on Query {
|
|
10
|
+
cart {
|
|
11
|
+
items {
|
|
12
|
+
__typename
|
|
13
|
+
id
|
|
14
|
+
variant {
|
|
15
|
+
__typename
|
|
16
|
+
selectedOptions {
|
|
17
|
+
name
|
|
18
|
+
value
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`);
|
|
25
|
+
const CartItemVariationsDefinition = defineComponent({
|
|
26
|
+
name: "CartItemVariations",
|
|
27
|
+
importPath: "@vtex/faststore/components",
|
|
28
|
+
component: CartItemVariations,
|
|
29
|
+
fragment: cartItemVariationsFragment,
|
|
30
|
+
fetchStrategy: "reactive-list-item",
|
|
31
|
+
requiresContext: "cart-item",
|
|
32
|
+
editor: {
|
|
33
|
+
label: "Cart Item Variations",
|
|
34
|
+
category: "commerce"
|
|
35
|
+
},
|
|
36
|
+
schema: {},
|
|
37
|
+
guideline: "Renders the variations selected on a cart line (e.g. \"Cor: Vermelho\"); renders null when the line has none. Optional per-item data owned by its own fragment (ADR-0011). Must be inside CartList. See cart-item.md."
|
|
38
|
+
});
|
|
39
|
+
function CartItemVariations({ className, $data: $dataProp, ...props }) {
|
|
40
|
+
const options = useDataOverride($dataProp)?.variant?.selectedOptions;
|
|
41
|
+
if (!options || options.length === 0) return null;
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
...props,
|
|
44
|
+
className,
|
|
45
|
+
"data-fs-cart-item-variations": "",
|
|
46
|
+
children: options.map((option, index) => /* @__PURE__ */ jsxs("span", {
|
|
47
|
+
"data-fs-cart-item-variation": "",
|
|
48
|
+
"data-fs-text": "",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx("span", {
|
|
51
|
+
"data-fs-cart-item-variation-name": "",
|
|
52
|
+
children: option.name
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx("span", {
|
|
55
|
+
"data-fs-cart-item-variation-separator": "",
|
|
56
|
+
children: ": "
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx("span", {
|
|
59
|
+
"data-fs-cart-item-variation-value": "",
|
|
60
|
+
children: option.value
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}, `${option.name}-${index}`))
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { CartItemVariations, CartItemVariationsDefinition };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=cart-item-variations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-item-variations.js","names":[],"sources":["../../../src/matter/cart-item-variations/cart-item-variations.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { graphql } from '../../sdk/generated/gql.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — typed via @graphql-codegen client-preset (T7)\n// ---------------------------------------------------------------------------\n\n// ADR-0011: CartItemVariations is a per-item sub-matter that OWNS its (optional) selected-options\n// data. Decomposed out of the monolithic CartItemFragment, the selected-options subtree is\n// fetched only on pages that place this matter — over-fetch elimination by data ownership. The\n// author writes one uniform `on Query` fragment drilling the list; the compiler re-roots it to\n// `CartItemVariationsData_CartItem on CartItem`. Fields are inlined (no `...` spread) so the\n// derived per-item fragment is self-contained for `useFragment`; it drills the identical\n// cart { items { ... } } path as the other per-item matters so it merges un-aliased (ADR-0012).\nconst cartItemVariationsFragment = graphql(`\n fragment CartItemVariationsData on Query {\n cart {\n items {\n __typename\n id\n variant {\n __typename\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** One selected variation on the current cart line (e.g. `{ name: 'Cor', value: 'Vermelho' }`). */\nexport type CartItemVariationEntry = { name: string; value: string };\n\n/**\n * Per-line slice delivered by the `reactive-list-item` runtime: the value the wrapper publishes\n * through `DataOverrideContext`, read via `useDataOverride`. Only the fields the component renders\n * are typed; the resolved cache slice carries the full fragment selection.\n */\nexport type CartItemVariationsSlice = {\n variant: { selectedOptions: CartItemVariationEntry[] } | null;\n};\n\nexport type CartItemVariationsProps = ComponentPropsWithRef<'div'> & {\n /** Per-item slice from the reactive-list-item runtime; injected/overridden by the wrapper. */\n $data?: CartItemVariationsSlice | null;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const CartItemVariationsDefinition = defineComponent<CartItemVariationsProps>({\n name: 'CartItemVariations',\n importPath: '@vtex/faststore/components',\n component: CartItemVariations,\n fragment: cartItemVariationsFragment,\n fetchStrategy: 'reactive-list-item',\n // requiresContext pairs with CartList (provides 'cart-item') so the context-constraints walk\n // rejects placing this matter outside its iterator.\n requiresContext: 'cart-item',\n editor: { label: 'Cart Item Variations', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders the variations selected on a cart line (e.g. \"Cor: Vermelho\"); renders null when the line has none. Optional per-item data owned by its own fragment (ADR-0011). Must be inside CartList. See cart-item.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function CartItemVariations({ className, $data: $dataProp, ...props }: CartItemVariationsProps) {\n // Delivery-agnostic: the slice arrives through the DataOverrideContext seam the reactive-list-item\n // wrapper publishes (or via $data in tests); the component calls no data hook.\n const slice = useDataOverride<CartItemVariationsSlice | null | undefined>($dataProp);\n const options = slice?.variant?.selectedOptions;\n\n if (!options || options.length === 0) {\n return null;\n }\n\n return (\n <div {...props} className={className} data-fs-cart-item-variations=\"\">\n {options.map((option, index) => (\n <span key={`${option.name}-${index}`} data-fs-cart-item-variation=\"\" data-fs-text=\"\">\n <span data-fs-cart-item-variation-name=\"\">{option.name}</span>\n <span data-fs-cart-item-variation-separator=\"\">{': '}</span>\n <span data-fs-cart-item-variation-value=\"\">{option.value}</span>\n </span>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAkBA,MAAM,6BAA6B,QAAQ;;;;;;;;;;;;;;;;CAgB1C;AA2BD,MAAa,+BAA+B,gBAAyC;CACnF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,UAAU;CACV,eAAe;CAGf,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAwB,UAAU;CAAW;CAC9D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAMD,SAAgB,mBAAmB,EAAE,WAAW,OAAO,WAAW,GAAG,SAAkC;CAIrG,MAAM,UADQ,gBAA4D,SACtD,CAAC,EAAE,SAAS;CAEhC,IAAI,CAAC,WAAW,QAAQ,WAAW,GACjC,OAAO;CAGT,OACE,oBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,gCAA6B;EAChE,UAAA,QAAQ,KAAK,QAAQ,UACpB,qBAAC,QAAD;GAAsC,+BAA4B;GAAG,gBAAa;GAAlF,UAAA;IACE,oBAAC,QAAD;KAAM,oCAAiC;KAAI,UAAA,OAAO;IAAW,CAAA;IAC7D,oBAAC,QAAD;KAAM,yCAAsC;KAAI,UAAA;IAAW,CAAA;IAC3D,oBAAC,QAAD;KAAM,qCAAkC;KAAI,UAAA,OAAO;IAAY,CAAA;GAC3D;EAJK,GAAA,GAAG,OAAO,KAAK,GAAG,OAIvB,CACP;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { CartTotalizer, Money } from "../../sdk/cart/operations.js";
|
|
4
|
+
import { ComponentPropsWithRef } from "react";
|
|
5
|
+
//#region src/matter/cart-totalizer/cart-totalizer.d.ts
|
|
6
|
+
type CartTotalizerContextValue = Readonly<{
|
|
7
|
+
totalizers: readonly CartTotalizer[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare function useCartTotalizers(): CartTotalizerContextValue;
|
|
10
|
+
export type CartTotalizerRootProps = ComponentPropsWithRef<'div'> & {
|
|
11
|
+
/**
|
|
12
|
+
* Cart totalizer slice forwarded by the reactive runtime (`ReactiveDataProvider`) — it is the
|
|
13
|
+
* value of the `cart` top-level field on `CartTotalizerData on Query`, not the wrapping
|
|
14
|
+
* `{ cart: … }` shape. Receives `null` when the cart has not yet resolved.
|
|
15
|
+
*/
|
|
16
|
+
$data?: {
|
|
17
|
+
totalizers: readonly CartTotalizer[];
|
|
18
|
+
total: Money;
|
|
19
|
+
} | null;
|
|
20
|
+
};
|
|
21
|
+
export type CartTotalizerLineProps = ComponentPropsWithRef<'div'> & {
|
|
22
|
+
/** Which `cart.totalizers` entry to render, selected by `id` (e.g. "Items", "Shipping", "Discounts"). */
|
|
23
|
+
totalizerId: string;
|
|
24
|
+
/** Optional label override; defaults to the totalizer's `name`. */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** Styling hook → `data-fs-cart-totalizer-line-variant`. The F9 discounts line uses `'discount'`. */
|
|
27
|
+
variant?: 'default' | 'discount';
|
|
28
|
+
/** Text rendered in place of the value when the amount is exactly zero (e.g. "Free" for shipping — Decision 5). */
|
|
29
|
+
zeroLabel?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const CartTotalizerRootDefinition: ComponentDefinition<CartTotalizerRootProps>;
|
|
32
|
+
export declare const CartTotalizerLineDefinition: ComponentDefinition<CartTotalizerLineProps>;
|
|
33
|
+
export declare function CartTotalizerRoot({ $data: $dataProp, className, children, ...props }: CartTotalizerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function CartTotalizerLine({ totalizerId, label, variant, zeroLabel, className, children, ...props }: CartTotalizerLineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
35
|
+
export type CartDiscountKind = 'PROMOTION' | 'COUPON' | 'OTHER';
|
|
36
|
+
/**
|
|
37
|
+
* One cart-level discount line from `Cart.discounts`. `value` is the absolute amount discounted
|
|
38
|
+
* (a positive `Money`); the negative sign is applied on render by the locale's currency format.
|
|
39
|
+
* `amount` is typed `number` but is a string at runtime, so it is `Number()`-coerced before formatting.
|
|
40
|
+
* `name` is null for the OTHER residual and for an unnamed promotion — the `otherLabel` prop names those.
|
|
41
|
+
*/
|
|
42
|
+
export type CartDiscountEntry = {
|
|
43
|
+
name: string | null;
|
|
44
|
+
value: {
|
|
45
|
+
amount: number;
|
|
46
|
+
currencyCode: string;
|
|
47
|
+
};
|
|
48
|
+
kind: CartDiscountKind;
|
|
49
|
+
};
|
|
50
|
+
/** Cart slice forwarded by the reactive runtime — the value of the top-level `cart` field. */
|
|
51
|
+
type CartDiscountLinesSlice = {
|
|
52
|
+
discounts: CartDiscountEntry[];
|
|
53
|
+
};
|
|
54
|
+
export type CartDiscountLineProps = ComponentPropsWithRef<'div'> & {
|
|
55
|
+
/** Label for lines the API cannot name: the OTHER residual and an unnamed featured promotion. */
|
|
56
|
+
otherLabel?: string;
|
|
57
|
+
/** Cart discount slice forwarded by the reactive runtime; injected/overridden by the runtime or in tests. */
|
|
58
|
+
$data?: CartDiscountLinesSlice | null;
|
|
59
|
+
};
|
|
60
|
+
export declare const CartDiscountLineDefinition: ComponentDefinition<CartDiscountLineProps>;
|
|
61
|
+
export declare function CartDiscountLine({ otherLabel, className, $data: $dataProp, ...props }: CartDiscountLineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
62
|
+
/** Cart slice forwarded by the reactive runtime — the value of the top-level `cart` field. */
|
|
63
|
+
type CartMarkdownSlice = {
|
|
64
|
+
itemMarkdownTotal: {
|
|
65
|
+
amount: number;
|
|
66
|
+
currencyCode: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type CartMarkdownLineProps = ComponentPropsWithRef<'div'> & {
|
|
70
|
+
/** Row label for the aggregate item-level markdown. Interim operational default until the i18n catalog lands. */
|
|
71
|
+
label?: string;
|
|
72
|
+
/** Cart markdown slice forwarded by the reactive runtime; injected/overridden by the runtime or in tests. */
|
|
73
|
+
$data?: CartMarkdownSlice | null;
|
|
74
|
+
};
|
|
75
|
+
export declare const CartMarkdownLineDefinition: ComponentDefinition<CartMarkdownLineProps>;
|
|
76
|
+
export declare function CartMarkdownLine({ label, className, $data: $dataProp, ...props }: CartMarkdownLineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
77
|
+
//#endregion
|
|
78
|
+
//# sourceMappingURL=cart-totalizer.d.ts.map
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
|
|
5
|
+
import { graphql } from "../../sdk/generated/gql.js";
|
|
6
|
+
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
7
|
+
import { CartTotalValueContext, formatPrice } from "../cart/cart.js";
|
|
8
|
+
import { createContext, useContext, useMemo } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/matter/cart-totalizer/cart-totalizer.tsx
|
|
11
|
+
const fragment = graphql(`
|
|
12
|
+
fragment CartTotalizerData on Query {
|
|
13
|
+
cart {
|
|
14
|
+
__typename
|
|
15
|
+
id
|
|
16
|
+
totalizers {
|
|
17
|
+
__typename
|
|
18
|
+
id
|
|
19
|
+
name
|
|
20
|
+
value {
|
|
21
|
+
...MoneyFragment
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
total {
|
|
25
|
+
...MoneyFragment
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`);
|
|
30
|
+
const CART_TOTALIZER_UNSET = Symbol("CartTotalizerContextUnset");
|
|
31
|
+
const CartTotalizerContextInternal = createContext(CART_TOTALIZER_UNSET);
|
|
32
|
+
function useCartTotalizers() {
|
|
33
|
+
const ctx = useContext(CartTotalizerContextInternal);
|
|
34
|
+
if (ctx === CART_TOTALIZER_UNSET) throw new Error("useCartTotalizers() must be used inside a <CartTotalizerRoot> subtree.");
|
|
35
|
+
return ctx;
|
|
36
|
+
}
|
|
37
|
+
const CartTotalizerRootDefinition = defineComponent({
|
|
38
|
+
name: "CartTotalizerRoot",
|
|
39
|
+
importPath: "@vtex/faststore/components",
|
|
40
|
+
component: CartTotalizerRoot,
|
|
41
|
+
fragment,
|
|
42
|
+
fetchStrategy: "reactive",
|
|
43
|
+
editor: {
|
|
44
|
+
label: "Cart Totalizer Root",
|
|
45
|
+
category: "commerce"
|
|
46
|
+
},
|
|
47
|
+
schema: {},
|
|
48
|
+
guideline: "Focused reactive provider for cart totalizers + total (narrower than CartRoot); merges with CartRoot into one cart query when both are present on the page (e.g. CartRoot wrapping the mini-cart drawer, CartTotalizerRoot composing its footer). Use it to compose an order summary — in a mini-cart drawer footer or a checkout summary panel: wrap a CartTotalizerLine totalizerId=\"Items\" (subtotal), a CartTotalizerLine totalizerId=\"Discounts\" variant=\"discount\" (auto-hides at zero), a CartTotalizerLine totalizerId=\"Shipping\" zeroLabel=\"Grátis\", and a CartTotal for the grand total (set CartTotal label for a labeled total row). CartTotal is root-agnostic and reads the total from this root — there is no CartTotalizerTotal."
|
|
49
|
+
});
|
|
50
|
+
const CartTotalizerLineDefinition = defineComponent({
|
|
51
|
+
name: "CartTotalizerLine",
|
|
52
|
+
importPath: "@vtex/faststore/components",
|
|
53
|
+
component: CartTotalizerLine,
|
|
54
|
+
editor: {
|
|
55
|
+
label: "Cart Totalizer Line",
|
|
56
|
+
category: "commerce"
|
|
57
|
+
},
|
|
58
|
+
schema: {
|
|
59
|
+
totalizerId: {
|
|
60
|
+
type: "string",
|
|
61
|
+
label: "Totalizer Id"
|
|
62
|
+
},
|
|
63
|
+
label: {
|
|
64
|
+
type: "string",
|
|
65
|
+
label: "Label"
|
|
66
|
+
},
|
|
67
|
+
variant: {
|
|
68
|
+
type: ["default", "discount"],
|
|
69
|
+
default: "default",
|
|
70
|
+
label: "Variant"
|
|
71
|
+
},
|
|
72
|
+
zeroLabel: {
|
|
73
|
+
type: "string",
|
|
74
|
+
label: "Zero Label"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
guideline: "Renders one cart totalizer row (label + value) selected by totalizerId. The canonical order-summary lines are totalizerId=\"Items\" (the subtotal), totalizerId=\"Discounts\" (the discount), and totalizerId=\"Shipping\" (the shipping cost). For the discounts line set variant=\"discount\" — it hides itself when the value is zero (no active discount). The Core API returns a negative amount for discounts; the formatted value displays as-is (e.g. \"-R$ 40,00\"). Set zeroLabel=\"Grátis\" for the shipping line so a zero amount renders the label instead of R$ 0,00. A line whose totalizerId is absent from the cart renders nothing (no empty row). Must be inside CartTotalizerRoot."
|
|
78
|
+
});
|
|
79
|
+
function CartTotalizerRoot({ $data: $dataProp, className, children, ...props }) {
|
|
80
|
+
const $data = useDataOverride($dataProp);
|
|
81
|
+
const totalizerValue = useMemo(() => ({ totalizers: $data?.totalizers ?? [] }), [$data?.totalizers]);
|
|
82
|
+
return /* @__PURE__ */ jsx(CartTotalValueContext, {
|
|
83
|
+
value: $data?.total ?? null,
|
|
84
|
+
children: /* @__PURE__ */ jsx(CartTotalizerContextInternal, {
|
|
85
|
+
value: totalizerValue,
|
|
86
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
87
|
+
...props,
|
|
88
|
+
className,
|
|
89
|
+
"data-fs-cart-totalizer-root": "",
|
|
90
|
+
children
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function CartTotalizerLine({ totalizerId, label, variant = "default", zeroLabel, className, children, ...props }) {
|
|
96
|
+
const { totalizers } = useCartTotalizers();
|
|
97
|
+
const { locale, currency } = useStorefrontContext();
|
|
98
|
+
const totalizer = totalizers.find((t) => t.id === totalizerId);
|
|
99
|
+
if (!totalizer) return null;
|
|
100
|
+
const amount = totalizer.value.amount;
|
|
101
|
+
if (variant === "discount" && amount === 0) return null;
|
|
102
|
+
const valueContent = amount === 0 && zeroLabel != null ? zeroLabel : formatPrice(amount, locale, currency);
|
|
103
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
...props,
|
|
105
|
+
className,
|
|
106
|
+
"data-fs-cart-totalizer-line": "",
|
|
107
|
+
"data-fs-cart-totalizer-line-variant": variant,
|
|
108
|
+
children: [/* @__PURE__ */ jsx("span", { children: label ?? totalizer.name }), /* @__PURE__ */ jsx("span", { children: children ?? valueContent })]
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const cartDiscountLinesFragment = graphql(`
|
|
112
|
+
fragment CartDiscountLinesData on Query {
|
|
113
|
+
cart {
|
|
114
|
+
__typename
|
|
115
|
+
id
|
|
116
|
+
discounts {
|
|
117
|
+
name
|
|
118
|
+
value {
|
|
119
|
+
...MoneyFragment
|
|
120
|
+
}
|
|
121
|
+
kind
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`);
|
|
126
|
+
const CartDiscountLineDefinition = defineComponent({
|
|
127
|
+
name: "CartDiscountLine",
|
|
128
|
+
importPath: "@vtex/faststore/components",
|
|
129
|
+
component: CartDiscountLine,
|
|
130
|
+
fragment: cartDiscountLinesFragment,
|
|
131
|
+
fetchStrategy: "reactive",
|
|
132
|
+
editor: {
|
|
133
|
+
label: "Cart Discount Line",
|
|
134
|
+
category: "commerce"
|
|
135
|
+
},
|
|
136
|
+
schema: { otherLabel: {
|
|
137
|
+
type: "string",
|
|
138
|
+
default: "Other discounts",
|
|
139
|
+
label: "Unnamed discount label"
|
|
140
|
+
} },
|
|
141
|
+
guideline: "Itemized order-summary discounts: renders one line per entry in cart.discounts (one per promotion and per coupon, plus a residual \"other\" line), each as label + negative amount. Renders nothing when the cart has no discounts. This is the itemized alternative to CartTotalizerLine totalizerId=\"Discounts\": the entries sum to that same aggregate, so compose this OR that line, never both (both would double-count the same money). Place it in the order summary, typically inside CartTotalizerRoot. Set otherLabel for the residual and any unnamed promotion. See cart-totalizer.md."
|
|
142
|
+
});
|
|
143
|
+
function CartDiscountLine({ otherLabel = "Other discounts", className, $data: $dataProp, ...props }) {
|
|
144
|
+
const slice = useDataOverride($dataProp);
|
|
145
|
+
const { locale, currency } = useStorefrontContext();
|
|
146
|
+
const discounts = slice?.discounts;
|
|
147
|
+
if (!discounts || discounts.length === 0) return null;
|
|
148
|
+
return /* @__PURE__ */ jsx("div", {
|
|
149
|
+
...props,
|
|
150
|
+
className,
|
|
151
|
+
"data-fs-cart-discount-lines": "",
|
|
152
|
+
children: discounts.map((discount, index) => {
|
|
153
|
+
const amount = Number(discount.value.amount);
|
|
154
|
+
const label = discount.name ?? otherLabel;
|
|
155
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
"data-fs-cart-discount-line": "",
|
|
157
|
+
"data-fs-cart-discount-line-kind": discount.kind.toLowerCase(),
|
|
158
|
+
"data-fs-text": "",
|
|
159
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
160
|
+
"data-fs-cart-discount-line-label": "",
|
|
161
|
+
children: label
|
|
162
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
163
|
+
"data-fs-cart-discount-line-value": "",
|
|
164
|
+
children: formatPrice(-amount, locale, currency)
|
|
165
|
+
})]
|
|
166
|
+
}, `${discount.kind}-${discount.name}-${index}`);
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const cartMarkdownFragment = graphql(`
|
|
171
|
+
fragment CartMarkdownData on Query {
|
|
172
|
+
cart {
|
|
173
|
+
__typename
|
|
174
|
+
id
|
|
175
|
+
itemMarkdownTotal {
|
|
176
|
+
...MoneyFragment
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
`);
|
|
181
|
+
const CartMarkdownLineDefinition = defineComponent({
|
|
182
|
+
name: "CartMarkdownLine",
|
|
183
|
+
importPath: "@vtex/faststore/components",
|
|
184
|
+
component: CartMarkdownLine,
|
|
185
|
+
fragment: cartMarkdownFragment,
|
|
186
|
+
fetchStrategy: "reactive",
|
|
187
|
+
editor: {
|
|
188
|
+
label: "Cart Markdown Line",
|
|
189
|
+
category: "commerce"
|
|
190
|
+
},
|
|
191
|
+
schema: { label: {
|
|
192
|
+
type: "string",
|
|
193
|
+
default: "Item discounts",
|
|
194
|
+
label: "Markdown label"
|
|
195
|
+
} },
|
|
196
|
+
guideline: "Aggregate item-level catalog markdown: renders Cart.itemMarkdownTotal (the sum of listPrice − price across the cart, the \"de/por\" catalog savings) as a single negative line. Renders nothing when the cart has no markdown. This is DISTINCT money from CartDiscountLine and CartTotalizerLine totalizerId=\"Discounts\" (those are cart-level promotions/coupons, price − sellingPrice) — it may be shown ALONGSIDE them, not instead of them, and does not double-count. Place it in the order summary, typically inside CartTotalizerRoot. Set label to word the row. See cart-totalizer.md."
|
|
197
|
+
});
|
|
198
|
+
function CartMarkdownLine({ label = "Item discounts", className, $data: $dataProp, ...props }) {
|
|
199
|
+
const slice = useDataOverride($dataProp);
|
|
200
|
+
const { locale, currency } = useStorefrontContext();
|
|
201
|
+
const amount = Number(slice?.itemMarkdownTotal?.amount ?? 0);
|
|
202
|
+
if (!amount) return null;
|
|
203
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
204
|
+
...props,
|
|
205
|
+
className,
|
|
206
|
+
"data-fs-cart-markdown-line": "",
|
|
207
|
+
"data-fs-text": "",
|
|
208
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
209
|
+
"data-fs-cart-markdown-line-label": "",
|
|
210
|
+
children: label
|
|
211
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
212
|
+
"data-fs-cart-markdown-line-value": "",
|
|
213
|
+
children: formatPrice(-amount, locale, currency)
|
|
214
|
+
})]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
export { CartDiscountLine, CartDiscountLineDefinition, CartMarkdownLine, CartMarkdownLineDefinition, CartTotalizerLine, CartTotalizerLineDefinition, CartTotalizerRoot, CartTotalizerRootDefinition, useCartTotalizers };
|
|
219
|
+
|
|
220
|
+
//# sourceMappingURL=cart-totalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-totalizer.js","names":[],"sources":["../../../src/matter/cart-totalizer/cart-totalizer.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, createContext, useContext, useMemo } from 'react';\nimport type { Money, CartTotalizer as Totalizer } from '../../sdk/cart/operations.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { graphql } from '../../sdk/generated/gql.js';\nimport { CartTotalValueContext, formatPrice } from '../cart/cart.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — narrow cart slice (totalizers + total)\n// ---------------------------------------------------------------------------\n\nconst fragment = graphql(`\n fragment CartTotalizerData on Query {\n cart {\n __typename\n id\n totalizers {\n __typename\n id\n name\n value {\n ...MoneyFragment\n }\n }\n total {\n ...MoneyFragment\n }\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Context — totalizers list, provided by CartTotalizerRoot for CartTotalizerLine\n// ---------------------------------------------------------------------------\n\ntype CartTotalizerContextValue = Readonly<{\n totalizers: readonly Totalizer[];\n}>;\n\nconst CART_TOTALIZER_UNSET = Symbol('CartTotalizerContextUnset');\n\nconst CartTotalizerContextInternal = createContext<CartTotalizerContextValue | typeof CART_TOTALIZER_UNSET>(\n CART_TOTALIZER_UNSET,\n);\n\nexport function useCartTotalizers(): CartTotalizerContextValue {\n const ctx = useContext(CartTotalizerContextInternal);\n if (ctx === CART_TOTALIZER_UNSET) {\n throw new Error('useCartTotalizers() must be used inside a <CartTotalizerRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type CartTotalizerRootProps = ComponentPropsWithRef<'div'> & {\n /**\n * Cart totalizer slice forwarded by the reactive runtime (`ReactiveDataProvider`) — it is the\n * value of the `cart` top-level field on `CartTotalizerData on Query`, not the wrapping\n * `{ cart: … }` shape. Receives `null` when the cart has not yet resolved.\n */\n $data?: { totalizers: readonly Totalizer[]; total: Money } | null;\n};\n\nexport type CartTotalizerLineProps = ComponentPropsWithRef<'div'> & {\n /** Which `cart.totalizers` entry to render, selected by `id` (e.g. \"Items\", \"Shipping\", \"Discounts\"). */\n totalizerId: string;\n /** Optional label override; defaults to the totalizer's `name`. */\n label?: string;\n /** Styling hook → `data-fs-cart-totalizer-line-variant`. The F9 discounts line uses `'discount'`. */\n variant?: 'default' | 'discount';\n /** Text rendered in place of the value when the amount is exactly zero (e.g. \"Free\" for shipping — Decision 5). */\n zeroLabel?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const CartTotalizerRootDefinition = defineComponent<CartTotalizerRootProps>({\n name: 'CartTotalizerRoot',\n importPath: '@vtex/faststore/components',\n component: CartTotalizerRoot,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Cart Totalizer Root', category: 'commerce' },\n schema: {},\n guideline:\n 'Focused reactive provider for cart totalizers + total (narrower than CartRoot); merges with CartRoot into one cart query when both are present on the page (e.g. CartRoot wrapping the mini-cart drawer, CartTotalizerRoot composing its footer). Use it to compose an order summary — in a mini-cart drawer footer or a checkout summary panel: wrap a CartTotalizerLine totalizerId=\"Items\" (subtotal), a CartTotalizerLine totalizerId=\"Discounts\" variant=\"discount\" (auto-hides at zero), a CartTotalizerLine totalizerId=\"Shipping\" zeroLabel=\"Grátis\", and a CartTotal for the grand total (set CartTotal label for a labeled total row). CartTotal is root-agnostic and reads the total from this root — there is no CartTotalizerTotal.',\n});\n\nexport const CartTotalizerLineDefinition = defineComponent<CartTotalizerLineProps>({\n name: 'CartTotalizerLine',\n importPath: '@vtex/faststore/components',\n component: CartTotalizerLine,\n editor: { label: 'Cart Totalizer Line', category: 'commerce' },\n schema: {\n totalizerId: { type: 'string', label: 'Totalizer Id' },\n label: { type: 'string', label: 'Label' },\n variant: { type: ['default', 'discount'] as const, default: 'default', label: 'Variant' },\n zeroLabel: { type: 'string', label: 'Zero Label' },\n },\n guideline:\n 'Renders one cart totalizer row (label + value) selected by totalizerId. The canonical order-summary lines are totalizerId=\"Items\" (the subtotal), totalizerId=\"Discounts\" (the discount), and totalizerId=\"Shipping\" (the shipping cost). For the discounts line set variant=\"discount\" — it hides itself when the value is zero (no active discount). The Core API returns a negative amount for discounts; the formatted value displays as-is (e.g. \"-R$ 40,00\"). Set zeroLabel=\"Grátis\" for the shipping line so a zero amount renders the label instead of R$ 0,00. A line whose totalizerId is absent from the cart renders nothing (no empty row). Must be inside CartTotalizerRoot.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function CartTotalizerRoot({ $data: $dataProp, className, children, ...props }: CartTotalizerRootProps) {\n const $data = useDataOverride($dataProp);\n\n const totalizerValue: CartTotalizerContextValue = useMemo(\n () => ({ totalizers: $data?.totalizers ?? [] }),\n [$data?.totalizers],\n );\n\n return (\n <CartTotalValueContext value={$data?.total ?? null}>\n <CartTotalizerContextInternal value={totalizerValue}>\n <div {...props} className={className} data-fs-cart-totalizer-root=\"\">\n {children}\n </div>\n </CartTotalizerContextInternal>\n </CartTotalValueContext>\n );\n}\n\nexport function CartTotalizerLine({\n totalizerId,\n label,\n variant = 'default',\n zeroLabel,\n className,\n children,\n ...props\n}: CartTotalizerLineProps) {\n const { totalizers } = useCartTotalizers();\n const { locale, currency } = useStorefrontContext();\n const totalizer = totalizers.find((t) => t.id === totalizerId);\n\n if (!totalizer) return null;\n\n const amount = totalizer.value.amount;\n\n if (variant === 'discount' && amount === 0) return null;\n\n const valueContent = amount === 0 && zeroLabel != null ? zeroLabel : formatPrice(amount, locale, currency);\n\n return (\n <div {...props} className={className} data-fs-cart-totalizer-line=\"\" data-fs-cart-totalizer-line-variant={variant}>\n <span>{label ?? totalizer.name}</span>\n <span>{children ?? valueContent}</span>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// CartDiscountLine — itemized discount breakdown (F11)\n// ---------------------------------------------------------------------------\n\n// Owns its own `Cart.discounts` slice (ADR-0011 data ownership): the field is fetched only when this\n// leaf is placed and merges with any CartTotalizerRoot / CartRoot cart selection into one query. The\n// entries are the itemized companion to the aggregate \"Discounts\" totalizer and sum to it, so a store\n// composes this OR CartTotalizerLine totalizerId=\"Discounts\", never both.\nconst cartDiscountLinesFragment = graphql(`\n fragment CartDiscountLinesData on Query {\n cart {\n __typename\n id\n discounts {\n name\n value {\n ...MoneyFragment\n }\n kind\n }\n }\n }\n`);\n\nexport type CartDiscountKind = 'PROMOTION' | 'COUPON' | 'OTHER';\n\n/**\n * One cart-level discount line from `Cart.discounts`. `value` is the absolute amount discounted\n * (a positive `Money`); the negative sign is applied on render by the locale's currency format.\n * `amount` is typed `number` but is a string at runtime, so it is `Number()`-coerced before formatting.\n * `name` is null for the OTHER residual and for an unnamed promotion — the `otherLabel` prop names those.\n */\nexport type CartDiscountEntry = {\n name: string | null;\n value: { amount: number; currencyCode: string };\n kind: CartDiscountKind;\n};\n\n/** Cart slice forwarded by the reactive runtime — the value of the top-level `cart` field. */\ntype CartDiscountLinesSlice = { discounts: CartDiscountEntry[] };\n\nexport type CartDiscountLineProps = ComponentPropsWithRef<'div'> & {\n /** Label for lines the API cannot name: the OTHER residual and an unnamed featured promotion. */\n otherLabel?: string;\n /** Cart discount slice forwarded by the reactive runtime; injected/overridden by the runtime or in tests. */\n $data?: CartDiscountLinesSlice | null;\n};\n\nexport const CartDiscountLineDefinition = defineComponent<CartDiscountLineProps>({\n name: 'CartDiscountLine',\n importPath: '@vtex/faststore/components',\n component: CartDiscountLine,\n fragment: cartDiscountLinesFragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Cart Discount Line', category: 'commerce' },\n schema: {\n otherLabel: { type: 'string', default: 'Other discounts', label: 'Unnamed discount label' },\n },\n guideline:\n 'Itemized order-summary discounts: renders one line per entry in cart.discounts (one per promotion ' +\n 'and per coupon, plus a residual \"other\" line), each as label + negative amount. Renders nothing ' +\n 'when the cart has no discounts. This is the itemized alternative to CartTotalizerLine ' +\n 'totalizerId=\"Discounts\": the entries sum to that same aggregate, so compose this OR that line, ' +\n 'never both (both would double-count the same money). Place it in the order summary, typically ' +\n 'inside CartTotalizerRoot. Set otherLabel for the residual and any unnamed promotion. See cart-totalizer.md.',\n});\n\nexport function CartDiscountLine({\n otherLabel = 'Other discounts',\n className,\n $data: $dataProp,\n ...props\n}: CartDiscountLineProps) {\n const slice = useDataOverride<CartDiscountLinesSlice | null | undefined>($dataProp);\n const { locale, currency } = useStorefrontContext();\n const discounts = slice?.discounts;\n\n if (!discounts || discounts.length === 0) {\n return null;\n }\n\n return (\n <div {...props} className={className} data-fs-cart-discount-lines=\"\">\n {discounts.map((discount, index) => {\n const amount = Number(discount.value.amount);\n const label = discount.name ?? otherLabel;\n\n return (\n <div\n key={`${discount.kind}-${discount.name}-${index}`}\n data-fs-cart-discount-line=\"\"\n data-fs-cart-discount-line-kind={discount.kind.toLowerCase()}\n data-fs-text=\"\"\n >\n <span data-fs-cart-discount-line-label=\"\">{label}</span>\n {/* Negate the positive magnitude and let the currency format sign it — no hardcoded glyph. */}\n <span data-fs-cart-discount-line-value=\"\">{formatPrice(-amount, locale, currency)}</span>\n </div>\n );\n })}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// CartMarkdownLine — aggregate item-level catalog markdown (F11 scenario 1)\n// ---------------------------------------------------------------------------\n\n// Renders Cart.itemMarkdownTotal — Σ(listPrice − price) × qty across non-gift lines, computed\n// server-side — as one negative summary line, self-hiding when zero. This is the catalog \"de/por\"\n// markdown that sits ABOVE the Items subtotal, so it is DISTINCT money from the cart-level promotions\n// on the Discounts totalizer / CartDiscountLine (price − sellingPrice): the two coexist in a summary,\n// they do not substitute. Owns its own slice (ADR-0011): the field is fetched only when this leaf is\n// placed and merges with any CartTotalizerRoot / CartRoot cart selection into one query.\nconst cartMarkdownFragment = graphql(`\n fragment CartMarkdownData on Query {\n cart {\n __typename\n id\n itemMarkdownTotal {\n ...MoneyFragment\n }\n }\n }\n`);\n\n/** Cart slice forwarded by the reactive runtime — the value of the top-level `cart` field. */\ntype CartMarkdownSlice = { itemMarkdownTotal: { amount: number; currencyCode: string } };\n\nexport type CartMarkdownLineProps = ComponentPropsWithRef<'div'> & {\n /** Row label for the aggregate item-level markdown. Interim operational default until the i18n catalog lands. */\n label?: string;\n /** Cart markdown slice forwarded by the reactive runtime; injected/overridden by the runtime or in tests. */\n $data?: CartMarkdownSlice | null;\n};\n\nexport const CartMarkdownLineDefinition = defineComponent<CartMarkdownLineProps>({\n name: 'CartMarkdownLine',\n importPath: '@vtex/faststore/components',\n component: CartMarkdownLine,\n fragment: cartMarkdownFragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Cart Markdown Line', category: 'commerce' },\n schema: {\n label: { type: 'string', default: 'Item discounts', label: 'Markdown label' },\n },\n guideline:\n 'Aggregate item-level catalog markdown: renders Cart.itemMarkdownTotal (the sum of listPrice − price ' +\n 'across the cart, the \"de/por\" catalog savings) as a single negative line. Renders nothing when the ' +\n 'cart has no markdown. This is DISTINCT money from CartDiscountLine and CartTotalizerLine ' +\n 'totalizerId=\"Discounts\" (those are cart-level promotions/coupons, price − sellingPrice) — it may be ' +\n 'shown ALONGSIDE them, not instead of them, and does not double-count. Place it in the order summary, ' +\n 'typically inside CartTotalizerRoot. Set label to word the row. See cart-totalizer.md.',\n});\n\nexport function CartMarkdownLine({\n label = 'Item discounts',\n className,\n $data: $dataProp,\n ...props\n}: CartMarkdownLineProps) {\n const slice = useDataOverride<CartMarkdownSlice | null | undefined>($dataProp);\n const { locale, currency } = useStorefrontContext();\n // `amount` is a string at runtime; coerce before checking/formatting. A zero markdown self-hides.\n const amount = Number(slice?.itemMarkdownTotal?.amount ?? 0);\n\n if (!amount) {\n return null;\n }\n\n return (\n <div {...props} className={className} data-fs-cart-markdown-line=\"\" data-fs-text=\"\">\n <span data-fs-cart-markdown-line-label=\"\">{label}</span>\n {/* Negate the positive magnitude and let the currency format sign it — no hardcoded glyph. */}\n <span data-fs-cart-markdown-line-value=\"\">{formatPrice(-amount, locale, currency)}</span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAcA,MAAM,WAAW,QAAQ;;;;;;;;;;;;;;;;;;CAkBxB;AAUD,MAAM,uBAAuB,OAAO,2BAA2B;AAE/D,MAAM,+BAA+B,cACnC,oBACF;AAEA,SAAgB,oBAA+C;CAC7D,MAAM,MAAM,WAAW,4BAA4B;CACnD,IAAI,QAAQ,sBACV,MAAM,IAAI,MAAM,wEAAwE;CAE1F,OAAO;AACT;AA8BA,MAAa,8BAA8B,gBAAwC;CACjF,MAAM;CACN,YAAY;CACZ,WAAW;CACX;CACA,eAAe;CACf,QAAQ;EAAE,OAAO;EAAuB,UAAU;CAAW;CAC7D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,8BAA8B,gBAAwC;CACjF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAuB,UAAU;CAAW;CAC7D,QAAQ;EACN,aAAa;GAAE,MAAM;GAAU,OAAO;EAAe;EACrD,OAAO;GAAE,MAAM;GAAU,OAAO;EAAQ;EACxC,SAAS;GAAE,MAAM,CAAC,WAAW,UAAU;GAAY,SAAS;GAAW,OAAO;EAAU;EACxF,WAAW;GAAE,MAAM;GAAU,OAAO;EAAa;CACnD;CACA,WACE;AACJ,CAAC;AAMD,SAAgB,kBAAkB,EAAE,OAAO,WAAW,WAAW,UAAU,GAAG,SAAiC;CAC7G,MAAM,QAAQ,gBAAgB,SAAS;CAEvC,MAAM,iBAA4C,eACzC,EAAE,YAAY,OAAO,cAAc,CAAC,EAAE,IAC7C,CAAC,OAAO,UAAU,CACpB;CAEA,OACE,oBAAC,uBAAD;EAAuB,OAAO,OAAO,SAAS;EAC5C,UAAA,oBAAC,8BAAD;GAA8B,OAAO;GACnC,UAAA,oBAAC,OAAD;IAAK,GAAI;IAAkB;IAAW,+BAA4B;IAC/D;GACE,CAAA;EACuB,CAAA;CACT,CAAA;AAE3B;AAEA,SAAgB,kBAAkB,EAChC,aACA,OACA,UAAU,WACV,WACA,WACA,UACA,GAAG,SACsB;CACzB,MAAM,EAAE,eAAe,kBAAkB;CACzC,MAAM,EAAE,QAAQ,aAAa,qBAAqB;CAClD,MAAM,YAAY,WAAW,MAAM,MAAM,EAAE,OAAO,WAAW;CAE7D,IAAI,CAAC,WAAW,OAAO;CAEvB,MAAM,SAAS,UAAU,MAAM;CAE/B,IAAI,YAAY,cAAc,WAAW,GAAG,OAAO;CAEnD,MAAM,eAAe,WAAW,KAAK,aAAa,OAAO,YAAY,YAAY,QAAQ,QAAQ,QAAQ;CAEzG,OACE,qBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,+BAA4B;EAAG,uCAAqC;EAA1G,UAAA,CACE,oBAAC,QAAD,EAAA,UAAO,SAAS,UAAU,KAAW,CAAA,GACrC,oBAAC,QAAD,EAAA,UAAO,YAAY,aAAmB,CAAA,CACnC;;AAET;AAUA,MAAM,4BAA4B,QAAQ;;;;;;;;;;;;;;CAczC;AA0BD,MAAa,6BAA6B,gBAAuC;CAC/E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,UAAU;CACV,eAAe;CACf,QAAQ;EAAE,OAAO;EAAsB,UAAU;CAAW;CAC5D,QAAQ,EACN,YAAY;EAAE,MAAM;EAAU,SAAS;EAAmB,OAAO;CAAyB,EAC5F;CACA,WACE;AAMJ,CAAC;AAED,SAAgB,iBAAiB,EAC/B,aAAa,mBACb,WACA,OAAO,WACP,GAAG,SACqB;CACxB,MAAM,QAAQ,gBAA2D,SAAS;CAClF,MAAM,EAAE,QAAQ,aAAa,qBAAqB;CAClD,MAAM,YAAY,OAAO;CAEzB,IAAI,CAAC,aAAa,UAAU,WAAW,GACrC,OAAO;CAGT,OACE,oBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,+BAA4B;EAC/D,UAAA,UAAU,KAAK,UAAU,UAAU;GAClC,MAAM,SAAS,OAAO,SAAS,MAAM,MAAM;GAC3C,MAAM,QAAQ,SAAS,QAAQ;GAE/B,OACE,qBAAC,OAAD;IAEE,8BAA2B;IAC3B,mCAAiC,SAAS,KAAK,YAAY;IAC3D,gBAAa;IAJf,UAAA,CAME,oBAAC,QAAD;KAAM,oCAAiC;KAAI,UAAA;IAAY,CAAA,GAEvD,oBAAC,QAAD;KAAM,oCAAiC;KAAI,UAAA,YAAY,CAAC,QAAQ,QAAQ,QAAQ;IAAQ,CAAA,CACrF;GARE,GAAA,GAAG,SAAS,KAAK,GAAG,SAAS,KAAK,GAAG,OAQvC;EAET,CAAC;CACE,CAAA;AAET;AAYA,MAAM,uBAAuB,QAAQ;;;;;;;;;;CAUpC;AAYD,MAAa,6BAA6B,gBAAuC;CAC/E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,UAAU;CACV,eAAe;CACf,QAAQ;EAAE,OAAO;EAAsB,UAAU;CAAW;CAC5D,QAAQ,EACN,OAAO;EAAE,MAAM;EAAU,SAAS;EAAkB,OAAO;CAAiB,EAC9E;CACA,WACE;AAMJ,CAAC;AAED,SAAgB,iBAAiB,EAC/B,QAAQ,kBACR,WACA,OAAO,WACP,GAAG,SACqB;CACxB,MAAM,QAAQ,gBAAsD,SAAS;CAC7E,MAAM,EAAE,QAAQ,aAAa,qBAAqB;CAElD,MAAM,SAAS,OAAO,OAAO,mBAAmB,UAAU,CAAC;CAE3D,IAAI,CAAC,QACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,8BAA2B;EAAG,gBAAa;EAAjF,UAAA,CACE,oBAAC,QAAD;GAAM,oCAAiC;GAAI,UAAA;EAAY,CAAA,GAEvD,oBAAC,QAAD;GAAM,oCAAiC;GAAI,UAAA,YAAY,CAAC,QAAQ,QAAQ,QAAQ;EAAQ,CAAA,CACrF;;AAET"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 { ReactNode } from "react";
|
|
5
|
+
//#region src/matter/client-preferences/client-preferences.d.ts
|
|
6
|
+
/** The `$data` slice forwarded by the reactive runtime — the `ClientPreferences` sibling entity. */
|
|
7
|
+
export type ClientPreferencesData = {
|
|
8
|
+
clientPreferences?: {
|
|
9
|
+
optinNewsLetter?: boolean | null;
|
|
10
|
+
savePersonalData?: boolean | null;
|
|
11
|
+
} | null;
|
|
12
|
+
} | null;
|
|
13
|
+
export type ClientPreferencesRootProps = {
|
|
14
|
+
/** `Query` slice forwarded by the reactive runtime (value of the section fragment). */
|
|
15
|
+
$data?: ClientPreferencesData;
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export type ClientPreferencesControlProps = {
|
|
20
|
+
label: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Injected by the compiler from `actions: { identity: ['clientPreferencesUpdate'] }`; the write surface. */
|
|
23
|
+
$actions?: ComponentActions;
|
|
24
|
+
};
|
|
25
|
+
export type NewsletterOptInControlProps = ClientPreferencesControlProps;
|
|
26
|
+
export type SavePersonalDataOptInControlProps = ClientPreferencesControlProps;
|
|
27
|
+
export declare const ClientPreferencesRootDefinition: ComponentDefinition<ClientPreferencesRootProps>;
|
|
28
|
+
export declare const NewsletterOptInControlDefinition: ComponentDefinition<ClientPreferencesControlProps>;
|
|
29
|
+
export declare const SavePersonalDataOptInControlDefinition: ComponentDefinition<ClientPreferencesControlProps>;
|
|
30
|
+
/**
|
|
31
|
+
* Renders the client-preferences section Root: reads `$data` (the `ClientPreferences` sibling entity),
|
|
32
|
+
* reads `useSession()` (which also enforces the `SessionRoot` ancestor, mirroring
|
|
33
|
+
* `EmailIdentificationControl`), seeds both opt-in values from the section fragment, and publishes a
|
|
34
|
+
* section context exposing both values plus per-field pending/error tracking. The write itself flows
|
|
35
|
+
* through the Control's `$actions.identity.clientPreferencesUpdate` (ADR-0010); this Root tracks which
|
|
36
|
+
* keys are in flight and stores the returned userErrors under each key so each Control surfaces ITS OWN
|
|
37
|
+
* pending/error. When the session reports `canEditData: false` (identified but unauthenticated claimed
|
|
38
|
+
* profile — VTEX refuses the write server-side) every Control renders disabled with its readonly
|
|
39
|
+
* `data-fs-*` attribute, mirroring `EmailIdentificationControl`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function ClientPreferencesRoot({ $data: $dataProp, className, children }: ClientPreferencesRootProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function NewsletterOptInControl(props: NewsletterOptInControlProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare function SavePersonalDataOptInControl(props: SavePersonalDataOptInControlProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare const ClientPreferences: {
|
|
45
|
+
Root: typeof ClientPreferencesRoot;
|
|
46
|
+
NewsletterOptInControl: typeof NewsletterOptInControl;
|
|
47
|
+
SavePersonalDataOptInControl: typeof SavePersonalDataOptInControl;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
//# sourceMappingURL=client-preferences.d.ts.map
|