@shopify/hydrogen 2026.10.0-preview.4 → 2026.10.0

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 (437) hide show
  1. package/dist/cli/index.mjs +23 -12
  2. package/dist/client/client.d.mts +18 -15
  3. package/dist/client/client.mjs +8 -3
  4. package/dist/client/client.mjs.map +1 -1
  5. package/dist/client/errors.d.mts +35 -13
  6. package/dist/client/errors.mjs +23 -13
  7. package/dist/client/errors.mjs.map +1 -1
  8. package/dist/client/types.d.mts +140 -90
  9. package/dist/core/analytics/cart-tracker.d.mts +19 -10
  10. package/dist/core/analytics/cart-tracker.mjs +18 -10
  11. package/dist/core/analytics/cart-tracker.mjs.map +1 -1
  12. package/dist/core/analytics/events.d.mts +17 -11
  13. package/dist/core/analytics/events.mjs +13 -4
  14. package/dist/core/analytics/events.mjs.map +1 -1
  15. package/dist/core/analytics/types.d.mts +207 -118
  16. package/dist/core/analytics/utils/flatten-connection.d.mts +11 -9
  17. package/dist/core/analytics/utils/flatten-connection.mjs +7 -6
  18. package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -1
  19. package/dist/core/cache/fetch-with-cache.d.mts +24 -4
  20. package/dist/core/cache/fetch-with-cache.mjs +17 -2
  21. package/dist/core/cache/fetch-with-cache.mjs.map +1 -1
  22. package/dist/core/cache/key.d.mts +2 -0
  23. package/dist/core/cache/key.mjs.map +1 -1
  24. package/dist/core/cache/run-with-cache.d.mts +56 -8
  25. package/dist/core/cache/run-with-cache.mjs +17 -6
  26. package/dist/core/cache/run-with-cache.mjs.map +1 -1
  27. package/dist/core/cache/store.d.mts +8 -6
  28. package/dist/core/cache/store.mjs.map +1 -1
  29. package/dist/core/cache/strategies.d.mts +27 -2
  30. package/dist/core/cache/strategies.mjs +6 -0
  31. package/dist/core/cache/strategies.mjs.map +1 -1
  32. package/dist/core/cart/actions.d.mts +37 -30
  33. package/dist/core/cart/actions.mjs +21 -9
  34. package/dist/core/cart/actions.mjs.map +1 -1
  35. package/dist/core/cart/attach-quantity-input.d.mts +8 -7
  36. package/dist/core/cart/attach-quantity-input.mjs +8 -7
  37. package/dist/core/cart/attach-quantity-input.mjs.map +1 -1
  38. package/dist/core/cart/buyer-identity-sync.d.mts +7 -6
  39. package/dist/core/cart/buyer-identity-sync.mjs.map +1 -1
  40. package/dist/core/cart/cart.d.mts +59 -46
  41. package/dist/core/cart/cart.mjs +46 -29
  42. package/dist/core/cart/cart.mjs.map +1 -1
  43. package/dist/core/cart/cookie.d.mts +8 -4
  44. package/dist/core/cart/cookie.mjs +8 -4
  45. package/dist/core/cart/cookie.mjs.map +1 -1
  46. package/dist/core/cart/form.d.mts +34 -20
  47. package/dist/core/cart/form.mjs +6 -4
  48. package/dist/core/cart/form.mjs.map +1 -1
  49. package/dist/core/cart/get-cart.d.mts +27 -15
  50. package/dist/core/cart/get-cart.mjs +13 -8
  51. package/dist/core/cart/get-cart.mjs.map +1 -1
  52. package/dist/core/cart/quantity.d.mts +16 -5
  53. package/dist/core/cart/quantity.mjs +16 -5
  54. package/dist/core/cart/quantity.mjs.map +1 -1
  55. package/dist/core/cart/queries.d.mts +25 -19
  56. package/dist/core/cart/queries.mjs +15 -1
  57. package/dist/core/cart/queries.mjs.map +1 -1
  58. package/dist/core/cart/server-handlers.d.mts +82 -45
  59. package/dist/core/cart/server-handlers.mjs +4 -0
  60. package/dist/core/cart/server-handlers.mjs.map +1 -1
  61. package/dist/core/cart/state.d.mts +110 -64
  62. package/dist/core/cart/state.mjs +24 -6
  63. package/dist/core/cart/state.mjs.map +1 -1
  64. package/dist/core/collection/collection.d.mts +52 -53
  65. package/dist/core/collection/collection.mjs +5 -3
  66. package/dist/core/collection/collection.mjs.map +1 -1
  67. package/dist/core/collection/reconciler.d.mts +23 -16
  68. package/dist/core/collection/reconciler.mjs +8 -4
  69. package/dist/core/collection/reconciler.mjs.map +1 -1
  70. package/dist/core/collection/state.d.mts +31 -26
  71. package/dist/core/collection/state.mjs +4 -3
  72. package/dist/core/collection/state.mjs.map +1 -1
  73. package/dist/core/collection/url.d.mts +70 -29
  74. package/dist/core/collection/url.mjs +63 -25
  75. package/dist/core/collection/url.mjs.map +1 -1
  76. package/dist/core/constants.d.mts +1 -0
  77. package/dist/core/constants.mjs +1 -0
  78. package/dist/core/constants.mjs.map +1 -1
  79. package/dist/core/logging/logging.d.mts +14 -8
  80. package/dist/core/logging/logging.mjs +15 -10
  81. package/dist/core/logging/logging.mjs.map +1 -1
  82. package/dist/core/logging/types.d.mts +28 -11
  83. package/dist/core/logging/types.mjs.map +1 -1
  84. package/dist/core/money/format.d.mts +6 -4
  85. package/dist/core/money/format.mjs +19 -9
  86. package/dist/core/money/format.mjs.map +1 -1
  87. package/dist/core/money/types.d.mts +41 -25
  88. package/dist/core/predictive-search/form.d.mts +37 -7
  89. package/dist/core/predictive-search/form.mjs +21 -3
  90. package/dist/core/predictive-search/form.mjs.map +1 -1
  91. package/dist/core/predictive-search/queries.d.mts +18 -30
  92. package/dist/core/predictive-search/queries.mjs +7 -3
  93. package/dist/core/predictive-search/queries.mjs.map +1 -1
  94. package/dist/core/predictive-search/search.d.mts +25 -27
  95. package/dist/core/predictive-search/search.mjs +20 -19
  96. package/dist/core/predictive-search/search.mjs.map +1 -1
  97. package/dist/core/predictive-search/server-handlers.d.mts +25 -26
  98. package/dist/core/predictive-search/server-handlers.mjs +4 -0
  99. package/dist/core/predictive-search/server-handlers.mjs.map +1 -1
  100. package/dist/core/predictive-search/store.d.mts +65 -24
  101. package/dist/core/predictive-search/store.mjs +12 -1
  102. package/dist/core/predictive-search/store.mjs.map +1 -1
  103. package/dist/core/predictive-search/url.d.mts +36 -37
  104. package/dist/core/predictive-search/url.mjs +14 -6
  105. package/dist/core/predictive-search/url.mjs.map +1 -1
  106. package/dist/core/product/form.d.mts +63 -16
  107. package/dist/core/product/form.mjs +8 -2
  108. package/dist/core/product/form.mjs.map +1 -1
  109. package/dist/core/product/options.d.mts +8 -10
  110. package/dist/core/product/options.mjs +8 -10
  111. package/dist/core/product/options.mjs.map +1 -1
  112. package/dist/core/product/product-form.d.mts +77 -29
  113. package/dist/core/product/product-form.mjs +32 -10
  114. package/dist/core/product/product-form.mjs.map +1 -1
  115. package/dist/core/product/state.d.mts +55 -32
  116. package/dist/core/product/url.d.mts +19 -13
  117. package/dist/core/product/url.mjs +10 -10
  118. package/dist/core/product/url.mjs.map +1 -1
  119. package/dist/core/request-context.d.mts +77 -19
  120. package/dist/core/request-context.mjs +5 -1
  121. package/dist/core/request-context.mjs.map +1 -1
  122. package/dist/core/request-routing/handle-shopify-redirects.d.mts +12 -4
  123. package/dist/core/request-routing/handle-shopify-redirects.mjs +9 -2
  124. package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
  125. package/dist/core/request-routing/handle-shopify-routes.d.mts +5 -5
  126. package/dist/core/request-routing/handle-shopify-routes.mjs +7 -5
  127. package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -1
  128. package/dist/core/request-routing/interceptors/proxy.mjs +79 -43
  129. package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -1
  130. package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
  131. package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
  132. package/dist/core/request-routing/interceptors/url-redirects.mjs +6 -1
  133. package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
  134. package/dist/core/request-routing/interceptors/well-known.mjs +1 -1
  135. package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -1
  136. package/dist/core/request-routing/registered-routes.d.mts +12 -0
  137. package/dist/core/request-routing/registered-routes.mjs +12 -0
  138. package/dist/core/request-routing/registered-routes.mjs.map +1 -1
  139. package/dist/core/request-routing/route-types.d.mts +43 -18
  140. package/dist/core/shop-pay/shop-pay.d.mts +71 -35
  141. package/dist/core/shop-pay/shop-pay.mjs +36 -10
  142. package/dist/core/shop-pay/shop-pay.mjs.map +1 -1
  143. package/dist/core/shopify-scripts/index.d.mts +15 -5
  144. package/dist/core/shopify-scripts/index.mjs +15 -5
  145. package/dist/core/shopify-scripts/index.mjs.map +1 -1
  146. package/dist/core/shopify-scripts/initialize.d.mts +12 -4
  147. package/dist/core/shopify-scripts/initialize.mjs +12 -4
  148. package/dist/core/shopify-scripts/initialize.mjs.map +1 -1
  149. package/dist/core/shopify-scripts/types.d.mts +58 -25
  150. package/dist/core/standard-routes/build.d.mts +11 -12
  151. package/dist/core/standard-routes/build.mjs +11 -12
  152. package/dist/core/standard-routes/build.mjs.map +1 -1
  153. package/dist/core/standard-routes/types.d.mts +30 -24
  154. package/dist/core/url.mjs +2 -1
  155. package/dist/core/url.mjs.map +1 -1
  156. package/dist/customer-account/client.d.mts +36 -69
  157. package/dist/customer-account/client.mjs +7 -8
  158. package/dist/customer-account/client.mjs.map +1 -1
  159. package/dist/customer-account/errors.d.mts +45 -36
  160. package/dist/customer-account/errors.mjs +21 -36
  161. package/dist/customer-account/errors.mjs.map +1 -1
  162. package/dist/customer-account/graphql.d.mts +11 -23
  163. package/dist/customer-account/graphql.mjs +3 -9
  164. package/dist/customer-account/graphql.mjs.map +1 -1
  165. package/dist/customer-account/session.d.mts +130 -100
  166. package/dist/customer-account/session.mjs +32 -10
  167. package/dist/customer-account/session.mjs.map +1 -1
  168. package/dist/customer-account/type-resolver.d.mts +7 -8
  169. package/dist/development/client/client.d.mts +18 -15
  170. package/dist/development/client/client.mjs +8 -3
  171. package/dist/development/client/client.mjs.map +1 -1
  172. package/dist/development/client/errors.d.mts +35 -13
  173. package/dist/development/client/errors.mjs +23 -13
  174. package/dist/development/client/errors.mjs.map +1 -1
  175. package/dist/development/client/types.d.mts +140 -90
  176. package/dist/development/core/analytics/cart-tracker.d.mts +19 -10
  177. package/dist/development/core/analytics/cart-tracker.mjs +18 -10
  178. package/dist/development/core/analytics/cart-tracker.mjs.map +1 -1
  179. package/dist/development/core/analytics/events.d.mts +17 -11
  180. package/dist/development/core/analytics/events.mjs +13 -4
  181. package/dist/development/core/analytics/events.mjs.map +1 -1
  182. package/dist/development/core/analytics/types.d.mts +207 -118
  183. package/dist/development/core/analytics/utils/flatten-connection.d.mts +11 -9
  184. package/dist/development/core/analytics/utils/flatten-connection.mjs +7 -6
  185. package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -1
  186. package/dist/development/core/cache/fetch-with-cache.d.mts +24 -4
  187. package/dist/development/core/cache/fetch-with-cache.mjs +17 -2
  188. package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -1
  189. package/dist/development/core/cache/key.d.mts +2 -0
  190. package/dist/development/core/cache/key.mjs.map +1 -1
  191. package/dist/development/core/cache/run-with-cache.d.mts +56 -8
  192. package/dist/development/core/cache/run-with-cache.mjs +17 -6
  193. package/dist/development/core/cache/run-with-cache.mjs.map +1 -1
  194. package/dist/development/core/cache/store.d.mts +8 -6
  195. package/dist/development/core/cache/store.mjs.map +1 -1
  196. package/dist/development/core/cache/strategies.d.mts +27 -2
  197. package/dist/development/core/cache/strategies.mjs +6 -0
  198. package/dist/development/core/cache/strategies.mjs.map +1 -1
  199. package/dist/development/core/cart/actions.d.mts +37 -30
  200. package/dist/development/core/cart/actions.mjs +21 -9
  201. package/dist/development/core/cart/actions.mjs.map +1 -1
  202. package/dist/development/core/cart/attach-quantity-input.d.mts +8 -7
  203. package/dist/development/core/cart/attach-quantity-input.mjs +8 -7
  204. package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -1
  205. package/dist/development/core/cart/buyer-identity-sync.d.mts +6 -5
  206. package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -1
  207. package/dist/development/core/cart/cart.d.mts +59 -46
  208. package/dist/development/core/cart/cart.mjs +46 -29
  209. package/dist/development/core/cart/cart.mjs.map +1 -1
  210. package/dist/development/core/cart/cookie.d.mts +8 -4
  211. package/dist/development/core/cart/cookie.mjs +8 -4
  212. package/dist/development/core/cart/cookie.mjs.map +1 -1
  213. package/dist/development/core/cart/form.d.mts +34 -20
  214. package/dist/development/core/cart/form.mjs +6 -4
  215. package/dist/development/core/cart/form.mjs.map +1 -1
  216. package/dist/development/core/cart/get-cart.d.mts +27 -15
  217. package/dist/development/core/cart/get-cart.mjs +13 -8
  218. package/dist/development/core/cart/get-cart.mjs.map +1 -1
  219. package/dist/development/core/cart/quantity.d.mts +16 -5
  220. package/dist/development/core/cart/quantity.mjs +16 -5
  221. package/dist/development/core/cart/quantity.mjs.map +1 -1
  222. package/dist/development/core/cart/queries.d.mts +25 -19
  223. package/dist/development/core/cart/queries.mjs +15 -1
  224. package/dist/development/core/cart/queries.mjs.map +1 -1
  225. package/dist/development/core/cart/server-handlers.d.mts +82 -45
  226. package/dist/development/core/cart/server-handlers.mjs +4 -0
  227. package/dist/development/core/cart/server-handlers.mjs.map +1 -1
  228. package/dist/development/core/cart/state.d.mts +110 -64
  229. package/dist/development/core/cart/state.mjs +24 -6
  230. package/dist/development/core/cart/state.mjs.map +1 -1
  231. package/dist/development/core/collection/collection.d.mts +52 -53
  232. package/dist/development/core/collection/collection.mjs +5 -3
  233. package/dist/development/core/collection/collection.mjs.map +1 -1
  234. package/dist/development/core/collection/reconciler.d.mts +23 -16
  235. package/dist/development/core/collection/reconciler.mjs +8 -4
  236. package/dist/development/core/collection/reconciler.mjs.map +1 -1
  237. package/dist/development/core/collection/state.d.mts +31 -26
  238. package/dist/development/core/collection/state.mjs +4 -3
  239. package/dist/development/core/collection/state.mjs.map +1 -1
  240. package/dist/development/core/collection/url.d.mts +70 -29
  241. package/dist/development/core/collection/url.mjs +63 -25
  242. package/dist/development/core/collection/url.mjs.map +1 -1
  243. package/dist/development/core/constants.mjs.map +1 -1
  244. package/dist/development/core/logging/logging.d.mts +14 -8
  245. package/dist/development/core/logging/logging.mjs +15 -10
  246. package/dist/development/core/logging/logging.mjs.map +1 -1
  247. package/dist/development/core/logging/types.d.mts +28 -11
  248. package/dist/development/core/logging/types.mjs.map +1 -1
  249. package/dist/development/core/money/format.d.mts +6 -4
  250. package/dist/development/core/money/format.mjs +19 -9
  251. package/dist/development/core/money/format.mjs.map +1 -1
  252. package/dist/development/core/money/types.d.mts +41 -25
  253. package/dist/development/core/predictive-search/form.d.mts +37 -7
  254. package/dist/development/core/predictive-search/form.mjs +21 -3
  255. package/dist/development/core/predictive-search/form.mjs.map +1 -1
  256. package/dist/development/core/predictive-search/queries.d.mts +18 -30
  257. package/dist/development/core/predictive-search/queries.mjs +7 -3
  258. package/dist/development/core/predictive-search/queries.mjs.map +1 -1
  259. package/dist/development/core/predictive-search/search.d.mts +25 -27
  260. package/dist/development/core/predictive-search/search.mjs +20 -19
  261. package/dist/development/core/predictive-search/search.mjs.map +1 -1
  262. package/dist/development/core/predictive-search/server-handlers.d.mts +25 -26
  263. package/dist/development/core/predictive-search/server-handlers.mjs +4 -0
  264. package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -1
  265. package/dist/development/core/predictive-search/store.d.mts +65 -24
  266. package/dist/development/core/predictive-search/store.mjs +12 -1
  267. package/dist/development/core/predictive-search/store.mjs.map +1 -1
  268. package/dist/development/core/predictive-search/url.d.mts +36 -37
  269. package/dist/development/core/predictive-search/url.mjs +14 -6
  270. package/dist/development/core/predictive-search/url.mjs.map +1 -1
  271. package/dist/development/core/product/form.d.mts +63 -16
  272. package/dist/development/core/product/form.mjs +8 -2
  273. package/dist/development/core/product/form.mjs.map +1 -1
  274. package/dist/development/core/product/options.d.mts +8 -10
  275. package/dist/development/core/product/options.mjs +8 -10
  276. package/dist/development/core/product/options.mjs.map +1 -1
  277. package/dist/development/core/product/product-form.d.mts +77 -29
  278. package/dist/development/core/product/product-form.mjs +32 -10
  279. package/dist/development/core/product/product-form.mjs.map +1 -1
  280. package/dist/development/core/product/state.d.mts +55 -32
  281. package/dist/development/core/product/url.d.mts +19 -13
  282. package/dist/development/core/product/url.mjs +10 -10
  283. package/dist/development/core/product/url.mjs.map +1 -1
  284. package/dist/development/core/request-context.d.mts +77 -19
  285. package/dist/development/core/request-context.mjs +5 -1
  286. package/dist/development/core/request-context.mjs.map +1 -1
  287. package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +12 -4
  288. package/dist/development/core/request-routing/handle-shopify-redirects.mjs +9 -2
  289. package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
  290. package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +9 -1
  291. package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +7 -0
  292. package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -1
  293. package/dist/development/core/request-routing/handle-shopify-routes.mjs +7 -5
  294. package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -1
  295. package/dist/development/core/request-routing/interceptors/proxy.mjs +79 -43
  296. package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -1
  297. package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
  298. package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
  299. package/dist/development/core/request-routing/interceptors/url-redirects.mjs +6 -1
  300. package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
  301. package/dist/development/core/request-routing/interceptors/well-known.mjs +1 -1
  302. package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -1
  303. package/dist/development/core/request-routing/registered-routes.d.mts +12 -0
  304. package/dist/development/core/request-routing/registered-routes.mjs +12 -0
  305. package/dist/development/core/request-routing/registered-routes.mjs.map +1 -1
  306. package/dist/development/core/request-routing/route-types.d.mts +43 -18
  307. package/dist/development/core/shop-pay/shop-pay.d.mts +71 -35
  308. package/dist/development/core/shop-pay/shop-pay.mjs +36 -10
  309. package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -1
  310. package/dist/development/core/shopify-scripts/index.d.mts +15 -5
  311. package/dist/development/core/shopify-scripts/index.mjs +15 -5
  312. package/dist/development/core/shopify-scripts/index.mjs.map +1 -1
  313. package/dist/development/core/shopify-scripts/initialize.d.mts +12 -4
  314. package/dist/development/core/shopify-scripts/initialize.mjs +12 -4
  315. package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -1
  316. package/dist/development/core/shopify-scripts/types.d.mts +58 -25
  317. package/dist/development/core/standard-routes/build.d.mts +11 -12
  318. package/dist/development/core/standard-routes/build.mjs +11 -12
  319. package/dist/development/core/standard-routes/build.mjs.map +1 -1
  320. package/dist/development/core/standard-routes/types.d.mts +30 -24
  321. package/dist/development/core/url.mjs +2 -1
  322. package/dist/development/core/url.mjs.map +1 -1
  323. package/dist/development/customer-account/session.d.mts +45 -54
  324. package/dist/development/customer-account/session.mjs +20 -4
  325. package/dist/development/customer-account/session.mjs.map +1 -1
  326. package/dist/development/globals.d.mts +20 -11
  327. package/dist/development/graphql/generated/storefront-api-types.d.mts +127 -1
  328. package/dist/development/graphql/graphql.d.mts +17 -16
  329. package/dist/development/graphql/graphql.mjs +7 -8
  330. package/dist/development/graphql/graphql.mjs.map +1 -1
  331. package/dist/development/graphql/type-resolver.d.mts +15 -8
  332. package/dist/development/react/cart.d.mts +78 -32
  333. package/dist/development/react/cart.mjs +56 -29
  334. package/dist/development/react/cart.mjs.map +1 -1
  335. package/dist/development/react/collection.d.mts +40 -22
  336. package/dist/development/react/collection.mjs +27 -7
  337. package/dist/development/react/collection.mjs.map +1 -1
  338. package/dist/development/react/predictive-search.d.mts +65 -50
  339. package/dist/development/react/predictive-search.mjs +23 -21
  340. package/dist/development/react/predictive-search.mjs.map +1 -1
  341. package/dist/development/react/product.d.mts +45 -16
  342. package/dist/development/react/product.mjs +13 -11
  343. package/dist/development/react/product.mjs.map +1 -1
  344. package/dist/development/react/shop-pay.d.mts +15 -0
  345. package/dist/development/react/shop-pay.mjs +9 -0
  346. package/dist/development/react/shop-pay.mjs.map +1 -1
  347. package/dist/development/react/shopify-scripts.d.mts +23 -2
  348. package/dist/development/react/shopify-scripts.mjs +9 -0
  349. package/dist/development/react/shopify-scripts.mjs.map +1 -1
  350. package/dist/development/vue/cart.d.mts +28 -23
  351. package/dist/development/vue/cart.mjs +42 -25
  352. package/dist/development/vue/cart.mjs.map +1 -1
  353. package/dist/development/vue/collection.d.mts +20 -12
  354. package/dist/development/vue/collection.mjs +15 -7
  355. package/dist/development/vue/collection.mjs.map +1 -1
  356. package/dist/development/vue/index.d.mts +2 -2
  357. package/dist/development/vue/index.mjs +2 -2
  358. package/dist/development/vue/predictive-search.d.mts +31 -36
  359. package/dist/development/vue/predictive-search.mjs +16 -22
  360. package/dist/development/vue/predictive-search.mjs.map +1 -1
  361. package/dist/development/vue/product.d.mts +16 -15
  362. package/dist/development/vue/product.mjs +11 -11
  363. package/dist/development/vue/product.mjs.map +1 -1
  364. package/dist/development/vue/shop-pay.d.mts +14 -17
  365. package/dist/development/vue/shop-pay.mjs +8 -0
  366. package/dist/development/vue/shop-pay.mjs.map +1 -1
  367. package/dist/development/vue/shopify-scripts.d.mts +11 -0
  368. package/dist/development/vue/shopify-scripts.mjs +6 -0
  369. package/dist/development/vue/shopify-scripts.mjs.map +1 -1
  370. package/dist/globals.d.mts +20 -11
  371. package/dist/graphql/generated/storefront-api-types.d.mts +127 -1
  372. package/dist/graphql/graphql.d.mts +17 -16
  373. package/dist/graphql/graphql.mjs +7 -8
  374. package/dist/graphql/graphql.mjs.map +1 -1
  375. package/dist/graphql/type-resolver.d.mts +15 -8
  376. package/dist/react/cart.d.mts +78 -32
  377. package/dist/react/cart.mjs +56 -29
  378. package/dist/react/cart.mjs.map +1 -1
  379. package/dist/react/collection.d.mts +40 -22
  380. package/dist/react/collection.mjs +27 -7
  381. package/dist/react/collection.mjs.map +1 -1
  382. package/dist/react/predictive-search.d.mts +65 -50
  383. package/dist/react/predictive-search.mjs +23 -21
  384. package/dist/react/predictive-search.mjs.map +1 -1
  385. package/dist/react/product.d.mts +45 -16
  386. package/dist/react/product.mjs +13 -11
  387. package/dist/react/product.mjs.map +1 -1
  388. package/dist/react/shop-pay.d.mts +15 -0
  389. package/dist/react/shop-pay.mjs +9 -0
  390. package/dist/react/shop-pay.mjs.map +1 -1
  391. package/dist/react/shopify-scripts.d.mts +23 -2
  392. package/dist/react/shopify-scripts.mjs +9 -0
  393. package/dist/react/shopify-scripts.mjs.map +1 -1
  394. package/dist/ts-plugin/index.cjs +6 -0
  395. package/dist/ts-plugin/index.cjs.map +1 -1
  396. package/dist/ts-plugin/index.d.cts +6 -0
  397. package/dist/vite/local-https.d.mts +51 -17
  398. package/dist/vite/local-https.mjs +26 -5
  399. package/dist/vite/local-https.mjs.map +1 -1
  400. package/dist/vue/cart.d.mts +28 -23
  401. package/dist/vue/cart.mjs +42 -25
  402. package/dist/vue/cart.mjs.map +1 -1
  403. package/dist/vue/collection.d.mts +20 -12
  404. package/dist/vue/collection.mjs +15 -7
  405. package/dist/vue/collection.mjs.map +1 -1
  406. package/dist/vue/index.d.mts +2 -2
  407. package/dist/vue/index.mjs +2 -2
  408. package/dist/vue/predictive-search.d.mts +31 -36
  409. package/dist/vue/predictive-search.mjs +16 -22
  410. package/dist/vue/predictive-search.mjs.map +1 -1
  411. package/dist/vue/product.d.mts +16 -15
  412. package/dist/vue/product.mjs +11 -11
  413. package/dist/vue/product.mjs.map +1 -1
  414. package/dist/vue/shop-pay.d.mts +14 -17
  415. package/dist/vue/shop-pay.mjs +8 -0
  416. package/dist/vue/shop-pay.mjs.map +1 -1
  417. package/dist/vue/shopify-scripts.d.mts +11 -0
  418. package/dist/vue/shopify-scripts.mjs +6 -0
  419. package/dist/vue/shopify-scripts.mjs.map +1 -1
  420. package/package.json +3 -1
  421. package/skills/hydrogen-analytics/SKILL.md +1 -1
  422. package/skills/hydrogen-cart-ui/SKILL.md +28 -2
  423. package/skills/hydrogen-collection-browser/SKILL.md +9 -1
  424. package/skills/hydrogen-collection-browser/references/nextjs.md +1 -1
  425. package/skills/hydrogen-collection-browser/references/nuxt.md +1 -1
  426. package/skills/hydrogen-collection-browser/references/react.md +151 -32
  427. package/skills/hydrogen-customer-account/SKILL.md +2 -0
  428. package/skills/hydrogen-request-handlers/SKILL.md +21 -11
  429. package/skills/hydrogen-setup/references/analytics.md +14 -8
  430. package/skills/hydrogen-setup/steps/1-inspect-app.md +2 -2
  431. package/skills/hydrogen-setup/steps/6-product-detail-page.md +21 -11
  432. package/skills/hydrogen-storefront-client/SKILL.md +1 -1
  433. package/skills/hydrogen-storefront-client/references/caching.md +2 -0
  434. package/skills/hydrogen-variant-form/SKILL.md +25 -7
  435. package/skills/hydrogen-variant-form/references/nextjs.md +39 -4
  436. package/skills/hydrogen-variant-form/references/nuxt.md +83 -42
  437. package/skills/hydrogen-variant-form/references/react.md +45 -9
