@vtex/faststore 0.0.4 → 0.0.5

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/catalog.json +67 -1
  3. package/dist/components.d.ts +4 -1
  4. package/dist/components.js +5 -2
  5. package/dist/content-types.json +73 -0
  6. package/dist/docs/account-access-gate.md +153 -0
  7. package/dist/docs/account-entry-point.md +1 -2
  8. package/dist/docs/account-menu.md +164 -0
  9. package/dist/docs/buy-button.md +1 -1
  10. package/dist/docs/cart.md +1 -1
  11. package/dist/docs/session.md +1 -1
  12. package/dist/docs/sign-in-redirect.md +1 -1
  13. package/dist/matter/account-access-gate/account-access-gate.d.ts +86 -0
  14. package/dist/matter/account-access-gate/account-access-gate.js +283 -0
  15. package/dist/matter/account-access-gate/account-access-gate.js.map +1 -0
  16. package/dist/matter/account-access-gate/sign-out-intent.d.ts +17 -0
  17. package/dist/matter/account-access-gate/sign-out-intent.js +62 -0
  18. package/dist/matter/account-access-gate/sign-out-intent.js.map +1 -0
  19. package/dist/matter/account-entry-point/account-entry-point.js +2 -2
  20. package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
  21. package/dist/matter/account-menu/account-menu.d.ts +88 -0
  22. package/dist/matter/account-menu/account-menu.js +246 -0
  23. package/dist/matter/account-menu/account-menu.js.map +1 -0
  24. package/dist/matter/cart/cart.d.ts +1 -1
  25. package/dist/matter/cart/cart.js +2 -2
  26. package/dist/matter/cart/cart.js.map +1 -1
  27. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  28. package/dist/matter/my-account-profile/my-account-profile.js +1 -1
  29. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  30. package/dist/matter/shipping-address/shipping-address.js +1 -1
  31. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  32. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  33. package/dist/particles/footer-social/footer-social.js +1 -1
  34. package/dist/particles/incentives/incentives.js +1 -1
  35. package/dist/sdk/actions/cart-action-provider.d.ts +1 -1
  36. package/dist/sdk/actions/cart-action-provider.js +1 -1
  37. package/dist/sdk/actions/cart-action-provider.js.map +1 -1
  38. package/dist/sdk/actions/session-action-provider.d.ts +1 -1
  39. package/dist/sdk/actions/session-action-provider.js +1 -1
  40. package/dist/sdk/actions/session-action-provider.js.map +1 -1
  41. package/dist/sdk/actions/shipping-action-provider.d.ts +1 -1
  42. package/dist/sdk/actions/shipping-action-provider.js +1 -1
  43. package/dist/sdk/actions/shipping-action-provider.js.map +1 -1
  44. package/dist/sdk/cache/storefront-cache.js +1 -1
  45. package/dist/sdk/cache/storefront-cache.js.map +1 -1
  46. package/dist/sdk/cart/operations.d.ts +4 -4
  47. package/dist/sdk/cart/operations.js +1 -1
  48. package/dist/sdk/cart/operations.js.map +1 -1
  49. package/dist/sdk/cart/optimistic.js +1 -1
  50. package/dist/sdk/cart/optimistic.js.map +1 -1
  51. package/dist/sdk/cart/use-cart-actions.d.ts +1 -1
  52. package/dist/sdk/cart/use-cart-actions.js +3 -3
  53. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  54. package/dist/sdk/cart/use-cart-validate-on-open.js +1 -1
  55. package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
  56. package/dist/sdk/cart/write-gate.js +1 -1
  57. package/dist/sdk/cart/write-gate.js.map +1 -1
  58. package/dist/sdk/data/page-reactive-data-root.d.ts +2 -2
  59. package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
  60. package/dist/sdk/data/reactive-data-provider.d.ts +1 -1
  61. package/dist/sdk/data/reactive-data-provider.js +1 -1
  62. package/dist/sdk/data/reactive-data-provider.js.map +1 -1
  63. package/dist/sdk/data/reactive-list-item-data-provider.d.ts +1 -1
  64. package/dist/sdk/data/reactive-list-item-data-provider.js +1 -1
  65. package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -1
  66. package/dist/sdk/data/use-reactive-entity.js +1 -1
  67. package/dist/sdk/data/use-reactive-entity.js.map +1 -1
  68. package/dist/sdk/generated/gql.js +2 -1
  69. package/dist/sdk/generated/gql.js.map +1 -1
  70. package/dist/sdk/generated/graphql.js +85 -1
  71. package/dist/sdk/generated/graphql.js.map +1 -1
  72. package/dist/sdk/identity/operations.js.map +1 -1
  73. package/dist/sdk/identity/use-identity-actions.d.ts +1 -1
  74. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  75. package/dist/sdk/session/auth-operations.d.ts +1 -1
  76. package/dist/sdk/session/auth-operations.js.map +1 -1
  77. package/dist/sdk/session/use-session-actions.d.ts +1 -1
  78. package/dist/sdk/session/use-session-actions.js.map +1 -1
  79. package/dist/sdk/session/use-session-revalidation.js +65 -0
  80. package/dist/sdk/session/use-session-revalidation.js.map +1 -0
  81. package/dist/sdk/shipping/option-select-operations.d.ts +1 -1
  82. package/dist/sdk/shipping/option-select-operations.js.map +1 -1
  83. package/dist/sdk/shipping/request-timeout.js +1 -1
  84. package/dist/sdk/shipping/request-timeout.js.map +1 -1
  85. package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
  86. package/dist/sdk/shipping/shipping-operations.js.map +1 -1
  87. package/dist/sdk/shipping/use-shipping-actions.d.ts +2 -2
  88. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  89. package/dist/sdk/state/cart.d.ts +3 -4
  90. package/dist/sdk/state/cart.js +6 -7
  91. package/dist/sdk/state/cart.js.map +1 -1
  92. package/dist/utils/safe-href.js +3 -3
  93. package/dist/utils/safe-href.js.map +1 -1
  94. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"cart.js","names":[],"sources":["../../../src/matter/cart/cart.tsx"],"sourcesContent":["'use client';\n\nimport type { ErrorLike } from '@apollo/client';\nimport { useApolloClient, useReactiveVar } from '@apollo/client/react';\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport { useLinkStatus } from 'next/link';\nimport { useRouter } from 'next/navigation';\nimport {\n type ComponentPropsWithRef,\n cloneElement,\n createContext,\n isValidElement,\n type ReactNode,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { DrawerClose, type DrawerRootProps } from '../../particles/drawer/drawer.js';\nimport { Icon } from '../../particles/icon/icon.js';\nimport { Image } from '../../particles/image/image.js';\nimport { NavigationLink, type NavigationLinkProps } from '../../particles/navigation-link/navigation-link.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport type { AppliedCoupon, CartEntity, Money } from '../../sdk/cart/operations.js';\nimport { readCartFromCache } from '../../sdk/cart/use-cart-actions.js';\nimport { useCartValidateOnOpen } from '../../sdk/cart/use-cart-validate-on-open.js';\nimport { awaitCartWrites } from '../../sdk/cart/write-gate.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ListItemRefContext } from '../../sdk/data/list-item-ref-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { graphql } from '../../sdk/generated/gql.js';\nimport {\n cartCouponErrorsVar,\n cartLastAddVar,\n cartUserErrorsVar,\n miniCartOpenVar,\n orderFormIdVar,\n} from '../../sdk/state/cart.js';\n\n// ---------------------------------------------------------------------------\n// Content models — merchant-editable copy. `$content` wins when a content entry is present; the\n// schema prop of the same name is the fallback in a non-CMS store, which issues no content read at\n// all (rfc-content-only-cms-integration). The disclaimer deliberately ships no default copy: legal\n// or conditional wording the package invented would assert conditions no merchant agreed to.\n// ---------------------------------------------------------------------------\n\nexport const CartDisclaimerContent = defineContentType({\n id: 'cart-disclaimer',\n title: 'Cart Disclaimer',\n description: 'Conditions, limits, or legal wording shown in the cart before checkout.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: { type: 'string', minLength: 1, title: 'Disclaimer text' },\n },\n },\n});\n\n// The checkout CTA's wording is a merchant decision, so it comes from a content entry with the\n// schema prop as the non-CMS fallback. Label only: re-pointing checkout is not a copy decision, so\n// the destination stays an authored prop and never joins this channel. No `default` here — an\n// untouched slot has to stay unfilled, or a prefilled entry would outrank the label a store already\n// authored.\nexport const CartCheckoutLabelContent = defineContentType({\n id: 'cart-checkout-label',\n title: 'Cart Checkout Label',\n description: 'Editorial label for the checkout call to action.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['label'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Checkout label' },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type CartDataContextValue = Readonly<{\n cart: CartEntity | null;\n /**\n * Cart query error surfaced by the reactive root. `cart` is non-null on the server (`Cart!`),\n * so `cart: null` + `error` means the fetch failed — not an empty cart.\n */\n error: ErrorLike | null;\n}>;\n\nexport type CartRootProps = ComponentPropsWithRef<'div'> & {\n /**\n * Cart entity slice forwarded by the reactive runtime (`ReactiveDataProvider`) — it is the value\n * of the `cart` top-level field on `CartData on Query`, not the wrapping `{ cart: … }` shape.\n * Receives `null` when the cart is not yet seeded (e.g. server returned no cart for the current\n * session, or `orderFormIdVar` is still null).\n */\n $data?: CartEntity | null;\n};\n\nexport type CartListProps = ComponentPropsWithRef<'div'> & {\n /** Number of CartItemSkeleton rows to render while the cart is still loading (FR-7). */\n skeletonCount?: number;\n};\n\nexport type CartTotalProps = ComponentPropsWithRef<'span'> & {\n label?: string;\n};\n\nexport type CartCountProps = ComponentPropsWithRef<'span'> & {\n template?: string;\n};\n\nexport type CartErrorProps = ComponentPropsWithRef<'div'>;\n\n// `$content` is omitted from the inherited props on purpose: NavigationLink's model also carries the\n// destination and target, and this CTA's content channel is the label alone.\nexport type CartGoCheckoutProps = Omit<NavigationLinkProps, 'href' | '$content'> & {\n href?: string;\n /** Authored fallback for the button label; `children` still works for stores that label it there. */\n label?: string;\n /** Merchant-authored label, sliced from the page/layout content entry; wins over the label prop and\n * over children. Absent in a non-CMS store — the props are the fallback. */\n $content?: ContentValue<typeof CartCheckoutLabelContent>;\n /** Injected by the compiler from `actions: { cart: ['validate'] }`; the stock-validation write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartCouponFormProps = ComponentPropsWithRef<'form'> & {\n placeholder?: string;\n applyLabel?: string;\n /** Injected by the compiler from `actions: { cart: ['applyCoupon'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartAppliedCouponsProps = ComponentPropsWithRef<'div'> & {\n /** Injected by the compiler from `actions: { cart: ['removeCoupon'] }`; forwarded to the built-in chip's remove control. */\n $actions?: ComponentActions;\n};\n\nexport type CartCouponRemoveProps = ComponentPropsWithRef<'button'> & {\n /**\n * The coupon code this control removes. Normally supplied by the enclosing CartAppliedCoupons\n * chip via context; pass it explicitly to override or to use the control standalone.\n */\n code?: string;\n /** Injected by the compiler from `actions: { cart: ['removeCoupon'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartCouponErrorProps = ComponentPropsWithRef<'div'>;\n\nexport type CartDisclaimerProps = ComponentPropsWithRef<'p'> & {\n /**\n * Authored fallback, rendered when no CMS entry supplies the notice. Ranks below `children`:\n * `children ?? $content?.text ?? text`.\n */\n text?: string;\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: ContentValue<typeof CartDisclaimerContent>;\n};\n\nexport type CartCheckoutGuardProps = ComponentPropsWithRef<'div'>;\nexport type CartLoadingProps = ComponentPropsWithRef<'div'>;\nexport type CartEmptyProps = ComponentPropsWithRef<'div'>;\nexport type CartFilledProps = ComponentPropsWithRef<'div'>;\n\nexport type CartEmptyMessageProps = ComponentPropsWithRef<'p'> & {\n /** Authored fallback, rendered when no CMS entry supplies the message. */\n text?: string;\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: ContentValue<typeof CartEmptyMessageContent>;\n};\n\nexport type CartContinueShoppingProps = ComponentPropsWithRef<'button'> & {\n /** Authored fallback, rendered when no CMS entry supplies the label. Children win over both. */\n label?: string;\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: ContentValue<typeof CartContinueShoppingContent>;\n};\n\nexport type CartUnavailableCountProps = ComponentPropsWithRef<'span'> & {\n /** Output format; `{count}` is replaced by the integer count. */\n template?: string;\n};\n\nexport type CartRemoveUnavailableProps = ComponentPropsWithRef<'button'> & {\n /** Injected by the compiler from `actions: { cart: ['removeItems'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartOpenOnAddProps = {\n children?: ReactNode;\n /** Injected by the compiler from `actions: { cart: ['validate'] }`; drives the validate-on-open call. */\n $actions?: ComponentActions;\n};\n\nexport type CartRedirectOnAddProps = {\n href?: string;\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — typed via @graphql-codegen client-preset (T7)\n// ---------------------------------------------------------------------------\n\n// CartRoot is the reactive read root. It fetches item refs plus the per-item scalars the cart-level\n// aggregate reads cross-cuttingly — `quantity` and `gift` (CartCount, which counts only the lines the\n// shopper added) and `variant.availability` (CartCheckoutGuard) — plus the cart totals, messages, and\n// coupons. The display-only per-item scalars (prices, name, sku, image, product) are owned by\n// CartItemRoot's own `reactive-list-item` fragment and merge un-aliased onto the shared\n// `cart { items }` path (ADR-0012 Option B). The MUTATION fragment (`CartFragment` →\n// `CartItemFragment` in operations.ts) stays whole so writes normalize a complete `CartItem` into the\n// cache for the per-item `useFragment` to read — which is why `gift` joins it too.\nconst fragment = graphql(`\n fragment CartData on Query {\n cart {\n __typename\n id\n items {\n __typename\n id\n quantity\n gift\n variant {\n __typename\n availability\n }\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// ---------------------------------------------------------------------------\n// Money formatting — shared by the cart aggregate and the cart-item leaves\n// ---------------------------------------------------------------------------\n\nexport function formatPrice(value: number, locale: string, currency: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value);\n}\n\n// ---------------------------------------------------------------------------\n// Cart total value context — provided by CartRoot and CartTotalizerRoot so that\n// CartTotal works inside either root without a circular import.\n// ---------------------------------------------------------------------------\n\nexport const CartTotalValueContext = createContext<Money | null>(null);\n\n// ---------------------------------------------------------------------------\n// Cart data context (read-only cart entity + query error)\n// ---------------------------------------------------------------------------\n\nconst CART_DATA_UNSET = Symbol('CartDataContextUnset');\n\nconst CartDataContextInternal = createContext<CartDataContextValue | typeof CART_DATA_UNSET>(CART_DATA_UNSET);\n\nexport const CartDataContext = CartDataContextInternal as React.Context<CartDataContextValue>;\n\n/**\n * Read the current cart entity and query error from the nearest `CartRoot`. Throws when called\n * outside a `CartRoot` subtree.\n *\n * Cart *writes* no longer flow through this context — they are dispatched via the compiler-injected\n * `$actions.cart.*` prop (the `cart` action namespace), which reads/writes the cache directly and\n * needs no `CartRoot` ancestor (specs/actions.md, ADR-0010). This hook is reads only.\n */\nexport function useCart(): CartDataContextValue {\n const ctx = useContext(CartDataContextInternal);\n if (ctx === CART_DATA_UNSET) {\n throw new Error('useCart() must be used inside a <CartRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Cart coupon context (provided by CartAppliedCoupons per applied coupon)\n// ---------------------------------------------------------------------------\n\nconst CartCouponContext = createContext<AppliedCoupon | null>(null);\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const CartRootDefinition = defineComponent<CartRootProps>({\n name: 'CartRoot',\n importPath: '@vtex/faststore/components',\n component: CartRoot,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Cart Root', category: 'commerce' },\n schema: {},\n guideline:\n 'Cart data provider hosted by the layout (shared shell), wrapping the slot so every page consumes its context; exactly one per tree — do not place it as a page root. To build a mini-cart, wrap this CartRoot subtree in a modal DrawerRoot: the header carries a DrawerTrigger with a CartCount badge, the DrawerPopup body is a CartList line-item template, and its footer is CartTotal plus CartGoCheckout. The mini-cart is this layout composition, not a dedicated component. See cart.md.',\n});\n\nexport const CartListDefinition = defineComponent<CartListProps>({\n name: 'CartList',\n importPath: '@vtex/faststore/components',\n component: CartList,\n editor: { label: 'Cart List', category: 'commerce' },\n schema: {\n skeletonCount: { type: 'number', default: 3, label: 'Skeleton Count' },\n },\n // Declares the per-line iteration context (ADR-0009): a `reactive-list-item` sub-matter placed\n // inside CartList `requiresContext: 'cart-item'`, and the build-time `validateContextConstraints`\n // walk reports a misplaced one. Runtime: CartList publishes each line's ref via ListItemRefContext.\n providesContext: 'cart-item',\n guideline:\n 'Renders its children once per cart item; wrap the line-item template in a CartItemRoot and place CartItem* components inside it to define the template (e.g. CartItemImage, CartItemName, CartItemPrice, a CartItemQuantity stepper, CartItemRemove). While the cart is loading it renders skeletonCount CartItemSkeleton placeholders instead. In a mini-cart it is the scrollable body of the DrawerPopup. Must be inside CartRoot.',\n});\n\nexport const CartTotalDefinition = defineComponent<CartTotalProps>({\n name: 'CartTotal',\n importPath: '@vtex/faststore/components',\n component: CartTotal,\n editor: { label: 'Cart Total', category: 'commerce' },\n schema: {\n label: { type: 'string', label: 'Label' },\n },\n guideline:\n 'The single root-agnostic grand-total component: renders the cart grand total, formatted from the active storefront context, reading the value from the nearest CartRoot or CartTotalizerRoot. Set the optional label prop to render a label alongside the value (e.g. \"Total\"); omit it to render the value alone. In a mini-cart it sits in the DrawerPopup footer alongside CartGoCheckout, inside a CartCheckoutGuard, so the total is visible at the checkout button.',\n});\n\nexport const CartCountDefinition = defineComponent<CartCountProps>({\n name: 'CartCount',\n importPath: '@vtex/faststore/components',\n component: CartCount,\n editor: { label: 'Cart Count', category: 'commerce' },\n schema: {\n template: { type: 'string', default: '{count}', label: 'Template' },\n },\n guideline:\n \"Renders the total item count in the cart; use the template prop to customize the format (e.g. '{count} produtos'). Gift lines are excluded from the count — a promotional gift is not something the shopper added — so a cart holding only gifts shows 0. In a mini-cart, place it as the badge on the header DrawerTrigger and again in the DrawerPopup header. Must be inside CartRoot.\",\n});\n\nexport const CartErrorDefinition = defineComponent<CartErrorProps>({\n name: 'CartError',\n importPath: '@vtex/faststore/components',\n component: CartError,\n editor: { label: 'Cart Error', category: 'commerce' },\n schema: {},\n guideline: 'Inline error banner that surfaces cart mutation errors. Must be inside CartRoot.',\n});\n\nexport const CartGoCheckoutDefinition = defineComponent<CartGoCheckoutProps>({\n name: 'CartGoCheckout',\n importPath: '@vtex/faststore/components',\n component: CartGoCheckout,\n content: CartCheckoutLabelContent,\n editor: { label: 'Cart Go Checkout', category: 'commerce' },\n schema: {\n href: { type: 'string', default: '/checkout', label: 'Checkout URL' },\n label: { type: 'string', default: 'Checkout', label: 'Checkout label' },\n },\n actions: { cart: ['validate'] },\n guideline:\n 'Navigation link to the checkout page (default href /checkout); use as the checkout CTA inside the cart summary. In a mini-cart it is the DrawerPopup footer CTA, next to CartTotal. The button wording is merchant-editable content: a CMS entry wins, then the label prop (default \"Checkout\"), then children — so a store that labels the button through children keeps working and a CMS save overrides it without a deploy. The destination is not content-editable: href stays an authored prop, because re-pointing checkout is not a copy decision. Before routing it runs a stock validation and only navigates when the re-checked cart has no unavailable line; a validation that cannot run falls open and navigates anyway. During a client-side route transition to checkout it surfaces a loading state on its content wrapper as aria-busy plus data-fs-cart-go-checkout-pending, and while the pre-checkout validation runs it exposes data-fs-cart-go-checkout-validating — there is no built-in spinner, so opt into one by styling those attributes (e.g. composing a Spinner). For an external or hard checkout navigation there is no client-side transition, so the loading state simply does not show (a graceful no-op). The enriched footer checkout CTA is CartCheckoutGuard wrapping CartTotal and this CartGoCheckout: the guard makes the CTA inert (data-fs-cart-checkout-blocked) while any item is unavailable, and CartTotal shows the grand total at the button. Must be inside CartRoot.',\n});\n\nexport const CartCouponFormDefinition = defineComponent<CartCouponFormProps>({\n name: 'CartCouponForm',\n importPath: '@vtex/faststore/components',\n component: CartCouponForm,\n editor: { label: 'Cart Coupon Form', category: 'commerce' },\n schema: {\n placeholder: { type: 'string', label: 'Placeholder' },\n applyLabel: { type: 'string', label: 'Apply Label' },\n },\n actions: { cart: ['applyCoupon'] },\n guideline:\n 'Coupon code input plus an apply button; root-agnostic (dispatches $actions.cart.applyCoupon). While an apply is in flight it disables the input and button and exposes data-fs-cart-coupon-pending. In a mini-cart it sits in the DrawerPopup footer above the totals; pair it with CartAppliedCoupons (the applied list) and CartCouponError (the error banner). Must be inside CartRoot.',\n});\n\nexport const CartAppliedCouponsDefinition = defineComponent<CartAppliedCouponsProps>({\n name: 'CartAppliedCoupons',\n importPath: '@vtex/faststore/components',\n component: CartAppliedCoupons,\n editor: { label: 'Cart Applied Coupons', category: 'commerce' },\n schema: {},\n actions: { cart: ['removeCoupon'] },\n guideline:\n 'Renders one chip per applied coupon (cart.appliedCoupons), each showing its code and a CartCouponRemove control; renders nothing when no coupons are applied. A coupon whose conditions did not match is marked with data-fs-cart-coupon-unmatched. Place it next to CartCouponForm in the mini-cart footer. Must be inside CartRoot.',\n});\n\nexport const CartCouponRemoveDefinition = defineComponent<CartCouponRemoveProps>({\n name: 'CartCouponRemove',\n importPath: '@vtex/faststore/components',\n component: CartCouponRemove,\n editor: { label: 'Cart Coupon Remove', category: 'commerce' },\n schema: {\n code: { type: 'string', label: 'Coupon Code' },\n },\n actions: { cart: ['removeCoupon'] },\n guideline:\n \"The per-chip remove control (the X); dispatches $actions.cart.removeCoupon for that chip's code. Use inside a CartAppliedCoupons chip, which supplies the code via context. If used standalone (no CartAppliedCoupons ancestor), pass the code prop explicitly — without a code the remove action has no target and the button is a no-op.\",\n});\n\nexport const CartCouponErrorDefinition = defineComponent<CartCouponErrorProps>({\n name: 'CartCouponError',\n importPath: '@vtex/faststore/components',\n component: CartCouponError,\n editor: { label: 'Cart Coupon Error', category: 'commerce' },\n schema: {},\n guideline:\n 'Inline error banner that surfaces coupon apply/remove errors next to the CartCouponForm; renders nothing when there are none. Reads a dedicated coupon error channel, separate from CartError. Must be inside CartRoot.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function CartRoot({ $data: $dataProp, className, children, ...props }: CartRootProps) {\n const $data = useDataOverride($dataProp);\n const cart = $data ?? null;\n const { error: rootError } = useContext(ReactiveRootContext);\n\n // Hydrate the cart action's ready gate from the cart query response: once the entity arrives, the\n // existing-line writes (remove / quantity) can read it from the cache without a prior addItem.\n const cartEntityId = cart?.id ?? null;\n useEffect(() => {\n if (cartEntityId) orderFormIdVar(cartEntityId);\n }, [cartEntityId]);\n\n // Read-only context: the cart entity + query error. Cart writes are dispatched through\n // `$actions.cart.*`, not this context (ADR-0010).\n const dataValue: CartDataContextValue = useMemo(() => ({ cart, error: rootError ?? null }), [cart, rootError]);\n\n return (\n <CartTotalValueContext value={cart?.total ?? null}>\n <CartDataContextInternal value={dataValue}>\n <div {...props} className={className} data-fs-cart-root=\"\">\n {children}\n </div>\n </CartDataContextInternal>\n </CartTotalValueContext>\n );\n}\n\nexport function CartList({ className, children, skeletonCount = 3, ...props }: CartListProps) {\n const { cart } = useCart();\n const { loading } = useContext(ReactiveRootContext);\n const items = cart?.items ?? [];\n\n // FR-7: while the reactive cart query is in flight and no cart has resolved yet, render\n // skeleton placeholders instead of an empty list. Once data arrives (cart non-null) the real\n // lines render; a refetch over an existing cart keeps showing the items, not skeletons.\n if (loading && cart == null) {\n return (\n <div {...props} className={className} data-fs-cart-list=\"\">\n {Array.from({ length: skeletonCount }, (_, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static placeholders have no stable id\n <CartItemSkeleton key={i} />\n ))}\n </div>\n );\n }\n\n return (\n <div {...props} className={className} data-fs-cart-list=\"\">\n {items.map((item) => (\n // Publish the line's entity ref so each per-item provider (CartItemRoot,\n // CartItemSellerInfo, …) wrapped by <ReactiveListItemDataProvider> subscribes to\n // CartItem:<id> and falls back to this server-rendered slice until the cache is complete.\n // The per-line React context (CartItemContext) is provided by CartItemRoot, sliced — CartList\n // no longer fans the whole entity out (ADR-0012 Option B).\n <ListItemRefContext key={item.id} value={{ __typename: 'CartItem', id: item.id, fallbackData: item }}>\n {children}\n </ListItemRefContext>\n ))}\n </div>\n );\n}\n\nexport function CartTotal({ label, className, children, ...props }: CartTotalProps) {\n const total = useContext(CartTotalValueContext);\n const { locale, currency } = useStorefrontContext();\n const value = children ?? formatPrice(total?.amount ?? 0, locale, currency);\n\n return (\n <span {...props} className={className} data-fs-cart-total=\"\" data-fs-text=\"\">\n {label == null ? (\n value\n ) : (\n <>\n <span>{label}</span>\n <span>{value}</span>\n </>\n )}\n </span>\n );\n}\n\nexport function CartCount({ className, children, template = '{count}', ...props }: CartCountProps) {\n const { cart } = useCart();\n // Gift lines are left out — a promotion added them, not the shopper. A gift-only cart therefore\n // counts 0 while still rendering filled: the three-state branch gates on items.length, not on this.\n const count = cart?.items.reduce((sum, item) => (item.gift ? sum : sum + item.quantity), 0) ?? 0;\n\n return (\n <span {...props} className={className} data-fs-cart-count=\"\" data-fs-text=\"\">\n {children ?? template.replace('{count}', String(count))}\n </span>\n );\n}\n\nexport function CartError({ className, children, ...props }: CartErrorProps) {\n const userErrors = useReactiveVar(cartUserErrorsVar);\n const [firstError] = userErrors;\n if (!firstError) return null;\n\n return (\n <div {...props} role=\"alert\" className={className} data-fs-cart-error=\"\" data-fs-text=\"\">\n {children ?? firstError.message}\n </div>\n );\n}\n\n// `useLinkStatus()` only reports a pending window from a component rendered inside the <Link>, so\n// the loading state lives in this module-private child rather than in CartGoCheckout's body. No\n// built-in spinner: stores opt in by styling data-fs-cart-go-checkout-pending (mirrors buy-button).\nfunction CartGoCheckoutPending({ children }: { children?: ReactNode }) {\n const { pending } = useLinkStatus();\n\n return (\n <span\n data-fs-cart-go-checkout-content=\"\"\n aria-busy={pending || undefined}\n {...(pending ? { 'data-fs-cart-go-checkout-pending': '' } : {})}\n >\n {children}\n </span>\n );\n}\n\n// A blank value counts as unconfigured: the model's minLength is enforced by neither the runtime\n// slice nor the preflight, and an authored empty string is the same mistake. Trim to decide, never to\n// render.\nfunction configuredLabel(value: string | undefined) {\n return value?.trim() ? value : undefined;\n}\n\n// Internal vs external navigation: a site-relative checkout route is a client-side transition\n// (router.push, which keeps the pending state working); an absolute off-site checkout URL is a hard\n// navigation. Both run only after the validate gate has decided to proceed.\nfunction navigateToCheckout(href: string, push: (href: string) => void): void {\n if (/^https?:\\/\\//i.test(href)) {\n globalThis.location.assign(href);\n } else {\n push(href);\n }\n}\n\nexport function CartGoCheckout({\n href = '/checkout',\n label,\n className,\n children,\n onClick,\n $content,\n $actions: $actionsProp,\n ...props\n}: CartGoCheckoutProps) {\n const $actions = useActionsOverride($actionsProp);\n const client = useApolloClient();\n const router = useRouter();\n const [validating, setValidating] = useState(false);\n // Re-entrancy latch. A ref, not `validating`, because two clicks in one tick both read the same\n // pre-render state value; a ref is set synchronously so the second click sees the reservation.\n const inFlight = useRef(false);\n\n // `label` gets no destructuring default on purpose: it has to stay undefined when a store did not\n // author it, or it would shadow the `children` label every store still writes today. The literal\n // terminates the chain instead, which is what keeps the link from ever losing its accessible name.\n // $content stays here and is never spread into NavigationLink, so no entry can reach the href.\n // String children go through the same blank check as the props, so an empty or whitespace-only\n // authored label can never leave the link without an accessible name; element children (an icon\n // composition) pass through untouched.\n const resolvedChildren = typeof children === 'string' ? configuredLabel(children) : children;\n const resolvedLabel = configuredLabel($content?.label) ?? configuredLabel(label) ?? resolvedChildren ?? 'Checkout';\n\n // Pre-checkout stock validation (specs/mini-cart-validation-wiring.md, FR-6 / Decision 3). Intercept\n // the CTA, await any in-flight write, validate, then branch on the outcome: a validation that could\n // not run navigates anyway (fail-open, unconditional — holds with or without a CartCheckoutGuard); a\n // validation that succeeded navigates only when the corrected cart has no unavailable line. Reading\n // the cache after the await is deterministic because Apollo commits the mutation's cache write before\n // the promise resolves.\n async function handleClick(e: React.MouseEvent<HTMLAnchorElement>) {\n onClick?.(e);\n const validate = $actions?.cart?.validate;\n // No gate wired → the link behaves natively. Modified clicks (new tab, middle-click) and clicks\n // another handler already owns are left to the browser.\n if (!validate) return;\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n e.preventDefault();\n // Re-entrant clicks while a validation is running are swallowed, never a second dispatch.\n if (inFlight.current) return;\n inFlight.current = true;\n\n setValidating(true);\n try {\n await awaitCartWrites();\n const errors = await validate();\n if (errors.length > 0) {\n navigateToCheckout(href, router.push);\n return;\n }\n const cart = readCartFromCache(client);\n const blocked = (cart?.items ?? []).some((item) => item.variant.availability !== 'AVAILABLE');\n if (!blocked) navigateToCheckout(href, router.push);\n } finally {\n inFlight.current = false;\n setValidating(false);\n }\n }\n\n return (\n <NavigationLink\n {...props}\n href={href}\n onClick={handleClick}\n className={className}\n data-fs-cart-go-checkout=\"\"\n {...(validating ? { 'data-fs-cart-go-checkout-validating': '' } : {})}\n >\n <CartGoCheckoutPending>{resolvedLabel}</CartGoCheckoutPending>\n </NavigationLink>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Coupon — apply / applied list + remove / error (FSPG-830)\n// ---------------------------------------------------------------------------\n\nexport function CartCouponForm({\n placeholder = 'Coupon code',\n applyLabel = 'Apply',\n className,\n children,\n onSubmit,\n $actions: $actionsProp,\n ...props\n}: CartCouponFormProps) {\n const $actions = useActionsOverride($actionsProp);\n const [code, setCode] = useState('');\n const [pending, setPending] = useState(false);\n\n async function handleSubmit(e: Parameters<NonNullable<CartCouponFormProps['onSubmit']>>[0]) {\n e.preventDefault();\n onSubmit?.(e);\n const trimmed = code.trim();\n if (!trimmed || pending) return;\n\n setPending(true);\n try {\n const errors = await $actions?.cart?.applyCoupon?.({ code: trimmed });\n // Clear the input only when the apply succeeded (no userErrors).\n if (!errors || errors.length === 0) setCode('');\n } finally {\n setPending(false);\n }\n }\n\n return (\n <form\n {...props}\n className={className}\n onSubmit={handleSubmit}\n data-fs-cart-coupon-form=\"\"\n {...(pending ? { 'data-fs-cart-coupon-pending': '' } : {})}\n >\n {children ?? (\n <>\n <input\n type=\"text\"\n value={code}\n placeholder={placeholder}\n aria-label={placeholder}\n disabled={pending}\n onChange={(e) => setCode(e.target.value)}\n data-fs-cart-coupon-input=\"\"\n />\n <button type=\"submit\" disabled={pending} data-fs-cart-coupon-apply=\"\" data-fs-button=\"\">\n {applyLabel}\n </button>\n </>\n )}\n </form>\n );\n}\n\nexport function CartAppliedCoupons({ className, children, $actions: $actionsProp, ...props }: CartAppliedCouponsProps) {\n const $actions = useActionsOverride($actionsProp);\n const { cart } = useCart();\n const coupons = cart?.appliedCoupons ?? [];\n if (coupons.length === 0) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-applied-coupons=\"\">\n {coupons.map((coupon) => (\n <CartCouponContext key={coupon.code} value={coupon}>\n <CartCouponChip $actions={$actions}>{children}</CartCouponChip>\n </CartCouponContext>\n ))}\n </div>\n );\n}\n\n// Per-coupon chip rendered by CartAppliedCoupons. Unregistered presentational helper (mirrors\n// CartItemSkeleton): the chip exposes data-fs-cart-coupon (+ data-fs-cart-coupon-unmatched) and\n// renders the coupon code inline, then renders the remove control — either the author-supplied\n// `children` (so the compiler can inject $actions into a CartCouponRemove placed in the layout) or a\n// built-in CartCouponRemove. The active coupon flows to descendants via CartCouponContext.\nfunction CartCouponChip({ children, $actions }: { children?: ReactNode; $actions?: ComponentActions }) {\n const coupon = useContext(CartCouponContext);\n if (!coupon) return null;\n\n return (\n <span data-fs-cart-coupon=\"\" {...(coupon.isUnmatchedCondition ? { 'data-fs-cart-coupon-unmatched': '' } : {})}>\n <span data-fs-cart-coupon-code=\"\" data-fs-text=\"\">\n {coupon.code}\n </span>\n {children ?? (\n <CartCouponRemove $actions={$actions} aria-label={`Remove coupon ${coupon.code}`}>\n ×\n </CartCouponRemove>\n )}\n </span>\n );\n}\n\nexport function CartCouponRemove({\n code,\n className,\n children,\n onClick,\n $actions: $actionsProp,\n ...props\n}: CartCouponRemoveProps) {\n const $actions = useActionsOverride($actionsProp);\n const coupon = useContext(CartCouponContext);\n const targetCode = code ?? coupon?.code;\n\n function handleClick(e: React.MouseEvent<HTMLButtonElement>) {\n if (targetCode) void $actions?.cart?.removeCoupon?.({ code: targetCode });\n onClick?.(e);\n }\n\n return (\n <button\n {...props}\n type=\"button\"\n className={className}\n onClick={handleClick}\n data-fs-cart-coupon-remove=\"\"\n data-fs-button=\"\"\n >\n {children}\n </button>\n );\n}\n\nexport function CartCouponError({ className, children, ...props }: CartCouponErrorProps) {\n const couponErrors = useReactiveVar(cartCouponErrorsVar);\n const [firstError] = couponErrors;\n if (!firstError) return null;\n\n return (\n <div {...props} role=\"alert\" className={className} data-fs-cart-coupon-error=\"\" data-fs-text=\"\">\n {children ?? firstError.message}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// F4 — Out-of-stock / unavailable item handling\n// ---------------------------------------------------------------------------\n\nexport const CartCheckoutGuardDefinition = defineComponent<CartCheckoutGuardProps>({\n name: 'CartCheckoutGuard',\n importPath: '@vtex/faststore/components',\n component: CartCheckoutGuard,\n editor: { label: 'Cart Checkout Guard', category: 'commerce' },\n schema: {},\n guideline:\n 'Wraps the checkout CTA and blocks progression while any cart item is unavailable: the subtree is made non-interactive (inert) and data-fs-cart-checkout-blocked is exposed for styling the disabled state. In the mini-cart DrawerPopup footer it is the enriched checkout CTA wrapper: place CartTotal and CartGoCheckout inside it so the grand total sits at the button and the whole CTA goes inert when an item cannot be delivered. Must be inside CartRoot.',\n});\n\nexport const CartLoadingDefinition = defineComponent<CartLoadingProps>({\n name: 'CartLoading',\n importPath: '@vtex/faststore/components',\n component: CartLoading,\n editor: { label: 'Cart Loading', category: 'commerce' },\n schema: {},\n guideline:\n 'The loading branch of the three-state mini-cart (loading / empty / filled): renders its children only while the cart is still loading. Supply a skeleton placeholder as its child. Pair with CartEmpty and CartFilled. Must be inside CartRoot. See cart.md.',\n});\n\nexport const CartEmptyDefinition = defineComponent<CartEmptyProps>({\n name: 'CartEmpty',\n importPath: '@vtex/faststore/components',\n component: CartEmpty,\n editor: { label: 'Cart Empty', category: 'commerce' },\n schema: {},\n guideline:\n 'The empty branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has resolved with zero items. It carries no copy of its own — compose CartEmptyMessage for the message and CartContinueShopping for the continue-shopping control, in whatever order and grouping the panel needs. Pair with CartLoading and CartFilled. Must be inside CartRoot. See cart.md.',\n});\n\nexport const CartFilledDefinition = defineComponent<CartFilledProps>({\n name: 'CartFilled',\n importPath: '@vtex/faststore/components',\n component: CartFilled,\n editor: { label: 'Cart Filled', category: 'commerce' },\n schema: {},\n guideline:\n 'The filled branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has one or more items. Wrap the CartList, the order summary, and the checkout CTA in it so they hide when the cart is empty. Pair with CartLoading and CartEmpty. Must be inside CartRoot. See cart.md.',\n});\n\nexport const CartUnavailableCountDefinition = defineComponent<CartUnavailableCountProps>({\n name: 'CartUnavailableCount',\n importPath: '@vtex/faststore/components',\n component: CartUnavailableCount,\n editor: { label: 'Cart Unavailable Count', category: 'commerce' },\n schema: {\n template: { type: 'string', default: '{count} items unavailable', label: 'Template' },\n },\n guideline: 'Cart-level summary of how many lines are unavailable; self-hides when none. See cart.md.',\n});\n\nexport const CartRemoveUnavailableDefinition = defineComponent<CartRemoveUnavailableProps>({\n name: 'CartRemoveUnavailable',\n importPath: '@vtex/faststore/components',\n component: CartRemoveUnavailable,\n editor: { label: 'Cart Remove Unavailable', category: 'commerce' },\n schema: {},\n actions: { cart: ['removeItems'] },\n guideline: 'Button that removes every unavailable line in one batch call; self-hides when none. See cart.md.',\n});\n\nfunction isUnavailable(item: CartEntity['items'][number]): boolean {\n return item.variant.availability !== 'AVAILABLE';\n}\n\nexport function CartCheckoutGuard({ className, children, ...props }: CartCheckoutGuardProps) {\n const { cart } = useCart();\n // Fail-safe: block on any non-AVAILABLE state — OUT_OF_STOCK, UNAVAILABLE, and the\n // catch-all UNKNOWN — so an unclassified item never lets the shopper proceed.\n const blocked = (cart?.items ?? []).some(isUnavailable);\n\n return (\n <div\n {...props}\n className={className}\n inert={blocked}\n aria-disabled={blocked || undefined}\n data-fs-cart-checkout-guard=\"\"\n data-fs-cart-checkout-blocked={blocked ? '' : undefined}\n >\n {children}\n </div>\n );\n}\n\nexport function CartUnavailableCount({\n className,\n children,\n template = '{count} items unavailable',\n ...props\n}: CartUnavailableCountProps) {\n const { cart } = useCart();\n const count = (cart?.items ?? []).filter(isUnavailable).length;\n if (count === 0) return null;\n\n return (\n <span {...props} className={className} data-fs-cart-unavailable-count=\"\" data-fs-text=\"\">\n {children ?? template.replace('{count}', String(count))}\n </span>\n );\n}\n\nexport function CartRemoveUnavailable({\n className,\n children,\n onClick,\n $actions: $actionsProp,\n ...props\n}: CartRemoveUnavailableProps) {\n const $actions = useActionsOverride($actionsProp);\n const { cart } = useCart();\n const unavailableIds = (cart?.items ?? []).filter(isUnavailable).map((item) => item.id);\n if (unavailableIds.length === 0) return null;\n\n function handleClick(e: React.MouseEvent<HTMLButtonElement>) {\n void $actions?.cart?.removeItems?.({ ids: unavailableIds });\n onClick?.(e);\n }\n\n return (\n <button\n {...props}\n type=\"button\"\n className={className}\n onClick={handleClick}\n data-fs-cart-remove-unavailable=\"\"\n data-fs-button=\"\"\n >\n {children ?? 'Remove unavailable items'}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// FSPG-822 — post-add behavior (mutually exclusive, selected by composition)\n//\n// Both subscribe to the add-success pulse (cartLastAddVar), which `addItem`\n// increments on each clean add. CartOpenOnAdd maps the pulse to the mini-cart's\n// open state; CartRedirectOnAdd sends a no-mini-cart store straight to checkout.\n// A store composes exactly one — there is no global.json flag.\n// ---------------------------------------------------------------------------\n\nexport const CartOpenOnAddDefinition = defineComponent<CartOpenOnAddProps>({\n name: 'CartOpenOnAdd',\n importPath: '@vtex/faststore/components',\n component: CartOpenOnAdd,\n editor: { label: 'Cart Open On Add', category: 'commerce' },\n schema: {},\n actions: { cart: ['validate'] },\n guideline:\n 'Mini-cart post-add behavior: wraps the mini-cart DrawerRoot subtree and opens the drawer automatically on each successful add to cart. Compose it as the parent of the DrawerRoot (its single child) — the header DrawerTrigger, the popup, and the cart leaves stay inside that DrawerRoot. It makes the drawer controlled internally, so do not set raw open/onOpenChange on DrawerRoot; the header trigger and manual close (Escape / backdrop / close button) keep working. It also runs a stock validation when the overlay opens, behind a short staleness window and skipped while a cart write is in flight, so opening a cart that went stale corrects it before the shopper acts. Use only in a store that has a mini-cart drawer. Mutually exclusive with CartRedirectOnAdd — compose exactly one. See cart.md.',\n});\n\nexport const CartRedirectOnAddDefinition = defineComponent<CartRedirectOnAddProps>({\n name: 'CartRedirectOnAdd',\n importPath: '@vtex/faststore/components',\n component: CartRedirectOnAdd,\n editor: { label: 'Cart Redirect On Add', category: 'commerce' },\n schema: {\n href: { type: 'string', default: '/checkout', label: 'Checkout URL' },\n },\n guideline:\n 'No-mini-cart post-add behavior: navigates the shopper to checkout (href, default /checkout) after each successful add to cart. Compose it once in the layout for a store that has no mini-cart drawer; it renders no UI of its own. Use this instead of a mini-cart when adding a product should go straight to checkout. Mutually exclusive with CartOpenOnAdd — compose exactly one, and omit the drawer when using this. See cart.md.',\n});\n\n/**\n * Makes the wrapped mini-cart `DrawerRoot` controlled by `miniCartOpenVar` and opens it on each\n * add-success pulse. `miniCartOpenVar` is the single source of truth: the pulse-driven open, the\n * header trigger (`onOpenChange(true)`), and manual close (`onOpenChange(false)`) all route through\n * it, so the trigger and manual dismissal keep working under controlled mode. Context-free — it\n * reads reactive vars and needs no `CartRoot` ancestor (ADR-0010). Expects a single `DrawerRoot`\n * child; the wiring is encapsulated here, never exposed as authorable drawer props.\n */\nexport function CartOpenOnAdd({ children, $actions: $actionsProp }: CartOpenOnAddProps) {\n const $actions = useActionsOverride($actionsProp);\n const open = useReactiveVar(miniCartOpenVar);\n const pulse = useReactiveVar(cartLastAddVar);\n\n useEffect(() => {\n if (pulse > 0) miniCartOpenVar(true);\n }, [pulse]);\n\n // Validate the cart's stock on the overlay's closed→open edge (T13). This is the sole observer of\n // that transition, so validate-on-open lives here rather than in a separate leaf whose only open\n // signal would be this same var.\n useCartValidateOnOpen($actions?.cart?.validate);\n\n if (!isValidElement<Pick<DrawerRootProps, 'open' | 'onOpenChange'>>(children)) return children;\n\n return cloneElement(children, {\n open,\n onOpenChange: (next: boolean) => miniCartOpenVar(next),\n });\n}\n\n/**\n * Navigates a no-mini-cart store to checkout after a successful add. Keys a `useEffect` on the\n * add-success pulse, which `addItem` increments only on the clean branch after the `await`, so the\n * redirect is post-resolve and success-gated. The initial `0` is ignored, so a fresh mount never\n * navigates. Context-free — no `CartRoot` ancestor (ADR-0010). Renders its passthrough children (or\n * nothing); it carries no drawer.\n */\nexport function CartRedirectOnAdd({ href = '/checkout', children }: CartRedirectOnAddProps) {\n const router = useRouter();\n const pulse = useReactiveVar(cartLastAddVar);\n\n useEffect(() => {\n if (pulse > 0) router.push(href);\n }, [pulse, href, router]);\n\n return children;\n}\n\n// ---------------------------------------------------------------------------\n// Loading / empty / filled — three mutually-exclusive self-hide branches gating\n// on the reactive cart (FSPG-820). `CartLoading` renders while the cart has not\n// resolved (`cart == null`); `CartEmpty` requires a resolved, item-free cart so\n// the empty state never flashes during load; `CartFilled` requires items.\n// Exactly one renders at any time: loading → empty → filled.\n// ---------------------------------------------------------------------------\n\nexport function CartLoading({ className, children, ...props }: CartLoadingProps) {\n const { cart } = useCart();\n if (cart != null) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-loading=\"\">\n {children}\n </div>\n );\n}\n\nexport function CartEmpty({ className, children, ...props }: CartEmptyProps) {\n const { cart } = useCart();\n if (cart == null || cart.items.length > 0) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-empty=\"\">\n {children}\n </div>\n );\n}\n\nexport function CartFilled({ className, children, ...props }: CartFilledProps) {\n const { cart } = useCart();\n if ((cart?.items ?? []).length === 0) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-filled=\"\">\n {children}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Merchant messaging — disclaimer (F13). A plain-text notice the merchant authors, shown before the\n// shopper commits. It carries no fragment: the items gate reads what CartRoot already selects, so\n// placing or removing it leaves the composed page query unchanged.\n// ---------------------------------------------------------------------------\n\nexport const CartDisclaimerDefinition = defineComponent({\n name: 'CartDisclaimer',\n importPath: '@vtex/faststore/components',\n component: CartDisclaimer,\n content: CartDisclaimerContent,\n editor: { label: 'Cart Disclaimer', category: 'commerce' },\n schema: {\n text: { type: 'string', label: 'Disclaimer text' },\n },\n guideline:\n 'Plain-text merchant notice — conditions, purchase limits, or legal wording — shown in the cart before the shopper commits. CMS content wins over the text prop, and nothing renders when neither supplies a notice. It renders only when the cart has items, so it stays out of the empty state and out of the window before the cart resolves on its own. Place it inside CartFilled, below the order summary or immediately above the checkout CTA (CartCheckoutGuard): placement is composition order, and there is no position prop. Plain text only — no rich text and no inline links. Must be inside CartRoot. See cart.md.',\n});\n\nexport function CartDisclaimer({ text, $content, className, children, ...props }: CartDisclaimerProps) {\n const { cart } = useCart();\n // The empty-state rule is the leaf's own, not its placement's: a disclaimer composed outside\n // CartFilled still stays out of an empty overlay, and requiring a resolved cart keeps it from\n // flashing ahead of the lines it applies to.\n if (cart == null || cart.items.length === 0) return null;\n\n const notice = $content?.text ?? text;\n // Authored children are the highest-precedence override, matching the cart siblings (CartTotal,\n // CartCount, CartError…). A blank or whitespace-only string child counts as unconfigured — the same\n // rule CartGoCheckout's configuredLabel applies — so it never renders an empty <p>; non-string\n // composed children pass through untouched. Absent children, the copy resolves as\n // `$content?.text ?? text` and must be non-blank: `minLength` is enforced by neither the runtime\n // slice nor the preflight, so a blank entry value reaches the component and counts as unconfigured.\n const resolvedChildren = typeof children === 'string' ? configuredLabel(children) : children;\n if (resolvedChildren == null && !notice?.trim()) return null;\n\n return (\n <p {...props} className={className} data-fs-cart-disclaimer=\"\" data-fs-text=\"\">\n {resolvedChildren ?? notice}\n </p>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton — loading placeholder rendered by CartList while the reactive cart\n// query is in flight (FR-7). Plain, unregistered presentational helper (mirrors\n// PricingSkeleton's shape; CartRoot is reactive, so the lazy `skeleton` field\n// does not apply — CartList drives it instead).\n// ---------------------------------------------------------------------------\n\nexport function CartItemSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n // Minimal built-in look (plain, always-generated utilities) so the placeholder is visible out of\n // the box; a store can still restyle the bars via the data-fs-cart-item-skeleton-line swatch.\n return (\n <div {...props} className={className} data-fs-cart-item-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-cart-item-skeleton-line=\"\" className=\"block h-4 w-full animate-pulse rounded bg-gray-200\" />\n <span data-fs-cart-item-skeleton-line=\"\" className=\"mt-2 block h-4 w-2/3 animate-pulse rounded bg-gray-200\" />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Merchant alert banner — a family rather than a single leaf, so the schema\n// decides the order and the subset instead of a layout prop. The Root owns\n// every resolution for two reasons: it is the only part that can tell whether\n// there is anything to say before the others mount, and one content model\n// keyed by its element id keeps the merchant's authoring surface a single\n// group in the Admin instead of one per part.\n// ---------------------------------------------------------------------------\n\nexport const CartAlertContent = defineContentType({\n id: 'cart-alert',\n title: 'Cart Alert',\n description: 'Merchant notice shown at the top of the mini-cart overlay.',\n schema: {\n type: 'object',\n additionalProperties: false,\n // Nothing is required. This model shares one composite entry with the other mini-cart content\n // leaves, and a read-time `required` violation invalidates the whole entry — one blank message\n // would take the disclaimer, the empty-state copy and the checkout label down with it.\n // `minLength` is author-time guidance only, so a blank still arrives here and self-hides.\n properties: {\n text: { type: 'string', minLength: 1, title: 'Message' },\n // Inline literals: the catalog scanner reads this file statically and rejects an identifier\n // it cannot evaluate. Every name is a base-dialect one, so each resolves in any store\n // regardless of its configured collection — but a store still has to register them.\n icon: {\n type: 'string',\n enum: ['bell', 'bell-ringing', 'tag', 'shopping-cart', 'map-pin', 'star'],\n title: 'Icon',\n },\n iconUrl: { type: 'string', format: 'uri', title: 'Custom icon', widget: { 'ui:widget': 'media-gallery' } },\n iconAlt: { type: 'string', title: 'Custom icon alt text' },\n },\n },\n});\n\n/**\n * The sprite names the CMS channel admits. Exported because a store whose merchants pick the icon\n * has to list them under `icons.include` for the glyph to reach the route sprite — one import there\n * instead of six retyped strings. Read off the model so the two cannot drift apart.\n */\nexport const CART_ALERT_ICON_NAMES = CartAlertContent.schema.properties.icon.enum;\n\nexport type CartAlertRootProps = ComponentPropsWithRef<'div'> & {\n /** Authored fallback message. No default: an invented one would ship copy no merchant wrote. */\n text?: string;\n /** Authored fallback sprite name. Unbounded — the compiler resolves it or fails the build. */\n icon?: string;\n /** Authored fallback uploaded glyph; wins over `icon` when both resolve. */\n iconUrl?: string;\n /** Alt text for the uploaded glyph; empty (decorative) when unset. */\n iconAlt?: string;\n /** Merchant-authored copy, sliced from the layout's composite entry; wins field by field. */\n $content?: ContentValue<typeof CartAlertContent>;\n};\n\n/** The glyph renders as an `img` or an `svg` depending on the channel, so it takes only what both accept. */\nexport type CartAlertIconProps = { className?: string };\n\nexport type CartAlertTextProps = ComponentPropsWithRef<'span'>;\n\n/** One resolved glyph: an uploaded image or a sprite name, never both. */\ntype ResolvedGlyph = { src: string; alt: string } | { name: string };\n\ntype CartAlertContextValue = {\n /** Non-blank by construction: the root self-hides when nothing resolves. */\n message: string;\n /** Resolved on the root so the parts hold no precedence logic; `null` when no glyph is configured. */\n glyph: ResolvedGlyph | null;\n};\n\nconst CART_ALERT_CONTEXT_UNSET = Symbol('CartAlertContextUnset');\n\nconst CartAlertContext = createContext<CartAlertContextValue | typeof CART_ALERT_CONTEXT_UNSET>(\n CART_ALERT_CONTEXT_UNSET,\n);\n\nfunction useCartAlert(): CartAlertContextValue {\n const ctx = useContext(CartAlertContext);\n if (ctx === CART_ALERT_CONTEXT_UNSET) {\n throw new Error('CartAlert parts must be used inside CartAlertRoot.');\n }\n return ctx;\n}\n\n/**\n * A content-channel icon name is admitted only when the model's `enum` still lists it. An entry is\n * external data whose `icon` is typed as the enum but not guaranteed to be one at runtime (a stale\n * value, or a read-time gate that does not enforce `enum`), and an unadmitted name would reach the\n * sprite lookup and render an empty `<svg>` with no build error and nothing in the console.\n */\nfunction admitContentIcon(name: string | undefined): string | undefined {\n return name && (CART_ALERT_ICON_NAMES as readonly string[]).includes(name) ? name : undefined;\n}\n\n/**\n * Resolves one glyph from a single source channel, the upload before the sprite name. Kept per-source\n * rather than per-field so the two channels never mix across sources: a merchant who configures a\n * sprite name in the CMS is not silently overridden by an uploaded-glyph *prop* the developer left as\n * a default. The prop `name` is unfiltered — the compiler resolves it or fails the build; only a\n * content name passes through `admitContentIcon`.\n */\nfunction resolveGlyph(\n url: string | undefined,\n alt: string | undefined,\n name: string | undefined,\n): ResolvedGlyph | null {\n if (url?.trim()) return { src: url, alt: alt ?? '' };\n if (name) return { name };\n return null;\n}\n\n// Type parameters are left to inference so `CorrelateContent` can check `$content` against the\n// declared model (an explicit TProps would bypass it), mirroring BuyButtonButton and Promotion.\nexport const CartAlertRootDefinition = defineComponent({\n name: 'CartAlertRoot',\n importPath: '@vtex/faststore/components',\n component: CartAlertRoot,\n content: CartAlertContent,\n editor: { label: 'Cart Alert', category: 'commerce' },\n schema: {\n text: { type: 'string', label: 'Message' },\n icon: { type: 'icon', label: 'Icon' },\n iconUrl: { type: 'string', label: 'Custom icon URL' },\n iconAlt: { type: 'string', label: 'Custom icon alt text' },\n },\n providesContext: 'cart-alert',\n guideline:\n 'Merchant-authored notice near the top of the mini-cart overlay (a minimum order, a running promotion): wraps CartAlertIcon and CartAlertText in any subset, any order — the arrangement is the composition, not a prop — and renders the glyph then the copy when composed with no children. Its copy and glyph are CMS-editable through the cart-alert content model, with the text, icon, iconUrl and iconAlt props as the non-CMS fallback; it renders nothing when no message is configured, so an unconfigured banner leaves no empty box. Reads no cart data, so it needs no CartRoot ancestor and no cart-state gate — place it inside CartFilled to hide it on an empty cart. A store whose merchants choose the icon must list CART_ALERT_ICON_NAMES under icons.include in global.json, or a chosen glyph renders empty. Distinct from CartError (cart mutation errors) and CartUnavailableCount (data-driven). See cart.md.',\n});\n\nexport const CartAlertIconDefinition = defineComponent<CartAlertIconProps>({\n name: 'CartAlertIcon',\n importPath: '@vtex/faststore/components',\n component: CartAlertIcon,\n editor: { label: 'Cart Alert Icon', category: 'commerce' },\n schema: {},\n requiresContext: 'cart-alert',\n guideline:\n 'The alert glyph, inside a CartAlertRoot (or any ancestor providing `cart-alert` context). Prefers the merchant-uploaded icon and falls back to the predefined sprite name, and renders nothing when neither is configured. Decorative — the message carries the meaning. Place it before or after CartAlertText to set the order.',\n});\n\nexport const CartAlertTextDefinition = defineComponent<CartAlertTextProps>({\n name: 'CartAlertText',\n importPath: '@vtex/faststore/components',\n component: CartAlertText,\n editor: { label: 'Cart Alert Message', category: 'commerce' },\n schema: {},\n requiresContext: 'cart-alert',\n guideline:\n 'The alert message, inside a CartAlertRoot (or any ancestor providing `cart-alert` context). The copy comes from the root (its CMS entry or its text prop), so children are a display override rather than an authoring channel. Place it before or after CartAlertIcon to set the order.',\n});\n\nexport function CartAlertRoot({\n text,\n icon,\n iconUrl,\n iconAlt,\n className,\n children,\n $content,\n ...props\n}: CartAlertRootProps) {\n const message = $content?.text ?? text;\n\n // The glyph resolves as a whole channel, CMS before props, so a merchant-configured glyph — sprite\n // name or upload — wins over whatever the developer set as a fallback. Resolving each field on its\n // own would let a prop `iconUrl` mask a CMS `icon`, a CMS edit that does nothing. Memoized so the\n // context value keeps a stable identity across renders — the parts re-render only on a real change.\n const value = useMemo<CartAlertContextValue>(\n () => ({\n message: message ?? '',\n glyph:\n resolveGlyph($content?.iconUrl, $content?.iconAlt, admitContentIcon($content?.icon)) ??\n resolveGlyph(iconUrl, iconAlt, icon),\n }),\n [message, $content?.iconUrl, $content?.iconAlt, $content?.icon, iconUrl, iconAlt, icon],\n );\n if (!message?.trim()) return null;\n\n return (\n <CartAlertContext value={value}>\n <div {...props} className={className} data-fs-cart-alert=\"\">\n {children ?? (\n <>\n <CartAlertIcon />\n <CartAlertText />\n </>\n )}\n </div>\n </CartAlertContext>\n );\n}\n\nexport function CartAlertIcon({ className }: Readonly<CartAlertIconProps>) {\n const { glyph } = useCartAlert();\n if (!glyph) return null;\n\n if ('src' in glyph) {\n return <Image src={glyph.src} alt={glyph.alt} className={className} data-fs-cart-alert-icon=\"\" />;\n }\n return <Icon name={glyph.name} className={className} data-fs-cart-alert-icon=\"\" />;\n}\n\nexport function CartAlertText({ className, children, ...props }: CartAlertTextProps) {\n const { message } = useCartAlert();\n\n return (\n <span {...props} className={className} data-fs-cart-alert-text=\"\" data-fs-text=\"\">\n {children ?? message}\n </span>\n );\n}\n\n// ---------------------------------------------------------------------------\n// F1 — Empty-state copy: the message and the way back to browsing.\n//\n// Two leaves rather than one, because the message and the control are placed\n// independently: the message sits in the panel body while the control is\n// commonly pinned to the drawer footer. Neither renders a wrapper, so grouping,\n// order, and any illustration stay the store's, composed inside CartEmpty.\n//\n// The copy is merchant-editable, so each leaf declares its own content model\n// with a schema prop as the non-CMS fallback ($content -> prop -> default),\n// following footer-copyright. `CartEmpty` gates when the branch renders; these\n// leaves only carry copy, so they read no cart data and select no field.\n// ---------------------------------------------------------------------------\n\nexport const CartEmptyMessageContent = defineContentType({\n id: 'cart-empty-message',\n title: 'Cart Empty Message',\n description: 'Message shown in the cart overlay when the cart has no items.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: { type: 'string', minLength: 1, title: 'Empty cart message', default: 'Your cart is empty' },\n },\n },\n});\n\nexport const CartContinueShoppingContent = defineContentType({\n id: 'cart-continue-shopping',\n title: 'Cart Continue Shopping',\n description: 'Label for the control that dismisses the cart overlay and returns the shopper to browsing.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['label'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Continue shopping label', default: 'Continue shopping' },\n },\n },\n});\n\nexport const CartEmptyMessageDefinition = defineComponent<CartEmptyMessageProps>({\n name: 'CartEmptyMessage',\n importPath: '@vtex/faststore/components',\n component: CartEmptyMessage,\n content: CartEmptyMessageContent,\n editor: { label: 'Cart Empty Message', category: 'commerce' },\n schema: {\n text: { type: 'string', default: 'Your cart is empty', label: 'Empty cart message' },\n },\n guideline:\n 'The empty-cart message, rendered as plain text inside CartEmpty. CMS content wins over the text prop, which defaults to \"Your cart is empty\"; blank resolved copy renders nothing. It carries no layout — group and space it with Container, and pair it with CartContinueShopping for the way back to browsing. See cart.md.',\n});\n\nexport const CartContinueShoppingDefinition = defineComponent<CartContinueShoppingProps>({\n name: 'CartContinueShopping',\n importPath: '@vtex/faststore/components',\n component: CartContinueShopping,\n content: CartContinueShoppingContent,\n editor: { label: 'Cart Continue Shopping', category: 'action' },\n schema: {\n label: { type: 'string', default: 'Continue shopping', label: 'Continue shopping label' },\n },\n guideline:\n 'Dismisses the cart overlay so the shopper can keep browsing; dispatches no cart write. Place it in the empty panel inside CartEmpty, commonly in a footer Container. It closes the drawer, so it requires a DrawerRoot ancestor — on a cart page with no drawer, compose a NavigationLink back to browsing instead of this control. CMS content wins over the label prop, and composed children win over both (compose an icon that way). See cart.md.',\n});\n\nexport function CartEmptyMessage({\n text = 'Your cart is empty',\n $content,\n className,\n ...props\n}: CartEmptyMessageProps) {\n const message = $content?.text ?? text;\n // `minLength` is enforced by neither the runtime slice nor the preflight, so a blank entry value\n // reaches the component and counts as unconfigured. Trim to decide, never to render.\n if (!message.trim()) return null;\n\n return (\n <p {...props} className={className} data-fs-cart-empty-message=\"\" data-fs-text=\"\">\n {message}\n </p>\n );\n}\n\nexport function CartContinueShopping({\n label = 'Continue shopping',\n $content,\n className,\n children,\n ...props\n}: CartContinueShoppingProps) {\n const content = $content?.label ?? label;\n // Composed children are the button's content, so they carry it on their own when copy is blank.\n if (children == null && !content.trim()) return null;\n\n return (\n <DrawerClose {...props} className={className} data-fs-cart-continue-shopping=\"\" data-fs-button=\"\">\n {children ?? content}\n </DrawerClose>\n );\n}\n\n// The `Cart.*` namespace object is assembled in the package barrel (src/index.ts) so it can combine\n// the aggregate components here with the line-item components in matter/cart-item without a cyclic\n// import between the two files.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,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAA0B,UAAU;CAAS;CAC9D,QAAQ,EACN,OAAO;EAAE,MAAM;EAAU,SAAS;EAAqB,OAAO;CAA0B,EAC1F;CACA,WACE;AACJ,CAAC;AAED,SAAgB,iBAAiB,EAC/B,OAAO,sBACP,UACA,WACA,GAAG,SACqB;CACxB,MAAM,UAAU,UAAU,QAAQ;CAGlC,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE5B,OACE,oBAAC,KAAD;EAAG,GAAI;EAAkB;EAAW,8BAA2B;EAAG,gBAAa;EAC5E,UAAA;CACA,CAAA;AAEP;AAEA,SAAgB,qBAAqB,EACnC,QAAQ,qBACR,UACA,WACA,UACA,GAAG,SACyB;CAC5B,MAAM,UAAU,UAAU,SAAS;CAEnC,IAAI,YAAY,QAAQ,CAAC,QAAQ,KAAK,GAAG,OAAO;CAEhD,OACE,oBAAC,aAAD;EAAa,GAAI;EAAkB;EAAW,kCAA+B;EAAG,kBAAe;EAC5F,UAAA,YAAY;CACF,CAAA;AAEjB"}
