@thorprovider/blocks 3.0.2 → 4.1.0

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 (234) hide show
  1. package/README.md +61 -21
  2. package/dist/blocks/designs/checkout-commerce-v1/block.d.ts +49 -0
  3. package/dist/blocks/designs/checkout-commerce-v1/block.d.ts.map +1 -0
  4. package/dist/blocks/designs/checkout-commerce-v1/block.js +2487 -0
  5. package/dist/blocks/designs/checkout-commerce-v1/block.js.map +1 -0
  6. package/dist/blocks/designs/checkout-commerce-v1/block.mjs +2467 -0
  7. package/dist/blocks/designs/checkout-commerce-v1/block.mjs.map +1 -0
  8. package/dist/blocks/designs/checkout-commerce-v1/data-context.d.ts +8 -0
  9. package/dist/blocks/designs/checkout-commerce-v1/data-context.d.ts.map +1 -0
  10. package/dist/blocks/designs/checkout-commerce-v1/data-context.js +44 -0
  11. package/dist/blocks/designs/checkout-commerce-v1/data-context.js.map +1 -0
  12. package/dist/blocks/designs/checkout-commerce-v1/data-context.mjs +19 -0
  13. package/dist/blocks/designs/checkout-commerce-v1/data-context.mjs.map +1 -0
  14. package/dist/blocks/designs/checkout-commerce-v1/index.d.ts +3 -0
  15. package/dist/blocks/designs/checkout-commerce-v1/index.d.ts.map +1 -0
  16. package/dist/blocks/designs/checkout-commerce-v1/index.js +36 -0
  17. package/dist/blocks/designs/checkout-commerce-v1/index.js.map +1 -0
  18. package/dist/blocks/designs/checkout-commerce-v1/index.mjs +6 -0
  19. package/dist/blocks/designs/checkout-commerce-v1/index.mjs.map +1 -0
  20. package/dist/blocks/designs/marketplace-product-card/block.d.ts +12 -0
  21. package/dist/blocks/designs/marketplace-product-card/block.d.ts.map +1 -0
  22. package/dist/blocks/designs/marketplace-product-card/block.js +243 -0
  23. package/dist/blocks/designs/marketplace-product-card/block.js.map +1 -0
  24. package/dist/blocks/designs/marketplace-product-card/block.mjs +233 -0
  25. package/dist/blocks/designs/marketplace-product-card/block.mjs.map +1 -0
  26. package/dist/blocks/designs/marketplace-product-card/index.d.ts +3 -0
  27. package/dist/blocks/designs/marketplace-product-card/index.d.ts.map +1 -0
  28. package/dist/blocks/designs/marketplace-product-card/index.js +36 -0
  29. package/dist/blocks/designs/marketplace-product-card/index.js.map +1 -0
  30. package/dist/blocks/designs/marketplace-product-card/index.mjs +6 -0
  31. package/dist/blocks/designs/marketplace-product-card/index.mjs.map +1 -0
  32. package/dist/blocks/designs/marketplace-product-card/normalize.d.ts +13 -0
  33. package/dist/blocks/designs/marketplace-product-card/normalize.d.ts.map +1 -0
  34. package/dist/blocks/designs/marketplace-product-card/normalize.js +36 -0
  35. package/dist/blocks/designs/marketplace-product-card/normalize.js.map +1 -0
  36. package/dist/blocks/designs/marketplace-product-card/normalize.mjs +12 -0
  37. package/dist/blocks/designs/marketplace-product-card/normalize.mjs.map +1 -0
  38. package/dist/blocks/designs/marketplace-product-card/variants.d.ts +72 -0
  39. package/dist/blocks/designs/marketplace-product-card/variants.d.ts.map +1 -0
  40. package/dist/blocks/designs/marketplace-product-card/variants.js +123 -0
  41. package/dist/blocks/designs/marketplace-product-card/variants.js.map +1 -0
  42. package/dist/blocks/designs/marketplace-product-card/variants.mjs +89 -0
  43. package/dist/blocks/designs/marketplace-product-card/variants.mjs.map +1 -0
  44. package/dist/blocks/e-commerce/account/account-frame.d.ts +38 -0
  45. package/dist/blocks/e-commerce/account/account-frame.d.ts.map +1 -0
  46. package/dist/blocks/e-commerce/account/account-frame.js +102 -0
  47. package/dist/blocks/e-commerce/account/account-frame.js.map +1 -0
  48. package/dist/blocks/e-commerce/account/account-frame.mjs +78 -0
  49. package/dist/blocks/e-commerce/account/account-frame.mjs.map +1 -0
  50. package/dist/blocks/e-commerce/account/address-book.d.ts +79 -0
  51. package/dist/blocks/e-commerce/account/address-book.d.ts.map +1 -0
  52. package/dist/blocks/e-commerce/account/address-book.js +250 -0
  53. package/dist/blocks/e-commerce/account/address-book.js.map +1 -0
  54. package/dist/blocks/e-commerce/account/address-book.mjs +225 -0
  55. package/dist/blocks/e-commerce/account/address-book.mjs.map +1 -0
  56. package/dist/blocks/e-commerce/account/profile-form.d.ts +35 -0
  57. package/dist/blocks/e-commerce/account/profile-form.d.ts.map +1 -0
  58. package/dist/blocks/e-commerce/account/profile-form.js +100 -0
  59. package/dist/blocks/e-commerce/account/profile-form.js.map +1 -0
  60. package/dist/blocks/e-commerce/account/profile-form.mjs +76 -0
  61. package/dist/blocks/e-commerce/account/profile-form.mjs.map +1 -0
  62. package/dist/blocks/e-commerce/checkout-forms/checkbox-check.js +1 -1
  63. package/dist/blocks/e-commerce/checkout-forms/checkbox-check.js.map +1 -1
  64. package/dist/blocks/e-commerce/checkout-forms/checkbox-check.mjs +1 -1
  65. package/dist/blocks/e-commerce/checkout-forms/checkbox-check.mjs.map +1 -1
  66. package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.d.ts +11 -0
  67. package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.d.ts.map +1 -0
  68. package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.js +46 -0
  69. package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.js.map +1 -0
  70. package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.mjs +22 -0
  71. package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.mjs.map +1 -0
  72. package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.d.ts +28 -0
  73. package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.d.ts.map +1 -0
  74. package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.js +278 -0
  75. package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.js.map +1 -0
  76. package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.mjs +260 -0
  77. package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.mjs.map +1 -0
  78. package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.d.ts +12 -9
  79. package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.d.ts.map +1 -1
  80. package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.js +49 -71
  81. package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.js.map +1 -1
  82. package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.mjs +50 -72
  83. package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.mjs.map +1 -1
  84. package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.d.ts.map +1 -1
  85. package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.js +6 -3
  86. package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.js.map +1 -1
  87. package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.mjs +6 -3
  88. package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.mjs.map +1 -1
  89. package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.d.ts +7 -0
  90. package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.d.ts.map +1 -0
  91. package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.js +41 -0
  92. package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.js.map +1 -0
  93. package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.mjs +16 -0
  94. package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.mjs.map +1 -0
  95. package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.d.ts +24 -0
  96. package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.d.ts.map +1 -0
  97. package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.js +75 -0
  98. package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.js.map +1 -0
  99. package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.mjs +58 -0
  100. package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.mjs.map +1 -0
  101. package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.d.ts +3 -2
  102. package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.d.ts.map +1 -1
  103. package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.js +9 -2
  104. package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.js.map +1 -1
  105. package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.mjs +9 -2
  106. package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.mjs.map +1 -1
  107. package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.d.ts +23 -8
  108. package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.d.ts.map +1 -1
  109. package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.js +136 -31
  110. package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.js.map +1 -1
  111. package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.mjs +143 -32
  112. package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.mjs.map +1 -1
  113. package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.d.ts +13 -7
  114. package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.d.ts.map +1 -1
  115. package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.js +179 -28
  116. package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.js.map +1 -1
  117. package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.mjs +180 -29
  118. package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.mjs.map +1 -1
  119. package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.d.ts +20 -0
  120. package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.d.ts.map +1 -0
  121. package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.js +199 -0
  122. package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.js.map +1 -0
  123. package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.mjs +175 -0
  124. package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.mjs.map +1 -0
  125. package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.d.ts +14 -0
  126. package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.d.ts.map +1 -0
  127. package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.js +136 -0
  128. package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.js.map +1 -0
  129. package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.mjs +109 -0
  130. package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.mjs.map +1 -0
  131. package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.d.ts +32 -10
  132. package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.d.ts.map +1 -1
  133. package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.js +265 -147
  134. package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.js.map +1 -1
  135. package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.mjs +272 -148
  136. package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.mjs.map +1 -1
  137. package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.d.ts +13 -0
  138. package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.d.ts.map +1 -0
  139. package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.js +74 -0
  140. package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.js.map +1 -0
  141. package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.mjs +50 -0
  142. package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.mjs.map +1 -0
  143. package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.d.ts +7 -0
  144. package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.d.ts.map +1 -0
  145. package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.js +91 -0
  146. package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.js.map +1 -0
  147. package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.mjs +65 -0
  148. package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.mjs.map +1 -0
  149. package/dist/blocks/e-commerce/checkout-forms/checkout.d.ts +174 -44
  150. package/dist/blocks/e-commerce/checkout-forms/checkout.d.ts.map +1 -1
  151. package/dist/blocks/e-commerce/checkout-forms/checkout.js +532 -108
  152. package/dist/blocks/e-commerce/checkout-forms/checkout.js.map +1 -1
  153. package/dist/blocks/e-commerce/checkout-forms/checkout.mjs +542 -109
  154. package/dist/blocks/e-commerce/checkout-forms/checkout.mjs.map +1 -1
  155. package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.d.ts.map +1 -1
  156. package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.js +44 -20
  157. package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.js.map +1 -1
  158. package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.mjs +44 -20
  159. package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.mjs.map +1 -1
  160. package/dist/blocks/e-commerce/navigation/storefront-navbar.d.ts.map +1 -1
  161. package/dist/blocks/e-commerce/navigation/storefront-navbar.js +21 -10
  162. package/dist/blocks/e-commerce/navigation/storefront-navbar.js.map +1 -1
  163. package/dist/blocks/e-commerce/navigation/storefront-navbar.mjs +21 -10
  164. package/dist/blocks/e-commerce/navigation/storefront-navbar.mjs.map +1 -1
  165. package/dist/blocks/e-commerce/product-list/product-card.d.ts.map +1 -1
  166. package/dist/blocks/e-commerce/product-list/product-card.js +36 -9
  167. package/dist/blocks/e-commerce/product-list/product-card.js.map +1 -1
  168. package/dist/blocks/e-commerce/product-list/product-card.mjs +36 -9
  169. package/dist/blocks/e-commerce/product-list/product-card.mjs.map +1 -1
  170. package/dist/blocks/e-commerce/product-list/product-showcase-1.d.ts.map +1 -1
  171. package/dist/blocks/e-commerce/product-list/product-showcase-1.js +7 -2
  172. package/dist/blocks/e-commerce/product-list/product-showcase-1.js.map +1 -1
  173. package/dist/blocks/e-commerce/product-list/product-showcase-1.mjs +7 -2
  174. package/dist/blocks/e-commerce/product-list/product-showcase-1.mjs.map +1 -1
  175. package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.d.ts.map +1 -1
  176. package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.js +5 -1
  177. package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.js.map +1 -1
  178. package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.mjs +5 -1
  179. package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.mjs.map +1 -1
  180. package/dist/blocks/e-commerce/storefront-hero/storefront-hero.d.ts.map +1 -1
  181. package/dist/blocks/e-commerce/storefront-hero/storefront-hero.js +71 -51
  182. package/dist/blocks/e-commerce/storefront-hero/storefront-hero.js.map +1 -1
  183. package/dist/blocks/e-commerce/storefront-hero/storefront-hero.mjs +71 -51
  184. package/dist/blocks/e-commerce/storefront-hero/storefront-hero.mjs.map +1 -1
  185. package/dist/blocks/marketing/banners/banner-1.d.ts.map +1 -1
  186. package/dist/blocks/marketing/banners/banner-1.js +15 -27
  187. package/dist/blocks/marketing/banners/banner-1.js.map +1 -1
  188. package/dist/blocks/marketing/banners/banner-1.mjs +16 -28
  189. package/dist/blocks/marketing/banners/banner-1.mjs.map +1 -1
  190. package/dist/index.d.ts +16 -4
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js +19 -0
  193. package/dist/index.js.map +1 -1
  194. package/dist/index.mjs +13 -0
  195. package/dist/index.mjs.map +1 -1
  196. package/dist/lib/contracts/checkout-commerce-v1.d.ts +2350 -0
  197. package/dist/lib/contracts/checkout-commerce-v1.d.ts.map +1 -0
  198. package/dist/lib/contracts/checkout-commerce-v1.js +417 -0
  199. package/dist/lib/contracts/checkout-commerce-v1.js.map +1 -0
  200. package/dist/lib/contracts/checkout-commerce-v1.mjs +392 -0
  201. package/dist/lib/contracts/checkout-commerce-v1.mjs.map +1 -0
  202. package/dist/lib/contracts/marketplace-product-card.d.ts +324 -0
  203. package/dist/lib/contracts/marketplace-product-card.d.ts.map +1 -0
  204. package/dist/lib/contracts/marketplace-product-card.js +85 -0
  205. package/dist/lib/contracts/marketplace-product-card.js.map +1 -0
  206. package/dist/lib/contracts/marketplace-product-card.mjs +61 -0
  207. package/dist/lib/contracts/marketplace-product-card.mjs.map +1 -0
  208. package/dist/lib/contracts.d.ts +2289 -178
  209. package/dist/lib/contracts.d.ts.map +1 -1
  210. package/dist/lib/contracts.js +332 -25
  211. package/dist/lib/contracts.js.map +1 -1
  212. package/dist/lib/contracts.mjs +278 -5
  213. package/dist/lib/contracts.mjs.map +1 -1
  214. package/dist/lib/money-schema.d.ts +19 -0
  215. package/dist/lib/money-schema.d.ts.map +1 -0
  216. package/dist/lib/money-schema.js +33 -0
  217. package/dist/lib/money-schema.js.map +1 -0
  218. package/dist/lib/money-schema.mjs +9 -0
  219. package/dist/lib/money-schema.mjs.map +1 -0
  220. package/dist/lib/motion.d.ts +29 -0
  221. package/dist/lib/motion.d.ts.map +1 -0
  222. package/dist/lib/motion.js +65 -0
  223. package/dist/lib/motion.js.map +1 -0
  224. package/dist/lib/motion.mjs +41 -0
  225. package/dist/lib/motion.mjs.map +1 -0
  226. package/dist/ui/accordion.d.ts +3 -1
  227. package/dist/ui/accordion.d.ts.map +1 -1
  228. package/dist/ui/accordion.js +21 -5
  229. package/dist/ui/accordion.js.map +1 -1
  230. package/dist/ui/accordion.mjs +21 -5
  231. package/dist/ui/accordion.mjs.map +1 -1
  232. package/dist/ui/input-group.d.ts +1 -1
  233. package/package.json +18 -3
  234. package/dist/.tsbuildinfo +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/blocks/e-commerce/checkout-forms/checkout.tsx"],"sourcesContent":["'use client'\n\nimport { useEffect, useRef, useState } from 'react'\nimport { Lock } from 'lucide-react'\nimport { Button } from '../../../ui/button'\nimport { Card, CardContent } from '../../../ui/card'\nimport { cn } from '../../../lib/utils'\nimport { CheckoutContactStep } from './checkout-contact-step'\nimport { CheckoutShippingStep } from './checkout-shipping-step'\nimport { CheckoutPaymentStep } from './checkout-payment-step'\nimport { CheckoutReviewStep } from './checkout-review-step'\nimport { CheckoutOrderSummaryPanel } from './checkout-order-summary'\nimport { CheckoutProgress } from './checkout-progress'\nimport type { Money, PaymentMethod } from '@thorprovider/types'\nimport type { CheckoutFieldErrors as GenericCheckoutFieldErrors } from './checkout-form-types'\n\n/**\n * The canonical checkout is a page-level unit. The host owns the commercial\n * state (values, selections, totals, submission); the block owns only the\n * ephemeral step index of the `stepper` presentation.\n */\nexport type CheckoutPresentation = 'single-page' | 'stepper'\n\nexport type CheckoutStepId = 'contact' | 'shipping' | 'payment' | 'review'\n\n/** Flat, controlled form values. No card data: payment entry belongs to the host provider surface. */\nexport interface CheckoutValues {\n email: string\n firstName: string\n lastName: string\n phone: string\n address: string\n city: string\n state: string\n zipCode: string\n country: string\n paymentMethod: string\n saveInfo: boolean\n newsletter: boolean\n promoCode: string\n}\n\nexport type CheckoutValuesFieldErrors = GenericCheckoutFieldErrors<keyof CheckoutValues>\n\nexport type CheckoutFieldDescriptions = Partial<Record<keyof CheckoutValues, string>>\n\nexport interface CheckoutOrderLine {\n /** Backend line identity — the stable React key. */\n id: string | number\n name: string\n variant?: string\n quantity: number\n /** Backend-authoritative line total; rendered verbatim. */\n lineTotal?: Money\n /** Optional unit price shown as secondary text; never multiplied. */\n unitPrice?: Money\n /** Optional; an absent image is omitted rather than serialized as `\"\"`. */\n image?: string\n}\n\nexport interface CheckoutTotals {\n subtotal: Money\n discount?: Money\n tax?: Money\n shipping?: Money\n total: Money\n}\n\nexport interface CheckoutOrderSummary {\n items: CheckoutOrderLine[]\n /** Backend-authoritative totals; rendered verbatim. */\n totals?: CheckoutTotals\n}\n\nexport type CheckoutTotalsState = 'idle' | 'pending' | 'error'\n\nexport interface CheckoutCountryOption {\n value: string\n label: string\n}\n\nexport interface CheckoutShippingOption {\n /** Backend shipping method id — the controlled selection identity. */\n id: string\n name: string\n price?: Money\n description?: string\n estimatedDays?: string\n}\n\nexport type CheckoutChangeHandler = (field: keyof CheckoutValues, value: string | boolean) => void\n\n/**\n * Every user-facing string is overridable. Neutral English defaults ship with\n * the block; the host supplies its own copy through this object.\n */\nexport interface CheckoutLabels {\n title: string\n description: string\n orderSummaryTitle: string\n stepProgressLabel: string\n contactStepName: string\n shippingStepName: string\n paymentStepName: string\n reviewStepName: string\n contactHeading: string\n contactDescription: string\n shippingHeading: string\n shippingDescription: string\n paymentHeading: string\n paymentDescription: string\n reviewHeading: string\n reviewDescription: string\n emailLabel: string\n firstNameLabel: string\n lastNameLabel: string\n phoneLabel: string\n addressLabel: string\n cityLabel: string\n stateLabel: string\n zipCodeLabel: string\n countryLabel: string\n countryPlaceholder: string\n shippingMethodLegend: string\n paymentMethodLegend: string\n noPaymentMethodsLabel: string\n unavailableMethodLabel: string\n requiresSetupLabel: string\n saveInfoLabel: string\n newsletterLabel: string\n promoCodeLabel: string\n promoPlaceholder: string\n promoApplyLabel: string\n subtotalLabel: string\n discountLabel: string\n taxLabel: string\n shippingLabel: string\n totalLabel: string\n eachLabel: string\n totalsPendingLabel: string\n totalsErrorLabel: string\n totalsUnavailableLabel: string\n amountUnavailableLabel: string\n retryLabel: string\n reviewContactLabel: string\n reviewShipToLabel: string\n reviewPaymentLabel: string\n reviewShippingLabel: string\n reviewEmptyLabel: string\n backLabel: string\n continueLabel: string\n completeOrderLabel: string\n processingLabel: string\n submitErrorActionLabel: string\n}\n\nconst DEFAULT_LABELS: CheckoutLabels = {\n title: 'Checkout',\n description: '',\n orderSummaryTitle: 'Order summary',\n stepProgressLabel: 'Checkout progress',\n contactStepName: 'Contact',\n shippingStepName: 'Shipping',\n paymentStepName: 'Payment',\n reviewStepName: 'Review',\n contactHeading: 'Contact information',\n contactDescription: 'We use these details to keep you informed about your order.',\n shippingHeading: 'Shipping address',\n shippingDescription: 'Tell us where the order should be delivered.',\n paymentHeading: 'Payment',\n paymentDescription: 'Choose how you want to pay for this order.',\n reviewHeading: 'Review your order',\n reviewDescription: 'Check the details below before placing the order.',\n emailLabel: 'Email',\n firstNameLabel: 'First name',\n lastNameLabel: 'Last name',\n phoneLabel: 'Phone (optional)',\n addressLabel: 'Street address',\n cityLabel: 'City',\n stateLabel: 'State / Province',\n zipCodeLabel: 'ZIP / Postal code',\n countryLabel: 'Country',\n countryPlaceholder: 'Select a country',\n shippingMethodLegend: 'Shipping method',\n paymentMethodLegend: 'Payment method',\n noPaymentMethodsLabel: 'No payment methods are available for this region.',\n unavailableMethodLabel: 'Unavailable',\n requiresSetupLabel: 'Requires additional setup',\n saveInfoLabel: 'Save this information for next time',\n newsletterLabel: 'Email me about news and offers',\n promoCodeLabel: 'Promotional code',\n promoPlaceholder: 'Enter the code',\n promoApplyLabel: 'Apply',\n subtotalLabel: 'Subtotal',\n discountLabel: 'Discount',\n taxLabel: 'Tax',\n shippingLabel: 'Shipping',\n totalLabel: 'Total',\n eachLabel: 'each',\n totalsPendingLabel: 'Updating totals…',\n totalsErrorLabel: 'We could not update the order totals.',\n totalsUnavailableLabel: 'Totals are unavailable.',\n amountUnavailableLabel: '—',\n retryLabel: 'Retry',\n reviewContactLabel: 'Contact',\n reviewShipToLabel: 'Ship to',\n reviewPaymentLabel: 'Payment',\n reviewShippingLabel: 'Shipping method',\n reviewEmptyLabel: 'No details provided yet.',\n backLabel: 'Back',\n continueLabel: 'Continue',\n completeOrderLabel: 'Place order',\n processingLabel: 'Placing order…',\n submitErrorActionLabel: 'Try again',\n}\n\nconst BASE_STEPS: CheckoutStepId[] = ['contact', 'shipping', 'payment']\n\nconst STEP_COPY: Record<\n CheckoutStepId,\n { name: keyof CheckoutLabels; heading: keyof CheckoutLabels; description: keyof CheckoutLabels }\n> = {\n contact: {\n name: 'contactStepName',\n heading: 'contactHeading',\n description: 'contactDescription',\n },\n shipping: {\n name: 'shippingStepName',\n heading: 'shippingHeading',\n description: 'shippingDescription',\n },\n payment: {\n name: 'paymentStepName',\n heading: 'paymentHeading',\n description: 'paymentDescription',\n },\n review: {\n name: 'reviewStepName',\n heading: 'reviewHeading',\n description: 'reviewDescription',\n },\n}\n\nexport interface CheckoutProps {\n presentation: CheckoutPresentation\n /** Appends a confirmation step (`stepper`) or section (`single-page`) before submission. */\n showReviewStep?: boolean\n values: CheckoutValues\n onChange: CheckoutChangeHandler\n orderSummary?: CheckoutOrderSummary\n totalsState?: CheckoutTotalsState\n onRetryTotals?: () => void\n countries?: CheckoutCountryOption[]\n shippingOptions?: CheckoutShippingOption[]\n selectedShippingOptionId?: string\n onSelectShippingOption?: (id: string) => void\n paymentMethods?: PaymentMethod[]\n onApplyPromo?: (code: string) => void\n promoPending?: boolean\n /** Optional trust copy; rendered only when supplied. */\n trustNotes?: string[]\n labels?: Partial<CheckoutLabels>\n /** Override money formatting (locale, currency). Defaults to `Money.currencyCode`. */\n formatMoney?: (money: Money) => string\n fieldErrors?: CheckoutValuesFieldErrors\n fieldDescriptions?: CheckoutFieldDescriptions\n /** Consulted before advancing and for every applicable step before submitting. */\n validateStep?: (step: CheckoutStepId) => boolean\n /** Notification only — never an authoritative controlled value. */\n onStepChange?: (step: CheckoutStepId) => void\n onSubmit?: (values: CheckoutValues) => void\n submitting?: boolean\n submitError?: string\n onRetrySubmit?: () => void\n}\n\nexport function Checkout({\n presentation,\n showReviewStep = false,\n values,\n onChange,\n orderSummary,\n totalsState = 'idle',\n onRetryTotals,\n countries,\n shippingOptions,\n selectedShippingOptionId,\n onSelectShippingOption,\n paymentMethods = [],\n onApplyPromo,\n promoPending = false,\n trustNotes,\n labels,\n formatMoney,\n fieldErrors,\n fieldDescriptions,\n validateStep,\n onStepChange,\n onSubmit,\n submitting = false,\n submitError,\n onRetrySubmit,\n}: CheckoutProps) {\n const resolved: CheckoutLabels = { ...DEFAULT_LABELS, ...labels }\n const steps = showReviewStep ? [...BASE_STEPS, 'review' as const] : BASE_STEPS\n const [stepIndex, setStepIndex] = useState(0)\n const activeStep = steps[Math.min(stepIndex, steps.length - 1)]\n\n const headingRef = useRef<HTMLHeadingElement>(null)\n const hasMounted = useRef(false)\n\n useEffect(() => {\n if (presentation !== 'stepper') return\n if (!hasMounted.current) {\n hasMounted.current = true\n return\n }\n headingRef.current?.focus()\n }, [presentation, activeStep])\n\n const moveTo = (nextIndex: number) => {\n const next = steps[nextIndex]\n if (!next) return\n setStepIndex(nextIndex)\n onStepChange?.(next)\n }\n\n const handleContinue = () => {\n if (validateStep && !validateStep(activeStep)) return\n moveTo(stepIndex + 1)\n }\n\n const handleBack = () => {\n if (stepIndex === 0) return\n moveTo(stepIndex - 1)\n }\n\n const handleSubmit = () => {\n if (submitting) return\n if (validateStep && !steps.every((step) => validateStep(step))) return\n onSubmit?.(values)\n }\n\n const renderStep = (step: CheckoutStepId) => {\n switch (step) {\n case 'contact':\n return (\n <CheckoutContactStep\n values={values}\n onChange={onChange}\n labels={resolved}\n showSaveInfo={labels?.saveInfoLabel !== undefined}\n showNewsletter={labels?.newsletterLabel !== undefined}\n fieldErrors={fieldErrors}\n fieldDescriptions={fieldDescriptions}\n />\n )\n case 'shipping':\n return (\n <CheckoutShippingStep\n values={values}\n onChange={onChange}\n labels={resolved}\n countries={countries}\n shippingOptions={shippingOptions}\n selectedShippingOptionId={selectedShippingOptionId}\n onSelectShippingOption={onSelectShippingOption}\n formatMoney={formatMoney}\n fieldErrors={fieldErrors}\n fieldDescriptions={fieldDescriptions}\n />\n )\n case 'payment':\n return (\n <CheckoutPaymentStep\n values={values}\n onChange={onChange}\n labels={resolved}\n paymentMethods={paymentMethods}\n fieldErrors={fieldErrors}\n fieldDescriptions={fieldDescriptions}\n />\n )\n case 'review':\n return (\n <CheckoutReviewStep\n values={values}\n labels={resolved}\n selectedShippingOptionId={selectedShippingOptionId}\n shippingOptions={shippingOptions}\n paymentMethods={paymentMethods}\n />\n )\n }\n }\n\n const isLastStep = stepIndex === steps.length - 1\n\n const submitAction = (\n <Button type=\"button\" onClick={handleSubmit} disabled={submitting}>\n <Lock className=\"size-4\" />\n {submitting ? resolved.processingLabel : resolved.completeOrderLabel}\n </Button>\n )\n\n const submitErrorNode = submitError ? (\n <div\n role=\"alert\"\n className=\"mt-6 flex flex-wrap items-center justify-between gap-3 rounded-md border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive\"\n >\n <span>{submitError}</span>\n {onRetrySubmit ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onRetrySubmit}\n disabled={submitting}\n >\n {resolved.submitErrorActionLabel}\n </Button>\n ) : null}\n </div>\n ) : null\n\n const summaryNode = orderSummary ? (\n <div\n className={cn(\n 'min-w-0 lg:col-span-1',\n presentation === 'single-page' && 'lg:order-last',\n )}\n >\n <CheckoutOrderSummaryPanel\n summary={orderSummary}\n labels={resolved}\n totalsState={totalsState}\n onRetryTotals={onRetryTotals}\n promoCode={values.promoCode}\n onPromoCodeChange={(value) => onChange('promoCode', value)}\n onApplyPromo={onApplyPromo}\n promoPending={promoPending}\n trustNotes={trustNotes}\n formatMoney={formatMoney}\n />\n </div>\n ) : null\n\n return (\n <div className=\"mx-auto max-w-6xl px-4 py-12 sm:px-6 lg:px-8\">\n {(resolved.title || resolved.description) && (\n <header className=\"mb-8 text-center\">\n {resolved.title ? (\n <h1 className=\"text-3xl font-bold tracking-tight sm:text-4xl\">{resolved.title}</h1>\n ) : null}\n {resolved.description ? (\n <p className=\"mt-2 text-muted-foreground\">{resolved.description}</p>\n ) : null}\n </header>\n )}\n\n {presentation === 'stepper' ? (\n <CheckoutProgress\n steps={steps.map((step) => ({\n id: step,\n label: resolved[STEP_COPY[step].name],\n }))}\n currentStep={activeStep}\n ariaLabel={resolved.stepProgressLabel}\n />\n ) : null}\n\n <div className={cn('mt-8 grid grid-cols-1 gap-6', orderSummary && 'lg:grid-cols-3')}>\n {presentation === 'single-page' ? summaryNode : null}\n\n <div className={cn('min-w-0', orderSummary ? 'lg:col-span-2' : 'lg:col-span-3')}>\n <Card>\n <CardContent className=\"p-6\">\n {presentation === 'stepper' ? (\n <>\n <div className=\"mb-6\">\n <h2 ref={headingRef} tabIndex={-1} className=\"text-lg font-semibold outline-none\">\n {resolved[STEP_COPY[activeStep].heading]}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {resolved[STEP_COPY[activeStep].description]}\n </p>\n </div>\n\n {renderStep(activeStep)}\n </>\n ) : (\n <div className=\"flex flex-col gap-8\">\n {steps.map((step) => (\n <section key={step} className=\"flex flex-col gap-4\">\n <div>\n <h2 className=\"text-lg font-semibold\">\n {resolved[STEP_COPY[step].heading]}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {resolved[STEP_COPY[step].description]}\n </p>\n </div>\n {renderStep(step)}\n </section>\n ))}\n </div>\n )}\n\n {submitErrorNode}\n\n <div\n className={cn(\n 'mt-6 flex flex-wrap items-center gap-4',\n presentation === 'stepper' ? 'justify-between' : 'justify-end',\n )}\n >\n {presentation === 'stepper' ? (\n <>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleBack}\n disabled={stepIndex === 0 || submitting}\n >\n {resolved.backLabel}\n </Button>\n {isLastStep ? (\n submitAction\n ) : (\n <Button type=\"button\" onClick={handleContinue} disabled={submitting}>\n {resolved.continueLabel}\n </Button>\n )}\n </>\n ) : (\n submitAction\n )}\n </div>\n </CardContent>\n </Card>\n </div>\n\n {presentation === 'stepper' ? summaryNode : null}\n </div>\n </div>\n )\n}\n\nexport default Checkout\n"],"mappings":";AA4VU,SAmIM,UAnIN,KAoDN,YApDM;AA1VV,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,MAAM,mBAAmB;AAClC,SAAS,UAAU;AACnB,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,iCAAiC;AAC1C,SAAS,wBAAwB;AAgJjC,MAAM,iBAAiC;AAAA,EACrC,OAAO;AAAA,EACP,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB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C1C,mBAAS,UAAU,UAAU,EAAE,OAAO,GACzC;AAAA,YACA,oBAAC,OAAE,WAAU,iCACV,mBAAS,UAAU,UAAU,EAAE,WAAW,GAC7C;AAAA,aACF;AAAA,UAEC,WAAW,UAAU;AAAA,WACxB,IAEA,oBAAC,SAAI,WAAU,uBACZ,gBAAM,IAAI,CAAC,SACV,qBAAC,aAAmB,WAAU,uBAC5B;AAAA,+BAAC,SACC;AAAA,gCAAC,QAAG,WAAU,yBACX,mBAAS,UAAU,IAAI,EAAE,OAAO,GACnC;AAAA,YACA,oBAAC,OAAE,WAAU,iCACV,mBAAS,UAAU,IAAI,EAAE,WAAW,GACvC;AAAA,aACF;AAAA,UACC,WAAW,IAAI;AAAA,aATJ,IAUd,CACD,GACH;AAAA,QAGD;AAAA,QAED;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,iBAAiB,YAAY,oBAAoB;AAAA,YACnD;AAAA,YAEC,2BAAiB,YAChB,iCACE;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAQ;AAAA,kBACR,SAAS;AAAA,kBACT,UAAU,cAAc,KAAK;AAAA,kBAE5B,mBAAS;AAAA;AAAA,cACZ;AAAA,cACC,aACC,eAEA,oBAAC,UAAO,MAAK,UAAS,SAAS,gBAAgB,UAAU,YACtD,mBAAS,eACZ;AAAA,eAEJ,IAEA;AAAA;AAAA,QAEJ;AAAA,SACF,GACF,GACF;AAAA,MAEC,iBAAiB,YAAY,cAAc;AAAA,OAC9C;AAAA,KACF;AAEJ;AAEA,IAAO,mBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/blocks/e-commerce/checkout-forms/checkout.tsx"],"sourcesContent":["'use client'\n\nimport { useEffect, useId, useRef, useState } from 'react'\nimport { Lock } from 'lucide-react'\nimport { Button } from '../../../ui/button'\nimport { Card, CardContent } from '../../../ui/card'\nimport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from '../../../ui/accordion'\nimport { cn } from '../../../lib/utils'\nimport { CheckoutContactStep } from './checkout-contact-step'\nimport { CheckoutShippingStep } from './checkout-shipping-step'\nimport { CheckoutPaymentStep } from './checkout-payment-step'\nimport { CheckoutReviewStep } from './checkout-review-step'\nimport { CheckoutOrderSummaryPanel } from './checkout-order-summary'\nimport { CheckoutProgress } from './checkout-progress'\nimport {\n CheckoutSectionNav,\n checkoutSectionHeadingId,\n checkoutSectionId,\n} from './checkout-section-nav'\nimport { CheckoutStepHeader } from './checkout-step-header'\nimport { stepErrorMessage, stepHasErrors, stepSummary } from './checkout-step-summary'\nimport { CheckoutIdProvider } from './checkout-id-context'\nimport type {\n CheckoutAddressLevel,\n CheckoutAddressOption,\n CheckoutAddressValues,\n CheckoutAdjustmentPayment,\n CheckoutContactValues,\n CheckoutCustomerIdentity,\n CheckoutInterruption,\n CheckoutInterruptionAction,\n CheckoutLocationOptions,\n CheckoutReadState,\n CheckoutSavedAddress,\n CheckoutShippingGroup,\n CheckoutShippingGroupItem,\n CheckoutShippingOption,\n CheckoutSubmission,\n Money,\n PaymentMethod,\n} from '@thorprovider/types'\nimport type { CheckoutFieldError } from './checkout-form-types'\n\nexport type {\n CheckoutAddressLevel,\n CheckoutAddressOption,\n CheckoutAddressValues,\n CheckoutAdjustmentPayment,\n CheckoutContactValues,\n CheckoutCustomerIdentity,\n CheckoutInterruption,\n CheckoutInterruptionAction,\n CheckoutLocationOptions,\n CheckoutReadState,\n CheckoutSavedAddress,\n CheckoutShippingGroup,\n CheckoutShippingGroupItem,\n CheckoutShippingOption,\n CheckoutSubmission,\n CheckoutInterruptionKind,\n} from '@thorprovider/types'\n\n/**\n * The canonical checkout is a page-level unit. The host owns the commercial\n * state (values, selections, totals, submission); the block owns only the\n * active step id of the `stepper` presentation and local input strings.\n */\nexport type CheckoutPresentation = 'single-page' | 'accordion' | 'stepper'\n\nexport type CheckoutStepId = 'contact' | 'shipping' | 'payment' | 'review'\n\n/** Backward-compatible alias for consumers that already use this name. */\nexport type CheckoutCountryOption = CheckoutAddressOption\n\nexport interface CheckoutOrderLine {\n /** Backend line identity — the stable React key. */\n id: string | number\n name: string\n variant?: string\n quantity: number\n /** Backend-authoritative line total; rendered verbatim. */\n lineTotal?: Money\n /** Optional unit price shown as secondary text; never multiplied. */\n unitPrice?: Money\n /** Optional; an absent image is omitted rather than serialized as `\"\"`. */\n image?: string\n}\n\nexport interface CheckoutTotals {\n subtotal: Money\n discount?: Money\n tax?: Money\n shipping?: Money\n total: Money\n}\n\nexport interface CheckoutOrderSummary {\n items: CheckoutOrderLine[]\n /** Backend-authoritative totals; rendered verbatim. */\n totals?: CheckoutTotals\n}\n\nexport type CheckoutTotalsState = 'idle' | 'pending' | 'error'\n\nexport type CheckoutContactChangeHandler = (\n field: keyof CheckoutContactValues,\n value: string,\n) => void\n\nexport type CheckoutAddressChangeHandler = (\n field: keyof CheckoutAddressValues,\n value: string,\n) => void\n\nexport interface CheckoutFieldErrors {\n contact?: Partial<Record<keyof CheckoutContactValues, CheckoutFieldError[]>>\n shippingAddress?: Partial<Record<keyof CheckoutAddressValues, CheckoutFieldError[]>>\n billingAddress?: Partial<Record<keyof CheckoutAddressValues, CheckoutFieldError[]>>\n paymentMethod?: CheckoutFieldError[]\n promoCode?: CheckoutFieldError[]\n}\n\nexport interface CheckoutFieldDescriptions {\n contact?: Partial<Record<keyof CheckoutContactValues, string>>\n shippingAddress?: Partial<Record<keyof CheckoutAddressValues, string>>\n billingAddress?: Partial<Record<keyof CheckoutAddressValues, string>>\n paymentMethod?: string\n}\n\nexport type CheckoutAvailabilityStatus = 'available' | 'empty' | 'unavailable' | 'error'\n\nexport interface CheckoutAvailability {\n status: CheckoutAvailabilityStatus\n reason?: string\n actionLabel?: string\n onAction?: () => void\n}\n\n/**\n * Every user-facing string is overridable. Neutral English defaults ship with\n * the block; the host supplies its own copy through this object.\n */\nexport interface CheckoutLabels {\n title: string\n description: string\n orderSummaryTitle: string\n stepProgressLabel: string\n contactStepName: string\n shippingStepName: string\n paymentStepName: string\n reviewStepName: string\n contactHeading: string\n contactDescription: string\n shippingHeading: string\n shippingDescription: string\n billingHeading: string\n billingDescription: string\n paymentHeading: string\n paymentDescription: string\n reviewHeading: string\n reviewDescription: string\n emailLabel: string\n firstNameLabel: string\n lastNameLabel: string\n phoneLabel: string\n companyLabel: string\n addressLabel: string\n address2Label: string\n cityLabel: string\n stateLabel: string\n zipCodeLabel: string\n countryLabel: string\n countryPlaceholder: string\n provincePlaceholder: string\n cityPlaceholder: string\n signedInAsLabel: string\n signOutLabel: string\n signInLabel: string\n accountRequiredHeading: string\n accountRequiredDescription: string\n signUpLabel: string\n identityPendingLabel: string\n optionalIndicatorLabel: string\n savedAddressesLabel: string\n defaultAddressLabel: string\n recipientHeading: string\n recipientDescription: string\n addressHeading: string\n addAddressLabel: string\n useAddressLabel: string\n deleteAddressLabel: string\n deleteAddressConfirmLabel: string\n deleteAddressHintLabel: string\n cancelAddressLabel: string\n updateSavedAddressLabel: string\n saveAsNewAddressLabel: string\n saveAddressLabel: string\n newAddressLabel: string\n savingAddressLabel: string\n deletingAddressLabel: string\n addressSaveErrorLabel: string\n addressDeleteErrorLabel: string\n addressSavedLabel: string\n addressDeletedLabel: string\n billingSameAsShippingLabel: string\n locationLoadingLabel: string\n locationErrorLabel: string\n locationUnavailableLabel: string\n locationOptionalLabel: string\n shippingMethodLegend: string\n noShippingOptionsLabel: string\n groupUnavailableLabel: string\n deliveryLoadingLabel: string\n deliveryErrorLabel: string\n deliveryUnavailableLabel: string\n paymentMethodLegend: string\n noPaymentMethodsLabel: string\n paymentLoadingLabel: string\n paymentErrorLabel: string\n paymentUnavailableLabel: string\n unavailableMethodLabel: string\n requiresSetupLabel: string\n giftCardLabel: string\n giftCardPlaceholder: string\n applyLabel: string\n removeLabel: string\n storeCreditLabel: string\n availableCreditLabel: string\n saveInfoLabel: string\n newsletterLabel: string\n promoCodeLabel: string\n promoPlaceholder: string\n promoApplyLabel: string\n subtotalLabel: string\n discountLabel: string\n taxLabel: string\n shippingLabel: string\n totalLabel: string\n eachLabel: string\n totalsPendingLabel: string\n totalsErrorLabel: string\n totalsUnavailableLabel: string\n amountUnavailableLabel: string\n retryLabel: string\n reviewContactLabel: string\n reviewShipToLabel: string\n reviewBillingLabel: string\n reviewPaymentLabel: string\n reviewShippingLabel: string\n reviewDeliveryGroupsLabel: string\n reviewGroupLabel: string\n reviewGroupItemsLabel: string\n reviewAdjustmentsLabel: string\n reviewSameAsShippingLabel: string\n reviewLinesLabel: string\n reviewEmptyLabel: string\n backLabel: string\n continueLabel: string\n validationAttentionLabel: string\n completeOrderLabel: string\n processingLabel: string\n submitErrorActionLabel: string\n interruptionAcknowledgeLabel: string\n interruptionRefreshLabel: string\n interruptionReturnToCartLabel: string\n interruptionRetryLabel: string\n availabilityEmptyLabel: string\n availabilityUnavailableLabel: string\n availabilityErrorLabel: string\n}\n\nconst DEFAULT_LABELS: CheckoutLabels = {\n title: 'Checkout',\n description: '',\n orderSummaryTitle: 'Order summary',\n stepProgressLabel: 'Checkout progress',\n contactStepName: 'Contact',\n shippingStepName: 'Shipping',\n paymentStepName: 'Payment',\n reviewStepName: 'Review',\n contactHeading: 'Contact information',\n contactDescription: 'We use these details to keep you informed about your order.',\n shippingHeading: 'Shipping address',\n shippingDescription: 'Tell us where the order should be delivered.',\n billingHeading: 'Billing address',\n billingDescription: 'Where should the invoice be addressed?',\n paymentHeading: 'Payment',\n paymentDescription: 'Choose how you want to pay for this order.',\n reviewHeading: 'Review your order',\n reviewDescription: 'Check the details below before placing the order.',\n emailLabel: 'Email',\n firstNameLabel: 'First name',\n lastNameLabel: 'Last name',\n phoneLabel: 'Phone',\n companyLabel: 'Company (optional)',\n addressLabel: 'Address line 1',\n address2Label: 'Address line 2 (optional)',\n cityLabel: 'City',\n stateLabel: 'State / Province',\n zipCodeLabel: 'ZIP / Postal code',\n countryLabel: 'Country',\n countryPlaceholder: 'Select a country',\n provincePlaceholder: 'Select a province or state',\n cityPlaceholder: 'Select a city',\n signedInAsLabel: 'Signed in as',\n signOutLabel: 'Sign out',\n signInLabel: 'Sign in',\n accountRequiredHeading: 'Sign in to continue',\n accountRequiredDescription: 'You need an account to complete this purchase.',\n signUpLabel: 'Create account',\n identityPendingLabel: 'Checking your account…',\n optionalIndicatorLabel: 'optional',\n savedAddressesLabel: 'Saved addresses',\n defaultAddressLabel: 'Default',\n recipientHeading: 'Recipient',\n recipientDescription: 'Who should receive this order? It can be someone else.',\n addressHeading: 'Address',\n addAddressLabel: 'Add address',\n useAddressLabel: 'Use',\n deleteAddressLabel: 'Delete',\n deleteAddressConfirmLabel: 'Delete this saved address?',\n deleteAddressHintLabel: 'The order will still ship to the current address.',\n cancelAddressLabel: 'Cancel',\n updateSavedAddressLabel: 'Update saved address',\n saveAsNewAddressLabel: 'Save as new address',\n saveAddressLabel: 'Save to my addresses',\n newAddressLabel: 'New address',\n savingAddressLabel: 'Saving address…',\n deletingAddressLabel: 'Deleting…',\n addressSaveErrorLabel: 'We could not save this address.',\n addressDeleteErrorLabel: 'We could not delete this address.',\n addressSavedLabel: 'Address saved.',\n addressDeletedLabel: 'Address deleted.',\n billingSameAsShippingLabel: 'Billing address same as shipping',\n locationLoadingLabel: 'Loading options…',\n locationErrorLabel: 'We could not load these options.',\n locationUnavailableLabel: 'No options are available.',\n locationOptionalLabel: 'Optional for this address.',\n shippingMethodLegend: 'Shipping method',\n noShippingOptionsLabel: 'No delivery options are available for this address.',\n groupUnavailableLabel: 'Unavailable for this address.',\n deliveryLoadingLabel: 'Loading delivery options…',\n deliveryErrorLabel: 'We could not load delivery options.',\n deliveryUnavailableLabel: 'Delivery is unavailable for this address.',\n paymentMethodLegend: 'Payment method',\n noPaymentMethodsLabel: 'No payment methods are available for this region.',\n paymentLoadingLabel: 'Loading payment methods…',\n paymentErrorLabel: 'We could not load payment methods.',\n paymentUnavailableLabel: 'Payment is unavailable for this region.',\n unavailableMethodLabel: 'Unavailable',\n requiresSetupLabel: 'Requires additional setup',\n giftCardLabel: 'Gift card',\n giftCardPlaceholder: 'Enter a gift card code',\n applyLabel: 'Apply',\n removeLabel: 'Remove',\n storeCreditLabel: 'Store credit',\n availableCreditLabel: 'Available credit',\n saveInfoLabel: 'Save this information for next time',\n newsletterLabel: 'Email me about news and offers',\n promoCodeLabel: 'Promotional code',\n promoPlaceholder: 'Enter the code',\n promoApplyLabel: 'Apply',\n subtotalLabel: 'Subtotal',\n discountLabel: 'Discount',\n taxLabel: 'Tax',\n shippingLabel: 'Shipping',\n totalLabel: 'Total',\n eachLabel: 'each',\n totalsPendingLabel: 'Updating totals…',\n totalsErrorLabel: 'We could not update the order totals.',\n totalsUnavailableLabel: 'Totals are unavailable.',\n amountUnavailableLabel: '—',\n retryLabel: 'Retry',\n reviewContactLabel: 'Contact',\n reviewShipToLabel: 'Ship to',\n reviewBillingLabel: 'Billing',\n reviewPaymentLabel: 'Payment',\n reviewShippingLabel: 'Delivery',\n reviewDeliveryGroupsLabel: 'Delivery groups',\n reviewGroupLabel: 'Group {n} of {total}',\n reviewGroupItemsLabel: 'Items',\n reviewAdjustmentsLabel: 'Adjustments',\n reviewSameAsShippingLabel: 'Same as shipping',\n reviewLinesLabel: 'Lines',\n reviewEmptyLabel: 'No details provided yet.',\n backLabel: 'Back',\n continueLabel: 'Continue',\n validationAttentionLabel: 'Please review the {step} section.',\n completeOrderLabel: 'Place order',\n processingLabel: 'Placing order…',\n submitErrorActionLabel: 'Try again',\n interruptionAcknowledgeLabel: 'Acknowledge and continue',\n interruptionRefreshLabel: 'Refresh',\n interruptionReturnToCartLabel: 'Return to cart',\n interruptionRetryLabel: 'Try again',\n availabilityEmptyLabel: 'Your cart is empty.',\n availabilityUnavailableLabel: 'Checkout is unavailable.',\n availabilityErrorLabel: 'We could not load checkout.',\n}\n\nconst STEP_COPY: Record<\n CheckoutStepId,\n { name: keyof CheckoutLabels; heading: keyof CheckoutLabels; description: keyof CheckoutLabels }\n> = {\n contact: {\n name: 'contactStepName',\n heading: 'contactHeading',\n description: 'contactDescription',\n },\n shipping: {\n name: 'shippingStepName',\n heading: 'shippingHeading',\n description: 'shippingDescription',\n },\n payment: {\n name: 'paymentStepName',\n heading: 'paymentHeading',\n description: 'paymentDescription',\n },\n review: {\n name: 'reviewStepName',\n heading: 'reviewHeading',\n description: 'reviewDescription',\n },\n}\n\n/**\n * Host-owned saved-address mutation state. The block renders pending, error,\n * and success feedback from this value; it never mutates the list itself.\n */\nexport interface CheckoutSavedAddressState {\n /** Entry being created (`create`), updated, or deleted. */\n pendingId?: string\n /** Error for a specific entry, or for the create/save row when `id` is omitted. */\n error?: { id?: string; message: string }\n /** Id of the entry that last changed successfully. */\n lastSavedId?: string\n /** Distinguishes saved and deleted live-region announcements. */\n lastAction?: 'saved' | 'deleted'\n}\n\nexport interface CheckoutProps {\n presentation: CheckoutPresentation\n /** Appends a review step (`stepper`) or section (`single-page`) before submission. */\n showReviewStep?: boolean\n /** Require an authenticated customer before showing checkout fields. */\n requireAccount?: boolean\n /** Whether authenticated shoppers see the contact step; defaults to `when-guest`. */\n contactStep?: 'when-guest' | 'always'\n /** Host intent to start account creation. */\n onSignUp?: () => void\n /** Marks the buyer's contact phone as required; validation remains host-owned. */\n requireContactPhone?: boolean\n /** Marks the shipping recipient phone as required; validation remains host-owned. */\n requireShippingPhone?: boolean\n contact: CheckoutContactValues\n onContactChange: CheckoutContactChangeHandler\n customer?: CheckoutCustomerIdentity | null\n onSignIn?: () => void\n onSignOut?: () => void\n savedAddresses?: CheckoutSavedAddress[]\n onSelectSavedAddress?: (id: string) => void\n onCreateSavedAddress?: (address: CheckoutAddressValues) => void\n onUpdateSavedAddress?: (id: string, address: CheckoutAddressValues) => void\n onDeleteSavedAddress?: (id: string) => void\n onStartNewAddress?: () => void\n onCancelNewAddress?: () => void\n savedAddressState?: CheckoutSavedAddressState\n shippingAddress: CheckoutAddressValues\n billingAddress?: CheckoutAddressValues\n sameAsShipping: boolean\n onShippingAddressChange: CheckoutAddressChangeHandler\n onBillingAddressChange?: CheckoutAddressChangeHandler\n onSameAsShippingChange: (same: boolean) => void\n shippingLocations?: CheckoutLocationOptions\n billingLocations?: CheckoutLocationOptions\n onRetryLocations?: (kind: 'shipping' | 'billing', level: CheckoutAddressLevel) => void\n shippingGroups?: CheckoutShippingGroup[]\n shippingState?: CheckoutReadState\n onSelectShippingOption?: (groupId: string, optionId: string) => void\n onRetryShipping?: () => void\n paymentMethods?: PaymentMethod[]\n paymentState?: CheckoutReadState\n paymentMethod: string\n onSelectPaymentMethod: (id: string) => void\n onRetryPayment?: () => void\n adjustmentPayments?: CheckoutAdjustmentPayment[]\n onApplyGiftCard?: (code: string) => void\n giftCardState?: 'idle' | 'pending' | 'valid' | 'invalid'\n giftCardMessage?: string\n onRemoveAdjustment?: (id: string) => void\n storeCredit?: {\n available: Money\n applied?: Money\n onApply?: () => void\n onRemove?: () => void\n }\n orderSummary?: CheckoutOrderSummary\n totalsState?: CheckoutTotalsState\n onRetryTotals?: () => void\n promoCode?: string\n onPromoCodeChange?: (value: string) => void\n onApplyPromo?: (code: string) => void\n promoPending?: boolean\n /** Optional trust copy; rendered only when supplied. */\n trustNotes?: string[]\n labels?: Partial<CheckoutLabels>\n /** Override money formatting (locale, currency). Defaults to `Money.currencyCode`. */\n formatMoney?: (money: Money) => string\n fieldErrors?: CheckoutFieldErrors\n fieldDescriptions?: CheckoutFieldDescriptions\n /** Consulted before advancing and for every applicable step before submitting. */\n validateStep?: (step: CheckoutStepId) => boolean\n /** Notification only — never an authoritative controlled value. */\n onStepChange?: (step: CheckoutStepId) => void\n availability?: CheckoutAvailability\n interruption?: CheckoutInterruption\n onInterruptionAction?: (action: CheckoutInterruptionAction) => void\n submitting?: boolean\n submitError?: string\n onRetrySubmit?: () => void\n onSubmit?: (snapshot: CheckoutSubmission) => void\n}\n\nfunction availabilityLabel(status: CheckoutAvailabilityStatus, labels: CheckoutLabels): string {\n if (status === 'empty') return labels.availabilityEmptyLabel\n if (status === 'error') return labels.availabilityErrorLabel\n return labels.availabilityUnavailableLabel\n}\n\nexport function Checkout({\n presentation,\n showReviewStep = false,\n requireAccount = false,\n contactStep = 'when-guest',\n onSignUp,\n requireContactPhone = false,\n requireShippingPhone = false,\n contact,\n onContactChange,\n customer,\n onSignIn,\n onSignOut,\n savedAddresses,\n onSelectSavedAddress,\n onCreateSavedAddress,\n onUpdateSavedAddress,\n onDeleteSavedAddress,\n onStartNewAddress,\n onCancelNewAddress,\n savedAddressState,\n shippingAddress,\n billingAddress,\n sameAsShipping,\n onShippingAddressChange,\n onBillingAddressChange,\n onSameAsShippingChange,\n shippingLocations,\n billingLocations,\n onRetryLocations,\n shippingGroups,\n shippingState = 'idle',\n onSelectShippingOption,\n onRetryShipping,\n paymentMethods = [],\n paymentState = 'idle',\n paymentMethod,\n onSelectPaymentMethod,\n onRetryPayment,\n adjustmentPayments,\n onApplyGiftCard,\n giftCardState,\n giftCardMessage,\n onRemoveAdjustment,\n storeCredit,\n orderSummary,\n totalsState = 'idle',\n onRetryTotals,\n promoCode,\n onPromoCodeChange,\n onApplyPromo,\n promoPending = false,\n trustNotes,\n labels,\n formatMoney,\n fieldErrors,\n fieldDescriptions,\n validateStep,\n onStepChange,\n availability,\n interruption,\n onInterruptionAction,\n submitting = false,\n submitError,\n onRetrySubmit,\n onSubmit,\n}: CheckoutProps) {\n const resolved: CheckoutLabels = { ...DEFAULT_LABELS, ...labels }\n const identityPending = requireAccount && customer === undefined\n const accountGate = requireAccount && customer === null\n const contactVisible = contactStep === 'always' || !customer\n const steps = [\n ...(contactVisible ? (['contact'] as const) : []),\n 'shipping',\n 'payment',\n ...(showReviewStep ? (['review'] as const) : []),\n ] satisfies CheckoutStepId[]\n const checkoutInstanceId = `checkout-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`\n const [activeStepState, setActiveStepState] = useState<CheckoutStepId>(steps[0]!)\n const activeStep = steps.includes(activeStepState) ? activeStepState : steps[0]!\n const stepIndex = steps.indexOf(activeStep)\n const [validationAlert, setValidationAlert] = useState<\n { step: CheckoutStepId; nonce: number } | undefined\n >()\n const validationAlertNonce = useRef(0)\n\n const headingRef = useRef<HTMLHeadingElement>(null)\n const hasMounted = useRef(false)\n\n useEffect(() => {\n if (activeStepState === activeStep) return\n setActiveStepState(activeStep)\n onStepChange?.(activeStep)\n }, [activeStep, activeStepState, onStepChange])\n\n useEffect(() => {\n if (presentation !== 'stepper' && presentation !== 'accordion') return\n if (!hasMounted.current) {\n hasMounted.current = true\n return\n }\n if (presentation === 'stepper') {\n headingRef.current?.focus()\n } else {\n document.getElementById(checkoutSectionHeadingId(checkoutInstanceId, activeStep))?.focus()\n }\n }, [presentation, activeStep, checkoutInstanceId])\n\n useEffect(() => {\n if (!validationAlert) return\n if (\n (presentation === 'stepper' || presentation === 'accordion') &&\n activeStep !== validationAlert.step\n ) {\n return\n }\n\n const heading = document.getElementById(\n checkoutSectionHeadingId(checkoutInstanceId, validationAlert.step),\n )\n const stepContainer = heading?.closest<HTMLElement>('[data-checkout-step]')\n const firstInvalid = stepContainer?.querySelector<HTMLElement>('[aria-invalid=\"true\"]')\n const target = firstInvalid ?? heading\n if (!target) return\n\n const prefersReducedMotion =\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false\n target.scrollIntoView?.({ behavior: prefersReducedMotion ? 'auto' : 'smooth', block: 'start' })\n target.focus({ preventScroll: true })\n }, [activeStep, checkoutInstanceId, presentation, validationAlert])\n\n const moveTo = (nextIndex: number) => {\n const next = steps[nextIndex]\n if (!next) return\n setActiveStepState(next)\n onStepChange?.(next)\n }\n\n const revealStep = (step: CheckoutStepId) => {\n validationAlertNonce.current += 1\n setValidationAlert({ step, nonce: validationAlertNonce.current })\n\n if (presentation === 'stepper' || presentation === 'accordion') {\n const nextIndex = steps.indexOf(step)\n if (nextIndex >= 0 && step !== activeStep) moveTo(nextIndex)\n }\n }\n\n const handleContinue = () => {\n if (validateStep && !validateStep(activeStep)) {\n revealStep(activeStep)\n return\n }\n moveTo(stepIndex + 1)\n }\n\n const handleBack = () => {\n if (stepIndex === 0) return\n moveTo(stepIndex - 1)\n }\n\n const blockedByInterruption = interruption?.severity === 'blocking'\n\n const handleSubmit = () => {\n if (submitting || blockedByInterruption) return\n if (validateStep) {\n const firstInvalidStep = steps.find((step) => !validateStep(step))\n if (firstInvalidStep) {\n revealStep(firstInvalidStep)\n return\n }\n }\n const snapshot: CheckoutSubmission = {\n contact,\n shippingAddress,\n billingAddress: sameAsShipping ? undefined : billingAddress,\n sameAsShipping,\n shippingSelections: (shippingGroups ?? []).flatMap((group) =>\n group.selectedOptionId\n ? [{ groupId: group.id, optionId: group.selectedOptionId }]\n : [],\n ),\n paymentMethod,\n adjustmentPayments: adjustmentPayments ?? [],\n promoCode: promoCode ?? '',\n }\n onSubmit?.(snapshot)\n }\n\n const renderStep = (step: CheckoutStepId) => {\n switch (step) {\n case 'contact':\n return (\n <CheckoutContactStep\n contact={contact}\n onChange={onContactChange}\n customer={customer}\n onSignIn={onSignIn}\n onSignOut={onSignOut}\n requirePhone={requireContactPhone}\n labels={resolved}\n fieldErrors={fieldErrors?.contact}\n fieldDescriptions={fieldDescriptions?.contact}\n />\n )\n case 'shipping':\n return (\n <CheckoutShippingStep\n shippingAddress={shippingAddress}\n billingAddress={billingAddress}\n sameAsShipping={sameAsShipping}\n onShippingAddressChange={onShippingAddressChange}\n onBillingAddressChange={onBillingAddressChange}\n onSameAsShippingChange={onSameAsShippingChange}\n shippingLocations={shippingLocations}\n billingLocations={billingLocations}\n onRetryLocations={onRetryLocations}\n savedAddresses={savedAddresses}\n onSelectSavedAddress={onSelectSavedAddress}\n onCreateSavedAddress={onCreateSavedAddress}\n onUpdateSavedAddress={onUpdateSavedAddress}\n onDeleteSavedAddress={onDeleteSavedAddress}\n onStartNewAddress={onStartNewAddress}\n onCancelNewAddress={onCancelNewAddress}\n savedAddressState={savedAddressState}\n shippingGroups={shippingGroups}\n shippingState={shippingState}\n onSelectShippingOption={onSelectShippingOption}\n onRetryShipping={onRetryShipping}\n labels={resolved}\n formatMoney={formatMoney}\n fieldErrors={fieldErrors}\n fieldDescriptions={fieldDescriptions}\n requireShippingPhone={requireShippingPhone}\n />\n )\n case 'payment':\n return (\n <CheckoutPaymentStep\n paymentMethods={paymentMethods}\n paymentState={paymentState}\n paymentMethod={paymentMethod}\n onSelectPaymentMethod={onSelectPaymentMethod}\n onRetryPayment={onRetryPayment}\n adjustmentPayments={adjustmentPayments}\n onApplyGiftCard={onApplyGiftCard}\n giftCardState={giftCardState}\n giftCardMessage={giftCardMessage}\n onRemoveAdjustment={onRemoveAdjustment}\n storeCredit={storeCredit}\n labels={resolved}\n formatMoney={formatMoney}\n fieldErrors={fieldErrors?.paymentMethod}\n description={fieldDescriptions?.paymentMethod}\n />\n )\n case 'review':\n return (\n <CheckoutReviewStep\n contact={contact}\n shippingAddress={shippingAddress}\n billingAddress={billingAddress}\n sameAsShipping={sameAsShipping}\n shippingGroups={shippingGroups}\n paymentMethod={paymentMethod}\n paymentMethods={paymentMethods}\n adjustmentPayments={adjustmentPayments}\n orderSummary={orderSummary}\n labels={resolved}\n formatMoney={formatMoney}\n />\n )\n }\n }\n\n const isLastStep = stepIndex === steps.length - 1\n\n const submitAction = (\n <Button\n type=\"button\"\n onClick={handleSubmit}\n disabled={submitting || blockedByInterruption}\n data-checkout-action=\"submit\"\n >\n <Lock className=\"size-4\" />\n {submitting ? resolved.processingLabel : resolved.completeOrderLabel}\n </Button>\n )\n\n const submitErrorNode = submitError ? (\n <div\n role=\"alert\"\n className=\"mt-6 flex flex-wrap items-center justify-between gap-3 rounded-md border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive\"\n >\n <span>{submitError}</span>\n {onRetrySubmit ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onRetrySubmit}\n disabled={submitting}\n >\n {resolved.submitErrorActionLabel}\n </Button>\n ) : null}\n </div>\n ) : null\n\n const validationAlertNode = validationAlert ? (\n <p key={validationAlert.nonce} className=\"sr-only\" role=\"alert\">\n {resolved.validationAttentionLabel.replace(\n '{step}',\n resolved[STEP_COPY[validationAlert.step].name],\n )}\n </p>\n ) : null\n\n const summaryNode = orderSummary ? (\n <div\n className={cn(\n 'min-w-0 lg:col-span-1',\n presentation === 'single-page' && 'lg:order-last',\n )}\n >\n <CheckoutOrderSummaryPanel\n summary={orderSummary}\n labels={resolved}\n totalsState={totalsState}\n onRetryTotals={onRetryTotals}\n promoCode={promoCode ?? ''}\n onPromoCodeChange={onPromoCodeChange ?? (() => {})}\n onApplyPromo={onApplyPromo}\n promoPending={promoPending}\n adjustmentPayments={adjustmentPayments}\n trustNotes={trustNotes}\n formatMoney={formatMoney}\n />\n </div>\n ) : null\n\n if (availability && availability.status !== 'available') {\n return (\n <div className=\"mx-auto max-w-3xl px-4 py-12 sm:px-6 lg:px-8\">\n <Card>\n <CardContent className=\"flex flex-col items-center gap-4 p-8 text-center\">\n <h1 className=\"text-2xl font-semibold\">{resolved.title}</h1>\n <p className=\"text-muted-foreground\">\n {availability.reason ?? availabilityLabel(availability.status, resolved)}\n </p>\n {availability.actionLabel && availability.onAction ? (\n <Button type=\"button\" variant=\"outline\" onClick={availability.onAction}>\n {availability.actionLabel}\n </Button>\n ) : null}\n </CardContent>\n </Card>\n </div>\n )\n }\n\n if (identityPending || accountGate) {\n return (\n <div className=\"mx-auto max-w-6xl px-4 py-12 sm:px-6 lg:px-8\">\n {(resolved.title || resolved.description) && (\n <header className=\"mb-8 text-center\">\n {resolved.title ? (\n <h1 className=\"text-3xl font-bold tracking-tight sm:text-4xl\">{resolved.title}</h1>\n ) : null}\n {resolved.description ? (\n <p className=\"mt-2 text-muted-foreground\">{resolved.description}</p>\n ) : null}\n </header>\n )}\n <div className={cn('grid grid-cols-1 gap-6', orderSummary && 'lg:grid-cols-3')}>\n <Card className={cn('min-w-0', orderSummary ? 'lg:col-span-2' : 'lg:col-span-3')}>\n <CardContent className=\"flex flex-col gap-4 p-6\">\n {identityPending ? (\n <p role=\"status\" aria-live=\"polite\" className=\"text-muted-foreground\">\n {resolved.identityPendingLabel}\n </p>\n ) : (\n <>\n <div>\n <h2 className=\"text-lg font-semibold\">{resolved.accountRequiredHeading}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {resolved.accountRequiredDescription}\n </p>\n </div>\n <div className=\"flex flex-wrap gap-3\">\n {onSignIn ? (\n <Button type=\"button\" onClick={onSignIn} data-checkout-action=\"sign-in\">\n {resolved.signInLabel}\n </Button>\n ) : null}\n {onSignUp ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onSignUp}\n data-checkout-action=\"sign-up\"\n >\n {resolved.signUpLabel}\n </Button>\n ) : null}\n </div>\n </>\n )}\n </CardContent>\n </Card>\n {summaryNode}\n </div>\n </div>\n )\n }\n\n const interruptionNode = interruption ? (\n <div\n role={interruption.severity === 'blocking' ? 'alert' : 'status'}\n className={cn(\n 'mt-6 flex flex-col gap-3 rounded-md border px-4 py-3 text-sm',\n interruption.severity === 'blocking'\n ? 'border-destructive/50 bg-destructive/10 text-destructive'\n : 'border-amber-500/50 bg-amber-500/10',\n )}\n >\n <div>\n <p className=\"font-medium\">{interruption.title}</p>\n <p>{interruption.message}</p>\n {interruption.changes?.length ? (\n <ul className=\"mt-2 list-disc pl-5\">\n {interruption.changes.map((change, index) => (\n <li key={`${change.lineId ?? index}:${change.label}`}>\n {change.label}\n {change.previous && change.next\n ? `: ${change.previous} → ${change.next}`\n : null}\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n {interruption.actions.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {interruption.actions.map((action) => (\n <Button\n key={action}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => onInterruptionAction?.(action)}\n >\n {actionLabel(action, resolved)}\n </Button>\n ))}\n </div>\n ) : null}\n </div>\n ) : null\n\n return (\n <CheckoutIdProvider prefix={checkoutInstanceId}>\n <div\n className=\"mx-auto max-w-6xl px-4 py-12 sm:px-6 lg:px-8\"\n data-checkout-presentation={presentation}\n data-checkout-step={presentation === 'stepper' ? activeStep : undefined}\n >\n {(resolved.title || resolved.description) && (\n <header className=\"mb-8 text-center\">\n {resolved.title ? (\n <h1 className=\"text-3xl font-bold tracking-tight sm:text-4xl\">{resolved.title}</h1>\n ) : null}\n {resolved.description ? (\n <p className=\"mt-2 text-muted-foreground\">{resolved.description}</p>\n ) : null}\n </header>\n )}\n\n {presentation === 'stepper' ? (\n <CheckoutProgress\n steps={steps.map((step) => ({\n id: step,\n label: resolved[STEP_COPY[step].name],\n }))}\n currentStep={activeStep}\n ariaLabel={resolved.stepProgressLabel}\n />\n ) : null}\n\n {presentation === 'single-page' ? (\n <div className=\"mt-8\">\n <CheckoutSectionNav\n instanceId={checkoutInstanceId}\n steps={steps.map((step) => ({\n id: step,\n label: resolved[STEP_COPY[step].name],\n }))}\n ariaLabel={resolved.stepProgressLabel}\n />\n </div>\n ) : null}\n\n <div className={cn('mt-8 grid grid-cols-1 gap-6', orderSummary && 'lg:grid-cols-3')}>\n {presentation === 'single-page' ? summaryNode : null}\n\n <div className={cn('min-w-0', orderSummary ? 'lg:col-span-2' : 'lg:col-span-3')}>\n <Card>\n <CardContent className=\"p-6\">\n {presentation === 'stepper' ? (\n <>\n <div className=\"mb-6\">\n <h2\n id={checkoutSectionHeadingId(checkoutInstanceId, activeStep)}\n ref={headingRef}\n tabIndex={-1}\n className=\"scroll-mt-24 text-lg font-semibold outline-none\"\n >\n {resolved[STEP_COPY[activeStep].heading]}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {resolved[STEP_COPY[activeStep].description]}\n </p>\n </div>\n\n <div data-checkout-step={activeStep}>{renderStep(activeStep)}</div>\n </>\n ) : presentation === 'accordion' ? (\n <Accordion\n type=\"single\"\n value={activeStep}\n collapsible={false}\n className=\"flex flex-col\"\n onValueChange={(value) => {\n const nextIndex = steps.indexOf(value as CheckoutStepId)\n if (nextIndex >= 0) moveTo(nextIndex)\n }}\n >\n {steps.map((step, index) => (\n <AccordionItem\n key={step}\n value={step}\n id={checkoutSectionId(checkoutInstanceId, step)}\n data-checkout-step={step}\n >\n <AccordionTrigger\n id={checkoutSectionHeadingId(checkoutInstanceId, step)}\n headingLevel={2}\n className=\"gap-4 py-5 hover:no-underline\"\n >\n <CheckoutStepHeader\n index={index}\n heading={resolved[STEP_COPY[step].heading]}\n description={resolved[STEP_COPY[step].description]}\n headingAs=\"span\"\n summary={\n step === activeStep\n ? undefined\n : stepSummary(step, {\n contact,\n shippingAddress,\n shippingGroups,\n paymentMethods,\n paymentMethod,\n })\n }\n errorMessage={\n stepHasErrors(step, fieldErrors)\n ? stepErrorMessage(step, fieldErrors) ??\n resolved.validationAttentionLabel.replace(\n '{step}',\n resolved[STEP_COPY[step].name],\n )\n : undefined\n }\n />\n </AccordionTrigger>\n <AccordionContent className=\"pb-6\">\n <div>{renderStep(step)}</div>\n </AccordionContent>\n </AccordionItem>\n ))}\n </Accordion>\n ) : (\n <div className=\"flex flex-col gap-8\">\n {steps.map((step, index) => (\n <section\n key={step}\n id={checkoutSectionId(checkoutInstanceId, step)}\n className=\"flex flex-col gap-4 border-t pt-8 first:border-t-0 first:pt-0\"\n data-checkout-step={step}\n >\n <CheckoutStepHeader\n index={index}\n heading={resolved[STEP_COPY[step].heading]}\n description={resolved[STEP_COPY[step].description]}\n headingId={checkoutSectionHeadingId(checkoutInstanceId, step)}\n headingTabIndex={-1}\n errorMessage={\n stepHasErrors(step, fieldErrors)\n ? stepErrorMessage(step, fieldErrors) ??\n resolved.validationAttentionLabel.replace(\n '{step}',\n resolved[STEP_COPY[step].name],\n )\n : undefined\n }\n />\n {renderStep(step)}\n </section>\n ))}\n </div>\n )}\n\n {interruptionNode}\n {submitErrorNode}\n {validationAlertNode}\n\n <div\n className={cn(\n 'mt-6 flex flex-wrap items-center gap-4',\n presentation === 'stepper' || presentation === 'accordion'\n ? 'justify-between'\n : 'justify-end',\n )}\n >\n {presentation === 'stepper' || presentation === 'accordion' ? (\n <>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleBack}\n disabled={stepIndex === 0 || submitting}\n data-checkout-action=\"back\"\n >\n {resolved.backLabel}\n </Button>\n {isLastStep ? (\n submitAction\n ) : (\n <Button\n type=\"button\"\n onClick={handleContinue}\n disabled={submitting || blockedByInterruption}\n data-checkout-action=\"continue\"\n >\n {resolved.continueLabel}\n </Button>\n )}\n </>\n ) : (\n submitAction\n )}\n </div>\n </CardContent>\n </Card>\n </div>\n\n {presentation === 'stepper' ? summaryNode : null}\n </div>\n </div>\n </CheckoutIdProvider>\n )\n}\n\nfunction actionLabel(action: CheckoutInterruptionAction, labels: CheckoutLabels): string {\n switch (action) {\n case 'acknowledge':\n return labels.interruptionAcknowledgeLabel\n case 'refresh':\n return labels.interruptionRefreshLabel\n case 'return-to-cart':\n return labels.interruptionReturnToCartLabel\n case 'retry':\n return labels.interruptionRetryLabel\n }\n}\n\nexport default Checkout\n"],"mappings":";AAwtBU,SA6LM,UA7LN,KAqFN,YArFM;AAttBV,SAAS,WAAW,OAAO,QAAQ,gBAAgB;AACnD,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,MAAM,mBAAmB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,iCAAiC;AAC1C,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,kBAAkB,eAAe,mBAAmB;AAC7D,SAAS,0BAA0B;AA0PnC,MAAM,iBAAiC;AAAA,EACrC,OAAO;AAAA,EACP,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,gBAA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,IAEA;AAAA;AAAA,YAEJ;AAAA,aACF,GACF,GACF;AAAA,UAEC,iBAAiB,YAAY,cAAc;AAAA,WAC9C;AAAA;AAAA;AAAA,EACA,GACF;AAEJ;AAEA,SAAS,YAAY,QAAoC,QAAgC;AACvF,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,OAAO;AAAA,IAChB,KAAK;AACH,aAAO,OAAO;AAAA,IAChB,KAAK;AACH,aAAO,OAAO;AAAA,IAChB,KAAK;AACH,aAAO,OAAO;AAAA,EAClB;AACF;AAEA,IAAO,mBAAQ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"storefront-navbar-cart-sheet.d.ts","sourceRoot":"","sources":["../../../../src/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAGhD,MAAM,WAAW,QAAQ;IACvB,0EAA0E;IAC1E,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAA;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;AAEzD,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB;;;;OAIG;IACH,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,6EAA6E;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6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,8EAA8E;IAC9E,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAwBD,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EAAE,YAAY,EACtB,wBAA8B,EAC9B,WAAW,EAAE,eAAe,EAC5B,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAiB,EACjB,oBAA0B,EAC1B,KAAc,EACd,UAAgD,EAChD,UAAyB,EACzB,OAAO,EACP,YAAyC,EACzC,mBAA2B,EAC3B,gBAAwB,EACxB,mBAA2B,GAC5B,EAAE,8BAA8B,+BAoQhC"}
