@vtex/faststore 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (509) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +0 -1
  3. package/dist/_virtual/_rolldown/runtime.js +4 -0
  4. package/dist/actions.json +6 -1
  5. package/dist/catalog.json +789 -1701
  6. package/dist/cli/index.d.ts +66 -28
  7. package/dist/cli/index.js +7371 -512
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/server-runtime.js +41 -60
  10. package/dist/cli/server-runtime.js.map +1 -1
  11. package/dist/client.d.ts +3 -3
  12. package/dist/client.js +2 -2
  13. package/dist/components.d.ts +63 -57
  14. package/dist/components.js +60 -54
  15. package/dist/content-types.json +5785 -754
  16. package/dist/core/dist/define-component.d.ts +1 -1
  17. package/dist/core/dist/define-content-type.d.ts +50 -2
  18. package/dist/core/dist/define-content-type.js +107 -3
  19. package/dist/core/dist/define-content-type.js.map +1 -1
  20. package/dist/core/dist/index.d.ts +2 -2
  21. package/dist/docs/access-code-field.md +1 -1
  22. package/dist/docs/access-code-sign-in.md +126 -77
  23. package/dist/docs/account-address-book.md +210 -95
  24. package/dist/docs/account-menu.md +14 -15
  25. package/dist/docs/account-saved-cards.md +44 -39
  26. package/dist/docs/alert-dialog.md +3 -1
  27. package/dist/docs/avatar.md +4 -2
  28. package/dist/docs/billing-address.md +99 -30
  29. package/dist/docs/binding-switcher.md +5 -2
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +39 -26
  32. package/dist/docs/card-summary.md +18 -8
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +39 -26
  36. package/dist/docs/cart-item.md +29 -14
  37. package/dist/docs/cart-totalizer.md +7 -5
  38. package/dist/docs/cart.md +135 -41
  39. package/dist/docs/challenge-return.md +135 -0
  40. package/dist/docs/client-preferences-fieldset.md +10 -5
  41. package/dist/docs/client-preferences.md +31 -8
  42. package/dist/docs/client-profile-fieldset.md +20 -6
  43. package/dist/docs/client-profile.md +12 -3
  44. package/dist/docs/copy-text.md +9 -7
  45. package/dist/docs/document-field.md +1 -1
  46. package/dist/docs/email-field.md +2 -1
  47. package/dist/docs/email-identification.md +12 -2
  48. package/dist/docs/footer-copyright.md +4 -2
  49. package/dist/docs/form.md +54 -18
  50. package/dist/docs/free-shipping-progress.md +6 -5
  51. package/dist/docs/identity-edit.md +8 -2
  52. package/dist/docs/identity-summary.md +18 -5
  53. package/dist/docs/installments.md +46 -32
  54. package/dist/docs/my-account-profile.md +16 -11
  55. package/dist/docs/navigation-link.md +5 -3
  56. package/dist/docs/order-cancel.md +3 -1
  57. package/dist/docs/order-delivery-address.md +7 -5
  58. package/dist/docs/order-delivery-group.md +1 -3
  59. package/dist/docs/order-details-back.md +1 -1
  60. package/dist/docs/order-details-header.md +1 -4
  61. package/dist/docs/order-invoice-download.md +60 -0
  62. package/dist/docs/order-list-row.md +1 -1
  63. package/dist/docs/order-list-search.md +13 -20
  64. package/dist/docs/order-list-views.md +11 -17
  65. package/dist/docs/order-list.md +12 -5
  66. package/dist/docs/order-payment.md +9 -7
  67. package/dist/docs/order-placed-date.md +1 -1
  68. package/dist/docs/order-placed-payment-summary.md +28 -15
  69. package/dist/docs/order-placed.md +49 -14
  70. package/dist/docs/order-progress.md +1 -1
  71. package/dist/docs/order-status-badge.md +20 -9
  72. package/dist/docs/order-summary.md +2 -2
  73. package/dist/docs/order-tracking-link.md +58 -0
  74. package/dist/docs/payment-method-badges.md +30 -4
  75. package/dist/docs/payment-methods.md +1 -1
  76. package/dist/docs/payment.md +36 -17
  77. package/dist/docs/phone-field.md +4 -4
  78. package/dist/docs/place-order.md +84 -36
  79. package/dist/docs/postal-code-field.md +3 -1
  80. package/dist/docs/pricing.md +21 -23
  81. package/dist/docs/product-gallery.md +19 -20
  82. package/dist/docs/product-information.md +13 -9
  83. package/dist/docs/product-list.md +7 -6
  84. package/dist/docs/product-shelf.md +0 -1
  85. package/dist/docs/promotion.md +4 -2
  86. package/dist/docs/region.md +23 -15
  87. package/dist/docs/save-card.md +7 -6
  88. package/dist/docs/saved-cards.md +65 -36
  89. package/dist/docs/shipping-address.md +57 -21
  90. package/dist/docs/shipping-simulator.md +53 -15
  91. package/dist/docs/sign-in-disclosure.md +176 -0
  92. package/dist/docs/sign-in-form.md +78 -47
  93. package/dist/docs/sign-in-redirect.md +4 -2
  94. package/dist/docs/sign-in.md +173 -0
  95. package/dist/docs/toast.md +15 -4
  96. package/dist/docs/variant-selector.md +15 -11
  97. package/dist/domain-logic/dist/checkout/rules.js +33 -0
  98. package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
  99. package/dist/graphql/types.d.ts +4 -14
  100. package/dist/index.d.ts +2 -2
  101. package/dist/internal/client.d.ts +1 -3
  102. package/dist/internal/client.js +1 -1
  103. package/dist/internal/server.d.ts +7 -4
  104. package/dist/internal/server.js +7 -4
  105. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  106. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  108. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  109. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  110. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  111. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  112. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  113. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  114. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  115. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  116. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  117. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  118. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  120. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  121. package/dist/matter/account-address-book/account-address-book.js +74 -33
  122. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  123. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  124. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  126. package/dist/matter/account-address-book/account-address-country.js +83 -49
  127. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  128. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  129. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  131. package/dist/matter/account-address-book/account-address-form.js +518 -155
  132. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  133. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  134. package/dist/matter/account-address-book/account-address-record.js +32 -17
  135. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  136. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  137. package/dist/matter/account-menu/account-menu.js +46 -54
  138. package/dist/matter/account-menu/account-menu.js.map +1 -1
  139. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  140. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
  141. package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
  142. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
  143. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  144. package/dist/matter/billing-address/billing-address.js +227 -156
  145. package/dist/matter/billing-address/billing-address.js.map +1 -1
  146. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  147. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  148. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  149. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  150. package/dist/matter/buy-button/buy-button.js +10 -19
  151. package/dist/matter/buy-button/buy-button.js.map +1 -1
  152. package/dist/matter/card-entry/card-capture.js +12 -4
  153. package/dist/matter/card-entry/card-capture.js.map +1 -1
  154. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  155. package/dist/matter/card-entry/card-entry.js +348 -221
  156. package/dist/matter/card-entry/card-entry.js.map +1 -1
  157. package/dist/matter/cart/cart-namespace.d.ts +7 -1
  158. package/dist/matter/cart/cart-namespace.js +7 -1
  159. package/dist/matter/cart/cart-namespace.js.map +1 -1
  160. package/dist/matter/cart/cart.d.ts +402 -61
  161. package/dist/matter/cart/cart.js +624 -153
  162. package/dist/matter/cart/cart.js.map +1 -1
  163. package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
  164. package/dist/matter/cart-destination/cart-destination.js +160 -70
  165. package/dist/matter/cart-destination/cart-destination.js.map +1 -1
  166. package/dist/matter/cart-item/cart-item.d.ts +144 -17
  167. package/dist/matter/cart-item/cart-item.js +166 -49
  168. package/dist/matter/cart-item/cart-item.js.map +1 -1
  169. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  170. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  171. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  172. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  173. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  174. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  175. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  176. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  177. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  178. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  179. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  180. package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
  181. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  182. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  183. package/dist/matter/challenge-return/challenge-return.js +241 -0
  184. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  185. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  186. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  187. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  188. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  189. package/dist/matter/client-preferences/client-preferences.js +84 -15
  190. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  191. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  192. package/dist/matter/client-profile/client-profile.js +64 -24
  193. package/dist/matter/client-profile/client-profile.js.map +1 -1
  194. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  195. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  196. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  197. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  198. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  199. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  200. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  201. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  202. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  203. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  204. package/dist/matter/delivery-options/delivery-options.js +75 -12
  205. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  206. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  207. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  209. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  210. package/dist/matter/email-identification/email-identification.js +49 -12
  211. package/dist/matter/email-identification/email-identification.js.map +1 -1
  212. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
  213. package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  215. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  216. package/dist/matter/identity-edit/identity-edit.js +47 -19
  217. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  218. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  219. package/dist/matter/identity-summary/identity-summary.js +95 -45
  220. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  221. package/dist/matter/installments/installments-select.d.ts +98 -16
  222. package/dist/matter/installments/installments-select.js +156 -48
  223. package/dist/matter/installments/installments-select.js.map +1 -1
  224. package/dist/matter/installments/installments.d.ts +96 -16
  225. package/dist/matter/installments/installments.js +115 -40
  226. package/dist/matter/installments/installments.js.map +1 -1
  227. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  228. package/dist/matter/installments/use-installments-selection.js +8 -3
  229. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  230. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  231. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  232. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  233. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  234. package/dist/matter/order-cancel/order-cancel.js +118 -51
  235. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  236. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  237. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  238. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  239. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  240. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  241. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  242. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  243. package/dist/matter/order-details-header/order-details-header.js +66 -58
  244. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  245. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  246. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  247. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  248. package/dist/matter/order-list/order-list.d.ts +164 -19
  249. package/dist/matter/order-list/order-list.js +229 -87
  250. package/dist/matter/order-list/order-list.js.map +1 -1
  251. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  252. package/dist/matter/order-list-row/order-list-row.js +3 -2
  253. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  254. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  255. package/dist/matter/order-list-search/order-list-search.js +30 -69
  256. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  257. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  258. package/dist/matter/order-list-views/order-list-views.js +22 -68
  259. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  260. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  261. package/dist/matter/order-payment/order-payment.js +44 -39
  262. package/dist/matter/order-payment/order-payment.js.map +1 -1
  263. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  264. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  265. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  266. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  267. package/dist/matter/order-placed/order-placed.js +230 -139
  268. package/dist/matter/order-placed/order-placed.js.map +1 -1
  269. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  270. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  271. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  272. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  273. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  275. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  276. package/dist/matter/order-progress/order-progress.js +37 -45
  277. package/dist/matter/order-progress/order-progress.js.map +1 -1
  278. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  279. package/dist/matter/order-summary/order-summary.js +38 -44
  280. package/dist/matter/order-summary/order-summary.js.map +1 -1
  281. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  282. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  283. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  284. package/dist/matter/payment/payment-card-capture.js +17 -10
  285. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  286. package/dist/matter/payment/payment-controller.d.ts +4 -2
  287. package/dist/matter/payment/payment-controller.js +30 -9
  288. package/dist/matter/payment/payment-controller.js.map +1 -1
  289. package/dist/matter/payment/payment-method-badges.js +1 -1
  290. package/dist/matter/payment/payment.d.ts +69 -19
  291. package/dist/matter/payment/payment.js +101 -35
  292. package/dist/matter/payment/payment.js.map +1 -1
  293. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  294. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  295. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  296. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  297. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  298. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  299. package/dist/matter/place-order/place-order.d.ts +171 -57
  300. package/dist/matter/place-order/place-order.js +376 -185
  301. package/dist/matter/place-order/place-order.js.map +1 -1
  302. package/dist/matter/pricing/pricing.d.ts +152 -13
  303. package/dist/matter/pricing/pricing.js +153 -52
  304. package/dist/matter/pricing/pricing.js.map +1 -1
  305. package/dist/matter/product-information/product-information.d.ts +27 -4
  306. package/dist/matter/product-information/product-information.js +32 -15
  307. package/dist/matter/product-information/product-information.js.map +1 -1
  308. package/dist/matter/product-list/product-list.d.ts +24 -6
  309. package/dist/matter/product-list/product-list.js +32 -26
  310. package/dist/matter/product-list/product-list.js.map +1 -1
  311. package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
  312. package/dist/matter/product-shelf/product-shelf.js +2 -15
  313. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  314. package/dist/matter/region/region.d.ts +33 -16
  315. package/dist/matter/region/region.js +59 -52
  316. package/dist/matter/region/region.js.map +1 -1
  317. package/dist/matter/save-card/save-card.d.ts +43 -8
  318. package/dist/matter/save-card/save-card.js +61 -23
  319. package/dist/matter/save-card/save-card.js.map +1 -1
  320. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  321. package/dist/matter/saved-cards/saved-cards.js +349 -77
  322. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  323. package/dist/matter/shipping-address/address-payload.js +25 -0
  324. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  325. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  326. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  327. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  328. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  329. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  330. package/dist/matter/shipping-address/shipping-address.js +443 -188
  331. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  332. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
  333. package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
  334. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  335. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  336. package/dist/matter/sign-in/sign-in.js +285 -0
  337. package/dist/matter/sign-in/sign-in.js.map +1 -0
  338. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  339. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  341. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  342. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  343. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  344. package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
  345. package/dist/particles/binding-switcher/binding-switcher.js +37 -26
  346. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
  347. package/dist/particles/card-summary/card-summary.d.ts +38 -8
  348. package/dist/particles/card-summary/card-summary.js +55 -22
  349. package/dist/particles/card-summary/card-summary.js.map +1 -1
  350. package/dist/particles/carousel/carousel.d.ts +99 -11
  351. package/dist/particles/carousel/carousel.js +103 -35
  352. package/dist/particles/carousel/carousel.js.map +1 -1
  353. package/dist/particles/copy-text/copy-text.js +5 -15
  354. package/dist/particles/copy-text/copy-text.js.map +1 -1
  355. package/dist/particles/dialog/dialog.d.ts +14 -6
  356. package/dist/particles/dialog/dialog.js +6 -3
  357. package/dist/particles/dialog/dialog.js.map +1 -1
  358. package/dist/particles/drawer/drawer.js +1 -1
  359. package/dist/particles/drawer/drawer.js.map +1 -1
  360. package/dist/particles/email-field/email-field.d.ts +2 -1
  361. package/dist/particles/email-field/email-field.js +2 -1
  362. package/dist/particles/email-field/email-field.js.map +1 -1
  363. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  364. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  365. package/dist/particles/form/form.d.ts +85 -13
  366. package/dist/particles/form/form.js +91 -42
  367. package/dist/particles/form/form.js.map +1 -1
  368. package/dist/particles/gallery/gallery.d.ts +129 -12
  369. package/dist/particles/gallery/gallery.js +121 -34
  370. package/dist/particles/gallery/gallery.js.map +1 -1
  371. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  372. package/dist/particles/order-details-back/order-details-back.js +8 -10
  373. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  374. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  375. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  376. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  377. package/dist/particles/password-field/password-field.d.ts +1 -1
  378. package/dist/particles/password-field/password-field.js +2 -4
  379. package/dist/particles/password-field/password-field.js.map +1 -1
  380. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  381. package/dist/particles/phone-field/phone-field.js +8 -11
  382. package/dist/particles/phone-field/phone-field.js.map +1 -1
  383. package/dist/particles/spinner/spinner.d.ts +24 -4
  384. package/dist/particles/spinner/spinner.js +25 -9
  385. package/dist/particles/spinner/spinner.js.map +1 -1
  386. package/dist/particles/switch/switch.d.ts +4 -1
  387. package/dist/particles/switch/switch.js +3 -1
  388. package/dist/particles/switch/switch.js.map +1 -1
  389. package/dist/particles/toast/toast.d.ts +29 -3
  390. package/dist/particles/toast/toast.js +34 -10
  391. package/dist/particles/toast/toast.js.map +1 -1
  392. package/dist/schema.graphql +164 -56
  393. package/dist/sdk/address/address-fields.js +4 -4
  394. package/dist/sdk/address/address-fields.js.map +1 -1
  395. package/dist/sdk/address/constants.js +1 -6
  396. package/dist/sdk/address/constants.js.map +1 -1
  397. package/dist/sdk/address/messages.js +44 -44
  398. package/dist/sdk/address/messages.js.map +1 -1
  399. package/dist/sdk/address/postal-code.js +15 -2
  400. package/dist/sdk/address/postal-code.js.map +1 -1
  401. package/dist/sdk/address/types.d.ts +5 -3
  402. package/dist/sdk/address/validate-address.js +3 -3
  403. package/dist/sdk/address/validate-address.js.map +1 -1
  404. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  405. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  406. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  407. package/dist/sdk/data/index.js +2 -2
  408. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  409. package/dist/sdk/generated/gql.js +1 -1
  410. package/dist/sdk/generated/gql.js.map +1 -1
  411. package/dist/sdk/generated/graphql.d.ts +20 -5
  412. package/dist/sdk/generated/graphql.js +6 -0
  413. package/dist/sdk/generated/graphql.js.map +1 -1
  414. package/dist/sdk/i18n/format-error-code.js +23 -0
  415. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  416. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  417. package/dist/sdk/i18n/message-formatter.js +140 -0
  418. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  419. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  420. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  421. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  422. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  423. package/dist/sdk/navigation/redirect.d.ts +2 -0
  424. package/dist/sdk/navigation/redirect.js +19 -1
  425. package/dist/sdk/navigation/redirect.js.map +1 -1
  426. package/dist/sdk/navigation/types.d.ts +13 -0
  427. package/dist/sdk/payment/bin-format.js +21 -0
  428. package/dist/sdk/payment/bin-format.js.map +1 -0
  429. package/dist/sdk/payment/challenge-return.js +37 -0
  430. package/dist/sdk/payment/challenge-return.js.map +1 -0
  431. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  432. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  433. package/dist/sdk/payment/gateway.d.ts +1 -1
  434. package/dist/sdk/payment/gateway.js +8 -2
  435. package/dist/sdk/payment/gateway.js.map +1 -1
  436. package/dist/sdk/payment/operations.d.ts +1 -0
  437. package/dist/sdk/payment/operations.js +28 -6
  438. package/dist/sdk/payment/operations.js.map +1 -1
  439. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  440. package/dist/sdk/payment/resumed-purchase.js +119 -0
  441. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  442. package/dist/sdk/payment/security-code-mask.js +16 -23
  443. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  444. package/dist/sdk/payment/submission-registry.js +6 -2
  445. package/dist/sdk/payment/submission-registry.js.map +1 -1
  446. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  447. package/dist/sdk/payment/use-payment-actions.js +23 -4
  448. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  449. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  450. package/dist/sdk/payment/use-place-order.js +138 -76
  451. package/dist/sdk/payment/use-place-order.js.map +1 -1
  452. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  453. package/dist/sdk/provider/storefront-provider.js +4 -11
  454. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  455. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  456. package/dist/sdk/seo/entity-landing.js +30 -0
  457. package/dist/sdk/seo/entity-landing.js.map +1 -0
  458. package/dist/sdk/seo/page-alternates.d.ts +3 -2
  459. package/dist/sdk/seo/page-alternates.js +4 -2
  460. package/dist/sdk/seo/page-alternates.js.map +1 -1
  461. package/dist/sdk/seo/search-landing.d.ts +42 -0
  462. package/dist/sdk/seo/search-landing.js +85 -0
  463. package/dist/sdk/seo/search-landing.js.map +1 -0
  464. package/dist/sdk/session/mock-session.d.ts +9 -0
  465. package/dist/sdk/session/mock-session.js +31 -0
  466. package/dist/sdk/session/mock-session.js.map +1 -0
  467. package/dist/sdk/session/read-server-session.d.ts +3 -0
  468. package/dist/sdk/session/read-server-session.js +5 -0
  469. package/dist/sdk/session/read-server-session.js.map +1 -1
  470. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  471. package/dist/sdk/session/return-path-segment.js +15 -0
  472. package/dist/sdk/session/return-path-segment.js.map +1 -0
  473. package/dist/sdk/session/use-session-actions.js.map +1 -1
  474. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  475. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  476. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  477. package/dist/utils/safe-href.d.ts +2 -0
  478. package/package.json +4 -3
  479. package/skills/storefront-asset/SKILL.md +2 -2
  480. package/skills/storefront-asset/references/api-side.md +27 -14
  481. package/skills/storefront-asset/references/findings.md +5 -2
  482. package/src/styles/tailwind.css +8 -0
  483. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  484. package/dist/message-locales.json +0 -7
  485. package/dist/sdk/i18n/client.d.ts +0 -4
  486. package/dist/sdk/i18n/client.js +0 -4
  487. package/dist/sdk/i18n/locales.d.ts +0 -8
  488. package/dist/sdk/i18n/locales.js +0 -57
  489. package/dist/sdk/i18n/locales.js.map +0 -1
  490. package/dist/sdk/i18n/messages/en-US.js +0 -183
  491. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  492. package/dist/sdk/i18n/messages/en-US.json +0 -178
  493. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
  494. package/dist/sdk/i18n/messages/es-ES.js +0 -183
  495. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  496. package/dist/sdk/i18n/messages/es-ES.json +0 -178
  497. package/dist/sdk/i18n/messages/pt-BR.js +0 -183
  498. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  499. package/dist/sdk/i18n/messages/pt-BR.json +0 -178
  500. package/dist/sdk/i18n/provider.d.ts +0 -1
  501. package/dist/sdk/i18n/provider.js +0 -30
  502. package/dist/sdk/i18n/provider.js.map +0 -1
  503. package/dist/sdk/i18n/server.d.ts +0 -28
  504. package/dist/sdk/i18n/server.js +0 -59
  505. package/dist/sdk/i18n/server.js.map +0 -1
  506. package/dist/utils/resolve-authored-copy.js +0 -18
  507. package/dist/utils/resolve-authored-copy.js.map +0 -1
  508. package/dist/utils/substitute-template.js +0 -33
  509. package/dist/utils/substitute-template.js.map +0 -1
