@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,10 @@
|
|
|
1
|
+
import { DocumentNode } from "@apollo/client";
|
|
2
|
+
//#region src/sdk/graphql-tag.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Tagged template that parses a GraphQL string into a DocumentNode
|
|
5
|
+
* without `loc` properties, so the result is a plain serializable object
|
|
6
|
+
* safe to pass from Server Components to Client Components.
|
|
7
|
+
*/
|
|
8
|
+
export declare function gql(literals: TemplateStringsArray, ...args: unknown[]): DocumentNode;
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=graphql-tag.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parse, print } from "graphql";
|
|
2
|
+
//#region src/sdk/graphql-tag.ts
|
|
3
|
+
/**
|
|
4
|
+
* Tagged template that parses a GraphQL string into a DocumentNode
|
|
5
|
+
* without `loc` properties, so the result is a plain serializable object
|
|
6
|
+
* safe to pass from Server Components to Client Components.
|
|
7
|
+
*/
|
|
8
|
+
function gql(literals, ...args) {
|
|
9
|
+
let result = literals[0] ?? "";
|
|
10
|
+
for (let i = 0; i < args.length; i++) {
|
|
11
|
+
const arg = args[i];
|
|
12
|
+
if (arg && typeof arg === "object" && "kind" in arg && arg.kind === "Document") result += print(arg);
|
|
13
|
+
else result += String(arg);
|
|
14
|
+
result += literals[i + 1] ?? "";
|
|
15
|
+
}
|
|
16
|
+
return JSON.parse(JSON.stringify(parse(result, { noLocation: true })));
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { gql };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=graphql-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-tag.js","names":[],"sources":["../../src/sdk/graphql-tag.ts"],"sourcesContent":["import type { DocumentNode } from '@apollo/client';\nimport { parse, print } from 'graphql';\n\n/**\n * Tagged template that parses a GraphQL string into a DocumentNode\n * without `loc` properties, so the result is a plain serializable object\n * safe to pass from Server Components to Client Components.\n */\nexport function gql(literals: TemplateStringsArray, ...args: unknown[]): DocumentNode {\n let result = literals[0] ?? '';\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg && typeof arg === 'object' && 'kind' in arg && arg.kind === 'Document') {\n result += print(arg as DocumentNode);\n } else {\n result += String(arg);\n }\n result += literals[i + 1] ?? '';\n }\n\n return JSON.parse(JSON.stringify(parse(result, { noLocation: true }))) as DocumentNode;\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,IAAI,UAAgC,GAAG,MAA+B;CACpF,IAAI,SAAS,SAAS,MAAM;CAE5B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,MAAM,KAAK;EACjB,IAAI,OAAO,OAAO,QAAQ,YAAY,UAAU,OAAO,IAAI,SAAS,YAClE,UAAU,MAAM,GAAmB;OAEnC,UAAU,OAAO,GAAG;EAEtB,UAAU,SAAS,IAAI,MAAM;CAC/B;CAEA,OAAO,KAAK,MAAM,KAAK,UAAU,MAAM,QAAQ,EAAE,YAAY,KAAK,CAAC,CAAC,CAAC;AACvE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _exports from "./messages/en-US.json.js";
|
|
2
|
+
//#region src/sdk/i18n/locales.d.ts
|
|
3
|
+
/** The resolved record a render formats against: what crosses the RSC boundary and what `IntlProvider` takes. */
|
|
4
|
+
export type Messages = Readonly<Record<string, string>>;
|
|
5
|
+
/** Every id in the source catalog. Exported for the `Record<string, MessageId>` escape hatch. */
|
|
6
|
+
export type MessageId = keyof typeof _exports;
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/sdk/i18n/locales.ts
|
|
2
|
+
/** The locales this package ships a catalog for. */
|
|
3
|
+
const SUPPORTED_LOCALES = [
|
|
4
|
+
"en-US",
|
|
5
|
+
"es-ES",
|
|
6
|
+
"pt-BR"
|
|
7
|
+
];
|
|
8
|
+
/** The hand-authored source catalog and the implicit floor of every fallback chain. */
|
|
9
|
+
const DEFAULT_LOCALE = "en-US";
|
|
10
|
+
/** Locale tag → catalog loader. An explicit table, never string formatting. */
|
|
11
|
+
const CATALOG_FILES = Object.freeze({
|
|
12
|
+
"en-US": () => import("./messages/en-US.js").then((module) => module.default),
|
|
13
|
+
"es-ES": () => import("./messages/es-ES.js").then((module) => module.default),
|
|
14
|
+
"pt-BR": () => import("./messages/pt-BR.js").then((module) => module.default)
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* The supported locale a tag names, matched against the table's keys case-insensitively.
|
|
18
|
+
* `undefined` for anything else — no truncation, no language-only fallback.
|
|
19
|
+
*/
|
|
20
|
+
function normalizeLocale(tag) {
|
|
21
|
+
const wanted = tag.toLowerCase();
|
|
22
|
+
return SUPPORTED_LOCALES.find((locale) => locale.toLowerCase() === wanted);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The merged record as `react-intl` types it.
|
|
26
|
+
*
|
|
27
|
+
* The id augmentation in `intl.d.ts` makes `messages` require *every* id in the union, which a
|
|
28
|
+
* record merged from up to four catalogs cannot prove structurally — and typing `Messages` by the
|
|
29
|
+
* union instead would push the same gap out to every caller that serializes it. What actually holds
|
|
30
|
+
* is Invariant 4: `loadMessages` merges the source catalog underneath every chain, and
|
|
31
|
+
* `locales.test.ts` asserts the result is a superset of its keys for every supported locale. This is
|
|
32
|
+
* the one place that gap is crossed.
|
|
33
|
+
*
|
|
34
|
+
* An assertion and never a copy: `IntlProvider` compares `messages` by reference to decide whether
|
|
35
|
+
* to rebuild `intl`, so handing it a fresh object would invalidate every `useIntl()` in the tree on
|
|
36
|
+
* each render of the provider above it.
|
|
37
|
+
*/
|
|
38
|
+
function asIntlMessages(messages) {
|
|
39
|
+
return messages;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* How both entries answer a formatting error.
|
|
43
|
+
*
|
|
44
|
+
* A missing id is impossible — the id union rejects one at `pnpm typecheck` — and a missing
|
|
45
|
+
* translation is the build warning's business, not a shopper's console. What is left is a malformed
|
|
46
|
+
* ICU string from a translator, which the parity test already fails CI over. Logging it in
|
|
47
|
+
* development keeps it findable while a catalog is being edited; staying silent in production keeps
|
|
48
|
+
* a shopper's console clean.
|
|
49
|
+
*/
|
|
50
|
+
function onIntlError(error) {
|
|
51
|
+
if (process.env.NODE_ENV === "production") return;
|
|
52
|
+
console.error(error);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { CATALOG_FILES, DEFAULT_LOCALE, SUPPORTED_LOCALES, asIntlMessages, normalizeLocale, onIntlError };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=locales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.js","names":[],"sources":["../../../src/sdk/i18n/locales.ts"],"sourcesContent":["/**\n * The message catalogs this package ships, and the table that finds one.\n *\n * ## Adding a key\n *\n * Every id is prefixed `fs/` and uses at most three dot-separated levels after the prefix, in one of\n * two tiers: generic (`fs/a11y.*`, `fs/action.*`, `fs/error.*`) or `domain.area.leaf`\n * (`fs/shipping.estimate.in-hours`). **A component name never appears in a key.**\n *\n * Crowdin treats a renamed key as a new string and orphans its translations, and component names are\n * the most-renamed thing in this repository — a component moving between `particles/` and `matter/`,\n * being absorbed, or being renamed would force a choice between a lying key and paying for\n * retranslation. Domain names are more stable. The `fs/` prefix earns nothing mechanically today; it\n * buys the option of a second catalog owner later, and adding it afterwards costs a retranslation.\n *\n * Add the key to `messages/en-US.json` — the hand-authored source, never a build artifact — and the\n * id union picks it up. The translated catalogs follow through Crowdin; the package build warns about\n * the gap and does not fail on it.\n *\n * ## Adding a locale\n *\n * Three edits, all in this directory: the JSON file, a `SUPPORTED_LOCALES` entry, a `CATALOG_FILES`\n * entry. Never derive a filename from a locale tag by concatenation or truncation — the filename\n * Crowdin writes is decided by the Crowdin project's language mapping, not by anything here, and a\n * computed path that misses falls through to the default locale with HTTP 200. The table plus\n * `locales.test.ts` is what makes a disagreement loud.\n */\nimport type enUS from './messages/en-US.json';\n\n/** The resolved record a render formats against: what crosses the RSC boundary and what `IntlProvider` takes. */\nexport type Messages = Readonly<Record<string, string>>;\n\n/** Every id in the source catalog. Exported for the `Record<string, MessageId>` escape hatch. */\nexport type MessageId = keyof typeof enUS;\n\n/** The locales this package ships a catalog for. */\nexport const SUPPORTED_LOCALES = ['en-US', 'es-ES', 'pt-BR'] as const;\n\nexport type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];\n\n/** The hand-authored source catalog and the implicit floor of every fallback chain. */\nexport const DEFAULT_LOCALE: SupportedLocale = 'en-US';\n\n/** Locale tag → catalog loader. An explicit table, never string formatting. */\nexport const CATALOG_FILES: Readonly<Record<SupportedLocale, () => Promise<Messages>>> = Object.freeze({\n 'en-US': () => import('./messages/en-US.json').then((module) => module.default),\n 'es-ES': () => import('./messages/es-ES.json').then((module) => module.default),\n 'pt-BR': () => import('./messages/pt-BR.json').then((module) => module.default),\n});\n\n/**\n * The supported locale a tag names, matched against the table's keys case-insensitively.\n * `undefined` for anything else — no truncation, no language-only fallback.\n */\nexport function normalizeLocale(tag: string): SupportedLocale | undefined {\n const wanted = tag.toLowerCase();\n return SUPPORTED_LOCALES.find((locale) => locale.toLowerCase() === wanted);\n}\n\n/**\n * The merged record as `react-intl` types it.\n *\n * The id augmentation in `intl.d.ts` makes `messages` require *every* id in the union, which a\n * record merged from up to four catalogs cannot prove structurally — and typing `Messages` by the\n * union instead would push the same gap out to every caller that serializes it. What actually holds\n * is Invariant 4: `loadMessages` merges the source catalog underneath every chain, and\n * `locales.test.ts` asserts the result is a superset of its keys for every supported locale. This is\n * the one place that gap is crossed.\n *\n * An assertion and never a copy: `IntlProvider` compares `messages` by reference to decide whether\n * to rebuild `intl`, so handing it a fresh object would invalidate every `useIntl()` in the tree on\n * each render of the provider above it.\n */\nexport function asIntlMessages(messages: Messages): Record<MessageId, string> {\n return messages as Record<MessageId, string>;\n}\n\n/**\n * How both entries answer a formatting error.\n *\n * A missing id is impossible — the id union rejects one at `pnpm typecheck` — and a missing\n * translation is the build warning's business, not a shopper's console. What is left is a malformed\n * ICU string from a translator, which the parity test already fails CI over. Logging it in\n * development keeps it findable while a catalog is being edited; staying silent in production keeps\n * a shopper's console clean.\n */\nexport function onIntlError(error: Error): void {\n if (process.env.NODE_ENV === 'production') return;\n console.error(error);\n}\n"],"mappings":";;AAoCA,MAAa,oBAAoB;CAAC;CAAS;CAAS;AAAO;;AAK3D,MAAa,iBAAkC;;AAG/C,MAAa,gBAA4E,OAAO,OAAO;CACrG,eAAe,OAAO,sBAAwB,CAAC,MAAM,WAAW,OAAO,OAAO;CAC9E,eAAe,OAAO,sBAAwB,CAAC,MAAM,WAAW,OAAO,OAAO;CAC9E,eAAe,OAAO,sBAAwB,CAAC,MAAM,WAAW,OAAO,OAAO;AAChF,CAAC;;;;;AAMD,SAAgB,gBAAgB,KAA0C;CACxE,MAAM,SAAS,IAAI,YAAY;CAC/B,OAAO,kBAAkB,MAAM,WAAW,OAAO,YAAY,MAAM,MAAM;AAC3E;;;;;;;;;;;;;;;AAgBA,SAAgB,eAAe,UAA+C;CAC5E,OAAO;AACT;;;;;;;;;;AAWA,SAAgB,YAAY,OAAoB;CAC9C,IAAI,QAAQ,IAAI,aAAa,cAAc;CAC3C,QAAQ,MAAM,KAAK;AACrB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/sdk/i18n/messages/en-US.json
|
|
2
|
+
var en_US_default = {
|
|
3
|
+
"fs/a11y.close": "Close",
|
|
4
|
+
"fs/region.error.invalid-postal-code": "Enter a valid postal code.",
|
|
5
|
+
"fs/region.error.network": "Unable to set your region. Please try again.",
|
|
6
|
+
"fs/region.error.unserved-postal-code": "We do not deliver to this postal code yet.",
|
|
7
|
+
"fs/route.not-found": "Page not found",
|
|
8
|
+
"fs/shipping.calculating": "Calculating…",
|
|
9
|
+
"fs/shipping.calculation-failed": "Unable to calculate shipping. Try again.",
|
|
10
|
+
"fs/shipping.estimate.in-business-days": "in {days, plural, one {# business day} other {# business days}}",
|
|
11
|
+
"fs/shipping.estimate.in-days": "in {days, plural, one {# day} other {# days}}",
|
|
12
|
+
"fs/shipping.estimate.in-hours": "in {hours, plural, one {# hour} other {# hours}}",
|
|
13
|
+
"fs/shipping.estimate.in-minutes": "in {minutes, plural, one {# minute} other {# minutes}}",
|
|
14
|
+
"fs/shipping.estimate.today": "arrives today",
|
|
15
|
+
"fs/shipping.free-badge": "Free shipping",
|
|
16
|
+
"fs/shipping.free-price": "Free",
|
|
17
|
+
"fs/shipping.no-options": "No delivery options available for this address.",
|
|
18
|
+
"fs/shipping.postal-code.aria-label": "Postal code",
|
|
19
|
+
"fs/shipping.postal-code.placeholder": "Enter your postal code"
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { en_US_default as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=en-US.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-US.js","names":[],"sources":["../../../../src/sdk/i18n/messages/en-US.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fs/a11y.close": "Close",
|
|
3
|
+
"fs/region.error.invalid-postal-code": "Enter a valid postal code.",
|
|
4
|
+
"fs/region.error.network": "Unable to set your region. Please try again.",
|
|
5
|
+
"fs/region.error.unserved-postal-code": "We do not deliver to this postal code yet.",
|
|
6
|
+
"fs/route.not-found": "Page not found",
|
|
7
|
+
"fs/shipping.calculating": "Calculating…",
|
|
8
|
+
"fs/shipping.calculation-failed": "Unable to calculate shipping. Try again.",
|
|
9
|
+
"fs/shipping.estimate.in-business-days": "in {days, plural, one {# business day} other {# business days}}",
|
|
10
|
+
"fs/shipping.estimate.in-days": "in {days, plural, one {# day} other {# days}}",
|
|
11
|
+
"fs/shipping.estimate.in-hours": "in {hours, plural, one {# hour} other {# hours}}",
|
|
12
|
+
"fs/shipping.estimate.in-minutes": "in {minutes, plural, one {# minute} other {# minutes}}",
|
|
13
|
+
"fs/shipping.estimate.today": "arrives today",
|
|
14
|
+
"fs/shipping.free-badge": "Free shipping",
|
|
15
|
+
"fs/shipping.free-price": "Free",
|
|
16
|
+
"fs/shipping.no-options": "No delivery options available for this address.",
|
|
17
|
+
"fs/shipping.postal-code.aria-label": "Postal code",
|
|
18
|
+
"fs/shipping.postal-code.placeholder": "Enter your postal code"
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/sdk/i18n/messages/en-US.json.d.ts
|
|
2
|
+
declare const _exports: {
|
|
3
|
+
"fs/a11y.close": string;
|
|
4
|
+
"fs/region.error.invalid-postal-code": string;
|
|
5
|
+
"fs/region.error.network": string;
|
|
6
|
+
"fs/region.error.unserved-postal-code": string;
|
|
7
|
+
"fs/route.not-found": string;
|
|
8
|
+
"fs/shipping.calculating": string;
|
|
9
|
+
"fs/shipping.calculation-failed": string;
|
|
10
|
+
"fs/shipping.estimate.in-business-days": string;
|
|
11
|
+
"fs/shipping.estimate.in-days": string;
|
|
12
|
+
"fs/shipping.estimate.in-hours": string;
|
|
13
|
+
"fs/shipping.estimate.in-minutes": string;
|
|
14
|
+
"fs/shipping.estimate.today": string;
|
|
15
|
+
"fs/shipping.free-badge": string;
|
|
16
|
+
"fs/shipping.free-price": string;
|
|
17
|
+
"fs/shipping.no-options": string;
|
|
18
|
+
"fs/shipping.postal-code.aria-label": string;
|
|
19
|
+
"fs/shipping.postal-code.placeholder": string;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { _exports as default };
|
|
23
|
+
//# sourceMappingURL=en-US.json.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/sdk/i18n/messages/es-ES.json
|
|
2
|
+
var es_ES_default = {
|
|
3
|
+
"fs/a11y.close": "Cerrar",
|
|
4
|
+
"fs/region.error.invalid-postal-code": "Introduce un código postal válido.",
|
|
5
|
+
"fs/region.error.network": "No se pudo definir tu región. Inténtalo de nuevo.",
|
|
6
|
+
"fs/region.error.unserved-postal-code": "Todavía no hacemos entregas en este código postal.",
|
|
7
|
+
"fs/route.not-found": "Página no encontrada",
|
|
8
|
+
"fs/shipping.calculating": "Calculando…",
|
|
9
|
+
"fs/shipping.calculation-failed": "No se pudo calcular el envío. Inténtalo de nuevo.",
|
|
10
|
+
"fs/shipping.estimate.in-business-days": "en {days, plural, one {# día hábil} other {# días hábiles}}",
|
|
11
|
+
"fs/shipping.estimate.in-days": "en {days, plural, one {# día} other {# días}}",
|
|
12
|
+
"fs/shipping.estimate.in-hours": "en {hours, plural, one {# hora} other {# horas}}",
|
|
13
|
+
"fs/shipping.estimate.in-minutes": "en {minutes, plural, one {# minuto} other {# minutos}}",
|
|
14
|
+
"fs/shipping.estimate.today": "llega hoy",
|
|
15
|
+
"fs/shipping.free-badge": "Envío gratis",
|
|
16
|
+
"fs/shipping.free-price": "Gratis",
|
|
17
|
+
"fs/shipping.no-options": "No hay opciones de entrega disponibles para esta dirección.",
|
|
18
|
+
"fs/shipping.postal-code.aria-label": "Código postal",
|
|
19
|
+
"fs/shipping.postal-code.placeholder": "Introduce tu código postal"
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { es_ES_default as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=es-ES.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"es-ES.js","names":[],"sources":["../../../../src/sdk/i18n/messages/es-ES.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fs/a11y.close": "Cerrar",
|
|
3
|
+
"fs/region.error.invalid-postal-code": "Introduce un código postal válido.",
|
|
4
|
+
"fs/region.error.network": "No se pudo definir tu región. Inténtalo de nuevo.",
|
|
5
|
+
"fs/region.error.unserved-postal-code": "Todavía no hacemos entregas en este código postal.",
|
|
6
|
+
"fs/route.not-found": "Página no encontrada",
|
|
7
|
+
"fs/shipping.calculating": "Calculando…",
|
|
8
|
+
"fs/shipping.calculation-failed": "No se pudo calcular el envío. Inténtalo de nuevo.",
|
|
9
|
+
"fs/shipping.estimate.in-business-days": "en {days, plural, one {# día hábil} other {# días hábiles}}",
|
|
10
|
+
"fs/shipping.estimate.in-days": "en {days, plural, one {# día} other {# días}}",
|
|
11
|
+
"fs/shipping.estimate.in-hours": "en {hours, plural, one {# hora} other {# horas}}",
|
|
12
|
+
"fs/shipping.estimate.in-minutes": "en {minutes, plural, one {# minuto} other {# minutos}}",
|
|
13
|
+
"fs/shipping.estimate.today": "llega hoy",
|
|
14
|
+
"fs/shipping.free-badge": "Envío gratis",
|
|
15
|
+
"fs/shipping.free-price": "Gratis",
|
|
16
|
+
"fs/shipping.no-options": "No hay opciones de entrega disponibles para esta dirección.",
|
|
17
|
+
"fs/shipping.postal-code.aria-label": "Código postal",
|
|
18
|
+
"fs/shipping.postal-code.placeholder": "Introduce tu código postal"
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/sdk/i18n/messages/pt-BR.json
|
|
2
|
+
var pt_BR_default = {
|
|
3
|
+
"fs/a11y.close": "Fechar",
|
|
4
|
+
"fs/region.error.invalid-postal-code": "Informe um CEP válido.",
|
|
5
|
+
"fs/region.error.network": "Não foi possível definir sua região. Tente novamente.",
|
|
6
|
+
"fs/region.error.unserved-postal-code": "Ainda não entregamos neste CEP.",
|
|
7
|
+
"fs/route.not-found": "Página não encontrada",
|
|
8
|
+
"fs/shipping.calculating": "Calculando…",
|
|
9
|
+
"fs/shipping.calculation-failed": "Não foi possível calcular o frete. Tente novamente.",
|
|
10
|
+
"fs/shipping.estimate.in-business-days": "em {days, plural, one {# dia útil} other {# dias úteis}}",
|
|
11
|
+
"fs/shipping.estimate.in-days": "em {days, plural, one {# dia} other {# dias}}",
|
|
12
|
+
"fs/shipping.estimate.in-hours": "em {hours, plural, one {# hora} other {# horas}}",
|
|
13
|
+
"fs/shipping.estimate.in-minutes": "em {minutes, plural, one {# minuto} other {# minutos}}",
|
|
14
|
+
"fs/shipping.estimate.today": "vai ser entregue hoje",
|
|
15
|
+
"fs/shipping.free-badge": "Frete grátis",
|
|
16
|
+
"fs/shipping.free-price": "Grátis",
|
|
17
|
+
"fs/shipping.no-options": "Nenhuma opção de entrega disponível para este endereço.",
|
|
18
|
+
"fs/shipping.postal-code.aria-label": "CEP",
|
|
19
|
+
"fs/shipping.postal-code.placeholder": "Digite seu CEP"
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { pt_BR_default as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=pt-BR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pt-BR.js","names":[],"sources":["../../../../src/sdk/i18n/messages/pt-BR.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fs/a11y.close": "Fechar",
|
|
3
|
+
"fs/region.error.invalid-postal-code": "Informe um CEP válido.",
|
|
4
|
+
"fs/region.error.network": "Não foi possível definir sua região. Tente novamente.",
|
|
5
|
+
"fs/region.error.unserved-postal-code": "Ainda não entregamos neste CEP.",
|
|
6
|
+
"fs/route.not-found": "Página não encontrada",
|
|
7
|
+
"fs/shipping.calculating": "Calculando…",
|
|
8
|
+
"fs/shipping.calculation-failed": "Não foi possível calcular o frete. Tente novamente.",
|
|
9
|
+
"fs/shipping.estimate.in-business-days": "em {days, plural, one {# dia útil} other {# dias úteis}}",
|
|
10
|
+
"fs/shipping.estimate.in-days": "em {days, plural, one {# dia} other {# dias}}",
|
|
11
|
+
"fs/shipping.estimate.in-hours": "em {hours, plural, one {# hora} other {# horas}}",
|
|
12
|
+
"fs/shipping.estimate.in-minutes": "em {minutes, plural, one {# minuto} other {# minutos}}",
|
|
13
|
+
"fs/shipping.estimate.today": "vai ser entregue hoje",
|
|
14
|
+
"fs/shipping.free-badge": "Frete grátis",
|
|
15
|
+
"fs/shipping.free-price": "Grátis",
|
|
16
|
+
"fs/shipping.no-options": "Nenhuma opção de entrega disponível para este endereço.",
|
|
17
|
+
"fs/shipping.postal-code.aria-label": "CEP",
|
|
18
|
+
"fs/shipping.postal-code.placeholder": "Digite seu CEP"
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DEFAULT_LOCALE, asIntlMessages, normalizeLocale, onIntlError } from "./locales.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { IntlProvider } from "react-intl";
|
|
5
|
+
//#region src/sdk/i18n/provider.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Mounted by `StorefrontProvider`, never by a store.
|
|
8
|
+
*
|
|
9
|
+
* The record arrives already resolved: the server merged the locale's catalog over the fallback
|
|
10
|
+
* chain `global.json` declares, so SSR and hydration read the same bytes and only one locale reaches
|
|
11
|
+
* the browser.
|
|
12
|
+
*
|
|
13
|
+
* The tag is normalized for the same reason `getIntl` normalizes it: when no catalog ships for the
|
|
14
|
+
* declared locale the strings rendered are the source catalog's, and plural categories have to be
|
|
15
|
+
* selected under the language those strings are written in. Without it a Server Component and a
|
|
16
|
+
* Client Component could pluralize the same English string under different rules.
|
|
17
|
+
*/
|
|
18
|
+
function MessageProvider({ locale, messages, children }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(IntlProvider, {
|
|
20
|
+
locale: normalizeLocale(locale) ?? "en-US",
|
|
21
|
+
defaultLocale: DEFAULT_LOCALE,
|
|
22
|
+
messages: asIntlMessages(messages),
|
|
23
|
+
onError: onIntlError,
|
|
24
|
+
children
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { MessageProvider };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../../src/sdk/i18n/provider.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { IntlProvider } from 'react-intl';\nimport { asIntlMessages, DEFAULT_LOCALE, type Messages, normalizeLocale, onIntlError } from './locales.js';\n\nexport type MessageProviderProps = Readonly<{\n locale: string;\n messages: Messages;\n children: ReactNode;\n}>;\n\n/**\n * Mounted by `StorefrontProvider`, never by a store.\n *\n * The record arrives already resolved: the server merged the locale's catalog over the fallback\n * chain `global.json` declares, so SSR and hydration read the same bytes and only one locale reaches\n * the browser.\n *\n * The tag is normalized for the same reason `getIntl` normalizes it: when no catalog ships for the\n * declared locale the strings rendered are the source catalog's, and plural categories have to be\n * selected under the language those strings are written in. Without it a Server Component and a\n * Client Component could pluralize the same English string under different rules.\n */\nexport function MessageProvider({ locale, messages, children }: MessageProviderProps) {\n return (\n <IntlProvider\n locale={normalizeLocale(locale) ?? DEFAULT_LOCALE}\n defaultLocale={DEFAULT_LOCALE}\n messages={asIntlMessages(messages)}\n onError={onIntlError}\n >\n {children}\n </IntlProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,SAAgB,gBAAgB,EAAE,QAAQ,UAAU,YAAkC;CACpF,OACE,oBAAC,cAAD;EACE,QAAQ,gBAAgB,MAAM,KAAA;EAC9B,eAAe;EACf,UAAU,eAAe,QAAQ;EACjC,SAAS;EAER;CACW,CAAA;AAElB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { StorefrontContext } from "../../core/dist/schema/generated/schema.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { Messages } from "./locales.js";
|
|
4
|
+
import { IntlShape } from "react-intl/server";
|
|
5
|
+
//#region src/sdk/i18n/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The messages a locale renders with: the locale's own catalog over each fallback in `chain`, over
|
|
8
|
+
* the source catalog.
|
|
9
|
+
*
|
|
10
|
+
* The chain comes from `global.localization.locales[*].fallback`, nearest first, which the compiler
|
|
11
|
+
* emits as `localeFallbacks`. The source catalog is merged underneath it always: it is the only
|
|
12
|
+
* catalog guaranteed to hold every id in the union, so the result is a superset of its keys and a
|
|
13
|
+
* raw id is unrenderable. An unsupported tag resolves to the source catalog and warns once.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadMessages(locale: string, chain?: readonly string[]): Promise<Messages>;
|
|
16
|
+
/**
|
|
17
|
+
* An `IntlShape` for a Server Component or any non-React code — no React context involved.
|
|
18
|
+
*
|
|
19
|
+
* The `locale` handed to `createIntl` is the one whose catalog was actually loaded, not the one the
|
|
20
|
+
* context declared. They differ when the context carries a locale no catalog ships, which
|
|
21
|
+
* `loadMessages` resolves to the source catalog: passing the declared tag would then select plural
|
|
22
|
+
* categories for a language the strings are not written in — `{count, plural, …}` in English text
|
|
23
|
+
* evaluated under, say, French rules. `loadMessages` still receives the declared tag, so the
|
|
24
|
+
* unsupported-locale warning it emits is unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getIntl(context: StorefrontContext, chain?: readonly string[]): Promise<IntlShape>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CATALOG_FILES, DEFAULT_LOCALE, SUPPORTED_LOCALES, asIntlMessages, normalizeLocale, onIntlError } from "./locales.js";
|
|
2
|
+
import { createIntl, createIntlCache } from "react-intl/server";
|
|
3
|
+
//#region src/sdk/i18n/server.ts
|
|
4
|
+
/** Tags already warned about, so an unsupported binding does not warn once per render. */
|
|
5
|
+
const warnedTags = /* @__PURE__ */ new Set();
|
|
6
|
+
async function catalogFor(tag) {
|
|
7
|
+
const supported = normalizeLocale(tag);
|
|
8
|
+
return supported ? CATALOG_FILES[supported]() : void 0;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The messages a locale renders with: the locale's own catalog over each fallback in `chain`, over
|
|
12
|
+
* the source catalog.
|
|
13
|
+
*
|
|
14
|
+
* The chain comes from `global.localization.locales[*].fallback`, nearest first, which the compiler
|
|
15
|
+
* emits as `localeFallbacks`. The source catalog is merged underneath it always: it is the only
|
|
16
|
+
* catalog guaranteed to hold every id in the union, so the result is a superset of its keys and a
|
|
17
|
+
* raw id is unrenderable. An unsupported tag resolves to the source catalog and warns once.
|
|
18
|
+
*/
|
|
19
|
+
async function loadMessages(locale, chain = []) {
|
|
20
|
+
const supported = normalizeLocale(locale);
|
|
21
|
+
if (!supported && !warnedTags.has(locale)) {
|
|
22
|
+
warnedTags.add(locale);
|
|
23
|
+
console.warn(`loadMessages: no message catalog ships for locale ${JSON.stringify(locale)}, rendering ${DEFAULT_LOCALE} instead. @vtex/faststore ships: ${SUPPORTED_LOCALES.join(", ")}.`);
|
|
24
|
+
}
|
|
25
|
+
const order = [
|
|
26
|
+
DEFAULT_LOCALE,
|
|
27
|
+
...[...chain].reverse(),
|
|
28
|
+
...supported ? [supported] : []
|
|
29
|
+
];
|
|
30
|
+
const merged = Object.create(null);
|
|
31
|
+
for (const tag of order) {
|
|
32
|
+
const catalog = await catalogFor(tag);
|
|
33
|
+
if (catalog) Object.assign(merged, catalog);
|
|
34
|
+
}
|
|
35
|
+
return Object.freeze({ ...merged });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An `IntlShape` for a Server Component or any non-React code — no React context involved.
|
|
39
|
+
*
|
|
40
|
+
* The `locale` handed to `createIntl` is the one whose catalog was actually loaded, not the one the
|
|
41
|
+
* context declared. They differ when the context carries a locale no catalog ships, which
|
|
42
|
+
* `loadMessages` resolves to the source catalog: passing the declared tag would then select plural
|
|
43
|
+
* categories for a language the strings are not written in — `{count, plural, …}` in English text
|
|
44
|
+
* evaluated under, say, French rules. `loadMessages` still receives the declared tag, so the
|
|
45
|
+
* unsupported-locale warning it emits is unchanged.
|
|
46
|
+
*/
|
|
47
|
+
async function getIntl(context, chain) {
|
|
48
|
+
const messages = await loadMessages(context.locale, chain);
|
|
49
|
+
return createIntl({
|
|
50
|
+
locale: normalizeLocale(context.locale) ?? "en-US",
|
|
51
|
+
defaultLocale: DEFAULT_LOCALE,
|
|
52
|
+
messages: asIntlMessages(messages),
|
|
53
|
+
onError: onIntlError
|
|
54
|
+
}, createIntlCache());
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { getIntl, loadMessages };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","names":[],"sources":["../../../src/sdk/i18n/server.ts"],"sourcesContent":["import type { StorefrontContext } from '@vtex/fs-core';\nimport { createIntl, createIntlCache, type IntlShape } from 'react-intl/server';\nimport {\n asIntlMessages,\n CATALOG_FILES,\n DEFAULT_LOCALE,\n type Messages,\n normalizeLocale,\n onIntlError,\n SUPPORTED_LOCALES,\n} from './locales.js';\n\n/** Tags already warned about, so an unsupported binding does not warn once per render. */\nconst warnedTags = new Set<string>();\n\nasync function catalogFor(tag: string): Promise<Messages | undefined> {\n const supported = normalizeLocale(tag);\n return supported ? CATALOG_FILES[supported]() : undefined;\n}\n\n/**\n * The messages a locale renders with: the locale's own catalog over each fallback in `chain`, over\n * the source catalog.\n *\n * The chain comes from `global.localization.locales[*].fallback`, nearest first, which the compiler\n * emits as `localeFallbacks`. The source catalog is merged underneath it always: it is the only\n * catalog guaranteed to hold every id in the union, so the result is a superset of its keys and a\n * raw id is unrenderable. An unsupported tag resolves to the source catalog and warns once.\n */\nexport async function loadMessages(locale: string, chain: readonly string[] = []): Promise<Messages> {\n const supported = normalizeLocale(locale);\n\n if (!supported && !warnedTags.has(locale)) {\n warnedTags.add(locale);\n console.warn(\n `loadMessages: no message catalog ships for locale ${JSON.stringify(locale)}, rendering ` +\n `${DEFAULT_LOCALE} instead. @vtex/faststore ships: ${SUPPORTED_LOCALES.join(', ')}.`,\n );\n }\n\n // Farthest source first, so every nearer one overwrites it: the source catalog, then the declared\n // chain reversed, then the locale's own catalog last.\n const order = [DEFAULT_LOCALE, ...[...chain].reverse(), ...(supported ? [supported] : [])];\n\n // A null-prototype target, because `Object.assign` onto a plain object treats a `\"__proto__\"` key\n // as a setter: a catalog carrying one would swap the prototype instead of adding a message, and\n // the value would be invisible to `Object.keys`. The merge has to be additive for every key a\n // translator can produce.\n const merged: Record<string, string> = Object.create(null);\n for (const tag of order) {\n const catalog = await catalogFor(tag);\n if (catalog) Object.assign(merged, catalog);\n }\n // This crosses into `StorefrontProvider`'s `messages` prop — a Server Component (the generated root\n // layout) handing it to a `'use client'` component — and React's Flight serializer rejects a\n // null-prototype record (\"Classes or null prototypes are not supported\"). Copy onto a plain object\n // literal now that every `Object.assign` above is done: object spread copies via\n // `CreateDataPropertyOrThrow`, never the `[[Set]]` a `\"__proto__\"` key would hijack, so it still\n // lands as an ordinary own property, exactly as it did in `merged`.\n return Object.freeze({ ...merged });\n}\n\n/**\n * An `IntlShape` for a Server Component or any non-React code — no React context involved.\n *\n * The `locale` handed to `createIntl` is the one whose catalog was actually loaded, not the one the\n * context declared. They differ when the context carries a locale no catalog ships, which\n * `loadMessages` resolves to the source catalog: passing the declared tag would then select plural\n * categories for a language the strings are not written in — `{count, plural, …}` in English text\n * evaluated under, say, French rules. `loadMessages` still receives the declared tag, so the\n * unsupported-locale warning it emits is unchanged.\n */\nexport async function getIntl(context: StorefrontContext, chain?: readonly string[]): Promise<IntlShape> {\n const messages = await loadMessages(context.locale, chain);\n return createIntl(\n {\n locale: normalizeLocale(context.locale) ?? DEFAULT_LOCALE,\n defaultLocale: DEFAULT_LOCALE,\n messages: asIntlMessages(messages),\n onError: onIntlError,\n },\n createIntlCache(),\n );\n}\n"],"mappings":";;;;AAaA,MAAM,6BAAa,IAAI,IAAY;AAEnC,eAAe,WAAW,KAA4C;CACpE,MAAM,YAAY,gBAAgB,GAAG;CACrC,OAAO,YAAY,cAAc,UAAU,CAAC,IAAI,KAAA;AAClD;;;;;;;;;;AAWA,eAAsB,aAAa,QAAgB,QAA2B,CAAC,GAAsB;CACnG,MAAM,YAAY,gBAAgB,MAAM;CAExC,IAAI,CAAC,aAAa,CAAC,WAAW,IAAI,MAAM,GAAG;EACzC,WAAW,IAAI,MAAM;EACrB,QAAQ,KACN,qDAAqD,KAAK,UAAU,MAAM,EAAE,cACvE,eAAe,mCAAmC,kBAAkB,KAAK,IAAI,EAAE,EACtF;CACF;CAIA,MAAM,QAAQ;EAAC;EAAgB,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ;EAAG,GAAI,YAAY,CAAC,SAAS,IAAI,CAAC;CAAE;CAMzF,MAAM,SAAiC,OAAO,OAAO,IAAI;CACzD,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,UAAU,MAAM,WAAW,GAAG;EACpC,IAAI,SAAS,OAAO,OAAO,QAAQ,OAAO;CAC5C;CAOA,OAAO,OAAO,OAAO,EAAE,GAAG,OAAO,CAAC;AACpC;;;;;;;;;;;AAYA,eAAsB,QAAQ,SAA4B,OAA+C;CACvG,MAAM,WAAW,MAAM,aAAa,QAAQ,QAAQ,KAAK;CACzD,OAAO,WACL;EACE,QAAQ,gBAAgB,QAAQ,MAAM,KAAA;EACtC,eAAe;EACf,UAAU,eAAe,QAAQ;EACjC,SAAS;CACX,GACA,gBAAgB,CAClB;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TypedDocumentNode } from "@apollo/client";
|
|
2
|
+
//#region src/sdk/identity/operations.d.ts
|
|
3
|
+
/** A single domain error returned by `clientProfileUpdate` (`ClientProfileUpdateError`). */
|
|
4
|
+
export type ClientProfileUserError = Readonly<{
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}>;
|
|
8
|
+
/** The two opt-in fields, keyed exactly as the GraphQL `ClientPreferences` type / input. */
|
|
9
|
+
export type ClientPreferenceKey = 'optinNewsLetter' | 'savePersonalData';
|
|
10
|
+
/**
|
|
11
|
+
* A single write failure. `code` is a string rather than the server enum because the action adds
|
|
12
|
+
* two client-originated codes — `NETWORK_ERROR` and `UNAUTHORIZED` — to the server's set.
|
|
13
|
+
*/
|
|
14
|
+
export type CustomerProfileUserError = Readonly<{
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Partial profile input — mirrors the schema's `CustomerProfileUpdateInput` verbatim. An omitted
|
|
20
|
+
* field is left untouched upstream; an empty string is an explicit erase. `email` is absent by
|
|
21
|
+
* construction: it is the login identifier and is not writable.
|
|
22
|
+
*/
|
|
23
|
+
export type CustomerProfileUpdateInput = Readonly<{
|
|
24
|
+
firstName?: string;
|
|
25
|
+
lastName?: string;
|
|
26
|
+
homePhone?: string;
|
|
27
|
+
mobilePhone?: string;
|
|
28
|
+
document?: string;
|
|
29
|
+
documentType?: string;
|
|
30
|
+
birthDate?: string;
|
|
31
|
+
gender?: string;
|
|
32
|
+
}>;
|
|
33
|
+
//#endregion
|
|
34
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { gql } from "../graphql-tag.js";
|
|
2
|
+
//#region src/sdk/identity/operations.ts
|
|
3
|
+
const CLIENT_PROFILE_UPDATE = gql`
|
|
4
|
+
mutation ClientProfileUpdate($input: ClientProfileUpdateInput!) {
|
|
5
|
+
clientProfileUpdate(input: $input) {
|
|
6
|
+
__typename
|
|
7
|
+
clientProfile {
|
|
8
|
+
__typename
|
|
9
|
+
id
|
|
10
|
+
email
|
|
11
|
+
firstName
|
|
12
|
+
lastName
|
|
13
|
+
document
|
|
14
|
+
phone
|
|
15
|
+
}
|
|
16
|
+
session {
|
|
17
|
+
__typename
|
|
18
|
+
id
|
|
19
|
+
loggedIn
|
|
20
|
+
canEditData
|
|
21
|
+
isIdentified
|
|
22
|
+
}
|
|
23
|
+
userErrors {
|
|
24
|
+
code
|
|
25
|
+
message
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const CLIENT_PREFERENCES_UPDATE = gql`
|
|
31
|
+
mutation ClientPreferencesUpdate($input: ClientPreferencesUpdateInput!) {
|
|
32
|
+
clientPreferencesUpdate(input: $input) {
|
|
33
|
+
__typename
|
|
34
|
+
clientPreferences {
|
|
35
|
+
__typename
|
|
36
|
+
id
|
|
37
|
+
optinNewsLetter
|
|
38
|
+
savePersonalData
|
|
39
|
+
}
|
|
40
|
+
userErrors {
|
|
41
|
+
code
|
|
42
|
+
message
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
/**
|
|
48
|
+
* Selects the whole entity, not just the written fields: the normalized cache is what re-delivers
|
|
49
|
+
* the new values to the profile Root, so a partial selection would leave it holding stale ones.
|
|
50
|
+
*/
|
|
51
|
+
const CUSTOMER_PROFILE_UPDATE = gql`
|
|
52
|
+
mutation CustomerProfileUpdate($input: CustomerProfileUpdateInput!) {
|
|
53
|
+
customerProfileUpdate(input: $input) {
|
|
54
|
+
__typename
|
|
55
|
+
customerProfile {
|
|
56
|
+
__typename
|
|
57
|
+
id
|
|
58
|
+
firstName
|
|
59
|
+
lastName
|
|
60
|
+
email
|
|
61
|
+
homePhone
|
|
62
|
+
mobilePhone
|
|
63
|
+
document
|
|
64
|
+
documentType
|
|
65
|
+
birthDate
|
|
66
|
+
gender
|
|
67
|
+
}
|
|
68
|
+
userErrors {
|
|
69
|
+
code
|
|
70
|
+
message
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { CLIENT_PREFERENCES_UPDATE, CLIENT_PROFILE_UPDATE, CUSTOMER_PROFILE_UPDATE };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","names":[],"sources":["../../../src/sdk/identity/operations.ts"],"sourcesContent":["import type { TypedDocumentNode } from '@apollo/client';\nimport { gql } from '../graphql-tag.js';\n\n/**\n * Identity (client-profile / client-preferences / customer-profile) GraphQL operations\n * (specs/fspg-859-email-field.md, specs/consent-opt-in-component.md,\n * specs/sfs-3286-customer-profile-update-action.md).\n *\n * The first two writes reuse the EXISTING `clientProfileUpdate` / `clientPreferencesUpdate` mutations — partial\n * writes that touch only the fields they are given. `EmailIdentificationControl` sends `{ email }`\n * through `clientProfileUpdate` (flipping `Session.isIdentified`); the consent opt-in Controls send one\n * flag through `clientPreferencesUpdate`. Both live on the User Identity sibling entities of `Cart`,\n * not nested under it.\n *\n * `customerProfileUpdate` is the account-scoped counterpart: it persists to the shopper's saved\n * profile with no cart in play, keyed server-side off the session.\n *\n * Authored with the serializable `gql` tag (not the codegen `graphql()` factory) and explicitly\n * excluded from the codegen `documents` glob (see `codegen.ts`) — the `gql` tag alone is still\n * plucked by `graphql-codegen`, which would duplicate these hand-written types in `sdk/generated/`.\n * The identity writes do not need generated types and stay hand-typed `TypedDocumentNode`s,\n * mirroring how the ShippingSimulator matter authors its raw fragment.\n */\n\n// ---------------------------------------------------------------------------\n// Domain types — mirror the existing checkout schema\n// ---------------------------------------------------------------------------\n\n/** The ClientProfile slice returned by the mutation: the identity-step fields plus the Node identity keys. */\nexport type ClientProfileEntity = Readonly<{\n __typename?: 'ClientProfile';\n id: string;\n email: string | null;\n firstName: string | null;\n lastName: string | null;\n document: string | null;\n phone: string | null;\n}>;\n\n/** A single domain error returned by `clientProfileUpdate` (`ClientProfileUpdateError`). */\nexport type ClientProfileUserError = Readonly<{ code: string; message: string }>;\n\n/** Partial profile input — mirrors the schema's `ClientProfileUpdateInput`; omitted fields are left untouched. */\nexport type ClientProfileUpdateInput = Readonly<{\n email?: string;\n firstName?: string;\n lastName?: string;\n phone?: string;\n document?: string;\n}>;\n\n/** The Session slice returned alongside the profile — lets Apollo's normalized cache flip\n * `useSession()`'s isIdentified reactively, with no separate refetch. */\nexport type ClientProfileUpdateSessionEntity = Readonly<{\n __typename?: 'Session';\n id: string;\n loggedIn: boolean;\n canEditData: boolean;\n isIdentified: boolean;\n}>;\n\nexport type ClientProfileUpdateMutation = {\n clientProfileUpdate: {\n __typename?: 'ClientProfileUpdatePayload';\n clientProfile: ClientProfileEntity | null;\n session: ClientProfileUpdateSessionEntity | null;\n userErrors: ClientProfileUserError[];\n };\n};\n\nexport type ClientProfileUpdateMutationVariables = {\n input: ClientProfileUpdateInput;\n};\n\n// ---------------------------------------------------------------------------\n// Mutation operation\n// ---------------------------------------------------------------------------\n\nexport const CLIENT_PROFILE_UPDATE: TypedDocumentNode<\n ClientProfileUpdateMutation,\n ClientProfileUpdateMutationVariables\n> = gql`\n mutation ClientProfileUpdate($input: ClientProfileUpdateInput!) {\n clientProfileUpdate(input: $input) {\n __typename\n clientProfile {\n __typename\n id\n email\n firstName\n lastName\n document\n phone\n }\n session {\n __typename\n id\n loggedIn\n canEditData\n isIdentified\n }\n userErrors {\n code\n message\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Client preferences (consent opt-ins) — mirror the profile write\n// ---------------------------------------------------------------------------\n\n/** The ClientPreferences slice this feature reads/writes: the two opt-in flags plus the Node key. */\nexport type ClientPreferencesEntity = Readonly<{\n __typename?: 'ClientPreferences';\n id: string;\n optinNewsLetter: boolean | null;\n savePersonalData: boolean | null;\n}>;\n\n/** The two opt-in fields, keyed exactly as the GraphQL `ClientPreferences` type / input. */\nexport type ClientPreferenceKey = 'optinNewsLetter' | 'savePersonalData';\n\n/** Partial preferences input — a Control sends ONE flag; omitted flags are left untouched. */\nexport type ClientPreferencesUpdateInput = Readonly<Partial<Record<ClientPreferenceKey, boolean>>>;\n\nexport type ClientPreferencesUpdateMutation = {\n clientPreferencesUpdate: {\n __typename?: 'ClientPreferencesUpdatePayload';\n clientPreferences: ClientPreferencesEntity | null;\n userErrors: ClientProfileUserError[];\n };\n};\n\nexport type ClientPreferencesUpdateMutationVariables = {\n input: ClientPreferencesUpdateInput;\n};\n\nexport const CLIENT_PREFERENCES_UPDATE: TypedDocumentNode<\n ClientPreferencesUpdateMutation,\n ClientPreferencesUpdateMutationVariables\n> = gql`\n mutation ClientPreferencesUpdate($input: ClientPreferencesUpdateInput!) {\n clientPreferencesUpdate(input: $input) {\n __typename\n clientPreferences {\n __typename\n id\n optinNewsLetter\n savePersonalData\n }\n userErrors {\n code\n message\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Persistent shopper profile — account-scoped, not the cart projection above\n// ---------------------------------------------------------------------------\n\n/** The CustomerProfile slice the mutation returns: every readable field plus the cache key. */\nexport type CustomerProfileEntity = Readonly<{\n __typename?: 'CustomerProfile';\n id: string;\n firstName: string | null;\n lastName: string | null;\n email: string | null;\n homePhone: string | null;\n mobilePhone: string | null;\n document: string | null;\n documentType: string | null;\n birthDate: string | null;\n gender: string | null;\n}>;\n\n/**\n * A single write failure. `code` is a string rather than the server enum because the action adds\n * two client-originated codes — `NETWORK_ERROR` and `UNAUTHORIZED` — to the server's set.\n */\nexport type CustomerProfileUserError = Readonly<{ code: string; message: string }>;\n\n/**\n * Partial profile input — mirrors the schema's `CustomerProfileUpdateInput` verbatim. An omitted\n * field is left untouched upstream; an empty string is an explicit erase. `email` is absent by\n * construction: it is the login identifier and is not writable.\n */\nexport type CustomerProfileUpdateInput = Readonly<{\n firstName?: string;\n lastName?: string;\n homePhone?: string;\n mobilePhone?: string;\n document?: string;\n documentType?: string;\n birthDate?: string;\n gender?: string;\n}>;\n\nexport type CustomerProfileUpdateMutation = {\n customerProfileUpdate: {\n __typename?: 'CustomerProfileUpdatePayload';\n customerProfile: CustomerProfileEntity;\n userErrors: CustomerProfileUserError[];\n };\n};\n\nexport type CustomerProfileUpdateMutationVariables = {\n input: CustomerProfileUpdateInput;\n};\n\n/**\n * Selects the whole entity, not just the written fields: the normalized cache is what re-delivers\n * the new values to the profile Root, so a partial selection would leave it holding stale ones.\n */\nexport const CUSTOMER_PROFILE_UPDATE: TypedDocumentNode<\n CustomerProfileUpdateMutation,\n CustomerProfileUpdateMutationVariables\n> = gql`\n mutation CustomerProfileUpdate($input: CustomerProfileUpdateInput!) {\n customerProfileUpdate(input: $input) {\n __typename\n customerProfile {\n __typename\n id\n firstName\n lastName\n email\n homePhone\n mobilePhone\n document\n documentType\n birthDate\n gender\n }\n userErrors {\n code\n message\n }\n }\n }\n`;\n"],"mappings":";;AA8EA,MAAa,wBAGT,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DP,MAAa,4BAGT,GAAG;;;;;;;;;;;;;;;;;;;;;AA2EP,MAAa,0BAGT,GAAG"}
|