@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.js","names":[],"sources":["../../../src/matter/payment/payment.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, createContext, useContext, useId, useLayoutEffect, useMemo } from 'react';\nimport { Fieldset } from '../../particles/fieldset/fieldset.js';\nimport { RadioGroup, RadioIndicator, RadioRoot } from '../../particles/radio/radio.js';\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 { resolveAuthoredCopy } from '../../utils/resolve-authored-copy.js';\nimport { PaymentCardCaptureProvider, type PaymentCartData } from './payment-card-capture.js';\nimport {\n type PaymentMethodSelection,\n type PaymentSectionData,\n resolveCanRevealCardPayment,\n resolvePreselectionCandidateId,\n splitCardMethods,\n usePaymentMethodSelection,\n} from './use-payment-method-selection.js';\n\n/**\n * The `PaymentSection` matter root (specs/payment-section-root.md, T5 of the Credit Card epic;\n * docs/features/credit-card/rfc.md § D1). `PaymentSectionRoot` is the always-visible presentation\n * variant over the `Payment` entity T1 projects: it owns a thin `fragment` (the method list with its\n * server-driven validator config, plus the current selection), runs the shared\n * `usePaymentMethodSelection` engine, and provides the `payment` context its leaves read — the card\n * entry (T7), cardholder document (T8), installments (T9), save-card (T10), billing address (T11),\n * saved cards (T12), and place-order CTA (T14) — through the guarded `usePayment()` hook rather than\n * drilled props (ADR-0009). `PaymentSectionController` (payment-controller.tsx) is the second provider\n * of the same context for a collapsed overlay surface; ADR-0009 matches by contract identifier, so the\n * two substitute for one another with zero edits to any consumer.\n *\n * \"Thin\" means no `installmentOptions` (T9's own fragment), no `savedCards` (T12's), and no\n * `selectedInstallment` (T6's) — the heavy, optional, and iterated subtrees ADR-0011/ADR-0012 split out.\n * `methods[].validator` *is* selected here: it is a non-normalized value object off `Payment.methods`\n * that cannot be subscribed separately, and T7 tests every method's `numberRegex` to detect a network.\n *\n * `children` is the section composition, not a per-method template — the method picker is\n * `PaymentMethodList`, an independently placeable part with its own hooks.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — raw template literal, matching the merged `payment-summary` sibling. The codegen\n// `documents` glob does not scan `src/matter/payment*`, so the typed `graphql()` factory is\n// unavailable here; `data-component-contract.test.ts` validates this fragment against the real schema.\n//\n// Selects `payment { id }` so Apollo's InMemoryCache normalizes `Payment` by id — required for the\n// `Payment` entity that `paymentMethodSelect` echoes back to update the same cache entity this\n// fragment reads. `fetchStrategy: 'reactive'`'s no-refetch guarantee holds only if both sides\n// normalize to one entity.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment PaymentSectionData 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/**\n * The default payment-group scope: credit and debit (T140, FR-2, Decision 2). Both strings are\n * store-configured, so a store whose groups differ must set `group` explicitly; `group: ''` scopes\n * nothing (specs/payment-section-root.md § Documentation Gaps item 1). Widened from a single string to\n * a set (Decision 1) — a public API break for any consumer importing it directly (Interfaces).\n */\n/**\n * The roots' keyed `$data` (ADR-0015, arity 2): the `Payment` slice the selection engine reads, and the\n * cart total `add_payment_info` needs (moved here from `CardEntry`, which reads no cart).\n */\nexport type PaymentSectionRootData = {\n payment?: PaymentSectionData;\n cart?: PaymentCartData;\n} | null;\n\nexport const DEFAULT_METHOD_GROUP: readonly string[] = ['creditCardPaymentGroup', 'debitCardPaymentGroup'];\n\n// ---------------------------------------------------------------------------\n// Payment context — provided by both section roots, read by every leaf\n// ---------------------------------------------------------------------------\n\n/**\n * The `payment` context contract, normative for T7–T12 and T14. Everything the selection engine\n * resolves, plus the overlay disclosure. What is deliberately absent is part of the contract too: no\n * card number, CVV, expiration, or holder name (RFC D13 — they live only in the card entry's local\n * state); no submission channel for the place-order sequence, which is the separate, narrow\n * `PaymentSubmissionProvider` below (T13) precisely so no card-shaped value ever joins this contract;\n * no `installmentOptions` / `savedCards` / `selectedInstallment` (their owners' fragments); and no\n * optimistic mirror of the persisted selection.\n */\nexport type PaymentContextValue = Readonly<\n PaymentMethodSelection & {\n /** The collapsed surface's disclosure state. Always `true` under `PaymentSectionRoot`. */\n open: boolean;\n /**\n * Drives the collapsed surface. A no-op under `PaymentSectionRoot`, so a leaf written for the\n * overlay composes unchanged inline. Selecting a method never closes the surface on its own — the\n * shopper still has a card to type — so closing is the composition's call (Decision 5).\n */\n setOpen: (open: boolean) => void;\n }\n>;\n\nconst PAYMENT_CONTEXT_UNSET = Symbol('PaymentContextUnset');\n\nconst PaymentContextInternal = createContext<PaymentContextValue | typeof PAYMENT_CONTEXT_UNSET>(PAYMENT_CONTEXT_UNSET);\n\n/** The provider both section roots render. Exported for `PaymentSectionController`. */\nexport const PaymentContext = PaymentContextInternal as React.Context<PaymentContextValue>;\n\n/**\n * Read the payment section's selection state, draft, and overlay disclosure from the nearest\n * `PaymentSectionRoot` or `PaymentSectionController`. Throws outside either subtree — a misplaced\n * consumer is a composition bug the author should see immediately, not a silent degrade to an empty\n * selection — mirroring `useSession()` / `useDeliveryOptions()`. ADR-0009's compiler check catches the\n * same mistake before emission for schema-authored pages; this is the defense-in-depth layer for\n * Storybook, tests, and hand-written JSX.\n */\nexport function usePayment(): PaymentContextValue {\n const ctx = useContext(PaymentContextInternal);\n if (ctx === PAYMENT_CONTEXT_UNSET) {\n throw new Error('usePayment() must be used inside a <PaymentSectionRoot> or <PaymentSectionController> subtree.');\n }\n return ctx;\n}\n\nconst NO_DISCLOSURE = () => {};\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type PaymentSectionRootProps = ComponentPropsWithRef<'div'> & {\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 (FR-4, US-3). T1's read model is method-agnostic and assigns the\n * narrowing to the consumer; this prop supplies no method, label, or ordering — the list itself is\n * fragment data. 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};\n\n/** Renders its own controls from the context's method list — `children` would have nothing to template. */\nexport type PaymentMethodListProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {\n /**\n * The radio group's accessible name, rendered as a visible `Fieldset.Legend` (T38, Decision 1).\n * Resolved through `resolveAuthoredCopy`: an authored empty or whitespace-only string falls back to\n * the default rather than rendering a nameless group.\n */\n legend?: string;\n /**\n * The single card control's name (T171, Decision 8). The control stands for every in-scope\n * credit/debit method at once, so it cannot take its name from one of their `method.name` values the\n * way a per-network row did — it is authored copy instead, defaulting to the PRD's own string.\n * Resolved through `resolveAuthoredCopy` exactly as `legend` is, so an authored empty or\n * whitespace-only string falls back rather than rendering a nameless control.\n */\n cardLabel?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const PaymentSectionRootDefinition = defineComponent<PaymentSectionRootProps>({\n name: 'PaymentSectionRoot',\n importPath: '@vtex/faststore/components',\n component: PaymentSectionRoot,\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', category: 'commerce' },\n schema: {\n // A literal, not `DEFAULT_METHOD_GROUP`: the native catalog builder extracts `schema` statically\n // and silently drops an identifier-valued default, so the built entry would carry no default and\n // the compiler would emit the section unscoped. `payment.test.tsx` asserts the literal matches the\n // constant, and that the built catalog kept the default.\n // T140, Decision 2/OQ-6: `type: 'array'` — no code path in packages/sukima/crates/sukima-core/\n // validates an authored prop's JSON value against this declared type, so a store's existing bare\n // string keeps compiling. No `items`: an enum would validate against a closed set of group names,\n // which is wrong for a store that renamed its group (OQ-3) — the exact fragility Decision 1 closes.\n group: {\n type: 'array',\n default: ['creditCardPaymentGroup', 'debitCardPaymentGroup'],\n label: 'Payment method group',\n },\n },\n guideline:\n \"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.\",\n});\n\nexport const PaymentMethodListDefinition = defineComponent<PaymentMethodListProps>({\n name: 'PaymentMethodList',\n importPath: '@vtex/faststore/components',\n component: PaymentMethodList,\n requiresContext: 'payment',\n editor: { label: 'Payment Method List', category: 'commerce' },\n schema: {\n // T38/T171: inline literals, never identifiers — the native catalog builder extracts `schema`\n // statically and silently drops an identifier-valued default (INV-8).\n legend: { type: 'string', default: 'Payment method', label: 'Legend' },\n cardLabel: { type: 'string', default: 'Pay with Credit / Debit Card', label: 'Card option label' },\n },\n guideline:\n '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.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function PaymentSectionRoot({\n group = DEFAULT_METHOD_GROUP,\n $data: $dataProp,\n $actions: $actionsProp,\n className,\n children,\n ...props\n}: PaymentSectionRootProps) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n const selection = usePaymentMethodSelection({ group, $data: $data?.payment ?? null, $actions });\n const payment = useMemo<PaymentContextValue>(\n () => ({ ...selection, open: true, setOpen: NO_DISCLOSURE }),\n [selection],\n );\n\n return (\n <PaymentContextInternal value={payment}>\n <PaymentSubmissionProvider path={selection.draft.path}>\n <PaymentCardCaptureProvider selection={selection} cart={$data?.cart} $actions={$actions}>\n <div\n {...props}\n className={className}\n data-fs-payment-section=\"\"\n {...(selection.draft.path ? { 'data-fs-payment-section-path': selection.draft.path } : {})}\n // T28, Decision 5: presence attribute only, deliberately never `inert` — `PlaceOrder` composes\n // as a child of this same container (FR-6), so making it inert here would swallow the CTA's\n // own role=\"alert\"/role=\"status\" regions, the shopper's only channel for the outcome.\n {...(selection.placing ? { 'data-fs-payment-section-placing': '' } : {})}\n >\n {children}\n </div>\n </PaymentCardCaptureProvider>\n </PaymentSubmissionProvider>\n </PaymentContextInternal>\n );\n}\n\n/**\n * The picker's presence state, always emitted so a swatch can surface a row-less container — otherwise\n * a zero-height element under any stacking swatch, and the \"visible empty region\" the section's\n * group-default risk is accepted on. `loading` (still resolving) and `empty` (resolved, nothing in\n * scope) stay distinct: one is a wait, the other a misconfiguration.\n */\nfunction methodListState({ loading, count }: { loading: boolean; count: number }): 'loading' | 'empty' | 'ready' {\n if (loading) return 'loading';\n if (count === 0) return 'empty';\n return 'ready';\n}\n\n/**\n * The DOM value the collapsed card control carries inside the `RadioGroup`. Base UI requires every\n * radio root to have one, and this control stands for N methods, so there is no `method.id` it could\n * use.\n *\n * It is a radio-group value and nothing else — **never a method id** (INV-1, ADR-0023). It is never\n * dispatched: `handleValueChange` below maps it back to `resolvePreselectionCandidateId`'s answer\n * before calling `selectMethod`, and records card mode through `selectNewCard()`, which dispatches\n * nothing, when there is no candidate (T191, FR-6). The prefix keeps it from ever colliding with a\n * `PaymentMethod.id` a standalone row is bound to.\n */\nconst CARD_CONTROL_VALUE = '__fs-card-control';\n\nexport function PaymentMethodList({ legend, cardLabel, className, ...props }: PaymentMethodListProps) {\n const {\n methods,\n allMethods,\n persistedMethodId,\n selectedMethodId,\n selectionError,\n selectMethod,\n selectNewCard,\n cardModeActive,\n loading,\n placing,\n setMethodListMounted,\n } = usePayment();\n\n // T171, FR-1/FR-2: one control for the in-scope card methods, one row for every other in-scope\n // method. Memoized off the two lists only (NFR-5) — nothing here may widen what re-creates the\n // `payment` context value, which a keystroke already churns enough.\n const { collapsedCardMethods, standaloneMethods } = useMemo(\n () => splitCardMethods({ methods, allMethods }),\n [methods, allMethods],\n );\n // Decision 3: the collapsed control dispatches the *shared* preselection candidate, so the escape\n // hatch and the preselection can never disagree about whether an id is available.\n const cardCandidateId = useMemo(() => resolvePreselectionCandidateId(methods), [methods]);\n const canRevealCardPayment = resolveCanRevealCardPayment({ collapsedCardMethods, standaloneMethods });\n\n // Decision 2: derived, never bound to one `method.id` — a control standing for N methods has none.\n // Checked when the persisted selection resolves inside the collapsed set, and when nothing is\n // persisted at all (PRD REQ-02's \"the card payment option is selected by default\"). The second arm\n // is a deliberate divergence from the pre-T171 bound-to-`$data` behaviour: the control can read\n // checked while `$data.selectedMethodId` is still null, having dispatched nothing. `persistedMethodId`\n // is the raw, unscoped fact on purpose — a persisted method this section does not serve must leave the\n // control unchecked, which is what keeps it activatable as US-5's way back. T191 (FR-6): card mode is\n // the third arm, the card option chosen over such a selection or over a non-card one.\n const cardControlChecked =\n collapsedCardMethods.length > 0 &&\n (persistedMethodId === null ||\n collapsedCardMethods.some((method) => method.id === selectedMethodId) ||\n cardModeActive);\n\n // Fix pass, finding R2: registers this instance with the shared engine so the card leaves know an\n // escape hatch exists before they ever collapse — a section composed with no `PaymentMethodList` at\n // all must never hide the only remaining way to change the method (typing a new card number).\n // Retracted unconditionally on unmount, unlike `setPlacing`'s own \"leave it if still placing\"\n // carve-out: there is no in-flight sequence here for an abandoned instance to still be part of.\n //\n // T191, Decision 5 (after T171's Decision 4): what is registered is `canRevealCardPayment`, not the\n // bare fact of being mounted — whether this list can bring the card form back. A rendered card\n // option always can, since card mode needs no method id; without one, only a row bound to a card\n // method can. See `resolveCanRevealCardPayment`'s own doc comment. The dependency list carries it,\n // so the registration re-runs when the method list resolves.\n //\n // Fix pass round 2 (flash regression): `useLayoutEffect`, not `useEffect` — mirroring\n // `place-order.tsx`'s own `setPlacing` registration, the structurally identical precedent for\n // publishing a ref-counted fact to this shared engine from a leaf's mount. A passive effect runs\n // after the browser has already painted, so a root whose persisted selection is genuinely out of\n // scope committed one real frame with `methodListMounted` still `false` — the collapse (then\n // `selectionOutOfScope && methodListMounted`, now `cardPaymentCollapsed`) computed `false` for that\n // frame, painting the card form visible, focusable, and with its security code not yet cleared,\n // before the registration ever landed and a second commit hid it. A layout effect's own state update\n // is guaranteed to flush synchronously before the browser paints, so the very first frame a shopper\n // can ever see already reflects `methodListMounted`. The card leaves read it purely at render time,\n // not from an effect of their own, so this reorders nothing on that side: whichever commit this\n // layout effect's own update produces is the one their next render (still pre-paint) sees.\n const instanceKey = useId();\n useLayoutEffect(() => {\n setMethodListMounted(instanceKey, canRevealCardPayment);\n return () => setMethodListMounted(instanceKey, false);\n }, [instanceKey, setMethodListMounted, canRevealCardPayment]);\n\n // INV-1: only an id the read model supplied is ever dispatched. A standalone row's value *is* its own\n // `method.id`; the collapsed control's value is a DOM value with no method behind it, so it routes\n // through the shared candidate instead (FR-4). With no candidate to name it records card mode, which\n // brings the card form back and sends nothing (T191, FR-6, Decision 6).\n function handleValueChange(value: string) {\n if (value === CARD_CONTROL_VALUE) {\n if (cardCandidateId !== null) {\n selectMethod({ methodId: cardCandidateId });\n } else {\n selectNewCard();\n }\n return;\n }\n selectMethod({ methodId: value });\n }\n\n return (\n <div\n {...props}\n className={className}\n inert={placing}\n aria-disabled={placing || undefined}\n data-fs-payment-method-list=\"\"\n data-fs-payment-method-list-state={methodListState({ loading, count: methods.length })}\n {...(placing ? { 'data-fs-payment-method-list-placing': '' } : {})}\n >\n {selectionError ? (\n <div role=\"alert\" data-fs-payment-method-list-error=\"\">\n {selectionError}\n </div>\n ) : null}\n {methods.length > 0 ? (\n // T38, Decision 1: Fieldset.Root + Fieldset.Legend, exactly what card-entry.tsx:1101-1112\n // already ships — Base UI propagates the legend's id as aria-labelledby onto the descendant\n // RadioGroup, so this one wrapper names both the fieldset and the radiogroup (measured).\n <Fieldset.Root data-fs-payment-method-list-fieldset=\"\">\n <Fieldset.Legend>{resolveAuthoredCopy(legend, 'Payment method')}</Fieldset.Legend>\n <RadioGroup\n value={cardControlChecked ? CARD_CONTROL_VALUE : (selectedMethodId ?? '')}\n onValueChange={handleValueChange}\n >\n {collapsedCardMethods.length > 0 ? (\n // One control for every in-scope credit and debit method (FR-1, Decision 1). Both\n // styling hooks stay exactly where a per-network row carried them — `payment.md`'s\n // styling table documents them, so a store's swatch keeps its selectors.\n <RadioRoot value={CARD_CONTROL_VALUE}>\n <RadioIndicator data-fs-payment-method-indicator=\"\" />\n <span data-fs-payment-method-name=\"\">\n {resolveAuthoredCopy(cardLabel, 'Pay with Credit / Debit Card')}\n </span>\n </RadioRoot>\n ) : null}\n {standaloneMethods.map((method) => (\n <RadioRoot key={method.id} value={method.id}>\n <RadioIndicator data-fs-payment-method-indicator=\"\" />\n <span data-fs-payment-method-name=\"\">{method.name}</span>\n </RadioRoot>\n ))}\n </RadioGroup>\n </Fieldset.Root>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,WAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkE/B,MAAa,uBAA0C,CAAC,0BAA0B,uBAAuB;AA4BzG,MAAM,wBAAwB,OAAO,qBAAqB;AAE1D,MAAM,yBAAyB,cAAkE,qBAAqB;;AAGtH,MAAa,iBAAi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EA,OACE,qBAAC,OAAD;EACE,GAAI;EACO;EACX,OAAO;EACP,iBAAe,WAAW,KAAA;EAC1B,+BAA4B;EAC5B,qCAAmC,gBAAgB;GAAE;GAAS,OAAO,QAAQ;EAAO,CAAC;EACrF,GAAK,UAAU,EAAE,uCAAuC,GAAG,IAAI,CAAC;EAPlE,UAAA,CASG,iBACC,oBAAC,OAAD;GAAK,MAAK;GAAQ,qCAAkC;GACjD,UAAA;EACE,CAAA,IACH,MACH,QAAQ,SAAS,IAIhB,qBAAC,SAAS,MAAV;GAAe,wCAAqC;GAApD,UAAA,CACE,oBAAC,SAAS,QAAV,EAAA,UAAkB,oBAAoB,QAAQ,gBAAgB,EAAmB,CAAA,GACjF,qBAAC,YAAD;IACE,OAAO,qBAAqB,qBAAsB,oBAAoB;IACtE,eAAe;IAFjB,UAAA,CAIG,qBAAqB,SAAS,IAI7B,qBAAC,WAAD;KAAW,OAAO;KAAlB,UAAA,CACE,oBAAC,gBAAD,EAAgB,oCAAiC,GAAI,CAAA,GACrD,oBAAC,QAAD;MAAM,+BAA4B;MAC/B,UAAA,oBAAoB,WAAW,8BAA8B;KAC1D,CAAA,CACG;IACT,CAAA,IAAA,MACH,kBAAkB,KAAK,WACtB,qBAAC,WAAD;KAA2B,OAAO,OAAO;KAAzC,UAAA,CACE,oBAAC,gBAAD,EAAgB,oCAAiC,GAAI,CAAA,GACrD,oBAAC,QAAD;MAAM,+BAA4B;MAAI,UAAA,OAAO;KAAW,CAAA,CAC/C;IAHK,GAAA,OAAO,EAGZ,CACZ,CACS;GACC,CAAA,CAAA;EACb,CAAA,IAAA,IACD;;AAET"}
1
+ {"version":3,"file":"payment.js","names":[],"sources":["../../../src/matter/payment/payment.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ContentValue,\n defineComponent,\n defineContentType,\n type MessageFieldName,\n type MessageLocaleProp,\n} from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, createContext, useContext, useId, useLayoutEffect, useMemo } from 'react';\nimport { Fieldset } from '../../particles/fieldset/fieldset.js';\nimport { RadioGroup, RadioIndicator, RadioRoot } from '../../particles/radio/radio.js';\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 { formatErrorCode } from '../../sdk/i18n/format-error-code.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { PaymentSubmissionProvider } from '../../sdk/payment/submission-registry.js';\nimport { PaymentCardCaptureProvider, type PaymentCartData } from './payment-card-capture.js';\nimport {\n orderMethodListRows,\n type PaymentMethodSelectErrorCode,\n type PaymentMethodSelection,\n type PaymentSectionData,\n resolveCanRevealCardPayment,\n resolvePreselectionCandidateId,\n splitCardMethods,\n usePaymentMethodSelection,\n} from './use-payment-method-selection.js';\n\n/**\n * The `PaymentSection` matter root (specs/payment-section-root.md, T5 of the Credit Card epic;\n * docs/features/credit-card/rfc.md § D1). `PaymentSectionRoot` is the always-visible presentation\n * variant over the `Payment` entity T1 projects: it owns a thin `fragment` (the method list with its\n * server-driven validator config, plus the current selection), runs the shared\n * `usePaymentMethodSelection` engine, and provides the `payment` context its leaves read — the card\n * entry (T7), cardholder document (T8), installments (T9), save-card (T10), billing address (T11),\n * saved cards (T12), and place-order CTA (T14) — through the guarded `usePayment()` hook rather than\n * drilled props (ADR-0009). `PaymentSectionController` (payment-controller.tsx) is the second provider\n * of the same context for a collapsed overlay surface; ADR-0009 matches by contract identifier, so the\n * two substitute for one another with zero edits to any consumer.\n *\n * \"Thin\" means no `installmentOptions` (T9's own fragment), no `savedCards` (T12's), and no\n * `selectedInstallment` (T6's) — the heavy, optional, and iterated subtrees ADR-0011/ADR-0012 split out.\n * `methods[].validator` *is* selected here: it is a non-normalized value object off `Payment.methods`\n * that cannot be subscribed separately, and T7 tests every method's `numberRegex` to detect a network.\n *\n * `children` is the section composition, not a per-method template — the method picker is\n * `PaymentMethodList`, an independently placeable part with its own hooks.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — raw template literal, matching the merged `payment-summary` sibling. The codegen\n// `documents` glob does not scan `src/matter/payment*`, so the typed `graphql()` factory is\n// unavailable here; `data-component-contract.test.ts` validates this fragment against the real schema.\n//\n// Selects `payment { id }` so Apollo's InMemoryCache normalizes `Payment` by id — required for the\n// `Payment` entity that `paymentMethodSelect` echoes back to update the same cache entity this\n// fragment reads. `fetchStrategy: 'reactive'`'s no-refetch guarantee holds only if both sides\n// normalize to one entity.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment PaymentSectionData 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/**\n * The default payment-group scope: credit and debit (T140, FR-2, Decision 2). Both strings are\n * store-configured, so a store whose groups differ must set `group` explicitly; `group: ''` scopes\n * nothing (specs/payment-section-root.md § Documentation Gaps item 1). Widened from a single string to\n * a set (Decision 1) — a public API break for any consumer importing it directly (Interfaces).\n */\n/**\n * The cart's contact profile as the submit gate reads it. Only the three fields VTEX refuses an order\n * for; the profile's `document` is never selected, so no cardholder-document value reaches this contract.\n */\nexport type PaymentClientProfile = Readonly<{\n firstName?: string | null;\n lastName?: string | null;\n phone?: string | null;\n}>;\n\n/**\n * The roots' keyed `$data` (ADR-0015, arity 3): the `Payment` slice the selection engine reads, the\n * cart total `add_payment_info` needs (moved here from `CardEntry`, which reads no cart), and the cart's\n * profile, which the submit gate checks before a transaction opens.\n */\nexport type PaymentSectionRootData = {\n payment?: PaymentSectionData;\n cart?: PaymentCartData;\n clientProfile?: PaymentClientProfile | null;\n} | null;\n\nexport const DEFAULT_METHOD_GROUP: readonly string[] = ['creditCardPaymentGroup', 'debitCardPaymentGroup'];\n\n// ---------------------------------------------------------------------------\n// Payment context — provided by both section roots, read by every leaf\n// ---------------------------------------------------------------------------\n\n/**\n * The `payment` context contract, normative for T7–T12 and T14. Everything the selection engine\n * resolves, plus the overlay disclosure. What is deliberately absent is part of the contract too: no\n * card number, CVV, expiration, or holder name (RFC D13 — they live only in the card entry's local\n * state); no submission channel for the place-order sequence, which is the separate, narrow\n * `PaymentSubmissionProvider` below (T13) precisely so no card-shaped value ever joins this contract;\n * no `installmentOptions` / `savedCards` / `selectedInstallment` (their owners' fragments); and no\n * optimistic mirror of the persisted selection.\n */\nexport type PaymentContextValue = Readonly<\n PaymentMethodSelection & {\n /** The collapsed surface's disclosure state. Always `true` under `PaymentSectionRoot`. */\n open: boolean;\n /**\n * Drives the collapsed surface. A no-op under `PaymentSectionRoot`, so a leaf written for the\n * overlay composes unchanged inline. Selecting a method never closes the surface on its own — the\n * shopper still has a card to type — so closing is the composition's call (Decision 5).\n */\n setOpen: (open: boolean) => void;\n /**\n * The cart's profile when the roots' `$data` carried one. `undefined` or `null` means it was not\n * read (still resolving, or a `$data` that omits it), which the submit gate never refuses on; a\n * present object counts as read even when every field is `null`.\n */\n clientProfile?: PaymentClientProfile | null;\n }\n>;\n\nconst PAYMENT_CONTEXT_UNSET = Symbol('PaymentContextUnset');\n\nconst PaymentContextInternal = createContext<PaymentContextValue | typeof PAYMENT_CONTEXT_UNSET>(PAYMENT_CONTEXT_UNSET);\n\n/** The provider both section roots render. Exported for `PaymentSectionController`. */\nexport const PaymentContext = PaymentContextInternal as React.Context<PaymentContextValue>;\n\n/**\n * Read the payment section's selection state, draft, and overlay disclosure from the nearest\n * `PaymentSectionRoot` or `PaymentSectionController`. Throws outside either subtree — a misplaced\n * consumer is a composition bug the author should see immediately, not a silent degrade to an empty\n * selection — mirroring `useSession()` / `useDeliveryOptions()`. ADR-0009's compiler check catches the\n * same mistake before emission for schema-authored pages; this is the defense-in-depth layer for\n * Storybook, tests, and hand-written JSX.\n */\nexport function usePayment(): PaymentContextValue {\n const ctx = useContext(PaymentContextInternal);\n if (ctx === PAYMENT_CONTEXT_UNSET) {\n throw new Error('usePayment() must be used inside a <PaymentSectionRoot> or <PaymentSectionController> subtree.');\n }\n return ctx;\n}\n\nconst NO_DISCLOSURE = () => {};\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type PaymentSectionRootProps = ComponentPropsWithRef<'div'> & {\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 (FR-4, US-3). T1's read model is method-agnostic and assigns the\n * narrowing to the consumer; this prop supplies no method, label, or ordering — the list itself is\n * fragment data. An empty string scopes nothing.\n */\n group?: string | readonly string[];\n /**\n * The order of the method list, as a list of `PaymentMethod.groupName` values (T199): a method row\n * sits at its group's position, and the single card control at the first of its groups the list\n * names. It only orders — a group the list leaves out still shows, after the named ones in the order\n * form's order, and a name no method holds is ignored. Names match exactly. Unset or empty keeps the\n * order form's order, the card control first.\n */\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};\n\nexport const PaymentMethodListContent = defineContentType({\n id: 'payment-method-list',\n title: 'Payment Method List',\n description: 'Copy for the payment method group legend, the single card option and a refused selection.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n legend: {\n type: 'string',\n title: 'Legend',\n description: \"The radio group's visible accessible name.\",\n format: 'icu-message',\n messageSource: 'Payment method',\n },\n cardLabel: {\n type: 'string',\n title: 'Card option label',\n description: 'Names the one option that stands for every in-scope credit and debit method.',\n format: 'icu-message',\n messageSource: 'Pay with Credit / Debit Card',\n },\n genericErrorMessage: {\n type: 'string',\n title: 'Selection failure message',\n description: 'Shown when a method selection fails: a network failure or a fault the shopper cannot fix.',\n format: 'icu-message',\n messageSource: 'Unable to select the payment method. Please try again.',\n },\n },\n },\n});\n\n/**\n * The message for each code a method selection can return. The list is not where a saved card is picked,\n * so no code is one its shopper can act on here; every code, and one this map does not know, shows\n * genericErrorMessage.\n */\nexport const PAYMENT_METHOD_LIST_ERROR_FIELDS = {\n MISSING_CART_CONTEXT: 'genericErrorMessage',\n CART_NOT_FOUND: 'genericErrorMessage',\n INVALID_METHOD_ID: 'genericErrorMessage',\n INVALID_SAVED_CARD_ACCOUNT_ID: 'genericErrorMessage',\n MISMATCHED_BIN_FOR_SAVED_CARD: 'genericErrorMessage',\n INVALID_BIN_FORMAT: 'genericErrorMessage',\n CONFLICTING_BIN_AND_ACCOUNT_ID: 'genericErrorMessage',\n NETWORK_ERROR: 'genericErrorMessage',\n} as const satisfies Record<PaymentMethodSelectErrorCode, MessageFieldName<typeof PaymentMethodListContent>>;\n\n/** Renders its own controls from the context's method list — `children` would have nothing to template. */\nexport type PaymentMethodListProps = Omit<ComponentPropsWithRef<'div'>, 'children'> &\n MessageLocaleProp & {\n /**\n * Merchant-authored copy: the group legend (T38) and the single card control's name (T171). The card\n * control stands for every in-scope credit/debit method at once, so it cannot take its name from one\n * of their `method.name` values.\n */\n $content?: ContentValue<typeof PaymentMethodListContent>;\n };\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const PaymentSectionRootDefinition = defineComponent<PaymentSectionRootProps>({\n name: 'PaymentSectionRoot',\n importPath: '@vtex/faststore/components',\n component: PaymentSectionRoot,\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', category: 'commerce' },\n schema: {\n // A literal, not `DEFAULT_METHOD_GROUP`: the native catalog builder extracts `schema` statically\n // and silently drops an identifier-valued default, so the built entry would carry no default and\n // the compiler would emit the section unscoped. `payment.test.tsx` asserts the literal matches the\n // constant, and that the built catalog kept the default.\n // T140, Decision 2/OQ-6: `type: 'array'` — no code path in packages/sukima/crates/sukima-core/\n // validates an authored prop's JSON value against this declared type, so a store's existing bare\n // string keeps compiling. No `items`: an enum would validate against a closed set of group names,\n // which is wrong for a store that renamed its group (OQ-3) — the exact fragility Decision 1 closes.\n group: {\n type: 'array',\n default: ['creditCardPaymentGroup', 'debitCardPaymentGroup'],\n label: 'Payment method group',\n },\n // T199, Decision 2: no `default` — absent means the order form's order, and the catalog builder\n // drops an identifier default, so a default would have to be a literal `[]` the compiler would emit\n // into every generated section for no effect. No `items`, for the same reason `group` has none.\n groupOrder: {\n type: 'array',\n label: 'Payment method group order',\n },\n },\n guideline:\n \"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.\",\n});\n\nexport const PaymentMethodListDefinition = defineComponent<PaymentMethodListProps>({\n name: 'PaymentMethodList',\n importPath: '@vtex/faststore/components',\n component: PaymentMethodList,\n requiresContext: 'payment',\n content: PaymentMethodListContent,\n editor: { label: 'Payment Method List', category: 'commerce' },\n schema: {},\n guideline:\n '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.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function PaymentSectionRoot({\n group = DEFAULT_METHOD_GROUP,\n groupOrder,\n $data: $dataProp,\n $actions: $actionsProp,\n className,\n children,\n ...props\n}: PaymentSectionRootProps) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n const selection = usePaymentMethodSelection({ group, groupOrder, $data: $data?.payment ?? null, $actions });\n const clientProfile = $data?.clientProfile;\n const payment = useMemo<PaymentContextValue>(\n () => ({ ...selection, open: true, setOpen: NO_DISCLOSURE, clientProfile }),\n [selection, clientProfile],\n );\n\n return (\n <PaymentContextInternal value={payment}>\n <PaymentSubmissionProvider path={selection.draft.path}>\n <PaymentCardCaptureProvider selection={selection} cart={$data?.cart} $actions={$actions}>\n <div\n {...props}\n className={className}\n data-fs-payment-section=\"\"\n {...(selection.draft.path ? { 'data-fs-payment-section-path': selection.draft.path } : {})}\n // T28, Decision 5: presence attribute only, deliberately never `inert` — `PlaceOrder` composes\n // as a child of this same container (FR-6), so making it inert here would swallow the CTA's\n // own role=\"alert\"/role=\"status\" regions, the shopper's only channel for the outcome.\n {...(selection.placing ? { 'data-fs-payment-section-placing': '' } : {})}\n >\n {children}\n </div>\n </PaymentCardCaptureProvider>\n </PaymentSubmissionProvider>\n </PaymentContextInternal>\n );\n}\n\n/**\n * The picker's presence state, always emitted so a swatch can surface a row-less container — otherwise\n * a zero-height element under any stacking swatch, and the \"visible empty region\" the section's\n * group-default risk is accepted on. `loading` (still resolving) and `empty` (resolved, nothing in\n * scope) stay distinct: one is a wait, the other a misconfiguration.\n */\nfunction methodListState({ loading, count }: { loading: boolean; count: number }): 'loading' | 'empty' | 'ready' {\n if (loading) return 'loading';\n if (count === 0) return 'empty';\n return 'ready';\n}\n\n/**\n * The DOM value the collapsed card control carries inside the `RadioGroup`. Base UI requires every\n * radio root to have one, and this control stands for N methods, so there is no `method.id` it could\n * use.\n *\n * It is a radio-group value and nothing else — **never a method id** (INV-1, ADR-0023). It is never\n * dispatched: `handleValueChange` below maps it back to `resolvePreselectionCandidateId`'s answer\n * before calling `selectMethod`, and records card mode through `selectNewCard()`, which dispatches\n * nothing, when there is no candidate (T191, FR-6). The prefix keeps it from ever colliding with a\n * `PaymentMethod.id` a standalone row is bound to.\n */\nconst CARD_CONTROL_VALUE = '__fs-card-control';\n\nexport function PaymentMethodList({ $content, $locale, className, ...props }: PaymentMethodListProps) {\n const { format } = useMessageFormatter(PaymentMethodListContent, $content);\n const {\n methods,\n allMethods,\n groupOrder,\n persistedMethodId,\n selectedMethodId,\n selectionError,\n selectMethod,\n selectNewCard,\n cardModeActive,\n loading,\n placing,\n setMethodListMounted,\n } = usePayment();\n\n // T171, FR-1/FR-2: one control for the in-scope card methods, one row for every other in-scope\n // method. Memoized off the two lists only (NFR-5) — nothing here may widen what re-creates the\n // `payment` context value, which a keystroke already churns enough.\n const { collapsedCardMethods, standaloneMethods } = useMemo(\n () => splitCardMethods({ methods, allMethods }),\n [methods, allMethods],\n );\n // T199: the merchant's order is applied here, to the rows alone — `methods` keeps the order form's\n // order, because a typed card number resolves against it.\n const rows = useMemo(\n () => orderMethodListRows({ collapsedCardMethods, standaloneMethods, groupOrder }),\n [collapsedCardMethods, standaloneMethods, groupOrder],\n );\n // Decision 3: the collapsed control dispatches the *shared* preselection candidate, so the escape\n // hatch and the preselection can never disagree about whether an id is available.\n const cardCandidateId = useMemo(() => resolvePreselectionCandidateId(methods), [methods]);\n const canRevealCardPayment = resolveCanRevealCardPayment({ collapsedCardMethods, standaloneMethods });\n\n // Decision 2: derived, never bound to one `method.id` — a control standing for N methods has none.\n // Checked when the persisted selection resolves inside the collapsed set, and when nothing is\n // persisted at all (PRD REQ-02's \"the card payment option is selected by default\"). The second arm\n // is a deliberate divergence from the pre-T171 bound-to-`$data` behaviour: the control can read\n // checked while `$data.selectedMethodId` is still null, having dispatched nothing. `persistedMethodId`\n // is the raw, unscoped fact on purpose — a persisted method this section does not serve must leave the\n // control unchecked, which is what keeps it activatable as US-5's way back. T191 (FR-6): card mode is\n // the third arm, the card option chosen over such a selection or over a non-card one.\n const cardControlChecked =\n collapsedCardMethods.length > 0 &&\n (persistedMethodId === null ||\n collapsedCardMethods.some((method) => method.id === selectedMethodId) ||\n cardModeActive);\n\n // Fix pass, finding R2: registers this instance with the shared engine so the card leaves know an\n // escape hatch exists before they ever collapse — a section composed with no `PaymentMethodList` at\n // all must never hide the only remaining way to change the method (typing a new card number).\n // Retracted unconditionally on unmount, unlike `setPlacing`'s own \"leave it if still placing\"\n // carve-out: there is no in-flight sequence here for an abandoned instance to still be part of.\n //\n // T191, Decision 5 (after T171's Decision 4): what is registered is `canRevealCardPayment`, not the\n // bare fact of being mounted — whether this list can bring the card form back. A rendered card\n // option always can, since card mode needs no method id; without one, only a row bound to a card\n // method can. See `resolveCanRevealCardPayment`'s own doc comment. The dependency list carries it,\n // so the registration re-runs when the method list resolves.\n //\n // Fix pass round 2 (flash regression): `useLayoutEffect`, not `useEffect` — mirroring\n // `place-order.tsx`'s own `setPlacing` registration, the structurally identical precedent for\n // publishing a ref-counted fact to this shared engine from a leaf's mount. A passive effect runs\n // after the browser has already painted, so a root whose persisted selection is genuinely out of\n // scope committed one real frame with `methodListMounted` still `false` — the collapse (then\n // `selectionOutOfScope && methodListMounted`, now `cardPaymentCollapsed`) computed `false` for that\n // frame, painting the card form visible, focusable, and with its security code not yet cleared,\n // before the registration ever landed and a second commit hid it. A layout effect's own state update\n // is guaranteed to flush synchronously before the browser paints, so the very first frame a shopper\n // can ever see already reflects `methodListMounted`. The card leaves read it purely at render time,\n // not from an effect of their own, so this reorders nothing on that side: whichever commit this\n // layout effect's own update produces is the one their next render (still pre-paint) sees.\n const instanceKey = useId();\n useLayoutEffect(() => {\n setMethodListMounted(instanceKey, canRevealCardPayment);\n return () => setMethodListMounted(instanceKey, false);\n }, [instanceKey, setMethodListMounted, canRevealCardPayment]);\n\n // INV-1: only an id the read model supplied is ever dispatched. A standalone row's value *is* its own\n // `method.id`; the collapsed control's value is a DOM value with no method behind it, so it routes\n // through the shared candidate instead (FR-4). With no candidate to name it records card mode, which\n // brings the card form back and sends nothing (T191, FR-6, Decision 6).\n function handleValueChange(value: string) {\n if (value === CARD_CONTROL_VALUE) {\n if (cardCandidateId !== null) {\n selectMethod({ methodId: cardCandidateId });\n } else {\n selectNewCard();\n }\n return;\n }\n selectMethod({ methodId: value });\n }\n\n return (\n <div\n {...props}\n className={className}\n inert={placing}\n aria-disabled={placing || undefined}\n data-fs-payment-method-list=\"\"\n data-fs-payment-method-list-state={methodListState({ loading, count: methods.length })}\n {...(placing ? { 'data-fs-payment-method-list-placing': '' } : {})}\n >\n {selectionError ? (\n <div role=\"alert\" data-fs-payment-method-list-error=\"\">\n {formatErrorCode(\n PaymentMethodListContent,\n PAYMENT_METHOD_LIST_ERROR_FIELDS,\n selectionError,\n format,\n 'genericErrorMessage',\n )}\n </div>\n ) : null}\n {methods.length > 0 ? (\n // T38, Decision 1: Fieldset.Root + Fieldset.Legend, exactly what card-entry.tsx:1101-1112\n // already ships — Base UI propagates the legend's id as aria-labelledby onto the descendant\n // RadioGroup, so this one wrapper names both the fieldset and the radiogroup (measured).\n <Fieldset.Root data-fs-payment-method-list-fieldset=\"\">\n <Fieldset.Legend>{format('legend')}</Fieldset.Legend>\n <RadioGroup\n value={cardControlChecked ? CARD_CONTROL_VALUE : (selectedMethodId ?? '')}\n onValueChange={handleValueChange}\n >\n {rows.map((row) =>\n row.kind === 'card' ? (\n // One control for every in-scope credit and debit method (FR-1, Decision 1). Both\n // styling hooks stay exactly where a per-network row carried them — `payment.md`'s\n // styling table documents them, so a store's swatch keeps its selectors.\n <RadioRoot key={CARD_CONTROL_VALUE} value={CARD_CONTROL_VALUE}>\n <RadioIndicator data-fs-payment-method-indicator=\"\" />\n <span data-fs-payment-method-name=\"\">{format('cardLabel')}</span>\n </RadioRoot>\n ) : (\n <RadioRoot key={row.method.id} value={row.method.id}>\n <RadioIndicator data-fs-payment-method-indicator=\"\" />\n <span data-fs-payment-method-name=\"\">{row.method.name}</span>\n </RadioRoot>\n ),\n )}\n </RadioGroup>\n </Fieldset.Root>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAM,WAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsF/B,MAAa,uBAA0C,CAAC,0BAA0B,uBAAuB;AAkCzG,MAAM,wBAAwB,OAAO,qBAAqB;AAE1D,MAAM,yBAAyB,cAAkE,qBAAqB;;AAGtH,MAAa,iBAAiB;;;;;;;;;AAU9B,SAAgB,aAAkC;CAChD,MAAM,MAAM,WAAW,sBAAsB;CAC7C,IAAI,QAAQ,uBACV,MAAM,IAAI,MAAM,gGAAgG;CAElH,OAAO;AACT;AAEA,MAAM,sBAAsB,CAAC;AA6B7B,MAAa,2BAA2B,kBAAkB;CACxD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MA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,EAAgB,oCAAiC,GAAI,CAAA,GACrD,oBAAC,QAAD;MAAM,+BAA4B;MAAI,UAAA,IAAI,OAAO;KAAW,CAAA,CACnD;IAHK,GAAA,IAAI,OAAO,EAGhB,CAEf;GACU,CAAA,CACC;EACb,CAAA,IAAA,IACD;;AAET"}
@@ -1,4 +1,5 @@
1
- import { PaymentMethodSelectInput } from "../../sdk/payment/operations.js";
1
+ import { PaymentType } from "../../sdk/generated/graphql.js";
2
+ import { PaymentMethodSelectInput, PaymentUserError } from "../../sdk/payment/operations.js";
2
3
  import "../../sdk/actions/types.js";
3
4
  import { PaymentSubmissionPath } from "../../sdk/payment/submission-registry.js";
4
5
  import { DocumentType } from "../../particles/document-field/document-field.js";
@@ -33,6 +34,11 @@ export type PaymentSectionValidator = Readonly<{
33
34
  export type PaymentSectionMethod = Readonly<{
34
35
  id: string;
35
36
  name: string;
37
+ /**
38
+ * The vendor-neutral kind (`PaymentMethod.type`, T230). The card classifiers read this. `groupName`
39
+ * stays the open-ended vendor string: the `group` scope, `groupOrder` and the gateway body read it.
40
+ */
41
+ type: PaymentType;
36
42
  groupName: string;
37
43
  validator: PaymentSectionValidator;
38
44
  }>;
@@ -107,6 +113,12 @@ export type PaymentDraft = Readonly<{
107
113
  * literal must carry it.
108
114
  */
109
115
  billingAddressUnsaved: boolean | null;
116
+ /**
117
+ * The card entry passes length, Luhn, expiration and security code: a boolean, never the card. `false`
118
+ * until `CardEntry` says otherwise, and again whenever it unmounts. The installment selector reads it
119
+ * (with `path`) to decide whether it renders at all.
120
+ */
121
+ entryValid: boolean;
110
122
  }>;
111
123
  /**
112
124
  * Whether the BIN the server has persisted agrees with the client's current `draft.bin`.
@@ -148,6 +160,13 @@ export type PaymentMethodSelection = {
148
160
  * risk `methods` exists to guard against (T71, Decision 1).
149
161
  */
150
162
  allMethods: readonly PaymentSectionMethod[];
163
+ /**
164
+ * The merchant-authored order of the method list, normalized (`normalizeGroupOrder`): group names, `[]`
165
+ * when unset (T199). Read only by `PaymentMethodList`, which orders its own rows by it. `methods` and
166
+ * `allMethods` keep the order form's order: a typed card number resolves against `methods` in order, so
167
+ * the order here is display-only. Keeps its identity across renders while its content is equal.
168
+ */
169
+ groupOrder: readonly string[];
151
170
  /**
152
171
  * The raw persisted method id, unfiltered by `group` — the exact value `$data.selectedMethodId`
153
172
  * carries. Unscoped for the same reason `allMethods` is: `usePaymentSubmitGate` must resolve the
@@ -235,8 +254,8 @@ export type PaymentMethodSelection = {
235
254
  draft: PaymentDraft;
236
255
  /** True until the `Payment` entity resolves. */
237
256
  loading: boolean;
238
- /** Message of the first `userError` from the latest selection, or `null`. */
239
- selectionError: string | null;
257
+ /** The first `userError` from the latest selection, or `null`. Its readers word it by `code`. */
258
+ selectionError: PaymentUserError | null;
240
259
  /**
241
260
  * Dispatches `payment.setMethod` with T4's exact input, request-sequenced so only the latest call
242
261
  * owns the error state. Records **only the draft facts the input carries**: an `accountId` is the
@@ -251,13 +270,15 @@ export type PaymentMethodSelection = {
251
270
  * no method is known until card entry detects one, so there is nothing to select yet (US-4).
252
271
  */
253
272
  selectNewCard: () => void;
254
- /** Publishes or clears the detected BIN with no write, for per-keystroke detection. */
273
+ /** Publishes or clears the detected BIN with no write, once the field holds a complete BIN. */
255
274
  setDraftBin: (bin: string | null) => void;
256
275
  /**
257
276
  * Publishes or clears the save-card flag (T10). A bare `useState` passthrough — no validation, no
258
277
  * dispatch. Nothing in this round calls it; it exists for T10 to consume.
259
278
  */
260
279
  setDraftSaveCard: (saveCard: boolean | null) => void;
280
+ /** Publishes whether the card entry is valid (`PaymentDraft.entryValid`). Bare passthrough, local state, no dispatch. */
281
+ setDraftEntryValid: (valid: boolean) => void;
261
282
  /** Publishes or clears the saved-card label (T10). Bare passthrough, mirroring `setDraftSaveCard`. */
262
283
  setDraftCardLabel: (cardLabel: string | null) => void;
263
284
  /** Publishes or clears the cardholder document (T8). Bare passthrough, mirroring `setDraftSaveCard`. */
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { PAYMENT_NETWORK_ERROR_CODE } from "../../sdk/payment/operations.js";
2
3
  import { resolveCountryDocumentType } from "./cardholder-document-rule.js";
3
4
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
5
  //#region src/matter/payment/use-payment-method-selection.ts
@@ -40,14 +41,16 @@ function isSelectionOutOfScope({ persistedMethodId, selectedMethod, methodsReada
40
41
  return methodsReadable && persistedMethodId !== null && selectedMethod === null;
41
42
  }
42
43
  /**
43
- * The credit-card payment group, named separately from `payment.tsx`'s own `DEFAULT_METHOD_GROUP`
44
- * (T140, Decision 3): once that constant widens to the whole default *set*, it can no longer double as
45
- * "the credit group's identifier," and reading "the first member of the set" would make preselection
46
- * depend on prop authoring order — reintroducing the position-dependence the T79 ruling closed.
47
- * Declared here, not in `payment.tsx`: the import runs `payment.tsx` -> `use-payment-method-selection.js`
48
- * (`payment.tsx:8-12`) and never the other way, so the reverse would be a cycle.
44
+ * The credit-card kind, named separately from `payment.tsx`'s own `DEFAULT_METHOD_GROUP` (T140,
45
+ * Decision 3): that constant is the default *authored scope* over `groupName`, a set a store may
46
+ * override, so it cannot double as "the credit kind's identifier," and reading "the first member of
47
+ * the set" would make preselection depend on prop authoring order — reintroducing the position-
48
+ * dependence the T79 ruling closed. Since T230 the classifiers read `PaymentMethod.type`, the closed
49
+ * vendor-neutral kind, not the open-ended `groupName`. Declared here, not in `payment.tsx`: the import
50
+ * runs `payment.tsx` -> `use-payment-method-selection.js` (`payment.tsx:8-12`) and never the other way,
51
+ * so the reverse would be a cycle.
49
52
  */
50
- const CREDIT_CARD_PAYMENT_GROUP = "creditCardPaymentGroup";
53
+ const CREDIT_CARD_TYPE = "CREDIT_CARD";
51
54
  /**
52
55
  * The one method identity a length-1 list offers, or `null` for any other length. Building block for
53
56
  * `resolvePreselectionCandidateId` below, which applies it twice — once to the whole scoped list, once
@@ -62,7 +65,7 @@ function soleMethodId(methods) {
62
65
  }
63
66
  /**
64
67
  * The whole preselection candidate rule (T140, FR-6a, Decision 3): the sole in-scope method when the
65
- * scoped list holds exactly one, or — when it does not — the sole method in the credit group, so a
68
+ * scoped list holds exactly one, or — when it does not — the sole credit-card method, so a
66
69
  * store offering one credit and one debit method keeps the preselection it had before debit was
67
70
  * admitted. `null` when neither tier yields a single identity. Keyed on identity, never position, the
68
71
  * same property `soleMethodId` already had (the T79 ruling).
@@ -74,26 +77,27 @@ function soleMethodId(methods) {
74
77
  function resolvePreselectionCandidateId(methods) {
75
78
  const soleId = soleMethodId(methods);
76
79
  if (soleId !== null) return soleId;
77
- return soleMethodId(methods.filter((method) => method.groupName === CREDIT_CARD_PAYMENT_GROUP));
80
+ return soleMethodId(methods.filter((method) => method.type === CREDIT_CARD_TYPE));
78
81
  }
79
82
  /**
80
- * The payment groups `PaymentMethodList` treats as card-shaped and collapses into one control (T171,
81
- * FR-1, Decision 6).
83
+ * The payment kinds `PaymentMethodList` treats as card-shaped and collapses into one control (T171,
84
+ * FR-1, Decision 6; read off `PaymentMethod.type` since T230, which maps the vendor groups the API knows
85
+ * to the closed `PaymentType`).
82
86
  *
83
- * Deliberately a **second** constant beside `payment.tsx`'s `DEFAULT_METHOD_GROUP`, whose members
84
- * happen to be the same two strings today: that one is the default *authored scope*, which a store may
85
- * override with its own group names, while this one is what the section treats as a card group.
86
- * Collapsing on the authored scope instead would collapse a store's Pix method the moment it authored
87
- * `group: ['pixPaymentGroup']`.
87
+ * Deliberately a **second** constant beside `payment.tsx`'s `DEFAULT_METHOD_GROUP`: that one is the
88
+ * default *authored scope* over `groupName`, which a store may override with its own group names, while
89
+ * this one is what the section treats as a card. Collapsing on the authored scope instead would collapse
90
+ * a store's Pix method the moment it authored `group: ['pixPaymentGroup']`.
88
91
  *
89
- * The list's one card control is built from these groups alone. The section's card expression is
90
- * `isCardMethod` below, these groups or a card-number pattern, which the engineer ruled on 2026-09-29
91
- * and ADR-0023 records (T191, OQ-3). A store that renamed its card groups gets no card control at all,
92
- * only one row per method, which is the pre-T171 rendering: a safe degrade, never a wrong dispatch.
92
+ * The list's one card control is built from these kinds alone. The section's card expression is
93
+ * `isCardMethod` below, these kinds or a card-number pattern, which the engineer ruled on 2026-09-29
94
+ * and ADR-0023 records (T191, OQ-3). A store-specific group the API maps to `OTHER` gets no card
95
+ * control, only one row per method, which is the pre-T171 rendering: a safe degrade, never a wrong
96
+ * dispatch.
93
97
  */
94
- const CARD_METHOD_GROUPS = [CREDIT_CARD_PAYMENT_GROUP, "debitCardPaymentGroup"];
98
+ const CARD_METHOD_TYPES = [CREDIT_CARD_TYPE, "DEBIT_CARD"];
95
99
  /**
96
- * Whether `method` is a card (T191, FR-1, Decision 1): its group is one of `CARD_METHOD_GROUPS`, or its
100
+ * Whether `method` is a card (T191, FR-1, Decision 1): its kind is one of `CARD_METHOD_TYPES`, or its
97
101
  * validator carries a card-number pattern. It decides the card-payment collapse, whether a list row can
98
102
  * bring the card form back, `CardEntry`'s refusal to post under a method that is not a card, and whether
99
103
  * a persisted method's own installment options apply. The list's fold keeps its group-only rule (OQ-3).
@@ -105,7 +109,7 @@ const CARD_METHOD_GROUPS = [CREDIT_CARD_PAYMENT_GROUP, "debitCardPaymentGroup"];
105
109
  * is detected as that method itself.
106
110
  */
107
111
  function isCardMethod(method) {
108
- return CARD_METHOD_GROUPS.includes(method.groupName) || Boolean(method.validator.numberRegex);
112
+ return CARD_METHOD_TYPES.includes(method.type) || Boolean(method.validator.numberRegex);
109
113
  }
110
114
  /**
111
115
  * Splits a scoped method list the way `PaymentMethodList` renders it (T171, FR-1/FR-2/FR-7,
@@ -131,11 +135,58 @@ function splitCardMethods({ methods, allMethods }) {
131
135
  standaloneMethods: methods
132
136
  };
133
137
  return {
134
- collapsedCardMethods: methods.filter((method) => CARD_METHOD_GROUPS.includes(method.groupName)),
135
- standaloneMethods: methods.filter((method) => !CARD_METHOD_GROUPS.includes(method.groupName))
138
+ collapsedCardMethods: methods.filter((method) => CARD_METHOD_TYPES.includes(method.type)),
139
+ standaloneMethods: methods.filter((method) => !CARD_METHOD_TYPES.includes(method.type))
136
140
  };
137
141
  }
138
142
  /**
143
+ * Reads the merchant-authored `groupOrder` prop into a clean list of group names (T199, FR-2). A
144
+ * non-empty string is a one-member list; an array keeps only its non-empty string members, a repeated
145
+ * name at its first position; anything else is `[]`. No validator checks an authored prop's JSON value
146
+ * against its declared `type: 'array'`, so a hand-written page can hand this a number or `null`, and the
147
+ * order must degrade to "no order" rather than throw. Names are matched exactly and case-sensitively
148
+ * against `PaymentMethod.groupName`, so nothing is trimmed.
149
+ */
150
+ function normalizeGroupOrder(value) {
151
+ if (typeof value === "string") return value === "" ? EMPTY_GROUP_ORDER : [value];
152
+ if (!Array.isArray(value)) return EMPTY_GROUP_ORDER;
153
+ const names = value.filter((name) => typeof name === "string" && name !== "");
154
+ return [...new Set(names)];
155
+ }
156
+ const EMPTY_GROUP_ORDER = [];
157
+ /**
158
+ * Orders the rows of `PaymentMethodList` by the merchant's `groupOrder` (T199, FR-4). Rows start in R1's
159
+ * order, the card control and then `standaloneMethods`, and a stable sort moves them: a method row's key
160
+ * is the index of its `groupName` in `groupOrder`; the card control's key is the smallest index of any
161
+ * `groupName` a member of `collapsedCardMethods` holds, so a named card group nobody sells cannot pull it
162
+ * up (Decision 3); a row with no key is unlisted and sorts after every listed row, keeping R1's order.
163
+ *
164
+ * Sorts a copy and never reaches `methods`: a typed card number resolves to the first matching method in
165
+ * `methods` order, so the order here is display-only and cannot change which method an order is charged
166
+ * under (RFC D15). Never adds or drops a row, so the order cannot hide a method.
167
+ */
168
+ function orderMethodListRows({ collapsedCardMethods, standaloneMethods, groupOrder }) {
169
+ const positionOf = (groupName) => {
170
+ const index = groupOrder.indexOf(groupName);
171
+ return index === -1 ? Number.POSITIVE_INFINITY : index;
172
+ };
173
+ const rows = [...collapsedCardMethods.length > 0 ? [{
174
+ row: { kind: "card" },
175
+ position: Math.min(...collapsedCardMethods.map((method) => positionOf(method.groupName)))
176
+ }] : [], ...standaloneMethods.map((method) => ({
177
+ row: {
178
+ kind: "method",
179
+ method
180
+ },
181
+ position: positionOf(method.groupName)
182
+ }))];
183
+ rows.sort((a, b) => {
184
+ if (a.position === b.position) return 0;
185
+ return a.position < b.position ? -1 : 1;
186
+ });
187
+ return rows.map(({ row }) => row);
188
+ }
189
+ /**
139
190
  * Whether a rendered `PaymentMethodList` can bring the card form back — the fact it registers as
140
191
  * `methodListMounted` (T191, FR-4, Decision 5; before it, T171's "can dispatch an in-scope id").
141
192
  *
@@ -194,8 +245,8 @@ function resolveMethodPreselection({ loading, methods, persistedMethodId, select
194
245
  }
195
246
  const EMPTY_PLACING_STATE = { placingKeys: /* @__PURE__ */ new Set() };
196
247
  const EMPTY_METHOD_LIST_PRESENCE_STATE = { mountedKeys: /* @__PURE__ */ new Set() };
197
- /** `$data` is the payment slice the root has already unwrapped from its keyed `{ payment, cart }`. */
198
- function usePaymentMethodSelection({ group, $data, $actions }) {
248
+ /** `$data` is the payment slice the root has already unwrapped from its keyed `{ payment, cart, clientProfile }`. */
249
+ function usePaymentMethodSelection({ group, groupOrder: groupOrderProp, $data, $actions }) {
199
250
  const loading = $data == null;
200
251
  const methodsReadable = $data?.methods !== void 0;
201
252
  const allMethods = $data?.methods ?? EMPTY_METHODS;
@@ -212,6 +263,8 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
212
263
  const groups = typeof group === "string" ? [group] : group;
213
264
  return allMethods.filter((method) => groups.includes(method.groupName));
214
265
  }, [allMethods, group]);
266
+ const groupOrderKey = JSON.stringify(normalizeGroupOrder(groupOrderProp));
267
+ const groupOrder = useMemo(() => JSON.parse(groupOrderKey), [groupOrderKey]);
215
268
  const selectedMethod = useMemo(() => methods.find((method) => method.id === persistedMethodId) ?? null, [methods, persistedMethodId]);
216
269
  const selectedMethodId = selectedMethod?.id ?? null;
217
270
  const selectionOutOfScope = isSelectionOutOfScope({
@@ -236,6 +289,7 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
236
289
  const [draftSaveCard, setDraftSaveCard] = useState(null);
237
290
  const [draftCardLabel, setDraftCardLabel] = useState(null);
238
291
  const [draftDocument, setDraftDocument] = useState(null);
292
+ const [draftEntryValid, setDraftEntryValid] = useState(false);
239
293
  const [draftBillingAddressDifferent, setDraftBillingAddressDifferent] = useState(null);
240
294
  const [billingAddressUnsavedState, setBillingAddressUnsavedState] = useState(EMPTY_BILLING_ADDRESS_UNSAVED_STATE);
241
295
  const [placingState, setPlacingState] = useState(EMPTY_PLACING_STATE);
@@ -278,7 +332,7 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
278
332
  setSelectMethodPending(false);
279
333
  const [firstError] = userErrors;
280
334
  if (firstError) {
281
- if (surfaceError) setSelectionError(firstError.message);
335
+ if (surfaceError) setSelectionError(firstError);
282
336
  else console.error("[usePaymentMethodSelection] preselection rejected", firstError.code);
283
337
  revertDraft?.();
284
338
  } else if (plainPick) {
@@ -288,7 +342,10 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
288
342
  }).catch(() => {
289
343
  if (selectionToken.current !== token) return;
290
344
  setSelectMethodPending(false);
291
- if (surfaceError) setSelectionError("Unable to select the payment method. Try again.");
345
+ if (surfaceError) setSelectionError({
346
+ code: PAYMENT_NETWORK_ERROR_CODE,
347
+ message: "Unable to select the payment method. Try again."
348
+ });
292
349
  else console.error("[usePaymentMethodSelection] preselection request failed");
293
350
  revertDraft?.();
294
351
  });
@@ -399,7 +456,8 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
399
456
  cardLabel: draftCardLabel,
400
457
  document: draftDocument,
401
458
  billingAddressDifferent: draftBillingAddressDifferent,
402
- billingAddressUnsaved: billingAddressUnsavedState.everPublished ? billingAddressUnsavedState.unsavedKeys.size > 0 : null
459
+ billingAddressUnsaved: billingAddressUnsavedState.everPublished ? billingAddressUnsavedState.unsavedKeys.size > 0 : null,
460
+ entryValid: draftEntryValid
403
461
  }), [
404
462
  draftPath,
405
463
  selectedAccountId,
@@ -408,7 +466,8 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
408
466
  draftCardLabel,
409
467
  draftDocument,
410
468
  draftBillingAddressDifferent,
411
- billingAddressUnsavedState
469
+ billingAddressUnsavedState,
470
+ draftEntryValid
412
471
  ]);