@@ -30,19 +30,27 @@ var import_button = require("../../../ui/button.js");
30
30
  var import_empty = require("../../../ui/empty.js");
31
31
  var import_separator = require("../../../ui/separator.js");
32
32
  var import_sheet = require("../../../ui/sheet.js");
33
+ var import_motion = require("../../../lib/motion.js");
33
34
  var import_money = require("../../../lib/money.js");
34
35
  const usdFormatter = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
35
36
  const smokyExit = {
36
37
  opacity: 0,
37
- y: 10,
38
- scale: 0.96,
39
- filter: "blur(8px)",
40
- transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] }
38
+ y: import_motion.MOTION.distancePx.state,
39
+ transition: {
40
+ duration: import_motion.MOTION.durationSeconds.state,
41
+ ease: import_motion.MOTION.easing.standard
42
+ }
43
+ };
44
+ const revealHidden = { opacity: 0, y: import_motion.MOTION.distancePx.entrance };
45
+ const revealShown = { opacity: 1, y: 0 };
46
+ const revealExit = {
47
+ opacity: 0,
48
+ y: 0,
49
+ transition: {
50
+ duration: import_motion.MOTION.durationSeconds.feedback,
51
+ ease: import_motion.MOTION.easing.standard
52
+ }
41
53
  };
