@vtex/faststore 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +0 -1
  3. package/dist/actions.json +6 -1
  4. package/dist/catalog.json +789 -1701
  5. package/dist/cli/index.d.ts +66 -28
  6. package/dist/cli/index.js +7371 -512
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/server-runtime.js +41 -60
  9. package/dist/cli/server-runtime.js.map +1 -1
  10. package/dist/client.d.ts +3 -3
  11. package/dist/client.js +2 -2
  12. package/dist/components.d.ts +63 -57
  13. package/dist/components.js +60 -54
  14. package/dist/content-types.json +5785 -754
  15. package/dist/core/dist/define-component.d.ts +1 -1
  16. package/dist/core/dist/define-content-type.d.ts +50 -2
  17. package/dist/core/dist/define-content-type.js +107 -3
  18. package/dist/core/dist/define-content-type.js.map +1 -1
  19. package/dist/core/dist/index.d.ts +2 -2
  20. package/dist/docs/access-code-field.md +1 -1
  21. package/dist/docs/access-code-sign-in.md +126 -77
  22. package/dist/docs/account-address-book.md +210 -95
  23. package/dist/docs/account-menu.md +14 -15
  24. package/dist/docs/account-saved-cards.md +44 -39
  25. package/dist/docs/alert-dialog.md +3 -1
  26. package/dist/docs/avatar.md +4 -2
  27. package/dist/docs/billing-address.md +99 -30
  28. package/dist/docs/binding-switcher.md +5 -2
  29. package/dist/docs/buy-button.md +7 -8
  30. package/dist/docs/card-entry.md +39 -26
  31. package/dist/docs/card-summary.md +18 -8
  32. package/dist/docs/cardholder-document.md +5 -3
  33. package/dist/docs/carousel.md +5 -4
  34. package/dist/docs/cart-destination.md +39 -26
  35. package/dist/docs/cart-item.md +29 -14
  36. package/dist/docs/cart-totalizer.md +7 -5
  37. package/dist/docs/cart.md +135 -41
  38. package/dist/docs/challenge-return.md +135 -0
  39. package/dist/docs/client-preferences-fieldset.md +10 -5
  40. package/dist/docs/client-preferences.md +31 -8
  41. package/dist/docs/client-profile-fieldset.md +20 -6
  42. package/dist/docs/client-profile.md +12 -3
  43. package/dist/docs/copy-text.md +9 -7
  44. package/dist/docs/document-field.md +1 -1
  45. package/dist/docs/email-field.md +2 -1
  46. package/dist/docs/email-identification.md +12 -2
  47. package/dist/docs/footer-copyright.md +4 -2
  48. package/dist/docs/form.md +54 -18
  49. package/dist/docs/free-shipping-progress.md +6 -5
  50. package/dist/docs/identity-edit.md +8 -2
  51. package/dist/docs/identity-summary.md +18 -5
  52. package/dist/docs/installments.md +46 -32
  53. package/dist/docs/my-account-profile.md +16 -11
  54. package/dist/docs/navigation-link.md +5 -3
  55. package/dist/docs/order-cancel.md +3 -1
  56. package/dist/docs/order-delivery-address.md +7 -5
  57. package/dist/docs/order-delivery-group.md +1 -3
  58. package/dist/docs/order-details-back.md +1 -1
  59. package/dist/docs/order-details-header.md +1 -4
  60. package/dist/docs/order-invoice-download.md +60 -0
  61. package/dist/docs/order-list-row.md +1 -1
  62. package/dist/docs/order-list-search.md +13 -20
  63. package/dist/docs/order-list-views.md +11 -17
  64. package/dist/docs/order-list.md +12 -5
  65. package/dist/docs/order-payment.md +9 -7
  66. package/dist/docs/order-placed-date.md +1 -1
  67. package/dist/docs/order-placed-payment-summary.md +28 -15
  68. package/dist/docs/order-placed.md +49 -14
  69. package/dist/docs/order-progress.md +1 -1
  70. package/dist/docs/order-status-badge.md +20 -9
  71. package/dist/docs/order-summary.md +2 -2
  72. package/dist/docs/order-tracking-link.md +58 -0
  73. package/dist/docs/payment-method-badges.md +30 -4
  74. package/dist/docs/payment-methods.md +1 -1
  75. package/dist/docs/payment.md +36 -17
  76. package/dist/docs/phone-field.md +4 -4
  77. package/dist/docs/place-order.md +84 -36
  78. package/dist/docs/postal-code-field.md +3 -1
  79. package/dist/docs/pricing.md +21 -23
  80. package/dist/docs/product-gallery.md +19 -20
  81. package/dist/docs/product-information.md +13 -9
  82. package/dist/docs/product-list.md +7 -6
  83. package/dist/docs/product-shelf.md +0 -1
  84. package/dist/docs/promotion.md +4 -2
  85. package/dist/docs/region.md +23 -15
  86. package/dist/docs/save-card.md +7 -6
  87. package/dist/docs/saved-cards.md +65 -36
  88. package/dist/docs/shipping-address.md +57 -21
  89. package/dist/docs/shipping-simulator.md +53 -15
  90. package/dist/docs/sign-in-disclosure.md +176 -0
  91. package/dist/docs/sign-in-form.md +78 -47
  92. package/dist/docs/sign-in-redirect.md +4 -2
  93. package/dist/docs/sign-in.md +173 -0
  94. package/dist/docs/toast.md +15 -4
  95. package/dist/docs/variant-selector.md +15 -11
  96. package/dist/graphql/types.d.ts +4 -14
  97. package/dist/index.d.ts +2 -2
  98. package/dist/internal/client.d.ts +1 -3
  99. package/dist/internal/client.js +1 -1
  100. package/dist/internal/server.d.ts +7 -4
  101. package/dist/internal/server.js +7 -4
  102. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
  103. package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
  104. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
  105. package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
  106. package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
  107. package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
  108. package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
  109. package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
  110. package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
  111. package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
  112. package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
  113. package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
  114. package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
  115. package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
  116. package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
  117. package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
  118. package/dist/matter/account-address-book/account-address-book.js +74 -33
  119. package/dist/matter/account-address-book/account-address-book.js.map +1 -1
  120. package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
  121. package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
  122. package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
  123. package/dist/matter/account-address-book/account-address-country.js +83 -49
  124. package/dist/matter/account-address-book/account-address-country.js.map +1 -1
  125. package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
  126. package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
  127. package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
  128. package/dist/matter/account-address-book/account-address-form.js +518 -155
  129. package/dist/matter/account-address-book/account-address-form.js.map +1 -1
  130. package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
  131. package/dist/matter/account-address-book/account-address-record.js +32 -17
  132. package/dist/matter/account-address-book/account-address-record.js.map +1 -1
  133. package/dist/matter/account-menu/account-menu.d.ts +34 -17
  134. package/dist/matter/account-menu/account-menu.js +46 -54
  135. package/dist/matter/account-menu/account-menu.js.map +1 -1
  136. package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
  137. package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
  138. package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
  139. package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
  140. package/dist/matter/billing-address/billing-address.d.ts +156 -74
  141. package/dist/matter/billing-address/billing-address.js +227 -156
  142. package/dist/matter/billing-address/billing-address.js.map +1 -1
  143. package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
  144. package/dist/matter/breadcrumb/breadcrumb.js +24 -9
  145. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
  146. package/dist/matter/buy-button/buy-button.d.ts +8 -11
  147. package/dist/matter/buy-button/buy-button.js +10 -19
  148. package/dist/matter/buy-button/buy-button.js.map +1 -1
  149. package/dist/matter/card-entry/card-capture.js +12 -4
  150. package/dist/matter/card-entry/card-capture.js.map +1 -1
  151. package/dist/matter/card-entry/card-entry.d.ts +123 -32
  152. package/dist/matter/card-entry/card-entry.js +348 -221
  153. package/dist/matter/card-entry/card-entry.js.map +1 -1
  154. package/dist/matter/cart/cart-namespace.d.ts +7 -1
  155. package/dist/matter/cart/cart-namespace.js +7 -1
  156. package/dist/matter/cart/cart-namespace.js.map +1 -1
  157. package/dist/matter/cart/cart.d.ts +402 -61
  158. package/dist/matter/cart/cart.js +624 -153
  159. package/dist/matter/cart/cart.js.map +1 -1
  160. package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
  161. package/dist/matter/cart-destination/cart-destination.js +160 -70
  162. package/dist/matter/cart-destination/cart-destination.js.map +1 -1
  163. package/dist/matter/cart-item/cart-item.d.ts +144 -17
  164. package/dist/matter/cart-item/cart-item.js +166 -49
  165. package/dist/matter/cart-item/cart-item.js.map +1 -1
  166. package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
  167. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
  168. package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
  169. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
  170. package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
  171. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
  172. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
  173. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
  174. package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
  175. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
  176. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
  177. package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
  178. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
  179. package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
  180. package/dist/matter/challenge-return/challenge-return.js +241 -0
  181. package/dist/matter/challenge-return/challenge-return.js.map +1 -0
  182. package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
  183. package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
  184. package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
  185. package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
  186. package/dist/matter/client-preferences/client-preferences.js +84 -15
  187. package/dist/matter/client-preferences/client-preferences.js.map +1 -1
  188. package/dist/matter/client-profile/client-profile.d.ts +44 -9
  189. package/dist/matter/client-profile/client-profile.js +64 -24
  190. package/dist/matter/client-profile/client-profile.js.map +1 -1
  191. package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
  192. package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
  193. package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
  194. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
  195. package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
  196. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
  197. package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
  198. package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
  199. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
  200. package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
  201. package/dist/matter/delivery-options/delivery-options.js +75 -12
  202. package/dist/matter/delivery-options/delivery-options.js.map +1 -1
  203. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
  204. package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
  205. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
  206. package/dist/matter/email-identification/email-identification.d.ts +25 -3
  207. package/dist/matter/email-identification/email-identification.js +49 -12
  208. package/dist/matter/email-identification/email-identification.js.map +1 -1
  209. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
  210. package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
  211. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
  212. package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
  213. package/dist/matter/identity-edit/identity-edit.js +47 -19
  214. package/dist/matter/identity-edit/identity-edit.js.map +1 -1
  215. package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
  216. package/dist/matter/identity-summary/identity-summary.js +95 -45
  217. package/dist/matter/identity-summary/identity-summary.js.map +1 -1
  218. package/dist/matter/installments/installments-select.d.ts +98 -16
  219. package/dist/matter/installments/installments-select.js +156 -48
  220. package/dist/matter/installments/installments-select.js.map +1 -1
  221. package/dist/matter/installments/installments.d.ts +96 -16
  222. package/dist/matter/installments/installments.js +115 -40
  223. package/dist/matter/installments/installments.js.map +1 -1
  224. package/dist/matter/installments/use-installments-selection.d.ts +1 -0
  225. package/dist/matter/installments/use-installments-selection.js +8 -3
  226. package/dist/matter/installments/use-installments-selection.js.map +1 -1
  227. package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
  228. package/dist/matter/my-account-profile/my-account-profile.js +370 -174
  229. package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
  230. package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
  231. package/dist/matter/order-cancel/order-cancel.js +118 -51
  232. package/dist/matter/order-cancel/order-cancel.js.map +1 -1
  233. package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
  234. package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
  235. package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
  236. package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
  237. package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
  238. package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
  239. package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
  240. package/dist/matter/order-details-header/order-details-header.js +66 -58
  241. package/dist/matter/order-details-header/order-details-header.js.map +1 -1
  242. package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
  243. package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
  244. package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
  245. package/dist/matter/order-list/order-list.d.ts +164 -19
  246. package/dist/matter/order-list/order-list.js +229 -87
  247. package/dist/matter/order-list/order-list.js.map +1 -1
  248. package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
  249. package/dist/matter/order-list-row/order-list-row.js +3 -2
  250. package/dist/matter/order-list-row/order-list-row.js.map +1 -1
  251. package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
  252. package/dist/matter/order-list-search/order-list-search.js +30 -69
  253. package/dist/matter/order-list-search/order-list-search.js.map +1 -1
  254. package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
  255. package/dist/matter/order-list-views/order-list-views.js +22 -68
  256. package/dist/matter/order-list-views/order-list-views.js.map +1 -1
  257. package/dist/matter/order-payment/order-payment.d.ts +33 -10
  258. package/dist/matter/order-payment/order-payment.js +44 -39
  259. package/dist/matter/order-payment/order-payment.js.map +1 -1
  260. package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
  261. package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
  262. package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
  263. package/dist/matter/order-placed/order-placed.d.ts +198 -31
  264. package/dist/matter/order-placed/order-placed.js +230 -139
  265. package/dist/matter/order-placed/order-placed.js.map +1 -1
  266. package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
  267. package/dist/matter/order-placed-date/order-placed-date.js +7 -8
  268. package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
  269. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
  270. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
  271. package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
  272. package/dist/matter/order-progress/order-progress.d.ts +19 -8
  273. package/dist/matter/order-progress/order-progress.js +37 -45
  274. package/dist/matter/order-progress/order-progress.js.map +1 -1
  275. package/dist/matter/order-summary/order-summary.d.ts +19 -9
  276. package/dist/matter/order-summary/order-summary.js +38 -44
  277. package/dist/matter/order-summary/order-summary.js.map +1 -1
  278. package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
  279. package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
  280. package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
  281. package/dist/matter/payment/payment-card-capture.js +17 -10
  282. package/dist/matter/payment/payment-card-capture.js.map +1 -1
  283. package/dist/matter/payment/payment-controller.d.ts +4 -2
  284. package/dist/matter/payment/payment-controller.js +30 -9
  285. package/dist/matter/payment/payment-controller.js.map +1 -1
  286. package/dist/matter/payment/payment-method-badges.js +1 -1
  287. package/dist/matter/payment/payment.d.ts +69 -19
  288. package/dist/matter/payment/payment.js +101 -35
  289. package/dist/matter/payment/payment.js.map +1 -1
  290. package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
  291. package/dist/matter/payment/use-payment-method-selection.js +94 -32
  292. package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
  293. package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
  294. package/dist/matter/payment/use-payment-submit-gate.js +47 -8
  295. package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
  296. package/dist/matter/place-order/place-order.d.ts +171 -57
  297. package/dist/matter/place-order/place-order.js +376 -185
  298. package/dist/matter/place-order/place-order.js.map +1 -1
  299. package/dist/matter/pricing/pricing.d.ts +152 -13
  300. package/dist/matter/pricing/pricing.js +153 -52
  301. package/dist/matter/pricing/pricing.js.map +1 -1
  302. package/dist/matter/product-information/product-information.d.ts +27 -4
  303. package/dist/matter/product-information/product-information.js +32 -15
  304. package/dist/matter/product-information/product-information.js.map +1 -1
  305. package/dist/matter/product-list/product-list.d.ts +24 -6
  306. package/dist/matter/product-list/product-list.js +32 -26
  307. package/dist/matter/product-list/product-list.js.map +1 -1
  308. package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
  309. package/dist/matter/product-shelf/product-shelf.js +2 -15
  310. package/dist/matter/product-shelf/product-shelf.js.map +1 -1
  311. package/dist/matter/region/region.d.ts +33 -16
  312. package/dist/matter/region/region.js +59 -52
  313. package/dist/matter/region/region.js.map +1 -1
  314. package/dist/matter/save-card/save-card.d.ts +43 -8
  315. package/dist/matter/save-card/save-card.js +61 -23
  316. package/dist/matter/save-card/save-card.js.map +1 -1
  317. package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
  318. package/dist/matter/saved-cards/saved-cards.js +349 -77
  319. package/dist/matter/saved-cards/saved-cards.js.map +1 -1
  320. package/dist/matter/shipping-address/address-payload.js +25 -0
  321. package/dist/matter/shipping-address/address-payload.js.map +1 -0
  322. package/dist/matter/shipping-address/country-descriptors.js +71 -71
  323. package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
  324. package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
  325. package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
  326. package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
  327. package/dist/matter/shipping-address/shipping-address.js +443 -188
  328. package/dist/matter/shipping-address/shipping-address.js.map +1 -1
  329. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
  330. package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
  331. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
  332. package/dist/matter/sign-in/sign-in.d.ts +108 -0
  333. package/dist/matter/sign-in/sign-in.js +285 -0
  334. package/dist/matter/sign-in/sign-in.js.map +1 -0
  335. package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
  336. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
  337. package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
  338. package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
  339. package/dist/matter/sign-in-form/sign-in-form.js +134 -144
  340. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
  341. package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
  342. package/dist/particles/binding-switcher/binding-switcher.js +37 -26
  343. package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
  344. package/dist/particles/card-summary/card-summary.d.ts +38 -8
  345. package/dist/particles/card-summary/card-summary.js +55 -22
  346. package/dist/particles/card-summary/card-summary.js.map +1 -1
  347. package/dist/particles/carousel/carousel.d.ts +99 -11
  348. package/dist/particles/carousel/carousel.js +103 -35
  349. package/dist/particles/carousel/carousel.js.map +1 -1
  350. package/dist/particles/copy-text/copy-text.js +5 -15
  351. package/dist/particles/copy-text/copy-text.js.map +1 -1
  352. package/dist/particles/dialog/dialog.d.ts +14 -6
  353. package/dist/particles/dialog/dialog.js +6 -3
  354. package/dist/particles/dialog/dialog.js.map +1 -1
  355. package/dist/particles/drawer/drawer.js +1 -1
  356. package/dist/particles/drawer/drawer.js.map +1 -1
  357. package/dist/particles/email-field/email-field.d.ts +2 -1
  358. package/dist/particles/email-field/email-field.js +2 -1
  359. package/dist/particles/email-field/email-field.js.map +1 -1
  360. package/dist/particles/footer-link-group/footer-link-group.js +1 -0
  361. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
  362. package/dist/particles/form/form.d.ts +85 -13
  363. package/dist/particles/form/form.js +91 -42
  364. package/dist/particles/form/form.js.map +1 -1
  365. package/dist/particles/gallery/gallery.d.ts +129 -12
  366. package/dist/particles/gallery/gallery.js +121 -34
  367. package/dist/particles/gallery/gallery.js.map +1 -1
  368. package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
  369. package/dist/particles/order-details-back/order-details-back.js +8 -10
  370. package/dist/particles/order-details-back/order-details-back.js.map +1 -1
  371. package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
  372. package/dist/particles/order-status-badge/order-status-badge.js +4 -20
  373. package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
  374. package/dist/particles/password-field/password-field.d.ts +1 -1
  375. package/dist/particles/password-field/password-field.js +2 -4
  376. package/dist/particles/password-field/password-field.js.map +1 -1
  377. package/dist/particles/phone-field/phone-field.d.ts +4 -4
  378. package/dist/particles/phone-field/phone-field.js +8 -11
  379. package/dist/particles/phone-field/phone-field.js.map +1 -1
  380. package/dist/particles/spinner/spinner.d.ts +24 -4
  381. package/dist/particles/spinner/spinner.js +25 -9
  382. package/dist/particles/spinner/spinner.js.map +1 -1
  383. package/dist/particles/switch/switch.d.ts +4 -1
  384. package/dist/particles/switch/switch.js +3 -1
  385. package/dist/particles/switch/switch.js.map +1 -1
  386. package/dist/particles/toast/toast.d.ts +29 -3
  387. package/dist/particles/toast/toast.js +34 -10
  388. package/dist/particles/toast/toast.js.map +1 -1
  389. package/dist/schema.graphql +164 -56
  390. package/dist/sdk/address/address-fields.js +4 -4
  391. package/dist/sdk/address/address-fields.js.map +1 -1
  392. package/dist/sdk/address/constants.js +1 -6
  393. package/dist/sdk/address/constants.js.map +1 -1
  394. package/dist/sdk/address/messages.js +44 -44
  395. package/dist/sdk/address/messages.js.map +1 -1
  396. package/dist/sdk/address/postal-code.js +15 -2
  397. package/dist/sdk/address/postal-code.js.map +1 -1
  398. package/dist/sdk/address/types.d.ts +5 -3
  399. package/dist/sdk/address/validate-address.js +3 -3
  400. package/dist/sdk/address/validate-address.js.map +1 -1
  401. package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
  402. package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
  403. package/dist/sdk/cart/use-cart-actions.js.map +1 -1
  404. package/dist/sdk/data/index.js +2 -2
  405. package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
  406. package/dist/sdk/generated/gql.js +1 -1
  407. package/dist/sdk/generated/gql.js.map +1 -1
  408. package/dist/sdk/generated/graphql.d.ts +20 -5
  409. package/dist/sdk/generated/graphql.js +6 -0
  410. package/dist/sdk/generated/graphql.js.map +1 -1
  411. package/dist/sdk/i18n/format-error-code.js +23 -0
  412. package/dist/sdk/i18n/format-error-code.js.map +1 -0
  413. package/dist/sdk/i18n/message-formatter.d.ts +22 -0
  414. package/dist/sdk/i18n/message-formatter.js +140 -0
  415. package/dist/sdk/i18n/message-formatter.js.map +1 -0
  416. package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
  417. package/dist/sdk/i18n/use-message-formatter.js +18 -0
  418. package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
  419. package/dist/sdk/identity/use-identity-actions.js.map +1 -1
  420. package/dist/sdk/navigation/redirect.d.ts +2 -0
  421. package/dist/sdk/navigation/redirect.js +19 -1
  422. package/dist/sdk/navigation/redirect.js.map +1 -1
  423. package/dist/sdk/navigation/types.d.ts +13 -0
  424. package/dist/sdk/payment/bin-format.js +20 -0
  425. package/dist/sdk/payment/bin-format.js.map +1 -0
  426. package/dist/sdk/payment/challenge-return.js +37 -0
  427. package/dist/sdk/payment/challenge-return.js.map +1 -0
  428. package/dist/sdk/payment/confirmation-last-four.js +39 -0
  429. package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
  430. package/dist/sdk/payment/gateway.d.ts +1 -1
  431. package/dist/sdk/payment/gateway.js +8 -2
  432. package/dist/sdk/payment/gateway.js.map +1 -1
  433. package/dist/sdk/payment/operations.d.ts +1 -0
  434. package/dist/sdk/payment/operations.js +28 -6
  435. package/dist/sdk/payment/operations.js.map +1 -1
  436. package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
  437. package/dist/sdk/payment/resumed-purchase.js +119 -0
  438. package/dist/sdk/payment/resumed-purchase.js.map +1 -0
  439. package/dist/sdk/payment/security-code-mask.js +16 -23
  440. package/dist/sdk/payment/security-code-mask.js.map +1 -1
  441. package/dist/sdk/payment/submission-registry.js +6 -2
  442. package/dist/sdk/payment/submission-registry.js.map +1 -1
  443. package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
  444. package/dist/sdk/payment/use-payment-actions.js +23 -3
  445. package/dist/sdk/payment/use-payment-actions.js.map +1 -1
  446. package/dist/sdk/payment/use-place-order.d.ts +10 -2
  447. package/dist/sdk/payment/use-place-order.js +138 -76
  448. package/dist/sdk/payment/use-place-order.js.map +1 -1
  449. package/dist/sdk/provider/storefront-provider.d.ts +1 -7
  450. package/dist/sdk/provider/storefront-provider.js +4 -11
  451. package/dist/sdk/provider/storefront-provider.js.map +1 -1
  452. package/dist/sdk/seo/entity-landing.d.ts +24 -0
  453. package/dist/sdk/seo/entity-landing.js +30 -0
  454. package/dist/sdk/seo/entity-landing.js.map +1 -0
  455. package/dist/sdk/seo/page-alternates.d.ts +3 -2
  456. package/dist/sdk/seo/page-alternates.js +4 -2
  457. package/dist/sdk/seo/page-alternates.js.map +1 -1
  458. package/dist/sdk/seo/search-landing.d.ts +42 -0
  459. package/dist/sdk/seo/search-landing.js +85 -0
  460. package/dist/sdk/seo/search-landing.js.map +1 -0
  461. package/dist/sdk/session/mock-session.d.ts +9 -0
  462. package/dist/sdk/session/mock-session.js +31 -0
  463. package/dist/sdk/session/mock-session.js.map +1 -0
  464. package/dist/sdk/session/read-server-session.d.ts +3 -0
  465. package/dist/sdk/session/read-server-session.js +5 -0
  466. package/dist/sdk/session/read-server-session.js.map +1 -1
  467. package/dist/sdk/session/return-path-segment.d.ts +10 -0
  468. package/dist/sdk/session/return-path-segment.js +15 -0
  469. package/dist/sdk/session/return-path-segment.js.map +1 -0
  470. package/dist/sdk/session/use-session-actions.js.map +1 -1
  471. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
  472. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
  473. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
  474. package/dist/utils/safe-href.d.ts +2 -0
  475. package/package.json +4 -3
  476. package/skills/storefront-asset/SKILL.md +2 -2
  477. package/skills/storefront-asset/references/api-side.md +27 -14
  478. package/skills/storefront-asset/references/findings.md +5 -2
  479. package/src/styles/tailwind.css +8 -0
  480. package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
  481. package/dist/message-locales.json +0 -7
  482. package/dist/sdk/i18n/client.d.ts +0 -4
  483. package/dist/sdk/i18n/client.js +0 -4
  484. package/dist/sdk/i18n/locales.d.ts +0 -8
  485. package/dist/sdk/i18n/locales.js +0 -57
  486. package/dist/sdk/i18n/locales.js.map +0 -1
  487. package/dist/sdk/i18n/messages/en-US.js +0 -183
  488. package/dist/sdk/i18n/messages/en-US.js.map +0 -1
  489. package/dist/sdk/i18n/messages/en-US.json +0 -178
  490. package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
  491. package/dist/sdk/i18n/messages/es-ES.js +0 -183
  492. package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
  493. package/dist/sdk/i18n/messages/es-ES.json +0 -178
  494. package/dist/sdk/i18n/messages/pt-BR.js +0 -183
  495. package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
  496. package/dist/sdk/i18n/messages/pt-BR.json +0 -178
  497. package/dist/sdk/i18n/provider.d.ts +0 -1
  498. package/dist/sdk/i18n/provider.js +0 -30
  499. package/dist/sdk/i18n/provider.js.map +0 -1
  500. package/dist/sdk/i18n/server.d.ts +0 -28
  501. package/dist/sdk/i18n/server.js +0 -59
  502. package/dist/sdk/i18n/server.js.map +0 -1
  503. package/dist/utils/resolve-authored-copy.js +0 -18
  504. package/dist/utils/resolve-authored-copy.js.map +0 -1
  505. package/dist/utils/substitute-template.js +0 -33
  506. package/dist/utils/substitute-template.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"access-code-sign-in.js","names":[],"sources":["../../../src/matter/access-code-sign-in/access-code-sign-in.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, FormEvent } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport { AccessCodeField } from '../../particles/access-code-field/access-code-field.js';\nimport { EmailField, isValidEmail } from '../../particles/email-field/email-field.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport type { SessionUserError } from '../../sdk/session/auth-operations.js';\nimport { resolveAuthoredCopy } from '../../utils/resolve-authored-copy.js';\nimport { useSession } from '../session/session.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment (colocated, ADR-0011) — clientProfile.email seeds the draft email as a\n// convenience pre-fill for an already-identified shopper; sessionAuthProviders.accessKeyAuthentication\n// is the account gate. Authored as a raw string, mirroring EmailIdentificationControl/ShippingSimulator.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment AccessCodeSignInData on Query {\n clientProfile {\n __typename\n id\n email\n }\n sessionAuthProviders {\n accessKeyAuthentication\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Colocated fragment slice forwarded by the reactive runtime — `null` until both fields resolve. */\nexport type AccessCodeSignInSlice = {\n clientProfile: { email: string | null } | null;\n sessionAuthProviders: { accessKeyAuthentication: boolean } | null;\n};\n\nexport type AccessCodeSignInStep = 'request' | 'validate';\n\nexport type AccessCodeSignInContextValue = Readonly<{\n /** The shopper's locally-typed draft email — never written to the cart; only ever an argument to\n * requestAccessCode/validateAccessCode. Pre-fills from `clientProfile.email` when known, but a\n * shopper edit is never persisted anywhere by this family. */\n email: string;\n /** Updates the draft email; marks it as shopper-touched so pre-fill no longer overwrites it. */\n setEmail: (email: string) => void;\n step: AccessCodeSignInStep;\n /** Opaque token round-tripped from requestAccessCode into validateAccessCode. */\n authenticationToken: string | null;\n /** Called by AccessCodeRequestControl on a successful requestAccessCode. */\n startValidation: (authenticationToken: string) => void;\n}>;\n\nexport type AccessCodeSignInRootProps = ComponentPropsWithRef<'div'> & {\n $data?: AccessCodeSignInSlice | null;\n};\n\nexport type AccessCodeEmailControlProps = ComponentPropsWithRef<'div'> & {\n label?: string;\n placeholder?: string;\n invalidEmailMessage?: string;\n};\n\nexport type AccessCodeRequestControlProps = ComponentPropsWithRef<'div'> & {\n label?: string;\n pendingLabel?: string;\n sendLimitMessage?: string;\n blockedMessage?: string;\n networkErrorMessage?: string;\n onRequested?: (authenticationToken: string) => void;\n $actions?: ComponentActions;\n};\n\nexport type AccessCodeValidateControlProps = ComponentPropsWithRef<'div'> & {\n label?: string;\n placeholder?: string;\n submitLabel?: string;\n codeLength?: number;\n invalidCodeMessage?: string;\n blockedMessage?: string;\n missingAuthContextMessage?: string;\n networkErrorMessage?: string;\n onValidated?: () => void;\n $actions?: ComponentActions;\n};\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst ACCESS_CODE_SIGN_IN_CONTEXT_UNSET = Symbol('AccessCodeSignInContextUnset');\n\nconst AccessCodeSignInContext = createContext<AccessCodeSignInContextValue | typeof ACCESS_CODE_SIGN_IN_CONTEXT_UNSET>(\n ACCESS_CODE_SIGN_IN_CONTEXT_UNSET,\n);\n\n/**\n * Read the stepper state (email, step, authenticationToken) from the nearest `AccessCodeSignInRoot`.\n * Throws when called outside that subtree — a misplaced control is a composition bug that should\n * surface immediately, mirroring `useShippingSimulator()`/`useSession()`.\n */\nfunction useAccessCodeSignIn(): AccessCodeSignInContextValue {\n const ctx = useContext(AccessCodeSignInContext);\n if (ctx === ACCESS_CODE_SIGN_IN_CONTEXT_UNSET) {\n throw new Error('AccessCodeSignIn components must be used inside AccessCodeSignInRoot.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Error-code → message mapping — every failure surfaces inline, at the control that produced it;\n// an unmapped code falls back to the server-supplied message rather than being silent. Each mapped\n// case is resolved through `resolveAuthoredCopy` (T38, FR-5): an authored empty or whitespace-only\n// message falls back to the server-supplied `error.message` rather than rendering a blank alert.\n// ---------------------------------------------------------------------------\n\nfunction requestErrorMessage(\n error: SessionUserError,\n props: Pick<AccessCodeRequestControlProps, 'sendLimitMessage' | 'blockedMessage' | 'networkErrorMessage'>,\n): string {\n switch (error.code) {\n case 'ACCESS_CODE_SEND_LIMIT':\n return resolveAuthoredCopy(props.sendLimitMessage, error.message);\n case 'BLOCKED':\n return resolveAuthoredCopy(props.blockedMessage, error.message);\n case 'NETWORK_ERROR':\n return resolveAuthoredCopy(props.networkErrorMessage, error.message);\n default:\n return error.message;\n }\n}\n\nfunction validateErrorMessage(\n error: SessionUserError,\n props: Pick<\n AccessCodeValidateControlProps,\n 'invalidCodeMessage' | 'blockedMessage' | 'missingAuthContextMessage' | 'networkErrorMessage'\n >,\n): string {\n switch (error.code) {\n case 'INVALID_ACCESS_CODE':\n return resolveAuthoredCopy(props.invalidCodeMessage, error.message);\n case 'BLOCKED':\n return resolveAuthoredCopy(props.blockedMessage, error.message);\n case 'MISSING_AUTH_CONTEXT':\n return resolveAuthoredCopy(props.missingAuthContextMessage, error.message);\n case 'NETWORK_ERROR':\n return resolveAuthoredCopy(props.networkErrorMessage, error.message);\n default:\n return error.message;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccessCodeSignInRootDefinition = defineComponent<AccessCodeSignInRootProps>({\n name: 'AccessCodeSignInRoot',\n importPath: '@vtex/faststore/components',\n component: AccessCodeSignInRoot,\n fragment,\n fetchStrategy: 'reactive',\n requiresContext: 'session',\n editor: { label: 'Access Code Sign-In', category: 'identity' },\n schema: {},\n guideline:\n 'Self-gating root of the anonymous-or-identified, email + access-code sign-in: renders nothing once loggedIn or when the account disables accessKeyAuthentication, but is available from the anonymous state onward. Owns a locally-typed draft email (never written to the cart) and the request/validate stepper. Must be inside SessionRoot. See access-code-sign-in.md.',\n});\n\nexport const AccessCodeEmailControlDefinition = defineComponent<AccessCodeEmailControlProps>({\n name: 'AccessCodeEmailControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeEmailControl,\n editor: { label: 'Access Code Email', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n invalidEmailMessage: { type: 'string', label: 'Invalid email message' },\n },\n guideline:\n 'The draft email input for the access-code flow: visible only at the request step, pre-fills from clientProfile.email when known but never persists an edit anywhere — it is purely the argument requestAccessCode/validateAccessCode dispatch with. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\nexport const AccessCodeRequestControlDefinition = defineComponent<AccessCodeRequestControlProps>({\n name: 'AccessCodeRequestControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeRequestControl,\n actions: { session: ['requestAccessCode'] },\n editor: { label: 'Access Code Request', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n sendLimitMessage: { type: 'string', label: 'Send-limit message' },\n blockedMessage: { type: 'string', label: 'Blocked message' },\n networkErrorMessage: { type: 'string', label: 'Network error message' },\n },\n guideline:\n 'Send-code step: disabled until the Root-owned draft email is a valid, non-empty address; dispatches $actions.session.requestAccessCode with it and advances the stepper on success. Failures render inline, never as a blocking error. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\nexport const AccessCodeValidateControlDefinition = defineComponent<AccessCodeValidateControlProps>({\n name: 'AccessCodeValidateControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeValidateControl,\n actions: { session: ['validateAccessCode'] },\n editor: { label: 'Access Code Validate', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n submitLabel: { type: 'string', label: 'Submit label' },\n codeLength: { type: 'number', default: 6, label: 'Code length' },\n invalidCodeMessage: { type: 'string', label: 'Invalid code message' },\n blockedMessage: { type: 'string', label: 'Blocked message' },\n networkErrorMessage: { type: 'string', label: 'Network error message' },\n },\n guideline:\n 'Code-entry step: composes AccessCodeField and dispatches $actions.session.validateAccessCode with the Root-owned email and authenticationToken; a successful validate flips the session reactively and hides the Root. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/**\n * Data-owning root of the access-code sign-in flow. Self-gates on two signals:\n * `useSession().state !== 'loggedIn'` (available from anonymous through identified; hides once\n * signed in) and `sessionAuthProviders.accessKeyAuthentication === true`. An unresolved fragment\n * read (`$data` still `null`) is treated as \"provider not enabled\" — the flow stays hidden rather\n * than flashing. Owns the `step`/`authenticationToken` stepper plus a locally-typed draft `email`\n * as local state, broadcasting all of it through context to its children. The draft email pre-fills\n * from `clientProfile.email` once (for an already-identified shopper) but a shopper edit is never\n * persisted anywhere by this family — it is purely the requestAccessCode/validateAccessCode\n * argument; the server sets clientProfileData.email as a side effect of a successful validate.\n * Reacts automatically once `useSession()` flips to `loggedIn` — no manual unmount call anywhere in\n * this family.\n */\nexport function AccessCodeSignInRoot({ $data: $dataProp, className, children, ...props }: AccessCodeSignInRootProps) {\n const $data = useDataOverride($dataProp);\n const { state } = useSession();\n\n const [step, setStep] = useState<AccessCodeSignInStep>('request');\n const [authenticationToken, setAuthenticationToken] = useState<string | null>(null);\n\n const startValidation = useCallback((token: string) => {\n setAuthenticationToken(token);\n setStep('validate');\n }, []);\n\n const savedEmail = $data?.clientProfile?.email ?? '';\n const [email, setEmailState] = useState('');\n const [touched, setTouched] = useState(false);\n\n // Pre-fill from the resolving/known profile email, but only while still at the request step and\n // until the shopper edits the draft — mirrors ClientProfileRoot's untouched-field re-seed, never\n // clobbering an in-progress edit. Freezing the re-seed once the flow leaves 'request' keeps a\n // mid-flow profile-cache change from diverging the email between requestAccessCode and\n // validateAccessCode (the server rejects a validate whose email differs from the request).\n useEffect(() => {\n if (step === 'request' && !touched) setEmailState(savedEmail);\n }, [savedEmail, touched, step]);\n\n const setEmail = useCallback((next: string) => {\n setTouched(true);\n setEmailState(next);\n }, []);\n\n const providerEnabled = $data?.sessionAuthProviders?.accessKeyAuthentication ?? false;\n\n const contextValue = useMemo<AccessCodeSignInContextValue>(\n () => ({ email, setEmail, step, authenticationToken, startValidation }),\n [email, setEmail, step, authenticationToken, startValidation],\n );\n\n const gated = state !== 'loggedIn' && providerEnabled;\n if (!gated) return null;\n\n return (\n <AccessCodeSignInContext value={contextValue}>\n <div {...props} className={className} data-fs-access-code-sign-in-root=\"\">\n {children}\n </div>\n </AccessCodeSignInContext>\n );\n}\n\n/**\n * The draft email input for the access-code flow. Renders only at the request step. Bound to the\n * Root's local `email`/`setEmail` — never a fragment, never a mutation of its own; typing here\n * never touches the cart. Format validation is `EmailField`'s own blur-triggered check (never\n * per-keystroke); `invalidEmailMessage` is only its fallback text, mirroring how\n * `EmailIdentificationControl` defers to the same particle for the same reason.\n */\nexport function AccessCodeEmailControl({\n label,\n placeholder,\n invalidEmailMessage,\n className,\n ...props\n}: AccessCodeEmailControlProps) {\n const { step, email, setEmail } = useAccessCodeSignIn();\n\n if (step !== 'request') return null;\n\n return (\n <div {...props} className={className} data-fs-access-code-email-control=\"\">\n <EmailField\n label={label}\n placeholder={placeholder}\n value={email}\n onValueChange={setEmail}\n errorMessage={invalidEmailMessage}\n />\n </div>\n );\n}\n\n/**\n * Renders only while the Root's stepper is at `step === 'request'`. Reads the draft email from\n * context and dispatches `$actions.session.requestAccessCode({ email })` once it is a valid,\n * non-empty address (no account-existence pre-check beyond that format gate). On a result with a\n * non-null token and no `userErrors`, advances the Root's stepper. Every `userErrors` entry renders\n * inline via a host-supplied, per-code message; the step never changes on error, so the shopper can\n * retry or abandon the method and continue as a guest.\n */\nexport function AccessCodeRequestControl({\n label,\n pendingLabel,\n sendLimitMessage,\n blockedMessage,\n networkErrorMessage,\n onRequested,\n $actions: $actionsProp,\n className,\n ...props\n}: AccessCodeRequestControlProps) {\n const $actions = useActionsOverride($actionsProp);\n const { step, email, startValidation } = useAccessCodeSignIn();\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<SessionUserError | null>(null);\n\n if (step !== 'request') return null;\n\n const canSubmit = !pending && isValidEmail(email);\n\n async function handleClick() {\n if (!canSubmit) return;\n setPending(true);\n setError(null);\n\n try {\n const result = (await $actions?.session?.requestAccessCode?.({ email })) ?? {\n authenticationToken: null,\n userErrors: [],\n };\n\n if (result.authenticationToken && result.userErrors.length === 0) {\n startValidation(result.authenticationToken);\n onRequested?.(result.authenticationToken);\n return;\n }\n\n const [firstError] = result.userErrors;\n if (firstError) setError(firstError);\n } finally {\n setPending(false);\n }\n }\n\n const message = error ? requestErrorMessage(error, { sendLimitMessage, blockedMessage, networkErrorMessage }) : null;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-access-code-request-control=\"\"\n {...(pending ? { 'data-fs-access-code-request-pending': '' } : {})}\n >\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={!canSubmit}\n aria-busy={pending || undefined}\n data-fs-access-code-request-submit=\"\"\n data-fs-button=\"\"\n >\n {/* T38, FR-5: resolveAuthoredCopy so an authored empty/whitespace-only pendingLabel falls\n back to `label` instead of blanking the button while the request is in flight. */}\n {pending ? resolveAuthoredCopy(pendingLabel, label ?? '') : label}\n </button>\n {message ? (\n <div role=\"alert\" data-fs-access-code-request-error=\"\">\n {message}\n </div>\n ) : null}\n </div>\n );\n}\n\n/**\n * Renders only while the Root's stepper is at `step === 'validate'`. Composes `AccessCodeField` for\n * the code value and a submit control, disabled below `codeLength` (a UX courtesy, never a\n * validity claim). Dispatches `$actions.session.validateAccessCode` with the email and\n * `authenticationToken` read from context. On a non-empty `userErrors` result, sets the field's\n * `invalid`/`errorMessage` from a host-supplied per-code message and retains the code/token so the\n * shopper can retry without re-requesting. On success it calls the optional `onValidated` and renders\n * no local \"success\" UI — `useSession()` flipping to `loggedIn` is what makes the whole Root\n * disappear.\n */\nexport function AccessCodeValidateControl({\n label,\n placeholder,\n submitLabel,\n codeLength = 6,\n invalidCodeMessage,\n blockedMessage,\n missingAuthContextMessage,\n networkErrorMessage,\n onValidated,\n $actions: $actionsProp,\n className,\n ...props\n}: AccessCodeValidateControlProps) {\n const $actions = useActionsOverride($actionsProp);\n const { step, email, authenticationToken } = useAccessCodeSignIn();\n const [code, setCode] = useState('');\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<SessionUserError | null>(null);\n\n if (step !== 'validate') return null;\n\n const canSubmit = !pending && code.length >= codeLength && authenticationToken != null;\n\n async function handleSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n if (!canSubmit || authenticationToken == null) return;\n\n setPending(true);\n setError(null);\n\n try {\n const errors =\n (await $actions?.session?.validateAccessCode?.({ email, accessCode: code, authenticationToken })) ?? [];\n\n const [firstError] = errors;\n if (firstError) {\n setError(firstError);\n return;\n }\n } finally {\n setPending(false);\n }\n\n onValidated?.();\n }\n\n function handleCodeChange(next: string) {\n setCode(next);\n if (error) setError(null);\n }\n\n const errorMessage = error\n ? validateErrorMessage(error, {\n invalidCodeMessage,\n blockedMessage,\n missingAuthContextMessage,\n networkErrorMessage,\n })\n : undefined;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-access-code-validate-control=\"\"\n {...(pending ? { 'data-fs-access-code-validate-pending': '' } : {})}\n >\n <form onSubmit={handleSubmit}>\n <AccessCodeField\n label={label}\n placeholder={placeholder}\n value={code}\n maxLength={codeLength}\n onValueChange={handleCodeChange}\n disabled={pending}\n invalid={error != null}\n errorMessage={errorMessage}\n />\n <button\n type=\"submit\"\n disabled={!canSubmit}\n aria-busy={pending || undefined}\n data-fs-access-code-validate-submit=\"\"\n data-fs-button=\"\"\n >\n {submitLabel}\n </button>\n </form>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const AccessCodeSignIn = {\n Root: AccessCodeSignInRoot,\n Email: AccessCodeEmailControl,\n Request: AccessCodeRequestControl,\n Validate: AccessCodeValidateControl,\n};\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,WAAyB;;;;;;;;;;;;AA4E/B,MAAM,oCAAoC,OAAO,8BAA8B;AAE/E,MAAM,0BAA0B,cAC9B,iCACF;;;;;;AAOA,SAAS,sBAAoD;CAC3D,MAAM,MAAM,WAAW,uBAAuB;CAC9C,IAAI,QAAQ,mCACV,MAAM,IAAI,MAAM,uEAAuE;CAEzF,OAAO;AACT;AASA,SAAS,oBACP,OACA,OACQ;CACR,QAAQ,MAAM,MAAd;EACE,KAAK,0BACH,OAAO,oBAAoB,MAAM,kBAAkB,MAAM,OAAO;EAClE,KAAK,WACH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AY;IAAM;GAAoB,CAAC,KAAM,CAAC;GAGxG,IAAI,YAAY;IACd,SAAS,UAAU;IACnB;GACF;EACF,UAAU;GACR,WAAW,KAAK;EAClB;EAEA,cAAc;CAChB;CAEA,SAAS,iBAAiB,MAAc;EACtC,QAAQ,IAAI;EACZ,IAAI,OAAO,SAAS,IAAI;CAC1B;CAEA,MAAM,eAAe,QACjB,qBAAqB,OAAO;EAC1B;EACA;EACA;EACA;CACF,CAAC,IACD,KAAA;CAEJ,OACE,oBAAC,OAAD;EACE,GAAI;EACO;EACX,wCAAqC;EACrC,GAAK,UAAU,EAAE,wCAAwC,GAAG,IAAI,CAAC;EAEjE,UAAA,qBAAC,QAAD;GAAM,UAAU;GAAhB,UAAA,CACE,oBAAC,iBAAD;IACS;IACM;IACb,OAAO;IACP,WAAW;IACX,eAAe;IACf,UAAU;IACV,SAAS,SAAS;IACJ;GACf,CAAA,GACD,oBAAC,UAAD;IACE,MAAK;IACL,UAAU,CAAC;IACX,aAAW,WAAW,KAAA;IACtB,uCAAoC;IACpC,kBAAe;IAEd,UAAA;GACK,CAAA,CACJ;;CACH,CAAA;AAET;AAMA,MAAa,mBAAmB;CAC9B,MAAM;CACN,OAAO;CACP,SAAS;CACT,UAAU;AACZ"}