@@ -38,6 +38,11 @@ export type PaymentStartTransactionResult = Readonly<{
38
38
  /** Gateway origin. Nullable, and never interpolated into a URL before `isTrustedGatewayOrigin`. */
39
39
  gatewayUrl: string | null;
40
40
  orderGroup: string | null;
41
+ /**
42
+ * The Relay Node ID of the order, for `Query.order(id:)`. Null when the transaction carried no order
43
+ * group. Optional so a provider written before this field existed still satisfies the type.
44
+ */
45
+ orderNodeId?: string | null;
41
46
  userProfileId: string | null;
42
47
  /** Display decimal. The gateway body's unit is `valueInCents`. */
43
48
  value: PaymentMoney | null;
@@ -47,12 +52,16 @@ export type PaymentStartTransactionResult = Readonly<{
47
52
  }>;
48
53
  export type PaymentGatewayCallbackResult = Readonly<{
49
54
  orderId: string | null;
55
+ /** The Relay Node ID of the finalized order, for `Query.order(id:)`. Null unless the callback succeeded. */
56
+ orderNodeId?: string | null;
57
+ /** The bank's challenge page. Set only when the server answered a challenge with a usable URL. */
58
+ redirectUrl?: string | null;
50
59
  userErrors: readonly PaymentUserError[];
51
60
  }>;
52
61
  export type PaymentActions = Readonly<{
53
62
  /** Select a payment method, optionally identifying a new card's BIN or a saved card's account. */
54
63
  setMethod: (input: PaymentMethodSelectInput) => Promise<readonly PaymentUserError[]>;
55
- /** Select an installment count for the current method. The response carries the recomputed cart total. */
64
+ /** Select an installment count for the current method. The response's `cart.total` is the greater of the order form's value and the selected payment's value. */
56
65
  setInstallments: (count: number) => Promise<readonly PaymentUserError[]>;
57
66
  /** Persist the billing address, or fall back to the delivery address (`sameAsDelivery: true`). */
58
67
  setBillingAddress: (input: PaymentBillingAddressUpdateInput) => Promise<readonly PaymentUserError[]>;
@@ -66,8 +75,14 @@ export type PaymentActions = Readonly<{
66
75
  saveCard: (enabled: boolean) => Promise<readonly PaymentUserError[]>;
67
76
  /** Open a VTEX transaction from the persisted selection. Resolves the payload the gateway call needs. */
68
77
  startTransaction: () => Promise<PaymentStartTransactionResult>;
69
- /** Finalize the transaction after the gateway accepted the card. */
70
- gatewayCallback: (orderGroup: string) => Promise<PaymentGatewayCallbackResult>;
78
+ /**
79
+ * Finalize the transaction after the gateway accepted the card. `acceptChallenges: true` is sent only by
80
+ * the page the bank returns the shopper to, and only then; omitted, the server asks for a challenge
81
+ * instead of finishing the order.
82
+ */
83
+ gatewayCallback: (orderGroup: string, options?: Readonly<{
84
+ acceptChallenges?: boolean;
85
+ }>) => Promise<PaymentGatewayCallbackResult>;
71
86
  /**
72
87
  * Façade: post the card straight to the payment gateway. Issues no GraphQL operation and writes
73
88
  * nothing to the cache. Never rejects: resolves `{ reachedGateway, userErrors }`, with one `GATEWAY_ERROR`
@@ -4,10 +4,15 @@ import "../../core/dist/index.js";
4
4
  import { loggableErrorName } from "../../utils/loggable-error-name.js";
5
5
  import { PAYMENT_BILLING_ADDRESS_UPDATE, PAYMENT_GATEWAY_CALLBACK, PAYMENT_INSTALLMENT_SELECT, PAYMENT_METHOD_SELECT, PAYMENT_NETWORK_ERROR_CODE, PAYMENT_START_TRANSACTION } from "./operations.js";
6
6
  import { CLIENT_PREFERENCES_UPDATE } from "../identity/operations.js";
7
+ import { require_rules } from "../../domain-logic/dist/checkout/rules.js";
8
+ import { isAcceptedBin } from "./bin-format.js";
7
9
  import { PAYMENT_GATEWAY_USER_ERROR, postPaymentsToGateway } from "./gateway.js";
8
10
  import { useMutation } from "@apollo/client/react";
9
11
  import { useCallback, useMemo } from "react";
10
- //#region src/sdk/payment/use-payment-actions.ts
12
+ const INVALID_BIN_ERROR = {
13
+ code: "INVALID_BIN_FORMAT",
14
+ message: require_rules().INVALID_BIN_MESSAGE
15
+ };
11
16
  const NETWORK_ERROR = {
12
17
  code: PAYMENT_NETWORK_ERROR_CODE,
13
18
  message: "Unable to complete the request. Please try again."
@@ -18,6 +23,7 @@ const EMPTY_START_TRANSACTION = {
18
23
  merchantName: null,
19
24
  gatewayUrl: null,
20
25
  orderGroup: null,
26
+ orderNodeId: null,
21
27
  userProfileId: null,
22
28
  value: null,
23
29
  valueInCents: null,
@@ -37,6 +43,7 @@ function usePaymentActions() {
37
43
  const [startTransactionMutation] = useMutation(PAYMENT_START_TRANSACTION);
38
44
  const [gatewayCallbackMutation] = useMutation(PAYMENT_GATEWAY_CALLBACK);
39
45
  const setMethod = useCallback(async (input) => {
46
+ if (!isAcceptedBin(input)) return [INVALID_BIN_ERROR];
40
47
  try {
41
48
  return (await methodSelectMutation({ variables: { input } })).data?.paymentMethodSelect.userErrors ?? [];
42
49
  } catch (error) {
@@ -76,6 +83,7 @@ function usePaymentActions() {
76
83
  merchantName: payload?.merchantName ?? null,
77
84
  gatewayUrl: payload?.gatewayUrl ?? null,
78
85
  orderGroup: payload?.orderGroup ?? null,
86
+ orderNodeId: payload?.orderNodeId ?? null,
79
87
  userProfileId: payload?.userProfileId ?? null,
80
88
  value: payload?.value ?? null,
81
89
  valueInCents: payload?.valueInCents ?? null,
@@ -90,17 +98,24 @@ function usePaymentActions() {
90
98
  };
91
99
  }
92
100
  }, [startTransactionMutation]);
93
- const gatewayCallback = useCallback(async (orderGroup) => {
101
+ const gatewayCallback = useCallback(async (orderGroup, options) => {
94
102
  try {
95
- const payload = (await gatewayCallbackMutation({ variables: { input: { orderGroup } } })).data?.paymentGatewayCallback;
103
+ const input = options?.acceptChallenges === true ? {
104
+ orderGroup,
105
+ acceptChallenges: true
106
+ } : { orderGroup };
107
+ const payload = (await gatewayCallbackMutation({ variables: { input } })).data?.paymentGatewayCallback;
96
108
  return {
97
109
  orderId: payload?.orderId ?? null,
110
+ orderNodeId: payload?.orderNodeId ?? null,
111
+ ...payload?.redirectUrl ? { redirectUrl: payload.redirectUrl } : {},
98
112
  userErrors: payload?.userErrors ?? []
99
113
  };
100
114
  } catch (error) {
101
115
  console.error("[payment.gatewayCallback] paymentGatewayCallback failed", loggableErrorName(error));
102
116
  return {
103
117
  orderId: null,
118
+ orderNodeId: null,
104
119
  userErrors: [NETWORK_ERROR]
105
120
  };
106
121
  }
@@ -162,7 +177,7 @@ defineActions({
162
177
  ]
163
178
  },
164
179
  setInstallments: {
165
- description: "Select an installment count for the current method (async/pessimistic). The response recomputes the cart total with interest. Resolves the payload userErrors.",
180
+ description: "Select an installment count for the current method (async/pessimistic). The response carries the cart, whose total is the greater of the order form value and the selected payment value, so it includes the interest of the picked tier. Resolves the payload userErrors.",
166
181
  payload: [{
167
182
  name: "count",
168
183
  type: "number"
@@ -243,6 +258,10 @@ defineActions({
243
258
  payload: [{
244
259
  name: "orderGroup",
245
260
  type: "string"
261
+ }, {
262
+ name: "acceptChallenges",
263
+ type: "boolean",
264
+ optional: true
246
265
  }]
247
266
  },
248
267
  sendPayments: {
@@ -1 +1 @@
1
- {"version":3,"file":"use-payment-actions.js","names":[],"sources":["../../../src/sdk/payment/use-payment-actions.ts"],"sourcesContent":["'use client';\n\nimport { useMutation } from '@apollo/client/react';\nimport { defineActions } from '@vtex/fs-core';\nimport { useCallback, useMemo } from 'react';\nimport { loggableErrorName } from '../../utils/loggable-error-name.js';\nimport { CLIENT_PREFERENCES_UPDATE } from '../identity/operations.js';\nimport {\n PAYMENT_GATEWAY_USER_ERROR,\n type PaymentGatewayResult,\n postPaymentsToGateway,\n type SendPaymentsRequest,\n} from './gateway.js';\nimport {\n PAYMENT_BILLING_ADDRESS_UPDATE,\n PAYMENT_GATEWAY_CALLBACK,\n PAYMENT_INSTALLMENT_SELECT,\n PAYMENT_METHOD_SELECT,\n PAYMENT_NETWORK_ERROR_CODE,\n PAYMENT_START_TRANSACTION,\n type PaymentBillingAddressUpdateInput,\n type PaymentMethodSelectInput,\n type PaymentMoney,\n type PaymentUserError,\n} from './operations.js';\n\n/**\n * The `payment` action namespace — the sanctioned client write surface for credit-card payment\n * (specs/payment-action-namespace.md; docs/features/credit-card/rfc.md § D12;\n * docs/storefront-core/adr-0010-actions-own-the-write-side.md).\n *\n * Six mutation-backed methods run the write model T3 shipped (`checkout/schema.graphql` § 11), except\n * `saveCard`, which reuses the already-shipped `clientPreferencesUpdate` document this package owns —\n * there is no `paymentSaveCard` mutation and T3 decided there must not be one. All six are\n * async/pessimistic: the handler awaits the mutation and only the server-confirmed payload changes the\n * cache. Each is stateless (no reactive vars, no module state), resolves its payload `userErrors` (empty\n * on success), and never throws for an expected outcome; an infrastructure failure (transport or an\n * upstream GraphQLError) is caught and collapsed to one synthetic `NETWORK_ERROR` userError with no\n * per-code branching, mirroring `useShippingActions`.\n *\n * `sendPayments` is the seventh method and the odd one: a **façade** (ADR-0010's sanctioned flavor,\n * alongside `notifications`) that posts card data from the browser straight to the payment gateway,\n * touching neither our GraphQL layer nor the normalized cache. It is catalogued like any other method —\n * per D12, hiding a write route with no read-back would cost discoverability without protecting\n * anything, and the compiler wants to *see* which components reference it. What is deliberately absent\n * from the catalog is the card data itself: no `payload` entry below names a card number, CVV, expiry,\n * or holder name, so there is no schema-bindable name for the editor or the agent to map a value onto\n * (RFC D13). The card reaches the handler as a runtime argument from the card-entry component's local\n * state (T7), and `gateway.ts` — which has no Apollo import — is the only module that touches it.\n */\n\n/**\n * Everything `usePlaceOrder` (T13) needs to assemble `PaymentGatewayTransaction`, minus the five\n * fields that come from the `Payment` read model. Every field is nullable because a payload carrying\n * `userErrors` nulls all of them (T18 Decision 4), so a complete descriptor is only guaranteed once\n * `userErrors` is empty *and* the payload passes the caller's completeness check.\n */\nexport type PaymentStartTransactionResult = Readonly<{\n transactionId: string | null;\n merchantName: string | null;\n /** Gateway origin. Nullable, and never interpolated into a URL before `isTrustedGatewayOrigin`. */\n gatewayUrl: string | null;\n orderGroup: string | null;\n userProfileId: string | null;\n /** Display decimal. The gateway body's unit is `valueInCents`. */\n value: PaymentMoney | null;\n valueInCents: number | null;\n referenceValueInCents: number | null;\n userErrors: readonly PaymentUserError[];\n}>;\n\nexport type PaymentGatewayCallbackResult = Readonly<{\n orderId: string | null;\n userErrors: readonly PaymentUserError[];\n}>;\n\nexport type PaymentActions = Readonly<{\n /** Select a payment method, optionally identifying a new card's BIN or a saved card's account. */\n setMethod: (input: PaymentMethodSelectInput) => Promise<readonly PaymentUserError[]>;\n /** Select an installment count for the current method. The response carries the recomputed cart total. */\n setInstallments: (count: number) => Promise<readonly PaymentUserError[]>;\n /** Persist the billing address, or fall back to the delivery address (`sameAsDelivery: true`). */\n setBillingAddress: (input: PaymentBillingAddressUpdateInput) => Promise<readonly PaymentUserError[]>;\n /**\n * Record the data-storage consent a saved card requires, over the existing `clientPreferencesUpdate`.\n * This does not by itself save the card: the save flag and label travel on `sendPayments`'s card\n * argument (RFC D5's two halves). The boolean passes through unchanged — whether unchecking should\n * revoke a consent an unrelated opt-in component may have granted is T10's decision, and its spec must\n * state one (Gap 4 in specs/payment-action-namespace.md).\n */\n saveCard: (enabled: boolean) => Promise<readonly PaymentUserError[]>;\n /** Open a VTEX transaction from the persisted selection. Resolves the payload the gateway call needs. */\n startTransaction: () => Promise<PaymentStartTransactionResult>;\n /** Finalize the transaction after the gateway accepted the card. */\n gatewayCallback: (orderGroup: string) => Promise<PaymentGatewayCallbackResult>;\n /**\n * Façade: post the card straight to the payment gateway. Issues no GraphQL operation and writes\n * nothing to the cache. Never rejects: resolves `{ reachedGateway, userErrors }`, with one `GATEWAY_ERROR`\n * userError when the gateway rejects the call or it could not be issued. `reachedGateway` is `false`\n * only when no request was issued; every outcome it cannot classify is `true`.\n */\n sendPayments: (request: SendPaymentsRequest) => Promise<PaymentGatewayResult>;\n}>;\n\nconst NETWORK_ERROR: PaymentUserError = {\n code: PAYMENT_NETWORK_ERROR_CODE,\n message: 'Unable to complete the request. Please try again.',\n};\n\n/** Mirrors the resolver's own nulled-fields constant, so one added field is nulled in one place. */\nconst EMPTY_START_TRANSACTION = {\n transactionId: null,\n merchantName: null,\n gatewayUrl: null,\n orderGroup: null,\n userProfileId: null,\n value: null,\n valueInCents: null,\n referenceValueInCents: null,\n} as const;\n\n/**\n * The `payment` namespace hook. Registered with the first-party action registry via `paymentActions`\n * below; the compiler-emitted `PaymentActionProvider` calls it and threads the narrowed methods into\n * each consumer's `$actions.payment`. Writes persist purely through the normalized-cache merge of each\n * mutation response — no refetch, no imperative cache write.\n */\nexport function usePaymentActions(): PaymentActions {\n const [methodSelectMutation] = useMutation(PAYMENT_METHOD_SELECT);\n const [installmentSelectMutation] = useMutation(PAYMENT_INSTALLMENT_SELECT);\n const [billingAddressMutation] = useMutation(PAYMENT_BILLING_ADDRESS_UPDATE);\n const [preferencesMutation] = useMutation(CLIENT_PREFERENCES_UPDATE);\n const [startTransactionMutation] = useMutation(PAYMENT_START_TRANSACTION);\n const [gatewayCallbackMutation] = useMutation(PAYMENT_GATEWAY_CALLBACK);\n\n const setMethod = useCallback<PaymentActions['setMethod']>(\n async (input) => {\n try {\n const result = await methodSelectMutation({ variables: { input } });\n return result.data?.paymentMethodSelect.userErrors ?? [];\n } catch (error) {\n // Log only the error name — the input carries the card's BIN, and a variable-coercion error's\n // message echoes the offending value (`got invalid value … at \"input.bin\"`).\n console.error('[payment.setMethod] paymentMethodSelect failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [methodSelectMutation],\n );\n\n const setInstallments = useCallback<PaymentActions['setInstallments']>(\n async (count) => {\n try {\n const result = await installmentSelectMutation({ variables: { input: { count } } });\n return result.data?.paymentInstallmentSelect.userErrors ?? [];\n } catch (error) {\n console.error('[payment.setInstallments] paymentInstallmentSelect failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [installmentSelectMutation],\n );\n\n const setBillingAddress = useCallback<PaymentActions['setBillingAddress']>(\n async (input) => {\n try {\n const result = await billingAddressMutation({ variables: { input } });\n return result.data?.paymentBillingAddressUpdate.userErrors ?? [];\n } catch (error) {\n // Log only the error name — the message can echo the submitted address (PII).\n console.error('[payment.setBillingAddress] paymentBillingAddressUpdate failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [billingAddressMutation],\n );\n\n const saveCard = useCallback<PaymentActions['saveCard']>(\n async (enabled) => {\n try {\n const result = await preferencesMutation({ variables: { input: { savePersonalData: enabled } } });\n return result.data?.clientPreferencesUpdate?.userErrors ?? [];\n } catch (error) {\n console.error('[payment.saveCard] clientPreferencesUpdate failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [preferencesMutation],\n );\n\n const startTransaction = useCallback<PaymentActions['startTransaction']>(async () => {\n try {\n const result = await startTransactionMutation();\n const payload = result.data?.paymentStartTransaction;\n return {\n transactionId: payload?.transactionId ?? null,\n merchantName: payload?.merchantName ?? null,\n gatewayUrl: payload?.gatewayUrl ?? null,\n orderGroup: payload?.orderGroup ?? null,\n userProfileId: payload?.userProfileId ?? null,\n value: payload?.value ?? null,\n valueInCents: payload?.valueInCents ?? null,\n referenceValueInCents: payload?.referenceValueInCents ?? null,\n userErrors: payload?.userErrors ?? [],\n };\n } catch (error) {\n console.error('[payment.startTransaction] paymentStartTransaction failed', loggableErrorName(error));\n return { ...EMPTY_START_TRANSACTION, userErrors: [NETWORK_ERROR] };\n }\n }, [startTransactionMutation]);\n\n const gatewayCallback = useCallback<PaymentActions['gatewayCallback']>(\n async (orderGroup) => {\n try {\n const result = await gatewayCallbackMutation({ variables: { input: { orderGroup } } });\n const payload = result.data?.paymentGatewayCallback;\n return { orderId: payload?.orderId ?? null, userErrors: payload?.userErrors ?? [] };\n } catch (error) {\n console.error('[payment.gatewayCallback] paymentGatewayCallback failed', loggableErrorName(error));\n return { orderId: null, userErrors: [NETWORK_ERROR] };\n }\n },\n [gatewayCallbackMutation],\n );\n\n const sendPayments = useCallback<PaymentActions['sendPayments']>(async (request) => {\n try {\n return await postPaymentsToGateway(request);\n } catch (error) {\n // Log the error NAME ONLY. The request carries a card number and CVV, and a thrown fetch error's\n // message can echo the URL or the body — nothing on this path is ever serialized to a log.\n console.error('[payment.sendPayments] gateway request failed', loggableErrorName(error));\n // A rejected request is unclassified — it may have been processed — so it counts as reached.\n return { reachedGateway: true, userErrors: [PAYMENT_GATEWAY_USER_ERROR] };\n }\n }, []);\n\n return useMemo(\n () => ({\n setMethod,\n setInstallments,\n setBillingAddress,\n saveCard,\n startTransaction,\n gatewayCallback,\n sendPayments,\n }),\n [setMethod, setInstallments, setBillingAddress, saveCard, startTransaction, gatewayCallback, sendPayments],\n );\n}\n\n/**\n * Declares the `payment` action namespace — the single source of truth for its method/payload metadata,\n * runtime provider, and `use` hook (mirrors `cartActions`, `shippingActions`). The native catalog\n * builder (`scripts/build-catalog.mjs`) statically reads this call to emit `actions.json`; at runtime\n * `PaymentActionProvider` calls `usePaymentActions` directly.\n *\n * `sendPayments`'s `payload` lists only the non-sensitive transaction descriptor's identifiers.\n * `ActionPayloadField` is the surface a schema-bindable name would come from, so the card fields'\n * absence here is the mechanical form of RFC D13: card number and CVV are never expressed as a declared\n * action payload. The `SendPaymentsRequest` type in `gateway.ts` is the source of truth for the real\n * call shape.\n */\nexport const paymentActions = defineActions({\n namespace: 'payment',\n description:\n 'Mutation-backed payment writes against the VTEX orderForm paymentData/invoiceData, plus a façade that posts card data directly to the payment gateway (never through our GraphQL layer or cache).',\n provider: { name: 'PaymentActionProvider', importPath: '@vtex/faststore/internal/client' },\n methods: {\n setMethod: {\n description:\n 'Select a payment method, optionally identifying a new card by BIN or a saved card by account (async/pessimistic). Resolves the payload userErrors.',\n payload: [\n { name: 'methodId', type: 'string' },\n { name: 'bin', type: 'string', optional: true },\n { name: 'accountId', type: 'string', optional: true },\n ],\n },\n setInstallments: {\n description:\n 'Select an installment count for the current method (async/pessimistic). The response recomputes the cart total with interest. Resolves the payload userErrors.',\n payload: [{ name: 'count', type: 'number' }],\n },\n setBillingAddress: {\n description:\n 'Persist the billing address, or fall back to the delivery address with sameAsDelivery (async/pessimistic). Resolves the payload userErrors.',\n payload: [\n { name: 'sameAsDelivery', type: 'boolean' },\n { name: 'addressType', type: 'string', optional: true },\n { name: 'postalCode', type: 'string', optional: true },\n { name: 'country', type: 'string', optional: true },\n { name: 'street', type: 'string', optional: true },\n { name: 'number', type: 'string', optional: true },\n { name: 'complement', type: 'string', optional: true },\n { name: 'neighborhood', type: 'string', optional: true },\n { name: 'city', type: 'string', optional: true },\n { name: 'state', type: 'string', optional: true },\n { name: 'reference', type: 'string', optional: true },\n ],\n },\n saveCard: {\n description:\n 'Record the data-storage consent a saved card requires, reusing the existing clientPreferencesUpdate write. Does not itself save the card — the save flag and label travel on sendPayments.',\n payload: [{ name: 'enabled', type: 'boolean' }],\n },\n startTransaction: {\n description:\n 'Open a VTEX transaction from the persisted payment selection. Takes no arguments; resolves the transaction identifiers the gateway call needs.',\n payload: [],\n },\n gatewayCallback: {\n description: 'Finalize the transaction after the gateway accepted the card. Resolves the payload userErrors.',\n payload: [{ name: 'orderGroup', type: 'string' }],\n },\n sendPayments: {\n description:\n 'Façade: post the card directly from the browser to the payment gateway. Issues no GraphQL operation and writes nothing to the cache. Resolves { reachedGateway, userErrors }: reachedGateway is false only when no request was issued. The card number and CVV are runtime-only arguments and are deliberately absent from this payload — they are never a bindable field (RFC D13).',\n payload: [\n { name: 'gatewayUrl', type: 'string' },\n { name: 'transactionId', type: 'string' },\n { name: 'merchantName', type: 'string' },\n { name: 'orderGroup', type: 'string' },\n { name: 'userProfileId', type: 'string' },\n ],\n },\n },\n use: usePaymentActions,\n});\n"],"mappings":";;;;;;;;;;AAwGA,MAAM,gBAAkC;CACtC,MAAM;CACN,SAAS;AACX;;AAGA,MAAM,0BAA0B;CAC9B,eAAe;CACf,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,OAAO;CACP,cAAc;CACd,uBAAuB;AACzB;;;;;;;AAQA,SAAgB,oBAAoC;CAClD,MAAM,CAAC,wBAAwB,YAAY,qBAAqB;CAChE,MAAM,CAAC,6BAA6B,YAAY,0BAA0B;CAC1E,MAAM,CAAC,0BAA0B,YAAY,8BAA8B;CAC3E,MAAM,CAAC,uBAAuB,YAAY,yBAAyB;CACnE,MAAM,CAAC,4BAA4B,YAAY,yBAAyB;CACxE,MAAM,CAAC,2BAA2B,YAAY,wBAAwB;CAEtE,MAAM,YAAY,YAChB,OAAO,UAAU;EACf,IAAI;GAEF,QAAO,MADc,qBAAqB,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,EAAA,CACpD,MAAM,oBAAoB,cAAc,CAAC;EACzD,SAAS,OAAO;GAGd,QAAQ,MAAM,kDAAkD,kBAAkB,KAAK,CAAC;GACxF,OAAO,CAAC,aAAa;EACvB;CACF,GACA,CAAC,oBAAoB,CACvB;CAEA,MAAM,kBAAkB,YACtB,OAAO,UAAU;EACf,IAAI;GAEF,QAAO,MADc,0BAA0B,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAA,CACpE,MAAM,yBAAyB,cAAc,CAAC;E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,UAAU;IAAK;IACrD;KAAE,MAAM;KAAW,MAAM;KAAU,UAAU;IAAK;IAClD;KAAE,MAAM;KAAU,MAAM;KAAU,UAAU;IAAK;IACjD;KAAE,MAAM;KAAU,MAAM;KAAU,UAAU;IAAK;IACjD;KAAE,MAAM;KAAc,MAAM;KAAU,UAAU;IAAK;IACrD;KAAE,MAAM;KAAgB,MAAM;KAAU,UAAU;IAAK;IACvD;KAAE,MAAM;KAAQ,MAAM;KAAU,UAAU;IAAK;IAC/C;KAAE,MAAM;KAAS,MAAM;KAAU,UAAU;IAAK;IAChD;KAAE,MAAM;KAAa,MAAM;KAAU,UAAU;IAAK;GACtD;EACF;EACA,UAAU;GACR,aACE;GACF,SAAS,CAAC;IAAE,MAAM;IAAW,MAAM;GAAU,CAAC;EAChD;EACA,kBAAkB;GAChB,aACE;GACF,SAAS,CAAC;EACZ;EACA,iBAAiB;GACf,aAAa;GACb,SAAS,CAAC;IAAE,MAAM;IAAc,MAAM;GAAS,CAAC;EAClD;EACA,cAAc;GACZ,aACE;GACF,SAAS;IACP;KAAE,MAAM;KAAc,MAAM;IAAS;IACrC;KAAE,MAAM;KAAiB,MAAM;IAAS;IACxC;KAAE,MAAM;KAAgB,MAAM;IAAS;IACvC;KAAE,MAAM;KAAc,MAAM;IAAS;IACrC;KAAE,MAAM;KAAiB,MAAM;IAAS;GAC1C;EACF;CACF;CACA,KAAK;AACP,CAAC"}
1
+ {"version":3,"file":"use-payment-actions.js","names":["INVALID_BIN_MESSAGE"],"sources":["../../../src/sdk/payment/use-payment-actions.ts"],"sourcesContent":["'use client';\n\nimport { useMutation } from '@apollo/client/react';\nimport { defineActions } from '@vtex/fs-core';\nimport { INVALID_BIN_MESSAGE } from '@vtex/fs-domain-logic/checkout/rules';\nimport { useCallback, useMemo } from 'react';\nimport { loggableErrorName } from '../../utils/loggable-error-name.js';\nimport { CLIENT_PREFERENCES_UPDATE } from '../identity/operations.js';\nimport { isAcceptedBin } from './bin-format.js';\nimport {\n PAYMENT_GATEWAY_USER_ERROR,\n type PaymentGatewayResult,\n postPaymentsToGateway,\n type SendPaymentsRequest,\n} from './gateway.js';\nimport {\n PAYMENT_BILLING_ADDRESS_UPDATE,\n PAYMENT_GATEWAY_CALLBACK,\n PAYMENT_INSTALLMENT_SELECT,\n PAYMENT_METHOD_SELECT,\n PAYMENT_NETWORK_ERROR_CODE,\n PAYMENT_START_TRANSACTION,\n type PaymentBillingAddressUpdateInput,\n type PaymentMethodSelectInput,\n type PaymentMoney,\n type PaymentUserError,\n} from './operations.js';\n\n/**\n * The `payment` action namespace — the sanctioned client write surface for credit-card payment\n * (specs/payment-action-namespace.md; docs/features/credit-card/rfc.md § D12;\n * docs/storefront-core/adr-0010-actions-own-the-write-side.md).\n *\n * Six mutation-backed methods run the write model T3 shipped (`checkout/schema.graphql` § 11), except\n * `saveCard`, which reuses the already-shipped `clientPreferencesUpdate` document this package owns —\n * there is no `paymentSaveCard` mutation and T3 decided there must not be one. All six are\n * async/pessimistic: the handler awaits the mutation and only the server-confirmed payload changes the\n * cache. Each is stateless (no reactive vars, no module state), resolves its payload `userErrors` (empty\n * on success), and never throws for an expected outcome; an infrastructure failure (transport or an\n * upstream GraphQLError) is caught and collapsed to one synthetic `NETWORK_ERROR` userError with no\n * per-code branching, mirroring `useShippingActions`.\n *\n * `sendPayments` is the seventh method and the odd one: a **façade** (ADR-0010's sanctioned flavor,\n * alongside `notifications`) that posts card data from the browser straight to the payment gateway,\n * touching neither our GraphQL layer nor the normalized cache. It is catalogued like any other method —\n * per D12, hiding a write route with no read-back would cost discoverability without protecting\n * anything, and the compiler wants to *see* which components reference it. What is deliberately absent\n * from the catalog is the card data itself: no `payload` entry below names a card number, CVV, expiry,\n * or holder name, so there is no schema-bindable name for the editor or the agent to map a value onto\n * (RFC D13). The card reaches the handler as a runtime argument from the card-entry component's local\n * state (T7), and `gateway.ts` — which has no Apollo import — is the only module that touches it.\n */\n\n/**\n * Everything `usePlaceOrder` (T13) needs to assemble `PaymentGatewayTransaction`, minus the five\n * fields that come from the `Payment` read model. Every field is nullable because a payload carrying\n * `userErrors` nulls all of them (T18 Decision 4), so a complete descriptor is only guaranteed once\n * `userErrors` is empty *and* the payload passes the caller's completeness check.\n */\nexport type PaymentStartTransactionResult = Readonly<{\n transactionId: string | null;\n merchantName: string | null;\n /** Gateway origin. Nullable, and never interpolated into a URL before `isTrustedGatewayOrigin`. */\n gatewayUrl: string | null;\n orderGroup: string | null;\n /**\n * The Relay Node ID of the order, for `Query.order(id:)`. Null when the transaction carried no order\n * group. Optional so a provider written before this field existed still satisfies the type.\n */\n orderNodeId?: string | null;\n userProfileId: string | null;\n /** Display decimal. The gateway body's unit is `valueInCents`. */\n value: PaymentMoney | null;\n valueInCents: number | null;\n referenceValueInCents: number | null;\n userErrors: readonly PaymentUserError[];\n}>;\n\nexport type PaymentGatewayCallbackResult = Readonly<{\n orderId: string | null;\n /** The Relay Node ID of the finalized order, for `Query.order(id:)`. Null unless the callback succeeded. */\n orderNodeId?: string | null;\n /** The bank's challenge page. Set only when the server answered a challenge with a usable URL. */\n redirectUrl?: string | null;\n userErrors: readonly PaymentUserError[];\n}>;\n\nexport type PaymentActions = Readonly<{\n /** Select a payment method, optionally identifying a new card's BIN or a saved card's account. */\n setMethod: (input: PaymentMethodSelectInput) => Promise<readonly PaymentUserError[]>;\n /** Select an installment count for the current method. The response's `cart.total` is the greater of the order form's value and the selected payment's value. */\n setInstallments: (count: number) => Promise<readonly PaymentUserError[]>;\n /** Persist the billing address, or fall back to the delivery address (`sameAsDelivery: true`). */\n setBillingAddress: (input: PaymentBillingAddressUpdateInput) => Promise<readonly PaymentUserError[]>;\n /**\n * Record the data-storage consent a saved card requires, over the existing `clientPreferencesUpdate`.\n * This does not by itself save the card: the save flag and label travel on `sendPayments`'s card\n * argument (RFC D5's two halves). The boolean passes through unchanged — whether unchecking should\n * revoke a consent an unrelated opt-in component may have granted is T10's decision, and its spec must\n * state one (Gap 4 in specs/payment-action-namespace.md).\n */\n saveCard: (enabled: boolean) => Promise<readonly PaymentUserError[]>;\n /** Open a VTEX transaction from the persisted selection. Resolves the payload the gateway call needs. */\n startTransaction: () => Promise<PaymentStartTransactionResult>;\n /**\n * Finalize the transaction after the gateway accepted the card. `acceptChallenges: true` is sent only by\n * the page the bank returns the shopper to, and only then; omitted, the server asks for a challenge\n * instead of finishing the order.\n */\n gatewayCallback: (\n orderGroup: string,\n options?: Readonly<{ acceptChallenges?: boolean }>,\n ) => Promise<PaymentGatewayCallbackResult>;\n /**\n * Façade: post the card straight to the payment gateway. Issues no GraphQL operation and writes\n * nothing to the cache. Never rejects: resolves `{ reachedGateway, userErrors }`, with one `GATEWAY_ERROR`\n * userError when the gateway rejects the call or it could not be issued. `reachedGateway` is `false`\n * only when no request was issued; every outcome it cannot classify is `true`.\n */\n sendPayments: (request: SendPaymentsRequest) => Promise<PaymentGatewayResult>;\n}>;\n\nconst INVALID_BIN_ERROR: PaymentUserError = { code: 'INVALID_BIN_FORMAT', message: INVALID_BIN_MESSAGE };\n\n// Diagnostic `message` (logs, `onResult`); each reader words `NETWORK_ERROR` from its own content.\nconst NETWORK_ERROR: PaymentUserError = {\n code: PAYMENT_NETWORK_ERROR_CODE,\n message: 'Unable to complete the request. Please try again.',\n};\n\n/** Mirrors the resolver's own nulled-fields constant, so one added field is nulled in one place. */\nconst EMPTY_START_TRANSACTION = {\n transactionId: null,\n merchantName: null,\n gatewayUrl: null,\n orderGroup: null,\n orderNodeId: null,\n userProfileId: null,\n value: null,\n valueInCents: null,\n referenceValueInCents: null,\n} as const;\n\n/**\n * The `payment` namespace hook. Registered with the first-party action registry via `paymentActions`\n * below; the compiler-emitted `PaymentActionProvider` calls it and threads the narrowed methods into\n * each consumer's `$actions.payment`. Writes persist purely through the normalized-cache merge of each\n * mutation response — no refetch, no imperative cache write.\n */\nexport function usePaymentActions(): PaymentActions {\n const [methodSelectMutation] = useMutation(PAYMENT_METHOD_SELECT);\n const [installmentSelectMutation] = useMutation(PAYMENT_INSTALLMENT_SELECT);\n const [billingAddressMutation] = useMutation(PAYMENT_BILLING_ADDRESS_UPDATE);\n const [preferencesMutation] = useMutation(CLIENT_PREFERENCES_UPDATE);\n const [startTransactionMutation] = useMutation(PAYMENT_START_TRANSACTION);\n const [gatewayCallbackMutation] = useMutation(PAYMENT_GATEWAY_CALLBACK);\n\n const setMethod = useCallback<PaymentActions['setMethod']>(\n async (input) => {\n // Refused here, before the value can reach the network, the GraphQL variables or the Apollo cache.\n // Logs nothing: the input carries the value being refused.\n if (!isAcceptedBin(input)) return [INVALID_BIN_ERROR];\n try {\n const result = await methodSelectMutation({ variables: { input } });\n return result.data?.paymentMethodSelect.userErrors ?? [];\n } catch (error) {\n // Log only the error name — the input carries the card's BIN, and a variable-coercion error's\n // message echoes the offending value (`got invalid value … at \"input.bin\"`).\n console.error('[payment.setMethod] paymentMethodSelect failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [methodSelectMutation],\n );\n\n const setInstallments = useCallback<PaymentActions['setInstallments']>(\n async (count) => {\n try {\n const result = await installmentSelectMutation({ variables: { input: { count } } });\n return result.data?.paymentInstallmentSelect.userErrors ?? [];\n } catch (error) {\n console.error('[payment.setInstallments] paymentInstallmentSelect failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [installmentSelectMutation],\n );\n\n const setBillingAddress = useCallback<PaymentActions['setBillingAddress']>(\n async (input) => {\n try {\n const result = await billingAddressMutation({ variables: { input } });\n return result.data?.paymentBillingAddressUpdate.userErrors ?? [];\n } catch (error) {\n // Log only the error name — the message can echo the submitted address (PII).\n console.error('[payment.setBillingAddress] paymentBillingAddressUpdate failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [billingAddressMutation],\n );\n\n const saveCard = useCallback<PaymentActions['saveCard']>(\n async (enabled) => {\n try {\n const result = await preferencesMutation({ variables: { input: { savePersonalData: enabled } } });\n return result.data?.clientPreferencesUpdate?.userErrors ?? [];\n } catch (error) {\n console.error('[payment.saveCard] clientPreferencesUpdate failed', loggableErrorName(error));\n return [NETWORK_ERROR];\n }\n },\n [preferencesMutation],\n );\n\n const startTransaction = useCallback<PaymentActions['startTransaction']>(async () => {\n try {\n const result = await startTransactionMutation();\n const payload = result.data?.paymentStartTransaction;\n return {\n transactionId: payload?.transactionId ?? null,\n merchantName: payload?.merchantName ?? null,\n gatewayUrl: payload?.gatewayUrl ?? null,\n orderGroup: payload?.orderGroup ?? null,\n orderNodeId: payload?.orderNodeId ?? null,\n userProfileId: payload?.userProfileId ?? null,\n value: payload?.value ?? null,\n valueInCents: payload?.valueInCents ?? null,\n referenceValueInCents: payload?.referenceValueInCents ?? null,\n userErrors: payload?.userErrors ?? [],\n };\n } catch (error) {\n console.error('[payment.startTransaction] paymentStartTransaction failed', loggableErrorName(error));\n return { ...EMPTY_START_TRANSACTION, userErrors: [NETWORK_ERROR] };\n }\n }, [startTransactionMutation]);\n\n const gatewayCallback = useCallback<PaymentActions['gatewayCallback']>(\n async (orderGroup, options) => {\n try {\n const input = options?.acceptChallenges === true ? { orderGroup, acceptChallenges: true } : { orderGroup };\n const result = await gatewayCallbackMutation({ variables: { input } });\n const payload = result.data?.paymentGatewayCallback;\n return {\n orderId: payload?.orderId ?? null,\n orderNodeId: payload?.orderNodeId ?? null,\n ...(payload?.redirectUrl ? { redirectUrl: payload.redirectUrl } : {}),\n userErrors: payload?.userErrors ?? [],\n };\n } catch (error) {\n console.error('[payment.gatewayCallback] paymentGatewayCallback failed', loggableErrorName(error));\n return { orderId: null, orderNodeId: null, userErrors: [NETWORK_ERROR] };\n }\n },\n [gatewayCallbackMutation],\n );\n\n const sendPayments = useCallback<PaymentActions['sendPayments']>(async (request) => {\n try {\n return await postPaymentsToGateway(request);\n } catch (error) {\n // Log the error NAME ONLY. The request carries a card number and CVV, and a thrown fetch error's\n // message can echo the URL or the body — nothing on this path is ever serialized to a log.\n console.error('[payment.sendPayments] gateway request failed', loggableErrorName(error));\n // A rejected request is unclassified — it may have been processed — so it counts as reached.\n return { reachedGateway: true, userErrors: [PAYMENT_GATEWAY_USER_ERROR] };\n }\n }, []);\n\n return useMemo(\n () => ({\n setMethod,\n setInstallments,\n setBillingAddress,\n saveCard,\n startTransaction,\n gatewayCallback,\n sendPayments,\n }),\n [setMethod, setInstallments, setBillingAddress, saveCard, startTransaction, gatewayCallback, sendPayments],\n );\n}\n\n/**\n * Declares the `payment` action namespace — the single source of truth for its method/payload metadata,\n * runtime provider, and `use` hook (mirrors `cartActions`, `shippingActions`). The native catalog\n * builder (`scripts/build-catalog.mjs`) statically reads this call to emit `actions.json`; at runtime\n * `PaymentActionProvider` calls `usePaymentActions` directly.\n *\n * `sendPayments`'s `payload` lists only the non-sensitive transaction descriptor's identifiers.\n * `ActionPayloadField` is the surface a schema-bindable name would come from, so the card fields'\n * absence here is the mechanical form of RFC D13: card number and CVV are never expressed as a declared\n * action payload. The `SendPaymentsRequest` type in `gateway.ts` is the source of truth for the real\n * call shape.\n */\nexport const paymentActions = defineActions({\n namespace: 'payment',\n description:\n 'Mutation-backed payment writes against the VTEX orderForm paymentData/invoiceData, plus a façade that posts card data directly to the payment gateway (never through our GraphQL layer or cache).',\n provider: { name: 'PaymentActionProvider', importPath: '@vtex/faststore/internal/client' },\n methods: {\n setMethod: {\n description:\n 'Select a payment method, optionally identifying a new card by BIN or a saved card by account (async/pessimistic). Resolves the payload userErrors.',\n payload: [\n { name: 'methodId', type: 'string' },\n { name: 'bin', type: 'string', optional: true },\n { name: 'accountId', type: 'string', optional: true },\n ],\n },\n setInstallments: {\n description:\n 'Select an installment count for the current method (async/pessimistic). The response carries the cart, whose total is the greater of the order form value and the selected payment value, so it includes the interest of the picked tier. Resolves the payload userErrors.',\n payload: [{ name: 'count', type: 'number' }],\n },\n setBillingAddress: {\n description:\n 'Persist the billing address, or fall back to the delivery address with sameAsDelivery (async/pessimistic). Resolves the payload userErrors.',\n payload: [\n { name: 'sameAsDelivery', type: 'boolean' },\n { name: 'addressType', type: 'string', optional: true },\n { name: 'postalCode', type: 'string', optional: true },\n { name: 'country', type: 'string', optional: true },\n { name: 'street', type: 'string', optional: true },\n { name: 'number', type: 'string', optional: true },\n { name: 'complement', type: 'string', optional: true },\n { name: 'neighborhood', type: 'string', optional: true },\n { name: 'city', type: 'string', optional: true },\n { name: 'state', type: 'string', optional: true },\n { name: 'reference', type: 'string', optional: true },\n ],\n },\n saveCard: {\n description:\n 'Record the data-storage consent a saved card requires, reusing the existing clientPreferencesUpdate write. Does not itself save the card — the save flag and label travel on sendPayments.',\n payload: [{ name: 'enabled', type: 'boolean' }],\n },\n startTransaction: {\n description:\n 'Open a VTEX transaction from the persisted payment selection. Takes no arguments; resolves the transaction identifiers the gateway call needs.',\n payload: [],\n },\n gatewayCallback: {\n description: 'Finalize the transaction after the gateway accepted the card. Resolves the payload userErrors.',\n payload: [\n { name: 'orderGroup', type: 'string' },\n { name: 'acceptChallenges', type: 'boolean', optional: true },\n ],\n },\n sendPayments: {\n description:\n 'Façade: post the card directly from the browser to the payment gateway. Issues no GraphQL operation and writes nothing to the cache. Resolves { reachedGateway, userErrors }: reachedGateway is false only when no request was issued. The card number and CVV are runtime-only arguments and are deliberately absent from this payload — they are never a bindable field (RFC D13).',\n payload: [\n { name: 'gatewayUrl', type: 'string' },\n { name: 'transactionId', type: 'string' },\n { name: 'merchantName', type: 'string' },\n { name: 'orderGroup', type: 'string' },\n { name: 'userProfileId', type: 'string' },\n ],\n },\n },\n use: usePaymentActions,\n});\n"],"mappings":";;;;;;;;;;;AA0HA,MAAM,oBAAsC;CAAE,MAAM;CAAsB,uBAASA,CAAAA,CAAAA;AAAoB;AAGvG,MAAM,gBAAkC;CACtC,MAAM;CACN,SAAS;AACX;;AAGA,MAAM,0BAA0B;CAC9B,eAAe;CACf,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,aAAa;CACb,eAAe;CACf,OAAO;CACP,cAAc;CACd,uBAAuB;AACzB;;;;;;;AAQA,SAAgB,oBAAoC;CAClD,MAAM,CAAC,wBAAwB,YAA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AM;KAAS,MAAM;KAAU,UAAU;IAAK;IAChD;KAAE,MAAM;KAAa,MAAM;KAAU,UAAU;IAAK;GACtD;EACF;EACA,UAAU;GACR,aACE;GACF,SAAS,CAAC;IAAE,MAAM;IAAW,MAAM;GAAU,CAAC;EAChD;EACA,kBAAkB;GAChB,aACE;GACF,SAAS,CAAC;EACZ;EACA,iBAAiB;GACf,aAAa;GACb,SAAS,CACP;IAAE,MAAM;IAAc,MAAM;GAAS,GACrC;IAAE,MAAM;IAAoB,MAAM;IAAW,UAAU;GAAK,CAC9D;EACF;EACA,cAAc;GACZ,aACE;GACF,SAAS;IACP;KAAE,MAAM;KAAc,MAAM;IAAS;IACrC;KAAE,MAAM;KAAiB,MAAM;IAAS;IACxC;KAAE,MAAM;KAAgB,MAAM;IAAS;IACvC;KAAE,MAAM;KAAc,MAAM;IAAS;IACrC;KAAE,MAAM;KAAiB,MAAM;IAAS;GAC1C;EACF;CACF;CACA,KAAK;AACP,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import { PaymentMoney } from "./operations.js";
2
2
  import "../actions/types.js";
3
+ import "./resumed-purchase.js";
3
4
  //#region src/sdk/payment/use-place-order.d.ts
4
5
  export type PlaceOrderInstallment = Readonly<{
5
6
  count: number;
6
7
  /** Per-installment amount, as a display decimal. The gateway's unit is minor units. */
7
8
  value: PaymentMoney;
8
- interestRate: number;
9
+ /** `null` when the order form did not say. The gateway body still gets a number: `?? 0` at the descriptor. */
10
+ interestRate: number | null;
9
11
  }>;
10
12
  export type PlaceOrderMethod = Readonly<{
11
13
  id: string;
@@ -36,7 +38,8 @@ export type PlaceOrderAttemptPhase =
36
38
  /** The continuation resolved with no userErrors — the card reached the gateway. */
37
39
  'sent' |
38
40
  /** The card's fate is unknown: the continuation threw, the POST was aborted, or a finalization got no
39
- * answer or only a locked code (`REDIRECT_REQUIRED`, `MISSING_TRANSACTION_COOKIES`). Resume-only.
41
+ * answer or only a locked code (`REDIRECT_REQUIRED`, `MISSING_TRANSACTION_COOKIES`,
42
+ * `ORDER_GROUP_MISMATCH`). Resume-only.
40
43
  * Treated exactly like `sent`. */
41
44
  'unresolved' |
42
45
  /** `gatewayCallback` is in flight for this attempt's order group. */
@@ -55,6 +58,11 @@ export type PlaceOrderAttempt = Readonly<{
55
58
  * upstream success response body is discarded. So `orderId === orderGroup` on every success today.
56
59
  */
57
60
  orderId: string | null;
61
+ /**
62
+ * The Relay Node ID of the placed order, from `gatewayCallback` (or from `startTransaction` when no
63
+ * callback runs). Absent until the attempt settles; opaque to this module.
64
+ */
65
+ orderNodeId?: string | null;
58
66
  }>;
59
67
  /**
60
68
  * Fix pass (High finding, race #2): widened past a plain value so a write can be made conditional on