42
- const revealEase = [0.22, 1, 0.36, 1];
43
- const revealHidden = { opacity: 0, y: 12, filter: "blur(3px)" };
44
- const revealShown = { opacity: 1, y: 0, filter: "blur(0px)" };
45
- const revealExit = { opacity: 0, y: 0, filter: "blur(0px)", transition: { duration: 0.2, ease: "easeOut" } };
46
54
  function StorefrontNavbarCartSheet({
47
55
  items,
48
56
  onQtyChange,
@@ -124,12 +132,12 @@ function StorefrontNavbarCartSheet({
124
132
  import_react2.motion.li,
125
133
  {
126
134
  layout: !reduceMotion,
127
- initial: reduceMotion ? false : { opacity: 0, y: 8, filter: "blur(4px)" },
128
- animate: { opacity: 1, y: 0, filter: "blur(0px)" },
135
+ initial: reduceMotion ? false : { opacity: 0, y: import_motion.MOTION.distancePx.feedback },
136
+ animate: { opacity: 1, y: 0 },
129
137
  exit: reduceMotion ? { opacity: 0 } : smokyExit,
130
- transition: { duration: 0.28, ease: [0.22, 1, 0.36, 1] },
138
+ transition: { duration: import_motion.MOTION.durationSeconds.state, ease: import_motion.MOTION.easing.standard },
131
139
  className: "border-border flex gap-4 border-b py-4 last:border-b-0",
132
- style: { willChange: "transform, opacity, filter" },
140
+ style: { willChange: "transform, opacity" },
133
141
  children: [
134
142
  item.image ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
135
143
  "img",
@@ -210,8 +218,12 @@ function StorefrontNavbarCartSheet({
210
218
  {
211
219
  initial: reduceMotion ? false : revealHidden,
212
220
  animate: revealShown,
213
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0 },
214
- style: { willChange: "transform, opacity, filter" },
221
+ transition: reduceMotion ? { duration: 0 } : {
222
+ duration: import_motion.MOTION.durationSeconds.entrance,
223
+ ease: import_motion.MOTION.easing.standard,
224
+ delay: import_motion.MOTION.stagger(0)
225
+ },
226
+ style: { willChange: "transform, opacity" },
215
227
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_empty.EmptyMedia, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ShoppingBag, { "aria-hidden": "true" }) })
216
228
  }
217
229
  ),
@@ -220,8 +232,12 @@ function StorefrontNavbarCartSheet({
220
232
  {
221
233
  initial: reduceMotion ? false : revealHidden,
222
234
  animate: revealShown,
223
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0.04 },
224
- style: { willChange: "transform, opacity, filter" },
235
+ transition: reduceMotion ? { duration: 0 } : {
236
+ duration: import_motion.MOTION.durationSeconds.entrance,
237
+ ease: import_motion.MOTION.easing.standard,
238
+ delay: import_motion.MOTION.stagger(1)
239
+ },
240
+ style: { willChange: "transform, opacity" },
225
241
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_empty.EmptyTitle, { children: "Your cart is empty" })
226
242
  }
227
243
  ),
@@ -230,8 +246,12 @@ function StorefrontNavbarCartSheet({
230
246
  {
231
247
  initial: reduceMotion ? false : revealHidden,
232
248
  animate: revealShown,
233
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0.08 },
234
- style: { willChange: "transform, opacity, filter" },
249
+ transition: reduceMotion ? { duration: 0 } : {
250
+ duration: import_motion.MOTION.durationSeconds.entrance,
251
+ ease: import_motion.MOTION.easing.standard,
252
+ delay: import_motion.MOTION.stagger(2)
253
+ },
254
+ style: { willChange: "transform, opacity" },
235
255
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_empty.EmptyDescription, { children: "Once you add something it will show up here." })
236
256
  }
237
257
  )
@@ -241,8 +261,12 @@ function StorefrontNavbarCartSheet({
241
261
  {
242
262
  initial: reduceMotion ? false : revealHidden,
243
263
  animate: revealShown,
244
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0.12 },
245
- style: { willChange: "transform, opacity, filter" },
264
+ transition: reduceMotion ? { duration: 0 } : {
265
+ duration: import_motion.MOTION.durationSeconds.entrance,
266
+ ease: import_motion.MOTION.easing.standard,
267
+ delay: import_motion.MOTION.stagger(3)
268
+ },
269
+ style: { willChange: "transform, opacity" },
246
270
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_empty.EmptyContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.SheetClose, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { children: "Continue shopping" }) }) })
247
271
  }
