@vtex/faststore 0.0.6 → 0.0.8
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 +99 -0
- package/dist/actions.json +152 -1
- package/dist/catalog.json +2541 -1278
- package/dist/cli/UnreachableCaseError-Crd168Vu.js +10 -0
- package/dist/cli/UnreachableCaseError-Crd168Vu.js.map +1 -0
- package/dist/cli/cacheControl-CEojH_TM.js +158 -0
- package/dist/cli/cacheControl-CEojH_TM.js.map +1 -0
- package/dist/cli/cachePolicy-m2vASMRW.js +26 -0
- package/dist/cli/cachePolicy-m2vASMRW.js.map +1 -0
- package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js +10 -0
- package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js.map +1 -0
- package/dist/cli/default-BCQHcwbL.js +253 -0
- package/dist/cli/default-BCQHcwbL.js.map +1 -0
- package/dist/cli/disableSuggestions-yO9UqiWn.js +21 -0
- package/dist/cli/disableSuggestions-yO9UqiWn.js.map +1 -0
- package/dist/cli/dist-C1JhdHfo.js +2001 -0
- package/dist/cli/dist-C1JhdHfo.js.map +1 -0
- package/dist/cli/graphql-DG9thCDG.js +14589 -0
- package/dist/cli/graphql-DG9thCDG.js.map +1 -0
- package/dist/cli/index.d.ts +799 -0
- package/dist/cli/index.js +36459 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.min-BsIHDfFK.js +613 -0
- package/dist/cli/index.min-BsIHDfFK.js.map +1 -0
- package/dist/cli/inlineTrace-uLgOJ3TH.js +52 -0
- package/dist/cli/inlineTrace-uLgOJ3TH.js.map +1 -0
- package/dist/cli/internalPlugin-DnuwN4_4.js +11 -0
- package/dist/cli/internalPlugin-DnuwN4_4.js.map +1 -0
- package/dist/cli/packageVersion-DQAnIEil.js +6 -0
- package/dist/cli/packageVersion-DQAnIEil.js.map +1 -0
- package/dist/cli/rolldown-runtime-BMI-E3GI.js +44 -0
- package/dist/cli/schemaIsSubgraph-DoGh3OYj.js +17 -0
- package/dist/cli/schemaIsSubgraph-DoGh3OYj.js.map +1 -0
- package/dist/cli/schemaReporting-K-me-3-v.js +199 -0
- package/dist/cli/schemaReporting-K-me-3-v.js.map +1 -0
- package/dist/cli/server-runtime.js +49879 -0
- package/dist/cli/server-runtime.js.map +1 -0
- package/dist/cli/traceTreeBuilder-BIcV2U7b.js +9118 -0
- package/dist/cli/traceTreeBuilder-BIcV2U7b.js.map +1 -0
- package/dist/cli/usageReporting-Bpl8vSZX.js +10201 -0
- package/dist/cli/usageReporting-Bpl8vSZX.js.map +1 -0
- package/dist/cli/v4-CBhFvC49.js +42 -0
- package/dist/cli/v4-CBhFvC49.js.map +1 -0
- package/dist/client.d.ts +5 -1
- package/dist/client.js +5 -1
- package/dist/components.d.ts +38 -9
- package/dist/components.js +42 -13
- package/dist/content-types.json +616 -0
- package/dist/core/dist/define-component.d.ts +43 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/account-access-gate.md +4 -4
- package/dist/docs/account-address-book.md +519 -0
- package/dist/docs/account-entry-point.md +1 -1
- package/dist/docs/account-menu-identity.md +160 -0
- package/dist/docs/account-menu.md +107 -24
- package/dist/docs/alert-dialog.md +2 -2
- package/dist/docs/avatar.md +103 -0
- package/dist/docs/billing-address.md +17 -9
- package/dist/docs/card-entry.md +37 -6
- package/dist/docs/cardholder-document.md +16 -14
- package/dist/docs/cart-item.md +1 -1
- package/dist/docs/cart.md +8 -8
- package/dist/docs/client-profile-fieldset.md +7 -5
- package/dist/docs/copy-text.md +84 -0
- package/dist/docs/document-field.md +8 -8
- package/dist/docs/footer-link-group.md +2 -2
- package/dist/docs/header-root.md +1 -1
- package/dist/docs/incentives.md +2 -2
- package/dist/docs/logo.md +5 -5
- package/dist/docs/my-account-profile.md +5 -5
- package/dist/docs/navigation-link-list.md +2 -2
- package/dist/docs/navigation-link.md +3 -3
- package/dist/docs/order-cancel.md +52 -0
- package/dist/docs/order-delivery-address.md +63 -0
- package/dist/docs/order-delivery-group.md +83 -0
- package/dist/docs/order-details-back.md +41 -0
- package/dist/docs/order-details-header.md +48 -0
- package/dist/docs/order-list-row.md +46 -0
- package/dist/docs/order-list-search.md +101 -0
- package/dist/docs/order-list-views.md +97 -0
- package/dist/docs/order-list.md +94 -0
- package/dist/docs/order-payment.md +94 -0
- package/dist/docs/order-placed-date.md +49 -0
- package/dist/docs/order-placed-payment-summary.md +13 -15
- package/dist/docs/order-placed.md +225 -0
- package/dist/docs/order-progress.md +88 -0
- package/dist/docs/order-status-badge.md +91 -0
- package/dist/docs/order-summary.md +53 -0
- package/dist/docs/payment-method-badges.md +14 -3
- package/dist/docs/place-order.md +13 -9
- package/dist/docs/product-shelf.md +20 -13
- package/dist/docs/saved-cards.md +2 -2
- package/dist/docs/select.md +19 -6
- package/dist/docs/session.md +1 -1
- package/dist/docs/shipping-address.md +1 -1
- package/dist/docs/sign-in-redirect.md +6 -6
- package/dist/docs/toast.md +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +2 -1
- package/dist/internal/client.d.ts +6 -1
- package/dist/internal/client.js +8 -3
- package/dist/internal/content.d.ts +2 -2
- package/dist/internal/server.d.ts +8 -1
- package/dist/internal/server.js +8 -1
- package/dist/matter/account-access-gate/account-access-gate.d.ts +2 -1
- package/dist/matter/account-access-gate/account-access-gate.js +19 -16
- package/dist/matter/account-access-gate/account-access-gate.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +60 -0
- package/dist/matter/account-address-book/account-address-book-delete.js +184 -0
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +19 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.js +50 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +42 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.js +146 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +25 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +72 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book.d.ts +120 -0
- package/dist/matter/account-address-book/account-address-book.js +469 -0
- package/dist/matter/account-address-book/account-address-book.js.map +1 -0
- package/dist/matter/account-address-book/account-address-country-switch.js +59 -0
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -0
- package/dist/matter/account-address-book/account-address-country.d.ts +36 -0
- package/dist/matter/account-address-book/account-address-country.js +151 -0
- package/dist/matter/account-address-book/account-address-country.js.map +1 -0
- package/dist/matter/account-address-book/account-address-first-line.js +11 -0
- package/dist/matter/account-address-book/account-address-first-line.js.map +1 -0
- package/dist/matter/account-address-book/account-address-form-context.d.ts +55 -0
- package/dist/matter/account-address-book/account-address-form-context.js +14 -0
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -0
- package/dist/matter/account-address-book/account-address-form.d.ts +85 -0
- package/dist/matter/account-address-book/account-address-form.js +946 -0
- package/dist/matter/account-address-book/account-address-form.js.map +1 -0
- package/dist/matter/account-address-book/account-address-postal-autofill.js +189 -0
- package/dist/matter/account-address-book/account-address-postal-autofill.js.map +1 -0
- package/dist/matter/account-address-book/account-address-record.d.ts +26 -0
- package/dist/matter/account-address-book/account-address-record.js +138 -0
- package/dist/matter/account-address-book/account-address-record.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.js +11 -11
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +77 -3
- package/dist/matter/account-menu/account-menu.js +252 -19
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu/sign-out-failure.js +50 -0
- package/dist/matter/account-menu/sign-out-failure.js.map +1 -0
- package/dist/matter/account-menu-identity/account-menu-identity.d.ts +21 -0
- package/dist/matter/account-menu-identity/account-menu-identity.js +88 -0
- package/dist/matter/account-menu-identity/account-menu-identity.js.map +1 -0
- package/dist/matter/billing-address/billing-address.d.ts +30 -17
- package/dist/matter/billing-address/billing-address.js +128 -33
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.js +2 -2
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +4 -3
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +5 -3
- package/dist/matter/card-entry/card-entry.js +78 -27
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cardholder-document/cardholder-document.d.ts +10 -9
- package/dist/matter/cardholder-document/cardholder-document.js +36 -16
- package/dist/matter/cardholder-document/cardholder-document.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +7 -2
- package/dist/matter/cart/cart.js +29 -26
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-item/cart-item.js +2 -2
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences-fieldset.js +2 -2
- package/dist/matter/client-profile-form/client-profile-fieldset.js +9 -6
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.js +3 -3
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.js +4 -3
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +6 -3
- package/dist/matter/my-account-profile/my-account-profile.js +6 -5
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +110 -0
- package/dist/matter/order-cancel/order-cancel.js +344 -0
- package/dist/matter/order-cancel/order-cancel.js.map +1 -0
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +73 -0
- package/dist/matter/order-delivery-address/order-delivery-address.js +172 -0
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -0
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +128 -0
- package/dist/matter/order-delivery-group/order-delivery-group.js +408 -0
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -0
- package/dist/matter/order-details-header/order-details-header.d.ts +104 -0
- package/dist/matter/order-details-header/order-details-header.js +190 -0
- package/dist/matter/order-details-header/order-details-header.js.map +1 -0
- package/dist/matter/order-list/customer-orders-filter.d.ts +12 -0
- package/dist/matter/order-list/customer-orders-filter.js +30 -0
- package/dist/matter/order-list/customer-orders-filter.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +121 -0
- package/dist/matter/order-list/order-list.js +395 -0
- package/dist/matter/order-list/order-list.js.map +1 -0
- package/dist/matter/order-list-row/order-list-row.d.ts +44 -0
- package/dist/matter/order-list-row/order-list-row.js +127 -0
- package/dist/matter/order-list-row/order-list-row.js.map +1 -0
- package/dist/matter/order-list-search/order-list-search.d.ts +72 -0
- package/dist/matter/order-list-search/order-list-search.js +296 -0
- package/dist/matter/order-list-search/order-list-search.js.map +1 -0
- package/dist/matter/order-list-views/order-list-views.d.ts +65 -0
- package/dist/matter/order-list-views/order-list-views.js +154 -0
- package/dist/matter/order-list-views/order-list-views.js.map +1 -0
- package/dist/matter/order-payment/order-payment.d.ts +83 -0
- package/dist/matter/order-payment/order-payment.js +258 -0
- package/dist/matter/order-payment/order-payment.js.map +1 -0
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +145 -0
- package/dist/matter/order-placed/order-placed-deliveries.js +380 -0
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -0
- package/dist/matter/order-placed/order-placed.d.ts +122 -0
- package/dist/matter/order-placed/order-placed.js +452 -0
- package/dist/matter/order-placed/order-placed.js.map +1 -0
- package/dist/matter/order-placed-date/order-placed-date.d.ts +45 -0
- package/dist/matter/order-placed-date/order-placed-date.js +92 -0
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +5 -8
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +29 -81
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +85 -0
- package/dist/matter/order-progress/order-progress.js +203 -0
- package/dist/matter/order-progress/order-progress.js.map +1 -0
- package/dist/matter/order-summary/order-summary.d.ts +81 -0
- package/dist/matter/order-summary/order-summary.js +192 -0
- package/dist/matter/order-summary/order-summary.js.map +1 -0
- package/dist/matter/payment/cardholder-document-rule.d.ts +35 -0
- package/dist/matter/payment/cardholder-document-rule.js +35 -0
- package/dist/matter/payment/cardholder-document-rule.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +38 -23
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.js +12 -0
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +4 -2
- package/dist/matter/payment/payment-method-badges.js.map +1 -1
- package/dist/matter/payment/payment.js +12 -0
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +39 -0
- package/dist/matter/payment/use-payment-method-selection.js +30 -2
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +16 -2
- package/dist/matter/payment/use-payment-submit-gate.js +42 -14
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +12 -7
- package/dist/matter/place-order/place-order.js +126 -103
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.js +5 -5
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +61 -31
- package/dist/matter/product-shelf/product-shelf.js +157 -57
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.js +1 -1
- package/dist/matter/saved-cards/saved-cards.js +27 -15
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/session/session.js +2 -2
- package/dist/matter/session/session.js.map +1 -1
- package/dist/matter/shipping-address/country-descriptors.d.ts +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +23 -1
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/shipping-address.js +63 -15
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in-redirect/sign-in-redirect.js +48 -10
- package/dist/matter/sign-in-redirect/sign-in-redirect.js.map +1 -1
- package/dist/matter/variant-selector/variant-selector.js +2 -2
- package/dist/matter/variant-selector/variant-selector.js.map +1 -1
- package/dist/particles/address-summary/address-summary.js +2 -2
- package/dist/particles/address-summary/address-summary.js.map +1 -1
- package/dist/particles/alert-dialog/alert-dialog.d.ts +5 -1
- package/dist/particles/alert-dialog/alert-dialog.js +5 -2
- package/dist/particles/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/particles/avatar/avatar.d.ts +17 -0
- package/dist/particles/avatar/avatar.js +65 -0
- package/dist/particles/avatar/avatar.js.map +1 -0
- package/dist/particles/copy-text/copy-text.d.ts +28 -0
- package/dist/particles/copy-text/copy-text.js +140 -0
- package/dist/particles/copy-text/copy-text.js.map +1 -0
- package/dist/particles/document-field/document-field.d.ts +34 -5
- package/dist/particles/document-field/document-field.js +115 -19
- package/dist/particles/document-field/document-field.js.map +1 -1
- package/dist/particles/field/field.js +1 -1
- package/dist/particles/field/field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.d.ts +6 -2
- package/dist/particles/footer-link-group/footer-link-group.js +18 -7
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/incentives/incentives.d.ts +6 -2
- package/dist/particles/incentives/incentives.js +7 -2
- package/dist/particles/incentives/incentives.js.map +1 -1
- package/dist/particles/logo/logo.d.ts +3 -2
- package/dist/particles/logo/logo.js +20 -8
- package/dist/particles/logo/logo.js.map +1 -1
- package/dist/particles/navigation-link/navigation-link.d.ts +2 -3
- package/dist/particles/navigation-link/navigation-link.js +4 -4
- package/dist/particles/navigation-link/navigation-link.js.map +1 -1
- package/dist/particles/navigation-link-list/navigation-link-list.d.ts +6 -2
- package/dist/particles/navigation-link-list/navigation-link-list.js +18 -7
- package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +28 -0
- package/dist/particles/order-details-back/order-details-back.js +52 -0
- package/dist/particles/order-details-back/order-details-back.js.map +1 -0
- package/dist/particles/order-status-badge/order-status-badge.d.ts +19 -0
- package/dist/particles/order-status-badge/order-status-badge.js +50 -0
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -0
- package/dist/particles/phone-field/phone-field.js +2 -2
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/select/select.js +6 -6
- package/dist/particles/select/select.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +1 -1
- package/dist/particles/toast/toast.js +32 -6
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +1079 -54
- package/dist/sdk/actions/address-action-provider.d.ts +16 -0
- package/dist/sdk/actions/address-action-provider.js +20 -0
- package/dist/sdk/actions/address-action-provider.js.map +1 -0
- package/dist/sdk/actions/analytics-action-provider.js +1 -1
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/order-action-provider.d.ts +12 -0
- package/dist/sdk/actions/order-action-provider.js +16 -0
- package/dist/sdk/actions/order-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +6 -2
- package/dist/sdk/address/address-fields.js +38 -0
- package/dist/sdk/address/address-fields.js.map +1 -0
- package/dist/sdk/address/checkout-readiness.js +17 -0
- package/dist/sdk/address/checkout-readiness.js.map +1 -0
- package/dist/sdk/address/constants.js +60 -0
- package/dist/sdk/address/constants.js.map +1 -0
- package/dist/sdk/address/country-display.js +19 -0
- package/dist/sdk/address/country-display.js.map +1 -0
- package/dist/sdk/address/country-rules.js +30 -0
- package/dist/sdk/address/country-rules.js.map +1 -0
- package/dist/sdk/address/format-address.js +18 -0
- package/dist/sdk/address/format-address.js.map +1 -0
- package/dist/sdk/address/iso-countries.js +262 -0
- package/dist/sdk/address/iso-countries.js.map +1 -0
- package/dist/sdk/address/layouts.js +56 -0
- package/dist/sdk/address/layouts.js.map +1 -0
- package/dist/sdk/address/messages.js +97 -0
- package/dist/sdk/address/messages.js.map +1 -0
- package/dist/sdk/address/operations.d.ts +54 -0
- package/dist/sdk/address/operations.js +83 -0
- package/dist/sdk/address/operations.js.map +1 -0
- package/dist/sdk/address/postal-code-lookup-operations.js +23 -0
- package/dist/sdk/address/postal-code-lookup-operations.js.map +1 -0
- package/dist/sdk/address/postal-code.js +11 -0
- package/dist/sdk/address/postal-code.js.map +1 -0
- package/dist/sdk/address/schema.js +14 -0
- package/dist/sdk/address/schema.js.map +1 -0
- package/dist/sdk/address/server-fields.js +25 -0
- package/dist/sdk/address/server-fields.js.map +1 -0
- package/dist/sdk/address/switch-country.js +57 -0
- package/dist/sdk/address/switch-country.js.map +1 -0
- package/dist/sdk/address/types.d.ts +26 -0
- package/dist/sdk/address/use-address-actions.d.ts +29 -0
- package/dist/sdk/address/use-address-actions.js +247 -0
- package/dist/sdk/address/use-address-actions.js.map +1 -0
- package/dist/sdk/address/use-address-by-postal-code.js +57 -0
- package/dist/sdk/address/use-address-by-postal-code.js.map +1 -0
- package/dist/sdk/address/validate-address.js +62 -0
- package/dist/sdk/address/validate-address.js.map +1 -0
- package/dist/sdk/analytics/use-analytics-actions.js +2 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cache/storefront-cache.js +29 -4
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js +9 -8
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js +2 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
- package/dist/sdk/client/fetch-page-data.d.ts +11 -0
- package/dist/sdk/client/fetch-page-data.js +12 -1
- package/dist/sdk/client/fetch-page-data.js.map +1 -1
- package/dist/sdk/content/create-content-runtime.d.ts +22 -1
- package/dist/sdk/content/create-content-runtime.js +90 -9
- package/dist/sdk/content/create-content-runtime.js.map +1 -1
- package/dist/sdk/data/empty-content-value.js +16 -0
- package/dist/sdk/data/empty-content-value.js.map +1 -0
- package/dist/sdk/data/failed-fields.js +23 -0
- package/dist/sdk/data/failed-fields.js.map +1 -0
- package/dist/sdk/data/hot-data-provider.js +2 -1
- package/dist/sdk/data/hot-data-provider.js.map +1 -1
- package/dist/sdk/data/index.js +1 -1
- package/dist/sdk/data/page-reactive-data-root.d.ts +45 -7
- package/dist/sdk/data/page-reactive-data-root.js +88 -12
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
- package/dist/sdk/data/variables-from-content.d.ts +43 -0
- package/dist/sdk/data/variables-from-content.js +57 -0
- package/dist/sdk/data/variables-from-content.js.map +1 -0
- package/dist/sdk/generated/fragment-types.js +2 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -1
- package/dist/sdk/generated/gql.js +4 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +8 -0
- package/dist/sdk/generated/graphql.js +296 -1
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/messages/en-US.js +138 -1
- package/dist/sdk/i18n/messages/en-US.json +138 -1
- package/dist/sdk/i18n/messages/en-US.json.d.ts +137 -0
- package/dist/sdk/i18n/messages/es-ES.js +138 -1
- package/dist/sdk/i18n/messages/es-ES.json +138 -1
- package/dist/sdk/i18n/messages/pt-BR.js +138 -1
- package/dist/sdk/i18n/messages/pt-BR.json +138 -1
- package/dist/sdk/identity/use-identity-actions.js +5 -4
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/current-page.js +30 -0
- package/dist/sdk/navigation/current-page.js.map +1 -0
- package/dist/sdk/navigation/not-found-log.d.ts +28 -0
- package/dist/sdk/navigation/not-found-log.js +133 -0
- package/dist/sdk/navigation/not-found-log.js.map +1 -0
- package/dist/sdk/navigation/path.js +25 -0
- package/dist/sdk/navigation/path.js.map +1 -0
- package/dist/sdk/navigation/redirect.d.ts +11 -0
- package/dist/sdk/navigation/redirect.js +22 -0
- package/dist/sdk/navigation/redirect.js.map +1 -0
- package/dist/sdk/navigation/report.js +70 -0
- package/dist/sdk/navigation/report.js.map +1 -0
- package/dist/sdk/navigation/resolve-storefront-href.d.ts +12 -0
- package/dist/sdk/navigation/resolve-storefront-href.js +214 -0
- package/dist/sdk/navigation/resolve-storefront-href.js.map +1 -0
- package/dist/sdk/navigation/route-identity-provider.d.ts +11 -0
- package/dist/sdk/navigation/route-identity-provider.js +20 -0
- package/dist/sdk/navigation/route-identity-provider.js.map +1 -0
- package/dist/sdk/navigation/route-map-provider.d.ts +19 -0
- package/dist/sdk/navigation/route-map-provider.js +29 -0
- package/dist/sdk/navigation/route-map-provider.js.map +1 -0
- package/dist/sdk/navigation/storefront-link.d.ts +16 -0
- package/dist/sdk/navigation/storefront-link.js +66 -0
- package/dist/sdk/navigation/storefront-link.js.map +1 -0
- package/dist/sdk/navigation/types.d.ts +45 -0
- package/dist/sdk/navigation/use-storefront-navigation.d.ts +26 -0
- package/dist/sdk/navigation/use-storefront-navigation.js +73 -0
- package/dist/sdk/navigation/use-storefront-navigation.js.map +1 -0
- package/dist/sdk/navigation/use-storefront-route.d.ts +26 -0
- package/dist/sdk/navigation/use-storefront-route.js +87 -0
- package/dist/sdk/navigation/use-storefront-route.js.map +1 -0
- package/dist/sdk/navigation/use-storefront-search-params.d.ts +11 -0
- package/dist/sdk/navigation/use-storefront-search-params.js +16 -0
- package/dist/sdk/navigation/use-storefront-search-params.js.map +1 -0
- package/dist/sdk/orders/completion-badge.d.ts +8 -0
- package/dist/sdk/orders/completion-badge.js +47 -0
- package/dist/sdk/orders/completion-badge.js.map +1 -0
- package/dist/sdk/orders/order-operations.d.ts +19 -0
- package/dist/sdk/orders/order-operations.js +21 -0
- package/dist/sdk/orders/order-operations.js.map +1 -0
- package/dist/sdk/orders/use-order-actions.d.ts +23 -0
- package/dist/sdk/orders/use-order-actions.js +62 -0
- package/dist/sdk/orders/use-order-actions.js.map +1 -0
- package/dist/sdk/payment/gateway-origin.js +26 -13
- package/dist/sdk/payment/gateway-origin.js.map +1 -1
- package/dist/sdk/payment/gateway.d.ts +14 -2
- package/dist/sdk/payment/gateway.js +32 -14
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.js +11 -0
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/submission-registry.d.ts +2 -1
- package/dist/sdk/payment/submission-registry.js +12 -8
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +5 -3
- package/dist/sdk/payment/use-payment-actions.js +6 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +6 -3
- package/dist/sdk/payment/use-place-order.js +334 -144
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/region/use-region-actions.js +2 -1
- package/dist/sdk/region/use-region-actions.js.map +1 -1
- package/dist/sdk/seo/page-alternates.d.ts +55 -0
- package/dist/sdk/seo/page-alternates.js +132 -0
- package/dist/sdk/seo/page-alternates.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +21 -0
- package/dist/sdk/session/read-server-session.js +61 -0
- package/dist/sdk/session/read-server-session.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js +5 -4
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/session/use-session-revalidation.js +2 -1
- package/dist/sdk/session/use-session-revalidation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js +3 -2
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/utils/own-value.js +19 -0
- package/dist/utils/own-value.js.map +1 -0
- package/dist/utils/safe-href.d.ts +11 -0
- package/dist/utils/safe-href.js +31 -22
- package/dist/utils/safe-href.js.map +1 -1
- package/package.json +17 -2
- package/skills/storefront-asset/SKILL.md +111 -0
- package/skills/storefront-asset/references/api-side.md +153 -0
- package/skills/storefront-asset/references/findings.md +40 -0
- package/skills/storefront-asset/references/ui-side.md +94 -0
- package/src/styles/tailwind.css +27 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: storefront-asset
|
|
3
|
+
description: FastStore extension authoring with @vtex/faststore. Scaffold a storefront Asset, write its API side (defineSubgraph) or UI side (defineComponent), and fix storefront-* Findings until vtex extension validate is green. Use when creating or editing an Asset whose asset.yaml says kind storefront.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FastStore extension
|
|
7
|
+
|
|
8
|
+
A FastStore extension is a **storefront Asset**: one package at `extensions/<ext>/<asset>/` whose
|
|
9
|
+
`asset.yaml` says `kind: storefront`. It holds at most one **API side** (fields it adds to the
|
|
10
|
+
storefront graph) and at most one **UI side** (components a store places). An extension holds at
|
|
11
|
+
most one storefront Asset. The Asset depends on `@vtex/faststore` alone, and `vtex extension` loads
|
|
12
|
+
the checks from that same package, so the code and its checks share one version.
|
|
13
|
+
|
|
14
|
+
Run the CLI from the Account Repo root as `pnpm extension <command>`, the script
|
|
15
|
+
`vtex extension init` writes. With stdout piped it prints JSON and puts its messages on stderr.
|
|
16
|
+
`pnpm extension commands --json` describes every command and flag.
|
|
17
|
+
|
|
18
|
+
The Asset is **green** when `pnpm extension validate <ext>` exits 0. Exit 1 means an error Finding
|
|
19
|
+
and exit 2 means warnings only. An `info` Finding, such as `extension-not-installed`, leaves it
|
|
20
|
+
green.
|
|
21
|
+
|
|
22
|
+
## Steps
|
|
23
|
+
|
|
24
|
+
1. **Check the SDK.** Run `pnpm extension validate <ext> --json`. A `provider-invalid` Finding on
|
|
25
|
+
the Asset's `package.json` that names `@vtex/faststore` ("is not a valid storefront provider")
|
|
26
|
+
means the installed SDK predates the storefront provider, and none of the checks below ran.
|
|
27
|
+
`provider-failed` means the provider threw. Either one is the human's to resolve: stop and ask
|
|
28
|
+
which `@vtex/faststore` to install. Done when neither code appears.
|
|
29
|
+
2. **Create the Asset when it is missing.** On pnpm 11, first set `allowBuilds:` with
|
|
30
|
+
`esbuild: false` in the root's `pnpm-workspace.yaml`, replacing any placeholder value pnpm wrote
|
|
31
|
+
there. Without it pnpm refuses esbuild's build script, and `add` ends in `tool-failed` with the
|
|
32
|
+
Asset's `package.json` but no template. Then `pnpm extension add <ext>/<asset> --kind storefront`
|
|
33
|
+
writes the API side; add `--template ui` for the UI side. When `<ext>` is new too, pass
|
|
34
|
+
`--vendor` and `--description`: outside a terminal `add` exits 3 instead of asking. `add` writes
|
|
35
|
+
`asset.yaml`, `package.json` and the template's files, and installs their packages. An Asset that
|
|
36
|
+
`add` left without its template, or one made by hand, takes its files and `package.json` fields
|
|
37
|
+
from the side's reference. Done when the folder holds every file its sides need.
|
|
38
|
+
3. **Read the side's reference, then write the change in its shapes.** A resolver, a GraphQL type,
|
|
39
|
+
a secret or data from an outside service is the API side:
|
|
40
|
+
[references/api-side.md](references/api-side.md). A React component, an editable prop or a
|
|
41
|
+
catalog key is the UI side: [references/ui-side.md](references/ui-side.md). A change that needs
|
|
42
|
+
both sides reads both, and the Asset takes the both-sides layout below.
|
|
43
|
+
4. **Validate until green.** Run `pnpm extension validate <ext> --json`. For each `storefront-*`
|
|
44
|
+
Finding, apply the fix in its row of [references/findings.md](references/findings.md), then run
|
|
45
|
+
it again. Done when it exits 0.
|
|
46
|
+
5. **Run the Asset's own checks.** In the Asset's folder, `pnpm typecheck`, and for an API side
|
|
47
|
+
`pnpm test`. An Asset made by hand may lack the scripts: run `pnpm exec tsc --noEmit` and
|
|
48
|
+
`pnpm exec vitest run`. Done when each exits 0.
|
|
49
|
+
|
|
50
|
+
## Layout
|
|
51
|
+
|
|
52
|
+
The provider reads an Asset's sides from `package.json` and two paths. A storefront `asset.yaml`
|
|
53
|
+
holds the envelope and an empty body, so nothing in it changes the layout.
|
|
54
|
+
|
|
55
|
+
| Side | What marks it | Entry |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| API | `package.json#main`, or, with neither `main` nor `exports["./catalog.json"]`, `src/index.ts` | The declaration module, which `export default`s a `defineSubgraph(...)` |
|
|
58
|
+
| UI | A `src/components/` directory, or `exports["./catalog.json"]` | Every `defineComponent` under `src/components/` |
|
|
59
|
+
|
|
60
|
+
An Asset with both sides names its declaration through `main` (for example `api/index.ts`) and
|
|
61
|
+
keeps `src/index.ts` as the component barrel. Without `main`, a `src/index.ts` beside a
|
|
62
|
+
`./catalog.json` export is the barrel.
|
|
63
|
+
|
|
64
|
+
The templates set these `package.json` fields, and an Asset made by hand sets them itself. Both
|
|
65
|
+
sides take `"type": "module"`, a `typecheck` script and `typescript@^5.9.3` in devDependencies;
|
|
66
|
+
`validate` reports `storefront-typescript-unsupported` without TypeScript 5. The API side adds
|
|
67
|
+
`graphql`, `vitest` and a `test` script. The UI side adds `@types/react`, `react` as a peer, and
|
|
68
|
+
these exports:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
"exports": {
|
|
72
|
+
".": "./src/index.ts",
|
|
73
|
+
"./catalog.json": "./dist/catalog.json"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
A store lists the Asset's package as a dependency and compiles its components from `src/`.
|
|
78
|
+
|
|
79
|
+
## Environment
|
|
80
|
+
|
|
81
|
+
`dev` needs `VTEX_ACCOUNT` in the repo root's `.env`, or `STOREFRONT_CORE_URL` to override the core
|
|
82
|
+
URL derived from the account. `VTEX_WORKSPACE` defaults to `master`. `VTEX_TOKEN`, which is
|
|
83
|
+
optional, and the value of every secret a declaration lists go in the root's `.env.local`, which
|
|
84
|
+
git ignores. Keep the Asset's folder free of `.env` files, so one place holds every value.
|
|
85
|
+
`validate` reads none of them.
|
|
86
|
+
|
|
87
|
+
## Running it live
|
|
88
|
+
|
|
89
|
+
`dev` runs until it is stopped, so start it in the background. Start it through the CLI's bin, so a
|
|
90
|
+
stop signal reaches the CLI rather than a pnpm wrapper:
|
|
91
|
+
`node node_modules/@vtex/cli-plugin-extension/dist/bin/vtex-extension.js dev <ext>` from the repo
|
|
92
|
+
root. It serves one local router over every API side and rebuilds each UI side's
|
|
93
|
+
`dist/catalog.json` on every save under `src/`. The first run downloads the Hive Router into
|
|
94
|
+
`.vtex/storefront/`, and the Assets stay `starting` until it lands.
|
|
95
|
+
|
|
96
|
+
`.vtex/dev-session.json` at the repo root lists each Asset's `status` (`starting`, `ready` or
|
|
97
|
+
`failed`), its `findings`, and, once `ready`, its `details`: the router `url`, the `subgraph` and
|
|
98
|
+
the `catalog`. Query the router `url`; the subgraph's port changes on every reload. A Finding
|
|
99
|
+
leaves the Asset `ready`, so read `findings` after each save. The file's shape is provisional.
|
|
100
|
+
|
|
101
|
+
One session runs per repo, and a second `dev` exits 1 and names the running one. SIGTERM or SIGINT
|
|
102
|
+
stops it with exit 0 and removes the file.
|
|
103
|
+
|
|
104
|
+
## Building it
|
|
105
|
+
|
|
106
|
+
`pnpm extension build <ext>` validates first, then writes each Asset's output to
|
|
107
|
+
`.vtex/build/<ext>/<asset>/` (`--out <dir>` puts it under another root). The API side emits
|
|
108
|
+
`server.mjs` and `extension.graphql`. The UI side emits `catalog.json`, `content-types.json` when
|
|
109
|
+
there is one, and `docs/`. An Asset with an error Finding is `failed` and leaves no folder. The
|
|
110
|
+
output is what the pipeline collects; the UI side's `catalog.json` also lands in the Asset's `dist/`,
|
|
111
|
+
where its export points, so a store build finds it. `--json` prints each Asset's status.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# The API side
|
|
2
|
+
|
|
3
|
+
The API side is one declaration module: `src/index.ts`, or the file `package.json#main` names when
|
|
4
|
+
the Asset has a UI side too.
|
|
5
|
+
|
|
6
|
+
## The declaration
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { defineSubgraph, gql } from '@vtex/faststore/graphql';
|
|
10
|
+
|
|
11
|
+
const REVIEWS_BY_SLUG: Record<string, Array<{ id: string; rating: number; text: string }>> = {
|
|
12
|
+
'sample-product-slug': [{ id: '1', rating: 5, text: 'Replace this with data from your own source.' }],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default defineSubgraph({
|
|
16
|
+
vendor: 'acme',
|
|
17
|
+
|
|
18
|
+
typeDefs: gql`
|
|
19
|
+
extend type Product @key(fields: "slug") {
|
|
20
|
+
slug: String! @external
|
|
21
|
+
reviews: [Review!]!
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type Review {
|
|
25
|
+
id: ID!
|
|
26
|
+
rating: Int!
|
|
27
|
+
text: String!
|
|
28
|
+
}
|
|
29
|
+
`,
|
|
30
|
+
|
|
31
|
+
extends: ['Product'],
|
|
32
|
+
|
|
33
|
+
resolvers: {
|
|
34
|
+
Product: {
|
|
35
|
+
reviews: (product: { slug: string }) => REVIEWS_BY_SLUG[product.slug] ?? [],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`@vtex/faststore/graphql` exports `defineSubgraph`, `gql` and the types `SubgraphContext`,
|
|
42
|
+
`SubgraphDefinition` and `SubgraphResolvers`. `defineSubgraph` returns its argument unchanged; the
|
|
43
|
+
provider builds the schema from it.
|
|
44
|
+
|
|
45
|
+
| Field | What it is |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `vendor` | Required. Matches `^[a-z][a-z0-9]*$`: lowercase letters and digits, starting with a letter. It prefixes every name the Asset contributes. |
|
|
48
|
+
| `typeDefs` | SDL in a `gql` tag, with bare names. Write `@key` and `@external` on the entity you extend; the provider injects the federation preamble. |
|
|
49
|
+
| `extends` | The core entities the SDL extends. `Product`, keyed by `slug`, is the only one. |
|
|
50
|
+
| `resolvers` | Keyed by bare names. The provider renames the keys to the prefixed names and adds each entity's `__resolveReference`. |
|
|
51
|
+
| `secrets` | Optional. The environment names the resolvers read; see Secrets. |
|
|
52
|
+
| `name` | Optional. The subgraph name; the package name by default. |
|
|
53
|
+
|
|
54
|
+
## The vendor prefix
|
|
55
|
+
|
|
56
|
+
The build prefixes every name the Asset contributes with `<vendor>_`: fields added to `Product`,
|
|
57
|
+
root `Query` and `Mutation` fields, and each declared type with every reference to it. The
|
|
58
|
+
declaration above exposes `Product.acme_reviews` of type `[acme_Review!]!`. Write bare names in the
|
|
59
|
+
declaration and let the build add the prefix. The `@key` field of an extended entity keeps its core
|
|
60
|
+
name.
|
|
61
|
+
|
|
62
|
+
## The resolver context
|
|
63
|
+
|
|
64
|
+
A resolver's third argument has exactly these five keys:
|
|
65
|
+
|
|
66
|
+
| Key | Value |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `ctx.account` | The `x-vtex-account` header, `''` when absent |
|
|
69
|
+
| `ctx.workspace` | The `x-vtex-workspace` header, `''` when absent |
|
|
70
|
+
| `ctx.headers` | `x-vtex-locale`, `x-vtex-segment` and `x-vtex-session`, each only when the request carried it |
|
|
71
|
+
| `ctx.token` | The raw `authorization` header, `''` when absent |
|
|
72
|
+
| `ctx.secrets` | The declared secret names that are set, mapped to their values |
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import type { SubgraphContext } from '@vtex/faststore/graphql';
|
|
76
|
+
|
|
77
|
+
const reviews = (product: { slug: string }, _args: unknown, ctx: SubgraphContext) =>
|
|
78
|
+
fetchReviews(product.slug, { apiKey: ctx.secrets.ACME_API_KEY, account: ctx.account });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Secrets
|
|
82
|
+
|
|
83
|
+
`secrets: ['ACME_API_KEY']` declares the environment names the Asset reads. Each name matches
|
|
84
|
+
`^[A-Z][A-Z0-9_]*$`. The provider rejects `PATH`, `HOME`, `PWD`, `SHELL`, `TMPDIR` and any name
|
|
85
|
+
that starts with `VTEX_` or `NODE_`. A declared name that is not set is absent from `ctx.secrets`;
|
|
86
|
+
`dev` logs one warning for each. Values come from the repo root's `.env` and `.env.local`; keep
|
|
87
|
+
secret values in `.env.local`, which git ignores. A resolver reads them through `ctx.secrets` only.
|
|
88
|
+
|
|
89
|
+
## The capability boundary
|
|
90
|
+
|
|
91
|
+
The provider lints the declaration and every `./` or `../` module it imports. Each rule is an error
|
|
92
|
+
Finding at the line it flags:
|
|
93
|
+
|
|
94
|
+
| Rule | What it flags | What to write instead |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| `process-env` | Any `process.env` member access | Declare the name in `secrets` and read `ctx.secrets` |
|
|
97
|
+
| `fs-import` | A runtime import of `fs` or `fs/promises`, bare or `node:` | Fetch the data from a service |
|
|
98
|
+
| `child-process-import` | A runtime import of `child_process` | Call a service over HTTP |
|
|
99
|
+
|
|
100
|
+
Static `import`, `import x = require()`, `require()`, dynamic `import()` and value re-exports all
|
|
101
|
+
count; type-only imports do not. The lint does not walk packages, so route every secret through `ctx.secrets` even when a
|
|
102
|
+
dependency could read the environment: the deployed server scrubs the declared names from its
|
|
103
|
+
environment after boot.
|
|
104
|
+
|
|
105
|
+
## The test
|
|
106
|
+
|
|
107
|
+
`src/index.test.ts` sits beside the declaration. It builds the subgraph with `buildSubgraph` from
|
|
108
|
+
`@vtex/faststore/cli` and resolves the field through `_entities`, the join a federated query makes:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { buildSubgraph } from '@vtex/faststore/cli';
|
|
112
|
+
import { graphql } from 'graphql';
|
|
113
|
+
import { describe, expect, it } from 'vitest';
|
|
114
|
+
import definition from './index';
|
|
115
|
+
|
|
116
|
+
describe('acme extension', () => {
|
|
117
|
+
it('builds a subgraph and resolves the sample field via _entities', async () => {
|
|
118
|
+
const schema = buildSubgraph(definition);
|
|
119
|
+
|
|
120
|
+
const result = await graphql({
|
|
121
|
+
schema,
|
|
122
|
+
source: `
|
|
123
|
+
query ($representations: [_Any!]!) {
|
|
124
|
+
_entities(representations: $representations) {
|
|
125
|
+
... on Product {
|
|
126
|
+
acme_reviews {
|
|
127
|
+
rating
|
|
128
|
+
text
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`,
|
|
134
|
+
variableValues: {
|
|
135
|
+
representations: [{ __typename: 'Product', slug: 'sample-product-slug' }],
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
expect(result.errors).toBeUndefined();
|
|
140
|
+
const entities = result.data?._entities as Array<{ acme_reviews: Array<{ rating: number }> }>;
|
|
141
|
+
expect(entities[0]?.acme_reviews[0]?.rating).toBe(5);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The test sees the built schema, so it queries the prefixed name (`acme_reviews`). `buildSubgraph`
|
|
147
|
+
and `_entities` are the whole surface a test uses.
|
|
148
|
+
|
|
149
|
+
## What validate checks here
|
|
150
|
+
|
|
151
|
+
`validate` runs the capability lint, loads the declaration and builds the subgraph, which is where
|
|
152
|
+
the `vendor` grammar, the `extends` list, the secret names and the SDL fail. It then composes the
|
|
153
|
+
slice with the storefront core schema. `dev` runs the same checks at boot and on every save.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# The Findings
|
|
2
|
+
|
|
3
|
+
Every code `vtex extension validate` reports for a storefront Asset. All are errors. `file` is
|
|
4
|
+
relative to the repo root, and a Finding with a `range` points at its line and column. `dev` reports
|
|
5
|
+
the API-side and UI-side codes for the same faults and replaces them on every reload, and never the
|
|
6
|
+
two kind rules. `build` validates each Asset first, so it reports every code `validate` does before
|
|
7
|
+
it writes, plus `storefront-build-failed`.
|
|
8
|
+
|
|
9
|
+
## The Asset's code
|
|
10
|
+
|
|
11
|
+
| Code | Trigger | On | Fix |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `storefront-typescript-unsupported` | The Asset's `typescript` is missing or has no TypeScript 5 compiler API, so the capability lint did not run | `package.json` | `pnpm add -D typescript@^5.9.3` in the Asset's folder |
|
|
14
|
+
| `storefront-capability-process-env` | A `process.env` member access in the declaration or a module it imports | The source line | Declare the name in `secrets` and read `ctx.secrets` |
|
|
15
|
+
| `storefront-capability-fs-import` | A runtime import of `fs` or `fs/promises` | The source line | Fetch the data from a service; a resolver has no filesystem |
|
|
16
|
+
| `storefront-capability-child-process-import` | A runtime import of `child_process` | The source line | Call a service; a resolver spawns no process |
|
|
17
|
+
| `storefront-declaration-invalid` | `main` names no file; the declaration does not bundle or import; it does not `export default defineSubgraph(...)`; or the build rejects it: a `vendor` outside `^[a-z][a-z0-9]*$`, an `extends` entry other than `Product`, a `@key` other than `slug`, a secret name outside the grammar, or SDL that does not parse | The declaration entry | The message names the field or the SDL error. On a UI-only Asset's `src/index.ts`, add `exports["./catalog.json"]`: without it the barrel was read as a declaration |
|
|
18
|
+
| `storefront-composition-failed` | The built slice does not compose with the storefront core schema: a type or field that collides with core's, or a federation directive the composer rejects. In `dev`, also a conflict between two Assets' slices | The declaration entry | Change the SDL as the message says. Keep `@key(fields: "slug")` on `Product` and bare names elsewhere |
|
|
19
|
+
| `storefront-catalog-export-missing` | The Asset has `src/components/` and `package.json#exports` has no `./catalog.json` key | `package.json` | Add `"./catalog.json": "./dist/catalog.json"` and `".": "./src/index.ts"` to `exports` |
|
|
20
|
+
| `storefront-catalog-export-invalid` | The `./catalog.json` export names no file, or a path that is not `./`-relative, has `..` or resolves outside the Asset through a link; `dev` and `build` write where it points, so the catalog goes to `dist/` meanwhile | `package.json` | Point the export at a file inside the Asset: `"./catalog.json": "./dist/catalog.json"` |
|
|
21
|
+
| `storefront-catalog-invalid` | The catalog build threw: no component under `src/components/` (`NoExtensionComponents`), two components with one name, a fragment spread with no definition (`UnresolvedSpread`), no `package.json#name` (`MissingPackageName`), or a top-level `defineActions` | `package.json` | The message names the file or component. Add a `defineComponent`, rename the duplicate, drop the spread, set `name`, or remove `defineActions` |
|
|
22
|
+
| `storefront-build-failed` | The build step after `validate` passed failed: no or invalid `tsconfig.json`, a TypeScript diagnostic, the `server.mjs` bundle, two component docs sharing a basename, or the catalog | `package.json` | The message is the runner's error. Fix what it names and run `pnpm extension build` again |
|
|
23
|
+
|
|
24
|
+
`storefront-declaration-invalid`, `storefront-catalog-invalid` and `storefront-build-failed` carry
|
|
25
|
+
the build's own error verbatim in their message: read it before changing code.
|
|
26
|
+
|
|
27
|
+
## The kind rules
|
|
28
|
+
|
|
29
|
+
`validate` and `build` check these before either side; `dev` does not.
|
|
30
|
+
|
|
31
|
+
| Code | Trigger | On | Fix |
|
|
32
|
+
| --- | --- | --- | --- |
|
|
33
|
+
| `storefront-one-per-extension` | The extension already has a storefront Asset, and this one is its second | The Asset's `asset.yaml`, at `kind` | Merge the two into one Asset with both sides, or move this one to its own extension |
|
|
34
|
+
| `storefront-store-extension-not-installed` | A store under `stores/` depends on the Asset's package, and an account that uses that store does not list the extension under `installed:` in `accounts.yaml` | The store's `package.json` | Add `<vendor>.<ext>@<range>` to each such account's `installed:`, or drop the dependency |
|
|
35
|
+
|
|
36
|
+
## The provider's own faults
|
|
37
|
+
|
|
38
|
+
`provider-invalid` on the Asset's `package.json` means the installed `@vtex/faststore` has no
|
|
39
|
+
storefront provider. `provider-failed` means the provider threw. Both belong to the SDK, so the
|
|
40
|
+
human decides which `@vtex/faststore` to install.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# The UI side
|
|
2
|
+
|
|
3
|
+
The UI side is the set of components under `src/components/`, each registered with
|
|
4
|
+
`defineComponent` from `@vtex/faststore`, and the barrel `src/index.ts` a store imports them from.
|
|
5
|
+
The provider builds a catalog of the registrations. A store reads the catalog to place the
|
|
6
|
+
components and compiles them from `src/`; the Asset ships no JavaScript build.
|
|
7
|
+
|
|
8
|
+
## A component
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { defineComponent } from '@vtex/faststore';
|
|
12
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
13
|
+
|
|
14
|
+
/** Props for {@link HeroBanner}. Extends all native `<section>` attributes. */
|
|
15
|
+
export type HeroBannerProps = ComponentPropsWithRef<'section'> & {
|
|
16
|
+
/** The headline text. */
|
|
17
|
+
title?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const HeroBannerDefinition = defineComponent<HeroBannerProps>({
|
|
21
|
+
name: 'HeroBanner',
|
|
22
|
+
importPath: '@acme/reviews-ui',
|
|
23
|
+
component: HeroBanner,
|
|
24
|
+
editor: { label: 'Hero Banner', category: 'content' },
|
|
25
|
+
schema: {
|
|
26
|
+
title: { type: 'string', label: 'Title' },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function HeroBanner({ title, className, ...props }: HeroBannerProps) {
|
|
31
|
+
return (
|
|
32
|
+
<section {...props} className={className} data-fs-hero-banner="">
|
|
33
|
+
<h1>{title}</h1>
|
|
34
|
+
</section>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Field | What it is |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `name` | The exported function's name. |
|
|
42
|
+
| `importPath` | The Asset's `package.json#name`. A store imports the component from there. |
|
|
43
|
+
| `component` | The function. A function declaration hoists, so the definition may come first. |
|
|
44
|
+
| `editor` | `label`, the name an editor shows, and `category`, a free string that groups it. `description` and `icon` are optional. |
|
|
45
|
+
| `schema` | The editable props. Each has a `type` (`string`, `number`, `boolean`, `object`, `array` or a list of string literals), an optional `label` and an optional `default`; an `array` may name its allowed elements in `items`. Values are serializable: strings, numbers, booleans, objects and arrays of them. |
|
|
46
|
+
|
|
47
|
+
The provider finds definitions by a static scan of `src/components/`, recursive, skipping
|
|
48
|
+
`*.test.tsx`, `*.stories.tsx` and `generated/`. Export each one as a top-level `const` named
|
|
49
|
+
`<Component>Definition` whose argument is an object literal.
|
|
50
|
+
|
|
51
|
+
The root element carries `data-fs-<component>=""` as its identity, and `data-fs-<component>-<prop>`
|
|
52
|
+
for each prop that changes its look. The component accepts `className` and renders it. A store
|
|
53
|
+
styles it through those attributes, so the component ships no CSS.
|
|
54
|
+
|
|
55
|
+
## The barrel
|
|
56
|
+
|
|
57
|
+
`src/index.ts` re-exports every component and its definition:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
export type { HeroBannerProps } from './components/HeroBanner';
|
|
61
|
+
export { HeroBanner, HeroBannerDefinition } from './components/HeroBanner';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It is the `exports["."]` target. With `exports["./catalog.json"]` set, the provider reads it as the
|
|
65
|
+
barrel, never as a declaration.
|
|
66
|
+
|
|
67
|
+
## The catalog
|
|
68
|
+
|
|
69
|
+
Each registration becomes one catalog entry keyed `<packageName>:<Component>`, for example
|
|
70
|
+
`@acme/reviews-ui:HeroBanner`. The package name, taken verbatim from `package.json#name`, is the
|
|
71
|
+
namespace, so two Assets never collide.
|
|
72
|
+
|
|
73
|
+
`dev` builds `dist/catalog.json` at boot and on every save under `src/`; `exports["./catalog.json"]`
|
|
74
|
+
points there, and git ignores `dist/`. `build` writes the same file there beside its output folder,
|
|
75
|
+
so a store built after `pnpm extension build` finds it without a `dev` loop. `validate` builds the
|
|
76
|
+
catalog into the Asset's `.vtex/storefront/` scratch folder and leaves `dist/` as it is. A failed
|
|
77
|
+
build keeps the previous `catalog.json` until the next save fixes it.
|
|
78
|
+
|
|
79
|
+
A store sees the Asset as a UI side through the `./catalog.json` export alone. Without it, no store
|
|
80
|
+
sees the components, and `validate` reports `storefront-catalog-export-missing`. The export must
|
|
81
|
+
name a `./` path inside the Asset, since `dev` and `build` write the catalog where it points; one
|
|
82
|
+
that does not is `storefront-catalog-export-invalid`, and the catalog goes to `dist/` meanwhile.
|
|
83
|
+
|
|
84
|
+
## Props and content only
|
|
85
|
+
|
|
86
|
+
Keep each component to its props and editor content. A GraphQL fragment spread fails the catalog
|
|
87
|
+
build with `UnresolvedSpread` (reported as `storefront-catalog-invalid`), because no convention yet
|
|
88
|
+
names where a storefront Asset's generated fragments live.
|
|
89
|
+
|
|
90
|
+
## What validate checks here
|
|
91
|
+
|
|
92
|
+
`validate` fails a UI side whose `package.json` lacks the `./catalog.json` export, whose
|
|
93
|
+
`src/components/` declares no component, that has two components with one name, or that spreads a
|
|
94
|
+
fragment with no definition.
|
package/src/styles/tailwind.css
CHANGED
|
@@ -63,4 +63,31 @@
|
|
|
63
63
|
[data-fs-card-entry-fieldset] {
|
|
64
64
|
min-inline-size: 0;
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
/* Baseline look and viewport bound for the select popup. Nothing else styles it, and a matter-composed
|
|
68
|
+
popup is portaled out of reach of a store's descendant selectors, so unstyled it is transparent text
|
|
69
|
+
drawn over the next field, content-wide and free to run past the viewport. `--anchor-width` and
|
|
70
|
+
`--available-height` are set on the positioner by Base UI; the latter bounds the popup (not the list)
|
|
71
|
+
to the viewport. Preflight's `border-box` counts the 1px border inside that bound, and the flex column
|
|
72
|
+
hands the leftover height, minus any composed scroll arrows, to the list, so a tall popup never
|
|
73
|
+
overruns the viewport by the border or the arrows. `@layer base` so any merchant utility class (`max-h-60`,
|
|
74
|
+
`overflow-*`) outranks it under Tailwind 4's layer order. */
|
|
75
|
+
[data-fs-select-popup] {
|
|
76
|
+
max-height: var(--available-height);
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
min-width: var(--anchor-width);
|
|
80
|
+
background-color: var(--color-bg);
|
|
81
|
+
border: 1px solid var(--color-border);
|
|
82
|
+
border-radius: var(--radius-md);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* The list, not the popup, is the scroll container: that is the Select contract (`SelectList` is the
|
|
86
|
+
"scrollable container"), and Base UI's scroll arrows watch the list's scroll position, so a popup
|
|
87
|
+
that scrolled instead would leave them inert. `min-height: 0` lets the flex item shrink below its
|
|
88
|
+
content so the popup's bound reaches it. */
|
|
89
|
+
[data-fs-select-list] {
|
|
90
|
+
min-height: 0;
|
|
91
|
+
overflow-y: auto;
|
|
92
|
+
}
|
|
66
93
|
}
|