@vtex/faststore 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (509) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +0 -1
  3. package/dist/_virtual/_rolldown/runtime.js +4 -0
  4. package/dist/actions.json +6 -1
  5. package/dist/catalog.json +789 -1701
  6. package/dist/cli/index.d.ts +66 -28
  7. package/dist/cli/index.js +7371 -512
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/server-runtime.js +41 -60
  10. package/dist/cli/server-runtime.js.map +1 -1
  11. package/dist/client.d.ts +3 -3
  12. package/dist/client.js +2 -2
  13. package/dist/components.d.ts +63 -57
  14. package/dist/components.js +60 -54
  15. package/dist/content-types.json +5785 -754
  16. package/dist/core/dist/define-component.d.ts +1 -1
  17. package/dist/core/dist/define-content-type.d.ts +50 -2
  18. package/dist/core/dist/define-content-type.js +107 -3
  19. package/dist/core/dist/define-content-type.js.map +1 -1
  20. package/dist/core/dist/index.d.ts +2 -2
  21. package/dist/docs/access-code-field.md +1 -1
  22. package/dist/docs/access-code-sign-in.md +126 -77
  23. package/dist/docs/account-address-book.md +210 -95
  24. package/dist/docs/account-menu.md +14 -15
  25. package/dist/docs/account-saved-cards.md +44 -39
  26. package/dist/docs/alert-dialog.md +3 -1
  27. package/dist/docs/avatar.md +4 -2
  28. package/dist/docs/billing-address.md +99 -30
  29. package/dist/docs/binding-switcher.md +5 -2
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +39 -26
  32. package/dist/docs/card-summary.md +18 -8
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +39 -26
  36. package/dist/docs/cart-item.md +29 -14
  37. package/dist/docs/cart-totalizer.md +7 -5
  38. package/dist/docs/cart.md +135 -41
  39. package/dist/docs/challenge-return.md +135 -0
  40. package/dist/docs/client-preferences-fieldset.md +10 -5
  41. package/dist/docs/client-preferences.md +31 -8
  42. package/dist/docs/client-profile-fieldset.md +20 -6
  43. package/dist/docs/client-profile.md +12 -3
  44. package/dist/docs/copy-text.md +9 -7
  45. package/dist/docs/document-field.md +1 -1
  46. package/dist/docs/email-field.md +2 -1
  47. package/dist/docs/email-identification.md +12 -2
  48. package/dist/docs/footer-copyright.md +4 -2
  49. package/dist/docs/form.md +54 -18
  50. package/dist/docs/free-shipping-progress.md +6 -5
  51. package/dist/docs/identity-edit.md +8 -2
  52. package/dist/docs/identity-summary.md +18 -5
  53. package/dist/docs/installments.md +46 -32
  54. package/dist/docs/my-account-profile.md +16 -11
  55. package/dist/docs/navigation-link.md +5 -3
  56. package/dist/docs/order-cancel.md +3 -1
  57. package/dist/docs/order-delivery-address.md +7 -5
  58. package/dist/docs/order-delivery-group.md +1 -3
  59. package/dist/docs/order-details-back.md +1 -1
  60. package/dist/docs/order-details-header.md +1 -4
  61. package/dist/docs/order-invoice-download.md +60 -0
  62. package/dist/docs/order-list-row.md +1 -1
  63. package/dist/docs/order-list-search.md +13 -20
  64. package/dist/docs/order-list-views.md +11 -17
  65. package/dist/docs/order-list.md +12 -5
  66. package/dist/docs/order-payment.md +9 -7
  67. package/dist/docs/order-placed-date.md +1 -1
  68. package/dist/docs/order-placed-payment-summary.md +28 -15
  69. package/dist/docs/order-placed.md +49 -14
  70. package/dist/docs/order-progress.md +1 -1
  71. package/dist/docs/order-status-badge.md +20 -9
  72. package/dist/docs/order-summary.md +2 -2
  73. package/dist/docs/order-tracking-link.md +58 -0
  74. package/dist/docs/payment-method-badges.md +30 -4
  75. package/dist/docs/payment-methods.md +1 -1
  76. package/dist/docs/payment.md +36 -17
  77. package/dist/docs/phone-field.md +4 -4
  78. package/dist/docs/place-order.md +84 -36
  79. package/dist/docs/postal-code-field.md +3 -1
  80. package/dist/docs/pricing.md +21 -23
  81. package/dist/docs/product-gallery.md +19 -20
  82. package/dist/docs/product-information.md +13 -9
  83. package/dist/docs/product-list.md +7 -6
  84. package/dist/docs/product-shelf.md +0 -1
  85. package/dist/docs/promotion.md +4 -2
  86. package/dist/docs/region.md +23 -15
  87. package/dist/docs/save-card.md +7 -6
  88. package/dist/docs/saved-cards.md +65 -36
  89. package/dist/docs/shipping-address.md +57 -21
  90. package/dist/docs/shipping-simulator.md +53 -15
  91. package/dist/docs/sign-in-disclosure.md +176 -0
  92. package/dist/docs/sign-in-form.md +78 -47
  93. package/dist/docs/sign-in-redirect.md +4 -2
  94. package/dist/docs/sign-in.md +173 -0
  95. package/dist/docs/toast.md +15 -4
  96. package/dist/docs/variant-selector.md +15 -11
  97. package/dist/domain-logic/dist/checkout/rules.js +33 -0
  98. package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
  99. package/dist/graphql/types.d.ts +4 -14
  100. package/dist/index.d.ts +2 -2
  101. package/dist/internal/client.d.ts +1 -3
  102. package/dist/internal/client.js +1 -1
  103. package/dist/internal/server.d.ts +7 -4
  104. package/dist/internal/server.js +7 -4
  105. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  106. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  108. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  109. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  110. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  111. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  112. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  113. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  114. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  115. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  116. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  117. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  118. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  120. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  121. package/dist/matter/account-address-book/account-address-book.js +74 -33
  122. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  123. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  124. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  126. package/dist/matter/account-address-book/account-address-country.js +83 -49
  127. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  128. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  129. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  131. package/dist/matter/account-address-book/account-address-form.js +518 -155
  132. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  133. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  134. package/dist/matter/account-address-book/account-address-record.js +32 -17
  135. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  136. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  137. package/dist/matter/account-menu/account-menu.js +46 -54
  138. package/dist/matter/account-menu/account-menu.js.map +1 -1
  139. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  140. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
  141. package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
  142. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
  143. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  144. package/dist/matter/billing-address/billing-address.js +227 -156
  145. package/dist/matter/billing-address/billing-address.js.map +1 -1
  146. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  147. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  148. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  149. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  150. package/dist/matter/buy-button/buy-button.js +10 -19
  151. package/dist/matter/buy-button/buy-button.js.map +1 -1
  152. package/dist/matter/card-entry/card-capture.js +12 -4
  153. package/dist/matter/card-entry/card-capture.js.map +1 -1
  154. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  155. package/dist/matter/card-entry/card-entry.js +348 -221
  156. package/dist/matter/card-entry/card-entry.js.map +1 -1
  157. package/dist/matter/cart/cart-namespace.d.ts +7 -1
  158. package/dist/matter/cart/cart-namespace.js +7 -1
  159. package/dist/matter/cart/cart-namespace.js.map +1 -1
  160. package/dist/matter/cart/cart.d.ts +402 -61
  161. package/dist/matter/cart/cart.js +624 -153
  162. package/dist/matter/cart/cart.js.map +1 -1
  163. package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
  164. package/dist/matter/cart-destination/cart-destination.js +160 -70
  165. package/dist/matter/cart-destination/cart-destination.js.map +1 -1
  166. package/dist/matter/cart-item/cart-item.d.ts +144 -17
  167. package/dist/matter/cart-item/cart-item.js +166 -49
  168. package/dist/matter/cart-item/cart-item.js.map +1 -1
  169. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  170. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  171. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  172. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  173. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  174. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  175. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  176. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  177. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  178. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  179. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  180. package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
  181. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  182. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  183. package/dist/matter/challenge-return/challenge-return.js +241 -0
  184. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  185. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  186. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  187. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  188. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  189. package/dist/matter/client-preferences/client-preferences.js +84 -15
  190. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  191. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  192. package/dist/matter/client-profile/client-profile.js +64 -24
  193. package/dist/matter/client-profile/client-profile.js.map +1 -1
  194. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  195. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  196. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  197. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  198. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  199. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  200. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  201. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  202. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  203. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  204. package/dist/matter/delivery-options/delivery-options.js +75 -12
  205. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  206. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  207. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  209. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  210. package/dist/matter/email-identification/email-identification.js +49 -12
  211. package/dist/matter/email-identification/email-identification.js.map +1 -1
  212. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
  213. package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  215. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  216. package/dist/matter/identity-edit/identity-edit.js +47 -19
  217. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  218. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  219. package/dist/matter/identity-summary/identity-summary.js +95 -45
  220. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  221. package/dist/matter/installments/installments-select.d.ts +98 -16
  222. package/dist/matter/installments/installments-select.js +156 -48
  223. package/dist/matter/installments/installments-select.js.map +1 -1
  224. package/dist/matter/installments/installments.d.ts +96 -16
  225. package/dist/matter/installments/installments.js +115 -40
  226. package/dist/matter/installments/installments.js.map +1 -1
  227. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  228. package/dist/matter/installments/use-installments-selection.js +8 -3
  229. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  230. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  231. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  232. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  233. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  234. package/dist/matter/order-cancel/order-cancel.js +118 -51
  235. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  236. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  237. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  238. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  239. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  240. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  241. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  242. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  243. package/dist/matter/order-details-header/order-details-header.js +66 -58
  244. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  245. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  246. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  247. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  248. package/dist/matter/order-list/order-list.d.ts +164 -19
  249. package/dist/matter/order-list/order-list.js +229 -87
  250. package/dist/matter/order-list/order-list.js.map +1 -1
  251. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  252. package/dist/matter/order-list-row/order-list-row.js +3 -2
  253. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  254. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  255. package/dist/matter/order-list-search/order-list-search.js +30 -69
  256. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  257. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  258. package/dist/matter/order-list-views/order-list-views.js +22 -68
  259. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  260. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  261. package/dist/matter/order-payment/order-payment.js +44 -39
  262. package/dist/matter/order-payment/order-payment.js.map +1 -1
  263. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  264. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  265. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  266. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  267. package/dist/matter/order-placed/order-placed.js +230 -139
  268. package/dist/matter/order-placed/order-placed.js.map +1 -1
  269. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  270. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  271. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  272. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  273. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  275. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  276. package/dist/matter/order-progress/order-progress.js +37 -45
  277. package/dist/matter/order-progress/order-progress.js.map +1 -1
  278. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  279. package/dist/matter/order-summary/order-summary.js +38 -44
  280. package/dist/matter/order-summary/order-summary.js.map +1 -1
  281. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  282. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  283. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  284. package/dist/matter/payment/payment-card-capture.js +17 -10
  285. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  286. package/dist/matter/payment/payment-controller.d.ts +4 -2
  287. package/dist/matter/payment/payment-controller.js +30 -9
  288. package/dist/matter/payment/payment-controller.js.map +1 -1
  289. package/dist/matter/payment/payment-method-badges.js +1 -1
  290. package/dist/matter/payment/payment.d.ts +69 -19
  291. package/dist/matter/payment/payment.js +101 -35
  292. package/dist/matter/payment/payment.js.map +1 -1
  293. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  294. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  295. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  296. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  297. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  298. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  299. package/dist/matter/place-order/place-order.d.ts +171 -57
  300. package/dist/matter/place-order/place-order.js +376 -185
  301. package/dist/matter/place-order/place-order.js.map +1 -1
  302. package/dist/matter/pricing/pricing.d.ts +152 -13
  303. package/dist/matter/pricing/pricing.js +153 -52
  304. package/dist/matter/pricing/pricing.js.map +1 -1
  305. package/dist/matter/product-information/product-information.d.ts +27 -4
  306. package/dist/matter/product-information/product-information.js +32 -15
  307. package/dist/matter/product-information/product-information.js.map +1 -1
  308. package/dist/matter/product-list/product-list.d.ts +24 -6
  309. package/dist/matter/product-list/product-list.js +32 -26
  310. package/dist/matter/product-list/product-list.js.map +1 -1
  311. package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
  312. package/dist/matter/product-shelf/product-shelf.js +2 -15
  313. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  314. package/dist/matter/region/region.d.ts +33 -16
  315. package/dist/matter/region/region.js +59 -52
  316. package/dist/matter/region/region.js.map +1 -1
  317. package/dist/matter/save-card/save-card.d.ts +43 -8
  318. package/dist/matter/save-card/save-card.js +61 -23
  319. package/dist/matter/save-card/save-card.js.map +1 -1
  320. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  321. package/dist/matter/saved-cards/saved-cards.js +349 -77
  322. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  323. package/dist/matter/shipping-address/address-payload.js +25 -0
  324. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  325. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  326. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  327. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  328. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  329. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  330. package/dist/matter/shipping-address/shipping-address.js +443 -188
  331. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  332. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
  333. package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
  334. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  335. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  336. package/dist/matter/sign-in/sign-in.js +285 -0
  337. package/dist/matter/sign-in/sign-in.js.map +1 -0
  338. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  339. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  341. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  342. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  343. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  344. package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
  345. package/dist/particles/binding-switcher/binding-switcher.js +37 -26
  346. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
  347. package/dist/particles/card-summary/card-summary.d.ts +38 -8
  348. package/dist/particles/card-summary/card-summary.js +55 -22
  349. package/dist/particles/card-summary/card-summary.js.map +1 -1
  350. package/dist/particles/carousel/carousel.d.ts +99 -11
  351. package/dist/particles/carousel/carousel.js +103 -35
  352. package/dist/particles/carousel/carousel.js.map +1 -1
  353. package/dist/particles/copy-text/copy-text.js +5 -15
  354. package/dist/particles/copy-text/copy-text.js.map +1 -1
  355. package/dist/particles/dialog/dialog.d.ts +14 -6
  356. package/dist/particles/dialog/dialog.js +6 -3
  357. package/dist/particles/dialog/dialog.js.map +1 -1
  358. package/dist/particles/drawer/drawer.js +1 -1
  359. package/dist/particles/drawer/drawer.js.map +1 -1
  360. package/dist/particles/email-field/email-field.d.ts +2 -1
  361. package/dist/particles/email-field/email-field.js +2 -1
  362. package/dist/particles/email-field/email-field.js.map +1 -1
  363. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  364. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  365. package/dist/particles/form/form.d.ts +85 -13
  366. package/dist/particles/form/form.js +91 -42
  367. package/dist/particles/form/form.js.map +1 -1
  368. package/dist/particles/gallery/gallery.d.ts +129 -12
  369. package/dist/particles/gallery/gallery.js +121 -34
  370. package/dist/particles/gallery/gallery.js.map +1 -1
  371. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  372. package/dist/particles/order-details-back/order-details-back.js +8 -10
  373. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  374. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  375. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  376. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  377. package/dist/particles/password-field/password-field.d.ts +1 -1
  378. package/dist/particles/password-field/password-field.js +2 -4
  379. package/dist/particles/password-field/password-field.js.map +1 -1
  380. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  381. package/dist/particles/phone-field/phone-field.js +8 -11
  382. package/dist/particles/phone-field/phone-field.js.map +1 -1
  383. package/dist/particles/spinner/spinner.d.ts +24 -4
  384. package/dist/particles/spinner/spinner.js +25 -9
  385. package/dist/particles/spinner/spinner.js.map +1 -1
  386. package/dist/particles/switch/switch.d.ts +4 -1
  387. package/dist/particles/switch/switch.js +3 -1
  388. package/dist/particles/switch/switch.js.map +1 -1
  389. package/dist/particles/toast/toast.d.ts +29 -3
  390. package/dist/particles/toast/toast.js +34 -10
  391. package/dist/particles/toast/toast.js.map +1 -1
  392. package/dist/schema.graphql +164 -56
  393. package/dist/sdk/address/address-fields.js +4 -4
  394. package/dist/sdk/address/address-fields.js.map +1 -1
  395. package/dist/sdk/address/constants.js +1 -6
  396. package/dist/sdk/address/constants.js.map +1 -1
  397. package/dist/sdk/address/messages.js +44 -44
  398. package/dist/sdk/address/messages.js.map +1 -1
  399. package/dist/sdk/address/postal-code.js +15 -2
  400. package/dist/sdk/address/postal-code.js.map +1 -1
  401. package/dist/sdk/address/types.d.ts +5 -3
  402. package/dist/sdk/address/validate-address.js +3 -3
  403. package/dist/sdk/address/validate-address.js.map +1 -1
  404. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  405. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  406. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  407. package/dist/sdk/data/index.js +2 -2
  408. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  409. package/dist/sdk/generated/gql.js +1 -1
  410. package/dist/sdk/generated/gql.js.map +1 -1
  411. package/dist/sdk/generated/graphql.d.ts +20 -5
  412. package/dist/sdk/generated/graphql.js +6 -0
  413. package/dist/sdk/generated/graphql.js.map +1 -1
  414. package/dist/sdk/i18n/format-error-code.js +23 -0
  415. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  416. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  417. package/dist/sdk/i18n/message-formatter.js +140 -0
  418. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  419. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  420. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  421. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  422. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  423. package/dist/sdk/navigation/redirect.d.ts +2 -0
  424. package/dist/sdk/navigation/redirect.js +19 -1
  425. package/dist/sdk/navigation/redirect.js.map +1 -1
  426. package/dist/sdk/navigation/types.d.ts +13 -0
  427. package/dist/sdk/payment/bin-format.js +21 -0
  428. package/dist/sdk/payment/bin-format.js.map +1 -0
  429. package/dist/sdk/payment/challenge-return.js +37 -0
  430. package/dist/sdk/payment/challenge-return.js.map +1 -0
  431. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  432. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  433. package/dist/sdk/payment/gateway.d.ts +1 -1
  434. package/dist/sdk/payment/gateway.js +8 -2
  435. package/dist/sdk/payment/gateway.js.map +1 -1
  436. package/dist/sdk/payment/operations.d.ts +1 -0
  437. package/dist/sdk/payment/operations.js +28 -6
  438. package/dist/sdk/payment/operations.js.map +1 -1
  439. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  440. package/dist/sdk/payment/resumed-purchase.js +119 -0
  441. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  442. package/dist/sdk/payment/security-code-mask.js +16 -23
  443. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  444. package/dist/sdk/payment/submission-registry.js +6 -2
  445. package/dist/sdk/payment/submission-registry.js.map +1 -1
  446. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  447. package/dist/sdk/payment/use-payment-actions.js +23 -4
  448. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  449. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  450. package/dist/sdk/payment/use-place-order.js +138 -76
  451. package/dist/sdk/payment/use-place-order.js.map +1 -1
  452. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  453. package/dist/sdk/provider/storefront-provider.js +4 -11
  454. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  455. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  456. package/dist/sdk/seo/entity-landing.js +30 -0
  457. package/dist/sdk/seo/entity-landing.js.map +1 -0
  458. package/dist/sdk/seo/page-alternates.d.ts +3 -2
  459. package/dist/sdk/seo/page-alternates.js +4 -2
  460. package/dist/sdk/seo/page-alternates.js.map +1 -1
  461. package/dist/sdk/seo/search-landing.d.ts +42 -0
  462. package/dist/sdk/seo/search-landing.js +85 -0
  463. package/dist/sdk/seo/search-landing.js.map +1 -0
  464. package/dist/sdk/session/mock-session.d.ts +9 -0
  465. package/dist/sdk/session/mock-session.js +31 -0
  466. package/dist/sdk/session/mock-session.js.map +1 -0
  467. package/dist/sdk/session/read-server-session.d.ts +3 -0
  468. package/dist/sdk/session/read-server-session.js +5 -0
  469. package/dist/sdk/session/read-server-session.js.map +1 -1
  470. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  471. package/dist/sdk/session/return-path-segment.js +15 -0
  472. package/dist/sdk/session/return-path-segment.js.map +1 -0
  473. package/dist/sdk/session/use-session-actions.js.map +1 -1
  474. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  475. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  476. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  477. package/dist/utils/safe-href.d.ts +2 -0
  478. package/package.json +4 -3
  479. package/skills/storefront-asset/SKILL.md +2 -2
  480. package/skills/storefront-asset/references/api-side.md +27 -14
  481. package/skills/storefront-asset/references/findings.md +5 -2
  482. package/src/styles/tailwind.css +8 -0
  483. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  484. package/dist/message-locales.json +0 -7
  485. package/dist/sdk/i18n/client.d.ts +0 -4
  486. package/dist/sdk/i18n/client.js +0 -4
  487. package/dist/sdk/i18n/locales.d.ts +0 -8
  488. package/dist/sdk/i18n/locales.js +0 -57
  489. package/dist/sdk/i18n/locales.js.map +0 -1
  490. package/dist/sdk/i18n/messages/en-US.js +0 -183
  491. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  492. package/dist/sdk/i18n/messages/en-US.json +0 -178
  493. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
  494. package/dist/sdk/i18n/messages/es-ES.js +0 -183
  495. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  496. package/dist/sdk/i18n/messages/es-ES.json +0 -178
  497. package/dist/sdk/i18n/messages/pt-BR.js +0 -183
  498. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  499. package/dist/sdk/i18n/messages/pt-BR.json +0 -178
  500. package/dist/sdk/i18n/provider.d.ts +0 -1
  501. package/dist/sdk/i18n/provider.js +0 -30
  502. package/dist/sdk/i18n/provider.js.map +0 -1
  503. package/dist/sdk/i18n/server.d.ts +0 -28
  504. package/dist/sdk/i18n/server.js +0 -59
  505. package/dist/sdk/i18n/server.js.map +0 -1
  506. package/dist/utils/resolve-authored-copy.js +0 -18
  507. package/dist/utils/resolve-authored-copy.js.map +0 -1
  508. package/dist/utils/substitute-template.js +0 -33
  509. package/dist/utils/substitute-template.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"binding-switcher.js","names":[],"sources":["../../../src/particles/binding-switcher/binding-switcher.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useStorefrontRoute } from '../../sdk/navigation/use-storefront-route.js';\nimport { resolveAuthoredCopy } from '../../utils/resolve-authored-copy.js';\nimport { Select } from '../select/select.js';\n\nexport type BindingSwitcherBinding = {\n locale?: unknown;\n currency?: unknown;\n salesChannel?: unknown;\n url?: unknown;\n country?: unknown;\n timezone?: unknown;\n};\n\ntype BindingSwitcherOption = {\n id: string;\n label: string;\n};\n\n/**\n * `foundation.json` `localization.bindings`, keyed by binding id. An entry counts only when it is an\n * own key, the value is a non-null object, and `locale` is a string. Fewer than two counted\n * entries yields an empty list.\n */\nexport function bindingSwitcherOptions(\n bindings: Record<string, BindingSwitcherBinding> | null | undefined,\n activeLocale: string,\n): { id: string; label: string }[] {\n if (bindings == null) return [];\n\n const counted: { id: string; locale: string; currency: unknown }[] = [];\n for (const [id, value] of Object.entries(bindings)) {\n if (!isCountedBinding(value)) continue;\n counted.push({ id, locale: value.locale, currency: value.currency });\n }\n if (counted.length < 2) return [];\n\n const localeCount = new Map<string, number>();\n for (const entry of counted) {\n localeCount.set(entry.locale, (localeCount.get(entry.locale) ?? 0) + 1);\n }\n\n const options = counted.map((entry) => {\n let label = languageName(entry.locale);\n const shared = (localeCount.get(entry.locale) ?? 0) > 1;\n if (shared && typeof entry.currency === 'string' && entry.currency.length > 0) {\n label += ` (${entry.currency})`;\n }\n return { id: entry.id, label };\n });\n\n options.sort((a, b) => compareOptions(a, b, activeLocale));\n return options;\n}\n\nfunction isCountedBinding(value: unknown): value is BindingSwitcherBinding & { locale: string } {\n return typeof value === 'object' && value !== null && typeof (value as BindingSwitcherBinding).locale === 'string';\n}\n\nfunction languageName(locale: string): string {\n try {\n const name = new Intl.DisplayNames([locale], { type: 'language', languageDisplay: 'standard' }).of(locale);\n if (!name) return locale;\n return name;\n } catch {\n return locale;\n }\n}\n\nfunction compareOptions(a: BindingSwitcherOption, b: BindingSwitcherOption, activeLocale: string): number {\n try {\n return a.label.localeCompare(b.label, activeLocale) || a.id.localeCompare(b.id, activeLocale);\n } catch {\n return a.label.localeCompare(b.label) || a.id.localeCompare(b.id);\n }\n}\n\nexport const NOTICE_DEFAULT = \"This page isn't available in the selected language.\";\n/** How long the control stays disabled after a started navigation that never unloads the page. */\nconst NAVIGATION_TIMEOUT_MS = 10_000;\n\nexport const LABEL_DEFAULT = 'Language';\n\nexport type BindingSwitcherProps = Omit<ComponentPropsWithRef<'div'>, 'children'> & {\n /** `foundation.json` `localization.bindings`, keyed by binding id. No library default. */\n bindings?: Record<string, BindingSwitcherBinding> | null;\n /** Accessible name, rendered as `Select.Label`. */\n label?: string;\n /** Shown when the page loaded with `fs_notice=no-equivalent`. */\n notice?: string;\n /** Injected from `actions: { locale: ['set'] }`. */\n $actions?: ComponentActions;\n};\n\nexport const BindingSwitcherDefinition = defineComponent<BindingSwitcherProps>({\n name: 'BindingSwitcher',\n importPath: '@vtex/faststore/components',\n component: BindingSwitcher,\n editor: { label: 'Binding Switcher', category: 'action' },\n actions: { locale: ['set'] },\n schema: {\n bindings: { type: 'object', label: 'Bindings' },\n // Inline rather than `LABEL_DEFAULT` / `NOTICE_DEFAULT`: the catalog scanner reads this file\n // statically and drops a nested identifier it cannot evaluate. The strings match those constants.\n label: { type: 'string', default: 'Language', label: 'Label' },\n notice: {\n type: 'string',\n default: \"This page isn't available in the selected language.\",\n label: 'Notice',\n },\n },\n guideline:\n 'Lists the bindings a store declares and switches the whole binding (locale, currency, sales channel) through locale.set. Renders nothing when fewer than two bindings are present; the store passes bindings as $data.Global.localization.bindings.',\n});\n\nexport function BindingSwitcher({\n bindings,\n label,\n notice,\n $actions: $actionsProp,\n className,\n ...props\n}: BindingSwitcherProps) {\n const $actions = useActionsOverride($actionsProp);\n const { bindingId, locale } = useStorefrontContext();\n const options = useMemo(() => bindingSwitcherOptions(bindings, locale), [bindings, locale]);\n const [pending, setPending] = useState(false);\n const { path } = useStorefrontRoute();\n // The path the notice arrived on: the layout stays mounted across client navigations, and the\n // notice belongs to that one visit of the page it was shown on.\n const [noticePath, setNoticePath] = useState<string | null>(null);\n const noticeVisible = noticePath !== null && noticePath === path;\n const pendingTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const labelText = resolveAuthoredCopy(label, LABEL_DEFAULT);\n const noticeText = resolveAuthoredCopy(notice, NOTICE_DEFAULT);\n const optionCount = options.length;\n\n // Hidden on the first render. `location` is read after mount so the notice cannot mismatch\n // hydration, and so a store with fewer than two bindings leaves the query alone.\n useEffect(() => {\n if (optionCount < 2) return;\n const url = new URL(globalThis.location.href);\n if (url.searchParams.get('fs_notice') !== 'no-equivalent') return;\n setNoticePath(path);\n url.searchParams.delete('fs_notice');\n globalThis.history.replaceState(globalThis.history.state, '', `${url.pathname}${url.search}${url.hash}`);\n }, [optionCount, path]);\n\n useEffect(() => {\n if (noticePath !== null && path !== noticePath) setNoticePath(null);\n }, [noticePath, path]);\n\n // A page restored from the back/forward cache comes back with the state it left with.\n useEffect(() => {\n function onPageShow(event: PageTransitionEvent) {\n if (!event.persisted) return;\n clearTimeout(pendingTimeout.current);\n setPending(false);\n }\n globalThis.addEventListener('pageshow', onPageShow);\n return () => {\n globalThis.removeEventListener('pageshow', onPageShow);\n clearTimeout(pendingTimeout.current);\n };\n }, []);\n\n async function handleChange(value: string | null) {\n if (value === null || value === bindingId) return;\n const set = $actions?.locale?.set;\n if (!set) {\n console.error('[BindingSwitcher] no locale.set');\n return;\n }\n setPending(true);\n let navigated = false;\n try {\n navigated = (await set({ bindingId: value })) === true;\n } finally {\n // A started navigation keeps the control disabled until the next document replaces this one, or\n // until the timeout when the page never unloads (a cancelled `beforeunload`, a 204, a download).\n if (navigated) {\n pendingTimeout.current = setTimeout(() => setPending(false), NAVIGATION_TIMEOUT_MS);\n } else {\n setPending(false);\n }\n }\n }\n\n if (optionCount < 2) return null;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-binding-switcher=\"\"\n aria-busy={pending || undefined}\n {...(pending ? { 'data-fs-binding-switcher-pending': '' } : {})}\n >\n {noticeVisible ? <output data-fs-binding-switcher-notice=\"\">{noticeText}</output> : null}\n <Select.Root value={bindingId} onValueChange={handleChange} disabled={pending}>\n <Select.Label>{labelText}</Select.Label>\n <Select.Trigger disabled={pending}>\n <Select.Value>{(value) => options.find((option) => option.id === value)?.label ?? value ?? ''}</Select.Value>\n <Select.Icon>▾</Select.Icon>\n </Select.Trigger>\n <Select.Positioner align=\"start\" sideOffset={4} alignItemWithTrigger={false}>\n <Select.Popup>\n <Select.List>\n {options.map((option) => (\n <Select.Item key={option.id} value={option.id} label={option.label}>\n {option.label}\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Root>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,SAAgB,uBACd,UACA,cACiC;CACjC,IAAI,YAAY,MAAM,OAAO,CAAC;CAE9B,MAAM,UAA+D,CAAC;CACtE,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,QAAQ,GAAG;EAClD,IAAI,CAAC,iBAAiB,KAAK,GAAG;EAC9B,QAAQ,KAAK;GAAE;GAAI,QAAQ,MAAM;GAAQ,UAAU,MAAM;EAAS,CAAC;CACrE;CACA,IAAI,QAAQ,SAAS,GAAG,OAAO,CAAC;CAEhC,MAAM,8BAAc,IAAI,IAAoB;CAC5C,KAAK,MAAM,SAAS,SAClB,YAAY,IAAI,MAAM,SAAS,YAAY,IAAI,MAAM,MAAM,KAAK,KAAK,CAAC;CAGxE,MAAM,UAAU,QAAQ,KAAK,UAAU;EACrC,IAAI,QAAQ,aAAa,MAAM,MAAM;EAErC,KADgB,YAAY,IAAI,MAAM,MAAM,KAAK,KAAK,KACxC,OAAO,MAAM,aAAa,YAAY,MAAM,SAAS,SAAS,GAC1E,SAAS,KAAK,MAAM,SAAS;EAE/B,OAAO;GAAE,IAAI,MAAM;GAAI;EAAM;CAC/B,CAAC;CAED,QAAQ,MAAM,GAAG,MAAM,eAAe,GAAG,GAAG,YAAY,CAAC;CACzD,OAAO;AACT;AAEA,SAAS,iBAAiB,OAAsE;CAC9F,OAAO,OAAO,UAAU,YAAY,UAAU,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F;CAEA,IAAI,cAAc,GAAG,OAAO;CAE5B,OACE,qBAAC,OAAD;EACE,GAAI;EACO;EACX,4BAAyB;EACzB,aAAW,WAAW,KAAA;EACtB,GAAK,UAAU,EAAE,oCAAoC,GAAG,IAAI,CAAC;EAL/D,UAAA,CAOG,gBAAgB,oBAAC,UAAD;GAAQ,mCAAgC;GAAI,UAAA;EAAmB,CAAA,IAAI,MACpF,qBAAC,OAAO,MAAR;GAAa,OAAO;GAAW,eAAe;GAAc,UAAU;GAAtE,UAAA;IACE,oBAAC,OAAO,OAAR,EAAA,UAAe,UAAwB,CAAA;IACvC,qBAAC,OAAO,SAAR;KAAgB,UAAU;KAA1B,UAAA,CACE,oBAAC,OAAO,OAAR,EAAA,WAAgB,UAAU,QAAQ,MAAM,WAAW,OAAO,OAAO,KAAK,CAAC,EAAE,SAAS,SAAS,GAAiB,CAAA,GAC5G,oBAAC,OAAO,MAAR,EAAA,UAAa,IAAc,CAAA,CACb;;IAChB,oBAAC,OAAO,YAAR;KAAmB,OAAM;KAAQ,YAAY;KAAG,sBAAsB;KACpE,UAAA,oBAAC,OAAO,OAAR,EAAA,UACE,oBAAC,OAAO,MAAR,EAAA,UACG,QAAQ,KAAK,WACZ,oBAAC,OAAO,MAAR;MAA6B,OAAO,OAAO;MAAI,OAAO,OAAO;MAC1D,UAAA,OAAO;KACG,GAFK,OAAO,EAEZ,CACd,EACU,CAAA,EACD,CAAA;IACG,CAAA;GACR;EACV,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"binding-switcher.js","names":[],"sources":["../../../src/particles/binding-switcher/binding-switcher.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { useStorefrontRoute } from '../../sdk/navigation/use-storefront-route.js';\nimport { Select } from '../select/select.js';\n\nexport const BindingSwitcherContent = defineContentType({\n id: 'binding-switcher',\n title: 'Binding Switcher',\n description: 'Label of the binding select and the notice shown when a page has no equivalent in the chosen binding.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Label', format: 'icu-message', messageSource: 'Language' },\n notice: {\n type: 'string',\n title: 'No-equivalent notice',\n description: 'Shown when the page loaded with fs_notice=no-equivalent.',\n format: 'icu-message',\n messageSource: \"This page isn't available in the selected language.\",\n },\n },\n },\n});\n\nexport type BindingSwitcherBinding = {\n locale?: unknown;\n currency?: unknown;\n salesChannel?: unknown;\n url?: unknown;\n country?: unknown;\n timezone?: unknown;\n};\n\ntype BindingSwitcherOption = {\n id: string;\n label: string;\n};\n\n/**\n * `foundation.json` `localization.bindings`, keyed by binding id. An entry counts only when it is an\n * own key, the value is a non-null object, and `locale` is a string. Fewer than two counted\n * entries yields an empty list.\n */\nexport function bindingSwitcherOptions(\n bindings: Record<string, BindingSwitcherBinding> | null | undefined,\n activeLocale: string,\n): { id: string; label: string }[] {\n if (bindings == null) return [];\n\n const counted: { id: string; locale: string; currency: unknown }[] = [];\n for (const [id, value] of Object.entries(bindings)) {\n if (!isCountedBinding(value)) continue;\n counted.push({ id, locale: value.locale, currency: value.currency });\n }\n if (counted.length < 2) return [];\n\n const localeCount = new Map<string, number>();\n for (const entry of counted) {\n localeCount.set(entry.locale, (localeCount.get(entry.locale) ?? 0) + 1);\n }\n\n const options = counted.map((entry) => {\n let label = languageName(entry.locale);\n const shared = (localeCount.get(entry.locale) ?? 0) > 1;\n if (shared && typeof entry.currency === 'string' && entry.currency.length > 0) {\n label += ` (${entry.currency})`;\n }\n return { id: entry.id, label };\n });\n\n options.sort((a, b) => compareOptions(a, b, activeLocale));\n return options;\n}\n\nfunction isCountedBinding(value: unknown): value is BindingSwitcherBinding & { locale: string } {\n return typeof value === 'object' && value !== null && typeof (value as BindingSwitcherBinding).locale === 'string';\n}\n\nfunction languageName(locale: string): string {\n try {\n const name = new Intl.DisplayNames([locale], { type: 'language', languageDisplay: 'standard' }).of(locale);\n if (!name) return locale;\n return name;\n } catch {\n return locale;\n }\n}\n\nfunction compareOptions(a: BindingSwitcherOption, b: BindingSwitcherOption, activeLocale: string): number {\n try {\n return a.label.localeCompare(b.label, activeLocale) || a.id.localeCompare(b.id, activeLocale);\n } catch {\n return a.label.localeCompare(b.label) || a.id.localeCompare(b.id);\n }\n}\n\n/** How long the control stays disabled after a started navigation that never unloads the page. */\nconst NAVIGATION_TIMEOUT_MS = 10_000;\n\nexport type BindingSwitcherProps = Omit<ComponentPropsWithRef<'div'>, 'children'> &\n MessageLocaleProp & {\n /** `foundation.json` `localization.bindings`, keyed by binding id. No library default. */\n bindings?: Record<string, BindingSwitcherBinding> | null;\n /** Injected from `actions: { locale: ['set'] }`. */\n $actions?: ComponentActions;\n /** `label` is the accessible name, rendered as `Select.Label`; `notice` shows on `fs_notice=no-equivalent`. */\n $content?: ContentValue<typeof BindingSwitcherContent>;\n };\n\nexport const BindingSwitcherDefinition = defineComponent<BindingSwitcherProps>({\n name: 'BindingSwitcher',\n importPath: '@vtex/faststore/components',\n component: BindingSwitcher,\n content: BindingSwitcherContent,\n editor: { label: 'Binding Switcher', category: 'action' },\n actions: { locale: ['set'] },\n schema: {\n bindings: { type: 'object', label: 'Bindings' },\n },\n guideline:\n 'Lists the bindings a store declares and switches the whole binding (locale, currency, sales channel) through locale.set. Renders nothing when fewer than two bindings are present; the store passes bindings as $data.Global.localization.bindings. Its label and no-equivalent notice come from the $content fields label and notice.',\n});\n\nexport function BindingSwitcher({\n bindings,\n $actions: $actionsProp,\n $locale,\n $content,\n className,\n ...props\n}: BindingSwitcherProps) {\n const $actions = useActionsOverride($actionsProp);\n const { bindingId, locale } = useStorefrontContext();\n const options = useMemo(() => bindingSwitcherOptions(bindings, locale), [bindings, locale]);\n const [pending, setPending] = useState(false);\n const { path } = useStorefrontRoute();\n // The path the notice arrived on: the layout stays mounted across client navigations, and the\n // notice belongs to that one visit of the page it was shown on.\n const [noticePath, setNoticePath] = useState<string | null>(null);\n const noticeVisible = noticePath !== null && noticePath === path;\n const pendingTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const messages = useMessageFormatter(BindingSwitcherContent, $content);\n const optionCount = options.length;\n\n // Hidden on the first render. `location` is read after mount so the notice cannot mismatch\n // hydration, and so a store with fewer than two bindings leaves the query alone.\n useEffect(() => {\n if (optionCount < 2) return;\n const url = new URL(globalThis.location.href);\n if (url.searchParams.get('fs_notice') !== 'no-equivalent') return;\n setNoticePath(path);\n url.searchParams.delete('fs_notice');\n globalThis.history.replaceState(globalThis.history.state, '', `${url.pathname}${url.search}${url.hash}`);\n }, [optionCount, path]);\n\n useEffect(() => {\n if (noticePath !== null && path !== noticePath) setNoticePath(null);\n }, [noticePath, path]);\n\n // A page restored from the back/forward cache comes back with the state it left with.\n useEffect(() => {\n function onPageShow(event: PageTransitionEvent) {\n if (!event.persisted) return;\n clearTimeout(pendingTimeout.current);\n setPending(false);\n }\n globalThis.addEventListener('pageshow', onPageShow);\n return () => {\n globalThis.removeEventListener('pageshow', onPageShow);\n clearTimeout(pendingTimeout.current);\n };\n }, []);\n\n async function handleChange(value: string | null) {\n if (value === null || value === bindingId) return;\n const set = $actions?.locale?.set;\n if (!set) {\n console.error('[BindingSwitcher] no locale.set');\n return;\n }\n setPending(true);\n let navigated = false;\n try {\n navigated = (await set({ bindingId: value })) === true;\n } finally {\n // A started navigation keeps the control disabled until the next document replaces this one, or\n // until the timeout when the page never unloads (a cancelled `beforeunload`, a 204, a download).\n if (navigated) {\n pendingTimeout.current = setTimeout(() => setPending(false), NAVIGATION_TIMEOUT_MS);\n } else {\n setPending(false);\n }\n }\n }\n\n if (optionCount < 2) return null;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-binding-switcher=\"\"\n aria-busy={pending || undefined}\n {...(pending ? { 'data-fs-binding-switcher-pending': '' } : {})}\n >\n {noticeVisible ? <output data-fs-binding-switcher-notice=\"\">{messages.format('notice')}</output> : null}\n <Select.Root value={bindingId} onValueChange={handleChange} disabled={pending}>\n <Select.Label>{messages.format('label')}</Select.Label>\n <Select.Trigger disabled={pending}>\n <Select.Value>{(value) => options.find((option) => option.id === value)?.label ?? value ?? ''}</Select.Value>\n <Select.Icon>▾</Select.Icon>\n </Select.Trigger>\n <Select.Positioner align=\"start\" sideOffset={4} alignItemWithTrigger={false}>\n <Select.Popup>\n <Select.List>\n {options.map((option) => (\n <Select.Item key={option.id} value={option.id} label={option.label}>\n {option.label}\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Root>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,yBAAyB,kBAAkB;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,OAAO;IAAE,MAAM;IAAU,OAAO;IAAS,QAAQ;IAAe,eAAe;GAAW;GAC1F,QAAQ;IACN,MAAM;IACN,OAAO;IACP,aAAa;IACb,QAAQ;IACR,eAAe;GACjB;EACF;CACF;AACF,CAAC;;;;;;AAqBD,SAAgB,uBACd,UACA,cACiC;CACjC,IAAI,YAAY,MAAM,OAAO,CAAC;CAE9B,MAAM,UAA+D,CAAC;CACtE,KAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,QAAQ,GAAG;EAClD,IAAI,CAAC,iBAAiB,KAAK,GAAG;EAC9B,QAAQ,KAAK;GAAE;GAAI,QAAQ,MAAM;GAAQ,UAAU,MAAM;EAAS,CAAC;CACrE;CACA,IAAI,QAAQ,SAAS,GAAG,OAAO,CAAC;CAEhC,MAAM,8BAAc,IAAI,IAAoB;CAC5C,KAAK,MAAM,SAAS,SAClB,YAAY,IAAI,MAAM,SAAS,YAAY,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,4 @@
1
+ import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
1
2
  import { ComponentDefinition } from "../../core/dist/define-component.js";
2
3
  import "../../core/dist/index.js";
3
4
  import { CardNetworkIconName } from "./card-network.js";
@@ -33,10 +34,11 @@ export type CardSummaryRootProps = Readonly<{
33
34
  label?: string | null;
34
35
  children?: ReactNode;
35
36
  }>;
36
- export type CardSummaryProps = Readonly<{
37
+ export type CardSummaryProps = MessageLocaleProp & Readonly<{
37
38
  className?: string;
38
39
  /** The parts, in order. Defaults to Mark, Name, Mask, Digits. */
39
40
  children?: ReactNode;
41
+ $content?: ContentValue<typeof CardSummaryContent>;
40
42
  }>;
41
43
  export type CardSummaryPartProps = {
42
44
  className?: string;
@@ -50,11 +52,35 @@ export type CardSummaryMaskProps = Readonly<CardSummaryPartProps & {
50
52
  /** Replaces `mask`, e.g. with an icon. Always hidden from assistive technology. */
51
53
  children?: ReactNode;
52
54
  }>;
53
- export declare const CardSummaryDefinition: ComponentDefinition<Readonly<{
54
- className?: string;
55
- /** The parts, in order. Defaults to Mark, Name, Mask, Digits. */
56
- children?: ReactNode;
57
- }>>;
55
+ export declare const CardSummaryContent: {
56
+ readonly id: "card-summary";
57
+ readonly title: "Card Summary";
58
+ readonly description: "The card's last digits as read to assistive technology.";
59
+ readonly schema: {
60
+ readonly type: "object";
61
+ readonly additionalProperties: false;
62
+ readonly properties: {
63
+ readonly endingIn: {
64
+ readonly type: "string";
65
+ readonly title: "Card last digits";
66
+ readonly format: "icu-message";
67
+ readonly messageSource: "ending in {lastDigits}";
68
+ readonly messageArguments: {
69
+ readonly type: "object";
70
+ readonly properties: {
71
+ readonly lastDigits: {
72
+ readonly type: "string";
73
+ };
74
+ };
75
+ };
76
+ readonly messageExample: {
77
+ readonly lastDigits: "4242";
78
+ };
79
+ };
80
+ };
81
+ };
82
+ };
83
+ export declare const CardSummaryDefinition: ComponentDefinition<CardSummaryProps>;
58
84
  export declare const CardSummaryMarkDefinition: ComponentDefinition<Readonly<CardSummaryPartProps>>;
59
85
  export declare const CardSummaryNameDefinition: ComponentDefinition<Readonly<CardSummaryPartProps>>;
60
86
  export declare const CardSummaryMaskDefinition: ComponentDefinition<Readonly<CardSummaryPartProps & {
@@ -70,14 +96,18 @@ export declare const CardSummaryDigitsDefinition: ComponentDefinition<Readonly<C
70
96
  */
71
97
  export declare function CardSummaryRoot({ network, lastDigits, label, children }: CardSummaryRootProps): import("react/jsx-runtime").JSX.Element;
72
98
  /** The wrapper: the composed parts, or Mark, Name, Mask and Digits by default. */
73
- export declare function CardSummary({ className, children }: CardSummaryProps): import("react/jsx-runtime").JSX.Element;
99
+ export declare function CardSummary({ className, children, $content }: CardSummaryProps): import("react/jsx-runtime").JSX.Element;
74
100
  /** The network's mark, and the network itself when a label takes the name. */
75
101
  export declare function CardSummaryMark({ className }: CardSummaryMarkProps): import("react/jsx-runtime").JSX.Element | null;
76
102
  /** The label, or else the network name. Renders nothing when both are blank. */
77
103
  export declare function CardSummaryName({ className }: CardSummaryNameProps): import("react/jsx-runtime").JSX.Element | null;
78
104
  /** Decoration for the hidden digits. Renders nothing when empty or when there are no digits. */
79
105
  export declare function CardSummaryMask({ className, mask, children }: CardSummaryMaskProps): import("react/jsx-runtime").JSX.Element | null;
80
- /** The last four digits, read as "ending in" them. Renders nothing when there are no digits. */
106
+ /**
107
+ * The last four digits, read with CardSummary's endingIn message. With no such text, outside a
108
+ * CardSummary or with the message missing, the digits themselves stay audible. Renders nothing when
109
+ * there are no digits.
110
+ */
81
111
  export declare function CardSummaryDigits({ className }: CardSummaryDigitsProps): import("react/jsx-runtime").JSX.Element | null;
82
112
  //#endregion
83
113
  //# sourceMappingURL=card-summary.d.ts.map
@@ -1,30 +1,53 @@
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";
4
- import { useIntl } from "../../sdk/i18n/client.js";
5
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
5
6
  import { Icon } from "../icon/icon.js";
6
7
  import { cardNetworkIcon } from "./card-network.js";
7
8
  import { createContext, useContext, useMemo } from "react";
8
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
10
  //#region src/particles/card-summary/card-summary.tsx
10
11
  const CardSummaryContext = createContext(null);
12
+ const CardSummaryEndingInContext = createContext(null);
11
13
  /** The card the nearest CardSummaryRoot provides. Throws outside one. */
12
14
  function useCardSummary() {
13
15
  const ctx = useContext(CardSummaryContext);
14
16
  if (!ctx) throw new Error("CardSummary parts must be used inside CardSummaryRoot.");
15
17
  return ctx;
16
18
  }
19
+ const CardSummaryContent = defineContentType({
20
+ id: "card-summary",
21
+ title: "Card Summary",
22
+ description: "The card's last digits as read to assistive technology.",
23
+ schema: {
24
+ type: "object",
25
+ additionalProperties: false,
26
+ properties: { endingIn: {
27
+ type: "string",
28
+ title: "Card last digits",
29
+ format: "icu-message",
30
+ messageSource: "ending in {lastDigits}",
31
+ messageArguments: {
32
+ type: "object",
33
+ properties: { lastDigits: { type: "string" } }
34
+ },
35
+ messageExample: { lastDigits: "4242" }
36
+ } }
37
+ }
38
+ });
17
39
  const CardSummaryDefinition = defineComponent({
18
40
  name: "CardSummary",
19
41
  importPath: "@vtex/faststore/components",
20
42
  component: CardSummary,
43
+ content: CardSummaryContent,
21
44
  requiresContext: "card-summary",
22
45
  editor: {
23
46
  label: "Card Summary",
24
47
  category: "content"
25
48
  },
26
49
  schema: {},
27
- guideline: "A saved card's identity: network mark, label or else network name, mask, last four digits, in that order by default. Compose CardSummaryMark / Name / Mask / Digits as children to reorder or drop a part; the reading order follows the composition. The default satisfies the rule that the mark and the digits always show; a custom composition that drops either gives that up. Must be inside a card-summary provider."
50
+ guideline: "A saved card's identity: network mark, label or else network name, mask, last four digits, in that order by default. Compose CardSummaryMark / Name / Mask / Digits as children to reorder or drop a part; the reading order follows the composition. The default satisfies the rule that the mark and the digits always show; a custom composition that drops either gives that up. Its endingIn message is what CardSummaryDigits reads to screen readers. Must be inside a card-summary provider."
28
51
  });
29
52
  const CardSummaryMarkDefinition = defineComponent({
30
53
  name: "CardSummaryMark",
@@ -76,7 +99,7 @@ const CardSummaryDigitsDefinition = defineComponent({
76
99
  category: "content"
77
100
  },
78
101
  schema: {},
79
- guideline: "The last four digits, announced to screen readers as \"ending in\" and the digits. Never more than four digits. Renders nothing when the card has no digits. Must be inside a card-summary provider."
102
+ guideline: "The last four digits, announced to screen readers with the endingIn message of the CardSummary around it; outside one, or with that message missing, screen readers hear the bare digits. Never more than four digits. Renders nothing when the card has no digits. Must be inside a card-summary provider."
80
103
  });
81
104
  /**
82
105
  * Provides one card to the parts, keeping only its last four digits. No definition on purpose: a
@@ -103,19 +126,24 @@ function CardSummaryRoot({ network, lastDigits, label, children }) {
103
126
  });
104
127
  }
105
128
  /** The wrapper: the composed parts, or Mark, Name, Mask and Digits by default. */
106
- function CardSummary({ className, children }) {
129
+ function CardSummary({ className, children, $content }) {
107
130
  const { icon, label } = useCardSummary();
108
- return /* @__PURE__ */ jsx("span", {
109
- className,
110
- "data-fs-card-summary": "",
111
- "data-fs-card-summary-network": icon ?? void 0,
112
- ...label ? { "data-fs-card-summary-labeled": "" } : {},
113
- children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
114
- /* @__PURE__ */ jsx(CardSummaryMark, {}),
115
- /* @__PURE__ */ jsx(CardSummaryName, {}),
116
- /* @__PURE__ */ jsx(CardSummaryMask, {}),
117
- /* @__PURE__ */ jsx(CardSummaryDigits, {})
118
- ] })
131
+ const { format } = useMessageFormatter(CardSummaryContent, $content);
132
+ const endingIn = useMemo(() => (lastDigits) => format("endingIn", { lastDigits }), [format]);
133
+ return /* @__PURE__ */ jsx(CardSummaryEndingInContext, {
134
+ value: endingIn,
135
+ children: /* @__PURE__ */ jsx("span", {
136
+ className,
137
+ "data-fs-card-summary": "",
138
+ "data-fs-card-summary-network": icon ?? void 0,
139
+ ...label ? { "data-fs-card-summary-labeled": "" } : {},
140
+ children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
141
+ /* @__PURE__ */ jsx(CardSummaryMark, {}),
142
+ /* @__PURE__ */ jsx(CardSummaryName, {}),
143
+ /* @__PURE__ */ jsx(CardSummaryMask, {}),
144
+ /* @__PURE__ */ jsx(CardSummaryDigits, {})
145
+ ] })
146
+ })
119
147
  });
120
148
  }
121
149
  /** The network's mark, and the network itself when a label takes the name. */
@@ -164,25 +192,30 @@ function CardSummaryMask({ className, mask = "••••", children }) {
164
192
  children: content
165
193
  }), " "] });