248
272
  )
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.tsx"],"sourcesContent":["'use client'\n\nimport { useEffect, useState } from 'react'\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { Minus, Plus, ShoppingBag } from 'lucide-react'\n\nimport { Button } from '../../../ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '../../../ui/empty'\nimport { Separator } from '../../../ui/separator'\nimport { SheetClose } from '../../../ui/sheet'\nimport type { Money } from '@thorprovider/types'\nimport { formatMoney } from '../../../lib/money'\n\nexport interface CartItem {\n /** Backend cart line-item id — the stable identity for update/removal. */\n id: string\n name: string\n variant?: string\n price: number\n qty: number\n /** Optional; an absent image is omitted rather than serialized as `\"\"`. */\n image?: string\n /**\n * Canonical backend line amount. Required for truthful rendering in\n * `canonical` mode; when absent/invalid the line shows the unavailable\n * label rather than a numeric fallback.\n */\n lineTotal?: Money\n}\n\nexport type CartSheetState = 'idle' | 'pending' | 'error'\n\nexport interface StorefrontNavbarCartSheetProps {\n items: CartItem[]\n /**\n * Quantity DELTA for a backend cart line-item id. The boundary converts the\n * delta into an absolute quantity against the authoritative current line\n * quantity before mutating the cart.\n */\n onQtyChange: (id: string, delta: number) => void\n /** Remove the backend cart line-item id. */\n onRemove: (id: string) => void\n /** Authoritative backend subtotal. Preferred over any local line math. */\n subtotal?: Money\n /** Shown when an authoritative subtotal is supplied but absent/malformed. */\n subtotalUnavailableLabel?: string\n /** Override money formatting (locale, currency). Defaults to `Money.currencyCode`. */\n formatMoney?: (money: Money) => string\n /** @deprecated legacy numeric formatter; ignored when `subtotal` is supplied. */\n formatPrice?: (value: number) => string\n onCheckout?: () => void\n onViewCart?: () => void\n /**\n * Backend-authoritative rendering. When `true`, each line amount comes from\n * the item's canonical `lineTotal` Money and the sheet never recomputes\n * `price * qty`. When omitted/false, legacy numeric rendering is preserved\n * for standalone consumers.\n */\n canonical?: boolean\n /** Shown in `canonical` mode when a line amount is missing or malformed. */\n lineUnavailableLabel?: string\n /** Cart read/mutation lifecycle. Pending retains confirmed lines; error is recoverable. */\n state?: CartSheetState\n /** Message shown when `state` is `error`. */\n errorLabel?: string\n /** Label for the recovery action in the error state. */\n retryLabel?: string\n /** Recovery action invoked from the error state. */\n onRetry?: () => void\n /** Label shown while `state` is `pending`. */\n pendingLabel?: string\n /** When `true`, the checkout action is suppressed (checkout not installed). */\n checkoutUnavailable?: boolean\n /** When `true`, the checkout action is disabled (cart not ready / invalid amounts). */\n checkoutDisabled?: boolean\n /** When `true`, the review action is suppressed (cart view not installed). */\n viewCartUnavailable?: boolean\n}\n\nconst usdFormatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })\n\n/** Approximate Transitions.dev `delete-with-smoky-dissolve` for list rows (Pro effect). */\nconst smokyExit = {\n opacity: 0,\n y: 10,\n scale: 0.96,\n filter: 'blur(8px)',\n transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] as const },\n}\n\n/**\n * Transitions.dev `texts-reveal`: lines rise from below with blur, staggered.\n * Exit is a quiet in-place fade — no Y return, no reverse stagger.\n */\nconst revealEase = [0.22, 1, 0.36, 1] as const\nconst revealHidden = { opacity: 0, y: 12, filter: 'blur(3px)' }\nconst revealShown = { opacity: 1, y: 0, filter: 'blur(0px)' }\nconst revealExit = { opacity: 0, y: 0, filter: 'blur(0px)', transition: { duration: 0.2, ease: 'easeOut' as const } }\n\nexport function StorefrontNavbarCartSheet({\n items,\n onQtyChange,\n onRemove,\n subtotal: subtotalProp,\n subtotalUnavailableLabel = '—',\n formatMoney: formatMoneyProp,\n formatPrice,\n onCheckout,\n onViewCart,\n canonical = false,\n lineUnavailableLabel = '—',\n state = 'idle',\n errorLabel = 'No se pudo actualizar el carrito.',\n retryLabel = 'Reintentar',\n onRetry,\n pendingLabel = 'Actualizando el carrito…',\n checkoutUnavailable = false,\n checkoutDisabled = false,\n viewCartUnavailable = false,\n}: StorefrontNavbarCartSheetProps) {\n const reduceMotion = useReducedMotion()\n const format = formatPrice ?? (value => usdFormatter.format(value))\n const localSubtotal = items.reduce((total, item) => total + item.price * item.qty, 0)\n const authoritativeSubtotal = subtotalProp !== undefined ? formatMoney(subtotalProp, formatMoneyProp) : null\n const isEmpty = items.length === 0\n const isPending = state === 'pending'\n const isError = state === 'error'\n /** Wait for the last cart row's exit before revealing empty copy. */\n const [showEmpty, setShowEmpty] = useState(isEmpty)\n\n useEffect(() => {\n if (!isEmpty) {\n setShowEmpty(false)\n }\n }, [isEmpty])\n\n const lineAmount = (item: CartItem): string => {\n if (canonical) {\n if (item.lineTotal === undefined) {\n return lineUnavailableLabel\n }\n return formatMoney(item.lineTotal, formatMoneyProp) ?? lineUnavailableLabel\n }\n return format(item.price * item.qty)\n }\n\n // A confirmed empty cart is only claimed when no read/mutation is in flight\n // and no read error is outstanding; otherwise the sheet shows loading/error.\n const showConfirmedEmpty = showEmpty && !isPending && !isError\n const mutationsDisabled = isPending\n\n return (\n <>\n <div className='relative flex min-h-0 flex-1 flex-col overflow-hidden'>\n {isPending ? (\n <p\n role='status'\n aria-live='polite'\n className='border-border text-muted-foreground border-b px-4 py-2 text-sm'\n >\n {pendingLabel}\n </p>\n ) : null}\n {isError ? (\n <div\n role='alert'\n className='border-border flex items-center justify-between gap-2 border-b px-4 py-2 text-sm'\n >\n <span className='text-destructive'>{errorLabel}</span>\n {onRetry ? (\n <Button variant='ghost' size='sm' onClick={onRetry}>\n {retryLabel}\n </Button>\n ) : null}\n </div>\n ) : null}\n <ul className='flex-1 overflow-y-auto px-4'>\n <AnimatePresence\n initial={false}\n mode='popLayout'\n onExitComplete={() => {\n if (items.length === 0) {\n setShowEmpty(true)\n }\n }}\n >\n {items.map(item => (\n <motion.li\n key={item.id}\n layout={!reduceMotion}\n initial={reduceMotion ? false : { opacity: 0, y: 8, filter: 'blur(4px)' }}\n animate={{ opacity: 1, y: 0, filter: 'blur(0px)' }}\n exit={reduceMotion ? { opacity: 0 } : smokyExit}\n transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }}\n className='border-border flex gap-4 border-b py-4 last:border-b-0'\n style={{ willChange: 'transform, opacity, filter' }}\n >\n {item.image ? (\n <img\n src={item.image || undefined}\n alt=''\n width={80}\n height={96}\n className='bg-muted size-20 shrink-0 rounded-md object-cover'\n />\n ) : (\n <div aria-hidden='true' className='bg-muted size-20 shrink-0 rounded-md' />\n )}\n <div className='flex min-w-0 flex-1 flex-col'>\n <div className='flex items-start justify-between gap-2'>\n <div className='min-w-0'>\n <p className='truncate text-sm font-medium'>{item.name}</p>\n {item.variant ? (\n <p className='text-muted-foreground text-sm'>{item.variant}</p>\n ) : null}\n </div>\n <p className='text-sm font-medium'>{lineAmount(item)}</p>\n </div>\n\n <div className='mt-auto flex items-center justify-between pt-2'>\n <div className='border-border flex items-center rounded-md border'>\n <Button\n variant='ghost'\n size='icon'\n className='size-8 rounded-r-none'\n aria-label={`Decrease quantity, ${item.name}`}\n disabled={mutationsDisabled}\n onClick={() => onQtyChange(item.id, -1)}\n >\n <Minus />\n </Button>\n <span className='w-8 text-center text-sm tabular-nums'>{item.qty}</span>\n <Button\n variant='ghost'\n size='icon'\n className='size-8 rounded-l-none'\n aria-label={`Increase quantity, ${item.name}`}\n disabled={mutationsDisabled}\n onClick={() => onQtyChange(item.id, 1)}\n >\n <Plus />\n </Button>\n </div>\n <Button\n variant='ghost'\n size='sm'\n className='text-muted-foreground hover:text-foreground'\n aria-label={`Remove ${item.name} from cart`}\n disabled={mutationsDisabled}\n onClick={() => onRemove(item.id)}\n >\n Remove\n </Button>\n </div>\n </div>\n </motion.li>\n ))}\n </AnimatePresence>\n </ul>\n\n <AnimatePresence>\n {showConfirmedEmpty ? (\n <motion.div\n key='empty'\n initial={false}\n exit={reduceMotion ? { opacity: 0 } : revealExit}\n className='absolute inset-0'\n >\n <Empty className='h-full border-0'>\n <EmptyHeader>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : { duration: 0.5, ease: revealEase, delay: 0 }\n }\n style={{ willChange: 'transform, opacity, filter' }}\n >\n <EmptyMedia variant='icon'>\n <ShoppingBag aria-hidden='true' />\n </EmptyMedia>\n </motion.div>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : { duration: 0.5, ease: revealEase, delay: 0.04 }\n }\n style={{ willChange: 'transform, opacity, filter' }}\n >\n <EmptyTitle>Your cart is empty</EmptyTitle>\n </motion.div>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : { duration: 0.5, ease: revealEase, delay: 0.08 }\n }\n style={{ willChange: 'transform, opacity, filter' }}\n >\n <EmptyDescription>Once you add something it will show up here.</EmptyDescription>\n </motion.div>\n </EmptyHeader>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : { duration: 0.5, ease: revealEase, delay: 0.12 }\n }\n style={{ willChange: 'transform, opacity, filter' }}\n >\n <EmptyContent>\n <SheetClose asChild>\n <Button>Continue shopping</Button>\n </SheetClose>\n </EmptyContent>\n </motion.div>\n </Empty>\n </motion.div>\n ) : null}\n </AnimatePresence>\n </div>\n\n {!isEmpty ? (\n <div className='flex flex-col gap-4 p-4'>\n <Separator />\n <div className='flex items-center justify-between text-sm'>\n <span className='text-muted-foreground'>Subtotal</span>\n <span className='font-medium tabular-nums'>\n {canonical || subtotalProp !== undefined\n ? authoritativeSubtotal ?? subtotalUnavailableLabel\n : format(localSubtotal)}\n </span>\n </div>\n <p className='text-muted-foreground text-xs'>Shipping and taxes are calculated at checkout.</p>\n <div className='flex flex-col gap-2'>\n {checkoutUnavailable ? null : (\n <Button\n className='w-full'\n disabled={checkoutDisabled || isPending}\n onClick={onCheckout}\n >\n Checkout\n </Button>\n )}\n {viewCartUnavailable ? null : (\n <Button variant='ghost' className='w-full' onClick={onViewCart}>\n View cart\n </Button>\n )}\n </div>\n </div>\n ) : null}\n </>\n )\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+JI;AA7JJ,mBAAoC;AACpC,IAAAA,gBAA0D;AAC1D,0BAAyC;AAEzC,oBAAuB;AACvB,mBAOO;AACP,uBAA0B;AAC1B,mBAA2B;AAE3B,mBAA4B;AAoE5B,MAAM,eAAe,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,YAAY,UAAU,MAAM,CAAC;AAG1F,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,GAAG;AAAA,EACH,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,YAAY,EAAE,UAAU,MAAM,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,EAAW;AAChE;AAMA,MAAM,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC;AACpC,MAAM,eAAe,EAAE,SAAS,GAAG,GAAG,IAAI,QAAQ,YAAY;AAC9D,MAAM,cAAc,EAAE,SAAS,GAAG,GAAG,GAAG,QAAQ,YAAY;AAC5D,MAAM,aAAa,EAAE,SAAS,GAAG,GAAG,GAAG,QAAQ,aAAa,YAAY,EAAE,UAAU,KAAK,MAAM,UAAmB,EAA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AAA,QA9DI;AAAA,MA+DN,IACE,MACN;AAAA,OACF;AAAA,IAEC,CAAC,UACA,6CAAC,SAAI,WAAU,2BACb;AAAA,kDAAC,8BAAU;AAAA,MACX,6CAAC,SAAI,WAAU,6CACb;AAAA,oDAAC,UAAK,WAAU,yBAAwB,sBAAQ;AAAA,QAChD,4CAAC,UAAK,WAAU,4BACb,uBAAa,iBAAiB,SAC3B,yBAAyB,2BACzB,OAAO,aAAa,GAC1B;AAAA,SACF;AAAA,MACA,4CAAC,OAAE,WAAU,iCAAgC,4DAA8C;AAAA,MAC3F,6CAAC,SAAI,WAAU,uBACZ;AAAA,8BAAsB,OACrB;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,UAAU,oBAAoB;AAAA,YAC9B,SAAS;AAAA,YACV;AAAA;AAAA,QAED;AAAA,QAED,sBAAsB,OACrB,4CAAC,wBAAO,SAAQ,SAAQ,WAAU,UAAS,SAAS,YAAY,uBAEhE;AAAA,SAEJ;AAAA,OACF,IACE;AAAA,KACN;AAEJ;","names":["import_react"]}
1
+ {"version":3,"sources":["../../../../src/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.tsx"],"sourcesContent":["'use client'\n\nimport { useEffect, useState } from 'react'\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { Minus, Plus, ShoppingBag } from 'lucide-react'\n\nimport { Button } from '../../../ui/button'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '../../../ui/empty'\nimport { Separator } from '../../../ui/separator'\nimport { SheetClose } from '../../../ui/sheet'\nimport { MOTION } from '../../../lib/motion'\nimport type { Money } from '@thorprovider/types'\nimport { formatMoney } from '../../../lib/money'\n\nexport interface CartItem {\n /** Backend cart line-item id — the stable identity for update/removal. */\n id: string\n name: string\n variant?: string\n price: number\n qty: number\n /** Optional; an absent image is omitted rather than serialized as `\"\"`. */\n image?: string\n /**\n * Canonical backend line amount. Required for truthful rendering in\n * `canonical` mode; when absent/invalid the line shows the unavailable\n * label rather than a numeric fallback.\n */\n lineTotal?: Money\n}\n\nexport type CartSheetState = 'idle' | 'pending' | 'error'\n\nexport interface StorefrontNavbarCartSheetProps {\n items: CartItem[]\n /**\n * Quantity DELTA for a backend cart line-item id. The boundary converts the\n * delta into an absolute quantity against the authoritative current line\n * quantity before mutating the cart.\n */\n onQtyChange: (id: string, delta: number) => void\n /** Remove the backend cart line-item id. */\n onRemove: (id: string) => void\n /** Authoritative backend subtotal. Preferred over any local line math. */\n subtotal?: Money\n /** Shown when an authoritative subtotal is supplied but absent/malformed. */\n subtotalUnavailableLabel?: string\n /** Override money formatting (locale, currency). Defaults to `Money.currencyCode`. */\n formatMoney?: (money: Money) => string\n /** @deprecated legacy numeric formatter; ignored when `subtotal` is supplied. */\n formatPrice?: (value: number) => string\n onCheckout?: () => void\n onViewCart?: () => void\n /**\n * Backend-authoritative rendering. When `true`, each line amount comes from\n * the item's canonical `lineTotal` Money and the sheet never recomputes\n * `price * qty`. When omitted/false, legacy numeric rendering is preserved\n * for standalone consumers.\n */\n canonical?: boolean\n /** Shown in `canonical` mode when a line amount is missing or malformed. */\n lineUnavailableLabel?: string\n /** Cart read/mutation lifecycle. Pending retains confirmed lines; error is recoverable. */\n state?: CartSheetState\n /** Message shown when `state` is `error`. */\n errorLabel?: string\n /** Label for the recovery action in the error state. */\n retryLabel?: string\n /** Recovery action invoked from the error state. */\n onRetry?: () => void\n /** Label shown while `state` is `pending`. */\n pendingLabel?: string\n /** When `true`, the checkout action is suppressed (checkout not installed). */\n checkoutUnavailable?: boolean\n /** When `true`, the checkout action is disabled (cart not ready / invalid amounts). */\n checkoutDisabled?: boolean\n /** When `true`, the review action is suppressed (cart view not installed). */\n viewCartUnavailable?: boolean\n}\n\nconst usdFormatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })\n\nconst smokyExit = {\n opacity: 0,\n y: MOTION.distancePx.state,\n transition: {\n duration: MOTION.durationSeconds.state,\n ease: MOTION.easing.standard,\n },\n}\n\nconst revealHidden = { opacity: 0, y: MOTION.distancePx.entrance }\nconst revealShown = { opacity: 1, y: 0 }\nconst revealExit = {\n opacity: 0,\n y: 0,\n transition: {\n duration: MOTION.durationSeconds.feedback,\n ease: MOTION.easing.standard,\n },\n}\n\nexport function StorefrontNavbarCartSheet({\n items,\n onQtyChange,\n onRemove,\n subtotal: subtotalProp,\n subtotalUnavailableLabel = '—',\n formatMoney: formatMoneyProp,\n formatPrice,\n onCheckout,\n onViewCart,\n canonical = false,\n lineUnavailableLabel = '—',\n state = 'idle',\n errorLabel = 'No se pudo actualizar el carrito.',\n retryLabel = 'Reintentar',\n onRetry,\n pendingLabel = 'Actualizando el carrito…',\n checkoutUnavailable = false,\n checkoutDisabled = false,\n viewCartUnavailable = false,\n}: StorefrontNavbarCartSheetProps) {\n const reduceMotion = useReducedMotion()\n const format = formatPrice ?? (value => usdFormatter.format(value))\n const localSubtotal = items.reduce((total, item) => total + item.price * item.qty, 0)\n const authoritativeSubtotal = subtotalProp !== undefined ? formatMoney(subtotalProp, formatMoneyProp) : null\n const isEmpty = items.length === 0\n const isPending = state === 'pending'\n const isError = state === 'error'\n /** Wait for the last cart row's exit before revealing empty copy. */\n const [showEmpty, setShowEmpty] = useState(isEmpty)\n\n useEffect(() => {\n if (!isEmpty) {\n setShowEmpty(false)\n }\n }, [isEmpty])\n\n const lineAmount = (item: CartItem): string => {\n if (canonical) {\n if (item.lineTotal === undefined) {\n return lineUnavailableLabel\n }\n return formatMoney(item.lineTotal, formatMoneyProp) ?? lineUnavailableLabel\n }\n return format(item.price * item.qty)\n }\n\n // A confirmed empty cart is only claimed when no read/mutation is in flight\n // and no read error is outstanding; otherwise the sheet shows loading/error.\n const showConfirmedEmpty = showEmpty && !isPending && !isError\n const mutationsDisabled = isPending\n\n return (\n <>\n <div className='relative flex min-h-0 flex-1 flex-col overflow-hidden'>\n {isPending ? (\n <p\n role='status'\n aria-live='polite'\n className='border-border text-muted-foreground border-b px-4 py-2 text-sm'\n >\n {pendingLabel}\n </p>\n ) : null}\n {isError ? (\n <div\n role='alert'\n className='border-border flex items-center justify-between gap-2 border-b px-4 py-2 text-sm'\n >\n <span className='text-destructive'>{errorLabel}</span>\n {onRetry ? (\n <Button variant='ghost' size='sm' onClick={onRetry}>\n {retryLabel}\n </Button>\n ) : null}\n </div>\n ) : null}\n <ul className='flex-1 overflow-y-auto px-4'>\n <AnimatePresence\n initial={false}\n mode='popLayout'\n onExitComplete={() => {\n if (items.length === 0) {\n setShowEmpty(true)\n }\n }}\n >\n {items.map(item => (\n <motion.li\n key={item.id}\n layout={!reduceMotion}\n initial={reduceMotion ? false : { opacity: 0, y: MOTION.distancePx.feedback }}\n animate={{ opacity: 1, y: 0 }}\n exit={reduceMotion ? { opacity: 0 } : smokyExit}\n transition={{ duration: MOTION.durationSeconds.state, ease: MOTION.easing.standard }}\n className='border-border flex gap-4 border-b py-4 last:border-b-0'\n style={{ willChange: 'transform, opacity' }}\n >\n {item.image ? (\n <img\n src={item.image || undefined}\n alt=''\n width={80}\n height={96}\n className='bg-muted size-20 shrink-0 rounded-md object-cover'\n />\n ) : (\n <div aria-hidden='true' className='bg-muted size-20 shrink-0 rounded-md' />\n )}\n <div className='flex min-w-0 flex-1 flex-col'>\n <div className='flex items-start justify-between gap-2'>\n <div className='min-w-0'>\n <p className='truncate text-sm font-medium'>{item.name}</p>\n {item.variant ? (\n <p className='text-muted-foreground text-sm'>{item.variant}</p>\n ) : null}\n </div>\n <p className='text-sm font-medium'>{lineAmount(item)}</p>\n </div>\n\n <div className='mt-auto flex items-center justify-between pt-2'>\n <div className='border-border flex items-center rounded-md border'>\n <Button\n variant='ghost'\n size='icon'\n className='size-8 rounded-r-none'\n aria-label={`Decrease quantity, ${item.name}`}\n disabled={mutationsDisabled}\n onClick={() => onQtyChange(item.id, -1)}\n >\n <Minus />\n </Button>\n <span className='w-8 text-center text-sm tabular-nums'>{item.qty}</span>\n <Button\n variant='ghost'\n size='icon'\n className='size-8 rounded-l-none'\n aria-label={`Increase quantity, ${item.name}`}\n disabled={mutationsDisabled}\n onClick={() => onQtyChange(item.id, 1)}\n >\n <Plus />\n </Button>\n </div>\n <Button\n variant='ghost'\n size='sm'\n className='text-muted-foreground hover:text-foreground'\n aria-label={`Remove ${item.name} from cart`}\n disabled={mutationsDisabled}\n onClick={() => onRemove(item.id)}\n >\n Remove\n </Button>\n </div>\n </div>\n </motion.li>\n ))}\n </AnimatePresence>\n </ul>\n\n <AnimatePresence>\n {showConfirmedEmpty ? (\n <motion.div\n key='empty'\n initial={false}\n exit={reduceMotion ? { opacity: 0 } : revealExit}\n className='absolute inset-0'\n >\n <Empty className='h-full border-0'>\n <EmptyHeader>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : {\n duration: MOTION.durationSeconds.entrance,\n ease: MOTION.easing.standard,\n delay: MOTION.stagger(0),\n }\n }\n style={{ willChange: 'transform, opacity' }}\n >\n <EmptyMedia variant='icon'>\n <ShoppingBag aria-hidden='true' />\n </EmptyMedia>\n </motion.div>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : {\n duration: MOTION.durationSeconds.entrance,\n ease: MOTION.easing.standard,\n delay: MOTION.stagger(1),\n }\n }\n style={{ willChange: 'transform, opacity' }}\n >\n <EmptyTitle>Your cart is empty</EmptyTitle>\n </motion.div>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : {\n duration: MOTION.durationSeconds.entrance,\n ease: MOTION.easing.standard,\n delay: MOTION.stagger(2),\n }\n }\n style={{ willChange: 'transform, opacity' }}\n >\n <EmptyDescription>Once you add something it will show up here.</EmptyDescription>\n </motion.div>\n </EmptyHeader>\n <motion.div\n initial={reduceMotion ? false : revealHidden}\n animate={revealShown}\n transition={\n reduceMotion\n ? { duration: 0 }\n : {\n duration: MOTION.durationSeconds.entrance,\n ease: MOTION.easing.standard,\n delay: MOTION.stagger(3),\n }\n }\n style={{ willChange: 'transform, opacity' }}\n >\n <EmptyContent>\n <SheetClose asChild>\n <Button>Continue shopping</Button>\n </SheetClose>\n </EmptyContent>\n </motion.div>\n </Empty>\n </motion.div>\n ) : null}\n </AnimatePresence>\n </div>\n\n {!isEmpty ? (\n <div className='flex flex-col gap-4 p-4'>\n <Separator />\n <div className='flex items-center justify-between text-sm'>\n <span className='text-muted-foreground'>Subtotal</span>\n <span className='font-medium tabular-nums'>\n {canonical || subtotalProp !== undefined\n ? authoritativeSubtotal ?? subtotalUnavailableLabel\n : format(localSubtotal)}\n </span>\n </div>\n <p className='text-muted-foreground text-xs'>Shipping and taxes are calculated at checkout.</p>\n <div className='flex flex-col gap-2'>\n {checkoutUnavailable ? null : (\n <Button\n className='w-full'\n disabled={checkoutDisabled || isPending}\n onClick={onCheckout}\n >\n Checkout\n </Button>\n )}\n {viewCartUnavailable ? null : (\n <Button variant='ghost' className='w-full' onClick={onViewCart}>\n View cart\n </Button>\n )}\n </div>\n </div>\n ) : null}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkKI;AAhKJ,mBAAoC;AACpC,IAAAA,gBAA0D;AAC1D,0BAAyC;AAEzC,oBAAuB;AACvB,mBAOO;AACP,uBAA0B;AAC1B,mBAA2B;AAC3B,oBAAuB;AAEvB,mBAA4B;AAoE5B,MAAM,eAAe,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,YAAY,UAAU,MAAM,CAAC;AAE1F,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,GAAG,qBAAO,WAAW;AAAA,EACrB,YAAY;AAAA,IACV,UAAU,qBAAO,gBAAgB;AAAA,IACjC,MAAM,qBAAO,OAAO;AAAA,EACtB;AACF;AAEA,MAAM,eAAe,EAAE,SAAS,GAAG,GAAG,qBAAO,WA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AE,YAAY,qBAAqB;AAAA,kBAE1C,sDAAC,iCAAiB,0DAA4C;AAAA;AAAA,cAChE;AAAA,eACF;AAAA,YACA;AAAA,cAAC,qBAAO;AAAA,cAAP;AAAA,gBACC,SAAS,eAAe,QAAQ;AAAA,gBAChC,SAAS;AAAA,gBACT,YACE,eACI,EAAE,UAAU,EAAE,IACd;AAAA,kBACE,UAAU,qBAAO,gBAAgB;AAAA,kBACjC,MAAM,qBAAO,OAAO;AAAA,kBACpB,OAAO,qBAAO,QAAQ,CAAC;AAAA,gBACzB;AAAA,gBAEN,OAAO,EAAE,YAAY,qBAAqB;AAAA,gBAE1C,sDAAC,6BACC,sDAAC,2BAAW,SAAO,MACjB,sDAAC,wBAAO,+BAAiB,GAC3B,GACF;AAAA;AAAA,YACF;AAAA,aACF;AAAA;AAAA,QA9EI;AAAA,MA+EN,IACE,MACN;AAAA,OACF;AAAA,IAEC,CAAC,UACA,6CAAC,SAAI,WAAU,2BACb;AAAA,kDAAC,8BAAU;AAAA,MACX,6CAAC,SAAI,WAAU,6CACb;AAAA,oDAAC,UAAK,WAAU,yBAAwB,sBAAQ;AAAA,QAChD,4CAAC,UAAK,WAAU,4BACb,uBAAa,iBAAiB,SAC3B,yBAAyB,2BACzB,OAAO,aAAa,GAC1B;AAAA,SACF;AAAA,MACA,4CAAC,OAAE,WAAU,iCAAgC,4DAA8C;AAAA,MAC3F,6CAAC,SAAI,WAAU,uBACZ;AAAA,8BAAsB,OACrB;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,UAAU,oBAAoB;AAAA,YAC9B,SAAS;AAAA,YACV;AAAA;AAAA,QAED;AAAA,QAED,sBAAsB,OACrB,4CAAC,wBAAO,SAAQ,SAAQ,WAAU,UAAS,SAAS,YAAY,uBAEhE;AAAA,SAEJ;AAAA,OACF,IACE;AAAA,KACN;AAEJ;","names":["import_react"]}
@@ -14,19 +14,27 @@ import {
14
14
  } from "../../../ui/empty.mjs";
15
15
  import { Separator } from "../../../ui/separator.mjs";
16
16
  import { SheetClose } from "../../../ui/sheet.mjs";
17
+ import { MOTION } from "../../../lib/motion.mjs";
17
18
  import { formatMoney } from "../../../lib/money.mjs";
18
19
  const usdFormatter = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
19
20
  const smokyExit = {
20
21
  opacity: 0,
21
- y: 10,
22
- scale: 0.96,
23
- filter: "blur(8px)",
24
- transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] }
22
+ y: MOTION.distancePx.state,
23
+ transition: {
24
+ duration: MOTION.durationSeconds.state,
25
+ ease: MOTION.easing.standard
26
+ }
27
+ };
28
+ const revealHidden = { opacity: 0, y: MOTION.distancePx.entrance };
29
+ const revealShown = { opacity: 1, y: 0 };
30
+ const revealExit = {
31
+ opacity: 0,
32
+ y: 0,
33
+ transition: {
34
+ duration: MOTION.durationSeconds.feedback,
35
+ ease: MOTION.easing.standard
36
+ }
25
37
  };
