@vtex/faststore 0.0.8 → 0.0.11

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 (568) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +0 -1
  3. package/dist/actions.json +48 -1
  4. package/dist/catalog.json +1397 -1594
  5. package/dist/cli/index.d.ts +66 -28
  6. package/dist/cli/index.js +7371 -512
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/server-runtime.js +41 -60
  9. package/dist/cli/server-runtime.js.map +1 -1
  10. package/dist/client.d.ts +3 -3
  11. package/dist/client.js +2 -2
  12. package/dist/components.d.ts +67 -56
  13. package/dist/components.js +64 -53
  14. package/dist/content-types.json +5886 -555
  15. package/dist/core/dist/define-component.d.ts +7 -2
  16. package/dist/core/dist/define-content-type.d.ts +50 -2
  17. package/dist/core/dist/define-content-type.js +107 -3
  18. package/dist/core/dist/define-content-type.js.map +1 -1
  19. package/dist/core/dist/index.d.ts +2 -2
  20. package/dist/docs/access-code-field.md +1 -1
  21. package/dist/docs/access-code-sign-in.md +126 -77
  22. package/dist/docs/account-address-book.md +210 -95
  23. package/dist/docs/account-entry-point.md +4 -4
  24. package/dist/docs/account-menu.md +16 -17
  25. package/dist/docs/account-saved-cards.md +306 -0
  26. package/dist/docs/alert-dialog.md +3 -1
  27. package/dist/docs/avatar.md +4 -2
  28. package/dist/docs/billing-address.md +99 -30
  29. package/dist/docs/binding-switcher.md +157 -0
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +42 -29
  32. package/dist/docs/card-summary.md +185 -0
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +251 -0
  36. package/dist/docs/cart-item.md +48 -15
  37. package/dist/docs/cart-totalizer.md +8 -6
  38. package/dist/docs/cart.md +240 -39
  39. package/dist/docs/challenge-return.md +135 -0
  40. package/dist/docs/client-preferences-fieldset.md +10 -5
  41. package/dist/docs/client-preferences.md +31 -8
  42. package/dist/docs/client-profile-fieldset.md +20 -6
  43. package/dist/docs/client-profile.md +12 -3
  44. package/dist/docs/copy-text.md +9 -7
  45. package/dist/docs/document-field.md +1 -1
  46. package/dist/docs/email-field.md +2 -1
  47. package/dist/docs/email-identification.md +12 -2
  48. package/dist/docs/footer-copyright.md +4 -2
  49. package/dist/docs/footer-social.md +1 -1
  50. package/dist/docs/form.md +54 -18
  51. package/dist/docs/free-shipping-progress.md +18 -13
  52. package/dist/docs/identity-edit.md +8 -2
  53. package/dist/docs/identity-summary.md +18 -5
  54. package/dist/docs/incentives.md +2 -2
  55. package/dist/docs/installments.md +46 -32
  56. package/dist/docs/logo.md +1 -1
  57. package/dist/docs/my-account-profile.md +16 -11
  58. package/dist/docs/navigation-link.md +5 -3
  59. package/dist/docs/order-cancel.md +3 -1
  60. package/dist/docs/order-delivery-address.md +7 -5
  61. package/dist/docs/order-delivery-group.md +1 -3
  62. package/dist/docs/order-details-back.md +1 -1
  63. package/dist/docs/order-details-header.md +1 -4
  64. package/dist/docs/order-invoice-download.md +60 -0
  65. package/dist/docs/order-list-row.md +1 -1
  66. package/dist/docs/order-list-search.md +13 -20
  67. package/dist/docs/order-list-views.md +11 -17
  68. package/dist/docs/order-list.md +12 -5
  69. package/dist/docs/order-payment.md +9 -7
  70. package/dist/docs/order-placed-date.md +1 -1
  71. package/dist/docs/order-placed-payment-summary.md +28 -15
  72. package/dist/docs/order-placed.md +49 -14
  73. package/dist/docs/order-progress.md +1 -1
  74. package/dist/docs/order-status-badge.md +20 -9
  75. package/dist/docs/order-summary.md +2 -2
  76. package/dist/docs/order-tracking-link.md +58 -0
  77. package/dist/docs/payment-method-badges.md +32 -6
  78. package/dist/docs/payment-methods.md +2 -2
  79. package/dist/docs/payment.md +36 -17
  80. package/dist/docs/phone-field.md +4 -4
  81. package/dist/docs/place-order.md +84 -36
  82. package/dist/docs/postal-code-field.md +3 -1
  83. package/dist/docs/pricing.md +21 -23
  84. package/dist/docs/product-gallery.md +19 -20
  85. package/dist/docs/product-information.md +14 -10
  86. package/dist/docs/product-list.md +7 -6
  87. package/dist/docs/product-shelf.md +7 -1
  88. package/dist/docs/promotion.md +4 -2
  89. package/dist/docs/region.md +23 -15
  90. package/dist/docs/save-card.md +7 -6
  91. package/dist/docs/saved-cards.md +65 -36
  92. package/dist/docs/select.md +3 -4
  93. package/dist/docs/shipping-address.md +57 -21
  94. package/dist/docs/shipping-simulator.md +53 -15
  95. package/dist/docs/sign-in-disclosure.md +176 -0
  96. package/dist/docs/sign-in-form.md +78 -47
  97. package/dist/docs/sign-in-redirect.md +5 -3
  98. package/dist/docs/sign-in.md +173 -0
  99. package/dist/docs/toast.md +45 -16
  100. package/dist/docs/variant-selector.md +15 -11
  101. package/dist/graphql/types.d.ts +4 -14
  102. package/dist/index.d.ts +3 -2
  103. package/dist/internal/client.d.ts +4 -3
  104. package/dist/internal/client.js +5 -2
  105. package/dist/internal/server.d.ts +10 -5
  106. package/dist/internal/server.js +9 -4
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  108. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  109. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  110. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  111. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  112. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  113. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  114. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  115. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  116. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  117. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  118. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  120. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  121. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  122. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  123. package/dist/matter/account-address-book/account-address-book.js +74 -33
  124. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  126. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  127. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  128. package/dist/matter/account-address-book/account-address-country.js +83 -49
  129. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  131. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  132. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  133. package/dist/matter/account-address-book/account-address-form.js +518 -155
  134. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  135. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  136. package/dist/matter/account-address-book/account-address-record.js +32 -17
  137. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  138. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  139. package/dist/matter/account-menu/account-menu.js +46 -54
  140. package/dist/matter/account-menu/account-menu.js.map +1 -1
  141. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  142. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +463 -0
  143. package/dist/matter/account-saved-cards/account-saved-cards.js +1011 -0
  144. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -0
  145. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  146. package/dist/matter/billing-address/billing-address.js +227 -156
  147. package/dist/matter/billing-address/billing-address.js.map +1 -1
  148. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  149. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  150. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  151. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  152. package/dist/matter/buy-button/buy-button.js +10 -19
  153. package/dist/matter/buy-button/buy-button.js.map +1 -1
  154. package/dist/matter/card-entry/card-capture.js +12 -4
  155. package/dist/matter/card-entry/card-capture.js.map +1 -1
  156. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  157. package/dist/matter/card-entry/card-entry.js +348 -221
  158. package/dist/matter/card-entry/card-entry.js.map +1 -1
  159. package/dist/matter/cart/cart-namespace.d.ts +11 -1
  160. package/dist/matter/cart/cart-namespace.js +11 -1
  161. package/dist/matter/cart/cart-namespace.js.map +1 -1
  162. package/dist/matter/cart/cart.d.ts +416 -45
  163. package/dist/matter/cart/cart.js +782 -101
  164. package/dist/matter/cart/cart.js.map +1 -1
  165. package/dist/matter/cart-destination/cart-destination.d.ts +233 -0
  166. package/dist/matter/cart-destination/cart-destination.js +703 -0
  167. package/dist/matter/cart-destination/cart-destination.js.map +1 -0
  168. package/dist/matter/cart-item/cart-item.d.ts +145 -16
  169. package/dist/matter/cart-item/cart-item.js +230 -54
  170. package/dist/matter/cart-item/cart-item.js.map +1 -1
  171. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  172. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  173. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  174. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  175. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  176. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  177. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  178. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  179. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  180. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  181. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  182. package/dist/matter/cart-totalizer/cart-totalizer.js +49 -19
  183. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  184. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  185. package/dist/matter/challenge-return/challenge-return.js +241 -0
  186. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  187. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  188. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  189. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  190. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  191. package/dist/matter/client-preferences/client-preferences.js +84 -15
  192. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  193. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  194. package/dist/matter/client-profile/client-profile.js +64 -24
  195. package/dist/matter/client-profile/client-profile.js.map +1 -1
  196. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  197. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  198. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  199. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  200. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  201. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  202. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  203. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  204. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  205. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  206. package/dist/matter/delivery-options/delivery-options.js +75 -12
  207. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  209. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  210. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  211. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  212. package/dist/matter/email-identification/email-identification.js +49 -12
  213. package/dist/matter/email-identification/email-identification.js.map +1 -1
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +85 -10
  215. package/dist/matter/free-shipping-progress/free-shipping-progress.js +153 -53
  216. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  217. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  218. package/dist/matter/identity-edit/identity-edit.js +47 -19
  219. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  220. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  221. package/dist/matter/identity-summary/identity-summary.js +95 -45
  222. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  223. package/dist/matter/installments/installments-select.d.ts +98 -16
  224. package/dist/matter/installments/installments-select.js +156 -48
  225. package/dist/matter/installments/installments-select.js.map +1 -1
  226. package/dist/matter/installments/installments.d.ts +96 -16
  227. package/dist/matter/installments/installments.js +115 -40
  228. package/dist/matter/installments/installments.js.map +1 -1
  229. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  230. package/dist/matter/installments/use-installments-selection.js +8 -3
  231. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  232. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  233. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  234. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  235. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  236. package/dist/matter/order-cancel/order-cancel.js +118 -51
  237. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  238. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  239. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  240. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  241. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  242. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  243. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  244. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  245. package/dist/matter/order-details-header/order-details-header.js +66 -58
  246. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  247. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  248. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  249. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  250. package/dist/matter/order-list/order-list.d.ts +164 -19
  251. package/dist/matter/order-list/order-list.js +229 -87
  252. package/dist/matter/order-list/order-list.js.map +1 -1
  253. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  254. package/dist/matter/order-list-row/order-list-row.js +3 -2
  255. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  256. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  257. package/dist/matter/order-list-search/order-list-search.js +30 -69
  258. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  259. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  260. package/dist/matter/order-list-views/order-list-views.js +22 -68
  261. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  262. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  263. package/dist/matter/order-payment/order-payment.js +44 -39
  264. package/dist/matter/order-payment/order-payment.js.map +1 -1
  265. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  266. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  267. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  268. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  269. package/dist/matter/order-placed/order-placed.js +230 -139
  270. package/dist/matter/order-placed/order-placed.js.map +1 -1
  271. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  272. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  273. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  275. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  276. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  277. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  278. package/dist/matter/order-progress/order-progress.js +37 -45
  279. package/dist/matter/order-progress/order-progress.js.map +1 -1
  280. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  281. package/dist/matter/order-summary/order-summary.js +38 -44
  282. package/dist/matter/order-summary/order-summary.js.map +1 -1
  283. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  284. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  285. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  286. package/dist/matter/payment/payment-card-capture.js +17 -10
  287. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  288. package/dist/matter/payment/payment-controller.d.ts +4 -2
  289. package/dist/matter/payment/payment-controller.js +30 -9
  290. package/dist/matter/payment/payment-controller.js.map +1 -1
  291. package/dist/matter/payment/payment-method-badges.js +1 -1
  292. package/dist/matter/payment/payment.d.ts +69 -19
  293. package/dist/matter/payment/payment.js +101 -35
  294. package/dist/matter/payment/payment.js.map +1 -1
  295. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  296. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  297. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  298. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  299. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  300. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  301. package/dist/matter/place-order/place-order.d.ts +171 -57
  302. package/dist/matter/place-order/place-order.js +376 -185
  303. package/dist/matter/place-order/place-order.js.map +1 -1
  304. package/dist/matter/pricing/pricing.d.ts +152 -13
  305. package/dist/matter/pricing/pricing.js +153 -52
  306. package/dist/matter/pricing/pricing.js.map +1 -1
  307. package/dist/matter/product-information/product-information.d.ts +27 -4
  308. package/dist/matter/product-information/product-information.js +32 -15
  309. package/dist/matter/product-information/product-information.js.map +1 -1
  310. package/dist/matter/product-list/product-list.d.ts +24 -6
  311. package/dist/matter/product-list/product-list.js +32 -26
  312. package/dist/matter/product-list/product-list.js.map +1 -1
  313. package/dist/matter/product-shelf/product-shelf.d.ts +8 -3
  314. package/dist/matter/product-shelf/product-shelf.js +111 -10
  315. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  316. package/dist/matter/region/region.d.ts +33 -16
  317. package/dist/matter/region/region.js +59 -52
  318. package/dist/matter/region/region.js.map +1 -1
  319. package/dist/matter/save-card/save-card.d.ts +43 -8
  320. package/dist/matter/save-card/save-card.js +61 -23
  321. package/dist/matter/save-card/save-card.js.map +1 -1
  322. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  323. package/dist/matter/saved-cards/saved-cards.js +349 -77
  324. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  325. package/dist/matter/shipping-address/address-payload.js +25 -0
  326. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  327. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  328. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  329. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  330. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  331. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  332. package/dist/matter/shipping-address/shipping-address.js +443 -188
  333. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  334. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +251 -25
  335. package/dist/matter/shipping-simulator/shipping-simulator.js +261 -51
  336. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  337. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  338. package/dist/matter/sign-in/sign-in.js +285 -0
  339. package/dist/matter/sign-in/sign-in.js.map +1 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  341. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  342. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  343. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  344. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  345. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  346. package/dist/particles/binding-switcher/binding-switcher.d.ts +59 -0
  347. package/dist/particles/binding-switcher/binding-switcher.js +194 -0
  348. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -0
  349. package/dist/particles/card-summary/card-network.d.ts +17 -0
  350. package/dist/particles/card-summary/card-network.js +25 -0
  351. package/dist/particles/card-summary/card-network.js.map +1 -0
  352. package/dist/particles/card-summary/card-summary.d.ts +113 -0
  353. package/dist/particles/card-summary/card-summary.js +221 -0
  354. package/dist/particles/card-summary/card-summary.js.map +1 -0
  355. package/dist/particles/carousel/carousel.d.ts +99 -11
  356. package/dist/particles/carousel/carousel.js +103 -35
  357. package/dist/particles/carousel/carousel.js.map +1 -1
  358. package/dist/particles/copy-text/copy-text.js +5 -15
  359. package/dist/particles/copy-text/copy-text.js.map +1 -1
  360. package/dist/particles/dialog/dialog.d.ts +14 -6
  361. package/dist/particles/dialog/dialog.js +6 -3
  362. package/dist/particles/dialog/dialog.js.map +1 -1
  363. package/dist/particles/drawer/drawer.js +1 -1
  364. package/dist/particles/drawer/drawer.js.map +1 -1
  365. package/dist/particles/email-field/email-field.d.ts +2 -1
  366. package/dist/particles/email-field/email-field.js +2 -1
  367. package/dist/particles/email-field/email-field.js.map +1 -1
  368. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  369. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  370. package/dist/particles/footer-social/footer-social.d.ts +1 -1
  371. package/dist/particles/footer-social/footer-social.js +1 -1
  372. package/dist/particles/footer-social/footer-social.js.map +1 -1
  373. package/dist/particles/form/form.d.ts +85 -13
  374. package/dist/particles/form/form.js +91 -42
  375. package/dist/particles/form/form.js.map +1 -1
  376. package/dist/particles/gallery/gallery.d.ts +129 -12
  377. package/dist/particles/gallery/gallery.js +121 -34
  378. package/dist/particles/gallery/gallery.js.map +1 -1
  379. package/dist/particles/incentives/incentives.d.ts +1 -1
  380. package/dist/particles/incentives/incentives.js +1 -1
  381. package/dist/particles/incentives/incentives.js.map +1 -1
  382. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  383. package/dist/particles/order-details-back/order-details-back.js +8 -10
  384. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  385. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  386. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  387. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  388. package/dist/particles/password-field/password-field.d.ts +1 -1
  389. package/dist/particles/password-field/password-field.js +2 -4
  390. package/dist/particles/password-field/password-field.js.map +1 -1
  391. package/dist/particles/payment-methods/payment-methods.d.ts +1 -1
  392. package/dist/particles/payment-methods/payment-methods.js +1 -1
  393. package/dist/particles/payment-methods/payment-methods.js.map +1 -1
  394. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  395. package/dist/particles/phone-field/phone-field.js +8 -11
  396. package/dist/particles/phone-field/phone-field.js.map +1 -1
  397. package/dist/particles/spinner/spinner.d.ts +24 -4
  398. package/dist/particles/spinner/spinner.js +25 -9
  399. package/dist/particles/spinner/spinner.js.map +1 -1
  400. package/dist/particles/switch/switch.d.ts +4 -1
  401. package/dist/particles/switch/switch.js +3 -1
  402. package/dist/particles/switch/switch.js.map +1 -1
  403. package/dist/particles/toast/toast.d.ts +49 -9
  404. package/dist/particles/toast/toast.js +81 -15
  405. package/dist/particles/toast/toast.js.map +1 -1
  406. package/dist/schema.graphql +461 -89
  407. package/dist/sdk/actions/index.d.ts +3 -1
  408. package/dist/sdk/actions/index.js +3 -1
  409. package/dist/sdk/actions/locale-action-provider.d.ts +16 -0
  410. package/dist/sdk/actions/locale-action-provider.js +20 -0
  411. package/dist/sdk/actions/locale-action-provider.js.map +1 -0
  412. package/dist/sdk/actions/saved-card-action-provider.d.ts +12 -0
  413. package/dist/sdk/actions/saved-card-action-provider.js +16 -0
  414. package/dist/sdk/actions/saved-card-action-provider.js.map +1 -0
  415. package/dist/sdk/actions/types.d.ts +6 -2
  416. package/dist/sdk/address/address-fields.js +4 -4
  417. package/dist/sdk/address/address-fields.js.map +1 -1
  418. package/dist/sdk/address/constants.js +1 -6
  419. package/dist/sdk/address/constants.js.map +1 -1
  420. package/dist/sdk/address/messages.js +44 -44
  421. package/dist/sdk/address/messages.js.map +1 -1
  422. package/dist/sdk/address/postal-code.js +15 -2
  423. package/dist/sdk/address/postal-code.js.map +1 -1
  424. package/dist/sdk/address/types.d.ts +5 -3
  425. package/dist/sdk/address/validate-address.js +3 -3
  426. package/dist/sdk/address/validate-address.js.map +1 -1
  427. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  428. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  429. package/dist/sdk/cache/storefront-cache.js +2 -1
  430. package/dist/sdk/cache/storefront-cache.js.map +1 -1
  431. package/dist/sdk/cart/operations.d.ts +2 -1
  432. package/dist/sdk/cart/operations.js +55 -1
  433. package/dist/sdk/cart/operations.js.map +1 -1
  434. package/dist/sdk/cart/optimistic.d.ts +30 -7
  435. package/dist/sdk/cart/optimistic.js +78 -41
  436. package/dist/sdk/cart/optimistic.js.map +1 -1
  437. package/dist/sdk/cart/use-cart-actions.d.ts +7 -0
  438. package/dist/sdk/cart/use-cart-actions.js +61 -15
  439. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  440. package/dist/sdk/cart/use-cart-sync-sales-channel.js +70 -0
  441. package/dist/sdk/cart/use-cart-sync-sales-channel.js.map +1 -0
  442. package/dist/sdk/data/index.js +2 -2
  443. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  444. package/dist/sdk/generated/gql.js +16 -12
  445. package/dist/sdk/generated/gql.js.map +1 -1
  446. package/dist/sdk/generated/graphql.d.ts +197 -51
  447. package/dist/sdk/generated/graphql.js +2318 -91
  448. package/dist/sdk/generated/graphql.js.map +1 -1
  449. package/dist/sdk/i18n/format-error-code.js +23 -0
  450. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  451. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  452. package/dist/sdk/i18n/message-formatter.js +140 -0
  453. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  454. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  455. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  456. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  457. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  458. package/dist/sdk/locale/binding-switch-provider.d.ts +13 -0
  459. package/dist/sdk/locale/binding-switch-provider.js +20 -0
  460. package/dist/sdk/locale/binding-switch-provider.js.map +1 -0
  461. package/dist/sdk/locale/use-locale-actions.d.ts +16 -0
  462. package/dist/sdk/locale/use-locale-actions.js +70 -0
  463. package/dist/sdk/locale/use-locale-actions.js.map +1 -0
  464. package/dist/sdk/navigation/binding-switch.d.ts +39 -0
  465. package/dist/sdk/navigation/binding-switch.js +129 -0
  466. package/dist/sdk/navigation/binding-switch.js.map +1 -0
  467. package/dist/sdk/navigation/decode-route-params.d.ts +11 -0
  468. package/dist/sdk/navigation/decode-route-params.js +32 -0
  469. package/dist/sdk/navigation/decode-route-params.js.map +1 -0
  470. package/dist/sdk/navigation/redirect.d.ts +2 -0
  471. package/dist/sdk/navigation/redirect.js +19 -1
  472. package/dist/sdk/navigation/redirect.js.map +1 -1
  473. package/dist/sdk/navigation/types.d.ts +13 -0
  474. package/dist/sdk/payment/bin-format.js +20 -0
  475. package/dist/sdk/payment/bin-format.js.map +1 -0
  476. package/dist/sdk/payment/challenge-return.js +37 -0
  477. package/dist/sdk/payment/challenge-return.js.map +1 -0
  478. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  479. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  480. package/dist/sdk/payment/gateway.d.ts +1 -1
  481. package/dist/sdk/payment/gateway.js +8 -2
  482. package/dist/sdk/payment/gateway.js.map +1 -1
  483. package/dist/sdk/payment/operations.d.ts +1 -0
  484. package/dist/sdk/payment/operations.js +28 -6
  485. package/dist/sdk/payment/operations.js.map +1 -1
  486. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  487. package/dist/sdk/payment/resumed-purchase.js +119 -0
  488. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  489. package/dist/sdk/payment/security-code-mask.js +16 -23
  490. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  491. package/dist/sdk/payment/submission-registry.js +6 -2
  492. package/dist/sdk/payment/submission-registry.js.map +1 -1
  493. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  494. package/dist/sdk/payment/use-payment-actions.js +23 -3
  495. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  496. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  497. package/dist/sdk/payment/use-place-order.js +138 -76
  498. package/dist/sdk/payment/use-place-order.js.map +1 -1
  499. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  500. package/dist/sdk/provider/storefront-provider.js +4 -11
  501. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  502. package/dist/sdk/saved-cards/operations.d.ts +16 -0
  503. package/dist/sdk/saved-cards/operations.js +41 -0
  504. package/dist/sdk/saved-cards/operations.js.map +1 -0
  505. package/dist/sdk/saved-cards/use-saved-card-actions.d.ts +26 -0
  506. package/dist/sdk/saved-cards/use-saved-card-actions.js +86 -0
  507. package/dist/sdk/saved-cards/use-saved-card-actions.js.map +1 -0
  508. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  509. package/dist/sdk/seo/entity-landing.js +30 -0
  510. package/dist/sdk/seo/entity-landing.js.map +1 -0
  511. package/dist/sdk/seo/page-alternates.d.ts +8 -5
  512. package/dist/sdk/seo/page-alternates.js +11 -14
  513. package/dist/sdk/seo/page-alternates.js.map +1 -1
  514. package/dist/sdk/seo/search-landing.d.ts +42 -0
  515. package/dist/sdk/seo/search-landing.js +85 -0
  516. package/dist/sdk/seo/search-landing.js.map +1 -0
  517. package/dist/sdk/session/mock-session.d.ts +9 -0
  518. package/dist/sdk/session/mock-session.js +31 -0
  519. package/dist/sdk/session/mock-session.js.map +1 -0
  520. package/dist/sdk/session/read-server-session.d.ts +3 -0
  521. package/dist/sdk/session/read-server-session.js +5 -0
  522. package/dist/sdk/session/read-server-session.js.map +1 -1
  523. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  524. package/dist/sdk/session/return-path-segment.js +15 -0
  525. package/dist/sdk/session/return-path-segment.js.map +1 -0
  526. package/dist/sdk/session/use-session-actions.js.map +1 -1
  527. package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
  528. package/dist/sdk/shipping/shipping-operations.js +13 -0
  529. package/dist/sdk/shipping/shipping-operations.js.map +1 -1
  530. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  531. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  532. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  533. package/dist/sdk/state/cart.d.ts +9 -2
  534. package/dist/sdk/state/cart.js +9 -2
  535. package/dist/sdk/state/cart.js.map +1 -1
  536. package/dist/utils/safe-href.d.ts +2 -0
  537. package/package.json +4 -3
  538. package/skills/storefront-asset/SKILL.md +2 -2
  539. package/skills/storefront-asset/references/api-side.md +27 -14
  540. package/skills/storefront-asset/references/findings.md +5 -2
  541. package/src/styles/tailwind.css +9 -2
  542. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  543. package/dist/message-locales.json +0 -7
  544. package/dist/sdk/i18n/client.d.ts +0 -4
  545. package/dist/sdk/i18n/client.js +0 -4
  546. package/dist/sdk/i18n/locales.d.ts +0 -8
  547. package/dist/sdk/i18n/locales.js +0 -57
  548. package/dist/sdk/i18n/locales.js.map +0 -1
  549. package/dist/sdk/i18n/messages/en-US.js +0 -164
  550. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  551. package/dist/sdk/i18n/messages/en-US.json +0 -159
  552. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -163
  553. package/dist/sdk/i18n/messages/es-ES.js +0 -164
  554. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  555. package/dist/sdk/i18n/messages/es-ES.json +0 -159
  556. package/dist/sdk/i18n/messages/pt-BR.js +0 -164
  557. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  558. package/dist/sdk/i18n/messages/pt-BR.json +0 -159
  559. package/dist/sdk/i18n/provider.d.ts +0 -1
  560. package/dist/sdk/i18n/provider.js +0 -30
  561. package/dist/sdk/i18n/provider.js.map +0 -1
  562. package/dist/sdk/i18n/server.d.ts +0 -28
  563. package/dist/sdk/i18n/server.js +0 -59
  564. package/dist/sdk/i18n/server.js.map +0 -1
  565. package/dist/utils/resolve-authored-copy.js +0 -18
  566. package/dist/utils/resolve-authored-copy.js.map +0 -1
  567. package/dist/utils/substitute-template.js +0 -33
  568. package/dist/utils/substitute-template.js.map +0 -1
