@vtex/faststore 0.0.8 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (568) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +0 -1
  3. package/dist/actions.json +48 -1
  4. package/dist/catalog.json +1397 -1594
  5. package/dist/cli/index.d.ts +66 -28
  6. package/dist/cli/index.js +7371 -512
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/server-runtime.js +41 -60
  9. package/dist/cli/server-runtime.js.map +1 -1
  10. package/dist/client.d.ts +3 -3
  11. package/dist/client.js +2 -2
  12. package/dist/components.d.ts +67 -56
  13. package/dist/components.js +64 -53
  14. package/dist/content-types.json +5886 -555
  15. package/dist/core/dist/define-component.d.ts +7 -2
  16. package/dist/core/dist/define-content-type.d.ts +50 -2
  17. package/dist/core/dist/define-content-type.js +107 -3
  18. package/dist/core/dist/define-content-type.js.map +1 -1
  19. package/dist/core/dist/index.d.ts +2 -2
  20. package/dist/docs/access-code-field.md +1 -1
  21. package/dist/docs/access-code-sign-in.md +126 -77
  22. package/dist/docs/account-address-book.md +210 -95
  23. package/dist/docs/account-entry-point.md +4 -4
  24. package/dist/docs/account-menu.md +16 -17
  25. package/dist/docs/account-saved-cards.md +306 -0
  26. package/dist/docs/alert-dialog.md +3 -1
  27. package/dist/docs/avatar.md +4 -2
  28. package/dist/docs/billing-address.md +99 -30
  29. package/dist/docs/binding-switcher.md +157 -0
  30. package/dist/docs/buy-button.md +7 -8
  31. package/dist/docs/card-entry.md +42 -29
  32. package/dist/docs/card-summary.md +185 -0
  33. package/dist/docs/cardholder-document.md +5 -3
  34. package/dist/docs/carousel.md +5 -4
  35. package/dist/docs/cart-destination.md +251 -0
  36. package/dist/docs/cart-item.md +48 -15
  37. package/dist/docs/cart-totalizer.md +8 -6
  38. package/dist/docs/cart.md +240 -39
  39. package/dist/docs/challenge-return.md +135 -0
  40. package/dist/docs/client-preferences-fieldset.md +10 -5
  41. package/dist/docs/client-preferences.md +31 -8
  42. package/dist/docs/client-profile-fieldset.md +20 -6
  43. package/dist/docs/client-profile.md +12 -3
  44. package/dist/docs/copy-text.md +9 -7
  45. package/dist/docs/document-field.md +1 -1
  46. package/dist/docs/email-field.md +2 -1
  47. package/dist/docs/email-identification.md +12 -2
  48. package/dist/docs/footer-copyright.md +4 -2
  49. package/dist/docs/footer-social.md +1 -1
  50. package/dist/docs/form.md +54 -18
  51. package/dist/docs/free-shipping-progress.md +18 -13
  52. package/dist/docs/identity-edit.md +8 -2
  53. package/dist/docs/identity-summary.md +18 -5
  54. package/dist/docs/incentives.md +2 -2
  55. package/dist/docs/installments.md +46 -32
  56. package/dist/docs/logo.md +1 -1
  57. package/dist/docs/my-account-profile.md +16 -11
  58. package/dist/docs/navigation-link.md +5 -3
  59. package/dist/docs/order-cancel.md +3 -1
  60. package/dist/docs/order-delivery-address.md +7 -5
  61. package/dist/docs/order-delivery-group.md +1 -3
  62. package/dist/docs/order-details-back.md +1 -1
  63. package/dist/docs/order-details-header.md +1 -4
  64. package/dist/docs/order-invoice-download.md +60 -0
  65. package/dist/docs/order-list-row.md +1 -1
  66. package/dist/docs/order-list-search.md +13 -20
  67. package/dist/docs/order-list-views.md +11 -17
  68. package/dist/docs/order-list.md +12 -5
  69. package/dist/docs/order-payment.md +9 -7
  70. package/dist/docs/order-placed-date.md +1 -1
  71. package/dist/docs/order-placed-payment-summary.md +28 -15
  72. package/dist/docs/order-placed.md +49 -14
  73. package/dist/docs/order-progress.md +1 -1
  74. package/dist/docs/order-status-badge.md +20 -9
  75. package/dist/docs/order-summary.md +2 -2
  76. package/dist/docs/order-tracking-link.md +58 -0
  77. package/dist/docs/payment-method-badges.md +32 -6
  78. package/dist/docs/payment-methods.md +2 -2
  79. package/dist/docs/payment.md +36 -17
  80. package/dist/docs/phone-field.md +4 -4
  81. package/dist/docs/place-order.md +84 -36
  82. package/dist/docs/postal-code-field.md +3 -1
  83. package/dist/docs/pricing.md +21 -23
  84. package/dist/docs/product-gallery.md +19 -20
  85. package/dist/docs/product-information.md +14 -10
  86. package/dist/docs/product-list.md +7 -6
  87. package/dist/docs/product-shelf.md +7 -1
  88. package/dist/docs/promotion.md +4 -2
  89. package/dist/docs/region.md +23 -15
  90. package/dist/docs/save-card.md +7 -6
  91. package/dist/docs/saved-cards.md +65 -36
  92. package/dist/docs/select.md +3 -4
  93. package/dist/docs/shipping-address.md +57 -21
  94. package/dist/docs/shipping-simulator.md +53 -15
  95. package/dist/docs/sign-in-disclosure.md +176 -0
  96. package/dist/docs/sign-in-form.md +78 -47
  97. package/dist/docs/sign-in-redirect.md +5 -3
  98. package/dist/docs/sign-in.md +173 -0
  99. package/dist/docs/toast.md +45 -16
  100. package/dist/docs/variant-selector.md +15 -11
  101. package/dist/graphql/types.d.ts +4 -14
  102. package/dist/index.d.ts +3 -2
  103. package/dist/internal/client.d.ts +4 -3
  104. package/dist/internal/client.js +5 -2
  105. package/dist/internal/server.d.ts +10 -5
  106. package/dist/internal/server.js +9 -4
  107. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  108. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  109. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  110. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  111. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  112. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  113. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  114. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  115. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  116. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  117. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  118. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  119. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  120. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  121. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  122. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  123. package/dist/matter/account-address-book/account-address-book.js +74 -33
  124. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  126. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  127. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  128. package/dist/matter/account-address-book/account-address-country.js +83 -49
  129. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  131. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  132. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  133. package/dist/matter/account-address-book/account-address-form.js +518 -155
  134. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  135. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  136. package/dist/matter/account-address-book/account-address-record.js +32 -17
  137. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  138. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  139. package/dist/matter/account-menu/account-menu.js +46 -54
  140. package/dist/matter/account-menu/account-menu.js.map +1 -1
  141. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  142. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +463 -0
  143. package/dist/matter/account-saved-cards/account-saved-cards.js +1011 -0
  144. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -0
  145. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  146. package/dist/matter/billing-address/billing-address.js +227 -156
  147. package/dist/matter/billing-address/billing-address.js.map +1 -1
  148. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  149. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  150. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  151. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  152. package/dist/matter/buy-button/buy-button.js +10 -19
  153. package/dist/matter/buy-button/buy-button.js.map +1 -1
  154. package/dist/matter/card-entry/card-capture.js +12 -4
  155. package/dist/matter/card-entry/card-capture.js.map +1 -1
  156. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  157. package/dist/matter/card-entry/card-entry.js +348 -221
  158. package/dist/matter/card-entry/card-entry.js.map +1 -1
  159. package/dist/matter/cart/cart-namespace.d.ts +11 -1
  160. package/dist/matter/cart/cart-namespace.js +11 -1
  161. package/dist/matter/cart/cart-namespace.js.map +1 -1
  162. package/dist/matter/cart/cart.d.ts +416 -45
  163. package/dist/matter/cart/cart.js +782 -101
  164. package/dist/matter/cart/cart.js.map +1 -1
  165. package/dist/matter/cart-destination/cart-destination.d.ts +233 -0
  166. package/dist/matter/cart-destination/cart-destination.js +703 -0
  167. package/dist/matter/cart-destination/cart-destination.js.map +1 -0
  168. package/dist/matter/cart-item/cart-item.d.ts +145 -16
  169. package/dist/matter/cart-item/cart-item.js +230 -54
  170. package/dist/matter/cart-item/cart-item.js.map +1 -1
  171. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  172. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  173. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  174. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  175. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  176. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  177. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  178. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  179. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  180. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  181. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  182. package/dist/matter/cart-totalizer/cart-totalizer.js +49 -19
  183. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  184. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  185. package/dist/matter/challenge-return/challenge-return.js +241 -0
  186. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  187. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  188. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  189. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  190. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  191. package/dist/matter/client-preferences/client-preferences.js +84 -15
  192. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  193. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  194. package/dist/matter/client-profile/client-profile.js +64 -24
  195. package/dist/matter/client-profile/client-profile.js.map +1 -1
  196. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  197. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  198. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  199. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  200. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  201. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  202. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  203. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  204. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  205. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  206. package/dist/matter/delivery-options/delivery-options.js +75 -12
  207. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  208. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  209. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  210. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  211. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  212. package/dist/matter/email-identification/email-identification.js +49 -12
  213. package/dist/matter/email-identification/email-identification.js.map +1 -1
  214. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +85 -10
  215. package/dist/matter/free-shipping-progress/free-shipping-progress.js +153 -53
  216. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  217. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  218. package/dist/matter/identity-edit/identity-edit.js +47 -19
  219. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  220. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  221. package/dist/matter/identity-summary/identity-summary.js +95 -45
  222. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  223. package/dist/matter/installments/installments-select.d.ts +98 -16
  224. package/dist/matter/installments/installments-select.js +156 -48
  225. package/dist/matter/installments/installments-select.js.map +1 -1
  226. package/dist/matter/installments/installments.d.ts +96 -16
  227. package/dist/matter/installments/installments.js +115 -40
  228. package/dist/matter/installments/installments.js.map +1 -1
  229. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  230. package/dist/matter/installments/use-installments-selection.js +8 -3
  231. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  232. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  233. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  234. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  235. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  236. package/dist/matter/order-cancel/order-cancel.js +118 -51
  237. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  238. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  239. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  240. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  241. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  242. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  243. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  244. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  245. package/dist/matter/order-details-header/order-details-header.js +66 -58
  246. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  247. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  248. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  249. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  250. package/dist/matter/order-list/order-list.d.ts +164 -19
  251. package/dist/matter/order-list/order-list.js +229 -87
  252. package/dist/matter/order-list/order-list.js.map +1 -1
  253. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  254. package/dist/matter/order-list-row/order-list-row.js +3 -2
  255. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  256. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  257. package/dist/matter/order-list-search/order-list-search.js +30 -69
  258. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  259. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  260. package/dist/matter/order-list-views/order-list-views.js +22 -68
  261. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  262. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  263. package/dist/matter/order-payment/order-payment.js +44 -39
  264. package/dist/matter/order-payment/order-payment.js.map +1 -1
  265. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  266. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  267. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  268. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  269. package/dist/matter/order-placed/order-placed.js +230 -139
  270. package/dist/matter/order-placed/order-placed.js.map +1 -1
  271. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  272. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  273. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  274. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  275. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  276. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  277. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  278. package/dist/matter/order-progress/order-progress.js +37 -45
  279. package/dist/matter/order-progress/order-progress.js.map +1 -1
  280. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  281. package/dist/matter/order-summary/order-summary.js +38 -44
  282. package/dist/matter/order-summary/order-summary.js.map +1 -1
  283. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  284. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  285. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  286. package/dist/matter/payment/payment-card-capture.js +17 -10
  287. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  288. package/dist/matter/payment/payment-controller.d.ts +4 -2
  289. package/dist/matter/payment/payment-controller.js +30 -9
  290. package/dist/matter/payment/payment-controller.js.map +1 -1
  291. package/dist/matter/payment/payment-method-badges.js +1 -1
  292. package/dist/matter/payment/payment.d.ts +69 -19
  293. package/dist/matter/payment/payment.js +101 -35
  294. package/dist/matter/payment/payment.js.map +1 -1
  295. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  296. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  297. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  298. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  299. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  300. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  301. package/dist/matter/place-order/place-order.d.ts +171 -57
  302. package/dist/matter/place-order/place-order.js +376 -185
  303. package/dist/matter/place-order/place-order.js.map +1 -1
  304. package/dist/matter/pricing/pricing.d.ts +152 -13
  305. package/dist/matter/pricing/pricing.js +153 -52
  306. package/dist/matter/pricing/pricing.js.map +1 -1
  307. package/dist/matter/product-information/product-information.d.ts +27 -4
  308. package/dist/matter/product-information/product-information.js +32 -15
  309. package/dist/matter/product-information/product-information.js.map +1 -1
  310. package/dist/matter/product-list/product-list.d.ts +24 -6
  311. package/dist/matter/product-list/product-list.js +32 -26
  312. package/dist/matter/product-list/product-list.js.map +1 -1
  313. package/dist/matter/product-shelf/product-shelf.d.ts +8 -3
  314. package/dist/matter/product-shelf/product-shelf.js +111 -10
  315. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  316. package/dist/matter/region/region.d.ts +33 -16
  317. package/dist/matter/region/region.js +59 -52
  318. package/dist/matter/region/region.js.map +1 -1
  319. package/dist/matter/save-card/save-card.d.ts +43 -8
  320. package/dist/matter/save-card/save-card.js +61 -23
  321. package/dist/matter/save-card/save-card.js.map +1 -1
  322. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  323. package/dist/matter/saved-cards/saved-cards.js +349 -77
  324. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  325. package/dist/matter/shipping-address/address-payload.js +25 -0
  326. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  327. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  328. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  329. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  330. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  331. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  332. package/dist/matter/shipping-address/shipping-address.js +443 -188
  333. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  334. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +251 -25
  335. package/dist/matter/shipping-simulator/shipping-simulator.js +261 -51
  336. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  337. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  338. package/dist/matter/sign-in/sign-in.js +285 -0
  339. package/dist/matter/sign-in/sign-in.js.map +1 -0
  340. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  341. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  342. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  343. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  344. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  345. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  346. package/dist/particles/binding-switcher/binding-switcher.d.ts +59 -0
  347. package/dist/particles/binding-switcher/binding-switcher.js +194 -0
  348. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -0
  349. package/dist/particles/card-summary/card-network.d.ts +17 -0
  350. package/dist/particles/card-summary/card-network.js +25 -0
  351. package/dist/particles/card-summary/card-network.js.map +1 -0
  352. package/dist/particles/card-summary/card-summary.d.ts +113 -0
  353. package/dist/particles/card-summary/card-summary.js +221 -0
  354. package/dist/particles/card-summary/card-summary.js.map +1 -0
  355. package/dist/particles/carousel/carousel.d.ts +99 -11
  356. package/dist/particles/carousel/carousel.js +103 -35
  357. package/dist/particles/carousel/carousel.js.map +1 -1
  358. package/dist/particles/copy-text/copy-text.js +5 -15
  359. package/dist/particles/copy-text/copy-text.js.map +1 -1
  360. package/dist/particles/dialog/dialog.d.ts +14 -6
  361. package/dist/particles/dialog/dialog.js +6 -3
  362. package/dist/particles/dialog/dialog.js.map +1 -1
  363. package/dist/particles/drawer/drawer.js +1 -1
  364. package/dist/particles/drawer/drawer.js.map +1 -1
  365. package/dist/particles/email-field/email-field.d.ts +2 -1
  366. package/dist/particles/email-field/email-field.js +2 -1
  367. package/dist/particles/email-field/email-field.js.map +1 -1
  368. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  369. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  370. package/dist/particles/footer-social/footer-social.d.ts +1 -1
  371. package/dist/particles/footer-social/footer-social.js +1 -1
  372. package/dist/particles/footer-social/footer-social.js.map +1 -1
  373. package/dist/particles/form/form.d.ts +85 -13
  374. package/dist/particles/form/form.js +91 -42
  375. package/dist/particles/form/form.js.map +1 -1
  376. package/dist/particles/gallery/gallery.d.ts +129 -12
  377. package/dist/particles/gallery/gallery.js +121 -34
  378. package/dist/particles/gallery/gallery.js.map +1 -1
  379. package/dist/particles/incentives/incentives.d.ts +1 -1
  380. package/dist/particles/incentives/incentives.js +1 -1
  381. package/dist/particles/incentives/incentives.js.map +1 -1
  382. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  383. package/dist/particles/order-details-back/order-details-back.js +8 -10
  384. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  385. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  386. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  387. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  388. package/dist/particles/password-field/password-field.d.ts +1 -1
  389. package/dist/particles/password-field/password-field.js +2 -4
  390. package/dist/particles/password-field/password-field.js.map +1 -1
  391. package/dist/particles/payment-methods/payment-methods.d.ts +1 -1
  392. package/dist/particles/payment-methods/payment-methods.js +1 -1
  393. package/dist/particles/payment-methods/payment-methods.js.map +1 -1
  394. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  395. package/dist/particles/phone-field/phone-field.js +8 -11
  396. package/dist/particles/phone-field/phone-field.js.map +1 -1
  397. package/dist/particles/spinner/spinner.d.ts +24 -4
  398. package/dist/particles/spinner/spinner.js +25 -9
  399. package/dist/particles/spinner/spinner.js.map +1 -1
  400. package/dist/particles/switch/switch.d.ts +4 -1
  401. package/dist/particles/switch/switch.js +3 -1
  402. package/dist/particles/switch/switch.js.map +1 -1
  403. package/dist/particles/toast/toast.d.ts +49 -9
  404. package/dist/particles/toast/toast.js +81 -15
  405. package/dist/particles/toast/toast.js.map +1 -1
  406. package/dist/schema.graphql +461 -89
  407. package/dist/sdk/actions/index.d.ts +3 -1
  408. package/dist/sdk/actions/index.js +3 -1
  409. package/dist/sdk/actions/locale-action-provider.d.ts +16 -0
  410. package/dist/sdk/actions/locale-action-provider.js +20 -0
  411. package/dist/sdk/actions/locale-action-provider.js.map +1 -0
  412. package/dist/sdk/actions/saved-card-action-provider.d.ts +12 -0
  413. package/dist/sdk/actions/saved-card-action-provider.js +16 -0
  414. package/dist/sdk/actions/saved-card-action-provider.js.map +1 -0
  415. package/dist/sdk/actions/types.d.ts +6 -2
  416. package/dist/sdk/address/address-fields.js +4 -4
  417. package/dist/sdk/address/address-fields.js.map +1 -1
  418. package/dist/sdk/address/constants.js +1 -6
  419. package/dist/sdk/address/constants.js.map +1 -1
  420. package/dist/sdk/address/messages.js +44 -44
  421. package/dist/sdk/address/messages.js.map +1 -1
  422. package/dist/sdk/address/postal-code.js +15 -2
  423. package/dist/sdk/address/postal-code.js.map +1 -1
  424. package/dist/sdk/address/types.d.ts +5 -3
  425. package/dist/sdk/address/validate-address.js +3 -3
  426. package/dist/sdk/address/validate-address.js.map +1 -1
  427. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  428. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  429. package/dist/sdk/cache/storefront-cache.js +2 -1
  430. package/dist/sdk/cache/storefront-cache.js.map +1 -1
  431. package/dist/sdk/cart/operations.d.ts +2 -1
  432. package/dist/sdk/cart/operations.js +55 -1
  433. package/dist/sdk/cart/operations.js.map +1 -1
  434. package/dist/sdk/cart/optimistic.d.ts +30 -7
  435. package/dist/sdk/cart/optimistic.js +78 -41
  436. package/dist/sdk/cart/optimistic.js.map +1 -1
  437. package/dist/sdk/cart/use-cart-actions.d.ts +7 -0
  438. package/dist/sdk/cart/use-cart-actions.js +61 -15
  439. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  440. package/dist/sdk/cart/use-cart-sync-sales-channel.js +70 -0
  441. package/dist/sdk/cart/use-cart-sync-sales-channel.js.map +1 -0
  442. package/dist/sdk/data/index.js +2 -2
  443. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  444. package/dist/sdk/generated/gql.js +16 -12
  445. package/dist/sdk/generated/gql.js.map +1 -1
  446. package/dist/sdk/generated/graphql.d.ts +197 -51
  447. package/dist/sdk/generated/graphql.js +2318 -91
  448. package/dist/sdk/generated/graphql.js.map +1 -1
  449. package/dist/sdk/i18n/format-error-code.js +23 -0
  450. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  451. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  452. package/dist/sdk/i18n/message-formatter.js +140 -0
  453. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  454. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  455. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  456. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  457. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  458. package/dist/sdk/locale/binding-switch-provider.d.ts +13 -0
  459. package/dist/sdk/locale/binding-switch-provider.js +20 -0
  460. package/dist/sdk/locale/binding-switch-provider.js.map +1 -0
  461. package/dist/sdk/locale/use-locale-actions.d.ts +16 -0
  462. package/dist/sdk/locale/use-locale-actions.js +70 -0
  463. package/dist/sdk/locale/use-locale-actions.js.map +1 -0
  464. package/dist/sdk/navigation/binding-switch.d.ts +39 -0
  465. package/dist/sdk/navigation/binding-switch.js +129 -0
  466. package/dist/sdk/navigation/binding-switch.js.map +1 -0
  467. package/dist/sdk/navigation/decode-route-params.d.ts +11 -0
  468. package/dist/sdk/navigation/decode-route-params.js +32 -0
  469. package/dist/sdk/navigation/decode-route-params.js.map +1 -0
  470. package/dist/sdk/navigation/redirect.d.ts +2 -0
  471. package/dist/sdk/navigation/redirect.js +19 -1
  472. package/dist/sdk/navigation/redirect.js.map +1 -1
  473. package/dist/sdk/navigation/types.d.ts +13 -0
  474. package/dist/sdk/payment/bin-format.js +20 -0
  475. package/dist/sdk/payment/bin-format.js.map +1 -0
  476. package/dist/sdk/payment/challenge-return.js +37 -0
  477. package/dist/sdk/payment/challenge-return.js.map +1 -0
  478. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  479. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  480. package/dist/sdk/payment/gateway.d.ts +1 -1
  481. package/dist/sdk/payment/gateway.js +8 -2
  482. package/dist/sdk/payment/gateway.js.map +1 -1
  483. package/dist/sdk/payment/operations.d.ts +1 -0
  484. package/dist/sdk/payment/operations.js +28 -6
  485. package/dist/sdk/payment/operations.js.map +1 -1
  486. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  487. package/dist/sdk/payment/resumed-purchase.js +119 -0
  488. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  489. package/dist/sdk/payment/security-code-mask.js +16 -23
  490. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  491. package/dist/sdk/payment/submission-registry.js +6 -2
  492. package/dist/sdk/payment/submission-registry.js.map +1 -1
  493. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  494. package/dist/sdk/payment/use-payment-actions.js +23 -3
  495. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  496. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  497. package/dist/sdk/payment/use-place-order.js +138 -76
  498. package/dist/sdk/payment/use-place-order.js.map +1 -1
  499. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  500. package/dist/sdk/provider/storefront-provider.js +4 -11
  501. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  502. package/dist/sdk/saved-cards/operations.d.ts +16 -0
  503. package/dist/sdk/saved-cards/operations.js +41 -0
  504. package/dist/sdk/saved-cards/operations.js.map +1 -0
  505. package/dist/sdk/saved-cards/use-saved-card-actions.d.ts +26 -0
  506. package/dist/sdk/saved-cards/use-saved-card-actions.js +86 -0
  507. package/dist/sdk/saved-cards/use-saved-card-actions.js.map +1 -0
  508. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  509. package/dist/sdk/seo/entity-landing.js +30 -0
  510. package/dist/sdk/seo/entity-landing.js.map +1 -0
  511. package/dist/sdk/seo/page-alternates.d.ts +8 -5
  512. package/dist/sdk/seo/page-alternates.js +11 -14
  513. package/dist/sdk/seo/page-alternates.js.map +1 -1
  514. package/dist/sdk/seo/search-landing.d.ts +42 -0
  515. package/dist/sdk/seo/search-landing.js +85 -0
  516. package/dist/sdk/seo/search-landing.js.map +1 -0
  517. package/dist/sdk/session/mock-session.d.ts +9 -0
  518. package/dist/sdk/session/mock-session.js +31 -0
  519. package/dist/sdk/session/mock-session.js.map +1 -0
  520. package/dist/sdk/session/read-server-session.d.ts +3 -0
  521. package/dist/sdk/session/read-server-session.js +5 -0
  522. package/dist/sdk/session/read-server-session.js.map +1 -1
  523. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  524. package/dist/sdk/session/return-path-segment.js +15 -0
  525. package/dist/sdk/session/return-path-segment.js.map +1 -0
  526. package/dist/sdk/session/use-session-actions.js.map +1 -1
  527. package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
  528. package/dist/sdk/shipping/shipping-operations.js +13 -0
  529. package/dist/sdk/shipping/shipping-operations.js.map +1 -1
  530. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  531. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  532. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  533. package/dist/sdk/state/cart.d.ts +9 -2
  534. package/dist/sdk/state/cart.js +9 -2
  535. package/dist/sdk/state/cart.js.map +1 -1
  536. package/dist/utils/safe-href.d.ts +2 -0
  537. package/package.json +4 -3
  538. package/skills/storefront-asset/SKILL.md +2 -2
  539. package/skills/storefront-asset/references/api-side.md +27 -14
  540. package/skills/storefront-asset/references/findings.md +5 -2
  541. package/src/styles/tailwind.css +9 -2
  542. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  543. package/dist/message-locales.json +0 -7
  544. package/dist/sdk/i18n/client.d.ts +0 -4
  545. package/dist/sdk/i18n/client.js +0 -4
  546. package/dist/sdk/i18n/locales.d.ts +0 -8
  547. package/dist/sdk/i18n/locales.js +0 -57
  548. package/dist/sdk/i18n/locales.js.map +0 -1
  549. package/dist/sdk/i18n/messages/en-US.js +0 -164
  550. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  551. package/dist/sdk/i18n/messages/en-US.json +0 -159
  552. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -163
  553. package/dist/sdk/i18n/messages/es-ES.js +0 -164
  554. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  555. package/dist/sdk/i18n/messages/es-ES.json +0 -159
  556. package/dist/sdk/i18n/messages/pt-BR.js +0 -164
  557. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  558. package/dist/sdk/i18n/messages/pt-BR.json +0 -159
  559. package/dist/sdk/i18n/provider.d.ts +0 -1
  560. package/dist/sdk/i18n/provider.js +0 -30
  561. package/dist/sdk/i18n/provider.js.map +0 -1
  562. package/dist/sdk/i18n/server.d.ts +0 -28
  563. package/dist/sdk/i18n/server.js +0 -59
  564. package/dist/sdk/i18n/server.js.map +0 -1
  565. package/dist/utils/resolve-authored-copy.js +0 -18
  566. package/dist/utils/resolve-authored-copy.js.map +0 -1
  567. package/dist/utils/substitute-template.js +0 -33
  568. package/dist/utils/substitute-template.js.map +0 -1