1
+ {"version":3,"file":"access-code-sign-in.js","names":[],"sources":["../../../src/matter/access-code-sign-in/access-code-sign-in.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ContentValue,\n defineComponent,\n defineContentType,\n type MessageFieldName,\n type MessageLocaleProp,\n} from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, FormEvent } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from 'react';\nimport { AccessCodeField } from '../../particles/access-code-field/access-code-field.js';\nimport { isValidEmail } from '../../particles/email-field/email-field.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { formatErrorCode } from '../../sdk/i18n/format-error-code.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport type { SessionUserError } from '../../sdk/session/auth-operations.js';\nimport { useSession } from '../session/session.js';\nimport { useSignIn } from '../sign-in/sign-in.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type AccessCodeSignInStep = 'request' | 'validate';\n\n/** The pace between code sends, in seconds. A fixed convention, never an authored value: a CMS edit\n * could set it to zero. VTEX ID publishes no send-limit window, so this errs long deliberately. */\nexport const ACCESS_CODE_RESEND_INTERVAL_SECONDS = 60;\n\nexport type AccessCodeSignInContextValue = Readonly<{\n step: AccessCodeSignInStep;\n /** Opaque token round-tripped from requestAccessCode into validateAccessCode. */\n authenticationToken: string | null;\n /** The address `requestAccessCode` was dispatched with. `validateAccessCode` must use this, not the\n * live `sign-in` draft: the server rejects a validate whose email differs from the request. */\n requestedEmail: string | null;\n /** Called by AccessCodeRequestControl and AccessCodeResendControl on a successful requestAccessCode.\n * Writes the token and the address it was issued for in one transition, so neither can be set without\n * the other, and arms the resend pace. */\n startValidation: (authenticationToken: string, requestedEmail: string) => void;\n /** Whole seconds until another code may be sent. `0` means permitted. */\n resendAvailableInSeconds: number;\n /** Discards the step, the token, the pinned address and the pace together, returning to `request`. */\n resetToRequest: () => void;\n}>;\n\nexport type AccessCodeSignInRootProps = ComponentPropsWithRef<'div'>;\n\nexport type AccessCodeRequestControlProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n label?: string;\n pendingLabel?: string;\n onRequested?: (authenticationToken: string) => void;\n /** The inline message for each refusal of the send. */\n $content?: ContentValue<typeof AccessCodeRequestControlContent>;\n $actions?: ComponentActions;\n };\n\nexport type AccessCodeSentNoticeProps = ComponentPropsWithRef<'output'> &\n MessageLocaleProp & {\n /** The confirmation sentence; its `email` argument is the address the code was sent to. */\n $content?: ContentValue<typeof AccessCodeSentNoticeContent>;\n };\n\nexport type AccessCodeResendControlProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n label?: string;\n pendingLabel?: string;\n onResent?: (authenticationToken: string) => void;\n /** The button label while the pace has not elapsed (its `seconds` argument is the whole seconds left),\n * and the inline message for each refusal of the send. */\n $content?: ContentValue<typeof AccessCodeResendContent>;\n $actions?: ComponentActions;\n };\n\nexport type AccessCodeCorrectEmailControlProps = ComponentPropsWithRef<'div'> & {\n label?: string;\n onCorrected?: () => void;\n};\n\nexport type AccessCodeValidateControlProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n label?: string;\n placeholder?: string;\n submitLabel?: string;\n codeLength?: number;\n onValidated?: () => void;\n /** The inline message for each refusal of the code. */\n $content?: ContentValue<typeof AccessCodeValidateControlContent>;\n $actions?: ComponentActions;\n };\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst ACCESS_CODE_SIGN_IN_CONTEXT_UNSET = Symbol('AccessCodeSignInContextUnset');\n\nconst AccessCodeSignInContext = createContext<AccessCodeSignInContextValue | typeof ACCESS_CODE_SIGN_IN_CONTEXT_UNSET>(\n ACCESS_CODE_SIGN_IN_CONTEXT_UNSET,\n);\n\n/**\n * Read the stepper state (step, authenticationToken, requestedEmail) from the nearest\n * `AccessCodeSignInRoot`. Throws when called outside that subtree — a misplaced control is a\n * composition bug that should surface immediately, mirroring `useShippingSimulator()`/`useSession()`.\n * A part outside any `SignInRoot` reports that missing ancestor first, since it is the one to add first.\n */\nexport function useAccessCodeSignIn(): AccessCodeSignInContextValue {\n useSignIn();\n const ctx = useContext(AccessCodeSignInContext);\n if (ctx === ACCESS_CODE_SIGN_IN_CONTEXT_UNSET) {\n throw new Error('AccessCodeSignIn components must be used inside AccessCodeSignInRoot.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Content models and error-code → message maps. Every failure surfaces inline, at the control that\n// produced it, worded by that control's own message for its code. A code these maps do not know (a newer\n// server than this package) shows the control's networkErrorMessage.\n// ---------------------------------------------------------------------------\n\n/** `SessionErrorCode` of API Core's schema plus the client-minted transport failure. */\ntype SessionErrorCode =\n | 'INVALID_CREDENTIALS'\n | 'INVALID_ACCESS_CODE'\n | 'ACCESS_CODE_SEND_LIMIT'\n | 'BLOCKED'\n | 'MISSING_AUTH_CONTEXT'\n | 'NETWORK_ERROR';\n\nexport const AccessCodeRequestControlContent = defineContentType({\n id: 'access-code-request-control',\n title: 'Access Code Request Control',\n description: 'The inline messages shown when sending the access code fails.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n sendLimitMessage: {\n type: 'string',\n title: 'Send-limit message',\n description: 'Shown when too many codes were requested for the address.',\n format: 'icu-message',\n messageSource: 'Too many codes requested. Try again later.',\n },\n blockedMessage: {\n type: 'string',\n title: 'Blocked message',\n description: 'Shown when the account is blocked. Names no duration: the account service returns none.',\n format: 'icu-message',\n messageSource: 'This account is blocked. Contact support.',\n },\n networkErrorMessage: {\n type: 'string',\n title: 'Generic error message',\n description: 'Shown for a network failure and for any refusal the shopper cannot act on.',\n format: 'icu-message',\n messageSource: 'Something went wrong. Please try again.',\n },\n },\n },\n});\n\nexport const AccessCodeValidateControlContent = defineContentType({\n id: 'access-code-validate-control',\n title: 'Access Code Validate Control',\n description: 'The inline messages shown when the access code is refused.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n invalidCodeMessage: {\n type: 'string',\n title: 'Invalid code message',\n description: 'Shown when the code is wrong or expired.',\n format: 'icu-message',\n messageSource: 'That code is incorrect or expired.',\n },\n blockedMessage: {\n type: 'string',\n title: 'Blocked message',\n description: 'Shown when the account is blocked. Names no duration: the account service returns none.',\n format: 'icu-message',\n messageSource: 'This account is blocked. Contact support.',\n },\n missingAuthContextMessage: {\n type: 'string',\n title: 'Missing sign-in context message',\n description:\n 'Shown when the request lost the context the code was issued for. Should not occur on a correct flow.',\n format: 'icu-message',\n messageSource: 'Something went wrong. Please try again.',\n },\n networkErrorMessage: {\n type: 'string',\n title: 'Generic error message',\n description: 'Shown for a network failure and for any refusal the shopper cannot act on.',\n format: 'icu-message',\n messageSource: 'Something went wrong. Please try again.',\n },\n },\n },\n});\n\nexport const ACCESS_CODE_REQUEST_ERROR_FIELDS = {\n ACCESS_CODE_SEND_LIMIT: 'sendLimitMessage',\n BLOCKED: 'blockedMessage',\n NETWORK_ERROR: 'networkErrorMessage',\n MISSING_AUTH_CONTEXT: 'networkErrorMessage',\n INVALID_CREDENTIALS: 'networkErrorMessage',\n INVALID_ACCESS_CODE: 'networkErrorMessage',\n} as const satisfies Record<SessionErrorCode, MessageFieldName<typeof AccessCodeRequestControlContent>>;\n\nexport const ACCESS_CODE_VALIDATE_ERROR_FIELDS = {\n INVALID_ACCESS_CODE: 'invalidCodeMessage',\n BLOCKED: 'blockedMessage',\n MISSING_AUTH_CONTEXT: 'missingAuthContextMessage',\n NETWORK_ERROR: 'networkErrorMessage',\n INVALID_CREDENTIALS: 'networkErrorMessage',\n ACCESS_CODE_SEND_LIMIT: 'networkErrorMessage',\n} as const satisfies Record<SessionErrorCode, MessageFieldName<typeof AccessCodeValidateControlContent>>;\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccessCodeSignInRootDefinition = defineComponent<AccessCodeSignInRootProps>({\n name: 'AccessCodeSignInRoot',\n importPath: '@vtex/faststore/components',\n component: AccessCodeSignInRoot,\n requiresContext: 'sign-in',\n editor: { label: 'Access Code Sign-In', category: 'identity' },\n schema: {},\n guideline:\n \"Root of the access-code method of the sign-in surface: renders nothing until the account configuration has arrived, when the account disables the access code, while another method is the active one, and once loggedIn. Owns the request/validate stepper, the authenticationToken and the address the code was requested for; the email field is SignInEmailControl's. Must be inside SignInRoot. See access-code-sign-in.md.\",\n});\n\nexport const AccessCodeRequestControlDefinition = defineComponent<AccessCodeRequestControlProps>({\n name: 'AccessCodeRequestControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeRequestControl,\n content: AccessCodeRequestControlContent,\n actions: { session: ['requestAccessCode'] },\n editor: { label: 'Access Code Request', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n },\n guideline:\n 'Send-code step: disabled until the shared SignInRoot email draft is a valid, non-empty address; dispatches $actions.session.requestAccessCode with it and advances the stepper on success. Failures render inline, never as a blocking error. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\nexport const AccessCodeValidateControlDefinition = defineComponent<AccessCodeValidateControlProps>({\n name: 'AccessCodeValidateControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeValidateControl,\n content: AccessCodeValidateControlContent,\n actions: { session: ['validateAccessCode'] },\n editor: { label: 'Access Code Validate', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n submitLabel: { type: 'string', label: 'Submit label' },\n codeLength: { type: 'number', default: 6, label: 'Code length' },\n },\n guideline:\n 'Code-entry step: composes AccessCodeField and dispatches $actions.session.validateAccessCode with the address the code was requested for and the authenticationToken, never the live email draft; a successful validate flips the session reactively and hides the Root. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\nexport const AccessCodeSentNoticeContent = defineContentType({\n id: 'access-code-sent-notice',\n title: 'Access Code Sent Notice',\n description: 'Confirmation that names the address the access code was sent to.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n template: {\n type: 'string',\n title: 'Template',\n format: 'icu-message',\n messageSource: 'We sent an access code to {email}.',\n messageArguments: { type: 'object', properties: { email: { type: 'string' } } },\n messageExample: { email: 'shopper@example.com' },\n },\n },\n },\n});\n\nexport const AccessCodeSentNoticeDefinition = defineComponent<AccessCodeSentNoticeProps>({\n name: 'AccessCodeSentNotice',\n importPath: '@vtex/faststore/components',\n component: AccessCodeSentNotice,\n content: AccessCodeSentNoticeContent,\n editor: { label: 'Access Code Sent Notice', category: 'identity' },\n schema: {},\n guideline:\n \"Confirmation shown at the validate step only: names the address the code was sent to, read from the Root's pinned address and never from the live email draft. The sentence is the $content field template, an ICU message whose {email} argument is the address. Announced once as a status. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.\",\n});\n\nexport const AccessCodeResendContent = defineContentType({\n id: 'access-code-resend',\n title: 'Access Code Resend',\n description:\n 'Label of the resend button while the resend pace has not elapsed, and the inline messages shown when resending fails.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n sendLimitMessage: {\n type: 'string',\n title: 'Send-limit message',\n description: 'Shown when too many codes were requested for the address.',\n format: 'icu-message',\n messageSource: 'Too many codes requested. Try again later.',\n },\n blockedMessage: {\n type: 'string',\n title: 'Blocked message',\n description: 'Shown when the account is blocked. Names no duration: the account service returns none.',\n format: 'icu-message',\n messageSource: 'This account is blocked. Contact support.',\n },\n networkErrorMessage: {\n type: 'string',\n title: 'Generic error message',\n description: 'Shown for a network failure and for any refusal the shopper cannot act on.',\n format: 'icu-message',\n messageSource: 'Something went wrong. Please try again.',\n },\n countdownTemplate: {\n type: 'string',\n title: 'Countdown template',\n format: 'icu-message',\n messageSource: 'Resend code in {seconds}s',\n messageArguments: { type: 'object', properties: { seconds: { type: 'integer' } } },\n messageExample: { seconds: 42 },\n },\n },\n },\n});\n\nexport const ACCESS_CODE_RESEND_ERROR_FIELDS = {\n ...ACCESS_CODE_REQUEST_ERROR_FIELDS,\n} as const satisfies Record<SessionErrorCode, MessageFieldName<typeof AccessCodeResendContent>>;\n\nexport const AccessCodeResendControlDefinition = defineComponent<AccessCodeResendControlProps>({\n name: 'AccessCodeResendControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeResendControl,\n content: AccessCodeResendContent,\n actions: { session: ['requestAccessCode'] },\n editor: { label: 'Access Code Resend', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n pendingLabel: { type: 'string', label: 'Pending label' },\n },\n guideline:\n 'Validate-step only: dispatches $actions.session.requestAccessCode again with the address the first code was sent to, never the live email draft, and replaces the token. Inert for a fixed interval after each code is sent, counting the seconds down in its own label through the $content field countdownTemplate (an ICU message with a {seconds} argument). The interval is not authorable. Failures render inline. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\nexport const AccessCodeCorrectEmailControlDefinition = defineComponent<AccessCodeCorrectEmailControlProps>({\n name: 'AccessCodeCorrectEmailControl',\n importPath: '@vtex/faststore/components',\n component: AccessCodeCorrectEmailControl,\n editor: { label: 'Access Code Correct E-mail', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n },\n guideline:\n 'Validate-step only: returns the shopper to the send step and discards the earlier request whole (token, pinned address and resend pace), so a corrected address starts a genuinely new request. Never held by the resend pace. Must be inside AccessCodeSignInRoot. See access-code-sign-in.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/** The in-flight label: an authored `pendingLabel` with content, else `label`, so the button never blanks. */\nfunction pendingLabelOr(pendingLabel: string | undefined, label: string | undefined): string {\n return pendingLabel?.trim() ? pendingLabel : (label ?? '');\n}\n\ntype Stepper = {\n step: AccessCodeSignInStep;\n authenticationToken: string | null;\n requestedEmail: string | null;\n /** Epoch ms at which another code may be sent; `null` when none is pending. A deadline, not a counter,\n * so a throttled background tab cannot make the countdown drift. */\n resendAvailableAt: number | null;\n};\n\nconst INITIAL_STEPPER: Stepper = {\n step: 'request',\n authenticationToken: null,\n requestedEmail: null,\n resendAvailableAt: null,\n};\n\n/**\n * Root of the access-code method of the sign-in surface. It declares no fragment and reads no data of\n * its own: the gate is the three `sign-in` context reads (`resolved`, `accessCodeEnabled` and\n * `method === 'accessCode'`) plus the session read (`state !== 'loggedIn'`), so a store enabling both\n * methods shows the code step only while the access code is the method showing. It returns `null`\n * rather than unmounting, so its `useState` — the stepper, the token and the pinned address — survives\n * a method switch and a gate close.\n *\n * Owns the `step`/`authenticationToken` stepper, the address the token was issued for and the resend\n * deadline, broadcasting them through context. The shared email draft is `SignInRoot`'s, never this\n * family's; the validate dispatch reads the pinned `requestedEmail` instead, because the server rejects a\n * `validateAccessCode` whose email differs from the `requestAccessCode` that issued the token. The\n * deadline lives here, not on the resend control, because this Root returns `null` on a method switch and\n * unmounts every child with it. Everything clears together — `resetToRequest()` — on any change of\n * `useSession().state` other than the session resolving, so a stale token, address and countdown never greet\n * the next shopper. This Root never unmounts, so that reaction is the only thing that clears it: no manual call\n * anywhere in this family.\n */\nexport function AccessCodeSignInRoot({ className, children, ...props }: AccessCodeSignInRootProps) {\n const { state, loading } = useSession();\n const { resolved, accessCodeEnabled, method } = useSignIn();\n const wasLoading = useRef(loading);\n\n const [stepper, setStepper] = useState<Stepper>(INITIAL_STEPPER);\n const [, tick] = useReducer((count: number) => count + 1, 0);\n\n const startValidation = useCallback((token: string, requestedEmail: string) => {\n setStepper({\n step: 'validate',\n authenticationToken: token,\n requestedEmail,\n resendAvailableAt: Date.now() + ACCESS_CODE_RESEND_INTERVAL_SECONDS * 1000,\n });\n }, []);\n\n const resetToRequest = useCallback(() => {\n setStepper(INITIAL_STEPPER);\n }, []);\n\n // A transition trigger, not a state test: it fires on mount (a no-op against the initial stepper) and on\n // every change of the session state, so a shopper who is already identified keeps their own token. The\n // session resolving is not a change of shopper: while it loads, `state` reads `anonymous` as a default, so\n // the transition out of loading is skipped, or a code sent in that window would be wiped by the arrival\n // of the very session it belongs to.\n // biome-ignore lint/correctness/useExhaustiveDependencies: `state` is the trigger, not a value the effect reads\n useEffect(() => {\n if (!wasLoading.current) resetToRequest();\n }, [state, resetToRequest]);\n\n // Declared after the trigger above so that it still reads the previous commit's `loading`.\n useEffect(() => {\n wasLoading.current = loading;\n }, [loading]);\n\n const { step, authenticationToken, requestedEmail, resendAvailableAt } = stepper;\n\n // The interval only forces a re-render; the rendered seconds are derived from the deadline. It exists\n // while a deadline is pending and clears it, and itself, once the deadline has passed.\n useEffect(() => {\n if (resendAvailableAt == null) return;\n const interval = setInterval(() => {\n if (Date.now() < resendAvailableAt) {\n tick();\n return;\n }\n setStepper((current) =>\n current.resendAvailableAt === resendAvailableAt ? { ...current, resendAvailableAt: null } : current,\n );\n }, 1000);\n return () => clearInterval(interval);\n }, [resendAvailableAt]);\n\n const resendAvailableInSeconds =\n resendAvailableAt == null ? 0 : Math.max(0, Math.ceil((resendAvailableAt - Date.now()) / 1000));\n\n const contextValue = useMemo<AccessCodeSignInContextValue>(\n () => ({ step, authenticationToken, requestedEmail, startValidation, resendAvailableInSeconds, resetToRequest }),\n [step, authenticationToken, requestedEmail, startValidation, resendAvailableInSeconds, resetToRequest],\n );\n\n const gated = state !== 'loggedIn' && resolved && accessCodeEnabled && method === 'accessCode';\n if (!gated) return null;\n\n return (\n <AccessCodeSignInContext value={contextValue}>\n <div {...props} className={className} data-fs-access-code-sign-in-root=\"\">\n {children}\n </div>\n </AccessCodeSignInContext>\n );\n}\n\n/**\n * Renders only while the Root's stepper is at `step === 'request'`. Reads the shared draft email from\n * `useSignIn()` and dispatches `$actions.session.requestAccessCode({ email })` once it is a valid,\n * non-empty address (no account-existence pre-check beyond that format gate). On a result with a\n * non-null token and no `userErrors`, advances the Root's stepper and hands it the exact address that\n * was dispatched, so the validate step is bound to it. Every `userErrors` entry renders\n * inline, worded by the `$content` field for its code; the step never changes on error, so the shopper can\n * retry or abandon the method and continue as a guest.\n *\n * A result that arrives after the session changed under it is dropped rather than written: the Root\n * cleared the stepper for that change, and writing the result would bind the next shopper to the\n * address and the live token of the one who pressed send.\n */\nexport function AccessCodeRequestControl({\n label,\n pendingLabel,\n onRequested,\n $content,\n $locale,\n $actions: $actionsProp,\n className,\n ...props\n}: AccessCodeRequestControlProps) {\n const $actions = useActionsOverride($actionsProp);\n const { step, startValidation } = useAccessCodeSignIn();\n const { format } = useMessageFormatter(AccessCodeRequestControlContent, $content);\n const { email } = useSignIn();\n const { state, loading } = useSession();\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<SessionUserError | null>(null);\n\n // The session the shopper is in right now, readable after an await: a new object whenever the Root's\n // session clear runs (a change of `useSession().state` that is not the session resolving), so a result\n // can tell that its request was cleared while it was in flight.\n const liveSession = useRef({});\n const wasLoading = useRef(loading);\n useEffect(() => {\n if (!wasLoading.current) liveSession.current = { state };\n }, [state]);\n useEffect(() => {\n wasLoading.current = loading;\n }, [loading]);\n\n if (step !== 'request') return null;\n\n const canSubmit = !pending && isValidEmail(email);\n\n async function handleClick() {\n if (!canSubmit) return;\n // The address the server binds the token to. `email` is this render's value, so the draft moving while\n // the request is in flight cannot change it; the local names the one value the dispatch and the pin share.\n // Trimmed, as `SignInForm` trims the same shared draft. No test covers it and none can through this\n // composition: `EmailField` renders `type=\"email\"`, whose value sanitization strips leading and trailing\n // whitespace before the draft ever sees it, so the two methods cannot observably disagree today. The\n // trim is here so they still cannot if the draft ever reaches them from somewhere that is not that input.\n const requestedEmail = email.trim();\n const sessionAtPress = liveSession.current;\n setPending(true);\n setError(null);\n\n try {\n const result = (await $actions?.session?.requestAccessCode?.({ email: requestedEmail })) ?? {\n authenticationToken: null,\n userErrors: [],\n };\n\n if (liveSession.current !== sessionAtPress) return;\n\n if (result.authenticationToken && result.userErrors.length === 0) {\n startValidation(result.authenticationToken, requestedEmail);\n onRequested?.(result.authenticationToken);\n return;\n }\n\n const [firstError] = result.userErrors;\n if (firstError) setError(firstError);\n } finally {\n setPending(false);\n }\n }\n\n const message = error\n ? formatErrorCode(\n AccessCodeRequestControlContent,\n ACCESS_CODE_REQUEST_ERROR_FIELDS,\n error,\n format,\n 'networkErrorMessage',\n )\n : null;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-access-code-request-control=\"\"\n {...(pending ? { 'data-fs-access-code-request-pending': '' } : {})}\n >\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={!canSubmit}\n aria-busy={pending || undefined}\n data-fs-access-code-request-submit=\"\"\n data-fs-button=\"\"\n >\n {/* A blank authored pendingLabel falls back to `label` instead of blanking the button in flight. */}\n {pending ? pendingLabelOr(pendingLabel, label) : label}\n </button>\n {error ? (\n <div role=\"alert\" data-fs-access-code-request-error=\"\">\n {message}\n </div>\n ) : null}\n </div>\n );\n}\n\n/**\n * Renders only while the Root's stepper is at `step === 'validate'`. Composes `AccessCodeField` for\n * the code value and a submit control, disabled below `codeLength` (a UX courtesy, never a\n * validity claim). Dispatches `$actions.session.validateAccessCode` with the pinned `requestedEmail`\n * and `authenticationToken` read from context — never the live `sign-in` draft. On a non-empty\n * `userErrors` result, sets the field's `invalid`/`errorMessage` from the `$content` field for its code\n * and retains the code/token so the shopper can retry without re-requesting. On success it calls the optional `onValidated` and renders\n * no local \"success\" UI — `useSession()` flipping to `loggedIn` is what makes the whole Root\n * disappear.\n */\nexport function AccessCodeValidateControl({\n label,\n placeholder,\n submitLabel,\n codeLength = 6,\n onValidated,\n $content,\n $locale,\n $actions: $actionsProp,\n className,\n ...props\n}: AccessCodeValidateControlProps) {\n const $actions = useActionsOverride($actionsProp);\n const { format } = useMessageFormatter(AccessCodeValidateControlContent, $content);\n const { step, requestedEmail, authenticationToken } = useAccessCodeSignIn();\n const [code, setCode] = useState('');\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<SessionUserError | null>(null);\n\n // This control stays mounted while the stepper is back at the request step, so what the shopper typed and\n // the error that answered it belong to a request that no longer exists. Drop both on that transition.\n if (step !== 'validate') {\n if (code) setCode('');\n if (error) setError(null);\n return null;\n }\n\n const canSubmit = !pending && code.length >= codeLength && authenticationToken != null && requestedEmail != null;\n\n async function handleSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n if (!canSubmit || authenticationToken == null || requestedEmail == null) return;\n\n setPending(true);\n setError(null);\n\n try {\n const errors =\n (await $actions?.session?.validateAccessCode?.({\n email: requestedEmail,\n accessCode: code,\n authenticationToken,\n })) ?? [];\n\n const [firstError] = errors;\n if (firstError) {\n setError(firstError);\n return;\n }\n } finally {\n setPending(false);\n }\n\n onValidated?.();\n }\n\n function handleCodeChange(next: string) {\n setCode(next);\n if (error) setError(null);\n }\n\n const errorMessage = error\n ? formatErrorCode(\n AccessCodeValidateControlContent,\n ACCESS_CODE_VALIDATE_ERROR_FIELDS,\n error,\n format,\n 'networkErrorMessage',\n )\n : undefined;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-access-code-validate-control=\"\"\n {...(pending ? { 'data-fs-access-code-validate-pending': '' } : {})}\n >\n <form onSubmit={handleSubmit}>\n <AccessCodeField\n label={label}\n placeholder={placeholder}\n value={code}\n maxLength={codeLength}\n onValueChange={handleCodeChange}\n disabled={pending}\n invalid={error != null}\n errorMessage={errorMessage}\n />\n <button\n type=\"submit\"\n disabled={!canSubmit}\n aria-busy={pending || undefined}\n data-fs-access-code-validate-submit=\"\"\n data-fs-button=\"\"\n >\n {submitLabel}\n </button>\n </form>\n </div>\n );\n}\n\n/**\n * Renders only at the validate step. Names the address the code was dispatched to — the Root's pinned\n * `requestedEmail`, never the live `sign-in` draft, which a shopper edit or a profile re-seed can move\n * after the request. The `template` message's `email` argument is the address. The wrapper is an\n * `output`, whose implicit `status` role announces the confirmation once, when it appears.\n */\nexport function AccessCodeSentNotice({ $content, $locale, className, ...props }: AccessCodeSentNoticeProps) {\n const { step, requestedEmail } = useAccessCodeSignIn();\n const { format } = useMessageFormatter(AccessCodeSentNoticeContent, $content);\n\n if (step !== 'validate' || requestedEmail == null) return null;\n\n return (\n <output {...props} className={className} data-fs-access-code-sent-notice=\"\">\n {format('template', { email: requestedEmail })}\n </output>\n );\n}\n\n/**\n * Renders only at the validate step. Dispatches `$actions.session.requestAccessCode` with the Root's\n * pinned `requestedEmail` — never the live draft, so a second code goes to the address the shopper was\n * told about — and replaces the token with the one it returns through the same `startValidation` that\n * the request control uses, which re-pins the same address and re-arms the pace. Inert until the pace\n * has elapsed, with the whole seconds left in its own label. A failure renders inline and leaves the\n * step, the token and the pace untouched: no code was sent, so none is paced.\n *\n * A result that arrives after the request it answered has been discarded (the shopper went back, the\n * session changed, the Root closed) is dropped rather than written, so a token is never re-paired with\n * the address that was left.\n */\nexport function AccessCodeResendControl({\n label,\n pendingLabel,\n onResent,\n $content,\n $locale,\n $actions: $actionsProp,\n className,\n ...props\n}: AccessCodeResendControlProps) {\n const $actions = useActionsOverride($actionsProp);\n const { step, authenticationToken, requestedEmail, resendAvailableInSeconds, startValidation } =\n useAccessCodeSignIn();\n const { format } = useMessageFormatter(AccessCodeResendContent, $content);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<SessionUserError | null>(null);\n\n // The token the Root holds right now, readable after an await. `null` once the request this control\n // answers has been discarded, or once the control itself is gone.\n const liveToken = useRef<string | null>(authenticationToken);\n useEffect(() => {\n liveToken.current = authenticationToken;\n return () => {\n liveToken.current = null;\n };\n }, [authenticationToken]);\n\n if (step !== 'validate' || requestedEmail == null) {\n if (error) setError(null);\n return null;\n }\n\n const paced = resendAvailableInSeconds > 0;\n const canSubmit = !pending && !paced;\n\n async function handleClick() {\n if (!canSubmit || requestedEmail == null) return;\n // The address the first code went to and the token it was issued under, fixed at press time.\n const pinnedEmail = requestedEmail;\n const tokenAtPress = authenticationToken;\n setPending(true);\n setError(null);\n\n try {\n const result = (await $actions?.session?.requestAccessCode?.({ email: pinnedEmail })) ?? {\n authenticationToken: null,\n userErrors: [],\n };\n\n if (liveToken.current !== tokenAtPress) return;\n\n if (result.authenticationToken && result.userErrors.length === 0) {\n startValidation(result.authenticationToken, pinnedEmail);\n onResent?.(result.authenticationToken);\n return;\n }\n\n const [firstError] = result.userErrors;\n if (firstError) setError(firstError);\n } finally {\n setPending(false);\n }\n }\n\n const message = error\n ? formatErrorCode(AccessCodeResendContent, ACCESS_CODE_RESEND_ERROR_FIELDS, error, format, 'networkErrorMessage')\n : null;\n const pacedLabel = paced ? format('countdownTemplate', { seconds: resendAvailableInSeconds }) : label;\n const buttonLabel = pending ? pendingLabelOr(pendingLabel, label) : pacedLabel;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-access-code-resend-control=\"\"\n {...(paced ? { 'data-fs-access-code-resend-waiting': '' } : {})}\n {...(pending ? { 'data-fs-access-code-resend-pending': '' } : {})}\n >\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={!canSubmit}\n aria-busy={pending || undefined}\n data-fs-access-code-resend-submit=\"\"\n data-fs-button=\"\"\n >\n {buttonLabel}\n </button>\n {error ? (\n <div role=\"alert\" data-fs-access-code-resend-error=\"\">\n {message}\n </div>\n ) : null}\n </div>\n );\n}\n\n/**\n * Renders only at the validate step. Calls the Root's `resetToRequest()`, which discards the step, the\n * token, the pinned address and the resend pace in one transition. The shopper lands on the request step\n * with the shared draft still in the field to edit; the next request pins whatever address they send and\n * the token the server issues for it, and the earlier token is unreachable. Never held by the pace: the\n * pace counts codes sent, and a shopper who mistyped is not made to wait for the address they meant.\n */\nexport function AccessCodeCorrectEmailControl({\n label,\n onCorrected,\n className,\n ...props\n}: AccessCodeCorrectEmailControlProps) {\n const { step, resetToRequest } = useAccessCodeSignIn();\n\n if (step !== 'validate') return null;\n\n function handleClick() {\n resetToRequest();\n onCorrected?.();\n }\n\n return (\n <div {...props} className={className} data-fs-access-code-correct-email-control=\"\">\n <button type=\"button\" onClick={handleClick} data-fs-access-code-correct-email-button=\"\" data-fs-button=\"\">\n {label}\n </button>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const AccessCodeSignIn = {\n Root: AccessCodeSignInRoot,\n Request: AccessCodeRequestControl,\n SentNotice: AccessCodeSentNotice,\n Validate: AccessCodeValidateControl,\n Resend: AccessCodeResendControl,\n CorrectEmail: AccessCodeCorrectEmailControl,\n};\n"],"mappings":";;;;;;;;;;;;;AAkGA,MAAM,oCAAoC,OAAO,8BAA8B;AAE/E,MAAM,0BAA0B,cAC9B,iCACF;;;;;;;AAQA,SAAgB,sBAAoD;CAClE,UAAU;CACV,MAAM,MAAM,WAAW,uBAAuB;CAC9C,IAAI,QAAQ,mCACV,MAAM,IAAI,MAAM,uEAAuE;CAEzF,OAAO;AACT;AAiBA,MAAa,kCAAkC,kBAAkB;CAC/D,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,kBAAkB;IAChB,MAAM;IACN,OAAO;IACP,aAA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UAAA;EACE,CAAA,IACH,IACD;;AAET;;;;;;;;AASA,SAAgB,8BAA8B,EAC5C,OACA,aACA,WACA,GAAG,SACkC;CACrC,MAAM,EAAE,MAAM,mBAAmB,oBAAoB;CAErD,IAAI,SAAS,YAAY,OAAO;CAEhC,SAAS,cAAc;EACrB,eAAe;EACf,cAAc;CAChB;CAEA,OACE,oBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,6CAA0C;EAC9E,UAAA,oBAAC,UAAD;GAAQ,MAAK;GAAS,SAAS;GAAa,4CAAyC;GAAG,kBAAe;GACpG,UAAA;EACK,CAAA;CACL,CAAA;AAET;AAMA,MAAa,mBAAmB;CAC9B,MAAM;CACN,SAAS;CACT,YAAY;CACZ,UAAU;CACV,QAAQ;CACR,cAAc;AAChB"}
@@ -1,3 +1,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 { ComponentActions } from "../../sdk/actions/types.js";
@@ -9,52 +10,89 @@ import { ComponentPropsWithRef } from "react";
9
10
  * puts the question and dispatches `$actions.address.remove`. The confirmation never edits the list:
10
11
  * the entry leaves through the cache edit the action makes.
11
12
  */
12
- export type AccountAddressBookDeleteTriggerProps = ComponentPropsWithRef<'button'> & {
13
- /** The button's visible text. A blank value falls back to the catalog copy. */
14
- label?: string;
13
+ export type AccountAddressBookDeleteTriggerProps = ComponentPropsWithRef<'button'> & MessageLocaleProp & {
14
+ $content?: ContentValue<typeof AccountAddressBookDeleteTriggerContent>;
15
15
  };
16
- export type AccountAddressBookDeleteConfirmProps = Readonly<{
16
+ export type AccountAddressBookDeleteConfirmProps = MessageLocaleProp & Readonly<{
17
17
  /** Goes on the popup, the one element a store can size and place: the dialog renders in a portal. */
18
18
  className?: string;
19
- /** The question. A blank value falls back to the catalog copy. */
20
- title?: string;
21
- /** What deleting means. The address's first line always shows before it. A blank value falls back to the catalog copy. */
22
- description?: string;
23
- /** The label of the control that backs out. A blank value falls back to the catalog copy. */
24
- cancelLabel?: string;
25
- /** The label of the control that deletes. A blank value falls back to the catalog copy. */
26
- confirmLabel?: string;
27
- /** Toast after the address is deleted. A blank value falls back to the catalog copy. */
28
- deletedMessage?: string;
29
- /** Shown in the prompt when the address was not deleted. A blank value falls back to the catalog copy. */
30
- failedMessage?: string;
31
- /** Shown in the prompt when the session expired. A blank value falls back to the catalog copy. */
32
- unauthorizedMessage?: string;
19
+ $content?: ContentValue<typeof AccountAddressBookDeleteConfirmContent>;
33
20
  /** Injected by the compiler from `actions: { address: [...] }`; the address write surface. */
34
21
  $actions?: ComponentActions;
35
22
  }>;
36
- export declare function AccountAddressBookDeleteTrigger({ label, className, children, onClick, ...props }: AccountAddressBookDeleteTriggerProps): import("react/jsx-runtime").JSX.Element;
37
- export declare function AccountAddressBookDeleteConfirm({ className, title, description, cancelLabel, confirmLabel, deletedMessage, failedMessage, unauthorizedMessage, $actions: $actionsProp }: AccountAddressBookDeleteConfirmProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function AccountAddressBookDeleteTrigger({ $content, $locale, className, children, onClick, ...props }: AccountAddressBookDeleteTriggerProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function AccountAddressBookDeleteConfirm({ className, $content, $actions: $actionsProp }: AccountAddressBookDeleteConfirmProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare const AccountAddressBookDeleteTriggerContent: {
26
+ readonly id: "account-address-book-delete-trigger";
27
+ readonly title: "Account Address Book Delete Trigger";
28
+ readonly description: "Label of the control that asks to delete an address.";
29
+ readonly schema: {
30
+ readonly type: "object";
31
+ readonly additionalProperties: false;
32
+ readonly properties: {
33
+ readonly label: {
34
+ readonly type: "string";
35
+ readonly title: "Button label";
36
+ readonly format: "icu-message";
37
+ readonly messageSource: "Delete";
38
+ };
39
+ };
40
+ };
41
+ };
38
42
  export declare const AccountAddressBookDeleteTriggerDefinition: ComponentDefinition<AccountAddressBookDeleteTriggerProps>;
39
- export declare const AccountAddressBookDeleteConfirmDefinition: ComponentDefinition<Readonly<{
40
- /** Goes on the popup, the one element a store can size and place: the dialog renders in a portal. */
41
- className?: string;
42
- /** The question. A blank value falls back to the catalog copy. */
43
- title?: string;
44
- /** What deleting means. The address's first line always shows before it. A blank value falls back to the catalog copy. */
45
- description?: string;
46
- /** The label of the control that backs out. A blank value falls back to the catalog copy. */
47
- cancelLabel?: string;
48
- /** The label of the control that deletes. A blank value falls back to the catalog copy. */
49
- confirmLabel?: string;
50
- /** Toast after the address is deleted. A blank value falls back to the catalog copy. */
51
- deletedMessage?: string;
52
- /** Shown in the prompt when the address was not deleted. A blank value falls back to the catalog copy. */
53
- failedMessage?: string;
54
- /** Shown in the prompt when the session expired. A blank value falls back to the catalog copy. */
55
- unauthorizedMessage?: string;
56
- /** Injected by the compiler from `actions: { address: [...] }`; the address write surface. */
57
- $actions?: ComponentActions;
58
- }>>;
43
+ export declare const AccountAddressBookDeleteConfirmContent: {
44
+ readonly id: "account-address-book-delete-confirm";
45
+ readonly title: "Account Address Book Delete Confirm";
46
+ readonly description: "The question, the labels and the outcome messages of the address deletion prompt.";
47
+ readonly schema: {
48
+ readonly type: "object";
49
+ readonly additionalProperties: false;
50
+ readonly properties: {
51
+ readonly title: {
52
+ readonly type: "string";
53
+ readonly title: "Question";
54
+ readonly format: "icu-message";
55
+ readonly messageSource: "Delete this address?";
56
+ };
57
+ readonly description: {
58
+ readonly type: "string";
59
+ readonly title: "What deleting means";
60
+ readonly format: "icu-message";
61
+ readonly messageSource: "This can't be undone.";
62
+ };
63
+ readonly cancelLabel: {
64
+ readonly type: "string";
65
+ readonly title: "Cancel label";
66
+ readonly format: "icu-message";
67
+ readonly messageSource: "Cancel";
68
+ };
69
+ readonly confirmLabel: {
70
+ readonly type: "string";
71
+ readonly title: "Delete label";
72
+ readonly format: "icu-message";
73
+ readonly messageSource: "Delete";
74
+ };
75
+ readonly deletedMessage: {
76
+ readonly type: "string";
77
+ readonly title: "Address deleted message";
78
+ readonly format: "icu-message";
79
+ readonly messageSource: "Address deleted.";
80
+ };
81
+ readonly failedMessage: {
82
+ readonly type: "string";
83
+ readonly title: "Not deleted message";
84
+ readonly format: "icu-message";
85
+ readonly messageSource: "We couldn't delete this address. Try again.";
86
+ };
87
+ readonly unauthorizedMessage: {
88
+ readonly type: "string";
89
+ readonly title: "Session expired message";
90
+ readonly format: "icu-message";
91
+ readonly messageSource: "Your session expired. Sign in again to delete this address.";
92
+ };
93
+ };
94
+ };
95
+ };
96
+ export declare const AccountAddressBookDeleteConfirmDefinition: ComponentDefinition<AccountAddressBookDeleteConfirmProps>;
59
97
  //#endregion
60
98
  //# sourceMappingURL=account-address-book-delete.d.ts.map
@@ -1,11 +1,11 @@
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 { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
6
- import { resolveAuthoredCopy } from "../../utils/resolve-authored-copy.js";
7
- import { loggableErrorName } from "../../utils/loggable-error-name.js";
8
7
  import { Button } from "../../particles/button/button.js";
8
+ import { loggableErrorName } from "../../utils/loggable-error-name.js";
9
9
  import { useAccountAddressBook, useAccountAddressBookItem } from "./account-address-book.js";
10
10
  import { AlertDialog } from "../../particles/alert-dialog/alert-dialog.js";
11
11
  import { useToast } from "../../particles/toast/toast.js";
@@ -22,11 +22,10 @@ function deleteError(userErrors) {
22
22
  if (userErrors.length === 0 || userErrors.some(({ code }) => code === "NOT_FOUND")) return null;
23
23
  return userErrors.some(({ code }) => code === "UNAUTHORIZED") ? "unauthorized" : "deleteFailed";
24
24
  }
25
- function AccountAddressBookDeleteTrigger({ label, className, children, onClick, ...props }) {
25
+ function AccountAddressBookDeleteTrigger({ $content, $locale, className, children, onClick, ...props }) {
26
26
  const { requestDelete } = useAccountAddressBook();
27
27
  const address = useAccountAddressBookItem();
28
- const intl = useIntl();
29
- const text = resolveAuthoredCopy(label, intl.formatMessage({ id: "fs/address-delete.trigger" }));
28
+ const text = useMessageFormatter(AccountAddressBookDeleteTriggerContent, $content).format("label");
30
29
  const line = firstLine(address);
31
30
  return /* @__PURE__ */ jsx(Button, {
32
31
  "aria-label": line === "" ? void 0 : `${text} ${line}`,
@@ -41,23 +40,22 @@ function AccountAddressBookDeleteTrigger({ label, className, children, onClick,
41
40
  children: children ?? text
42
41
  });
43
42
  }
44
- function AccountAddressBookDeleteConfirm({ className, title, description, cancelLabel, confirmLabel, deletedMessage, failedMessage, unauthorizedMessage, $actions: $actionsProp }) {
43
+ function AccountAddressBookDeleteConfirm({ className, $content, $actions: $actionsProp }) {
45
44
  const toast = useToast();
46
- const intl = useIntl();
45
+ const { format } = useMessageFormatter(AccountAddressBookDeleteConfirmContent, $content);
47
46
  const $actions = useActionsOverride($actionsProp);
48
47
  const { pendingDelete, endDelete, openForm, close } = useAccountAddressBook();
49
48
  const [pending, setPending] = useState(false);
50
49
  const pendingRef = useRef(false);
51
50
  const [error, setError] = useState(null);
52
51
  const line = pendingDelete ? firstLine(pendingDelete) : "";
53
- const errorMessage = error === "unauthorized" ? resolveAuthoredCopy(unauthorizedMessage, intl.formatMessage({ id: "fs/address-delete.error.unauthorized" })) : resolveAuthoredCopy(failedMessage, intl.formatMessage({ id: "fs/address-delete.error.failed" }));
54
52
  function finish() {
55
53
  setError(null);
56
54
  endDelete();
57
55
  }
58
56
  function deleted(id) {
59
57
  toast.add({
60
- title: resolveAuthoredCopy(deletedMessage, intl.formatMessage({ id: "fs/address-delete.deleted" })),
58
+ title: format("deletedMessage"),
61
59
  type: "success"
62
60
  });
63
61
  if (openForm?.mode === "edit" && openForm.address.id === id) close();
@@ -95,19 +93,19 @@ function AccountAddressBookDeleteConfirm({ className, title, description, cancel
95
93
  className,
96
94
  "data-fs-account-address-book-delete-confirm": "",
97
95
  children: [
98
- /* @__PURE__ */ jsx(AlertDialog.Title, { children: resolveAuthoredCopy(title, intl.formatMessage({ id: "fs/address-delete.title" })) }),
96
+ /* @__PURE__ */ jsx(AlertDialog.Title, { children: format("title") }),
99
97
  /* @__PURE__ */ jsxs(AlertDialog.Description, { children: [line === "" ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
100
98
  "data-fs-account-address-book-delete-address": "",
101
99
  children: line
102
- }), " "] }), resolveAuthoredCopy(description, intl.formatMessage({ id: "fs/address-delete.description" }))] }),
100
+ }), " "] }), format("description")] }),
103
101
  error === null ? null : /* @__PURE__ */ jsx("p", {
104
102
  role: "alert",
105
103
  "data-fs-account-address-book-delete-error": "",
106
- children: errorMessage
104
+ children: format(error === "unauthorized" ? "unauthorizedMessage" : "failedMessage")
107
105
  }),
108
106
  /* @__PURE__ */ jsx(AlertDialog.Close, {
109
107
  disabled: pending,
110
- children: resolveAuthoredCopy(cancelLabel, intl.formatMessage({ id: "fs/address-delete.cancel" }))
108
+ children: format("cancelLabel")
111
109
  }),
112
110
  /* @__PURE__ */ jsx(Button, {
113
111
  type: "button",
@@ -115,70 +113,108 @@ function AccountAddressBookDeleteConfirm({ className, title, description, cancel
115
113
  "aria-busy": pending || void 0,
116
114
  onClick: confirm,
117
115
  "data-fs-account-address-book-delete-submit": "",
118
- children: resolveAuthoredCopy(confirmLabel, intl.formatMessage({ id: "fs/address-delete.confirm" }))
116
+ children: format("confirmLabel")
119
117
  })
120
118
  ]
121
119
  }) })] })