@@ -2,23 +2,29 @@
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
3
  import { defineContentType } from "../../core/dist/define-content-type.js";
4
4
  import "../../core/dist/index.js";
5
+ import { resolveSafeHref } from "../../utils/safe-href.js";
5
6
  import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
7
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
6
8
  import { useStorefrontNavigation } from "../../sdk/navigation/use-storefront-navigation.js";
7
9
  import { graphql } from "../../sdk/generated/gql.js";
8
10
  import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
11
+ import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
9
12
  import { useDataOverride } from "../../sdk/data/data-override-context.js";
13
+ import { loggableErrorName } from "../../utils/loggable-error-name.js";
14
+ import { ReactiveRootContext } from "../../sdk/data/page-reactive-data-root.js";
10
15
  import { NavigationLink } from "../../particles/navigation-link/navigation-link.js";
11
16
  import { ListItemRefContext } from "../../sdk/data/list-item-ref-context.js";
12
- import { ReactiveRootContext } from "../../sdk/data/page-reactive-data-root.js";
17
+ import { useOptionalToast } from "../../particles/toast/toast.js";
13
18
  import { Icon } from "../../particles/icon/icon.js";
14
19
  import { DrawerClose } from "../../particles/drawer/drawer.js";
15
20
  import { Image } from "../../particles/image/image.js";