166
194
  }
167
- /** The last four digits, read as "ending in" them. Renders nothing when there are no digits. */
195
+ /**
196
+ * The last four digits, read with CardSummary's endingIn message. With no such text, outside a
197
+ * CardSummary or with the message missing, the digits themselves stay audible. Renders nothing when
198
+ * there are no digits.
199
+ */
168
200
  function CardSummaryDigits({ className }) {
169
201
  const { lastFour } = useCardSummary();
170
- const intl = useIntl();
202
+ const endingIn = useContext(CardSummaryEndingInContext);
171
203
  if (!lastFour) return null;
172
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
204
+ const spoken = endingIn ? endingIn(lastFour) : "";
205
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
173
206
  className,
174
207
  "data-fs-card-summary-digits": "",
175
- children: [/* @__PURE__ */ jsx("span", {
208
+ children: spoken ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
176
209
  "aria-hidden": "true",
177
210
  children: lastFour
178
211
  }), /* @__PURE__ */ jsx("span", {
179
212
  "data-fs-sr-only": "",
180
213
  className: "sr-only",
181
- children: intl.formatMessage({ id: "fs/card.ending-in" }, { lastDigits: lastFour })
182
- })]
214
+ children: spoken
215
+ })] }) : /* @__PURE__ */ jsx("span", { children: lastFour })
183
216
  }), " "] });