122
120
  });
123
121
  }
122
+ const AccountAddressBookDeleteTriggerContent = defineContentType({
123
+ id: "account-address-book-delete-trigger",
124
+ title: "Account Address Book Delete Trigger",
125
+ description: "Label of the control that asks to delete an address.",
126
+ schema: {
127
+ type: "object",
128
+ additionalProperties: false,
129
+ properties: { label: {
130
+ type: "string",
131
+ title: "Button label",
132
+ format: "icu-message",
133
+ messageSource: "Delete"
134
+ } }
135
+ }
136
+ });
124
137
  const AccountAddressBookDeleteTriggerDefinition = defineComponent({
125
138
  name: "AccountAddressBookDeleteTrigger",
126
139
  importPath: "@vtex/faststore/components",
127
140
  component: AccountAddressBookDeleteTrigger,
141
+ content: AccountAddressBookDeleteTriggerContent,
128
142
  requiresContext: "account-address-book-item",
129
143
  editor: {
130
144
  label: "Account Address Book Delete Trigger",
131
145
  category: "action"
132
146
  },
133
- schema: { label: {
134
- type: "string",
135
- label: "Button label"
136
- } },
147
+ schema: {},
137
148
  guideline: "Asks to delete the address of the entry it sits in. Nothing is deleted until the shopper confirms in an AccountAddressBookDeleteConfirm. Its accessible name adds the address's first line, so a list of them is told apart. Place it inside AccountAddressBookItem, and one AccountAddressBookDeleteConfirm under the root to ask the question."
138
149
  });