16
21
  import { cartCouponErrorsVar, cartLastAddVar, cartUserErrorsVar, miniCartOpenVar, orderFormIdVar } from "../../sdk/state/cart.js";
17
22
  import { awaitCartWrites } from "../../sdk/cart/write-gate.js";
18
23
  import { readCartFromCache } from "../../sdk/cart/use-cart-actions.js";
24
+ import { useCartSyncSalesChannel } from "../../sdk/cart/use-cart-sync-sales-channel.js";
19
25
  import { useCartValidateOnOpen } from "../../sdk/cart/use-cart-validate-on-open.js";
20
- import { useApolloClient, useReactiveVar } from "@apollo/client/react";
21
- import { cloneElement, createContext, isValidElement, useContext, useEffect, useMemo, useRef, useState } from "react";
26
+ import { getApolloContext, useApolloClient, useReactiveVar } from "@apollo/client/react";
27
+ import { cloneElement, createContext, isValidElement, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
22
28
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
23
29
  import { useLinkStatus } from "next/link";
24
30
  //#region src/matter/cart/cart.tsx
@@ -40,18 +46,246 @@ const CartDisclaimerContent = defineContentType({
40
46
  const CartCheckoutLabelContent = defineContentType({
41
47
  id: "cart-checkout-label",
42
48
  title: "Cart Checkout Label",
43
- description: "Editorial label for the checkout call to action.",
49
+ description: "Label for the checkout call to action.",
44
50
  schema: {
45
51
  type: "object",
46
52
  additionalProperties: false,
47
- required: ["label"],
48
53
  properties: { label: {
49
54
  type: "string",
50
55
  minLength: 1,
51
- title: "Checkout label"
56
+ title: "Checkout label",
57
+ format: "icu-message",
58
+ messageSource: "Checkout"
59
+ } }
60
+ }
61
+ });
62
+ const CartCountContent = defineContentType({
63
+ id: "cart-count",
64
+ title: "Cart Count",
65
+ description: "Text of the cart item count.",
66
+ schema: {
67
+ type: "object",
68
+ additionalProperties: false,
69
+ properties: { template: {
70
+ type: "string",
71
+ title: "Item count",
72
+ format: "icu-message",
73
+ messageSource: "{count}",
74
+ messageArguments: {
75
+ type: "object",
76
+ properties: { count: { type: "integer" } }
77
+ },
78
+ messageExample: { count: 3 }
52
79
  } }
53
80
  }
54
81
  });
82
+ const CartCouponFormContent = defineContentType({
83
+ id: "cart-coupon-form",
84
+ title: "Cart Coupon Form",
85
+ description: "Copy for the coupon code input, its apply button and the applied toast.",
86
+ schema: {
87
+ type: "object",
88
+ additionalProperties: false,
89
+ properties: {
90
+ placeholder: {
91
+ type: "string",
92
+ title: "Input placeholder",
93
+ description: "Also the accessible name of the input.",
94
+ format: "icu-message",
95
+ messageSource: "Coupon code"
96
+ },
97
+ applyLabel: {
98
+ type: "string",
99
+ title: "Apply button label",
100
+ format: "icu-message",
101
+ messageSource: "Apply"
102
+ },
103
+ appliedMessage: {
104
+ type: "string",
105
+ title: "Applied toast title",
106
+ description: "Raised after an apply whose code comes back matched; blank raises no toast.",
107
+ format: "icu-message",
108
+ messageSource: "Coupon applied"
109
+ }
110
+ }
111
+ }
112
+ });
113
+ const CartAppliedCouponsContent = defineContentType({
114
+ id: "cart-applied-coupons",
115
+ title: "Cart Applied Coupons",
116
+ description: "Copy for the built-in remove control of each applied coupon chip.",
117
+ schema: {
118
+ type: "object",
119
+ additionalProperties: false,
120
+ properties: { removeLabel: {
121
+ type: "string",
122
+ title: "Remove control accessible label",
123
+ format: "icu-message",
124
+ messageSource: "Remove coupon {code}",
125
+ messageArguments: {
126
+ type: "object",
127
+ properties: { code: { type: "string" } }
128
+ },
129
+ messageExample: { code: "SAVE10" }
130
+ } }
131
+ }
132
+ });
133
+ const CartCouponUnmatchedContent = defineContentType({
134
+ id: "cart-coupon-unmatched",
135
+ title: "Cart Coupon Unmatched",
136
+ description: "Notice shown on an applied coupon whose conditions do not match the cart.",
137
+ schema: {
138
+ type: "object",
139
+ additionalProperties: false,
140
+ properties: { message: {
141
+ type: "string",
142
+ title: "Notice",
143
+ format: "icu-message",
144
+ messageSource: "This coupon is not being applied to your cart"
145
+ } }
146
+ }
147
+ });
148
+ const CartCouponSavingsContent = defineContentType({
149
+ id: "cart-coupon-savings",
150
+ title: "Cart Coupon Savings",
151
+ description: "Text of the amount an applied coupon saves.",
152
+ schema: {
153
+ type: "object",
154
+ additionalProperties: false,
155
+ properties: { template: {
156
+ type: "string",
157
+ title: "Savings text",
158
+ description: "`amount` is the formatted saving.",
159
+ format: "icu-message",
160
+ messageSource: "{amount}",
161
+ messageArguments: {
162
+ type: "object",
163
+ properties: { amount: { type: "string" } }
164
+ },
165
+ messageExample: { amount: "-$10.00" }
166
+ } }
167
+ }
168
+ });
169
+ const CartUnavailableCountContent = defineContentType({
170
+ id: "cart-unavailable-count",
171
+ title: "Cart Unavailable Count",
172
+ description: "Summary of how many cart lines are unavailable.",
173
+ schema: {
174
+ type: "object",
175
+ additionalProperties: false,
176
+ properties: { template: {
177
+ type: "string",
178
+ title: "Unavailable count",
179
+ format: "icu-message",
180
+ messageSource: "{count, plural, one {# item unavailable} other {# items unavailable}}",
181
+ messageArguments: {
182
+ type: "object",
183
+ properties: { count: { type: "integer" } }
184
+ },
185
+ messageExample: { count: 2 }
186
+ } }
187
+ }
188
+ });
189
+ const CartRemoveUnavailableContent = defineContentType({
190
+ id: "cart-remove-unavailable",
191
+ title: "Cart Remove Unavailable",
192
+ description: "Label for the button that removes every unavailable cart line.",
193
+ schema: {
194
+ type: "object",
195
+ additionalProperties: false,
196
+ properties: { label: {
197
+ type: "string",
198
+ title: "Button label",
199
+ format: "icu-message",
200
+ messageSource: "Remove unavailable items"
201
+ } }
202
+ }
203
+ });
204
+ const ClearCartButtonContent = defineContentType({
205
+ id: "clear-cart-button",
206
+ title: "Clear Cart Button",
207
+ description: "Label for the button that removes every cart line.",
208
+ schema: {
209
+ type: "object",
210
+ additionalProperties: false,
211
+ properties: { label: {
212
+ type: "string",
213
+ title: "Button label",
214
+ format: "icu-message",
215
+ messageSource: "Clear cart"
216
+ } }
217
+ }
218
+ });
219
+ const CartErrorContent = defineContentType({
220
+ id: "cart-error",
221
+ title: "Cart Error",
222
+ description: "Messages shown when a cart item write is refused, one per error code the shopper can act on.",
223
+ schema: {
224
+ type: "object",
225
+ additionalProperties: false,
226
+ properties: {
227
+ invalidQuantityMessage: {
228
+ type: "string",
229
+ title: "Invalid quantity message",
230
+ description: "Shown when the requested quantity is not accepted.",
231
+ format: "icu-message",
232
+ messageSource: "Choose a valid quantity."
233
+ },
234
+ itemNotFoundMessage: {
235
+ type: "string",
236
+ title: "Item not found message",
237
+ description: "Shown when the item is no longer in the cart.",
238
+ format: "icu-message",
239
+ messageSource: "This item is no longer in your cart."
240
+ },
241
+ genericErrorMessage: {
242
+ type: "string",
243
+ title: "Generic failure message",
244
+ description: "Shown for a network failure and for every refusal the shopper cannot act on.",
245
+ format: "icu-message",
246
+ messageSource: "Unable to update cart. Please try again."
247
+ }
248
+ }
249
+ }
250
+ });
251
+ const CartCouponErrorContent = defineContentType({
252
+ id: "cart-coupon-error",
253
+ title: "Cart Coupon Error",
254
+ description: "Messages shown when a coupon apply or remove is refused, one per error code the shopper can act on.",
255
+ schema: {
256
+ type: "object",
257
+ additionalProperties: false,
258
+ properties: {
259
+ couponNotFoundMessage: {
260
+ type: "string",
261
+ title: "Coupon not found message",
262
+ description: "Shown when the code is unknown or not accepted by this cart.",
263
+ format: "icu-message",
264
+ messageSource: "This coupon is not valid for your cart."
265
+ },
266
+ couponExpiredMessage: {
267
+ type: "string",
268
+ title: "Coupon expired message",
269
+ format: "icu-message",
270
+ messageSource: "This coupon has expired."
271
+ },
272
+ couponNotCombinedMessage: {
273
+ type: "string",
274
+ title: "Coupon not combined message",
275
+ description: "Shown when the code is refused while another coupon is applied. The platform does not say whether the code is unknown or cannot be combined.",
276
+ format: "icu-message",
277
+ messageSource: "This coupon cannot be used with the coupons already applied."
278
+ },
279
+ genericErrorMessage: {
280
+ type: "string",
281
+ title: "Generic failure message",
282
+ description: "Shown for a network failure and for every refusal the shopper cannot act on.",
283
+ format: "icu-message",
284
+ messageSource: "Unable to update your coupons. Please try again."
285
+ }
286
+ }
287
+ }
288
+ });
55
289
  const fragment = graphql(`
56
290
  fragment CartData on Query {
57
291
  cart {
@@ -88,6 +322,17 @@ const fragment = graphql(`
88
322
  code
89
323
  isUnmatchedCondition
90
324
  }
325
+ discounts {
326
+ name
327
+ value {
328
+ ...MoneyFragment
329
+ }
330
+ kind
331
+ }
332
+ salesChannelMismatch {
333
+ cartSalesChannel
334
+ activeSalesChannel
335
+ }
91
336
  }
92
337
  }
93
338
  `);
@@ -97,6 +342,17 @@ function formatPrice(value, locale, currency) {
97
342
  currency
98
343
  }).format(value);
99
344
  }
345
+ /**
346
+ * True when a money amount can be read as a number: a finite `number` (the optimistic-cache shape) or
347
+ * a non-blank string `Number` parses to a finite value (the wire shape, a decimal string). Blank and
348
+ * nullish amounts are rejected before `Number()` runs, because `Number('')` and `Number(null)` are `0`
349
+ * and would turn a missing amount into a real zero.
350
+ */
351
+ function isFiniteAmount(value) {
352
+ if (typeof value === "number") return Number.isFinite(value);
353
+ if (typeof value === "string") return value.trim() !== "" && Number.isFinite(Number(value));
354
+ return false;
355
+ }
100
356
  const CartTotalValueContext = createContext(null);
101
357
  const CART_DATA_UNSET = Symbol("CartDataContextUnset");
102
358
  const CartDataContextInternal = createContext(CART_DATA_UNSET);
@@ -126,7 +382,8 @@ const CartRootDefinition = defineComponent({
126
382
  category: "commerce"
127
383
  },
128
384
  schema: {},
129
- guideline: "Cart data provider hosted by the layout (shared shell), wrapping the slot so every page consumes its context; exactly one per tree — do not place it as a page root. To build a mini-cart, wrap this CartRoot subtree in a modal DrawerRoot: the header carries a DrawerTrigger with a CartCount badge, the DrawerPopup body is a CartList line-item template, and its footer is CartTotal plus CartGoCheckout. The mini-cart is this layout composition, not a dedicated component. See cart.md."
385
+ actions: { cart: ["syncSalesChannel"] },
386
+ guideline: "Cart data provider hosted by the layout (shared shell), wrapping the slot so every page consumes its context; exactly one per tree — do not place it as a page root. To build a mini-cart, wrap this CartRoot subtree in a modal DrawerRoot: the header carries a DrawerTrigger with a CartCount badge, the DrawerPopup body is a CartList line-item template, and its footer is CartTotal plus CartGoCheckout. The mini-cart is this layout composition, not a dedicated component. See cart.md. On load, a cart whose sales channel differs from the request is moved onto the active channel."
130
387
  });
131
388
  const CartListDefinition = defineComponent({
132
389
  name: "CartList",
@@ -144,6 +401,34 @@ const CartListDefinition = defineComponent({
144
401
  providesContext: "cart-item",
145
402
  guideline: "Renders its children once per cart item; wrap the line-item template in a CartItemRoot and place CartItem* components inside it to define the template (e.g. CartItemImage, CartItemName, CartItemPrice, a CartItemQuantity stepper, CartItemRemove). While the cart is loading it renders skeletonCount CartItemSkeleton placeholders instead. In a mini-cart it is the scrollable body of the DrawerPopup. Must be inside CartRoot."
146
403
  });
404
+ const CartAvailableItemsDefinition = defineComponent({
405
+ name: "CartAvailableItems",
406
+ importPath: "@vtex/faststore/components",
407
+ component: CartAvailableItems,
408
+ editor: {
409
+ label: "Cart Available Items",
410
+ category: "commerce"
411
+ },
412
+ schema: { skeletonCount: {
413
+ type: "number",
414
+ default: 3,
415
+ label: "Skeleton Count"
416
+ } },
417
+ providesContext: "cart-item",
418
+ guideline: "Renders its children once per purchasable cart line (availability AVAILABLE); wrap the line-item template in a CartItemRoot. Place it under CartFilled in the place of CartList, together with CartUnavailableSection for the lines the shopper cannot buy; do not compose CartList beside it. Gift lines follow their availability. Renders skeletonCount skeletons while the cart is loading and nothing when no line is purchasable. Must be inside CartRoot. See cart.md."
419
+ });
420
+ const CartUnavailableItemsDefinition = defineComponent({
421
+ name: "CartUnavailableItems",
422
+ importPath: "@vtex/faststore/components",
423
+ component: CartUnavailableItems,
424
+ editor: {
425
+ label: "Cart Unavailable Items",
426
+ category: "commerce"
427
+ },
428
+ schema: {},
429
+ providesContext: "cart-item",
430
+ guideline: "Renders its children once per unavailable cart line (any availability other than AVAILABLE); wrap the line-item template in a CartItemRoot and compose the line leaves (for example CartItemImage, CartItemName, CartItemVariations, CartItemRemove), adding CartItemUnavailable only when the line itself must state its reason. Renders nothing when no line is unavailable or while the cart is loading. Place it inside CartUnavailableSection after its header. Gift lines follow their availability and show no per-line remove. Must be inside CartRoot. See cart.md."
431
+ });
147
432
  const CartTotalDefinition = defineComponent({
148
433
  name: "CartTotal",
149
434
  importPath: "@vtex/faststore/components",
@@ -162,27 +447,25 @@ const CartCountDefinition = defineComponent({
162
447
  name: "CartCount",
163
448
  importPath: "@vtex/faststore/components",
164
449
  component: CartCount,
450
+ content: CartCountContent,
165
451
  editor: {
166
452
  label: "Cart Count",
167
453
  category: "commerce"
168
454
  },
169
- schema: { template: {
170
- type: "string",
171
- default: "{count}",
172
- label: "Template"
173
- } },
174
- guideline: "Renders the total item count in the cart; use the template prop to customize the format (e.g. '{count} produtos'). Gift lines are excluded from the count — a promotional gift is not something the shopper added — so a cart holding only gifts shows 0. In a mini-cart, place it as the badge on the header DrawerTrigger and again in the DrawerPopup header. Must be inside CartRoot."
455
+ schema: {},
456
+ guideline: "Renders the total item count in the cart; the text comes from the $content field template, an ICU message with a count argument (e.g. '{count, plural, =1 {# produto} other {# produtos}}'). A count that is not a finite number renders nothing. Gift lines are excluded from the count — a promotional gift is not something the shopper added — so a cart holding only gifts shows 0. In a mini-cart, place it as the badge on the header DrawerTrigger and again in the DrawerPopup header. Must be inside CartRoot."
175
457
  });
176
458
  const CartErrorDefinition = defineComponent({
177
459
  name: "CartError",
178
460
  importPath: "@vtex/faststore/components",
179
461
  component: CartError,
462
+ content: CartErrorContent,
180
463
  editor: {
181
464
  label: "Cart Error",
182
465
  category: "commerce"
183
466
  },
184
467
  schema: {},
185
- guideline: "Inline error banner that surfaces cart mutation errors. Must be inside CartRoot."
468
+ guideline: "Inline error banner that surfaces cart item write errors; renders nothing when there are none. Words each error code from its $content (genericErrorMessage for a network failure, every refusal the shopper cannot act on, and an unknown code). Authored children replace the message. Must be inside CartRoot."
186
469
  });
187
470
  const CartGoCheckoutDefinition = defineComponent({
188
471
  name: "CartGoCheckout",
@@ -193,53 +476,39 @@ const CartGoCheckoutDefinition = defineComponent({
193
476
  label: "Cart Go Checkout",
194
477
  category: "commerce"
195
478
  },
196
- schema: {
197
- href: {
198
- type: "link",
199
- default: { standard: "checkout" },
200
- label: "Checkout URL"
201
- },
202
- label: {
203
- type: "string",
204
- default: "Checkout",
205
- label: "Checkout label"
206
- }
207
- },
479
+ schema: { href: {
480
+ type: "link",
481
+ default: { standard: "checkout" },
482
+ label: "Checkout URL"
483
+ } },
208
484
  actions: { cart: ["validate"] },
209
- guideline: "Navigation link to the checkout page (default href the checkout page); use as the checkout CTA inside the cart summary. In a mini-cart it is the DrawerPopup footer CTA, next to CartTotal. The button wording is merchant-editable content: a CMS entry wins, then the label prop (default \"Checkout\"), then children — so a store that labels the button through children keeps working and a CMS save overrides it without a deploy. The destination is not content-editable: href stays an authored prop, because re-pointing checkout is not a copy decision. Before routing it runs a stock validation and only navigates when the re-checked cart has no unavailable line; a validation that cannot run falls open and navigates anyway. During a client-side route transition to checkout it surfaces a loading state on its content wrapper as aria-busy plus data-fs-cart-go-checkout-pending, and while the pre-checkout validation runs it exposes data-fs-cart-go-checkout-validating — there is no built-in spinner, so opt into one by styling those attributes (e.g. composing a Spinner). For an external or hard checkout navigation there is no client-side transition, so the loading state simply does not show (a graceful no-op). The enriched footer checkout CTA is CartCheckoutGuard wrapping CartTotal and this CartGoCheckout: the guard makes the CTA inert (data-fs-cart-checkout-blocked) while any item is unavailable, and CartTotal shows the grand total at the button. Must be inside CartRoot."
485
+ guideline: "Navigation link to the checkout page (default href the checkout page); use as the checkout CTA inside the cart summary. In a mini-cart it is the DrawerPopup footer CTA, next to CartTotal. Composed children are the button content; without them the text comes from the $content field label. The destination is not content-editable: href stays an authored prop, because re-pointing checkout is not a copy decision. Before routing it runs a stock validation and only navigates when the re-checked cart has no unavailable line; a validation that cannot run falls open and navigates anyway. When it leaves for the checkout it closes the mini-cart drawer it sits in, so do not wrap it in DrawerClose. During a client-side route transition to checkout it surfaces a loading state on its content wrapper as aria-busy plus data-fs-cart-go-checkout-pending, and while the pre-checkout validation runs it exposes data-fs-cart-go-checkout-validating — there is no built-in spinner, so opt into one by styling those attributes (e.g. composing a Spinner). For an external or hard checkout navigation there is no client-side transition, so the loading state simply does not show (a graceful no-op). The enriched footer checkout CTA is CartCheckoutGuard wrapping CartTotal and this CartGoCheckout: the guard makes the CTA inert (data-fs-cart-checkout-blocked) while any item is unavailable, and CartTotal shows the grand total at the button. Must be inside CartRoot."
210
486
  });
211
487
  const CartCouponFormDefinition = defineComponent({
212
488
  name: "CartCouponForm",
213
489
  importPath: "@vtex/faststore/components",
214
490
  component: CartCouponForm,
491
+ content: CartCouponFormContent,
215
492
  editor: {
216
493
  label: "Cart Coupon Form",
217
494
  category: "commerce"
218
495
  },
219
- schema: {
220
- placeholder: {
221
- type: "string",
222
- label: "Placeholder"
223
- },
224
- applyLabel: {
225
- type: "string",
226
- label: "Apply Label"
227
- }
228
- },
496
+ schema: {},
229
497
  actions: { cart: ["applyCoupon"] },
230
- guideline: "Coupon code input plus an apply button; root-agnostic (dispatches $actions.cart.applyCoupon). While an apply is in flight it disables the input and button and exposes data-fs-cart-coupon-pending. In a mini-cart it sits in the DrawerPopup footer above the totals; pair it with CartAppliedCoupons (the applied list) and CartCouponError (the error banner). Must be inside CartRoot."
498
+ guideline: "Coupon code input plus an apply button; root-agnostic (dispatches $actions.cart.applyCoupon). While an apply is in flight it disables the input and button and exposes data-fs-cart-coupon-pending. In a mini-cart it sits in the DrawerPopup footer above the totals; pair it with CartAppliedCoupons (the applied list) and CartCouponError (the error banner). For a single-coupon store, wrap the entry (the accordion holding this form) in CartCouponEmpty so it hides once a code is applied. When an apply returns no errors and the submitted code comes back matched, it raises a toast titled by the $content field appliedMessage (needs a ToastProvider with a ToastList in the layout; with none, no toast shows and the apply still works). An unmatched code raises no toast; compose CartCouponUnmatched in the chip for that case. The toast still shows when CartCouponEmpty removes the form. Must be inside CartRoot."
231
499
  });
232
500
  const CartAppliedCouponsDefinition = defineComponent({
233
501
  name: "CartAppliedCoupons",
234
502
  importPath: "@vtex/faststore/components",
235
503
  component: CartAppliedCoupons,
504
+ content: CartAppliedCouponsContent,
236
505
  editor: {
237
506
  label: "Cart Applied Coupons",
238
507
  category: "commerce"
239
508
  },
240
509
  schema: {},
241
510
  actions: { cart: ["removeCoupon"] },
242
- guideline: "Renders one chip per applied coupon (cart.appliedCoupons), each showing its code and a CartCouponRemove control; renders nothing when no coupons are applied. A coupon whose conditions did not match is marked with data-fs-cart-coupon-unmatched. Place it next to CartCouponForm in the mini-cart footer. Must be inside CartRoot."
511
+ guideline: "Renders one chip per applied coupon (cart.appliedCoupons), each showing its code and a CartCouponRemove control (named by the $content field removeLabel); renders nothing when no coupons are applied. A coupon whose conditions did not match is marked with data-fs-cart-coupon-unmatched. Place it next to CartCouponForm in the mini-cart footer. Composed children replace the built-in remove control, so a chip template that adds CartCouponUnmatched (the unmatched-coupon notice) or CartCouponSavings (the amount the coupon saves) must also compose CartCouponRemove. Must be inside CartRoot."
243
512
  });
244
513
  const CartCouponRemoveDefinition = defineComponent({
245
514
  name: "CartCouponRemove",
@@ -260,20 +529,64 @@ const CartCouponErrorDefinition = defineComponent({
260
529
  name: "CartCouponError",
261
530
  importPath: "@vtex/faststore/components",
262
531
  component: CartCouponError,
532
+ content: CartCouponErrorContent,
263
533
  editor: {
264
534
  label: "Cart Coupon Error",
265
535
  category: "commerce"
266
536
  },
267
537
  schema: {},
268
- guideline: "Inline error banner that surfaces coupon apply/remove errors next to the CartCouponForm; renders nothing when there are none. Reads a dedicated coupon error channel, separate from CartError. Must be inside CartRoot."
538
+ guideline: "Inline error banner that surfaces coupon apply/remove errors next to the CartCouponForm; renders nothing when there are none. Reads a dedicated coupon error channel, separate from CartError. Words each error code from its $content (genericErrorMessage for a network failure, every refusal the shopper cannot act on, and an unknown code). Authored children replace the message. Must be inside CartRoot."
539
+ });
540
+ const CartCouponEmptyDefinition = defineComponent({
541
+ name: "CartCouponEmpty",
542
+ importPath: "@vtex/faststore/components",
543
+ component: CartCouponEmpty,
544
+ editor: {
545
+ label: "Cart Coupon Empty",
546
+ category: "commerce"
547
+ },
548
+ schema: {},
549
+ guideline: "Coupon entry gate: renders its children only while the resolved cart has no applied coupon (cart.appliedCoupons is empty), and nothing while the cart loads. The merchant coupon policy is composition: for a single-coupon store, wrap the coupon entry (the AccordionRoot holding CartCouponForm) in it so the entry hides once a code is applied and returns when the chip is removed; for a multi-coupon store, omit it so the entry stays open for more codes. Keep CartAppliedCoupons and CartCouponError outside it, so the applied chips and coupon errors stay visible. Must be inside CartRoot. See cart.md."
550
+ });
551
+ const CartCouponUnmatchedDefinition = defineComponent({
552
+ name: "CartCouponUnmatched",
553
+ importPath: "@vtex/faststore/components",
554
+ component: CartCouponUnmatched,
555
+ content: CartCouponUnmatchedContent,
556
+ editor: {
557
+ label: "Cart Coupon Unmatched",
558
+ category: "commerce"
559
+ },
560
+ schema: {},
561
+ guideline: "Per-chip notice for an applied coupon that grants nothing: renders the $content field message in an <output> live region only while the enclosing chip's coupon has isUnmatchedCondition (its conditions stopped matching, were never met, or the code was accepted without validation), and nothing once it matches again, outside a chip, or when the copy is blank. Place it inside CartAppliedCoupons next to CartCouponRemove: composed children replace the built-in remove control, so a chip template without CartCouponRemove loses the X. It does not remove the coupon; the shopper removes it with the X. See cart.md."
269
562
  });
270
- function CartRoot({ $data: $dataProp, className, children, ...props }) {
271
- const cart = useDataOverride($dataProp) ?? null;
563
+ const CartCouponSavingsDefinition = defineComponent({
564
+ name: "CartCouponSavings",
565
+ importPath: "@vtex/faststore/components",
566
+ component: CartCouponSavings,
567
+ content: CartCouponSavingsContent,
568
+ editor: {
569
+ label: "Cart Coupon Savings",
570
+ category: "commerce"
571
+ },
572
+ schema: {},
573
+ guideline: "Per-chip amount a fixed-amount coupon took off, summed from cart.discounts for the enclosing chip's code. Renders nothing for an unmatched, free-shipping or percentage coupon (the API attributes no amount to them), outside a chip, or when the sum is not above zero. The chip text is the $content field template, an ICU message whose {amount} argument is the formatted saving, e.g. '{amount}' or 'Economia de {amount}'. The chip already shows the code before its children. Place it inside a CartAppliedCoupons chip template next to CartCouponRemove: composed children replace the built-in remove control, so a chip template without CartCouponRemove loses the X. Must be inside CartRoot. See cart.md."
574
+ });
575
+ const useIsomorphicLayoutEffect = globalThis.window === void 0 ? useEffect : useLayoutEffect;
576
+ function CartRoot({ $data: $dataProp, $actions: $actionsProp, className, children, ...props }) {
577
+ const $data = useDataOverride($dataProp);
578
+ const $actions = useActionsOverride($actionsProp);
579
+ const cart = $data ?? null;
580
+ useCartSyncSalesChannel($actions?.cart?.syncSalesChannel, cart?.id ?? null, cart?.salesChannelMismatch);
272
581
  const { error: rootError } = useContext(ReactiveRootContext);
273
582
  const cartEntityId = cart?.id ?? null;
274
583
  useEffect(() => {
275
584
  if (cartEntityId) orderFormIdVar(cartEntityId);
276
585
  }, [cartEntityId]);
586
+ useIsomorphicLayoutEffect(() => {
587
+ cartUserErrorsVar([]);
588
+ cartCouponErrorsVar([]);
589
+ }, []);
277
590
  const dataValue = useMemo(() => ({
278
591
  cart,
279
592
  error: rootError ?? null
@@ -315,10 +628,56 @@ function CartList({ className, children, skeletonCount = 3, ...props }) {
315
628
  }, item.id))
316
629
  });
317
630
  }
631
+ function CartLines({ items, className, children, attribute, rest }) {
632
+ return /* @__PURE__ */ jsx("div", {
633
+ ...rest,
634
+ className,
635
+ ...attribute,
636
+ children: items.map((item) => /* @__PURE__ */ jsx(ListItemRefContext, {
637
+ value: {
638
+ __typename: "CartItem",
639
+ id: item.id,
640
+ fallbackData: item
641
+ },
642
+ children
643
+ }, item.id))
644
+ });
645
+ }
646
+ function CartAvailableItems({ className, children, skeletonCount = 3, ...props }) {
647
+ const { cart } = useCart();
648
+ const { loading } = useContext(ReactiveRootContext);
649
+ if (loading && cart == null) return /* @__PURE__ */ jsx("div", {
650
+ ...props,
651
+ className,
652
+ "data-fs-cart-available-items": "",
653
+ children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx(CartItemSkeleton, {}, i))
654
+ });
655
+ const items = (cart?.items ?? []).filter((item) => !isUnavailable(item));
656
+ if (items.length === 0) return null;
657
+ return /* @__PURE__ */ jsx(CartLines, {
658
+ items,
659
+ className,
660
+ attribute: { "data-fs-cart-available-items": "" },
661
+ rest: props,
662
+ children
663
+ });
664
+ }
665
+ function CartUnavailableItems({ className, children, ...props }) {
666
+ const { cart } = useCart();
667
+ const items = (cart?.items ?? []).filter(isUnavailable);
668
+ if (items.length === 0) return null;
669
+ return /* @__PURE__ */ jsx(CartLines, {
670
+ items,
671
+ className,
672
+ attribute: { "data-fs-cart-unavailable-items": "" },
673
+ rest: props,
674
+ children
675
+ });
676
+ }
318
677
  function CartTotal({ label, className, children, ...props }) {
319
678
  const total = useContext(CartTotalValueContext);
320
679
  const { locale, currency } = useStorefrontContext();
321
- const value = children ?? formatPrice(total?.amount ?? 0, locale, currency);
680
+ const value = children ?? formatPrice(Number(total?.amount ?? 0), locale, currency);
322
681
  return /* @__PURE__ */ jsx("span", {
323
682
  ...props,
324
683
  className,
@@ -327,19 +686,51 @@ function CartTotal({ label, className, children, ...props }) {
327
686
  children: label == null ? value : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx("span", { children: value })] })
328
687
  });
329
688
  }
330
- function CartCount({ className, children, template = "{count}", ...props }) {
689
+ function addToCount(sum, item) {
690
+ if (item.gift) return sum;
691
+ return Number.isFinite(item.quantity) ? sum + item.quantity : NaN;
692
+ }
693
+ function CartCount({ className, children, $content, $locale, ...props }) {
331
694
  const { cart } = useCart();
332
- const count = cart?.items.reduce((sum, item) => item.gift ? sum : sum + item.quantity, 0) ?? 0;
695
+ const { format } = useMessageFormatter(CartCountContent, $content);
696
+ const count = cart?.items.reduce(addToCount, 0) ?? 0;
697
+ if (!Number.isFinite(count)) return null;
333
698
  return /* @__PURE__ */ jsx("span", {
334
699
  ...props,
335
700
  className,
336
701
  "data-fs-cart-count": "",
337
702
  "data-fs-text": "",
338
- children: children ?? template.replace("{count}", String(count))
703
+ children: children ?? format("template", { count })
339
704
  });
340
705
  }
341
- function CartError({ className, children, ...props }) {
342
- const [firstError] = useReactiveVar(cartUserErrorsVar);
706
+ /**
707
+ * The message for each code an item write can publish: the five item mutations' codes plus the
708
+ * client-minted transport failure. A code this map does not know (a newer server) shows genericErrorMessage.
709
+ */
710
+ const CART_ERROR_FIELDS = {
711
+ INVALID_QUANTITY: "invalidQuantityMessage",
712
+ ITEM_NOT_FOUND: "itemNotFoundMessage",
713
+ MISSING_CART_CONTEXT: "genericErrorMessage",
714
+ CART_NOT_FOUND: "genericErrorMessage",
715
+ INVALID_VARIANT_ID: "genericErrorMessage",
716
+ INVALID_SELLER_ID: "genericErrorMessage",
717
+ NO_LINE_IDS_PROVIDED: "genericErrorMessage",
718
+ UPSTREAM_ERROR: "genericErrorMessage",
719
+ NETWORK_ERROR: "genericErrorMessage"
720
+ };
721
+ /** The message for each code a coupon write can publish, plus the client-minted transport failure. */
722
+ const CART_COUPON_ERROR_FIELDS = {
723
+ COUPON_NOT_FOUND: "couponNotFoundMessage",
724
+ COUPON_EXPIRED: "couponExpiredMessage",
725
+ COUPON_NOT_COMBINED: "couponNotCombinedMessage",
726
+ MISSING_CART_CONTEXT: "genericErrorMessage",
727
+ CART_NOT_FOUND: "genericErrorMessage",
728
+ NETWORK_ERROR: "genericErrorMessage"
729
+ };
730
+ function CartError({ $content, $locale, className, children, ...props }) {
731
+ const userErrors = useReactiveVar(cartUserErrorsVar);
732
+ const { format } = useMessageFormatter(CartErrorContent, $content);
733
+ const [firstError] = userErrors;
343
734
  if (!firstError) return null;
344
735
  return /* @__PURE__ */ jsx("div", {
345
736
  ...props,
@@ -347,7 +738,7 @@ function CartError({ className, children, ...props }) {
347
738
  className,
348
739
  "data-fs-cart-error": "",
349
740
  "data-fs-text": "",
350
- children: children ?? firstError.message
741
+ children: children ?? formatErrorCode(CartErrorContent, CART_ERROR_FIELDS, firstError, format, "genericErrorMessage")
351
742
  });
352
743
  }
353
744
  function CartGoCheckoutPending({ children }) {
@@ -364,19 +755,29 @@ function configuredLabel(value) {
364
755
  }
365
756
  /** The default destination of both checkout navigations. Module-level, so an effect keyed on it is stable. */
366
757
  const CHECKOUT_PAGE = { standard: "checkout" };
367
- function CartGoCheckout({ href = CHECKOUT_PAGE, label, className, children, onClick, $content, $actions: $actionsProp, ...props }) {
758
+ function isPlainLeftClick(e) {
759
+ return !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
760
+ }
761
+ function CartGoCheckout({ href = CHECKOUT_PAGE, className, children, onClick, $content, $locale, $actions: $actionsProp, ...props }) {
368
762
  const $actions = useActionsOverride($actionsProp);
763
+ const { format } = useMessageFormatter(CartCheckoutLabelContent, $content);
369
764
  const client = useApolloClient();
370
765
  const { push } = useStorefrontNavigation();
371
766
  const [validating, setValidating] = useState(false);
372
767
  const inFlight = useRef(false);
373
- const resolvedChildren = typeof children === "string" ? configuredLabel(children) : children;
374
- const resolvedLabel = configuredLabel($content?.label) ?? configuredLabel(label) ?? resolvedChildren ?? "Checkout";
768
+ const resolvedLabel = (typeof children === "string" ? configuredLabel(children) : children) ?? format("label");
769
+ function leave() {
770
+ miniCartOpenVar(false);
771
+ push(href);
772
+ }
375
773
  async function handleClick(e) {
376
774
  onClick?.(e);
775
+ if (!isPlainLeftClick(e)) return;
377
776
  const validate = $actions?.cart?.validate;
378
- if (!validate) return;
379
- if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
777
+ if (!validate) {
778
+ miniCartOpenVar(false);
779
+ return;
780
+ }
380
781
  e.preventDefault();
381
782
  if (inFlight.current) return;
382
783
  inFlight.current = true;
@@ -384,10 +785,10 @@ function CartGoCheckout({ href = CHECKOUT_PAGE, label, className, children, onCl
384
785
  try {
385
786
  await awaitCartWrites();
386
787
  if ((await validate()).length > 0) {
387
- push(href);
788
+ leave();
388
789
  return;
389
790
  }
390
- if (!(readCartFromCache(client)?.items ?? []).some((item) => item.variant.availability !== "AVAILABLE")) push(href);
791
+ if (!(readCartFromCache(client)?.items ?? []).some((item) => item.variant.availability !== "AVAILABLE")) leave();
391
792
  } finally {
392
793
  inFlight.current = false;
393
794
  setValidating(false);
@@ -403,8 +804,11 @@ function CartGoCheckout({ href = CHECKOUT_PAGE, label, className, children, onCl
403
804
  children: /* @__PURE__ */ jsx(CartGoCheckoutPending, { children: resolvedLabel })
404
805
  });
405
806
  }
406
- function CartCouponForm({ placeholder = "Coupon code", applyLabel = "Apply", className, children, onSubmit, $actions: $actionsProp, ...props }) {
807
+ function CartCouponForm({ className, children, onSubmit, $content, $locale, $actions: $actionsProp, ...props }) {
407
808
  const $actions = useActionsOverride($actionsProp);
809
+ const { format } = useMessageFormatter(CartCouponFormContent, $content);
810
+ const toast = useOptionalToast();
811
+ const { client } = useContext(getApolloContext());
408
812
  const [code, setCode] = useState("");
409
813
  const [pending, setPending] = useState(false);
410
814
  async function handleSubmit(e) {
@@ -416,10 +820,19 @@ function CartCouponForm({ placeholder = "Coupon code", applyLabel = "Apply", cla
416
820
  try {
417
821
  const errors = await $actions?.cart?.applyCoupon?.({ code: trimmed });
418
822
  if (!errors || errors.length === 0) setCode("");
823
+ if (errors?.length === 0 && client && toast) {
824
+ const submitted = trimmed.toLowerCase();
825
+ const title = (readCartFromCache(client)?.appliedCoupons ?? []).some((coupon) => coupon.code.trim().toLowerCase() === submitted && coupon.isUnmatchedCondition === false) ? format("appliedMessage") : "";
826
+ if (title) toast.add({
827
+ title,
828
+ type: "success"
829
+ });
830
+ }
419
831
  } finally {
420
832
  setPending(false);
421
833
  }
422
834
  }
835
+ const placeholder = children == null ? format("placeholder") : void 0;
423
836
  return /* @__PURE__ */ jsx("form", {
424
837
  ...props,
425
838
  className,
@@ -439,12 +852,13 @@ function CartCouponForm({ placeholder = "Coupon code", applyLabel = "Apply", cla
439
852
  disabled: pending,
440
853
  "data-fs-cart-coupon-apply": "",
441
854
  "data-fs-button": "",
442
- children: applyLabel
855
+ children: format("applyLabel")
443
856
  })] })
444
857
  });
445
858
  }
446
- function CartAppliedCoupons({ className, children, $actions: $actionsProp, ...props }) {
859
+ function CartAppliedCoupons({ className, children, $content, $locale, $actions: $actionsProp, ...props }) {
447
860
  const $actions = useActionsOverride($actionsProp);
861
+ const { format } = useMessageFormatter(CartAppliedCouponsContent, $content);
448
862
  const { cart } = useCart();
449
863
  const coupons = cart?.appliedCoupons ?? [];
450
864
  if (coupons.length === 0) return null;
@@ -456,12 +870,13 @@ function CartAppliedCoupons({ className, children, $actions: $actionsProp, ...pr
456
870
  value: coupon,
457
871
  children: /* @__PURE__ */ jsx(CartCouponChip, {
458
872
  $actions,
873
+ removeLabel: children == null ? format("removeLabel", { code: coupon.code }) : void 0,
459
874
  children
460
875
  })
461
876
  }, coupon.code))
462
877
  });
463
878
  }
464
- function CartCouponChip({ children, $actions }) {
879
+ function CartCouponChip({ children, removeLabel, $actions }) {
465
880
  const coupon = useContext(CartCouponContext);
466
881
  if (!coupon) return null;
467
882
  return /* @__PURE__ */ jsxs("span", {
@@ -473,7 +888,7 @@ function CartCouponChip({ children, $actions }) {
473
888
  children: coupon.code
474
889
  }), children ?? /* @__PURE__ */ jsx(CartCouponRemove, {
475
890
  $actions,
476
- "aria-label": `Remove coupon ${coupon.code}`,
891
+ "aria-label": removeLabel,
477
892
  children: "×"
478
893
  })]
479
894
  });
@@ -496,8 +911,10 @@ function CartCouponRemove({ code, className, children, onClick, $actions: $actio
496
911
  children
497
912
  });
498
913
  }
499
- function CartCouponError({ className, children, ...props }) {
500
- const [firstError] = useReactiveVar(cartCouponErrorsVar);
914
+ function CartCouponError({ $content, $locale, className, children, ...props }) {
915
+ const couponErrors = useReactiveVar(cartCouponErrorsVar);
916
+ const { format } = useMessageFormatter(CartCouponErrorContent, $content);
917
+ const [firstError] = couponErrors;
501
918
  if (!firstError) return null;
502
919
  return /* @__PURE__ */ jsx("div", {
503
920
  ...props,
@@ -505,7 +922,47 @@ function CartCouponError({ className, children, ...props }) {
505
922
  className,
506
923
  "data-fs-cart-coupon-error": "",
507
924
  "data-fs-text": "",
508
- children: children ?? firstError.message
925
+ children: children ?? formatErrorCode(CartCouponErrorContent, CART_COUPON_ERROR_FIELDS, firstError, format, "genericErrorMessage")
926
+ });
927
+ }
928
+ function CartCouponEmpty({ className, children, ...props }) {
929
+ const { cart } = useCart();
930
+ if (cart == null || (cart.appliedCoupons ?? []).length > 0) return null;
931
+ return /* @__PURE__ */ jsx("div", {
932
+ ...props,
933
+ className,
934
+ "data-fs-cart-coupon-empty": "",
935
+ children
936
+ });
937
+ }
938
+ function CartCouponUnmatched({ className, children, $content, $locale, ...props }) {
939
+ const coupon = useContext(CartCouponContext);
940
+ const { format } = useMessageFormatter(CartCouponUnmatchedContent, $content);
941
+ if (coupon?.isUnmatchedCondition !== true) return null;
942
+ const notice = children ?? format("message");
943
+ if (notice === "") return null;
944
+ return /* @__PURE__ */ jsx("output", {
945
+ ...props,
946
+ className,
947
+ "data-fs-cart-coupon-unmatched-notice": "",
948
+ "data-fs-text": "",
949
+ children: notice
950
+ });
951
+ }
952
+ function CartCouponSavings({ className, $content, $locale, ...props }) {
953
+ const coupon = useContext(CartCouponContext);
954
+ const { cart } = useCart();
955
+ const { locale, currency } = useStorefrontContext();
956
+ const { format } = useMessageFormatter(CartCouponSavingsContent, $content);
957
+ if (!cart || !coupon || coupon.isUnmatchedCondition || coupon.code === "") return null;
958
+ const saved = cart.discounts.reduce((sum, discount) => discount.kind === "COUPON" && discount.name === coupon.code && isFiniteAmount(discount.value.amount) ? sum + Number(discount.value.amount) : sum, 0);
959
+ if (saved <= 0) return null;
960
+ return /* @__PURE__ */ jsx("span", {
961
+ ...props,
962
+ className,
963
+ "data-fs-cart-coupon-savings": "",
964
+ "data-fs-text": "",
965
+ children: format("template", { amount: formatPrice(-saved, locale, currency) })
509
966
  });
510
967
  }
511
968
  const CartCheckoutGuardDefinition = defineComponent({
@@ -550,34 +1007,45 @@ const CartFilledDefinition = defineComponent({
550
1007
  category: "commerce"
551
1008
  },
552
1009
  schema: {},
553
- guideline: "The filled branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has one or more items. Wrap the CartList, the order summary, and the checkout CTA in it so they hide when the cart is empty. Pair with CartLoading and CartEmpty. Must be inside CartRoot. See cart.md."
1010
+ guideline: "The filled branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has one or more items. Wrap the CartList (or the CartAvailableItems and CartUnavailableItems pair that replaces it, the latter inside a CartUnavailableSection with a CartUnavailableLabel), the order summary, and the checkout CTA in it so they hide when the cart is empty. Pair with CartLoading and CartEmpty. Must be inside CartRoot. See cart.md."
554
1011
  });
555
1012
  const CartUnavailableCountDefinition = defineComponent({
556
1013
  name: "CartUnavailableCount",
557
1014
  importPath: "@vtex/faststore/components",
558
1015
  component: CartUnavailableCount,
1016
+ content: CartUnavailableCountContent,
559
1017
  editor: {
560
1018
  label: "Cart Unavailable Count",
561
1019
  category: "commerce"
562
1020
  },
563
- schema: { template: {
564
- type: "string",
565
- default: "{count} items unavailable",
566
- label: "Template"
567
- } },
568
- guideline: "Cart-level summary of how many lines are unavailable; self-hides when none. See cart.md."
1021
+ schema: {},
1022
+ guideline: "Cart-level summary of how many lines are unavailable; self-hides when none. The text is the $content field template, an ICU message with a count argument. See cart.md."
569
1023
  });
570
1024
  const CartRemoveUnavailableDefinition = defineComponent({
571
1025
  name: "CartRemoveUnavailable",
572
1026
  importPath: "@vtex/faststore/components",
573
1027
  component: CartRemoveUnavailable,
1028
+ content: CartRemoveUnavailableContent,
574
1029
  editor: {
575
1030
  label: "Cart Remove Unavailable",
576
1031
  category: "commerce"
577
1032
  },
578
1033
  schema: {},
579
1034
  actions: { cart: ["removeItems"] },
580
- guideline: "Button that removes every unavailable line in one batch call; self-hides when none. See cart.md."
1035
+ guideline: "Button that removes every unavailable line in one batch call; self-hides when none. Composed children are the label; without them it is the $content field label. See cart.md."
1036
+ });
1037
+ const ClearCartButtonDefinition = defineComponent({
1038
+ name: "ClearCartButton",
1039
+ importPath: "@vtex/faststore/components",
1040
+ component: ClearCartButton,
1041
+ content: ClearCartButtonContent,
1042
+ editor: {
1043
+ label: "Clear Cart Button",
1044
+ category: "commerce"
1045
+ },
1046
+ schema: {},
1047
+ actions: { cart: ["removeItems"] },
1048
+ guideline: "Button that removes every line in the cart (gift and unavailable lines included) in one batch call; self-hides when the cart has no lines. Disabled, with data-fs-clear-cart-button-pending, while the call is in flight. No confirmation and no toast. The write is optimistic: CartEmpty replaces CartFilled as soon as it is clicked; on failure the lines come back and the error shows in CartError, so compose a CartError outside the CartFilled/CartEmpty branches. Composed children are the label; without them it is the $content field label. Must be inside CartRoot. See cart.md."
581
1049
  });
582
1050
  function isUnavailable(item) {
583
1051
  return item.variant.availability !== "AVAILABLE";
@@ -595,8 +1063,9 @@ function CartCheckoutGuard({ className, children, ...props }) {
595
1063
  children
596
1064
  });
597
1065
  }
598
- function CartUnavailableCount({ className, children, template = "{count} items unavailable", ...props }) {
1066
+ function CartUnavailableCount({ className, children, $content, $locale, ...props }) {
599
1067
  const { cart } = useCart();
1068
+ const { format } = useMessageFormatter(CartUnavailableCountContent, $content);
600
1069
  const count = (cart?.items ?? []).filter(isUnavailable).length;
601
1070
  if (count === 0) return null;
602
1071
  return /* @__PURE__ */ jsx("span", {
@@ -604,11 +1073,12 @@ function CartUnavailableCount({ className, children, template = "{count} items u
604
1073
  className,
605
1074
  "data-fs-cart-unavailable-count": "",
606
1075
  "data-fs-text": "",
607
- children: children ?? template.replace("{count}", String(count))
1076
+ children: children ?? format("template", { count })
608
1077
  });
609
1078
  }
610
- function CartRemoveUnavailable({ className, children, onClick, $actions: $actionsProp, ...props }) {
1079
+ function CartRemoveUnavailable({ className, children, onClick, $content, $locale, $actions: $actionsProp, ...props }) {
611
1080
  const $actions = useActionsOverride($actionsProp);
1081
+ const { format } = useMessageFormatter(CartRemoveUnavailableContent, $content);
612
1082
  const { cart } = useCart();
613
1083
  const unavailableIds = (cart?.items ?? []).filter(isUnavailable).map((item) => item.id);
614
1084
  if (unavailableIds.length === 0) return null;
@@ -623,7 +1093,224 @@ function CartRemoveUnavailable({ className, children, onClick, $actions: $action
623
1093
  onClick: handleClick,
624
1094
  "data-fs-cart-remove-unavailable": "",
625
1095
  "data-fs-button": "",
626
- children: children ?? "Remove unavailable items"
1096
+ children: children ?? format("label")
1097
+ });
1098
+ }
1099
+ const CartUnavailableLabelContent = defineContentType({
1100
+ id: "cart-unavailable-label",
1101
+ title: "Cart Unavailable Label",
1102
+ description: "Heading copy of the cart section that holds the lines the shopper cannot buy.",
1103
+ schema: {
1104
+ type: "object",
1105
+ additionalProperties: false,
1106
+ properties: { text: {
1107
+ type: "string",
1108
+ title: "Unavailable section label",
1109
+ format: "icu-message",
1110
+ messageSource: "Unavailable"
1111
+ } }
1112
+ }
1113
+ });
1114
+ const CartUnavailableSectionDefinition = defineComponent({
1115
+ name: "CartUnavailableSection",
1116
+ importPath: "@vtex/faststore/components",
1117
+ component: CartUnavailableSection,
1118
+ editor: {
1119
+ label: "Cart Unavailable Section",
1120
+ category: "commerce"
1121
+ },
1122
+ schema: {},
1123
+ guideline: "Renders its children only when at least one cart line is unavailable, so the section card, header and list disappear together; it carries no copy (compose CartUnavailableLabel and CartUnavailableItems inside it). Pair with CartAvailableItems under CartFilled. Must be inside CartRoot. See cart.md."
1124
+ });
1125
+ const CartUnavailableLabelDefinition = defineComponent({
1126
+ name: "CartUnavailableLabel",
1127
+ importPath: "@vtex/faststore/components",
1128
+ component: CartUnavailableLabel,
1129
+ content: CartUnavailableLabelContent,
1130
+ editor: {
1131
+ label: "Cart Unavailable Label",
1132
+ category: "commerce"
1133
+ },
1134
+ schema: {},
1135
+ guideline: "Heading copy of the unavailable section, rendered as plain text from the $content field text; blank copy renders nothing. It renders only while at least one line is unavailable. Compose one inside CartUnavailableSection as its header, grouped with an Icon in a Container when the header carries one. Must be inside CartRoot. See cart.md."
1136
+ });
1137
+ function CartUnavailableSection({ className, children, ...props }) {
1138
+ const { cart } = useCart();
1139
+ if (!cart?.items.some(isUnavailable)) return null;
1140
+ return /* @__PURE__ */ jsx("div", {
1141
+ ...props,
1142
+ className,
1143
+ "data-fs-cart-unavailable-section": "",
1144
+ children
1145
+ });
1146
+ }
1147
+ function CartUnavailableLabel({ $content, $locale, className, ...props }) {
1148
+ const { cart } = useCart();
1149
+ const { format } = useMessageFormatter(CartUnavailableLabelContent, $content);
1150
+ if (!cart?.items.some(isUnavailable)) return null;
1151
+ const copy = format("text");
1152
+ if (!copy.trim()) return null;
1153
+ return /* @__PURE__ */ jsx("p", {
1154
+ ...props,
1155
+ className,
1156
+ "data-fs-cart-unavailable-label": "",
1157
+ "data-fs-text": "",
1158
+ children: copy
1159
+ });
1160
+ }
1161
+ const CartAllUnavailableMessageContent = defineContentType({
1162
+ id: "cart-all-unavailable-message",
1163
+ title: "Cart All Unavailable Message",
1164
+ description: "Warning shown in the cart when none of the lines the shopper added can be bought, with an optional link.",
1165
+ schema: {
1166
+ type: "object",
1167
+ additionalProperties: false,
1168
+ properties: {
1169
+ text: {
1170
+ type: "string",
1171
+ title: "Nothing purchasable message",
1172
+ format: "icu-message",
1173
+ messageSource: "No items are available for purchase right now"
1174
+ },
1175
+ linkText: {
1176
+ type: "string",
1177
+ minLength: 1,
1178
+ title: "Link text"
1179
+ },
1180
+ linkHref: {
1181
+ type: "string",
1182
+ minLength: 1,
1183
+ title: "Link destination",
1184
+ format: "uri-reference",
1185
+ pattern: "^(?:https?://.*|mailto:.+|tel:.+|/(?:[^/].*)?)$"
1186
+ }
1187
+ }
1188
+ }
1189
+ });
1190
+ const CartAllUnavailableDefinition = defineComponent({
1191
+ name: "CartAllUnavailable",
1192
+ importPath: "@vtex/faststore/components",
1193
+ component: CartAllUnavailable,
1194
+ editor: {
1195
+ label: "Cart All Unavailable",
1196
+ category: "commerce"
1197
+ },
1198
+ schema: {},
1199
+ guideline: "Renders its children only when the cart has at least one line the shopper added and every such line is unavailable; gift lines are ignored, so a gift-only cart never shows it and a cart whose only available line is a gift does. Distinct from CartEmpty (zero lines). Carries no copy: compose CartAllUnavailableMessage inside it, which carries the optional link. While it holds no rendered CartAllUnavailableMessage (blank copy, or no message composed), the store stylesheet hides it with display: none, so put the box on the gate: blank copy leaves no empty box, and a display class cannot show it. Place under CartFilled. Must be inside CartRoot. See cart.md."
1200
+ });
1201
+ const CartAllUnavailableMessageDefinition = defineComponent({
1202
+ name: "CartAllUnavailableMessage",
1203
+ importPath: "@vtex/faststore/components",
1204
+ component: CartAllUnavailableMessage,
1205
+ content: CartAllUnavailableMessageContent,
1206
+ editor: {
1207
+ label: "Cart All Unavailable Message",
1208
+ category: "commerce"
1209
+ },
1210
+ schema: {
1211
+ linkText: {
1212
+ type: "string",
1213
+ label: "Link text"
1214
+ },
1215
+ linkHref: {
1216
+ type: "link",
1217
+ label: "Link destination"
1218
+ }
1219
+ },
1220
+ guideline: "The warning that nothing in the cart can be bought, inside CartAllUnavailable, announced to screen readers as an alert. The message is the $content field text; blank copy renders nothing. It renders only while the cart has nothing purchasable. An optional link follows the text: set linkText and linkHref (a page reference such as { \"page\": \"<page name>\" }), or the same CMS fields; it renders only when both are set, there is no default, and a destination that is not a page reference or an http, https, mailto, tel or site-relative URL is dropped. A non-blank CMS field wins over its prop, so a CMS store authors no link props. Must be inside CartRoot. See cart.md."
1221
+ });
1222
+ /** True when the cart has a shopper-added line and every shopper-added line is unavailable. */
1223
+ function hasNothingPurchasable(items) {
1224
+ const shopperLines = items.filter((item) => !item.gift);
1225
+ return shopperLines.length > 0 && shopperLines.every(isUnavailable);
1226
+ }
1227
+ function CartAllUnavailable({ className, children, ...props }) {
1228
+ const { cart } = useCart();
1229
+ if (cart == null || !hasNothingPurchasable(cart.items)) return null;
1230
+ return /* @__PURE__ */ jsx("div", {
1231
+ ...props,
1232
+ className,
1233
+ "data-fs-cart-all-unavailable": "",
1234
+ children
1235
+ });
1236
+ }
1237
+ /**
1238
+ * A page reference skips the string allowlist. A string is checked, and a refusal drops the link.
1239
+ * The runtime content slice does not enforce the model's `pattern`, so this is the only gate on a CMS string.
1240
+ */
1241
+ function resolveMessageLinkHref(href) {
1242
+ if (href == null) return null;
1243
+ if (typeof href !== "string") return href;
1244
+ if (!href.trim()) return null;
1245
+ const destination = resolveSafeHref(href);
1246
+ if (!destination.safe) {
1247
+ console.warn("[CartAllUnavailableMessage] link destination rejected", { reason: destination.reason });
1248
+ return null;
1249
+ }
1250
+ return destination.href;
1251
+ }
1252
+ function CartAllUnavailableMessage({ linkText, linkHref, $content, $locale, className, ...props }) {
1253
+ const { cart } = useCart();
1254
+ const { format } = useMessageFormatter(CartAllUnavailableMessageContent, $content);
1255
+ if (cart == null || !hasNothingPurchasable(cart.items)) return null;
1256
+ const copy = format("text");
1257
+ if (!copy.trim()) return null;
1258
+ const resolvedLinkText = configuredLabel($content?.linkText) ?? configuredLabel(linkText);
1259
+ const rawHref = $content?.linkHref?.trim() ? $content.linkHref : linkHref;
1260
+ const destination = resolvedLinkText ? resolveMessageLinkHref(rawHref) : null;
1261
+ return /* @__PURE__ */ jsxs("div", {
1262
+ ...props,
1263
+ role: "alert",
1264
+ className,
1265
+ "data-fs-cart-all-unavailable-message": "",
1266
+ children: [/* @__PURE__ */ jsx("p", {
1267
+ "data-fs-cart-all-unavailable-message-text": "",
1268
+ "data-fs-text": "",
1269
+ children: copy
1270
+ }), resolvedLinkText && destination != null ? /* @__PURE__ */ jsx(NavigationLink, {
1271
+ href: destination,
1272
+ "data-fs-cart-all-unavailable-message-link": "",
1273
+ children: resolvedLinkText
1274
+ }) : null]
1275
+ });
1276
+ }
1277
+ function ClearCartButton({ className, children, disabled, onClick, $content, $locale, $actions: $actionsProp, ...props }) {
1278
+ const $actions = useActionsOverride($actionsProp);
1279
+ const { format } = useMessageFormatter(ClearCartButtonContent, $content);
1280
+ const { cart } = useCart();
1281
+ const [pending, setPending] = useState(false);
1282
+ const inFlight = useRef(false);
1283
+ const ids = (cart?.items ?? []).map((item) => item.id);
1284
+ if (ids.length === 0) return null;
1285
+ async function clear(removeItems) {
1286
+ try {
1287
+ await removeItems({ ids });
1288
+ } catch (error) {
1289
+ console.error("[ClearCartButton] removeItems failed", loggableErrorName(error));
1290
+ } finally {
1291
+ inFlight.current = false;
1292
+ setPending(false);
1293
+ }
1294
+ }
1295
+ function handleClick(e) {
1296
+ if (inFlight.current) return;
1297
+ onClick?.(e);
1298
+ const removeItems = $actions?.cart?.removeItems;
1299
+ if (typeof removeItems !== "function") return;
1300
+ inFlight.current = true;
1301
+ setPending(true);
1302
+ clear(removeItems);
1303
+ }
1304
+ return /* @__PURE__ */ jsx("button", {
1305
+ ...props,
1306
+ type: "button",
1307
+ className,
1308
+ onClick: handleClick,
1309
+ disabled: pending || disabled,
1310
+ "data-fs-clear-cart-button": "",
1311
+ "data-fs-button": "",
1312
+ ...pending ? { "data-fs-clear-cart-button-pending": "" } : {},
1313
+ children: children ?? format("label")
627
1314
  });
628
1315
  }
629
1316
  const CartOpenOnAddDefinition = defineComponent({
@@ -876,7 +1563,7 @@ const CartAlertRootDefinition = defineComponent({
876
1563
  }
877
1564
  },
878
1565
  providesContext: "cart-alert",
879
- guideline: "Merchant-authored notice near the top of the mini-cart overlay (a minimum order, a running promotion): wraps CartAlertIcon and CartAlertText in any subset, any order — the arrangement is the composition, not a prop — and renders the glyph then the copy when composed with no children. Its copy and glyph are CMS-editable through the cart-alert content model, with the text, icon, iconUrl and iconAlt props as the non-CMS fallback; it renders nothing when no message is configured, so an unconfigured banner leaves no empty box. Reads no cart data, so it needs no CartRoot ancestor and no cart-state gate — place it inside CartFilled to hide it on an empty cart. A store whose merchants choose the icon must list CART_ALERT_ICON_NAMES under icons.include in global.json, or a chosen glyph renders empty. Distinct from CartError (cart mutation errors) and CartUnavailableCount (data-driven). See cart.md."
1566
+ guideline: "Merchant-authored notice near the top of the mini-cart overlay (a minimum order, a running promotion): wraps CartAlertIcon and CartAlertText in any subset, any order — the arrangement is the composition, not a prop — and renders the glyph then the copy when composed with no children. Its copy and glyph are CMS-editable through the cart-alert content model, with the text, icon, iconUrl and iconAlt props as the non-CMS fallback; it renders nothing when no message is configured, so an unconfigured banner leaves no empty box. Reads no cart data, so it needs no CartRoot ancestor and no cart-state gate — place it inside CartFilled to hide it on an empty cart. A store whose merchants choose the icon must list CART_ALERT_ICON_NAMES under icons.include in its foundation, or a chosen glyph renders empty. Distinct from CartError (cart mutation errors) and CartUnavailableCount (data-driven). See cart.md."
880
1567
  });
881
1568
  const CartAlertIconDefinition = defineComponent({
882
1569
  name: "CartAlertIcon",
@@ -959,12 +1646,12 @@ const CartEmptyMessageContent = defineContentType({
959
1646
  schema: {
960
1647
  type: "object",
961
1648
  additionalProperties: false,
962
- required: ["text"],
963
1649
  properties: { text: {
964
1650
  type: "string",
965
1651
  minLength: 1,
966
1652
  title: "Empty cart message",
967
- default: "Your cart is empty"
1653
+ format: "icu-message",
1654
+ messageSource: "Your cart is empty"
968
1655
  } }
969
1656
  }
970
1657
  });
@@ -975,12 +1662,12 @@ const CartContinueShoppingContent = defineContentType({
975
1662
  schema: {
976
1663
  type: "object",
977
1664
  additionalProperties: false,
978
- required: ["label"],
979
1665
  properties: { label: {
980
1666
  type: "string",
981
1667
  minLength: 1,
982
1668
  title: "Continue shopping label",
983
- default: "Continue shopping"
1669
+ format: "icu-message",
1670
+ messageSource: "Continue shopping"
984
1671
  } }
985
1672
  }
986
1673
  });
@@ -993,12 +1680,8 @@ const CartEmptyMessageDefinition = defineComponent({
993
1680
  label: "Cart Empty Message",
994
1681
  category: "commerce"
995
1682
  },
996
- schema: { text: {
997
- type: "string",
998
- default: "Your cart is empty",
999
- label: "Empty cart message"
1000
- } },
1001
- guideline: "The empty-cart message, rendered as plain text inside CartEmpty. CMS content wins over the text prop, which defaults to \"Your cart is empty\"; blank resolved copy renders nothing. It carries no layout — group and space it with Container, and pair it with CartContinueShopping for the way back to browsing. See cart.md."
1683
+ schema: {},
1684
+ guideline: "The empty-cart message, rendered as plain text inside CartEmpty. The text is the $content field text; a blank message renders nothing. It carries no layout — group and space it with Container, and pair it with CartContinueShopping for the way back to browsing. See cart.md."
1002
1685
  });
1003
1686
  const CartContinueShoppingDefinition = defineComponent({
1004
1687
  name: "CartContinueShopping",
@@ -1009,16 +1692,13 @@ const CartContinueShoppingDefinition = defineComponent({
1009
1692
  label: "Cart Continue Shopping",
1010
1693
  category: "action"
1011
1694
  },
1012
- schema: { label: {
1013
- type: "string",
1014
- default: "Continue shopping",
1015
- label: "Continue shopping label"
1016
- } },
1017
- guideline: "Dismisses the cart overlay so the shopper can keep browsing; dispatches no cart write. Place it in the empty panel inside CartEmpty, commonly in a footer Container. It closes the drawer, so it requires a DrawerRoot ancestor — on a cart page with no drawer, compose a NavigationLink back to browsing instead of this control. CMS content wins over the label prop, and composed children win over both (compose an icon that way). See cart.md."
1695
+ schema: {},
1696
+ guideline: "Dismisses the cart overlay so the shopper can keep browsing; dispatches no cart write. Place it in the empty panel inside CartEmpty, commonly in a footer Container. It closes the drawer, so it requires a DrawerRoot ancestor — on a cart page with no drawer, compose a NavigationLink back to browsing instead of this control. Composed children are the button content (compose an icon that way); without them the text is the $content field label. See cart.md."
1018
1697
  });
1019
- function CartEmptyMessage({ text = "Your cart is empty", $content, className, ...props }) {
1020
- const message = $content?.text ?? text;
1021
- if (!message.trim()) return null;
1698
+ function CartEmptyMessage({ $content, $locale, className, ...props }) {
1699
+ const { format } = useMessageFormatter(CartEmptyMessageContent, $content);
1700
+ const message = format("text");
1701
+ if (message === "") return null;
1022
1702
  return /* @__PURE__ */ jsx("p", {
1023
1703
  ...props,
1024
1704
  className,
@@ -1027,18 +1707,19 @@ function CartEmptyMessage({ text = "Your cart is empty", $content, className, ..
1027
1707
  children: message
1028
1708
  });
1029
1709
  }
1030
- function CartContinueShopping({ label = "Continue shopping", $content, className, children, ...props }) {
1031
- const content = $content?.label ?? label;
1032
- if (children == null && !content.trim()) return null;
1710
+ function CartContinueShopping({ $content, $locale, className, children, ...props }) {
1711
+ const { format } = useMessageFormatter(CartContinueShoppingContent, $content);
1712
+ const content = children ?? format("label");
1713
+ if (content === "") return null;
1033
1714
  return /* @__PURE__ */ jsx(DrawerClose, {
1034
1715
  ...props,
1035
1716
  className,
1036
1717
  "data-fs-cart-continue-shopping": "",
1037
1718
  "data-fs-button": "",
1038
- children: children ?? content
1719
+ children: content
1039
1720
  });
1040
1721
  }
1041
1722
  //#endregion
1042
- export { CART_ALERT_ICON_NAMES, CartAlertContent, CartAlertIcon, CartAlertIconDefinition, CartAlertRoot, CartAlertRootDefinition, CartAlertText, CartAlertTextDefinition, CartAppliedCoupons, CartAppliedCouponsDefinition, CartCheckoutGuard, CartCheckoutGuardDefinition, CartCheckoutLabelContent, CartContinueShopping, CartContinueShoppingContent, CartContinueShoppingDefinition, CartCount, CartCountDefinition, CartCouponError, CartCouponErrorDefinition, CartCouponForm, CartCouponFormDefinition, CartCouponRemove, CartCouponRemoveDefinition, CartDataContext, CartDisclaimer, CartDisclaimerContent, CartDisclaimerDefinition, CartEmpty, CartEmptyDefinition, CartEmptyMessage, CartEmptyMessageContent, CartEmptyMessageDefinition, CartError, CartErrorDefinition, CartFilled, CartFilledDefinition, CartGoCheckout, CartGoCheckoutDefinition, CartItemSkeleton, CartList, CartListDefinition, CartLoading, CartLoadingDefinition, CartOpenOnAdd, CartOpenOnAddDefinition, CartRedirectOnAdd, CartRedirectOnAddDefinition, CartRemoveUnavailable, CartRemoveUnavailableDefinition, CartRoot, CartRootDefinition, CartTotal, CartTotalDefinition, CartTotalValueContext, CartUnavailableCount, CartUnavailableCountDefinition, formatPrice, useCart };
1723
+ export { CART_ALERT_ICON_NAMES, CART_COUPON_ERROR_FIELDS, CART_ERROR_FIELDS, CartAlertContent, CartAlertIcon, CartAlertIconDefinition, CartAlertRoot, CartAlertRootDefinition, CartAlertText, CartAlertTextDefinition, CartAllUnavailable, CartAllUnavailableDefinition, CartAllUnavailableMessage, CartAllUnavailableMessageContent, CartAllUnavailableMessageDefinition, CartAppliedCoupons, CartAppliedCouponsContent, CartAppliedCouponsDefinition, CartAvailableItems, CartAvailableItemsDefinition, CartCheckoutGuard, CartCheckoutGuardDefinition, CartCheckoutLabelContent, CartContinueShopping, CartContinueShoppingContent, CartContinueShoppingDefinition, CartCount, CartCountContent, CartCountDefinition, CartCouponEmpty, CartCouponEmptyDefinition, CartCouponError, CartCouponErrorContent, CartCouponErrorDefinition, CartCouponForm, CartCouponFormContent, CartCouponFormDefinition, CartCouponRemove, CartCouponRemoveDefinition, CartCouponSavings, CartCouponSavingsContent, CartCouponSavingsDefinition, CartCouponUnmatched, CartCouponUnmatchedContent, CartCouponUnmatchedDefinition, CartDataContext, CartDisclaimer, CartDisclaimerContent, CartDisclaimerDefinition, CartEmpty, CartEmptyDefinition, CartEmptyMessage, CartEmptyMessageContent, CartEmptyMessageDefinition, CartError, CartErrorContent, CartErrorDefinition, CartFilled, CartFilledDefinition, CartGoCheckout, CartGoCheckoutDefinition, CartItemSkeleton, CartList, CartListDefinition, CartLoading, CartLoadingDefinition, CartOpenOnAdd, CartOpenOnAddDefinition, CartRedirectOnAdd, CartRedirectOnAddDefinition, CartRemoveUnavailable, CartRemoveUnavailableContent, CartRemoveUnavailableDefinition, CartRoot, CartRootDefinition, CartTotal, CartTotalDefinition, CartTotalValueContext, CartUnavailableCount, CartUnavailableCountContent, CartUnavailableCountDefinition, CartUnavailableItems, CartUnavailableItemsDefinition, CartUnavailableLabel, CartUnavailableLabelContent, CartUnavailableLabelDefinition, CartUnavailableSection, CartUnavailableSectionDefinition, ClearCartButton, ClearCartButtonContent, ClearCartButtonDefinition, formatPrice, isFiniteAmount, useCart };
1043
1724
 
1044
1725
  //# sourceMappingURL=cart.js.map