184
217
  }
185
218
  //#endregion
186
- export { CardSummary, CardSummaryDefinition, CardSummaryDigits, CardSummaryDigitsDefinition, CardSummaryMark, CardSummaryMarkDefinition, CardSummaryMask, CardSummaryMaskDefinition, CardSummaryName, CardSummaryNameDefinition, CardSummaryRoot, useCardSummary };
219
+ export { CardSummary, CardSummaryContent, CardSummaryDefinition, CardSummaryDigits, CardSummaryDigitsDefinition, CardSummaryMark, CardSummaryMarkDefinition, CardSummaryMask, CardSummaryMaskDefinition, CardSummaryName, CardSummaryNameDefinition, CardSummaryRoot, useCardSummary };
187
220
 
188
221
  //# sourceMappingURL=card-summary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"card-summary.js","names":[],"sources":["../../../src/particles/card-summary/card-summary.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { useIntl } from '../../sdk/i18n/client.js';\nimport { Icon } from '../icon/icon.js';\nimport { type CardNetworkIconName, cardNetworkIcon } from './card-network.js';\n\n/**\n * CardSummary particle (no business coupling — ADR-0001): a saved card's identity — network mark,\n * label or network name, mask, last four digits — as parts the schema arranges. A row that owns\n * card data wraps its children in CardSummaryRoot and declares `card-summary` in its own\n * providesContext; the parts read the card from there. Each part decides from the data, never from\n * which other parts are composed, so any arrangement keeps the network identifiable.\n */\n\nexport type CardSummaryValue = Readonly<{\n /** The network's display name as given. */\n network: string;\n /** The base-dialect icon for the network, or `null` when unmapped. */\n icon: CardNetworkIconName | null;\n /** The trimmed label, or `null` when absent or blank. */\n label: string | null;\n /** `label ?? network`, or `null` when both are blank. */\n name: string | null;\n /** At most four digits; `''` when none. */\n lastFour: string;\n}>;\n\nconst CardSummaryContext = createContext<CardSummaryValue | null>(null);\n\n/** The card the nearest CardSummaryRoot provides. Throws outside one. */\nexport function useCardSummary(): CardSummaryValue {\n const ctx = useContext(CardSummaryContext);\n if (!ctx) throw new Error('CardSummary parts must be used inside CardSummaryRoot.');\n return ctx;\n}\n\nexport type CardSummaryRootProps = Readonly<{\n /** The network's display name from the platform, e.g. `Visa`. Selects the mark by exact key match. */\n network: string;\n /** The card's last digits. Only the trailing four digit characters ever reach the parts. */\n lastDigits: string;\n /** The shopper's own name for the card. Shown in place of the network name when non-blank. */\n label?: string | null;\n children?: ReactNode;\n}>;\n\nexport type CardSummaryProps = Readonly<{\n className?: string;\n /** The parts, in order. Defaults to Mark, Name, Mask, Digits. */\n children?: ReactNode;\n}>;\n\nexport type CardSummaryPartProps = {\n className?: string;\n};\n\nexport type CardSummaryMarkProps = Readonly<CardSummaryPartProps>;\n\nexport type CardSummaryNameProps = Readonly<CardSummaryPartProps>;\n\nexport type CardSummaryDigitsProps = Readonly<CardSummaryPartProps>;\n\nexport type CardSummaryMaskProps = Readonly<\n CardSummaryPartProps & {\n /** The masking symbol shown before the digits. Defaults to `••••`; empty renders nothing. */\n mask?: string;\n /** Replaces `mask`, e.g. with an icon. Always hidden from assistive technology. */\n children?: ReactNode;\n }\n>;\n\nexport const CardSummaryDefinition = defineComponent<CardSummaryProps>({\n name: 'CardSummary',\n importPath: '@vtex/faststore/components',\n component: CardSummary,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary', category: 'content' },\n schema: {},\n guideline:\n \"A saved card's identity: network mark, label or else network name, mask, last four digits, in that order by default. Compose CardSummaryMark / Name / Mask / Digits as children to reorder or drop a part; the reading order follows the composition. The default satisfies the rule that the mark and the digits always show; a custom composition that drops either gives that up. Must be inside a card-summary provider.\",\n});\n\nexport const CardSummaryMarkDefinition = defineComponent<CardSummaryMarkProps>({\n name: 'CardSummaryMark',\n importPath: '@vtex/faststore/components',\n component: CardSummaryMark,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Mark', category: 'content' },\n schema: {},\n guideline:\n \"The card network's mark. When the card has a label, it also carries the network: hidden text beside the mark, or the network name as visible text for a network with no mark. Renders nothing for an unlabelled card on a network with no mark, since the name says it. On an unlabelled card the glyph is decorative and CardSummaryName announces the network, so compose both: Mark without Name leaves screen readers no network. Marks come from data, so the store lists CARD_NETWORK_ICON_NAMES under icons.include. Must be inside a card-summary provider.\",\n});\n\nexport const CardSummaryNameDefinition = defineComponent<CardSummaryNameProps>({\n name: 'CardSummaryName',\n importPath: '@vtex/faststore/components',\n component: CardSummaryName,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Name', category: 'content' },\n schema: {},\n guideline:\n \"The shopper's label for the card, or else its network name; nothing when both are blank. Read-only. On an unlabelled card it is the only part a screen reader hears the network from. Must be inside a card-summary provider.\",\n});\n\nexport const CardSummaryMaskDefinition = defineComponent<CardSummaryMaskProps>({\n name: 'CardSummaryMask',\n importPath: '@vtex/faststore/components',\n component: CardSummaryMask,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Mask', category: 'content' },\n schema: {\n mask: { type: 'string', default: '••••', label: 'Mask' },\n },\n guideline:\n 'Decoration standing for the hidden digits: the mask text (•••• by default), or children such as an icon in its place. Keep children inline. Always hidden from assistive technology; dropping it changes nothing a screen reader hears. Renders nothing when empty or when the card has no digits. Must be inside a card-summary provider.',\n});\n\nexport const CardSummaryDigitsDefinition = defineComponent<CardSummaryDigitsProps>({\n name: 'CardSummaryDigits',\n importPath: '@vtex/faststore/components',\n component: CardSummaryDigits,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Digits', category: 'content' },\n schema: {},\n guideline:\n 'The last four digits, announced to screen readers as \"ending in\" and the digits. Never more than four digits. Renders nothing when the card has no digits. Must be inside a card-summary provider.',\n});\n\n/**\n * Provides one card to the parts, keeping only its last four digits. No definition on purpose: a\n * schema cannot supply the card, so a matter row renders it and declares 'card-summary' itself.\n */\nexport function CardSummaryRoot({ network, lastDigits, label, children }: CardSummaryRootProps) {\n const value = useMemo<CardSummaryValue>(() => {\n const trimmedLabel = label?.trim() || null;\n return {\n network,\n icon: cardNetworkIcon(network),\n label: trimmedLabel,\n name: trimmedLabel ?? (network.trim() ? network : null),\n lastFour: lastDigits.replaceAll(/\\D/g, '').slice(-4),\n };\n }, [network, lastDigits, label]);\n\n return <CardSummaryContext.Provider value={value}>{children}</CardSummaryContext.Provider>;\n}\n\n/** The wrapper: the composed parts, or Mark, Name, Mask and Digits by default. */\nexport function CardSummary({ className, children }: CardSummaryProps) {\n const { icon, label } = useCardSummary();\n return (\n <span\n className={className}\n data-fs-card-summary=\"\"\n data-fs-card-summary-network={icon ?? undefined}\n {...(label ? { 'data-fs-card-summary-labeled': '' } : {})}\n >\n {children ?? (\n <>\n <CardSummaryMark />\n <CardSummaryName />\n <CardSummaryMask />\n <CardSummaryDigits />\n </>\n )}\n </span>\n );\n}\n\n// Each part ends with a space: accessible names concatenate inline siblings with no separator, so\n// without it a screen reader hears \"MastercardCompany card\". A flex container drops it visually.\n\n/** The network's mark, and the network itself when a label takes the name. */\nexport function CardSummaryMark({ className }: CardSummaryMarkProps) {\n const { network, icon, label } = useCardSummary();\n if (!icon && (!label || !network.trim())) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-mark=\"\">\n {icon ? <Icon name={icon} data-fs-card-summary-icon=\"\" /> : null}\n {label && icon ? (\n <span data-fs-sr-only=\"\" className=\"sr-only\">\n {network}\n </span>\n ) : null}\n {label && !icon ? <span data-fs-card-summary-network-name=\"\">{network}</span> : null}\n </span>{' '}\n </>\n );\n}\n\n/** The label, or else the network name. Renders nothing when both are blank. */\nexport function CardSummaryName({ className }: CardSummaryNameProps) {\n const { name } = useCardSummary();\n if (!name) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-name=\"\">\n {name}\n </span>{' '}\n </>\n );\n}\n\n/** Decoration for the hidden digits. Renders nothing when empty or when there are no digits. */\nexport function CardSummaryMask({ className, mask = '••••', children }: CardSummaryMaskProps) {\n const { lastFour } = useCardSummary();\n const content = children ?? mask;\n if (!lastFour || !content) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-mask=\"\" aria-hidden=\"true\">\n {content}\n </span>{' '}\n </>\n );\n}\n\n/** The last four digits, read as \"ending in\" them. Renders nothing when there are no digits. */\nexport function CardSummaryDigits({ className }: CardSummaryDigitsProps) {\n const { lastFour } = useCardSummary();\n const intl = useIntl();\n if (!lastFour) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-digits=\"\">\n <span aria-hidden=\"true\">{lastFour}</span>\n <span data-fs-sr-only=\"\" className=\"sr-only\">\n {intl.formatMessage({ id: 'fs/card.ending-in' }, { lastDigits: lastFour })}\n </span>\n </span>{' '}\n </>\n );\n}\n"],"mappings":";;;;;;;;;AA6BA,MAAM,qBAAqB,cAAuC,IAAI;;AAGtE,SAAgB,iBAAmC;CACjD,MAAM,MAAM,WAAW,kBAAkB;CACzC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,wDAAwD;CAClF,OAAO;AACT;AAqCA,MAAa,wBAAwB,gBAAkC;CACrE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAgB,UAAU;CAAU;CACrD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAU;CAC1D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAU;CAC1D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAU;CAC1D,QAAQ,EACN,MAAM;EAAE,MAAM;EAAU,SAAS;EAAQ,OAAO;CAAO,EACzD;CACA,WACE;AACJ,CAAC;AAED,MAAa,8BAA8B,gBAAwC;CACjF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAuB,UAAU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GACG,CAAA,IACJ;GACH,SAAS,CAAC,OAAO,oBAAC,QAAD;IAAM,qCAAkC;IAAI,UAAA;GAAc,CAAA,IAAI;EAC5E;CAAE,CAAA,GAAA,GACR,EAAA,CAAA;AAEN;;AAGA,SAAgB,gBAAgB,EAAE,aAAmC;CACnE,MAAM,EAAE,SAAS,eAAe;CAChC,IAAI,CAAC,MAAM,OAAO;CAClB,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAiB;EAAW,6BAA0B;EACnD,UAAA;CACG,CAAA,GAAE,GACR,EAAA,CAAA;AAEN;;AAGA,SAAgB,gBAAgB,EAAE,WAAW,OAAO,QAAQ,YAAkC;CAC5F,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,UAAU,YAAY;CAC5B,IAAI,CAAC,YAAY,CAAC,SAAS,OAAO;CAClC,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAiB;EAAW,6BAA0B;EAAG,eAAY;EAClE,UAAA;CACG,CAAA,GAAE,GACR,EAAA,CAAA;AAEN;;AAGA,SAAgB,kBAAkB,EAAE,aAAqC;CACvE,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,OAAO,QAAQ;CACrB,IAAI,CAAC,UAAU,OAAO;CACtB,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,QAAD;EAAiB;EAAW,+BAA4B;EAAxD,UAAA,CACE,oBAAC,QAAD;GAAM,eAAY;GAAQ,UAAA;EAAe,CAAA,GACzC,oBAAC,QAAD;GAAM,mBAAgB;GAAG,WAAU;GAChC,UAAA,KAAK,cAAc,EAAE,IAAI,oBAAoB,GAAG,EAAE,YAAY,SAAS,CAAC;EACrE,CAAA,CACF;CAAE,CAAA,GAAA,GACR,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"card-summary.js","names":[],"sources":["../../../src/particles/card-summary/card-summary.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { Icon } from '../icon/icon.js';\nimport { type CardNetworkIconName, cardNetworkIcon } from './card-network.js';\n\n/**\n * CardSummary particle (no business coupling — ADR-0001): a saved card's identity — network mark,\n * label or network name, mask, last four digits — as parts the schema arranges. A row that owns\n * card data wraps its children in CardSummaryRoot and declares `card-summary` in its own\n * providesContext; the parts read the card from there. Each part decides from the data, never from\n * which other parts are composed, so any arrangement keeps the network identifiable.\n */\n\nexport type CardSummaryValue = Readonly<{\n /** The network's display name as given. */\n network: string;\n /** The base-dialect icon for the network, or `null` when unmapped. */\n icon: CardNetworkIconName | null;\n /** The trimmed label, or `null` when absent or blank. */\n label: string | null;\n /** `label ?? network`, or `null` when both are blank. */\n name: string | null;\n /** At most four digits; `''` when none. */\n lastFour: string;\n}>;\n\nconst CardSummaryContext = createContext<CardSummaryValue | null>(null);\n\n/** The screen-reader text for the digits, formatted by the CardSummary wrapper from its own content. */\ntype CardSummaryEndingIn = (lastDigits: string) => string;\n\nconst CardSummaryEndingInContext = createContext<CardSummaryEndingIn | null>(null);\n\n/** The card the nearest CardSummaryRoot provides. Throws outside one. */\nexport function useCardSummary(): CardSummaryValue {\n const ctx = useContext(CardSummaryContext);\n if (!ctx) throw new Error('CardSummary parts must be used inside CardSummaryRoot.');\n return ctx;\n}\n\nexport type CardSummaryRootProps = Readonly<{\n /** The network's display name from the platform, e.g. `Visa`. Selects the mark by exact key match. */\n network: string;\n /** The card's last digits. Only the trailing four digit characters ever reach the parts. */\n lastDigits: string;\n /** The shopper's own name for the card. Shown in place of the network name when non-blank. */\n label?: string | null;\n children?: ReactNode;\n}>;\n\nexport type CardSummaryProps = MessageLocaleProp &\n Readonly<{\n className?: string;\n /** The parts, in order. Defaults to Mark, Name, Mask, Digits. */\n children?: ReactNode;\n $content?: ContentValue<typeof CardSummaryContent>;\n }>;\n\nexport type CardSummaryPartProps = {\n className?: string;\n};\n\nexport type CardSummaryMarkProps = Readonly<CardSummaryPartProps>;\n\nexport type CardSummaryNameProps = Readonly<CardSummaryPartProps>;\n\nexport type CardSummaryDigitsProps = Readonly<CardSummaryPartProps>;\n\nexport type CardSummaryMaskProps = Readonly<\n CardSummaryPartProps & {\n /** The masking symbol shown before the digits. Defaults to `••••`; empty renders nothing. */\n mask?: string;\n /** Replaces `mask`, e.g. with an icon. Always hidden from assistive technology. */\n children?: ReactNode;\n }\n>;\n\nexport const CardSummaryContent = defineContentType({\n id: 'card-summary',\n title: 'Card Summary',\n description: \"The card's last digits as read to assistive technology.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n endingIn: {\n type: 'string',\n title: 'Card last digits',\n format: 'icu-message',\n messageSource: 'ending in {lastDigits}',\n messageArguments: { type: 'object', properties: { lastDigits: { type: 'string' } } },\n messageExample: { lastDigits: '4242' },\n },\n },\n },\n});\n\nexport const CardSummaryDefinition = defineComponent<CardSummaryProps>({\n name: 'CardSummary',\n importPath: '@vtex/faststore/components',\n component: CardSummary,\n content: CardSummaryContent,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary', category: 'content' },\n schema: {},\n guideline:\n \"A saved card's identity: network mark, label or else network name, mask, last four digits, in that order by default. Compose CardSummaryMark / Name / Mask / Digits as children to reorder or drop a part; the reading order follows the composition. The default satisfies the rule that the mark and the digits always show; a custom composition that drops either gives that up. Its endingIn message is what CardSummaryDigits reads to screen readers. Must be inside a card-summary provider.\",\n});\n\nexport const CardSummaryMarkDefinition = defineComponent<CardSummaryMarkProps>({\n name: 'CardSummaryMark',\n importPath: '@vtex/faststore/components',\n component: CardSummaryMark,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Mark', category: 'content' },\n schema: {},\n guideline:\n \"The card network's mark. When the card has a label, it also carries the network: hidden text beside the mark, or the network name as visible text for a network with no mark. Renders nothing for an unlabelled card on a network with no mark, since the name says it. On an unlabelled card the glyph is decorative and CardSummaryName announces the network, so compose both: Mark without Name leaves screen readers no network. Marks come from data, so the store lists CARD_NETWORK_ICON_NAMES under icons.include. Must be inside a card-summary provider.\",\n});\n\nexport const CardSummaryNameDefinition = defineComponent<CardSummaryNameProps>({\n name: 'CardSummaryName',\n importPath: '@vtex/faststore/components',\n component: CardSummaryName,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Name', category: 'content' },\n schema: {},\n guideline:\n \"The shopper's label for the card, or else its network name; nothing when both are blank. Read-only. On an unlabelled card it is the only part a screen reader hears the network from. Must be inside a card-summary provider.\",\n});\n\nexport const CardSummaryMaskDefinition = defineComponent<CardSummaryMaskProps>({\n name: 'CardSummaryMask',\n importPath: '@vtex/faststore/components',\n component: CardSummaryMask,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Mask', category: 'content' },\n schema: {\n mask: { type: 'string', default: '••••', label: 'Mask' },\n },\n guideline:\n 'Decoration standing for the hidden digits: the mask text (•••• by default), or children such as an icon in its place. Keep children inline. Always hidden from assistive technology; dropping it changes nothing a screen reader hears. Renders nothing when empty or when the card has no digits. Must be inside a card-summary provider.',\n});\n\nexport const CardSummaryDigitsDefinition = defineComponent<CardSummaryDigitsProps>({\n name: 'CardSummaryDigits',\n importPath: '@vtex/faststore/components',\n component: CardSummaryDigits,\n requiresContext: 'card-summary',\n editor: { label: 'Card Summary Digits', category: 'content' },\n schema: {},\n guideline:\n 'The last four digits, announced to screen readers with the endingIn message of the CardSummary around it; outside one, or with that message missing, screen readers hear the bare digits. Never more than four digits. Renders nothing when the card has no digits. Must be inside a card-summary provider.',\n});\n\n/**\n * Provides one card to the parts, keeping only its last four digits. No definition on purpose: a\n * schema cannot supply the card, so a matter row renders it and declares 'card-summary' itself.\n */\nexport function CardSummaryRoot({ network, lastDigits, label, children }: CardSummaryRootProps) {\n const value = useMemo<CardSummaryValue>(() => {\n const trimmedLabel = label?.trim() || null;\n return {\n network,\n icon: cardNetworkIcon(network),\n label: trimmedLabel,\n name: trimmedLabel ?? (network.trim() ? network : null),\n lastFour: lastDigits.replaceAll(/\\D/g, '').slice(-4),\n };\n }, [network, lastDigits, label]);\n\n return <CardSummaryContext.Provider value={value}>{children}</CardSummaryContext.Provider>;\n}\n\n/** The wrapper: the composed parts, or Mark, Name, Mask and Digits by default. */\nexport function CardSummary({ className, children, $content }: CardSummaryProps) {\n const { icon, label } = useCardSummary();\n const { format } = useMessageFormatter(CardSummaryContent, $content);\n // Formatted on demand, so a composition without Digits never reports the message missing.\n const endingIn = useMemo<CardSummaryEndingIn>(() => (lastDigits) => format('endingIn', { lastDigits }), [format]);\n return (\n <CardSummaryEndingInContext value={endingIn}>\n <span\n className={className}\n data-fs-card-summary=\"\"\n data-fs-card-summary-network={icon ?? undefined}\n {...(label ? { 'data-fs-card-summary-labeled': '' } : {})}\n >\n {children ?? (\n <>\n <CardSummaryMark />\n <CardSummaryName />\n <CardSummaryMask />\n <CardSummaryDigits />\n </>\n )}\n </span>\n </CardSummaryEndingInContext>\n );\n}\n\n// Each part ends with a space: accessible names concatenate inline siblings with no separator, so\n// without it a screen reader hears \"MastercardCompany card\". A flex container drops it visually.\n\n/** The network's mark, and the network itself when a label takes the name. */\nexport function CardSummaryMark({ className }: CardSummaryMarkProps) {\n const { network, icon, label } = useCardSummary();\n if (!icon && (!label || !network.trim())) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-mark=\"\">\n {icon ? <Icon name={icon} data-fs-card-summary-icon=\"\" /> : null}\n {label && icon ? (\n <span data-fs-sr-only=\"\" className=\"sr-only\">\n {network}\n </span>\n ) : null}\n {label && !icon ? <span data-fs-card-summary-network-name=\"\">{network}</span> : null}\n </span>{' '}\n </>\n );\n}\n\n/** The label, or else the network name. Renders nothing when both are blank. */\nexport function CardSummaryName({ className }: CardSummaryNameProps) {\n const { name } = useCardSummary();\n if (!name) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-name=\"\">\n {name}\n </span>{' '}\n </>\n );\n}\n\n/** Decoration for the hidden digits. Renders nothing when empty or when there are no digits. */\nexport function CardSummaryMask({ className, mask = '••••', children }: CardSummaryMaskProps) {\n const { lastFour } = useCardSummary();\n const content = children ?? mask;\n if (!lastFour || !content) return null;\n return (\n <>\n <span className={className} data-fs-card-summary-mask=\"\" aria-hidden=\"true\">\n {content}\n </span>{' '}\n </>\n );\n}\n\n/**\n * The last four digits, read with CardSummary's endingIn message. With no such text, outside a\n * CardSummary or with the message missing, the digits themselves stay audible. Renders nothing when\n * there are no digits.\n */\nexport function CardSummaryDigits({ className }: CardSummaryDigitsProps) {\n const { lastFour } = useCardSummary();\n const endingIn = useContext(CardSummaryEndingInContext);\n if (!lastFour) return null;\n const spoken = endingIn ? endingIn(lastFour) : '';\n return (\n <>\n <span className={className} data-fs-card-summary-digits=\"\">\n {spoken ? (\n <>\n <span aria-hidden=\"true\">{lastFour}</span>\n <span data-fs-sr-only=\"\" className=\"sr-only\">\n {spoken}\n </span>\n </>\n ) : (\n <span>{lastFour}</span>\n )}\n </span>{' '}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AA6BA,MAAM,qBAAqB,cAAuC,IAAI;AAKtE,MAAM,6BAA6B,cAA0C,IAAI;;AAGjF,SAAgB,iBAAmC;CACjD,MAAM,MAAM,WAAW,kBAAkB;CACzC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,wDAAwD;CAClF,OAAO;AACT;AAuCA,MAAa,qBAAqB,kBAAkB;CAClD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,UAAU;GACR,MAAM;GACN,OAAO;GACP,QAAQ;GACR,eAAe;GACf,kBAAkB;IAAE,MAAM;IAAU,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,EAAE;GAAE;GACnF,gBAAgB,EAAE,YAAY,OAAO;EACvC,EACF;CACF;AACF,CAAC;AAED,MAAa,wBAAwB,gBAAkC;CACrE,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,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iB;EAAW,6BAA0B;EACnD,UAAA;CACG,CAAA,GAAE,GACR,EAAA,CAAA;AAEN;;AAGA,SAAgB,gBAAgB,EAAE,WAAW,OAAO,QAAQ,YAAkC;CAC5F,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,UAAU,YAAY;CAC5B,IAAI,CAAC,YAAY,CAAC,SAAS,OAAO;CAClC,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAiB;EAAW,6BAA0B;EAAG,eAAY;EAClE,UAAA;CACG,CAAA,GAAE,GACR,EAAA,CAAA;AAEN;;;;;;AAOA,SAAgB,kBAAkB,EAAE,aAAqC;CACvE,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,WAAW,WAAW,0BAA0B;CACtD,IAAI,CAAC,UAAU,OAAO;CACtB,MAAM,SAAS,WAAW,SAAS,QAAQ,IAAI;CAC/C,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAiB;EAAW,+BAA4B;EACrD,UAAA,SACC,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,eAAY;GAAQ,UAAA;EAAe,CAAA,GACzC,oBAAC,QAAD;GAAM,mBAAgB;GAAG,WAAU;GAChC,UAAA;EACG,CAAA,CACN,EAAA,CAAA,IAEF,oBAAC,QAAD,EAAA,UAAO,SAAe,CAAA;CAEpB,CAAA,GAAE,GACR,EAAA,CAAA;AAEN"}
