@vtex/faststore 0.0.1

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 (538) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +95 -0
  4. package/dist/actions.json +334 -0
  5. package/dist/catalog.json +6615 -0
  6. package/dist/client.d.ts +17 -0
  7. package/dist/client.js +8 -0
  8. package/dist/components.d.ts +87 -0
  9. package/dist/components.js +87 -0
  10. package/dist/content-types.json +684 -0
  11. package/dist/core/dist/actions/mock-action.d.ts +24 -0
  12. package/dist/core/dist/actions/mock-action.js +28 -0
  13. package/dist/core/dist/actions/mock-action.js.map +1 -0
  14. package/dist/core/dist/actions/registry.d.ts +24 -0
  15. package/dist/core/dist/actions/registry.js +28 -0
  16. package/dist/core/dist/actions/registry.js.map +1 -0
  17. package/dist/core/dist/define-component.d.ts +100 -0
  18. package/dist/core/dist/define-component.js +8 -0
  19. package/dist/core/dist/define-component.js.map +1 -0
  20. package/dist/core/dist/define-content-type.d.ts +95 -0
  21. package/dist/core/dist/define-content-type.js +283 -0
  22. package/dist/core/dist/define-content-type.js.map +1 -0
  23. package/dist/core/dist/index.d.ts +7 -0
  24. package/dist/core/dist/index.js +5 -0
  25. package/dist/core/dist/schema/generated/schema.d.ts +28 -0
  26. package/dist/core/dist/types.d.ts +1 -0
  27. package/dist/docs/access-code-field.md +100 -0
  28. package/dist/docs/access-code-sign-in.md +174 -0
  29. package/dist/docs/account-entry-point.md +155 -0
  30. package/dist/docs/address-summary.md +50 -0
  31. package/dist/docs/buy-button.md +162 -0
  32. package/dist/docs/carousel.md +105 -0
  33. package/dist/docs/cart-item.md +162 -0
  34. package/dist/docs/cart-totalizer.md +197 -0
  35. package/dist/docs/cart.md +495 -0
  36. package/dist/docs/client-preferences.md +184 -0
  37. package/dist/docs/client-profile-form.md +192 -0
  38. package/dist/docs/client-profile.md +117 -0
  39. package/dist/docs/container.md +97 -0
  40. package/dist/docs/document-field.md +97 -0
  41. package/dist/docs/email-field.md +93 -0
  42. package/dist/docs/email-identification.md +102 -0
  43. package/dist/docs/footer-copyright.md +112 -0
  44. package/dist/docs/footer-link-group.md +162 -0
  45. package/dist/docs/footer-root.md +145 -0
  46. package/dist/docs/footer-social.md +151 -0
  47. package/dist/docs/free-shipping-progress.md +87 -0
  48. package/dist/docs/gallery.md +84 -0
  49. package/dist/docs/header-root.md +150 -0
  50. package/dist/docs/identity-edit.md +88 -0
  51. package/dist/docs/identity-summary.md +106 -0
  52. package/dist/docs/incentives.md +151 -0
  53. package/dist/docs/logo.md +135 -0
  54. package/dist/docs/meter.md +67 -0
  55. package/dist/docs/navigation-link-list.md +171 -0
  56. package/dist/docs/navigation-link.md +163 -0
  57. package/dist/docs/navigation-menu.md +264 -0
  58. package/dist/docs/payment-methods.md +139 -0
  59. package/dist/docs/phone-field.md +106 -0
  60. package/dist/docs/postal-code-field.md +126 -0
  61. package/dist/docs/pricing.md +499 -0
  62. package/dist/docs/product-gallery.md +409 -0
  63. package/dist/docs/product-information.md +295 -0
  64. package/dist/docs/product-list.md +170 -0
  65. package/dist/docs/product-quantity.md +88 -0
  66. package/dist/docs/product-shelf.md +141 -0
  67. package/dist/docs/promotion.md +109 -0
  68. package/dist/docs/region.md +225 -0
  69. package/dist/docs/session.md +123 -0
  70. package/dist/docs/shipping-address.md +390 -0
  71. package/dist/docs/shipping-simulator.md +147 -0
  72. package/dist/docs/sign-in-form.md +117 -0
  73. package/dist/docs/tabs.md +176 -0
  74. package/dist/docs/toast.md +124 -0
  75. package/dist/docs/variant-selector.md +450 -0
  76. package/dist/graphql/define-subgraph.d.ts +12 -0
  77. package/dist/graphql/define-subgraph.js +15 -0
  78. package/dist/graphql/define-subgraph.js.map +1 -0
  79. package/dist/graphql/gql.d.ts +10 -0
  80. package/dist/graphql/gql.js +16 -0
  81. package/dist/graphql/gql.js.map +1 -0
  82. package/dist/graphql/types.d.ts +88 -0
  83. package/dist/graphql.d.ts +4 -0
  84. package/dist/graphql.js +3 -0
  85. package/dist/index.d.ts +19 -0
  86. package/dist/index.js +5 -0
  87. package/dist/internal/client.d.ts +24 -0
  88. package/dist/internal/client.js +23 -0
  89. package/dist/internal/content.d.ts +2 -0
  90. package/dist/internal/content.js +2 -0
  91. package/dist/internal/server.d.ts +7 -0
  92. package/dist/internal/server.js +6 -0
  93. package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +111 -0
  94. package/dist/matter/access-code-sign-in/access-code-sign-in.js +387 -0
  95. package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -0
  96. package/dist/matter/account-entry-point/account-entry-point.d.ts +64 -0
  97. package/dist/matter/account-entry-point/account-entry-point.js +151 -0
  98. package/dist/matter/account-entry-point/account-entry-point.js.map +1 -0
  99. package/dist/matter/breadcrumb/breadcrumb.d.ts +40 -0
  100. package/dist/matter/breadcrumb/breadcrumb.js +155 -0
  101. package/dist/matter/breadcrumb/breadcrumb.js.map +1 -0
  102. package/dist/matter/buy-button/buy-button.d.ts +95 -0
  103. package/dist/matter/buy-button/buy-button.js +259 -0
  104. package/dist/matter/buy-button/buy-button.js.map +1 -0
  105. package/dist/matter/cart/cart-namespace.d.ts +48 -0
  106. package/dist/matter/cart/cart-namespace.js +50 -0
  107. package/dist/matter/cart/cart-namespace.js.map +1 -0
  108. package/dist/matter/cart/cart.d.ts +312 -0
  109. package/dist/matter/cart/cart.js +1034 -0
  110. package/dist/matter/cart/cart.js.map +1 -0
  111. package/dist/matter/cart-item/cart-item.d.ts +103 -0
  112. package/dist/matter/cart-item/cart-item.js +672 -0
  113. package/dist/matter/cart-item/cart-item.js.map +1 -0
  114. package/dist/matter/cart-item-compositions/cart-item-compositions.d.ts +49 -0
  115. package/dist/matter/cart-item-compositions/cart-item-compositions.js +165 -0
  116. package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -0
  117. package/dist/matter/cart-item-customizations/cart-item-customizations.d.ts +28 -0
  118. package/dist/matter/cart-item-customizations/cart-item-customizations.js +73 -0
  119. package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -0
  120. package/dist/matter/cart-item-discounts/cart-item-discounts.d.ts +33 -0
  121. package/dist/matter/cart-item-discounts/cart-item-discounts.js +70 -0
  122. package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -0
  123. package/dist/matter/cart-item-seller-info/cart-item-seller-info.d.ts +24 -0
  124. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +54 -0
  125. package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -0
  126. package/dist/matter/cart-item-variations/cart-item-variations.d.ts +27 -0
  127. package/dist/matter/cart-item-variations/cart-item-variations.js +69 -0
  128. package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -0
  129. package/dist/matter/cart-totalizer/cart-totalizer.d.ts +78 -0
  130. package/dist/matter/cart-totalizer/cart-totalizer.js +220 -0
  131. package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -0
  132. package/dist/matter/client-preferences/client-preferences.d.ts +50 -0
  133. package/dist/matter/client-preferences/client-preferences.js +206 -0
  134. package/dist/matter/client-preferences/client-preferences.js.map +1 -0
  135. package/dist/matter/client-profile/client-profile.d.ts +59 -0
  136. package/dist/matter/client-profile/client-profile.js +185 -0
  137. package/dist/matter/client-profile/client-profile.js.map +1 -0
  138. package/dist/matter/client-profile-form/client-profile-form.d.ts +126 -0
  139. package/dist/matter/client-profile-form/client-profile-form.js +660 -0
  140. package/dist/matter/client-profile-form/client-profile-form.js.map +1 -0
  141. package/dist/matter/delivery-options/delivery-options-accordion.d.ts +30 -0
  142. package/dist/matter/delivery-options/delivery-options-accordion.js +189 -0
  143. package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -0
  144. package/dist/matter/delivery-options/delivery-options-controller.d.ts +49 -0
  145. package/dist/matter/delivery-options/delivery-options-controller.js +203 -0
  146. package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -0
  147. package/dist/matter/delivery-options/delivery-options.d.ts +31 -0
  148. package/dist/matter/delivery-options/delivery-options.js +103 -0
  149. package/dist/matter/delivery-options/delivery-options.js.map +1 -0
  150. package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +9 -0
  151. package/dist/matter/delivery-options/use-delivery-option-selection.js +76 -0
  152. package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -0
  153. package/dist/matter/email-identification/email-identification.d.ts +37 -0
  154. package/dist/matter/email-identification/email-identification.js +111 -0
  155. package/dist/matter/email-identification/email-identification.js.map +1 -0
  156. package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +44 -0
  157. package/dist/matter/free-shipping-progress/free-shipping-progress.js +170 -0
  158. package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -0
  159. package/dist/matter/identity-edit/identity-edit.d.ts +52 -0
  160. package/dist/matter/identity-edit/identity-edit.js +148 -0
  161. package/dist/matter/identity-edit/identity-edit.js.map +1 -0
  162. package/dist/matter/identity-summary/identity-summary.d.ts +128 -0
  163. package/dist/matter/identity-summary/identity-summary.js +344 -0
  164. package/dist/matter/identity-summary/identity-summary.js.map +1 -0
  165. package/dist/matter/pricing/pricing.d.ts +162 -0
  166. package/dist/matter/pricing/pricing.js +793 -0
  167. package/dist/matter/pricing/pricing.js.map +1 -0
  168. package/dist/matter/product-gallery/product-gallery.d.ts +23 -0
  169. package/dist/matter/product-gallery/product-gallery.js +188 -0
  170. package/dist/matter/product-gallery/product-gallery.js.map +1 -0
  171. package/dist/matter/product-information/product-information.d.ts +61 -0
  172. package/dist/matter/product-information/product-information.js +355 -0
  173. package/dist/matter/product-information/product-information.js.map +1 -0
  174. package/dist/matter/product-list/product-list.d.ts +86 -0
  175. package/dist/matter/product-list/product-list.js +342 -0
  176. package/dist/matter/product-list/product-list.js.map +1 -0
  177. package/dist/matter/product-quantity/product-quantity.d.ts +50 -0
  178. package/dist/matter/product-quantity/product-quantity.js +111 -0
  179. package/dist/matter/product-quantity/product-quantity.js.map +1 -0
  180. package/dist/matter/product-shelf/product-shelf.d.ts +125 -0
  181. package/dist/matter/product-shelf/product-shelf.js +376 -0
  182. package/dist/matter/product-shelf/product-shelf.js.map +1 -0
  183. package/dist/matter/region/region.d.ts +211 -0
  184. package/dist/matter/region/region.js +579 -0
  185. package/dist/matter/region/region.js.map +1 -0
  186. package/dist/matter/session/session.d.ts +58 -0
  187. package/dist/matter/session/session.js +112 -0
  188. package/dist/matter/session/session.js.map +1 -0
  189. package/dist/matter/shipping-address/country-descriptors.js +101 -0
  190. package/dist/matter/shipping-address/country-descriptors.js.map +1 -0
  191. package/dist/matter/shipping-address/shipping-address.d.ts +284 -0
  192. package/dist/matter/shipping-address/shipping-address.js +1036 -0
  193. package/dist/matter/shipping-address/shipping-address.js.map +1 -0
  194. package/dist/matter/shipping-simulator/shipping-simulator.d.ts +143 -0
  195. package/dist/matter/shipping-simulator/shipping-simulator.js +644 -0
  196. package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -0
  197. package/dist/matter/sign-in-form/sign-in-form.d.ts +79 -0
  198. package/dist/matter/sign-in-form/sign-in-form.js +226 -0
  199. package/dist/matter/sign-in-form/sign-in-form.js.map +1 -0
  200. package/dist/matter/variant-selector/variant-selector.d.ts +183 -0
  201. package/dist/matter/variant-selector/variant-selector.js +840 -0
  202. package/dist/matter/variant-selector/variant-selector.js.map +1 -0
  203. package/dist/message-locales.json +7 -0
  204. package/dist/particles/access-code-field/access-code-field.d.ts +33 -0
  205. package/dist/particles/access-code-field/access-code-field.js +95 -0
  206. package/dist/particles/access-code-field/access-code-field.js.map +1 -0
  207. package/dist/particles/accordion/accordion.d.ts +45 -0
  208. package/dist/particles/accordion/accordion.js +156 -0
  209. package/dist/particles/accordion/accordion.js.map +1 -0
  210. package/dist/particles/address-summary/address-summary.d.ts +50 -0
  211. package/dist/particles/address-summary/address-summary.js +129 -0
  212. package/dist/particles/address-summary/address-summary.js.map +1 -0
  213. package/dist/particles/badge/badge.d.ts +10 -0
  214. package/dist/particles/badge/badge.js +27 -0
  215. package/dist/particles/badge/badge.js.map +1 -0
  216. package/dist/particles/button/button.d.ts +18 -0
  217. package/dist/particles/button/button.js +37 -0
  218. package/dist/particles/button/button.js.map +1 -0
  219. package/dist/particles/carousel/carousel.d.ts +60 -0
  220. package/dist/particles/carousel/carousel.js +335 -0
  221. package/dist/particles/carousel/carousel.js.map +1 -0
  222. package/dist/particles/checkbox/checkbox.d.ts +40 -0
  223. package/dist/particles/checkbox/checkbox.js +82 -0
  224. package/dist/particles/checkbox/checkbox.js.map +1 -0
  225. package/dist/particles/container/container.d.ts +20 -0
  226. package/dist/particles/container/container.js +36 -0
  227. package/dist/particles/container/container.js.map +1 -0
  228. package/dist/particles/dialog/dialog.d.ts +54 -0
  229. package/dist/particles/dialog/dialog.js +192 -0
  230. package/dist/particles/dialog/dialog.js.map +1 -0
  231. package/dist/particles/document-field/document-field.d.ts +61 -0
  232. package/dist/particles/document-field/document-field.js +146 -0
  233. package/dist/particles/document-field/document-field.js.map +1 -0
  234. package/dist/particles/drawer/drawer.d.ts +52 -0
  235. package/dist/particles/drawer/drawer.js +183 -0
  236. package/dist/particles/drawer/drawer.js.map +1 -0
  237. package/dist/particles/email-field/email-field.d.ts +37 -0
  238. package/dist/particles/email-field/email-field.js +106 -0
  239. package/dist/particles/email-field/email-field.js.map +1 -0
  240. package/dist/particles/field/field.d.ts +50 -0
  241. package/dist/particles/field/field.js +133 -0
  242. package/dist/particles/field/field.js.map +1 -0
  243. package/dist/particles/fieldset/fieldset.d.ts +16 -0
  244. package/dist/particles/fieldset/fieldset.js +52 -0
  245. package/dist/particles/fieldset/fieldset.js.map +1 -0
  246. package/dist/particles/footer-copyright/footer-copyright.d.ts +32 -0
  247. package/dist/particles/footer-copyright/footer-copyright.js +50 -0
  248. package/dist/particles/footer-copyright/footer-copyright.js.map +1 -0
  249. package/dist/particles/footer-link-group/footer-link-group.d.ts +66 -0
  250. package/dist/particles/footer-link-group/footer-link-group.js +154 -0
  251. package/dist/particles/footer-link-group/footer-link-group.js.map +1 -0
  252. package/dist/particles/footer-root/footer-root.d.ts +21 -0
  253. package/dist/particles/footer-root/footer-root.js +38 -0
  254. package/dist/particles/footer-root/footer-root.js.map +1 -0
  255. package/dist/particles/footer-social/footer-social.d.ts +79 -0
  256. package/dist/particles/footer-social/footer-social.js +176 -0
  257. package/dist/particles/footer-social/footer-social.js.map +1 -0
  258. package/dist/particles/gallery/gallery.d.ts +181 -0
  259. package/dist/particles/gallery/gallery.js +920 -0
  260. package/dist/particles/gallery/gallery.js.map +1 -0
  261. package/dist/particles/header-root/header-root.d.ts +21 -0
  262. package/dist/particles/header-root/header-root.js +38 -0
  263. package/dist/particles/header-root/header-root.js.map +1 -0
  264. package/dist/particles/icon/icon.d.ts +22 -0
  265. package/dist/particles/icon/icon.js +48 -0
  266. package/dist/particles/icon/icon.js.map +1 -0
  267. package/dist/particles/image/image.d.ts +13 -0
  268. package/dist/particles/image/image.js +59 -0
  269. package/dist/particles/image/image.js.map +1 -0
  270. package/dist/particles/incentives/incentives.d.ts +85 -0
  271. package/dist/particles/incentives/incentives.js +200 -0
  272. package/dist/particles/incentives/incentives.js.map +1 -0
  273. package/dist/particles/input/input.d.ts +9 -0
  274. package/dist/particles/input/input.js +28 -0
  275. package/dist/particles/input/input.js.map +1 -0
  276. package/dist/particles/logo/logo.d.ts +55 -0
  277. package/dist/particles/logo/logo.js +96 -0
  278. package/dist/particles/logo/logo.js.map +1 -0
  279. package/dist/particles/menu/menu.d.ts +103 -0
  280. package/dist/particles/menu/menu.js +409 -0
  281. package/dist/particles/menu/menu.js.map +1 -0
  282. package/dist/particles/menubar/menubar.d.ts +18 -0
  283. package/dist/particles/menubar/menubar.js +42 -0
  284. package/dist/particles/menubar/menubar.js.map +1 -0
  285. package/dist/particles/meter/meter.d.ts +36 -0
  286. package/dist/particles/meter/meter.js +132 -0
  287. package/dist/particles/meter/meter.js.map +1 -0
  288. package/dist/particles/navigation-link/navigation-link.d.ts +43 -0
  289. package/dist/particles/navigation-link/navigation-link.js +82 -0
  290. package/dist/particles/navigation-link/navigation-link.js.map +1 -0
  291. package/dist/particles/navigation-link-list/navigation-link-list.d.ts +59 -0
  292. package/dist/particles/navigation-link-list/navigation-link-list.js +103 -0
  293. package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -0
  294. package/dist/particles/navigation-menu/navigation-menu.d.ts +78 -0
  295. package/dist/particles/navigation-menu/navigation-menu.js +295 -0
  296. package/dist/particles/navigation-menu/navigation-menu.js.map +1 -0
  297. package/dist/particles/number-field/number-field.d.ts +46 -0
  298. package/dist/particles/number-field/number-field.js +169 -0
  299. package/dist/particles/number-field/number-field.js.map +1 -0
  300. package/dist/particles/password-field/password-field.d.ts +31 -0
  301. package/dist/particles/password-field/password-field.js +109 -0
  302. package/dist/particles/password-field/password-field.js.map +1 -0
  303. package/dist/particles/payment-methods/payment-methods.d.ts +72 -0
  304. package/dist/particles/payment-methods/payment-methods.js +151 -0
  305. package/dist/particles/payment-methods/payment-methods.js.map +1 -0
  306. package/dist/particles/phone-field/phone-field.d.ts +67 -0
  307. package/dist/particles/phone-field/phone-field.js +250 -0
  308. package/dist/particles/phone-field/phone-field.js.map +1 -0
  309. package/dist/particles/popover/popover.d.ts +68 -0
  310. package/dist/particles/popover/popover.js +284 -0
  311. package/dist/particles/popover/popover.js.map +1 -0
  312. package/dist/particles/postal-code-field/postal-code-field.d.ts +75 -0
  313. package/dist/particles/postal-code-field/postal-code-field.js +169 -0
  314. package/dist/particles/postal-code-field/postal-code-field.js.map +1 -0
  315. package/dist/particles/promotion/promotion.d.ts +46 -0
  316. package/dist/particles/promotion/promotion.js +78 -0
  317. package/dist/particles/promotion/promotion.js.map +1 -0
  318. package/dist/particles/quantity-selector/quantity-selector.d.ts +30 -0
  319. package/dist/particles/quantity-selector/quantity-selector.js +116 -0
  320. package/dist/particles/quantity-selector/quantity-selector.js.map +1 -0
  321. package/dist/particles/radio/radio.d.ts +36 -0
  322. package/dist/particles/radio/radio.js +76 -0
  323. package/dist/particles/radio/radio.js.map +1 -0
  324. package/dist/particles/scroll-area/scroll-area.d.ts +36 -0
  325. package/dist/particles/scroll-area/scroll-area.js +145 -0
  326. package/dist/particles/scroll-area/scroll-area.js.map +1 -0
  327. package/dist/particles/select/select.d.ts +125 -0
  328. package/dist/particles/select/select.js +478 -0
  329. package/dist/particles/select/select.js.map +1 -0
  330. package/dist/particles/separator/separator.d.ts +12 -0
  331. package/dist/particles/separator/separator.js +33 -0
  332. package/dist/particles/separator/separator.js.map +1 -0
  333. package/dist/particles/shared/input-mask.d.ts +5 -0
  334. package/dist/particles/shared/input-mask.js +58 -0
  335. package/dist/particles/shared/input-mask.js.map +1 -0
  336. package/dist/particles/spinner/spinner.d.ts +13 -0
  337. package/dist/particles/spinner/spinner.js +31 -0
  338. package/dist/particles/spinner/spinner.js.map +1 -0
  339. package/dist/particles/switch/switch.d.ts +27 -0
  340. package/dist/particles/switch/switch.js +59 -0
  341. package/dist/particles/switch/switch.js.map +1 -0
  342. package/dist/particles/tabs/tabs.d.ts +45 -0
  343. package/dist/particles/tabs/tabs.js +164 -0
  344. package/dist/particles/tabs/tabs.js.map +1 -0
  345. package/dist/particles/text/text.d.ts +24 -0
  346. package/dist/particles/text/text.js +40 -0
  347. package/dist/particles/text/text.js.map +1 -0
  348. package/dist/particles/toast/toast.d.ts +83 -0
  349. package/dist/particles/toast/toast.js +194 -0
  350. package/dist/particles/toast/toast.js.map +1 -0
  351. package/dist/particles/toggle/toggle.d.ts +26 -0
  352. package/dist/particles/toggle/toggle.js +61 -0
  353. package/dist/particles/toggle/toggle.js.map +1 -0
  354. package/dist/particles/tooltip/tooltip.d.ts +61 -0
  355. package/dist/particles/tooltip/tooltip.js +240 -0
  356. package/dist/particles/tooltip/tooltip.js.map +1 -0
  357. package/dist/schema.graphql +2953 -0
  358. package/dist/sdk/actions/cart-action-provider.d.ts +19 -0
  359. package/dist/sdk/actions/cart-action-provider.js +23 -0
  360. package/dist/sdk/actions/cart-action-provider.js.map +1 -0
  361. package/dist/sdk/actions/identity-action-provider.d.ts +15 -0
  362. package/dist/sdk/actions/identity-action-provider.js +19 -0
  363. package/dist/sdk/actions/identity-action-provider.js.map +1 -0
  364. package/dist/sdk/actions/index.d.ts +7 -0
  365. package/dist/sdk/actions/index.js +6 -0
  366. package/dist/sdk/actions/inject-actions.d.ts +14 -0
  367. package/dist/sdk/actions/inject-actions.js +36 -0
  368. package/dist/sdk/actions/inject-actions.js.map +1 -0
  369. package/dist/sdk/actions/region-action-provider.d.ts +15 -0
  370. package/dist/sdk/actions/region-action-provider.js +19 -0
  371. package/dist/sdk/actions/region-action-provider.js.map +1 -0
  372. package/dist/sdk/actions/session-action-provider.d.ts +15 -0
  373. package/dist/sdk/actions/session-action-provider.js +19 -0
  374. package/dist/sdk/actions/session-action-provider.js.map +1 -0
  375. package/dist/sdk/actions/shipping-action-provider.d.ts +15 -0
  376. package/dist/sdk/actions/shipping-action-provider.js +19 -0
  377. package/dist/sdk/actions/shipping-action-provider.js.map +1 -0
  378. package/dist/sdk/actions/types.d.ts +21 -0
  379. package/dist/sdk/cache/storefront-cache.js +35 -0
  380. package/dist/sdk/cache/storefront-cache.js.map +1 -0
  381. package/dist/sdk/cart/operations.d.ts +31 -0
  382. package/dist/sdk/cart/operations.js +215 -0
  383. package/dist/sdk/cart/operations.js.map +1 -0
  384. package/dist/sdk/cart/optimistic.d.ts +24 -0
  385. package/dist/sdk/cart/optimistic.js +164 -0
  386. package/dist/sdk/cart/optimistic.js.map +1 -0
  387. package/dist/sdk/cart/use-cart-actions.d.ts +56 -0
  388. package/dist/sdk/cart/use-cart-actions.js +348 -0
  389. package/dist/sdk/cart/use-cart-actions.js.map +1 -0
  390. package/dist/sdk/cart/use-cart-validate-on-open.js +50 -0
  391. package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -0
  392. package/dist/sdk/cart/write-gate.js +54 -0
  393. package/dist/sdk/cart/write-gate.js.map +1 -0
  394. package/dist/sdk/client/assert-api-url.js +20 -0
  395. package/dist/sdk/client/assert-api-url.js.map +1 -0
  396. package/dist/sdk/client/create-client.d.ts +23 -0
  397. package/dist/sdk/client/create-client.js +46 -0
  398. package/dist/sdk/client/create-client.js.map +1 -0
  399. package/dist/sdk/client/fetch-page-data.d.ts +39 -0
  400. package/dist/sdk/client/fetch-page-data.js +33 -0
  401. package/dist/sdk/client/fetch-page-data.js.map +1 -0
  402. package/dist/sdk/client/register-preload-query.d.ts +24 -0
  403. package/dist/sdk/client/register-preload-query.js +33 -0
  404. package/dist/sdk/client/register-preload-query.js.map +1 -0
  405. package/dist/sdk/content/create-content-runtime.d.ts +68 -0
  406. package/dist/sdk/content/create-content-runtime.js +503 -0
  407. package/dist/sdk/content/create-content-runtime.js.map +1 -0
  408. package/dist/sdk/context/headers.d.ts +15 -0
  409. package/dist/sdk/context/headers.js +21 -0
  410. package/dist/sdk/context/headers.js.map +1 -0
  411. package/dist/sdk/context/storefront-context.d.ts +11 -0
  412. package/dist/sdk/context/storefront-context.js +29 -0
  413. package/dist/sdk/context/storefront-context.js.map +1 -0
  414. package/dist/sdk/data/data-override-context.d.ts +12 -0
  415. package/dist/sdk/data/data-override-context.js +19 -0
  416. package/dist/sdk/data/data-override-context.js.map +1 -0
  417. package/dist/sdk/data/entity-subscriber.js +28 -0
  418. package/dist/sdk/data/entity-subscriber.js.map +1 -0
  419. package/dist/sdk/data/hot-data-provider.d.ts +19 -0
  420. package/dist/sdk/data/hot-data-provider.js +33 -0
  421. package/dist/sdk/data/hot-data-provider.js.map +1 -0
  422. package/dist/sdk/data/index.d.ts +8 -0
  423. package/dist/sdk/data/index.js +8 -0
  424. package/dist/sdk/data/list-item-ref-context.d.ts +20 -0
  425. package/dist/sdk/data/list-item-ref-context.js +11 -0
  426. package/dist/sdk/data/list-item-ref-context.js.map +1 -0
  427. package/dist/sdk/data/multiple-reactive-data-provider.d.ts +32 -0
  428. package/dist/sdk/data/multiple-reactive-data-provider.js +20 -0
  429. package/dist/sdk/data/multiple-reactive-data-provider.js.map +1 -0
  430. package/dist/sdk/data/page-reactive-data-root.d.ts +53 -0
  431. package/dist/sdk/data/page-reactive-data-root.js +153 -0
  432. package/dist/sdk/data/page-reactive-data-root.js.map +1 -0
  433. package/dist/sdk/data/reactive-data-provider.d.ts +25 -0
  434. package/dist/sdk/data/reactive-data-provider.js +24 -0
  435. package/dist/sdk/data/reactive-data-provider.js.map +1 -0
  436. package/dist/sdk/data/reactive-list-item-data-provider.d.ts +26 -0
  437. package/dist/sdk/data/reactive-list-item-data-provider.js +42 -0
  438. package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -0
  439. package/dist/sdk/data/use-reactive-entity.js +40 -0
  440. package/dist/sdk/data/use-reactive-entity.js.map +1 -0
  441. package/dist/sdk/format/client.d.ts +12 -0
  442. package/dist/sdk/format/client.js +20 -0
  443. package/dist/sdk/format/client.js.map +1 -0
  444. package/dist/sdk/format/formatters.d.ts +32 -0
  445. package/dist/sdk/format/formatters.js +45 -0
  446. package/dist/sdk/format/formatters.js.map +1 -0
  447. package/dist/sdk/generated/fragment-types.js +23 -0
  448. package/dist/sdk/generated/fragment-types.js.map +1 -0
  449. package/dist/sdk/generated/gql.js +51 -0
  450. package/dist/sdk/generated/gql.js.map +1 -0
  451. package/dist/sdk/generated/graphql.d.ts +622 -0
  452. package/dist/sdk/generated/graphql.js +11917 -0
  453. package/dist/sdk/generated/graphql.js.map +1 -0
  454. package/dist/sdk/graphql-tag.d.ts +10 -0
  455. package/dist/sdk/graphql-tag.js +21 -0
  456. package/dist/sdk/graphql-tag.js.map +1 -0
  457. package/dist/sdk/i18n/client.d.ts +4 -0
  458. package/dist/sdk/i18n/client.js +4 -0
  459. package/dist/sdk/i18n/locales.d.ts +8 -0
  460. package/dist/sdk/i18n/locales.js +57 -0
  461. package/dist/sdk/i18n/locales.js.map +1 -0
  462. package/dist/sdk/i18n/messages/en-US.js +24 -0
  463. package/dist/sdk/i18n/messages/en-US.js.map +1 -0
  464. package/dist/sdk/i18n/messages/en-US.json +19 -0
  465. package/dist/sdk/i18n/messages/en-US.json.d.ts +23 -0
  466. package/dist/sdk/i18n/messages/es-ES.js +24 -0
  467. package/dist/sdk/i18n/messages/es-ES.js.map +1 -0
  468. package/dist/sdk/i18n/messages/es-ES.json +19 -0
  469. package/dist/sdk/i18n/messages/pt-BR.js +24 -0
  470. package/dist/sdk/i18n/messages/pt-BR.js.map +1 -0
  471. package/dist/sdk/i18n/messages/pt-BR.json +19 -0
  472. package/dist/sdk/i18n/provider.d.ts +1 -0
  473. package/dist/sdk/i18n/provider.js +30 -0
  474. package/dist/sdk/i18n/provider.js.map +1 -0
  475. package/dist/sdk/i18n/server.d.ts +28 -0
  476. package/dist/sdk/i18n/server.js +59 -0
  477. package/dist/sdk/i18n/server.js.map +1 -0
  478. package/dist/sdk/identity/operations.d.ts +34 -0
  479. package/dist/sdk/identity/operations.js +78 -0
  480. package/dist/sdk/identity/operations.js.map +1 -0
  481. package/dist/sdk/identity/use-identity-actions.d.ts +62 -0
  482. package/dist/sdk/identity/use-identity-actions.js +180 -0
  483. package/dist/sdk/identity/use-identity-actions.js.map +1 -0
  484. package/dist/sdk/provider/index.d.ts +2 -0
  485. package/dist/sdk/provider/index.js +2 -0
  486. package/dist/sdk/provider/storefront-provider.d.ts +32 -0
  487. package/dist/sdk/provider/storefront-provider.js +111 -0
  488. package/dist/sdk/provider/storefront-provider.js.map +1 -0
  489. package/dist/sdk/region/operations.d.ts +6 -0
  490. package/dist/sdk/region/region-operations.d.ts +30 -0
  491. package/dist/sdk/region/region-operations.js +23 -0
  492. package/dist/sdk/region/region-operations.js.map +1 -0
  493. package/dist/sdk/region/use-region-actions.d.ts +23 -0
  494. package/dist/sdk/region/use-region-actions.js +66 -0
  495. package/dist/sdk/region/use-region-actions.js.map +1 -0
  496. package/dist/sdk/seller.js +11 -0
  497. package/dist/sdk/seller.js.map +1 -0
  498. package/dist/sdk/session/auth-operations.d.ts +47 -0
  499. package/dist/sdk/session/auth-operations.js +79 -0
  500. package/dist/sdk/session/auth-operations.js.map +1 -0
  501. package/dist/sdk/session/operations.d.ts +6 -0
  502. package/dist/sdk/session/use-session-actions.d.ts +27 -0
  503. package/dist/sdk/session/use-session-actions.js +126 -0
  504. package/dist/sdk/session/use-session-actions.js.map +1 -0
  505. package/dist/sdk/shipping/cart-operations.d.ts +3 -0
  506. package/dist/sdk/shipping/cart-operations.js +33 -0
  507. package/dist/sdk/shipping/cart-operations.js.map +1 -0
  508. package/dist/sdk/shipping/operations.d.ts +3 -0
  509. package/dist/sdk/shipping/operations.js +33 -0
  510. package/dist/sdk/shipping/operations.js.map +1 -0
  511. package/dist/sdk/shipping/option-select-operations.d.ts +24 -0
  512. package/dist/sdk/shipping/option-select-operations.js +45 -0
  513. package/dist/sdk/shipping/option-select-operations.js.map +1 -0
  514. package/dist/sdk/shipping/request-timeout.js +41 -0
  515. package/dist/sdk/shipping/request-timeout.js.map +1 -0
  516. package/dist/sdk/shipping/shipping-operations.d.ts +38 -0
  517. package/dist/sdk/shipping/shipping-operations.js +77 -0
  518. package/dist/sdk/shipping/shipping-operations.js.map +1 -0
  519. package/dist/sdk/shipping/use-cart-shipping-simulation.d.ts +7 -0
  520. package/dist/sdk/shipping/use-cart-shipping-simulation.js +72 -0
  521. package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -0
  522. package/dist/sdk/shipping/use-shipping-actions.d.ts +27 -0
  523. package/dist/sdk/shipping/use-shipping-actions.js +113 -0
  524. package/dist/sdk/shipping/use-shipping-actions.js.map +1 -0
  525. package/dist/sdk/shipping/use-shipping-simulation.d.ts +7 -0
  526. package/dist/sdk/shipping/use-shipping-simulation.js +72 -0
  527. package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -0
  528. package/dist/sdk/state/cart.d.ts +42 -0
  529. package/dist/sdk/state/cart.js +64 -0
  530. package/dist/sdk/state/cart.js.map +1 -0
  531. package/dist/sdk/state/index.js +3 -0
  532. package/dist/sdk/state/variant-selector.d.ts +17 -0
  533. package/dist/sdk/state/variant-selector.js +14 -0
  534. package/dist/sdk/state/variant-selector.js.map +1 -0
  535. package/dist/utils/safe-href.js +63 -0
  536. package/dist/utils/safe-href.js.map +1 -0
  537. package/package.json +84 -0
  538. package/src/styles/tailwind.css +32 -0