@@ -1,4 +1,114 @@
1
1
  //#region src/graphql/generated/storefront-api-types.d.ts
2
+ /** All built-in and custom scalars, mapped to their actual values */
3
+ type Scalars = {
4
+ ID: {
5
+ input: string;
6
+ output: string;
7
+ };
8
+ String: {
9
+ input: string;
10
+ output: string;
11
+ };
12
+ Boolean: {
13
+ input: boolean;
14
+ output: boolean;
15
+ };
16
+ Int: {
17
+ input: number;
18
+ output: number;
19
+ };
20
+ Float: {
21
+ input: number;
22
+ output: number;
23
+ };
24
+ /**
25
+ * A string containing a hexadecimal representation of a color.
26
+ *
27
+ * For example, "#6A8D48".
28
+ *
29
+ */
30
+ Color: {
31
+ input: string;
32
+ output: string;
33
+ };
34
+ /**
35
+ * Represents an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)-encoded date and time string.
36
+ * For example, 3:50 pm on September 7, 2019 in the time zone of UTC (Coordinated Universal Time) is
37
+ * represented as `"2019-09-07T15:50:00Z`".
38
+ *
39
+ */
40
+ DateTime: {
41
+ input: string;
42
+ output: string;
43
+ };
44
+ /**
45
+ * A signed decimal number, which supports arbitrary precision and is serialized as a string.
46
+ *
47
+ * Example values: `"29.99"`, `"29.999"`.
48
+ *
49
+ */
50
+ Decimal: {
51
+ input: string;
52
+ output: string;
53
+ };
54
+ /**
55
+ * A string containing HTML code. Refer to the [HTML spec](https://html.spec.whatwg.org/#elements-3) for a
56
+ * complete list of HTML elements.
57
+ *
58
+ * Example value: `"<p>Grey cotton knit sweater.</p>"`
59
+ *
60
+ */
61
+ HTML: {
62
+ input: string;
63
+ output: string;
64
+ }; /** An ISO 8601-encoded datetime */
65
+ ISO8601DateTime: {
66
+ input: string;
67
+ output: string;
68
+ };
69
+ /**
70
+ * A [JSON](https://www.json.org/json-en.html) object.
71
+ *
72
+ * Example value:
73
+ * `{
74
+ * "product": {
75
+ * "id": "gid://shopify/Product/1346443542550",
76
+ * "title": "White T-shirt",
77
+ * "options": [{
78
+ * "name": "Size",
79
+ * "values": ["M", "L"]
80
+ * }]
81
+ * }
82
+ * }`
83
+ *
84
+ */
85
+ JSON: {
86
+ input: string;
87
+ output: string;
88
+ };
89
+ /**
90
+ * Represents an [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) and
91
+ * [RFC 3987](https://datatracker.ietf.org/doc/html/rfc3987)-compliant URI string.
92
+ *
93
+ * For example, `"https://example.myshopify.com"` is a valid URL. It includes a scheme (`https`) and a host
94
+ * (`example.myshopify.com`).
95
+ *
96
+ */
97
+ URL: {
98
+ input: string;
99
+ output: string;
100
+ };
101
+ /**
102
+ * An unsigned 64-bit integer. Represents whole numeric values between 0 and 2^64 - 1 encoded as a string of base-10 digits.
103
+ *
104
+ * Example value: `"50"`.
105
+ *
106
+ */
107
+ UnsignedInt64: {
108
+ input: string;
109
+ output: string;
110
+ };
111
+ };
2
112
  /**
3
113
  * Error codes returned by [`CartUserError`](https://shopify.dev/docs/api/storefront/current/objects/CartUserError) during cart mutations. Covers validation failures for addresses, quantities, delivery options, merchandise lines, discount codes, and metafields.
4
114
  *
@@ -14,6 +124,13 @@ type CartWarningCode = /** The discount code cannot be honored. */"DISCOUNT_CODE
14
124
  *
