@vtex/faststore 0.0.8 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (568) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +0 -1
  3. package/dist/actions.json +48 -1
  4. package/dist/catalog.json +1397 -1594
  5. package/dist/cli/index.d.ts +66 -28
  6. package/dist/cli/index.js +7371 -512
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/server-runtime.js +41 -60
  9. package/dist/cli/server-runtime.js.map +1 -1
  10. package/dist/client.d.ts +3 -3
  11. package/dist/client.js +2 -2
  12. package/dist/components.d.ts +67 -56
  13. package/dist/components.js +64 -53
  14. package/dist/content-types.json +5886 -555
  15. package/dist/core/dist/define-component.d.ts +7 -2
  16. package/dist/core/dist/define-content-type.d.ts +50 -2
  17. package/dist/core/dist/define-content-type.js +107 -3
  18. package/dist/core/dist/define-content-type.js.map +1 -1
  19. package/dist/core/dist/index.d.ts +2 -2
  20. package/dist/docs/access-code-field.md +1 -1
  21. package/dist/docs/access-code-sign-in.md +126 -77
  22. package/dist/docs/account-address-book.md +210 -95
  23. package/dist/docs/account-entry-point.md +4 -4
  24. package/dist/docs/account-menu.md +16 -17
  25. package/dist/docs/account-saved-cards.md +306 -0
  26. package/dist/docs/alert-dialog.md +3 -1
  27. package/dist/docs/avatar.md +4 -2
  28. package/dist/docs/billing-address.md +99 -30
  29. package/dist/docs/binding-switcher.md +157 -0
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +42 -29
  32. package/dist/docs/card-summary.md +185 -0
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +251 -0
  36. package/dist/docs/cart-item.md +48 -15
  37. package/dist/docs/cart-totalizer.md +8 -6
  38. package/dist/docs/cart.md +240 -39
  39. package/dist/docs/challenge-return.md +135 -0
  40. package/dist/docs/client-preferences-fieldset.md +10 -5
  41. package/dist/docs/client-preferences.md +31 -8
  42. package/dist/docs/client-profile-fieldset.md +20 -6
  43. package/dist/docs/client-profile.md +12 -3
  44. package/dist/docs/copy-text.md +9 -7
  45. package/dist/docs/document-field.md +1 -1
  46. package/dist/docs/email-field.md +2 -1
  47. package/dist/docs/email-identification.md +12 -2
  48. package/dist/docs/footer-copyright.md +4 -2
  49. package/dist/docs/footer-social.md +1 -1
  50. package/dist/docs/form.md +54 -18
  51. package/dist/docs/free-shipping-progress.md +18 -13
  52. package/dist/docs/identity-edit.md +8 -2
  53. package/dist/docs/identity-summary.md +18 -5
  54. package/dist/docs/incentives.md +2 -2
  55. package/dist/docs/installments.md +46 -32
  56. package/dist/docs/logo.md +1 -1
  57. package/dist/docs/my-account-profile.md +16 -11
  58. package/dist/docs/navigation-link.md +5 -3
  59. package/dist/docs/order-cancel.md +3 -1
  60. package/dist/docs/order-delivery-address.md +7 -5
  61. package/dist/docs/order-delivery-group.md +1 -3
  62. package/dist/docs/order-details-back.md +1 -1
  63. package/dist/docs/order-details-header.md +1 -4
  64. package/dist/docs/order-invoice-download.md +60 -0
  65. package/dist/docs/order-list-row.md +1 -1
  66. package/dist/docs/order-list-search.md +13 -20
  67. package/dist/docs/order-list-views.md +11 -17
  68. package/dist/docs/order-list.md +12 -5
  69. package/dist/docs/order-payment.md +9 -7
  70. package/dist/docs/order-placed-date.md +1 -1
  71. package/dist/docs/order-placed-payment-summary.md +28 -15
  72. package/dist/docs/order-placed.md +49 -14
  73. package/dist/docs/order-progress.md +1 -1
  74. package/dist/docs/order-status-badge.md +20 -9
  75. package/dist/docs/order-summary.md +2 -2
  76. package/dist/docs/order-tracking-link.md +58 -0
  77. package/dist/docs/payment-method-badges.md +32 -6
  78. package/dist/docs/payment-methods.md +2 -2
  79. package/dist/docs/payment.md +36 -17
  80. package/dist/docs/phone-field.md +4 -4
  81. package/dist/docs/place-order.md +84 -36
  82. package/dist/docs/postal-code-field.md +3 -1
  83. package/dist/docs/pricing.md +21 -23
  84. package/dist/docs/product-gallery.md +19 -20
  85. package/dist/docs/product-information.md +14 -10
  86. package/dist/docs/product-list.md +7 -6
  87. package/dist/docs/product-shelf.md +7 -1
  88. package/dist/docs/promotion.md +4 -2
  89. package/dist/docs/region.md +23 -15
  90. package/dist/docs/save-card.md +7 -6
  91. package/dist/docs/saved-cards.md +65 -36
  92. package/dist/docs/select.md +3 -4
  93. package/dist/docs/shipping-address.md +57 -21
  94. package/dist/docs/shipping-simulator.md +53 -15
  95. package/dist/docs/sign-in-disclosure.md +176 -0
  96. package/dist/docs/sign-in-form.md +78 -47
  97. package/dist/docs/sign-in-redirect.md +5 -3
  98. package/dist/docs/sign-in.md +173 -0
  99. package/dist/docs/toast.md +45 -16
  100. package/dist/docs/variant-selector.md +15 -11
  101. package/dist/graphql/types.d.ts +4 -14
  102. package/dist/index.d.ts +3 -2
  103. package/dist/internal/client.d.ts +4 -3
  104. package/dist/internal/client.js +5 -2
  105. package/dist/internal/server.d.ts +10 -5
  106. package/dist/internal/server.js +9 -4
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  108. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  109. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  110. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  111. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  112. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  113. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  114. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  115. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  116. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  117. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  118. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  120. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  121. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  122. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  123. package/dist/matter/account-address-book/account-address-book.js +74 -33
  124. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  126. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  127. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  128. package/dist/matter/account-address-book/account-address-country.js +83 -49
  129. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  131. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  132. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  133. package/dist/matter/account-address-book/account-address-form.js +518 -155
  134. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  135. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  136. package/dist/matter/account-address-book/account-address-record.js +32 -17
  137. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  138. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  139. package/dist/matter/account-menu/account-menu.js +46 -54
  140. package/dist/matter/account-menu/account-menu.js.map +1 -1
  141. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  142. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +463 -0
  143. package/dist/matter/account-saved-cards/account-saved-cards.js +1011 -0
  144. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -0
  145. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  146. package/dist/matter/billing-address/billing-address.js +227 -156
  147. package/dist/matter/billing-address/billing-address.js.map +1 -1
  148. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  149. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  150. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  151. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  152. package/dist/matter/buy-button/buy-button.js +10 -19
  153. package/dist/matter/buy-button/buy-button.js.map +1 -1
  154. package/dist/matter/card-entry/card-capture.js +12 -4
  155. package/dist/matter/card-entry/card-capture.js.map +1 -1
  156. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  157. package/dist/matter/card-entry/card-entry.js +348 -221
  158. package/dist/matter/card-entry/card-entry.js.map +1 -1
  159. package/dist/matter/cart/cart-namespace.d.ts +11 -1
  160. package/dist/matter/cart/cart-namespace.js +11 -1
  161. package/dist/matter/cart/cart-namespace.js.map +1 -1
  162. package/dist/matter/cart/cart.d.ts +416 -45
  163. package/dist/matter/cart/cart.js +782 -101
  164. package/dist/matter/cart/cart.js.map +1 -1
  165. package/dist/matter/cart-destination/cart-destination.d.ts +233 -0
  166. package/dist/matter/cart-destination/cart-destination.js +703 -0
  167. package/dist/matter/cart-destination/cart-destination.js.map +1 -0
  168. package/dist/matter/cart-item/cart-item.d.ts +145 -16
  169. package/dist/matter/cart-item/cart-item.js +230 -54
  170. package/dist/matter/cart-item/cart-item.js.map +1 -1
  171. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  172. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  173. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  174. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  175. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  176. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  177. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  178. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  179. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  180. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  181. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  182. package/dist/matter/cart-totalizer/cart-totalizer.js +49 -19
  183. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  184. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  185. package/dist/matter/challenge-return/challenge-return.js +241 -0
  186. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  187. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  188. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  189. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  190. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  191. package/dist/matter/client-preferences/client-preferences.js +84 -15
  192. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  193. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  194. package/dist/matter/client-profile/client-profile.js +64 -24
  195. package/dist/matter/client-profile/client-profile.js.map +1 -1
  196. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  197. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  198. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  199. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  200. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  201. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  202. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  203. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  204. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  205. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  206. package/dist/matter/delivery-options/delivery-options.js +75 -12
  207. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  209. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  210. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  211. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  212. package/dist/matter/email-identification/email-identification.js +49 -12
  213. package/dist/matter/email-identification/email-identification.js.map +1 -1
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +85 -10
  215. package/dist/matter/free-shipping-progress/free-shipping-progress.js +153 -53
  216. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  217. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  218. package/dist/matter/identity-edit/identity-edit.js +47 -19
  219. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  220. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  221. package/dist/matter/identity-summary/identity-summary.js +95 -45
  222. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  223. package/dist/matter/installments/installments-select.d.ts +98 -16
  224. package/dist/matter/installments/installments-select.js +156 -48
  225. package/dist/matter/installments/installments-select.js.map +1 -1
  226. package/dist/matter/installments/installments.d.ts +96 -16
  227. package/dist/matter/installments/installments.js +115 -40
  228. package/dist/matter/installments/installments.js.map +1 -1
  229. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  230. package/dist/matter/installments/use-installments-selection.js +8 -3
  231. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  232. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  233. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  234. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  235. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  236. package/dist/matter/order-cancel/order-cancel.js +118 -51
  237. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  238. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  239. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  240. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  241. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  242. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  243. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  244. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  245. package/dist/matter/order-details-header/order-details-header.js +66 -58
  246. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  247. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  248. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  249. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  250. package/dist/matter/order-list/order-list.d.ts +164 -19
  251. package/dist/matter/order-list/order-list.js +229 -87
  252. package/dist/matter/order-list/order-list.js.map +1 -1
  253. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  254. package/dist/matter/order-list-row/order-list-row.js +3 -2
  255. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  256. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  257. package/dist/matter/order-list-search/order-list-search.js +30 -69
  258. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  259. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  260. package/dist/matter/order-list-views/order-list-views.js +22 -68
  261. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  262. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  263. package/dist/matter/order-payment/order-payment.js +44 -39
  264. package/dist/matter/order-payment/order-payment.js.map +1 -1
  265. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  266. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  267. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  268. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  269. package/dist/matter/order-placed/order-placed.js +230 -139
  270. package/dist/matter/order-placed/order-placed.js.map +1 -1
  271. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  272. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  273. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  275. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  276. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  277. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  278. package/dist/matter/order-progress/order-progress.js +37 -45
  279. package/dist/matter/order-progress/order-progress.js.map +1 -1
  280. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  281. package/dist/matter/order-summary/order-summary.js +38 -44
  282. package/dist/matter/order-summary/order-summary.js.map +1 -1
  283. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  284. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  285. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  286. package/dist/matter/payment/payment-card-capture.js +17 -10
  287. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  288. package/dist/matter/payment/payment-controller.d.ts +4 -2
  289. package/dist/matter/payment/payment-controller.js +30 -9
  290. package/dist/matter/payment/payment-controller.js.map +1 -1
  291. package/dist/matter/payment/payment-method-badges.js +1 -1
  292. package/dist/matter/payment/payment.d.ts +69 -19
  293. package/dist/matter/payment/payment.js +101 -35
  294. package/dist/matter/payment/payment.js.map +1 -1
  295. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  296. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  297. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  298. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  299. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  300. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  301. package/dist/matter/place-order/place-order.d.ts +171 -57
  302. package/dist/matter/place-order/place-order.js +376 -185
  303. package/dist/matter/place-order/place-order.js.map +1 -1
  304. package/dist/matter/pricing/pricing.d.ts +152 -13
  305. package/dist/matter/pricing/pricing.js +153 -52
  306. package/dist/matter/pricing/pricing.js.map +1 -1
  307. package/dist/matter/product-information/product-information.d.ts +27 -4
  308. package/dist/matter/product-information/product-information.js +32 -15
  309. package/dist/matter/product-information/product-information.js.map +1 -1
  310. package/dist/matter/product-list/product-list.d.ts +24 -6
  311. package/dist/matter/product-list/product-list.js +32 -26
  312. package/dist/matter/product-list/product-list.js.map +1 -1
  313. package/dist/matter/product-shelf/product-shelf.d.ts +8 -3
  314. package/dist/matter/product-shelf/product-shelf.js +111 -10
  315. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  316. package/dist/matter/region/region.d.ts +33 -16
  317. package/dist/matter/region/region.js +59 -52
  318. package/dist/matter/region/region.js.map +1 -1
  319. package/dist/matter/save-card/save-card.d.ts +43 -8
  320. package/dist/matter/save-card/save-card.js +61 -23
  321. package/dist/matter/save-card/save-card.js.map +1 -1
  322. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  323. package/dist/matter/saved-cards/saved-cards.js +349 -77
  324. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  325. package/dist/matter/shipping-address/address-payload.js +25 -0
  326. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  327. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  328. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  329. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  330. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  331. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  332. package/dist/matter/shipping-address/shipping-address.js +443 -188
  333. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  334. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +251 -25
  335. package/dist/matter/shipping-simulator/shipping-simulator.js +261 -51
  336. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  337. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  338. package/dist/matter/sign-in/sign-in.js +285 -0
  339. package/dist/matter/sign-in/sign-in.js.map +1 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  341. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  342. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  343. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  344. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  345. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  346. package/dist/particles/binding-switcher/binding-switcher.d.ts +59 -0
  347. package/dist/particles/binding-switcher/binding-switcher.js +194 -0
  348. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -0
  349. package/dist/particles/card-summary/card-network.d.ts +17 -0
  350. package/dist/particles/card-summary/card-network.js +25 -0
  351. package/dist/particles/card-summary/card-network.js.map +1 -0
  352. package/dist/particles/card-summary/card-summary.d.ts +113 -0
  353. package/dist/particles/card-summary/card-summary.js +221 -0
  354. package/dist/particles/card-summary/card-summary.js.map +1 -0
  355. package/dist/particles/carousel/carousel.d.ts +99 -11
  356. package/dist/particles/carousel/carousel.js +103 -35
  357. package/dist/particles/carousel/carousel.js.map +1 -1
  358. package/dist/particles/copy-text/copy-text.js +5 -15
  359. package/dist/particles/copy-text/copy-text.js.map +1 -1
  360. package/dist/particles/dialog/dialog.d.ts +14 -6
  361. package/dist/particles/dialog/dialog.js +6 -3
  362. package/dist/particles/dialog/dialog.js.map +1 -1
  363. package/dist/particles/drawer/drawer.js +1 -1
  364. package/dist/particles/drawer/drawer.js.map +1 -1
  365. package/dist/particles/email-field/email-field.d.ts +2 -1
  366. package/dist/particles/email-field/email-field.js +2 -1
  367. package/dist/particles/email-field/email-field.js.map +1 -1
  368. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  369. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  370. package/dist/particles/footer-social/footer-social.d.ts +1 -1
  371. package/dist/particles/footer-social/footer-social.js +1 -1
  372. package/dist/particles/footer-social/footer-social.js.map +1 -1
  373. package/dist/particles/form/form.d.ts +85 -13
  374. package/dist/particles/form/form.js +91 -42
  375. package/dist/particles/form/form.js.map +1 -1
  376. package/dist/particles/gallery/gallery.d.ts +129 -12
  377. package/dist/particles/gallery/gallery.js +121 -34
  378. package/dist/particles/gallery/gallery.js.map +1 -1
  379. package/dist/particles/incentives/incentives.d.ts +1 -1
  380. package/dist/particles/incentives/incentives.js +1 -1
  381. package/dist/particles/incentives/incentives.js.map +1 -1
  382. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  383. package/dist/particles/order-details-back/order-details-back.js +8 -10
  384. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  385. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  386. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  387. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  388. package/dist/particles/password-field/password-field.d.ts +1 -1
  389. package/dist/particles/password-field/password-field.js +2 -4
  390. package/dist/particles/password-field/password-field.js.map +1 -1
  391. package/dist/particles/payment-methods/payment-methods.d.ts +1 -1
  392. package/dist/particles/payment-methods/payment-methods.js +1 -1
  393. package/dist/particles/payment-methods/payment-methods.js.map +1 -1
  394. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  395. package/dist/particles/phone-field/phone-field.js +8 -11
  396. package/dist/particles/phone-field/phone-field.js.map +1 -1
  397. package/dist/particles/spinner/spinner.d.ts +24 -4
  398. package/dist/particles/spinner/spinner.js +25 -9
  399. package/dist/particles/spinner/spinner.js.map +1 -1
  400. package/dist/particles/switch/switch.d.ts +4 -1
  401. package/dist/particles/switch/switch.js +3 -1
  402. package/dist/particles/switch/switch.js.map +1 -1
  403. package/dist/particles/toast/toast.d.ts +49 -9
  404. package/dist/particles/toast/toast.js +81 -15
  405. package/dist/particles/toast/toast.js.map +1 -1
  406. package/dist/schema.graphql +461 -89
  407. package/dist/sdk/actions/index.d.ts +3 -1
  408. package/dist/sdk/actions/index.js +3 -1
  409. package/dist/sdk/actions/locale-action-provider.d.ts +16 -0
  410. package/dist/sdk/actions/locale-action-provider.js +20 -0
  411. package/dist/sdk/actions/locale-action-provider.js.map +1 -0
  412. package/dist/sdk/actions/saved-card-action-provider.d.ts +12 -0
  413. package/dist/sdk/actions/saved-card-action-provider.js +16 -0
  414. package/dist/sdk/actions/saved-card-action-provider.js.map +1 -0
  415. package/dist/sdk/actions/types.d.ts +6 -2
  416. package/dist/sdk/address/address-fields.js +4 -4
  417. package/dist/sdk/address/address-fields.js.map +1 -1
  418. package/dist/sdk/address/constants.js +1 -6
  419. package/dist/sdk/address/constants.js.map +1 -1
  420. package/dist/sdk/address/messages.js +44 -44
  421. package/dist/sdk/address/messages.js.map +1 -1
  422. package/dist/sdk/address/postal-code.js +15 -2
  423. package/dist/sdk/address/postal-code.js.map +1 -1
  424. package/dist/sdk/address/types.d.ts +5 -3
  425. package/dist/sdk/address/validate-address.js +3 -3
  426. package/dist/sdk/address/validate-address.js.map +1 -1
  427. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  428. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  429. package/dist/sdk/cache/storefront-cache.js +2 -1
  430. package/dist/sdk/cache/storefront-cache.js.map +1 -1
  431. package/dist/sdk/cart/operations.d.ts +2 -1
  432. package/dist/sdk/cart/operations.js +55 -1
  433. package/dist/sdk/cart/operations.js.map +1 -1
  434. package/dist/sdk/cart/optimistic.d.ts +30 -7
  435. package/dist/sdk/cart/optimistic.js +78 -41
  436. package/dist/sdk/cart/optimistic.js.map +1 -1
  437. package/dist/sdk/cart/use-cart-actions.d.ts +7 -0
  438. package/dist/sdk/cart/use-cart-actions.js +61 -15
  439. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  440. package/dist/sdk/cart/use-cart-sync-sales-channel.js +70 -0
  441. package/dist/sdk/cart/use-cart-sync-sales-channel.js.map +1 -0
  442. package/dist/sdk/data/index.js +2 -2
  443. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  444. package/dist/sdk/generated/gql.js +16 -12
  445. package/dist/sdk/generated/gql.js.map +1 -1
  446. package/dist/sdk/generated/graphql.d.ts +197 -51
  447. package/dist/sdk/generated/graphql.js +2318 -91
  448. package/dist/sdk/generated/graphql.js.map +1 -1
  449. package/dist/sdk/i18n/format-error-code.js +23 -0
  450. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  451. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  452. package/dist/sdk/i18n/message-formatter.js +140 -0
  453. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  454. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  455. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  456. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  457. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  458. package/dist/sdk/locale/binding-switch-provider.d.ts +13 -0
  459. package/dist/sdk/locale/binding-switch-provider.js +20 -0
  460. package/dist/sdk/locale/binding-switch-provider.js.map +1 -0
  461. package/dist/sdk/locale/use-locale-actions.d.ts +16 -0
  462. package/dist/sdk/locale/use-locale-actions.js +70 -0
  463. package/dist/sdk/locale/use-locale-actions.js.map +1 -0
  464. package/dist/sdk/navigation/binding-switch.d.ts +39 -0
  465. package/dist/sdk/navigation/binding-switch.js +129 -0
  466. package/dist/sdk/navigation/binding-switch.js.map +1 -0
  467. package/dist/sdk/navigation/decode-route-params.d.ts +11 -0
  468. package/dist/sdk/navigation/decode-route-params.js +32 -0
  469. package/dist/sdk/navigation/decode-route-params.js.map +1 -0
  470. package/dist/sdk/navigation/redirect.d.ts +2 -0
  471. package/dist/sdk/navigation/redirect.js +19 -1
  472. package/dist/sdk/navigation/redirect.js.map +1 -1
  473. package/dist/sdk/navigation/types.d.ts +13 -0
  474. package/dist/sdk/payment/bin-format.js +20 -0
  475. package/dist/sdk/payment/bin-format.js.map +1 -0
  476. package/dist/sdk/payment/challenge-return.js +37 -0
  477. package/dist/sdk/payment/challenge-return.js.map +1 -0
  478. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  479. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  480. package/dist/sdk/payment/gateway.d.ts +1 -1
  481. package/dist/sdk/payment/gateway.js +8 -2
  482. package/dist/sdk/payment/gateway.js.map +1 -1
  483. package/dist/sdk/payment/operations.d.ts +1 -0
  484. package/dist/sdk/payment/operations.js +28 -6
  485. package/dist/sdk/payment/operations.js.map +1 -1
  486. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  487. package/dist/sdk/payment/resumed-purchase.js +119 -0
  488. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  489. package/dist/sdk/payment/security-code-mask.js +16 -23
  490. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  491. package/dist/sdk/payment/submission-registry.js +6 -2
  492. package/dist/sdk/payment/submission-registry.js.map +1 -1
  493. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  494. package/dist/sdk/payment/use-payment-actions.js +23 -3
  495. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  496. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  497. package/dist/sdk/payment/use-place-order.js +138 -76
  498. package/dist/sdk/payment/use-place-order.js.map +1 -1
  499. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  500. package/dist/sdk/provider/storefront-provider.js +4 -11
  501. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  502. package/dist/sdk/saved-cards/operations.d.ts +16 -0
  503. package/dist/sdk/saved-cards/operations.js +41 -0
  504. package/dist/sdk/saved-cards/operations.js.map +1 -0
  505. package/dist/sdk/saved-cards/use-saved-card-actions.d.ts +26 -0
  506. package/dist/sdk/saved-cards/use-saved-card-actions.js +86 -0
  507. package/dist/sdk/saved-cards/use-saved-card-actions.js.map +1 -0
  508. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  509. package/dist/sdk/seo/entity-landing.js +30 -0
  510. package/dist/sdk/seo/entity-landing.js.map +1 -0
  511. package/dist/sdk/seo/page-alternates.d.ts +8 -5
  512. package/dist/sdk/seo/page-alternates.js +11 -14
  513. package/dist/sdk/seo/page-alternates.js.map +1 -1
  514. package/dist/sdk/seo/search-landing.d.ts +42 -0
  515. package/dist/sdk/seo/search-landing.js +85 -0
  516. package/dist/sdk/seo/search-landing.js.map +1 -0
  517. package/dist/sdk/session/mock-session.d.ts +9 -0
  518. package/dist/sdk/session/mock-session.js +31 -0
  519. package/dist/sdk/session/mock-session.js.map +1 -0
  520. package/dist/sdk/session/read-server-session.d.ts +3 -0
  521. package/dist/sdk/session/read-server-session.js +5 -0
  522. package/dist/sdk/session/read-server-session.js.map +1 -1
  523. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  524. package/dist/sdk/session/return-path-segment.js +15 -0
  525. package/dist/sdk/session/return-path-segment.js.map +1 -0
  526. package/dist/sdk/session/use-session-actions.js.map +1 -1
  527. package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
  528. package/dist/sdk/shipping/shipping-operations.js +13 -0
  529. package/dist/sdk/shipping/shipping-operations.js.map +1 -1
  530. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  531. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  532. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  533. package/dist/sdk/state/cart.d.ts +9 -2
  534. package/dist/sdk/state/cart.js +9 -2
  535. package/dist/sdk/state/cart.js.map +1 -1
  536. package/dist/utils/safe-href.d.ts +2 -0
  537. package/package.json +4 -3
  538. package/skills/storefront-asset/SKILL.md +2 -2
  539. package/skills/storefront-asset/references/api-side.md +27 -14
  540. package/skills/storefront-asset/references/findings.md +5 -2
  541. package/src/styles/tailwind.css +9 -2
  542. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  543. package/dist/message-locales.json +0 -7
  544. package/dist/sdk/i18n/client.d.ts +0 -4
  545. package/dist/sdk/i18n/client.js +0 -4
  546. package/dist/sdk/i18n/locales.d.ts +0 -8
  547. package/dist/sdk/i18n/locales.js +0 -57
  548. package/dist/sdk/i18n/locales.js.map +0 -1
  549. package/dist/sdk/i18n/messages/en-US.js +0 -164
  550. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  551. package/dist/sdk/i18n/messages/en-US.json +0 -159
  552. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -163
  553. package/dist/sdk/i18n/messages/es-ES.js +0 -164
  554. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  555. package/dist/sdk/i18n/messages/es-ES.json +0 -159
  556. package/dist/sdk/i18n/messages/pt-BR.js +0 -164
  557. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  558. package/dist/sdk/i18n/messages/pt-BR.json +0 -159
  559. package/dist/sdk/i18n/provider.d.ts +0 -1
  560. package/dist/sdk/i18n/provider.js +0 -30
  561. package/dist/sdk/i18n/provider.js.map +0 -1
  562. package/dist/sdk/i18n/server.d.ts +0 -28
  563. package/dist/sdk/i18n/server.js +0 -59
  564. package/dist/sdk/i18n/server.js.map +0 -1
  565. package/dist/utils/resolve-authored-copy.js +0 -18
  566. package/dist/utils/resolve-authored-copy.js.map +0 -1
  567. package/dist/utils/substitute-template.js +0 -33
  568. package/dist/utils/substitute-template.js.map +0 -1