@@ -0,0 +1,1011 @@
1
+ "use client";
2
+ import { defineComponent } from "../../core/dist/define-component.js";
3
+ import { defineContentType } from "../../core/dist/define-content-type.js";
4
+ import "../../core/dist/index.js";
5
+ import { signInTarget } from "../../utils/safe-href.js";
6
+ import { useStorefrontFormatters } from "../../sdk/format/client.js";
7
+ import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
8
+ import { useStorefrontRoute } from "../../sdk/navigation/use-storefront-route.js";
9
+ import { graphql } from "../../sdk/generated/gql.js";
10
+ import { ActionsOverrideContext, useActionsOverride } from "../../sdk/actions/actions-override-context.js";
11
+ import { useDataOverride } from "../../sdk/data/data-override-context.js";
12
+ import { useSession } from "../session/session.js";
13
+ import { ReactiveRootContext } from "../../sdk/data/page-reactive-data-root.js";
14
+ import { NavigationLink } from "../../particles/navigation-link/navigation-link.js";
15
+ import { ListItemRefContext } from "../../sdk/data/list-item-ref-context.js";
16
+ import { AlertDialogClose, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger } from "../../particles/alert-dialog/alert-dialog.js";
17
+ import { CardSummary, CardSummaryRoot, useCardSummary } from "../../particles/card-summary/card-summary.js";
18
+ import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
19
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
20
+ import { CombinedGraphQLErrors } from "@apollo/client/errors";
21
+ //#region src/matter/account-saved-cards/account-saved-cards.tsx
22
+ /**
23
+ * The signed-in shopper's saved cards in the account.
24
+ * The Root reads card ids only; each AccountSavedCardItem subscribes to its own CustomerSavedCard
25
+ * (ADR-0012) and provides `card-summary` and the row itself, so the schema arranges the CardSummary
26
+ * parts and AccountSavedCardExpiry in the row.
27
+ * Every text is children or else the part's own `$content` message; the expiry line, repeated per row,
28
+ * takes no children.
29
+ * Removal state lives in the Root, because a successful removal unmounts the row it started from. The
30
+ * Root also declares the `savedCard.remove` write, so every remove control in the section reaches the
31
+ * provider.
32
+ */
33
+ const fragment = graphql(`
34
+ fragment AccountSavedCardsData on Query {
35
+ customerSavedCards {
36
+ __typename
37
+ id
38
+ cards {
39
+ __typename
40
+ id
41
+ }
42
+ }
43
+ }
44
+ `);
45
+ const itemFragment = graphql(`
46
+ fragment AccountSavedCardItemData on Query {
47
+ customerSavedCards {
48
+ cards {
49
+ __typename
50
+ id
51
+ network {
52
+ name
53
+ }
54
+ lastDigits
55
+ expiry {
56
+ month
57
+ year
58
+ }
59
+ status
60
+ }
61
+ }
62
+ }
63
+ `);
64
+ const AccountSavedCardsHeadingContent = defineContentType({
65
+ id: "account-saved-cards-heading",
66
+ title: "Account Saved Cards Heading",
67
+ description: "Heading of the account's saved-cards section.",
68
+ schema: {
69
+ type: "object",
70
+ additionalProperties: false,
71
+ properties: { text: {
72
+ type: "string",
73
+ minLength: 1,
74
+ title: "Heading",
75
+ format: "icu-message",
76
+ messageSource: "Saved cards"
77
+ } }
78
+ }
79
+ });
80
+ const AccountSavedCardsEmptyContent = defineContentType({
81
+ id: "account-saved-cards-empty",
82
+ title: "Account Saved Cards Empty",
83
+ description: "Statement shown when the shopper has no saved cards.",
84
+ schema: {
85
+ type: "object",
86
+ additionalProperties: false,
87
+ properties: { text: {
88
+ type: "string",
89
+ minLength: 1,
90
+ title: "Empty statement",
91
+ format: "icu-message",
92
+ messageSource: "You have no saved cards yet."
93
+ } }
94
+ }
95
+ });
96
+ const AccountSavedCardsLoadingContent = defineContentType({
97
+ id: "account-saved-cards-loading",
98
+ title: "Account Saved Cards Loading",
99
+ description: "Announcement read to assistive technology while the saved cards load.",
100
+ schema: {
101
+ type: "object",
102
+ additionalProperties: false,
103
+ properties: { text: {
104
+ type: "string",
105
+ minLength: 1,
106
+ title: "Loading announcement",
107
+ format: "icu-message",
108
+ messageSource: "Loading your saved cards…"
109
+ } }
110
+ }
111
+ });
112
+ const AccountSavedCardsErrorContent = defineContentType({
113
+ id: "account-saved-cards-error",
114
+ title: "Account Saved Cards Error",
115
+ description: "Messages shown when the saved cards cannot be read.",
116
+ schema: {
117
+ type: "object",
118
+ additionalProperties: false,
119
+ properties: {
120
+ text: {
121
+ type: "string",
122
+ minLength: 1,
123
+ title: "Load failure message",
124
+ format: "icu-message",
125
+ messageSource: "We couldn't load your saved cards. Please try again later."
126
+ },
127
+ sessionExpiredText: {
128
+ type: "string",
129
+ minLength: 1,
130
+ title: "Session expired message",
131
+ format: "icu-message",
132
+ messageSource: "Your session has expired."
133
+ },
134
+ signInLabel: {
135
+ type: "string",
136
+ minLength: 1,
137
+ title: "Sign-in link label",
138
+ format: "icu-message",
139
+ messageSource: "Sign in again"
140
+ }
141
+ }
142
+ }
143
+ });
144
+ const AccountSavedCardExpiryContent = defineContentType({
145
+ id: "account-saved-card-expiry",
146
+ title: "Account Saved Card Expiry",
147
+ description: "A saved card's expiry line. The date follows the label and is never authored.",
148
+ schema: {
149
+ type: "object",
150
+ additionalProperties: false,
151
+ properties: {
152
+ expiresLabel: {
153
+ type: "string",
154
+ minLength: 1,
155
+ title: "Label before a working card's date",
156
+ format: "icu-message",
157
+ messageSource: "Expires"
158
+ },
159
+ expiredLabel: {
160
+ type: "string",
161
+ minLength: 1,
162
+ title: "Label before an expired card's date",
163
+ format: "icu-message",
164
+ messageSource: "Expired"
165
+ },
166
+ expiredText: {
167
+ type: "string",
168
+ minLength: 1,
169
+ title: "Expired card with no date",
170
+ format: "icu-message",
171
+ messageSource: "Expired"
172
+ },
173
+ unusableText: {
174
+ type: "string",
175
+ minLength: 1,
176
+ title: "Unusable card",
177
+ format: "icu-message",
178
+ messageSource: "This card can't be used"
179
+ }
180
+ }
181
+ }
182
+ });
183
+ const AccountSavedCardRemoveTriggerContent = defineContentType({
184
+ id: "account-saved-card-remove-trigger",
185
+ title: "Account Saved Card Remove Trigger",
186
+ description: "Label of the control that opens a saved card's removal prompt, and the card's last digits read to assistive technology.",
187
+ schema: {
188
+ type: "object",
189
+ additionalProperties: false,
190
+ properties: {
191
+ text: {
192
+ type: "string",
193
+ minLength: 1,
194
+ title: "Trigger label",
195
+ format: "icu-message",
196
+ messageSource: "Remove"
197
+ },
198
+ cardEndingIn: {
199
+ type: "string",
200
+ minLength: 1,
201
+ title: "Card last digits",
202
+ description: "Read to assistive technology after the card name.",
203
+ format: "icu-message",
204
+ messageSource: "ending in {lastDigits}",
205
+ messageArguments: {
206
+ type: "object",
207
+ properties: { lastDigits: { type: "string" } }
208
+ },
209
+ messageExample: { lastDigits: "4242" }
210
+ }
211
+ }
212
+ }
213
+ });
214
+ const AccountSavedCardRemoveTitleContent = defineContentType({
215
+ id: "account-saved-card-remove-title",
216
+ title: "Account Saved Card Remove Title",
217
+ description: "Question that titles the removal prompt.",
218
+ schema: {
219
+ type: "object",
220
+ additionalProperties: false,
221
+ properties: { text: {
222
+ type: "string",
223
+ minLength: 1,
224
+ title: "Prompt title",
225
+ format: "icu-message",
226
+ messageSource: "Remove this card?"
227
+ } }
228
+ }
229
+ });
230
+ const AccountSavedCardRemoveDescriptionContent = defineContentType({
231
+ id: "account-saved-card-remove-body",
232
+ title: "Account Saved Card Remove Description",
233
+ description: "What removing the card means, shown after the card in the removal prompt, and the card's last digits read to assistive technology.",
234
+ schema: {
235
+ type: "object",
236
+ additionalProperties: false,
237
+ properties: {
238
+ text: {
239
+ type: "string",
240
+ minLength: 1,
241
+ title: "Consequence",
242
+ format: "icu-message",
243
+ messageSource: "It will no longer be offered when you pay. This can't be undone."
244
+ },
245
+ cardEndingIn: {
246
+ type: "string",
247
+ minLength: 1,
248
+ title: "Card last digits",
249
+ description: "Read to assistive technology after the card name.",
250
+ format: "icu-message",
251
+ messageSource: "ending in {lastDigits}",
252
+ messageArguments: {
253
+ type: "object",
254
+ properties: { lastDigits: { type: "string" } }
255
+ },
256
+ messageExample: { lastDigits: "4242" }
257
+ }
258
+ }
259
+ }
260
+ });
261
+ const AccountSavedCardRemoveCancelContent = defineContentType({
262
+ id: "account-saved-card-remove-cancel",
263
+ title: "Account Saved Card Remove Cancel",
264
+ description: "Label of the control that keeps the card.",
265
+ schema: {
266
+ type: "object",
267
+ additionalProperties: false,
268
+ properties: { text: {
269
+ type: "string",
270
+ minLength: 1,
271
+ title: "Cancel label",
272
+ format: "icu-message",
273
+ messageSource: "Cancel"
274
+ } }
275
+ }
276
+ });
277
+ const AccountSavedCardRemoveConfirmContent = defineContentType({
278
+ id: "account-saved-card-remove-confirm",
279
+ title: "Account Saved Card Remove Confirm",
280
+ description: "Label of the control that removes the card, and its label while the removal runs.",
281
+ schema: {
282
+ type: "object",
283
+ additionalProperties: false,
284
+ properties: {
285
+ text: {
286
+ type: "string",
287
+ minLength: 1,
288
+ title: "Confirm label",
289
+ format: "icu-message",
290
+ messageSource: "Remove card"
291
+ },
292
+ pendingText: {
293
+ type: "string",
294
+ minLength: 1,
295
+ title: "Label while removing",
296
+ format: "icu-message",
297
+ messageSource: "Removing…"
298
+ }
299
+ }
300
+ }
301
+ });
302
+ const AccountSavedCardsRemoveFeedbackContent = defineContentType({
303
+ id: "account-saved-cards-remove-feedback",
304
+ title: "Account Saved Cards Remove Feedback",
305
+ description: "Messages that tell the shopper how a card removal ended.",
306
+ schema: {
307
+ type: "object",
308
+ additionalProperties: false,
309
+ properties: {
310
+ successText: {
311
+ type: "string",
312
+ minLength: 1,
313
+ title: "Card removed",
314
+ format: "icu-message",
315
+ messageSource: "The card was removed."
316
+ },
317
+ failureText: {
318
+ type: "string",
319
+ minLength: 1,
320
+ title: "Card not removed",
321
+ format: "icu-message",
322
+ messageSource: "We couldn't remove the card. Please try again."
323
+ },
324
+ sessionExpiredText: {
325
+ type: "string",
326
+ minLength: 1,
327
+ title: "Session expired message",
328
+ format: "icu-message",
329
+ messageSource: "Your session has expired."
330
+ },
331
+ signInLabel: {
332
+ type: "string",
333
+ minLength: 1,
334
+ title: "Sign-in link label",
335
+ format: "icu-message",
336
+ messageSource: "Sign in again"
337
+ }
338
+ }
339
+ }
340
+ });
341
+ const AccountSavedCardsContext = createContext(null);
342
+ /** The section state the nearest AccountSavedCardsRoot publishes. Throws outside one. */
343
+ function useAccountSavedCards() {
344
+ const ctx = useContext(AccountSavedCardsContext);
345
+ if (!ctx) throw new Error("AccountSavedCards parts must be used inside AccountSavedCardsRoot.");
346
+ return ctx;
347
+ }
348
+ const AccountSavedCardContext = createContext(null);
349
+ /** The card the nearest AccountSavedCardItem provides. Throws outside one. */
350
+ function useAccountSavedCard() {
351
+ const ctx = useContext(AccountSavedCardContext);
352
+ if (!ctx) throw new Error("AccountSavedCard parts must be used inside AccountSavedCardItem.");
353
+ return ctx;
354
+ }
355
+ const AccountSavedCardRemoveContext = createContext(null);
356
+ /** The remove controller the nearest AccountSavedCardRemove provides. Throws outside one. */
357
+ function useAccountSavedCardRemove() {
358
+ const ctx = useContext(AccountSavedCardRemoveContext);
359
+ if (!ctx) throw new Error("AccountSavedCardRemove parts must be used inside AccountSavedCardRemove.");
360
+ return ctx;
361
+ }
362
+ /** Only an explicit USABLE reads as usable, so a status this client does not know never looks usable. */
363
+ function savedCardState(status) {
364
+ if (status === "USABLE") return "usable";
365
+ if (status === "EXPIRED") return "expired";
366
+ return "unusable";
367
+ }
368
+ function validExpiry(expiry) {
369
+ if (!expiry) return null;
370
+ const { month, year } = expiry;
371
+ if (!Number.isInteger(month) || month < 1 || month > 12) return null;
372
+ if (!Number.isInteger(year) || year < 1e3 || year > 9999) return null;
373
+ return {
374
+ month,
375
+ year
376
+ };
377
+ }
378
+ const EMPTY_CARDS = Object.freeze([]);
379
+ /**
380
+ * The read's own error code. The root error is page-wide, so an error whose path names another field
381
+ * does not count; with no path at all, the first code stands.
382
+ */
383
+ function readErrorCode(error) {
384
+ if (!CombinedGraphQLErrors.is(error)) return null;
385
+ const code = (error.errors.find((entry) => entry.path?.[0] === "customerSavedCards") ?? error.errors.find((entry) => entry.path == null))?.extensions?.code;
386
+ return typeof code === "string" ? code : null;
387
+ }
388
+ /**
389
+ * One state for the whole section. A null slice plus an error is a failed read; an error beside a
390
+ * resolved slice belongs to another field of the page query and changes nothing here.
391
+ */
392
+ function resolveSectionState(data, loading, error) {
393
+ if (data == null) {
394
+ if (error) return {
395
+ state: "error",
396
+ cards: EMPTY_CARDS,
397
+ errorCode: readErrorCode(error)
398
+ };
399
+ return {
400
+ state: loading ? "loading" : "idle",
401
+ cards: EMPTY_CARDS,
402
+ errorCode: null
403
+ };
404
+ }
405
+ const cards = data.cards ?? EMPTY_CARDS;
406
+ return {
407
+ state: cards.length === 0 ? "empty" : "ready",
408
+ cards,
409
+ errorCode: null
410
+ };
411
+ }
412
+ const AccountSavedCardsRootDefinition = defineComponent({
413
+ name: "AccountSavedCardsRoot",
414
+ importPath: "@vtex/faststore/components",
415
+ component: AccountSavedCardsRoot,
416
+ fragment,
417
+ fetchStrategy: "reactive",
418
+ requiresContext: "session",
419
+ providesContext: "account-saved-cards",
420
+ actions: { savedCard: ["remove"] },
421
+ editor: {
422
+ label: "Account Saved Cards Root",
423
+ category: "identity"
424
+ },
425
+ schema: {},
426
+ guideline: "The signed-in shopper's saved cards, read with no cart. Renders nothing unless the session is loggedIn, and no chrome of its own: compose AccountSavedCardsHeading, AccountSavedCardsRemoveFeedback, AccountSavedCardsLoading, AccountSavedCardsError, AccountSavedCardsEmpty, and AccountSavedCardsList (with an AccountSavedCardItem inside) as children. Exactly one of Loading, Error, Empty, or List renders at a time; the state is on data-fs-account-saved-cards-state. It owns the removal state and supplies the savedCard.remove write to every AccountSavedCardRemove inside, so the write sits here rather than on the control that dispatches it; with no remove control composed the write is never called. Must be inside a SessionRoot, normally the my-account layout's. See account-saved-cards.md."
427
+ });
428
+ const AccountSavedCardsHeadingDefinition = defineComponent({
429
+ name: "AccountSavedCardsHeading",
430
+ importPath: "@vtex/faststore/components",
431
+ component: AccountSavedCardsHeading,
432
+ content: AccountSavedCardsHeadingContent,
433
+ requiresContext: "account-saved-cards",
434
+ editor: {
435
+ label: "Account Saved Cards Heading",
436
+ category: "identity"
437
+ },
438
+ schema: { as: {
439
+ type: [
440
+ "h2",
441
+ "h3",
442
+ "h4",
443
+ "h5",
444
+ "h6"
445
+ ],
446
+ default: "h2",
447
+ label: "Heading level"
448
+ } },
449
+ guideline: "The section heading, rendered in every state. `as` sets the level from h2 to h6 (default h2); there is no h1, because the page title belongs to the page shell — pick the level that fits where the section is nested, or omit the heading. Text is children, or else the text message. Must be inside AccountSavedCardsRoot."
450
+ });
451
+ const AccountSavedCardsListDefinition = defineComponent({
452
+ name: "AccountSavedCardsList",
453
+ importPath: "@vtex/faststore/components",
454
+ component: AccountSavedCardsList,
455
+ requiresContext: "account-saved-cards",
456
+ providesContext: "account-saved-card",
457
+ editor: {
458
+ label: "Account Saved Cards List",
459
+ category: "identity"
460
+ },
461
+ schema: {},
462
+ guideline: "The list of saved cards, one row per card in the platform order, rendered only when the shopper has at least one. Place one AccountSavedCardItem inside as the row template. Must be inside AccountSavedCardsRoot."
463
+ });
464
+ const AccountSavedCardItemDefinition = defineComponent({
465
+ name: "AccountSavedCardItem",
466
+ importPath: "@vtex/faststore/components",
467
+ component: AccountSavedCardItem,
468
+ fragment: itemFragment,
469
+ fetchStrategy: "reactive-list-item",
470
+ requiresContext: "account-saved-card",
471
+ providesContext: ["card-summary", "account-saved-card-data"],
472
+ editor: {
473
+ label: "Account Saved Card Item",
474
+ category: "identity"
475
+ },
476
+ schema: {},
477
+ guideline: "One saved card as a list row. It provides the card to the CardSummary parts, AccountSavedCardExpiry, and AccountSavedCardRemove. It renders only its children, so compose CardSummary, AccountSavedCardExpiry and AccountSavedCardRemove in it; keep AccountSavedCardExpiry in any row, and leave AccountSavedCardRemove out only for a read-only list. An expired row carries data-fs-account-saved-card-expired, an unusable one data-fs-account-saved-card-unusable, and a row whose removal is pending data-fs-account-saved-card-removing, for a swatch to dim. Never shows more than the last four digits. Must be inside AccountSavedCardsList."
478
+ });
479
+ const AccountSavedCardExpiryDefinition = defineComponent({
480
+ name: "AccountSavedCardExpiry",
481
+ importPath: "@vtex/faststore/components",
482
+ component: AccountSavedCardExpiry,
483
+ content: AccountSavedCardExpiryContent,
484
+ requiresContext: "account-saved-card-data",
485
+ editor: {
486
+ label: "Account Saved Card Expiry",
487
+ category: "identity"
488
+ },
489
+ schema: {},
490
+ guideline: "When a saved card expires: \"Expires 05/28\" for a working card, \"Expired 05/24\" (or \"Expired\" with no date) for an expired one, and \"This card can't be used\", with no date, for an unusable one. Renders nothing for a working card with no date. The label is the expiresLabel, expiredLabel, expiredText or unusableText message; the component always places the MM/YY date after it. The state is on data-fs-account-saved-card-expiry-status (usable, expired, unusable). Must be inside AccountSavedCardItem."
491
+ });
492
+ const AccountSavedCardsEmptyDefinition = defineComponent({
493
+ name: "AccountSavedCardsEmpty",
494
+ importPath: "@vtex/faststore/components",
495
+ component: AccountSavedCardsEmpty,
496
+ content: AccountSavedCardsEmptyContent,
497
+ requiresContext: "account-saved-cards",
498
+ editor: {
499
+ label: "Account Saved Cards Empty",
500
+ category: "identity"
501
+ },
502
+ schema: {},
503
+ guideline: "States that the shopper has no saved cards. Renders only once the read resolved with none — never while loading or after a failure. Text is children, or else the text message. Must be inside AccountSavedCardsRoot."
504
+ });
505
+ const AccountSavedCardsLoadingDefinition = defineComponent({
506
+ name: "AccountSavedCardsLoading",
507
+ importPath: "@vtex/faststore/components",
508
+ component: AccountSavedCardsLoading,
509
+ content: AccountSavedCardsLoadingContent,
510
+ requiresContext: "account-saved-cards",
511
+ editor: {
512
+ label: "Account Saved Cards Loading",
513
+ category: "identity"
514
+ },
515
+ schema: { skeletonCount: {
516
+ type: "number",
517
+ default: 2,
518
+ label: "Placeholder rows"
519
+ } },
520
+ guideline: "Placeholder rows while the saved cards load, plus one polite live region that announces the wait (the text message). The rows are hidden from assistive technology; style them through data-fs-account-saved-cards-loading-row. Without this part the section shows no loading look. Must be inside AccountSavedCardsRoot."
521
+ });
522
+ const AccountSavedCardsErrorDefinition = defineComponent({
523
+ name: "AccountSavedCardsError",
524
+ importPath: "@vtex/faststore/components",
525
+ component: AccountSavedCardsError,
526
+ content: AccountSavedCardsErrorContent,
527
+ requiresContext: "account-saved-cards",
528
+ editor: {
529
+ label: "Account Saved Cards Error",
530
+ category: "identity"
531
+ },
532
+ schema: {},
533
+ guideline: "An alert shown when the saved cards cannot be read. An expired session says so and links to sign-in, returning the shopper to this page; any other failure says the cards could not be loaded. The wording is the sessionExpiredText, signInLabel and text messages, never from the server; children replace it for every failure and drop the link. Must be inside AccountSavedCardsRoot."
534
+ });
535
+ const AccountSavedCardRemoveDefinition = defineComponent({
536
+ name: "AccountSavedCardRemove",
537
+ importPath: "@vtex/faststore/components",
538
+ component: AccountSavedCardRemove,
539
+ requiresContext: "account-saved-card-data",
540
+ providesContext: "account-saved-card-remove",
541
+ editor: {
542
+ label: "Account Saved Card Remove",
543
+ category: "identity"
544
+ },
545
+ schema: {},
546
+ guideline: "Lets the shopper remove the row's card after confirming. State-only controller: wrap one AlertDialogRoot and it becomes controlled, so never set open or onOpenChange on it. Compose AlertDialogRoot > (AccountSavedCardRemoveTrigger + AlertDialogPortal > (AlertDialogBackdrop + AlertDialogViewport > AlertDialogPopup > (AccountSavedCardRemoveTitle + AccountSavedCardRemoveDescription + AccountSavedCardRemoveCancel + AccountSavedCardRemoveConfirm))), Cancel before Confirm so the safe action takes focus. With no children it renders nothing. The prompt stays open while the removal runs and closes when it fails; on success the row leaves the list. AccountSavedCardsRoot supplies the savedCard.remove write, and the outcome goes unreported unless the section composes AccountSavedCardsRemoveFeedback. Must be inside AccountSavedCardItem."
547
+ });
548
+ const AccountSavedCardRemoveTriggerDefinition = defineComponent({
549
+ name: "AccountSavedCardRemoveTrigger",
550
+ importPath: "@vtex/faststore/components",
551
+ component: AccountSavedCardRemoveTrigger,
552
+ content: AccountSavedCardRemoveTriggerContent,
553
+ requiresContext: "account-saved-card-remove",
554
+ editor: {
555
+ label: "Account Saved Card Remove Trigger",
556
+ category: "identity"
557
+ },
558
+ schema: {},
559
+ guideline: "Opens the removal prompt. Its accessible name is its text followed by the card, e.g. \"Remove Visa ending in 1234\"; the card part is visually hidden. Disabled while any removal in the section is pending. Text is children, or else the text message; the card part is the cardEndingIn message. Direct child of the AlertDialogRoot inside AccountSavedCardRemove."
560
+ });
561
+ const AccountSavedCardRemoveTitleDefinition = defineComponent({
562
+ name: "AccountSavedCardRemoveTitle",
563
+ importPath: "@vtex/faststore/components",
564
+ component: AccountSavedCardRemoveTitle,
565
+ content: AccountSavedCardRemoveTitleContent,
566
+ requiresContext: "account-saved-card-remove",
567
+ editor: {
568
+ label: "Account Saved Card Remove Title",
569
+ category: "identity"
570
+ },
571
+ schema: {},
572
+ guideline: "The removal prompt's question and its accessible name. Required inside AlertDialogPopup. Text is children, or else the text message. Must be inside AccountSavedCardRemove."
573
+ });
574
+ const AccountSavedCardRemoveDescriptionDefinition = defineComponent({
575
+ name: "AccountSavedCardRemoveDescription",
576
+ importPath: "@vtex/faststore/components",
577
+ component: AccountSavedCardRemoveDescription,
578
+ content: AccountSavedCardRemoveDescriptionContent,
579
+ requiresContext: "account-saved-card-remove",
580
+ editor: {
581
+ label: "Account Saved Card Remove Description",
582
+ category: "identity"
583
+ },
584
+ schema: {},
585
+ guideline: "Names the card and states the consequence; screen readers announce it with the prompt. With no children it renders CardSummary, which reads the cardEndingIn message of this part as its endingIn, and then the text message; children replace both, so keep a CardSummary in them for the prompt to name the card. Inside AlertDialogPopup, after AccountSavedCardRemoveTitle. Must be inside AccountSavedCardRemove."
586
+ });
587
+ const AccountSavedCardRemoveCancelDefinition = defineComponent({
588
+ name: "AccountSavedCardRemoveCancel",
589
+ importPath: "@vtex/faststore/components",
590
+ component: AccountSavedCardRemoveCancel,
591
+ content: AccountSavedCardRemoveCancelContent,
592
+ requiresContext: "account-saved-card-remove",
593
+ editor: {
594
+ label: "Account Saved Card Remove Cancel",
595
+ category: "identity"
596
+ },
597
+ schema: {},
598
+ guideline: "Closes the removal prompt and keeps the card. Disabled while the removal runs. Place it before AccountSavedCardRemoveConfirm so it takes focus when the prompt opens. Text is children, or else the text message. Must be inside AccountSavedCardRemove."
599
+ });
600
+ const AccountSavedCardRemoveConfirmDefinition = defineComponent({
601
+ name: "AccountSavedCardRemoveConfirm",
602
+ importPath: "@vtex/faststore/components",
603
+ component: AccountSavedCardRemoveConfirm,
604
+ content: AccountSavedCardRemoveConfirmContent,
605
+ requiresContext: "account-saved-card-remove",
606
+ editor: {
607
+ label: "Account Saved Card Remove Confirm",
608
+ category: "identity"
609
+ },
610
+ schema: {},
611
+ guideline: "Removes the card. It dispatches savedCard.remove through the write AccountSavedCardsRoot supplies and declares none of its own. While the removal runs it is busy and shows its pending text; one removal runs at a time in the section. Text is children, or else the text message; the pendingText message while removing. Must be inside AccountSavedCardRemove."
612
+ });
613
+ const AccountSavedCardsRemoveFeedbackDefinition = defineComponent({
614
+ name: "AccountSavedCardsRemoveFeedback",
615
+ importPath: "@vtex/faststore/components",
616
+ component: AccountSavedCardsRemoveFeedback,
617
+ content: AccountSavedCardsRemoveFeedbackContent,
618
+ requiresContext: "account-saved-cards",
619
+ editor: {
620
+ label: "Account Saved Cards Remove Feedback",
621
+ category: "identity"
622
+ },
623
+ schema: {},
624
+ guideline: "Tells the shopper how a card removal ended: a status message that takes focus when the card was removed, or an alert when it was not, with a sign-in link back to this page when the session expired. Renders in every state of the section, so the message outlives the removed row and an emptied list; it stays until the next removal starts. Without this part a removal's outcome goes unreported. The wording is the successText, failureText, sessionExpiredText and signInLabel messages, never the server's; the outcome is on data-fs-account-saved-cards-remove-feedback-outcome. Must be inside AccountSavedCardsRoot."
625
+ });
626
+ /**
627
+ * One removal at a time: each success replaces the whole cached list, so two in flight could land out
628
+ * of order and restore a card the later one removed.
629
+ */
630
+ function useRemovalState() {
631
+ const [pendingId, setPendingId] = useState(null);
632
+ const [outcome, setOutcome] = useState(null);
633
+ const pendingRef = useRef(null);
634
+ const begin = useCallback((id) => {
635
+ if (pendingRef.current !== null) return false;
636
+ pendingRef.current = id;
637
+ setPendingId(id);
638
+ setOutcome(null);
639
+ return true;
640
+ }, []);
641
+ const settle = useCallback((id, userErrors) => {
642
+ if (pendingRef.current !== id) return;
643
+ pendingRef.current = null;
644
+ setPendingId(null);
645
+ const [first] = userErrors;
646
+ setOutcome(first ? {
647
+ kind: "failed",
648
+ code: first.code
649
+ } : { kind: "removed" });
650
+ }, []);
651
+ return useMemo(() => ({
652
+ pendingId,
653
+ outcome,
654
+ begin,
655
+ settle
656
+ }), [
657
+ pendingId,
658
+ outcome,
659
+ begin,
660
+ settle
661
+ ]);
662
+ }
663
+ function AccountSavedCardsRoot({ $data: $dataProp, $actions: $actionsProp, className, children, ...props }) {
664
+ const { state: sessionState } = useSession();
665
+ const data = useDataOverride($dataProp) ?? null;
666
+ const $actions = useActionsOverride($actionsProp);
667
+ const { loading, error } = useContext(ReactiveRootContext);
668
+ const section = useMemo(() => resolveSectionState(data, loading, error), [
669
+ data,
670
+ loading,
671
+ error
672
+ ]);
673
+ const removal = useRemovalState();
674
+ const value = useMemo(() => ({
675
+ ...section,
676
+ removal
677
+ }), [section, removal]);
678
+ if (sessionState !== "loggedIn") return null;
679
+ return /* @__PURE__ */ jsx(AccountSavedCardsContext, {
680
+ value,
681
+ children: /* @__PURE__ */ jsx(ActionsOverrideContext, {
682
+ value: $actions,
683
+ children: /* @__PURE__ */ jsx("div", {
684
+ ...props,
685
+ className,
686
+ "data-fs-account-saved-cards": "",
687
+ "data-fs-account-saved-cards-state": value.state,
688
+ children
689
+ })
690
+ })
691
+ });
692
+ }
693
+ function AccountSavedCardsHeading({ as: Tag = "h2", $content, $locale, className, children, ...props }) {
694
+ useAccountSavedCards();
695
+ const { format } = useMessageFormatter(AccountSavedCardsHeadingContent, $content);
696
+ return /* @__PURE__ */ jsx(Tag, {
697
+ ...props,
698
+ className,
699
+ "data-fs-account-saved-cards-heading": "",
700
+ children: children ?? format("text")
701
+ });
702
+ }
703
+ function AccountSavedCardsList({ className, children, ...props }) {
704
+ const { state, cards } = useAccountSavedCards();
705
+ if (state !== "ready") return null;
706
+ return /* @__PURE__ */ jsx("ul", {
707
+ ...props,
708
+ className,
709
+ "data-fs-account-saved-cards-list": "",
710
+ children: cards.map((card) => /* @__PURE__ */ jsx(ListItemRefContext, {
711
+ value: {
712
+ __typename: "CustomerSavedCard",
713
+ id: card.id,
714
+ fallbackData: void 0
715
+ },
716
+ children
717
+ }, card.id))
718
+ });
719
+ }
720
+ function AccountSavedCardItem({ $data: $dataProp, className, children, ...props }) {
721
+ const card = useDataOverride($dataProp) ?? null;
722
+ const pendingId = useContext(AccountSavedCardsContext)?.removal.pendingId ?? null;
723
+ if (!card) return null;
724
+ const state = savedCardState(card.status);
725
+ return /* @__PURE__ */ jsx(AccountSavedCardContext, {
726
+ value: card,
727
+ children: /* @__PURE__ */ jsx("li", {
728
+ ...props,
729
+ className,
730
+ "data-fs-account-saved-card": "",
731
+ ...state === "expired" ? { "data-fs-account-saved-card-expired": "" } : {},
732
+ ...state === "unusable" ? { "data-fs-account-saved-card-unusable": "" } : {},
733
+ ...pendingId === card.id ? { "data-fs-account-saved-card-removing": "" } : {},
734
+ children: /* @__PURE__ */ jsx(CardSummaryRoot, {
735
+ network: card.network.name,
736
+ lastDigits: card.lastDigits,
737
+ children
738
+ })
739
+ })
740
+ });
741
+ }
742
+ function AccountSavedCardExpiry({ $content, $locale, className, ...props }) {
743
+ const { status, expiry } = useAccountSavedCard();
744
+ const { format } = useMessageFormatter(AccountSavedCardExpiryContent, $content);
745
+ const { formatDate } = useStorefrontFormatters();
746
+ const state = savedCardState(status);
747
+ const date = state === "unusable" ? null : validExpiry(expiry);
748
+ if (state === "usable" && !date) return null;
749
+ let label;
750
+ if (state === "unusable") label = format("unusableText");
751
+ else if (!date) label = format("expiredText");
752
+ else if (state === "expired") label = format("expiredLabel");
753
+ else label = format("expiresLabel");
754
+ const month = date ? String(date.month).padStart(2, "0") : "";
755
+ return /* @__PURE__ */ jsxs("p", {
756
+ ...props,
757
+ className,
758
+ "data-fs-account-saved-card-expiry": "",
759
+ "data-fs-account-saved-card-expiry-status": state,
760
+ children: [/* @__PURE__ */ jsx("span", {
761
+ "data-fs-account-saved-card-expiry-label": "",
762
+ children: label
763
+ }), date ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
764
+ " ",
765
+ /* @__PURE__ */ jsx("time", {
766
+ "data-fs-account-saved-card-expiry-date": "",
767
+ dateTime: `${date.year}-${month}`,
768
+ "aria-hidden": "true",
769
+ children: `${month}/${String(date.year % 100).padStart(2, "0")}`
770
+ }),
771
+ " ",
772
+ /* @__PURE__ */ jsx("span", {
773
+ "data-fs-sr-only": "",
774
+ className: "sr-only",
775
+ children: formatDate(Date.UTC(date.year, date.month - 1, 1), {
776
+ month: "long",
777
+ year: "numeric",
778
+ timeZone: "UTC"
779
+ })
780
+ })
781
+ ] }) : null]
782
+ });
783
+ }
784
+ function AccountSavedCardsEmpty({ $content, $locale, className, children, ...props }) {
785
+ const { state } = useAccountSavedCards();
786
+ const { format } = useMessageFormatter(AccountSavedCardsEmptyContent, $content);
787
+ if (state !== "empty") return null;
788
+ return /* @__PURE__ */ jsx("p", {
789
+ ...props,
790
+ className,
791
+ "data-fs-account-saved-cards-empty": "",
792
+ children: children ?? format("text")
793
+ });
794
+ }
795
+ const DEFAULT_SKELETON_COUNT = 2;
796
+ function AccountSavedCardsLoading({ skeletonCount = DEFAULT_SKELETON_COUNT, $content, $locale, className, ...props }) {
797
+ const { state } = useAccountSavedCards();
798
+ const { format } = useMessageFormatter(AccountSavedCardsLoadingContent, $content);
799
+ const loading = state === "loading";
800
+ const rows = Number.isFinite(skeletonCount) ? Math.max(1, Math.trunc(skeletonCount)) : DEFAULT_SKELETON_COUNT;
801
+ const [announcement, setAnnouncement] = useState("");
802
+ const pendingLabel = loading ? format("text") : "";
803
+ useEffect(() => {
804
+ setAnnouncement(pendingLabel);
805
+ }, [pendingLabel]);
806
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [loading ? /* @__PURE__ */ jsx("div", {
807
+ ...props,
808
+ className,
809
+ "aria-hidden": "true",
810
+ "data-fs-account-saved-cards-loading": "",
811
+ children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsx("span", { "data-fs-account-saved-cards-loading-row": "" }, index))
812
+ }) : null, /* @__PURE__ */ jsx("output", {
813
+ "aria-live": "polite",
814
+ "data-fs-account-saved-cards-loading-announcement": "",
815
+ children: announcement
816
+ })] });
817
+ }
818
+ function AccountSavedCardsError({ $content, $locale, className, children, ...props }) {
819
+ const { state, errorCode } = useAccountSavedCards();
820
+ const { format } = useMessageFormatter(AccountSavedCardsErrorContent, $content);
821
+ const { path } = useStorefrontRoute();
822
+ if (state !== "error") return null;
823
+ const sessionExpired = errorCode === "UNAUTHORIZED";
824
+ return /* @__PURE__ */ jsx("div", {
825
+ ...props,
826
+ role: "alert",
827
+ className,
828
+ "data-fs-account-saved-cards-error": "",
829
+ "data-fs-account-saved-cards-error-code": sessionExpired ? "unauthorized" : "failed",
830
+ children: children ?? (sessionExpired ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
831
+ format("sessionExpiredText"),
832
+ " ",
833
+ /* @__PURE__ */ jsx(NavigationLink, {
834
+ href: signInTarget(path),
835
+ prefetch: false,
836
+ "data-fs-account-saved-cards-sign-in": "",
837
+ children: format("signInLabel")
838
+ })
839
+ ] }) : format("text"))
840
+ });
841
+ }
842
+ function AccountSavedCardRemove({ children }) {
843
+ const { id } = useAccountSavedCard();
844
+ const { removal } = useAccountSavedCards();
845
+ const [open, setOpen] = useState(false);
846
+ const pending = removal.pendingId === id;
847
+ const blocked = removal.pendingId !== null;
848
+ const close = useCallback(() => setOpen(false), []);
849
+ const value = useMemo(() => ({
850
+ id,
851
+ pending,
852
+ blocked,
853
+ close
854
+ }), [
855
+ id,
856
+ pending,
857
+ blocked,
858
+ close
859
+ ]);
860
+ if (!isValidElement(children)) return /* @__PURE__ */ jsx(AccountSavedCardRemoveContext, {
861
+ value,
862
+ children
863
+ });
864
+ return /* @__PURE__ */ jsx(AccountSavedCardRemoveContext, {
865
+ value,
866
+ children: cloneElement(children, {
867
+ open,
868
+ onOpenChange: (next) => {
869
+ if (next ? blocked : pending) return;
870
+ setOpen(next);
871
+ }
872
+ })
873
+ });
874
+ }
875
+ function AccountSavedCardRemoveTrigger({ $content, $locale, className, children, disabled, ...props }) {
876
+ const { blocked } = useAccountSavedCardRemove();
877
+ const { name, lastFour } = useCardSummary();
878
+ const { format } = useMessageFormatter(AccountSavedCardRemoveTriggerContent, $content);
879
+ const card = [name, lastFour ? format("cardEndingIn", { lastDigits: lastFour }) : null].filter(Boolean).join(" ");
880
+ return /* @__PURE__ */ jsxs(AlertDialogTrigger, {
881
+ ...props,
882
+ className,
883
+ disabled: blocked || disabled,
884
+ "data-fs-account-saved-card-remove-trigger": "",
885
+ children: [children ?? format("text"), card ? /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx("span", {
886
+ "data-fs-sr-only": "",
887
+ className: "sr-only",
888
+ children: card
889
+ })] }) : null]
890
+ });
891
+ }
892
+ function AccountSavedCardRemoveTitle({ $content, $locale, className, children, ...props }) {
893
+ useAccountSavedCardRemove();
894
+ const { format } = useMessageFormatter(AccountSavedCardRemoveTitleContent, $content);
895
+ return /* @__PURE__ */ jsx(AlertDialogTitle, {
896
+ ...props,
897
+ className,
898
+ "data-fs-account-saved-card-remove-title": "",
899
+ children: children ?? format("text")
900
+ });
901
+ }
902
+ function AccountSavedCardRemoveDescription({ $content, $locale, className, children, ...props }) {
903
+ useAccountSavedCardRemove();
904
+ const { format } = useMessageFormatter(AccountSavedCardRemoveDescriptionContent, $content);
905
+ const cardEndingIn = $content?.cardEndingIn;
906
+ const cardSummaryContent = useMemo(() => ({ endingIn: cardEndingIn }), [cardEndingIn]);
907
+ return /* @__PURE__ */ jsx(AlertDialogDescription, {
908
+ ...props,
909
+ className,
910
+ "data-fs-account-saved-card-remove-description": "",
911
+ children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
912
+ /* @__PURE__ */ jsx(CardSummary, { $content: cardSummaryContent }),
913
+ " ",
914
+ format("text")
915
+ ] })
916
+ });
917
+ }
918
+ function AccountSavedCardRemoveCancel({ $content, $locale, className, children, disabled, ...props }) {
919
+ const { pending } = useAccountSavedCardRemove();
920
+ const { format } = useMessageFormatter(AccountSavedCardRemoveCancelContent, $content);
921
+ return /* @__PURE__ */ jsx(AlertDialogClose, {
922
+ ...props,
923
+ className,
924
+ disabled: pending || disabled,
925
+ "data-fs-account-saved-card-remove-cancel": "",
926
+ children: children ?? format("text")
927
+ });
928
+ }
929
+ function AccountSavedCardRemoveConfirm({ $content, $locale, className, children, onClick, ...props }) {
930
+ const { id, pending, close } = useAccountSavedCardRemove();
931
+ const { removal } = useAccountSavedCards();
932
+ const remove = useActionsOverride(void 0)?.savedCard?.remove;
933
+ const { format } = useMessageFormatter(AccountSavedCardRemoveConfirmContent, $content);
934
+ async function handleClick(event) {
935
+ onClick?.(event);
936
+ if (event.defaultPrevented || !remove || !removal.begin(id)) return;
937
+ let userErrors;
938
+ try {
939
+ userErrors = await remove({ id });
940
+ } catch {
941
+ userErrors = [{ code: "NETWORK_ERROR" }];
942
+ }
943
+ removal.settle(id, userErrors);
944
+ close();
945
+ }
946
+ return /* @__PURE__ */ jsx("button", {
947
+ ...props,
948
+ type: "button",
949
+ className,
950
+ "aria-disabled": pending || void 0,
951
+ "aria-busy": pending || void 0,
952
+ "data-fs-account-saved-card-remove-confirm": "",
953
+ ...pending ? { "data-fs-account-saved-card-remove-confirm-pending": "" } : {},
954
+ onClick: handleClick,
955
+ children: pending ? format("pendingText") : children ?? format("text")
956
+ });
957
+ }
958
+ function feedbackOutcome(outcome) {
959
+ if (!outcome) return void 0;
960
+ if (outcome.kind === "removed") return "removed";
961
+ return outcome.code === "UNAUTHORIZED" ? "unauthorized" : "failed";
962
+ }
963
+ function AccountSavedCardsRemoveFeedback({ $content, $locale, className, ...props }) {
964
+ const { removal: { outcome } } = useAccountSavedCards();
965
+ const { format } = useMessageFormatter(AccountSavedCardsRemoveFeedbackContent, $content);
966
+ const { path } = useStorefrontRoute();
967
+ const statusRef = useRef(null);
968
+ const kind = feedbackOutcome(outcome);
969
+ const [announcement, setAnnouncement] = useState("");
970
+ const removed = outcome?.kind === "removed";
971
+ const successText = removed ? format("successText") : "";
972
+ useEffect(() => {
973
+ setAnnouncement(successText);
974
+ if (removed) statusRef.current?.focus();
975
+ }, [removed, successText]);
976
+ return /* @__PURE__ */ jsxs("div", {
977
+ ...props,
978
+ className,
979
+ "data-fs-account-saved-cards-remove-feedback": "",
980
+ "data-fs-account-saved-cards-remove-feedback-outcome": kind,
981
+ children: [
982
+ /* @__PURE__ */ jsx("output", {
983
+ ref: statusRef,
984
+ "aria-live": "polite",
985
+ tabIndex: -1,
986
+ children: announcement
987
+ }),
988
+ kind === "unauthorized" ? /* @__PURE__ */ jsxs("div", {
989
+ role: "alert",
990
+ children: [
991
+ format("sessionExpiredText"),
992
+ " ",
993
+ /* @__PURE__ */ jsx(NavigationLink, {
994
+ href: signInTarget(path),
995
+ prefetch: false,
996
+ "data-fs-account-saved-cards-remove-feedback-sign-in": "",
997
+ children: format("signInLabel")
998
+ })
999
+ ]
1000
+ }) : null,
1001
+ kind === "failed" ? /* @__PURE__ */ jsx("div", {
1002
+ role: "alert",
1003
+ children: format("failureText")
1004
+ }) : null
1005
+ ]
1006
+ });
1007
+ }
1008
+ //#endregion
1009
+ export { AccountSavedCardExpiry, AccountSavedCardExpiryContent, AccountSavedCardExpiryDefinition, AccountSavedCardItem, AccountSavedCardItemDefinition, AccountSavedCardRemove, AccountSavedCardRemoveCancel, AccountSavedCardRemoveCancelContent, AccountSavedCardRemoveCancelDefinition, AccountSavedCardRemoveConfirm, AccountSavedCardRemoveConfirmContent, AccountSavedCardRemoveConfirmDefinition, AccountSavedCardRemoveDefinition, AccountSavedCardRemoveDescription, AccountSavedCardRemoveDescriptionContent, AccountSavedCardRemoveDescriptionDefinition, AccountSavedCardRemoveTitle, AccountSavedCardRemoveTitleContent, AccountSavedCardRemoveTitleDefinition, AccountSavedCardRemoveTrigger, AccountSavedCardRemoveTriggerContent, AccountSavedCardRemoveTriggerDefinition, AccountSavedCardsEmpty, AccountSavedCardsEmptyContent, AccountSavedCardsEmptyDefinition, AccountSavedCardsError, AccountSavedCardsErrorContent, AccountSavedCardsErrorDefinition, AccountSavedCardsHeading, AccountSavedCardsHeadingContent, AccountSavedCardsHeadingDefinition, AccountSavedCardsList, AccountSavedCardsListDefinition, AccountSavedCardsLoading, AccountSavedCardsLoadingContent, AccountSavedCardsLoadingDefinition, AccountSavedCardsRemoveFeedback, AccountSavedCardsRemoveFeedbackContent, AccountSavedCardsRemoveFeedbackDefinition, AccountSavedCardsRoot, AccountSavedCardsRootDefinition, useAccountSavedCard, useAccountSavedCardRemove, useAccountSavedCards };
1010
+
1011
+ //# sourceMappingURL=account-saved-cards.js.map