15
125
  */
16
126
  type CountryCode = /** Ascension Island. */"AC" /** Andorra. */ | "AD" /** United Arab Emirates. */ | "AE" /** Afghanistan. */ | "AF" /** Antigua & Barbuda. */ | "AG" /** Anguilla. */ | "AI" /** Albania. */ | "AL" /** Armenia. */ | "AM" /** Netherlands Antilles. */ | "AN" /** Angola. */ | "AO" /** Argentina. */ | "AR" /** Austria. */ | "AT" /** Australia. */ | "AU" /** Aruba. */ | "AW" /** Åland Islands. */ | "AX" /** Azerbaijan. */ | "AZ" /** Bosnia & Herzegovina. */ | "BA" /** Barbados. */ | "BB" /** Bangladesh. */ | "BD" /** Belgium. */ | "BE" /** Burkina Faso. */ | "BF" /** Bulgaria. */ | "BG" /** Bahrain. */ | "BH" /** Burundi. */ | "BI" /** Benin. */ | "BJ" /** St. Barthélemy. */ | "BL" /** Bermuda. */ | "BM" /** Brunei. */ | "BN" /** Bolivia. */ | "BO" /** Caribbean Netherlands. */ | "BQ" /** Brazil. */ | "BR" /** Bahamas. */ | "BS" /** Bhutan. */ | "BT" /** Bouvet Island. */ | "BV" /** Botswana. */ | "BW" /** Belarus. */ | "BY" /** Belize. */ | "BZ" /** Canada. */ | "CA" /** Cocos (Keeling) Islands. */ | "CC" /** Congo - Kinshasa. */ | "CD" /** Central African Republic. */ | "CF" /** Congo - Brazzaville. */ | "CG" /** Switzerland. */ | "CH" /** Côte d’Ivoire. */ | "CI" /** Cook Islands. */ | "CK" /** Chile. */ | "CL" /** Cameroon. */ | "CM" /** China. */ | "CN" /** Colombia. */ | "CO" /** Costa Rica. */ | "CR" /** Cuba. */ | "CU" /** Cape Verde. */ | "CV" /** Curaçao. */ | "CW" /** Christmas Island. */ | "CX" /** Cyprus. */ | "CY" /** Czechia. */ | "CZ" /** Germany. */ | "DE" /** Djibouti. */ | "DJ" /** Denmark. */ | "DK" /** Dominica. */ | "DM" /** Dominican Republic. */ | "DO" /** Algeria. */ | "DZ" /** Ecuador. */ | "EC" /** Estonia. */ | "EE" /** Egypt. */ | "EG" /** Western Sahara. */ | "EH" /** Eritrea. */ | "ER" /** Spain. */ | "ES" /** Ethiopia. */ | "ET" /** Finland. */ | "FI" /** Fiji. */ | "FJ" /** Falkland Islands. */ | "FK" /** Faroe Islands. */ | "FO" /** France. */ | "FR" /** Gabon. */ | "GA" /** United Kingdom. */ | "GB" /** Grenada. */ | "GD" /** Georgia. */ | "GE" /** French Guiana. */ | "GF" /** Guernsey. */ | "GG" /** Ghana. */ | "GH" /** Gibraltar. */ | "GI" /** Greenland. */ | "GL" /** Gambia. */ | "GM" /** Guinea. */ | "GN" /** Guadeloupe. */ | "GP" /** Equatorial Guinea. */ | "GQ" /** Greece. */ | "GR" /** South Georgia & South Sandwich Islands. */ | "GS" /** Guatemala. */ | "GT" /** Guinea-Bissau. */ | "GW" /** Guyana. */ | "GY" /** Hong Kong SAR. */ | "HK" /** Heard & McDonald Islands. */ | "HM" /** Honduras. */ | "HN" /** Croatia. */ | "HR" /** Haiti. */ | "HT" /** Hungary. */ | "HU" /** Indonesia. */ | "ID" /** Ireland. */ | "IE" /** Israel. */ | "IL" /** Isle of Man. */ | "IM" /** India. */ | "IN" /** British Indian Ocean Territory. */ | "IO" /** Iraq. */ | "IQ" /** Iran. */ | "IR" /** Iceland. */ | "IS" /** Italy. */ | "IT" /** Jersey. */ | "JE" /** Jamaica. */ | "JM" /** Jordan. */ | "JO" /** Japan. */ | "JP" /** Kenya. */ | "KE" /** Kyrgyzstan. */ | "KG" /** Cambodia. */ | "KH" /** Kiribati. */ | "KI" /** Comoros. */ | "KM" /** St. Kitts & Nevis. */ | "KN" /** North Korea. */ | "KP" /** South Korea. */ | "KR" /** Kuwait. */ | "KW" /** Cayman Islands. */ | "KY" /** Kazakhstan. */ | "KZ" /** Laos. */ | "LA" /** Lebanon. */ | "LB" /** St. Lucia. */ | "LC" /** Liechtenstein. */ | "LI" /** Sri Lanka. */ | "LK" /** Liberia. */ | "LR" /** Lesotho. */ | "LS" /** Lithuania. */ | "LT" /** Luxembourg. */ | "LU" /** Latvia. */ | "LV" /** Libya. */ | "LY" /** Morocco. */ | "MA" /** Monaco. */ | "MC" /** Moldova. */ | "MD" /** Montenegro. */ | "ME" /** St. Martin. */ | "MF" /** Madagascar. */ | "MG" /** North Macedonia. */ | "MK" /** Mali. */ | "ML" /** Myanmar (Burma). */ | "MM" /** Mongolia. */ | "MN" /** Macao SAR. */ | "MO" /** Martinique. */ | "MQ" /** Mauritania. */ | "MR" /** Montserrat. */ | "MS" /** Malta. */ | "MT" /** Mauritius. */ | "MU" /** Maldives. */ | "MV" /** Malawi. */ | "MW" /** Mexico. */ | "MX" /** Malaysia. */ | "MY" /** Mozambique. */ | "MZ" /** Namibia. */ | "NA" /** New Caledonia. */ | "NC" /** Niger. */ | "NE" /** Norfolk Island. */ | "NF" /** Nigeria. */ | "NG" /** Nicaragua. */ | "NI" /** Netherlands. */ | "NL" /** Norway. */ | "NO" /** Nepal. */ | "NP" /** Nauru. */ | "NR" /** Niue. */ | "NU" /** New Zealand. */ | "NZ" /** Oman. */ | "OM" /** Panama. */ | "PA" /** Peru. */ | "PE" /** French Polynesia. */ | "PF" /** Papua New Guinea. */ | "PG" /** Philippines. */ | "PH" /** Pakistan. */ | "PK" /** Poland. */ | "PL" /** St. Pierre & Miquelon. */ | "PM" /** Pitcairn Islands. */ | "PN" /** Palestinian Territories. */ | "PS" /** Portugal. */ | "PT" /** Paraguay. */ | "PY" /** Qatar. */ | "QA" /** Réunion. */ | "RE" /** Romania. */ | "RO" /** Serbia. */ | "RS" /** Russia. */ | "RU" /** Rwanda. */ | "RW" /** Saudi Arabia. */ | "SA" /** Solomon Islands. */ | "SB" /** Seychelles. */ | "SC" /** Sudan. */ | "SD" /** Sweden. */ | "SE" /** Singapore. */ | "SG" /** St. Helena. */ | "SH" /** Slovenia. */ | "SI" /** Svalbard & Jan Mayen. */ | "SJ" /** Slovakia. */ | "SK" /** Sierra Leone. */ | "SL" /** San Marino. */ | "SM" /** Senegal. */ | "SN" /** Somalia. */ | "SO" /** Suriname. */ | "SR" /** South Sudan. */ | "SS" /** São Tomé & Príncipe. */ | "ST" /** El Salvador. */ | "SV" /** Sint Maarten. */ | "SX" /** Syria. */ | "SY" /** Eswatini. */ | "SZ" /** Tristan da Cunha. */ | "TA" /** Turks & Caicos Islands. */ | "TC" /** Chad. */ | "TD" /** French Southern Territories. */ | "TF" /** Togo. */ | "TG" /** Thailand. */ | "TH" /** Tajikistan. */ | "TJ" /** Tokelau. */ | "TK" /** Timor-Leste. */ | "TL" /** Turkmenistan. */ | "TM" /** Tunisia. */ | "TN" /** Tonga. */ | "TO" /** Türkiye. */ | "TR" /** Trinidad & Tobago. */ | "TT" /** Tuvalu. */ | "TV" /** Taiwan. */ | "TW" /** Tanzania. */ | "TZ" /** Ukraine. */ | "UA" /** Uganda. */ | "UG" /** U.S. Outlying Islands. */ | "UM" /** United States. */ | "US" /** Uruguay. */ | "UY" /** Uzbekistan. */ | "UZ" /** Vatican City. */ | "VA" /** St. Vincent & Grenadines. */ | "VC" /** Venezuela. */ | "VE" /** British Virgin Islands. */ | "VG" /** Vietnam. */ | "VN" /** Vanuatu. */ | "VU" /** Wallis & Futuna. */ | "WF" /** Samoa. */ | "WS" /** Kosovo. */ | "XK" /** Yemen. */ | "YE" /** Mayotte. */ | "YT" /** South Africa. */ | "ZA" /** Zambia. */ | "ZM" /** Zimbabwe. */ | "ZW" /** Unknown Region. */ | "ZZ";
