@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,19 @@
|
|
|
1
|
+
import { ActionProviderProps } from "./inject-actions.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/sdk/actions/cart-action-provider.d.ts
|
|
4
|
+
export type CartActionProviderProps = ActionProviderProps;
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `cart` action namespace — the write-side mirror of
|
|
7
|
+
* `ReactiveDataProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { cart: [...] }` with `<CartActionProvider methods={[...]}>`, calls `useCartActions`
|
|
9
|
+
* once, narrows the surface to the declared `methods`, and threads it into the single child via
|
|
10
|
+
* `$actions.cart` (merging with any outer namespace provider). A namespace a component does not
|
|
11
|
+
* declare is never wrapped, so its hook is never called (specs/actions.md FR-6).
|
|
12
|
+
*
|
|
13
|
+
* It injects `$actions` as a prop (cloneElement) rather than a context so the contract matches
|
|
14
|
+
* `$data`: components destructure `$actions` from props and stay directly testable with `mockAction`.
|
|
15
|
+
* That makes the child's shape load-bearing — see `injectActions`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function CartActionProvider(props: CartActionProviderProps): ReactNode;
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=cart-action-provider.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCartActions } from "../cart/use-cart-actions.js";
|
|
3
|
+
import { injectActions } from "./inject-actions.js";
|
|
4
|
+
//#region src/sdk/actions/cart-action-provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `cart` action namespace — the write-side mirror of
|
|
7
|
+
* `ReactiveDataProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { cart: [...] }` with `<CartActionProvider methods={[...]}>`, calls `useCartActions`
|
|
9
|
+
* once, narrows the surface to the declared `methods`, and threads it into the single child via
|
|
10
|
+
* `$actions.cart` (merging with any outer namespace provider). A namespace a component does not
|
|
11
|
+
* declare is never wrapped, so its hook is never called (specs/actions.md FR-6).
|
|
12
|
+
*
|
|
13
|
+
* It injects `$actions` as a prop (cloneElement) rather than a context so the contract matches
|
|
14
|
+
* `$data`: components destructure `$actions` from props and stay directly testable with `mockAction`.
|
|
15
|
+
* That makes the child's shape load-bearing — see `injectActions`.
|
|
16
|
+
*/
|
|
17
|
+
function CartActionProvider(props) {
|
|
18
|
+
return injectActions("cart", useCartActions(), props);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { CartActionProvider };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=cart-action-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-action-provider.js","names":[],"sources":["../../../src/sdk/actions/cart-action-provider.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useCartActions } from '../cart/use-cart-actions.js';\nimport { type ActionProviderProps, injectActions } from './inject-actions.js';\n\nexport type CartActionProviderProps = ActionProviderProps;\n\n/**\n * Compiler-emitted runtime wrapper for the `cart` action namespace — the write-side mirror of\n * `ReactiveDataProvider`. The compiler wraps every element whose definition declares\n * `actions: { cart: [...] }` with `<CartActionProvider methods={[...]}>`, calls `useCartActions`\n * once, narrows the surface to the declared `methods`, and threads it into the single child via\n * `$actions.cart` (merging with any outer namespace provider). A namespace a component does not\n * declare is never wrapped, so its hook is never called (specs/actions.md FR-6).\n *\n * It injects `$actions` as a prop (cloneElement) rather than a context so the contract matches\n * `$data`: components destructure `$actions` from props and stay directly testable with `mockAction`.\n * That makes the child's shape load-bearing — see `injectActions`.\n */\nexport function CartActionProvider(props: CartActionProviderProps): ReactNode {\n return injectActions('cart', useCartActions(), props);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,SAAgB,mBAAmB,OAA2C;CAC5E,OAAO,cAAc,QAAQ,eAAe,GAAG,KAAK;AACtD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionProviderProps } from "./inject-actions.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/sdk/actions/identity-action-provider.d.ts
|
|
4
|
+
export type IdentityActionProviderProps = ActionProviderProps;
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `identity` action namespace — the write-side mirror of
|
|
7
|
+
* `ReactiveDataProvider`, structurally identical to `CartActionProvider`. The compiler wraps every
|
|
8
|
+
* element whose definition declares `actions: { identity: [...] }` with
|
|
9
|
+
* `<IdentityActionProvider methods={[...]}>`, calls `useIdentityActions` once, narrows the surface to
|
|
10
|
+
* the declared `methods`, and threads it into the single child via `$actions.identity` (merging with
|
|
11
|
+
* any outer namespace provider).
|
|
12
|
+
*/
|
|
13
|
+
export declare function IdentityActionProvider(props: IdentityActionProviderProps): ReactNode;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=identity-action-provider.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { injectActions } from "./inject-actions.js";
|
|
3
|
+
import { useIdentityActions } from "../identity/use-identity-actions.js";
|
|
4
|
+
//#region src/sdk/actions/identity-action-provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `identity` action namespace — the write-side mirror of
|
|
7
|
+
* `ReactiveDataProvider`, structurally identical to `CartActionProvider`. The compiler wraps every
|
|
8
|
+
* element whose definition declares `actions: { identity: [...] }` with
|
|
9
|
+
* `<IdentityActionProvider methods={[...]}>`, calls `useIdentityActions` once, narrows the surface to
|
|
10
|
+
* the declared `methods`, and threads it into the single child via `$actions.identity` (merging with
|
|
11
|
+
* any outer namespace provider).
|
|
12
|
+
*/
|
|
13
|
+
function IdentityActionProvider(props) {
|
|
14
|
+
return injectActions("identity", useIdentityActions(), props);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { IdentityActionProvider };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=identity-action-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-action-provider.js","names":[],"sources":["../../../src/sdk/actions/identity-action-provider.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useIdentityActions } from '../identity/use-identity-actions.js';\nimport { type ActionProviderProps, injectActions } from './inject-actions.js';\n\nexport type IdentityActionProviderProps = ActionProviderProps;\n\n/**\n * Compiler-emitted runtime wrapper for the `identity` action namespace — the write-side mirror of\n * `ReactiveDataProvider`, structurally identical to `CartActionProvider`. The compiler wraps every\n * element whose definition declares `actions: { identity: [...] }` with\n * `<IdentityActionProvider methods={[...]}>`, calls `useIdentityActions` once, narrows the surface to\n * the declared `methods`, and threads it into the single child via `$actions.identity` (merging with\n * any outer namespace provider).\n */\nexport function IdentityActionProvider(props: IdentityActionProviderProps): ReactNode {\n return injectActions('identity', useIdentityActions(), props);\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,uBAAuB,OAA+C;CACpF,OAAO,cAAc,YAAY,mBAAmB,GAAG,KAAK;AAC9D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentActions } from "./types.js";
|
|
2
|
+
import { CartActionProvider, CartActionProviderProps } from "./cart-action-provider.js";
|
|
3
|
+
import { IdentityActionProvider, IdentityActionProviderProps } from "./identity-action-provider.js";
|
|
4
|
+
import { RegionActionProvider, RegionActionProviderProps } from "./region-action-provider.js";
|
|
5
|
+
import { SessionActionProvider, SessionActionProviderProps } from "./session-action-provider.js";
|
|
6
|
+
import { ShippingActionProvider, ShippingActionProviderProps } from "./shipping-action-provider.js";
|
|
7
|
+
export { CartActionProvider, type CartActionProviderProps, IdentityActionProvider, type IdentityActionProviderProps, RegionActionProvider, type RegionActionProviderProps, SessionActionProvider, type SessionActionProviderProps, ShippingActionProvider, type ShippingActionProviderProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CartActionProvider } from "./cart-action-provider.js";
|
|
2
|
+
import { IdentityActionProvider } from "./identity-action-provider.js";
|
|
3
|
+
import { RegionActionProvider } from "./region-action-provider.js";
|
|
4
|
+
import { SessionActionProvider } from "./session-action-provider.js";
|
|
5
|
+
import { ShippingActionProvider } from "./shipping-action-provider.js";
|
|
6
|
+
export { CartActionProvider, IdentityActionProvider, RegionActionProvider, SessionActionProvider, ShippingActionProvider };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/sdk/actions/inject-actions.d.ts
|
|
3
|
+
/** Props every compiler-emitted action provider takes, plus whatever an outer wrapper injected. */
|
|
4
|
+
export type ActionProviderProps = Readonly<{
|
|
5
|
+
/** Method names the consuming component declared under `actions: { <namespace>: [...] }`. */
|
|
6
|
+
methods: readonly string[];
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Injected by the content boundary when the consumer also declares a content model. */
|
|
9
|
+
$content?: Record<string, unknown>;
|
|
10
|
+
/** Injected by another namespace's provider when the consumer declares more than one. */
|
|
11
|
+
$actions?: Record<string, Record<string, unknown>>;
|
|
12
|
+
}>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=inject-actions.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cloneElement, isValidElement } from "react";
|
|
3
|
+
//#region src/sdk/actions/inject-actions.tsx
|
|
4
|
+
/**
|
|
5
|
+
* The shared body of every action provider: narrow the namespace surface to the declared `methods`
|
|
6
|
+
* and clone it onto the single child as `$actions.<namespace>`.
|
|
7
|
+
*
|
|
8
|
+
* A provider is transparent, so it forwards what an outer wrapper injected onto *it* rather than
|
|
9
|
+
* consuming it: `$content` from the content boundary, and the namespaces of an outer provider when
|
|
10
|
+
* the consumer declares more than one. Reading `$actions` off the child as well keeps a child that
|
|
11
|
+
* already carries some (a hand-authored tree, `mockAction` in a test) working.
|
|
12
|
+
*/
|
|
13
|
+
function injectActions(namespace, surface, { methods, children, $content, $actions }) {
|
|
14
|
+
if (!isValidElement(children)) return children;
|
|
15
|
+
const selected = {};
|
|
16
|
+
for (const method of methods) {
|
|
17
|
+
const handler = surface[method];
|
|
18
|
+
if (typeof handler === "function") selected[method] = handler;
|
|
19
|
+
}
|
|
20
|
+
const child = children;
|
|
21
|
+
const inherited = {
|
|
22
|
+
...child.props.$actions,
|
|
23
|
+
...$actions
|
|
24
|
+
};
|
|
25
|
+
return cloneElement(child, {
|
|
26
|
+
...$content === void 0 ? {} : { $content },
|
|
27
|
+
$actions: {
|
|
28
|
+
...inherited,
|
|
29
|
+
[namespace]: selected
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { injectActions };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=inject-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-actions.js","names":[],"sources":["../../../src/sdk/actions/inject-actions.tsx"],"sourcesContent":["'use client';\n\nimport { cloneElement, isValidElement, type ReactElement, type ReactNode } from 'react';\n\n/** Props every compiler-emitted action provider takes, plus whatever an outer wrapper injected. */\nexport type ActionProviderProps = Readonly<{\n /** Method names the consuming component declared under `actions: { <namespace>: [...] }`. */\n methods: readonly string[];\n children: ReactNode;\n /** Injected by the content boundary when the consumer also declares a content model. */\n $content?: Record<string, unknown>;\n /** Injected by another namespace's provider when the consumer declares more than one. */\n $actions?: Record<string, Record<string, unknown>>;\n}>;\n\ntype InjectedProps = Pick<ActionProviderProps, '$content' | '$actions'>;\n\n/**\n * The shared body of every action provider: narrow the namespace surface to the declared `methods`\n * and clone it onto the single child as `$actions.<namespace>`.\n *\n * A provider is transparent, so it forwards what an outer wrapper injected onto *it* rather than\n * consuming it: `$content` from the content boundary, and the namespaces of an outer provider when\n * the consumer declares more than one. Reading `$actions` off the child as well keeps a child that\n * already carries some (a hand-authored tree, `mockAction` in a test) working.\n */\nexport function injectActions(\n namespace: string,\n surface: Record<string, unknown>,\n { methods, children, $content, $actions }: ActionProviderProps,\n): ReactNode {\n if (!isValidElement(children)) return children;\n\n const selected: Record<string, unknown> = {};\n for (const method of methods) {\n const handler = surface[method];\n if (typeof handler === 'function') selected[method] = handler;\n }\n\n const child = children as ReactElement<InjectedProps>;\n const inherited = { ...child.props.$actions, ...$actions };\n return cloneElement(child, {\n ...($content === undefined ? {} : { $content }),\n $actions: { ...inherited, [namespace]: selected },\n });\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAgB,cACd,WACA,SACA,EAAE,SAAS,UAAU,UAAU,YACpB;CACX,IAAI,CAAC,eAAe,QAAQ,GAAG,OAAO;CAEtC,MAAM,WAAoC,CAAC;CAC3C,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,UAAU,QAAQ;EACxB,IAAI,OAAO,YAAY,YAAY,SAAS,UAAU;CACxD;CAEA,MAAM,QAAQ;CACd,MAAM,YAAY;EAAE,GAAG,MAAM,MAAM;EAAU,GAAG;CAAS;CACzD,OAAO,aAAa,OAAO;EACzB,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS;EAC7C,UAAU;GAAE,GAAG;IAAY,YAAY;EAAS;CAClD,CAAC;AACH"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionProviderProps } from "./inject-actions.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/sdk/actions/region-action-provider.d.ts
|
|
4
|
+
export type RegionActionProviderProps = ActionProviderProps;
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `region` action namespace — a line-for-line mirror of
|
|
7
|
+
* `SessionActionProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { region: [...] }` with `<RegionActionProvider methods={[...]}>`, calls `useRegionActions`
|
|
9
|
+
* once, narrows the surface to the declared `methods`, and threads it into the single child via
|
|
10
|
+
* `$actions.region` (merging with any outer namespace provider). A namespace a component does not
|
|
11
|
+
* declare is never wrapped, so its hook is never called.
|
|
12
|
+
*/
|
|
13
|
+
export declare function RegionActionProvider(props: RegionActionProviderProps): ReactNode;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=region-action-provider.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { injectActions } from "./inject-actions.js";
|
|
3
|
+
import { useRegionActions } from "../region/use-region-actions.js";
|
|
4
|
+
//#region src/sdk/actions/region-action-provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `region` action namespace — a line-for-line mirror of
|
|
7
|
+
* `SessionActionProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { region: [...] }` with `<RegionActionProvider methods={[...]}>`, calls `useRegionActions`
|
|
9
|
+
* once, narrows the surface to the declared `methods`, and threads it into the single child via
|
|
10
|
+
* `$actions.region` (merging with any outer namespace provider). A namespace a component does not
|
|
11
|
+
* declare is never wrapped, so its hook is never called.
|
|
12
|
+
*/
|
|
13
|
+
function RegionActionProvider(props) {
|
|
14
|
+
return injectActions("region", useRegionActions(), props);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { RegionActionProvider };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=region-action-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region-action-provider.js","names":[],"sources":["../../../src/sdk/actions/region-action-provider.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useRegionActions } from '../region/use-region-actions.js';\nimport { type ActionProviderProps, injectActions } from './inject-actions.js';\n\nexport type RegionActionProviderProps = ActionProviderProps;\n\n/**\n * Compiler-emitted runtime wrapper for the `region` action namespace — a line-for-line mirror of\n * `SessionActionProvider`. The compiler wraps every element whose definition declares\n * `actions: { region: [...] }` with `<RegionActionProvider methods={[...]}>`, calls `useRegionActions`\n * once, narrows the surface to the declared `methods`, and threads it into the single child via\n * `$actions.region` (merging with any outer namespace provider). A namespace a component does not\n * declare is never wrapped, so its hook is never called.\n */\nexport function RegionActionProvider(props: RegionActionProviderProps): ReactNode {\n return injectActions('region', useRegionActions(), props);\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,qBAAqB,OAA6C;CAChF,OAAO,cAAc,UAAU,iBAAiB,GAAG,KAAK;AAC1D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionProviderProps } from "./inject-actions.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/sdk/actions/session-action-provider.d.ts
|
|
4
|
+
export type SessionActionProviderProps = ActionProviderProps;
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `session` action namespace — a line-for-line mirror of
|
|
7
|
+
* `CartActionProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { session: [...] }` with `<SessionActionProvider methods={[...]}>`, calls
|
|
9
|
+
* `useSessionActions` once, narrows the surface to the declared `methods`, and threads it into the
|
|
10
|
+
* single child via `$actions.session` (merging with any outer namespace provider). A namespace a
|
|
11
|
+
* component does not declare is never wrapped, so its hook is never called (specs/actions.md FR-6).
|
|
12
|
+
*/
|
|
13
|
+
export declare function SessionActionProvider(props: SessionActionProviderProps): ReactNode;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=session-action-provider.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { injectActions } from "./inject-actions.js";
|
|
3
|
+
import { useSessionActions } from "../session/use-session-actions.js";
|
|
4
|
+
//#region src/sdk/actions/session-action-provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `session` action namespace — a line-for-line mirror of
|
|
7
|
+
* `CartActionProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { session: [...] }` with `<SessionActionProvider methods={[...]}>`, calls
|
|
9
|
+
* `useSessionActions` once, narrows the surface to the declared `methods`, and threads it into the
|
|
10
|
+
* single child via `$actions.session` (merging with any outer namespace provider). A namespace a
|
|
11
|
+
* component does not declare is never wrapped, so its hook is never called (specs/actions.md FR-6).
|
|
12
|
+
*/
|
|
13
|
+
function SessionActionProvider(props) {
|
|
14
|
+
return injectActions("session", useSessionActions(), props);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SessionActionProvider };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=session-action-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-action-provider.js","names":[],"sources":["../../../src/sdk/actions/session-action-provider.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useSessionActions } from '../session/use-session-actions.js';\nimport { type ActionProviderProps, injectActions } from './inject-actions.js';\n\nexport type SessionActionProviderProps = ActionProviderProps;\n\n/**\n * Compiler-emitted runtime wrapper for the `session` action namespace — a line-for-line mirror of\n * `CartActionProvider`. The compiler wraps every element whose definition declares\n * `actions: { session: [...] }` with `<SessionActionProvider methods={[...]}>`, calls\n * `useSessionActions` once, narrows the surface to the declared `methods`, and threads it into the\n * single child via `$actions.session` (merging with any outer namespace provider). A namespace a\n * component does not declare is never wrapped, so its hook is never called (specs/actions.md FR-6).\n */\nexport function SessionActionProvider(props: SessionActionProviderProps): ReactNode {\n return injectActions('session', useSessionActions(), props);\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,sBAAsB,OAA8C;CAClF,OAAO,cAAc,WAAW,kBAAkB,GAAG,KAAK;AAC5D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionProviderProps } from "./inject-actions.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/sdk/actions/shipping-action-provider.d.ts
|
|
4
|
+
export type ShippingActionProviderProps = ActionProviderProps;
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `shipping` action namespace — a line-for-line mirror of
|
|
7
|
+
* `SessionActionProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { shipping: [...] }` with `<ShippingActionProvider methods={[...]}>`, calls
|
|
9
|
+
* `useShippingActions` once, narrows the surface to the declared `methods`, and threads it into the
|
|
10
|
+
* single child via `$actions.shipping` (merging with any outer namespace provider). A namespace a
|
|
11
|
+
* component does not declare is never wrapped, so its hook is never called (specs/actions.md FR-6).
|
|
12
|
+
*/
|
|
13
|
+
export declare function ShippingActionProvider(props: ShippingActionProviderProps): ReactNode;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=shipping-action-provider.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { injectActions } from "./inject-actions.js";
|
|
3
|
+
import { useShippingActions } from "../shipping/use-shipping-actions.js";
|
|
4
|
+
//#region src/sdk/actions/shipping-action-provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Compiler-emitted runtime wrapper for the `shipping` action namespace — a line-for-line mirror of
|
|
7
|
+
* `SessionActionProvider`. The compiler wraps every element whose definition declares
|
|
8
|
+
* `actions: { shipping: [...] }` with `<ShippingActionProvider methods={[...]}>`, calls
|
|
9
|
+
* `useShippingActions` once, narrows the surface to the declared `methods`, and threads it into the
|
|
10
|
+
* single child via `$actions.shipping` (merging with any outer namespace provider). A namespace a
|
|
11
|
+
* component does not declare is never wrapped, so its hook is never called (specs/actions.md FR-6).
|
|
12
|
+
*/
|
|
13
|
+
function ShippingActionProvider(props) {
|
|
14
|
+
return injectActions("shipping", useShippingActions(), props);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ShippingActionProvider };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=shipping-action-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shipping-action-provider.js","names":[],"sources":["../../../src/sdk/actions/shipping-action-provider.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useShippingActions } from '../shipping/use-shipping-actions.js';\nimport { type ActionProviderProps, injectActions } from './inject-actions.js';\n\nexport type ShippingActionProviderProps = ActionProviderProps;\n\n/**\n * Compiler-emitted runtime wrapper for the `shipping` action namespace — a line-for-line mirror of\n * `SessionActionProvider`. The compiler wraps every element whose definition declares\n * `actions: { shipping: [...] }` with `<ShippingActionProvider methods={[...]}>`, calls\n * `useShippingActions` once, narrows the surface to the declared `methods`, and threads it into the\n * single child via `$actions.shipping` (merging with any outer namespace provider). A namespace a\n * component does not declare is never wrapped, so its hook is never called (specs/actions.md FR-6).\n */\nexport function ShippingActionProvider(props: ShippingActionProviderProps): ReactNode {\n return injectActions('shipping', useShippingActions(), props);\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,uBAAuB,OAA+C;CACpF,OAAO,cAAc,YAAY,mBAAmB,GAAG,KAAK;AAC9D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CartActions } from "../cart/use-cart-actions.js";
|
|
2
|
+
import { IdentityActions } from "../identity/use-identity-actions.js";
|
|
3
|
+
import { RegionActions } from "../region/use-region-actions.js";
|
|
4
|
+
import { SessionActions } from "../session/use-session-actions.js";
|
|
5
|
+
import { ShippingActions } from "../shipping/use-shipping-actions.js";
|
|
6
|
+
//#region src/sdk/actions/types.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The `$actions` prop the compiler injects (and `mockAction` builds for tests). Each namespace is
|
|
9
|
+
* optional and each method is optional within it, because a component only receives the methods it
|
|
10
|
+
* declared under `actions: { ... }`. Ships the `cart`, `identity`, `region`, `session`, and
|
|
11
|
+
* `shipping` namespaces.
|
|
12
|
+
*/
|
|
13
|
+
export type ComponentActions = {
|
|
14
|
+
cart?: Partial<CartActions>;
|
|
15
|
+
identity?: Partial<IdentityActions>;
|
|
16
|
+
region?: Partial<RegionActions>;
|
|
17
|
+
session?: Partial<SessionActions>;
|
|
18
|
+
shipping?: Partial<ShippingActions>;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { possibleTypes } from "../generated/fragment-types.js";
|
|
2
|
+
import { InMemoryCache } from "@apollo/client";
|
|
3
|
+
//#region src/sdk/cache/storefront-cache.ts
|
|
4
|
+
/**
|
|
5
|
+
* Per-entity normalization and field-merge rules for the Storefront cache.
|
|
6
|
+
*
|
|
7
|
+
* Empty in T1. Domain entries (Product, Cart, OrderForm, …) arrive with the
|
|
8
|
+
* particles that need them — see specs/shared-apollo-sdk-surface.md,
|
|
9
|
+
* "Out of Scope".
|
|
10
|
+
*/
|
|
11
|
+
const typePolicies = {};
|
|
12
|
+
/**
|
|
13
|
+
* The single source of truth for InMemoryCache configuration. Both the
|
|
14
|
+
* server-side `createClient` and the client-side `StorefrontProvider`
|
|
15
|
+
* consume this so SSR and CSR normalize entities identically.
|
|
16
|
+
*/
|
|
17
|
+
function getCacheConfig() {
|
|
18
|
+
return {
|
|
19
|
+
typePolicies,
|
|
20
|
+
possibleTypes
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The only place an `InMemoryCache` is constructed on the server path.
|
|
25
|
+
* The client-side provider builds its cache from `getCacheConfig()` so the
|
|
26
|
+
* config is shared verbatim without coupling to a specific InMemoryCache
|
|
27
|
+
* subclass (the Next.js integration ships its own SSR-aware variant).
|
|
28
|
+
*/
|
|
29
|
+
function buildCache() {
|
|
30
|
+
return new InMemoryCache(getCacheConfig());
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { buildCache, getCacheConfig, possibleTypes, typePolicies };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=storefront-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storefront-cache.js","names":[],"sources":["../../../src/sdk/cache/storefront-cache.ts"],"sourcesContent":["import { InMemoryCache, type InMemoryCacheConfig, type TypePolicies } from '@apollo/client';\nimport { possibleTypes } from '../generated/fragment-types.js';\n\n/**\n * Per-entity normalization and field-merge rules for the Storefront cache.\n *\n * Empty in T1. Domain entries (Product, Cart, OrderForm, …) arrive with the\n * particles that need them — see specs/shared-apollo-sdk-surface.md,\n * \"Out of Scope\".\n */\nexport const typePolicies: TypePolicies = {};\n\nexport { possibleTypes };\n\n/**\n * The single source of truth for InMemoryCache configuration. Both the\n * server-side `createClient` and the client-side `StorefrontProvider`\n * consume this so SSR and CSR normalize entities identically.\n */\nexport function getCacheConfig(): InMemoryCacheConfig {\n return {\n typePolicies,\n possibleTypes,\n };\n}\n\n/**\n * The only place an `InMemoryCache` is constructed on the server path.\n * The client-side provider builds its cache from `getCacheConfig()` so the\n * config is shared verbatim without coupling to a specific InMemoryCache\n * subclass (the Next.js integration ships its own SSR-aware variant).\n */\nexport function buildCache(): InMemoryCache {\n return new InMemoryCache(getCacheConfig());\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,eAA6B,CAAC;;;;;;AAS3C,SAAgB,iBAAsC;CACpD,OAAO;EACL;EACA;CACF;AACF;;;;;;;AAQA,SAAgB,aAA4B;CAC1C,OAAO,IAAI,cAAc,eAAe,CAAC;AAC3C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CartFragmentFragment, CartItemFragmentFragment, CartItemQuantityDecreaseMutation, CartItemQuantityIncreaseMutation, CartItemRemoveMutation, MoneyFragmentFragment } from "../generated/graphql.js";
|
|
2
|
+
import "./operations.js";
|
|
3
|
+
import { TypedDocumentNode } from "@apollo/client";
|
|
4
|
+
//#region src/sdk/cart/operations.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Cart-related GraphQL operations and shared fragments (T6 / specs/mutation-contract.md).
|
|
7
|
+
*
|
|
8
|
+
* The `CartFragment` is the canonical Cart selection set: every mutation operation spreads it so
|
|
9
|
+
* the cache normalisation reaches every reactive subscriber (CartTotal, CartCount, CartItems, …)
|
|
10
|
+
* through a single response. The contract regression test (`contract.test.ts`) parses these
|
|
11
|
+
* documents and asserts the spread is present — see specs/mutation-contract.md AD-D3 / AD-8.
|
|
12
|
+
*
|
|
13
|
+
* T7 ([specs/graphql-codegen-pipeline.md][T7]) routes the domain types and the operation factory
|
|
14
|
+
* through @graphql-codegen. Public type names (`CartEntity`, `CartItemEntity`, `Money`, payload
|
|
15
|
+
* + input aliases) are preserved as re-exports / aliases so consumer call sites do not change.
|
|
16
|
+
*
|
|
17
|
+
* [T7]: ../../../../../specs/graphql-codegen-pipeline.md
|
|
18
|
+
*/
|
|
19
|
+
export type Money = MoneyFragmentFragment;
|
|
20
|
+
export type CartItemEntity = CartItemFragmentFragment;
|
|
21
|
+
export type CartEntity = CartFragmentFragment;
|
|
22
|
+
export type CartTotalizer = CartFragmentFragment['totalizers'][number];
|
|
23
|
+
export type CartUserError = Readonly<{
|
|
24
|
+
code: string;
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
export type CartItemRemovePayload = CartItemRemoveMutation['cartItemRemove'];
|
|
28
|
+
export type CartItemQuantityIncreasePayload = CartItemQuantityIncreaseMutation['cartItemQuantityIncrease'];
|
|
29
|
+
export type CartItemQuantityDecreasePayload = CartItemQuantityDecreaseMutation['cartItemQuantityDecrease'];
|
|
30
|
+
//#endregion
|
|
31
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { graphql } from "../generated/gql.js";
|
|
2
|
+
graphql(`
|
|
3
|
+
fragment MoneyFragment on Money {
|
|
4
|
+
__typename
|
|
5
|
+
amount
|
|
6
|
+
currencyCode
|
|
7
|
+
}
|
|
8
|
+
`);
|
|
9
|
+
graphql(`
|
|
10
|
+
fragment CartItemFragment on CartItem {
|
|
11
|
+
__typename
|
|
12
|
+
id
|
|
13
|
+
quantity
|
|
14
|
+
price {
|
|
15
|
+
...MoneyFragment
|
|
16
|
+
}
|
|
17
|
+
listPrice {
|
|
18
|
+
...MoneyFragment
|
|
19
|
+
}
|
|
20
|
+
sellingPrice {
|
|
21
|
+
...MoneyFragment
|
|
22
|
+
}
|
|
23
|
+
gift
|
|
24
|
+
ownTotal {
|
|
25
|
+
...MoneyFragment
|
|
26
|
+
}
|
|
27
|
+
total {
|
|
28
|
+
...MoneyFragment
|
|
29
|
+
}
|
|
30
|
+
variant {
|
|
31
|
+
__typename
|
|
32
|
+
variantId
|
|
33
|
+
sku
|
|
34
|
+
name
|
|
35
|
+
image {
|
|
36
|
+
url
|
|
37
|
+
altText
|
|
38
|
+
}
|
|
39
|
+
availability
|
|
40
|
+
}
|
|
41
|
+
product {
|
|
42
|
+
__typename
|
|
43
|
+
productId
|
|
44
|
+
title
|
|
45
|
+
detailUrl
|
|
46
|
+
categories {
|
|
47
|
+
categoryId
|
|
48
|
+
name
|
|
49
|
+
}
|
|
50
|
+
brand {
|
|
51
|
+
brandId
|
|
52
|
+
name
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`);
|
|
57
|
+
/**
|
|
58
|
+
* Canonical Cart selection set. Every cart mutation MUST spread this fragment so the cache
|
|
59
|
+
* receives the entity slices that all subscribers depend on (id + items + totalizers + total +
|
|
60
|
+
* messages). The regression test in contract.test.ts enforces this.
|
|
61
|
+
*/
|
|
62
|
+
const CartFragment = graphql(`
|
|
63
|
+
fragment CartFragment on Cart {
|
|
64
|
+
__typename
|
|
65
|
+
id
|
|
66
|
+
items {
|
|
67
|
+
...CartItemFragment
|
|
68
|
+
}
|
|
69
|
+
totalizers {
|
|
70
|
+
__typename
|
|
71
|
+
id
|
|
72
|
+
name
|
|
73
|
+
value {
|
|
74
|
+
...MoneyFragment
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
total {
|
|
78
|
+
...MoneyFragment
|
|
79
|
+
}
|
|
80
|
+
messages {
|
|
81
|
+
__typename
|
|
82
|
+
code
|
|
83
|
+
text
|
|
84
|
+
status
|
|
85
|
+
}
|
|
86
|
+
appliedCoupons {
|
|
87
|
+
code
|
|
88
|
+
isUnmatchedCondition
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`);
|
|
92
|
+
const CART_ITEM_ADD = graphql(`
|
|
93
|
+
mutation CartItemAdd($input: CartItemAddInput!) {
|
|
94
|
+
cartItemAdd(input: $input) {
|
|
95
|
+
__typename
|
|
96
|
+
cart {
|
|
97
|
+
...CartFragment
|
|
98
|
+
}
|
|
99
|
+
userErrors {
|
|
100
|
+
code
|
|
101
|
+
message
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`);
|
|
106
|
+
const CART_ITEM_REMOVE = graphql(`
|
|
107
|
+
mutation CartItemRemove($input: CartItemRemoveInput!) {
|
|
108
|
+
cartItemRemove(input: $input) {
|
|
109
|
+
__typename
|
|
110
|
+
cart {
|
|
111
|
+
...CartFragment
|
|
112
|
+
}
|
|
113
|
+
userErrors {
|
|
114
|
+
code
|
|
115
|
+
message
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`);
|
|
120
|
+
const CART_ITEMS_REMOVE = graphql(`
|
|
121
|
+
mutation CartItemsRemove($input: CartItemsRemoveInput!) {
|
|
122
|
+
cartItemsRemove(input: $input) {
|
|
123
|
+
__typename
|
|
124
|
+
cart {
|
|
125
|
+
...CartFragment
|
|
126
|
+
}
|
|
127
|
+
userErrors {
|
|
128
|
+
code
|
|
129
|
+
message
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`);
|
|
134
|
+
const CART_ITEM_QUANTITY_INCREASE = graphql(`
|
|
135
|
+
mutation CartItemQuantityIncrease($input: CartItemQuantityIncreaseInput!) {
|
|
136
|
+
cartItemQuantityIncrease(input: $input) {
|
|
137
|
+
__typename
|
|
138
|
+
cart {
|
|
139
|
+
...CartFragment
|
|
140
|
+
}
|
|
141
|
+
userErrors {
|
|
142
|
+
code
|
|
143
|
+
message
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`);
|
|
148
|
+
const CART_ITEM_QUANTITY_DECREASE = graphql(`
|
|
149
|
+
mutation CartItemQuantityDecrease($input: CartItemQuantityDecreaseInput!) {
|
|
150
|
+
cartItemQuantityDecrease(input: $input) {
|
|
151
|
+
__typename
|
|
152
|
+
cart {
|
|
153
|
+
...CartFragment
|
|
154
|
+
}
|
|
155
|
+
userErrors {
|
|
156
|
+
code
|
|
157
|
+
message
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`);
|
|
162
|
+
const CART_COUPON_APPLY = graphql(`
|
|
163
|
+
mutation CartCouponApply($input: CartCouponApplyInput!) {
|
|
164
|
+
cartCouponApply(input: $input) {
|
|
165
|
+
__typename
|
|
166
|
+
cart {
|
|
167
|
+
...CartFragment
|
|
168
|
+
}
|
|
169
|
+
userErrors {
|
|
170
|
+
code
|
|
171
|
+
message
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`);
|
|
176
|
+
const CART_COUPON_REMOVE = graphql(`
|
|
177
|
+
mutation CartCouponRemove($input: CartCouponRemoveInput!) {
|
|
178
|
+
cartCouponRemove(input: $input) {
|
|
179
|
+
__typename
|
|
180
|
+
cart {
|
|
181
|
+
...CartFragment
|
|
182
|
+
}
|
|
183
|
+
userErrors {
|
|
184
|
+
code
|
|
185
|
+
message
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
`);
|
|
190
|
+
/**
|
|
191
|
+
* Re-check the active cart against the platform and adopt corrected availability. Read-only upstream
|
|
192
|
+
* (specs/mini-cart-validate-operation.md): the payload is the cart with each line's
|
|
193
|
+
* `variant.availability` refreshed, shaped like every other cart mutation so the correction lands in
|
|
194
|
+
* the normalized cache. Takes no arguments — the cart resolves from the request context. Spreading
|
|
195
|
+
* `CartFragment` is what makes the guard, the per-line alert, and the badge re-render as subscribers,
|
|
196
|
+
* so T13 needs no fragment or codegen change beyond registering this document.
|
|
197
|
+
*/
|
|
198
|
+
const CART_VALIDATE = graphql(`
|
|
199
|
+
mutation CartValidate {
|
|
200
|
+
cartValidate {
|
|
201
|
+
__typename
|
|
202
|
+
cart {
|
|
203
|
+
...CartFragment
|
|
204
|
+
}
|
|
205
|
+
userErrors {
|
|
206
|
+
code
|
|
207
|
+
message
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
`);
|
|
212
|
+
//#endregion
|
|
213
|
+
export { CART_COUPON_APPLY, CART_COUPON_REMOVE, CART_ITEMS_REMOVE, CART_ITEM_ADD, CART_ITEM_QUANTITY_DECREASE, CART_ITEM_QUANTITY_INCREASE, CART_ITEM_REMOVE, CART_VALIDATE, CartFragment };
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","names":[],"sources":["../../../src/sdk/cart/operations.ts"],"sourcesContent":["import type { TypedDocumentNode } from '@apollo/client';\nimport { graphql } from '../generated/gql.js';\nimport type {\n CartCouponApplyMutation,\n CartCouponApplyMutationVariables,\n CartCouponRemoveMutation,\n CartCouponRemoveMutationVariables,\n CartFragmentFragment,\n CartItemAddMutation,\n CartItemAddMutationVariables,\n CartItemFragmentFragment,\n CartItemQuantityDecreaseMutation,\n CartItemQuantityDecreaseMutationVariables,\n CartItemQuantityIncreaseMutation,\n CartItemQuantityIncreaseMutationVariables,\n CartItemRemoveMutation,\n CartItemRemoveMutationVariables,\n CartItemsRemoveMutation,\n CartItemsRemoveMutationVariables,\n CartValidateMutation,\n CartValidateMutationVariables,\n MoneyFragmentFragment,\n} from '../generated/graphql.js';\n\n/**\n * Cart-related GraphQL operations and shared fragments (T6 / specs/mutation-contract.md).\n *\n * The `CartFragment` is the canonical Cart selection set: every mutation operation spreads it so\n * the cache normalisation reaches every reactive subscriber (CartTotal, CartCount, CartItems, …)\n * through a single response. The contract regression test (`contract.test.ts`) parses these\n * documents and asserts the spread is present — see specs/mutation-contract.md AD-D3 / AD-8.\n *\n * T7 ([specs/graphql-codegen-pipeline.md][T7]) routes the domain types and the operation factory\n * through @graphql-codegen. Public type names (`CartEntity`, `CartItemEntity`, `Money`, payload\n * + input aliases) are preserved as re-exports / aliases so consumer call sites do not change.\n *\n * [T7]: ../../../../../specs/graphql-codegen-pipeline.md\n */\n\n// ---------------------------------------------------------------------------\n// Domain type aliases — re-exports from codegen artifacts (T7)\n// ---------------------------------------------------------------------------\n\nexport type Money = MoneyFragmentFragment;\nexport type CartItemEntity = CartItemFragmentFragment;\nexport type CartEntity = CartFragmentFragment;\nexport type CartTotalizer = CartFragmentFragment['totalizers'][number];\nexport type CartMessage = CartFragmentFragment['messages'][number];\nexport type AppliedCoupon = CartFragmentFragment['appliedCoupons'][number];\n\nexport type CartUserError = Readonly<{ code: string; message: string }>;\n\n// ---------------------------------------------------------------------------\n// Mutation input types — direct re-exports from codegen\n// ---------------------------------------------------------------------------\n\nexport type {\n CartCouponApplyInput,\n CartCouponRemoveInput,\n CartItemAddInput,\n CartItemQuantityDecreaseInput,\n CartItemQuantityIncreaseInput,\n CartItemRemoveInput,\n CartItemsRemoveInput,\n} from '../generated/graphql.js';\n\n// ---------------------------------------------------------------------------\n// Mutation payload types — derived from operation result types\n// ---------------------------------------------------------------------------\n\nexport type CartItemAddPayload = CartItemAddMutation['cartItemAdd'];\nexport type CartItemRemovePayload = CartItemRemoveMutation['cartItemRemove'];\nexport type CartItemsRemovePayload = CartItemsRemoveMutation['cartItemsRemove'];\nexport type CartItemQuantityIncreasePayload = CartItemQuantityIncreaseMutation['cartItemQuantityIncrease'];\nexport type CartItemQuantityDecreasePayload = CartItemQuantityDecreaseMutation['cartItemQuantityDecrease'];\nexport type CartCouponApplyPayload = CartCouponApplyMutation['cartCouponApply'];\nexport type CartCouponRemovePayload = CartCouponRemoveMutation['cartCouponRemove'];\nexport type CartValidatePayload = CartValidateMutation['cartValidate'];\n\n// ---------------------------------------------------------------------------\n// Shared fragments — authored via the codegen `graphql()` factory so codegen can scan and type\n// every operation that spreads them.\n// ---------------------------------------------------------------------------\n\nexport const MoneyFragment: TypedDocumentNode<MoneyFragmentFragment, never> = graphql(`\n fragment MoneyFragment on Money {\n __typename\n amount\n currencyCode\n }\n`);\n\nexport const CartItemFragment: TypedDocumentNode<CartItemFragmentFragment, never> = graphql(`\n fragment CartItemFragment on CartItem {\n __typename\n id\n quantity\n price {\n ...MoneyFragment\n }\n listPrice {\n ...MoneyFragment\n }\n sellingPrice {\n ...MoneyFragment\n }\n gift\n ownTotal {\n ...MoneyFragment\n }\n total {\n ...MoneyFragment\n }\n variant {\n __typename\n variantId\n sku\n name\n image {\n url\n altText\n }\n availability\n }\n product {\n __typename\n productId\n title\n detailUrl\n categories {\n categoryId\n name\n }\n brand {\n brandId\n name\n }\n }\n }\n`);\n\n/**\n * Canonical Cart selection set. Every cart mutation MUST spread this fragment so the cache\n * receives the entity slices that all subscribers depend on (id + items + totalizers + total +\n * messages). The regression test in contract.test.ts enforces this.\n */\nexport const CartFragment: TypedDocumentNode<CartFragmentFragment, never> = graphql(`\n fragment CartFragment on Cart {\n __typename\n id\n items {\n ...CartItemFragment\n }\n totalizers {\n __typename\n id\n name\n value {\n ...MoneyFragment\n }\n }\n total {\n ...MoneyFragment\n }\n messages {\n __typename\n code\n text\n status\n }\n appliedCoupons {\n code\n isUnmatchedCondition\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Mutation operations — authored via `graphql()`, typed via the codegen-derived\n// TypedDocumentNode generic so Apollo's `useMutation` infers TData / TVariables correctly.\n// ---------------------------------------------------------------------------\n\nexport const CART_ITEM_ADD: TypedDocumentNode<CartItemAddMutation, CartItemAddMutationVariables> = graphql(`\n mutation CartItemAdd($input: CartItemAddInput!) {\n cartItemAdd(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\nexport const CART_ITEM_REMOVE: TypedDocumentNode<CartItemRemoveMutation, CartItemRemoveMutationVariables> = graphql(`\n mutation CartItemRemove($input: CartItemRemoveInput!) {\n cartItemRemove(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\nexport const CART_ITEMS_REMOVE: TypedDocumentNode<CartItemsRemoveMutation, CartItemsRemoveMutationVariables> = graphql(`\n mutation CartItemsRemove($input: CartItemsRemoveInput!) {\n cartItemsRemove(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\nexport const CART_ITEM_QUANTITY_INCREASE: TypedDocumentNode<\n CartItemQuantityIncreaseMutation,\n CartItemQuantityIncreaseMutationVariables\n> = graphql(`\n mutation CartItemQuantityIncrease($input: CartItemQuantityIncreaseInput!) {\n cartItemQuantityIncrease(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\nexport const CART_ITEM_QUANTITY_DECREASE: TypedDocumentNode<\n CartItemQuantityDecreaseMutation,\n CartItemQuantityDecreaseMutationVariables\n> = graphql(`\n mutation CartItemQuantityDecrease($input: CartItemQuantityDecreaseInput!) {\n cartItemQuantityDecrease(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\nexport const CART_COUPON_APPLY: TypedDocumentNode<CartCouponApplyMutation, CartCouponApplyMutationVariables> = graphql(`\n mutation CartCouponApply($input: CartCouponApplyInput!) {\n cartCouponApply(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\nexport const CART_COUPON_REMOVE: TypedDocumentNode<CartCouponRemoveMutation, CartCouponRemoveMutationVariables> =\n graphql(`\n mutation CartCouponRemove($input: CartCouponRemoveInput!) {\n cartCouponRemove(input: $input) {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\n/**\n * Re-check the active cart against the platform and adopt corrected availability. Read-only upstream\n * (specs/mini-cart-validate-operation.md): the payload is the cart with each line's\n * `variant.availability` refreshed, shaped like every other cart mutation so the correction lands in\n * the normalized cache. Takes no arguments — the cart resolves from the request context. Spreading\n * `CartFragment` is what makes the guard, the per-line alert, and the badge re-render as subscribers,\n * so T13 needs no fragment or codegen change beyond registering this document.\n */\nexport const CART_VALIDATE: TypedDocumentNode<CartValidateMutation, CartValidateMutationVariables> = graphql(`\n mutation CartValidate {\n cartValidate {\n __typename\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n\n/**\n * Canonical list of cart mutation documents. Used by the contract regression test to iterate\n * over every shipped operation without hard-coding names.\n */\nexport const CART_MUTATIONS = [\n { name: 'CartItemAdd', document: CART_ITEM_ADD },\n { name: 'CartItemRemove', document: CART_ITEM_REMOVE },\n { name: 'CartItemsRemove', document: CART_ITEMS_REMOVE },\n { name: 'CartItemQuantityIncrease', document: CART_ITEM_QUANTITY_INCREASE },\n { name: 'CartItemQuantityDecrease', document: CART_ITEM_QUANTITY_DECREASE },\n { name: 'CartCouponApply', document: CART_COUPON_APPLY },\n { name: 'CartCouponRemove', document: CART_COUPON_REMOVE },\n { name: 'CartValidate', document: CART_VALIDATE },\n] as const;\n"],"mappings":";AAoF8E,QAAQ;;;;;;CAMrF;AAEmF,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C3F;;;;;;AAOD,MAAa,eAA+D,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BnF;AAOD,MAAa,gBAAsF,QAAQ;;;;;;;;;;;;;CAa1G;AAED,MAAa,mBAA+F,QAAQ;;;;;;;;;;;;;CAanH;AAED,MAAa,oBAAkG,QAAQ;;;;;;;;;;;;;CAatH;AAED,MAAa,8BAGT,QAAQ;;;;;;;;;;;;;CAaX;AAED,MAAa,8BAGT,QAAQ;;;;;;;;;;;;;CAaX;AAED,MAAa,oBAAkG,QAAQ;;;;;;;;;;;;;CAatH;AAED,MAAa,qBACX,QAAQ;;;;;;;;;;;;;CAaT;;;;;;;;;AAUD,MAAa,gBAAwF,QAAQ;;;;;;;;;;;;;CAa5G"}
|