1
+ {"version":3,"file":"cart.js","names":[],"sources":["../../../src/matter/cart/cart.tsx"],"sourcesContent":["'use client';\n\nimport type { ErrorLike } from '@apollo/client';\nimport { useApolloClient, useReactiveVar } from '@apollo/client/react';\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport { useLinkStatus } from 'next/link';\nimport { useRouter } from 'next/navigation';\nimport {\n type ComponentPropsWithRef,\n cloneElement,\n createContext,\n isValidElement,\n type ReactNode,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { DrawerClose, type DrawerRootProps } from '../../particles/drawer/drawer.js';\nimport { Icon } from '../../particles/icon/icon.js';\nimport { Image } from '../../particles/image/image.js';\nimport { NavigationLink, type NavigationLinkProps } from '../../particles/navigation-link/navigation-link.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport type { AppliedCoupon, CartEntity, Money } from '../../sdk/cart/operations.js';\nimport { readCartFromCache } from '../../sdk/cart/use-cart-actions.js';\nimport { useCartValidateOnOpen } from '../../sdk/cart/use-cart-validate-on-open.js';\nimport { awaitCartWrites } from '../../sdk/cart/write-gate.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ListItemRefContext } from '../../sdk/data/list-item-ref-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { graphql } from '../../sdk/generated/gql.js';\nimport {\n cartCouponErrorsVar,\n cartLastAddVar,\n cartUserErrorsVar,\n miniCartOpenVar,\n orderFormIdVar,\n} from '../../sdk/state/cart.js';\n\n// ---------------------------------------------------------------------------\n// Content models — merchant-editable copy. `$content` wins when a content entry is present; the\n// schema prop of the same name is the fallback in a non-CMS store, which issues no content read at\n// all (rfc-content-only-cms-integration). The disclaimer deliberately ships no default copy: legal\n// or conditional wording the package invented would assert conditions no merchant agreed to.\n// ---------------------------------------------------------------------------\n\nexport const CartDisclaimerContent = defineContentType({\n id: 'cart-disclaimer',\n title: 'Cart Disclaimer',\n description: 'Conditions, limits, or legal wording shown in the cart before checkout.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: { type: 'string', minLength: 1, title: 'Disclaimer text' },\n },\n },\n});\n\n// The checkout CTA's wording is a merchant decision, so it comes from a content entry with the\n// schema prop as the non-CMS fallback. Label only: re-pointing checkout is not a copy decision, so\n// the destination stays an authored prop and never joins this channel. No `default` here — an\n// untouched slot has to stay unfilled, or a prefilled entry would outrank the label a store already\n// authored.\nexport const CartCheckoutLabelContent = defineContentType({\n id: 'cart-checkout-label',\n title: 'Cart Checkout Label',\n description: 'Editorial label for the checkout call to action.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['label'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Checkout label' },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type CartDataContextValue = Readonly<{\n cart: CartEntity | null;\n /**\n * Cart query error surfaced by the reactive root. `cart` is non-null on the server (`Cart!`),\n * so `cart: null` + `error` means the fetch failed — not an empty cart.\n */\n error: ErrorLike | null;\n}>;\n\nexport type CartRootProps = ComponentPropsWithRef<'div'> & {\n /**\n * Cart entity slice forwarded by the reactive runtime (`ReactiveDataProvider`) — it is the value\n * of the `cart` top-level field on `CartData on Query`, not the wrapping `{ cart: … }` shape.\n * Receives `null` when the cart is not yet seeded (e.g. server returned no cart for the current\n * session, or `orderFormIdVar` is still null).\n */\n $data?: CartEntity | null;\n};\n\nexport type CartListProps = ComponentPropsWithRef<'div'> & {\n /** Number of CartItemSkeleton rows to render while the cart is still loading (FR-7). */\n skeletonCount?: number;\n};\n\nexport type CartTotalProps = ComponentPropsWithRef<'span'> & {\n label?: string;\n};\n\nexport type CartCountProps = ComponentPropsWithRef<'span'> & {\n template?: string;\n};\n\nexport type CartErrorProps = ComponentPropsWithRef<'div'>;\n\n// `$content` is omitted from the inherited props on purpose: NavigationLink's model also carries the\n// destination and target, and this CTA's content channel is the label alone.\nexport type CartGoCheckoutProps = Omit<NavigationLinkProps, 'href' | '$content'> & {\n href?: string;\n /** Authored fallback for the button label; `children` still works for stores that label it there. */\n label?: string;\n /** Merchant-authored label, sliced from the page/layout content entry; wins over the label prop and\n * over children. Absent in a non-CMS store — the props are the fallback. */\n $content?: ContentValue<typeof CartCheckoutLabelContent>;\n /** Injected by the compiler from `actions: { cart: ['validate'] }`; the stock-validation write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartCouponFormProps = ComponentPropsWithRef<'form'> & {\n placeholder?: string;\n applyLabel?: string;\n /** Injected by the compiler from `actions: { cart: ['applyCoupon'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartAppliedCouponsProps = ComponentPropsWithRef<'div'> & {\n /** Injected by the compiler from `actions: { cart: ['removeCoupon'] }`; forwarded to the built-in chip's remove control. */\n $actions?: ComponentActions;\n};\n\nexport type CartCouponRemoveProps = ComponentPropsWithRef<'button'> & {\n /**\n * The coupon code this control removes. Normally supplied by the enclosing CartAppliedCoupons\n * chip via context; pass it explicitly to override or to use the control standalone.\n */\n code?: string;\n /** Injected by the compiler from `actions: { cart: ['removeCoupon'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartCouponErrorProps = ComponentPropsWithRef<'div'>;\n\nexport type CartDisclaimerProps = ComponentPropsWithRef<'p'> & {\n /**\n * Authored fallback, rendered when no CMS entry supplies the notice. Ranks below `children`:\n * `children ?? $content?.text ?? text`.\n */\n text?: string;\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: ContentValue<typeof CartDisclaimerContent>;\n};\n\nexport type CartCheckoutGuardProps = ComponentPropsWithRef<'div'>;\nexport type CartLoadingProps = ComponentPropsWithRef<'div'>;\nexport type CartEmptyProps = ComponentPropsWithRef<'div'>;\nexport type CartFilledProps = ComponentPropsWithRef<'div'>;\n\nexport type CartEmptyMessageProps = ComponentPropsWithRef<'p'> & {\n /** Authored fallback, rendered when no CMS entry supplies the message. */\n text?: string;\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: ContentValue<typeof CartEmptyMessageContent>;\n};\n\nexport type CartContinueShoppingProps = ComponentPropsWithRef<'button'> & {\n /** Authored fallback, rendered when no CMS entry supplies the label. Children win over both. */\n label?: string;\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: ContentValue<typeof CartContinueShoppingContent>;\n};\n\nexport type CartUnavailableCountProps = ComponentPropsWithRef<'span'> & {\n /** Output format; `{count}` is replaced by the integer count. */\n template?: string;\n};\n\nexport type CartRemoveUnavailableProps = ComponentPropsWithRef<'button'> & {\n /** Injected by the compiler from `actions: { cart: ['removeItems'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\nexport type CartOpenOnAddProps = {\n children?: ReactNode;\n /** Injected by the compiler from `actions: { cart: ['validate'] }`; drives the validate-on-open call. */\n $actions?: ComponentActions;\n};\n\nexport type CartRedirectOnAddProps = {\n href?: string;\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — typed via @graphql-codegen client-preset (T7)\n// ---------------------------------------------------------------------------\n\n// CartRoot is the reactive read root. It fetches item refs plus the per-item scalars the cart-level\n// aggregate reads cross-cuttingly — `quantity` and `gift` (CartCount, which counts only the lines the\n// shopper added) and `variant.availability` (CartCheckoutGuard) — plus the cart totals, messages, and\n// coupons. The display-only per-item scalars (prices, name, sku, image, product) are owned by\n// CartItemRoot's own `reactive-list-item` fragment and merge un-aliased onto the shared\n// `cart { items }` path (ADR-0012 Option B). The MUTATION fragment (`CartFragment` →\n// `CartItemFragment` in operations.ts) stays whole so writes normalize a complete `CartItem` into the\n// cache for the per-item `useFragment` to read — which is why `gift` joins it too.\nconst fragment = graphql(`\n fragment CartData on Query {\n cart {\n __typename\n id\n items {\n __typename\n id\n quantity\n gift\n variant {\n __typename\n availability\n }\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// ---------------------------------------------------------------------------\n// Money formatting — shared by the cart aggregate and the cart-item leaves\n// ---------------------------------------------------------------------------\n\nexport function formatPrice(value: number, locale: string, currency: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value);\n}\n\n// ---------------------------------------------------------------------------\n// Cart total value context — provided by CartRoot and CartTotalizerRoot so that\n// CartTotal works inside either root without a circular import.\n// ---------------------------------------------------------------------------\n\nexport const CartTotalValueContext = createContext<Money | null>(null);\n\n// ---------------------------------------------------------------------------\n// Cart data context (read-only cart entity + query error)\n// ---------------------------------------------------------------------------\n\nconst CART_DATA_UNSET = Symbol('CartDataContextUnset');\n\nconst CartDataContextInternal = createContext<CartDataContextValue | typeof CART_DATA_UNSET>(CART_DATA_UNSET);\n\nexport const CartDataContext = CartDataContextInternal as React.Context<CartDataContextValue>;\n\n/**\n * Read the current cart entity and query error from the nearest `CartRoot`. Throws when called\n * outside a `CartRoot` subtree.\n *\n * Cart *writes* no longer flow through this context — they are dispatched via the compiler-injected\n * `$actions.cart.*` prop (the `cart` action namespace), which reads/writes the cache directly and\n * needs no `CartRoot` ancestor (docs/storefront-core/reference-free-particle-model.md § Write side — actions, ADR-0010). This hook is reads only.\n */\nexport function useCart(): CartDataContextValue {\n const ctx = useContext(CartDataContextInternal);\n if (ctx === CART_DATA_UNSET) {\n throw new Error('useCart() must be used inside a <CartRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Cart coupon context (provided by CartAppliedCoupons per applied coupon)\n// ---------------------------------------------------------------------------\n\nconst CartCouponContext = createContext<AppliedCoupon | null>(null);\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const CartRootDefinition = defineComponent<CartRootProps>({\n name: 'CartRoot',\n importPath: '@vtex/faststore/components',\n component: CartRoot,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Cart Root', category: 'commerce' },\n schema: {},\n guideline:\n 'Cart data provider hosted by the layout (shared shell), wrapping the slot so every page consumes its context; exactly one per tree — do not place it as a page root. To build a mini-cart, wrap this CartRoot subtree in a modal DrawerRoot: the header carries a DrawerTrigger with a CartCount badge, the DrawerPopup body is a CartList line-item template, and its footer is CartTotal plus CartGoCheckout. The mini-cart is this layout composition, not a dedicated component. See cart.md.',\n});\n\nexport const CartListDefinition = defineComponent<CartListProps>({\n name: 'CartList',\n importPath: '@vtex/faststore/components',\n component: CartList,\n editor: { label: 'Cart List', category: 'commerce' },\n schema: {\n skeletonCount: { type: 'number', default: 3, label: 'Skeleton Count' },\n },\n // Declares the per-line iteration context (ADR-0009): a `reactive-list-item` sub-matter placed\n // inside CartList `requiresContext: 'cart-item'`, and the build-time `validateContextConstraints`\n // walk reports a misplaced one. Runtime: CartList publishes each line's ref via ListItemRefContext.\n providesContext: 'cart-item',\n guideline:\n 'Renders its children once per cart item; wrap the line-item template in a CartItemRoot and place CartItem* components inside it to define the template (e.g. CartItemImage, CartItemName, CartItemPrice, a CartItemQuantity stepper, CartItemRemove). While the cart is loading it renders skeletonCount CartItemSkeleton placeholders instead. In a mini-cart it is the scrollable body of the DrawerPopup. Must be inside CartRoot.',\n});\n\nexport const CartTotalDefinition = defineComponent<CartTotalProps>({\n name: 'CartTotal',\n importPath: '@vtex/faststore/components',\n component: CartTotal,\n editor: { label: 'Cart Total', category: 'commerce' },\n schema: {\n label: { type: 'string', label: 'Label' },\n },\n guideline:\n 'The single root-agnostic grand-total component: renders the cart grand total, formatted from the active storefront context, reading the value from the nearest CartRoot or CartTotalizerRoot. Set the optional label prop to render a label alongside the value (e.g. \"Total\"); omit it to render the value alone. In a mini-cart it sits in the DrawerPopup footer alongside CartGoCheckout, inside a CartCheckoutGuard, so the total is visible at the checkout button.',\n});\n\nexport const CartCountDefinition = defineComponent<CartCountProps>({\n name: 'CartCount',\n importPath: '@vtex/faststore/components',\n component: CartCount,\n editor: { label: 'Cart Count', category: 'commerce' },\n schema: {\n template: { type: 'string', default: '{count}', label: 'Template' },\n },\n guideline:\n \"Renders the total item count in the cart; use the template prop to customize the format (e.g. '{count} produtos'). Gift lines are excluded from the count — a promotional gift is not something the shopper added — so a cart holding only gifts shows 0. In a mini-cart, place it as the badge on the header DrawerTrigger and again in the DrawerPopup header. Must be inside CartRoot.\",\n});\n\nexport const CartErrorDefinition = defineComponent<CartErrorProps>({\n name: 'CartError',\n importPath: '@vtex/faststore/components',\n component: CartError,\n editor: { label: 'Cart Error', category: 'commerce' },\n schema: {},\n guideline: 'Inline error banner that surfaces cart mutation errors. Must be inside CartRoot.',\n});\n\nexport const CartGoCheckoutDefinition = defineComponent<CartGoCheckoutProps>({\n name: 'CartGoCheckout',\n importPath: '@vtex/faststore/components',\n component: CartGoCheckout,\n content: CartCheckoutLabelContent,\n editor: { label: 'Cart Go Checkout', category: 'commerce' },\n schema: {\n href: { type: 'string', default: '/checkout', label: 'Checkout URL' },\n label: { type: 'string', default: 'Checkout', label: 'Checkout label' },\n },\n actions: { cart: ['validate'] },\n guideline:\n 'Navigation link to the checkout page (default href /checkout); use as the checkout CTA inside the cart summary. In a mini-cart it is the DrawerPopup footer CTA, next to CartTotal. The button wording is merchant-editable content: a CMS entry wins, then the label prop (default \"Checkout\"), then children — so a store that labels the button through children keeps working and a CMS save overrides it without a deploy. The destination is not content-editable: href stays an authored prop, because re-pointing checkout is not a copy decision. Before routing it runs a stock validation and only navigates when the re-checked cart has no unavailable line; a validation that cannot run falls open and navigates anyway. During a client-side route transition to checkout it surfaces a loading state on its content wrapper as aria-busy plus data-fs-cart-go-checkout-pending, and while the pre-checkout validation runs it exposes data-fs-cart-go-checkout-validating — there is no built-in spinner, so opt into one by styling those attributes (e.g. composing a Spinner). For an external or hard checkout navigation there is no client-side transition, so the loading state simply does not show (a graceful no-op). The enriched footer checkout CTA is CartCheckoutGuard wrapping CartTotal and this CartGoCheckout: the guard makes the CTA inert (data-fs-cart-checkout-blocked) while any item is unavailable, and CartTotal shows the grand total at the button. Must be inside CartRoot.',\n});\n\nexport const CartCouponFormDefinition = defineComponent<CartCouponFormProps>({\n name: 'CartCouponForm',\n importPath: '@vtex/faststore/components',\n component: CartCouponForm,\n editor: { label: 'Cart Coupon Form', category: 'commerce' },\n schema: {\n placeholder: { type: 'string', label: 'Placeholder' },\n applyLabel: { type: 'string', label: 'Apply Label' },\n },\n actions: { cart: ['applyCoupon'] },\n guideline:\n 'Coupon code input plus an apply button; root-agnostic (dispatches $actions.cart.applyCoupon). While an apply is in flight it disables the input and button and exposes data-fs-cart-coupon-pending. In a mini-cart it sits in the DrawerPopup footer above the totals; pair it with CartAppliedCoupons (the applied list) and CartCouponError (the error banner). Must be inside CartRoot.',\n});\n\nexport const CartAppliedCouponsDefinition = defineComponent<CartAppliedCouponsProps>({\n name: 'CartAppliedCoupons',\n importPath: '@vtex/faststore/components',\n component: CartAppliedCoupons,\n editor: { label: 'Cart Applied Coupons', category: 'commerce' },\n schema: {},\n actions: { cart: ['removeCoupon'] },\n guideline:\n 'Renders one chip per applied coupon (cart.appliedCoupons), each showing its code and a CartCouponRemove control; renders nothing when no coupons are applied. A coupon whose conditions did not match is marked with data-fs-cart-coupon-unmatched. Place it next to CartCouponForm in the mini-cart footer. Must be inside CartRoot.',\n});\n\nexport const CartCouponRemoveDefinition = defineComponent<CartCouponRemoveProps>({\n name: 'CartCouponRemove',\n importPath: '@vtex/faststore/components',\n component: CartCouponRemove,\n editor: { label: 'Cart Coupon Remove', category: 'commerce' },\n schema: {\n code: { type: 'string', label: 'Coupon Code' },\n },\n actions: { cart: ['removeCoupon'] },\n guideline:\n \"The per-chip remove control (the X); dispatches $actions.cart.removeCoupon for that chip's code. Use inside a CartAppliedCoupons chip, which supplies the code via context. If used standalone (no CartAppliedCoupons ancestor), pass the code prop explicitly — without a code the remove action has no target and the button is a no-op.\",\n});\n\nexport const CartCouponErrorDefinition = defineComponent<CartCouponErrorProps>({\n name: 'CartCouponError',\n importPath: '@vtex/faststore/components',\n component: CartCouponError,\n editor: { label: 'Cart Coupon Error', category: 'commerce' },\n schema: {},\n guideline:\n 'Inline error banner that surfaces coupon apply/remove errors next to the CartCouponForm; renders nothing when there are none. Reads a dedicated coupon error channel, separate from CartError. Must be inside CartRoot.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function CartRoot({ $data: $dataProp, className, children, ...props }: CartRootProps) {\n const $data = useDataOverride($dataProp);\n const cart = $data ?? null;\n const { error: rootError } = useContext(ReactiveRootContext);\n\n // Hydrate the cart action's ready gate from the cart query response: once the entity arrives, the\n // existing-line writes (remove / quantity) can read it from the cache without a prior addItem.\n const cartEntityId = cart?.id ?? null;\n useEffect(() => {\n if (cartEntityId) orderFormIdVar(cartEntityId);\n }, [cartEntityId]);\n\n // Read-only context: the cart entity + query error. Cart writes are dispatched through\n // `$actions.cart.*`, not this context (ADR-0010).\n const dataValue: CartDataContextValue = useMemo(() => ({ cart, error: rootError ?? null }), [cart, rootError]);\n\n return (\n <CartTotalValueContext value={cart?.total ?? null}>\n <CartDataContextInternal value={dataValue}>\n <div {...props} className={className} data-fs-cart-root=\"\">\n {children}\n </div>\n </CartDataContextInternal>\n </CartTotalValueContext>\n );\n}\n\nexport function CartList({ className, children, skeletonCount = 3, ...props }: CartListProps) {\n const { cart } = useCart();\n const { loading } = useContext(ReactiveRootContext);\n const items = cart?.items ?? [];\n\n // FR-7: while the reactive cart query is in flight and no cart has resolved yet, render\n // skeleton placeholders instead of an empty list. Once data arrives (cart non-null) the real\n // lines render; a refetch over an existing cart keeps showing the items, not skeletons.\n if (loading && cart == null) {\n return (\n <div {...props} className={className} data-fs-cart-list=\"\">\n {Array.from({ length: skeletonCount }, (_, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static placeholders have no stable id\n <CartItemSkeleton key={i} />\n ))}\n </div>\n );\n }\n\n return (\n <div {...props} className={className} data-fs-cart-list=\"\">\n {items.map((item) => (\n // Publish the line's entity ref so each per-item provider (CartItemRoot,\n // CartItemSellerInfo, …) wrapped by <ReactiveListItemDataProvider> subscribes to\n // CartItem:<id> and falls back to this server-rendered slice until the cache is complete.\n // The per-line React context (CartItemContext) is provided by CartItemRoot, sliced — CartList\n // no longer fans the whole entity out (ADR-0012 Option B).\n <ListItemRefContext key={item.id} value={{ __typename: 'CartItem', id: item.id, fallbackData: item }}>\n {children}\n </ListItemRefContext>\n ))}\n </div>\n );\n}\n\nexport function CartTotal({ label, className, children, ...props }: CartTotalProps) {\n const total = useContext(CartTotalValueContext);\n const { locale, currency } = useStorefrontContext();\n const value = children ?? formatPrice(total?.amount ?? 0, locale, currency);\n\n return (\n <span {...props} className={className} data-fs-cart-total=\"\" data-fs-text=\"\">\n {label == null ? (\n value\n ) : (\n <>\n <span>{label}</span>\n <span>{value}</span>\n </>\n )}\n </span>\n );\n}\n\nexport function CartCount({ className, children, template = '{count}', ...props }: CartCountProps) {\n const { cart } = useCart();\n // Gift lines are left out — a promotion added them, not the shopper. A gift-only cart therefore\n // counts 0 while still rendering filled: the three-state branch gates on items.length, not on this.\n const count = cart?.items.reduce((sum, item) => (item.gift ? sum : sum + item.quantity), 0) ?? 0;\n\n return (\n <span {...props} className={className} data-fs-cart-count=\"\" data-fs-text=\"\">\n {children ?? template.replace('{count}', String(count))}\n </span>\n );\n}\n\nexport function CartError({ className, children, ...props }: CartErrorProps) {\n const userErrors = useReactiveVar(cartUserErrorsVar);\n const [firstError] = userErrors;\n if (!firstError) return null;\n\n return (\n <div {...props} role=\"alert\" className={className} data-fs-cart-error=\"\" data-fs-text=\"\">\n {children ?? firstError.message}\n </div>\n );\n}\n\n// `useLinkStatus()` only reports a pending window from a component rendered inside the <Link>, so\n// the loading state lives in this module-private child rather than in CartGoCheckout's body. No\n// built-in spinner: stores opt in by styling data-fs-cart-go-checkout-pending (mirrors buy-button).\nfunction CartGoCheckoutPending({ children }: { children?: ReactNode }) {\n const { pending } = useLinkStatus();\n\n return (\n <span\n data-fs-cart-go-checkout-content=\"\"\n aria-busy={pending || undefined}\n {...(pending ? { 'data-fs-cart-go-checkout-pending': '' } : {})}\n >\n {children}\n </span>\n );\n}\n\n// A blank value counts as unconfigured: the model's minLength is enforced by neither the runtime\n// slice nor the preflight, and an authored empty string is the same mistake. Trim to decide, never to\n// render.\nfunction configuredLabel(value: string | undefined) {\n return value?.trim() ? value : undefined;\n}\n\n// Internal vs external navigation: a site-relative checkout route is a client-side transition\n// (router.push, which keeps the pending state working); an absolute off-site checkout URL is a hard\n// navigation. Both run only after the validate gate has decided to proceed.\nfunction navigateToCheckout(href: string, push: (href: string) => void): void {\n if (/^https?:\\/\\//i.test(href)) {\n globalThis.location.assign(href);\n } else {\n push(href);\n }\n}\n\nexport function CartGoCheckout({\n href = '/checkout',\n label,\n className,\n children,\n onClick,\n $content,\n $actions: $actionsProp,\n ...props\n}: CartGoCheckoutProps) {\n const $actions = useActionsOverride($actionsProp);\n const client = useApolloClient();\n const router = useRouter();\n const [validating, setValidating] = useState(false);\n // Re-entrancy latch. A ref, not `validating`, because two clicks in one tick both read the same\n // pre-render state value; a ref is set synchronously so the second click sees the reservation.\n const inFlight = useRef(false);\n\n // `label` gets no destructuring default on purpose: it has to stay undefined when a store did not\n // author it, or it would shadow the `children` label every store still writes today. The literal\n // terminates the chain instead, which is what keeps the link from ever losing its accessible name.\n // $content stays here and is never spread into NavigationLink, so no entry can reach the href.\n // String children go through the same blank check as the props, so an empty or whitespace-only\n // authored label can never leave the link without an accessible name; element children (an icon\n // composition) pass through untouched.\n const resolvedChildren = typeof children === 'string' ? configuredLabel(children) : children;\n const resolvedLabel = configuredLabel($content?.label) ?? configuredLabel(label) ?? resolvedChildren ?? 'Checkout';\n\n // Pre-checkout stock validation (docs/storefront-core/reference-cart.md § Validation). Intercept\n // the CTA, await any in-flight write, validate, then branch on the outcome: a validation that could\n // not run navigates anyway (fail-open, unconditional — holds with or without a CartCheckoutGuard); a\n // validation that succeeded navigates only when the corrected cart has no unavailable line. Reading\n // the cache after the await is deterministic because Apollo commits the mutation's cache write before\n // the promise resolves.\n async function handleClick(e: React.MouseEvent<HTMLAnchorElement>) {\n onClick?.(e);\n const validate = $actions?.cart?.validate;\n // No gate wired → the link behaves natively. Modified clicks (new tab, middle-click) and clicks\n // another handler already owns are left to the browser.\n if (!validate) return;\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n e.preventDefault();\n // Re-entrant clicks while a validation is running are swallowed, never a second dispatch.\n if (inFlight.current) return;\n inFlight.current = true;\n\n setValidating(true);\n try {\n await awaitCartWrites();\n const errors = await validate();\n if (errors.length > 0) {\n navigateToCheckout(href, router.push);\n return;\n }\n const cart = readCartFromCache(client);\n const blocked = (cart?.items ?? []).some((item) => item.variant.availability !== 'AVAILABLE');\n if (!blocked) navigateToCheckout(href, router.push);\n } finally {\n inFlight.current = false;\n setValidating(false);\n }\n }\n\n return (\n <NavigationLink\n {...props}\n href={href}\n onClick={handleClick}\n className={className}\n data-fs-cart-go-checkout=\"\"\n {...(validating ? { 'data-fs-cart-go-checkout-validating': '' } : {})}\n >\n <CartGoCheckoutPending>{resolvedLabel}</CartGoCheckoutPending>\n </NavigationLink>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Coupon — apply / applied list + remove / error (FSPG-830)\n// ---------------------------------------------------------------------------\n\nexport function CartCouponForm({\n placeholder = 'Coupon code',\n applyLabel = 'Apply',\n className,\n children,\n onSubmit,\n $actions: $actionsProp,\n ...props\n}: CartCouponFormProps) {\n const $actions = useActionsOverride($actionsProp);\n const [code, setCode] = useState('');\n const [pending, setPending] = useState(false);\n\n async function handleSubmit(e: Parameters<NonNullable<CartCouponFormProps['onSubmit']>>[0]) {\n e.preventDefault();\n onSubmit?.(e);\n const trimmed = code.trim();\n if (!trimmed || pending) return;\n\n setPending(true);\n try {\n const errors = await $actions?.cart?.applyCoupon?.({ code: trimmed });\n // Clear the input only when the apply succeeded (no userErrors).\n if (!errors || errors.length === 0) setCode('');\n } finally {\n setPending(false);\n }\n }\n\n return (\n <form\n {...props}\n className={className}\n onSubmit={handleSubmit}\n data-fs-cart-coupon-form=\"\"\n {...(pending ? { 'data-fs-cart-coupon-pending': '' } : {})}\n >\n {children ?? (\n <>\n <input\n type=\"text\"\n value={code}\n placeholder={placeholder}\n aria-label={placeholder}\n disabled={pending}\n onChange={(e) => setCode(e.target.value)}\n data-fs-cart-coupon-input=\"\"\n />\n <button type=\"submit\" disabled={pending} data-fs-cart-coupon-apply=\"\" data-fs-button=\"\">\n {applyLabel}\n </button>\n </>\n )}\n </form>\n );\n}\n\nexport function CartAppliedCoupons({ className, children, $actions: $actionsProp, ...props }: CartAppliedCouponsProps) {\n const $actions = useActionsOverride($actionsProp);\n const { cart } = useCart();\n const coupons = cart?.appliedCoupons ?? [];\n if (coupons.length === 0) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-applied-coupons=\"\">\n {coupons.map((coupon) => (\n <CartCouponContext key={coupon.code} value={coupon}>\n <CartCouponChip $actions={$actions}>{children}</CartCouponChip>\n </CartCouponContext>\n ))}\n </div>\n );\n}\n\n// Per-coupon chip rendered by CartAppliedCoupons. Unregistered presentational helper (mirrors\n// CartItemSkeleton): the chip exposes data-fs-cart-coupon (+ data-fs-cart-coupon-unmatched) and\n// renders the coupon code inline, then renders the remove control — either the author-supplied\n// `children` (so the compiler can inject $actions into a CartCouponRemove placed in the layout) or a\n// built-in CartCouponRemove. The active coupon flows to descendants via CartCouponContext.\nfunction CartCouponChip({ children, $actions }: { children?: ReactNode; $actions?: ComponentActions }) {\n const coupon = useContext(CartCouponContext);\n if (!coupon) return null;\n\n return (\n <span data-fs-cart-coupon=\"\" {...(coupon.isUnmatchedCondition ? { 'data-fs-cart-coupon-unmatched': '' } : {})}>\n <span data-fs-cart-coupon-code=\"\" data-fs-text=\"\">\n {coupon.code}\n </span>\n {children ?? (\n <CartCouponRemove $actions={$actions} aria-label={`Remove coupon ${coupon.code}`}>\n ×\n </CartCouponRemove>\n )}\n </span>\n );\n}\n\nexport function CartCouponRemove({\n code,\n className,\n children,\n onClick,\n $actions: $actionsProp,\n ...props\n}: CartCouponRemoveProps) {\n const $actions = useActionsOverride($actionsProp);\n const coupon = useContext(CartCouponContext);\n const targetCode = code ?? coupon?.code;\n\n function handleClick(e: React.MouseEvent<HTMLButtonElement>) {\n if (targetCode) void $actions?.cart?.removeCoupon?.({ code: targetCode });\n onClick?.(e);\n }\n\n return (\n <button\n {...props}\n type=\"button\"\n className={className}\n onClick={handleClick}\n data-fs-cart-coupon-remove=\"\"\n data-fs-button=\"\"\n >\n {children}\n </button>\n );\n}\n\nexport function CartCouponError({ className, children, ...props }: CartCouponErrorProps) {\n const couponErrors = useReactiveVar(cartCouponErrorsVar);\n const [firstError] = couponErrors;\n if (!firstError) return null;\n\n return (\n <div {...props} role=\"alert\" className={className} data-fs-cart-coupon-error=\"\" data-fs-text=\"\">\n {children ?? firstError.message}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// F4 — Out-of-stock / unavailable item handling\n// ---------------------------------------------------------------------------\n\nexport const CartCheckoutGuardDefinition = defineComponent<CartCheckoutGuardProps>({\n name: 'CartCheckoutGuard',\n importPath: '@vtex/faststore/components',\n component: CartCheckoutGuard,\n editor: { label: 'Cart Checkout Guard', category: 'commerce' },\n schema: {},\n guideline:\n 'Wraps the checkout CTA and blocks progression while any cart item is unavailable: the subtree is made non-interactive (inert) and data-fs-cart-checkout-blocked is exposed for styling the disabled state. In the mini-cart DrawerPopup footer it is the enriched checkout CTA wrapper: place CartTotal and CartGoCheckout inside it so the grand total sits at the button and the whole CTA goes inert when an item cannot be delivered. Must be inside CartRoot.',\n});\n\nexport const CartLoadingDefinition = defineComponent<CartLoadingProps>({\n name: 'CartLoading',\n importPath: '@vtex/faststore/components',\n component: CartLoading,\n editor: { label: 'Cart Loading', category: 'commerce' },\n schema: {},\n guideline:\n 'The loading branch of the three-state mini-cart (loading / empty / filled): renders its children only while the cart is still loading. Supply a skeleton placeholder as its child. Pair with CartEmpty and CartFilled. Must be inside CartRoot. See cart.md.',\n});\n\nexport const CartEmptyDefinition = defineComponent<CartEmptyProps>({\n name: 'CartEmpty',\n importPath: '@vtex/faststore/components',\n component: CartEmpty,\n editor: { label: 'Cart Empty', category: 'commerce' },\n schema: {},\n guideline:\n 'The empty branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has resolved with zero items. It carries no copy of its own — compose CartEmptyMessage for the message and CartContinueShopping for the continue-shopping control, in whatever order and grouping the panel needs. Pair with CartLoading and CartFilled. Must be inside CartRoot. See cart.md.',\n});\n\nexport const CartFilledDefinition = defineComponent<CartFilledProps>({\n name: 'CartFilled',\n importPath: '@vtex/faststore/components',\n component: CartFilled,\n editor: { label: 'Cart Filled', category: 'commerce' },\n schema: {},\n guideline:\n 'The filled branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has one or more items. Wrap the CartList, the order summary, and the checkout CTA in it so they hide when the cart is empty. Pair with CartLoading and CartEmpty. Must be inside CartRoot. See cart.md.',\n});\n\nexport const CartUnavailableCountDefinition = defineComponent<CartUnavailableCountProps>({\n name: 'CartUnavailableCount',\n importPath: '@vtex/faststore/components',\n component: CartUnavailableCount,\n editor: { label: 'Cart Unavailable Count', category: 'commerce' },\n schema: {\n template: { type: 'string', default: '{count} items unavailable', label: 'Template' },\n },\n guideline: 'Cart-level summary of how many lines are unavailable; self-hides when none. See cart.md.',\n});\n\nexport const CartRemoveUnavailableDefinition = defineComponent<CartRemoveUnavailableProps>({\n name: 'CartRemoveUnavailable',\n importPath: '@vtex/faststore/components',\n component: CartRemoveUnavailable,\n editor: { label: 'Cart Remove Unavailable', category: 'commerce' },\n schema: {},\n actions: { cart: ['removeItems'] },\n guideline: 'Button that removes every unavailable line in one batch call; self-hides when none. See cart.md.',\n});\n\nfunction isUnavailable(item: CartEntity['items'][number]): boolean {\n return item.variant.availability !== 'AVAILABLE';\n}\n\nexport function CartCheckoutGuard({ className, children, ...props }: CartCheckoutGuardProps) {\n const { cart } = useCart();\n // Fail-safe: block on any non-AVAILABLE state — OUT_OF_STOCK, UNAVAILABLE, and the\n // catch-all UNKNOWN — so an unclassified item never lets the shopper proceed.\n const blocked = (cart?.items ?? []).some(isUnavailable);\n\n return (\n <div\n {...props}\n className={className}\n inert={blocked}\n aria-disabled={blocked || undefined}\n data-fs-cart-checkout-guard=\"\"\n data-fs-cart-checkout-blocked={blocked ? '' : undefined}\n >\n {children}\n </div>\n );\n}\n\nexport function CartUnavailableCount({\n className,\n children,\n template = '{count} items unavailable',\n ...props\n}: CartUnavailableCountProps) {\n const { cart } = useCart();\n const count = (cart?.items ?? []).filter(isUnavailable).length;\n if (count === 0) return null;\n\n return (\n <span {...props} className={className} data-fs-cart-unavailable-count=\"\" data-fs-text=\"\">\n {children ?? template.replace('{count}', String(count))}\n </span>\n );\n}\n\nexport function CartRemoveUnavailable({\n className,\n children,\n onClick,\n $actions: $actionsProp,\n ...props\n}: CartRemoveUnavailableProps) {\n const $actions = useActionsOverride($actionsProp);\n const { cart } = useCart();\n const unavailableIds = (cart?.items ?? []).filter(isUnavailable).map((item) => item.id);\n if (unavailableIds.length === 0) return null;\n\n function handleClick(e: React.MouseEvent<HTMLButtonElement>) {\n void $actions?.cart?.removeItems?.({ ids: unavailableIds });\n onClick?.(e);\n }\n\n return (\n <button\n {...props}\n type=\"button\"\n className={className}\n onClick={handleClick}\n data-fs-cart-remove-unavailable=\"\"\n data-fs-button=\"\"\n >\n {children ?? 'Remove unavailable items'}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// FSPG-822 — post-add behavior (mutually exclusive, selected by composition)\n//\n// Both subscribe to the add-success pulse (cartLastAddVar), which `addItem`\n// increments on each clean add. CartOpenOnAdd maps the pulse to the mini-cart's\n// open state; CartRedirectOnAdd sends a no-mini-cart store straight to checkout.\n// A store composes exactly one — there is no global.json flag.\n// ---------------------------------------------------------------------------\n\nexport const CartOpenOnAddDefinition = defineComponent<CartOpenOnAddProps>({\n name: 'CartOpenOnAdd',\n importPath: '@vtex/faststore/components',\n component: CartOpenOnAdd,\n editor: { label: 'Cart Open On Add', category: 'commerce' },\n schema: {},\n actions: { cart: ['validate'] },\n guideline:\n 'Mini-cart post-add behavior: wraps the mini-cart DrawerRoot subtree and opens the drawer automatically on each successful add to cart. Compose it as the parent of the DrawerRoot (its single child) — the header DrawerTrigger, the popup, and the cart leaves stay inside that DrawerRoot. It makes the drawer controlled internally, so do not set raw open/onOpenChange on DrawerRoot; the header trigger and manual close (Escape / backdrop / close button) keep working. It also runs a stock validation when the overlay opens, behind a short staleness window and skipped while a cart write is in flight, so opening a cart that went stale corrects it before the shopper acts. Use only in a store that has a mini-cart drawer. Mutually exclusive with CartRedirectOnAdd — compose exactly one. See cart.md.',\n});\n\nexport const CartRedirectOnAddDefinition = defineComponent<CartRedirectOnAddProps>({\n name: 'CartRedirectOnAdd',\n importPath: '@vtex/faststore/components',\n component: CartRedirectOnAdd,\n editor: { label: 'Cart Redirect On Add', category: 'commerce' },\n schema: {\n href: { type: 'string', default: '/checkout', label: 'Checkout URL' },\n },\n guideline:\n 'No-mini-cart post-add behavior: navigates the shopper to checkout (href, default /checkout) after each successful add to cart. Compose it once in the layout for a store that has no mini-cart drawer; it renders no UI of its own. Use this instead of a mini-cart when adding a product should go straight to checkout. Mutually exclusive with CartOpenOnAdd — compose exactly one, and omit the drawer when using this. See cart.md.',\n});\n\n/**\n * Makes the wrapped mini-cart `DrawerRoot` controlled by `miniCartOpenVar` and opens it on each\n * add-success pulse. `miniCartOpenVar` is the single source of truth: the pulse-driven open, the\n * header trigger (`onOpenChange(true)`), and manual close (`onOpenChange(false)`) all route through\n * it, so the trigger and manual dismissal keep working under controlled mode. Context-free — it\n * reads reactive vars and needs no `CartRoot` ancestor (ADR-0010). Expects a single `DrawerRoot`\n * child; the wiring is encapsulated here, never exposed as authorable drawer props.\n */\nexport function CartOpenOnAdd({ children, $actions: $actionsProp }: CartOpenOnAddProps) {\n const $actions = useActionsOverride($actionsProp);\n const open = useReactiveVar(miniCartOpenVar);\n const pulse = useReactiveVar(cartLastAddVar);\n\n useEffect(() => {\n if (pulse > 0) miniCartOpenVar(true);\n }, [pulse]);\n\n // Validate the cart's stock on the overlay's closed→open edge (T13). This is the sole observer of\n // that transition, so validate-on-open lives here rather than in a separate leaf whose only open\n // signal would be this same var.\n useCartValidateOnOpen($actions?.cart?.validate);\n\n if (!isValidElement<Pick<DrawerRootProps, 'open' | 'onOpenChange'>>(children)) return children;\n\n return cloneElement(children, {\n open,\n onOpenChange: (next: boolean) => miniCartOpenVar(next),\n });\n}\n\n/**\n * Navigates a no-mini-cart store to checkout after a successful add. Keys a `useEffect` on the\n * add-success pulse, which `addItem` increments only on the clean branch after the `await`, so the\n * redirect is post-resolve and success-gated. The initial `0` is ignored, so a fresh mount never\n * navigates. Context-free — no `CartRoot` ancestor (ADR-0010). Renders its passthrough children (or\n * nothing); it carries no drawer.\n */\nexport function CartRedirectOnAdd({ href = '/checkout', children }: CartRedirectOnAddProps) {\n const router = useRouter();\n const pulse = useReactiveVar(cartLastAddVar);\n\n useEffect(() => {\n if (pulse > 0) router.push(href);\n }, [pulse, href, router]);\n\n return children;\n}\n\n// ---------------------------------------------------------------------------\n// Loading / empty / filled — three mutually-exclusive self-hide branches gating\n// on the reactive cart (FSPG-820). `CartLoading` renders while the cart has not\n// resolved (`cart == null`); `CartEmpty` requires a resolved, item-free cart so\n// the empty state never flashes during load; `CartFilled` requires items.\n// Exactly one renders at any time: loading → empty → filled.\n// ---------------------------------------------------------------------------\n\nexport function CartLoading({ className, children, ...props }: CartLoadingProps) {\n const { cart } = useCart();\n if (cart != null) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-loading=\"\">\n {children}\n </div>\n );\n}\n\nexport function CartEmpty({ className, children, ...props }: CartEmptyProps) {\n const { cart } = useCart();\n if (cart == null || cart.items.length > 0) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-empty=\"\">\n {children}\n </div>\n );\n}\n\nexport function CartFilled({ className, children, ...props }: CartFilledProps) {\n const { cart } = useCart();\n if ((cart?.items ?? []).length === 0) return null;\n\n return (\n <div {...props} className={className} data-fs-cart-filled=\"\">\n {children}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Merchant messaging — disclaimer (F13). A plain-text notice the merchant authors, shown before the\n// shopper commits. It carries no fragment: the items gate reads what CartRoot already selects, so\n// placing or removing it leaves the composed page query unchanged.\n// ---------------------------------------------------------------------------\n\nexport const CartDisclaimerDefinition = defineComponent({\n name: 'CartDisclaimer',\n importPath: '@vtex/faststore/components',\n component: CartDisclaimer,\n content: CartDisclaimerContent,\n editor: { label: 'Cart Disclaimer', category: 'commerce' },\n schema: {\n text: { type: 'string', label: 'Disclaimer text' },\n },\n guideline:\n 'Plain-text merchant notice — conditions, purchase limits, or legal wording — shown in the cart before the shopper commits. CMS content wins over the text prop, and nothing renders when neither supplies a notice. It renders only when the cart has items, so it stays out of the empty state and out of the window before the cart resolves on its own. Place it inside CartFilled, below the order summary or immediately above the checkout CTA (CartCheckoutGuard): placement is composition order, and there is no position prop. Plain text only — no rich text and no inline links. Must be inside CartRoot. See cart.md.',\n});\n\nexport function CartDisclaimer({ text, $content, className, children, ...props }: CartDisclaimerProps) {\n const { cart } = useCart();\n // The empty-state rule is the leaf's own, not its placement's: a disclaimer composed outside\n // CartFilled still stays out of an empty overlay, and requiring a resolved cart keeps it from\n // flashing ahead of the lines it applies to.\n if (cart == null || cart.items.length === 0) return null;\n\n const notice = $content?.text ?? text;\n // Authored children are the highest-precedence override, matching the cart siblings (CartTotal,\n // CartCount, CartError…). A blank or whitespace-only string child counts as unconfigured — the same\n // rule CartGoCheckout's configuredLabel applies — so it never renders an empty <p>; non-string\n // composed children pass through untouched. Absent children, the copy resolves as\n // `$content?.text ?? text` and must be non-blank: `minLength` is enforced by neither the runtime\n // slice nor the preflight, so a blank entry value reaches the component and counts as unconfigured.\n const resolvedChildren = typeof children === 'string' ? configuredLabel(children) : children;\n if (resolvedChildren == null && !notice?.trim()) return null;\n\n return (\n <p {...props} className={className} data-fs-cart-disclaimer=\"\" data-fs-text=\"\">\n {resolvedChildren ?? notice}\n </p>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton — loading placeholder rendered by CartList while the reactive cart\n// query is in flight (FR-7). Plain, unregistered presentational helper (mirrors\n// PricingSkeleton's shape; CartRoot is reactive, so the lazy `skeleton` field\n// does not apply — CartList drives it instead).\n// ---------------------------------------------------------------------------\n\nexport function CartItemSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n // Minimal built-in look (plain, always-generated utilities) so the placeholder is visible out of\n // the box; a store can still restyle the bars via the data-fs-cart-item-skeleton-line swatch.\n return (\n <div {...props} className={className} data-fs-cart-item-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-cart-item-skeleton-line=\"\" className=\"block h-4 w-full animate-pulse rounded bg-gray-200\" />\n <span data-fs-cart-item-skeleton-line=\"\" className=\"mt-2 block h-4 w-2/3 animate-pulse rounded bg-gray-200\" />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Merchant alert banner — a family rather than a single leaf, so the schema\n// decides the order and the subset instead of a layout prop. The Root owns\n// every resolution for two reasons: it is the only part that can tell whether\n// there is anything to say before the others mount, and one content model\n// keyed by its element id keeps the merchant's authoring surface a single\n// group in the Admin instead of one per part.\n// ---------------------------------------------------------------------------\n\nexport const CartAlertContent = defineContentType({\n id: 'cart-alert',\n title: 'Cart Alert',\n description: 'Merchant notice shown at the top of the mini-cart overlay.',\n schema: {\n type: 'object',\n additionalProperties: false,\n // Nothing is required. This model shares one composite entry with the other mini-cart content\n // leaves, and a read-time `required` violation invalidates the whole entry — one blank message\n // would take the disclaimer, the empty-state copy and the checkout label down with it.\n // `minLength` is author-time guidance only, so a blank still arrives here and self-hides.\n properties: {\n text: { type: 'string', minLength: 1, title: 'Message' },\n // Inline literals: the catalog scanner reads this file statically and rejects an identifier\n // it cannot evaluate. Every name is a base-dialect one, so each resolves in any store\n // regardless of its configured collection — but a store still has to register them.\n icon: {\n type: 'string',\n enum: ['bell', 'bell-ringing', 'tag', 'shopping-cart', 'map-pin', 'star'],\n title: 'Icon',\n },\n iconUrl: { type: 'string', format: 'uri', title: 'Custom icon', widget: { 'ui:widget': 'media-gallery' } },\n iconAlt: { type: 'string', title: 'Custom icon alt text' },\n },\n },\n});\n\n/**\n * The sprite names the CMS channel admits. Exported because a store whose merchants pick the icon\n * has to list them under `icons.include` for the glyph to reach the route sprite — one import there\n * instead of six retyped strings. Read off the model so the two cannot drift apart.\n */\nexport const CART_ALERT_ICON_NAMES = CartAlertContent.schema.properties.icon.enum;\n\nexport type CartAlertRootProps = ComponentPropsWithRef<'div'> & {\n /** Authored fallback message. No default: an invented one would ship copy no merchant wrote. */\n text?: string;\n /** Authored fallback sprite name. Unbounded — the compiler resolves it or fails the build. */\n icon?: string;\n /** Authored fallback uploaded glyph; wins over `icon` when both resolve. */\n iconUrl?: string;\n /** Alt text for the uploaded glyph; empty (decorative) when unset. */\n iconAlt?: string;\n /** Merchant-authored copy, sliced from the layout's composite entry; wins field by field. */\n $content?: ContentValue<typeof CartAlertContent>;\n};\n\n/** The glyph renders as an `img` or an `svg` depending on the channel, so it takes only what both accept. */\nexport type CartAlertIconProps = { className?: string };\n\nexport type CartAlertTextProps = ComponentPropsWithRef<'span'>;\n\n/** One resolved glyph: an uploaded image or a sprite name, never both. */\ntype ResolvedGlyph = { src: string; alt: string } | { name: string };\n\ntype CartAlertContextValue = {\n /** Non-blank by construction: the root self-hides when nothing resolves. */\n message: string;\n /** Resolved on the root so the parts hold no precedence logic; `null` when no glyph is configured. */\n glyph: ResolvedGlyph | null;\n};\n\nconst CART_ALERT_CONTEXT_UNSET = Symbol('CartAlertContextUnset');\n\nconst CartAlertContext = createContext<CartAlertContextValue | typeof CART_ALERT_CONTEXT_UNSET>(\n CART_ALERT_CONTEXT_UNSET,\n);\n\nfunction useCartAlert(): CartAlertContextValue {\n const ctx = useContext(CartAlertContext);\n if (ctx === CART_ALERT_CONTEXT_UNSET) {\n throw new Error('CartAlert parts must be used inside CartAlertRoot.');\n }\n return ctx;\n}\n\n/**\n * A content-channel icon name is admitted only when the model's `enum` still lists it. An entry is\n * external data whose `icon` is typed as the enum but not guaranteed to be one at runtime (a stale\n * value, or a read-time gate that does not enforce `enum`), and an unadmitted name would reach the\n * sprite lookup and render an empty `<svg>` with no build error and nothing in the console.\n */\nfunction admitContentIcon(name: string | undefined): string | undefined {\n return name && (CART_ALERT_ICON_NAMES as readonly string[]).includes(name) ? name : undefined;\n}\n\n/**\n * Resolves one glyph from a single source channel, the upload before the sprite name. Kept per-source\n * rather than per-field so the two channels never mix across sources: a merchant who configures a\n * sprite name in the CMS is not silently overridden by an uploaded-glyph *prop* the developer left as\n * a default. The prop `name` is unfiltered — the compiler resolves it or fails the build; only a\n * content name passes through `admitContentIcon`.\n */\nfunction resolveGlyph(\n url: string | undefined,\n alt: string | undefined,\n name: string | undefined,\n): ResolvedGlyph | null {\n if (url?.trim()) return { src: url, alt: alt ?? '' };\n if (name) return { name };\n return null;\n}\n\n// Type parameters are left to inference so `CorrelateContent` can check `$content` against the\n// declared model (an explicit TProps would bypass it), mirroring BuyButtonButton and Promotion.\nexport const CartAlertRootDefinition = defineComponent({\n name: 'CartAlertRoot',\n importPath: '@vtex/faststore/components',\n component: CartAlertRoot,\n content: CartAlertContent,\n editor: { label: 'Cart Alert', category: 'commerce' },\n schema: {\n text: { type: 'string', label: 'Message' },\n icon: { type: 'icon', label: 'Icon' },\n iconUrl: { type: 'string', label: 'Custom icon URL' },\n iconAlt: { type: 'string', label: 'Custom icon alt text' },\n },\n providesContext: 'cart-alert',\n guideline:\n 'Merchant-authored notice near the top of the mini-cart overlay (a minimum order, a running promotion): wraps CartAlertIcon and CartAlertText in any subset, any order — the arrangement is the composition, not a prop — and renders the glyph then the copy when composed with no children. Its copy and glyph are CMS-editable through the cart-alert content model, with the text, icon, iconUrl and iconAlt props as the non-CMS fallback; it renders nothing when no message is configured, so an unconfigured banner leaves no empty box. Reads no cart data, so it needs no CartRoot ancestor and no cart-state gate — place it inside CartFilled to hide it on an empty cart. A store whose merchants choose the icon must list CART_ALERT_ICON_NAMES under icons.include in global.json, or a chosen glyph renders empty. Distinct from CartError (cart mutation errors) and CartUnavailableCount (data-driven). See cart.md.',\n});\n\nexport const CartAlertIconDefinition = defineComponent<CartAlertIconProps>({\n name: 'CartAlertIcon',\n importPath: '@vtex/faststore/components',\n component: CartAlertIcon,\n editor: { label: 'Cart Alert Icon', category: 'commerce' },\n schema: {},\n requiresContext: 'cart-alert',\n guideline:\n 'The alert glyph, inside a CartAlertRoot (or any ancestor providing `cart-alert` context). Prefers the merchant-uploaded icon and falls back to the predefined sprite name, and renders nothing when neither is configured. Decorative — the message carries the meaning. Place it before or after CartAlertText to set the order.',\n});\n\nexport const CartAlertTextDefinition = defineComponent<CartAlertTextProps>({\n name: 'CartAlertText',\n importPath: '@vtex/faststore/components',\n component: CartAlertText,\n editor: { label: 'Cart Alert Message', category: 'commerce' },\n schema: {},\n requiresContext: 'cart-alert',\n guideline:\n 'The alert message, inside a CartAlertRoot (or any ancestor providing `cart-alert` context). The copy comes from the root (its CMS entry or its text prop), so children are a display override rather than an authoring channel. Place it before or after CartAlertIcon to set the order.',\n});\n\nexport function CartAlertRoot({\n text,\n icon,\n iconUrl,\n iconAlt,\n className,\n children,\n $content,\n ...props\n}: CartAlertRootProps) {\n const message = $content?.text ?? text;\n\n // The glyph resolves as a whole channel, CMS before props, so a merchant-configured glyph — sprite\n // name or upload — wins over whatever the developer set as a fallback. Resolving each field on its\n // own would let a prop `iconUrl` mask a CMS `icon`, a CMS edit that does nothing. Memoized so the\n // context value keeps a stable identity across renders — the parts re-render only on a real change.\n const value = useMemo<CartAlertContextValue>(\n () => ({\n message: message ?? '',\n glyph:\n resolveGlyph($content?.iconUrl, $content?.iconAlt, admitContentIcon($content?.icon)) ??\n resolveGlyph(iconUrl, iconAlt, icon),\n }),\n [message, $content?.iconUrl, $content?.iconAlt, $content?.icon, iconUrl, iconAlt, icon],\n );\n if (!message?.trim()) return null;\n\n return (\n <CartAlertContext value={value}>\n <div {...props} className={className} data-fs-cart-alert=\"\">\n {children ?? (\n <>\n <CartAlertIcon />\n <CartAlertText />\n </>\n )}\n </div>\n </CartAlertContext>\n );\n}\n\nexport function CartAlertIcon({ className }: Readonly<CartAlertIconProps>) {\n const { glyph } = useCartAlert();\n if (!glyph) return null;\n\n if ('src' in glyph) {\n return <Image src={glyph.src} alt={glyph.alt} className={className} data-fs-cart-alert-icon=\"\" />;\n }\n return <Icon name={glyph.name} className={className} data-fs-cart-alert-icon=\"\" />;\n}\n\nexport function CartAlertText({ className, children, ...props }: CartAlertTextProps) {\n const { message } = useCartAlert();\n\n return (\n <span {...props} className={className} data-fs-cart-alert-text=\"\" data-fs-text=\"\">\n {children ?? message}\n </span>\n );\n}\n\n// ---------------------------------------------------------------------------\n// F1 — Empty-state copy: the message and the way back to browsing.\n//\n// Two leaves rather than one, because the message and the control are placed\n// independently: the message sits in the panel body while the control is\n// commonly pinned to the drawer footer. Neither renders a wrapper, so grouping,\n// order, and any illustration stay the store's, composed inside CartEmpty.\n//\n// The copy is merchant-editable, so each leaf declares its own content model\n// with a schema prop as the non-CMS fallback ($content -> prop -> default),\n// following footer-copyright. `CartEmpty` gates when the branch renders; these\n// leaves only carry copy, so they read no cart data and select no field.\n// ---------------------------------------------------------------------------\n\nexport const CartEmptyMessageContent = defineContentType({\n id: 'cart-empty-message',\n title: 'Cart Empty Message',\n description: 'Message shown in the cart overlay when the cart has no items.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: { type: 'string', minLength: 1, title: 'Empty cart message', default: 'Your cart is empty' },\n },\n },\n});\n\nexport const CartContinueShoppingContent = defineContentType({\n id: 'cart-continue-shopping',\n title: 'Cart Continue Shopping',\n description: 'Label for the control that dismisses the cart overlay and returns the shopper to browsing.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['label'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Continue shopping label', default: 'Continue shopping' },\n },\n },\n});\n\nexport const CartEmptyMessageDefinition = defineComponent<CartEmptyMessageProps>({\n name: 'CartEmptyMessage',\n importPath: '@vtex/faststore/components',\n component: CartEmptyMessage,\n content: CartEmptyMessageContent,\n editor: { label: 'Cart Empty Message', category: 'commerce' },\n schema: {\n text: { type: 'string', default: 'Your cart is empty', label: 'Empty cart message' },\n },\n guideline:\n 'The empty-cart message, rendered as plain text inside CartEmpty. CMS content wins over the text prop, which defaults to \"Your cart is empty\"; blank resolved copy renders nothing. It carries no layout — group and space it with Container, and pair it with CartContinueShopping for the way back to browsing. See cart.md.',\n});\n\nexport const CartContinueShoppingDefinition = defineComponent<CartContinueShoppingProps>({\n name: 'CartContinueShopping',\n importPath: '@vtex/faststore/components',\n component: CartContinueShopping,\n content: CartContinueShoppingContent,\n editor: { label: 'Cart Continue Shopping', category: 'action' },\n schema: {\n label: { type: 'string', default: 'Continue shopping', label: 'Continue shopping label' },\n },\n guideline:\n 'Dismisses the cart overlay so the shopper can keep browsing; dispatches no cart write. Place it in the empty panel inside CartEmpty, commonly in a footer Container. It closes the drawer, so it requires a DrawerRoot ancestor — on a cart page with no drawer, compose a NavigationLink back to browsing instead of this control. CMS content wins over the label prop, and composed children win over both (compose an icon that way). See cart.md.',\n});\n\nexport function CartEmptyMessage({\n text = 'Your cart is empty',\n $content,\n className,\n ...props\n}: CartEmptyMessageProps) {\n const message = $content?.text ?? text;\n // `minLength` is enforced by neither the runtime slice nor the preflight, so a blank entry value\n // reaches the component and counts as unconfigured. Trim to decide, never to render.\n if (!message.trim()) return null;\n\n return (\n <p {...props} className={className} data-fs-cart-empty-message=\"\" data-fs-text=\"\">\n {message}\n </p>\n );\n}\n\nexport function CartContinueShopping({\n label = 'Continue shopping',\n $content,\n className,\n children,\n ...props\n}: CartContinueShoppingProps) {\n const content = $content?.label ?? label;\n // Composed children are the button's content, so they carry it on their own when copy is blank.\n if (children == null && !content.trim()) return null;\n\n return (\n <DrawerClose {...props} className={className} data-fs-cart-continue-shopping=\"\" data-fs-button=\"\">\n {children ?? content}\n </DrawerClose>\n );\n}\n\n// The `Cart.*` namespace object is assembled in the package barrel (src/index.ts) so it can combine\n// the aggregate components here with the line-item components in matter/cart-item without a cyclic\n// import between the two files.\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,wBAAwB,kBAAkB;CACrD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,UAAU,CAAC,MAAM;EACjB,YAAY,EACV,MAAM;GAAE,MAAM;GAAU,WAAW;GAAG,OAAO;EAAkB,EACjE;CACF;AACF,CAAC;AAOD,MAAa,2BAA2B,kBAAkB;CACxD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I,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE5B,OACE,oBAAC,KAAD;EAAG,GAAI;EAAkB;EAAW,8BAA2B;EAAG,gBAAa;EAC5E,UAAA;CACA,CAAA;AAEP;AAEA,SAAgB,qBAAqB,EACnC,QAAQ,qBACR,UACA,WACA,UACA,GAAG,SACyB;CAC5B,MAAM,UAAU,UAAU,SAAS;CAEnC,IAAI,YAAY,QAAQ,CAAC,QAAQ,KAAK,GAAG,OAAO;CAEhD,OACE,oBAAC,aAAD;EAAa,GAAI;EAAkB;EAAW,kCAA+B;EAAG,kBAAe;EAC5F,UAAA,YAAY;CACF,CAAA;AAEjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-options.js","names":[],"sources":["../../../src/matter/delivery-options/delivery-options.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { RadioGroup, RadioRoot } from '../../particles/radio/radio.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport {\n OptionItemContext,\n type ShippingOption,\n ShippingSimulatorContext,\n} from '../shipping-simulator/shipping-simulator.js';\nimport { type RawDeliveryOptionsData, useDeliveryOptionSelection } from './use-delivery-option-selection.js';\n\n/**\n * The `DeliveryOptions` matter section (specs/delivery-options-step.md, T3 of the Single Address\n * Delivery epic). `DeliveryOptionsRoot` is a reactive Root over the persisted `Shipping` entity\n * (Decision 1) that becomes the THIRD provider of the FSPG-832 option-leaf runtime contexts —\n * `ShippingSimulatorContext` and the per-option `OptionItemContext` — alongside the two existing\n * simulator Roots (Decision 2), so `ShippingSimulatorOption` / `OptionName` / `OptionEstimate` /\n * `OptionPrice` / `OptionFreeBadge` render identically here with zero edits to those leaves.\n * `children` is the per-option template, rendered once per option inside a `RadioRoot` (radio\n * particle) whose group value is bound directly to `selectedOptionId` (Decision 5 — no local\n * selection state); changing it fires the `shipping.selectOption` action. Fields the reused leaves\n * do not read for this section (`postalCode`, `setPostalCode`, `submit`, `status`) are inert\n * defaults, satisfying the shared context type without a simulation flow. Exception: while\n * rendering `mockOptions` (no real data), selection is local-only and never dispatches the action —\n * see `mockOptions` on `DeliveryOptionsRootProps`.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — raw template literal, matching the ShippingSimulator matter's own convention\n// (not yet migrated to the codegen `graphql()` pipeline; see codegen.ts's documents glob comment).\n//\n// Selects `shipping { id ... }` (not shown in the spec's fragment snippet) so Apollo's\n// InMemoryCache normalizes `Shipping` by id — required for `shippingOptionSelect`'s returned\n// `shipping` to update the same cache entity this fragment reads (Decision 1/Decision 5's\n// \"reactive cache, no local state\" only holds if both sides normalize to the same entity).\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment DeliveryOptionsData on Query {\n shipping {\n id\n options {\n id\n name\n channel\n shippingEstimate {\n value\n unit\n }\n price {\n amount\n currencyCode\n }\n listPrice {\n amount\n currencyCode\n }\n }\n selectedOptionId\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type DeliveryOptionsRootProps = ComponentPropsWithRef<'div'> & {\n /**\n * Shipping slice forwarded by the reactive runtime (`ReactiveDataProvider`) — it is the value of\n * the `shipping` top-level field on `DeliveryOptionsData on Query`, not the wrapping\n * `{ shipping: … }` shape. Receives `null` when shipping has not yet resolved.\n */\n $data?: RawDeliveryOptionsData | null;\n /** Compiler-injected action surface; carries `shipping.selectOption`. */\n $actions?: ComponentActions;\n /**\n * Local/dev fallback rows, used only when the reactive fetch resolves no options — real data\n * always wins the moment it has any. `Shipping.options` is non-nullable, so a genuinely empty\n * cart is indistinguishable from \"no data yet\" at this prop's shape; setting `mockOptions` is an\n * explicit per-page opt-in that accepts showing these rows in both cases. Omit on production\n * pages. Selecting a mock row is handled entirely with local state and never calls\n * `$actions.shipping.selectOption` — there is no real cart/address for the real mutation to act\n * on, so dispatching it would only ever surface a domain error (e.g. `MISSING_SHIPPING_ADDRESS`).\n */\n mockOptions?: ShippingOption[];\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const DeliveryOptionsRootDefinition = defineComponent<DeliveryOptionsRootProps>({\n name: 'DeliveryOptionsRoot',\n importPath: '@vtex/faststore/components',\n component: DeliveryOptionsRoot,\n fragment,\n fetchStrategy: 'reactive',\n actions: { shipping: ['selectOption'] },\n editor: { label: 'Delivery Options', category: 'commerce' },\n schema: {\n mockOptions: { type: 'array', label: 'Mock options (local/dev fallback, ignored once real data has options)' },\n },\n // Re-provides the reused option leaves' runtime contexts (Decision 2): the inner\n // `shipping-simulator-option` token is required — the option leaves compose as direct children\n // here with no `ShippingSimulatorOptions` node between them — and the outer `shipping-simulator`\n // token reflects the `ShippingSimulatorContext` this Root also provides at runtime.\n providesContext: ['shipping-simulator', 'shipping-simulator-option'],\n guideline:\n 'Root for the whole-cart delivery-option list at the delivery step: renders Shipping.options as a radio group bound to selectedOptionId, reusing the FSPG-832 option leaves (ShippingSimulatorOption, OptionName, OptionEstimate, OptionPrice, OptionFreeBadge) as the per-option template placed as children. Selecting a row dispatches $actions.shipping.selectOption. No local selection state — the group value is always the server selectedOptionId. mockOptions is a local/dev-only fallback rendered when the real fetch has no options; omit it in production.',\n});\n\n// ---------------------------------------------------------------------------\n// Shared list body\n// ---------------------------------------------------------------------------\n\nexport type DeliveryOptionsListBodyProps = ComponentPropsWithRef<'div'> & {\n /** Resolved option rows (real or mock), supplied by the caller's selection engine. */\n options: ShippingOption[];\n /** Group value bound to the radio group; `null` renders nothing selected. */\n selectedOptionId: string | null;\n /** First `userError` message from the latest selection, or `null`; rendered as `role=\"alert\"`. */\n selectionError: string | null;\n /** Dispatched on a row change with the picked option id. */\n onSelectOption: (optionId: string) => void;\n};\n\n/**\n * The list body shared by `DeliveryOptionsRoot` (always-open) and `DeliveryOptionsList` (the\n * collapsed-surface body under `DeliveryOptionsController`): the inline selection error plus the\n * radio group of options, reusing the FSPG-832 option leaves as the per-option `children` template.\n * It owns no data or selection engine — the caller resolves `options` / `selectedOptionId` /\n * `selectionError` and supplies the `onSelect` dispatch, so both surfaces render through one\n * component and cannot drift. Not registered: it renders no independently placeable part of its own\n * (the `data-fs-delivery-options` container hook and the reused leaves are the addressable parts).\n */\nexport function DeliveryOptionsListBody({\n options,\n selectedOptionId,\n selectionError,\n onSelectOption,\n className,\n children,\n ...props\n}: DeliveryOptionsListBodyProps) {\n return (\n <div {...props} className={className} data-fs-delivery-options=\"\">\n {selectionError ? (\n <div role=\"alert\" data-fs-delivery-options-error=\"\">\n {selectionError}\n </div>\n ) : null}\n {options.length > 0 ? (\n <RadioGroup value={selectedOptionId ?? ''} onValueChange={onSelectOption}>\n {options.map((option) => (\n <OptionItemContext key={option.id} value={option}>\n <RadioRoot value={option.id}>{children}</RadioRoot>\n </OptionItemContext>\n ))}\n </RadioGroup>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function DeliveryOptionsRoot({\n $data,\n $actions: $actionsProp,\n mockOptions,\n className,\n children,\n ...props\n}: DeliveryOptionsRootProps) {\n const $actions = useActionsOverride($actionsProp);\n const { options, selectedOptionId, selectionError, selectOption, contextValue } = useDeliveryOptionSelection({\n $data,\n $actions,\n mockOptions,\n });\n\n return (\n <ShippingSimulatorContext value={contextValue}>\n <DeliveryOptionsListBody\n {...props}\n className={className}\n options={options}\n selectedOptionId={selectedOptionId}\n selectionError={selectionError}\n onSelectOption={(optionId) => selectOption(optionId)}\n >\n {children}\n </DeliveryOptionsListBody>\n </ShippingSimulatorContext>\n );\n}\n"],"mappings":";;;;;;;;AA+FA,MAAa,gCAAgC,gBAA0C;CACrF,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;;;;;;;;;;;;;;;;;;CACA,eAAe;CACf,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE;CACtC,QAAQ;EAAE,OAAO;EAAoB,UAAU;CAAW;CAC1D,QAAQ,EACN,aAAa;EAAE,MAAM;EAAS,OAAO;CAAwE,EAC/G;CAKA,iBAAiB,CAAC,sBAAsB,2BAA2B;CACnE,WACE;AACJ,CAAC;;;;;;;;;;AA0BD,SAAgB,wBAAwB,EACtC,SACA,kBACA,gBACA,gBACA,WACA,UACA,GAAG,SAC4B;CAC/B,OACE,qBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,4BAAyB;EAA/D,UAAA,CACG,iBACC,oBAAC,OAAD;GAAK,MAAK;GAAQ,kCAA+B;GAC9C,UAAA;EACE,CAAA,IACH,MACH,QAAQ,SAAS,IAChB,oBAAC,YAAD;GAAY,OAAO,oBAAoB;GAAI,eAAe;GACvD,UAAA,QAAQ,KAAK,WACZ,oBAAC,mBAAD;IAAmC,OAAO;IACxC,UAAA,oBAAC,WAAD;KAAW,OAAO,OAAO;KAAK;IAAoB,CAAA;GACjC,GAFK,OAAO,EAEZ,CACpB;EACS,CAAA,IACV,IACD;;AAET;AAMA,SAAgB,oBAAoB,EAClC,OACA,UAAU,cACV,aACA,WACA,UACA,GAAG,SACwB;CAC3B,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,EAAE,SAAS,kBAAkB,gBAAgB,cAAc,iBAAiB,2BAA2B;EAC3G;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,0BAAD;EAA0B,OAAO;EAC/B,UAAA,oBAAC,yBAAD;GACE,GAAI;GACO;GACF;GACS;GACF;GAChB,iBAAiB,aAAa,aAAa,QAAQ;GAElD;EACsB,CAAA;CACD,CAAA;AAE9B"}
1
+ {"version":3,"file":"delivery-options.js","names":[],"sources":["../../../src/matter/delivery-options/delivery-options.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { RadioGroup, RadioRoot } from '../../particles/radio/radio.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport {\n OptionItemContext,\n type ShippingOption,\n ShippingSimulatorContext,\n} from '../shipping-simulator/shipping-simulator.js';\nimport { type RawDeliveryOptionsData, useDeliveryOptionSelection } from './use-delivery-option-selection.js';\n\n/**\n * The `DeliveryOptions` matter section (docs/storefront-core/reference-cart.md § Delivery, T3 of the Single Address\n * Delivery epic). `DeliveryOptionsRoot` is a reactive Root over the persisted `Shipping` entity\n * (Decision 1) that becomes the THIRD provider of the FSPG-832 option-leaf runtime contexts —\n * `ShippingSimulatorContext` and the per-option `OptionItemContext` — alongside the two existing\n * simulator Roots (Decision 2), so `ShippingSimulatorOption` / `OptionName` / `OptionEstimate` /\n * `OptionPrice` / `OptionFreeBadge` render identically here with zero edits to those leaves.\n * `children` is the per-option template, rendered once per option inside a `RadioRoot` (radio\n * particle) whose group value is bound directly to `selectedOptionId` (Decision 5 — no local\n * selection state); changing it fires the `shipping.selectOption` action. Fields the reused leaves\n * do not read for this section (`postalCode`, `setPostalCode`, `submit`, `status`) are inert\n * defaults, satisfying the shared context type without a simulation flow. Exception: while\n * rendering `mockOptions` (no real data), selection is local-only and never dispatches the action —\n * see `mockOptions` on `DeliveryOptionsRootProps`.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — raw template literal, matching the ShippingSimulator matter's own convention\n// (not yet migrated to the codegen `graphql()` pipeline; see codegen.ts's documents glob comment).\n//\n// Selects `shipping { id ... }` (not shown in the spec's fragment snippet) so Apollo's\n// InMemoryCache normalizes `Shipping` by id — required for `shippingOptionSelect`'s returned\n// `shipping` to update the same cache entity this fragment reads (Decision 1/Decision 5's\n// \"reactive cache, no local state\" only holds if both sides normalize to the same entity).\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment DeliveryOptionsData on Query {\n shipping {\n id\n options {\n id\n name\n channel\n shippingEstimate {\n value\n unit\n }\n price {\n amount\n currencyCode\n }\n listPrice {\n amount\n currencyCode\n }\n }\n selectedOptionId\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type DeliveryOptionsRootProps = ComponentPropsWithRef<'div'> & {\n /**\n * Shipping slice forwarded by the reactive runtime (`ReactiveDataProvider`) — it is the value of\n * the `shipping` top-level field on `DeliveryOptionsData on Query`, not the wrapping\n * `{ shipping: … }` shape. Receives `null` when shipping has not yet resolved.\n */\n $data?: RawDeliveryOptionsData | null;\n /** Compiler-injected action surface; carries `shipping.selectOption`. */\n $actions?: ComponentActions;\n /**\n * Local/dev fallback rows, used only when the reactive fetch resolves no options — real data\n * always wins the moment it has any. `Shipping.options` is non-nullable, so a genuinely empty\n * cart is indistinguishable from \"no data yet\" at this prop's shape; setting `mockOptions` is an\n * explicit per-page opt-in that accepts showing these rows in both cases. Omit on production\n * pages. Selecting a mock row is handled entirely with local state and never calls\n * `$actions.shipping.selectOption` — there is no real cart/address for the real mutation to act\n * on, so dispatching it would only ever surface a domain error (e.g. `MISSING_SHIPPING_ADDRESS`).\n */\n mockOptions?: ShippingOption[];\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const DeliveryOptionsRootDefinition = defineComponent<DeliveryOptionsRootProps>({\n name: 'DeliveryOptionsRoot',\n importPath: '@vtex/faststore/components',\n component: DeliveryOptionsRoot,\n fragment,\n fetchStrategy: 'reactive',\n actions: { shipping: ['selectOption'] },\n editor: { label: 'Delivery Options', category: 'commerce' },\n schema: {\n mockOptions: { type: 'array', label: 'Mock options (local/dev fallback, ignored once real data has options)' },\n },\n // Re-provides the reused option leaves' runtime contexts (Decision 2): the inner\n // `shipping-simulator-option` token is required — the option leaves compose as direct children\n // here with no `ShippingSimulatorOptions` node between them — and the outer `shipping-simulator`\n // token reflects the `ShippingSimulatorContext` this Root also provides at runtime.\n providesContext: ['shipping-simulator', 'shipping-simulator-option'],\n guideline:\n 'Root for the whole-cart delivery-option list at the delivery step: renders Shipping.options as a radio group bound to selectedOptionId, reusing the FSPG-832 option leaves (ShippingSimulatorOption, OptionName, OptionEstimate, OptionPrice, OptionFreeBadge) as the per-option template placed as children. Selecting a row dispatches $actions.shipping.selectOption. No local selection state — the group value is always the server selectedOptionId. mockOptions is a local/dev-only fallback rendered when the real fetch has no options; omit it in production.',\n});\n\n// ---------------------------------------------------------------------------\n// Shared list body\n// ---------------------------------------------------------------------------\n\nexport type DeliveryOptionsListBodyProps = ComponentPropsWithRef<'div'> & {\n /** Resolved option rows (real or mock), supplied by the caller's selection engine. */\n options: ShippingOption[];\n /** Group value bound to the radio group; `null` renders nothing selected. */\n selectedOptionId: string | null;\n /** First `userError` message from the latest selection, or `null`; rendered as `role=\"alert\"`. */\n selectionError: string | null;\n /** Dispatched on a row change with the picked option id. */\n onSelectOption: (optionId: string) => void;\n};\n\n/**\n * The list body shared by `DeliveryOptionsRoot` (always-open) and `DeliveryOptionsList` (the\n * collapsed-surface body under `DeliveryOptionsController`): the inline selection error plus the\n * radio group of options, reusing the FSPG-832 option leaves as the per-option `children` template.\n * It owns no data or selection engine — the caller resolves `options` / `selectedOptionId` /\n * `selectionError` and supplies the `onSelect` dispatch, so both surfaces render through one\n * component and cannot drift. Not registered: it renders no independently placeable part of its own\n * (the `data-fs-delivery-options` container hook and the reused leaves are the addressable parts).\n */\nexport function DeliveryOptionsListBody({\n options,\n selectedOptionId,\n selectionError,\n onSelectOption,\n className,\n children,\n ...props\n}: DeliveryOptionsListBodyProps) {\n return (\n <div {...props} className={className} data-fs-delivery-options=\"\">\n {selectionError ? (\n <div role=\"alert\" data-fs-delivery-options-error=\"\">\n {selectionError}\n </div>\n ) : null}\n {options.length > 0 ? (\n <RadioGroup value={selectedOptionId ?? ''} onValueChange={onSelectOption}>\n {options.map((option) => (\n <OptionItemContext key={option.id} value={option}>\n <RadioRoot value={option.id}>{children}</RadioRoot>\n </OptionItemContext>\n ))}\n </RadioGroup>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function DeliveryOptionsRoot({\n $data,\n $actions: $actionsProp,\n mockOptions,\n className,\n children,\n ...props\n}: DeliveryOptionsRootProps) {\n const $actions = useActionsOverride($actionsProp);\n const { options, selectedOptionId, selectionError, selectOption, contextValue } = useDeliveryOptionSelection({\n $data,\n $actions,\n mockOptions,\n });\n\n return (\n <ShippingSimulatorContext value={contextValue}>\n <DeliveryOptionsListBody\n {...props}\n className={className}\n options={options}\n selectedOptionId={selectedOptionId}\n selectionError={selectionError}\n onSelectOption={(optionId) => selectOption(optionId)}\n >\n {children}\n </DeliveryOptionsListBody>\n </ShippingSimulatorContext>\n );\n}\n"],"mappings":";;;;;;;;AA+FA,MAAa,gCAAgC,gBAA0C;CACrF,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;;;;;;;;;;;;;;;;;;CACA,eAAe;CACf,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE;CACtC,QAAQ;EAAE,OAAO;EAAoB,UAAU;CAAW;CAC1D,QAAQ,EACN,aAAa;EAAE,MAAM;EAAS,OAAO;CAAwE,EAC/G;CAKA,iBAAiB,CAAC,sBAAsB,2BAA2B;CACnE,WACE;AACJ,CAAC;;;;;;;;;;AA0BD,SAAgB,wBAAwB,EACtC,SACA,kBACA,gBACA,gBACA,WACA,UACA,GAAG,SAC4B;CAC/B,OACE,qBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,4BAAyB;EAA/D,UAAA,CACG,iBACC,oBAAC,OAAD;GAAK,MAAK;GAAQ,kCAA+B;GAC9C,UAAA;EACE,CAAA,IACH,MACH,QAAQ,SAAS,IAChB,oBAAC,YAAD;GAAY,OAAO,oBAAoB;GAAI,eAAe;GACvD,UAAA,QAAQ,KAAK,WACZ,oBAAC,mBAAD;IAAmC,OAAO;IACxC,UAAA,oBAAC,WAAD;KAAW,OAAO,OAAO;KAAK;IAAoB,CAAA;GACjC,GAFK,OAAO,EAEZ,CACpB;EACS,CAAA,IACV,IACD;;AAET;AAMA,SAAgB,oBAAoB,EAClC,OACA,UAAU,cACV,aACA,WACA,UACA,GAAG,SACwB;CAC3B,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,EAAE,SAAS,kBAAkB,gBAAgB,cAAc,iBAAiB,2BAA2B;EAC3G;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,0BAAD;EAA0B,OAAO;EAC/B,UAAA,oBAAC,yBAAD;GACE,GAAI;GACO;GACF;GACS;GACF;GAChB,iBAAiB,aAAa,aAAa,QAAQ;GAElD;EACsB,CAAA;CACD,CAAA;AAE9B"}
@@ -14,7 +14,7 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, use
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
15
  //#region src/matter/my-account-profile/my-account-profile.tsx
16
16
  /**
17
- * The `my-account-profile` compound (specs/sfs-3287-my-account-profile-root.md) — the data root
17
+ * The `my-account-profile` compound (see my-account-profile.md; spec archived at the specs-archive tag) — the data root
18
18
  * plus form mechanics for the shopper's persistent account profile. `Root` owns the saved profile,
19
19
  * the draft, the view↔edit toggle, and the single batched Save; it publishes a context whose
20
20
  * registration API is the seam every field Control attaches to.