26
- const revealEase = [0.22, 1, 0.36, 1];
27
- const revealHidden = { opacity: 0, y: 12, filter: "blur(3px)" };
28
- const revealShown = { opacity: 1, y: 0, filter: "blur(0px)" };
29
- const revealExit = { opacity: 0, y: 0, filter: "blur(0px)", transition: { duration: 0.2, ease: "easeOut" } };
30
38
  function StorefrontNavbarCartSheet({
31
39
  items,
32
40
  onQtyChange,
@@ -108,12 +116,12 @@ function StorefrontNavbarCartSheet({
108
116
  motion.li,
109
117
  {
110
118
  layout: !reduceMotion,
111
- initial: reduceMotion ? false : { opacity: 0, y: 8, filter: "blur(4px)" },
112
- animate: { opacity: 1, y: 0, filter: "blur(0px)" },
119
+ initial: reduceMotion ? false : { opacity: 0, y: MOTION.distancePx.feedback },
120
+ animate: { opacity: 1, y: 0 },
113
121
  exit: reduceMotion ? { opacity: 0 } : smokyExit,
114
- transition: { duration: 0.28, ease: [0.22, 1, 0.36, 1] },
122
+ transition: { duration: MOTION.durationSeconds.state, ease: MOTION.easing.standard },
115
123
  className: "border-border flex gap-4 border-b py-4 last:border-b-0",
116
- style: { willChange: "transform, opacity, filter" },
124
+ style: { willChange: "transform, opacity" },
117
125
  children: [
118
126
  item.image ? /* @__PURE__ */ jsx(
119
127
  "img",
@@ -194,8 +202,12 @@ function StorefrontNavbarCartSheet({
194
202
  {
195
203
  initial: reduceMotion ? false : revealHidden,
196
204
  animate: revealShown,
197
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0 },
198
- style: { willChange: "transform, opacity, filter" },
205
+ transition: reduceMotion ? { duration: 0 } : {
206
+ duration: MOTION.durationSeconds.entrance,
207
+ ease: MOTION.easing.standard,
208
+ delay: MOTION.stagger(0)
209
+ },
210
+ style: { willChange: "transform, opacity" },
199
211
  children: /* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", children: /* @__PURE__ */ jsx(ShoppingBag, { "aria-hidden": "true" }) })
200
212
  }
201
213
  ),
@@ -204,8 +216,12 @@ function StorefrontNavbarCartSheet({
204
216
  {
205
217
  initial: reduceMotion ? false : revealHidden,
206
218
  animate: revealShown,
207
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0.04 },
208
- style: { willChange: "transform, opacity, filter" },
219
+ transition: reduceMotion ? { duration: 0 } : {
220
+ duration: MOTION.durationSeconds.entrance,
221
+ ease: MOTION.easing.standard,
222
+ delay: MOTION.stagger(1)
223
+ },
224
+ style: { willChange: "transform, opacity" },
209
225
  children: /* @__PURE__ */ jsx(EmptyTitle, { children: "Your cart is empty" })
210
226
  }
211
227
  ),
@@ -214,8 +230,12 @@ function StorefrontNavbarCartSheet({
214
230
  {
215
231
  initial: reduceMotion ? false : revealHidden,
216
232
  animate: revealShown,
217
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0.08 },
218
- style: { willChange: "transform, opacity, filter" },
233
+ transition: reduceMotion ? { duration: 0 } : {
234
+ duration: MOTION.durationSeconds.entrance,
235
+ ease: MOTION.easing.standard,
236
+ delay: MOTION.stagger(2)
237
+ },
238
+ style: { willChange: "transform, opacity" },
219
239
  children: /* @__PURE__ */ jsx(EmptyDescription, { children: "Once you add something it will show up here." })
220
240
  }
221
241
  )
@@ -225,8 +245,12 @@ function StorefrontNavbarCartSheet({
225
245
  {
226
246
  initial: reduceMotion ? false : revealHidden,
227
247
  animate: revealShown,
228
- transition: reduceMotion ? { duration: 0 } : { duration: 0.5, ease: revealEase, delay: 0.12 },
229
- style: { willChange: "transform, opacity, filter" },
248
+ transition: reduceMotion ? { duration: 0 } : {
249
+ duration: MOTION.durationSeconds.entrance,
250
+ ease: MOTION.easing.standard,
251
+ delay: MOTION.stagger(3)
252
+ },
253
+ style: { willChange: "transform, opacity" },
230
254
  children: /* @__PURE__ */ jsx(EmptyContent, { children: /* @__PURE__ */ jsx(SheetClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { children: "Continue shopping" }) }) })
231
255
  }
232
256
  )