150
+ const AccountAddressBookDeleteConfirmContent = defineContentType({
151
+ id: "account-address-book-delete-confirm",
152
+ title: "Account Address Book Delete Confirm",
153
+ description: "The question, the labels and the outcome messages of the address deletion prompt.",
154
+ schema: {
155
+ type: "object",
156
+ additionalProperties: false,
157
+ properties: {
158
+ title: {
159
+ type: "string",
160
+ title: "Question",
161
+ format: "icu-message",
162
+ messageSource: "Delete this address?"
163
+ },
164
+ description: {
165
+ type: "string",
166
+ title: "What deleting means",
167
+ format: "icu-message",
168
+ messageSource: "This can't be undone."
169
+ },
170
+ cancelLabel: {
171
+ type: "string",
172
+ title: "Cancel label",
173
+ format: "icu-message",
174
+ messageSource: "Cancel"
175
+ },
176
+ confirmLabel: {
177
+ type: "string",
178
+ title: "Delete label",
179
+ format: "icu-message",
180
+ messageSource: "Delete"
181
+ },
182
+ deletedMessage: {
183
+ type: "string",
184
+ title: "Address deleted message",
185
+ format: "icu-message",
186
+ messageSource: "Address deleted."
187
+ },
188
+ failedMessage: {
189
+ type: "string",
190
+ title: "Not deleted message",
191
+ format: "icu-message",
192
+ messageSource: "We couldn't delete this address. Try again."
193
+ },
194
+ unauthorizedMessage: {
195
+ type: "string",
196
+ title: "Session expired message",
197
+ format: "icu-message",
198
+ messageSource: "Your session expired. Sign in again to delete this address."
199
+ }
200
+ }
201
+ }
202
+ });
139
203
  const AccountAddressBookDeleteConfirmDefinition = defineComponent({
140
204
  name: "AccountAddressBookDeleteConfirm",
141
205
  importPath: "@vtex/faststore/components",
142
206
  component: AccountAddressBookDeleteConfirm,
207
+ content: AccountAddressBookDeleteConfirmContent,
143
208
  requiresContext: "account-address-book",
144
209
  actions: { address: ["remove"] },
145
210
  editor: {
146
211
  label: "Account Address Book Delete Confirm",
147
212
  category: "layout"
148
213
  },
149
- schema: {
150
- title: {
151
- type: "string",
152
- label: "Question"
153
- },
154
- description: {
155
- type: "string",
156
- label: "What deleting means"
157
- },
158
- cancelLabel: {
159
- type: "string",
160
- label: "Cancel label"
161
- },
162
- confirmLabel: {
163
- type: "string",
164
- label: "Delete label"
165
- },
166
- deletedMessage: {
167
- type: "string",
168
- label: "Address deleted message"
169
- },
170
- failedMessage: {
171
- type: "string",
172
- label: "Not deleted message"
173
- },
174
- unauthorizedMessage: {
175
- type: "string",
176
- label: "Session expired message"
177
- }
178
- },
214
+ schema: {},
179
215
  guideline: "The alert dialog that asks before an address is deleted, one per address book, opened by AccountAddressBookDeleteTrigger. Names the address, takes focus on Cancel, and closes only on Cancel or Escape: a click outside does nothing. Confirming removes the address, shows a toast and closes; a refusal keeps the dialog open with a message and lets the shopper try again. While the call runs, nothing closes it. Deleting the last address leaves the book empty, so compose an AccountAddressBookEmpty. Requires a ToastProvider ancestor, since the success toast throws without one. Place it under AccountAddressBookRoot. See account-address-book.md."
180
216
  });
