@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,47 @@
1
+ import "../cart/operations.js";
2
+ import "./operations.js";
3
+ import { TypedDocumentNode } from "@apollo/client";
4
+ //#region src/sdk/session/auth-operations.d.ts
5
+ /**
6
+ * Session auth mutation documents (specs/fspg-880-session-action-namespace.md).
7
+ *
8
+ * Authored with the hand `gql` tag — the codegen `graphql()` factory is reserved for the reactive
9
+ * read path (`operations.ts`) — and explicitly excluded from the codegen `documents` glob (see
10
+ * `codegen.ts`): the `gql` tag alone is still plucked by `graphql-codegen`, which would duplicate
11
+ * these hand-written types in `sdk/generated/`. The mutations stay hand-typed as
12
+ * `TypedDocumentNode`s (Decision 3). Login/validate/logout share `SessionLoginPayloadFragment`,
13
+ * a hand-written fragment selecting the full refreshed payload:
14
+ * `session` with exactly `SessionFragment`'s field set, `cart` spreading the canonical codegen
15
+ * `CartFragment` (interpolated as a document), and the full `clientProfile` / `clientPreferences`
16
+ * slices. All payload entities are normalized Relay Nodes keyed on the orderFormId, so the response
17
+ * write into the cache *is* the post-login refresh: `SessionRoot`'s reactive read flips with no
18
+ * refetch and no imperative cache write (Decision 2).
19
+ *
20
+ * Failures follow ADR-00007's two-path contract: domain outcomes arrive as payload `userErrors`
21
+ * (`SessionError`); transport and top-level GraphQL failures are infrastructure, mapped by the
22
+ * handlers in `use-session-actions.ts` to the one client-synthesized code, `NETWORK_ERROR`.
23
+ */
24
+ /** A typed login-attempt failure; NETWORK_ERROR is the one client-synthesized code (Decision 5). */
25
+ export type SessionUserError = Readonly<{
26
+ code: string;
27
+ message: string;
28
+ }>;
29
+ export type SessionPasswordLoginPayload = Readonly<{
30
+ email: string;
31
+ password: string;
32
+ }>;
33
+ export type SessionRequestAccessCodePayload = Readonly<{
34
+ email: string;
35
+ }>;
36
+ export type SessionValidateAccessCodePayload = Readonly<{
37
+ email: string;
38
+ accessCode: string;
39
+ /** Opaque token from requestAccessCode, handed back unchanged (Decision 4). */
40
+ authenticationToken: string;
41
+ }>;
42
+ export type SessionAccessCodeRequestResult = Readonly<{
43
+ authenticationToken: string | null;
44
+ userErrors: readonly SessionUserError[];
45
+ }>;
46
+ //#endregion
47
+ //# sourceMappingURL=auth-operations.d.ts.map
@@ -0,0 +1,79 @@
1
+ import { gql } from "../graphql-tag.js";
2
+ import { CartFragment } from "../cart/operations.js";
3
+ //#region src/sdk/session/auth-operations.ts
4
+ /** The shared full-refreshed-payload selection for login/validate/logout; embeds `CartFragment`. */
5
+ const SessionLoginPayloadFragment = gql`
6
+ fragment SessionLoginPayloadFragment on SessionLoginPayload {
7
+ __typename
8
+ session {
9
+ __typename
10
+ id
11
+ loggedIn
12
+ canEditData
13
+ isIdentified
14
+ }
15
+ cart {
16
+ ...CartFragment
17
+ }
18
+ clientProfile {
19
+ __typename
20
+ id
21
+ email
22
+ firstName
23
+ lastName
24
+ phone
25
+ document
26
+ }
27
+ clientPreferences {
28
+ __typename
29
+ id
30
+ optinNewsLetter
31
+ savePersonalData
32
+ }
33
+ userErrors {
34
+ code
35
+ message
36
+ }
37
+ }
38
+ ${CartFragment}
39
+ `;
40
+ const SESSION_LOGIN_WITH_PASSWORD = gql`
41
+ mutation SessionLoginWithPassword($input: SessionPasswordLoginInput!) {
42
+ sessionLoginWithPassword(input: $input) {
43
+ ...SessionLoginPayloadFragment
44
+ }
45
+ }
46
+ ${SessionLoginPayloadFragment}
47
+ `;
48
+ const SESSION_REQUEST_ACCESS_CODE = gql`
49
+ mutation SessionRequestAccessCode($input: SessionRequestAccessCodeInput!) {
50
+ sessionRequestAccessCode(input: $input) {
51
+ __typename
52
+ authenticationToken
53
+ userErrors {
54
+ code
55
+ message
56
+ }
57
+ }
58
+ }
59
+ `;
60
+ const SESSION_VALIDATE_ACCESS_CODE = gql`
61
+ mutation SessionValidateAccessCode($input: SessionValidateAccessCodeInput!) {
62
+ sessionValidateAccessCode(input: $input) {
63
+ ...SessionLoginPayloadFragment
64
+ }
65
+ }
66
+ ${SessionLoginPayloadFragment}
67
+ `;
68
+ const SESSION_LOGOUT = gql`
69
+ mutation SessionLogout {
70
+ sessionLogout {
71
+ ...SessionLoginPayloadFragment
72
+ }
73
+ }
74
+ ${SessionLoginPayloadFragment}
75
+ `;
76
+ //#endregion
77
+ export { SESSION_LOGIN_WITH_PASSWORD, SESSION_LOGOUT, SESSION_REQUEST_ACCESS_CODE, SESSION_VALIDATE_ACCESS_CODE };
78
+
79
+ //# sourceMappingURL=auth-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-operations.js","names":[],"sources":["../../../src/sdk/session/auth-operations.ts"],"sourcesContent":["import type { TypedDocumentNode } from '@apollo/client';\nimport { type CartEntity, CartFragment } from '../cart/operations.js';\nimport { gql } from '../graphql-tag.js';\nimport type { SessionEntity } from './operations.js';\n\n/**\n * Session auth mutation documents (specs/fspg-880-session-action-namespace.md).\n *\n * Authored with the hand `gql` tag — the codegen `graphql()` factory is reserved for the reactive\n * read path (`operations.ts`) — and explicitly excluded from the codegen `documents` glob (see\n * `codegen.ts`): the `gql` tag alone is still plucked by `graphql-codegen`, which would duplicate\n * these hand-written types in `sdk/generated/`. The mutations stay hand-typed as\n * `TypedDocumentNode`s (Decision 3). Login/validate/logout share `SessionLoginPayloadFragment`,\n * a hand-written fragment selecting the full refreshed payload:\n * `session` with exactly `SessionFragment`'s field set, `cart` spreading the canonical codegen\n * `CartFragment` (interpolated as a document), and the full `clientProfile` / `clientPreferences`\n * slices. All payload entities are normalized Relay Nodes keyed on the orderFormId, so the response\n * write into the cache *is* the post-login refresh: `SessionRoot`'s reactive read flips with no\n * refetch and no imperative cache write (Decision 2).\n *\n * Failures follow ADR-00007's two-path contract: domain outcomes arrive as payload `userErrors`\n * (`SessionError`); transport and top-level GraphQL failures are infrastructure, mapped by the\n * handlers in `use-session-actions.ts` to the one client-synthesized code, `NETWORK_ERROR`.\n */\n\n/** A typed login-attempt failure; NETWORK_ERROR is the one client-synthesized code (Decision 5). */\nexport type SessionUserError = Readonly<{ code: string; message: string }>;\n\nexport type SessionPasswordLoginPayload = Readonly<{ email: string; password: string }>;\n\nexport type SessionRequestAccessCodePayload = Readonly<{ email: string }>;\n\nexport type SessionValidateAccessCodePayload = Readonly<{\n email: string;\n accessCode: string;\n /** Opaque token from requestAccessCode, handed back unchanged (Decision 4). */\n authenticationToken: string;\n}>;\n\nexport type SessionAccessCodeRequestResult = Readonly<{\n authenticationToken: string | null;\n userErrors: readonly SessionUserError[];\n}>;\n\n/** The shopper's profile slice of the login payload; fields are null when unset. */\nexport type ClientProfileEntity = Readonly<{\n __typename: 'ClientProfile';\n id: string;\n email: string | null;\n firstName: string | null;\n lastName: string | null;\n phone: string | null;\n document: string | null;\n}>;\n\n/** The shopper's preference opt-ins slice of the login payload; fields are null when unset. */\nexport type ClientPreferencesEntity = Readonly<{\n __typename: 'ClientPreferences';\n id: string;\n optinNewsLetter: boolean | null;\n savePersonalData: boolean | null;\n}>;\n\n/** The full login/logout mutation payload, projected from the one refreshed order form. */\nexport type SessionLoginPayloadEntity = Readonly<{\n __typename: 'SessionLoginPayload';\n session: SessionEntity;\n cart: CartEntity;\n clientProfile: ClientProfileEntity;\n clientPreferences: ClientPreferencesEntity;\n userErrors: readonly SessionUserError[];\n}>;\n\nexport type SessionRequestAccessCodePayloadEntity = Readonly<{\n __typename: 'SessionRequestAccessCodePayload';\n authenticationToken: string | null;\n userErrors: readonly SessionUserError[];\n}>;\n\ntype SessionLoginWithPasswordData = Readonly<{ sessionLoginWithPassword: SessionLoginPayloadEntity }>;\ntype SessionRequestAccessCodeData = Readonly<{ sessionRequestAccessCode: SessionRequestAccessCodePayloadEntity }>;\ntype SessionValidateAccessCodeData = Readonly<{ sessionValidateAccessCode: SessionLoginPayloadEntity }>;\ntype SessionLogoutData = Readonly<{ sessionLogout: SessionLoginPayloadEntity }>;\n\n/** The shared full-refreshed-payload selection for login/validate/logout; embeds `CartFragment`. */\nconst SessionLoginPayloadFragment = gql`\n fragment SessionLoginPayloadFragment on SessionLoginPayload {\n __typename\n session {\n __typename\n id\n loggedIn\n canEditData\n isIdentified\n }\n cart {\n ...CartFragment\n }\n clientProfile {\n __typename\n id\n email\n firstName\n lastName\n phone\n document\n }\n clientPreferences {\n __typename\n id\n optinNewsLetter\n savePersonalData\n }\n userErrors {\n code\n message\n }\n }\n ${CartFragment}\n`;\n\nexport const SESSION_LOGIN_WITH_PASSWORD: TypedDocumentNode<\n SessionLoginWithPasswordData,\n { input: SessionPasswordLoginPayload }\n> = gql`\n mutation SessionLoginWithPassword($input: SessionPasswordLoginInput!) {\n sessionLoginWithPassword(input: $input) {\n ...SessionLoginPayloadFragment\n }\n }\n ${SessionLoginPayloadFragment}\n`;\n\nexport const SESSION_REQUEST_ACCESS_CODE: TypedDocumentNode<\n SessionRequestAccessCodeData,\n { input: SessionRequestAccessCodePayload }\n> = gql`\n mutation SessionRequestAccessCode($input: SessionRequestAccessCodeInput!) {\n sessionRequestAccessCode(input: $input) {\n __typename\n authenticationToken\n userErrors {\n code\n message\n }\n }\n }\n`;\n\nexport const SESSION_VALIDATE_ACCESS_CODE: TypedDocumentNode<\n SessionValidateAccessCodeData,\n { input: SessionValidateAccessCodePayload }\n> = gql`\n mutation SessionValidateAccessCode($input: SessionValidateAccessCodeInput!) {\n sessionValidateAccessCode(input: $input) {\n ...SessionLoginPayloadFragment\n }\n }\n ${SessionLoginPayloadFragment}\n`;\n\nexport const SESSION_LOGOUT: TypedDocumentNode<SessionLogoutData, Record<string, never>> = gql`\n mutation SessionLogout {\n sessionLogout {\n ...SessionLoginPayloadFragment\n }\n }\n ${SessionLoginPayloadFragment}\n`;\n"],"mappings":";;;;AAqFA,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCnC,aAAa;;AAGjB,MAAa,8BAGT,GAAG;;;;;;IAMH,4BAA4B;;AAGhC,MAAa,8BAGT,GAAG;;;;;;;;;;;;AAaP,MAAa,+BAGT,GAAG;;;;;;IAMH,4BAA4B;;AAGhC,MAAa,iBAA8E,GAAG;;;;;;IAM1F,4BAA4B"}
@@ -0,0 +1,6 @@
1
+ import { SessionFragmentFragment } from "../generated/graphql.js";
2
+ import { TypedDocumentNode } from "@apollo/client";
3
+ //#region src/sdk/session/operations.d.ts
4
+ export type SessionEntity = SessionFragmentFragment;
5
+ //#endregion
6
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1,27 @@
1
+ import "../../core/dist/index.js";
2
+ import { SessionAccessCodeRequestResult, SessionPasswordLoginPayload, SessionRequestAccessCodePayload, SessionUserError, SessionValidateAccessCodePayload } from "./auth-operations.js";
3
+ //#region src/sdk/session/use-session-actions.d.ts
4
+ /**
5
+ * The `session` action namespace — the one sanctioned client write surface for authentication
6
+ * (specs/fspg-880-session-action-namespace.md, docs/storefront-core/adr-0010-actions-own-the-write-side.md).
7
+ *
8
+ * Every action is async/pessimistic (Decision 1): the handler awaits the mutation and only the
9
+ * server-confirmed payload changes the cache — authentication cannot be guessed client-side. The
10
+ * handlers are stateless: no reactive vars, no module state; the access-code `authenticationToken`
11
+ * is returned to the caller, which owns it as UI flow state (Decision 4). Each action resolves its
12
+ * payload `userErrors` (empty on success) and never throws for expected outcomes; infrastructure
13
+ * failures resolve as the synthetic `NETWORK_ERROR` (Decision 5). The credentials pass through
14
+ * mutation variables only — never logged, never stored.
15
+ */
16
+ export type SessionActions = Readonly<{
17
+ /** Password sign-in. Async/pessimistic; resolves the payload userErrors (empty on success). */
18
+ loginWithPassword: (payload: SessionPasswordLoginPayload) => Promise<readonly SessionUserError[]>;
19
+ /** Email an access code; resolves the opaque authenticationToken to round-trip into validate. */
20
+ requestAccessCode: (payload: SessionRequestAccessCodePayload) => Promise<SessionAccessCodeRequestResult>;
21
+ /** Validate an access code + token; logs the shopper in exactly as a password login would. */
22
+ validateAccessCode: (payload: SessionValidateAccessCodePayload) => Promise<readonly SessionUserError[]>;
23
+ /** Sign out. Idempotent for guests. */
24
+ logout: () => Promise<readonly SessionUserError[]>;
25
+ }>;
26
+ //#endregion
27
+ //# sourceMappingURL=use-session-actions.d.ts.map
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { defineActions } from "../../core/dist/actions/registry.js";
3
+ import "../../core/dist/index.js";
4
+ import { SESSION_LOGIN_WITH_PASSWORD, SESSION_LOGOUT, SESSION_REQUEST_ACCESS_CODE, SESSION_VALIDATE_ACCESS_CODE } from "./auth-operations.js";
5
+ import { useMutation } from "@apollo/client/react";
6
+ import { useCallback, useMemo } from "react";
7
+ //#region src/sdk/session/use-session-actions.ts
8
+ const NETWORK_USER_ERROR = {
9
+ code: "NETWORK_ERROR",
10
+ message: "Unable to complete the request. Please try again."
11
+ };
12
+ /**
13
+ * The `session` namespace hook. Registered with the first-party action registry via `sessionActions`
14
+ * below; the compiler-emitted `SessionActionProvider` calls it and threads the narrowed methods into
15
+ * each consumer's `$actions.session`. Login/validate/logout refresh the session purely through the
16
+ * normalized-cache merge of the mutation response (Decision 2) — no refetch, no imperative write.
17
+ */
18
+ function useSessionActions() {
19
+ const [loginMutation] = useMutation(SESSION_LOGIN_WITH_PASSWORD);
20
+ const [requestMutation] = useMutation(SESSION_REQUEST_ACCESS_CODE);
21
+ const [validateMutation] = useMutation(SESSION_VALIDATE_ACCESS_CODE);
22
+ const [logoutMutation] = useMutation(SESSION_LOGOUT);
23
+ const loginWithPassword = useCallback(async (payload) => {
24
+ try {
25
+ return (await loginMutation({ variables: { input: payload } })).data?.sessionLoginWithPassword.userErrors ?? [];
26
+ } catch (error) {
27
+ console.error("[session.loginWithPassword] sessionLoginWithPassword failed", error);
28
+ return [NETWORK_USER_ERROR];
29
+ }
30
+ }, [loginMutation]);
31
+ const requestAccessCode = useCallback(async (payload) => {
32
+ try {
33
+ const data = (await requestMutation({ variables: { input: payload } })).data?.sessionRequestAccessCode;
34
+ return {
35
+ authenticationToken: data?.authenticationToken ?? null,
36
+ userErrors: data?.userErrors ?? []
37
+ };
38
+ } catch (error) {
39
+ console.error("[session.requestAccessCode] sessionRequestAccessCode failed", error);
40
+ return {
41
+ authenticationToken: null,
42
+ userErrors: [NETWORK_USER_ERROR]
43
+ };
44
+ }
45
+ }, [requestMutation]);
46
+ const validateAccessCode = useCallback(async (payload) => {
47
+ try {
48
+ return (await validateMutation({ variables: { input: payload } })).data?.sessionValidateAccessCode.userErrors ?? [];
49
+ } catch (error) {
50
+ console.error("[session.validateAccessCode] sessionValidateAccessCode failed", error);
51
+ return [NETWORK_USER_ERROR];
52
+ }
53
+ }, [validateMutation]);
54
+ const logout = useCallback(async () => {
55
+ try {
56
+ return (await logoutMutation()).data?.sessionLogout.userErrors ?? [];
57
+ } catch (error) {
58
+ console.error("[session.logout] sessionLogout failed", error);
59
+ return [NETWORK_USER_ERROR];
60
+ }
61
+ }, [logoutMutation]);
62
+ return useMemo(() => ({
63
+ loginWithPassword,
64
+ requestAccessCode,
65
+ validateAccessCode,
66
+ logout
67
+ }), [
68
+ loginWithPassword,
69
+ requestAccessCode,
70
+ validateAccessCode,
71
+ logout
72
+ ]);
73
+ }
74
+ defineActions({
75
+ namespace: "session",
76
+ description: "Mutation-backed authentication writes against the VTEX ID session (login, access code, logout).",
77
+ provider: {
78
+ name: "SessionActionProvider",
79
+ importPath: "@vtex/faststore/internal/client"
80
+ },
81
+ methods: {
82
+ loginWithPassword: {
83
+ description: "Sign in with email and password (async/pessimistic). Resolves the payload userErrors.",
84
+ payload: [{
85
+ name: "email",
86
+ type: "string"
87
+ }, {
88
+ name: "password",
89
+ type: "string"
90
+ }]
91
+ },
92
+ requestAccessCode: {
93
+ description: "Email the shopper an access code; resolves the opaque authenticationToken to round-trip.",
94
+ payload: [{
95
+ name: "email",
96
+ type: "string"
97
+ }]
98
+ },
99
+ validateAccessCode: {
100
+ description: "Validate an access code with its authenticationToken (async/pessimistic); logs the shopper in.",
101
+ payload: [
102
+ {
103
+ name: "email",
104
+ type: "string"
105
+ },
106
+ {
107
+ name: "accessCode",
108
+ type: "string"
109
+ },
110
+ {
111
+ name: "authenticationToken",
112
+ type: "string"
113
+ }
114
+ ]
115
+ },
116
+ logout: {
117
+ description: "Sign out, clearing the auth cookies (async/pessimistic). Idempotent for guests.",
118
+ payload: []
119
+ }
120
+ },
121
+ use: useSessionActions
122
+ });
123
+ //#endregion
124
+ export { useSessionActions };
125
+
126
+ //# sourceMappingURL=use-session-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-session-actions.js","names":[],"sources":["../../../src/sdk/session/use-session-actions.ts"],"sourcesContent":["'use client';\n\nimport { useMutation } from '@apollo/client/react';\nimport { defineActions } from '@vtex/fs-core';\nimport { useCallback, useMemo } from 'react';\nimport {\n SESSION_LOGIN_WITH_PASSWORD,\n SESSION_LOGOUT,\n SESSION_REQUEST_ACCESS_CODE,\n SESSION_VALIDATE_ACCESS_CODE,\n type SessionAccessCodeRequestResult,\n type SessionPasswordLoginPayload,\n type SessionRequestAccessCodePayload,\n type SessionUserError,\n type SessionValidateAccessCodePayload,\n} from './auth-operations.js';\n\n/**\n * The `session` action namespace — the one sanctioned client write surface for authentication\n * (specs/fspg-880-session-action-namespace.md, docs/storefront-core/adr-0010-actions-own-the-write-side.md).\n *\n * Every action is async/pessimistic (Decision 1): the handler awaits the mutation and only the\n * server-confirmed payload changes the cache — authentication cannot be guessed client-side. The\n * handlers are stateless: no reactive vars, no module state; the access-code `authenticationToken`\n * is returned to the caller, which owns it as UI flow state (Decision 4). Each action resolves its\n * payload `userErrors` (empty on success) and never throws for expected outcomes; infrastructure\n * failures resolve as the synthetic `NETWORK_ERROR` (Decision 5). The credentials pass through\n * mutation variables only — never logged, never stored.\n */\nexport type SessionActions = Readonly<{\n /** Password sign-in. Async/pessimistic; resolves the payload userErrors (empty on success). */\n loginWithPassword: (payload: SessionPasswordLoginPayload) => Promise<readonly SessionUserError[]>;\n /** Email an access code; resolves the opaque authenticationToken to round-trip into validate. */\n requestAccessCode: (payload: SessionRequestAccessCodePayload) => Promise<SessionAccessCodeRequestResult>;\n /** Validate an access code + token; logs the shopper in exactly as a password login would. */\n validateAccessCode: (payload: SessionValidateAccessCodePayload) => Promise<readonly SessionUserError[]>;\n /** Sign out. Idempotent for guests. */\n logout: () => Promise<readonly SessionUserError[]>;\n}>;\n\nconst NETWORK_USER_ERROR: SessionUserError = {\n code: 'NETWORK_ERROR',\n message: 'Unable to complete the request. Please try again.',\n};\n\n/**\n * The `session` namespace hook. Registered with the first-party action registry via `sessionActions`\n * below; the compiler-emitted `SessionActionProvider` calls it and threads the narrowed methods into\n * each consumer's `$actions.session`. Login/validate/logout refresh the session purely through the\n * normalized-cache merge of the mutation response (Decision 2) — no refetch, no imperative write.\n */\nexport function useSessionActions(): SessionActions {\n const [loginMutation] = useMutation(SESSION_LOGIN_WITH_PASSWORD);\n const [requestMutation] = useMutation(SESSION_REQUEST_ACCESS_CODE);\n const [validateMutation] = useMutation(SESSION_VALIDATE_ACCESS_CODE);\n const [logoutMutation] = useMutation(SESSION_LOGOUT);\n\n const loginWithPassword = useCallback<SessionActions['loginWithPassword']>(\n async (payload) => {\n try {\n const result = await loginMutation({ variables: { input: payload } });\n return result.data?.sessionLoginWithPassword.userErrors ?? [];\n } catch (error) {\n console.error('[session.loginWithPassword] sessionLoginWithPassword failed', error);\n return [NETWORK_USER_ERROR];\n }\n },\n [loginMutation],\n );\n\n const requestAccessCode = useCallback<SessionActions['requestAccessCode']>(\n async (payload) => {\n try {\n const result = await requestMutation({ variables: { input: payload } });\n const data = result.data?.sessionRequestAccessCode;\n return { authenticationToken: data?.authenticationToken ?? null, userErrors: data?.userErrors ?? [] };\n } catch (error) {\n console.error('[session.requestAccessCode] sessionRequestAccessCode failed', error);\n return { authenticationToken: null, userErrors: [NETWORK_USER_ERROR] };\n }\n },\n [requestMutation],\n );\n\n const validateAccessCode = useCallback<SessionActions['validateAccessCode']>(\n async (payload) => {\n try {\n const result = await validateMutation({ variables: { input: payload } });\n return result.data?.sessionValidateAccessCode.userErrors ?? [];\n } catch (error) {\n console.error('[session.validateAccessCode] sessionValidateAccessCode failed', error);\n return [NETWORK_USER_ERROR];\n }\n },\n [validateMutation],\n );\n\n const logout = useCallback<SessionActions['logout']>(async () => {\n try {\n const result = await logoutMutation();\n return result.data?.sessionLogout.userErrors ?? [];\n } catch (error) {\n console.error('[session.logout] sessionLogout failed', error);\n return [NETWORK_USER_ERROR];\n }\n }, [logoutMutation]);\n\n return useMemo(\n () => ({ loginWithPassword, requestAccessCode, validateAccessCode, logout }),\n [loginWithPassword, requestAccessCode, validateAccessCode, logout],\n );\n}\n\n/**\n * Declares the `session` action namespace — the single source of truth for its method/payload\n * metadata, runtime provider, and `use` hook (mirrors `cartActions`). The native catalog builder\n * (`scripts/build-catalog.mjs`) statically reads this call to emit `actions.json`; at runtime\n * `SessionActionProvider` calls `useSessionActions` directly.\n */\nexport const sessionActions = defineActions({\n namespace: 'session',\n description: 'Mutation-backed authentication writes against the VTEX ID session (login, access code, logout).',\n provider: { name: 'SessionActionProvider', importPath: '@vtex/faststore/internal/client' },\n methods: {\n loginWithPassword: {\n description: 'Sign in with email and password (async/pessimistic). Resolves the payload userErrors.',\n payload: [\n { name: 'email', type: 'string' },\n { name: 'password', type: 'string' },\n ],\n },\n requestAccessCode: {\n description: 'Email the shopper an access code; resolves the opaque authenticationToken to round-trip.',\n payload: [{ name: 'email', type: 'string' }],\n },\n validateAccessCode: {\n description: 'Validate an access code with its authenticationToken (async/pessimistic); logs the shopper in.',\n payload: [\n { name: 'email', type: 'string' },\n { name: 'accessCode', type: 'string' },\n { name: 'authenticationToken', type: 'string' },\n ],\n },\n logout: {\n description: 'Sign out, clearing the auth cookies (async/pessimistic). Idempotent for guests.',\n payload: [],\n },\n },\n use: useSessionActions,\n});\n"],"mappings":";;;;;;;AAwCA,MAAM,qBAAuC;CAC3C,MAAM;CACN,SAAS;AACX;;;;;;;AAQA,SAAgB,oBAAoC;CAClD,MAAM,CAAC,iBAAiB,YAAY,2BAA2B;CAC/D,MAAM,CAAC,mBAAmB,YAAY,2BAA2B;CACjE,MAAM,CAAC,oBAAoB,YAAY,4BAA4B;CACnE,MAAM,CAAC,kBAAkB,YAAY,cAAc;CAEnD,MAAM,oBAAoB,YACxB,OAAO,YAAY;EACjB,IAAI;GAEF,QAAO,MADc,cAAc,EAAE,WAAW,EAAE,OAAO,QAAQ,EAAE,CAAC,EAAA,CACtD,MAAM,yBAAyB,cAAc,CAAC;EAC9D,SAAS,OAAO;GACd,QAAQ,MAAM,+DAA+D,KAAK;GAClF,OAAO,CAAC,kBAAkB;EAC5B;CACF,GACA,CAAC,aAAa,CAChB;CAEA,MAAM,oBAAoB,YACxB,OAAO,YAAY;EACjB,IAAI;GAEF,MAAM,QAAO,MADQ,gBAAgB,EAAE,WAAW,EAAE,OAAO,QAAQ,EAAE,CAAC,EAAA,CAClD,MAAM;GAC1B,OAAO;IAAE,qBAAqB,MAAM,uBAAuB;IAAM,YAAY,MAAM,cAAc,CAAC;GAAE;EACtG,SAAS,OAAO;GACd,QAAQ,MAAM,+DAA+D,KAAK;GAClF,OAAO;IAAE,qBAAqB;IAAM,YAAY,CAAC,kBAAkB;GAAE;EACvE;CACF,GACA,CAAC,eAAe,CAClB;CAEA,MAAM,qBAAqB,YACzB,OAAO,YAAY;EACjB,IAAI;GAEF,QAAO,MADc,iBAAiB,EAAE,WAAW,EAAE,OAAO,QAAQ,EAAE,CAAC,EAAA,CACzD,MAAM,0BAA0B,cAAc,CAAC;EAC/D,SAAS,OAAO;GACd,QAAQ,MAAM,iEAAiE,KAAK;GACpF,OAAO,CAAC,kBAAkB;EAC5B;CACF,GACA,CAAC,gBAAgB,CACnB;CAEA,MAAM,SAAS,YAAsC,YAAY;EAC/D,IAAI;GAEF,QAAO,MADc,eAAe,EAAA,CACtB,MAAM,cAAc,cAAc,CAAC;EACnD,SAAS,OAAO;GACd,QAAQ,MAAM,yCAAyC,KAAK;GAC5D,OAAO,CAAC,kBAAkB;EAC5B;CACF,GAAG,CAAC,cAAc,CAAC;CAEnB,OAAO,eACE;EAAE;EAAmB;EAAmB;EAAoB;CAAO,IAC1E;EAAC;EAAmB;EAAmB;EAAoB;CAAM,CACnE;AACF;AAQ8B,cAAc;CAC1C,WAAW;CACX,aAAa;CACb,UAAU;EAAE,MAAM;EAAyB,YAAY;CAAkC;CACzF,SAAS;EACP,mBAAmB;GACjB,aAAa;GACb,SAAS,CACP;IAAE,MAAM;IAAS,MAAM;GAAS,GAChC;IAAE,MAAM;IAAY,MAAM;GAAS,CACrC;EACF;EACA,mBAAmB;GACjB,aAAa;GACb,SAAS,CAAC;IAAE,MAAM;IAAS,MAAM;GAAS,CAAC;EAC7C;EACA,oBAAoB;GAClB,aAAa;GACb,SAAS;IACP;KAAE,MAAM;KAAS,MAAM;IAAS;IAChC;KAAE,MAAM;KAAc,MAAM;IAAS;IACrC;KAAE,MAAM;KAAuB,MAAM;IAAS;GAChD;EACF;EACA,QAAQ;GACN,aAAa;GACb,SAAS,CAAC;EACZ;CACF;CACA,KAAK;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CartShippingSimulateInput } from "../generated/graphql.js";
2
+ import { TypedDocumentNode } from "@apollo/client";
3
+ export type { CartShippingSimulateInput };
@@ -0,0 +1,33 @@
1
+ import { graphql } from "../generated/gql.js";
2
+ //#region src/sdk/shipping/cart-operations.ts
3
+ const CART_SHIPPING_SIMULATION = graphql(`
4
+ query CartShippingSimulation($input: CartShippingSimulateInput!) {
5
+ cartShippingSimulation(input: $input) {
6
+ shippingOptions {
7
+ id
8
+ name
9
+ channel
10
+ shippingEstimate {
11
+ value
12
+ unit
13
+ }
14
+ price {
15
+ amount
16
+ currencyCode
17
+ }
18
+ listPrice {
19
+ amount
20
+ currencyCode
21
+ }
22
+ }
23
+ userErrors {
24
+ code
25
+ message
26
+ }
27
+ }
28
+ }
29
+ `);
30
+ //#endregion
31
+ export { CART_SHIPPING_SIMULATION };
32
+
33
+ //# sourceMappingURL=cart-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-operations.js","names":[],"sources":["../../../src/sdk/shipping/cart-operations.ts"],"sourcesContent":["import type { TypedDocumentNode } from '@apollo/client';\nimport { graphql } from '../generated/gql.js';\nimport type { CartShippingSimulationQuery, CartShippingSimulationQueryVariables } from '../generated/graphql.js';\n\n/**\n * Cart-scoped shipping-simulation GraphQL operation.\n *\n * Authored via the codegen `graphql()` factory so codegen scans this document and generates\n * `CartShippingSimulationQuery`, `CartShippingSimulationQueryVariables`, and the\n * `CartShippingSimulateInput` input type. The input carries a destination only; the cart's items\n * are sourced server-side from the `x-order-form-id` context. The selection set mirrors the PDP\n * operation so `useCartShippingSimulation` reuses the same option/estimate/error mappers.\n */\n\n// ---------------------------------------------------------------------------\n// Input type — direct re-export from codegen\n// ---------------------------------------------------------------------------\n\nexport type { CartShippingSimulateInput } from '../generated/graphql.js';\n\n// ---------------------------------------------------------------------------\n// Query operation\n// ---------------------------------------------------------------------------\n\nexport const CART_SHIPPING_SIMULATION: TypedDocumentNode<\n CartShippingSimulationQuery,\n CartShippingSimulationQueryVariables\n> = graphql(`\n query CartShippingSimulation($input: CartShippingSimulateInput!) {\n cartShippingSimulation(input: $input) {\n shippingOptions {\n id\n name\n channel\n shippingEstimate {\n value\n unit\n }\n price {\n amount\n currencyCode\n }\n listPrice {\n amount\n currencyCode\n }\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n"],"mappings":";;AAwBA,MAAa,2BAGT,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BX"}
@@ -0,0 +1,3 @@
1
+ import { ShippingSimulateInput } from "../generated/graphql.js";
2
+ import { TypedDocumentNode } from "@apollo/client";
3
+ export type { ShippingSimulateInput };
@@ -0,0 +1,33 @@
1
+ import { graphql } from "../generated/gql.js";
2
+ //#region src/sdk/shipping/operations.ts
3
+ const SHIPPING_SIMULATION = graphql(`
4
+ query ShippingSimulation($input: ShippingSimulateInput!) {
5
+ shippingSimulation(input: $input) {
6
+ shippingOptions {
7
+ id
8
+ name
9
+ channel
10
+ shippingEstimate {
11
+ value
12
+ unit
13
+ }
14
+ price {
15
+ amount
16
+ currencyCode
17
+ }
18
+ listPrice {
19
+ amount
20
+ currencyCode
21
+ }
22
+ }
23
+ userErrors {
24
+ code
25
+ message
26
+ }
27
+ }
28
+ }
29
+ `);
30
+ //#endregion
31
+ export { SHIPPING_SIMULATION };
32
+
33
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","names":[],"sources":["../../../src/sdk/shipping/operations.ts"],"sourcesContent":["import type { TypedDocumentNode } from '@apollo/client';\nimport { graphql } from '../generated/gql.js';\nimport type { ShippingSimulationQuery, ShippingSimulationQueryVariables } from '../generated/graphql.js';\n\n/**\n * Shipping-simulation GraphQL operation (FSPG-815 / specs/fspg-815-minicart-wire-shipping-simulator-pdp.md).\n *\n * Authored via the codegen `graphql()` factory so codegen scans this document and generates\n * `ShippingSimulationQuery`, `ShippingSimulationQueryVariables`, and the `ShippingSimulateInput`\n * input type (Decision 2). The selection set carries exactly the fields the simulator's option\n * leaves consume; `useShippingSimulation` maps it onto the simulator's domain payload.\n */\n\n// ---------------------------------------------------------------------------\n// Input type — direct re-export from codegen\n// ---------------------------------------------------------------------------\n\nexport type { ShippingSimulateInput } from '../generated/graphql.js';\n\n// ---------------------------------------------------------------------------\n// Query operation\n// ---------------------------------------------------------------------------\n\nexport const SHIPPING_SIMULATION: TypedDocumentNode<ShippingSimulationQuery, ShippingSimulationQueryVariables> =\n graphql(`\n query ShippingSimulation($input: ShippingSimulateInput!) {\n shippingSimulation(input: $input) {\n shippingOptions {\n id\n name\n channel\n shippingEstimate {\n value\n unit\n }\n price {\n amount\n currencyCode\n }\n listPrice {\n amount\n currencyCode\n }\n }\n userErrors {\n code\n message\n }\n }\n }\n`);\n"],"mappings":";;AAuBA,MAAa,sBACX,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BT"}
@@ -0,0 +1,24 @@
1
+ import "../cart/operations.js";
2
+ import { TypedDocumentNode } from "@apollo/client";
3
+ //#region src/sdk/shipping/option-select-operations.d.ts
4
+ /**
5
+ * `shippingOptionSelect` mutation document (specs/delivery-options-step.md, T3).
6
+ *
7
+ * Authored with the hand `gql` tag — the codegen `graphql()` factory is reserved for the reactive
8
+ * read path (`shipping/operations.ts`) — and explicitly excluded from the codegen `documents` glob
9
+ * (see `codegen.ts`): the `gql` tag alone is still plucked by `graphql-codegen`, which would
10
+ * duplicate these hand-written types in `sdk/generated/`. Mirrors the `session`/`identity`
11
+ * action-mutation convention (hand-typed `TypedDocumentNode`s).
12
+ *
13
+ * Selects `cart { ...CartFragment }` alongside `shipping` so the normalized Apollo cache updates
14
+ * the cart totalizer in the same round trip (T1 epic note). Both `shipping` and its nested
15
+ * `options` select `id`/`__typename` so `InMemoryCache` normalizes them as the same entities the
16
+ * reactive `DeliveryOptionsData` fragment reads — required for the mutation response to flow back
17
+ * into the reactive UI with no refetch (Decision 1/Decision 5).
18
+ */
19
+ export type ShippingOptionSelectUserError = Readonly<{
20
+ code: string;
21
+ message: string;
22
+ }>;
23
+ //#endregion
24
+ //# sourceMappingURL=option-select-operations.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { gql } from "../graphql-tag.js";
2
+ import { CartFragment } from "../cart/operations.js";
3
+ //#region src/sdk/shipping/option-select-operations.ts
4
+ const SHIPPING_OPTION_SELECT = gql`
5
+ mutation ShippingOptionSelect($input: ShippingOptionSelectInput!) {
6
+ shippingOptionSelect(input: $input) {
7
+ __typename
8
+ shipping {
9
+ __typename
10
+ id
11
+ options {
12
+ __typename
13
+ id
14
+ name
15
+ channel
16
+ shippingEstimate {
17
+ value
18
+ unit
19
+ }
20
+ price {
21
+ amount
22
+ currencyCode
23
+ }
24
+ listPrice {
25
+ amount
26
+ currencyCode
27
+ }
28
+ }
29
+ selectedOptionId
30
+ }
31
+ cart {
32
+ ...CartFragment
33
+ }
34
+ userErrors {
35
+ code
36
+ message
37
+ }
38
+ }
39
+ }
40
+ ${CartFragment}
41
+ `;
42
+ //#endregion
43
+ export { SHIPPING_OPTION_SELECT };
44
+
45
+ //# sourceMappingURL=option-select-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"option-select-operations.js","names":[],"sources":["../../../src/sdk/shipping/option-select-operations.ts"],"sourcesContent":["import type { TypedDocumentNode } from '@apollo/client';\nimport { type CartEntity, CartFragment } from '../cart/operations.js';\nimport { gql } from '../graphql-tag.js';\n\n/**\n * `shippingOptionSelect` mutation document (specs/delivery-options-step.md, T3).\n *\n * Authored with the hand `gql` tag — the codegen `graphql()` factory is reserved for the reactive\n * read path (`shipping/operations.ts`) — and explicitly excluded from the codegen `documents` glob\n * (see `codegen.ts`): the `gql` tag alone is still plucked by `graphql-codegen`, which would\n * duplicate these hand-written types in `sdk/generated/`. Mirrors the `session`/`identity`\n * action-mutation convention (hand-typed `TypedDocumentNode`s).\n *\n * Selects `cart { ...CartFragment }` alongside `shipping` so the normalized Apollo cache updates\n * the cart totalizer in the same round trip (T1 epic note). Both `shipping` and its nested\n * `options` select `id`/`__typename` so `InMemoryCache` normalizes them as the same entities the\n * reactive `DeliveryOptionsData` fragment reads — required for the mutation response to flow back\n * into the reactive UI with no refetch (Decision 1/Decision 5).\n */\n\nexport type ShippingOptionSelectUserError = Readonly<{ code: string; message: string }>;\n\nexport type ShippingOptionSelectInput = Readonly<{ optionId: string }>;\n\ntype ShippingOptionEntity = Readonly<{\n __typename?: 'ShippingOption';\n id: string;\n name: string;\n channel: string;\n shippingEstimate: Readonly<{ __typename?: 'ShippingEstimate'; value: number; unit: string }>;\n price: Readonly<{ __typename?: 'Money'; amount: number; currencyCode: string }>;\n listPrice: Readonly<{ __typename?: 'Money'; amount: number; currencyCode: string }>;\n}>;\n\ntype ShippingEntity = Readonly<{\n __typename?: 'Shipping';\n id: string;\n options: readonly ShippingOptionEntity[];\n selectedOptionId: string | null;\n}>;\n\ntype ShippingOptionSelectPayloadEntity = Readonly<{\n __typename?: 'ShippingOptionSelectPayload';\n shipping: ShippingEntity | null;\n cart: CartEntity | null;\n userErrors: readonly ShippingOptionSelectUserError[];\n}>;\n\ntype ShippingOptionSelectMutation = Readonly<{ shippingOptionSelect: ShippingOptionSelectPayloadEntity }>;\n\ntype ShippingOptionSelectMutationVariables = Readonly<{ input: ShippingOptionSelectInput }>;\n\nexport const SHIPPING_OPTION_SELECT: TypedDocumentNode<\n ShippingOptionSelectMutation,\n ShippingOptionSelectMutationVariables\n> = gql`\n mutation ShippingOptionSelect($input: ShippingOptionSelectInput!) {\n shippingOptionSelect(input: $input) {\n __typename\n shipping {\n __typename\n id\n options {\n __typename\n id\n name\n channel\n shippingEstimate {\n value\n unit\n }\n price {\n amount\n currencyCode\n }\n listPrice {\n amount\n currencyCode\n }\n }\n selectedOptionId\n }\n cart {\n ...CartFragment\n }\n userErrors {\n code\n message\n }\n }\n }\n ${CartFragment}\n`;\n"],"mappings":";;;AAoDA,MAAa,yBAGT,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoCH,aAAa"}
@@ -0,0 +1,41 @@
1
+ //#region src/sdk/shipping/request-timeout.ts
2
+ /**
3
+ * Bounds the default shipping-simulation SDK request (specs/shipping-simulation-request-timeout.md).
4
+ *
5
+ * The default `useShippingSimulation` / `useCartShippingSimulation` callbacks run an imperative
6
+ * `client.query` with no time bound, so a logistics transport that never settles leaves the
7
+ * simulator Root stuck on `loading` forever. `withRequestTimeout` races the request against a finite
8
+ * timer: when the timer wins it aborts the in-flight request (via the `AbortSignal` threaded into
9
+ * `context.fetchOptions`) and rejects, which each hook's existing `catch` collapses to the same
10
+ * `UNKNOWN` userError as any other failure — so the timeout reuses the established error path and the
11
+ * Root leaves `loading` for `error`.
12
+ *
13
+ * The abort is best-effort: it cancels the network request only when the Apollo link chain honors the
14
+ * signal (`HttpLink` does; `MockLink` in tests does not). Settlement never depends on it — the timer
15
+ * race guarantees the returned promise resolves or rejects within `timeoutMs` regardless.
16
+ */
17
+ const SHIPPING_SIMULATION_TIMEOUT_MS = 1e4;
18
+ var ShippingSimulationTimeoutError = class extends Error {
19
+ constructor() {
20
+ super("Shipping simulation request timed out.");
21
+ this.name = "ShippingSimulationTimeoutError";
22
+ }
23
+ };
24
+ function withRequestTimeout(run, timeoutMs = SHIPPING_SIMULATION_TIMEOUT_MS) {
25
+ const controller = new AbortController();
26
+ let timer;
27
+ const timeout = new Promise((_, reject) => {
28
+ timer = setTimeout(() => {
29
+ controller.abort();
30
+ reject(new ShippingSimulationTimeoutError());
31
+ }, timeoutMs);
32
+ });
33
+ const request = (async () => run(controller.signal))();
34
+ return Promise.race([request, timeout]).finally(() => {
35
+ clearTimeout(timer);
36
+ });
37
+ }
38
+ //#endregion
39
+ export { SHIPPING_SIMULATION_TIMEOUT_MS, ShippingSimulationTimeoutError, withRequestTimeout };
40
+
41
+ //# sourceMappingURL=request-timeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-timeout.js","names":[],"sources":["../../../src/sdk/shipping/request-timeout.ts"],"sourcesContent":["/**\n * Bounds the default shipping-simulation SDK request (specs/shipping-simulation-request-timeout.md).\n *\n * The default `useShippingSimulation` / `useCartShippingSimulation` callbacks run an imperative\n * `client.query` with no time bound, so a logistics transport that never settles leaves the\n * simulator Root stuck on `loading` forever. `withRequestTimeout` races the request against a finite\n * timer: when the timer wins it aborts the in-flight request (via the `AbortSignal` threaded into\n * `context.fetchOptions`) and rejects, which each hook's existing `catch` collapses to the same\n * `UNKNOWN` userError as any other failure — so the timeout reuses the established error path and the\n * Root leaves `loading` for `error`.\n *\n * The abort is best-effort: it cancels the network request only when the Apollo link chain honors the\n * signal (`HttpLink` does; `MockLink` in tests does not). Settlement never depends on it — the timer\n * race guarantees the returned promise resolves or rejects within `timeoutMs` regardless.\n */\n\n// A generous safety net: well above any healthy round-trip and above the resolver's own upstream\n// budget, so it fires only on a genuine hang, not on a merely slow-but-healthy response.\nexport const SHIPPING_SIMULATION_TIMEOUT_MS = 10_000;\n\nexport class ShippingSimulationTimeoutError extends Error {\n constructor() {\n super('Shipping simulation request timed out.');\n this.name = 'ShippingSimulationTimeoutError';\n }\n}\n\nexport function withRequestTimeout<T>(\n run: (signal: AbortSignal) => Promise<T>,\n // Defaults to the shared constant; no runtime caller overrides it today. Kept as the injection\n // point for a future per-account configurable timeout, once a per-account config source exists.\n timeoutMs: number = SHIPPING_SIMULATION_TIMEOUT_MS,\n): Promise<T> {\n const controller = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n controller.abort();\n reject(new ShippingSimulationTimeoutError());\n }, timeoutMs);\n });\n\n // `run` is invoked inside an async wrapper so a synchronous throw becomes a rejection the race can\n // observe. Called bare, it would escape before `finally` is attached, leaving the timer armed and\n // the timeout's own rejection unhandled.\n const request = (async () => run(controller.signal))();\n\n return Promise.race([request, timeout]).finally(() => {\n clearTimeout(timer);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,iCAAiC;AAE9C,IAAa,iCAAb,cAAoD,MAAM;CACxD,cAAc;EACZ,MAAM,wCAAwC;EAC9C,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,mBACd,KAGA,YAAoB,gCACR;CACZ,MAAM,aAAa,IAAI,gBAAgB;CACvC,IAAI;CAEJ,MAAM,UAAU,IAAI,SAAgB,GAAG,WAAW;EAChD,QAAQ,iBAAiB;GACvB,WAAW,MAAM;GACjB,OAAO,IAAI,+BAA+B,CAAC;EAC7C,GAAG,SAAS;CACd,CAAC;CAKD,MAAM,WAAW,YAAY,IAAI,WAAW,MAAM,EAAA,CAAG;CAErD,OAAO,QAAQ,KAAK,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,cAAc;EACpD,aAAa,KAAK;CACpB,CAAC;AACH"}
@@ -0,0 +1,38 @@
1
+ import "../cart/operations.js";
2
+ import { TypedDocumentNode } from "@apollo/client";
3
+ //#region src/sdk/shipping/shipping-operations.d.ts
4
+ /**
5
+ * Shipping address mutation documents (specs/shipping-address-step.md, US-7).
6
+ *
7
+ * Authored with the hand `gql` tag — the codegen `graphql()` factory is reserved for the reactive
8
+ * read path (`operations.ts`) — and explicitly excluded from the codegen `documents` glob (see
9
+ * `codegen.ts`): the `gql` tag alone is still plucked by `graphql-codegen`, which would duplicate
10
+ * these hand-written types in `sdk/generated/`. The mutation stays hand-typed as a
11
+ * `TypedDocumentNode` (Decision 3 in the spec). The payload projects the full refreshed `shipping`
12
+ * and `cart` state, so the response write into the cache *is* the post-update refresh: `Shipping`'s
13
+ * reactive read flips with no refetch and no imperative cache write.
14
+ *
15
+ * Failures follow ADR-00007's two-path contract: domain outcomes arrive as payload `userErrors`
16
+ * (`ShippingAddressUpdateError`); transport and top-level GraphQL failures are infrastructure,
17
+ * mapped by the handlers in `use-shipping-actions.ts` to the one client-synthesized code,
18
+ * `NETWORK_USER_ERROR`.
19
+ */
20
+ /** A typed address-update failure; NETWORK_USER_ERROR is the one client-synthesized code. */
21
+ export type ShippingAddressUpdateErrorEntity = Readonly<{
22
+ code: string;
23
+ message: string;
24
+ }>;
25
+ export type ShippingAddressInput = Readonly<{
26
+ savedAddressId?: string;
27
+ recipientName: string;
28
+ postalCode: string;
29
+ country: string;
30
+ street?: string;
31
+ number?: string;
32
+ complement?: string;
33
+ neighborhood?: string;
34
+ city?: string;
35
+ state?: string;
36
+ }>;
37
+ //#endregion
38
+ //# sourceMappingURL=shipping-operations.d.ts.map