@@ -1,15 +1,17 @@
1
1
  "use client";
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
+ import { defineContentType } from "../../core/dist/define-content-type.js";
3
4
  import "../../core/dist/index.js";
5
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
4
6
  import { useDataOverride } from "../../sdk/data/data-override-context.js";
5
7
  import { ReactiveRootContext } from "../../sdk/data/page-reactive-data-root.js";
6
- import { substituteTemplate } from "../../utils/substitute-template.js";
8
+ import { useConfirmationLastFour } from "../../sdk/payment/confirmation-last-four.js";
7
9
  import { useContext } from "react";
8
10
  import { jsx, jsxs } from "react/jsx-runtime";
9
11
  //#region src/matter/order-placed-payment-summary/order-placed-payment-summary.tsx
10
12
  /**
11
13
  * OrderPlacedPaymentSummary matter (epic `credit-card`, T17 — recap the payment on the order
12
- * confirmation). Single-file matter per ADR-0001: owns its own `Query.order(orderGroup: $orderGroup)`
14
+ * confirmation). Single-file matter per ADR-0001: owns its own `Query.order(id: $orderId)`
13
15
  * fragment and sets no `requiresContext`, so it composes independently on a confirmation surface — no
14
16
  * ancestor context needed.
15
17
  *
@@ -24,9 +26,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
24
26
  */