413
472
  const binConfirmation = useMemo(() => resolveBinConfirmation({
414
473
  selectedBin: $data?.selectedBin,
@@ -422,6 +481,7 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
422
481
  return useMemo(() => ({
423
482
  methods,
424
483
  allMethods,
484
+ groupOrder,
425
485
  persistedMethodId,
426
486
  countryDocumentType,
427
487
  selectedMethodId,
@@ -441,6 +501,7 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
441
501
  selectNewCard,
442
502
  setDraftBin: writeDraftBin,
443
503
  setDraftSaveCard,
504
+ setDraftEntryValid,
444
505
  setDraftCardLabel,
445
506
  setDraftDocument,
446
507
  setDraftBillingAddressDifferent,
@@ -454,6 +515,7 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
454
515
  }), [
455
516
  methods,
456
517
  allMethods,
518
+ groupOrder,
457
519
  persistedMethodId,
458
520
  countryDocumentType,
459
521
  selectedMethodId,
@@ -481,6 +543,6 @@ function usePaymentMethodSelection({ group, $data, $actions }) {
481
543
  ]);
482
544
  }
483
545
  //#endregion
484
- export { CARD_METHOD_GROUPS, isCardMethod, isSelectionOutOfScope, resolveBinConfirmation, resolveCanRevealCardPayment, resolveCardPaymentCollapsed, resolveMethodPreselection, resolvePreselectionCandidateId, splitCardMethods, usePaymentMethodSelection };
546
+ export { CARD_METHOD_TYPES, isCardMethod, isSelectionOutOfScope, normalizeGroupOrder, orderMethodListRows, resolveBinConfirmation, resolveCanRevealCardPayment, resolveCardPaymentCollapsed, resolveMethodPreselection, resolvePreselectionCandidateId, splitCardMethods, usePaymentMethodSelection };
485
547
 
486
548
  //# sourceMappingURL=use-payment-method-selection.js.map