127
+ /**
128
+ * The three-letter currency codes that represent the world currencies used in
129
+ * stores. These include standard ISO 4217 codes, legacy codes,
130
+ * and non-standard codes.
131
+ *
132
+ */
133
+ type CurrencyCode = /** United Arab Emirates Dirham (AED). */"AED" /** Afghan Afghani (AFN). */ | "AFN" /** Albanian Lek (ALL). */ | "ALL" /** Armenian Dram (AMD). */ | "AMD" /** Netherlands Antillean Guilder. */ | "ANG" /** Angolan Kwanza (AOA). */ | "AOA" /** Argentine Pesos (ARS). */ | "ARS" /** Australian Dollars (AUD). */ | "AUD" /** Aruban Florin (AWG). */ | "AWG" /** Azerbaijani Manat (AZN). */ | "AZN" /** Bosnia and Herzegovina Convertible Mark (BAM). */ | "BAM" /** Barbadian Dollar (BBD). */ | "BBD" /** Bangladesh Taka (BDT). */ | "BDT" /** Bulgarian Lev (BGN). */ | "BGN" /** Bahraini Dinar (BHD). */ | "BHD" /** Burundian Franc (BIF). */ | "BIF" /** Bermudian Dollar (BMD). */ | "BMD" /** Brunei Dollar (BND). */ | "BND" /** Bolivian Boliviano (BOB). */ | "BOB" /** Brazilian Real (BRL). */ | "BRL" /** Bahamian Dollar (BSD). */ | "BSD" /** Bhutanese Ngultrum (BTN). */ | "BTN" /** Botswana Pula (BWP). */ | "BWP" /** Belarusian Ruble (BYN). */ | "BYN" /** Belarusian Ruble (BYR). */ | "BYR" /** Belize Dollar (BZD). */ | "BZD" /** Canadian Dollars (CAD). */ | "CAD" /** Congolese franc (CDF). */ | "CDF" /** Swiss Francs (CHF). */ | "CHF" /** Chilean Peso (CLP). */ | "CLP" /** Chinese Yuan Renminbi (CNY). */ | "CNY" /** Colombian Peso (COP). */ | "COP" /** Costa Rican Colones (CRC). */ | "CRC" /** Cape Verdean escudo (CVE). */ | "CVE" /** Czech Koruny (CZK). */ | "CZK" /** Djiboutian Franc (DJF). */ | "DJF" /** Danish Kroner (DKK). */ | "DKK" /** Dominican Peso (DOP). */ | "DOP" /** Algerian Dinar (DZD). */ | "DZD" /** Egyptian Pound (EGP). */ | "EGP" /** Eritrean Nakfa (ERN). */ | "ERN" /** Ethiopian Birr (ETB). */ | "ETB" /** Euro (EUR). */ | "EUR" /** Fijian Dollars (FJD). */ | "FJD" /** Falkland Islands Pounds (FKP). */ | "FKP" /** United Kingdom Pounds (GBP). */ | "GBP" /** Georgian Lari (GEL). */ | "GEL" /** Ghanaian Cedi (GHS). */ | "GHS" /** Gibraltar Pounds (GIP). */ | "GIP" /** Gambian Dalasi (GMD). */ | "GMD" /** Guinean Franc (GNF). */ | "GNF" /** Guatemalan Quetzal (GTQ). */ | "GTQ" /** Guyanese Dollar (GYD). */ | "GYD" /** Hong Kong Dollars (HKD). */ | "HKD" /** Honduran Lempira (HNL). */ | "HNL" /** Croatian Kuna (HRK). */ | "HRK" /** Haitian Gourde (HTG). */ | "HTG" /** Hungarian Forint (HUF). */ | "HUF" /** Indonesian Rupiah (IDR). */ | "IDR" /** Israeli New Shekel (NIS). */ | "ILS" /** Indian Rupees (INR). */ | "INR" /** Iraqi Dinar (IQD). */ | "IQD" /** Iranian Rial (IRR). */ | "IRR" /** Icelandic Kronur (ISK). */ | "ISK" /** Jersey Pound. */ | "JEP" /** Jamaican Dollars (JMD). */ | "JMD" /** Jordanian Dinar (JOD). */ | "JOD" /** Japanese Yen (JPY). */ | "JPY" /** Kenyan Shilling (KES). */ | "KES" /** Kyrgyzstani Som (KGS). */ | "KGS" /** Cambodian Riel. */ | "KHR" /** Kiribati Dollar (KID). */ | "KID" /** Comorian Franc (KMF). */ | "KMF" /** South Korean Won (KRW). */ | "KRW" /** Kuwaiti Dinar (KWD). */ | "KWD" /** Cayman Dollars (KYD). */ | "KYD" /** Kazakhstani Tenge (KZT). */ | "KZT" /** Laotian Kip (LAK). */ | "LAK" /** Lebanese Pounds (LBP). */ | "LBP" /** Sri Lankan Rupees (LKR). */ | "LKR" /** Liberian Dollar (LRD). */ | "LRD" /** Lesotho Loti (LSL). */ | "LSL" /** Lithuanian Litai (LTL). */ | "LTL" /** Latvian Lati (LVL). */ | "LVL" /** Libyan Dinar (LYD). */ | "LYD" /** Moroccan Dirham. */ | "MAD" /** Moldovan Leu (MDL). */ | "MDL" /** Malagasy Ariary (MGA). */ | "MGA" /** Macedonia Denar (MKD). */ | "MKD" /** Burmese Kyat (MMK). */ | "MMK" /** Mongolian Tugrik. */ | "MNT" /** Macanese Pataca (MOP). */ | "MOP" /** Mauritanian Ouguiya (MRU). */ | "MRU" /** Mauritian Rupee (MUR). */ | "MUR" /** Maldivian Rufiyaa (MVR). */ | "MVR" /** Malawian Kwacha (MWK). */ | "MWK" /** Mexican Pesos (MXN). */ | "MXN" /** Malaysian Ringgits (MYR). */ | "MYR" /** Mozambican Metical. */ | "MZN" /** Namibian Dollar. */ | "NAD" /** Nigerian Naira (NGN). */ | "NGN" /** Nicaraguan Córdoba (NIO). */ | "NIO" /** Norwegian Kroner (NOK). */ | "NOK" /** Nepalese Rupee (NPR). */ | "NPR" /** New Zealand Dollars (NZD). */ | "NZD" /** Omani Rial (OMR). */ | "OMR" /** Panamian Balboa (PAB). */ | "PAB" /** Peruvian Nuevo Sol (PEN). */ | "PEN" /** Papua New Guinean Kina (PGK). */ | "PGK" /** Philippine Peso (PHP). */ | "PHP" /** Pakistani Rupee (PKR). */ | "PKR" /** Polish Zlotych (PLN). */ | "PLN" /** Paraguayan Guarani (PYG). */ | "PYG" /** Qatari Rial (QAR). */ | "QAR" /** Romanian Lei (RON). */ | "RON" /** Serbian dinar (RSD). */ | "RSD" /** Russian Rubles (RUB). */ | "RUB" /** Rwandan Franc (RWF). */ | "RWF" /** Saudi Riyal (SAR). */ | "SAR" /** Solomon Islands Dollar (SBD). */ | "SBD" /** Seychellois Rupee (SCR). */ | "SCR" /** Sudanese Pound (SDG). */ | "SDG" /** Swedish Kronor (SEK). */ | "SEK" /** Singapore Dollars (SGD). */ | "SGD" /** Saint Helena Pounds (SHP). */ | "SHP" /** Sierra Leonean Leone (SLL). */ | "SLL" /** Somali Shilling (SOS). */ | "SOS" /** Surinamese Dollar (SRD). */ | "SRD" /** South Sudanese Pound (SSP). */ | "SSP" /** Sao Tome And Principe Dobra (STD). */ | "STD" /** Sao Tome And Principe Dobra (STN). */ | "STN" /** Syrian Pound (SYP). */ | "SYP" /** Swazi Lilangeni (SZL). */ | "SZL" /** Thai baht (THB). */ | "THB" /** Tajikistani Somoni (TJS). */ | "TJS" /** Turkmenistani Manat (TMT). */ | "TMT" /** Tunisian Dinar (TND). */ | "TND" /** Tongan Pa'anga (TOP). */ | "TOP" /** Turkish Lira (TRY). */ | "TRY" /** Trinidad and Tobago Dollars (TTD). */ | "TTD" /** Taiwan Dollars (TWD). */ | "TWD" /** Tanzanian Shilling (TZS). */ | "TZS" /** Ukrainian Hryvnia (UAH). */ | "UAH" /** Ugandan Shilling (UGX). */ | "UGX" /** United States Dollars (USD). */ | "USD" /** Uruguayan Pesos (UYU). */ | "UYU" /** Uzbekistan som (UZS). */ | "UZS" /** Venezuelan Bolivares (VED). */ | "VED" /** Venezuelan Bolivares (VEF). */ | "VEF" /** Venezuelan Bolivares Soberanos (VES). */ | "VES" /** Vietnamese đồng (VND). */ | "VND" /** Vanuatu Vatu (VUV). */ | "VUV" /** Samoan Tala (WST). */ | "WST" /** Central African CFA Franc (XAF). */ | "XAF" /** East Caribbean Dollar (XCD). */ | "XCD" /** Caribbean Guilder (XCG). */ | "XCG" /** West African CFA franc (XOF). */ | "XOF" /** CFP Franc (XPF). */ | "XPF" /** Unrecognized currency. */ | "XXX" /** Yemeni Rial (YER). */ | "YER" /** South African Rand (ZAR). */ | "ZAR" /** Zambian Kwacha (ZMW). */ | "ZMW";
17
134
  /**
18
135
  * Supported languages for retrieving translated storefront content. Pass a language code to the [`@inContext`](https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/in-context) directive to return product titles, descriptions, and other translatable fields in that language.
19
136
  *
@@ -21,6 +138,15 @@ type CountryCode = /** Ascension Island. */"AC" /** Andorra. */ | "AD" /** Unite
21
138
  *
22
139
  */