181
217
  //#endregion
182
- export { AccountAddressBookDeleteConfirm, AccountAddressBookDeleteConfirmDefinition, AccountAddressBookDeleteTrigger, AccountAddressBookDeleteTriggerDefinition };
218
+ export { AccountAddressBookDeleteConfirm, AccountAddressBookDeleteConfirmContent, AccountAddressBookDeleteConfirmDefinition, AccountAddressBookDeleteTrigger, AccountAddressBookDeleteTriggerContent, AccountAddressBookDeleteTriggerDefinition };
183
219
 
184
220
  //# sourceMappingURL=account-address-book-delete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-address-book-delete.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-book-delete.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, useRef, useState } from 'react';\nimport { AlertDialog } from '../../particles/alert-dialog/alert-dialog.js';\nimport { Button } from '../../particles/button/button.js';\nimport { useToast } from '../../particles/toast/toast.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport type { CustomerAddressUserError } from '../../sdk/address/operations.js';\nimport { useIntl } from '../../sdk/i18n/client.js';\nimport { loggableErrorName } from '../../utils/loggable-error-name.js';\nimport { resolveAuthoredCopy } from '../../utils/resolve-authored-copy.js';\nimport { useAccountAddressBook, useAccountAddressBookItem } from './account-address-book.js';\nimport { firstLine } from './account-address-first-line.js';\n\n/**\n * Deleting an address (specs/sfs-3437-address-book-delete.md, RFC REQ-04). The book's root holds which\n * address is waiting for an answer; a trigger in each entry asks, and one confirmation under the root\n * puts the question and dispatches `$actions.address.remove`. The confirmation never edits the list:\n * the entry leaves through the cache edit the action makes.\n */\n\nexport type AccountAddressBookDeleteTriggerProps = ComponentPropsWithRef<'button'> & {\n /** The button's visible text. A blank value falls back to the catalog copy. */\n label?: string;\n};\n\nexport type AccountAddressBookDeleteConfirmProps = Readonly<{\n /** Goes on the popup, the one element a store can size and place: the dialog renders in a portal. */\n className?: string;\n /** The question. A blank value falls back to the catalog copy. */\n title?: string;\n /** What deleting means. The address's first line always shows before it. A blank value falls back to the catalog copy. */\n description?: string;\n /** The label of the control that backs out. A blank value falls back to the catalog copy. */\n cancelLabel?: string;\n /** The label of the control that deletes. A blank value falls back to the catalog copy. */\n confirmLabel?: string;\n /** Toast after the address is deleted. A blank value falls back to the catalog copy. */\n deletedMessage?: string;\n /** Shown in the prompt when the address was not deleted. A blank value falls back to the catalog copy. */\n failedMessage?: string;\n /** Shown in the prompt when the session expired. A blank value falls back to the catalog copy. */\n unauthorizedMessage?: string;\n /** Injected by the compiler from `actions: { address: [...] }`; the address write surface. */\n $actions?: ComponentActions;\n}>;\n\ntype DeleteError = 'unauthorized' | 'deleteFailed';\n\n/**\n * What a result means for the prompt. An empty result is a removal, and so is `NOT_FOUND`: the server no\n * longer has the address, which is what the shopper asked for, and the action already took it out of\n * the cache. Anything else leaves the address listed.\n */\nfunction deleteError(userErrors: readonly CustomerAddressUserError[]): DeleteError | null {\n if (userErrors.length === 0 || userErrors.some(({ code }) => code === 'NOT_FOUND')) return null;\n return userErrors.some(({ code }) => code === 'UNAUTHORIZED') ? 'unauthorized' : 'deleteFailed';\n}\n\nexport function AccountAddressBookDeleteTrigger({\n label,\n className,\n children,\n onClick,\n ...props\n}: AccountAddressBookDeleteTriggerProps) {\n const { requestDelete } = useAccountAddressBook();\n const address = useAccountAddressBookItem();\n const intl = useIntl();\n const text = resolveAuthoredCopy(label, intl.formatMessage({ id: 'fs/address-delete.trigger' }));\n const line = firstLine(address);\n\n return (\n <Button\n aria-label={line === '' ? undefined : `${text} ${line}`}\n {...props}\n type=\"button\"\n className={className}\n onClick={(event) => {\n onClick?.(event);\n requestDelete(address, event.currentTarget);\n }}\n data-fs-account-address-book-delete=\"\"\n >\n {children ?? text}\n </Button>\n );\n}\n\nexport function AccountAddressBookDeleteConfirm({\n className,\n title,\n description,\n cancelLabel,\n confirmLabel,\n deletedMessage,\n failedMessage,\n unauthorizedMessage,\n $actions: $actionsProp,\n}: AccountAddressBookDeleteConfirmProps) {\n // Enforces the ToastProvider ancestor: the hook throws outside one.\n const toast = useToast();\n const intl = useIntl();\n const $actions = useActionsOverride($actionsProp);\n const { pendingDelete, endDelete, openForm, close } = useAccountAddressBook();\n const [pending, setPending] = useState(false);\n const pendingRef = useRef(false);\n const [error, setError] = useState<DeleteError | null>(null);\n\n const line = pendingDelete ? firstLine(pendingDelete) : '';\n const errorMessage =\n error === 'unauthorized'\n ? resolveAuthoredCopy(unauthorizedMessage, intl.formatMessage({ id: 'fs/address-delete.error.unauthorized' }))\n : resolveAuthoredCopy(failedMessage, intl.formatMessage({ id: 'fs/address-delete.error.failed' }));\n\n function finish() {\n setError(null);\n endDelete();\n }\n\n function deleted(id: string) {\n toast.add({\n title: resolveAuthoredCopy(deletedMessage, intl.formatMessage({ id: 'fs/address-delete.deleted' })),\n type: 'success',\n });\n // An edit of this very address would only fail with `NOT_FOUND`, so it goes with the address.\n if (openForm?.mode === 'edit' && openForm.address.id === id) close();\n finish();\n }\n\n async function confirm() {\n if (pendingRef.current || pendingDelete === null) return;\n const remove = $actions?.address?.remove;\n if (!remove) {\n // A composition gap (the provider chain never delivered the action) is otherwise a dead button.\n setError('deleteFailed');\n return;\n }\n\n const { id } = pendingDelete;\n pendingRef.current = true;\n setPending(true);\n setError(null);\n try {\n const failure = deleteError(await remove({ id }));\n if (failure) setError(failure);\n else deleted(id);\n } catch (error_) {\n // Log only the error name: a message can echo an address value.\n console.error('[AccountAddressBookDeleteConfirm] address.remove failed', loggableErrorName(error_));\n setError('deleteFailed');\n } finally {\n pendingRef.current = false;\n setPending(false);\n }\n }\n\n return (\n <AlertDialog.Root\n open={pendingDelete !== null}\n onOpenChange={(next) => {\n // Nothing closes the prompt while the call runs: its outcome has to land in front of the shopper.\n if (!next && !pendingRef.current) finish();\n }}\n >\n <AlertDialog.Portal>\n <AlertDialog.Backdrop />\n <AlertDialog.Viewport>\n <AlertDialog.Popup className={className} data-fs-account-address-book-delete-confirm=\"\">\n <AlertDialog.Title>\n {resolveAuthoredCopy(title, intl.formatMessage({ id: 'fs/address-delete.title' }))}\n </AlertDialog.Title>\n <AlertDialog.Description>\n {line === '' ? null : (\n <>\n <span data-fs-account-address-book-delete-address=\"\">{line}</span>{' '}\n </>\n )}\n {resolveAuthoredCopy(description, intl.formatMessage({ id: 'fs/address-delete.description' }))}\n </AlertDialog.Description>\n {error === null ? null : (\n <p role=\"alert\" data-fs-account-address-book-delete-error=\"\">\n {errorMessage}\n </p>\n )}\n <AlertDialog.Close disabled={pending}>\n {resolveAuthoredCopy(cancelLabel, intl.formatMessage({ id: 'fs/address-delete.cancel' }))}\n </AlertDialog.Close>\n <Button\n type=\"button\"\n disabled={pending}\n aria-busy={pending || undefined}\n onClick={confirm}\n data-fs-account-address-book-delete-submit=\"\"\n >\n {resolveAuthoredCopy(confirmLabel, intl.formatMessage({ id: 'fs/address-delete.confirm' }))}\n </Button>\n </AlertDialog.Popup>\n </AlertDialog.Viewport>\n </AlertDialog.Portal>\n </AlertDialog.Root>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccountAddressBookDeleteTriggerDefinition = defineComponent<AccountAddressBookDeleteTriggerProps>({\n name: 'AccountAddressBookDeleteTrigger',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookDeleteTrigger,\n requiresContext: 'account-address-book-item',\n editor: { label: 'Account Address Book Delete Trigger', category: 'action' },\n schema: {\n label: { type: 'string', label: 'Button label' },\n },\n guideline:\n \"Asks to delete the address of the entry it sits in. Nothing is deleted until the shopper confirms in an AccountAddressBookDeleteConfirm. Its accessible name adds the address's first line, so a list of them is told apart. Place it inside AccountAddressBookItem, and one AccountAddressBookDeleteConfirm under the root to ask the question.\",\n});\n\nexport const AccountAddressBookDeleteConfirmDefinition = defineComponent<AccountAddressBookDeleteConfirmProps>({\n name: 'AccountAddressBookDeleteConfirm',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookDeleteConfirm,\n requiresContext: 'account-address-book',\n actions: { address: ['remove'] },\n editor: { label: 'Account Address Book Delete Confirm', category: 'layout' },\n schema: {\n title: { type: 'string', label: 'Question' },\n description: { type: 'string', label: 'What deleting means' },\n cancelLabel: { type: 'string', label: 'Cancel label' },\n confirmLabel: { type: 'string', label: 'Delete label' },\n deletedMessage: { type: 'string', label: 'Address deleted message' },\n failedMessage: { type: 'string', label: 'Not deleted message' },\n unauthorizedMessage: { type: 'string', label: 'Session expired message' },\n },\n guideline:\n 'The alert dialog that asks before an address is deleted, one per address book, opened by AccountAddressBookDeleteTrigger. Names the address, takes focus on Cancel, and closes only on Cancel or Escape: a click outside does nothing. Confirming removes the address, shows a toast and closes; a refusal keeps the dialog open with a message and lets the shopper try again. While the call runs, nothing closes it. Deleting the last address leaves the book empty, so compose an AccountAddressBookEmpty. Requires a ToastProvider ancestor, since the success toast throws without one. Place it under AccountAddressBookRoot. See account-address-book.md.',\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwDA,SAAS,YAAY,YAAqE;CACxF,IAAI,WAAW,WAAW,KAAK,WAAW,MAAM,EAAE,WAAW,SAAS,WAAW,GAAG,OAAO;CAC3F,OAAO,WAAW,MAAM,EAAE,WAAW,SAAS,cAAc,IAAI,iBAAiB;AACnF;AAEA,SAAgB,gCAAgC,EAC9C,OACA,WACA,UACA,SACA,GAAG,SACoC;CACvC,MAAM,EAAE,kBAAkB,sBAAsB;CAChD,MAAM,UAAU,0BAA0B;CAC1C,MAAM,OAAO,QAAQ;CACrB,MAAM,OAAO,oBAAoB,OAAO,KAAK,cAAc,EAAE,IAAI,4BAA4B,CAAC,CAAC;CAC/F,MAAM,OAAO,UAAU,OAAO;CAE9B,OACE,oBAAC,QAAD;EACE,cAAY,SAAS,KAAK,KAAA,IAAY,GAAG,KAAK,GAAG;EACjD,GAAI;EACJ,MAAK;EACM;EACX,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,cAAc,SAAS,MAAM,aAAa;EAC5C;EACA,uCAAoC;EAEnC,UAAA,YAAY;CACP,CAAA;AAEZ;AAEA,SAAgB,gCAAgC,EAC9C,WACA,OACA,aACA,aACA,cACA,gBACA,eACA,qBACA,UAAU,gBAC6B;CAEvC,MAAM,QAAQ,SAAS;CACvB,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,EAAE,eAAe,WAAW,UAAU,UAAU,sBAAsB;CAC5E,MA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,CAAC,QAAQ,EAAE;CAC/B,QAAQ;EAAE,OAAO;EAAuC,UAAU;CAAS;CAC3E,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,OAAO;EAAW;EAC3C,aAAa;GAAE,MAAM;GAAU,OAAO;EAAsB;EAC5D,aAAa;GAAE,MAAM;GAAU,OAAO;EAAe;EACrD,cAAc;GAAE,MAAM;GAAU,OAAO;EAAe;EACtD,gBAAgB;GAAE,MAAM;GAAU,OAAO;EAA0B;EACnE,eAAe;GAAE,MAAM;GAAU,OAAO;EAAsB;EAC9D,qBAAqB;GAAE,MAAM;GAAU,OAAO;EAA0B;CAC1E;CACA,WACE;AACJ,CAAC"}