@@ -1,7 +1,94 @@
1
+ import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
1
2
  import { ComponentDefinition } from "../../core/dist/define-component.js";
2
3
  import "../../core/dist/index.js";
3
4
  import { ComponentPropsWithRef, ReactNode } from "react";
4
5
  //#region src/particles/carousel/carousel.d.ts
6
+ export declare const CarouselRootContent: {
7
+ readonly id: "carousel-root";
8
+ readonly title: "Carousel Root";
9
+ readonly description: "Accessible name of the carousel region.";
10
+ readonly schema: {
11
+ readonly type: "object";
12
+ readonly additionalProperties: false;
13
+ readonly properties: {
14
+ readonly label: {
15
+ readonly type: "string";
16
+ readonly title: "Accessible label";
17
+ readonly format: "icu-message";
18
+ readonly messageSource: "Carousel";
19
+ };
20
+ };
21
+ };
22
+ };
23
+ export declare const CarouselPreviousContent: {
24
+ readonly id: "carousel-previous";
25
+ readonly title: "Carousel Previous";
26
+ readonly description: "Accessible name of the previous-page control.";
27
+ readonly schema: {
28
+ readonly type: "object";
29
+ readonly additionalProperties: false;
30
+ readonly properties: {
31
+ readonly label: {
32
+ readonly type: "string";
33
+ readonly title: "Accessible label";
34
+ readonly format: "icu-message";
35
+ readonly messageSource: "Previous";
36
+ };
37
+ };
38
+ };
39
+ };
40
+ export declare const CarouselNextContent: {
41
+ readonly id: "carousel-next";
42
+ readonly title: "Carousel Next";
43
+ readonly description: "Accessible name of the next-page control.";
44
+ readonly schema: {
45
+ readonly type: "object";
46
+ readonly additionalProperties: false;
47
+ readonly properties: {
48
+ readonly label: {
49
+ readonly type: "string";
50
+ readonly title: "Accessible label";
51
+ readonly format: "icu-message";
52
+ readonly messageSource: "Next";
53
+ };
54
+ };
55
+ };
56
+ };
57
+ export declare const CarouselBulletsContent: {
58
+ readonly id: "carousel-bullets";
59
+ readonly title: "Carousel Bullets";
60
+ readonly description: "Accessible names of the page bullets and of their group.";
61
+ readonly schema: {
62
+ readonly type: "object";
63
+ readonly additionalProperties: false;
64
+ readonly properties: {
65
+ readonly ariaLabel: {
66
+ readonly type: "string";
67
+ readonly title: "Group accessible label";
68
+ readonly format: "icu-message";
69
+ readonly messageSource: "Choose page";
70
+ };
71
+ readonly bulletLabel: {
72
+ readonly type: "string";
73
+ readonly title: "Bullet accessible label";
74
+ readonly description: "The page argument is the 1-based page number.";
75
+ readonly format: "icu-message";
76
+ readonly messageSource: "Go to page {page}";
77
+ readonly messageArguments: {
78
+ readonly type: "object";
79
+ readonly properties: {
80
+ readonly page: {
81
+ readonly type: "integer";
82
+ };
83
+ };
84
+ };
85
+ readonly messageExample: {
86
+ readonly page: 2;
87
+ };
88
+ };
89
+ };
90
+ };
91
+ };
5
92
  export type CarouselVariant = 'slide' | 'scroll';