@@ -0,0 +1,170 @@
1
+ "use client";
2
+ import { defineComponent } from "../../core/dist/define-component.js";
3
+ import "../../core/dist/index.js";
4
+ import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
5
+ import { useDataOverride } from "../../sdk/data/data-override-context.js";
6
+ import { Meter } from "../../particles/meter/meter.js";
7
+ import { createContext, useContext } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ //#region src/matter/free-shipping-progress/free-shipping-progress.tsx
10
+ const fragment = `
11
+ fragment FreeShippingProgressData on Query {
12
+ cart {
13
+ id
14
+ total {
15
+ amount
16
+ currencyCode
17
+ }
18
+ freeShippingProgress {
19
+ threshold {
20
+ amount
21
+ currencyCode
22
+ }
23
+ remaining {
24
+ amount
25
+ currencyCode
26
+ }
27
+ qualified
28
+ }
29
+ }
30
+ }
31
+ `;
32
+ const FSP_CONTEXT_UNSET = Symbol("FreeShippingProgressContextUnset");
33
+ const FreeShippingProgressContext = createContext(FSP_CONTEXT_UNSET);
34
+ function useFreeShippingProgress() {
35
+ const ctx = useContext(FreeShippingProgressContext);
36
+ if (ctx === FSP_CONTEXT_UNSET) throw new Error("useFreeShippingProgress() must be used inside a <FreeShippingProgressRoot> subtree.");
37
+ return ctx;
38
+ }
39
+ function formatCurrency(value, locale, currency) {
40
+ return new Intl.NumberFormat(locale, {
41
+ style: "currency",
42
+ currency
43
+ }).format(value);
44
+ }
45
+ function clamp01(value) {
46
+ return Math.min(Math.max(value, 0), 1);
47
+ }
48
+ const FreeShippingProgressRootDefinition = defineComponent({
49
+ name: "FreeShippingProgressRoot",
50
+ importPath: "@vtex/faststore/components",
51
+ component: FreeShippingProgressRoot,
52
+ fragment,
53
+ fetchStrategy: "reactive",
54
+ editor: {
55
+ label: "Free Shipping Progress",
56
+ category: "commerce"
57
+ },
58
+ schema: {},
59
+ guideline: "Free-shipping progress bar for the top of a cart/mini-cart drawer: shows how much more to spend for free shipping and flips to an earned state when met. Renders nothing until a destination and an eligible promotion exist (self-hides on null). See free-shipping-progress.md."
60
+ });
61
+ const FreeShippingProgressBarDefinition = defineComponent({
62
+ name: "FreeShippingProgressBar",
63
+ importPath: "@vtex/faststore/components",
64
+ component: FreeShippingProgressBar,
65
+ editor: {
66
+ label: "Free Shipping Progress Bar",
67
+ category: "commerce"
68
+ },
69
+ schema: {},
70
+ guideline: "Meter bar that fills toward the free-shipping goal, full when earned. Must be inside FreeShippingProgressRoot. See free-shipping-progress.md."
71
+ });
72
+ const FreeShippingProgressMessageDefinition = defineComponent({
73
+ name: "FreeShippingProgressMessage",
74
+ importPath: "@vtex/faststore/components",
75
+ component: FreeShippingProgressMessage,
76
+ editor: {
77
+ label: "Free Shipping Progress Message",
78
+ category: "commerce"
79
+ },
80
+ schema: {
81
+ label: {
82
+ type: "string",
83
+ default: "faltam {value} para frete grátis",
84
+ label: "Below-threshold Label"
85
+ },
86
+ qualifiedLabel: {
87
+ type: "string",
88
+ default: "você ganhou frete grátis!",
89
+ label: "Qualified Label"
90
+ }
91
+ },
92
+ guideline: "Below-threshold vs earned copy, front-formatted from the active storefront context. Must be inside FreeShippingProgressRoot. See free-shipping-progress.md."
93
+ });
94
+ function FreeShippingProgressRoot({ threshold, remaining, qualified, cartTotal, $data: $dataProp, className, children, ...props }) {
95
+ const { currency } = useStorefrontContext();
96
+ const cart = useDataOverride($dataProp) ?? (qualified !== void 0 || threshold !== void 0 || remaining !== void 0 || cartTotal !== void 0 ? {
97
+ id: "preview",
98
+ total: {
99
+ amount: cartTotal ?? 0,
100
+ currencyCode: currency
101
+ },
102
+ freeShippingProgress: {
103
+ threshold: threshold != null ? {
104
+ amount: threshold,
105
+ currencyCode: currency
106
+ } : null,
107
+ remaining: {
108
+ amount: remaining ?? 0,
109
+ currencyCode: currency
110
+ },
111
+ qualified: qualified ?? false
112
+ }
113
+ } : null);
114
+ const fsp = cart?.freeShippingProgress;
115
+ if (!cart || fsp == null) return null;
116
+ const parsedThreshold = fsp.threshold != null ? Number(fsp.threshold.amount) : null;
117
+ const cartTotalAmount = Number(cart.total?.amount ?? 0);
118
+ const thresholdAmount = parsedThreshold != null && Number.isFinite(parsedThreshold) && parsedThreshold > 0 ? parsedThreshold : null;
119
+ const isQualified = fsp.qualified || thresholdAmount != null && cartTotalAmount >= thresholdAmount;
120
+ const liveRemaining = isQualified || thresholdAmount == null ? 0 : Math.max(thresholdAmount - cartTotalAmount, 0);
121
+ const value = {
122
+ isQualified,
123
+ fill: isQualified ? 1 : thresholdAmount != null ? clamp01(cartTotalAmount / thresholdAmount) : 0,
124
+ liveRemaining
125
+ };
126
+ return /* @__PURE__ */ jsx(FreeShippingProgressContext, {
127
+ value,
128
+ children: /* @__PURE__ */ jsx("div", {
129
+ ...props,
130
+ className,
131
+ "data-fs-free-shipping-progress-root": "",
132
+ children
133
+ })
134
+ });
135
+ }
136
+ function FreeShippingProgressBar({ className, ...props }) {
137
+ const { fill, isQualified, liveRemaining } = useFreeShippingProgress();
138
+ const { locale, currency } = useStorefrontContext();
139
+ const ariaValueText = isQualified ? "frete grátis conquistado" : `${formatCurrency(liveRemaining, locale, currency)} restantes para frete grátis`;
140
+ return /* @__PURE__ */ jsx(Meter.Root, {
141
+ ...props,
142
+ value: Math.round(fill * 100),
143
+ min: 0,
144
+ max: 100,
145
+ getAriaValueText: () => ariaValueText,
146
+ className,
147
+ "data-fs-free-shipping-progress-bar": "",
148
+ children: /* @__PURE__ */ jsx(Meter.Track, { children: /* @__PURE__ */ jsx(Meter.Indicator, {}) })
149
+ });
150
+ }
151
+ function FreeShippingProgressMessage({ label = "faltam {value} para frete grátis", qualifiedLabel = "você ganhou frete grátis!", className, children, ...props }) {
152
+ const { isQualified, liveRemaining } = useFreeShippingProgress();
153
+ const { locale, currency } = useStorefrontContext();
154
+ const text = isQualified ? qualifiedLabel : label.replace("{value}", formatCurrency(liveRemaining, locale, currency));
155
+ return /* @__PURE__ */ jsx("div", {
156
+ ...props,
157
+ className,
158
+ "data-fs-free-shipping-progress-message": "",
159
+ children: children ?? text
160
+ });
161
+ }
162
+ const FreeShippingProgress = {
163
+ Root: FreeShippingProgressRoot,
164
+ Bar: FreeShippingProgressBar,
165
+ Message: FreeShippingProgressMessage
166
+ };
167
+ //#endregion
168
+ export { FreeShippingProgress, FreeShippingProgressBar, FreeShippingProgressBarDefinition, FreeShippingProgressMessage, FreeShippingProgressMessageDefinition, FreeShippingProgressRoot, FreeShippingProgressRootDefinition };
169
+
170
+ //# sourceMappingURL=free-shipping-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"free-shipping-progress.js","names":[],"sources":["../../../src/matter/free-shipping-progress/free-shipping-progress.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, createContext, useContext } from 'react';\nimport { Meter } from '../../particles/meter/meter.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype MoneyValue = { amount: number | string; currencyCode: string };\n\ntype FreeShippingProgressData = {\n cart?: {\n id: string;\n total?: MoneyValue | null;\n freeShippingProgress?: {\n threshold: MoneyValue | null;\n remaining: MoneyValue;\n qualified: boolean;\n } | null;\n } | null;\n};\n\ntype FreeShippingProgressContextValue = {\n isQualified: boolean;\n fill: number;\n liveRemaining: number;\n};\n\nexport type FreeShippingProgressRootProps = ComponentPropsWithRef<'div'> & {\n threshold?: number;\n remaining?: number;\n qualified?: boolean;\n cartTotal?: number;\n $data?: FreeShippingProgressData['cart'] | null;\n};\n\nexport type FreeShippingProgressBarProps = ComponentPropsWithRef<'div'>;\nexport type FreeShippingProgressMessageProps = ComponentPropsWithRef<'div'> & {\n label?: string;\n qualifiedLabel?: string;\n};\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment — narrow cart slice (total + freeShippingProgress)\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment FreeShippingProgressData on Query {\n cart {\n id\n total {\n amount\n currencyCode\n }\n freeShippingProgress {\n threshold {\n amount\n currencyCode\n }\n remaining {\n amount\n currencyCode\n }\n qualified\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst FSP_CONTEXT_UNSET = Symbol('FreeShippingProgressContextUnset');\n\nconst FreeShippingProgressContext = createContext<FreeShippingProgressContextValue | typeof FSP_CONTEXT_UNSET>(\n FSP_CONTEXT_UNSET,\n);\n\nfunction useFreeShippingProgress(): FreeShippingProgressContextValue {\n const ctx = useContext(FreeShippingProgressContext);\n if (ctx === FSP_CONTEXT_UNSET) {\n throw new Error('useFreeShippingProgress() must be used inside a <FreeShippingProgressRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction formatCurrency(value: number, locale: string, currency: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value);\n}\n\nfunction clamp01(value: number): number {\n return Math.min(Math.max(value, 0), 1);\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const FreeShippingProgressRootDefinition = defineComponent<FreeShippingProgressRootProps>({\n name: 'FreeShippingProgressRoot',\n importPath: '@vtex/faststore/components',\n component: FreeShippingProgressRoot,\n fragment,\n fetchStrategy: 'reactive',\n editor: { label: 'Free Shipping Progress', category: 'commerce' },\n schema: {},\n guideline:\n 'Free-shipping progress bar for the top of a cart/mini-cart drawer: shows how much more to spend for free shipping and flips to an earned state when met. Renders nothing until a destination and an eligible promotion exist (self-hides on null). See free-shipping-progress.md.',\n});\n\nexport const FreeShippingProgressBarDefinition = defineComponent<FreeShippingProgressBarProps>({\n name: 'FreeShippingProgressBar',\n importPath: '@vtex/faststore/components',\n component: FreeShippingProgressBar,\n editor: { label: 'Free Shipping Progress Bar', category: 'commerce' },\n schema: {},\n guideline:\n 'Meter bar that fills toward the free-shipping goal, full when earned. Must be inside FreeShippingProgressRoot. See free-shipping-progress.md.',\n});\n\nexport const FreeShippingProgressMessageDefinition = defineComponent<FreeShippingProgressMessageProps>({\n name: 'FreeShippingProgressMessage',\n importPath: '@vtex/faststore/components',\n component: FreeShippingProgressMessage,\n editor: { label: 'Free Shipping Progress Message', category: 'commerce' },\n schema: {\n label: { type: 'string', default: 'faltam {value} para frete grátis', label: 'Below-threshold Label' },\n qualifiedLabel: { type: 'string', default: 'você ganhou frete grátis!', label: 'Qualified Label' },\n },\n guideline:\n 'Below-threshold vs earned copy, front-formatted from the active storefront context. Must be inside FreeShippingProgressRoot. See free-shipping-progress.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function FreeShippingProgressRoot({\n threshold,\n remaining,\n qualified,\n cartTotal,\n $data: $dataProp,\n className,\n children,\n ...props\n}: FreeShippingProgressRootProps) {\n // Only the synthesized preview cart below needs it; the leaves read the context where they format.\n const { currency } = useStorefrontContext();\n const $data = useDataOverride($dataProp);\n\n // Story / presentational overrides synthesize the field when no live cart is present.\n const cart =\n $data ??\n (qualified !== undefined || threshold !== undefined || remaining !== undefined || cartTotal !== undefined\n ? {\n id: 'preview',\n total: { amount: cartTotal ?? 0, currencyCode: currency },\n freeShippingProgress: {\n threshold: threshold != null ? { amount: threshold, currencyCode: currency } : null,\n remaining: { amount: remaining ?? 0, currencyCode: currency },\n qualified: qualified ?? false,\n },\n }\n : null);\n\n const fsp = cart?.freeShippingProgress;\n if (!cart || fsp == null) return null;\n\n const parsedThreshold = fsp.threshold != null ? Number(fsp.threshold.amount) : null;\n const cartTotalAmount = Number(cart.total?.amount ?? 0);\n // Usable threshold: present, finite, positive. Null/NaN/zero → no fill, no remaining.\n const thresholdAmount =\n parsedThreshold != null && Number.isFinite(parsedThreshold) && parsedThreshold > 0 ? parsedThreshold : null;\n\n const isQualified = fsp.qualified || (thresholdAmount != null && cartTotalAmount >= thresholdAmount);\n const liveRemaining = isQualified || thresholdAmount == null ? 0 : Math.max(thresholdAmount - cartTotalAmount, 0);\n const fill = isQualified ? 1 : thresholdAmount != null ? clamp01(cartTotalAmount / thresholdAmount) : 0;\n\n const value: FreeShippingProgressContextValue = { isQualified, fill, liveRemaining };\n\n return (\n <FreeShippingProgressContext value={value}>\n <div {...props} className={className} data-fs-free-shipping-progress-root=\"\">\n {children}\n </div>\n </FreeShippingProgressContext>\n );\n}\n\nexport function FreeShippingProgressBar({ className, ...props }: FreeShippingProgressBarProps) {\n const { fill, isQualified, liveRemaining } = useFreeShippingProgress();\n const { locale, currency } = useStorefrontContext();\n const ariaValueText = isQualified\n ? 'frete grátis conquistado'\n : `${formatCurrency(liveRemaining, locale, currency)} restantes para frete grátis`;\n\n return (\n <Meter.Root\n {...props}\n value={Math.round(fill * 100)}\n min={0}\n max={100}\n getAriaValueText={() => ariaValueText}\n className={className}\n data-fs-free-shipping-progress-bar=\"\"\n >\n <Meter.Track>\n <Meter.Indicator />\n </Meter.Track>\n </Meter.Root>\n );\n}\n\nexport function FreeShippingProgressMessage({\n label = 'faltam {value} para frete grátis',\n qualifiedLabel = 'você ganhou frete grátis!',\n className,\n children,\n ...props\n}: FreeShippingProgressMessageProps) {\n const { isQualified, liveRemaining } = useFreeShippingProgress();\n const { locale, currency } = useStorefrontContext();\n const text = isQualified ? qualifiedLabel : label.replace('{value}', formatCurrency(liveRemaining, locale, currency));\n\n return (\n <div {...props} className={className} data-fs-free-shipping-progress-message=\"\">\n {children ?? text}\n </div>\n );\n}\n\nexport const FreeShippingProgress = {\n Root: FreeShippingProgressRoot,\n Bar: FreeShippingProgressBar,\n Message: FreeShippingProgressMessage,\n};\n"],"mappings":";;;;;;;;;AAkDA,MAAM,WAAyB;;;;;;;;;;;;;;;;;;;;;;AA2B/B,MAAM,oBAAoB,OAAO,kCAAkC;AAEnE,MAAM,8BAA8B,cAClC,iBACF;AAEA,SAAS,0BAA4D;CACnE,MAAM,MAAM,WAAW,2BAA2B;CAClD,IAAI,QAAQ,mBACV,MAAM,IAAI,MAAM,qFAAqF;CAEvG,OAAO;AACT;AAMA,SAAS,eAAe,OAAe,QAAgB,UAA0B;CAC/E,OAAO,IAAI,KAAK,aAAa,QAAQ;EAAE,OAAO;EAAY;CAAS,CAAC,CAAC,CAAC,OAAO,KAAK;AACpF;AAEA,SAAS,QAAQ,OAAuB;CACtC,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;AACvC;AAMA,MAAa,qCAAqC,gBAA+C;CAC/F,MAAM;CACN,YAAY;CACZ,WAAW;CACX;CACA,eAAe;CACf,QAAQ;EAAE,OAAO;EAA0B,UAAU;CAAW;CAChE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,oCAAoC,gBAA8C;CAC7F,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAA8B,UAAU;CAAW;CACpE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,wCAAwC,gBAAkD;CACrG,MAAM;CACN,YAAY;CACZ,WAAW;CACX,QAAQ;EAAE,OAAO;EAAkC,UAAU;CAAW;CACxE,QAAQ;EACN,OAAO;GAAE,MAAM;GAAU,SAAS;GAAoC,OAAO;EAAwB;EACrG,gBAAgB;GAAE,MAAM;GAAU,SAAS;GAA6B,OAAO;EAAkB;CACnG;CACA,WACE;AACJ,CAAC;AAMD,SAAgB,yBAAyB,EACvC,WACA,WACA,WACA,WACA,OAAO,WACP,WACA,UACA,GAAG,SAC6B;CAEhC,MAAM,EAAE,aAAa,qBAAqB;CAI1C,MAAM,OAHQ,gBAAgB,SAIxB,MACH,cAAc,KAAA,KAAa,cAAc,KAAA,KAAa,cAAc,KAAA,KAAa,cAAc,KAAA,IAC5F;EACE,IAAI;EACJ,OAAO;GAAE,QAAQ,aAAa;GAAG,cAAc;EAAS;EACxD,sBAAsB;GACpB,WAAW,aAAa,OAAO;IAAE,QAAQ;IAAW,cAAc;GAAS,IAAI;GAC/E,WAAW;IAAE,QAAQ,aAAa;IAAG,cAAc;GAAS;GAC5D,WAAW,aAAa;EAC1B;CACF,IACA;CAEN,MAAM,MAAM,MAAM;CAClB,IAAI,CAAC,QAAQ,OAAO,MAAM,OAAO;CAEjC,MAAM,kBAAkB,IAAI,aAAa,OAAO,OAAO,IAAI,UAAU,MAAM,IAAI;CAC/E,MAAM,kBAAkB,OAAO,KAAK,OAAO,UAAU,CAAC;CAEtD,MAAM,kBACJ,mBAAmB,QAAQ,OAAO,SAAS,eAAe,KAAK,kBAAkB,IAAI,kBAAkB;CAEzG,MAAM,cAAc,IAAI,aAAc,mBAAmB,QAAQ,mBAAmB;CACpF,MAAM,gBAAgB,eAAe,mBAAmB,OAAO,IAAI,KAAK,IAAI,kBAAkB,iBAAiB,CAAC;CAGhH,MAAM,QAA0C;EAAE;EAAa,MAFlD,cAAc,IAAI,mBAAmB,OAAO,QAAQ,kBAAkB,eAAe,IAAI;EAEjC;CAAc;CAEnF,OACE,oBAAC,6BAAD;EAAoC;EAClC,UAAA,oBAAC,OAAD;GAAK,GAAI;GAAkB;GAAW,uCAAoC;GACvE;EACE,CAAA;CACsB,CAAA;AAEjC;AAEA,SAAgB,wBAAwB,EAAE,WAAW,GAAG,SAAuC;CAC7F,MAAM,EAAE,MAAM,aAAa,kBAAkB,wBAAwB;CACrE,MAAM,EAAE,QAAQ,aAAa,qBAAqB;CAClD,MAAM,gBAAgB,cAClB,6BACA,GAAG,eAAe,eAAe,QAAQ,QAAQ,EAAE;CAEvD,OACE,oBAAC,MAAM,MAAP;EACE,GAAI;EACJ,OAAO,KAAK,MAAM,OAAO,GAAG;EAC5B,KAAK;EACL,KAAK;EACL,wBAAwB;EACb;EACX,sCAAmC;EAEnC,UAAA,oBAAC,MAAM,OAAP,EAAA,UACE,oBAAC,MAAM,WAAP,CAAkB,CAAA,EACP,CAAA;CACH,CAAA;AAEhB;AAEA,SAAgB,4BAA4B,EAC1C,QAAQ,oCACR,iBAAiB,6BACjB,WACA,UACA,GAAG,SACgC;CACnC,MAAM,EAAE,aAAa,kBAAkB,wBAAwB;CAC/D,MAAM,EAAE,QAAQ,aAAa,qBAAqB;CAClD,MAAM,OAAO,cAAc,iBAAiB,MAAM,QAAQ,WAAW,eAAe,eAAe,QAAQ,QAAQ,CAAC;CAEpH,OACE,oBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,0CAAuC;EAC1E,UAAA,YAAY;CACV,CAAA;AAET;AAEA,MAAa,uBAAuB;CAClC,MAAM;CACN,KAAK;CACL,SAAS;AACX"}
@@ -0,0 +1,52 @@
1
+ import { ComponentDefinition } from "../../core/dist/define-component.js";
2
+ import "../../core/dist/index.js";
3
+ import { ReactNode } from "react";
4
+ //#region src/matter/identity-edit/identity-edit.d.ts
5
+ export type IdentityEditControllerProps = {
6
+ children?: ReactNode;
7
+ };
8
+ export type IdentityEditPanelProps = {
9
+ children?: ReactNode;
10
+ };
11
+ export type IdentityEditButtonProps = {
12
+ /** Text shown when no children are composed. */
13
+ label?: string;
14
+ className?: string;
15
+ /** Compose custom button content (e.g. an Icon plus text); falls back to `label`. */
16
+ children?: ReactNode;
17
+ };
18
+ export declare const IdentityEditControllerDefinition: ComponentDefinition<IdentityEditControllerProps>;
19
+ export declare const IdentitySummaryViewDefinition: ComponentDefinition<IdentityEditPanelProps>;
20
+ export declare const IdentityEditFormDefinition: ComponentDefinition<IdentityEditPanelProps>;
21
+ export declare const IdentityEditButtonDefinition: ComponentDefinition<IdentityEditButtonProps>;
22
+ export declare const IdentityEditCancelButtonDefinition: ComponentDefinition<IdentityEditButtonProps>;
23
+ /**
24
+ * Owns the identity section's mode and provides it to descendants. Renders no DOM of its own.
25
+ *
26
+ * The mode moves only when the shopper presses one of this section's own buttons. Saving the form does
27
+ * not close the section — the confirmation stays readable, and whether finishing a form should collapse
28
+ * anything is a sequencing question this component deliberately has no opinion on.
29
+ */
30
+ export declare function IdentityEditController({ children }: IdentityEditControllerProps): import("react/jsx-runtime").JSX.Element;
31
+ /** Renders its children only while the section shows the summary. */
32
+ export declare function IdentitySummaryView({ children }: IdentityEditPanelProps): import("react/jsx-runtime").JSX.Element | null;
33
+ /** Renders its children only while the section shows the form. */
34
+ export declare function IdentityEditForm({ children }: IdentityEditPanelProps): import("react/jsx-runtime").JSX.Element | null;
35
+ /** Opens the form. Renders `children` or the `label` fallback. */
36
+ export declare function IdentityEditButton({ label, className, children }: IdentityEditButtonProps): import("react/jsx-runtime").JSX.Element;
37
+ /** Returns to the summary without saving. Renders `children` or the `label` fallback. */
38
+ export declare function IdentityEditCancelButton({ label, className, children }: IdentityEditButtonProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare const IdentityEdit: {
40
+ Controller: typeof IdentityEditController;
41
+ ControllerDefinition: ComponentDefinition<IdentityEditControllerProps>;
42
+ SummaryView: typeof IdentitySummaryView;
43
+ SummaryViewDefinition: ComponentDefinition<IdentityEditPanelProps>;
44
+ Form: typeof IdentityEditForm;
45
+ FormDefinition: ComponentDefinition<IdentityEditPanelProps>;
46
+ EditButton: typeof IdentityEditButton;
47
+ EditButtonDefinition: ComponentDefinition<IdentityEditButtonProps>;
48
+ CancelButton: typeof IdentityEditCancelButton;
49
+ CancelButtonDefinition: ComponentDefinition<IdentityEditButtonProps>;
50
+ };
51
+ //#endregion
52
+ //# sourceMappingURL=identity-edit.d.ts.map
@@ -0,0 +1,148 @@
1
+ "use client";
2
+ import { defineComponent } from "../../core/dist/define-component.js";
3
+ import "../../core/dist/index.js";
4
+ import { createContext, useContext, useMemo, useState } from "react";
5
+ import { Fragment, jsx } from "react/jsx-runtime";
6
+ //#region src/matter/identity-edit/identity-edit.tsx
7
+ const IdentityEditContext = createContext(void 0);
8
+ function useIdentityEditContext() {
9
+ const ctx = useContext(IdentityEditContext);
10
+ if (!ctx) throw new Error("IdentitySummaryView, IdentityEditForm and the edit buttons must be used inside an IdentityEditController.");
11
+ return ctx;
12
+ }
13
+ const IdentityEditControllerDefinition = defineComponent({
14
+ name: "IdentityEditController",
15
+ importPath: "@vtex/faststore/components",
16
+ component: IdentityEditController,
17
+ providesContext: "identity-edit",
18
+ editor: {
19
+ label: "Identity Edit Controller",
20
+ category: "commerce"
21
+ },
22
+ schema: {},
23
+ guideline: "Owns the identity section's summary/form toggle: starts on the summary, opens on IdentityEditButton and returns on IdentityEditCancelButton. Saving does not move it, so the form's confirmation stays readable and ClientProfileForm never needs to know about a section around it. Self-contained: collapsing tells nothing else, so no other section opens as a result. Compose an IdentitySummaryView holding the summary parts and an IdentityEditForm holding a ClientProfileForm, plus an IdentityEditButton in the heading and an IdentityEditCancelButton next to the form. No state is named anywhere: which state a part belongs to is which component it is. Renders no DOM of its own."
24
+ });
25
+ const IdentitySummaryViewDefinition = defineComponent({
26
+ name: "IdentitySummaryView",
27
+ importPath: "@vtex/faststore/components",
28
+ component: IdentitySummaryView,
29
+ requiresContext: "identity-edit",
30
+ editor: {
31
+ label: "Identity Summary View",
32
+ category: "commerce"
33
+ },
34
+ schema: {},
35
+ guideline: "Renders its children only while the identity section shows the summary, and nothing while it shows the form. Takes no props: which state it gates is which component it is. Must be inside an IdentityEditController."
36
+ });
37
+ const IdentityEditFormDefinition = defineComponent({
38
+ name: "IdentityEditForm",
39
+ importPath: "@vtex/faststore/components",
40
+ component: IdentityEditForm,
41
+ requiresContext: "identity-edit",
42
+ editor: {
43
+ label: "Identity Edit Form",
44
+ category: "commerce"
45
+ },
46
+ schema: {},
47
+ guideline: "Renders its children only while the identity section shows the form, and nothing while it shows the summary. Compose ClientProfileFormRoot and its parts inside, plus an IdentityEditCancelButton. Must be inside an IdentityEditController."
48
+ });
49
+ const IdentityEditButtonDefinition = defineComponent({
50
+ name: "IdentityEditButton",
51
+ importPath: "@vtex/faststore/components",
52
+ component: IdentityEditButton,
53
+ requiresContext: "identity-edit",
54
+ editor: {
55
+ label: "Identity Edit Button",
56
+ category: "action"
57
+ },
58
+ schema: { label: {
59
+ type: "string",
60
+ default: "editar",
61
+ label: "Button label"
62
+ } },
63
+ guideline: "Opens the identity form. Place it in the section heading, inside an IdentitySummaryView so it disappears while the form is open. Compose an Icon plus text as children, or rely on `label`. Must be inside an IdentityEditController."
64
+ });
65
+ const IdentityEditCancelButtonDefinition = defineComponent({
66
+ name: "IdentityEditCancelButton",
67
+ importPath: "@vtex/faststore/components",
68
+ component: IdentityEditCancelButton,
69
+ requiresContext: "identity-edit",
70
+ editor: {
71
+ label: "Identity Edit Cancel Button",
72
+ category: "action"
73
+ },
74
+ schema: { label: {
75
+ type: "string",
76
+ default: "cancelar",
77
+ label: "Button label"
78
+ } },
79
+ guideline: "Returns the identity section to its summary without saving. Place it inside an IdentityEditForm. Must be inside an IdentityEditController."
80
+ });
81
+ /**
82
+ * Owns the identity section's mode and provides it to descendants. Renders no DOM of its own.
83
+ *
84
+ * The mode moves only when the shopper presses one of this section's own buttons. Saving the form does
85
+ * not close the section — the confirmation stays readable, and whether finishing a form should collapse
86
+ * anything is a sequencing question this component deliberately has no opinion on.
87
+ */
88
+ function IdentityEditController({ children }) {
89
+ const [mode, setMode] = useState("view");
90
+ const value = useMemo(() => ({
91
+ mode,
92
+ setMode
93
+ }), [mode]);
94
+ return /* @__PURE__ */ jsx(IdentityEditContext.Provider, {
95
+ value,
96
+ children
97
+ });
98
+ }
99
+ /** Renders its children only while the section shows the summary. */
100
+ function IdentitySummaryView({ children }) {
101
+ const { mode } = useIdentityEditContext();
102
+ if (mode !== "view") return null;
103
+ return /* @__PURE__ */ jsx(Fragment, { children });
104
+ }
105
+ /** Renders its children only while the section shows the form. */
106
+ function IdentityEditForm({ children }) {
107
+ const { mode } = useIdentityEditContext();
108
+ if (mode !== "edit") return null;
109
+ return /* @__PURE__ */ jsx(Fragment, { children });
110
+ }
111
+ /** Opens the form. Renders `children` or the `label` fallback. */
112
+ function IdentityEditButton({ label = "editar", className, children }) {
113
+ const { setMode } = useIdentityEditContext();
114
+ return /* @__PURE__ */ jsx("button", {
115
+ type: "button",
116
+ "data-fs-identity-edit-button": "",
117
+ className,
118
+ onClick: () => setMode("edit"),
119
+ children: children ?? label
120
+ });
121
+ }
122
+ /** Returns to the summary without saving. Renders `children` or the `label` fallback. */
123
+ function IdentityEditCancelButton({ label = "cancelar", className, children }) {
124
+ const { setMode } = useIdentityEditContext();
125
+ return /* @__PURE__ */ jsx("button", {
126
+ type: "button",
127
+ "data-fs-identity-edit-cancel-button": "",
128
+ className,
129
+ onClick: () => setMode("view"),
130
+ children: children ?? label
131
+ });
132
+ }
133
+ const IdentityEdit = {
134
+ Controller: IdentityEditController,
135
+ ControllerDefinition: IdentityEditControllerDefinition,
136
+ SummaryView: IdentitySummaryView,
137
+ SummaryViewDefinition: IdentitySummaryViewDefinition,
138
+ Form: IdentityEditForm,
139
+ FormDefinition: IdentityEditFormDefinition,
140
+ EditButton: IdentityEditButton,
141
+ EditButtonDefinition: IdentityEditButtonDefinition,
142
+ CancelButton: IdentityEditCancelButton,
143
+ CancelButtonDefinition: IdentityEditCancelButtonDefinition
144
+ };
145
+ //#endregion
146
+ export { IdentityEdit, IdentityEditButton, IdentityEditButtonDefinition, IdentityEditCancelButton, IdentityEditCancelButtonDefinition, IdentityEditController, IdentityEditControllerDefinition, IdentityEditForm, IdentityEditFormDefinition, IdentitySummaryView, IdentitySummaryViewDefinition };
147
+
148
+ //# sourceMappingURL=identity-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-edit.js","names":[],"sources":["../../../src/matter/identity-edit/identity-edit.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext, useMemo, useState } from 'react';\n\n// ---------------------------------------------------------------------------\n// Identity view/edit toggle.\n//\n// The identity section shows a summary of who the shopper is until they ask to change it, and returns to\n// the summary when they say so — this component owns the mode rather than a page authoring it\n// (ADR-0006). Saving does not move it; whether it should is a sequencing question left to the\n// flow-of-steps RFC (#611). The sibling of the delivery section's `ShippingAddressEditController`, and\n// its own component because the two differ in the parts that are domain knowledge. See identity-edit.md.\n// ---------------------------------------------------------------------------\n\n/** Internal: the section's two states never reach the schema, because each has its own component. */\ntype IdentityEditMode = 'view' | 'edit';\n\ntype IdentityEditContextValue = {\n mode: IdentityEditMode;\n setMode: (mode: IdentityEditMode) => void;\n};\n\nconst IdentityEditContext = createContext<IdentityEditContextValue | undefined>(undefined);\n\nfunction useIdentityEditContext(): IdentityEditContextValue {\n const ctx = useContext(IdentityEditContext);\n if (!ctx) {\n throw new Error(\n 'IdentitySummaryView, IdentityEditForm and the edit buttons must be used inside an IdentityEditController.',\n );\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\nexport type IdentityEditControllerProps = {\n children?: ReactNode;\n};\n\nexport type IdentityEditPanelProps = {\n children?: ReactNode;\n};\n\nexport type IdentityEditButtonProps = {\n /** Text shown when no children are composed. */\n label?: string;\n className?: string;\n /** Compose custom button content (e.g. an Icon plus text); falls back to `label`. */\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const IdentityEditControllerDefinition = defineComponent<IdentityEditControllerProps>({\n name: 'IdentityEditController',\n importPath: '@vtex/faststore/components',\n component: IdentityEditController,\n providesContext: 'identity-edit',\n editor: { label: 'Identity Edit Controller', category: 'commerce' },\n schema: {},\n guideline:\n \"Owns the identity section's summary/form toggle: starts on the summary, opens on IdentityEditButton and returns on IdentityEditCancelButton. Saving does not move it, so the form's confirmation stays readable and ClientProfileForm never needs to know about a section around it. Self-contained: collapsing tells nothing else, so no other section opens as a result. Compose an IdentitySummaryView holding the summary parts and an IdentityEditForm holding a ClientProfileForm, plus an IdentityEditButton in the heading and an IdentityEditCancelButton next to the form. No state is named anywhere: which state a part belongs to is which component it is. Renders no DOM of its own.\",\n});\n\nexport const IdentitySummaryViewDefinition = defineComponent<IdentityEditPanelProps>({\n name: 'IdentitySummaryView',\n importPath: '@vtex/faststore/components',\n component: IdentitySummaryView,\n requiresContext: 'identity-edit',\n editor: { label: 'Identity Summary View', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders its children only while the identity section shows the summary, and nothing while it shows the form. Takes no props: which state it gates is which component it is. Must be inside an IdentityEditController.',\n});\n\nexport const IdentityEditFormDefinition = defineComponent<IdentityEditPanelProps>({\n name: 'IdentityEditForm',\n importPath: '@vtex/faststore/components',\n component: IdentityEditForm,\n requiresContext: 'identity-edit',\n editor: { label: 'Identity Edit Form', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders its children only while the identity section shows the form, and nothing while it shows the summary. Compose ClientProfileFormRoot and its parts inside, plus an IdentityEditCancelButton. Must be inside an IdentityEditController.',\n});\n\nexport const IdentityEditButtonDefinition = defineComponent<IdentityEditButtonProps>({\n name: 'IdentityEditButton',\n importPath: '@vtex/faststore/components',\n component: IdentityEditButton,\n requiresContext: 'identity-edit',\n editor: { label: 'Identity Edit Button', category: 'action' },\n schema: {\n label: { type: 'string', default: 'editar', label: 'Button label' },\n },\n guideline:\n 'Opens the identity form. Place it in the section heading, inside an IdentitySummaryView so it disappears while the form is open. Compose an Icon plus text as children, or rely on `label`. Must be inside an IdentityEditController.',\n});\n\nexport const IdentityEditCancelButtonDefinition = defineComponent<IdentityEditButtonProps>({\n name: 'IdentityEditCancelButton',\n importPath: '@vtex/faststore/components',\n component: IdentityEditCancelButton,\n requiresContext: 'identity-edit',\n editor: { label: 'Identity Edit Cancel Button', category: 'action' },\n schema: {\n label: { type: 'string', default: 'cancelar', label: 'Button label' },\n },\n guideline:\n 'Returns the identity section to its summary without saving. Place it inside an IdentityEditForm. Must be inside an IdentityEditController.',\n});\n\n// ---------------------------------------------------------------------------\n// Components\n// ---------------------------------------------------------------------------\n\n/**\n * Owns the identity section's mode and provides it to descendants. Renders no DOM of its own.\n *\n * The mode moves only when the shopper presses one of this section's own buttons. Saving the form does\n * not close the section — the confirmation stays readable, and whether finishing a form should collapse\n * anything is a sequencing question this component deliberately has no opinion on.\n */\nexport function IdentityEditController({ children }: IdentityEditControllerProps) {\n const [mode, setMode] = useState<IdentityEditMode>('view');\n\n const value = useMemo<IdentityEditContextValue>(() => ({ mode, setMode }), [mode]);\n\n return <IdentityEditContext.Provider value={value}>{children}</IdentityEditContext.Provider>;\n}\n\n/** Renders its children only while the section shows the summary. */\nexport function IdentitySummaryView({ children }: IdentityEditPanelProps) {\n const { mode } = useIdentityEditContext();\n if (mode !== 'view') return null;\n return <>{children}</>;\n}\n\n/** Renders its children only while the section shows the form. */\nexport function IdentityEditForm({ children }: IdentityEditPanelProps) {\n const { mode } = useIdentityEditContext();\n if (mode !== 'edit') return null;\n return <>{children}</>;\n}\n\n/** Opens the form. Renders `children` or the `label` fallback. */\nexport function IdentityEditButton({ label = 'editar', className, children }: IdentityEditButtonProps) {\n const { setMode } = useIdentityEditContext();\n return (\n <button type=\"button\" data-fs-identity-edit-button=\"\" className={className} onClick={() => setMode('edit')}>\n {children ?? label}\n </button>\n );\n}\n\n/** Returns to the summary without saving. Renders `children` or the `label` fallback. */\nexport function IdentityEditCancelButton({ label = 'cancelar', className, children }: IdentityEditButtonProps) {\n const { setMode } = useIdentityEditContext();\n return (\n <button type=\"button\" data-fs-identity-edit-cancel-button=\"\" className={className} onClick={() => setMode('view')}>\n {children ?? label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace Export\n// ---------------------------------------------------------------------------\n\nexport const IdentityEdit = {\n Controller: IdentityEditController,\n ControllerDefinition: IdentityEditControllerDefinition,\n SummaryView: IdentitySummaryView,\n SummaryViewDefinition: IdentitySummaryViewDefinition,\n Form: IdentityEditForm,\n FormDefinition: IdentityEditFormDefinition,\n EditButton: IdentityEditButton,\n EditButtonDefinition: IdentityEditButtonDefinition,\n CancelButton: IdentityEditCancelButton,\n CancelButtonDefinition: IdentityEditCancelButtonDefinition,\n};\n"],"mappings":";;;;;;AAuBA,MAAM,sBAAsB,cAAoD,KAAA,CAAS;AAEzF,SAAS,yBAAmD;CAC1D,MAAM,MAAM,WAAW,mBAAmB;CAC1C,IAAI,CAAC,KACH,MAAM,IAAI,MACR,2GACF;CAEF,OAAO;AACT;AA0BA,MAAa,mCAAmC,gBAA6C;CAC3F,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA4B,UAAU;CAAW;CAClE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,gCAAgC,gBAAwC;CACnF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAyB,UAAU;CAAW;CAC/D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,6BAA6B,gBAAwC;CAChF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAsB,UAAU;CAAW;CAC5D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,+BAA+B,gBAAyC;CACnF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAwB,UAAU;CAAS;CAC5D,QAAQ,EACN,OAAO;EAAE,MAAM;EAAU,SAAS;EAAU,OAAO;CAAe,EACpE;CACA,WACE;AACJ,CAAC;AAED,MAAa,qCAAqC,gBAAyC;CACzF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA+B,UAAU;CAAS;CACnE,QAAQ,EACN,OAAO;EAAE,MAAM;EAAU,SAAS;EAAY,OAAO;CAAe,EACtE;CACA,WACE;AACJ,CAAC;;;;;;;;AAaD,SAAgB,uBAAuB,EAAE,YAAyC;CAChF,MAAM,CAAC,MAAM,WAAW,SAA2B,MAAM;CAEzD,MAAM,QAAQ,eAAyC;EAAE;EAAM;CAAQ,IAAI,CAAC,IAAI,CAAC;CAEjF,OAAO,oBAAC,oBAAoB,UAArB;EAAqC;EAAQ;CAAuC,CAAA;AAC7F;;AAGA,SAAgB,oBAAoB,EAAE,YAAoC;CACxE,MAAM,EAAE,SAAS,uBAAuB;CACxC,IAAI,SAAS,QAAQ,OAAO;CAC5B,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACvB;;AAGA,SAAgB,iBAAiB,EAAE,YAAoC;CACrE,MAAM,EAAE,SAAS,uBAAuB;CACxC,IAAI,SAAS,QAAQ,OAAO;CAC5B,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACvB;;AAGA,SAAgB,mBAAmB,EAAE,QAAQ,UAAU,WAAW,YAAqC;CACrG,MAAM,EAAE,YAAY,uBAAuB;CAC3C,OACE,oBAAC,UAAD;EAAQ,MAAK;EAAS,gCAA6B;EAAc;EAAW,eAAe,QAAQ,MAAM;EACtG,UAAA,YAAY;CACP,CAAA;AAEZ;;AAGA,SAAgB,yBAAyB,EAAE,QAAQ,YAAY,WAAW,YAAqC;CAC7G,MAAM,EAAE,YAAY,uBAAuB;CAC3C,OACE,oBAAC,UAAD;EAAQ,MAAK;EAAS,uCAAoC;EAAc;EAAW,eAAe,QAAQ,MAAM;EAC7G,UAAA,YAAY;CACP,CAAA;AAEZ;AAMA,MAAa,eAAe;CAC1B,YAAY;CACZ,sBAAsB;CACtB,aAAa;CACb,uBAAuB;CACvB,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,sBAAsB;CACtB,cAAc;CACd,wBAAwB;AAC1B"}
@@ -0,0 +1,128 @@
1
+ import { ComponentDefinition } from "../../core/dist/define-component.js";
2
+ import "../../core/dist/index.js";
3
+ import { ComponentActions } from "../../sdk/actions/types.js";
4
+ import { PhoneCountry } from "../../particles/phone-field/phone-field.js";
5
+ import { ReactNode } from "react";
6
+ //#region src/matter/identity-summary/identity-summary.d.ts
7
+ /**
8
+ * The `$data` slice forwarded by the reactive runtime — the unwrapped `ClientProfile` entity.
9
+ * The fragment selects a single top-level field, so the compiler hands the entity value directly
10
+ * (not a `{ clientProfile: ... }` wrapper); ADR-0015.
11
+ */
12
+ export type IdentitySummaryData = {
13
+ email?: string | null;
14
+ firstName?: string | null;
15
+ lastName?: string | null;
16
+ phone?: string | null;
17
+ document?: string | null;
18
+ } | null;
19
+ export type IdentitySummaryRootProps = {
20
+ /** Error message shown when the sign-out mutation returns user errors. */
21
+ signOutErrorMessage?: string;
22
+ className?: string;
23
+ children?: ReactNode;
24
+ /** `IdentitySummaryData` slice forwarded by the reactive runtime. */
25
+ $data?: IdentitySummaryData;
26
+ /** Compiler-injected action surface; carries `session.logout`. */
27
+ $actions?: ComponentActions;
28
+ };
29
+ export type IdentitySummarySelectedSummaryProps = {
30
+ /** Phone display country; selects the mask applied to the stored E.164 value. */
31
+ country?: PhoneCountry;
32
+ /** Badge label in the `identified` session state. */
33
+ identifiedBadgeLabel?: string;
34
+ /** Badge label in the `loggedIn` session state. */
35
+ loggedInBadgeLabel?: string;
36
+ className?: string;
37
+ /** Compose custom read-only content; falls back to the default badge + details when omitted. */
38
+ children?: ReactNode;
39
+ };
40
+ export type IdentitySummaryBadgeProps = {
41
+ /** Badge label in the `identified` session state. */
42
+ identifiedLabel?: string;
43
+ /** Badge label in the `loggedIn` session state. */
44
+ loggedInLabel?: string;
45
+ className?: string;
46
+ };
47
+ export type IdentitySummaryFieldProps = {
48
+ className?: string;
49
+ };
50
+ export type IdentitySummaryPhoneProps = {
51
+ /** Phone display country; selects the mask applied to the stored E.164 value. */
52
+ country?: PhoneCountry;
53
+ className?: string;
54
+ };
55
+ export type IdentitySummarySignOutButtonProps = {
56
+ label?: string;
57
+ className?: string;
58
+ children?: ReactNode;
59
+ };
60
+ export type IdentitySummaryErrorProps = {
61
+ className?: string;
62
+ };
63
+ export declare const IdentitySummaryRootDefinition: ComponentDefinition<IdentitySummaryRootProps>;
64
+ export declare const IdentitySummarySelectedSummaryDefinition: ComponentDefinition<IdentitySummarySelectedSummaryProps>;
65
+ export declare const IdentitySummaryBadgeDefinition: ComponentDefinition<IdentitySummaryBadgeProps>;
66
+ export declare const IdentitySummaryNameDefinition: ComponentDefinition<IdentitySummaryFieldProps>;
67
+ export declare const IdentitySummaryEmailDefinition: ComponentDefinition<IdentitySummaryFieldProps>;
68
+ export declare const IdentitySummaryPhoneDefinition: ComponentDefinition<IdentitySummaryPhoneProps>;
69
+ export declare const IdentitySummaryDocumentDefinition: ComponentDefinition<IdentitySummaryFieldProps>;
70
+ export declare const IdentitySummarySignOutButtonDefinition: ComponentDefinition<IdentitySummarySignOutButtonProps>;
71
+ export declare const IdentitySummaryErrorDefinition: ComponentDefinition<IdentitySummaryErrorProps>;
72
+ /**
73
+ * Data root for the identity summary. Reads the shopper profile from its colocated fragment,
74
+ * enforces the SessionRoot ancestor via `useSession()`, and self-gates to null in the anonymous
75
+ * state. Owns the sign-out mutation state (pending/error) and broadcasts everything the read-only
76
+ * parts and the sign-out button need through `IdentitySummaryContext`.
77
+ */
78
+ export declare function IdentitySummaryRoot({ signOutErrorMessage, className, children, $data: $dataProp, $actions }: IdentitySummaryRootProps): import("react/jsx-runtime").JSX.Element | null;
79
+ /**
80
+ * Read-only identity display: a session-state badge plus name, email, phone, and document.
81
+ *
82
+ * The props below configure the default composition only — composing children replaces it wholesale,
83
+ * and a leaf placed there takes its own props (`IdentitySummaryPhone` its `country`,
84
+ * `IdentitySummaryBadge` its labels). They are deliberately absent from the schema, so a page cannot
85
+ * set one here and watch it disappear behind composed children.
86
+ */
87
+ export declare function IdentitySummarySelectedSummary({ country, identifiedBadgeLabel, loggedInBadgeLabel, className, children }: IdentitySummarySelectedSummaryProps): import("react/jsx-runtime").JSX.Element;
88
+ /** Session-state badge. Renders `identifiedLabel` for a guest and `loggedInLabel` once authenticated. */
89
+ export declare function IdentitySummaryBadge({ identifiedLabel, loggedInLabel, className }: IdentitySummaryBadgeProps): import("react/jsx-runtime").JSX.Element;
90
+ /** The shopper's full name. Renders nothing when the profile carries neither name. */
91
+ export declare function IdentitySummaryName({ className }: IdentitySummaryFieldProps): import("react/jsx-runtime").JSX.Element | null;
92
+ /** The shopper's e-mail. Renders nothing when absent. */
93
+ export declare function IdentitySummaryEmail({ className }: IdentitySummaryFieldProps): import("react/jsx-runtime").JSX.Element | null;
94
+ /**
95
+ * The shopper's phone, masked for `country`. Renders nothing when absent, and renders the stored value
96
+ * as-is whenever the mask does not apply to it — no country given, or a stored E.164 number belonging to
97
+ * a different one. Each mask truncates to its own country's length, so applying the wrong one prints a
98
+ * number that is not the shopper's, with nothing to signal that digits were dropped.
99
+ */
100
+ export declare function IdentitySummaryPhone({ country, className }: IdentitySummaryPhoneProps): import("react/jsx-runtime").JSX.Element | null;
101
+ /** The shopper's tax document. Renders nothing when absent. */
102
+ export declare function IdentitySummaryDocument({ className }: IdentitySummaryFieldProps): import("react/jsx-runtime").JSX.Element | null;
103
+ /** Dispatches the sign-out mutation (async/pessimistic). */
104
+ export declare function IdentitySummarySignOutButton({ label, className, children }: IdentitySummarySignOutButtonProps): import("react/jsx-runtime").JSX.Element;
105
+ /** Renders the inline sign-out user error, or nothing when there is none. */
106
+ export declare function IdentitySummaryError({ className }: IdentitySummaryErrorProps): import("react/jsx-runtime").JSX.Element | null;
107
+ export declare const IdentitySummary: {
108
+ Badge: typeof IdentitySummaryBadge;
109
+ BadgeDefinition: ComponentDefinition<IdentitySummaryBadgeProps>;
110
+ Name: typeof IdentitySummaryName;
111
+ NameDefinition: ComponentDefinition<IdentitySummaryFieldProps>;
112
+ Email: typeof IdentitySummaryEmail;
113
+ EmailDefinition: ComponentDefinition<IdentitySummaryFieldProps>;
114
+ Phone: typeof IdentitySummaryPhone;
115
+ PhoneDefinition: ComponentDefinition<IdentitySummaryPhoneProps>;
116
+ Document: typeof IdentitySummaryDocument;
117
+ DocumentDefinition: ComponentDefinition<IdentitySummaryFieldProps>;
118
+ Root: typeof IdentitySummaryRoot;
119
+ RootDefinition: ComponentDefinition<IdentitySummaryRootProps>;
120
+ SelectedSummary: typeof IdentitySummarySelectedSummary;
121
+ SelectedSummaryDefinition: ComponentDefinition<IdentitySummarySelectedSummaryProps>;
122
+ SignOutButton: typeof IdentitySummarySignOutButton;
123
+ SignOutButtonDefinition: ComponentDefinition<IdentitySummarySignOutButtonProps>;
124
+ Error: typeof IdentitySummaryError;
125
+ ErrorDefinition: ComponentDefinition<IdentitySummaryErrorProps>;
126
+ };
127
+ //#endregion
128
+ //# sourceMappingURL=identity-summary.d.ts.map