@vtex/faststore 0.0.10 → 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 (506) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +0 -1
  3. package/dist/actions.json +6 -1
  4. package/dist/catalog.json +789 -1701
  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 +63 -57
  13. package/dist/components.js +60 -54
  14. package/dist/content-types.json +5785 -754
  15. package/dist/core/dist/define-component.d.ts +1 -1
  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-menu.md +14 -15
  24. package/dist/docs/account-saved-cards.md +44 -39
  25. package/dist/docs/alert-dialog.md +3 -1
  26. package/dist/docs/avatar.md +4 -2
  27. package/dist/docs/billing-address.md +99 -30
  28. package/dist/docs/binding-switcher.md +5 -2
  29. package/dist/docs/buy-button.md +7 -8
  30. package/dist/docs/card-entry.md +39 -26
  31. package/dist/docs/card-summary.md +18 -8
  32. package/dist/docs/cardholder-document.md +5 -3
  33. package/dist/docs/carousel.md +5 -4
  34. package/dist/docs/cart-destination.md +39 -26
  35. package/dist/docs/cart-item.md +29 -14
  36. package/dist/docs/cart-totalizer.md +7 -5
  37. package/dist/docs/cart.md +135 -41
  38. package/dist/docs/challenge-return.md +135 -0
  39. package/dist/docs/client-preferences-fieldset.md +10 -5
  40. package/dist/docs/client-preferences.md +31 -8
  41. package/dist/docs/client-profile-fieldset.md +20 -6
  42. package/dist/docs/client-profile.md +12 -3
  43. package/dist/docs/copy-text.md +9 -7
  44. package/dist/docs/document-field.md +1 -1
  45. package/dist/docs/email-field.md +2 -1
  46. package/dist/docs/email-identification.md +12 -2
  47. package/dist/docs/footer-copyright.md +4 -2
  48. package/dist/docs/form.md +54 -18
  49. package/dist/docs/free-shipping-progress.md +6 -5
  50. package/dist/docs/identity-edit.md +8 -2
  51. package/dist/docs/identity-summary.md +18 -5
  52. package/dist/docs/installments.md +46 -32
  53. package/dist/docs/my-account-profile.md +16 -11
  54. package/dist/docs/navigation-link.md +5 -3
  55. package/dist/docs/order-cancel.md +3 -1
  56. package/dist/docs/order-delivery-address.md +7 -5
  57. package/dist/docs/order-delivery-group.md +1 -3
  58. package/dist/docs/order-details-back.md +1 -1
  59. package/dist/docs/order-details-header.md +1 -4
  60. package/dist/docs/order-invoice-download.md +60 -0
  61. package/dist/docs/order-list-row.md +1 -1
  62. package/dist/docs/order-list-search.md +13 -20
  63. package/dist/docs/order-list-views.md +11 -17
  64. package/dist/docs/order-list.md +12 -5
  65. package/dist/docs/order-payment.md +9 -7
  66. package/dist/docs/order-placed-date.md +1 -1
  67. package/dist/docs/order-placed-payment-summary.md +28 -15
  68. package/dist/docs/order-placed.md +49 -14
  69. package/dist/docs/order-progress.md +1 -1
  70. package/dist/docs/order-status-badge.md +20 -9
  71. package/dist/docs/order-summary.md +2 -2
  72. package/dist/docs/order-tracking-link.md +58 -0
  73. package/dist/docs/payment-method-badges.md +30 -4
  74. package/dist/docs/payment-methods.md +1 -1
  75. package/dist/docs/payment.md +36 -17
  76. package/dist/docs/phone-field.md +4 -4
  77. package/dist/docs/place-order.md +84 -36
  78. package/dist/docs/postal-code-field.md +3 -1
  79. package/dist/docs/pricing.md +21 -23
  80. package/dist/docs/product-gallery.md +19 -20
  81. package/dist/docs/product-information.md +13 -9
  82. package/dist/docs/product-list.md +7 -6
  83. package/dist/docs/product-shelf.md +0 -1
  84. package/dist/docs/promotion.md +4 -2
  85. package/dist/docs/region.md +23 -15
  86. package/dist/docs/save-card.md +7 -6
  87. package/dist/docs/saved-cards.md +65 -36
  88. package/dist/docs/shipping-address.md +57 -21
  89. package/dist/docs/shipping-simulator.md +53 -15
  90. package/dist/docs/sign-in-disclosure.md +176 -0
  91. package/dist/docs/sign-in-form.md +78 -47
  92. package/dist/docs/sign-in-redirect.md +4 -2
  93. package/dist/docs/sign-in.md +173 -0
  94. package/dist/docs/toast.md +15 -4
  95. package/dist/docs/variant-selector.md +15 -11
  96. package/dist/graphql/types.d.ts +4 -14
  97. package/dist/index.d.ts +2 -2
  98. package/dist/internal/client.d.ts +1 -3
  99. package/dist/internal/client.js +1 -1
  100. package/dist/internal/server.d.ts +7 -4
  101. package/dist/internal/server.js +7 -4
  102. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  103. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  104. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  105. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  106. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  107. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  108. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  109. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  110. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  111. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  112. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  113. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  114. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  115. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  116. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  117. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  118. package/dist/matter/account-address-book/account-address-book.js +74 -33
  119. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  120. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  121. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  122. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  123. package/dist/matter/account-address-book/account-address-country.js +83 -49
  124. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  126. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  127. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  128. package/dist/matter/account-address-book/account-address-form.js +518 -155
  129. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  131. package/dist/matter/account-address-book/account-address-record.js +32 -17
  132. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  133. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  134. package/dist/matter/account-menu/account-menu.js +46 -54
  135. package/dist/matter/account-menu/account-menu.js.map +1 -1
  136. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  137. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
  138. package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
  139. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
  140. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  141. package/dist/matter/billing-address/billing-address.js +227 -156
  142. package/dist/matter/billing-address/billing-address.js.map +1 -1
  143. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  144. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  145. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  146. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  147. package/dist/matter/buy-button/buy-button.js +10 -19
  148. package/dist/matter/buy-button/buy-button.js.map +1 -1
  149. package/dist/matter/card-entry/card-capture.js +12 -4
  150. package/dist/matter/card-entry/card-capture.js.map +1 -1
  151. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  152. package/dist/matter/card-entry/card-entry.js +348 -221
  153. package/dist/matter/card-entry/card-entry.js.map +1 -1
  154. package/dist/matter/cart/cart-namespace.d.ts +7 -1
  155. package/dist/matter/cart/cart-namespace.js +7 -1
  156. package/dist/matter/cart/cart-namespace.js.map +1 -1
  157. package/dist/matter/cart/cart.d.ts +402 -61
  158. package/dist/matter/cart/cart.js +624 -153
  159. package/dist/matter/cart/cart.js.map +1 -1
  160. package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
  161. package/dist/matter/cart-destination/cart-destination.js +160 -70
  162. package/dist/matter/cart-destination/cart-destination.js.map +1 -1
  163. package/dist/matter/cart-item/cart-item.d.ts +144 -17
  164. package/dist/matter/cart-item/cart-item.js +166 -49
  165. package/dist/matter/cart-item/cart-item.js.map +1 -1
  166. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  167. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  168. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  169. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  170. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  171. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  172. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  173. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  174. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  175. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  176. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  177. package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
  178. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  179. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  180. package/dist/matter/challenge-return/challenge-return.js +241 -0
  181. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  182. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  183. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  184. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  185. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  186. package/dist/matter/client-preferences/client-preferences.js +84 -15
  187. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  188. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  189. package/dist/matter/client-profile/client-profile.js +64 -24
  190. package/dist/matter/client-profile/client-profile.js.map +1 -1
  191. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  192. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  193. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  194. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  195. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  196. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  197. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  198. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  199. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  200. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  201. package/dist/matter/delivery-options/delivery-options.js +75 -12
  202. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  203. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  204. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  205. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  206. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  207. package/dist/matter/email-identification/email-identification.js +49 -12
  208. package/dist/matter/email-identification/email-identification.js.map +1 -1
  209. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
  210. package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
  211. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  212. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  213. package/dist/matter/identity-edit/identity-edit.js +47 -19
  214. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  215. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  216. package/dist/matter/identity-summary/identity-summary.js +95 -45
  217. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  218. package/dist/matter/installments/installments-select.d.ts +98 -16
  219. package/dist/matter/installments/installments-select.js +156 -48
  220. package/dist/matter/installments/installments-select.js.map +1 -1
  221. package/dist/matter/installments/installments.d.ts +96 -16
  222. package/dist/matter/installments/installments.js +115 -40
  223. package/dist/matter/installments/installments.js.map +1 -1
  224. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  225. package/dist/matter/installments/use-installments-selection.js +8 -3
  226. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  227. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  228. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  229. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  230. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  231. package/dist/matter/order-cancel/order-cancel.js +118 -51
  232. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  233. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  234. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  235. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  236. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  237. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  238. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  239. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  240. package/dist/matter/order-details-header/order-details-header.js +66 -58
  241. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  242. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  243. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  244. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  245. package/dist/matter/order-list/order-list.d.ts +164 -19
  246. package/dist/matter/order-list/order-list.js +229 -87
  247. package/dist/matter/order-list/order-list.js.map +1 -1
  248. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  249. package/dist/matter/order-list-row/order-list-row.js +3 -2
  250. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  251. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  252. package/dist/matter/order-list-search/order-list-search.js +30 -69
  253. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  254. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  255. package/dist/matter/order-list-views/order-list-views.js +22 -68
  256. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  257. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  258. package/dist/matter/order-payment/order-payment.js +44 -39
  259. package/dist/matter/order-payment/order-payment.js.map +1 -1
  260. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  261. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  262. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  263. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  264. package/dist/matter/order-placed/order-placed.js +230 -139
  265. package/dist/matter/order-placed/order-placed.js.map +1 -1
  266. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  267. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  268. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  269. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  270. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  271. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  272. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  273. package/dist/matter/order-progress/order-progress.js +37 -45
  274. package/dist/matter/order-progress/order-progress.js.map +1 -1
  275. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  276. package/dist/matter/order-summary/order-summary.js +38 -44
  277. package/dist/matter/order-summary/order-summary.js.map +1 -1
  278. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  279. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  280. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  281. package/dist/matter/payment/payment-card-capture.js +17 -10
  282. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  283. package/dist/matter/payment/payment-controller.d.ts +4 -2
  284. package/dist/matter/payment/payment-controller.js +30 -9
  285. package/dist/matter/payment/payment-controller.js.map +1 -1
  286. package/dist/matter/payment/payment-method-badges.js +1 -1
  287. package/dist/matter/payment/payment.d.ts +69 -19
  288. package/dist/matter/payment/payment.js +101 -35
  289. package/dist/matter/payment/payment.js.map +1 -1
  290. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  291. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  292. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  293. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  294. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  295. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  296. package/dist/matter/place-order/place-order.d.ts +171 -57
  297. package/dist/matter/place-order/place-order.js +376 -185
  298. package/dist/matter/place-order/place-order.js.map +1 -1
  299. package/dist/matter/pricing/pricing.d.ts +152 -13
  300. package/dist/matter/pricing/pricing.js +153 -52
  301. package/dist/matter/pricing/pricing.js.map +1 -1
  302. package/dist/matter/product-information/product-information.d.ts +27 -4
  303. package/dist/matter/product-information/product-information.js +32 -15
  304. package/dist/matter/product-information/product-information.js.map +1 -1
  305. package/dist/matter/product-list/product-list.d.ts +24 -6
  306. package/dist/matter/product-list/product-list.js +32 -26
  307. package/dist/matter/product-list/product-list.js.map +1 -1
  308. package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
  309. package/dist/matter/product-shelf/product-shelf.js +2 -15
  310. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  311. package/dist/matter/region/region.d.ts +33 -16
  312. package/dist/matter/region/region.js +59 -52
  313. package/dist/matter/region/region.js.map +1 -1
  314. package/dist/matter/save-card/save-card.d.ts +43 -8
  315. package/dist/matter/save-card/save-card.js +61 -23
  316. package/dist/matter/save-card/save-card.js.map +1 -1
  317. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  318. package/dist/matter/saved-cards/saved-cards.js +349 -77
  319. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  320. package/dist/matter/shipping-address/address-payload.js +25 -0
  321. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  322. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  323. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  324. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  325. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  326. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  327. package/dist/matter/shipping-address/shipping-address.js +443 -188
  328. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  329. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
  330. package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
  331. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  332. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  333. package/dist/matter/sign-in/sign-in.js +285 -0
  334. package/dist/matter/sign-in/sign-in.js.map +1 -0
  335. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  336. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  337. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  338. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  339. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  340. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  341. package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
  342. package/dist/particles/binding-switcher/binding-switcher.js +37 -26
  343. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
  344. package/dist/particles/card-summary/card-summary.d.ts +38 -8
  345. package/dist/particles/card-summary/card-summary.js +55 -22
  346. package/dist/particles/card-summary/card-summary.js.map +1 -1
  347. package/dist/particles/carousel/carousel.d.ts +99 -11
  348. package/dist/particles/carousel/carousel.js +103 -35
  349. package/dist/particles/carousel/carousel.js.map +1 -1
  350. package/dist/particles/copy-text/copy-text.js +5 -15
  351. package/dist/particles/copy-text/copy-text.js.map +1 -1
  352. package/dist/particles/dialog/dialog.d.ts +14 -6
  353. package/dist/particles/dialog/dialog.js +6 -3
  354. package/dist/particles/dialog/dialog.js.map +1 -1
  355. package/dist/particles/drawer/drawer.js +1 -1
  356. package/dist/particles/drawer/drawer.js.map +1 -1
  357. package/dist/particles/email-field/email-field.d.ts +2 -1
  358. package/dist/particles/email-field/email-field.js +2 -1
  359. package/dist/particles/email-field/email-field.js.map +1 -1
  360. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  361. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  362. package/dist/particles/form/form.d.ts +85 -13
  363. package/dist/particles/form/form.js +91 -42
  364. package/dist/particles/form/form.js.map +1 -1
  365. package/dist/particles/gallery/gallery.d.ts +129 -12
  366. package/dist/particles/gallery/gallery.js +121 -34
  367. package/dist/particles/gallery/gallery.js.map +1 -1
  368. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  369. package/dist/particles/order-details-back/order-details-back.js +8 -10
  370. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  371. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  372. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  373. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  374. package/dist/particles/password-field/password-field.d.ts +1 -1
  375. package/dist/particles/password-field/password-field.js +2 -4
  376. package/dist/particles/password-field/password-field.js.map +1 -1
  377. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  378. package/dist/particles/phone-field/phone-field.js +8 -11
  379. package/dist/particles/phone-field/phone-field.js.map +1 -1
  380. package/dist/particles/spinner/spinner.d.ts +24 -4
  381. package/dist/particles/spinner/spinner.js +25 -9
  382. package/dist/particles/spinner/spinner.js.map +1 -1
  383. package/dist/particles/switch/switch.d.ts +4 -1
  384. package/dist/particles/switch/switch.js +3 -1
  385. package/dist/particles/switch/switch.js.map +1 -1
  386. package/dist/particles/toast/toast.d.ts +29 -3
  387. package/dist/particles/toast/toast.js +34 -10
  388. package/dist/particles/toast/toast.js.map +1 -1
  389. package/dist/schema.graphql +164 -56
  390. package/dist/sdk/address/address-fields.js +4 -4
  391. package/dist/sdk/address/address-fields.js.map +1 -1
  392. package/dist/sdk/address/constants.js +1 -6
  393. package/dist/sdk/address/constants.js.map +1 -1
  394. package/dist/sdk/address/messages.js +44 -44
  395. package/dist/sdk/address/messages.js.map +1 -1
  396. package/dist/sdk/address/postal-code.js +15 -2
  397. package/dist/sdk/address/postal-code.js.map +1 -1
  398. package/dist/sdk/address/types.d.ts +5 -3
  399. package/dist/sdk/address/validate-address.js +3 -3
  400. package/dist/sdk/address/validate-address.js.map +1 -1
  401. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  402. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  403. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  404. package/dist/sdk/data/index.js +2 -2
  405. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  406. package/dist/sdk/generated/gql.js +1 -1
  407. package/dist/sdk/generated/gql.js.map +1 -1
  408. package/dist/sdk/generated/graphql.d.ts +20 -5
  409. package/dist/sdk/generated/graphql.js +6 -0
  410. package/dist/sdk/generated/graphql.js.map +1 -1
  411. package/dist/sdk/i18n/format-error-code.js +23 -0
  412. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  413. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  414. package/dist/sdk/i18n/message-formatter.js +140 -0
  415. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  416. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  417. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  418. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  419. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  420. package/dist/sdk/navigation/redirect.d.ts +2 -0
  421. package/dist/sdk/navigation/redirect.js +19 -1
  422. package/dist/sdk/navigation/redirect.js.map +1 -1
  423. package/dist/sdk/navigation/types.d.ts +13 -0
  424. package/dist/sdk/payment/bin-format.js +20 -0
  425. package/dist/sdk/payment/bin-format.js.map +1 -0
  426. package/dist/sdk/payment/challenge-return.js +37 -0
  427. package/dist/sdk/payment/challenge-return.js.map +1 -0
  428. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  429. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  430. package/dist/sdk/payment/gateway.d.ts +1 -1
  431. package/dist/sdk/payment/gateway.js +8 -2
  432. package/dist/sdk/payment/gateway.js.map +1 -1
  433. package/dist/sdk/payment/operations.d.ts +1 -0
  434. package/dist/sdk/payment/operations.js +28 -6
  435. package/dist/sdk/payment/operations.js.map +1 -1
  436. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  437. package/dist/sdk/payment/resumed-purchase.js +119 -0
  438. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  439. package/dist/sdk/payment/security-code-mask.js +16 -23
  440. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  441. package/dist/sdk/payment/submission-registry.js +6 -2
  442. package/dist/sdk/payment/submission-registry.js.map +1 -1
  443. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  444. package/dist/sdk/payment/use-payment-actions.js +23 -3
  445. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  446. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  447. package/dist/sdk/payment/use-place-order.js +138 -76
  448. package/dist/sdk/payment/use-place-order.js.map +1 -1
  449. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  450. package/dist/sdk/provider/storefront-provider.js +4 -11
  451. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  452. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  453. package/dist/sdk/seo/entity-landing.js +30 -0
  454. package/dist/sdk/seo/entity-landing.js.map +1 -0
  455. package/dist/sdk/seo/page-alternates.d.ts +3 -2
  456. package/dist/sdk/seo/page-alternates.js +4 -2
  457. package/dist/sdk/seo/page-alternates.js.map +1 -1
  458. package/dist/sdk/seo/search-landing.d.ts +42 -0
  459. package/dist/sdk/seo/search-landing.js +85 -0
  460. package/dist/sdk/seo/search-landing.js.map +1 -0
  461. package/dist/sdk/session/mock-session.d.ts +9 -0
  462. package/dist/sdk/session/mock-session.js +31 -0
  463. package/dist/sdk/session/mock-session.js.map +1 -0
  464. package/dist/sdk/session/read-server-session.d.ts +3 -0
  465. package/dist/sdk/session/read-server-session.js +5 -0
  466. package/dist/sdk/session/read-server-session.js.map +1 -1
  467. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  468. package/dist/sdk/session/return-path-segment.js +15 -0
  469. package/dist/sdk/session/return-path-segment.js.map +1 -0
  470. package/dist/sdk/session/use-session-actions.js.map +1 -1
  471. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  472. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  473. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  474. package/dist/utils/safe-href.d.ts +2 -0
  475. package/package.json +4 -3
  476. package/skills/storefront-asset/SKILL.md +2 -2
  477. package/skills/storefront-asset/references/api-side.md +27 -14
  478. package/skills/storefront-asset/references/findings.md +5 -2
  479. package/src/styles/tailwind.css +8 -0
  480. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  481. package/dist/message-locales.json +0 -7
  482. package/dist/sdk/i18n/client.d.ts +0 -4
  483. package/dist/sdk/i18n/client.js +0 -4
  484. package/dist/sdk/i18n/locales.d.ts +0 -8
  485. package/dist/sdk/i18n/locales.js +0 -57
  486. package/dist/sdk/i18n/locales.js.map +0 -1
  487. package/dist/sdk/i18n/messages/en-US.js +0 -183
  488. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  489. package/dist/sdk/i18n/messages/en-US.json +0 -178
  490. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
  491. package/dist/sdk/i18n/messages/es-ES.js +0 -183
  492. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  493. package/dist/sdk/i18n/messages/es-ES.json +0 -178
  494. package/dist/sdk/i18n/messages/pt-BR.js +0 -183
  495. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  496. package/dist/sdk/i18n/messages/pt-BR.json +0 -178
  497. package/dist/sdk/i18n/provider.d.ts +0 -1
  498. package/dist/sdk/i18n/provider.js +0 -30
  499. package/dist/sdk/i18n/provider.js.map +0 -1
  500. package/dist/sdk/i18n/server.d.ts +0 -28
  501. package/dist/sdk/i18n/server.js +0 -59
  502. package/dist/sdk/i18n/server.js.map +0 -1
  503. package/dist/utils/resolve-authored-copy.js +0 -18
  504. package/dist/utils/resolve-authored-copy.js.map +0 -1
  505. package/dist/utils/substitute-template.js +0 -33
  506. package/dist/utils/substitute-template.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"payment-card-capture.js","names":[],"sources":["../../../src/matter/payment/payment-card-capture.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport type { PaymentGatewayTransaction } from '../../sdk/payment/gateway.js';\nimport { PAYMENT_NETWORK_ERROR_CODE, type PaymentUserError } from '../../sdk/payment/operations.js';\nimport { type PaymentSubmission, usePaymentSubmission } from '../../sdk/payment/submission-registry.js';\nimport {\n type CapturedCard,\n type CardCapture,\n CardCaptureContext,\n type CardCaptureContextValue,\n type CardCaptureMissingMethodExplainer,\n type CardCapturePreflight,\n type CardCaptureResult,\n} from '../card-entry/card-capture.js';\nimport { resolveCardholderDocument } from './cardholder-document-rule.js';\nimport { isCardMethod, type PaymentMethodSelection } from './use-payment-method-selection.js';\n\n/**\n * The checkout's `card-capture` provider (specs/sfs-3457-card-entry-card-capture-context.md),\n * rendered by both payment roots inside their `PaymentSubmissionProvider`. It hands `CardEntry` the\n * scoped methods and the selection facts, registers its capture as the `new-card` submission, folds\n * the draft's non-sensitive values into the card, and sends it through `sendPayments`. It also owns\n * `add_payment_info`, which needs the cart total `CardEntry` no longer reads.\n */\n\nexport type PaymentCartData = {\n total?: { amount: number; currencyCode: string } | null;\n} | null;\n\n/** The `add_payment_info` payment type for a card group; `undefined` for any other group (T140). */\nfunction paymentTypeOf(groupName: string | undefined): 'Credit Card' | 'Debit Card' | undefined {\n if (groupName === 'creditCardPaymentGroup') return 'Credit Card';\n if (groupName === 'debitCardPaymentGroup') return 'Debit Card';\n return undefined;\n}\n\n/** Mirrors `usePaymentActions`' own infrastructure-failure code for the same underlying meaning. */\nconst MISSING_GATEWAY_ACTION_ERROR: PaymentUserError = {\n code: PAYMENT_NETWORK_ERROR_CODE,\n message: 'Unable to complete the request. Please try again.',\n};\n\ntype LatestCaptureFacts = Readonly<{ selection: PaymentMethodSelection; $actions: ComponentActions | undefined }>;\n\n/**\n * Folds the draft's non-sensitive values into the captured card and sends it through `sendPayments`.\n * `facts` is `latest.current` read at submission time, never a value a closure captured earlier.\n */\nasync function sendNewCard(\n { selection, $actions }: LatestCaptureFacts,\n transaction: PaymentGatewayTransaction,\n card: CapturedCard,\n): Promise<CardCaptureResult> {\n const sendPayments = $actions?.payment?.sendPayments;\n if (!sendPayments) {\n console.error('[CardEntry] the payment action namespace is not injected');\n // Nothing was sent: no action to send it with (T112).\n return { reachedGateway: false, userErrors: [MISSING_GATEWAY_ACTION_ERROR] };\n }\n const { draft, allMethods, persistedMethodId, countryDocumentType } = selection;\n // T42 (Decision 4): the draft document is posted only while the rule applies — the same unscoped\n // persisted method the submit gate reads, under the store's country — never a stale value.\n const documentRule = resolveCardholderDocument({\n method: allMethods.find((method) => method.id === persistedMethodId) ?? null,\n countryDocumentType,\n });\n return sendPayments({\n transaction,\n card: {\n kind: 'new',\n ...card,\n document: documentRule ? (draft.document ?? undefined) : undefined,\n cardLabel: draft.cardLabel ?? undefined,\n saveCard: draft.saveCard ?? undefined,\n },\n });\n}\n\ntype PaymentCardCaptureProviderProps = Readonly<{\n selection: PaymentMethodSelection;\n cart: PaymentCartData | undefined;\n $actions: ComponentActions | undefined;\n children: ReactNode;\n}>;\n\nexport function PaymentCardCaptureProvider({ selection, cart, $actions, children }: PaymentCardCaptureProviderProps) {\n const { register } = usePaymentSubmission();\n // Read at submission and analytics time, never captured by a closure: the place-order sequence must\n // fold the draft as it stands then, and a keystroke must not re-render the section.\n const latest = useRef({ selection, $actions });\n useLayoutEffect(() => {\n latest.current = { selection, $actions };\n });\n\n const total = cart?.total ?? null;\n const totalRef = useRef(total);\n const activeCaptures = useRef(0);\n const analyticsDispatched = useRef(false);\n\n // `add_payment_info` (T2), once per root, when a card capture is mounted and the cart total has\n // resolved. T140, Decision 5: `paymentType` comes from whatever is selected when it fires, and the key\n // is absent otherwise; a later selection never re-fires it.\n const dispatchAddPaymentInfo = useCallback(() => {\n const currentTotal = totalRef.current;\n if (analyticsDispatched.current || activeCaptures.current === 0 || !currentTotal) return;\n const track = latest.current.$actions?.analytics?.track;\n if (!track) return;\n const { methods, selectedMethodId } = latest.current.selection;\n const paymentType = paymentTypeOf(methods.find((method) => method.id === selectedMethodId)?.groupName);\n track({\n name: 'add_payment_info',\n value: { amount: currentTotal.amount, currencyCode: currentTotal.currencyCode },\n // The key itself must be absent when nothing resolves to a known card kind — never a present\n // key holding `undefined` (toEcommercePayload's own doc comment carries the rest of this rule).\n ...(paymentType ? { paymentType } : {}),\n });\n analyticsDispatched.current = true;\n }, []);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: `$actions` re-runs the dispatch when the analytics namespace arrives after the total; the dispatch reads it through `latest`.\n useEffect(() => {\n totalRef.current = total;\n dispatchAddPaymentInfo();\n }, [total, $actions, dispatchAddPaymentInfo]);\n\n const registerCapture = useCallback(\n (\n capture: CardCapture,\n preflight: CardCapturePreflight,\n explainMissingMethod?: CardCaptureMissingMethodExplainer,\n ) => {\n const submit: PaymentSubmission = (transaction) =>\n capture((card) => sendNewCard(latest.current, transaction, card));\n const unregister = register('new-card', submit, preflight, explainMissingMethod);\n activeCaptures.current += 1;\n dispatchAddPaymentInfo();\n return () => {\n activeCaptures.current -= 1;\n unregister();\n };\n },\n [register, dispatchAddPaymentInfo],\n );\n\n const {\n methods,\n placing,\n attempt,\n selectMethod,\n selectNewCard,\n setDraftBin,\n draft,\n cardPaymentCollapsed,\n cardModeActive,\n selectedMethodId,\n selectionOutOfScope,\n selectedMethod,\n } = selection;\n // T202: `sent` and `unresolved` are the two phases in which `placeOrder` only resumes (the callback leg), so\n // a card typed there would never be submitted and never cleared. The form takes no input until the attempt\n // is freed. Read from the attempt on every render; nothing here writes it.\n const locked = attempt?.phase === 'sent' || attempt?.phase === 'unresolved';\n // T191 (FR-13, Decision 8): classified with the engine's own `isCardMethod`, so the card form's\n // refusal and the collapse can never disagree about a method.\n const selectionNonCard = selectedMethod !== null && !isCardMethod(selectedMethod);\n\n const value = useMemo<CardCaptureContextValue>(\n () => ({\n networks: methods,\n busy: placing || locked,\n // T202: the card POST has settled by any route once `send` returns, so nothing the form holds is needed\n // again (a refusal raised before `send` never reaches the clear).\n clearOn: 'any-outcome',\n registerCapture,\n selection: {\n selectMethod,\n selectNewCard,\n setDraftBin,\n path: draft.path,\n bin: draft.bin,\n collapsed: cardPaymentCollapsed,\n cardModeActive,\n selectedMethodId,\n selectionOutOfScope,\n selectionNonCard,\n },\n }),\n [\n methods,\n placing,\n locked,\n registerCapture,\n selectMethod,\n selectNewCard,\n setDraftBin,\n draft.path,\n draft.bin,\n cardPaymentCollapsed,\n cardModeActive,\n selectedMethodId,\n selectionOutOfScope,\n selectionNonCard,\n ],\n );\n\n return <CardCaptureContext value={value}>{children}</CardCaptureContext>;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"payment-card-capture.js","names":[],"sources":["../../../src/matter/payment/payment-card-capture.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport type { PaymentType } from '../../sdk/generated/graphql.js';\nimport { lastFourOf, rememberConfirmationLastFour } from '../../sdk/payment/confirmation-last-four.js';\nimport type { PaymentGatewayTransaction } from '../../sdk/payment/gateway.js';\nimport { PAYMENT_NETWORK_ERROR_CODE, type PaymentUserError } from '../../sdk/payment/operations.js';\nimport { type PaymentSubmission, usePaymentSubmission } from '../../sdk/payment/submission-registry.js';\nimport {\n type CapturedCard,\n type CardCapture,\n CardCaptureContext,\n type CardCaptureContextValue,\n type CardCaptureMissingMethodExplainer,\n type CardCapturePreflight,\n type CardCaptureResult,\n} from '../card-entry/card-capture.js';\nimport { resolveCardholderDocument } from './cardholder-document-rule.js';\nimport { isCardMethod, type PaymentMethodSelection } from './use-payment-method-selection.js';\n\n/**\n * The checkout's `card-capture` provider (specs/sfs-3457-card-entry-card-capture-context.md),\n * rendered by both payment roots inside their `PaymentSubmissionProvider`. It hands `CardEntry` the\n * scoped methods and the selection facts, registers its capture as the `new-card` submission, folds\n * the draft's non-sensitive values into the card, and sends it through `sendPayments`. It also owns\n * `add_payment_info`, which needs the cart total `CardEntry` no longer reads.\n */\n\nexport type PaymentCartData = {\n total?: { amount: number; currencyCode: string } | null;\n} | null;\n\n/** The `add_payment_info` payment type for a card kind; `undefined` for any other kind (T140; read off `type` since T230). */\nfunction paymentTypeOf(type: PaymentType | undefined): 'Credit Card' | 'Debit Card' | undefined {\n if (type === 'CREDIT_CARD') return 'Credit Card';\n if (type === 'DEBIT_CARD') return 'Debit Card';\n return undefined;\n}\n\n/** Mirrors `usePaymentActions`' own infrastructure-failure code. Its `message` is diagnostic; `PlaceOrder` words the code. */\nconst MISSING_GATEWAY_ACTION_ERROR: PaymentUserError = {\n code: PAYMENT_NETWORK_ERROR_CODE,\n message: 'Unable to complete the request. Please try again.',\n};\n\ntype LatestCaptureFacts = Readonly<{ selection: PaymentMethodSelection; $actions: ComponentActions | undefined }>;\n\n/**\n * Folds the draft's non-sensitive values into the captured card and sends it through `sendPayments`.\n * `facts` is `latest.current` read at submission time, never a value a closure captured earlier.\n */\nasync function sendNewCard(\n { selection, $actions }: LatestCaptureFacts,\n transaction: PaymentGatewayTransaction,\n card: CapturedCard,\n): Promise<CardCaptureResult> {\n const sendPayments = $actions?.payment?.sendPayments;\n if (!sendPayments) {\n console.error('[CardEntry] the payment action namespace is not injected');\n // Nothing was sent: no action to send it with (T112).\n return { reachedGateway: false, userErrors: [MISSING_GATEWAY_ACTION_ERROR] };\n }\n const { draft, allMethods, persistedMethodId, countryDocumentType } = selection;\n // T42 (Decision 4): the draft document is posted only while the rule applies — the same unscoped\n // persisted method the submit gate reads, under the store's country — never a stale value.\n const documentRule = resolveCardholderDocument({\n method: allMethods.find((method) => method.id === persistedMethodId) ?? null,\n countryDocumentType,\n });\n const lastFour = lastFourOf(card.number);\n const result = await sendPayments({\n transaction,\n card: {\n kind: 'new',\n ...card,\n document: documentRule ? (draft.document ?? undefined) : undefined,\n cardLabel: draft.cardLabel ?? undefined,\n saveCard: draft.saveCard ?? undefined,\n },\n });\n if (lastFour && result.userErrors.length === 0) rememberConfirmationLastFour(transaction.orderGroup, lastFour);\n return result;\n}\n\ntype PaymentCardCaptureProviderProps = Readonly<{\n selection: PaymentMethodSelection;\n cart: PaymentCartData | undefined;\n $actions: ComponentActions | undefined;\n children: ReactNode;\n}>;\n\nexport function PaymentCardCaptureProvider({ selection, cart, $actions, children }: PaymentCardCaptureProviderProps) {\n const { register } = usePaymentSubmission();\n // Read at submission and analytics time, never captured by a closure: the place-order sequence must\n // fold the draft as it stands then, and a keystroke must not re-render the section.\n const latest = useRef({ selection, $actions });\n useLayoutEffect(() => {\n latest.current = { selection, $actions };\n });\n\n const total = cart?.total ?? null;\n const totalRef = useRef(total);\n const activeCaptures = useRef(0);\n const analyticsDispatched = useRef(false);\n\n // `add_payment_info` (T2), once per root, when a card capture is mounted and the cart total has\n // resolved. T140, Decision 5: `paymentType` comes from whatever is selected when it fires, and the key\n // is absent otherwise; a later selection never re-fires it.\n const dispatchAddPaymentInfo = useCallback(() => {\n const currentTotal = totalRef.current;\n if (analyticsDispatched.current || activeCaptures.current === 0 || !currentTotal) return;\n const track = latest.current.$actions?.analytics?.track;\n if (!track) return;\n const { methods, selectedMethodId } = latest.current.selection;\n const paymentType = paymentTypeOf(methods.find((method) => method.id === selectedMethodId)?.type);\n track({\n name: 'add_payment_info',\n value: { amount: currentTotal.amount, currencyCode: currentTotal.currencyCode },\n // The key itself must be absent when nothing resolves to a known card kind — never a present\n // key holding `undefined` (toEcommercePayload's own doc comment carries the rest of this rule).\n ...(paymentType ? { paymentType } : {}),\n });\n analyticsDispatched.current = true;\n }, []);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: `$actions` re-runs the dispatch when the analytics namespace arrives after the total; the dispatch reads it through `latest`.\n useEffect(() => {\n totalRef.current = total;\n dispatchAddPaymentInfo();\n }, [total, $actions, dispatchAddPaymentInfo]);\n\n const registerCapture = useCallback(\n (\n capture: CardCapture,\n preflight: CardCapturePreflight,\n explainMissingMethod?: CardCaptureMissingMethodExplainer,\n ) => {\n const submit: PaymentSubmission = (transaction) =>\n capture((card) => sendNewCard(latest.current, transaction, card));\n const unregister = register('new-card', submit, preflight, explainMissingMethod);\n activeCaptures.current += 1;\n return () => {\n activeCaptures.current -= 1;\n unregister();\n };\n },\n [register],\n );\n\n const {\n methods,\n placing,\n attempt,\n selectMethod,\n selectNewCard,\n setDraftBin,\n setDraftEntryValid,\n draft,\n cardPaymentCollapsed,\n cardModeActive,\n selectedMethodId,\n selectionOutOfScope,\n selectedMethod,\n } = selection;\n // T202: `sent` and `unresolved` are the two phases in which `placeOrder` only resumes (the callback leg), so\n // a card typed there would never be submitted and never cleared. The form takes no input until the attempt\n // is freed. Read from the attempt on every render; nothing here writes it.\n const locked = attempt?.phase === 'sent' || attempt?.phase === 'unresolved';\n // T191 (FR-13, Decision 8): classified with the engine's own `isCardMethod`, so the card form's\n // refusal and the collapse can never disagree about a method.\n const selectionNonCard = selectedMethod !== null && !isCardMethod(selectedMethod);\n\n const value = useMemo<CardCaptureContextValue>(\n () => ({\n networks: methods,\n busy: placing || locked,\n // T202: the card POST has settled by any route once `send` returns, so nothing the form holds is needed\n // again (a refusal raised before `send` never reaches the clear).\n clearOn: 'any-outcome',\n registerCapture,\n onCaptureMounted: dispatchAddPaymentInfo,\n selection: {\n selectMethod,\n selectNewCard,\n setDraftBin,\n setDraftEntryValid,\n path: draft.path,\n bin: draft.bin,\n collapsed: cardPaymentCollapsed,\n cardModeActive,\n selectedMethodId,\n selectionOutOfScope,\n selectionNonCard,\n },\n }),\n [\n methods,\n placing,\n locked,\n registerCapture,\n dispatchAddPaymentInfo,\n selectMethod,\n selectNewCard,\n setDraftBin,\n setDraftEntryValid,\n draft.path,\n draft.bin,\n cardPaymentCollapsed,\n cardModeActive,\n selectedMethodId,\n selectionOutOfScope,\n selectionNonCard,\n ],\n );\n\n return <CardCaptureContext value={value}>{children}</CardCaptureContext>;\n}\n"],"mappings":"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"}
@@ -11,7 +11,9 @@ export type PaymentSectionControllerProps = {
11
11
  * scopes to exactly that one group. An empty string scopes nothing.
12
12
  */
13
13
  group?: string | readonly string[];
14
- /** Keyed `{ payment, cart }` forwarded by the reactive runtime (arity-2 fragment, ADR-0015). */
14
+ /** The order of the method list by `PaymentMethod.groupName`; only orders, never hides. See `PaymentSectionRootProps`. */
15
+ groupOrder?: string | readonly string[];
16
+ /** Keyed `{ payment, cart, clientProfile }` forwarded by the reactive runtime (arity-3 fragment, ADR-0015). */
15
17
  $data?: PaymentSectionRootData;
16
18
  /** Compiler-injected action surface; carries `payment.setMethod`, `payment.sendPayments`, and `analytics.track`. */
17
19
  $actions?: ComponentActions;
@@ -19,6 +21,6 @@ export type PaymentSectionControllerProps = {
19
21
  children?: ReactNode;
20
22
  };
21
23
  export declare const PaymentSectionControllerDefinition: ComponentDefinition<PaymentSectionControllerProps>;
22
- export declare function PaymentSectionController({ group, $data: $dataProp, $actions: $actionsProp, children }: Readonly<PaymentSectionControllerProps>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
24
+ export declare function PaymentSectionController({ group, groupOrder, $data: $dataProp, $actions: $actionsProp, children }: Readonly<PaymentSectionControllerProps>): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
23
25
  //#endregion
24
26
  //# sourceMappingURL=payment-controller.d.ts.map
@@ -22,6 +22,7 @@ const PaymentSectionControllerDefinition = defineComponent({
22
22
  __typename
23
23
  id
24
24
  name
25
+ type
25
26
  groupName
26
27
  validator {
27
28
  __typename
@@ -61,6 +62,13 @@ const PaymentSectionControllerDefinition = defineComponent({
61
62
  currencyCode
62
63
  }
63
64
  }
65
+ clientProfile {
66
+ __typename
67
+ id
68
+ firstName
69
+ lastName
70
+ phone
71
+ }
64
72
  }
65
73
  `,
66
74
  fetchStrategy: "reactive",
@@ -74,28 +82,41 @@ const PaymentSectionControllerDefinition = defineComponent({
74
82
  label: "Payment Section Controller",
75
83
  category: "commerce"
76
84
  },
77
- schema: { group: {
78
- type: "array",
79
- default: ["creditCardPaymentGroup", "debitCardPaymentGroup"],
80
- label: "Payment method group"
81
- } },
82
- guideline: "State-only controller for a collapsed payment section: wrap a single DialogRoot (centered modal) or DrawerRoot (slide-in) child and it becomes controlled. Renders no markup and bakes no styling — compose the overlay particles (DialogTrigger/DialogPortal/DialogBackdrop/DialogPopup or the Drawer equivalents) directly as page nodes, put a static label (Text) inside the trigger — no component echoes the current choice there, and put PaymentMethodList plus the payment leaves (CardEntry, Installments, SavedCards, PlaceOrder, …) inside the popup. Provides the same 'payment' and 'card-capture' contexts as PaymentSectionRoot, so every leaf composes under either with no change. Unlike the delivery-options controller it does NOT close on a successful selection — picking a method is mid-flow — so close it from a DrawerClose/DialogClose particle or from the leaf that finishes the flow. See payment.md.",
85
+ schema: {
86
+ group: {
87
+ type: "array",
88
+ default: ["creditCardPaymentGroup", "debitCardPaymentGroup"],
89
+ label: "Payment method group"
90
+ },
91
+ groupOrder: {
92
+ type: "array",
93
+ label: "Payment method group order"
94
+ }
95
+ },
96
+ guideline: "State-only controller for a collapsed payment section: wrap a single DialogRoot (centered modal) or DrawerRoot (slide-in) child and it becomes controlled. Renders no markup and bakes no styling — compose the overlay particles (DialogTrigger/DialogPortal/DialogBackdrop/DialogPopup or the Drawer equivalents) directly as page nodes, put a static label (Text) inside the trigger — no component echoes the current choice there, and put PaymentMethodList plus the payment leaves (CardEntry, Installments, SavedCards, PlaceOrder, …) inside the popup. Provides the same 'payment' and 'card-capture' contexts as PaymentSectionRoot, so every leaf composes under either with no change. groupOrder only orders the popup's PaymentMethodList — a list of the store's payment group names, copied from its own data, that puts each option at its group's position; it never hides or adds an option, and a group it leaves out still shows after the named ones. Unlike the delivery-options controller it does NOT close on a successful selection — picking a method is mid-flow — so close it from a DrawerClose/DialogClose particle or from the leaf that finishes the flow. See payment.md.",
83
97
  docPath: "./payment.md"
84
98
  });
85
- function PaymentSectionController({ group = DEFAULT_METHOD_GROUP, $data: $dataProp, $actions: $actionsProp, children }) {
99
+ function PaymentSectionController({ group = DEFAULT_METHOD_GROUP, groupOrder, $data: $dataProp, $actions: $actionsProp, children }) {
86
100
  const $data = useDataOverride($dataProp);
87
101
  const $actions = useActionsOverride($actionsProp);
88
102
  const selection = usePaymentMethodSelection({
89
103
  group,
104
+ groupOrder,
90
105
  $data: $data?.payment ?? null,
91
106
  $actions
92
107
  });
93
108
  const [open, setOpen] = useState(false);
109
+ const clientProfile = $data?.clientProfile;
94
110
  const payment = useMemo(() => ({
95
111
  ...selection,
96
112
  open,
97
- setOpen
98
- }), [selection, open]);
113
+ setOpen,
114
+ clientProfile
115
+ }), [
116
+ selection,
117
+ open,
118
+ clientProfile
119
+ ]);
99
120
  if (!isValidElement(children)) return children;
100
121
  return /* @__PURE__ */ jsx(PaymentContext, {
101
122
  value: payment,
@@ -1 +1 @@
1
- {"version":3,"file":"payment-controller.js","names":[],"sources":["../../../src/matter/payment/payment-controller.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { cloneElement, isValidElement, type ReactNode, useMemo, useState } from 'react';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { PaymentSubmissionProvider } from '../../sdk/payment/submission-registry.js';\nimport {\n DEFAULT_METHOD_GROUP,\n PaymentContext,\n type PaymentContextValue,\n type PaymentSectionRootData,\n} from './payment.js';\nimport { PaymentCardCaptureProvider } from './payment-card-capture.js';\nimport { usePaymentMethodSelection } from './use-payment-method-selection.js';\n\n/**\n * The collapsed payment section (centered modal / slide-in panel) as a state-only controller\n * (specs/payment-section-root.md, T5; docs/features/credit-card/rfc.md § D1). The page composes a raw\n * `DialogRoot` or `DrawerRoot` and each of its particles (`DialogTrigger` / `DialogBackdrop` /\n * `DialogPopup` …) directly as `page.json` nodes, so every part — including the portaled backdrop and\n * popup a descendant selector could not reach — is a swatch-addressable node with zero Tailwind baked\n * into the package, exactly as `DeliveryOptionsController` established.\n *\n * `PaymentSectionController` renders no markup: it runs the shared `usePaymentMethodSelection` engine,\n * holds the open state, provides the same `payment` context `PaymentSectionRoot` does (ADR-0009 matches\n * by contract identifier, so every leaf composes under either with no edit), then injects\n * `open` / `onOpenChange` into its single overlay-`Root` child via `cloneElement` — the same mechanism\n * as `CartOpenOnAdd` and `ShippingAddressSavedAddressDrawerController`.\n *\n * It diverges from `DeliveryOptionsController` in one deliberate way: a successful method selection\n * does **not** close the surface. Picking a delivery option completes that interaction; picking a\n * payment method is the first step of several — the shopper still types a card, picks an installment,\n * and places the order. Closing is therefore the composition's call, through the context's `setOpen`\n * (T14 on a placed order) or a `DrawerClose` / `DialogClose` particle.\n *\n * The trigger holds a static label (`Text`): no component echoes the current choice there, and none is\n * shipped here — `payment.md` documents the same composition.\n */\n\n// Repeats `PaymentSectionData`'s selection set verbatim under its own name. Two definitions cannot\n// share one fragment name in a page query, and the native catalog builder resolves\n// `defineComponent({ fragment })` statically — a value imported from another module is silently\n// dropped from the built catalog. `delivery-options` duplicates for the same reason;\n// `payment.test.tsx` asserts the two sets stay field-for-field identical.\nconst fragment = /* GraphQL */ `\n fragment PaymentSectionControllerData on Query {\n payment {\n __typename\n id\n methods {\n __typename\n id\n name\n groupName\n validator {\n __typename\n numberMask\n numberRegex\n cvvMask\n cvvRegex\n cvvRequired\n expirationRequired\n holderNameRequired\n billingAddressRequired\n documentDisplayable\n documentRequired\n }\n }\n selectedMethodId\n selectedAccountId\n selectedBin\n storeCountryCode\n countries {\n __typename\n countryCode\n documents {\n __typename\n type\n displayable\n required\n }\n }\n }\n cart {\n __typename\n id\n total {\n __typename\n amount\n currencyCode\n }\n }\n }\n`;\n\n// The minimal open-state shape the controller injects into its overlay-Root child; both `DialogRoot`\n// and `DrawerRoot` accept it.\ntype OverlayOpenProps = {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n};\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type PaymentSectionControllerProps = {\n /**\n * Scopes the method list to a **set** of `PaymentMethod.groupName` values — a method is in scope\n * when its `groupName` is a member (T140, FR-1, Decision 1). A single string is still accepted and\n * scopes to exactly that one group. An empty string scopes nothing.\n */\n group?: string | readonly string[];\n /** Keyed `{ payment, cart }` forwarded by the reactive runtime (arity-2 fragment, ADR-0015). */\n $data?: PaymentSectionRootData;\n /** Compiler-injected action surface; carries `payment.setMethod`, `payment.sendPayments`, and `analytics.track`. */\n $actions?: ComponentActions;\n /** The single overlay `Root` to control — a `DialogRoot` (modal) or `DrawerRoot` (slide-in). */\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const PaymentSectionControllerDefinition = defineComponent<PaymentSectionControllerProps>({\n name: 'PaymentSectionController',\n importPath: '@vtex/faststore/components',\n component: PaymentSectionController,\n fragment,\n fetchStrategy: 'reactive',\n actions: { payment: ['setMethod', 'sendPayments'], analytics: ['track'] },\n providesContext: ['payment', 'card-capture'],\n hardened: true,\n editor: { label: 'Payment Section Controller', category: 'commerce' },\n schema: {\n // Literal, not `DEFAULT_METHOD_GROUP` — see the same note on `PaymentSectionRootDefinition`.\n // T140, Decision 2/OQ-6: same widened shape as `PaymentSectionRootDefinition` — see its own note.\n group: {\n type: 'array',\n default: ['creditCardPaymentGroup', 'debitCardPaymentGroup'],\n label: 'Payment method group',\n },\n },\n guideline:\n \"State-only controller for a collapsed payment section: wrap a single DialogRoot (centered modal) or DrawerRoot (slide-in) child and it becomes controlled. Renders no markup and bakes no styling — compose the overlay particles (DialogTrigger/DialogPortal/DialogBackdrop/DialogPopup or the Drawer equivalents) directly as page nodes, put a static label (Text) inside the trigger — no component echoes the current choice there, and put PaymentMethodList plus the payment leaves (CardEntry, Installments, SavedCards, PlaceOrder, …) inside the popup. Provides the same 'payment' and 'card-capture' contexts as PaymentSectionRoot, so every leaf composes under either with no change. Unlike the delivery-options controller it does NOT close on a successful selection — picking a method is mid-flow — so close it from a DrawerClose/DialogClose particle or from the leaf that finishes the flow. See payment.md.\",\n // The convention-based `<file-stem>.md` (`payment-controller.md`) does not exist — this component's\n // doc is `payment.md`, shared with PaymentSectionRoot/PaymentMethodList (T25/FR-8).\n docPath: './payment.md',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function PaymentSectionController({\n group = DEFAULT_METHOD_GROUP,\n $data: $dataProp,\n $actions: $actionsProp,\n children,\n}: Readonly<PaymentSectionControllerProps>) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n const selection = usePaymentMethodSelection({ group, $data: $data?.payment ?? null, $actions });\n const [open, setOpen] = useState(false);\n const payment = useMemo<PaymentContextValue>(() => ({ ...selection, open, setOpen }), [selection, open]);\n\n if (!isValidElement<OverlayOpenProps>(children)) {\n return children;\n }\n\n return (\n <PaymentContext value={payment}>\n <PaymentSubmissionProvider path={selection.draft.path}>\n <PaymentCardCaptureProvider selection={selection} cart={$data?.cart} $actions={$actions}>\n {cloneElement(children, { open, onOpenChange: setOpen })}\n </PaymentCardCaptureProvider>\n </PaymentSubmissionProvider>\n </PaymentContext>\n );\n}\n"],"mappings":";;;;;;;;;;;AA+HA,MAAa,qCAAqC,gBAA+C;CAC/F,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA,eAAe;CACf,SAAS;EAAE,SAAS,CAAC,aAAa,cAAc;EAAG,WAAW,CAAC,OAAO;CAAE;CACxE,iBAAiB,CAAC,WAAW,cAAc;CAC3C,UAAU;CACV,QAAQ;EAAE,OAAO;EAA8B,UAAU;CAAW;CACpE,QAAQ,EAGN,OAAO;EACL,MAAM;EACN,SAAS,CAAC,0BAA0B,uBAAuB;EAC3D,OAAO;CACT,EACF;CACA,WACE;CAGF,SAAS;AACX,CAAC;AAMD,SAAgB,yBAAyB,EACvC,QAAQ,sBACR,OAAO,WACP,UAAU,cACV,YAC0C;CAC1C,MAAM,QAAQ,gBAAgB,SAAS;CACvC,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,YAAY,0BAA0B;EAAE;EAAO,OAAO,OAAO,WAAW;EAAM;CAAS,CAAC;CAC9F,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,UAAU,eAAoC;EAAE,GAAG;EAAW;EAAM;CAAQ,IAAI,CAAC,WAAW,IAAI,CAAC;CAEvG,IAAI,CAAC,eAAiC,QAAQ,GAC5C,OAAO;CAGT,OACE,oBAAC,gBAAD;EAAgB,OAAO;EACrB,UAAA,oBAAC,2BAAD;GAA2B,MAAM,UAAU,MAAM;GAC/C,UAAA,oBAAC,4BAAD;IAAuC;IAAW,MAAM,OAAO;IAAgB;IAC5E,UAAA,aAAa,UAAU;KAAE;KAAM,cAAc;IAAQ,CAAC;GAC7B,CAAA;EACH,CAAA;CACb,CAAA;AAEpB"}
1
+ {"version":3,"file":"payment-controller.js","names":[],"sources":["../../../src/matter/payment/payment-controller.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { cloneElement, isValidElement, type ReactNode, useMemo, useState } from 'react';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { PaymentSubmissionProvider } from '../../sdk/payment/submission-registry.js';\nimport {\n DEFAULT_METHOD_GROUP,\n PaymentContext,\n type PaymentContextValue,\n type PaymentSectionRootData,\n} from './payment.js';\nimport { PaymentCardCaptureProvider } from './payment-card-capture.js';\nimport { usePaymentMethodSelection } from './use-payment-method-selection.js';\n\n/**\n * The collapsed payment section (centered modal / slide-in panel) as a state-only controller\n * (specs/payment-section-root.md, T5; docs/features/credit-card/rfc.md § D1). The page composes a raw\n * `DialogRoot` or `DrawerRoot` and each of its particles (`DialogTrigger` / `DialogBackdrop` /\n * `DialogPopup` …) directly as `page.json` nodes, so every part — including the portaled backdrop and\n * popup a descendant selector could not reach — is a swatch-addressable node with zero Tailwind baked\n * into the package, exactly as `DeliveryOptionsController` established.\n *\n * `PaymentSectionController` renders no markup: it runs the shared `usePaymentMethodSelection` engine,\n * holds the open state, provides the same `payment` context `PaymentSectionRoot` does (ADR-0009 matches\n * by contract identifier, so every leaf composes under either with no edit), then injects\n * `open` / `onOpenChange` into its single overlay-`Root` child via `cloneElement` — the same mechanism\n * as `CartOpenOnAdd` and `ShippingAddressSavedAddressDrawerController`.\n *\n * It diverges from `DeliveryOptionsController` in one deliberate way: a successful method selection\n * does **not** close the surface. Picking a delivery option completes that interaction; picking a\n * payment method is the first step of several — the shopper still types a card, picks an installment,\n * and places the order. Closing is therefore the composition's call, through the context's `setOpen`\n * (T14 on a placed order) or a `DrawerClose` / `DialogClose` particle.\n *\n * The trigger holds a static label (`Text`): no component echoes the current choice there, and none is\n * shipped here — `payment.md` documents the same composition.\n */\n\n// Repeats `PaymentSectionData`'s selection set verbatim under its own name. Two definitions cannot\n// share one fragment name in a page query, and the native catalog builder resolves\n// `defineComponent({ fragment })` statically — a value imported from another module is silently\n// dropped from the built catalog. `delivery-options` duplicates for the same reason;\n// `payment.test.tsx` asserts the two sets stay field-for-field identical.\nconst fragment = /* GraphQL */ `\n fragment PaymentSectionControllerData on Query {\n payment {\n __typename\n id\n methods {\n __typename\n id\n name\n type\n groupName\n validator {\n __typename\n numberMask\n numberRegex\n cvvMask\n cvvRegex\n cvvRequired\n expirationRequired\n holderNameRequired\n billingAddressRequired\n documentDisplayable\n documentRequired\n }\n }\n selectedMethodId\n selectedAccountId\n selectedBin\n storeCountryCode\n countries {\n __typename\n countryCode\n documents {\n __typename\n type\n displayable\n required\n }\n }\n }\n cart {\n __typename\n id\n total {\n __typename\n amount\n currencyCode\n }\n }\n clientProfile {\n __typename\n id\n firstName\n lastName\n phone\n }\n }\n`;\n\n// The minimal open-state shape the controller injects into its overlay-Root child; both `DialogRoot`\n// and `DrawerRoot` accept it.\ntype OverlayOpenProps = {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n};\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type PaymentSectionControllerProps = {\n /**\n * Scopes the method list to a **set** of `PaymentMethod.groupName` values — a method is in scope\n * when its `groupName` is a member (T140, FR-1, Decision 1). A single string is still accepted and\n * scopes to exactly that one group. An empty string scopes nothing.\n */\n group?: string | readonly string[];\n /** The order of the method list by `PaymentMethod.groupName`; only orders, never hides. See `PaymentSectionRootProps`. */\n groupOrder?: string | readonly string[];\n /** Keyed `{ payment, cart, clientProfile }` forwarded by the reactive runtime (arity-3 fragment, ADR-0015). */\n $data?: PaymentSectionRootData;\n /** Compiler-injected action surface; carries `payment.setMethod`, `payment.sendPayments`, and `analytics.track`. */\n $actions?: ComponentActions;\n /** The single overlay `Root` to control — a `DialogRoot` (modal) or `DrawerRoot` (slide-in). */\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const PaymentSectionControllerDefinition = defineComponent<PaymentSectionControllerProps>({\n name: 'PaymentSectionController',\n importPath: '@vtex/faststore/components',\n component: PaymentSectionController,\n fragment,\n fetchStrategy: 'reactive',\n actions: { payment: ['setMethod', 'sendPayments'], analytics: ['track'] },\n providesContext: ['payment', 'card-capture'],\n hardened: true,\n editor: { label: 'Payment Section Controller', category: 'commerce' },\n schema: {\n // Literal, not `DEFAULT_METHOD_GROUP` — see the same note on `PaymentSectionRootDefinition`.\n // T140, Decision 2/OQ-6: same widened shape as `PaymentSectionRootDefinition` — see its own note.\n group: {\n type: 'array',\n default: ['creditCardPaymentGroup', 'debitCardPaymentGroup'],\n label: 'Payment method group',\n },\n // T199, Decision 2: no `default` — see the same note on `PaymentSectionRootDefinition`.\n groupOrder: {\n type: 'array',\n label: 'Payment method group order',\n },\n },\n guideline:\n \"State-only controller for a collapsed payment section: wrap a single DialogRoot (centered modal) or DrawerRoot (slide-in) child and it becomes controlled. Renders no markup and bakes no styling — compose the overlay particles (DialogTrigger/DialogPortal/DialogBackdrop/DialogPopup or the Drawer equivalents) directly as page nodes, put a static label (Text) inside the trigger — no component echoes the current choice there, and put PaymentMethodList plus the payment leaves (CardEntry, Installments, SavedCards, PlaceOrder, …) inside the popup. Provides the same 'payment' and 'card-capture' contexts as PaymentSectionRoot, so every leaf composes under either with no change. groupOrder only orders the popup's PaymentMethodList — a list of the store's payment group names, copied from its own data, that puts each option at its group's position; it never hides or adds an option, and a group it leaves out still shows after the named ones. Unlike the delivery-options controller it does NOT close on a successful selection — picking a method is mid-flow — so close it from a DrawerClose/DialogClose particle or from the leaf that finishes the flow. See payment.md.\",\n // The convention-based `<file-stem>.md` (`payment-controller.md`) does not exist — this component's\n // doc is `payment.md`, shared with PaymentSectionRoot/PaymentMethodList (T25/FR-8).\n docPath: './payment.md',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\nexport function PaymentSectionController({\n group = DEFAULT_METHOD_GROUP,\n groupOrder,\n $data: $dataProp,\n $actions: $actionsProp,\n children,\n}: Readonly<PaymentSectionControllerProps>) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n const selection = usePaymentMethodSelection({ group, groupOrder, $data: $data?.payment ?? null, $actions });\n const [open, setOpen] = useState(false);\n const clientProfile = $data?.clientProfile;\n const payment = useMemo<PaymentContextValue>(\n () => ({ ...selection, open, setOpen, clientProfile }),\n [selection, open, clientProfile],\n );\n\n if (!isValidElement<OverlayOpenProps>(children)) {\n return children;\n }\n\n return (\n <PaymentContext value={payment}>\n <PaymentSubmissionProvider path={selection.draft.path}>\n <PaymentCardCaptureProvider selection={selection} cart={$data?.cart} $actions={$actions}>\n {cloneElement(children, { open, onOpenChange: setOpen })}\n </PaymentCardCaptureProvider>\n </PaymentSubmissionProvider>\n </PaymentContext>\n );\n}\n"],"mappings":";;;;;;;;;;;AAyIA,MAAa,qCAAqC,gBAA+C;CAC/F,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACA,eAAe;CACf,SAAS;EAAE,SAAS,CAAC,aAAa,cAAc;EAAG,WAAW,CAAC,OAAO;CAAE;CACxE,iBAAiB,CAAC,WAAW,cAAc;CAC3C,UAAU;CACV,QAAQ;EAAE,OAAO;EAA8B,UAAU;CAAW;CACpE,QAAQ;EAGN,OAAO;GACL,MAAM;GACN,SAAS,CAAC,0BAA0B,uBAAuB;GAC3D,OAAO;EACT;EAEA,YAAY;GACV,MAAM;GACN,OAAO;EACT;CACF;CACA,WACE;CAGF,SAAS;AACX,CAAC;AAMD,SAAgB,yBAAyB,EACvC,QAAQ,sBACR,YACA,OAAO,WACP,UAAU,cACV,YAC0C;CAC1C,MAAM,QAAQ,gBAAgB,SAAS;CACvC,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,YAAY,0BAA0B;EAAE;EAAO;EAAY,OAAO,OAAO,WAAW;EAAM;CAAS,CAAC;CAC1G,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,gBAAgB,OAAO;CAC7B,MAAM,UAAU,eACP;EAAE,GAAG;EAAW;EAAM;EAAS;CAAc,IACpD;EAAC;EAAW;EAAM;CAAa,CACjC;CAEA,IAAI,CAAC,eAAiC,QAAQ,GAC5C,OAAO;CAGT,OACE,oBAAC,gBAAD;EAAgB,OAAO;EACrB,UAAA,oBAAC,2BAAD;GAA2B,MAAM,UAAU,MAAM;GAC/C,UAAA,oBAAC,4BAAD;IAAuC;IAAW,MAAM,OAAO;IAAgB;IAC5E,UAAA,aAAa,UAAU;KAAE;KAAM,cAAc;IAAQ,CAAC;GAC7B,CAAA;EACH,CAAA;CACb,CAAA;AAEpB"}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
3
  import "../../core/dist/index.js";
4
+ import { ownValue } from "../../utils/own-value.js";
4
5
  import { useDataOverride } from "../../sdk/data/data-override-context.js";
5
6
  import { Icon } from "../../particles/icon/icon.js";
6
7
  import { usePayment } from "./payment.js";
7
- import { ownValue } from "../../utils/own-value.js";
8
8
  import { NETWORK_ICON_BY_KEY } from "../card-entry/card-entry.js";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  //#region src/matter/payment/payment-method-badges.tsx
@@ -1,8 +1,9 @@
1
+ import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
1
2
  import { ComponentDefinition } from "../../core/dist/define-component.js";
2
3
  import "../../core/dist/index.js";
3
4
  import { ComponentActions } from "../../sdk/actions/types.js";
4
- import { PaymentMethodSelection, PaymentSectionData } from "./use-payment-method-selection.js";
5
5
  import { PaymentCartData } from "./payment-card-capture.js";
6
+ import { PaymentMethodSelection, PaymentSectionData } from "./use-payment-method-selection.js";
6
7
  import { ComponentPropsWithRef } from "react";
7
8
  //#region src/matter/payment/payment.d.ts
8
9
  /**
@@ -12,12 +13,23 @@ import { ComponentPropsWithRef } from "react";
12
13
  * a set (Decision 1) — a public API break for any consumer importing it directly (Interfaces).
13
14
  */
14
15
  /**
15
- * The roots' keyed `$data` (ADR-0015, arity 2): the `Payment` slice the selection engine reads, and the
16
- * cart total `add_payment_info` needs (moved here from `CardEntry`, which reads no cart).
16
+ * The cart's contact profile as the submit gate reads it. Only the three fields VTEX refuses an order
17
+ * for; the profile's `document` is never selected, so no cardholder-document value reaches this contract.
18
+ */
19
+ export type PaymentClientProfile = Readonly<{
20
+ firstName?: string | null;
21
+ lastName?: string | null;
22
+ phone?: string | null;
23
+ }>;
24
+ /**
25
+ * The roots' keyed `$data` (ADR-0015, arity 3): the `Payment` slice the selection engine reads, the
26
+ * cart total `add_payment_info` needs (moved here from `CardEntry`, which reads no cart), and the cart's
27
+ * profile, which the submit gate checks before a transaction opens.
17
28
  */
18
29
  export type PaymentSectionRootData = {
19
30
  payment?: PaymentSectionData;
20
31
  cart?: PaymentCartData;
32
+ clientProfile?: PaymentClientProfile | null;
21
33
  } | null;
22
34
  export declare const DEFAULT_METHOD_GROUP: readonly string[];
23
35
  /**
@@ -38,6 +50,12 @@ export type PaymentContextValue = Readonly<PaymentMethodSelection & {
38
50
  * shopper still has a card to type — so closing is the composition's call (Decision 5).
39
51
  */
40
52
  setOpen: (open: boolean) => void;
53
+ /**
54
+ * The cart's profile when the roots' `$data` carried one. `undefined` or `null` means it was not
55
+ * read (still resolving, or a `$data` that omits it), which the submit gate never refuses on; a
56
+ * present object counts as read even when every field is `null`.
57
+ */
58
+ clientProfile?: PaymentClientProfile | null;
41
59
  }>;
42
60
  /** The provider both section roots render. Exported for `PaymentSectionController`. */
43
61
  export declare const PaymentContext: React.Context<PaymentContextValue>;
@@ -59,31 +77,63 @@ export type PaymentSectionRootProps = ComponentPropsWithRef<'div'> & {
59
77
  * fragment data. An empty string scopes nothing.
60
78
  */
61
79
  group?: string | readonly string[];
62
- /** Keyed `{ payment, cart }` forwarded by the reactive runtime (arity-2 fragment, ADR-0015). */
80
+ /**
81
+ * The order of the method list, as a list of `PaymentMethod.groupName` values (T199): a method row
82
+ * sits at its group's position, and the single card control at the first of its groups the list
83
+ * names. It only orders — a group the list leaves out still shows, after the named ones in the order
84
+ * form's order, and a name no method holds is ignored. Names match exactly. Unset or empty keeps the
85
+ * order form's order, the card control first.
86
+ */
87
+ groupOrder?: string | readonly string[];
88
+ /** Keyed `{ payment, cart, clientProfile }` forwarded by the reactive runtime (arity-3 fragment, ADR-0015). */
63
89
  $data?: PaymentSectionRootData;
64
90
  /** Compiler-injected action surface; carries `payment.setMethod`, `payment.sendPayments`, and `analytics.track`. */
65
91
  $actions?: ComponentActions;
66
92
  };
93
+ export declare const PaymentMethodListContent: {
94
+ readonly id: "payment-method-list";
95
+ readonly title: "Payment Method List";
96
+ readonly description: "Copy for the payment method group legend, the single card option and a refused selection.";
97
+ readonly schema: {
98
+ readonly type: "object";
99
+ readonly additionalProperties: false;
100
+ readonly properties: {
101
+ readonly legend: {
102
+ readonly type: "string";
103
+ readonly title: "Legend";
104
+ readonly description: "The radio group's visible accessible name.";
105
+ readonly format: "icu-message";
106
+ readonly messageSource: "Payment method";
107
+ };
108
+ readonly cardLabel: {
109
+ readonly type: "string";
110
+ readonly title: "Card option label";
111
+ readonly description: "Names the one option that stands for every in-scope credit and debit method.";
112
+ readonly format: "icu-message";
113
+ readonly messageSource: "Pay with Credit / Debit Card";
114
+ };
115
+ readonly genericErrorMessage: {
116
+ readonly type: "string";
117
+ readonly title: "Selection failure message";
118
+ readonly description: "Shown when a method selection fails: a network failure or a fault the shopper cannot fix.";
119
+ readonly format: "icu-message";
120
+ readonly messageSource: "Unable to select the payment method. Please try again.";
121
+ };
122
+ };
123
+ };
124
+ };
67
125
  /** Renders its own controls from the context's method list — `children` would have nothing to template. */
68
- export type PaymentMethodListProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {
69
- /**
70
- * The radio group's accessible name, rendered as a visible `Fieldset.Legend` (T38, Decision 1).
71
- * Resolved through `resolveAuthoredCopy`: an authored empty or whitespace-only string falls back to
72
- * the default rather than rendering a nameless group.
73
- */
74
- legend?: string;
126
+ export type PaymentMethodListProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & MessageLocaleProp & {
75
127
  /**
76
- * The single card control's name (T171, Decision 8). The control stands for every in-scope
77
- * credit/debit method at once, so it cannot take its name from one of their `method.name` values the
78
- * way a per-network row did — it is authored copy instead, defaulting to the PRD's own string.
79
- * Resolved through `resolveAuthoredCopy` exactly as `legend` is, so an authored empty or
80
- * whitespace-only string falls back rather than rendering a nameless control.
128
+ * Merchant-authored copy: the group legend (T38) and the single card control's name (T171). The card
129
+ * control stands for every in-scope credit/debit method at once, so it cannot take its name from one
130
+ * of their `method.name` values.
81
131
  */
82
- cardLabel?: string;
132
+ $content?: ContentValue<typeof PaymentMethodListContent>;
83
133
  };
84
134
  export declare const PaymentSectionRootDefinition: ComponentDefinition<PaymentSectionRootProps>;
85
135
  export declare const PaymentMethodListDefinition: ComponentDefinition<PaymentMethodListProps>;
86
- export declare function PaymentSectionRoot({ group, $data: $dataProp, $actions: $actionsProp, className, children, ...props }: PaymentSectionRootProps): import("react/jsx-runtime").JSX.Element;
87
- export declare function PaymentMethodList({ legend, cardLabel, className, ...props }: PaymentMethodListProps): import("react/jsx-runtime").JSX.Element;
136
+ export declare function PaymentSectionRoot({ group, groupOrder, $data: $dataProp, $actions: $actionsProp, className, children, ...props }: PaymentSectionRootProps): import("react/jsx-runtime").JSX.Element;
137
+ export declare function PaymentMethodList({ $content, $locale, className, ...props }: PaymentMethodListProps): import("react/jsx-runtime").JSX.Element;
88
138
  //#endregion
89
139
  //# sourceMappingURL=payment.d.ts.map
@@ -1,13 +1,15 @@
1
1
  "use client";
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
+ import { defineContentType } from "../../core/dist/define-content-type.js";
3
4
  import "../../core/dist/index.js";
5
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
4
6
  import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
7
+ import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
5
8
  import { useDataOverride } from "../../sdk/data/data-override-context.js";
6
- import { resolveAuthoredCopy } from "../../utils/resolve-authored-copy.js";
7
9
  import { Fieldset } from "../../particles/fieldset/fieldset.js";
8
10
  import { RadioGroup, RadioIndicator, RadioRoot } from "../../particles/radio/radio.js";
9
11
  import { PaymentSubmissionProvider } from "../../sdk/payment/submission-registry.js";
10
- import { resolveCanRevealCardPayment, resolvePreselectionCandidateId, splitCardMethods, usePaymentMethodSelection } from "./use-payment-method-selection.js";
12
+ import { orderMethodListRows, resolveCanRevealCardPayment, resolvePreselectionCandidateId, splitCardMethods, usePaymentMethodSelection } from "./use-payment-method-selection.js";
11
13
  import { PaymentCardCaptureProvider } from "./payment-card-capture.js";
12
14
  import { createContext, useContext, useId, useLayoutEffect, useMemo } from "react";
13
15
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -41,6 +43,7 @@ const fragment = `
41
43
  __typename
42
44
  id
43
45
  name
46
+ type
44
47
  groupName
45
48
  validator {
46
49
  __typename
@@ -80,6 +83,13 @@ const fragment = `
80
83
  currencyCode
81
84
  }
82
85
  }
86
+ clientProfile {
87
+ __typename
88
+ id
89
+ firstName
90
+ lastName
91
+ phone
92
+ }
83
93
  }
84
94
  `;
85
95
  const DEFAULT_METHOD_GROUP = ["creditCardPaymentGroup", "debitCardPaymentGroup"];
@@ -101,6 +111,53 @@ function usePayment() {
101
111
  return ctx;
102
112
  }
103
113
  const NO_DISCLOSURE = () => {};
114
+ const PaymentMethodListContent = defineContentType({
115
+ id: "payment-method-list",
116
+ title: "Payment Method List",
117
+ description: "Copy for the payment method group legend, the single card option and a refused selection.",
118
+ schema: {
119
+ type: "object",
120
+ additionalProperties: false,
121
+ properties: {
122
+ legend: {
123
+ type: "string",
124
+ title: "Legend",
125
+ description: "The radio group's visible accessible name.",
126
+ format: "icu-message",
127
+ messageSource: "Payment method"
128
+ },
129
+ cardLabel: {
130
+ type: "string",
131
+ title: "Card option label",
132
+ description: "Names the one option that stands for every in-scope credit and debit method.",
133
+ format: "icu-message",
134
+ messageSource: "Pay with Credit / Debit Card"
135
+ },
136
+ genericErrorMessage: {
137
+ type: "string",
138
+ title: "Selection failure message",
139
+ description: "Shown when a method selection fails: a network failure or a fault the shopper cannot fix.",
140
+ format: "icu-message",
141
+ messageSource: "Unable to select the payment method. Please try again."
142
+ }
143
+ }
144
+ }
145
+ });
146
+ /**
147
+ * The message for each code a method selection can return. The list is not where a saved card is picked,
148
+ * so no code is one its shopper can act on here; every code, and one this map does not know, shows
149
+ * genericErrorMessage.
150
+ */
151
+ const PAYMENT_METHOD_LIST_ERROR_FIELDS = {
152
+ MISSING_CART_CONTEXT: "genericErrorMessage",
153
+ CART_NOT_FOUND: "genericErrorMessage",
154
+ INVALID_METHOD_ID: "genericErrorMessage",
155
+ INVALID_SAVED_CARD_ACCOUNT_ID: "genericErrorMessage",
156
+ MISMATCHED_BIN_FOR_SAVED_CARD: "genericErrorMessage",
157
+ INVALID_BIN_FORMAT: "genericErrorMessage",
158
+ CONFLICTING_BIN_AND_ACCOUNT_ID: "genericErrorMessage",
159
+ NETWORK_ERROR: "genericErrorMessage"
160
+ };
104
161
  const PaymentSectionRootDefinition = defineComponent({
105
162
  name: "PaymentSectionRoot",
106
163
  importPath: "@vtex/faststore/components",
@@ -117,49 +174,48 @@ const PaymentSectionRootDefinition = defineComponent({
117
174
  label: "Payment Section",
118
175
  category: "commerce"
119
176
  },
120
- schema: { group: {
121
- type: "array",
122
- default: ["creditCardPaymentGroup", "debitCardPaymentGroup"],
123
- label: "Payment method group"
124
- } },
125
- guideline: "Root of the checkout payment section: reads the payment methods and the current selection from the order form and provides the 'payment' context every payment leaf needs and the 'card-capture' context CardEntry needs, so place CardEntry, CardholderDocument, Installments, SaveCard, BillingAddress, SavedCards, PlaceOrder, and PaymentMethodList as its children — none of them render without a payment root ancestor. Renders one container div and no chrome or copy of its own; headings and layout belong to the composition. Selecting a payment option dispatches $actions.payment.setMethod and every subscriber re-renders from the cache with no refetch — and for a card it is the number the shopper types that decides the network, not an option they pick, so PaymentMethodList shows every in-scope credit and debit method as ONE card option. Which methods exist is always real data — never author them as props; group only scopes the list by the store's payment group(s) — defaults to credit and debit together, accepts one group name or a set of them, and set it to \"\" to show every method, one option each, with no card option. Use PaymentSectionController instead when the section should live in a drawer or modal. See payment.md."
177
+ schema: {
178
+ group: {
179
+ type: "array",
180
+ default: ["creditCardPaymentGroup", "debitCardPaymentGroup"],
181
+ label: "Payment method group"
182
+ },
183
+ groupOrder: {
184
+ type: "array",
185
+ label: "Payment method group order"
186
+ }
187
+ },
188
+ guideline: "Root of the checkout payment section: reads the payment methods and the current selection from the order form and provides the 'payment' context every payment leaf needs and the 'card-capture' context CardEntry needs, so place CardEntry, CardholderDocument, Installments, SaveCard, BillingAddress, SavedCards, PlaceOrder, and PaymentMethodList as its children — none of them render without a payment root ancestor. Renders one container div and no chrome or copy of its own; headings and layout belong to the composition. Selecting a payment option dispatches $actions.payment.setMethod and every subscriber re-renders from the cache with no refetch — and for a card it is the number the shopper types that decides the network, not an option they pick, so PaymentMethodList shows every in-scope credit and debit method as ONE card option. Which methods exist is always real data — never author them as props; group only scopes the list by the store's payment group(s) — defaults to credit and debit together, accepts one group name or a set of them, and set it to \"\" to show every method, one option each, with no card option. groupOrder only orders the list — a list of the store's payment group names, copied from its own data, that puts each option at its group's position and the card option at the first of its groups the list names; it never hides, adds or renames an option, a group it leaves out still shows after the named ones, and a name no method holds is ignored. Use PaymentSectionController instead when the section should live in a drawer or modal. See payment.md."
126
189
  });
127
190
  const PaymentMethodListDefinition = defineComponent({
128
191
  name: "PaymentMethodList",
129
192
  importPath: "@vtex/faststore/components",
130
193
  component: PaymentMethodList,
131
194
  requiresContext: "payment",
195
+ content: PaymentMethodListContent,
132
196
  editor: {
133
197
  label: "Payment Method List",
134
198
  category: "commerce"
135
199
  },
136
- schema: {
137
- legend: {
138
- type: "string",
139
- default: "Payment method",
140
- label: "Legend"
141
- },
142
- cardLabel: {
143
- type: "string",
144
- default: "Pay with Credit / Debit Card",
145
- label: "Card option label"
146
- }
147
- },
148
- guideline: "The payment-method picker: a radio group of the payment options the order form offers, plus the inline selection error (role=\"alert\"). Every in-scope credit and debit method is ONE option — the network comes from the card number the shopper types, never from a row they pick — and any other in-scope method (e.g. Pix) keeps a row of its own; set group to \"\" on the root to switch that off and get one row per method. Selecting an option dispatches the method selection. Selecting a non-card option hides the card form, and the card option brings it back. Place it inside a PaymentSectionRoot, or inside the DialogPopup/DrawerPopup of a PaymentSectionController. It renders its own options from real data, so it takes no children and no method props; author the card option's wording with cardLabel. Keep it composed: it is the only element that surfaces a rejected selection, and the only control that can recover a selection this section does not serve — omit it and a shopper whose persisted method sits outside group has no reachable way back. Must be inside a payment root."
200
+ schema: {},
201
+ guideline: "The payment-method picker: a radio group of the payment options the order form offers, plus the inline selection error (role=\"alert\"). Every in-scope credit and debit method is ONE option — the network comes from the card number the shopper types, never from a row they pick — and any other in-scope method (e.g. Pix) keeps a row of its own; set group to \"\" on the root to switch that off and get one row per method. Selecting an option dispatches the method selection. Selecting a non-card option hides the card form, and the card option brings it back. Place it inside a PaymentSectionRoot, or inside the DialogPopup/DrawerPopup of a PaymentSectionController. It renders its own options from real data, so it takes no children and no method props; its legend and the card option's wording come from the $content fields legend and cardLabel, and a refused selection shows genericErrorMessage. Keep it composed: it is the only element that surfaces a rejected selection, and the only control that can recover a selection this section does not serve — omit it and a shopper whose persisted method sits outside group has no reachable way back. Must be inside a payment root."
149
202
  });
150
- function PaymentSectionRoot({ group = DEFAULT_METHOD_GROUP, $data: $dataProp, $actions: $actionsProp, className, children, ...props }) {
203
+ function PaymentSectionRoot({ group = DEFAULT_METHOD_GROUP, groupOrder, $data: $dataProp, $actions: $actionsProp, className, children, ...props }) {
151
204
  const $data = useDataOverride($dataProp);
152
205
  const $actions = useActionsOverride($actionsProp);
153
206
  const selection = usePaymentMethodSelection({
154
207
  group,
208
+ groupOrder,
155
209
  $data: $data?.payment ?? null,
156
210
  $actions
157
211
  });
212
+ const clientProfile = $data?.clientProfile;
158
213
  const payment = useMemo(() => ({
159
214
  ...selection,
160
215
  open: true,
161
- setOpen: NO_DISCLOSURE
162
- }), [selection]);
216
+ setOpen: NO_DISCLOSURE,
217
+ clientProfile
218
+ }), [selection, clientProfile]);
163
219
  return /* @__PURE__ */ jsx(PaymentContextInternal, {
164
220
  value: payment,
165
221
  children: /* @__PURE__ */ jsx(PaymentSubmissionProvider, {
@@ -203,12 +259,22 @@ function methodListState({ loading, count }) {
203
259
  * `PaymentMethod.id` a standalone row is bound to.
204
260
  */
205
261
  const CARD_CONTROL_VALUE = "__fs-card-control";
206
- function PaymentMethodList({ legend, cardLabel, className, ...props }) {
207
- const { methods, allMethods, persistedMethodId, selectedMethodId, selectionError, selectMethod, selectNewCard, cardModeActive, loading, placing, setMethodListMounted } = usePayment();
262
+ function PaymentMethodList({ $content, $locale, className, ...props }) {
263
+ const { format } = useMessageFormatter(PaymentMethodListContent, $content);
264
+ const { methods, allMethods, groupOrder, persistedMethodId, selectedMethodId, selectionError, selectMethod, selectNewCard, cardModeActive, loading, placing, setMethodListMounted } = usePayment();
208
265
  const { collapsedCardMethods, standaloneMethods } = useMemo(() => splitCardMethods({
209
266
  methods,
210
267
  allMethods
211
268
  }), [methods, allMethods]);
269
+ const rows = useMemo(() => orderMethodListRows({
270
+ collapsedCardMethods,
271
+ standaloneMethods,
272
+ groupOrder
273
+ }), [
274
+ collapsedCardMethods,
275
+ standaloneMethods,
276
+ groupOrder
277
+ ]);
212
278
  const cardCandidateId = useMemo(() => resolvePreselectionCandidateId(methods), [methods]);
213
279
  const canRevealCardPayment = resolveCanRevealCardPayment({
214
280
  collapsedCardMethods,
@@ -246,30 +312,30 @@ function PaymentMethodList({ legend, cardLabel, className, ...props }) {
246
312
  children: [selectionError ? /* @__PURE__ */ jsx("div", {
247
313
  role: "alert",
248
314
  "data-fs-payment-method-list-error": "",
249
- children: selectionError
315
+ children: formatErrorCode(PaymentMethodListContent, PAYMENT_METHOD_LIST_ERROR_FIELDS, selectionError, format, "genericErrorMessage")
250
316
  }) : null, methods.length > 0 ? /* @__PURE__ */ jsxs(Fieldset.Root, {
251
317
  "data-fs-payment-method-list-fieldset": "",
252
- children: [/* @__PURE__ */ jsx(Fieldset.Legend, { children: resolveAuthoredCopy(legend, "Payment method") }), /* @__PURE__ */ jsxs(RadioGroup, {
318
+ children: [/* @__PURE__ */ jsx(Fieldset.Legend, { children: format("legend") }), /* @__PURE__ */ jsx(RadioGroup, {
253
319
  value: cardControlChecked ? CARD_CONTROL_VALUE : selectedMethodId ?? "",
254
320
  onValueChange: handleValueChange,
255
- children: [collapsedCardMethods.length > 0 ? /* @__PURE__ */ jsxs(RadioRoot, {
321
+ children: rows.map((row) => row.kind === "card" ? /* @__PURE__ */ jsxs(RadioRoot, {
256
322
  value: CARD_CONTROL_VALUE,
257
323
  children: [/* @__PURE__ */ jsx(RadioIndicator, { "data-fs-payment-method-indicator": "" }), /* @__PURE__ */ jsx("span", {
258
324
  "data-fs-payment-method-name": "",
259
- children: resolveAuthoredCopy(cardLabel, "Pay with Credit / Debit Card")
325
+ children: format("cardLabel")
260
326
  })]
261
- }) : null, standaloneMethods.map((method) => /* @__PURE__ */ jsxs(RadioRoot, {
262
- value: method.id,
327
+ }, CARD_CONTROL_VALUE) : /* @__PURE__ */ jsxs(RadioRoot, {
328
+ value: row.method.id,
263
329
  children: [/* @__PURE__ */ jsx(RadioIndicator, { "data-fs-payment-method-indicator": "" }), /* @__PURE__ */ jsx("span", {
264
330
  "data-fs-payment-method-name": "",
265
- children: method.name
331
+ children: row.method.name
266
332
  })]
267
- }, method.id))]
333
+ }, row.method.id))
268
334
  })]
269
335
  }) : null]
270
336
  });
271
337
  }
272
338
  //#endregion
273
- export { DEFAULT_METHOD_GROUP, PaymentContext, PaymentMethodList, PaymentMethodListDefinition, PaymentSectionRoot, PaymentSectionRootDefinition, usePayment };
339
+ export { DEFAULT_METHOD_GROUP, PAYMENT_METHOD_LIST_ERROR_FIELDS, PaymentContext, PaymentMethodList, PaymentMethodListContent, PaymentMethodListDefinition, PaymentSectionRoot, PaymentSectionRootDefinition, usePayment };
274
340
 
275
341
  //# sourceMappingURL=payment.js.map