@vtex/faststore 0.0.10 → 0.0.12

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 (509) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +0 -1
  3. package/dist/_virtual/_rolldown/runtime.js +4 -0
  4. package/dist/actions.json +6 -1
  5. package/dist/catalog.json +789 -1701
  6. package/dist/cli/index.d.ts +66 -28
  7. package/dist/cli/index.js +7371 -512
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/server-runtime.js +41 -60
  10. package/dist/cli/server-runtime.js.map +1 -1
  11. package/dist/client.d.ts +3 -3
  12. package/dist/client.js +2 -2
  13. package/dist/components.d.ts +63 -57
  14. package/dist/components.js +60 -54
  15. package/dist/content-types.json +5785 -754
  16. package/dist/core/dist/define-component.d.ts +1 -1
  17. package/dist/core/dist/define-content-type.d.ts +50 -2
  18. package/dist/core/dist/define-content-type.js +107 -3
  19. package/dist/core/dist/define-content-type.js.map +1 -1
  20. package/dist/core/dist/index.d.ts +2 -2
  21. package/dist/docs/access-code-field.md +1 -1
  22. package/dist/docs/access-code-sign-in.md +126 -77
  23. package/dist/docs/account-address-book.md +210 -95
  24. package/dist/docs/account-menu.md +14 -15
  25. package/dist/docs/account-saved-cards.md +44 -39
  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 +5 -2
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +39 -26
  32. package/dist/docs/card-summary.md +18 -8
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +39 -26
  36. package/dist/docs/cart-item.md +29 -14
  37. package/dist/docs/cart-totalizer.md +7 -5
  38. package/dist/docs/cart.md +135 -41
  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/form.md +54 -18
  50. package/dist/docs/free-shipping-progress.md +6 -5
  51. package/dist/docs/identity-edit.md +8 -2
  52. package/dist/docs/identity-summary.md +18 -5
  53. package/dist/docs/installments.md +46 -32
  54. package/dist/docs/my-account-profile.md +16 -11
  55. package/dist/docs/navigation-link.md +5 -3
  56. package/dist/docs/order-cancel.md +3 -1
  57. package/dist/docs/order-delivery-address.md +7 -5
  58. package/dist/docs/order-delivery-group.md +1 -3
  59. package/dist/docs/order-details-back.md +1 -1
  60. package/dist/docs/order-details-header.md +1 -4
  61. package/dist/docs/order-invoice-download.md +60 -0
  62. package/dist/docs/order-list-row.md +1 -1
  63. package/dist/docs/order-list-search.md +13 -20
  64. package/dist/docs/order-list-views.md +11 -17
  65. package/dist/docs/order-list.md +12 -5
  66. package/dist/docs/order-payment.md +9 -7
  67. package/dist/docs/order-placed-date.md +1 -1
  68. package/dist/docs/order-placed-payment-summary.md +28 -15
  69. package/dist/docs/order-placed.md +49 -14
  70. package/dist/docs/order-progress.md +1 -1
  71. package/dist/docs/order-status-badge.md +20 -9
  72. package/dist/docs/order-summary.md +2 -2
  73. package/dist/docs/order-tracking-link.md +58 -0
  74. package/dist/docs/payment-method-badges.md +30 -4
  75. package/dist/docs/payment-methods.md +1 -1
  76. package/dist/docs/payment.md +36 -17
  77. package/dist/docs/phone-field.md +4 -4
  78. package/dist/docs/place-order.md +84 -36
  79. package/dist/docs/postal-code-field.md +3 -1
  80. package/dist/docs/pricing.md +21 -23
  81. package/dist/docs/product-gallery.md +19 -20
  82. package/dist/docs/product-information.md +13 -9
  83. package/dist/docs/product-list.md +7 -6
  84. package/dist/docs/product-shelf.md +0 -1
  85. package/dist/docs/promotion.md +4 -2
  86. package/dist/docs/region.md +23 -15
  87. package/dist/docs/save-card.md +7 -6
  88. package/dist/docs/saved-cards.md +65 -36
  89. package/dist/docs/shipping-address.md +57 -21
  90. package/dist/docs/shipping-simulator.md +53 -15
  91. package/dist/docs/sign-in-disclosure.md +176 -0
  92. package/dist/docs/sign-in-form.md +78 -47
  93. package/dist/docs/sign-in-redirect.md +4 -2
  94. package/dist/docs/sign-in.md +173 -0
  95. package/dist/docs/toast.md +15 -4
  96. package/dist/docs/variant-selector.md +15 -11
  97. package/dist/domain-logic/dist/checkout/rules.js +33 -0
  98. package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
  99. package/dist/graphql/types.d.ts +4 -14
  100. package/dist/index.d.ts +2 -2
  101. package/dist/internal/client.d.ts +1 -3
  102. package/dist/internal/client.js +1 -1
  103. package/dist/internal/server.d.ts +7 -4
  104. package/dist/internal/server.js +7 -4
  105. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  106. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  108. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  109. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  110. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  111. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  112. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  113. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  114. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  115. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  116. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  117. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  118. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  120. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  121. package/dist/matter/account-address-book/account-address-book.js +74 -33
  122. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  123. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  124. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  126. package/dist/matter/account-address-book/account-address-country.js +83 -49
  127. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  128. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  129. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  131. package/dist/matter/account-address-book/account-address-form.js +518 -155
  132. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  133. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  134. package/dist/matter/account-address-book/account-address-record.js +32 -17
  135. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  136. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  137. package/dist/matter/account-menu/account-menu.js +46 -54
  138. package/dist/matter/account-menu/account-menu.js.map +1 -1
  139. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  140. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
  141. package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
  142. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
  143. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  144. package/dist/matter/billing-address/billing-address.js +227 -156
  145. package/dist/matter/billing-address/billing-address.js.map +1 -1
  146. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  147. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  148. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  149. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  150. package/dist/matter/buy-button/buy-button.js +10 -19
  151. package/dist/matter/buy-button/buy-button.js.map +1 -1
  152. package/dist/matter/card-entry/card-capture.js +12 -4
  153. package/dist/matter/card-entry/card-capture.js.map +1 -1
  154. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  155. package/dist/matter/card-entry/card-entry.js +348 -221
  156. package/dist/matter/card-entry/card-entry.js.map +1 -1
  157. package/dist/matter/cart/cart-namespace.d.ts +7 -1
  158. package/dist/matter/cart/cart-namespace.js +7 -1
  159. package/dist/matter/cart/cart-namespace.js.map +1 -1
  160. package/dist/matter/cart/cart.d.ts +402 -61
  161. package/dist/matter/cart/cart.js +624 -153
  162. package/dist/matter/cart/cart.js.map +1 -1
  163. package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
  164. package/dist/matter/cart-destination/cart-destination.js +160 -70
  165. package/dist/matter/cart-destination/cart-destination.js.map +1 -1
  166. package/dist/matter/cart-item/cart-item.d.ts +144 -17
  167. package/dist/matter/cart-item/cart-item.js +166 -49
  168. package/dist/matter/cart-item/cart-item.js.map +1 -1
  169. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  170. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  171. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  172. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  173. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  174. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  175. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  176. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  177. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  178. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  179. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  180. package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
  181. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  182. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  183. package/dist/matter/challenge-return/challenge-return.js +241 -0
  184. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  185. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  186. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  187. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  188. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  189. package/dist/matter/client-preferences/client-preferences.js +84 -15
  190. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  191. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  192. package/dist/matter/client-profile/client-profile.js +64 -24
  193. package/dist/matter/client-profile/client-profile.js.map +1 -1
  194. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  195. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  196. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  197. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  198. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  199. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  200. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  201. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  202. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  203. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  204. package/dist/matter/delivery-options/delivery-options.js +75 -12
  205. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  206. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  207. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  209. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  210. package/dist/matter/email-identification/email-identification.js +49 -12
  211. package/dist/matter/email-identification/email-identification.js.map +1 -1
  212. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
  213. package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  215. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  216. package/dist/matter/identity-edit/identity-edit.js +47 -19
  217. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  218. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  219. package/dist/matter/identity-summary/identity-summary.js +95 -45
  220. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  221. package/dist/matter/installments/installments-select.d.ts +98 -16
  222. package/dist/matter/installments/installments-select.js +156 -48
  223. package/dist/matter/installments/installments-select.js.map +1 -1
  224. package/dist/matter/installments/installments.d.ts +96 -16
  225. package/dist/matter/installments/installments.js +115 -40
  226. package/dist/matter/installments/installments.js.map +1 -1
  227. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  228. package/dist/matter/installments/use-installments-selection.js +8 -3
  229. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  230. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  231. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  232. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  233. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  234. package/dist/matter/order-cancel/order-cancel.js +118 -51
  235. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  236. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  237. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  238. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  239. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  240. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  241. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  242. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  243. package/dist/matter/order-details-header/order-details-header.js +66 -58
  244. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  245. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  246. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  247. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  248. package/dist/matter/order-list/order-list.d.ts +164 -19
  249. package/dist/matter/order-list/order-list.js +229 -87
  250. package/dist/matter/order-list/order-list.js.map +1 -1
  251. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  252. package/dist/matter/order-list-row/order-list-row.js +3 -2
  253. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  254. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  255. package/dist/matter/order-list-search/order-list-search.js +30 -69
  256. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  257. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  258. package/dist/matter/order-list-views/order-list-views.js +22 -68
  259. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  260. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  261. package/dist/matter/order-payment/order-payment.js +44 -39
  262. package/dist/matter/order-payment/order-payment.js.map +1 -1
  263. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  264. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  265. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  266. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  267. package/dist/matter/order-placed/order-placed.js +230 -139
  268. package/dist/matter/order-placed/order-placed.js.map +1 -1
  269. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  270. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  271. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  272. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  273. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  275. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  276. package/dist/matter/order-progress/order-progress.js +37 -45
  277. package/dist/matter/order-progress/order-progress.js.map +1 -1
  278. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  279. package/dist/matter/order-summary/order-summary.js +38 -44
  280. package/dist/matter/order-summary/order-summary.js.map +1 -1
  281. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  282. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  283. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  284. package/dist/matter/payment/payment-card-capture.js +17 -10
  285. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  286. package/dist/matter/payment/payment-controller.d.ts +4 -2
  287. package/dist/matter/payment/payment-controller.js +30 -9
  288. package/dist/matter/payment/payment-controller.js.map +1 -1
  289. package/dist/matter/payment/payment-method-badges.js +1 -1
  290. package/dist/matter/payment/payment.d.ts +69 -19
  291. package/dist/matter/payment/payment.js +101 -35
  292. package/dist/matter/payment/payment.js.map +1 -1
  293. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  294. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  295. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  296. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  297. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  298. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  299. package/dist/matter/place-order/place-order.d.ts +171 -57
  300. package/dist/matter/place-order/place-order.js +376 -185
  301. package/dist/matter/place-order/place-order.js.map +1 -1
  302. package/dist/matter/pricing/pricing.d.ts +152 -13
  303. package/dist/matter/pricing/pricing.js +153 -52
  304. package/dist/matter/pricing/pricing.js.map +1 -1
  305. package/dist/matter/product-information/product-information.d.ts +27 -4
  306. package/dist/matter/product-information/product-information.js +32 -15
  307. package/dist/matter/product-information/product-information.js.map +1 -1
  308. package/dist/matter/product-list/product-list.d.ts +24 -6
  309. package/dist/matter/product-list/product-list.js +32 -26
  310. package/dist/matter/product-list/product-list.js.map +1 -1
  311. package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
  312. package/dist/matter/product-shelf/product-shelf.js +2 -15
  313. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  314. package/dist/matter/region/region.d.ts +33 -16
  315. package/dist/matter/region/region.js +59 -52
  316. package/dist/matter/region/region.js.map +1 -1
  317. package/dist/matter/save-card/save-card.d.ts +43 -8
  318. package/dist/matter/save-card/save-card.js +61 -23
  319. package/dist/matter/save-card/save-card.js.map +1 -1
  320. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  321. package/dist/matter/saved-cards/saved-cards.js +349 -77
  322. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  323. package/dist/matter/shipping-address/address-payload.js +25 -0
  324. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  325. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  326. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  327. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  328. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  329. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  330. package/dist/matter/shipping-address/shipping-address.js +443 -188
  331. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  332. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
  333. package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
  334. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  335. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  336. package/dist/matter/sign-in/sign-in.js +285 -0
  337. package/dist/matter/sign-in/sign-in.js.map +1 -0
  338. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  339. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  341. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  342. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  343. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  344. package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
  345. package/dist/particles/binding-switcher/binding-switcher.js +37 -26
  346. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
  347. package/dist/particles/card-summary/card-summary.d.ts +38 -8
  348. package/dist/particles/card-summary/card-summary.js +55 -22
  349. package/dist/particles/card-summary/card-summary.js.map +1 -1
  350. package/dist/particles/carousel/carousel.d.ts +99 -11
  351. package/dist/particles/carousel/carousel.js +103 -35
  352. package/dist/particles/carousel/carousel.js.map +1 -1
  353. package/dist/particles/copy-text/copy-text.js +5 -15
  354. package/dist/particles/copy-text/copy-text.js.map +1 -1
  355. package/dist/particles/dialog/dialog.d.ts +14 -6
  356. package/dist/particles/dialog/dialog.js +6 -3
  357. package/dist/particles/dialog/dialog.js.map +1 -1
  358. package/dist/particles/drawer/drawer.js +1 -1
  359. package/dist/particles/drawer/drawer.js.map +1 -1
  360. package/dist/particles/email-field/email-field.d.ts +2 -1
  361. package/dist/particles/email-field/email-field.js +2 -1
  362. package/dist/particles/email-field/email-field.js.map +1 -1
  363. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  364. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  365. package/dist/particles/form/form.d.ts +85 -13
  366. package/dist/particles/form/form.js +91 -42
  367. package/dist/particles/form/form.js.map +1 -1
  368. package/dist/particles/gallery/gallery.d.ts +129 -12
  369. package/dist/particles/gallery/gallery.js +121 -34
  370. package/dist/particles/gallery/gallery.js.map +1 -1
  371. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  372. package/dist/particles/order-details-back/order-details-back.js +8 -10
  373. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  374. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  375. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  376. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  377. package/dist/particles/password-field/password-field.d.ts +1 -1
  378. package/dist/particles/password-field/password-field.js +2 -4
  379. package/dist/particles/password-field/password-field.js.map +1 -1
  380. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  381. package/dist/particles/phone-field/phone-field.js +8 -11
  382. package/dist/particles/phone-field/phone-field.js.map +1 -1
  383. package/dist/particles/spinner/spinner.d.ts +24 -4
  384. package/dist/particles/spinner/spinner.js +25 -9
  385. package/dist/particles/spinner/spinner.js.map +1 -1
  386. package/dist/particles/switch/switch.d.ts +4 -1
  387. package/dist/particles/switch/switch.js +3 -1
  388. package/dist/particles/switch/switch.js.map +1 -1
  389. package/dist/particles/toast/toast.d.ts +29 -3
  390. package/dist/particles/toast/toast.js +34 -10
  391. package/dist/particles/toast/toast.js.map +1 -1
  392. package/dist/schema.graphql +164 -56
  393. package/dist/sdk/address/address-fields.js +4 -4
  394. package/dist/sdk/address/address-fields.js.map +1 -1
  395. package/dist/sdk/address/constants.js +1 -6
  396. package/dist/sdk/address/constants.js.map +1 -1
  397. package/dist/sdk/address/messages.js +44 -44
  398. package/dist/sdk/address/messages.js.map +1 -1
  399. package/dist/sdk/address/postal-code.js +15 -2
  400. package/dist/sdk/address/postal-code.js.map +1 -1
  401. package/dist/sdk/address/types.d.ts +5 -3
  402. package/dist/sdk/address/validate-address.js +3 -3
  403. package/dist/sdk/address/validate-address.js.map +1 -1
  404. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  405. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  406. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  407. package/dist/sdk/data/index.js +2 -2
  408. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  409. package/dist/sdk/generated/gql.js +1 -1
  410. package/dist/sdk/generated/gql.js.map +1 -1
  411. package/dist/sdk/generated/graphql.d.ts +20 -5
  412. package/dist/sdk/generated/graphql.js +6 -0
  413. package/dist/sdk/generated/graphql.js.map +1 -1
  414. package/dist/sdk/i18n/format-error-code.js +23 -0
  415. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  416. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  417. package/dist/sdk/i18n/message-formatter.js +140 -0
  418. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  419. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  420. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  421. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  422. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  423. package/dist/sdk/navigation/redirect.d.ts +2 -0
  424. package/dist/sdk/navigation/redirect.js +19 -1
  425. package/dist/sdk/navigation/redirect.js.map +1 -1
  426. package/dist/sdk/navigation/types.d.ts +13 -0
  427. package/dist/sdk/payment/bin-format.js +21 -0
  428. package/dist/sdk/payment/bin-format.js.map +1 -0
  429. package/dist/sdk/payment/challenge-return.js +37 -0
  430. package/dist/sdk/payment/challenge-return.js.map +1 -0
  431. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  432. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  433. package/dist/sdk/payment/gateway.d.ts +1 -1
  434. package/dist/sdk/payment/gateway.js +8 -2
  435. package/dist/sdk/payment/gateway.js.map +1 -1
  436. package/dist/sdk/payment/operations.d.ts +1 -0
  437. package/dist/sdk/payment/operations.js +28 -6
  438. package/dist/sdk/payment/operations.js.map +1 -1
  439. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  440. package/dist/sdk/payment/resumed-purchase.js +119 -0
  441. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  442. package/dist/sdk/payment/security-code-mask.js +16 -23
  443. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  444. package/dist/sdk/payment/submission-registry.js +6 -2
  445. package/dist/sdk/payment/submission-registry.js.map +1 -1
  446. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  447. package/dist/sdk/payment/use-payment-actions.js +23 -4
  448. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  449. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  450. package/dist/sdk/payment/use-place-order.js +138 -76
  451. package/dist/sdk/payment/use-place-order.js.map +1 -1
  452. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  453. package/dist/sdk/provider/storefront-provider.js +4 -11
  454. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  455. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  456. package/dist/sdk/seo/entity-landing.js +30 -0
  457. package/dist/sdk/seo/entity-landing.js.map +1 -0
  458. package/dist/sdk/seo/page-alternates.d.ts +3 -2
  459. package/dist/sdk/seo/page-alternates.js +4 -2
  460. package/dist/sdk/seo/page-alternates.js.map +1 -1
  461. package/dist/sdk/seo/search-landing.d.ts +42 -0
  462. package/dist/sdk/seo/search-landing.js +85 -0
  463. package/dist/sdk/seo/search-landing.js.map +1 -0
  464. package/dist/sdk/session/mock-session.d.ts +9 -0
  465. package/dist/sdk/session/mock-session.js +31 -0
  466. package/dist/sdk/session/mock-session.js.map +1 -0
  467. package/dist/sdk/session/read-server-session.d.ts +3 -0
  468. package/dist/sdk/session/read-server-session.js +5 -0
  469. package/dist/sdk/session/read-server-session.js.map +1 -1
  470. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  471. package/dist/sdk/session/return-path-segment.js +15 -0
  472. package/dist/sdk/session/return-path-segment.js.map +1 -0
  473. package/dist/sdk/session/use-session-actions.js.map +1 -1
  474. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  475. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  476. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  477. package/dist/utils/safe-href.d.ts +2 -0
  478. package/package.json +4 -3
  479. package/skills/storefront-asset/SKILL.md +2 -2
  480. package/skills/storefront-asset/references/api-side.md +27 -14
  481. package/skills/storefront-asset/references/findings.md +5 -2
  482. package/src/styles/tailwind.css +8 -0
  483. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  484. package/dist/message-locales.json +0 -7
  485. package/dist/sdk/i18n/client.d.ts +0 -4
  486. package/dist/sdk/i18n/client.js +0 -4
  487. package/dist/sdk/i18n/locales.d.ts +0 -8
  488. package/dist/sdk/i18n/locales.js +0 -57
  489. package/dist/sdk/i18n/locales.js.map +0 -1
  490. package/dist/sdk/i18n/messages/en-US.js +0 -183
  491. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  492. package/dist/sdk/i18n/messages/en-US.json +0 -178
  493. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
  494. package/dist/sdk/i18n/messages/es-ES.js +0 -183
  495. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  496. package/dist/sdk/i18n/messages/es-ES.json +0 -178
  497. package/dist/sdk/i18n/messages/pt-BR.js +0 -183
  498. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  499. package/dist/sdk/i18n/messages/pt-BR.json +0 -178
  500. package/dist/sdk/i18n/provider.d.ts +0 -1
  501. package/dist/sdk/i18n/provider.js +0 -30
  502. package/dist/sdk/i18n/provider.js.map +0 -1
  503. package/dist/sdk/i18n/server.d.ts +0 -28
  504. package/dist/sdk/i18n/server.js +0 -59
  505. package/dist/sdk/i18n/server.js.map +0 -1
  506. package/dist/utils/resolve-authored-copy.js +0 -18
  507. package/dist/utils/resolve-authored-copy.js.map +0 -1
  508. package/dist/utils/substitute-template.js +0 -33
  509. package/dist/utils/substitute-template.js.map +0 -1