23
140
  type LanguageCode = /** Afrikaans. */"AF" /** Akan. */ | "AK" /** Amharic. */ | "AM" /** Arabic. */ | "AR" /** Assamese. */ | "AS" /** Azerbaijani. */ | "AZ" /** Belarusian. */ | "BE" /** Bulgarian. */ | "BG" /** Bambara. */ | "BM" /** Bangla. */ | "BN" /** Tibetan. */ | "BO" /** Breton. */ | "BR" /** Bosnian. */ | "BS" /** Catalan. */ | "CA" /** Chechen. */ | "CE" /** Central Kurdish. */ | "CKB" /** Czech. */ | "CS" /** Church Slavic. */ | "CU" /** Welsh. */ | "CY" /** Danish. */ | "DA" /** German. */ | "DE" /** Dzongkha. */ | "DZ" /** Ewe. */ | "EE" /** Greek. */ | "EL" /** English. */ | "EN" /** Esperanto. */ | "EO" /** Spanish. */ | "ES" /** Estonian. */ | "ET" /** Basque. */ | "EU" /** Persian. */ | "FA" /** Fulah. */ | "FF" /** Finnish. */ | "FI" /** Filipino. */ | "FIL" /** Faroese. */ | "FO" /** French. */ | "FR" /** Western Frisian. */ | "FY" /** Irish. */ | "GA" /** Scottish Gaelic. */ | "GD" /** Galician. */ | "GL" /** Gujarati. */ | "GU" /** Manx. */ | "GV" /** Hausa. */ | "HA" /** Hebrew. */ | "HE" /** Hindi. */ | "HI" /** Croatian. */ | "HR" /** Hungarian. */ | "HU" /** Armenian. */ | "HY" /** Interlingua. */ | "IA" /** Indonesian. */ | "ID" /** Igbo. */ | "IG" /** Sichuan Yi. */ | "II" /** Icelandic. */ | "IS" /** Italian. */ | "IT" /** Japanese. */ | "JA" /** Javanese. */ | "JV" /** Georgian. */ | "KA" /** Kikuyu. */ | "KI" /** Kazakh. */ | "KK" /** Kalaallisut. */ | "KL" /** Khmer. */ | "KM" /** Kannada. */ | "KN" /** Korean. */ | "KO" /** Kashmiri. */ | "KS" /** Kurdish. */ | "KU" /** Cornish. */ | "KW" /** Kyrgyz. */ | "KY" /** Latin. */ | "LA" /** Luxembourgish. */ | "LB" /** Ganda. */ | "LG" /** Lingala. */ | "LN" /** Lao. */ | "LO" /** Lithuanian. */ | "LT" /** Luba-Katanga. */ | "LU" /** Latvian. */ | "LV" /** Malagasy. */ | "MG" /** Māori. */ | "MI" /** Macedonian. */ | "MK" /** Malayalam. */ | "ML" /** Mongolian. */ | "MN" /** Moldavian. */ | "MO" /** Marathi. */ | "MR" /** Malay. */ | "MS" /** Maltese. */ | "MT" /** Burmese. */ | "MY" /** Norwegian (Bokmål). */ | "NB" /** North Ndebele. */ | "ND" /** Nepali. */ | "NE" /** Dutch. */ | "NL" /** Norwegian Nynorsk. */ | "NN" /** Norwegian. */ | "NO" /** Oromo. */ | "OM" /** Odia. */ | "OR" /** Ossetic. */ | "OS" /** Punjabi. */ | "PA" /** Polish. */ | "PL" /** Pashto. */ | "PS" /** Portuguese. */ | "PT" /** Portuguese (Brazil). */ | "PT_BR" /** Portuguese (Portugal). */ | "PT_PT" /** Quechua. */ | "QU" /** Romansh. */ | "RM" /** Rundi. */ | "RN" /** Romanian. */ | "RO" /** Russian. */ | "RU" /** Kinyarwanda. */ | "RW" /** Sanskrit. */ | "SA" /** Sardinian. */ | "SC" /** Sindhi. */ | "SD" /** Northern Sami. */ | "SE" /** Sango. */ | "SG" /** Serbo-Croatian. */ | "SH" /** Sinhala. */ | "SI" /** Slovak. */ | "SK" /** Slovenian. */ | "SL" /** Shona. */ | "SN" /** Somali. */ | "SO" /** Albanian. */ | "SQ" /** Serbian. */ | "SR" /** Sundanese. */ | "SU" /** Swedish. */ | "SV" /** Swahili. */ | "SW" /** Tamil. */ | "TA" /** Telugu. */ | "TE" /** Tajik. */ | "TG" /** Thai. */ | "TH" /** Tigrinya. */ | "TI" /** Turkmen. */ | "TK" /** Tongan. */ | "TO" /** Turkish. */ | "TR" /** Tatar. */ | "TT" /** Uyghur. */ | "UG" /** Ukrainian. */ | "UK" /** Urdu. */ | "UR" /** Uzbek. */ | "UZ" /** Vietnamese. */ | "VI" /** Volapük. */ | "VO" /** Wolof. */ | "WO" /** Xhosa. */ | "XH" /** Yiddish. */ | "YI" /** Yoruba. */ | "YO" /** Chinese. */ | "ZH" /** Chinese (Simplified). */ | "ZH_CN" /** Chinese (Traditional). */ | "ZH_TW" /** Zulu. */ | "ZU";
141
+ /**
142
+ * A precise monetary value with its associated currency. Combines a decimal amount with a three-letter [`CurrencyCode`](https://shopify.dev/docs/api/storefront/current/enums/CurrencyCode) to express prices, costs, and other financial values. For example, 12.99 USD.
143
+ *
144
+ */
145
+ type MoneyV2 = {
146
+ __typename?: "MoneyV2"; /** Decimal money amount. */
147
+ amount: Scalars["Decimal"]["output"]; /** Currency of the money. */
148
+ currencyCode: CurrencyCode;
149
+ };
24
150
  /** Decides the distribution of results. */