25
27
  const fragment = `
26
28
  fragment OrderPlacedPaymentSummaryData on Query {
27
- order(orderGroup: $orderGroup) {
29
+ order(id: $orderId) {
28
30
  __typename
29
31
  id
32
+ reference
30
33
  network
31
34
  lastFourDigits
32
35
  installment {
@@ -39,8 +42,73 @@ const fragment = `
39
42
  }
40
43
  }
41
44
  `;
42
- const TOTAL_TOKEN = "{total}";
43
- const COUNT_TOKEN = "{count}";
45
+ const OrderPlacedPaymentSummaryContent = defineContentType({
46
+ id: "order-placed-payment-summary",
47
+ title: "Order Placed Payment Summary",
48
+ description: "Copy of the payment recap on the order confirmation.",
49
+ schema: {
50
+ type: "object",
51
+ additionalProperties: false,
52
+ properties: {
53
+ lastFourTemplate: {
54
+ type: "string",
55
+ title: "Last four",
56
+ description: "Rendered only when the last four digits resolve.",
57
+ format: "icu-message",
58
+ messageSource: "•••• {lastFour}",
59
+ messageArguments: {
60
+ type: "object",
61
+ properties: { lastFour: { type: "string" } }
62
+ },
63
+ messageExample: { lastFour: "4242" }
64
+ },
65
+ noPaymentRecordLabel: {
66
+ type: "string",
67
+ title: "No payment record",
68
+ description: "Shown when the order resolves but carries no projectable payment record.",
69
+ format: "icu-message",
70
+ messageSource: "Payment method not available"
71
+ },
72
+ unresolvedOrderLabel: {
73
+ type: "string",
74
+ title: "Unresolved order",
75
+ description: "Shown when the order group does not resolve to a settled order.",
76
+ format: "icu-message",
77
+ messageSource: "Could not load the payment details"
78
+ },
79
+ installmentTemplate: {
80
+ type: "string",
81
+ title: "Installment",
82
+ description: "`total` is the formatted settled payment, never a per-installment amount, which is why the source says \"total\" instead of \"of\".",
83
+ format: "icu-message",
84
+ messageSource: "{count}x total {total}",
85
+ messageArguments: {
86
+ type: "object",
87
+ properties: {
88
+ count: { type: "integer" },
89
+ total: { type: "string" }
90
+ }
91
+ },
92
+ messageExample: {
93
+ count: 3,
94
+ total: "R$ 600,00"
95
+ }
96
+ },
97
+ installmentCountTemplate: {
98
+ type: "string",
99
+ title: "Installment count",
100
+ description: "Rendered instead of the installment message when the settled record has no total.",
101
+ format: "icu-message",
102
+ messageSource: "{count}x",
103
+ messageArguments: {
104
+ type: "object",
105
+ properties: { count: { type: "integer" } }
106
+ },
107
+ messageExample: { count: 3 }
108
+ }
109
+ }
110
+ }
111
+ });
44
112
  /**
45
113
  * Resolves `$data` plus the reactive root's `loading` into exactly one of four states, in a total,
46
114
  * ordered precedence. A split purchase is read whole (docs/features/order-placed/rfc.md, 3.1), so no
@@ -54,14 +122,14 @@ const COUNT_TOKEN = "{count}";
54
122
  * line. The order system sends no card label, so the recap reads none
55
123
  * (docs/features/order-placed/rfc.md, 4.5).
56
124
  */
57
- function resolveOrderPlacedPayment(data, loading) {
125
+ function resolveOrderPlacedPayment(data, loading, carriedLastFour) {
58
126
  if (loading && data == null) return { kind: "loading" };
59
127
  if (data == null) return { kind: "unresolved" };
60
128
  if (data.network == null && data.lastFourDigits == null) return { kind: "no-record" };
61
129
  return {
62
130
  kind: "recap",
63
131
  network: data.network ?? "",
64
- lastFourDigits: data.lastFourDigits ?? null,
132
+ lastFourDigits: data.lastFourDigits ?? (data.network == null ? null : carriedLastFour),
65
133
  installment: data.installment ?? null
66
134
  };
67
135
  }
@@ -89,86 +157,12 @@ function formatMoney(money) {
89
157
  return money.amount;
90
158
  }
91
159
  }
92
- /**
93
- * Drops the `{total}` placeholder from the RAW template — before `{count}` is substituted — together
94
- * with the WHOLE run of text between `{count}`'s own glued suffix (if any) and `{total}`, not merely
95
- * one connector word (Decision 8, T31 — specs/make-the-payment-components-authored-copy.md; this
96
- * hardens FR-12/T97's original single-run rule, which dropped only one word and left a multi-word
97
- * connector dangling, e.g. `'{count}x no valor total de {total}'` degrading to "6x no valor total").
98
- *
99
- * When `{count}` appears before `{total}`, this scans FORWARD from the end of `{count}` to the first
100
- * whitespace character: that run (possibly zero-length) is the count's own glued suffix — a unit
101
- * symbol like "x"/"×"/"回", never a connector — and is kept verbatim; everything from there through
102
- * `{total}` itself is dropped. When no whitespace separates `{count}` from `{total}` at all, the whole
103
- * run between them is glued and kept, and only the `{total}` token is dropped. A null total therefore
104
- * degrades `'{count}x of {total}'` to "6x" (the whitespace-separated run "of" is dropped in full),
105
- * `'{count}x {total}'` to "6x" (the "x" is glued to `{count}`, so it survives even though `{total}`
106
- * does not), `'{count}x{total}'` to "6x" too (no whitespace at all between them — the glued run,
107
- * `{total}` aside, is kept), and `'{count} parcelas de {total}'` — a self-contained unit noun with no
108
- * glued suffix — to a bare "6": no algorithm can tell "parcelas" apart from a dangling preposition, so
109
- * the same deterministic rule that kills every dangling phrase also takes a legitimate unit noun with
110
- * it (OQ-2). This applies wherever `{count}` sits in the template, not only at its start (`'Paid
111
- * {count}x {total}'` → "Paid 6x").
112
- *
113
- * The forward scan is bounded so it can never cross into `{total}`: `{total}` is a fixed literal
114
- * marker with a known position, unlike the count's own digits once substituted, which could otherwise
115
- * be mistaken for a connector by shape alone. Running this on the raw template — and only substituting
116
- * `{count}` afterward — is what keeps the count itself from ever being the thing removed (FR-4: the
117
- * element must always render when `count` resolves, for any template that contains `{count}`).
118
- *
119
- * Two edge cases are deliberate limits of this rule, not bugs to chase. `'{count} x {total}'` still
120
- * degrades to "6": a whitespace-separated single-character "x" is by construction indistinguishable
121
- * from a connector word, so it is dropped along with it — that IS the rule's principle, not an
122
- * exception to it. `'{count}-{total}'` degrades to "6-": the glued "-" is kept verbatim as the
123
- * author's own template text, whatever character it is. Both outcomes are stable and predictable,
124
- * which is the point.
125
- *
126
- * When `{count}` does not appear before `{total}` at all (a template that never shows the count, e.g.
127
- * `'Total: {total}'`), there is no boundary to scan forward from, and this path is unchanged from
128
- * before Decision 8: walk backward from `{total}`, drop one connector run and its surrounding
129
- * whitespace, and fall back to cutting the bare `{total}` token only when that would leave nothing but
130
- * whitespace (`installmentTemplate = '{total}'` collapses to `''`). FR-4's "always renders when count
131
- * resolves" guarantee is therefore scoped to templates that contain `{count}`; a total-only template
132
- * never had a count to render, and asked for the total alone.
133
- */
134
- function stripTotalToken(template) {
135
- const totalIndex = template.indexOf(TOTAL_TOKEN);
136
- if (totalIndex === -1) return template;
137
- const countIndex = template.indexOf(COUNT_TOKEN);
138
- const countEnd = countIndex + 7;
139
- const hasCountBoundary = countIndex !== -1 && countEnd <= totalIndex;
140
- const isWhitespaceAt = (index) => /\s/.test(template[index] ?? "");
141
- if (hasCountBoundary) {
142
- let gluedEnd = countEnd;
143
- while (gluedEnd < totalIndex && !isWhitespaceAt(gluedEnd)) gluedEnd++;
144
- return template.slice(0, gluedEnd) + template.slice(totalIndex + 7);
145
- }
146
- let cursor = totalIndex;
147
- while (cursor > 0 && isWhitespaceAt(cursor - 1)) cursor--;
148
- while (cursor > 0 && !isWhitespaceAt(cursor - 1)) cursor--;
149
- while (cursor > 0 && isWhitespaceAt(cursor - 1)) cursor--;
150
- const withConnectorDropped = template.slice(0, cursor) + template.slice(totalIndex + 7);
151
- if (withConnectorDropped.trim() !== "") return withConnectorDropped;
152
- return template.slice(0, totalIndex) + template.slice(totalIndex + 7);
153
- }
154
- /**
155
- * Substitutes `{count}` and `{total}` with replacer FUNCTIONS, not replacement strings (FR-5, the
156
- * same S1 fix `lastFourText` below applies to `lastFourTemplate`): `total.amount`/`total.currencyCode`
157
- * are server-sourced and unconstrained, so a replacement STRING could let a hostile value rewrite the
158
- * surrounding template text via `$&`/`` $` ``/`$'`/`$$`.
159
- *
160
- * When total is null, `{total}` and its connector word are dropped by `stripTotalToken` — on the raw
161
- * template, before `{count}` is substituted; see that function's doc comment for the exact rule. A
162
- * prior version ran an unanchored regex over the ALREADY-substituted string and, for any template
163
- * where the connector sits right next to `{count}` with only whitespace further out (e.g.
164
- * `'{count}x {total}'`), matched from the very start of the string and deleted the count along with
165
- * the connector, silently un-rendering the whole line (T33 fix-round-2 regression).
166
- */
167
- function formatInstallmentLine(template, installment) {
168
- const { total } = installment;
169
- if (!total) return substituteTemplate(stripTotalToken(template), { count: String(installment.count) }).trim();
170
- return substituteTemplate(template, {
171
- count: String(installment.count),
160
+ /** A record with a count but no total (never a fabricated amount) renders `installmentCountTemplate` instead. */
161
+ function formatInstallmentLine({ format }, installment) {
162
+ const { count, total } = installment;
163
+ if (!total) return format("installmentCountTemplate", { count }).trim();
164
+ return format("installmentTemplate", {
165
+ count,
172
166
  total: formatMoney(total)
173
167
  }).trim();
174
168
  }
@@ -178,33 +172,13 @@ const OrderPlacedPaymentSummaryDefinition = defineComponent({
178
172
  component: OrderPlacedPaymentSummary,
179
173
  fragment,
180
174
  fetchStrategy: "reactive",
175
+ content: OrderPlacedPaymentSummaryContent,
181
176
  editor: {
182
177
  label: "Order Placed Payment Summary",
183
178
  category: "commerce"
184
179
  },
185
- schema: {
186
- lastFourTemplate: {
187
- type: "string",
188
- default: "•••• {lastFour}",
189
- label: "Last-four template"
190
- },
191
- noPaymentRecordLabel: {
192
- type: "string",
193
- default: "Payment method not available",
194
- label: "No payment record label"
195
- },
196
- unresolvedOrderLabel: {
197
- type: "string",
198
- default: "Could not load the payment details",
199
- label: "Unresolved order label"
200
- },
201
- installmentTemplate: {
202
- type: "string",
203
- default: "{count}x of {total}",
204
- label: "Installment template"
205
- }
206
- },
207
- guideline: "Read-only recap, on a post-purchase confirmation surface, of the card the shopper paid with — sourced from the settled order (Query.order), never the live order form. Owns its own fragment; requires no ancestor context, so it composes standalone. Renders exactly one of four states, in strict precedence: nothing while the query is in flight; a role=\"alert\" notice when the order group does not resolve; an informational line when the order resolves with no payment record; or the recap itself (network, plus last four whenever the projection carries one, plus an installment line — count and settled total only, never a per-installment amount or interest rate — whenever the settled record reports one). Never compose it in checkout — the order group it reads does not exist until the order is placed, and no component renders a payment recap there. Never renders a full card number or CVV. See order-placed-payment-summary.md."
180
+ schema: {},
181
+ guideline: "Read-only recap, on a post-purchase confirmation surface, of the card the shopper paid with — sourced from the settled order (Query.order), never the live order form. Owns its own fragment; requires no ancestor context, so it composes standalone. Renders exactly one of four states, in strict precedence: nothing while the query is in flight; a role=\"alert\" notice when the order group does not resolve; an informational line when the order resolves with no payment record; or the recap itself (network, plus last four whenever the projection carries one, plus an installment line — count and settled total only, never a per-installment amount or interest rate — whenever the settled record reports one). Never compose it in checkout — the order group it reads does not exist until the order is placed, and no component renders a payment recap there. Its copy is the $content messages lastFourTemplate, noPaymentRecordLabel, unresolvedOrderLabel, installmentTemplate and installmentCountTemplate. Never renders a full card number or CVV. See order-placed-payment-summary.md."
208
182
  });
209
183
  /**
210
184
  * Renders the settled order's payment recap on a confirmation surface. Resolves through
@@ -214,27 +188,29 @@ const OrderPlacedPaymentSummaryDefinition = defineComponent({
214
188
  * last four (whenever present) plus the installment line (whenever the settled record reports one,
215
189
  * T33). Requires no context — composable standalone.
216
190
  */
217
- function OrderPlacedPaymentSummary({ className, lastFourTemplate = "•••• {lastFour}", noPaymentRecordLabel = "Payment method not available", unresolvedOrderLabel = "Could not load the payment details", installmentTemplate = "{count}x of {total}", $data: $dataProp }) {
191
+ function OrderPlacedPaymentSummary({ className, $content, $locale, $data: $dataProp }) {
218
192
  const $data = useDataOverride($dataProp);
193
+ const messages = useMessageFormatter(OrderPlacedPaymentSummaryContent, $content);
219
194
  const { loading } = useContext(ReactiveRootContext);
220
- const resolved = resolveOrderPlacedPayment($data ?? null, loading);
195
+ const carriedLastFour = useConfirmationLastFour($data?.reference);
196
+ const resolved = resolveOrderPlacedPayment($data ?? null, loading, carriedLastFour);
221
197
  if (resolved.kind === "loading") return null;
222
198
  if (resolved.kind === "unresolved") return /* @__PURE__ */ jsx("div", {
223
199
  className,
224
200
  role: "alert",
225
201
  "data-fs-order-placed-payment-summary": "",
226
202
  "data-fs-order-placed-payment-summary-unresolved": "",
227
- children: unresolvedOrderLabel
203
+ children: messages.format("unresolvedOrderLabel")
228
204
  });
229
205
  if (resolved.kind === "no-record") return /* @__PURE__ */ jsx("div", {
230
206
  className,
231
207
  "data-fs-order-placed-payment-summary": "",
232
208
  "data-fs-order-placed-payment-summary-no-record": "",
233
- children: noPaymentRecordLabel
209
+ children: messages.format("noPaymentRecordLabel")
234
210
  });
235
211
  const { network, lastFourDigits, installment } = resolved;
236
- const methodText = [network, lastFourDigits ? substituteTemplate(lastFourTemplate, { lastFour: lastFourDigits }) : null].filter(Boolean).join(" ");
237
- const installmentText = installment ? formatInstallmentLine(installmentTemplate, installment) : null;
212
+ const methodText = [network, lastFourDigits ? messages.format("lastFourTemplate", { lastFour: lastFourDigits }) : null].filter(Boolean).join(" ");
213
+ const installmentText = installment ? formatInstallmentLine(messages, installment) : null;
238
214
  return /* @__PURE__ */ jsxs("div", {
239
215
  className,
240
216
  "data-fs-order-placed-payment-summary": "",
@@ -248,6 +224,6 @@ function OrderPlacedPaymentSummary({ className, lastFourTemplate = "••••
248
224
  });
249
225
  }
250
226
  //#endregion
251
- export { OrderPlacedPaymentSummary, OrderPlacedPaymentSummaryDefinition };
227
+ export { OrderPlacedPaymentSummary, OrderPlacedPaymentSummaryContent, OrderPlacedPaymentSummaryDefinition };
252
228
 
253
229
  //# sourceMappingURL=order-placed-payment-summary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-placed-payment-summary.js","names":[],"sources":["../../../src/matter/order-placed-payment-summary/order-placed-payment-summary.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { useContext } from 'react';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { substituteTemplate } from '../../utils/substitute-template.js';\n\n/**\n * OrderPlacedPaymentSummary matter (epic `credit-card`, T17 — recap the payment on the order\n * confirmation). Single-file matter per ADR-0001: owns its own `Query.order(orderGroup: $orderGroup)`\n * fragment and sets no `requiresContext`, so it composes independently on a confirmation surface — no\n * ancestor context needed.\n *\n * This component is sourced from the settled order, never the live order form\n * (specs/order-placed-payment-summary.md, Decision 1): `Query.payment` projects the live order form\n * and stops resolving once the order is placed, so a post-purchase recap needs the settled-order\n * projection (`Query.order`, T16) instead — never compose it in checkout, and never\n * point this component at `Query.payment`.\n *\n * Read-only recap — no write affordance, no internal state; every transition is driven purely by\n * `$data` and `loading`.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment OrderPlacedPaymentSummaryData on Query {\n order(orderGroup: $orderGroup) {\n __typename\n id\n network\n lastFourDigits\n installment {\n count\n total {\n amount\n currencyCode\n }\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * The installment plan the order was charged in (T33, specs/settle-and-project-the-placed-\n * order.md). Null when the settled record reports none — never fabricated, never defaulted to\n * `{ count: 1 }`. `total` is null when the source carries the count but not enough to build a\n * Money from (Decision 2: the settled-order source never carries a per-installment amount or an\n * interest rate at all, see US-2).\n */\nexport type OrderPlacedInstallment = {\n count: number;\n total?: { amount: string; currencyCode: string } | null;\n} | null;\n\n/**\n * The `$data` slice forwarded by the reactive runtime. `OrderPlacedPaymentSummaryData` selects\n * exactly one top-level field (`order`), so per ADR-0015 the compiler derives a single entity\n * fragment and `$data` is the unwrapped value of that field — never a `{ order: … }` wrapper. `null`\n * when the order group does not resolve to a settled order.\n */\nexport type OrderPlacedPaymentSummaryData = {\n network?: string | null;\n lastFourDigits?: string | null;\n installment?: OrderPlacedInstallment;\n} | null;\n\n/** The four states the recap resolves to, in strict, total precedence order. */\ntype ResolvedOrderPlacedPayment =\n | { kind: 'loading' }\n | { kind: 'unresolved' }\n | { kind: 'no-record' }\n | {\n kind: 'recap';\n network: string;\n lastFourDigits: string | null;\n installment: OrderPlacedInstallment;\n };\n\nexport type OrderPlacedPaymentSummaryProps = {\n className?: string;\n /** Rendered only when `lastFourDigits` resolves; `{lastFour}` placeholder. */\n lastFourTemplate?: string;\n /** Shown when the order resolves but carries no projectable payment record. */\n noPaymentRecordLabel?: string;\n /** Shown when the order group does not resolve to a settled order. */\n unresolvedOrderLabel?: string;\n /**\n * Rendered only when `installment` resolves; `{count}`/`{total}` placeholders. When the source\n * carries the count but not enough to build a total from (US-2 — never a fabricated per-installment\n * amount), `{total}` is dropped together with everything between `{count}`'s own glued suffix (if\n * any) and `{total}` — but a run glued directly to `{count}`, with no whitespace, is a suffix of the\n * count, not a connector, and is kept. A null total therefore degrades `'{count}x of {total}'` to\n * \"6x\" — never \"6x of\" or a bare \"6\" (see `stripTotalToken`).\n */\n installmentTemplate?: string;\n /** Unwrapped `Order` slice forwarded by the reactive runtime — never a `{ order: … }` wrapper. */\n $data?: OrderPlacedPaymentSummaryData;\n};\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\nconst TOTAL_TOKEN = '{total}';\nconst COUNT_TOKEN = '{count}';\n\n/**\n * Resolves `$data` plus the reactive root's `loading` into exactly one of four states, in a total,\n * ordered precedence. A split purchase is read whole (docs/features/order-placed/rfc.md, 3.1), so no\n * error carries a state of its own: any failed read leaves `$data` null and resolves to `unresolved`.\n * `loading && data == null` separates a transient in-flight window from a genuinely unresolved order\n * group, so the unresolved alert never flashes on first paint of a successful confirmation. `no-record` fires only when network and\n * lastFourDigits are both null — a record carrying either still renders as `recap` (Open Question 5).\n *\n * `no-record`'s gate never reads installment (FR-6, INV-6): an order carrying an installment but\n * neither network nor lastFourDigits still renders `no-record`, not a recap with only an installment\n * line. The order system sends no card label, so the recap reads none\n * (docs/features/order-placed/rfc.md, 4.5).\n */\nfunction resolveOrderPlacedPayment(data: OrderPlacedPaymentSummaryData, loading: boolean): ResolvedOrderPlacedPayment {\n if (loading && data == null) return { kind: 'loading' };\n if (data == null) return { kind: 'unresolved' };\n if (data.network == null && data.lastFourDigits == null) return { kind: 'no-record' };\n return {\n kind: 'recap',\n network: data.network ?? '',\n lastFourDigits: data.lastFourDigits ?? null,\n installment: data.installment ?? null,\n };\n}\n\n/** Locale-formats a settled Money value (e.g. \"R$ 600,00\"). Fixed to pt-BR — not because it matches\n * every other default in this component (T31 moved every copy default here to en-US, which falsifies\n * that reasoning) but because this component has no `locale` prop of its own to read instead: adding\n * one is a formatting change, not a copy change, and is out of this task's scope (see OQ-3 in\n * specs/make-the-payment-components-authored-copy.md).\n *\n * `currencyCode` reaches this function already validated: `Money.currencyCode` is `CurrencyCode!`,\n * a GraphQL enum (`base/schema.graphql:186,206`), so a value outside the declared members fails\n * GraphQL's own enum serialization server-side and nulls `total` before it ever reaches a query\n * result — verified against this app's exact `buildSubgraphSchema` wiring (T33 fix pass: an empty\n * string / \"XX\" / \"BRLL\" each produced a `total: null` field error, never a value reaching here).\n * The try/catch below is defense in depth only, for a caller that bypasses that enum entirely (a\n * Storybook fixture, a `$data` override, a future schema change) — never expected to fire against a\n * real query response. */\nfunction formatMoney(money: { amount: string; currencyCode: string }): string {\n try {\n return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: money.currencyCode }).format(\n Number(money.amount),\n );\n } catch {\n return money.amount;\n }\n}\n\n/**\n * Drops the `{total}` placeholder from the RAW template — before `{count}` is substituted — together\n * with the WHOLE run of text between `{count}`'s own glued suffix (if any) and `{total}`, not merely\n * one connector word (Decision 8, T31 — specs/make-the-payment-components-authored-copy.md; this\n * hardens FR-12/T97's original single-run rule, which dropped only one word and left a multi-word\n * connector dangling, e.g. `'{count}x no valor total de {total}'` degrading to \"6x no valor total\").\n *\n * When `{count}` appears before `{total}`, this scans FORWARD from the end of `{count}` to the first\n * whitespace character: that run (possibly zero-length) is the count's own glued suffix — a unit\n * symbol like \"x\"/\"×\"/\"回\", never a connector — and is kept verbatim; everything from there through\n * `{total}` itself is dropped. When no whitespace separates `{count}` from `{total}` at all, the whole\n * run between them is glued and kept, and only the `{total}` token is dropped. A null total therefore\n * degrades `'{count}x of {total}'` to \"6x\" (the whitespace-separated run \"of\" is dropped in full),\n * `'{count}x {total}'` to \"6x\" (the \"x\" is glued to `{count}`, so it survives even though `{total}`\n * does not), `'{count}x{total}'` to \"6x\" too (no whitespace at all between them — the glued run,\n * `{total}` aside, is kept), and `'{count} parcelas de {total}'` — a self-contained unit noun with no\n * glued suffix — to a bare \"6\": no algorithm can tell \"parcelas\" apart from a dangling preposition, so\n * the same deterministic rule that kills every dangling phrase also takes a legitimate unit noun with\n * it (OQ-2). This applies wherever `{count}` sits in the template, not only at its start (`'Paid\n * {count}x {total}'` → \"Paid 6x\").\n *\n * The forward scan is bounded so it can never cross into `{total}`: `{total}` is a fixed literal\n * marker with a known position, unlike the count's own digits once substituted, which could otherwise\n * be mistaken for a connector by shape alone. Running this on the raw template — and only substituting\n * `{count}` afterward — is what keeps the count itself from ever being the thing removed (FR-4: the\n * element must always render when `count` resolves, for any template that contains `{count}`).\n *\n * Two edge cases are deliberate limits of this rule, not bugs to chase. `'{count} x {total}'` still\n * degrades to \"6\": a whitespace-separated single-character \"x\" is by construction indistinguishable\n * from a connector word, so it is dropped along with it — that IS the rule's principle, not an\n * exception to it. `'{count}-{total}'` degrades to \"6-\": the glued \"-\" is kept verbatim as the\n * author's own template text, whatever character it is. Both outcomes are stable and predictable,\n * which is the point.\n *\n * When `{count}` does not appear before `{total}` at all (a template that never shows the count, e.g.\n * `'Total: {total}'`), there is no boundary to scan forward from, and this path is unchanged from\n * before Decision 8: walk backward from `{total}`, drop one connector run and its surrounding\n * whitespace, and fall back to cutting the bare `{total}` token only when that would leave nothing but\n * whitespace (`installmentTemplate = '{total}'` collapses to `''`). FR-4's \"always renders when count\n * resolves\" guarantee is therefore scoped to templates that contain `{count}`; a total-only template\n * never had a count to render, and asked for the total alone.\n */\nfunction stripTotalToken(template: string): string {\n const totalIndex = template.indexOf(TOTAL_TOKEN);\n if (totalIndex === -1) return template;\n\n const countIndex = template.indexOf(COUNT_TOKEN);\n const countEnd = countIndex + COUNT_TOKEN.length;\n const hasCountBoundary = countIndex !== -1 && countEnd <= totalIndex;\n\n const isWhitespaceAt = (index: number) => /\\s/.test(template[index] ?? '');\n\n if (hasCountBoundary) {\n // Forward scan (Decision 8): the count's own glued suffix runs from countEnd up to the first\n // whitespace, or up to {total} itself when there is no whitespace between them at all.\n let gluedEnd = countEnd;\n while (gluedEnd < totalIndex && !isWhitespaceAt(gluedEnd)) gluedEnd++;\n return template.slice(0, gluedEnd) + template.slice(totalIndex + TOTAL_TOKEN.length);\n }\n\n // No {count} precedes {total} (e.g. \"Total: {total}\") — there is no boundary to stop a\n // connector-removal scan at, so this walks backward from {total} exactly as it did before Decision\n // 8: drop the whitespace immediately before {total}, then the one connector run before that, falling\n // back to dropping only the bare {total} token when removing the connector would leave nothing but\n // whitespace. Unchanged by Decision 8.\n let cursor = totalIndex;\n while (cursor > 0 && isWhitespaceAt(cursor - 1)) cursor--; // whitespace right before {total}\n while (cursor > 0 && !isWhitespaceAt(cursor - 1)) cursor--; // the candidate connector run\n while (cursor > 0 && isWhitespaceAt(cursor - 1)) cursor--; // whitespace right before the connector\n\n const withConnectorDropped = template.slice(0, cursor) + template.slice(totalIndex + TOTAL_TOKEN.length);\n if (withConnectorDropped.trim() !== '') return withConnectorDropped;\n\n return template.slice(0, totalIndex) + template.slice(totalIndex + TOTAL_TOKEN.length);\n}\n\n/**\n * Substitutes `{count}` and `{total}` with replacer FUNCTIONS, not replacement strings (FR-5, the\n * same S1 fix `lastFourText` below applies to `lastFourTemplate`): `total.amount`/`total.currencyCode`\n * are server-sourced and unconstrained, so a replacement STRING could let a hostile value rewrite the\n * surrounding template text via `$&`/`` $` ``/`$'`/`$$`.\n *\n * When total is null, `{total}` and its connector word are dropped by `stripTotalToken` — on the raw\n * template, before `{count}` is substituted; see that function's doc comment for the exact rule. A\n * prior version ran an unanchored regex over the ALREADY-substituted string and, for any template\n * where the connector sits right next to `{count}` with only whitespace further out (e.g.\n * `'{count}x {total}'`), matched from the very start of the string and deleted the count along with\n * the connector, silently un-rendering the whole line (T33 fix-round-2 regression).\n */\nfunction formatInstallmentLine(\n template: string,\n installment: { count: number; total?: { amount: string; currencyCode: string } | null },\n): string {\n const { total } = installment;\n if (!total) {\n return substituteTemplate(stripTotalToken(template), { count: String(installment.count) }).trim();\n }\n return substituteTemplate(template, { count: String(installment.count), total: formatMoney(total) }).trim();\n}\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const OrderPlacedPaymentSummaryDefinition = defineComponent<OrderPlacedPaymentSummaryProps>({\n name: 'OrderPlacedPaymentSummary',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedPaymentSummary,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Order Placed Payment Summary', category: 'commerce' },\n schema: {\n lastFourTemplate: { type: 'string', default: '•••• {lastFour}', label: 'Last-four template' },\n noPaymentRecordLabel: {\n type: 'string',\n default: 'Payment method not available',\n label: 'No payment record label',\n },\n unresolvedOrderLabel: {\n type: 'string',\n default: 'Could not load the payment details',\n label: 'Unresolved order label',\n },\n installmentTemplate: {\n type: 'string',\n default: '{count}x of {total}',\n label: 'Installment template',\n },\n },\n guideline:\n 'Read-only recap, on a post-purchase confirmation surface, of the card the shopper paid with — sourced from the settled order (Query.order), never the live order form. Owns its own fragment; requires no ancestor context, so it composes standalone. Renders exactly one of four states, in strict precedence: nothing while the query is in flight; a role=\"alert\" notice when the order group does not resolve; an informational line when the order resolves with no payment record; or the recap itself (network, plus last four whenever the projection carries one, plus an installment line — count and settled total only, never a per-installment amount or interest rate — whenever the settled record reports one). Never compose it in checkout — the order group it reads does not exist until the order is placed, and no component renders a payment recap there. Never renders a full card number or CVV. See order-placed-payment-summary.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\n/**\n * Renders the settled order's payment recap on a confirmation surface. Resolves through\n * `resolveOrderPlacedPayment`'s fixed precedence and renders exactly one state: the unresolved\n * notice as an inline `role=\"alert\"` element (FR-6); the no-record line as plain\n * informational text; the in-flight state as nothing at all (Decision 6); the recap as network plus\n * last four (whenever present) plus the installment line (whenever the settled record reports one,\n * T33). Requires no context — composable standalone.\n */\nexport function OrderPlacedPaymentSummary({\n className,\n lastFourTemplate = '•••• {lastFour}',\n noPaymentRecordLabel = 'Payment method not available',\n unresolvedOrderLabel = 'Could not load the payment details',\n installmentTemplate = '{count}x of {total}',\n $data: $dataProp,\n}: OrderPlacedPaymentSummaryProps) {\n const $data = useDataOverride($dataProp);\n const { loading } = useContext(ReactiveRootContext);\n const resolved = resolveOrderPlacedPayment($data ?? null, loading);\n\n if (resolved.kind === 'loading') return null;\n\n if (resolved.kind === 'unresolved') {\n return (\n <div\n className={className}\n role=\"alert\"\n data-fs-order-placed-payment-summary=\"\"\n data-fs-order-placed-payment-summary-unresolved=\"\"\n >\n {unresolvedOrderLabel}\n </div>\n );\n }\n\n if (resolved.kind === 'no-record') {\n return (\n <div\n className={className}\n data-fs-order-placed-payment-summary=\"\"\n data-fs-order-placed-payment-summary-no-record=\"\"\n >\n {noPaymentRecordLabel}\n </div>\n );\n }\n\n const { network, lastFourDigits, installment } = resolved;\n // `substituteTemplate` inserts every value literally (Decision 7): lastFourDigits is server-sourced\n // and unconstrained (a plain `String` in the schema, mapped straight from VTEX's payment.lastDigits\n // with no length/charset check — schema.graphql:2508, mappers.ts:650), so a hostile or buggy\n // upstream value can never rewrite the surrounding template text (S1).\n const lastFourText = lastFourDigits ? substituteTemplate(lastFourTemplate, { lastFour: lastFourDigits }) : null;\n // network and lastFourDigits are each independently nullable (schema.graphql:2496-2516,\n // mappers.ts:649-651) — the no-record gate above fires only when BOTH are null (FR-5), so a record\n // carrying just one of them still reaches this branch. Joining only the present parts avoids a\n // leading space (network null, lastFourDigits set) (R2).\n const methodText = [network, lastFourText].filter(Boolean).join(' ');\n // FR-4/FR-6: rendered whenever installment resolves, regardless of the count's value (Open\n // Question 3 — whether to suppress at count <= 1 — is left to a future product decision; this\n // component has no such special case today), and only inside this recap branch.\n const installmentText = installment ? formatInstallmentLine(installmentTemplate, installment) : null;\n\n return (\n <div className={className} data-fs-order-placed-payment-summary=\"\">\n {methodText ? <p data-fs-order-placed-payment-summary-method=\"\">{methodText}</p> : null}\n {installmentText ? <p data-fs-order-placed-payment-summary-installment=\"\">{installmentText}</p> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,WAAyB;;;;;;;;;;;;;;;;;AAmF/B,MAAM,cAAc;AACpB,MAAM,cAAc;;;;;;;;;;;;;;AAepB,SAAS,0BAA0B,MAAqC,SAA8C;CACpH,IAAI,WAAW,QAAQ,MAAM,OAAO,EAAE,MAAM,UAAU;CACtD,IAAI,QAAQ,MAAM,OAAO,EAAE,MAAM,aAAa;CAC9C,IAAI,KAAK,WAAW,QAAQ,KAAK,kBAAkB,MAAM,OAAO,EAAE,MAAM,YAAY;CACpF,OAAO;EACL,MAAM;EACN,SAAS,KAAK,WAAW;EACzB,gBAAgB,KAAK,kBAAkB;EACvC,aAAa,KAAK,eAAe;CACnC;AACF;;;;;;;;;;;;;;;AAgBA,SAAS,YAAY,OAAyD;CAC5E,IAAI;EACF,OAAO,IAAI,KAAK,aAAa,SAAS;GAAE,OAAO;GAAY,UAAU,MAAM;EAAa,CAAC,CAAC,CAAC,OACzF,OAAO,MAAM,MAAM,CACrB;CACF,QAAQ;EACN,OAAO,MAAM;CACf;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAS,gBAAgB,UAA0B;CACjD,MAAM,aAAa,SAAS,QAAQ,WAAW;CAC/C,IAAI,eAAe,IAAI,OAAO;CAE9B,MAAM,aAAa,SAAS,QAAQ,WAAW;CAC/C,MAAM,WAAW,aAAa;CAC9B,MAAM,mBAAmB,eAAe,MAAM,YAAY;CAE1D,MAAM,kBAAkB,UAAkB,KAAK,KAAK,SAAS,UAAU,EAAE;CAEzE,IAAI,kBAAkB;EAGpB,IAAI,WAAW;EACf,OAAO,WAAW,cAAc,CAAC,eAAe,QAAQ,GAAG;EAC3D,OAAO,SAAS,MAAM,GAAG,QAAQ,IAAI,SAAS,MAAM,aAAa,CAAkB;CACrF;CAOA,IAAI,SAAS;CACb,OAAO,SAAS,KAAK,eAAe,SAAS,CAAC,GAAG;CACjD,OAAO,SAAS,KAAK,CAAC,eAAe,SAAS,CAAC,GAAG;CAClD,OAAO,SAAS,KAAK,eAAe,SAAS,CAAC,GAAG;CAEjD,MAAM,uBAAuB,SAAS,MAAM,GAAG,MAAM,IAAI,SAAS,MAAM,aAAa,CAAkB;CACvG,IAAI,qBAAqB,KAAK,MAAM,IAAI,OAAO;CAE/C,OAAO,SAAS,MAAM,GAAG,UAAU,IAAI,SAAS,MAAM,aAAa,CAAkB;AACvF;;;;;;;;;;;;;;AAeA,SAAS,sBACP,UACA,aACQ;CACR,MAAM,EAAE,UAAU;CAClB,IAAI,CAAC,OACH,OAAO,mBAAmB,gBAAgB,QAAQ,GAAG,EAAE,OAAO,OAAO,YAAY,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK;CAElG,OAAO,mBAAmB,UAAU;EAAE,OAAO,OAAO,YAAY,KAAK;EAAG,OAAO,YAAY,KAAK;CAAE,CAAC,CAAC,CAAC,KAAK;AAC5G;AAMA,MAAa,sCAAsC,gBAAgD;CACjG,MAAM;CACN,YAAY;CACZ,WAAW;CACX;CACA,eAAe;CACf,QAAQ;EAAE,OAAO;EAAgC,UAAU;CAAW;CACtE,QAAQ;EACN,kBAAkB;GAAE,MAAM;GAAU,SAAS;GAAmB,OAAO;EAAqB;EAC5F,sBAAsB;GACpB,MAAM;GACN,SAAS;GACT,OAAO;EACT;EACA,sBAAsB;GACpB,MAAM;GACN,SAAS;GACT,OAAO;EACT;EACA,qBAAqB;GACnB,MAAM;GACN,SAAS;GACT,OAAO;EACT;CACF;CACA,WACE;AACJ,CAAC;;;;;;;;;AAcD,SAAgB,0BAA0B,EACxC,WACA,mBAAmB,mBACnB,uBAAuB,gCACvB,uBAAuB,sCACvB,sBAAsB,uBACtB,OAAO,aAC0B;CACjC,MAAM,QAAQ,gBAAgB,SAAS;CACvC,MAAM,EAAE,YAAY,WAAW,mBAAmB;CAClD,MAAM,WAAW,0BAA0B,SAAS,MAAM,OAAO;CAEjE,IAAI,SAAS,SAAS,WAAW,OAAO;CAExC,IAAI,SAAS,SAAS,cACpB,OACE,oBAAC,OAAD;EACa;EACX,MAAK;EACL,wCAAqC;EACrC,mDAAgD;EAE/C,UAAA;CACE,CAAA;CAIT,IAAI,SAAS,SAAS,aACpB,OACE,oBAAC,OAAD;EACa;EACX,wCAAqC;EACrC,kDAA+C;EAE9C,UAAA;CACE,CAAA;CAIT,MAAM,EAAE,SAAS,gBAAgB,gBAAgB;CAUjD,MAAM,aAAa,CAAC,SALC,iBAAiB,mBAAmB,kBAAkB,EAAE,UAAU,eAAe,CAAC,IAAI,IAKlE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CAInE,MAAM,kBAAkB,cAAc,sBAAsB,qBAAqB,WAAW,IAAI;CAEhG,OACE,qBAAC,OAAD;EAAgB;EAAW,wCAAqC;EAAhE,UAAA,CACG,aAAa,oBAAC,KAAD;GAAG,+CAA4C;GAAI,UAAA;EAAc,CAAA,IAAI,MAClF,kBAAkB,oBAAC,KAAD;GAAG,oDAAiD;GAAI,UAAA;EAAmB,CAAA,IAAI,IAC/F;;AAET"}
1
+ {"version":3,"file":"order-placed-payment-summary.js","names":[],"sources":["../../../src/matter/order-placed-payment-summary/order-placed-payment-summary.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport { useContext } from 'react';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport type { MessageFormatter } from '../../sdk/i18n/message-formatter.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { useConfirmationLastFour } from '../../sdk/payment/confirmation-last-four.js';\n\n/**\n * OrderPlacedPaymentSummary matter (epic `credit-card`, T17 — recap the payment on the order\n * confirmation). Single-file matter per ADR-0001: owns its own `Query.order(id: $orderId)`\n * fragment and sets no `requiresContext`, so it composes independently on a confirmation surface — no\n * ancestor context needed.\n *\n * This component is sourced from the settled order, never the live order form\n * (specs/order-placed-payment-summary.md, Decision 1): `Query.payment` projects the live order form\n * and stops resolving once the order is placed, so a post-purchase recap needs the settled-order\n * projection (`Query.order`, T16) instead — never compose it in checkout, and never\n * point this component at `Query.payment`.\n *\n * Read-only recap — no write affordance, no internal state; every transition is driven purely by\n * `$data` and `loading`.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment OrderPlacedPaymentSummaryData on Query {\n order(id: $orderId) {\n __typename\n id\n reference\n network\n lastFourDigits\n installment {\n count\n total {\n amount\n currencyCode\n }\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Content model. A message field is read only from `$content`.\n// ---------------------------------------------------------------------------\n\nexport const OrderPlacedPaymentSummaryContent = defineContentType({\n id: 'order-placed-payment-summary',\n title: 'Order Placed Payment Summary',\n description: 'Copy of the payment recap on the order confirmation.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n lastFourTemplate: {\n type: 'string',\n title: 'Last four',\n description: 'Rendered only when the last four digits resolve.',\n format: 'icu-message',\n messageSource: '•••• {lastFour}',\n messageArguments: { type: 'object', properties: { lastFour: { type: 'string' } } },\n messageExample: { lastFour: '4242' },\n },\n noPaymentRecordLabel: {\n type: 'string',\n title: 'No payment record',\n description: 'Shown when the order resolves but carries no projectable payment record.',\n format: 'icu-message',\n messageSource: 'Payment method not available',\n },\n unresolvedOrderLabel: {\n type: 'string',\n title: 'Unresolved order',\n description: 'Shown when the order group does not resolve to a settled order.',\n format: 'icu-message',\n messageSource: 'Could not load the payment details',\n },\n installmentTemplate: {\n type: 'string',\n title: 'Installment',\n description:\n '`total` is the formatted settled payment, never a per-installment amount, which is why the source says \"total\" instead of \"of\".',\n format: 'icu-message',\n messageSource: '{count}x total {total}',\n messageArguments: {\n type: 'object',\n properties: { count: { type: 'integer' }, total: { type: 'string' } },\n },\n messageExample: { count: 3, total: 'R$ 600,00' },\n },\n installmentCountTemplate: {\n type: 'string',\n title: 'Installment count',\n description: 'Rendered instead of the installment message when the settled record has no total.',\n format: 'icu-message',\n messageSource: '{count}x',\n messageArguments: { type: 'object', properties: { count: { type: 'integer' } } },\n messageExample: { count: 3 },\n },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * The installment plan the order was charged in (T33, specs/settle-and-project-the-placed-\n * order.md). Null when the settled record reports none — never fabricated, never defaulted to\n * `{ count: 1 }`. `total` is null when the source carries the count but not enough to build a\n * Money from (Decision 2: the settled-order source never carries a per-installment amount or an\n * interest rate at all, see US-2).\n */\nexport type OrderPlacedInstallment = {\n count: number;\n total?: { amount: string; currencyCode: string } | null;\n} | null;\n\n/**\n * The `$data` slice forwarded by the reactive runtime. `OrderPlacedPaymentSummaryData` selects\n * exactly one top-level field (`order`), so per ADR-0015 the compiler derives a single entity\n * fragment and `$data` is the unwrapped value of that field — never a `{ order: … }` wrapper. `null`\n * when the order group does not resolve to a settled order.\n */\nexport type OrderPlacedPaymentSummaryData = {\n /** The order group. Compared with the carried last four's own order group, never rendered. */\n reference?: string | null;\n network?: string | null;\n lastFourDigits?: string | null;\n installment?: OrderPlacedInstallment;\n} | null;\n\n/** The four states the recap resolves to, in strict, total precedence order. */\ntype ResolvedOrderPlacedPayment =\n | { kind: 'loading' }\n | { kind: 'unresolved' }\n | { kind: 'no-record' }\n | {\n kind: 'recap';\n network: string;\n lastFourDigits: string | null;\n installment: OrderPlacedInstallment;\n };\n\nexport type OrderPlacedPaymentSummaryProps = MessageLocaleProp & {\n className?: string;\n /** The last-four, no-record, unresolved and installment messages. */\n $content?: ContentValue<typeof OrderPlacedPaymentSummaryContent>;\n /** Unwrapped `Order` slice forwarded by the reactive runtime — never a `{ order: … }` wrapper. */\n $data?: OrderPlacedPaymentSummaryData;\n};\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Resolves `$data` plus the reactive root's `loading` into exactly one of four states, in a total,\n * ordered precedence. A split purchase is read whole (docs/features/order-placed/rfc.md, 3.1), so no\n * error carries a state of its own: any failed read leaves `$data` null and resolves to `unresolved`.\n * `loading && data == null` separates a transient in-flight window from a genuinely unresolved order\n * group, so the unresolved alert never flashes on first paint of a successful confirmation. `no-record` fires only when network and\n * lastFourDigits are both null — a record carrying either still renders as `recap` (Open Question 5).\n *\n * `no-record`'s gate never reads installment (FR-6, INV-6): an order carrying an installment but\n * neither network nor lastFourDigits still renders `no-record`, not a recap with only an installment\n * line. The order system sends no card label, so the recap reads none\n * (docs/features/order-placed/rfc.md, 4.5).\n */\nfunction resolveOrderPlacedPayment(\n data: OrderPlacedPaymentSummaryData,\n loading: boolean,\n carriedLastFour: string | null,\n): ResolvedOrderPlacedPayment {\n if (loading && data == null) return { kind: 'loading' };\n if (data == null) return { kind: 'unresolved' };\n if (data.network == null && data.lastFourDigits == null) return { kind: 'no-record' };\n return {\n kind: 'recap',\n network: data.network ?? '',\n // The settled record's own last four always wins; the carried one only fills a gap beside a network.\n lastFourDigits: data.lastFourDigits ?? (data.network == null ? null : carriedLastFour),\n installment: data.installment ?? null,\n };\n}\n\n/** Locale-formats a settled Money value (e.g. \"R$ 600,00\"). Fixed to pt-BR — not because it matches\n * every other default in this component (T31 moved every copy default here to en-US, which falsifies\n * that reasoning) but because this component has no `locale` prop of its own to read instead: adding\n * one is a formatting change, not a copy change, and is out of this task's scope (see OQ-3 in\n * specs/make-the-payment-components-authored-copy.md).\n *\n * `currencyCode` reaches this function already validated: `Money.currencyCode` is `CurrencyCode!`,\n * a GraphQL enum (`base/schema.graphql:186,206`), so a value outside the declared members fails\n * GraphQL's own enum serialization server-side and nulls `total` before it ever reaches a query\n * result — verified against this app's exact `buildSubgraphSchema` wiring (T33 fix pass: an empty\n * string / \"XX\" / \"BRLL\" each produced a `total: null` field error, never a value reaching here).\n * The try/catch below is defense in depth only, for a caller that bypasses that enum entirely (a\n * Storybook fixture, a `$data` override, a future schema change) — never expected to fire against a\n * real query response. */\nfunction formatMoney(money: { amount: string; currencyCode: string }): string {\n try {\n return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: money.currencyCode }).format(\n Number(money.amount),\n );\n } catch {\n return money.amount;\n }\n}\n\n/** A record with a count but no total (never a fabricated amount) renders `installmentCountTemplate` instead. */\nfunction formatInstallmentLine(\n { format }: MessageFormatter<typeof OrderPlacedPaymentSummaryContent>,\n installment: { count: number; total?: { amount: string; currencyCode: string } | null },\n): string {\n const { count, total } = installment;\n if (!total) {\n return format('installmentCountTemplate', { count }).trim();\n }\n return format('installmentTemplate', { count, total: formatMoney(total) }).trim();\n}\n\n// ---------------------------------------------------------------------------\n// Definition\n// ---------------------------------------------------------------------------\n\nexport const OrderPlacedPaymentSummaryDefinition = defineComponent<OrderPlacedPaymentSummaryProps>({\n name: 'OrderPlacedPaymentSummary',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedPaymentSummary,\n fragment,\n fetchStrategy: 'reactive',\n content: OrderPlacedPaymentSummaryContent,\n editor: { label: 'Order Placed Payment Summary', category: 'commerce' },\n schema: {},\n guideline:\n 'Read-only recap, on a post-purchase confirmation surface, of the card the shopper paid with — sourced from the settled order (Query.order), never the live order form. Owns its own fragment; requires no ancestor context, so it composes standalone. Renders exactly one of four states, in strict precedence: nothing while the query is in flight; a role=\"alert\" notice when the order group does not resolve; an informational line when the order resolves with no payment record; or the recap itself (network, plus last four whenever the projection carries one, plus an installment line — count and settled total only, never a per-installment amount or interest rate — whenever the settled record reports one). Never compose it in checkout — the order group it reads does not exist until the order is placed, and no component renders a payment recap there. Its copy is the $content messages lastFourTemplate, noPaymentRecordLabel, unresolvedOrderLabel, installmentTemplate and installmentCountTemplate. Never renders a full card number or CVV. See order-placed-payment-summary.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\n/**\n * Renders the settled order's payment recap on a confirmation surface. Resolves through\n * `resolveOrderPlacedPayment`'s fixed precedence and renders exactly one state: the unresolved\n * notice as an inline `role=\"alert\"` element (FR-6); the no-record line as plain\n * informational text; the in-flight state as nothing at all (Decision 6); the recap as network plus\n * last four (whenever present) plus the installment line (whenever the settled record reports one,\n * T33). Requires no context — composable standalone.\n */\nexport function OrderPlacedPaymentSummary({\n className,\n $content,\n $locale,\n $data: $dataProp,\n}: Readonly<OrderPlacedPaymentSummaryProps>) {\n const $data = useDataOverride($dataProp);\n const messages = useMessageFormatter(OrderPlacedPaymentSummaryContent, $content);\n const { loading } = useContext(ReactiveRootContext);\n const carriedLastFour = useConfirmationLastFour($data?.reference);\n const resolved = resolveOrderPlacedPayment($data ?? null, loading, carriedLastFour);\n\n if (resolved.kind === 'loading') return null;\n\n if (resolved.kind === 'unresolved') {\n return (\n <div\n className={className}\n role=\"alert\"\n data-fs-order-placed-payment-summary=\"\"\n data-fs-order-placed-payment-summary-unresolved=\"\"\n >\n {messages.format('unresolvedOrderLabel')}\n </div>\n );\n }\n\n if (resolved.kind === 'no-record') {\n return (\n <div\n className={className}\n data-fs-order-placed-payment-summary=\"\"\n data-fs-order-placed-payment-summary-no-record=\"\"\n >\n {messages.format('noPaymentRecordLabel')}\n </div>\n );\n }\n\n const { network, lastFourDigits, installment } = resolved;\n // An argument value is inserted literally: lastFourDigits is server-sourced and unconstrained, so a\n // hostile or buggy upstream value can never rewrite the surrounding message text (S1).\n const lastFourText = lastFourDigits ? messages.format('lastFourTemplate', { lastFour: lastFourDigits }) : null;\n // network and lastFourDigits are each independently nullable (schema.graphql:2496-2516,\n // mappers.ts:649-651) — the no-record gate above fires only when BOTH are null (FR-5), so a record\n // carrying just one of them still reaches this branch. Joining only the present parts avoids a\n // leading space (network null, lastFourDigits set) (R2).\n const methodText = [network, lastFourText].filter(Boolean).join(' ');\n // FR-4/FR-6: rendered whenever installment resolves, regardless of the count's value (Open\n // Question 3 — whether to suppress at count <= 1 — is left to a future product decision; this\n // component has no such special case today), and only inside this recap branch.\n const installmentText = installment ? formatInstallmentLine(messages, installment) : null;\n\n return (\n <div className={className} data-fs-order-placed-payment-summary=\"\">\n {methodText ? <p data-fs-order-placed-payment-summary-method=\"\">{methodText}</p> : null}\n {installmentText ? <p data-fs-order-placed-payment-summary-installment=\"\">{installmentText}</p> : null}\n </div>\n );\n}\n"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { ContentValue } from "../../core/dist/define-content-type.js";
1
+ import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
2
2
  import { ComponentDefinition } from "../../core/dist/define-component.js";
3
3
  import "../../core/dist/index.js";
4
4
  import { ComponentPropsWithRef, Ref } from "react";
@@ -14,34 +14,50 @@ export declare const OrderProgressContent: {
14
14
  readonly label: {
15
15
  readonly type: "string";
16
16
  readonly title: "Accessible name";
17
+ readonly format: "icu-message";
18
+ readonly messageSource: "Order progress";
17
19
  };
18
20
  readonly placed: {
19
21
  readonly type: "string";
20
22
  readonly title: "Order placed";
23
+ readonly format: "icu-message";
24
+ readonly messageSource: "Order placed";
21
25
  };
22
26
  readonly payment: {
23
27
  readonly type: "string";
24
28
  readonly title: "Payment";
29
+ readonly format: "icu-message";
30
+ readonly messageSource: "Payment";
25
31
  };
26
32
  readonly processing: {
27
33
  readonly type: "string";
28
34
  readonly title: "Processing";
35
+ readonly format: "icu-message";
36
+ readonly messageSource: "Processing";
29
37
  };
30
38
  readonly shipping: {
31
39
  readonly type: "string";
32
40
  readonly title: "Shipping";
41
+ readonly format: "icu-message";
42
+ readonly messageSource: "Shipping";
33
43
  };
34
44
  readonly stateDone: {
35
45
  readonly type: "string";
36
46
  readonly title: "Completed";
47
+ readonly format: "icu-message";
48
+ readonly messageSource: "Completed";
37
49
  };
38
50
  readonly stateCurrent: {
39
51
  readonly type: "string";
40
52
  readonly title: "In progress";
53
+ readonly format: "icu-message";
54
+ readonly messageSource: "In progress";
41
55
  };
42
56
  readonly statePending: {
43
57
  readonly type: "string";
44
58
  readonly title: "Not started";
59
+ readonly format: "icu-message";
60
+ readonly messageSource: "Not started";
45
61
  };
46
62
  };
47
63
  };
@@ -67,18 +83,13 @@ export type OrderProgressOrder = {
67
83
  * that field's value, so this is the order itself, or null when the read resolves nothing.
68
84
  */
69
85
  export type OrderProgressData = OrderProgressOrder | null;
70
- export type OrderProgressProps = Readonly<{
86
+ export type OrderProgressProps = MessageLocaleProp & Readonly<{
71
87
  $data?: OrderProgressData | null;
72
88
  $content?: OrderProgressContentValue;
73
89
  className?: string;
74
90
  ref?: Ref<HTMLOListElement>;
75
91
  }>;
76
- export declare const OrderProgressDefinition: ComponentDefinition<Readonly<{
77
- $data?: OrderProgressData | null;
78
- $content?: OrderProgressContentValue;
79
- className?: string;
80
- ref?: Ref<HTMLOListElement>;
81
- }>>;
92
+ export declare const OrderProgressDefinition: ComponentDefinition<OrderProgressProps>;
82
93
  export declare function OrderProgressSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>): import("react/jsx-runtime").JSX.Element;
83
94
  export declare function OrderProgress({ $data, $content, className, ref }: OrderProgressProps): import("react/jsx-runtime").JSX.Element | null;
84
95
  //#endregion
@@ -2,7 +2,7 @@
2
2
  import { defineComponent } from "../../core/dist/define-component.js";
3
3
  import { defineContentType } from "../../core/dist/define-content-type.js";
4
4
  import "../../core/dist/index.js";
5
- import { useIntl } from "../../sdk/i18n/client.js";
5
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/matter/order-progress/order-progress.tsx
8
8
  const fragment = `
@@ -31,55 +31,66 @@ const OrderProgressContent = defineContentType({
31
31
  properties: {
32
32
  label: {
33
33
  type: "string",
34
- title: "Accessible name"
34
+ title: "Accessible name",
35
+ format: "icu-message",
36
+ messageSource: "Order progress"
35
37
  },
36
38
  placed: {
37
39
  type: "string",
38
- title: "Order placed"
40
+ title: "Order placed",
41
+ format: "icu-message",
42
+ messageSource: "Order placed"
39
43
  },
40
44
  payment: {
41
45
  type: "string",
42
- title: "Payment"
46
+ title: "Payment",
47
+ format: "icu-message",
48
+ messageSource: "Payment"
43
49
  },
44
50
  processing: {
45
51
  type: "string",
46
- title: "Processing"
52
+ title: "Processing",
53
+ format: "icu-message",
54
+ messageSource: "Processing"
47
55
  },
48
56
  shipping: {
49
57
  type: "string",
50
- title: "Shipping"
58
+ title: "Shipping",
59
+ format: "icu-message",
60
+ messageSource: "Shipping"
51
61
  },
52
62
  stateDone: {
53
63
  type: "string",
54
- title: "Completed"
64
+ title: "Completed",
65
+ format: "icu-message",
66
+ messageSource: "Completed"
55
67
  },
56
68
  stateCurrent: {
57
69
  type: "string",
58
- title: "In progress"
70
+ title: "In progress",
71
+ format: "icu-message",
72
+ messageSource: "In progress"
59
73
  },
60
74
  statePending: {
61
75
  type: "string",
62
- title: "Not started"
76
+ title: "Not started",
77
+ format: "icu-message",
78
+ messageSource: "Not started"
63
79
  }
64
80
  }
65
81
  }
66
82
  });
83
+ /** Each stage's name is also the message field that labels it. */
67
84
  const STAGES = [
68
85
  "placed",
69
86
  "payment",
70
87
  "processing",
71
88
  "shipping"
72
89
  ];
73
- const STAGE_LABELS = {
74
- placed: "fs/order.stage.placed",
75
- payment: "fs/order.stage.payment",
76
- processing: "fs/order.stage.processing",
77
- shipping: "fs/order.stage.shipping"
78
- };
79
- const STATE_LABELS = {
80
- done: "fs/order.stage-state.done",
81
- current: "fs/order.stage-state.current",
82
- pending: "fs/order.stage-state.pending"
90
+ const STATE_FIELDS = {
91
+ done: "stateDone",
92
+ current: "stateCurrent",
93
+ pending: "statePending"
83
94
  };
84
95
  const OrderProgressDefinition = defineComponent({
85
96
  name: "OrderProgress",
@@ -94,11 +105,8 @@ const OrderProgressDefinition = defineComponent({
94
105
  category: "content"
95
106
  },
96
107
  schema: {},
97
- guideline: "Four stages of one order on the order page: placed, payment, processing, shipping, with a line up to the current one. Stage names and state sentences are content; a blank field keeps the catalogue. Reads the stage the API resolved; style each stage through its state hook."
108
+ guideline: "Four stages of one order on the order page: placed, payment, processing, shipping, with a line up to the current one. Stage names and state sentences are content. Reads the stage the API resolved; style each stage through its state hook."
98
109
  });
99
- function authored(value, fallback) {
100
- return value?.trim() || fallback;
101
- }
102
110
  function currentStage(value) {
103
111
  switch (value) {
104
112
  case "PAYMENT": return "payment";
@@ -138,36 +146,20 @@ function OrderProgressSkeleton({ className, ...props }) {
138
146
  children: STAGES.map((stage) => /* @__PURE__ */ jsx("span", { "data-fs-order-progress-skeleton-stage": "" }, stage))
139
147
  });
140
148
  }
141
- function stageSentence(stage, content) {
142
- switch (stage) {
143
- case "placed": return content?.placed;
144
- case "payment": return content?.payment;
145
- case "processing": return content?.processing;
146
- case "shipping": return content?.shipping;
147
- }
148
- }
149
- function stateSentence(state, content) {
150
- switch (state) {
151
- case "done": return content?.stateDone;
152
- case "current": return content?.stateCurrent;
153
- case "pending": return content?.statePending;
154
- default: return;
155
- }
156
- }
157
149
  function OrderProgress({ $data, $content, className, ref }) {
158
- const intl = useIntl();
150
+ const { format } = useMessageFormatter(OrderProgressContent, $content);
159
151
  const order = $data;
160
152
  if (!order) return null;
161
153
  const stages = stageModels(order);
162
154
  return /* @__PURE__ */ jsx("ol", {
163
155
  ref,
164
- "aria-label": authored($content?.label, intl.formatMessage({ id: "fs/order.progress.label" })),
156
+ "aria-label": format("label"),
165
157
  className,
166
158
  "data-fs-order-progress": "",
167
159
  "data-fs-order-progress-current": currentStage(order.progress.stage),
168
160
  "data-fs-order-progress-cancelled": order.progress.cancelled ? "" : void 0,
169
161
  children: stages.map(({ stage, state, line }) => {
170
- const statusLabel = STATE_LABELS[state];
162
+ const stateField = STATE_FIELDS[state];
171
163
  return /* @__PURE__ */ jsxs("li", {
172
164
  "data-fs-order-progress-stage": stage,
173
165
  "data-fs-order-progress-stage-state": state,
@@ -186,11 +178,11 @@ function OrderProgress({ $data, $content, className, ref }) {
186
178
  }),
187
179
  /* @__PURE__ */ jsx("span", {
188
180
  "data-fs-order-progress-label": "",
189
- children: authored(stageSentence(stage, $content), intl.formatMessage({ id: STAGE_LABELS[stage] }))
181
+ children: format(stage)
190
182
  }),
191
- statusLabel ? /* @__PURE__ */ jsx("span", {
183
+ stateField ? /* @__PURE__ */ jsx("span", {
192
184
  "data-fs-order-progress-status": "",
193
- children: authored(stateSentence(state, $content), intl.formatMessage({ id: statusLabel }))
185
+ children: format(stateField)
194
186
  }) : null
195
187
  ]
196
188
  }, stage);