@@ -1,8 +1,9 @@
1
- import { ContentValue } from "../../core/dist/define-content-type.js";
1
+ import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
2
2
  import { ComponentDefinition } from "../../core/dist/define-component.js";
3
3
  import "../../core/dist/index.js";
4
4
  import { ShippingAddressUpdateErrorEntity } from "../../sdk/shipping/shipping-operations.js";
5
5
  import { ComponentActions } from "../../sdk/actions/types.js";
6
+ import { CountryRules } from "../../sdk/address/types.js";
6
7
  import { ComponentPropsWithRef, ReactNode } from "react";
7
8
  //#region src/matter/cart-destination/cart-destination.d.ts
8
9
  export declare const CartDestinationValueContent: {
@@ -72,7 +73,7 @@ export declare const CartDestinationCancelContent: {
72
73
  export declare const CartDestinationErrorContent: {
73
74
  readonly id: "cart-destination-error";
74
75
  readonly title: "Cart Destination Error";
75
- readonly description: "Message shown when the destination write fails.";
76
+ readonly description: "Messages shown when the destination write is refused, one per error code the shopper can act on.";
76
77
  readonly schema: {
77
78
  readonly type: "object";
78
79
  readonly additionalProperties: false;
@@ -80,6 +81,16 @@ export declare const CartDestinationErrorContent: {
80
81
  readonly genericMessage: {
81
82
  readonly type: "string";
82
83
  readonly title: "Failure message";
84
+ readonly description: "Shown for a network failure and for every refusal the shopper cannot act on.";
85
+ readonly format: "icu-message";
86
+ readonly messageSource: "Unable to update the delivery location. Please try again.";
87
+ };
88
+ readonly invalidPostalCodeMessage: {
89
+ readonly type: "string";
90
+ readonly title: "Invalid postal code message";
91
+ readonly description: "Shown when the server rejects the postal code.";
92
+ readonly format: "icu-message";
93
+ readonly messageSource: "Enter a valid postal code.";
83
94
  };
84
95
  };
85
96
  };
@@ -115,7 +126,7 @@ export type CartDestinationValueProps = Omit<ComponentPropsWithRef<'span'>, 'chi
115
126
  /** Merchant-authored copy; wins over the prop when present. */
116
127
  $content?: ContentValue<typeof CartDestinationValueContent>;
117
128
  };
118
- export type CartDestinationUnsetProps = ComponentPropsWithRef<'div'>;
129
+ export type CartDestinationUnsetProps = ComponentPropsWithRef<'button'>;
119
130
  export type CartDestinationChangeProps = ComponentPropsWithRef<'button'> & {
120
131
  label?: string;
121
132
  $content?: ContentValue<typeof CartDestinationChangeContent>;
@@ -123,11 +134,10 @@ export type CartDestinationChangeProps = ComponentPropsWithRef<'button'> & {
123
134
  export type CartDestinationFormProps = ComponentPropsWithRef<'form'>;
124
135
  export type CartDestinationPostalCodeControlProps = {
125
136
  className?: string;
126
- /** Mask template; defaults to the one of the cart's country. */
127
- mask?: string;
128
137
  label?: string;
138
+ /** Wins over the example the country's rules give. */
129
139
  placeholder?: string;
130
- /** The field's own message for a draft that is incomplete or fails the country's pattern. */
140
+ /** The field's own message for a draft that fails the country's postal code rules. */
131
141
  invalidMessage?: string;
132
142
  };
133
143
  export type CartDestinationSubmitProps = ComponentPropsWithRef<'button'> & {
@@ -139,9 +149,8 @@ export type CartDestinationCancelProps = ComponentPropsWithRef<'button'> & {
139
149
  label?: string;
140
150
  $content?: ContentValue<typeof CartDestinationCancelContent>;
141
151
  };
142
- /** Children are omitted: what this renders is the write's own error, never authored content. */
143
- export type CartDestinationErrorProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
144
- genericMessage?: string;
152
+ /** Children are omitted: what this renders is the message for the write's error code. */
153
+ export type CartDestinationErrorProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & MessageLocaleProp & {
145
154
  $content?: ContentValue<typeof CartDestinationErrorContent>;
146
155
  };
147
156
  export type CartDestinationContextValue = Readonly<{
@@ -160,18 +169,20 @@ export type CartDestinationContextValue = Readonly<{
160
169
  cancel: () => void;
161
170
  draft: string;
162
171
  setDraft: (value: string) => void;
163
- /** The draft is complete, valid, different from the current one, and no write is pending. */
172
+ /**
173
+ * The country's rules for edit mode. `null` while they load, and when the load failed or the
174
+ * country is outside the library: the draft is then free text and nothing validates it.
175
+ */
176
+ rules: CountryRules | null;
177
+ /** The rules are still loading: the field and Submit stay disabled. */
178
+ rulesLoading: boolean;
179
+ /** The draft is valid for the country, different from the current one, and no write is pending. */
164
180
  canSubmit: boolean;
165
181
  pending: boolean;
166
182
  errors: readonly ShippingAddressUpdateErrorEntity[];
167
183
  /** The last submit was refused locally. */
168
184
  invalid: boolean;
169
185
  submit: () => void;
170
- /**
171
- * The postal code control reports the mask it renders (`null` on unmount), so the root validates the
172
- * draft against the same one. Without a control the root uses the country's mask.
173
- */
174
- registerMask: (mask: string | null) => void;
175
186
  }>;
176
187
  /**
177
188
  * Read the destination and the edit-mode state from the nearest `CartDestinationRoot`. Throws outside
@@ -181,7 +192,7 @@ export declare function useCartDestination(): CartDestinationContextValue;
181
192
  export declare const CartDestinationRootDefinition: ComponentDefinition<CartDestinationRootProps>;
182
193
  export declare const CartDestinationReadDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
183
194
  export declare const CartDestinationValueDefinition: ComponentDefinition<CartDestinationValueProps>;
184
- export declare const CartDestinationUnsetDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
195
+ export declare const CartDestinationUnsetDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
185
196
  export declare const CartDestinationChangeDefinition: ComponentDefinition<CartDestinationChangeProps>;
186
197
  export declare const CartDestinationFormDefinition: ComponentDefinition<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
187
198
  export declare const CartDestinationPostalCodeControlDefinition: ComponentDefinition<CartDestinationPostalCodeControlProps>;
@@ -199,13 +210,13 @@ export declare const CartDestinationErrorDefinition: ComponentDefinition<CartDes
199
210
  export declare function CartDestinationRoot({ defaultCountry, $data: $dataProp, $actions: $actionsProp, className, children, ...props }: CartDestinationRootProps): import("react/jsx-runtime").JSX.Element;
200
211
  export declare function CartDestinationRead({ className, children, ...props }: CartDestinationReadProps): import("react/jsx-runtime").JSX.Element | null;
201
212
  export declare function CartDestinationValue({ prefix, $content, className, ...props }: CartDestinationValueProps): import("react/jsx-runtime").JSX.Element | null;
202
- export declare function CartDestinationUnset({ className, children, ...props }: CartDestinationUnsetProps): import("react/jsx-runtime").JSX.Element | null;
213
+ export declare function CartDestinationUnset({ className, children, onClick, ...props }: CartDestinationUnsetProps): import("react/jsx-runtime").JSX.Element | null;
203
214
  export declare function CartDestinationChange({ label, $content, className, children, ...props }: CartDestinationChangeProps): import("react/jsx-runtime").JSX.Element;
204
215
  export declare function CartDestinationForm({ className, children, ...props }: CartDestinationFormProps): import("react/jsx-runtime").JSX.Element | null;
205
- export declare function CartDestinationPostalCodeControl({ className, mask, label, placeholder, invalidMessage }: Readonly<CartDestinationPostalCodeControlProps>): import("react/jsx-runtime").JSX.Element;
216
+ export declare function CartDestinationPostalCodeControl({ className, label, placeholder, invalidMessage }: Readonly<CartDestinationPostalCodeControlProps>): import("react/jsx-runtime").JSX.Element;
206
217
  export declare function CartDestinationSubmit({ label, pendingLabel, $content, className, children, ...props }: CartDestinationSubmitProps): import("react/jsx-runtime").JSX.Element;
207
218
  export declare function CartDestinationCancel({ label, $content, className, children, ...props }: CartDestinationCancelProps): import("react/jsx-runtime").JSX.Element;
208
- export declare function CartDestinationError({ genericMessage, $content, className, ...props }: CartDestinationErrorProps): import("react/jsx-runtime").JSX.Element | null;
219
+ export declare function CartDestinationError({ $content, $locale, className, ...props }: CartDestinationErrorProps): import("react/jsx-runtime").JSX.Element | null;
209
220
  export declare const CartDestination: {
210
221
  Root: typeof CartDestinationRoot;
211
222
  Read: typeof CartDestinationRead;
@@ -2,12 +2,19 @@
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 { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
6
+ import { Field } from "../../particles/field/field.js";
5
7
  import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
8
+ import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
6
9
  import { useDataOverride } from "../../sdk/data/data-override-context.js";
10
+ import { loggableErrorName } from "../../utils/loggable-error-name.js";
7
11
  import { ReactiveRootContext } from "../../sdk/data/page-reactive-data-root.js";
8
- import { getCountryDescriptor } from "../shipping-address/country-descriptors.js";
12
+ import { addressFields } from "../../sdk/address/address-fields.js";
13
+ import { loadCountryRules } from "../../sdk/address/country-rules.js";
14
+ import { validateAddress } from "../../sdk/address/validate-address.js";
15
+ import { normalizePostalCode } from "../../sdk/address/postal-code.js";
9
16
  import { awaitCartWrites } from "../../sdk/cart/write-gate.js";
10
- import { PostalCodeField, isPostalCodeComplete } from "../../particles/postal-code-field/postal-code-field.js";
17
+ import { Input } from "../../particles/input/input.js";
11
18
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
12
19
  import { jsx, jsxs } from "react/jsx-runtime";
13
20
  //#region src/matter/cart-destination/cart-destination.tsx
@@ -88,14 +95,26 @@ const CartDestinationCancelContent = defineContentType({
88
95
  const CartDestinationErrorContent = defineContentType({
89
96
  id: "cart-destination-error",
90
97
  title: "Cart Destination Error",
91
- description: "Message shown when the destination write fails.",
98
+ description: "Messages shown when the destination write is refused, one per error code the shopper can act on.",
92
99
  schema: {
93
100
  type: "object",
94
101
  additionalProperties: false,
95
- properties: { genericMessage: {
96
- type: "string",
97
- title: "Failure message"
98
- } }
102
+ properties: {
103
+ genericMessage: {
104
+ type: "string",
105
+ title: "Failure message",
106
+ description: "Shown for a network failure and for every refusal the shopper cannot act on.",
107
+ format: "icu-message",
108
+ messageSource: "Unable to update the delivery location. Please try again."
109
+ },
110
+ invalidPostalCodeMessage: {
111
+ type: "string",
112
+ title: "Invalid postal code message",
113
+ description: "Shown when the server rejects the postal code.",
114
+ format: "icu-message",
115
+ messageSource: "Enter a valid postal code."
116
+ }
117
+ }
99
118
  }
100
119
  });
101
120
  const CART_DESTINATION_CONTEXT_UNSET = Symbol("CartDestinationContextUnset");
@@ -112,24 +131,18 @@ function useCartDestination() {
112
131
  /** Whether a `CartDestinationForm` encloses the subtree, so `CartDestinationSubmit` knows its form owner. */
113
132
  const CartDestinationFormContext = createContext(false);
114
133
  const DEFAULT_COUNTRY = "BRA";
115
- /** Mask per country; the field's own default (the Brazilian CEP) covers any country not listed. */
116
- const DEFAULT_MASK = "99999-999";
117
- const COUNTRY_MASKS = {
118
- BRA: DEFAULT_MASK,
119
- USA: "99999|99999-9999"
120
- };
121
- function maskFor(country) {
122
- return COUNTRY_MASKS[country] ?? DEFAULT_MASK;
134
+ /** Whether the country's rules refuse the value. A country the library does not cover refuses nothing. */
135
+ function isPostalCodeRefused(value, rules) {
136
+ if (!rules?.covered) return false;
137
+ return validateAddress({ postalCode: value.trim() }, rules).postalCode !== void 0;
123
138
  }
124
- /** Letters and digits only, so `01310100` and `01310-100` compare equal. */
125
- function normalizePostalCode(value) {
126
- return value.replaceAll(/[^0-9A-Za-z]/g, "").toUpperCase();
139
+ /** The form the write sends and the comparison uses: the country's own, else the trimmed text. */
140
+ function toStoredPostalCode(value, rules) {
141
+ return rules ? normalizePostalCode(value, rules) : value.trim();
127
142
  }
128
- function isDraftValid(draft, country, mask) {
129
- if (!isPostalCodeComplete(draft, mask)) return false;
130
- const pattern = getCountryDescriptor(country)?.fields.find((field) => field.name === "postalCode")?.rule?.pattern;
131
- if (!pattern) return true;
132
- return (pattern instanceof RegExp ? pattern : pattern.value).test(draft);
143
+ function isDraftSubmittable(draft, current, rules) {
144
+ if (draft.trim() === "" || isPostalCodeRefused(draft, rules)) return false;
145
+ return toStoredPostalCode(draft, rules) !== toStoredPostalCode(current ?? "", rules);
133
146
  }
134
147
  const CartDestinationRootDefinition = defineComponent({
135
148
  name: "CartDestinationRoot",
@@ -188,7 +201,7 @@ const CartDestinationUnsetDefinition = defineComponent({
188
201
  category: "content"
189
202
  },
190
203
  schema: {},
191
- guideline: "Renders its children only once the destination resolved and none is set. Place the store-authored invitation (for example a Text reading \"Informe seu CEP\") inside it, within CartDestinationRead. Must be inside CartDestinationRoot."
204
+ guideline: "A button that opens edit mode when pressed, like CartDestinationChange, with aria-expanded tied to the mode. Renders only once the destination resolved and none is set. Its children are the store-authored invitation (for example an Icon and a Text reading \"Informe seu CEP\"). Never place a CartDestinationChange, a link or another button inside it: a button cannot hold another. The regular CartDestinationChange repeats it, so the store usually hides that one while this shows. Place it within CartDestinationRead. Must be inside CartDestinationRoot."
192
205
  });
193
206
  const CartDestinationChangeDefinition = defineComponent({
194
207
  name: "CartDestinationChange",
@@ -228,10 +241,6 @@ const CartDestinationPostalCodeControlDefinition = defineComponent({
228
241
  category: "content"
229
242
  },
230
243
  schema: {
231
- mask: {
232
- type: "string",
233
- label: "Mask pattern"
234
- },
235
244
  label: {
236
245
  type: "string",
237
246
  label: "Label"
@@ -245,7 +254,7 @@ const CartDestinationPostalCodeControlDefinition = defineComponent({
245
254
  label: "Invalid-value message"
246
255
  }
247
256
  },
248
- guideline: "The postal code input of edit mode, empty each time edit mode opens and focused on open. The mask follows the cart country unless set. Must be inside CartDestinationForm."
257
+ guideline: "The postal code input of edit mode, empty each time edit mode opens and focused once enabled. A plain text field whose limits and example come from the cart country's postal code rules; it stays disabled while they load, and a country the rules do not cover takes free text. Must be inside CartDestinationForm."
249
258
  });
250
259
  const CartDestinationSubmitDefinition = defineComponent({
251
260
  name: "CartDestinationSubmit",
@@ -267,7 +276,7 @@ const CartDestinationSubmitDefinition = defineComponent({
267
276
  label: "Pending label"
268
277
  }
269
278
  },
270
- guideline: "Writes the typed postal code. Disabled until it is complete for the country, valid and different from the current one, and while a write is pending (aria-busy). Must be inside CartDestinationForm."
279
+ guideline: "Writes the typed postal code. Disabled until the country's rules have loaded, the typed code is valid for the country (any text for a country the rules do not cover) and different from the current one, and while a write is pending (aria-busy). Must be inside CartDestinationForm."
271
280
  });
272
281
  const CartDestinationCancelDefinition = defineComponent({
273
282
  name: "CartDestinationCancel",
@@ -295,11 +304,8 @@ const CartDestinationErrorDefinition = defineComponent({
295
304
  label: "Cart Destination Error",
296
305
  category: "content"
297
306
  },
298
- schema: { genericMessage: {
299
- type: "string",
300
- label: "Failure message"
301
- } },
302
- guideline: "Announces why the destination write failed, as an alert, and renders nothing otherwise. Author one message covering a refused postal code and a network failure: both reach the client as the same error. Must be inside CartDestinationForm."
307
+ schema: {},
308
+ guideline: "Announces why the destination write failed, as an alert, and renders nothing otherwise. Words each error code from its $content: invalidPostalCodeMessage for a postal code the server rejects, genericMessage for a network failure and every refusal the shopper cannot act on. A postal code the platform refuses upstream also reaches the client as a network failure, so write genericMessage to cover it. An unknown code also shows genericMessage. Must be inside CartDestinationForm."
303
309
  });
304
310
  /**
305
311
  * Reads the cart destination reactively and publishes it, the edit-mode flag, the draft and the write
@@ -326,19 +332,47 @@ function CartDestinationRoot({ defaultCountry = DEFAULT_COUNTRY, $data: $dataPro
326
332
  const rootRef = useRef(null);
327
333
  const wasEditingRef = useRef(false);
328
334
  /**
329
- * Opening edit mode moves focus to the field; leaving it moves focus back to the change control,
330
- * which only mounts once read mode renders again, hence an effect on the flag rather than a call at
331
- * the event.
335
+ * Leaving edit mode moves focus back to the control that opens it, which only mounts once read mode
336
+ * renders again, hence an effect on the flag rather than a call at the event. With no destination that
337
+ * is the invitation; the change control is hidden then, so the invitation wins when both exist.
338
+ * Opening it focuses the field, which `CartDestinationPostalCodeControl` does once the rules have loaded and enabled it.
332
339
  */
333
340
  useEffect(() => {
334
341
  if (wasEditingRef.current === editing) return;
335
342
  wasEditingRef.current = editing;
336
- const selector = editing ? "[data-fs-postal-code-field-input]" : "[data-fs-cart-destination-change]";
337
- rootRef.current?.querySelector(selector)?.focus();
343
+ if (editing) return;
344
+ (rootRef.current?.querySelector("[data-fs-cart-destination-unset]") ?? rootRef.current?.querySelector("[data-fs-cart-destination-change]"))?.focus();
338
345
  }, [editing]);
339
- const [registeredMask, setRegisteredMask] = useState(null);
340
- const mask = registeredMask ?? maskFor(country);
341
- const canSubmit = !pending && isDraftValid(draft, country, mask) && normalizePostalCode(draft) !== normalizePostalCode(postalCode ?? "");
346
+ const [loaded, setLoaded] = useState(null);
347
+ useEffect(() => {
348
+ if (!editing) {
349
+ setLoaded((current) => current?.rules ? current : null);
350
+ return;
351
+ }
352
+ let active = true;
353
+ loadCountryRules(country).then((rules) => {
354
+ if (active) setLoaded({
355
+ country,
356
+ rules
357
+ });
358
+ }, (error) => {
359
+ if (!active) return;
360
+ console.warn("[CartDestinationRoot] country rules failed to load", {
361
+ country,
362
+ error: loggableErrorName(error)
363
+ });
364
+ setLoaded({
365
+ country,
366
+ rules: null
367
+ });
368
+ });
369
+ return () => {
370
+ active = false;
371
+ };
372
+ }, [editing, country]);
373
+ const rulesLoading = editing && loaded?.country !== country;
374
+ const rules = loaded?.country === country ? loaded.rules : null;
375
+ const canSubmit = !pending && !rulesLoading && isDraftSubmittable(draft, postalCode, rules);
342
376
  const startEditing = useCallback(() => setEditing(true), []);
343
377
  const cancel = useCallback(() => {
344
378
  setEditing(false);
@@ -365,7 +399,7 @@ function CartDestinationRoot({ defaultCountry = DEFAULT_COUNTRY, $data: $dataPro
365
399
  setErrors([]);
366
400
  setInvalid(false);
367
401
  awaitCartWrites().then(() => setAddress({
368
- postalCode: draft,
402
+ postalCode: toStoredPostalCode(draft, rules),
369
403
  country
370
404
  })).then((writeErrors) => {
371
405
  if (writeErrors.length > 0) {
@@ -382,7 +416,8 @@ function CartDestinationRoot({ defaultCountry = DEFAULT_COUNTRY, $data: $dataPro
382
416
  $actions,
383
417
  canSubmit,
384
418
  draft,
385
- country
419
+ country,
420
+ rules
386
421
  ]);
387
422
  const value = useMemo(() => ({
388
423
  postalCode,
@@ -395,12 +430,13 @@ function CartDestinationRoot({ defaultCountry = DEFAULT_COUNTRY, $data: $dataPro
395
430
  cancel,
396
431
  draft,
397
432
  setDraft: updateDraft,
433
+ rules,
434
+ rulesLoading,
398
435
  canSubmit,
399
436
  pending,
400
437
  errors,
401
438
  invalid,
402
- submit,
403
- registerMask: setRegisteredMask
439
+ submit
404
440
  }), [
405
441
  postalCode,
406
442
  address?.city,
@@ -412,6 +448,8 @@ function CartDestinationRoot({ defaultCountry = DEFAULT_COUNTRY, $data: $dataPro
412
448
  cancel,
413
449
  draft,
414
450
  updateDraft,
451
+ rules,
452
+ rulesLoading,
415
453
  canSubmit,
416
454
  pending,
417
455
  errors,
@@ -477,11 +515,17 @@ function CartDestinationValue({ prefix, $content, className, ...props }) {
477
515
  ]
478
516
  });
479
517
  }
480
- function CartDestinationUnset({ className, children, ...props }) {
481
- const { postalCode, loading } = useCartDestination();
518
+ function CartDestinationUnset({ className, children, onClick, ...props }) {
519
+ const { postalCode, loading, editing, startEditing } = useCartDestination();
482
520
  if (loading || postalCode != null) return null;
483
- return /* @__PURE__ */ jsx("div", {
521
+ return /* @__PURE__ */ jsx("button", {
484
522
  ...props,
523
+ type: "button",
524
+ onClick: (event) => {
525
+ onClick?.(event);
526
+ startEditing();
527
+ },
528
+ "aria-expanded": editing,
485
529
  className,
486
530
  "data-fs-cart-destination-unset": "",
487
531
  children
@@ -522,15 +566,21 @@ function CartDestinationForm({ className, children, ...props }) {
522
566
  })
523
567
  });
524
568
  }
525
- function CartDestinationPostalCodeControl({ className, mask, label, placeholder, invalidMessage }) {
526
- const { country, draft, setDraft, errors, invalid, pending, registerMask } = useCartDestination();
569
+ function CartDestinationPostalCodeControl({ className, label, placeholder, invalidMessage }) {
570
+ const { draft, setDraft, errors, invalid, pending, rules, rulesLoading } = useCartDestination();
527
571
  const rootRef = useRef(null);
572
+ const focusedOnOpenRef = useRef(false);
573
+ const [blurInvalid, setBlurInvalid] = useState(false);
528
574
  const refused = errors.length > 0;
529
- const effectiveMask = mask ?? maskFor(country);
575
+ const descriptor = useMemo(() => rules ? addressFields(rules, {}).find(({ name }) => name === "postalCode") : void 0, [rules]);
576
+ /** The country's example postal code: address data, not a message. */
577
+ const example = descriptor?.placeholder?.values.example;
578
+ /** A disabled input cannot take focus, so opening edit mode focuses the field once the rules enable it. */
530
579
  useEffect(() => {
531
- registerMask(effectiveMask);
532
- return () => registerMask(null);
533
- }, [effectiveMask, registerMask]);
580
+ if (rulesLoading || focusedOnOpenRef.current) return;
581
+ focusedOnOpenRef.current = true;
582
+ rootRef.current?.querySelector("[data-fs-postal-code-field-input]")?.focus();
583
+ }, [rulesLoading]);
534
584
  /**
535
585
  * Disabling the input while the write is in flight drops focus to the body, so a refusal otherwise
536
586
  * lands with nothing focused. Waits for `pending` to clear: focusing a disabled input is a no-op.
@@ -539,18 +589,42 @@ function CartDestinationPostalCodeControl({ className, mask, label, placeholder,
539
589
  if (!refused || pending) return;
540
590
  rootRef.current?.querySelector("[data-fs-postal-code-field-input]")?.focus();
541
591
  }, [refused, pending]);
542
- return /* @__PURE__ */ jsx(PostalCodeField, {
592
+ function handleChange(event) {
593
+ setBlurInvalid(false);
594
+ setDraft(event.target.value);
595
+ }
596
+ const showInvalid = invalid || refused || blurInvalid;
597
+ return /* @__PURE__ */ jsxs(Field.Root, {
543
598
  ref: rootRef,
544
599
  className,
600
+ name: "postalCode",
601
+ invalid: showInvalid,
602
+ disabled: pending || rulesLoading,
603
+ "data-fs-postal-code-field": "",
545
604
  "data-fs-cart-destination-postal-code-control": "",
546
- mask: effectiveMask,
547
- label,
548
- placeholder,
549
- errorMessage: refused ? void 0 : invalidMessage,
550
- value: draft,
551
- onValueChange: setDraft,
552
- invalid: invalid || refused,
553
- disabled: pending
605
+ children: [
606
+ label ? /* @__PURE__ */ jsx(Field.Label, {
607
+ "data-fs-postal-code-field-label": "",
608
+ children: label
609
+ }) : null,
610
+ /* @__PURE__ */ jsx(Input, {
611
+ "data-fs-postal-code-field-input": "",
612
+ type: "text",
613
+ name: "postalCode",
614
+ autoComplete: "postal-code",
615
+ value: draft,
616
+ maxLength: descriptor?.maxLength,
617
+ inputMode: descriptor?.inputMode,
618
+ placeholder: placeholder ?? example,
619
+ onChange: handleChange,
620
+ onBlur: () => setBlurInvalid(draft.trim() !== "" && isPostalCodeRefused(draft, rules))
621
+ }),
622
+ showInvalid && !refused && invalidMessage ? /* @__PURE__ */ jsx(Field.Error, {
623
+ match: true,
624
+ "data-fs-postal-code-field-error": "",
625
+ children: invalidMessage
626
+ }) : null
627
+ ]
554
628
  });
555
629
  }
556
630
  function CartDestinationSubmit({ label, pendingLabel, $content, className, children, ...props }) {
@@ -583,16 +657,32 @@ function CartDestinationCancel({ label, $content, className, children, ...props
583
657
  children: children ?? resolvedLabel
584
658
  });
585
659
  }
586
- function CartDestinationError({ genericMessage, $content, className, ...props }) {
660
+ /**
661
+ * The message for each code `shippingAddressUpdate` can return, plus the client-minted transport failure.
662
+ * This form writes only the postal code and the country, so every other refusal is one the shopper
663
+ * cannot act on here.
664
+ */
665
+ const CART_DESTINATION_ERROR_FIELDS = {
666
+ INVALID_POSTAL_CODE: "invalidPostalCodeMessage",
667
+ INVALID_ADDRESS: "genericMessage",
668
+ INVALID_COUNTRY_CODE: "genericMessage",
669
+ MISSING_RECIPIENT_NAME: "genericMessage",
670
+ INVALID_SAVED_ADDRESS_ID: "genericMessage",
671
+ MISSING_CART_CONTEXT: "genericMessage",
672
+ CART_NOT_FOUND: "genericMessage",
673
+ NETWORK_ERROR: "genericMessage"
674
+ };
675
+ function CartDestinationError({ $content, $locale, className, ...props }) {
587
676
  const { errors } = useCartDestination();
588
- if (errors.length === 0) return null;
589
- const authored = pickAuthored($content?.genericMessage, genericMessage);
677
+ const { format } = useMessageFormatter(CartDestinationErrorContent, $content);
678
+ const [firstError] = errors;
679
+ if (!firstError) return null;
590
680
  return /* @__PURE__ */ jsx("div", {
591
681
  ...props,
592
682
  role: "alert",
593
683
  className,
594
684
  "data-fs-cart-destination-error": "",
595
- children: authored ?? errors[0]?.message
685
+ children: formatErrorCode(CartDestinationErrorContent, CART_DESTINATION_ERROR_FIELDS, firstError, format, "genericMessage")
596
686
  });
597
687
  }
598
688
  const CartDestination = {
@@ -608,6 +698,6 @@ const CartDestination = {
608
698
  Error: CartDestinationError
609
699
  };
610
700
  //#endregion
611
- export { CartDestination, CartDestinationCancel, CartDestinationCancelContent, CartDestinationCancelDefinition, CartDestinationChange, CartDestinationChangeContent, CartDestinationChangeDefinition, CartDestinationError, CartDestinationErrorContent, CartDestinationErrorDefinition, CartDestinationForm, CartDestinationFormDefinition, CartDestinationPostalCodeControl, CartDestinationPostalCodeControlDefinition, CartDestinationRead, CartDestinationReadDefinition, CartDestinationRoot, CartDestinationRootDefinition, CartDestinationSubmit, CartDestinationSubmitContent, CartDestinationSubmitDefinition, CartDestinationUnset, CartDestinationUnsetDefinition, CartDestinationValue, CartDestinationValueContent, CartDestinationValueDefinition, useCartDestination };
701
+ export { CART_DESTINATION_ERROR_FIELDS, CartDestination, CartDestinationCancel, CartDestinationCancelContent, CartDestinationCancelDefinition, CartDestinationChange, CartDestinationChangeContent, CartDestinationChangeDefinition, CartDestinationError, CartDestinationErrorContent, CartDestinationErrorDefinition, CartDestinationForm, CartDestinationFormDefinition, CartDestinationPostalCodeControl, CartDestinationPostalCodeControlDefinition, CartDestinationRead, CartDestinationReadDefinition, CartDestinationRoot, CartDestinationRootDefinition, CartDestinationSubmit, CartDestinationSubmitContent, CartDestinationSubmitDefinition, CartDestinationUnset, CartDestinationUnsetDefinition, CartDestinationValue, CartDestinationValueContent, CartDestinationValueDefinition, useCartDestination };
612
702
 
613
703
  //# sourceMappingURL=cart-destination.js.map