6
93
  export type CarouselContextValue = {
7
94
  currentPage: number;
@@ -17,33 +104,34 @@ export type CarouselContextValue = {
17
104
  canGoPrevious: boolean;
18
105
  setItemCount: (count: number) => void;
19
106
  };
20
- export type CarouselRootProps = ComponentPropsWithRef<'section'> & {
107
+ export type CarouselRootProps = ComponentPropsWithRef<'section'> & MessageLocaleProp & {
21
108
  infiniteMode?: boolean;
22
109
  variant?: CarouselVariant;
23
110
  itemsPerPage?: number;
24
111
  defaultPage?: number;
25
- label?: string;
112
+ $content?: ContentValue<typeof CarouselRootContent>;
26
113
  };
27
114
  export type CarouselTrackProps = ComponentPropsWithRef<'div'> & {
28
115
  children?: ReactNode;
29
116
  };
30
- export type CarouselPreviousProps = ComponentPropsWithRef<'button'> & {
117
+ export type CarouselPreviousProps = ComponentPropsWithRef<'button'> & MessageLocaleProp & {
31
118
  children?: ReactNode;
119
+ $content?: ContentValue<typeof CarouselPreviousContent>;
32
120
  };
33
- export type CarouselNextProps = ComponentPropsWithRef<'button'> & {
121
+ export type CarouselNextProps = ComponentPropsWithRef<'button'> & MessageLocaleProp & {
34
122
  children?: ReactNode;
123
+ $content?: ContentValue<typeof CarouselNextContent>;
35
124
  };
36
- export type CarouselBulletsProps = ComponentPropsWithRef<'div'> & {
37
- ariaLabel?: string;
38
- bulletLabel?: string;
125
+ export type CarouselBulletsProps = ComponentPropsWithRef<'div'> & MessageLocaleProp & {
39
126
  hideWhenSingle?: boolean;
127
+ $content?: ContentValue<typeof CarouselBulletsContent>;
40
128
  };
41
129
  export declare function useCarousel(): CarouselContextValue;
42
- export declare function CarouselRoot({ infiniteMode, variant, itemsPerPage, defaultPage, label, children, ...props }: CarouselRootProps): import("react/jsx-runtime").JSX.Element;
130
+ export declare function CarouselRoot({ infiniteMode, variant, itemsPerPage, defaultPage, $locale, $content, children, ...props }: CarouselRootProps): import("react/jsx-runtime").JSX.Element;
43
131
  export declare function CarouselTrack({ children, style, ref, onScroll, ...props }: CarouselTrackProps): import("react/jsx-runtime").JSX.Element;
44
- export declare function CarouselPrevious({ children, onClick, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element;
45
- export declare function CarouselNext({ children, onClick, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element;
46
- export declare function CarouselBullets({ ariaLabel, bulletLabel, hideWhenSingle, ...props }: CarouselBulletsProps): import("react/jsx-runtime").JSX.Element | null;
132
+ export declare function CarouselPrevious({ $locale, $content, children, onClick, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element;
133
+ export declare function CarouselNext({ $locale, $content, children, onClick, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element;
134
+ export declare function CarouselBullets({ $locale, $content, hideWhenSingle, ...props }: CarouselBulletsProps): import("react/jsx-runtime").JSX.Element | null;
47
135
  export declare const CarouselRootDefinition: ComponentDefinition<CarouselRootProps>;
48
136
  export declare const CarouselTrackDefinition: ComponentDefinition<CarouselTrackProps>;
49
137
  export declare const CarouselPreviousDefinition: ComponentDefinition<CarouselPreviousProps>;