25
151
  type PredictiveSearchLimitScope = /** Return results up to limit across all types. */"ALL" /** Return results up to limit per type. */ | "EACH";
26
152
  /** The types of search items to perform predictive search on. */
@@ -43,5 +169,5 @@ type SearchUnavailableProductsType = /** Exclude unavailable products. */"HIDE"
43
169
  /** Specifies the list of resource fields to search. */
44
170
  type SearchableField = /** Author of the page or article. */"AUTHOR" /** Body of the page or article or product description or collection description. */ | "BODY" /** Product type. */ | "PRODUCT_TYPE" /** Tag associated with the product or article. */ | "TAG" /** Title of the page or article or product title or collection title. */ | "TITLE" /** Variant barcode. */ | "VARIANTS_BARCODE" /** Variant SKU. */ | "VARIANTS_SKU" /** Variant title. */ | "VARIANTS_TITLE" /** Product vendor. */ | "VENDOR";
45
171
  //#endregion
46
- export { CartErrorCode, CartWarningCode, CountryCode, LanguageCode, PredictiveSearchLimitScope, PredictiveSearchType, ProductCollectionSortKeys, SearchUnavailableProductsType, SearchableField };
172
+ export { CartErrorCode, CartWarningCode, CountryCode, LanguageCode, MoneyV2, PredictiveSearchLimitScope, PredictiveSearchType, ProductCollectionSortKeys, SearchUnavailableProductsType, SearchableField };
47
173
  //# sourceMappingURL=storefront-api-types.d.mts.map
@@ -8,29 +8,31 @@ type StorefrontTadaGql = initGraphQLTada<{
8
8
  introspection: introspection;
9
9
  scalars: StorefrontScalars;
10
10
  }>;
11
+ /** Type-only properties that mark a string as a `gql` document. */
11
12
  type StorefrontQueryMetadata<Source extends string = string> = {
12
- readonly __hydrogenQueryBrand: true;
13
+ /** Marks a string that `gql` returns. The property exists only in types. */readonly __hydrogenQueryBrand: true; /** The document's query text, which TypeScript reads to infer types. The property exists only in types. */
13
14
  readonly __hydrogenQuerySource?: Source;
14
15
  };
15
16
  /**
16
- * A branded string that carries phantom Result and Variables types.
17
+ * The type of a `gql` document, a query string that carries its result and variables types.
17
18
  *
18
- * Honest about being a `string` at runtime (unlike `TadaDocumentNode`
19
- * which claims to be an AST). Implements `DocumentDecoration` so
20
- * `ResultOf<>` and `VariablesOf<>` work on it.
19
+ * At runtime, the document is a plain string. Read the types with `StorefrontApi.ResultOf` and
20
+ * `StorefrontApi.VariablesOf`.
21
21
  */
22
22
  type StorefrontQueryString<Result = any, Variables = any, Source extends string = string> = string & DocumentDecoration<Result, Variables> & {
23
23
  readonly __hydrogenQueryBrand: true;
24
24
  readonly __hydrogenQuerySource?: Source;
25
25
  };
26
- /** Any `gql()`-branded string, regardless of inferred Result/Variables. Used in constraints that accept any Storefront document. */
26
+ /**
27
+ * Any `gql` document, whatever its result and variables types. Use the type to accept any Storefront API document.
28
+ */
27
29
  type AnyStorefrontQueryString = string & StorefrontQueryMetadata;
28
- /** Extracts the literal source text from a `gql()`-branded document type. Resolves to `never` for unbranded strings. */
30
+ /** The query text of a `gql` document as a string literal type. Resolves to `never` for a plain string. */
29
31
  type SourceOf<Doc> = Doc extends {
30
32
  readonly __hydrogenQuerySource?: infer Source extends string;
31
33
  } ? Source : never;
32
34
  type FragmentSources<Fragments extends readonly AnyStorefrontQueryString[]> = Fragments extends readonly [] ? "" : Fragments extends readonly [infer Only extends AnyStorefrontQueryString] ? SourceOf<Only> : Fragments extends readonly [infer First extends AnyStorefrontQueryString, ...infer Rest extends readonly AnyStorefrontQueryString[]] ? `${SourceOf<First>}\n${FragmentSources<Rest>}` : string;
33
- /** Concatenates a query source with its fragment sources into a single literal type, enabling end-to-end type inference for composed documents. */
35
+ /** The combined query text of a document and its fragments, which keeps the inferred types of composed documents. */
34
36
  type ComposedSource<Source extends string, Fragments extends readonly AnyStorefrontQueryString[]> = FragmentSources<Fragments> extends "" ? Source : `${Source}\n${FragmentSources<Fragments>}`;