1
+ {"version":3,"file":"account-address-book-delete.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-book-delete.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, useRef, useState } from 'react';\nimport { AlertDialog } from '../../particles/alert-dialog/alert-dialog.js';\nimport { Button } from '../../particles/button/button.js';\nimport { useToast } from '../../particles/toast/toast.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport type { CustomerAddressUserError } from '../../sdk/address/operations.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { loggableErrorName } from '../../utils/loggable-error-name.js';\nimport { useAccountAddressBook, useAccountAddressBookItem } from './account-address-book.js';\nimport { firstLine } from './account-address-first-line.js';\n\n/**\n * Deleting an address (specs/sfs-3437-address-book-delete.md, RFC REQ-04). The book's root holds which\n * address is waiting for an answer; a trigger in each entry asks, and one confirmation under the root\n * puts the question and dispatches `$actions.address.remove`. The confirmation never edits the list:\n * the entry leaves through the cache edit the action makes.\n */\n\nexport type AccountAddressBookDeleteTriggerProps = ComponentPropsWithRef<'button'> &\n MessageLocaleProp & {\n $content?: ContentValue<typeof AccountAddressBookDeleteTriggerContent>;\n };\n\nexport type AccountAddressBookDeleteConfirmProps = MessageLocaleProp &\n Readonly<{\n /** Goes on the popup, the one element a store can size and place: the dialog renders in a portal. */\n className?: string;\n $content?: ContentValue<typeof AccountAddressBookDeleteConfirmContent>;\n /** Injected by the compiler from `actions: { address: [...] }`; the address write surface. */\n $actions?: ComponentActions;\n }>;\n\ntype DeleteError = 'unauthorized' | 'deleteFailed';\n\n/**\n * What a result means for the prompt. An empty result is a removal, and so is `NOT_FOUND`: the server no\n * longer has the address, which is what the shopper asked for, and the action already took it out of\n * the cache. Anything else leaves the address listed.\n */\nfunction deleteError(userErrors: readonly CustomerAddressUserError[]): DeleteError | null {\n if (userErrors.length === 0 || userErrors.some(({ code }) => code === 'NOT_FOUND')) return null;\n return userErrors.some(({ code }) => code === 'UNAUTHORIZED') ? 'unauthorized' : 'deleteFailed';\n}\n\nexport function AccountAddressBookDeleteTrigger({\n $content,\n $locale,\n className,\n children,\n onClick,\n ...props\n}: AccountAddressBookDeleteTriggerProps) {\n const { requestDelete } = useAccountAddressBook();\n const address = useAccountAddressBookItem();\n const text = useMessageFormatter(AccountAddressBookDeleteTriggerContent, $content).format('label');\n const line = firstLine(address);\n\n return (\n <Button\n aria-label={line === '' ? undefined : `${text} ${line}`}\n {...props}\n type=\"button\"\n className={className}\n onClick={(event) => {\n onClick?.(event);\n requestDelete(address, event.currentTarget);\n }}\n data-fs-account-address-book-delete=\"\"\n >\n {children ?? text}\n </Button>\n );\n}\n\nexport function AccountAddressBookDeleteConfirm({\n className,\n $content,\n $actions: $actionsProp,\n}: AccountAddressBookDeleteConfirmProps) {\n // Enforces the ToastProvider ancestor: the hook throws outside one.\n const toast = useToast();\n const { format } = useMessageFormatter(AccountAddressBookDeleteConfirmContent, $content);\n const $actions = useActionsOverride($actionsProp);\n const { pendingDelete, endDelete, openForm, close } = useAccountAddressBook();\n const [pending, setPending] = useState(false);\n const pendingRef = useRef(false);\n const [error, setError] = useState<DeleteError | null>(null);\n\n const line = pendingDelete ? firstLine(pendingDelete) : '';\n\n function finish() {\n setError(null);\n endDelete();\n }\n\n function deleted(id: string) {\n toast.add({ title: format('deletedMessage'), type: 'success' });\n // An edit of this very address would only fail with `NOT_FOUND`, so it goes with the address.\n if (openForm?.mode === 'edit' && openForm.address.id === id) close();\n finish();\n }\n\n async function confirm() {\n if (pendingRef.current || pendingDelete === null) return;\n const remove = $actions?.address?.remove;\n if (!remove) {\n // A composition gap (the provider chain never delivered the action) is otherwise a dead button.\n setError('deleteFailed');\n return;\n }\n\n const { id } = pendingDelete;\n pendingRef.current = true;\n setPending(true);\n setError(null);\n try {\n const failure = deleteError(await remove({ id }));\n if (failure) setError(failure);\n else deleted(id);\n } catch (error_) {\n // Log only the error name: a message can echo an address value.\n console.error('[AccountAddressBookDeleteConfirm] address.remove failed', loggableErrorName(error_));\n setError('deleteFailed');\n } finally {\n pendingRef.current = false;\n setPending(false);\n }\n }\n\n return (\n <AlertDialog.Root\n open={pendingDelete !== null}\n onOpenChange={(next) => {\n // Nothing closes the prompt while the call runs: its outcome has to land in front of the shopper.\n if (!next && !pendingRef.current) finish();\n }}\n >\n <AlertDialog.Portal>\n <AlertDialog.Backdrop />\n <AlertDialog.Viewport>\n <AlertDialog.Popup className={className} data-fs-account-address-book-delete-confirm=\"\">\n <AlertDialog.Title>{format('title')}</AlertDialog.Title>\n <AlertDialog.Description>\n {line === '' ? null : (\n <>\n <span data-fs-account-address-book-delete-address=\"\">{line}</span>{' '}\n </>\n )}\n {format('description')}\n </AlertDialog.Description>\n {error === null ? null : (\n <p role=\"alert\" data-fs-account-address-book-delete-error=\"\">\n {format(error === 'unauthorized' ? 'unauthorizedMessage' : 'failedMessage')}\n </p>\n )}\n <AlertDialog.Close disabled={pending}>{format('cancelLabel')}</AlertDialog.Close>\n <Button\n type=\"button\"\n disabled={pending}\n aria-busy={pending || undefined}\n onClick={confirm}\n data-fs-account-address-book-delete-submit=\"\"\n >\n {format('confirmLabel')}\n </Button>\n </AlertDialog.Popup>\n </AlertDialog.Viewport>\n </AlertDialog.Portal>\n </AlertDialog.Root>\n );\n}\n\nexport const AccountAddressBookDeleteTriggerContent = defineContentType({\n id: 'account-address-book-delete-trigger',\n title: 'Account Address Book Delete Trigger',\n description: 'Label of the control that asks to delete an address.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Button label', format: 'icu-message', messageSource: 'Delete' },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccountAddressBookDeleteTriggerDefinition = defineComponent<AccountAddressBookDeleteTriggerProps>({\n name: 'AccountAddressBookDeleteTrigger',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookDeleteTrigger,\n content: AccountAddressBookDeleteTriggerContent,\n requiresContext: 'account-address-book-item',\n editor: { label: 'Account Address Book Delete Trigger', category: 'action' },\n schema: {},\n guideline:\n \"Asks to delete the address of the entry it sits in. Nothing is deleted until the shopper confirms in an AccountAddressBookDeleteConfirm. Its accessible name adds the address's first line, so a list of them is told apart. Place it inside AccountAddressBookItem, and one AccountAddressBookDeleteConfirm under the root to ask the question.\",\n});\n\nexport const AccountAddressBookDeleteConfirmContent = defineContentType({\n id: 'account-address-book-delete-confirm',\n title: 'Account Address Book Delete Confirm',\n description: 'The question, the labels and the outcome messages of the address deletion prompt.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n title: { type: 'string', title: 'Question', format: 'icu-message', messageSource: 'Delete this address?' },\n description: {\n type: 'string',\n title: 'What deleting means',\n format: 'icu-message',\n messageSource: \"This can't be undone.\",\n },\n cancelLabel: { type: 'string', title: 'Cancel label', format: 'icu-message', messageSource: 'Cancel' },\n confirmLabel: { type: 'string', title: 'Delete label', format: 'icu-message', messageSource: 'Delete' },\n deletedMessage: {\n type: 'string',\n title: 'Address deleted message',\n format: 'icu-message',\n messageSource: 'Address deleted.',\n },\n failedMessage: {\n type: 'string',\n title: 'Not deleted message',\n format: 'icu-message',\n messageSource: \"We couldn't delete this address. Try again.\",\n },\n unauthorizedMessage: {\n type: 'string',\n title: 'Session expired message',\n format: 'icu-message',\n messageSource: 'Your session expired. Sign in again to delete this address.',\n },\n },\n },\n});\n\nexport const AccountAddressBookDeleteConfirmDefinition = defineComponent<AccountAddressBookDeleteConfirmProps>({\n name: 'AccountAddressBookDeleteConfirm',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookDeleteConfirm,\n content: AccountAddressBookDeleteConfirmContent,\n requiresContext: 'account-address-book',\n actions: { address: ['remove'] },\n editor: { label: 'Account Address Book Delete Confirm', category: 'layout' },\n schema: {},\n guideline:\n 'The alert dialog that asks before an address is deleted, one per address book, opened by AccountAddressBookDeleteTrigger. Names the address, takes focus on Cancel, and closes only on Cancel or Escape: a click outside does nothing. Confirming removes the address, shows a toast and closes; a refusal keeps the dialog open with a message and lets the shopper try again. While the call runs, nothing closes it. Deleting the last address leaves the book empty, so compose an AccountAddressBookEmpty. Requires a ToastProvider ancestor, since the success toast throws without one. Place it under AccountAddressBookRoot. See account-address-book.md.',\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,YAAY,YAAqE;CACxF,IAAI,WAAW,WAAW,KAAK,WAAW,MAAM,EAAE,WAAW,SAAS,WAAW,GAAG,OAAO;CAC3F,OAAO,WAAW,MAAM,EAAE,WAAW,SAAS,cAAc,IAAI,iBAAiB;AACnF;AAEA,SAAgB,gCAAgC,EAC9C,UACA,SACA,WACA,UACA,SACA,GAAG,SACoC;CACvC,MAAM,EAAE,kBAAkB,sBAAsB;CAChD,MAAM,UAAU,0BAA0B;CAC1C,MAAM,OAAO,oBAAoB,wCAAwC,QAAQ,CAAC,CAAC,OAAO,OAAO;CACjG,MAAM,OAAO,UAAU,OAAO;CAE9B,OACE,oBAAC,QAAD;EACE,cAAY,SAAS,KAAK,KAAA,IAAY,GAAG,KAAK,GAAG;EACjD,GAAI;EACJ,MAAK;EACM;EACX,UAAU,UAAU;GAClB,UAAU,KA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