35
37
  type StorefrontGql = {
36
38
  <const Document extends AnyStorefrontQueryString, const Fragments extends readonly AnyStorefrontQueryString[], const DocumentSource extends string = ComposedSource<SourceOf<Document>, Fragments>>(document: Document, fragments: Fragments): StorefrontQueryString<InferResult<DocumentSource>, InferVariables<DocumentSource>, DocumentSource>;
@@ -38,14 +40,12 @@ type StorefrontGql = {
38
40
  <const Source extends string, const Fragments extends readonly AnyStorefrontQueryString[], const DocumentSource extends string = ComposedSource<Source, Fragments>>(source: Source, fragments: Fragments): StorefrontQueryString<InferResult<DocumentSource>, InferVariables<DocumentSource>, DocumentSource>;
39
41
  } & StorefrontTadaGql;
40
42
  /**
41
- * Tags a Storefront API query string for type-safe inference.
42
- *
43
- * At runtime, returns the source string (concatenated with any fragments).
44
- * At the type level, the return type carries phantom `Result` and `Variables`
45
- * types inferred from the Storefront API schema via gql.tada.
43
+ * Writes a typed Storefront API query, mutation, or fragment. TypeScript infers the result and
44
+ * variables types from Hydrogen's bundled Storefront API schema. At runtime, the function returns
45
+ * the query string with any fragments appended.
46
46
  *
47
- * Pass an array of previously declared `gql()` fragments as the second
48
- * argument to compose documents while preserving full type inference.
47
+ * Pass earlier fragment documents as the second argument to compose documents and keep the
48
+ * inferred types.
49
49
  *
50
50
  * @example
51
51
  * ```ts
@@ -62,10 +62,11 @@ type StorefrontGql = {
62
62
  * });
63
63
  *
64
64
  * if (!result.errors) {
65
- * // result.data.product is typed as `{ title: string } | null`
65
+ * // result.data.product has the type `{ title: string } | null`
66
66
  * console.log(result.data.product?.title);
67
67
  * }
68
68
  * ```
69
+ * @publicDocs
69
70
  */
70
71
  declare const gql: StorefrontGql;
71
72
  //#endregion
@@ -1,13 +1,11 @@
1
1
  //#region src/graphql/graphql.ts
2
2
  /**
3
- * Tags a Storefront API query string for type-safe inference.
3
+ * Writes a typed Storefront API query, mutation, or fragment. TypeScript infers the result and
4
+ * variables types from Hydrogen's bundled Storefront API schema. At runtime, the function returns
5
+ * the query string with any fragments appended.
4
6
  *
5
- * At runtime, returns the source string (concatenated with any fragments).
6
- * At the type level, the return type carries phantom `Result` and `Variables`
7
- * types inferred from the Storefront API schema via gql.tada.
8
- *
9
- * Pass an array of previously declared `gql()` fragments as the second
10
- * argument to compose documents while preserving full type inference.
7
+ * Pass earlier fragment documents as the second argument to compose documents and keep the
8
+ * inferred types.
11
9
  *
12
10
  * @example
13
11
  * ```ts
@@ -24,10 +22,11 @@
24
22
  * });
25
23
  *
26
24
  * if (!result.errors) {
27
- * // result.data.product is typed as `{ title: string } | null`
25
+ * // result.data.product has the type `{ title: string } | null`
28
26
  * console.log(result.data.product?.title);
29
27
  * }
30
28
  * ```
29
+ * @publicDocs
31
30
  */
32
31
  const gql = ((source, fragments) => {
33
32
  let query = source;
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.mjs","names":[],"sources":["../../src/graphql/graphql.ts"],"sourcesContent":["import type { DocumentDecoration, initGraphQLTada as InitGraphQLTada } from \"gql.tada\";\n\nimport type { introspection } from \"./generated/graphql-env\";\nimport type { StorefrontScalars } from \"./scalars\";\nimport type { InferResult, InferVariables } from \"./type-resolver\";\n\ntype StorefrontTadaGql = InitGraphQLTada<{\n introspection: introspection;\n scalars: StorefrontScalars;\n}>;\n\ntype StorefrontQueryMetadata<Source extends string = string> = {\n readonly __hydrogenQueryBrand: true;\n readonly __hydrogenQuerySource?: Source;\n};\n\n/**\n * A branded string that carries phantom Result and Variables types.\n *\n * Honest about being a `string` at runtime (unlike `TadaDocumentNode`\n * which claims to be an AST). Implements `DocumentDecoration` so\n * `ResultOf<>` and `VariablesOf<>` work on it.\n */\nexport type StorefrontQueryString<\n Result = any,\n Variables = any,\n Source extends string = string,\n> = string &\n DocumentDecoration<Result, Variables> & {\n readonly __hydrogenQueryBrand: true;\n readonly __hydrogenQuerySource?: Source;\n };\n\n/** Any `gql()`-branded string, regardless of inferred Result/Variables. Used in constraints that accept any Storefront document. */\nexport type AnyStorefrontQueryString = string & StorefrontQueryMetadata;\n\n/** Extracts the literal source text from a `gql()`-branded document type. Resolves to `never` for unbranded strings. */\nexport type SourceOf<Doc> = Doc extends {\n readonly __hydrogenQuerySource?: infer Source extends string;\n}\n ? Source\n : never;\n\nexport type FragmentSources<Fragments extends readonly AnyStorefrontQueryString[]> =\n Fragments extends readonly []\n ? \"\"\n : Fragments extends readonly [infer Only extends AnyStorefrontQueryString]\n ? SourceOf<Only>\n : Fragments extends readonly [\n infer First extends AnyStorefrontQueryString,\n ...infer Rest extends readonly AnyStorefrontQueryString[],\n ]\n ? `${SourceOf<First>}\\n${FragmentSources<Rest>}`\n : string;\n\n/** Concatenates a query source with its fragment sources into a single literal type, enabling end-to-end type inference for composed documents. */\nexport type ComposedSource<\n Source extends string,\n Fragments extends readonly AnyStorefrontQueryString[],\n> = FragmentSources<Fragments> extends \"\" ? Source : `${Source}\\n${FragmentSources<Fragments>}`;\n\ntype StorefrontGql = {\n // Composes an already-declared document with additional fragments. Declared\n // before the raw-source overloads so branded documents recover their literal\n // source through SourceOf instead of binding Source to the branded type,\n // which would degrade ComposedSource and kill inference.\n <\n const Document extends AnyStorefrontQueryString,\n const Fragments extends readonly AnyStorefrontQueryString[],\n const DocumentSource extends string = ComposedSource<SourceOf<Document>, Fragments>,\n >(\n document: Document,\n fragments: Fragments,\n ): StorefrontQueryString<\n InferResult<DocumentSource>,\n InferVariables<DocumentSource>,\n DocumentSource\n >;\n <const Source extends string>(\n source: Source,\n ): StorefrontQueryString<InferResult<Source>, InferVariables<Source>, Source>;\n <\n const Source extends string,\n const Fragments extends readonly AnyStorefrontQueryString[],\n const DocumentSource extends string = ComposedSource<Source, Fragments>,\n >(\n source: Source,\n fragments: Fragments,\n ): StorefrontQueryString<\n InferResult<DocumentSource>,\n InferVariables<DocumentSource>,\n DocumentSource\n >;\n} & StorefrontTadaGql;\n\n/**\n * Tags a Storefront API query string for type-safe inference.\n *\n * At runtime, returns the source string (concatenated with any fragments).\n * At the type level, the return type carries phantom `Result` and `Variables`\n * types inferred from the Storefront API schema via gql.tada.\n *\n * Pass an array of previously declared `gql()` fragments as the second\n * argument to compose documents while preserving full type inference.\n *\n * @example\n * ```ts\n * import { gql } from \"@shopify/hydrogen\";\n *\n * const PRODUCT_QUERY = gql(`\n * query Product($handle: String!) {\n * product(handle: $handle) { title }\n * }\n * `);\n *\n * const result = await storefront.graphql(PRODUCT_QUERY, {\n * variables: { handle: \"snowboard\" },\n * });\n *\n * if (!result.errors) {\n * // result.data.product is typed as `{ title: string } | null`\n * console.log(result.data.product?.title);\n * }\n * ```\n */\n// oxlint-disable-next-line typescript-eslint/consistent-type-assertions -- gql.tada adds phantom helper properties to the function type that are not used at runtime.\nexport const gql = ((source: string, fragments?: Array<string>) => {\n let query = source;\n\n if (fragments) {\n const seen = new Set<string>();\n for (const fragment of fragments) {\n if (!seen.has(fragment)) {\n seen.add(fragment);\n query += \"\\n\" + fragment;\n }\n }\n }\n\n return query;\n}) as unknown as StorefrontGql;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HA,MAAa,QAAQ,QAAgB,cAA8B;CACjE,IAAI,QAAQ;AAEZ,KAAI,WAAW;EACb,MAAM,uBAAO,IAAI,KAAa;AAC9B,OAAK,MAAM,YAAY,UACrB,KAAI,CAAC,KAAK,IAAI,SAAS,EAAE;AACvB,QAAK,IAAI,SAAS;AAClB,YAAS,OAAO;;;AAKtB,QAAO"}
1
+ {"version":3,"file":"graphql.mjs","names":[],"sources":["../../src/graphql/graphql.ts"],"sourcesContent":["import type { DocumentDecoration, initGraphQLTada as InitGraphQLTada } from \"gql.tada\";\n\nimport type { introspection } from \"./generated/graphql-env\";\nimport type { StorefrontScalars } from \"./scalars\";\nimport type { InferResult, InferVariables } from \"./type-resolver\";\n\ntype StorefrontTadaGql = InitGraphQLTada<{\n introspection: introspection;\n scalars: StorefrontScalars;\n}>;\n\n/** Type-only properties that mark a string as a `gql` document. */\ntype StorefrontQueryMetadata<Source extends string = string> = {\n /** Marks a string that `gql` returns. The property exists only in types. */\n readonly __hydrogenQueryBrand: true;\n /** The document's query text, which TypeScript reads to infer types. The property exists only in types. */\n readonly __hydrogenQuerySource?: Source;\n};\n\n/**\n * The type of a `gql` document, a query string that carries its result and variables types.\n *\n * At runtime, the document is a plain string. Read the types with `StorefrontApi.ResultOf` and\n * `StorefrontApi.VariablesOf`.\n */\nexport type StorefrontQueryString<\n Result = any,\n Variables = any,\n Source extends string = string,\n> = string &\n DocumentDecoration<Result, Variables> & {\n readonly __hydrogenQueryBrand: true;\n readonly __hydrogenQuerySource?: Source;\n };\n\n/**\n * Any `gql` document, whatever its result and variables types. Use the type to accept any Storefront API document.\n */\nexport type AnyStorefrontQueryString = string & StorefrontQueryMetadata;\n\n/** The query text of a `gql` document as a string literal type. Resolves to `never` for a plain string. */\nexport type SourceOf<Doc> = Doc extends {\n readonly __hydrogenQuerySource?: infer Source extends string;\n}\n ? Source\n : never;\n\nexport type FragmentSources<Fragments extends readonly AnyStorefrontQueryString[]> =\n Fragments extends readonly []\n ? \"\"\n : Fragments extends readonly [infer Only extends AnyStorefrontQueryString]\n ? SourceOf<Only>\n : Fragments extends readonly [\n infer First extends AnyStorefrontQueryString,\n ...infer Rest extends readonly AnyStorefrontQueryString[],\n ]\n ? `${SourceOf<First>}\\n${FragmentSources<Rest>}`\n : string;\n\n/** The combined query text of a document and its fragments, which keeps the inferred types of composed documents. */\nexport type ComposedSource<\n Source extends string,\n Fragments extends readonly AnyStorefrontQueryString[],\n> = FragmentSources<Fragments> extends \"\" ? Source : `${Source}\\n${FragmentSources<Fragments>}`;\n\ntype StorefrontGql = {\n // Composes an already-declared document with additional fragments. Declared\n // before the raw-source overloads so branded documents recover their literal\n // source through SourceOf instead of binding Source to the branded type,\n // which would degrade ComposedSource and kill inference.\n <\n const Document extends AnyStorefrontQueryString,\n const Fragments extends readonly AnyStorefrontQueryString[],\n const DocumentSource extends string = ComposedSource<SourceOf<Document>, Fragments>,\n >(\n document: Document,\n fragments: Fragments,\n ): StorefrontQueryString<\n InferResult<DocumentSource>,\n InferVariables<DocumentSource>,\n DocumentSource\n >;\n <const Source extends string>(\n source: Source,\n ): StorefrontQueryString<InferResult<Source>, InferVariables<Source>, Source>;\n <\n const Source extends string,\n const Fragments extends readonly AnyStorefrontQueryString[],\n const DocumentSource extends string = ComposedSource<Source, Fragments>,\n >(\n source: Source,\n fragments: Fragments,\n ): StorefrontQueryString<\n InferResult<DocumentSource>,\n InferVariables<DocumentSource>,\n DocumentSource\n >;\n} & StorefrontTadaGql;\n\n/**\n * Writes a typed Storefront API query, mutation, or fragment. TypeScript infers the result and\n * variables types from Hydrogen's bundled Storefront API schema. At runtime, the function returns\n * the query string with any fragments appended.\n *\n * Pass earlier fragment documents as the second argument to compose documents and keep the\n * inferred types.\n *\n * @example\n * ```ts\n * import { gql } from \"@shopify/hydrogen\";\n *\n * const PRODUCT_QUERY = gql(`\n * query Product($handle: String!) {\n * product(handle: $handle) { title }\n * }\n * `);\n *\n * const result = await storefront.graphql(PRODUCT_QUERY, {\n * variables: { handle: \"snowboard\" },\n * });\n *\n * if (!result.errors) {\n * // result.data.product has the type `{ title: string } | null`\n * console.log(result.data.product?.title);\n * }\n * ```\n * @publicDocs\n */\n// oxlint-disable-next-line typescript-eslint/consistent-type-assertions -- gql.tada adds phantom helper properties to the function type that are not used at runtime.\nexport const gql = ((source: string, fragments?: Array<string>) => {\n let query = source;\n\n if (fragments) {\n const seen = new Set<string>();\n for (const fragment of fragments) {\n if (!seen.has(fragment)) {\n seen.add(fragment);\n query += \"\\n\" + fragment;\n }\n }\n }\n\n return query;\n}) as unknown as StorefrontGql;\n\n/**\n * Writes a typed Storefront API query, mutation, or fragment. At runtime, the function returns the query text with each fragment appended once.\n *\n * TypeScript infers the result and variables types from Hydrogen's bundled Storefront API schema, even when the client targets another `apiVersion`. Read the types with `StorefrontApi.ResultOf` and `StorefrontApi.VariablesOf`. To type a fragment on its own, compose the fragment into a query and read the type from the query. The `FragmentOf` helper from `gql`.tada doesn't accept `gql` documents.\n *\n * @publicDocs\n */\nexport type StorefrontGqlForDocs =\n /**\n * @param source - The Storefront API query, mutation, or fragment source text.\n * @param fragments - The `gql` fragments that the query text spreads.\n * @returns A typed document to pass to the client's `graphql()` method.\n */\n (source: string, fragments?: readonly AnyStorefrontQueryString[]) => AnyStorefrontQueryString;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIA,MAAa,QAAQ,QAAgB,cAA8B;CACjE,IAAI,QAAQ;AAEZ,KAAI,WAAW;EACb,MAAM,uBAAO,IAAI,KAAa;AAC9B,OAAK,MAAM,YAAY,UACrB,KAAI,CAAC,KAAK,IAAI,SAAS,EAAE;AACvB,QAAK,IAAI,SAAS;AAClB,YAAS,OAAO;;;AAKtB,QAAO"}
@@ -134,6 +134,7 @@ type FragmentMap<Defs, Map = {}> = Defs extends readonly [infer Def, ...infer Re
134
134
  type FirstOperation<Defs> = Defs extends readonly [infer Def, ...infer Rest] ? Def extends {
135
135
  kind: "OperationDefinition";
136
136
  } ? Def : FirstOperation<Rest> : never;
137
+ /** The document's only operation, or `never` when the document has no operations or several. */
137
138
  type SingleOperation<Defs, Operation = never> = Defs extends readonly [infer Def, ...infer Rest] ? Def extends {
138
139
  kind: "OperationDefinition";
139
140
  } ? [Operation] extends [never] ? SingleOperation<Rest, Def> : never : SingleOperation<Rest, Operation> : Operation;
@@ -213,6 +214,7 @@ type VariablesType<Doc, Schema extends SchemaLike> = Doc extends {
213
214
  } ? FirstOperation<Defs> extends {
214
215
  variableDefinitions: any;
215
216
  } ? VariablesWalker<FirstOperation<Defs>["variableDefinitions"], Schema> : {} : {};
217
+ /** The operation kind of a parsed document with one operation. Resolves to `"unknown"` for any other document. */
216
218
  type OperationKindType<Doc> = Doc extends {
217
219
  kind: "Document";
218
220
  definitions: infer Defs extends readonly unknown[];
@@ -222,21 +224,26 @@ type OperationKindType<Doc> = Doc extends {
222
224
  type InferResultForSchema<T extends string, Schema extends SchemaLike> = parseDocument<T> extends infer Doc ? Doc extends never ? never : DocumentType<Doc, Schema> : never;
223
225
  type InferVariablesForSchema<T extends string, Schema extends SchemaLike> = parseDocument<T> extends infer Doc ? Doc extends never ? never : VariablesType<Doc, Schema> : never;
224
226
  /**
225
- * Infers the result type of a Storefront API query string against the bundled schema.
227
+ * The result type of a Storefront API query string, from Hydrogen's bundled schema.
226
228
  *
227
- * Useful when you need the result shape outside of `storefront.graphql()` — e.g. for
228
- * a component prop type. Takes a raw query source literal: for `gql()` documents use
229
- * `StorefrontApi.ResultOf`, since `InferResult<typeof doc>` resolves to `never`.
229
+ * Use the type for a result shape outside a GraphQL call, such as a component prop type. Pass the
230
+ * query text as a string literal type. For a `gql` document, use `StorefrontApi.ResultOf`. The
231
+ * type resolves to `never` for a `gql` document.
232
+ *
233
+ * @publicDocs
230
234
  */
231
235
  type InferResult<T extends string> = InferResultForSchema<T, StorefrontSchema>;
232
236
  /**
233
- * Infers the variables type of a Storefront API query string against the bundled schema.
237
+ * The variables type of a Storefront API query string, from Hydrogen's bundled schema.
238
+ *
239
+ * Use the type for a variables shape outside a GraphQL call, such as a loader parameter type. Pass
240
+ * the query text as a string literal type. For a `gql` document, use `StorefrontApi.VariablesOf`.
241
+ * The type resolves to `never` for a `gql` document.
234
242
  *
235
- * Useful when you need the variables shape outside of `storefront.graphql()` — e.g. for
236
- * a loader param type. Takes a raw query source literal: for `gql()` documents use
237
- * `StorefrontApi.VariablesOf`, since `InferVariables<typeof doc>` resolves to `never`.
243
+ * @publicDocs
238
244
  */
239
245
  type InferVariables<T extends string> = InferVariablesForSchema<T, StorefrontSchema>;
246
+ /** The operation kind of a query string, such as `query`. Resolves to `unknown` unless the query text has exactly one operation. */
240
247
  type InferOperationKind<T extends string> = parseDocument<T> extends infer Doc ? [Doc] extends [never] ? "unknown" : OperationKindType<Doc> : "unknown";
241
248
  //#endregion
242
249
  export { GraphQLSchemaFor, InferOperationKind, InferResult, InferResultForSchema, InferVariables, InferVariablesForSchema };
@@ -4,25 +4,71 @@ import { CartFormRegister } from "../core/cart/form.mjs";
4
4
  import { CartDataFromHandlers } from "../core/cart/server-handlers.mjs";
5
5
  import { FormHTMLAttributes, ReactNode, SubmitEvent } from "react";
6
6
  //#region src/react/cart.d.ts
7
+ /**
8
+ * Props for the cart provider that `createCartComponents` returns.
9
+ */
7
10
  type TypedCartProviderProps<TData extends CartData> = {
8
- initialData?: CartInitialData<TData>;
11
+ /**
12
+ * The `data` property of the cart GET handler's result, or a promise of that data. Without initial data, the store loads the cart from `/api/cart` after the provider mounts, and the server-rendered page shows an empty cart. The provider creates its store from the first value and ignores later changes.
13
+ */
14
+ initialData?: CartInitialData<TData>; /** Content that can read the cart through the cart hooks. */
9
15
  children?: ReactNode;
10
16
  };
11
17
  type CartInitialData<TData extends CartData = CartData> = CreateCartStoreOptions<TData>["initialData"];
18
+ /** A hook that returns the slice of cart state that your selector picks. */
19
+ type CartStateHook<TData extends CartData> =
20
+ /**
21
+ * @param selector - Picks the value to return from the cart state.
22
+ * @param isEqual - Compares the previous and next selected values. Return `true` to skip the re-render. Without the function, the hook compares the values by reference.
23
+ * @returns The selected value.
24
+ */
25
+ <S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S;
26
+ /** A hook that returns the slice of cart state that your selector picks, or `undefined` outside the cart provider. */
27
+ type OptionalCartStateHook<TData extends CartData> =
28
+ /**
29
+ * @param selector - Picks the value to return from the cart state.
30
+ * @param isEqual - Compares the previous and next selected values. Return `true` to skip the re-render. Without the function, the hook compares the values by reference.
31
+ * @returns The selected value, or `undefined` outside the cart provider.
32
+ */
33
+ <S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S | undefined;
34
+ /** Callbacks that run around a cart form submission. */
35
+ interface CartFormPropsOptions {
36
+ /** Runs before the cart store handles the submission. Call `event.preventDefault()` to skip the cart submission. */
37
+ beforeSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
38
+ /** Runs as soon as the cart change starts, before the server responds. */
39
+ afterSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
40
+ }
41
+ /** The form props function and the register function for a cart form. */
42
+ interface CartFormBindings {
43
+ /** Returns the `method`, `action`, and `onSubmit` props to spread on the form. The form posts to the cart endpoint, and the cart store handles each submission. */
44
+ formProps: (opts?: CartFormPropsOptions) => FormHTMLAttributes<HTMLFormElement>;
45
+ /** Returns the attributes for a cart field or action button. Register the quantity field with `interactive: true` to submit the form when the quantity changes. The interactive input takes the quantity as a default value and stays uncontrolled. */
46
+ register: CartFormRegister;
47
+ }
48
+ /**
49
+ * The cart provider and hooks that `createCartComponents` returns, typed with the custom cart fields from your cart server handlers.
50
+ */
12
51
  type TypedCartComponents<TData extends CartData> = {
13
- CartProvider: (props: TypedCartProviderProps<TData>) => ReactNode;
14
- useCart: <S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S;
15
- useSuspenseCart: <S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S;
16
- useOptionalCart: <S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S | undefined;
17
- useCartActions: typeof useCartActions;
52
+ /** Creates the cart store and shares the store with the cart hooks inside the provider. The provider connects the store on mount and destroys the store on unmount. */CartProvider: (props: TypedCartProviderProps<TData>) => ReactNode;
53
+ /**
54
+ * Returns the slice of cart state that the selector picks. The component re-renders when the selected value changes by reference, or when your `isEqual` function reports a change. A selector that returns the full state re-renders on every cart update.
55
+ */
56
+ useCart: CartStateHook<TData>; /** Suspends while the full cart loads, then returns the slice of cart state that the selector picks. Wrap the component in a `Suspense` boundary. */
57
+ useSuspenseCart: CartStateHook<TData>;
58
+ /**
59
+ * Returns the slice of cart state that the selector picks, or `undefined` outside the provider. Use the hook in a component that also renders above the provider, such as a cart badge on an error page.
60
+ */
61
+ useOptionalCart: OptionalCartStateHook<TData>; /** Returns the `refresh()` action. Call `refresh()` after a server-side cart change that skips cart forms. */
62
+ useCartActions: typeof useCartActions; /** Returns form props and a register function for cart forms. */
18
63
  useCartForm: typeof useCartForm;
19
64
  };
20
65
  /**
21
- * Factory that returns typed cart components and hooks matched to your server handler's
22
- * cart query shape.
66
+ * Returns a cart provider and cart hooks typed to the cart fragment in your cart server handlers.
67
+ * Pass `typeof cartServerHandlers` as the `THandlers` type argument. Every hook's cart state then includes your custom cart fields.
68
+ *
69
+ * On mount, the provider sends cart requests to `/api/cart` and connects the store. Every hook except `useOptionalCart` throws when you call it outside the provider.
23
70
  *
24
- * The generic `THandlers` parameter is inferred from your `createCartServerHandlers`
25
- * call, so every hook's {@link CartState} carries your custom cart fields end-to-end.
71
+ * @returns The cart provider, the cart state hooks, and the cart actions and form hooks.
26
72
  *
27
73
  * @example
28
74
  * ```tsx
@@ -37,14 +83,15 @@ type TypedCartComponents<TData extends CartData> = {
37
83
  * useCartForm,
38
84
  * } = createCartComponents<typeof cartServerHandlers>();
39
85
  * ```
86
+ * @publicDocs
40
87
  */
41
88
  declare function createCartComponents<THandlers>(): TypedCartComponents<CartDataFromHandlers<THandlers>>;
42
89
  /**
43
- * Returns cart actions for reconciling state after out-of-band mutations.
90
+ * Returns the cart action that reloads the cart after a cart change outside cart forms.
44
91
  *
45
- * Currently exposes {@link CartStore.refresh} — call it after server-side cart
46
- * mutations that bypass the form system (e.g. a server action that creates the
47
- * cart before the client knows about it).
92
+ * Call `refresh()` after a server-side cart change that skips cart forms, such as a server action that creates the cart.
93
+ *
94
+ * @returns The `refresh()` action.
48
95
  *
49
96
  * @example
50
97
  * ```tsx
@@ -55,14 +102,17 @@ declare function createCartComponents<THandlers>(): TypedCartComponents<CartData
55
102
  * refresh(); // re-fetch the cart
56
103
  * }
57
104
  * ```
105
+ * @publicDocs
58
106
  */
59
107
  declare function useCartActions(): CartActions;
60
108
  /**
61
- * Subscribes the {@link CartStore} to the analytics event dispatcher.
109
+ * Publishes cart analytics events when the customer's cart changes.
110
+ *
111
+ * Call the hook once near the root of your app, inside `CartProvider`. The hook starts tracking on mount and stops on unmount. The hook publishes `cart_updated`, `product_added_to_cart`, and `product_removed_from_cart` events.
62
112
  *
63
- * Call once near the root of your app — it subscribes on mount and
64
- * cleans up on unmount. Publishes `CART_UPDATED`, `PRODUCT_ADD_TO_CART`,
65
- * and `PRODUCT_REMOVED_FROM_CART` analytics events automatically.
113
+ * The hook throws outside `CartProvider`, and when the Shopify analytics bus isn't available. Render `ShopifyScripts` before the hook runs.
114
+ *
115
+ * @returns Nothing. The hook tracks cart analytics for the lifetime of the calling component.
66
116
  *
67
117
  * @example
68
118
  * ```tsx
@@ -71,19 +121,20 @@ declare function useCartActions(): CartActions;
71
121
  * return <Layout />;
72
122
  * }
73
123
  * ```
124
+ * @publicDocs
74
125
  */
75
126
  declare function useCartAnalytics(): void;
76
127
  /**
77
128
  * Returns form props and a field register function for building cart forms.
78
129
  *
79
- * `formProps()` returns `<form>` attributes that intercept submission, call
80
- * {@link CartStore.handleFormSubmit}, and prevent the default browser navigation.
81
- * `register()` returns the correct HTML attributes for each field type — see
82
- * `CartFormRegister` for the full field/action list.
130
+ * Spread `formProps()` on the form. The form posts to the cart endpoint. On submit, the form props stop the browser's navigation and send the form through the cart store.
131
+ * The submit handler ignores a failed cart change. Read failures from the cart state's `errors`.
132
+ * To skip the cart submission, call `event.preventDefault()` in a `beforeSubmit` callback. The `afterSubmit` callback runs as soon as the cart change starts, before the server responds.
133
+ * The register function returns the HTML attributes for each cart field and action.
134
+ *
135
+ * Register the quantity field with `interactive: true` to submit the form when the quantity changes. The interactive input takes the quantity as a default value and stays uncontrolled.
83
136
  *
84
- * When `register("quantity", { interactive: true })` is called, the returned
85
- * attributes include a `ref` callback that attaches {@link attachQuantityInput}
86
- * for auto-submit-on-change behavior.
137
+ * @returns The form props function and the register function.
87
138
  *
88
139
  * @example
89
140
  * ```tsx
@@ -102,14 +153,9 @@ declare function useCartAnalytics(): void;
102
153
  * );
103
154
  * }
104
155
  * ```
156
+ * @publicDocs
105
157
  */
106
- declare function useCartForm(): {
107
- formProps: (opts?: {
108
- beforeSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
109
- afterSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
110
- }) => FormHTMLAttributes<HTMLFormElement>;
111
- register: CartFormRegister;
112
- };
158
+ declare function useCartForm(): CartFormBindings;
113
159
  //#endregion
114
160
  export { createCartComponents, useCartAnalytics };
115
161
  //# sourceMappingURL=cart.d.mts.map