@shopify/hydrogen 2026.4.5 → 2026.10.0-preview.2

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 (764) hide show
  1. package/README.md +73 -13
  2. package/bin/hydrogen.mjs +7 -0
  3. package/dist/cli/index.mjs +647 -0
  4. package/dist/client/client.d.mts +34 -0
  5. package/dist/client/client.mjs +206 -0
  6. package/dist/client/client.mjs.map +1 -0
  7. package/dist/client/errors.d.mts +48 -0
  8. package/dist/client/errors.mjs +52 -0
  9. package/dist/client/errors.mjs.map +1 -0
  10. package/dist/client/index.d.mts +4 -0
  11. package/dist/client/types.d.mts +147 -0
  12. package/dist/core/analytics/cart-tracker.d.mts +8 -0
  13. package/dist/core/analytics/cart-tracker.mjs +144 -0
  14. package/dist/core/analytics/cart-tracker.mjs.map +1 -0
  15. package/dist/core/analytics/events.d.mts +15 -0
  16. package/dist/core/analytics/events.mjs +15 -0
  17. package/dist/core/analytics/events.mjs.map +1 -0
  18. package/dist/core/analytics/index.d.mts +3 -0
  19. package/dist/core/analytics/types.d.mts +143 -0
  20. package/dist/core/analytics/utils/flatten-connection.d.mts +19 -0
  21. package/dist/core/analytics/utils/flatten-connection.mjs +25 -0
  22. package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -0
  23. package/dist/core/cache/cache-status.mjs +17 -0
  24. package/dist/core/cache/cache-status.mjs.map +1 -0
  25. package/dist/core/cache/fetch-with-cache.d.mts +43 -0
  26. package/dist/core/cache/fetch-with-cache.mjs +188 -0
  27. package/dist/core/cache/fetch-with-cache.mjs.map +1 -0
  28. package/dist/core/cache/key.d.mts +6 -0
  29. package/dist/core/cache/key.mjs +27 -0
  30. package/dist/core/cache/key.mjs.map +1 -0
  31. package/dist/core/cache/run-with-cache.d.mts +36 -0
  32. package/dist/core/cache/run-with-cache.mjs +114 -0
  33. package/dist/core/cache/run-with-cache.mjs.map +1 -0
  34. package/dist/core/cache/store.d.mts +19 -0
  35. package/dist/core/cache/store.mjs +62 -0
  36. package/dist/core/cache/store.mjs.map +1 -0
  37. package/dist/core/cache/strategies.d.mts +39 -0
  38. package/dist/core/cache/strategies.mjs +70 -0
  39. package/dist/core/cache/strategies.mjs.map +1 -0
  40. package/dist/core/cart/actions.d.mts +50 -0
  41. package/dist/core/cart/actions.mjs +240 -0
  42. package/dist/core/cart/actions.mjs.map +1 -0
  43. package/dist/core/cart/attach-quantity-input.d.mts +5 -0
  44. package/dist/core/cart/attach-quantity-input.mjs +17 -0
  45. package/dist/core/cart/attach-quantity-input.mjs.map +1 -0
  46. package/dist/core/cart/buyer-identity-sync.d.mts +23 -0
  47. package/dist/core/cart/buyer-identity-sync.mjs +9 -0
  48. package/dist/core/cart/buyer-identity-sync.mjs.map +1 -0
  49. package/dist/core/cart/cart.d.mts +37 -0
  50. package/dist/core/cart/cart.mjs +1707 -0
  51. package/dist/core/cart/cart.mjs.map +1 -0
  52. package/dist/core/cart/cookie.d.mts +5 -0
  53. package/dist/core/cart/cookie.mjs +28 -0
  54. package/dist/core/cart/cookie.mjs.map +1 -0
  55. package/dist/core/cart/form.d.mts +130 -0
  56. package/dist/core/cart/form.mjs +75 -0
  57. package/dist/core/cart/form.mjs.map +1 -0
  58. package/dist/core/cart/get-cart.d.mts +25 -0
  59. package/dist/core/cart/get-cart.mjs +32 -0
  60. package/dist/core/cart/get-cart.mjs.map +1 -0
  61. package/dist/core/cart/index.d.mts +10 -0
  62. package/dist/core/cart/quantity.d.mts +10 -0
  63. package/dist/core/cart/quantity.mjs +14 -0
  64. package/dist/core/cart/quantity.mjs.map +1 -0
  65. package/dist/core/cart/queries.d.mts +4296 -0
  66. package/dist/core/cart/queries.mjs +70 -0
  67. package/dist/core/cart/queries.mjs.map +1 -0
  68. package/dist/core/cart/server-handlers.d.mts +82 -0
  69. package/dist/core/cart/server-handlers.mjs +322 -0
  70. package/dist/core/cart/server-handlers.mjs.map +1 -0
  71. package/dist/core/cart/state.d.mts +137 -0
  72. package/dist/core/cart/state.mjs +76 -0
  73. package/dist/core/cart/state.mjs.map +1 -0
  74. package/dist/core/cart/sync-quantity-inputs.mjs +16 -0
  75. package/dist/core/cart/sync-quantity-inputs.mjs.map +1 -0
  76. package/dist/core/collection/collection.d.mts +134 -0
  77. package/dist/core/collection/collection.mjs +170 -0
  78. package/dist/core/collection/collection.mjs.map +1 -0
  79. package/dist/core/collection/index.d.mts +6 -0
  80. package/dist/core/collection/reconciler.d.mts +32 -0
  81. package/dist/core/collection/reconciler.mjs +89 -0
  82. package/dist/core/collection/reconciler.mjs.map +1 -0
  83. package/dist/core/collection/state.d.mts +66 -0
  84. package/dist/core/collection/state.mjs +20 -0
  85. package/dist/core/collection/state.mjs.map +1 -0
  86. package/dist/core/collection/url.d.mts +71 -0
  87. package/dist/core/collection/url.mjs +376 -0
  88. package/dist/core/collection/url.mjs.map +1 -0
  89. package/dist/core/constants.d.mts +5 -0
  90. package/dist/core/constants.mjs +8 -0
  91. package/dist/core/constants.mjs.map +1 -0
  92. package/dist/core/headers.mjs +43 -0
  93. package/dist/core/headers.mjs.map +1 -0
  94. package/dist/core/index.d.mts +56 -0
  95. package/dist/core/index.mjs +45 -0
  96. package/dist/core/logging/logging.d.mts +21 -0
  97. package/dist/core/logging/logging.mjs +99 -0
  98. package/dist/core/logging/logging.mjs.map +1 -0
  99. package/dist/core/logging/types.d.mts +40 -0
  100. package/dist/core/logging/types.mjs +18 -0
  101. package/dist/core/logging/types.mjs.map +1 -0
  102. package/dist/core/money/cache.mjs +25 -0
  103. package/dist/core/money/cache.mjs.map +1 -0
  104. package/dist/core/money/format.d.mts +15 -0
  105. package/dist/core/money/format.mjs +243 -0
  106. package/dist/core/money/format.mjs.map +1 -0
  107. package/dist/core/money/types.d.mts +47 -0
  108. package/dist/core/observable.mjs +46 -0
  109. package/dist/core/observable.mjs.map +1 -0
  110. package/dist/core/predictive-search/constants.d.mts +5 -0
  111. package/dist/core/predictive-search/constants.mjs +6 -0
  112. package/dist/core/predictive-search/constants.mjs.map +1 -0
  113. package/dist/core/predictive-search/form.d.mts +31 -0
  114. package/dist/core/predictive-search/form.mjs +31 -0
  115. package/dist/core/predictive-search/form.mjs.map +1 -0
  116. package/dist/core/predictive-search/index.d.mts +6 -0
  117. package/dist/core/predictive-search/queries.d.mts +118 -0
  118. package/dist/core/predictive-search/queries.mjs +81 -0
  119. package/dist/core/predictive-search/queries.mjs.map +1 -0
  120. package/dist/core/predictive-search/search.d.mts +32 -0
  121. package/dist/core/predictive-search/search.mjs +74 -0
  122. package/dist/core/predictive-search/search.mjs.map +1 -0
  123. package/dist/core/predictive-search/server-handlers.d.mts +36 -0
  124. package/dist/core/predictive-search/server-handlers.mjs +113 -0
  125. package/dist/core/predictive-search/server-handlers.mjs.map +1 -0
  126. package/dist/core/predictive-search/store.d.mts +44 -0
  127. package/dist/core/predictive-search/store.mjs +224 -0
  128. package/dist/core/predictive-search/store.mjs.map +1 -0
  129. package/dist/core/predictive-search/url.d.mts +41 -0
  130. package/dist/core/predictive-search/url.mjs +71 -0
  131. package/dist/core/predictive-search/url.mjs.map +1 -0
  132. package/dist/core/product/accept-variant-id.mjs +98 -0
  133. package/dist/core/product/accept-variant-id.mjs.map +1 -0
  134. package/dist/core/product/form.d.mts +63 -0
  135. package/dist/core/product/form.mjs +44 -0
  136. package/dist/core/product/form.mjs.map +1 -0
  137. package/dist/core/product/index.d.mts +5 -0
  138. package/dist/core/product/options.d.mts +43 -0
  139. package/dist/core/product/options.mjs +296 -0
  140. package/dist/core/product/options.mjs.map +1 -0
  141. package/dist/core/product/product-form.d.mts +72 -0
  142. package/dist/core/product/product-form.mjs +158 -0
  143. package/dist/core/product/product-form.mjs.map +1 -0
  144. package/dist/core/product/state.d.mts +68 -0
  145. package/dist/core/product/url.d.mts +47 -0
  146. package/dist/core/product/url.mjs +69 -0
  147. package/dist/core/product/url.mjs.map +1 -0
  148. package/dist/core/request-context.d.mts +75 -0
  149. package/dist/core/request-context.mjs +141 -0
  150. package/dist/core/request-context.mjs.map +1 -0
  151. package/dist/core/request-routing/handle-shopify-redirects.d.mts +17 -0
  152. package/dist/core/request-routing/handle-shopify-redirects.mjs +31 -0
  153. package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -0
  154. package/dist/core/request-routing/handle-shopify-routes.d.mts +14 -0
  155. package/dist/core/request-routing/handle-shopify-routes.mjs +42 -0
  156. package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -0
  157. package/dist/core/request-routing/interceptors/admin-redirect.mjs +12 -0
  158. package/dist/core/request-routing/interceptors/admin-redirect.mjs.map +1 -0
  159. package/dist/core/request-routing/interceptors/ajax-api.mjs +16 -0
  160. package/dist/core/request-routing/interceptors/ajax-api.mjs.map +1 -0
  161. package/dist/core/request-routing/interceptors/api-proxy.mjs +20 -0
  162. package/dist/core/request-routing/interceptors/api-proxy.mjs.map +1 -0
  163. package/dist/core/request-routing/interceptors/checkout.mjs +58 -0
  164. package/dist/core/request-routing/interceptors/checkout.mjs.map +1 -0
  165. package/dist/core/request-routing/interceptors/mcp-proxy.mjs +23 -0
  166. package/dist/core/request-routing/interceptors/mcp-proxy.mjs.map +1 -0
  167. package/dist/core/request-routing/interceptors/proxy.mjs +73 -0
  168. package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -0
  169. package/dist/core/request-routing/interceptors/query-param-redirect.mjs +22 -0
  170. package/dist/core/request-routing/interceptors/query-param-redirect.mjs.map +1 -0
  171. package/dist/core/request-routing/interceptors/sfapi-proxy.mjs +27 -0
  172. package/dist/core/request-routing/interceptors/sfapi-proxy.mjs.map +1 -0
  173. package/dist/core/request-routing/interceptors/standard-routes.mjs +19 -0
  174. package/dist/core/request-routing/interceptors/standard-routes.mjs.map +1 -0
  175. package/dist/core/request-routing/interceptors/url-redirects.mjs +27 -0
  176. package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -0
  177. package/dist/core/request-routing/interceptors/well-known.mjs +22 -0
  178. package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -0
  179. package/dist/core/request-routing/registered-routes.d.mts +7 -0
  180. package/dist/core/request-routing/registered-routes.mjs +72 -0
  181. package/dist/core/request-routing/registered-routes.mjs.map +1 -0
  182. package/dist/core/request-routing/route-types.d.mts +56 -0
  183. package/dist/core/request-routing/safe-apply-response-headers.mjs +16 -0
  184. package/dist/core/request-routing/safe-apply-response-headers.mjs.map +1 -0
  185. package/dist/core/shop-pay/shop-pay.d.mts +102 -0
  186. package/dist/core/shop-pay/shop-pay.mjs +289 -0
  187. package/dist/core/shop-pay/shop-pay.mjs.map +1 -0
  188. package/dist/core/shopify-scripts/analytics.mjs +26 -0
  189. package/dist/core/shopify-scripts/analytics.mjs.map +1 -0
  190. package/dist/core/shopify-scripts/consent.mjs +17 -0
  191. package/dist/core/shopify-scripts/consent.mjs.map +1 -0
  192. package/dist/core/shopify-scripts/constants.mjs +19 -0
  193. package/dist/core/shopify-scripts/constants.mjs.map +1 -0
  194. package/dist/core/shopify-scripts/deprecated-cookies.mjs +97 -0
  195. package/dist/core/shopify-scripts/deprecated-cookies.mjs.map +1 -0
  196. package/dist/core/shopify-scripts/global.d.mts +1 -0
  197. package/dist/core/shopify-scripts/global.mjs +86 -0
  198. package/dist/core/shopify-scripts/global.mjs.map +1 -0
  199. package/dist/core/shopify-scripts/index.d.mts +27 -0
  200. package/dist/core/shopify-scripts/index.mjs +135 -0
  201. package/dist/core/shopify-scripts/index.mjs.map +1 -0
  202. package/dist/core/shopify-scripts/initialize.d.mts +18 -0
  203. package/dist/core/shopify-scripts/initialize.mjs +27 -0
  204. package/dist/core/shopify-scripts/initialize.mjs.map +1 -0
  205. package/dist/core/shopify-scripts/page-view.mjs +49 -0
  206. package/dist/core/shopify-scripts/page-view.mjs.map +1 -0
  207. package/dist/core/shopify-scripts/perfkit.mjs +33 -0
  208. package/dist/core/shopify-scripts/perfkit.mjs.map +1 -0
  209. package/dist/core/shopify-scripts/render.d.mts +1 -0
  210. package/dist/core/shopify-scripts/render.mjs +23 -0
  211. package/dist/core/shopify-scripts/render.mjs.map +1 -0
  212. package/dist/core/shopify-scripts/types.d.mts +76 -0
  213. package/dist/core/shopify-scripts/utils/cookie-domain.mjs +43 -0
  214. package/dist/core/shopify-scripts/utils/cookie-domain.mjs.map +1 -0
  215. package/dist/core/shopify-scripts/utils/inline-script.mjs +8 -0
  216. package/dist/core/shopify-scripts/utils/inline-script.mjs.map +1 -0
  217. package/dist/core/shopify-scripts/utils/navigation.mjs +46 -0
  218. package/dist/core/shopify-scripts/utils/navigation.mjs.map +1 -0
  219. package/dist/core/shopify-scripts/utils/tracking-values.mjs +65 -0
  220. package/dist/core/shopify-scripts/utils/tracking-values.mjs.map +1 -0
  221. package/dist/core/shopify-scripts/utils/uuid.mjs +17 -0
  222. package/dist/core/shopify-scripts/utils/uuid.mjs.map +1 -0
  223. package/dist/core/shopify-scripts/webmcp.mjs +22 -0
  224. package/dist/core/shopify-scripts/webmcp.mjs.map +1 -0
  225. package/dist/core/standard-routes/build.d.mts +34 -0
  226. package/dist/core/standard-routes/build.mjs +54 -0
  227. package/dist/core/standard-routes/build.mjs.map +1 -0
  228. package/dist/core/standard-routes/defaults.mjs +31 -0
  229. package/dist/core/standard-routes/defaults.mjs.map +1 -0
  230. package/dist/core/standard-routes/match.mjs +108 -0
  231. package/dist/core/standard-routes/match.mjs.map +1 -0
  232. package/dist/core/standard-routes/path.mjs +58 -0
  233. package/dist/core/standard-routes/path.mjs.map +1 -0
  234. package/dist/core/standard-routes/redirects.mjs +51 -0
  235. package/dist/core/standard-routes/redirects.mjs.map +1 -0
  236. package/dist/core/standard-routes/types.d.mts +95 -0
  237. package/dist/core/url.mjs +42 -0
  238. package/dist/core/url.mjs.map +1 -0
  239. package/dist/core/utils/load-script.mjs +34 -0
  240. package/dist/core/utils/load-script.mjs.map +1 -0
  241. package/dist/core/utils/parse-gid.mjs +33 -0
  242. package/dist/core/utils/parse-gid.mjs.map +1 -0
  243. package/dist/core/utils/record.mjs +8 -0
  244. package/dist/core/utils/record.mjs.map +1 -0
  245. package/dist/customer-account/client.d.mts +50 -0
  246. package/dist/customer-account/client.mjs +239 -0
  247. package/dist/customer-account/client.mjs.map +1 -0
  248. package/dist/customer-account/errors.d.mts +28 -0
  249. package/dist/customer-account/errors.mjs +39 -0
  250. package/dist/customer-account/errors.mjs.map +1 -0
  251. package/dist/customer-account/graphql.d.mts +29 -0
  252. package/dist/customer-account/graphql.mjs +39 -0
  253. package/dist/customer-account/graphql.mjs.map +1 -0
  254. package/dist/customer-account/index.d.mts +7 -0
  255. package/dist/customer-account/index.mjs +7 -0
  256. package/dist/customer-account/session.d.mts +117 -0
  257. package/dist/customer-account/session.mjs +733 -0
  258. package/dist/customer-account/session.mjs.map +1 -0
  259. package/dist/customer-account/type-resolver.d.mts +11 -0
  260. package/dist/customer-account-api-types.d.ts +3269 -3270
  261. package/dist/customer-account.schema.json +50753 -1
  262. package/dist/development/_virtual/_@oxc-project_runtime@0.127.0/helpers/taggedTemplateLiteral.mjs +7 -0
  263. package/dist/development/client/client.d.mts +34 -0
  264. package/dist/development/client/client.mjs +206 -0
  265. package/dist/development/client/client.mjs.map +1 -0
  266. package/dist/development/client/errors.d.mts +48 -0
  267. package/dist/development/client/errors.mjs +57 -0
  268. package/dist/development/client/errors.mjs.map +1 -0
  269. package/dist/development/client/index.d.mts +4 -0
  270. package/dist/development/client/types.d.mts +147 -0
  271. package/dist/development/core/analytics/cart-tracker.d.mts +8 -0
  272. package/dist/development/core/analytics/cart-tracker.mjs +144 -0
  273. package/dist/development/core/analytics/cart-tracker.mjs.map +1 -0
  274. package/dist/development/core/analytics/events.d.mts +15 -0
  275. package/dist/development/core/analytics/events.mjs +15 -0
  276. package/dist/development/core/analytics/events.mjs.map +1 -0
  277. package/dist/development/core/analytics/index.d.mts +3 -0
  278. package/dist/development/core/analytics/types.d.mts +143 -0
  279. package/dist/development/core/analytics/utils/flatten-connection.d.mts +19 -0
  280. package/dist/development/core/analytics/utils/flatten-connection.mjs +25 -0
  281. package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -0
  282. package/dist/development/core/cache/cache-status.mjs +17 -0
  283. package/dist/development/core/cache/cache-status.mjs.map +1 -0
  284. package/dist/development/core/cache/fetch-with-cache.d.mts +43 -0
  285. package/dist/development/core/cache/fetch-with-cache.mjs +188 -0
  286. package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -0
  287. package/dist/development/core/cache/key.d.mts +6 -0
  288. package/dist/development/core/cache/key.mjs +27 -0
  289. package/dist/development/core/cache/key.mjs.map +1 -0
  290. package/dist/development/core/cache/run-with-cache.d.mts +36 -0
  291. package/dist/development/core/cache/run-with-cache.mjs +114 -0
  292. package/dist/development/core/cache/run-with-cache.mjs.map +1 -0
  293. package/dist/development/core/cache/store.d.mts +19 -0
  294. package/dist/development/core/cache/store.mjs +62 -0
  295. package/dist/development/core/cache/store.mjs.map +1 -0
  296. package/dist/development/core/cache/strategies.d.mts +39 -0
  297. package/dist/development/core/cache/strategies.mjs +70 -0
  298. package/dist/development/core/cache/strategies.mjs.map +1 -0
  299. package/dist/development/core/cart/actions.d.mts +50 -0
  300. package/dist/development/core/cart/actions.mjs +240 -0
  301. package/dist/development/core/cart/actions.mjs.map +1 -0
  302. package/dist/development/core/cart/attach-quantity-input.d.mts +5 -0
  303. package/dist/development/core/cart/attach-quantity-input.mjs +17 -0
  304. package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -0
  305. package/dist/development/core/cart/buyer-identity-sync.d.mts +19 -0
  306. package/dist/development/core/cart/buyer-identity-sync.mjs +6 -0
  307. package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -0
  308. package/dist/development/core/cart/cart.d.mts +37 -0
  309. package/dist/development/core/cart/cart.mjs +1707 -0
  310. package/dist/development/core/cart/cart.mjs.map +1 -0
  311. package/dist/development/core/cart/cookie.d.mts +5 -0
  312. package/dist/development/core/cart/cookie.mjs +28 -0
  313. package/dist/development/core/cart/cookie.mjs.map +1 -0
  314. package/dist/development/core/cart/form.d.mts +130 -0
  315. package/dist/development/core/cart/form.mjs +75 -0
  316. package/dist/development/core/cart/form.mjs.map +1 -0
  317. package/dist/development/core/cart/get-cart.d.mts +25 -0
  318. package/dist/development/core/cart/get-cart.mjs +32 -0
  319. package/dist/development/core/cart/get-cart.mjs.map +1 -0
  320. package/dist/development/core/cart/index.d.mts +10 -0
  321. package/dist/development/core/cart/quantity.d.mts +10 -0
  322. package/dist/development/core/cart/quantity.mjs +14 -0
  323. package/dist/development/core/cart/quantity.mjs.map +1 -0
  324. package/dist/development/core/cart/queries.d.mts +4296 -0
  325. package/dist/development/core/cart/queries.mjs +70 -0
  326. package/dist/development/core/cart/queries.mjs.map +1 -0
  327. package/dist/development/core/cart/server-handlers.d.mts +82 -0
  328. package/dist/development/core/cart/server-handlers.mjs +322 -0
  329. package/dist/development/core/cart/server-handlers.mjs.map +1 -0
  330. package/dist/development/core/cart/state.d.mts +137 -0
  331. package/dist/development/core/cart/state.mjs +76 -0
  332. package/dist/development/core/cart/state.mjs.map +1 -0
  333. package/dist/development/core/cart/sync-quantity-inputs.mjs +16 -0
  334. package/dist/development/core/cart/sync-quantity-inputs.mjs.map +1 -0
  335. package/dist/development/core/collection/collection.d.mts +134 -0
  336. package/dist/development/core/collection/collection.mjs +170 -0
  337. package/dist/development/core/collection/collection.mjs.map +1 -0
  338. package/dist/development/core/collection/index.d.mts +6 -0
  339. package/dist/development/core/collection/reconciler.d.mts +32 -0
  340. package/dist/development/core/collection/reconciler.mjs +89 -0
  341. package/dist/development/core/collection/reconciler.mjs.map +1 -0
  342. package/dist/development/core/collection/state.d.mts +66 -0
  343. package/dist/development/core/collection/state.mjs +20 -0
  344. package/dist/development/core/collection/state.mjs.map +1 -0
  345. package/dist/development/core/collection/url.d.mts +71 -0
  346. package/dist/development/core/collection/url.mjs +376 -0
  347. package/dist/development/core/collection/url.mjs.map +1 -0
  348. package/dist/development/core/constants.mjs +7 -0
  349. package/dist/development/core/constants.mjs.map +1 -0
  350. package/dist/development/core/development.d.mts +56 -0
  351. package/dist/development/core/development.mjs +45 -0
  352. package/dist/development/core/headers.mjs +43 -0
  353. package/dist/development/core/headers.mjs.map +1 -0
  354. package/dist/development/core/index.d.mts +54 -0
  355. package/dist/development/core/logging/logging.d.mts +21 -0
  356. package/dist/development/core/logging/logging.mjs +99 -0
  357. package/dist/development/core/logging/logging.mjs.map +1 -0
  358. package/dist/development/core/logging/types.d.mts +40 -0
  359. package/dist/development/core/logging/types.mjs +18 -0
  360. package/dist/development/core/logging/types.mjs.map +1 -0
  361. package/dist/development/core/money/cache.mjs +25 -0
  362. package/dist/development/core/money/cache.mjs.map +1 -0
  363. package/dist/development/core/money/format.d.mts +15 -0
  364. package/dist/development/core/money/format.mjs +243 -0
  365. package/dist/development/core/money/format.mjs.map +1 -0
  366. package/dist/development/core/money/types.d.mts +47 -0
  367. package/dist/development/core/observable.mjs +46 -0
  368. package/dist/development/core/observable.mjs.map +1 -0
  369. package/dist/development/core/predictive-search/constants.d.mts +5 -0
  370. package/dist/development/core/predictive-search/constants.mjs +6 -0
  371. package/dist/development/core/predictive-search/constants.mjs.map +1 -0
  372. package/dist/development/core/predictive-search/form.d.mts +31 -0
  373. package/dist/development/core/predictive-search/form.mjs +31 -0
  374. package/dist/development/core/predictive-search/form.mjs.map +1 -0
  375. package/dist/development/core/predictive-search/index.d.mts +6 -0
  376. package/dist/development/core/predictive-search/queries.d.mts +118 -0
  377. package/dist/development/core/predictive-search/queries.mjs +81 -0
  378. package/dist/development/core/predictive-search/queries.mjs.map +1 -0
  379. package/dist/development/core/predictive-search/search.d.mts +32 -0
  380. package/dist/development/core/predictive-search/search.mjs +74 -0
  381. package/dist/development/core/predictive-search/search.mjs.map +1 -0
  382. package/dist/development/core/predictive-search/server-handlers.d.mts +36 -0
  383. package/dist/development/core/predictive-search/server-handlers.mjs +113 -0
  384. package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -0
  385. package/dist/development/core/predictive-search/store.d.mts +44 -0
  386. package/dist/development/core/predictive-search/store.mjs +224 -0
  387. package/dist/development/core/predictive-search/store.mjs.map +1 -0
  388. package/dist/development/core/predictive-search/url.d.mts +41 -0
  389. package/dist/development/core/predictive-search/url.mjs +71 -0
  390. package/dist/development/core/predictive-search/url.mjs.map +1 -0
  391. package/dist/development/core/product/accept-variant-id.mjs +98 -0
  392. package/dist/development/core/product/accept-variant-id.mjs.map +1 -0
  393. package/dist/development/core/product/form.d.mts +63 -0
  394. package/dist/development/core/product/form.mjs +44 -0
  395. package/dist/development/core/product/form.mjs.map +1 -0
  396. package/dist/development/core/product/index.d.mts +5 -0
  397. package/dist/development/core/product/options.d.mts +43 -0
  398. package/dist/development/core/product/options.mjs +296 -0
  399. package/dist/development/core/product/options.mjs.map +1 -0
  400. package/dist/development/core/product/product-form.d.mts +72 -0
  401. package/dist/development/core/product/product-form.mjs +158 -0
  402. package/dist/development/core/product/product-form.mjs.map +1 -0
  403. package/dist/development/core/product/state.d.mts +68 -0
  404. package/dist/development/core/product/url.d.mts +47 -0
  405. package/dist/development/core/product/url.mjs +69 -0
  406. package/dist/development/core/product/url.mjs.map +1 -0
  407. package/dist/development/core/request-context.d.mts +75 -0
  408. package/dist/development/core/request-context.mjs +141 -0
  409. package/dist/development/core/request-context.mjs.map +1 -0
  410. package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +17 -0
  411. package/dist/development/core/request-routing/handle-shopify-redirects.mjs +31 -0
  412. package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -0
  413. package/dist/development/core/request-routing/handle-shopify-routes.d.mts +1 -0
  414. package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +11 -0
  415. package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +16 -0
  416. package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -0
  417. package/dist/development/core/request-routing/handle-shopify-routes.mjs +42 -0
  418. package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -0
  419. package/dist/development/core/request-routing/interceptors/admin-redirect.mjs +12 -0
  420. package/dist/development/core/request-routing/interceptors/admin-redirect.mjs.map +1 -0
  421. package/dist/development/core/request-routing/interceptors/ajax-api.mjs +16 -0
  422. package/dist/development/core/request-routing/interceptors/ajax-api.mjs.map +1 -0
  423. package/dist/development/core/request-routing/interceptors/api-proxy.mjs +20 -0
  424. package/dist/development/core/request-routing/interceptors/api-proxy.mjs.map +1 -0
  425. package/dist/development/core/request-routing/interceptors/checkout.mjs +58 -0
  426. package/dist/development/core/request-routing/interceptors/checkout.mjs.map +1 -0
  427. package/dist/development/core/request-routing/interceptors/graphiql.mjs +46 -0
  428. package/dist/development/core/request-routing/interceptors/graphiql.mjs.map +1 -0
  429. package/dist/development/core/request-routing/interceptors/mcp-proxy.mjs +23 -0
  430. package/dist/development/core/request-routing/interceptors/mcp-proxy.mjs.map +1 -0
  431. package/dist/development/core/request-routing/interceptors/proxy.mjs +73 -0
  432. package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -0
  433. package/dist/development/core/request-routing/interceptors/query-param-redirect.mjs +22 -0
  434. package/dist/development/core/request-routing/interceptors/query-param-redirect.mjs.map +1 -0
  435. package/dist/development/core/request-routing/interceptors/sfapi-proxy.mjs +27 -0
  436. package/dist/development/core/request-routing/interceptors/sfapi-proxy.mjs.map +1 -0
  437. package/dist/development/core/request-routing/interceptors/standard-routes.mjs +19 -0
  438. package/dist/development/core/request-routing/interceptors/standard-routes.mjs.map +1 -0
  439. package/dist/development/core/request-routing/interceptors/url-redirects.mjs +27 -0
  440. package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -0
  441. package/dist/development/core/request-routing/interceptors/well-known.mjs +22 -0
  442. package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -0
  443. package/dist/development/core/request-routing/registered-routes.d.mts +7 -0
  444. package/dist/development/core/request-routing/registered-routes.mjs +72 -0
  445. package/dist/development/core/request-routing/registered-routes.mjs.map +1 -0
  446. package/dist/development/core/request-routing/route-types.d.mts +56 -0
  447. package/dist/development/core/request-routing/safe-apply-response-headers.mjs +16 -0
  448. package/dist/development/core/request-routing/safe-apply-response-headers.mjs.map +1 -0
  449. package/dist/development/core/shop-pay/shop-pay.d.mts +102 -0
  450. package/dist/development/core/shop-pay/shop-pay.mjs +289 -0
  451. package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -0
  452. package/dist/development/core/shopify-scripts/analytics.mjs +26 -0
  453. package/dist/development/core/shopify-scripts/analytics.mjs.map +1 -0
  454. package/dist/development/core/shopify-scripts/consent.mjs +17 -0
  455. package/dist/development/core/shopify-scripts/consent.mjs.map +1 -0
  456. package/dist/development/core/shopify-scripts/constants.mjs +19 -0
  457. package/dist/development/core/shopify-scripts/constants.mjs.map +1 -0
  458. package/dist/development/core/shopify-scripts/deprecated-cookies.mjs +97 -0
  459. package/dist/development/core/shopify-scripts/deprecated-cookies.mjs.map +1 -0
  460. package/dist/development/core/shopify-scripts/global.d.mts +1 -0
  461. package/dist/development/core/shopify-scripts/global.mjs +86 -0
  462. package/dist/development/core/shopify-scripts/global.mjs.map +1 -0
  463. package/dist/development/core/shopify-scripts/index.d.mts +27 -0
  464. package/dist/development/core/shopify-scripts/index.mjs +145 -0
  465. package/dist/development/core/shopify-scripts/index.mjs.map +1 -0
  466. package/dist/development/core/shopify-scripts/initialize.d.mts +18 -0
  467. package/dist/development/core/shopify-scripts/initialize.mjs +27 -0
  468. package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -0
  469. package/dist/development/core/shopify-scripts/page-view.mjs +49 -0
  470. package/dist/development/core/shopify-scripts/page-view.mjs.map +1 -0
  471. package/dist/development/core/shopify-scripts/perfkit.mjs +33 -0
  472. package/dist/development/core/shopify-scripts/perfkit.mjs.map +1 -0
  473. package/dist/development/core/shopify-scripts/render.d.mts +1 -0
  474. package/dist/development/core/shopify-scripts/render.mjs +23 -0
  475. package/dist/development/core/shopify-scripts/render.mjs.map +1 -0
  476. package/dist/development/core/shopify-scripts/types.d.mts +76 -0
  477. package/dist/development/core/shopify-scripts/utils/cookie-domain.mjs +43 -0
  478. package/dist/development/core/shopify-scripts/utils/cookie-domain.mjs.map +1 -0
  479. package/dist/development/core/shopify-scripts/utils/inline-script.mjs +8 -0
  480. package/dist/development/core/shopify-scripts/utils/inline-script.mjs.map +1 -0
  481. package/dist/development/core/shopify-scripts/utils/navigation.mjs +46 -0
  482. package/dist/development/core/shopify-scripts/utils/navigation.mjs.map +1 -0
  483. package/dist/development/core/shopify-scripts/utils/tracking-values.mjs +65 -0
  484. package/dist/development/core/shopify-scripts/utils/tracking-values.mjs.map +1 -0
  485. package/dist/development/core/shopify-scripts/utils/uuid.mjs +17 -0
  486. package/dist/development/core/shopify-scripts/utils/uuid.mjs.map +1 -0
  487. package/dist/development/core/shopify-scripts/webmcp.mjs +22 -0
  488. package/dist/development/core/shopify-scripts/webmcp.mjs.map +1 -0
  489. package/dist/development/core/standard-routes/build.d.mts +34 -0
  490. package/dist/development/core/standard-routes/build.mjs +54 -0
  491. package/dist/development/core/standard-routes/build.mjs.map +1 -0
  492. package/dist/development/core/standard-routes/defaults.mjs +31 -0
  493. package/dist/development/core/standard-routes/defaults.mjs.map +1 -0
  494. package/dist/development/core/standard-routes/match.mjs +108 -0
  495. package/dist/development/core/standard-routes/match.mjs.map +1 -0
  496. package/dist/development/core/standard-routes/path.mjs +58 -0
  497. package/dist/development/core/standard-routes/path.mjs.map +1 -0
  498. package/dist/development/core/standard-routes/redirects.mjs +51 -0
  499. package/dist/development/core/standard-routes/redirects.mjs.map +1 -0
  500. package/dist/development/core/standard-routes/types.d.mts +95 -0
  501. package/dist/development/core/types.d.mts +11 -0
  502. package/dist/development/core/url.mjs +42 -0
  503. package/dist/development/core/url.mjs.map +1 -0
  504. package/dist/development/core/utils/load-script.mjs +34 -0
  505. package/dist/development/core/utils/load-script.mjs.map +1 -0
  506. package/dist/development/core/utils/parse-gid.mjs +33 -0
  507. package/dist/development/core/utils/parse-gid.mjs.map +1 -0
  508. package/dist/development/customer-account/session.d.mts +46 -0
  509. package/dist/development/customer-account/session.mjs +21 -0
  510. package/dist/development/customer-account/session.mjs.map +1 -0
  511. package/dist/development/globals.d.mts +64 -0
  512. package/dist/development/graphql/generated/customer-account-api-types.d.mts +13 -0
  513. package/dist/development/graphql/generated/graphql-env.d.mts +19280 -0
  514. package/dist/development/graphql/generated/storefront-api-types.d.mts +47 -0
  515. package/dist/development/graphql/graphql.d.mts +40 -0
  516. package/dist/development/graphql/graphql.mjs +16 -0
  517. package/dist/development/graphql/graphql.mjs.map +1 -0
  518. package/dist/development/graphql/index.d.mts +2 -0
  519. package/dist/development/graphql/scalars.d.mts +15 -0
  520. package/dist/development/graphql/type-resolver.d.mts +229 -0
  521. package/dist/development/react/cart.d.mts +44 -0
  522. package/dist/development/react/cart.mjs +155 -0
  523. package/dist/development/react/cart.mjs.map +1 -0
  524. package/dist/development/react/collection.d.mts +91 -0
  525. package/dist/development/react/collection.mjs +129 -0
  526. package/dist/development/react/collection.mjs.map +1 -0
  527. package/dist/development/react/index.d.mts +13 -0
  528. package/dist/development/react/index.mjs +10 -0
  529. package/dist/development/react/predictive-search.d.mts +49 -0
  530. package/dist/development/react/predictive-search.mjs +133 -0
  531. package/dist/development/react/predictive-search.mjs.map +1 -0
  532. package/dist/development/react/product.d.mts +72 -0
  533. package/dist/development/react/product.mjs +127 -0
  534. package/dist/development/react/product.mjs.map +1 -0
  535. package/dist/development/react/shop-pay.d.mts +9 -0
  536. package/dist/development/react/shop-pay.mjs +16 -0
  537. package/dist/development/react/shop-pay.mjs.map +1 -0
  538. package/dist/development/react/shopify-scripts.d.mts +20 -0
  539. package/dist/development/react/shopify-scripts.mjs +39 -0
  540. package/dist/development/react/shopify-scripts.mjs.map +1 -0
  541. package/dist/development/vendor/standard-actions.d.mts +134 -0
  542. package/dist/development/vendor/standard-events.d.mts +1107 -0
  543. package/dist/development/vue/cart.d.mts +46 -0
  544. package/dist/development/vue/cart.mjs +122 -0
  545. package/dist/development/vue/cart.mjs.map +1 -0
  546. package/dist/development/vue/collection.d.mts +46 -0
  547. package/dist/development/vue/collection.mjs +108 -0
  548. package/dist/development/vue/collection.mjs.map +1 -0
  549. package/dist/development/vue/index.d.mts +11 -0
  550. package/dist/development/vue/index.mjs +8 -0
  551. package/dist/development/vue/predictive-search.d.mts +124 -0
  552. package/dist/development/vue/predictive-search.mjs +171 -0
  553. package/dist/development/vue/predictive-search.mjs.map +1 -0
  554. package/dist/development/vue/product.d.mts +57 -0
  555. package/dist/development/vue/product.mjs +167 -0
  556. package/dist/development/vue/product.mjs.map +1 -0
  557. package/dist/development/vue/shop-pay.d.mts +25 -0
  558. package/dist/development/vue/shop-pay.mjs +35 -0
  559. package/dist/development/vue/shop-pay.mjs.map +1 -0
  560. package/dist/development/vue/shopify-scripts.d.mts +127 -0
  561. package/dist/development/vue/shopify-scripts.mjs +79 -0
  562. package/dist/development/vue/shopify-scripts.mjs.map +1 -0
  563. package/dist/globals.d.mts +64 -0
  564. package/dist/graphql/generated/customer-account-api-types.d.mts +13 -0
  565. package/dist/graphql/generated/customer-account-graphql-env.d.mts +22170 -0
  566. package/dist/graphql/generated/graphql-env.d.mts +19280 -0
  567. package/dist/graphql/generated/storefront-api-types.d.mts +47 -0
  568. package/dist/graphql/graphql.d.mts +40 -0
  569. package/dist/graphql/graphql.mjs +16 -0
  570. package/dist/graphql/graphql.mjs.map +1 -0
  571. package/dist/graphql/index.d.mts +2 -0
  572. package/dist/graphql/scalars.d.mts +26 -0
  573. package/dist/graphql/type-resolver.d.mts +229 -0
  574. package/dist/react/cart.d.mts +44 -0
  575. package/dist/react/cart.mjs +155 -0
  576. package/dist/react/cart.mjs.map +1 -0
  577. package/dist/react/collection.d.mts +91 -0
  578. package/dist/react/collection.mjs +129 -0
  579. package/dist/react/collection.mjs.map +1 -0
  580. package/dist/react/index.d.mts +13 -0
  581. package/dist/react/index.mjs +10 -0
  582. package/dist/react/predictive-search.d.mts +49 -0
  583. package/dist/react/predictive-search.mjs +133 -0
  584. package/dist/react/predictive-search.mjs.map +1 -0
  585. package/dist/react/product.d.mts +72 -0
  586. package/dist/react/product.mjs +127 -0
  587. package/dist/react/product.mjs.map +1 -0
  588. package/dist/react/shop-pay.d.mts +9 -0
  589. package/dist/react/shop-pay.mjs +16 -0
  590. package/dist/react/shop-pay.mjs.map +1 -0
  591. package/dist/react/shopify-scripts.d.mts +20 -0
  592. package/dist/react/shopify-scripts.mjs +39 -0
  593. package/dist/react/shopify-scripts.mjs.map +1 -0
  594. package/dist/storefront-api-types.d.ts +2351 -2390
  595. package/dist/storefront.schema.json +41534 -1
  596. package/dist/ts-plugin/index.cjs +68 -0
  597. package/dist/ts-plugin/index.cjs.map +1 -0
  598. package/dist/ts-plugin/index.d.cts +4 -0
  599. package/dist/vendor/standard-actions.d.mts +134 -0
  600. package/dist/vendor/standard-events.d.mts +1107 -0
  601. package/dist/vite/certificate-prompt.mjs +24 -0
  602. package/dist/vite/certificate-prompt.mjs.map +1 -0
  603. package/dist/vite/index.d.mts +2 -0
  604. package/dist/vite/index.mjs +3 -0
  605. package/dist/vite/local-https.d.mts +47 -0
  606. package/dist/vite/local-https.mjs +276 -0
  607. package/dist/vite/local-https.mjs.map +1 -0
  608. package/dist/vite/mkcert.mjs +141 -0
  609. package/dist/vite/mkcert.mjs.map +1 -0
  610. package/dist/vue/cart.d.mts +46 -0
  611. package/dist/vue/cart.mjs +122 -0
  612. package/dist/vue/cart.mjs.map +1 -0
  613. package/dist/vue/collection.d.mts +46 -0
  614. package/dist/vue/collection.mjs +108 -0
  615. package/dist/vue/collection.mjs.map +1 -0
  616. package/dist/vue/index.d.mts +11 -0
  617. package/dist/vue/index.mjs +8 -0
  618. package/dist/vue/predictive-search.d.mts +124 -0
  619. package/dist/vue/predictive-search.mjs +171 -0
  620. package/dist/vue/predictive-search.mjs.map +1 -0
  621. package/dist/vue/product.d.mts +57 -0
  622. package/dist/vue/product.mjs +167 -0
  623. package/dist/vue/product.mjs.map +1 -0
  624. package/dist/vue/shop-pay.d.mts +25 -0
  625. package/dist/vue/shop-pay.mjs +35 -0
  626. package/dist/vue/shop-pay.mjs.map +1 -0
  627. package/dist/vue/shopify-scripts.d.mts +127 -0
  628. package/dist/vue/shopify-scripts.mjs +79 -0
  629. package/dist/vue/shopify-scripts.mjs.map +1 -0
  630. package/package.json +116 -86
  631. package/skills/hydrogen-analytics/SKILL.md +80 -0
  632. package/skills/hydrogen-analytics/references/react.md +160 -0
  633. package/skills/hydrogen-analytics/references/vue.md +80 -0
  634. package/skills/hydrogen-cart-drawer/SKILL.md +248 -0
  635. package/skills/hydrogen-cart-drawer/references/accessibility.md +109 -0
  636. package/skills/hydrogen-cart-drawer/references/css.md +67 -0
  637. package/skills/hydrogen-cart-ui/SKILL.md +224 -0
  638. package/skills/hydrogen-cart-ui/references/nextjs.md +89 -0
  639. package/skills/hydrogen-cart-ui/references/react.md +285 -0
  640. package/skills/hydrogen-cart-ui/references/vue.md +228 -0
  641. package/skills/hydrogen-collection-browser/SKILL.md +83 -0
  642. package/skills/hydrogen-collection-browser/references/nextjs.md +118 -0
  643. package/skills/hydrogen-collection-browser/references/nuxt.md +108 -0
  644. package/skills/hydrogen-collection-browser/references/react.md +301 -0
  645. package/skills/hydrogen-customer-account/SKILL.md +107 -0
  646. package/skills/hydrogen-image/SKILL.md +65 -0
  647. package/skills/hydrogen-local-https/SKILL.md +142 -0
  648. package/skills/hydrogen-markets/SKILL.md +221 -0
  649. package/skills/hydrogen-markets/references/nextjs.md +157 -0
  650. package/skills/hydrogen-money/SKILL.md +67 -0
  651. package/skills/hydrogen-oxygen/SKILL.md +245 -0
  652. package/skills/hydrogen-oxygen/references/react-router.md +230 -0
  653. package/skills/hydrogen-predictive-search/SKILL.md +130 -0
  654. package/skills/hydrogen-predictive-search/references/react.md +32 -0
  655. package/skills/hydrogen-predictive-search/references/vue.md +40 -0
  656. package/skills/hydrogen-request-handlers/SKILL.md +107 -0
  657. package/skills/hydrogen-request-handlers/references/frameworks.md +179 -0
  658. package/skills/hydrogen-request-handlers/references/nextjs.md +137 -0
  659. package/skills/hydrogen-request-handlers/references/nuxt.md +215 -0
  660. package/skills/hydrogen-routing/SKILL.md +171 -0
  661. package/skills/hydrogen-setup/SKILL.md +50 -0
  662. package/skills/hydrogen-setup/references/analytics.md +624 -0
  663. package/skills/hydrogen-setup/steps/1-inspect-app.md +62 -0
  664. package/skills/hydrogen-setup/steps/10-analytics.md +10 -0
  665. package/skills/hydrogen-setup/steps/11-verify.md +31 -0
  666. package/skills/hydrogen-setup/steps/2-scaffold.md +86 -0
  667. package/skills/hydrogen-setup/steps/3-build-home-page.md +37 -0
  668. package/skills/hydrogen-setup/steps/4-collection-and-search.md +14 -0
  669. package/skills/hydrogen-setup/steps/5-cart.md +10 -0
  670. package/skills/hydrogen-setup/steps/6-product-detail-page.md +416 -0
  671. package/skills/hydrogen-setup/steps/7-shopify-runtime-scripts.md +69 -0
  672. package/skills/hydrogen-setup/steps/8-cart-drawer-and-navbar.md +35 -0
  673. package/skills/hydrogen-setup/steps/9-account-page.md +54 -0
  674. package/skills/hydrogen-shop-pay/SKILL.md +79 -0
  675. package/skills/hydrogen-shop-pay/references/core.md +66 -0
  676. package/skills/hydrogen-shop-pay/references/react.md +50 -0
  677. package/skills/hydrogen-shop-pay/references/vue.md +39 -0
  678. package/skills/hydrogen-smoke-test/SKILL.md +205 -0
  679. package/skills/hydrogen-storefront-client/SKILL.md +322 -0
  680. package/skills/hydrogen-storefront-client/references/astro.md +125 -0
  681. package/skills/hydrogen-storefront-client/references/caching.md +25 -0
  682. package/skills/hydrogen-storefront-client/references/nextjs.md +121 -0
  683. package/skills/hydrogen-storefront-client/references/nuxt.md +121 -0
  684. package/skills/hydrogen-storefront-client/references/query-validation.md +95 -0
  685. package/skills/hydrogen-storefront-client/references/react-router.md +81 -0
  686. package/skills/hydrogen-storefront-client/references/solidstart.md +131 -0
  687. package/skills/hydrogen-storefront-client/references/sveltekit.md +169 -0
  688. package/skills/hydrogen-variant-form/SKILL.md +267 -0
  689. package/skills/hydrogen-variant-form/references/nextjs.md +207 -0
  690. package/skills/hydrogen-variant-form/references/nuxt.md +95 -0
  691. package/skills/hydrogen-variant-form/references/react.md +71 -0
  692. package/dist/dev/get-virtual-routes-H72465VB.js +0 -74
  693. package/dist/dev/hydrogen-routes.d.ts +0 -5
  694. package/dist/dev/hydrogen-routes.js +0 -25
  695. package/dist/development/get-virtual-routes-ACFZHU42.js +0 -71
  696. package/dist/development/get-virtual-routes-ACFZHU42.js.map +0 -1
  697. package/dist/development/index.cjs +0 -6978
  698. package/dist/development/index.cjs.map +0 -1
  699. package/dist/development/index.js +0 -6631
  700. package/dist/development/index.js.map +0 -1
  701. package/dist/development/log-seo-tags-IG37ONQ2.js +0 -74
  702. package/dist/development/log-seo-tags-IG37ONQ2.js.map +0 -1
  703. package/dist/development/react-router-preset.d.ts +0 -45
  704. package/dist/development/react-router-preset.js +0 -49
  705. package/dist/development/react-router-preset.js.map +0 -1
  706. package/dist/index.cjs +0 -1
  707. package/dist/oxygen/index.d.ts +0 -197
  708. package/dist/oxygen/index.js +0 -107
  709. package/dist/production/get-virtual-routes-ZZEGQQDV.js +0 -3
  710. package/dist/production/get-virtual-routes-ZZEGQQDV.js.map +0 -1
  711. package/dist/production/index.cjs +0 -1019
  712. package/dist/production/index.cjs.map +0 -1
  713. package/dist/production/index.d.cts +0 -3260
  714. package/dist/production/index.d.ts +0 -3260
  715. package/dist/production/index.js +0 -1019
  716. package/dist/production/index.js.map +0 -1
  717. package/dist/production/log-seo-tags-TY72EQWZ.js +0 -2
  718. package/dist/production/log-seo-tags-TY72EQWZ.js.map +0 -1
  719. package/dist/production/react-router-preset.d.ts +0 -45
  720. package/dist/production/react-router-preset.js +0 -11
  721. package/dist/react-router.d.ts +0 -75
  722. package/dist/vite/chunk-4O5OI3OO.js +0 -127
  723. package/dist/vite/chunk-FAQ7TVHC.js +0 -9
  724. package/dist/vite/chunk-QXBQVDMY.js +0 -68
  725. package/dist/vite/compat-date.d.ts +0 -3
  726. package/dist/vite/compat-date.js +0 -6
  727. package/dist/vite/get-virtual-routes.d.ts +0 -21
  728. package/dist/vite/get-virtual-routes.js +0 -74
  729. package/dist/vite/hydrogen-middleware.d.ts +0 -9
  730. package/dist/vite/hydrogen-middleware.js +0 -7
  731. package/dist/vite/plugin.d.ts +0 -22
  732. package/dist/vite/plugin.js +0 -171
  733. package/dist/vite/request-events.d.ts +0 -144
  734. package/dist/vite/request-events.js +0 -10
  735. package/dist/vite/types.d.ts +0 -5
  736. package/dist/vite/types.js +0 -0
  737. package/dist/vite/virtual-routes/assets/debug-network.css +0 -609
  738. package/dist/vite/virtual-routes/assets/favicon-dark.svg +0 -20
  739. package/dist/vite/virtual-routes/assets/favicon.svg +0 -28
  740. package/dist/vite/virtual-routes/assets/inter-variable-font.woff2 +0 -0
  741. package/dist/vite/virtual-routes/assets/jetbrainsmono-variable-font.woff2 +0 -0
  742. package/dist/vite/virtual-routes/assets/styles.css +0 -249
  743. package/dist/vite/virtual-routes/components/FlameChartWrapper.jsx +0 -123
  744. package/dist/vite/virtual-routes/components/HydrogenLogoBaseBW.jsx +0 -32
  745. package/dist/vite/virtual-routes/components/HydrogenLogoBaseColor.jsx +0 -47
  746. package/dist/vite/virtual-routes/components/IconBanner.jsx +0 -292
  747. package/dist/vite/virtual-routes/components/IconClose.jsx +0 -38
  748. package/dist/vite/virtual-routes/components/IconDiscard.jsx +0 -44
  749. package/dist/vite/virtual-routes/components/IconError.jsx +0 -61
  750. package/dist/vite/virtual-routes/components/IconGithub.jsx +0 -23
  751. package/dist/vite/virtual-routes/components/IconTwitter.jsx +0 -21
  752. package/dist/vite/virtual-routes/components/Layout.jsx +0 -7
  753. package/dist/vite/virtual-routes/components/RequestDetails.jsx +0 -171
  754. package/dist/vite/virtual-routes/components/RequestTable.jsx +0 -91
  755. package/dist/vite/virtual-routes/components/RequestWaterfall.jsx +0 -151
  756. package/dist/vite/virtual-routes/layout.jsx +0 -33
  757. package/dist/vite/virtual-routes/lib/useDebugNetworkServer.jsx +0 -178
  758. package/dist/vite/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx +0 -37
  759. package/dist/vite/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.tsx +0 -79
  760. package/dist/vite/virtual-routes/routes/graphiql.jsx +0 -5
  761. package/dist/vite/virtual-routes/routes/index.jsx +0 -265
  762. package/dist/vite/virtual-routes/routes/subrequest-profiler.jsx +0 -243
  763. package/dist/vite/virtual-routes/virtual-root-with-layout.jsx +0 -63
  764. package/dist/vite/virtual-routes/virtual-root.jsx +0 -67
@@ -1,3260 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode, ComponentType, ScriptHTMLAttributes, FC, ForwardRefExoticComponent, RefAttributes, ComponentProps } from 'react';
3
- import { BuyerInput, Cart, CountryCode as CountryCode$1, LanguageCode as LanguageCode$1, VisitorConsent as VisitorConsent$1, CartInput, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartSelectedDeliveryOptionInput, AttributeInput, Scalars, CartSelectableAddressInput, CartSelectableAddressUpdateInput, CartMetafieldsSetInput, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, CartWarning, Product, ProductVariant, CartLine, ComponentizableCartLine, CurrencyCode, PageInfo, Maybe, ProductOptionValue, ProductOption, ProductVariantConnection, SelectedOptionInput } from '@shopify/hydrogen-react/storefront-api-types';
4
- import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, RichText as RichText$1, ShopPayButton as ShopPayButton$1 } from '@shopify/hydrogen-react';
5
- export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MappedProductOptions, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, decodeEncodedVariant, flattenConnection, getAdjacentAndFirstAvailableVariants, getClientBrowserParameters, getProductOptions, getShopifyCookies, getTrackingValues, isOptionValueCombinationInEncodedVariant, mapSelectedProductOptionToObject, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useSelectedOptionInUrlParam, useShopifyCookies } from '@shopify/hydrogen-react';
6
- import { LanguageCode, CountryCode } from '@shopify/hydrogen-react/customer-account-api-types';
7
- import { ExecutionArgs } from 'graphql';
8
- import * as react_router from 'react-router';
9
- import { SessionData, FlashSessionData, Session, SessionStorage, RouterContextProvider, FetcherWithComponents, ServerBuild, LinkProps, LoaderFunctionArgs, MetaFunction, LoaderFunction, Params, Location } from 'react-router';
10
- import * as react_jsx_runtime from 'react/jsx-runtime';
11
- import { PartialDeep } from 'type-fest';
12
- import { RouteConfigEntry } from '@react-router/dev/routes';
13
- import { Preset } from '@react-router/dev/config';
14
- import { WithContext, Thing } from 'schema-dts';
15
-
16
- /**
17
- * Override options for a cache strategy.
18
- */
19
- interface AllCacheOptions {
20
- /**
21
- * The caching mode, generally `public`, `private`, or `no-store`.
22
- */
23
- mode?: string;
24
- /**
25
- * The maximum amount of time in seconds that a resource will be considered fresh. See `max-age` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#:~:text=Response%20Directives-,max%2Dage,-The%20max%2Dage).
26
- */
27
- maxAge?: number;
28
- /**
29
- * Indicate that the cache should serve the stale response in the background while revalidating the cache. See `stale-while-revalidate` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-while-revalidate).
30
- */
31
- staleWhileRevalidate?: number;
32
- /**
33
- * Similar to `maxAge` but specific to shared caches. See `s-maxage` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#s-maxage).
34
- */
35
- sMaxAge?: number;
36
- /**
37
- * Indicate that the cache should serve the stale response if an error occurs while revalidating the cache. See `stale-if-error` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-if-error).
38
- */
39
- staleIfError?: number;
40
- }
41
- /**
42
- * Use the `CachingStrategy` to define a custom caching mechanism for your data. Or use one of the pre-defined caching strategies: CacheNone, CacheShort, CacheLong.
43
- */
44
- type CachingStrategy = AllCacheOptions;
45
- type NoStoreStrategy = {
46
- mode: string;
47
- };
48
- /** @publicDocs */
49
- declare function generateCacheControlHeader(cacheOptions: CachingStrategy): string;
50
- /**
51
- *
52
- * @public
53
- * @publicDocs
54
- */
55
- declare function CacheNone(): NoStoreStrategy;
56
- /**
57
- *
58
- * @public
59
- * @publicDocs
60
- */
61
- declare function CacheShort(overrideOptions?: CachingStrategy): AllCacheOptions;
62
- /**
63
- *
64
- * @public
65
- * @publicDocs
66
- */
67
- declare function CacheLong(overrideOptions?: CachingStrategy): AllCacheOptions;
68
- /**
69
- *
70
- * @public
71
- * @publicDocs
72
- */
73
- declare function CacheCustom(overrideOptions: CachingStrategy): AllCacheOptions;
74
-
75
- /**
76
- Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
77
-
78
- Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
79
-
80
- @example
81
- ```
82
- import type {UnionToIntersection} from 'type-fest';
83
-
84
- type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
85
-
86
- type Intersection = UnionToIntersection<Union>;
87
- //=> {the(): void; great(arg: string): void; escape: boolean};
88
- ```
89
-
90
- A more applicable example which could make its way into your library code follows.
91
-
92
- @example
93
- ```
94
- import type {UnionToIntersection} from 'type-fest';
95
-
96
- class CommandOne {
97
- commands: {
98
- a1: () => undefined,
99
- b1: () => undefined,
100
- }
101
- }
102
-
103
- class CommandTwo {
104
- commands: {
105
- a2: (argA: string) => undefined,
106
- b2: (argB: string) => undefined,
107
- }
108
- }
109
-
110
- const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands);
111
- type Union = typeof union;
112
- //=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void}
113
-
114
- type Intersection = UnionToIntersection<Union>;
115
- //=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
116
- ```
117
-
118
- @category Type
119
- */
120
- type UnionToIntersection<Union> = (
121
- // `extends unknown` is always going to be the case and is used to convert the
122
- // `Union` into a [distributive conditional
123
- // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
124
- Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
125
- /**
126
- Create a union of all keys from a given type, even those exclusive to specific union members.
127
-
128
- Unlike the native `keyof` keyword, which returns keys present in **all** union members, this type returns keys from **any** member.
129
-
130
- @link https://stackoverflow.com/a/49402091
131
-
132
- @example
133
- ```
134
- import type {KeysOfUnion} from 'type-fest';
135
-
136
- type A = {
137
- common: string;
138
- a: number;
139
- };
140
-
141
- type B = {
142
- common: string;
143
- b: string;
144
- };
145
-
146
- type C = {
147
- common: string;
148
- c: boolean;
149
- };
150
-
151
- type Union = A | B | C;
152
-
153
- type CommonKeys = keyof Union;
154
- //=> 'common'
155
-
156
- type AllKeys = KeysOfUnion<Union>;
157
- //=> 'common' | 'a' | 'b' | 'c'
158
- ```
159
-
160
- @category Object
161
- */
162
- type KeysOfUnion<ObjectType> =
163
- // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
164
- keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
165
- /**
166
- Extract all optional keys from the given type.
167
-
168
- This is useful when you want to create a new type that contains different type values for the optional keys only.
169
-
170
- @example
171
- ```
172
- import type {OptionalKeysOf, Except} from 'type-fest';
173
-
174
- interface User {
175
- name: string;
176
- surname: string;
177
-
178
- luckyNumber?: number;
179
- }
180
-
181
- const REMOVE_FIELD = Symbol('remove field symbol');
182
- type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
183
- [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
184
- };
185
-
186
- const update1: UpdateOperation<User> = {
187
- name: 'Alice'
188
- };
189
-
190
- const update2: UpdateOperation<User> = {
191
- name: 'Bob',
192
- luckyNumber: REMOVE_FIELD
193
- };
194
- ```
195
-
196
- @category Utilities
197
- */
198
- type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
199
- ? (keyof {
200
- [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never;
201
- }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
202
- : never; // Should never happen
203
- /**
204
- Extract all required keys from the given type.
205
-
206
- This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
207
-
208
- @example
209
- ```
210
- import type {RequiredKeysOf} from 'type-fest';
211
-
212
- declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
213
-
214
- interface User {
215
- name: string;
216
- surname: string;
217
-
218
- luckyNumber?: number;
219
- }
220
-
221
- const validator1 = createValidation<User>('name', value => value.length < 25);
222
- const validator2 = createValidation<User>('surname', value => value.length < 25);
223
- ```
224
-
225
- @category Utilities
226
- */
227
- type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
228
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never; // Should never happen
229
- /**
230
- Returns a boolean for whether the given type is `never`.
231
-
232
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
233
- @link https://stackoverflow.com/a/53984913/10292952
234
- @link https://www.zhenghao.io/posts/ts-never
235
-
236
- Useful in type utilities, such as checking if something does not occur.
237
-
238
- @example
239
- ```
240
- import type {IsNever, And} from 'type-fest';
241
-
242
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
243
- type AreStringsEqual<A extends string, B extends string> =
244
- And<
245
- IsNever<Exclude<A, B>> extends true ? true : false,
246
- IsNever<Exclude<B, A>> extends true ? true : false
247
- >;
248
-
249
- type EndIfEqual<I extends string, O extends string> =
250
- AreStringsEqual<I, O> extends true
251
- ? never
252
- : void;
253
-
254
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
255
- if (input === output) {
256
- process.exit(0);
257
- }
258
- }
259
-
260
- endIfEqual('abc', 'abc');
261
- //=> never
262
-
263
- endIfEqual('abc', '123');
264
- //=> void
265
- ```
266
-
267
- @category Type Guard
268
- @category Utilities
269
- */
270
- type IsNever<T> = [
271
- T
272
- ] extends [
273
- never
274
- ] ? true : false;
275
- /**
276
- An if-else-like type that resolves depending on whether the given type is `never`.
277
-
278
- @see {@link IsNever}
279
-
280
- @example
281
- ```
282
- import type {IfNever} from 'type-fest';
283
-
284
- type ShouldBeTrue = IfNever<never>;
285
- //=> true
286
-
287
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
288
- //=> 'bar'
289
- ```
290
-
291
- @category Type Guard
292
- @category Utilities
293
- */
294
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
295
- type NoInfer$1<T> = T extends infer U ? U : never;
296
- /**
297
- Returns a boolean for whether the given type is `any`.
298
-
299
- @link https://stackoverflow.com/a/49928360/1490091
300
-
301
- Useful in type utilities, such as disallowing `any`s to be passed to a function.
302
-
303
- @example
304
- ```
305
- import type {IsAny} from 'type-fest';
306
-
307
- const typedObject = {a: 1, b: 2} as const;
308
- const anyObject: any = {a: 1, b: 2};
309
-
310
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
311
- return obj[key];
312
- }
313
-
314
- const typedA = get(typedObject, 'a');
315
- //=> 1
316
-
317
- const anyA = get(anyObject, 'a');
318
- //=> any
319
- ```
320
-
321
- @category Type Guard
322
- @category Utilities
323
- */
324
- type IsAny<T> = 0 extends 1 & NoInfer$1<T> ? true : false;
325
- /**
326
- Returns a boolean for whether the two given types are equal.
327
-
328
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
329
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
330
-
331
- Use-cases:
332
- - If you want to make a conditional branch based on the result of a comparison of two types.
333
-
334
- @example
335
- ```
336
- import type {IsEqual} from 'type-fest';
337
-
338
- // This type returns a boolean for whether the given array includes the given item.
339
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
340
- type Includes<Value extends readonly any[], Item> =
341
- Value extends readonly [Value[0], ...infer rest]
342
- ? IsEqual<Value[0], Item> extends true
343
- ? true
344
- : Includes<rest, Item>
345
- : false;
346
- ```
347
-
348
- @category Type Guard
349
- @category Utilities
350
- */
351
- type IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
352
- /**
353
- Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
354
-
355
- @example
356
- ```
357
- import type {Simplify} from 'type-fest';
358
-
359
- type PositionProps = {
360
- top: number;
361
- left: number;
362
- };
363
-
364
- type SizeProps = {
365
- width: number;
366
- height: number;
367
- };
368
-
369
- // In your editor, hovering over `Props` will show a flattened object with all the properties.
370
- type Props = Simplify<PositionProps & SizeProps>;
371
- ```
372
-
373
- Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
374
-
375
- If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
376
-
377
- @example
378
- ```
379
- import type {Simplify} from 'type-fest';
380
-
381
- interface SomeInterface {
382
- foo: number;
383
- bar?: string;
384
- baz: number | undefined;
385
- }
386
-
387
- type SomeType = {
388
- foo: number;
389
- bar?: string;
390
- baz: number | undefined;
391
- };
392
-
393
- const literal = {foo: 123, bar: 'hello', baz: 456};
394
- const someType: SomeType = literal;
395
- const someInterface: SomeInterface = literal;
396
-
397
- function fn(object: Record<string, unknown>): void {}
398
-
399
- fn(literal); // Good: literal object type is sealed
400
- fn(someType); // Good: type is sealed
401
- fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
402
- fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
403
- ```
404
-
405
- @link https://github.com/microsoft/TypeScript/issues/15300
406
- @see SimplifyDeep
407
- @category Object
408
- */
409
- type Simplify<T> = {
410
- [KeyType in keyof T]: T[KeyType];
411
- } & {};
412
- /**
413
- Omit any index signatures from the given object type, leaving only explicitly defined properties.
414
-
415
- This is the counterpart of `PickIndexSignature`.
416
-
417
- Use-cases:
418
- - Remove overly permissive signatures from third-party types.
419
-
420
- This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
421
-
422
- It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
423
-
424
- (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
425
-
426
- ```
427
- const indexed: Record<string, unknown> = {}; // Allowed
428
-
429
- const keyed: Record<'foo', unknown> = {}; // Error
430
- // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
431
- ```
432
-
433
- Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
434
-
435
- ```
436
- type Indexed = {} extends Record<string, unknown>
437
- ? '✅ `{}` is assignable to `Record<string, unknown>`'
438
- : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
439
- // => '✅ `{}` is assignable to `Record<string, unknown>`'
440
-
441
- type Keyed = {} extends Record<'foo' | 'bar', unknown>
442
- ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
443
- : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
444
- // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
445
- ```
446
-
447
- Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
448
-
449
- ```
450
- import type {OmitIndexSignature} from 'type-fest';
451
-
452
- type OmitIndexSignature<ObjectType> = {
453
- [KeyType in keyof ObjectType // Map each key of `ObjectType`...
454
- ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
455
- };
456
- ```
457
-
458
- ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
459
-
460
- ```
461
- import type {OmitIndexSignature} from 'type-fest';
462
-
463
- type OmitIndexSignature<ObjectType> = {
464
- [KeyType in keyof ObjectType
465
- // Is `{}` assignable to `Record<KeyType, unknown>`?
466
- as {} extends Record<KeyType, unknown>
467
- ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
468
- : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
469
- ]: ObjectType[KeyType];
470
- };
471
- ```
472
-
473
- If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
474
-
475
- @example
476
- ```
477
- import type {OmitIndexSignature} from 'type-fest';
478
-
479
- interface Example {
480
- // These index signatures will be removed.
481
- [x: string]: any
482
- [x: number]: any
483
- [x: symbol]: any
484
- [x: `head-${string}`]: string
485
- [x: `${string}-tail`]: string
486
- [x: `head-${string}-tail`]: string
487
- [x: `${bigint}`]: string
488
- [x: `embedded-${number}`]: string
489
-
490
- // These explicitly defined keys will remain.
491
- foo: 'bar';
492
- qux?: 'baz';
493
- }
494
-
495
- type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
496
- // => { foo: 'bar'; qux?: 'baz' | undefined; }
497
- ```
498
-
499
- @see PickIndexSignature
500
- @category Object
501
- */
502
- type OmitIndexSignature<ObjectType> = {
503
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
504
- };
505
- /**
506
- Pick only index signatures from the given object type, leaving out all explicitly defined properties.
507
-
508
- This is the counterpart of `OmitIndexSignature`.
509
-
510
- @example
511
- ```
512
- import type {PickIndexSignature} from 'type-fest';
513
-
514
- declare const symbolKey: unique symbol;
515
-
516
- type Example = {
517
- // These index signatures will remain.
518
- [x: string]: unknown;
519
- [x: number]: unknown;
520
- [x: symbol]: unknown;
521
- [x: `head-${string}`]: string;
522
- [x: `${string}-tail`]: string;
523
- [x: `head-${string}-tail`]: string;
524
- [x: `${bigint}`]: string;
525
- [x: `embedded-${number}`]: string;
526
-
527
- // These explicitly defined keys will be removed.
528
- ['kebab-case-key']: string;
529
- [symbolKey]: string;
530
- foo: 'bar';
531
- qux?: 'baz';
532
- };
533
-
534
- type ExampleIndexSignature = PickIndexSignature<Example>;
535
- // {
536
- // [x: string]: unknown;
537
- // [x: number]: unknown;
538
- // [x: symbol]: unknown;
539
- // [x: `head-${string}`]: string;
540
- // [x: `${string}-tail`]: string;
541
- // [x: `head-${string}-tail`]: string;
542
- // [x: `${bigint}`]: string;
543
- // [x: `embedded-${number}`]: string;
544
- // }
545
- ```
546
-
547
- @see OmitIndexSignature
548
- @category Object
549
- */
550
- type PickIndexSignature<ObjectType> = {
551
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType];
552
- };
553
- // Merges two objects without worrying about index signatures.
554
- type SimpleMerge<Destination, Source> = {
555
- [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
556
- } & Source;
557
- /**
558
- Merge two types into a new type. Keys of the second type overrides keys of the first type.
559
-
560
- @example
561
- ```
562
- import type {Merge} from 'type-fest';
563
-
564
- interface Foo {
565
- [x: string]: unknown;
566
- [x: number]: unknown;
567
- foo: string;
568
- bar: symbol;
569
- }
570
-
571
- type Bar = {
572
- [x: number]: number;
573
- [x: symbol]: unknown;
574
- bar: Date;
575
- baz: boolean;
576
- };
577
-
578
- export type FooBar = Merge<Foo, Bar>;
579
- // => {
580
- // [x: string]: unknown;
581
- // [x: number]: number;
582
- // [x: symbol]: unknown;
583
- // foo: string;
584
- // bar: Date;
585
- // baz: boolean;
586
- // }
587
- ```
588
-
589
- @category Object
590
- */
591
- type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
592
- /**
593
- An if-else-like type that resolves depending on whether the given type is `any`.
594
-
595
- @see {@link IsAny}
596
-
597
- @example
598
- ```
599
- import type {IfAny} from 'type-fest';
600
-
601
- type ShouldBeTrue = IfAny<any>;
602
- //=> true
603
-
604
- type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
605
- //=> 'bar'
606
- ```
607
-
608
- @category Type Guard
609
- @category Utilities
610
- */
611
- type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
612
- /**
613
- Works similar to the built-in `Pick` utility type, except for the following differences:
614
- - Distributes over union types and allows picking keys from any member of the union type.
615
- - Primitives types are returned as-is.
616
- - Picks all keys if `Keys` is `any`.
617
- - Doesn't pick `number` from a `string` index signature.
618
-
619
- @example
620
- ```
621
- type ImageUpload = {
622
- url: string;
623
- size: number;
624
- thumbnailUrl: string;
625
- };
626
-
627
- type VideoUpload = {
628
- url: string;
629
- duration: number;
630
- encodingFormat: string;
631
- };
632
-
633
- // Distributes over union types and allows picking keys from any member of the union type
634
- type MediaDisplay = HomomorphicPick<ImageUpload | VideoUpload, "url" | "size" | "duration">;
635
- //=> {url: string; size: number} | {url: string; duration: number}
636
-
637
- // Primitive types are returned as-is
638
- type Primitive = HomomorphicPick<string | number, 'toUpperCase' | 'toString'>;
639
- //=> string | number
640
-
641
- // Picks all keys if `Keys` is `any`
642
- type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
643
- //=> {a: 1; b: 2} | {c: 3}
644
-
645
- // Doesn't pick `number` from a `string` index signature
646
- type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
647
- //=> {}
648
- */
649
- type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = {
650
- [P in keyof T as Extract<P, Keys>]: T[P];
651
- };
652
- /**
653
- Merges user specified options with default options.
654
-
655
- @example
656
- ```
657
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
658
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
659
- type SpecifiedOptions = {leavesOnly: true};
660
-
661
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
662
- //=> {maxRecursionDepth: 10; leavesOnly: true}
663
- ```
664
-
665
- @example
666
- ```
667
- // Complains if default values are not provided for optional options
668
-
669
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
670
- type DefaultPathsOptions = {maxRecursionDepth: 10};
671
- type SpecifiedOptions = {};
672
-
673
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
674
- // ~~~~~~~~~~~~~~~~~~~
675
- // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
676
- ```
677
-
678
- @example
679
- ```
680
- // Complains if an option's default type does not conform to the expected type
681
-
682
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
683
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
684
- type SpecifiedOptions = {};
685
-
686
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
687
- // ~~~~~~~~~~~~~~~~~~~
688
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
689
- ```
690
-
691
- @example
692
- ```
693
- // Complains if an option's specified type does not conform to the expected type
694
-
695
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
696
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
697
- type SpecifiedOptions = {leavesOnly: 'yes'};
698
-
699
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
700
- // ~~~~~~~~~~~~~~~~
701
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
702
- ```
703
- */
704
- type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, {
705
- [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key];
706
- }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
707
- >>;
708
- /**
709
- Filter out keys from an object.
710
-
711
- Returns `never` if `Exclude` is strictly equal to `Key`.
712
- Returns `never` if `Key` extends `Exclude`.
713
- Returns `Key` otherwise.
714
-
715
- @example
716
- ```
717
- type Filtered = Filter<'foo', 'foo'>;
718
- //=> never
719
- ```
720
-
721
- @example
722
- ```
723
- type Filtered = Filter<'bar', string>;
724
- //=> never
725
- ```
726
-
727
- @example
728
- ```
729
- type Filtered = Filter<'bar', 'foo'>;
730
- //=> 'bar'
731
- ```
732
-
733
- @see {Except}
734
- */
735
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
736
- type ExceptOptions = {
737
- /**
738
- Disallow assigning non-specified properties.
739
-
740
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
741
-
742
- @default false
743
- */
744
- requireExactProps?: boolean;
745
- };
746
- type DefaultExceptOptions = {
747
- requireExactProps: false;
748
- };
749
- /**
750
- Create a type from an object type without certain keys.
751
-
752
- We recommend setting the `requireExactProps` option to `true`.
753
-
754
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
755
-
756
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
757
-
758
- @example
759
- ```
760
- import type {Except} from 'type-fest';
761
-
762
- type Foo = {
763
- a: number;
764
- b: string;
765
- };
766
-
767
- type FooWithoutA = Except<Foo, 'a'>;
768
- //=> {b: string}
769
-
770
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
771
- //=> errors: 'a' does not exist in type '{ b: string; }'
772
-
773
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
774
- //=> {a: number} & Partial<Record<"b", never>>
775
-
776
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
777
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
778
-
779
- // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
780
-
781
- // Consider the following example:
782
-
783
- type UserData = {
784
- [metadata: string]: string;
785
- email: string;
786
- name: string;
787
- role: 'admin' | 'user';
788
- };
789
-
790
- // `Omit` clearly doesn't behave as expected in this case:
791
- type PostPayload = Omit<UserData, 'email'>;
792
- //=> type PostPayload = { [x: string]: string; [x: number]: string; }
793
-
794
- // In situations like this, `Except` works better.
795
- // It simply removes the `email` key while preserving all the other keys.
796
- type PostPayload = Except<UserData, 'email'>;
797
- //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
798
- ```
799
-
800
- @category Object
801
- */
802
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
803
- type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
804
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
805
- } & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : {});
806
- /**
807
- Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
808
-
809
- Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
810
-
811
- @example
812
- ```
813
- import type {SetOptional} from 'type-fest';
814
-
815
- type Foo = {
816
- a: number;
817
- b?: string;
818
- c: boolean;
819
- }
820
-
821
- type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
822
- // type SomeOptional = {
823
- // a: number;
824
- // b?: string; // Was already optional and still is.
825
- // c?: boolean; // Is now optional.
826
- // }
827
- ```
828
-
829
- @category Object
830
- */
831
- type SetOptional<BaseType, Keys extends keyof BaseType> = BaseType extends unknown // To distribute `BaseType` when it's a union type.
832
- ? Simplify<
833
- // Pick just the keys that are readonly from the base type.
834
- Except<BaseType, Keys> &
835
- // Pick the keys that should be mutable from the base type and make them mutable.
836
- Partial<HomomorphicPick<BaseType, Keys>>> : never;
837
- /**
838
- * This file has utilities to create GraphQL clients
839
- * that consume the types generated by the preset.
840
- */
841
- /**
842
- * A generic type for `variables` in GraphQL clients
843
- */
844
- type GenericVariables = ExecutionArgs["variableValues"];
845
- /**
846
- * Use this type to make parameters optional in GraphQL clients
847
- * when no variables need to be passed.
848
- */
849
- type EmptyVariables = {
850
- [key: string]: never;
851
- };
852
- /**
853
- * GraphQL client's generic operation interface.
854
- */
855
- interface CodegenOperations {
856
- [key: string]: any;
857
- }
858
- /**
859
- * Used as the return type for GraphQL clients. It picks
860
- * the return type from the generated operation types.
861
- * @example
862
- * graphqlQuery: (...) => Promise<ClientReturn<...>>
863
- * graphqlQuery: (...) => Promise<{data: ClientReturn<...>}>
864
- */
865
- type ClientReturn<GeneratedOperations extends CodegenOperations, RawGqlString extends string, OverrideReturnType extends any = never> = IsNever<OverrideReturnType> extends true ? RawGqlString extends keyof GeneratedOperations ? GeneratedOperations[RawGqlString]["return"] : any : OverrideReturnType;
866
- /**
867
- * Checks if the generated variables for an operation
868
- * are optional or required.
869
- */
870
- type IsOptionalVariables<VariablesParam, OptionalVariableNames extends string = never, VariablesWithoutOptionals = Omit<VariablesParam, OptionalVariableNames>> = VariablesWithoutOptionals extends EmptyVariables ? true : GenericVariables extends VariablesParam ? true : Partial<VariablesWithoutOptionals> extends VariablesWithoutOptionals ? true : false;
871
- /**
872
- * Used as the type for the GraphQL client's variables. It checks
873
- * the generated operation types to see if variables are optional.
874
- * @example
875
- * graphqlQuery: (query: string, param: ClientVariables<...>) => Promise<...>
876
- * Where `param` is required.
877
- */
878
- type ClientVariables<GeneratedOperations extends CodegenOperations, RawGqlString extends string, OptionalVariableNames extends string = never, VariablesKey extends string = "variables", GeneratedVariables = RawGqlString extends keyof GeneratedOperations ? SetOptional<GeneratedOperations[RawGqlString]["variables"], Extract<keyof GeneratedOperations[RawGqlString]["variables"], OptionalVariableNames>> : GenericVariables, VariablesWrapper = Record<VariablesKey, GeneratedVariables>> = IsOptionalVariables<GeneratedVariables, OptionalVariableNames> extends true ? Partial<VariablesWrapper> : VariablesWrapper;
879
- /**
880
- * Similar to ClientVariables, but makes the whole wrapper optional:
881
- * @example
882
- * graphqlQuery: (query: string, ...params: ClientVariablesInRestParams<...>) => Promise<...>
883
- * Where the first item in `params` might be optional depending on the query.
884
- */
885
- type ClientVariablesInRestParams<GeneratedOperations extends CodegenOperations, RawGqlString extends string, OtherParams extends Record<string, any> = {}, OptionalVariableNames extends string = never, ProcessedVariables = OtherParams & ClientVariables<GeneratedOperations, RawGqlString, OptionalVariableNames>> = Partial<OtherParams> extends OtherParams ? IsOptionalVariables<GeneratedOperations[RawGqlString]["variables"], OptionalVariableNames> extends true ? [
886
- ProcessedVariables?
887
- ] : [
888
- ProcessedVariables
889
- ] : [
890
- ProcessedVariables
891
- ];
892
-
893
- declare class GraphQLError extends Error {
894
- /**
895
- * If an error can be associated to a particular point in the requested
896
- * GraphQL document, it should contain a list of locations.
897
- */
898
- locations?: Array<{
899
- line: number;
900
- column: number;
901
- }>;
902
- /**
903
- * If an error can be associated to a particular field in the GraphQL result,
904
- * it _must_ contain an entry with the key `path` that details the path of
905
- * the response field which experienced the error. This allows clients to
906
- * identify whether a null result is intentional or caused by a runtime error.
907
- */
908
- path?: Array<string | number>;
909
- /**
910
- * Reserved for implementors to extend the protocol however they see fit,
911
- * and hence there are no additional restrictions on its contents.
912
- */
913
- extensions?: {
914
- [key: string]: unknown;
915
- };
916
- constructor(message?: string, options?: Pick<GraphQLError, 'locations' | 'path' | 'extensions' | 'stack' | 'cause'> & {
917
- query?: string;
918
- queryVariables?: GenericVariables;
919
- requestId?: string | null;
920
- clientOperation?: string;
921
- });
922
- get [Symbol.toStringTag](): string;
923
- /**
924
- * Note: `toString()` is internally used by `console.log(...)` / `console.error(...)`
925
- * when ingesting logs in Oxygen production. Therefore, we want to make sure that
926
- * the error message is as informative as possible instead of `[object Object]`.
927
- */
928
- toString(): string;
929
- /**
930
- * Note: toJSON` is internally used by `JSON.stringify(...)`.
931
- * The most common scenario when this error instance is going to be stringified is
932
- * when it's passed to Remix' `json` and `defer` functions: e.g. `{promise: storefront.query(...)}`.
933
- * In this situation, we don't want to expose private error information to the browser so we only
934
- * do it in development.
935
- */
936
- toJSON(): Pick<GraphQLError, "message" | "locations" | "path" | "extensions" | "stack" | "name">;
937
- }
938
-
939
- type CrossRuntimeRequest = {
940
- url?: string;
941
- method?: string;
942
- headers: {
943
- get?: (key: string) => string | null | undefined;
944
- [key: string]: any;
945
- };
946
- };
947
-
948
- type DataFunctionValue = Response | NonNullable<unknown> | null;
949
- type JsonGraphQLError$1 = ReturnType<GraphQLError['toJSON']>;
950
- type Buyer = Partial<BuyerInput>;
951
- type CustomerAPIResponse<ReturnType> = {
952
- data: ReturnType;
953
- errors: Array<{
954
- message: string;
955
- locations?: Array<{
956
- line: number;
957
- column: number;
958
- }>;
959
- path?: Array<string>;
960
- extensions: {
961
- code: string;
962
- };
963
- }>;
964
- extensions: {
965
- cost: {
966
- requestQueryCost: number;
967
- actualQueryCakes: number;
968
- throttleStatus: {
969
- maximumAvailable: number;
970
- currentAvailable: number;
971
- restoreRate: number;
972
- };
973
- };
974
- };
975
- };
976
- interface CustomerAccountQueries {
977
- }
978
- interface CustomerAccountMutations {
979
- }
980
- type LoginOptions = {
981
- uiLocales?: LanguageCode;
982
- locale?: string;
983
- countryCode?: CountryCode;
984
- acrValues?: string;
985
- loginHint?: string;
986
- loginHintMode?: string;
987
- };
988
- type LogoutOptions = {
989
- /** The url to redirect customer to after logout, should be a relative URL. This url will need to included in Customer Account API's application setup for logout URI. The default value is current app origin, which is automatically setup in admin when using `--customer-account-push` flag with dev. */
990
- postLogoutRedirectUri?: string;
991
- /** Add custom headers to the logout redirect. */
992
- headers?: HeadersInit;
993
- /** If true, custom data in the session will not be cleared on logout. */
994
- keepSession?: boolean;
995
- };
996
- type CustomerAccount = {
997
- /** The i18n configuration for Customer Account API */
998
- i18n: {
999
- language: LanguageCode;
1000
- };
1001
- /** Start the OAuth login flow. This function should be called and returned from a Remix loader.
1002
- * It redirects the customer to a Shopify login domain. It also defined the final path the customer
1003
- * lands on at the end of the oAuth flow with the value of the `return_to` query param. (This is
1004
- * automatically setup unless `customAuthStatusHandler` option is in use)
1005
- *
1006
- * @param options.uiLocales - The displayed language of the login page. Only support for the following languages:
1007
- * `en`, `fr`, `cs`, `da`, `de`, `es`, `fi`, `it`, `ja`, `ko`, `nb`, `nl`, `pl`, `pt-BR`, `pt-PT`,
1008
- * `sv`, `th`, `tr`, `vi`, `zh-CN`, `zh-TW`. If supplied any other language code, it will default to `en`.
1009
- * */
1010
- login: (options?: LoginOptions) => Promise<Response>;
1011
- /** On successful login, the customer redirects back to your app. This function validates the OAuth response and exchanges the authorization code for an access token and refresh token. It also persists the tokens on your session. This function should be called and returned from the Remix loader configured as the redirect URI within the Customer Account API settings in admin. */
1012
- authorize: () => Promise<Response>;
1013
- /** Returns if the customer is logged in. It also checks if the access token is expired and refreshes it if needed. */
1014
- isLoggedIn: () => Promise<boolean>;
1015
- /** Check for a not logged in customer and redirect customer to login page. The redirect can be overwritten with `customAuthStatusHandler` option. */
1016
- handleAuthStatus: () => Promise<void>;
1017
- /** Returns CustomerAccessToken if the customer is logged in. It also run a expiry check and does a token refresh if needed. */
1018
- getAccessToken: () => Promise<string | undefined>;
1019
- /** Creates the fully-qualified URL to your store's GraphQL endpoint.*/
1020
- getApiUrl: () => string;
1021
- /** Logout the customer by clearing the session and redirecting to the login domain. It should be called and returned from a Remix action. The path app should redirect to after logout can be setup in Customer Account API settings in admin.
1022
- *
1023
- * @param options.postLogoutRedirectUri - The url to redirect customer to after logout, should be a relative URL. This url will need to included in Customer Account API's application setup for logout URI. The default value is current app origin, which is automatically setup in admin when using `--customer-account-push` flag with dev.
1024
- * @param options.headers - These will be passed along to the logout redirect. You can use these to set/clear cookies on logout, like the cart.
1025
- * @param options.keepSession - If true, custom data in the session will not be cleared on logout.
1026
- * */
1027
- logout: (options?: LogoutOptions) => Promise<Response>;
1028
- /** Execute a GraphQL query against the Customer Account API. This method execute `handleAuthStatus()` ahead of query. */
1029
- query: <OverrideReturnType extends any = never, RawGqlString extends string = string>(query: RawGqlString, ...options: ClientVariablesInRestParams<CustomerAccountQueries, RawGqlString>) => Promise<Omit<CustomerAPIResponse<ClientReturn<CustomerAccountQueries, RawGqlString, OverrideReturnType>>, 'errors'> & {
1030
- errors?: JsonGraphQLError$1[];
1031
- }>;
1032
- /** Execute a GraphQL mutation against the Customer Account API. This method execute `handleAuthStatus()` ahead of mutation. */
1033
- mutate: <OverrideReturnType extends any = never, RawGqlString extends string = string>(mutation: RawGqlString, ...options: ClientVariablesInRestParams<CustomerAccountMutations, RawGqlString>) => Promise<Omit<CustomerAPIResponse<ClientReturn<CustomerAccountMutations, RawGqlString, OverrideReturnType>>, 'errors'> & {
1034
- errors?: JsonGraphQLError$1[];
1035
- }>;
1036
- /** Set buyer information into session.*/
1037
- setBuyer: (buyer: Buyer) => void;
1038
- /** Get buyer token and company location id from session.*/
1039
- getBuyer: () => Promise<Buyer>;
1040
- /** Deprecated. Please use setBuyer. Set buyer information into session.*/
1041
- UNSTABLE_setBuyer: (buyer: Buyer) => void;
1042
- /** Deprecated. Please use getBuyer. Get buyer token and company location id from session.*/
1043
- UNSTABLE_getBuyer: () => Promise<Buyer>;
1044
- };
1045
- type CustomerAccountOptions = {
1046
- /** The client requires a session to persist the auth and refresh token. By default Hydrogen ships with cookie session storage, but you can use [another session storage](https://remix.run/docs/en/main/utils/sessions) implementation. */
1047
- session: HydrogenSession;
1048
- /** Unique UUID prefixed with `shp_` associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. Mock.shop doesn't automatically supply customerAccountId. Use `npx shopify hydrogen env pull` to link your store credentials. */
1049
- customerAccountId: string;
1050
- /** The shop id. Mock.shop doesn't automatically supply shopId. Use `npx shopify hydrogen env pull` to link your store credentials */
1051
- shopId: string;
1052
- /** Override the version of the API */
1053
- customerApiVersion?: string;
1054
- /** The object for the current Request. It should be provided by your platform. */
1055
- request: CrossRuntimeRequest;
1056
- /** The waitUntil function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
1057
- waitUntil?: WaitUntil;
1058
- /** This is the route in your app that authorizes the customer after logging in. Make sure to call `customer.authorize()` within the loader on this route. It defaults to `/account/authorize`. */
1059
- authUrl?: string;
1060
- /** Use this method to overwrite the default logged-out redirect behavior. The default handler [throws a redirect](https://remix.run/docs/en/main/utils/redirect#:~:text=!session) to `/account/login` with current path as `return_to` query param. */
1061
- customAuthStatusHandler?: () => DataFunctionValue;
1062
- /** Whether it should print GraphQL errors automatically. Defaults to true */
1063
- logErrors?: boolean | ((error?: Error) => boolean);
1064
- /** The path to redirect to after login. Defaults to `/account`. */
1065
- defaultRedirectPath?: string;
1066
- /** The path to login. Defaults to `/account/login`. */
1067
- loginPath?: string;
1068
- /** The oauth authorize path. Defaults to `/account/authorize`. */
1069
- authorizePath?: string;
1070
- /** Deprecated. `unstableB2b` is now stable. Please remove. */
1071
- unstableB2b?: boolean;
1072
- /** Localization data. */
1073
- language?: LanguageCode;
1074
- /** Set to true when using a custom HTTPS domain (e.g., ngrok, local proxy)
1075
- * instead of the default Hydrogen tunnel for local development.
1076
- * You must manually register your redirect_uri in Customer Account API settings. */
1077
- useCustomAuthDomain?: boolean;
1078
- };
1079
-
1080
- type CartGetProps<TExtraVariables = {}> = {
1081
- /**
1082
- * The cart ID.
1083
- * @default cart.getCartId();
1084
- */
1085
- cartId?: string;
1086
- /**
1087
- * The country code.
1088
- * @default storefront.i18n.country
1089
- */
1090
- country?: CountryCode$1;
1091
- /**
1092
- * The language code.
1093
- * @default storefront.i18n.language
1094
- */
1095
- language?: LanguageCode$1;
1096
- /**
1097
- * The number of cart lines to be returned.
1098
- * @default 100
1099
- */
1100
- numCartLines?: number;
1101
- /**
1102
- * Visitor consent preferences for the Storefront API's @inContext directive.
1103
- *
1104
- * **Most Hydrogen storefronts do NOT need this.** If you're using Hydrogen's
1105
- * analytics provider or Shopify's Customer Privacy API (including third-party
1106
- * consent services integrated with it), consent is handled automatically.
1107
- *
1108
- * This option exists for Storefront API parity and is primarily intended for
1109
- * non-Hydrogen integrations like Checkout Kit that manage consent outside
1110
- * Shopify's standard consent flow.
1111
- *
1112
- * When provided, consent is encoded into the cart's checkoutUrl via the _cs parameter.
1113
- */
1114
- visitorConsent?: VisitorConsent$1;
1115
- } & TExtraVariables;
1116
- type CartGetFunction<TCart = Cart, TExtraVariables = {}> = (cartInput?: CartGetProps<TExtraVariables>) => Promise<CartReturn<TCart> | null>;
1117
- type CartGetOptions = CartQueryOptions & {
1118
- /**
1119
- * The customer account client instance created by [`createCustomerAccountClient`](docs/api/hydrogen/latest/utilities/createcustomeraccountclient).
1120
- */
1121
- customerAccount?: CustomerAccount;
1122
- };
1123
- /** @publicDocs */
1124
- declare function cartGetDefault<TCart = Cart, TExtraVariables = {}>({ storefront, customerAccount, getCartId, cartFragment, }: CartGetOptions): CartGetFunction<TCart, TExtraVariables>;
1125
-
1126
- type CartCreateFunction<TCart = CartQueryDataReturn['cart']> = (input: CartInput, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1127
- /** @publicDocs */
1128
- declare function cartCreateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartCreateFunction<TCart>;
1129
-
1130
- type CartLinesAddFunction<TCart = CartQueryDataReturn['cart']> = (lines: Array<CartLineInput>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1131
- /** @publicDocs */
1132
- declare function cartLinesAddDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartLinesAddFunction<TCart>;
1133
-
1134
- type CartLinesUpdateFunction<TCart = CartQueryDataReturn['cart']> = (lines: CartLineUpdateInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1135
- /** @publicDocs */
1136
- declare function cartLinesUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartLinesUpdateFunction<TCart>;
1137
-
1138
- type CartLinesRemoveFunction<TCart = CartQueryDataReturn['cart']> = (lineIds: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1139
- /** @publicDocs */
1140
- declare function cartLinesRemoveDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartLinesRemoveFunction<TCart>;
1141
-
1142
- type CartDiscountCodesUpdateFunction<TCart = CartQueryDataReturn['cart']> = (discountCodes: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1143
- /** @publicDocs */
1144
- declare function cartDiscountCodesUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartDiscountCodesUpdateFunction<TCart>;
1145
-
1146
- type CartBuyerIdentityUpdateFunction<TCart = CartQueryDataReturn['cart']> = (buyerIdentity: CartBuyerIdentityInput, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1147
- /** @publicDocs */
1148
- declare function cartBuyerIdentityUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartBuyerIdentityUpdateFunction<TCart>;
1149
-
1150
- type CartNoteUpdateFunction<TCart = CartQueryDataReturn['cart']> = (note: string, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1151
- /** @publicDocs */
1152
- declare function cartNoteUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartNoteUpdateFunction<TCart>;
1153
-
1154
- type CartSelectedDeliveryOptionsUpdateFunction<TCart = CartQueryDataReturn['cart']> = (selectedDeliveryOptions: CartSelectedDeliveryOptionInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1155
- /** @publicDocs */
1156
- declare function cartSelectedDeliveryOptionsUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartSelectedDeliveryOptionsUpdateFunction<TCart>;
1157
-
1158
- type CartAttributesUpdateFunction<TCart = CartQueryDataReturn['cart']> = (attributes: AttributeInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1159
- /** @publicDocs */
1160
- declare function cartAttributesUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartAttributesUpdateFunction<TCart>;
1161
-
1162
- type CartMetafieldsSetFunction = (metafields: MetafieldWithoutOwnerId[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1163
- /** @publicDocs */
1164
- declare function cartMetafieldsSetDefault(options: CartQueryOptions): CartMetafieldsSetFunction;
1165
-
1166
- type CartMetafieldDeleteFunction = (key: Scalars['String']['input'], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1167
- /** @publicDocs */
1168
- declare function cartMetafieldDeleteDefault(options: CartQueryOptions): CartMetafieldDeleteFunction;
1169
-
1170
- type CartGiftCardCodesUpdateFunction<TCart = CartQueryDataReturn['cart']> = (giftCardCodes: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1171
- /**
1172
- * Updates (replaces) gift card codes in the cart.
1173
- *
1174
- * To add codes without replacing, use `cartGiftCardCodesAdd` (API 2025-10+).
1175
- *
1176
- * @param {CartQueryOptions} options - Cart query options including storefront client and cart fragment.
1177
- * @returns {CartGiftCardCodesUpdateFunction} - Function accepting gift card codes array and optional parameters.
1178
- *
1179
- * @example Replace all gift card codes
1180
- * const updateGiftCardCodes = cartGiftCardCodesUpdateDefault({ storefront, getCartId });
1181
- * await updateGiftCardCodes(['SUMMER2025', 'WELCOME10']);
1182
- * @publicDocs
1183
- */
1184
- declare function cartGiftCardCodesUpdateDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartGiftCardCodesUpdateFunction<TCart>;
1185
-
1186
- type CartGiftCardCodesAddFunction<TCart = CartQueryDataReturn['cart']> = (giftCardCodes: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1187
- /**
1188
- * Adds gift card codes to the cart without replacing existing ones.
1189
- *
1190
- * This function sends a mutation to the Storefront API to add one or more gift card codes to the cart.
1191
- * Unlike `cartGiftCardCodesUpdate` which replaces all codes, this mutation appends new codes to existing ones.
1192
- *
1193
- * @param {CartQueryOptions} options - The options for the cart query, including the storefront API client and cart fragment.
1194
- * @returns {CartGiftCardCodesAddFunction} - A function that takes an array of gift card codes and optional parameters, and returns the result of the API call.
1195
- *
1196
- * @example Add gift card codes
1197
- * const addGiftCardCodes = cartGiftCardCodesAddDefault({ storefront, getCartId });
1198
- * await addGiftCardCodes(['SUMMER2025', 'WELCOME10']);
1199
- * @publicDocs
1200
- */
1201
- declare function cartGiftCardCodesAddDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartGiftCardCodesAddFunction<TCart>;
1202
-
1203
- type CartGiftCardCodesRemoveFunction<TCart = CartQueryDataReturn['cart']> = (appliedGiftCardIds: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1204
- /** @publicDocs */
1205
- declare function cartGiftCardCodesRemoveDefault<TCart = CartQueryDataReturn['cart']>(options: CartQueryOptions): CartGiftCardCodesRemoveFunction<TCart>;
1206
-
1207
- type CartDeliveryAddressesAddFunction<TCart = CartQueryDataReturn['cart']> = (addresses: Array<CartSelectableAddressInput>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1208
-
1209
- type CartDeliveryAddressesRemoveFunction<TCart = CartQueryDataReturn['cart']> = (addressIds: Array<Scalars['ID']['input']> | Array<string>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1210
-
1211
- type CartDeliveryAddressesUpdateFunction<TCart = CartQueryDataReturn['cart']> = (addresses: Array<CartSelectableAddressUpdateInput>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1212
-
1213
- type CartDeliveryAddressesReplaceFunction<TCart = CartQueryDataReturn['cart']> = (addresses: Array<CartSelectableAddressInput>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn<TCart>>;
1214
-
1215
- type CartHandlerOptions = {
1216
- storefront: Storefront;
1217
- customerAccount?: CustomerAccount;
1218
- getCartId: () => string | undefined;
1219
- setCartId: (cartId: string) => Headers;
1220
- cartQueryFragment?: string;
1221
- cartMutateFragment?: string;
1222
- buyerIdentity?: CartBuyerIdentityInput;
1223
- };
1224
- type CustomMethodsBase = Record<string, Function>;
1225
- type CartHandlerOptionsWithRequiredCustom<TCustomMethods extends CustomMethodsBase> = CartHandlerOptions & {
1226
- customMethods: TCustomMethods;
1227
- };
1228
- type HydrogenCart<TCart = HydrogenCustomCartFragment & Cart, TGetExtraVariables = {}> = {
1229
- get: CartGetFunction<TCart, TGetExtraVariables>;
1230
- getCartId: () => string | undefined;
1231
- setCartId: (cartId: string) => Headers;
1232
- create: CartCreateFunction<TCart>;
1233
- addLines: CartLinesAddFunction<TCart>;
1234
- updateLines: CartLinesUpdateFunction<TCart>;
1235
- removeLines: CartLinesRemoveFunction<TCart>;
1236
- updateDiscountCodes: CartDiscountCodesUpdateFunction<TCart>;
1237
- updateGiftCardCodes: CartGiftCardCodesUpdateFunction<TCart>;
1238
- addGiftCardCodes: CartGiftCardCodesAddFunction<TCart>;
1239
- removeGiftCardCodes: CartGiftCardCodesRemoveFunction<TCart>;
1240
- updateBuyerIdentity: CartBuyerIdentityUpdateFunction<TCart>;
1241
- updateNote: CartNoteUpdateFunction<TCart>;
1242
- updateSelectedDeliveryOption: CartSelectedDeliveryOptionsUpdateFunction<TCart>;
1243
- updateAttributes: CartAttributesUpdateFunction<TCart>;
1244
- setMetafields: (metafields: MetafieldWithoutOwnerId[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn | CartQueryDataReturn<TCart>>;
1245
- deleteMetafield: ReturnType<typeof cartMetafieldDeleteDefault>;
1246
- /**
1247
- * Adds delivery addresses to the cart.
1248
- *
1249
- * This function sends a mutation to the storefront API to add one or more delivery addresses to the cart.
1250
- * It returns the result of the mutation, including any errors that occurred.
1251
- *
1252
- * @param {CartQueryOptions} options - The options for the cart query, including the storefront API client and cart fragment.
1253
- * @returns {ReturnType<typeof cartDeliveryAddressesAddDefault>} - A function that takes an array of addresses and optional parameters, and returns the result of the API call.
1254
- *
1255
- * @example
1256
- * const result = await cart.addDeliveryAddresses(
1257
- * [
1258
- * {
1259
- * address1: '123 Main St',
1260
- * city: 'Anytown',
1261
- * countryCode: 'US'
1262
- * }
1263
- * ],
1264
- * { someOptionalParam: 'value' }
1265
- * );
1266
- */
1267
- addDeliveryAddresses: CartDeliveryAddressesAddFunction<TCart>;
1268
- /**
1269
- * Removes delivery addresses from the cart.
1270
- *
1271
- * This function sends a mutation to the storefront API to remove one or more delivery addresses from the cart.
1272
- * It returns the result of the mutation, including any errors that occurred.
1273
- *
1274
- * @param {CartQueryOptions} options - The options for the cart query, including the storefront API client and cart fragment.
1275
- * @returns {CartDeliveryAddressRemoveFunction} - A function that takes an array of address IDs and optional parameters, and returns the result of the API call.
1276
- *
1277
- * @example
1278
- * const result = await cart.removeDeliveryAddresses([
1279
- * "gid://shopify/<objectName>/10079785100"
1280
- * ],
1281
- * { someOptionalParam: 'value' });
1282
- */
1283
- removeDeliveryAddresses: CartDeliveryAddressesRemoveFunction<TCart>;
1284
- /**
1285
- * Updates delivery addresses in the cart.
1286
- *
1287
- * This function sends a mutation to the storefront API to update one or more delivery addresses in the cart.
1288
- * It returns the result of the mutation, including any errors that occurred.
1289
- *
1290
- * @param {CartQueryOptions} options - The options for the cart query, including the storefront API client and cart fragment.
1291
- * @returns {CartDeliveryAddressUpdateFunction} - A function that takes an array of addresses and optional parameters, and returns the result of the API call.
1292
- *
1293
- * const result = await cart.updateDeliveryAddresses([
1294
- {
1295
- "address": {
1296
- "copyFromCustomerAddressId": "gid://shopify/<objectName>/10079785100",
1297
- "deliveryAddress": {
1298
- "address1": "<your-address1>",
1299
- "address2": "<your-address2>",
1300
- "city": "<your-city>",
1301
- "company": "<your-company>",
1302
- "countryCode": "AC",
1303
- "firstName": "<your-firstName>",
1304
- "lastName": "<your-lastName>",
1305
- "phone": "<your-phone>",
1306
- "provinceCode": "<your-provinceCode>",
1307
- "zip": "<your-zip>"
1308
- }
1309
- },
1310
- "id": "gid://shopify/<objectName>/10079785100",
1311
- "oneTimeUse": true,
1312
- "selected": true,
1313
- "validationStrategy": "COUNTRY_CODE_ONLY"
1314
- }
1315
- ],{ someOptionalParam: 'value' });
1316
- */
1317
- updateDeliveryAddresses: CartDeliveryAddressesUpdateFunction<TCart>;
1318
- /**
1319
- * Replaces all delivery addresses on the cart.
1320
- *
1321
- * This function sends a mutation to the storefront API to replace all delivery addresses on the cart
1322
- * with the provided addresses. It returns the result of the mutation, including any errors that occurred.
1323
- *
1324
- * @param {CartQueryOptions} options - The options for the cart query, including the storefront API client and cart fragment.
1325
- * @returns {CartDeliveryAddressesReplaceFunction} - A function that takes an array of addresses and optional parameters, and returns the result of the API call.
1326
- *
1327
- * @example
1328
- * const result = await cart.replaceDeliveryAddresses([
1329
- * {
1330
- * address: {
1331
- * deliveryAddress: {
1332
- * address1: '123 Main St',
1333
- * city: 'Anytown',
1334
- * countryCode: 'US'
1335
- * }
1336
- * },
1337
- * selected: true
1338
- * }
1339
- * ], { someOptionalParam: 'value' });
1340
- */
1341
- replaceDeliveryAddresses: CartDeliveryAddressesReplaceFunction<TCart>;
1342
- };
1343
- type HydrogenCartCustom<TCustomMethods extends CustomMethodsBase, TCart = HydrogenCustomCartFragment & Cart, TGetExtraVariables = {}> = Omit<HydrogenCart<TCart, TGetExtraVariables>, keyof TCustomMethods> & TCustomMethods;
1344
- /** @publicDocs */
1345
- declare function createCartHandler<TCustomMethods extends CustomMethodsBase>(options: CartHandlerOptionsWithRequiredCustom<TCustomMethods>): HydrogenCartCustom<TCustomMethods>;
1346
- declare function createCartHandler<TCart = HydrogenCustomCartFragment & Cart, TGetExtraVariables = {}>(options: CartHandlerOptions): HydrogenCart<TCart, TGetExtraVariables>;
1347
- declare function createCartHandler<TCart, TGetExtraVariables, TCustomMethods extends CustomMethodsBase>(options: CartHandlerOptionsWithRequiredCustom<TCustomMethods>): HydrogenCartCustom<TCustomMethods, TCart, TGetExtraVariables>;
1348
-
1349
- type RequestEventPayload = {
1350
- url: string;
1351
- eventType: 'request' | 'subrequest';
1352
- requestId?: string | null;
1353
- purpose?: string | null;
1354
- startTime: number;
1355
- endTime?: number;
1356
- cacheStatus?: 'MISS' | 'HIT' | 'STALE' | 'PUT';
1357
- waitUntil?: WaitUntil;
1358
- graphql?: string | null;
1359
- stackInfo?: {
1360
- file?: string;
1361
- func?: string;
1362
- line?: number;
1363
- column?: number;
1364
- };
1365
- responsePayload?: any;
1366
- responseInit?: Omit<ResponseInit, 'headers'> & {
1367
- headers?: [string, string][];
1368
- };
1369
- cache?: {
1370
- status?: string;
1371
- strategy?: string;
1372
- key?: string | readonly unknown[];
1373
- };
1374
- displayName?: string;
1375
- };
1376
-
1377
- declare const CUSTOMER_ACCOUNT_SESSION_KEY = "customerAccount";
1378
- declare const BUYER_SESSION_KEY = "buyer";
1379
-
1380
- type ConsentStatus = boolean | undefined;
1381
- type VisitorConsent = {
1382
- marketing: ConsentStatus;
1383
- analytics: ConsentStatus;
1384
- preferences: ConsentStatus;
1385
- sale_of_data: ConsentStatus;
1386
- };
1387
- type VisitorConsentCollected = {
1388
- analyticsAllowed: boolean;
1389
- firstPartyMarketingAllowed: boolean;
1390
- marketingAllowed: boolean;
1391
- preferencesAllowed: boolean;
1392
- saleOfDataAllowed: boolean;
1393
- thirdPartyMarketingAllowed: boolean;
1394
- };
1395
- type CustomerPrivacyApiLoaded = boolean;
1396
- type CustomerPrivacyConsentConfig = {
1397
- checkoutRootDomain: string;
1398
- storefrontRootDomain?: string;
1399
- storefrontAccessToken: string;
1400
- country?: CountryCode$1;
1401
- /** The privacyBanner refers to `language` as `locale` */
1402
- locale?: LanguageCode$1;
1403
- };
1404
- type SetConsentHeadlessParams = VisitorConsent & CustomerPrivacyConsentConfig & {
1405
- headlessStorefront?: boolean;
1406
- };
1407
- /**
1408
- Ideally this type should come from the Custoemr Privacy API sdk
1409
- analyticsProcessingAllowed -
1410
- currentVisitorConsent
1411
- doesMerchantSupportGranularConsent
1412
- firstPartyMarketingAllowed
1413
- getCCPAConsent
1414
- getTrackingConsent
1415
- marketingAllowed
1416
- preferencesProcessingAllowed
1417
- saleOfDataAllowed
1418
- saleOfDataRegion
1419
- setTrackingConsent
1420
- shouldShowBanner
1421
- shouldShowGDPRBanner
1422
- thirdPartyMarketingAllowed
1423
- **/
1424
- type OriginalCustomerPrivacy = {
1425
- currentVisitorConsent: () => VisitorConsent;
1426
- preferencesProcessingAllowed: () => boolean;
1427
- saleOfDataAllowed: () => boolean;
1428
- marketingAllowed: () => boolean;
1429
- analyticsProcessingAllowed: () => boolean;
1430
- setTrackingConsent: (consent: SetConsentHeadlessParams, callback: (data: {
1431
- error: string;
1432
- } | undefined) => void) => void;
1433
- shouldShowBanner: () => boolean;
1434
- };
1435
- type CustomerPrivacy = Omit<OriginalCustomerPrivacy, 'setTrackingConsent'> & {
1436
- setTrackingConsent: (consent: VisitorConsent, // we have already applied the headlessStorefront in the override
1437
- callback: (data: {
1438
- error: string;
1439
- } | undefined) => void) => void;
1440
- };
1441
- type PrivacyBanner = {
1442
- loadBanner: (options?: Partial<CustomerPrivacyConsentConfig>) => void;
1443
- showPreferences: (options?: Partial<CustomerPrivacyConsentConfig>) => void;
1444
- };
1445
- interface CustomEventMap$1 {
1446
- visitorConsentCollected: CustomEvent<VisitorConsentCollected>;
1447
- customerPrivacyApiLoaded: CustomEvent<CustomerPrivacyApiLoaded>;
1448
- }
1449
- type CustomerPrivacyApiProps = {
1450
- /** The production shop checkout domain url. */
1451
- checkoutDomain: string;
1452
- /** The storefront access token for the shop. */
1453
- storefrontAccessToken: string;
1454
- /** Whether to load the Shopify privacy banner as configured in Shopify admin. Defaults to true. */
1455
- withPrivacyBanner?: boolean;
1456
- /** Country code for the shop. */
1457
- country?: CountryCode$1;
1458
- /** Language code for the shop. */
1459
- locale?: LanguageCode$1;
1460
- /** Callback to be called when visitor consent is collected. */
1461
- onVisitorConsentCollected?: (consent: VisitorConsentCollected) => void;
1462
- /** Callback to be call when customer privacy api is ready. */
1463
- onReady?: () => void;
1464
- /**
1465
- * Whether consent libraries can use same-domain requests to the Storefront API.
1466
- * Defaults to true if the standard route proxy is enabled in Hydrogen server.
1467
- */
1468
- sameDomainForStorefrontApi?: boolean;
1469
- };
1470
- /** @publicDocs */
1471
- declare function useCustomerPrivacy(props: CustomerPrivacyApiProps): {
1472
- customerPrivacy: CustomerPrivacy | null;
1473
- privacyBanner?: PrivacyBanner | null;
1474
- };
1475
-
1476
- interface HydrogenSessionData {
1477
- [CUSTOMER_ACCOUNT_SESSION_KEY]: {
1478
- accessToken?: string;
1479
- expiresAt?: string;
1480
- refreshToken?: string;
1481
- codeVerifier?: string;
1482
- idToken?: string;
1483
- nonce?: string;
1484
- state?: string;
1485
- redirectPath?: string;
1486
- };
1487
- // for B2B buyer context
1488
- [BUYER_SESSION_KEY]: Partial<BuyerInput>;
1489
- }
1490
-
1491
- interface HydrogenSession<
1492
- Data = SessionData,
1493
- FlashData = FlashSessionData,
1494
- > {
1495
- get: Session<HydrogenSessionData & Data, FlashData>['get'];
1496
- set: Session<HydrogenSessionData & Data, FlashData>['set'];
1497
- unset: Session<HydrogenSessionData & Data, FlashData>['unset'];
1498
- commit: () => ReturnType<
1499
- SessionStorage<HydrogenSessionData & Data, FlashData>['commitSession']
1500
- >;
1501
- destroy?: () => ReturnType<
1502
- SessionStorage<HydrogenSessionData & Data, FlashData>['destroySession']
1503
- >;
1504
- isPending?: boolean;
1505
- }
1506
-
1507
- type WaitUntil = (promise: Promise<unknown>) => void;
1508
-
1509
- interface HydrogenEnv {
1510
- SESSION_SECRET: string;
1511
- PUBLIC_STOREFRONT_API_TOKEN: string;
1512
- PRIVATE_STOREFRONT_API_TOKEN: string;
1513
- PUBLIC_STORE_DOMAIN: string;
1514
- PUBLIC_STOREFRONT_ID: string;
1515
- PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID: string;
1516
- PUBLIC_CUSTOMER_ACCOUNT_API_URL: string;
1517
- PUBLIC_CHECKOUT_DOMAIN: string;
1518
- SHOP_ID: string;
1519
- }
1520
-
1521
- type StorefrontHeaders = {
1522
- /** A unique ID that correlates all sub-requests together. */
1523
- requestGroupId: string | null;
1524
- /** The IP address of the client. */
1525
- buyerIp: string | null;
1526
- /** The signature of the client's IP address for verification. */
1527
- buyerIpSig: string | null;
1528
- /** The cookie header from the client */
1529
- cookie: string | null;
1530
- /** The sec-purpose or purpose header value */
1531
- purpose: string | null;
1532
- };
1533
-
1534
- interface HydrogenRouterContextProvider<
1535
- TSession extends HydrogenSession = HydrogenSession,
1536
- TCustomMethods extends CustomMethodsBase | undefined = {},
1537
- TI18n extends I18nBase = I18nBase,
1538
- TEnv extends HydrogenEnv = Env,
1539
- > extends RouterContextProvider {
1540
- /** A GraphQL client for querying the Storefront API */
1541
- storefront: Storefront<TI18n>;
1542
- /** A GraphQL client for querying the Customer Account API */
1543
- customerAccount: CustomerAccount;
1544
- /** A collection of utilities used to interact with the cart */
1545
- cart: TCustomMethods extends CustomMethodsBase
1546
- ? HydrogenCartCustom<TCustomMethods>
1547
- : HydrogenCart;
1548
- /** Environment variables from the fetch function */
1549
- env: TEnv;
1550
- /** The waitUntil function for keeping requests alive */
1551
- waitUntil?: WaitUntil;
1552
- /** Session implementation */
1553
- session: TSession;
1554
- }
1555
-
1556
- declare global {
1557
- interface Window {
1558
- privacyBanner: PrivacyBanner;
1559
- Shopify: {
1560
- customerPrivacy?: Partial<CustomerPrivacy> & {
1561
- backendConsentEnabled?: boolean;
1562
- };
1563
- };
1564
- }
1565
- interface Document {
1566
- addEventListener<K extends keyof CustomEventMap>(
1567
- type: K,
1568
- listener: (this: Document, ev: CustomEventMap[K]) => void,
1569
- ): void;
1570
- removeEventListener<K extends keyof CustomEventMap>(
1571
- type: K,
1572
- listener: (this: Document, ev: CustomEventMap[K]) => void,
1573
- ): void;
1574
- dispatchEvent<K extends keyof CustomEventMap>(ev: CustomEventMap[K]): void;
1575
- }
1576
- var __H2O_LOG_EVENT: undefined | ((event: RequestEventPayload) => void);
1577
- var __remix_devServerHooks:
1578
- | undefined
1579
- | {getCriticalCss: (...args: unknown[]) => any};
1580
- }
1581
-
1582
- type I18nBase = {
1583
- language: LanguageCode$1 | LanguageCode;
1584
- country: CountryCode$1;
1585
- };
1586
- type JsonGraphQLError = ReturnType<GraphQLError['toJSON']>;
1587
- type StorefrontApiErrors = JsonGraphQLError[] | undefined;
1588
- type StorefrontError = {
1589
- errors?: StorefrontApiErrors;
1590
- };
1591
- /**
1592
- * Wraps all the returned utilities from `createStorefrontClient`.
1593
- */
1594
- type StorefrontClient<TI18n extends I18nBase> = {
1595
- storefront: Storefront<TI18n>;
1596
- };
1597
- /**
1598
- * Maps all the queries found in the project to variables and return types.
1599
- */
1600
- interface StorefrontQueries {
1601
- }
1602
- /**
1603
- * Maps all the mutations found in the project to variables and return types.
1604
- */
1605
- interface StorefrontMutations {
1606
- }
1607
- type AutoAddedVariableNames = 'country' | 'language';
1608
- type StorefrontCommonExtraParams = {
1609
- headers?: HeadersInit;
1610
- storefrontApiVersion?: string;
1611
- displayName?: string;
1612
- };
1613
- /**
1614
- * Interface to interact with the Storefront API.
1615
- */
1616
- type Storefront<TI18n extends I18nBase = I18nBase> = {
1617
- query: <OverrideReturnType extends any = never, RawGqlString extends string = string>(query: RawGqlString, ...options: ClientVariablesInRestParams<StorefrontQueries, RawGqlString, StorefrontCommonExtraParams & Pick<StorefrontQueryOptions, 'cache'>, AutoAddedVariableNames>) => Promise<ClientReturn<StorefrontQueries, RawGqlString, OverrideReturnType> & StorefrontError>;
1618
- mutate: <OverrideReturnType extends any = never, RawGqlString extends string = string>(mutation: RawGqlString, ...options: ClientVariablesInRestParams<StorefrontMutations, RawGqlString, StorefrontCommonExtraParams, AutoAddedVariableNames>) => Promise<ClientReturn<StorefrontMutations, RawGqlString, OverrideReturnType> & StorefrontError>;
1619
- cache?: Cache;
1620
- CacheNone: typeof CacheNone;
1621
- CacheLong: typeof CacheLong;
1622
- CacheShort: typeof CacheShort;
1623
- CacheCustom: typeof CacheCustom;
1624
- generateCacheControlHeader: typeof generateCacheControlHeader;
1625
- getPublicTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPublicTokenHeaders'];
1626
- getPrivateTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPrivateTokenHeaders'];
1627
- getShopifyDomain: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
1628
- getApiUrl: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
1629
- i18n: TI18n;
1630
- getHeaders: () => Record<string, string>;
1631
- /**
1632
- * Checks if the request URL matches the Storefront API GraphQL endpoint.
1633
- */
1634
- isStorefrontApiUrl: (request: {
1635
- url?: string;
1636
- }) => boolean;
1637
- /**
1638
- * Checks if the request URL matches the Storefront MCP endpoint.
1639
- */
1640
- isMcpUrl: (request: {
1641
- url?: string;
1642
- }) => boolean;
1643
- /**
1644
- * Forwards the request to the Storefront API.
1645
- * It reads the API version from the request URL.
1646
- */
1647
- forward: (request: Request, options?: Pick<StorefrontCommonExtraParams, 'storefrontApiVersion'>) => Promise<Response>;
1648
- /**
1649
- * Forwards the request to the Storefront MCP endpoint.
1650
- */
1651
- forwardMcp: (request: Request) => Promise<Response>;
1652
- /**
1653
- * Sets the collected subrequest headers in the response.
1654
- * Useful to forward the cookies and server-timing headers
1655
- * from server subrequests to the browser.
1656
- */
1657
- setCollectedSubrequestHeaders: (response: {
1658
- headers: Headers;
1659
- }) => void;
1660
- };
1661
- type HydrogenClientProps<TI18n> = {
1662
- /** Storefront API headers. If on Oxygen, use `getStorefrontHeaders()` */
1663
- storefrontHeaders?: StorefrontHeaders;
1664
- /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
1665
- cache?: Cache;
1666
- /** The globally unique identifier for the Shop */
1667
- storefrontId?: string;
1668
- /** The `waitUntil` function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
1669
- waitUntil?: WaitUntil;
1670
- /** An object containing a country code and language code */
1671
- i18n?: TI18n;
1672
- /** Whether it should print GraphQL errors automatically. Defaults to true */
1673
- logErrors?: boolean | ((error?: Error) => boolean);
1674
- };
1675
- type CreateStorefrontClientOptions<TI18n extends I18nBase> = HydrogenClientProps<TI18n> & StorefrontClientProps;
1676
- type StorefrontQueryOptions = StorefrontCommonExtraParams & {
1677
- query: string;
1678
- mutation?: never;
1679
- cache?: CachingStrategy;
1680
- };
1681
- /**
1682
- * This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2026-04/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
1683
- *
1684
- * Learn more about [data fetching in Hydrogen](/docs/custom-storefronts/hydrogen/data-fetching/fetch-data).
1685
- * @publicDocs
1686
- */
1687
- declare function createStorefrontClient<TI18n extends I18nBase>(options: CreateStorefrontClientOptions<TI18n>): StorefrontClient<TI18n>;
1688
- declare function formatAPIResult<T>(data: T, errors: StorefrontApiErrors): T & StorefrontError;
1689
- /** @publicDocs */
1690
- type CreateStorefrontClientForDocs<TI18n extends I18nBase> = {
1691
- storefront?: StorefrontForDoc<TI18n>;
1692
- };
1693
- type StorefrontForDoc<TI18n extends I18nBase = I18nBase> = {
1694
- /** The function to run a query on Storefront API. */
1695
- query?: <TData = any>(query: string, options: StorefrontQueryOptionsForDocs) => Promise<TData & StorefrontError>;
1696
- /** The function to run a mutation on Storefront API. */
1697
- mutate?: <TData = any>(mutation: string, options: StorefrontMutationOptionsForDocs) => Promise<TData & StorefrontError>;
1698
- /** The cache instance passed in from the `createStorefrontClient` argument. */
1699
- cache?: Cache;
1700
- /** Re-export of [`CacheNone`](/docs/api/hydrogen/utilities/cachenone). */
1701
- CacheNone?: typeof CacheNone;
1702
- /** Re-export of [`CacheLong`](/docs/api/hydrogen/utilities/cachelong). */
1703
- CacheLong?: typeof CacheLong;
1704
- /** Re-export of [`CacheShort`](/docs/api/hydrogen/utilities/cacheshort). */
1705
- CacheShort?: typeof CacheShort;
1706
- /** Re-export of [`CacheCustom`](/docs/api/hydrogen/utilities/cachecustom). */
1707
- CacheCustom?: typeof CacheCustom;
1708
- /** Re-export of [`generateCacheControlHeader`](/docs/api/hydrogen/utilities/generatecachecontrolheader). */
1709
- generateCacheControlHeader?: typeof generateCacheControlHeader;
1710
- /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. See [`getPublicTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2026-04/utilities/createstorefrontclient#:~:text=%27graphql%27.-,getPublicTokenHeaders,-(props%3F%3A) for more details. */
1711
- getPublicTokenHeaders?: ReturnType<typeof createStorefrontClient$1>['getPublicTokenHeaders'];
1712
- /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint for API calls made from a server. See [`getPrivateTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2026-04/utilities/createstorefrontclient#:~:text=storefrontApiVersion-,getPrivateTokenHeaders,-(props%3F%3A) for more details.*/
1713
- getPrivateTokenHeaders?: ReturnType<typeof createStorefrontClient$1>['getPrivateTokenHeaders'];
1714
- /** Creates the fully-qualified URL to your myshopify.com domain. See [`getShopifyDomain` in Hydrogen React](/docs/api/hydrogen-react/2026-04/utilities/createstorefrontclient#:~:text=StorefrontClientReturn-,getShopifyDomain,-(props%3F%3A) for more details. */
1715
- getShopifyDomain?: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
1716
- /** Creates the fully-qualified URL to your store's GraphQL endpoint. See [`getStorefrontApiUrl` in Hydrogen React](/docs/api/hydrogen-react/2026-04/utilities/createstorefrontclient#:~:text=storeDomain-,getStorefrontApiUrl,-(props%3F%3A) for more details.*/
1717
- getApiUrl?: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
1718
- /** The `i18n` object passed in from the `createStorefrontClient` argument. */
1719
- i18n?: TI18n;
1720
- };
1721
- type StorefrontQueryOptionsForDocs = {
1722
- /** The variables for the GraphQL query statement. */
1723
- variables?: Record<string, unknown>;
1724
- /** The cache strategy for this query. Default to max-age=1, stale-while-revalidate=86399. */
1725
- cache?: CachingStrategy;
1726
- /** Additional headers for this query. */
1727
- headers?: HeadersInit;
1728
- /** Override the Storefront API version for this query. */
1729
- storefrontApiVersion?: string;
1730
- /** The name of the query for debugging in the Subrequest Profiler. */
1731
- displayName?: string;
1732
- };
1733
- type StorefrontMutationOptionsForDocs = {
1734
- /** The variables for the GraphQL mutation statement. */
1735
- variables?: Record<string, unknown>;
1736
- /** Additional headers for this query. */
1737
- headers?: HeadersInit;
1738
- /** Override the Storefront API version for this query. */
1739
- storefrontApiVersion?: string;
1740
- /** The name of the query for debugging in the Subrequest Profiler. */
1741
- displayName?: string;
1742
- };
1743
-
1744
- declare global {
1745
- /**
1746
- * Extensible interface for typing cart results with a custom cart fragment.
1747
- * Augment this interface with your codegen'd fragment type to get full type
1748
- * safety on every cart operation — whether accessed via `context.cart`,
1749
- * `createCartHandler`, or `createHydrogenContext`.
1750
- *
1751
- * When empty (the default), `HydrogenCustomCartFragment & Cart` collapses
1752
- * to `Cart`, so existing behaviour is unchanged.
1753
- *
1754
- * @example
1755
- * ```ts
1756
- * // In app/lib/context.ts
1757
- * import type {CartApiQueryFragment} from 'storefrontapi.generated';
1758
- *
1759
- * declare global {
1760
- * interface HydrogenCustomCartFragment extends CartApiQueryFragment {}
1761
- * }
1762
- * ```
1763
- */
1764
- interface HydrogenCustomCartFragment {
1765
- }
1766
- }
1767
- type CartOptionalInput = {
1768
- /**
1769
- * The cart id.
1770
- * @default cart.getCartId();
1771
- */
1772
- cartId?: Scalars['ID']['input'];
1773
- /**
1774
- * The country code.
1775
- * @default storefront.i18n.country
1776
- */
1777
- country?: CountryCode$1;
1778
- /**
1779
- * The language code.
1780
- * @default storefront.i18n.language
1781
- */
1782
- language?: LanguageCode$1;
1783
- /**
1784
- * Visitor consent preferences for the Storefront API's @inContext directive.
1785
- *
1786
- * **Most Hydrogen storefronts do NOT need this.** If you're using Hydrogen's
1787
- * analytics provider or Shopify's Customer Privacy API (including third-party
1788
- * consent services integrated with it), consent is handled automatically.
1789
- *
1790
- * This option exists for Storefront API parity and is primarily intended for
1791
- * non-Hydrogen integrations like Checkout Kit that manage consent outside
1792
- * Shopify's standard consent flow.
1793
- *
1794
- * When provided, consent is encoded into the cart's checkoutUrl via the _cs parameter.
1795
- * @see https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/in-context
1796
- */
1797
- visitorConsent?: VisitorConsent$1;
1798
- };
1799
- type MetafieldWithoutOwnerId = Omit<CartMetafieldsSetInput, 'ownerId'>;
1800
- type CartQueryOptions = {
1801
- /**
1802
- * The storefront client instance created by [`createStorefrontClient`](docs/api/hydrogen/latest/utilities/createstorefrontclient).
1803
- */
1804
- storefront: Storefront;
1805
- /**
1806
- * A function that returns the cart ID.
1807
- */
1808
- getCartId: () => string | undefined;
1809
- /**
1810
- * The cart fragment to override the one used in this query.
1811
- */
1812
- cartFragment?: string;
1813
- /**
1814
- * The customer account instance created by [`createCustomerAccount`](docs/api/hydrogen/latest/customer/createcustomeraccount).
1815
- */
1816
- customerAccount?: CustomerAccount;
1817
- };
1818
- type CartReturn<TCart = Cart> = TCart & {
1819
- errors?: StorefrontApiErrors;
1820
- };
1821
- type CartQueryData<TCart = Cart> = {
1822
- cart: TCart;
1823
- userErrors?: CartUserError[] | MetafieldsSetUserError[] | MetafieldDeleteUserError[];
1824
- warnings?: CartWarning[];
1825
- };
1826
- type CartQueryDataReturn<TCart = Cart> = CartQueryData<TCart> & {
1827
- errors?: StorefrontApiErrors;
1828
- };
1829
- type CartQueryReturn<T, TCart = Cart> = (requiredParams: T, optionalParams?: CartOptionalInput) => Promise<CartQueryData<TCart>>;
1830
-
1831
- declare const AnalyticsEvent: {
1832
- PAGE_VIEWED: "page_viewed";
1833
- PRODUCT_VIEWED: "product_viewed";
1834
- COLLECTION_VIEWED: "collection_viewed";
1835
- CART_VIEWED: "cart_viewed";
1836
- SEARCH_VIEWED: "search_viewed";
1837
- CART_UPDATED: "cart_updated";
1838
- PRODUCT_ADD_TO_CART: "product_added_to_cart";
1839
- PRODUCT_REMOVED_FROM_CART: "product_removed_from_cart";
1840
- CUSTOM_EVENT: `custom_${string}`;
1841
- };
1842
-
1843
- type OtherData = {
1844
- /** Any other data that should be included in the event. */
1845
- [key: string]: unknown;
1846
- };
1847
- type BasePayload = {
1848
- /** The shop data passed in from the `AnalyticsProvider`. */
1849
- shop: ShopAnalytics | null;
1850
- /** The custom data passed in from the `AnalyticsProvider`. */
1851
- customData?: AnalyticsProviderProps['customData'];
1852
- };
1853
- type UrlPayload = {
1854
- /** The url location of when this event is collected. */
1855
- url: string;
1856
- };
1857
- type ProductPayload = {
1858
- /** The product id. */
1859
- id: Product['id'];
1860
- /** The product title. */
1861
- title: Product['title'];
1862
- /** The displaying variant price. */
1863
- price: ProductVariant['price']['amount'];
1864
- /** The product vendor. */
1865
- vendor: Product['vendor'];
1866
- /** The displaying variant id. */
1867
- variantId: ProductVariant['id'];
1868
- /** The displaying variant title. */
1869
- variantTitle: ProductVariant['title'];
1870
- /** The quantity of product. */
1871
- quantity: number;
1872
- /** The product sku. */
1873
- sku?: ProductVariant['sku'];
1874
- /** The product type. */
1875
- productType?: Product['productType'];
1876
- };
1877
- type ProductsPayload = {
1878
- /** The products associated with this event. */
1879
- products: Array<ProductPayload & OtherData>;
1880
- };
1881
- type CollectionPayloadDetails = {
1882
- /** The collection id. */
1883
- id: string;
1884
- /** The collection handle. */
1885
- handle: string;
1886
- };
1887
- type CollectionPayload = {
1888
- collection: CollectionPayloadDetails;
1889
- };
1890
- type SearchPayload = {
1891
- /** The search term used for the search results page */
1892
- searchTerm: string;
1893
- /** The search results */
1894
- searchResults?: any;
1895
- };
1896
- type CartPayload = {
1897
- /** The current cart state. */
1898
- cart: CartReturn | null;
1899
- /** The previous cart state. */
1900
- prevCart: CartReturn | null;
1901
- };
1902
- type CartLinePayload = {
1903
- /** The previous state of the cart line that got updated. */
1904
- prevLine?: CartLine | ComponentizableCartLine;
1905
- /** The current state of the cart line that got updated. */
1906
- currentLine?: CartLine | ComponentizableCartLine;
1907
- };
1908
- type CollectionViewPayload = CollectionPayload & UrlPayload & BasePayload;
1909
- type ProductViewPayload = ProductsPayload & UrlPayload & BasePayload;
1910
- type CartViewPayload = CartPayload & UrlPayload & BasePayload;
1911
- type PageViewPayload = UrlPayload & BasePayload;
1912
- type SearchViewPayload = SearchPayload & UrlPayload & BasePayload;
1913
- type CartUpdatePayload = CartPayload & BasePayload & OtherData;
1914
- type CartLineUpdatePayload = CartLinePayload & CartPayload & BasePayload & OtherData;
1915
- type CustomEventPayload = BasePayload & OtherData;
1916
- type BasicViewProps = {
1917
- data?: OtherData;
1918
- customData?: OtherData;
1919
- };
1920
- type ProductViewProps = {
1921
- data: ProductsPayload;
1922
- customData?: OtherData;
1923
- };
1924
- type CollectionViewProps = {
1925
- data: CollectionPayload;
1926
- customData?: OtherData;
1927
- };
1928
- type SearchViewProps = {
1929
- data?: SearchPayload;
1930
- customData?: OtherData;
1931
- };
1932
- type CustomViewProps = {
1933
- type: typeof AnalyticsEvent.CUSTOM_EVENT;
1934
- data?: OtherData;
1935
- customData?: OtherData;
1936
- };
1937
- /** @publicDocs */
1938
- declare function AnalyticsProductView(props: ProductViewProps): react_jsx_runtime.JSX.Element;
1939
- /** @publicDocs */
1940
- declare function AnalyticsCollectionView(props: CollectionViewProps): react_jsx_runtime.JSX.Element;
1941
- /** @publicDocs */
1942
- declare function AnalyticsCartView(props: BasicViewProps): react_jsx_runtime.JSX.Element;
1943
- /** @publicDocs */
1944
- declare function AnalyticsSearchView(props: SearchViewProps): react_jsx_runtime.JSX.Element;
1945
- /** @publicDocs */
1946
- declare function AnalyticsCustomView(props: CustomViewProps): react_jsx_runtime.JSX.Element;
1947
-
1948
- type ShopAnalytics = {
1949
- /** The shop ID. */
1950
- shopId: string;
1951
- /** The language code that is being displayed to user. */
1952
- acceptedLanguage: LanguageCode$1;
1953
- /** The currency code that is being displayed to user. */
1954
- currency: CurrencyCode;
1955
- /** The Hydrogen subchannel ID generated by Oxygen in the environment variable. */
1956
- hydrogenSubchannelId: string | '0';
1957
- };
1958
- type Consent = Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'sameDomainForStorefrontApi' | 'storefrontAccessToken' | 'withPrivacyBanner' | 'country'>> & {
1959
- language?: LanguageCode$1;
1960
- };
1961
- /** @publicDocs */
1962
- type AnalyticsProviderProps = {
1963
- /** React children to render. */
1964
- children?: ReactNode;
1965
- /** The cart or cart promise to track for cart analytics. When there is a difference between the state of the cart, `AnalyticsProvider` will trigger a `cart_updated` event. It will also produce `product_added_to_cart` and `product_removed_from_cart` based on cart line quantity and cart line id changes. */
1966
- cart: Promise<CartReturn | null> | CartReturn | null;
1967
- /** An optional function to set wether the user can be tracked. Defaults to Customer Privacy API's `window.Shopify.customerPrivacy.analyticsProcessingAllowed()`. */
1968
- canTrack?: () => boolean;
1969
- /** An optional custom payload to pass to all events. e.g language/locale/currency. */
1970
- customData?: Record<string, unknown>;
1971
- /** The shop configuration required to publish analytics events to Shopify. Use [`getShopAnalytics`](/docs/api/hydrogen/utilities/getshopanalytics). */
1972
- shop: Promise<ShopAnalytics | null> | ShopAnalytics | null;
1973
- /** The customer privacy consent configuration and options. */
1974
- consent: Consent;
1975
- /** @deprecated Disable throwing errors when required props are missing. */
1976
- disableThrowOnError?: boolean;
1977
- /** The domain scope of the cookie set with `useShopifyCookies`. **/
1978
- cookieDomain?: string;
1979
- };
1980
- type AnalyticsContextValue = {
1981
- /** A function to tell you the current state of if the user can be tracked by analytics. Defaults to Customer Privacy API's `window.Shopify.customerPrivacy.analyticsProcessingAllowed()`. */
1982
- canTrack: NonNullable<AnalyticsProviderProps['canTrack']>;
1983
- /** The current cart state. */
1984
- cart: Awaited<AnalyticsProviderProps['cart']>;
1985
- /** The custom data passed in from the `AnalyticsProvider`. */
1986
- customData?: AnalyticsProviderProps['customData'];
1987
- /** The previous cart state. */
1988
- prevCart: Awaited<AnalyticsProviderProps['cart']>;
1989
- /** A function to publish an analytics event. */
1990
- publish: typeof publish;
1991
- /** A function to register with the analytics provider. */
1992
- register: (key: string) => {
1993
- ready: () => void;
1994
- };
1995
- /** The shop configuration required to publish events to Shopify. */
1996
- shop: Awaited<AnalyticsProviderProps['shop']>;
1997
- /** A function to subscribe to analytics events. */
1998
- subscribe: typeof subscribe;
1999
- /** The privacy banner SDK methods with the config applied */
2000
- privacyBanner: PrivacyBanner | null;
2001
- /** The customer privacy SDK methods with the config applied */
2002
- customerPrivacy: CustomerPrivacy | null;
2003
- };
2004
- declare function subscribe(event: typeof AnalyticsEvent.PAGE_VIEWED, callback: (payload: PageViewPayload) => void): void;
2005
- declare function subscribe(event: typeof AnalyticsEvent.PRODUCT_VIEWED, callback: (payload: ProductViewPayload) => void): void;
2006
- declare function subscribe(event: typeof AnalyticsEvent.COLLECTION_VIEWED, callback: (payload: CollectionViewPayload) => void): void;
2007
- declare function subscribe(event: typeof AnalyticsEvent.CART_VIEWED, callback: (payload: CartViewPayload) => void): void;
2008
- declare function subscribe(event: typeof AnalyticsEvent.SEARCH_VIEWED, callback: (payload: SearchViewPayload) => void): void;
2009
- declare function subscribe(event: typeof AnalyticsEvent.CART_UPDATED, callback: (payload: CartUpdatePayload) => void): void;
2010
- declare function subscribe(event: typeof AnalyticsEvent.PRODUCT_ADD_TO_CART, callback: (payload: CartLineUpdatePayload) => void): void;
2011
- declare function subscribe(event: typeof AnalyticsEvent.PRODUCT_REMOVED_FROM_CART, callback: (payload: CartLineUpdatePayload) => void): void;
2012
- declare function subscribe(event: typeof AnalyticsEvent.CUSTOM_EVENT, callback: (payload: CustomEventPayload) => void): void;
2013
- declare function publish(event: typeof AnalyticsEvent.PAGE_VIEWED, payload: PageViewPayload): void;
2014
- declare function publish(event: typeof AnalyticsEvent.PRODUCT_VIEWED, payload: ProductViewPayload): void;
2015
- declare function publish(event: typeof AnalyticsEvent.COLLECTION_VIEWED, payload: CollectionViewPayload): void;
2016
- declare function publish(event: typeof AnalyticsEvent.CART_VIEWED, payload: CartViewPayload): void;
2017
- declare function publish(event: typeof AnalyticsEvent.CART_UPDATED, payload: CartUpdatePayload): void;
2018
- declare function publish(event: typeof AnalyticsEvent.PRODUCT_ADD_TO_CART, payload: CartLineUpdatePayload): void;
2019
- declare function publish(event: typeof AnalyticsEvent.PRODUCT_REMOVED_FROM_CART, payload: CartLineUpdatePayload): void;
2020
- declare function publish(event: typeof AnalyticsEvent.CUSTOM_EVENT, payload: OtherData): void;
2021
- declare function AnalyticsProvider({ canTrack: customCanTrack, cart: currentCart, children, consent, customData, shop: shopProp, cookieDomain, }: AnalyticsProviderProps): JSX.Element;
2022
- /** @publicDocs */
2023
- declare function useAnalytics(): AnalyticsContextValue;
2024
- type ShopAnalyticsProps = {
2025
- /**
2026
- * The storefront client instance created by [`createStorefrontClient`](docs/api/hydrogen/utilities/createstorefrontclient).
2027
- */
2028
- storefront: Storefront;
2029
- /**
2030
- * The `PUBLIC_STOREFRONT_ID` generated by Oxygen in the environment variable.
2031
- */
2032
- publicStorefrontId: string;
2033
- };
2034
- /** @publicDocs */
2035
- declare function getShopAnalytics({ storefront, publicStorefrontId, }: ShopAnalyticsProps): Promise<ShopAnalytics | null>;
2036
- declare const Analytics: {
2037
- CartView: typeof AnalyticsCartView;
2038
- CollectionView: typeof AnalyticsCollectionView;
2039
- CustomView: typeof AnalyticsCustomView;
2040
- ProductView: typeof AnalyticsProductView;
2041
- Provider: typeof AnalyticsProvider;
2042
- SearchView: typeof AnalyticsSearchView;
2043
- };
2044
-
2045
- /**
2046
- * The cache key is used to uniquely identify a value in the cache.
2047
- */
2048
- type CacheKey = string | readonly unknown[];
2049
- type AddDebugDataParam = {
2050
- displayName?: string;
2051
- response?: Pick<Response, 'url' | 'status' | 'statusText' | 'headers'>;
2052
- };
2053
- type CacheActionFunctionParam = {
2054
- addDebugData: (info: AddDebugDataParam) => void;
2055
- };
2056
-
2057
- type CreateWithCacheOptions = {
2058
- /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
2059
- cache: Cache;
2060
- /** The `waitUntil` function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
2061
- waitUntil: WaitUntil;
2062
- /** The `request` object is used by the Subrequest profiler, and to access certain headers for debugging */
2063
- request: CrossRuntimeRequest;
2064
- };
2065
- type WithCacheRunOptions<T> = {
2066
- /** The cache key for this run */
2067
- cacheKey: CacheKey;
2068
- /**
2069
- * Use the `CachingStrategy` to define a custom caching mechanism for your data.
2070
- * Or use one of the pre-defined caching strategies: [`CacheNone`](/docs/api/hydrogen/utilities/cachenone), [`CacheShort`](/docs/api/hydrogen/utilities/cacheshort), [`CacheLong`](/docs/api/hydrogen/utilities/cachelong).
2071
- */
2072
- cacheStrategy: CachingStrategy;
2073
- /** Useful to avoid accidentally caching bad results */
2074
- shouldCacheResult: (value: T) => boolean;
2075
- };
2076
- type WithCacheFetchOptions<T> = {
2077
- displayName?: string;
2078
- /**
2079
- * Use the `CachingStrategy` to define a custom caching mechanism for your data.
2080
- * Or use one of the pre-defined caching strategies: [`CacheNone`](/docs/api/hydrogen/utilities/cachenone), [`CacheShort`](/docs/api/hydrogen/utilities/cacheshort), [`CacheLong`](/docs/api/hydrogen/utilities/cachelong).
2081
- */
2082
- cacheStrategy?: CachingStrategy;
2083
- /** The cache key for this fetch */
2084
- cacheKey?: CacheKey;
2085
- /** Useful to avoid e.g. caching a successful response that contains an error in the body */
2086
- shouldCacheResponse: (body: T, response: Response) => boolean;
2087
- };
2088
- type WithCache = {
2089
- run: <T>(options: WithCacheRunOptions<T>, fn: ({ addDebugData }: CacheActionFunctionParam) => T | Promise<T>) => Promise<T>;
2090
- fetch: <T>(url: string, requestInit: RequestInit, options: WithCacheFetchOptions<T>) => Promise<{
2091
- data: T | null;
2092
- response: Response;
2093
- }>;
2094
- };
2095
- /** @publicDocs */
2096
- declare function createWithCache(cacheOptions: CreateWithCacheOptions): WithCache;
2097
-
2098
- /**
2099
- * This is a limited implementation of an in-memory cache.
2100
- * It only supports the `cache-control` header.
2101
- * It does NOT support `age` or `expires` headers.
2102
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Cache
2103
- * @publicDocs
2104
- */
2105
- declare class InMemoryCache implements Cache {
2106
- #private;
2107
- constructor();
2108
- add(request: RequestInfo): Promise<void>;
2109
- addAll(requests: RequestInfo[]): Promise<void>;
2110
- matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Response[]>;
2111
- put(request: Request, response: Response): Promise<void>;
2112
- match(request: Request): Promise<Response | undefined>;
2113
- delete(request: Request): Promise<boolean>;
2114
- keys(request?: Request): Promise<Request[]>;
2115
- }
2116
-
2117
- type OtherFormData = {
2118
- [key: string]: unknown;
2119
- };
2120
- type CartAttributesUpdateProps = {
2121
- action: 'AttributesUpdateInput';
2122
- inputs?: {
2123
- attributes: AttributeInput[];
2124
- } & OtherFormData;
2125
- };
2126
- type CartAttributesUpdateRequire = {
2127
- action: 'AttributesUpdateInput';
2128
- inputs: {
2129
- attributes: AttributeInput[];
2130
- } & OtherFormData;
2131
- };
2132
- type CartBuyerIdentityUpdateProps = {
2133
- action: 'BuyerIdentityUpdate';
2134
- inputs?: {
2135
- buyerIdentity: CartBuyerIdentityInput;
2136
- } & OtherFormData;
2137
- };
2138
- type CartBuyerIdentityUpdateRequire = {
2139
- action: 'BuyerIdentityUpdate';
2140
- inputs: {
2141
- buyerIdentity: CartBuyerIdentityInput;
2142
- } & OtherFormData;
2143
- };
2144
- type CartCreateProps = {
2145
- action: 'Create';
2146
- inputs?: {
2147
- input: CartInput;
2148
- } & OtherFormData;
2149
- };
2150
- type CartCreateRequire = {
2151
- action: 'Create';
2152
- inputs: {
2153
- input: CartInput;
2154
- } & OtherFormData;
2155
- };
2156
- type CartDiscountCodesUpdateProps = {
2157
- action: 'DiscountCodesUpdate';
2158
- inputs?: {
2159
- discountCodes: string[];
2160
- } & OtherFormData;
2161
- };
2162
- type CartDiscountCodesUpdateRequire = {
2163
- action: 'DiscountCodesUpdate';
2164
- inputs: {
2165
- discountCodes: string[];
2166
- } & OtherFormData;
2167
- };
2168
- type CartGiftCardCodesUpdateProps = {
2169
- action: 'GiftCardCodesUpdate';
2170
- inputs?: {
2171
- giftCardCodes: string[];
2172
- } & OtherFormData;
2173
- };
2174
- type CartGiftCardCodesUpdateRequire = {
2175
- action: 'GiftCardCodesUpdate';
2176
- inputs: {
2177
- giftCardCodes: string[];
2178
- } & OtherFormData;
2179
- };
2180
- type CartGiftCardCodesAddProps = {
2181
- action: 'GiftCardCodesAdd';
2182
- inputs?: {
2183
- giftCardCodes: string[];
2184
- } & OtherFormData;
2185
- };
2186
- type CartGiftCardCodesAddRequire = {
2187
- action: 'GiftCardCodesAdd';
2188
- inputs: {
2189
- giftCardCodes: string[];
2190
- } & OtherFormData;
2191
- };
2192
- type CartGiftCardCodesRemoveProps = {
2193
- action: 'GiftCardCodesRemove';
2194
- inputs?: {
2195
- giftCardCodes: string[];
2196
- } & OtherFormData;
2197
- };
2198
- type CartGiftCardCodesRemoveRequire = {
2199
- action: 'GiftCardCodesRemove';
2200
- inputs: {
2201
- giftCardCodes: string[];
2202
- } & OtherFormData;
2203
- };
2204
- type OptimisticCartLineInput = CartLineInput & {
2205
- selectedVariant?: unknown;
2206
- };
2207
- type CartLinesAddProps = {
2208
- action: 'LinesAdd';
2209
- inputs?: {
2210
- lines: Array<OptimisticCartLineInput>;
2211
- } & OtherFormData;
2212
- };
2213
- type CartLinesAddRequire = {
2214
- action: 'LinesAdd';
2215
- inputs: {
2216
- lines: Array<OptimisticCartLineInput>;
2217
- } & OtherFormData;
2218
- };
2219
- type CartLinesUpdateProps = {
2220
- action: 'LinesUpdate';
2221
- inputs?: {
2222
- lines: CartLineUpdateInput[];
2223
- } & OtherFormData;
2224
- };
2225
- type CartLinesUpdateRequire = {
2226
- action: 'LinesUpdate';
2227
- inputs: {
2228
- lines: CartLineUpdateInput[];
2229
- } & OtherFormData;
2230
- };
2231
- type CartLinesRemoveProps = {
2232
- action: 'LinesRemove';
2233
- inputs?: {
2234
- lineIds: string[];
2235
- } & OtherFormData;
2236
- };
2237
- type CartLinesRemoveRequire = {
2238
- action: 'LinesRemove';
2239
- inputs: {
2240
- lineIds: string[];
2241
- } & OtherFormData;
2242
- };
2243
- type CartNoteUpdateProps = {
2244
- action: 'NoteUpdate';
2245
- inputs?: {
2246
- note: string;
2247
- } & OtherFormData;
2248
- };
2249
- type CartNoteUpdateRequire = {
2250
- action: 'NoteUpdate';
2251
- inputs: {
2252
- note: string;
2253
- } & OtherFormData;
2254
- };
2255
- type CartSelectedDeliveryOptionsUpdateProps = {
2256
- action: 'SelectedDeliveryOptionsUpdate';
2257
- inputs?: {
2258
- selectedDeliveryOptions: CartSelectedDeliveryOptionInput[];
2259
- } & OtherFormData;
2260
- };
2261
- type CartSelectedDeliveryOptionsUpdateRequire = {
2262
- action: 'SelectedDeliveryOptionsUpdate';
2263
- inputs: {
2264
- selectedDeliveryOptions: CartSelectedDeliveryOptionInput[];
2265
- } & OtherFormData;
2266
- };
2267
- type CartMetafieldsSetProps = {
2268
- action: 'MetafieldsSet';
2269
- inputs?: {
2270
- metafields: MetafieldWithoutOwnerId[];
2271
- } & OtherFormData;
2272
- };
2273
- type CartMetafieldsSetRequire = {
2274
- action: 'MetafieldsSet';
2275
- inputs: {
2276
- metafields: MetafieldWithoutOwnerId[];
2277
- } & OtherFormData;
2278
- };
2279
- type CartMetafieldDeleteProps = {
2280
- action: 'MetafieldsDelete';
2281
- inputs?: {
2282
- key: Scalars['String']['input'];
2283
- } & OtherFormData;
2284
- };
2285
- type CartMetafieldDeleteRequire = {
2286
- action: 'MetafieldsDelete';
2287
- inputs: {
2288
- key: Scalars['String']['input'];
2289
- } & OtherFormData;
2290
- };
2291
- type CartDeliveryAddressesAddProps = {
2292
- action: 'DeliveryAddressesAdd';
2293
- inputs?: {
2294
- addresses: Array<CartSelectableAddressInput>;
2295
- } & OtherFormData;
2296
- };
2297
- type CartDeliveryAddressesAddRequire = {
2298
- action: 'DeliveryAddressesAdd';
2299
- inputs: {
2300
- addresses: Array<CartSelectableAddressInput>;
2301
- } & OtherFormData;
2302
- };
2303
- type CartDeliveryAddressesRemoveProps = {
2304
- action: 'DeliveryAddressesRemove';
2305
- inputs?: {
2306
- addressIds: Array<string> | Array<Scalars['ID']['input']>;
2307
- } & OtherFormData;
2308
- };
2309
- type CartDeliveryAddressesRemoveRequire = {
2310
- action: 'DeliveryAddressesRemove';
2311
- inputs: {
2312
- addressIds: Array<string> | Array<Scalars['ID']['input']>;
2313
- } & OtherFormData;
2314
- };
2315
- type CartDeliveryAddressesUpdateProps = {
2316
- action: 'DeliveryAddressesUpdate';
2317
- inputs?: {
2318
- addresses: Array<CartSelectableAddressUpdateInput>;
2319
- } & OtherFormData;
2320
- };
2321
- type CartDeliveryAddressesUpdateRequire = {
2322
- action: 'DeliveryAddressesUpdate';
2323
- inputs: {
2324
- addresses: Array<CartSelectableAddressUpdateInput>;
2325
- } & OtherFormData;
2326
- };
2327
- type CartDeliveryAddressesReplaceProps = {
2328
- action: 'DeliveryAddressesReplace';
2329
- inputs?: {
2330
- addresses: Array<CartSelectableAddressInput>;
2331
- } & OtherFormData;
2332
- };
2333
- type CartDeliveryAddressesReplaceRequire = {
2334
- action: 'DeliveryAddressesReplace';
2335
- inputs: {
2336
- addresses: Array<CartSelectableAddressInput>;
2337
- } & OtherFormData;
2338
- };
2339
- type CartCustomProps = {
2340
- action: `Custom${string}`;
2341
- inputs?: Record<string, unknown>;
2342
- };
2343
- type CartCustomRequire = {
2344
- action: `Custom${string}`;
2345
- inputs: Record<string, unknown>;
2346
- };
2347
- type CartFormCommonProps = {
2348
- /**
2349
- * Children nodes of CartForm.
2350
- * Children can be a render prop that receives the fetcher.
2351
- */
2352
- children: ReactNode | ((fetcher: FetcherWithComponents<any>) => ReactNode);
2353
- /**
2354
- * The route to submit the form to. Defaults to the current route.
2355
- */
2356
- route?: string;
2357
- /**
2358
- * Optional key to use for the fetcher.
2359
- * @see https://remix.run/hooks/use-fetcher#key
2360
- */
2361
- fetcherKey?: string;
2362
- };
2363
- type CartActionInputProps = CartAttributesUpdateProps | CartBuyerIdentityUpdateProps | CartCreateProps | CartDiscountCodesUpdateProps | CartGiftCardCodesUpdateProps | CartGiftCardCodesAddProps | CartGiftCardCodesRemoveProps | CartLinesAddProps | CartLinesUpdateProps | CartLinesRemoveProps | CartNoteUpdateProps | CartSelectedDeliveryOptionsUpdateProps | CartMetafieldsSetProps | CartMetafieldDeleteProps | CartDeliveryAddressesAddProps | CartDeliveryAddressesRemoveProps | CartDeliveryAddressesUpdateProps | CartDeliveryAddressesReplaceProps | CartCustomProps;
2364
- type CartActionInput = CartAttributesUpdateRequire | CartBuyerIdentityUpdateRequire | CartCreateRequire | CartDiscountCodesUpdateRequire | CartGiftCardCodesUpdateRequire | CartGiftCardCodesAddRequire | CartGiftCardCodesRemoveRequire | CartLinesAddRequire | CartLinesUpdateRequire | CartLinesRemoveRequire | CartNoteUpdateRequire | CartSelectedDeliveryOptionsUpdateRequire | CartMetafieldsSetRequire | CartMetafieldDeleteRequire | CartDeliveryAddressesAddRequire | CartDeliveryAddressesRemoveRequire | CartDeliveryAddressesUpdateRequire | CartDeliveryAddressesReplaceRequire | CartCustomRequire;
2365
- type CartFormProps = CartActionInputProps & CartFormCommonProps;
2366
- /** @publicDocs */
2367
- declare function CartForm({ children, action, inputs, route, fetcherKey, }: CartFormProps): JSX.Element;
2368
- declare namespace CartForm {
2369
- var INPUT_NAME: string;
2370
- var ACTIONS: {
2371
- readonly AttributesUpdateInput: "AttributesUpdateInput";
2372
- readonly BuyerIdentityUpdate: "BuyerIdentityUpdate";
2373
- readonly Create: "Create";
2374
- readonly DiscountCodesUpdate: "DiscountCodesUpdate";
2375
- readonly GiftCardCodesUpdate: "GiftCardCodesUpdate";
2376
- readonly GiftCardCodesAdd: "GiftCardCodesAdd";
2377
- readonly GiftCardCodesRemove: "GiftCardCodesRemove";
2378
- readonly LinesAdd: "LinesAdd";
2379
- readonly LinesRemove: "LinesRemove";
2380
- readonly LinesUpdate: "LinesUpdate";
2381
- readonly NoteUpdate: "NoteUpdate";
2382
- readonly SelectedDeliveryOptionsUpdate: "SelectedDeliveryOptionsUpdate";
2383
- readonly MetafieldsSet: "MetafieldsSet";
2384
- readonly MetafieldDelete: "MetafieldDelete";
2385
- readonly DeliveryAddressesAdd: "DeliveryAddressesAdd";
2386
- readonly DeliveryAddressesUpdate: "DeliveryAddressesUpdate";
2387
- readonly DeliveryAddressesRemove: "DeliveryAddressesRemove";
2388
- readonly DeliveryAddressesReplace: "DeliveryAddressesReplace";
2389
- };
2390
- var getFormInput: (formData: FormData) => CartActionInput;
2391
- }
2392
-
2393
- /** @publicDocs */
2394
- declare const cartGetIdDefault: (requestHeaders: CrossRuntimeRequest["headers"]) => () => string | undefined;
2395
-
2396
- type CookieOptions = {
2397
- maxage?: number;
2398
- expires?: Date | number | string;
2399
- samesite?: 'Lax' | 'Strict' | 'None';
2400
- secure?: boolean;
2401
- httponly?: boolean;
2402
- domain?: string;
2403
- path?: string;
2404
- };
2405
- /** @publicDocs */
2406
- declare const cartSetIdDefault: (cookieOptions?: CookieOptions) => (cartId: string) => Headers;
2407
-
2408
- type LikeACart = {
2409
- lines: {
2410
- nodes: Array<unknown>;
2411
- };
2412
- };
2413
- type OptimisticCartLine<T = CartLine | CartReturn> = T extends LikeACart ? T['lines']['nodes'][number] & {
2414
- isOptimistic?: boolean;
2415
- } : T & {
2416
- isOptimistic?: boolean;
2417
- };
2418
- type OptimisticCart<T = CartReturn> = T extends undefined | null ? // This is the null/undefined case, where the cart has yet to be created.
2419
- {
2420
- isOptimistic?: boolean;
2421
- lines: {
2422
- nodes: Array<OptimisticCartLine>;
2423
- };
2424
- totalQuantity?: number;
2425
- } & Omit<PartialDeep<CartReturn>, 'lines'> : Omit<T, 'lines'> & {
2426
- isOptimistic?: boolean;
2427
- lines: {
2428
- nodes: Array<OptimisticCartLine<T>>;
2429
- };
2430
- totalQuantity?: number;
2431
- };
2432
- /**
2433
- * @param cart The cart object from `context.cart.get()` returned by a server loader.
2434
- *
2435
- * @returns A new cart object augmented with optimistic state for `lines` and `totalQuantity`. Each cart line item that is optimistically added includes an `isOptimistic` property. Also if the cart has _any_ optimistic state, a root property `isOptimistic` will be set to `true`.
2436
- * @publicDocs
2437
- */
2438
- declare function useOptimisticCart<DefaultCart = {
2439
- lines?: {
2440
- nodes: Array<{
2441
- id: string;
2442
- quantity: number;
2443
- merchandise: {
2444
- is: string;
2445
- };
2446
- }>;
2447
- };
2448
- }>(cart?: DefaultCart): OptimisticCart<DefaultCart>;
2449
-
2450
- /**
2451
- * A custom Remix loader handler that fetches the changelog.json from GitHub.
2452
- * It is used by the `upgrade` command inside the route `https://hydrogen.shopify.dev/changelog.json`
2453
- */
2454
- declare function changelogHandler({ request, changelogUrl, }: {
2455
- request: Request;
2456
- changelogUrl?: string;
2457
- }): Promise<Response>;
2458
-
2459
- /**
2460
- * Grouped export of all Hydrogen context keys for convenient access.
2461
- * Use with React Router's context.get() pattern:
2462
- *
2463
- * @example
2464
- * ```ts
2465
- * import { hydrogenContext } from '@shopify/hydrogen';
2466
- *
2467
- * export async function loader({ context }) {
2468
- * const storefront = context.get(hydrogenContext.storefront);
2469
- * const cart = context.get(hydrogenContext.cart);
2470
- * }
2471
- * ```
2472
- * @publicDocs
2473
- */
2474
- declare const hydrogenContext: {
2475
- readonly storefront: react_router.RouterContext<Storefront<I18nBase>>;
2476
- readonly cart: react_router.RouterContext<HydrogenCart | HydrogenCartCustom<CustomMethodsBase>>;
2477
- readonly customerAccount: react_router.RouterContext<CustomerAccount>;
2478
- readonly env: react_router.RouterContext<HydrogenEnv>;
2479
- readonly session: react_router.RouterContext<HydrogenSession<react_router.SessionData, any>>;
2480
- readonly waitUntil: react_router.RouterContext<WaitUntil>;
2481
- };
2482
-
2483
- type HydrogenContextOptions<TSession extends HydrogenSession = HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env> = {
2484
- env: TEnv;
2485
- request: CrossRuntimeRequest;
2486
- /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
2487
- cache?: Cache;
2488
- /** The `waitUntil` function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
2489
- waitUntil?: WaitUntil;
2490
- /** Any cookie implementation. By default Hydrogen ships with cookie session storage, but you can use [another session storage](https://remix.run/docs/en/main/utils/sessions) implementation. */
2491
- session: TSession;
2492
- /** An object containing a country code and language code */
2493
- i18n?: TI18n;
2494
- /** Whether it should print GraphQL errors automatically. Defaults to true */
2495
- logErrors?: boolean | ((error?: Error) => boolean);
2496
- /** Storefront client overwrite options. See documentation for createStorefrontClient for more information. */
2497
- storefront?: {
2498
- /** Storefront API headers. Default values set from request header. */
2499
- headers?: CreateStorefrontClientOptions<TI18n>['storefrontHeaders'];
2500
- /** Override the Storefront API version for this query. */
2501
- apiVersion?: CreateStorefrontClientOptions<TI18n>['storefrontApiVersion'];
2502
- };
2503
- /** Customer Account client overwrite options. See documentation for createCustomerAccountClient for more information. */
2504
- customerAccount?: {
2505
- /** Override the version of the API */
2506
- apiVersion?: CustomerAccountOptions['customerApiVersion'];
2507
- /** This is the route in your app that authorizes the customer after logging in. Make sure to call `customer.authorize()` within the loader on this route. It defaults to `/account/authorize`. */
2508
- authUrl?: CustomerAccountOptions['authUrl'];
2509
- /** Use this method to overwrite the default logged-out redirect behavior. The default handler [throws a redirect](https://remix.run/docs/en/main/utils/redirect#:~:text=!session) to `/account/login` with current path as `return_to` query param. */
2510
- customAuthStatusHandler?: CustomerAccountOptions['customAuthStatusHandler'];
2511
- /** Deprecated. `unstableB2b` is now stable. Please remove. */
2512
- unstableB2b?: CustomerAccountOptions['unstableB2b'];
2513
- /** Set to true when using a custom HTTPS domain (e.g., ngrok, local proxy) instead of the default Hydrogen tunnel. */
2514
- useCustomAuthDomain?: CustomerAccountOptions['useCustomAuthDomain'];
2515
- };
2516
- /** Cart handler overwrite options. See documentation for createCartHandler for more information. */
2517
- cart?: {
2518
- /** A function that returns the cart id in the form of `gid://shopify/Cart/c1-123`. */
2519
- getId?: CartHandlerOptions['getCartId'];
2520
- /** A function that sets the cart ID. */
2521
- setId?: CartHandlerOptions['setCartId'];
2522
- /**
2523
- * The cart query fragment used by `cart.get()`.
2524
- * See the [example usage](/docs/api/hydrogen/utilities/createcarthandler#example-cart-fragments) in the documentation.
2525
- */
2526
- queryFragment?: CartHandlerOptions['cartQueryFragment'];
2527
- /**
2528
- * The cart mutation fragment used in most mutation requests, except for `setMetafields` and `deleteMetafield`.
2529
- * See the [example usage](/docs/api/hydrogen/utilities/createcarthandler#example-cart-fragments) in the documentation.
2530
- */
2531
- mutateFragment?: CartHandlerOptions['cartMutateFragment'];
2532
- /**
2533
- * Define custom methods or override existing methods for your cart API instance.
2534
- * See the [example usage](/docs/api/hydrogen/utilities/createcarthandler#example-custom-methods) in the documentation.
2535
- */
2536
- customMethods?: TCustomMethods;
2537
- };
2538
- buyerIdentity?: CartBuyerIdentityInput;
2539
- };
2540
- interface HydrogenContext<TSession extends HydrogenSession = HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env> {
2541
- /** A GraphQL client for querying the [Storefront API](https://shopify.dev/docs/api/storefront). */
2542
- storefront: StorefrontClient<TI18n>['storefront'];
2543
- /** A GraphQL client for querying the [Customer Account API](https://shopify.dev/docs/api/customer). It also provides methods to authenticate and check if the user is logged in. */
2544
- customerAccount: CustomerAccount;
2545
- /** A collection of utilities used to interact with the cart. */
2546
- cart: TCustomMethods extends CustomMethodsBase ? HydrogenCartCustom<TCustomMethods> : HydrogenCart;
2547
- env: TEnv;
2548
- /** The `waitUntil` function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
2549
- waitUntil?: WaitUntil;
2550
- /** Any cookie implementation. By default Hydrogen ships with cookie session storage, but you can use [another session storage](https://remix.run/docs/en/main/utils/sessions) implementation. */
2551
- session: TSession;
2552
- }
2553
- /** @publicDocs */
2554
- declare function createHydrogenContext<TSession extends HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env, TAdditionalContext extends Record<string, any> = {}>(options: HydrogenContextOptions<TSession, TCustomMethods, TI18n, TEnv>, additionalContext?: TAdditionalContext): HydrogenRouterContextProvider<TSession, TCustomMethods, TI18n, TEnv> & TAdditionalContext;
2555
-
2556
- type CreateRequestHandlerOptions<Context = unknown> = {
2557
- /** React Router's server build */
2558
- build: ServerBuild;
2559
- /** React Router's mode */
2560
- mode?: string;
2561
- /**
2562
- * Function to provide the load context for each request.
2563
- * It must contain Hydrogen's storefront client instance
2564
- * for other Hydrogen utilities to work properly.
2565
- */
2566
- getLoadContext?: (request: Request) => Promise<Context> | Context;
2567
- /**
2568
- * Whether to include the `powered-by` header in responses
2569
- * @default true
2570
- */
2571
- poweredByHeader?: boolean;
2572
- /**
2573
- * Collect tracking information from subrequests such as cookies
2574
- * and forward them to the browser. Disable this if you are not
2575
- * using Hydrogen's built-in analytics.
2576
- * @default true
2577
- */
2578
- collectTrackingInformation?: boolean;
2579
- };
2580
- /**
2581
- * Creates a request handler for Hydrogen apps using React Router.
2582
- * @publicDocs
2583
- */
2584
- declare function createRequestHandler<Context = unknown>({ build, mode, poweredByHeader, getLoadContext, collectTrackingInformation, }: CreateRequestHandlerOptions<Context>): (request: Request) => Promise<Response>;
2585
-
2586
- declare const NonceProvider: react.Provider<string | undefined>;
2587
- /** @publicDocs */
2588
- declare const useNonce: () => string | undefined;
2589
- type ContentSecurityPolicy = {
2590
- /** A randomly generated nonce string that should be passed to any custom `script` element */
2591
- nonce: string;
2592
- /** The content security policy header */
2593
- header: string;
2594
- NonceProvider: ComponentType<{
2595
- children: ReactNode;
2596
- }>;
2597
- };
2598
- type DirectiveValues = string[] | string | boolean;
2599
- type CreateContentSecurityPolicy = {
2600
- defaultSrc?: DirectiveValues;
2601
- scriptSrc?: DirectiveValues;
2602
- scriptSrcElem?: DirectiveValues;
2603
- styleSrc?: DirectiveValues;
2604
- imgSrc?: DirectiveValues;
2605
- connectSrc?: DirectiveValues;
2606
- fontSrc?: DirectiveValues;
2607
- objectSrc?: DirectiveValues;
2608
- mediaSrc?: DirectiveValues;
2609
- frameSrc?: DirectiveValues;
2610
- sandbox?: DirectiveValues;
2611
- reportUri?: DirectiveValues;
2612
- childSrc?: DirectiveValues;
2613
- formAction?: DirectiveValues;
2614
- frameAncestors?: DirectiveValues;
2615
- pluginTypes?: DirectiveValues;
2616
- baseUri?: DirectiveValues;
2617
- reportTo?: DirectiveValues;
2618
- workerSrc?: DirectiveValues;
2619
- manifestSrc?: DirectiveValues;
2620
- prefetchSrc?: DirectiveValues;
2621
- navigateTo?: DirectiveValues;
2622
- upgradeInsecureRequests?: boolean;
2623
- blockAllMixedContent?: boolean;
2624
- };
2625
- type ShopifyDomains = {
2626
- /** The production shop checkout domain url. */
2627
- checkoutDomain?: string;
2628
- /** The production shop domain url. */
2629
- storeDomain?: string;
2630
- };
2631
- type ShopProp = {
2632
- /** Shop specific configurations */
2633
- shop?: ShopifyDomains;
2634
- };
2635
- /**
2636
- * @param directives - Pass custom [content security policy directives](https://content-security-policy.com/). This is important if you load content in your app from third-party domains.
2637
- * @publicDocs
2638
- */
2639
- declare function createContentSecurityPolicy(props?: CreateContentSecurityPolicy & ShopProp): ContentSecurityPolicy;
2640
-
2641
- interface HydrogenScriptProps {
2642
- /** Wait to load the script until after the page hydrates. This prevents hydration errors for scripts that modify the DOM. Note: For security, `nonce` is not supported when using `waitForHydration`. Instead you need to add the domain of the script directly to your [Content Securitiy Policy directives](https://shopify.dev/docs/storefronts/headless/hydrogen/content-security-policy#step-3-customize-the-content-security-policy).*/
2643
- waitForHydration?: boolean;
2644
- }
2645
- interface ScriptAttributes extends ScriptHTMLAttributes<HTMLScriptElement> {
2646
- }
2647
- /** @publicDocs */
2648
- declare const Script: react.ForwardRefExoticComponent<HydrogenScriptProps & ScriptAttributes & react.RefAttributes<HTMLScriptElement>>;
2649
-
2650
- /** @publicDocs */
2651
- declare function createCustomerAccountClient({ session, customerAccountId, shopId, customerApiVersion, request, waitUntil, authUrl, customAuthStatusHandler, logErrors, loginPath, authorizePath, defaultRedirectPath, language, useCustomAuthDomain, }: CustomerAccountOptions): CustomerAccount;
2652
-
2653
- declare function hydrogenRoutes(currentRoutes: Array<RouteConfigEntry>): Promise<Array<RouteConfigEntry>>;
2654
-
2655
- /** @publicDocs */
2656
- declare function useOptimisticData<T>(identifier: string): T;
2657
- type OptimisticInputProps = {
2658
- /**
2659
- * A unique identifier for the optimistic input. Use the same identifier in `useOptimisticData`
2660
- * to retrieve the optimistic data from actions.
2661
- */
2662
- id: string;
2663
- /**
2664
- * The data to be stored in the optimistic input. Use for creating an optimistic successful state
2665
- * of this form action.
2666
- */
2667
- data: Record<string, unknown>;
2668
- };
2669
- /** @publicDocs */
2670
- declare function OptimisticInput({ id, data }: OptimisticInputProps): react_jsx_runtime.JSX.Element;
2671
-
2672
- declare global {
2673
- interface Window {
2674
- __hydrogenHydrated?: boolean;
2675
- }
2676
- }
2677
- type Connection<NodesType> = {
2678
- nodes: Array<NodesType>;
2679
- pageInfo: PageInfo;
2680
- } | {
2681
- edges: Array<{
2682
- node: NodesType;
2683
- }>;
2684
- pageInfo: PageInfo;
2685
- };
2686
- interface PaginationInfo<NodesType> {
2687
- /** The paginated array of nodes. You should map over and render this array. */
2688
- nodes: Array<NodesType>;
2689
- /** The `<NextLink>` is a helper component that makes it easy to navigate to the next page of paginated data. Alternatively you can build your own `<Link>` component: `<Link to={nextPageUrl} state={state} preventScrollReset />` */
2690
- NextLink: ForwardRefExoticComponent<Omit<LinkProps, 'to'> & RefAttributes<HTMLAnchorElement>>;
2691
- /** The `<PreviousLink>` is a helper component that makes it easy to navigate to the previous page of paginated data. Alternatively you can build your own `<Link>` component: `<Link to={previousPageUrl} state={state} preventScrollReset />` */
2692
- PreviousLink: ForwardRefExoticComponent<Omit<LinkProps, 'to'> & RefAttributes<HTMLAnchorElement>>;
2693
- /** The URL to the previous page of paginated data. Use this prop to build your own `<Link>` component. */
2694
- previousPageUrl: string;
2695
- /** The URL to the next page of paginated data. Use this prop to build your own `<Link>` component. */
2696
- nextPageUrl: string;
2697
- /** True if the cursor has next paginated data */
2698
- hasNextPage: boolean;
2699
- /** True if the cursor has previous paginated data */
2700
- hasPreviousPage: boolean;
2701
- /** True if we are in the process of fetching another page of data */
2702
- isLoading: boolean;
2703
- /** The `state` property is important to use when building your own `<Link>` component if you want paginated data to continuously append to the page. This means that every time the user clicks "Next page", the next page of data will be apppended inline with the previous page. If you want the whole page to re-render with only the next page results, do not pass the `state` prop to the Remix `<Link>` component. */
2704
- state: {
2705
- nodes: Array<NodesType>;
2706
- pageInfo: {
2707
- endCursor: Maybe<string> | undefined;
2708
- startCursor: Maybe<string> | undefined;
2709
- hasPreviousPage: boolean;
2710
- };
2711
- };
2712
- }
2713
- type PaginationProps<NodesType> = {
2714
- /** The response from `storefront.query` for a paginated request. Make sure the query is passed pagination variables and that the query has `pageInfo` with `hasPreviousPage`, `hasNextpage`, `startCursor`, and `endCursor` defined. */
2715
- connection: Connection<NodesType>;
2716
- /** A render prop that includes pagination data and helpers. */
2717
- children: PaginationRenderProp<NodesType>;
2718
- /** A namespace for the pagination component to avoid URL param conflicts when using multiple `Pagination` components on a single page. */
2719
- namespace?: string;
2720
- };
2721
- type PaginationRenderProp<NodesType> = FC<PaginationInfo<NodesType>>;
2722
- /**
2723
- *
2724
- * The [Storefront API uses cursors](https://shopify.dev/docs/api/usage/pagination-graphql) to paginate through lists of data
2725
- * and the \`<Pagination />\` component makes it easy to paginate data from the Storefront API.
2726
- *
2727
- * @prop connection The response from `storefront.query` for a paginated request. Make sure the query is passed pagination variables and that the query has `pageInfo` with `hasPreviousPage`, `hasNextpage`, `startCursor`, and `endCursor` defined.
2728
- * @prop children A render prop that includes pagination data and helpers.
2729
- * @publicDocs
2730
- */
2731
- declare function Pagination<NodesType>({ connection, children, namespace, }: PaginationProps<NodesType>): ReturnType<FC>;
2732
- /**
2733
- * @param request The request object passed to your Remix loader function.
2734
- * @param options Options for how to configure the pagination variables. Includes the ability to change how many nodes are within each page as well as a namespace to avoid URL param conflicts when using multiple `Pagination` components on a single page.
2735
- *
2736
- * @returns Variables to be used with the `storefront.query` function
2737
- * @publicDocs
2738
- */
2739
- declare function getPaginationVariables(request: Request, options?: {
2740
- pageBy: number;
2741
- namespace?: string;
2742
- }): {
2743
- last: number;
2744
- startCursor: string | null;
2745
- } | {
2746
- first: number;
2747
- endCursor: string | null;
2748
- };
2749
-
2750
- type OptimisticVariant<T> = T & {
2751
- isOptimistic?: boolean;
2752
- };
2753
- type OptimisticVariantInput = PartialDeep<ProductVariant>;
2754
- type OptimisticProductVariants = Array<PartialDeep<ProductVariant>> | Promise<Array<PartialDeep<ProductVariant>>> | PartialDeep<ProductVariant> | Promise<PartialDeep<ProductVariant>>;
2755
- /**
2756
- * @param selectedVariant The `selectedVariant` field queried with `variantBySelectedOptions`.
2757
- * @param variants The available product variants for the product. This can be an array of variants, a promise that resolves to an array of variants, or an object with a `product` key that contains the variants.
2758
- * @returns A new product object where the `selectedVariant` property is set to the variant that matches the current URL search params. If no variant is found, the original product object is returned. The `isOptimistic` property is set to `true` if the `selectedVariant` has been optimistically changed.
2759
- * @publicDocs
2760
- */
2761
- declare function useOptimisticVariant<SelectedVariant = OptimisticVariantInput, Variants = OptimisticProductVariants>(selectedVariant: SelectedVariant, variants: Variants): OptimisticVariant<SelectedVariant>;
2762
-
2763
- type VariantOption = {
2764
- name: string;
2765
- value?: string;
2766
- values: Array<VariantOptionValue>;
2767
- };
2768
- type PartialProductOptionValues = PartialDeep<ProductOptionValue>;
2769
- type PartialProductOption = PartialDeep<Omit<ProductOption, 'optionValues'> & {
2770
- optionValues: Array<PartialProductOptionValues>;
2771
- }>;
2772
- type VariantOptionValue = {
2773
- value: string;
2774
- isAvailable: boolean;
2775
- to: string;
2776
- search: string;
2777
- isActive: boolean;
2778
- variant?: PartialDeep<ProductVariant, {
2779
- recurseIntoArrays: true;
2780
- }>;
2781
- optionValue: PartialProductOptionValues;
2782
- };
2783
- /**
2784
- * @deprecated VariantSelector will be deprecated and removed in the next major version 2025-10
2785
- * Please use [getProductOptions](https://shopify.dev/docs/api/hydrogen/latest/utilities/getproductoptions),
2786
- * [getSelectedProductOptions](https://shopify.dev/docs/api/hydrogen/latest/utilities/getselectedproductoptions),
2787
- * [getAdjacentAndFirstAvailableVariants](https://shopify.dev/docs/api/hydrogen/latest/utilities/getadjacentandfirstavailablevariants) utils instead.
2788
- * and [useSelectedOptionInUrlParam](https://shopify.dev/docs/api/hydrogen/latest/utilities/useselectedoptioninurlparam)
2789
- * For a full implementation see the Skeleton template [routes/product.$handle.tsx](https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx).
2790
- */
2791
- type VariantSelectorProps = {
2792
- /** The product handle for all of the variants */
2793
- handle: string;
2794
- /** Product options from the [Storefront API](/docs/api/storefront/2026-04/objects/ProductOption). Make sure both `name` and `values` are a part of your query. */
2795
- options: Array<PartialProductOption> | undefined;
2796
- /** Product variants from the [Storefront API](/docs/api/storefront/2026-04/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
2797
- variants?: PartialDeep<ProductVariantConnection> | Array<PartialDeep<ProductVariant>>;
2798
- /** By default all products are under /products. Use this prop to provide a custom path. */
2799
- productPath?: string;
2800
- /** Should the VariantSelector wait to update until after the browser navigates to a variant. */
2801
- waitForNavigation?: boolean;
2802
- /** An optional selected variant to use for the initial state if no URL parameters are set */
2803
- selectedVariant?: Maybe<PartialDeep<ProductVariant>>;
2804
- children: ({ option }: {
2805
- option: VariantOption;
2806
- }) => ReactNode;
2807
- };
2808
- /**
2809
- * @deprecated VariantSelector will be deprecated and removed in the next major version 2025-10
2810
- * Please use [getProductOptions](https://shopify.dev/docs/api/hydrogen/latest/utilities/getproductoptions),
2811
- * [getSelectedProductOptions](https://shopify.dev/docs/api/hydrogen/latest/utilities/getselectedproductoptions),
2812
- * [getAdjacentAndFirstAvailableVariants](https://shopify.dev/docs/api/hydrogen/latest/utilities/getadjacentandfirstavailablevariants) utils instead.
2813
- * and [useSelectedOptionInUrlParam](https://shopify.dev/docs/api/hydrogen/latest/utilities/useselectedoptioninurlparam)
2814
- * For a full implementation see the Skeleton template [routes/product.$handle.tsx](https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx).
2815
- * @publicDocs
2816
- */
2817
- declare function VariantSelector({ handle, options: _options, variants: _variants, productPath, waitForNavigation, selectedVariant, children, }: VariantSelectorProps): react.FunctionComponentElement<{
2818
- children?: ReactNode | undefined;
2819
- }>;
2820
- /** @publicDocs */
2821
- type GetSelectedProductOptions = (request: Request) => SelectedOptionInput[];
2822
- /**
2823
- * Extract searchParams from a Request instance and return an array of selected options.
2824
- * @param request - The Request instance to extract searchParams from.
2825
- * @returns An array of selected options.
2826
- * @example Basic usage:
2827
- * ```tsx
2828
- *
2829
- * import {getSelectedProductOptions} from '@shopify/hydrogen';
2830
- *
2831
- * // Given a request url of `/products/product-handle?color=red&size=large`
2832
- *
2833
- * const selectedOptions = getSelectedProductOptions(request);
2834
- *
2835
- * // selectedOptions will equal:
2836
- * // [
2837
- * // {name: 'color', value: 'red'},
2838
- * // {name: 'size', value: 'large'}
2839
- * // ]
2840
- * ```
2841
- * @publicDocs
2842
- **/
2843
- declare const getSelectedProductOptions: GetSelectedProductOptions;
2844
-
2845
- /**
2846
- * Official Hydrogen Preset for React Router 7.16.x
2847
- *
2848
- * Provides optimal React Router configuration for Hydrogen applications on Oxygen.
2849
- * Enables validated performance optimizations while ensuring CLI compatibility.
2850
- *
2851
- * React Router 7.16.x Feature Support Matrix for Hydrogen 2025.7.0
2852
- *
2853
- * +----------------------------------+----------+----------------------------------+
2854
- * | Feature | Status | Notes |
2855
- * +----------------------------------+----------+----------------------------------+
2856
- * | CORE CONFIGURATION |
2857
- * +----------------------------------+----------+----------------------------------+
2858
- * | appDirectory: 'app' | Enabled | Core application structure |
2859
- * | buildDirectory: 'dist' | Enabled | Build output configuration |
2860
- * | ssr: true | Enabled | Server-side rendering |
2861
- * +----------------------------------+----------+----------------------------------+
2862
- * | PERFORMANCE FLAGS |
2863
- * +----------------------------------+----------+----------------------------------+
2864
- * | v8_middleware | Enabled | Required for Hydrogen context |
2865
- * | v8_splitRouteModules | Enabled | Route code splitting |
2866
- * | unstable_optimizeDeps | Enabled | Build performance optimization |
2867
- * +----------------------------------+----------+----------------------------------+
2868
- * | ROUTE DISCOVERY |
2869
- * +----------------------------------+----------+----------------------------------+
2870
- * | routeDiscovery: { mode: 'lazy' } | Default | Lazy route loading |
2871
- * | routeDiscovery: { mode: 'init' } | Allowed | Eager route loading |
2872
- * +----------------------------------+----------+----------------------------------+
2873
- * | UNSUPPORTED FEATURES |
2874
- * +----------------------------------+----------+----------------------------------+
2875
- * | basename: '/path' | Blocked | CLI infrastructure limitation |
2876
- * | prerender: ['/routes'] | Blocked | Plugin incompatibility |
2877
- * | serverBundles: () => {} | Blocked | Manifest incompatibility |
2878
- * | buildEnd: () => {} | Blocked | CLI bypasses hook execution |
2879
- * | subResourceIntegrity | Blocked | CSP nonce/hash conflict |
2880
- * | v8_viteEnvironmentApi | Blocked | CLI fallback detection used |
2881
- * +----------------------------------+----------+----------------------------------+
2882
- *
2883
- * @version 2025.7.0
2884
- */
2885
- declare function hydrogenPreset(): Preset;
2886
-
2887
- declare const RichText: typeof RichText$1;
2888
-
2889
- /** @publicDocs */
2890
- type GraphiQLLoader = (args: LoaderFunctionArgs) => Promise<Response>;
2891
- /** @publicDocs */
2892
- declare const graphiqlLoader: GraphiQLLoader;
2893
-
2894
- type StorefrontRedirect = {
2895
- /** The [Storefront client](/docs/api/hydrogen/utilities/createstorefrontclient) instance */
2896
- storefront: Storefront<I18nBase>;
2897
- /** The [MDN Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object that was passed to the `server.ts` request handler. */
2898
- request: Request;
2899
- /** The [MDN Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object created by `handleRequest` */
2900
- response?: Response;
2901
- /** By default the `/admin` route is redirected to the Shopify Admin page for the current storefront. Disable this redirect by passing `true`. */
2902
- noAdminRedirect?: boolean;
2903
- /** By default, query parameters are not used to match redirects. Set this to `true` if you'd like redirects to be query parameter sensitive */
2904
- matchQueryParams?: boolean;
2905
- };
2906
- /**
2907
- * Queries the Storefront API to see if there is any redirect
2908
- * created for the current route and performs it. Otherwise,
2909
- * it returns the response passed in the parameters. Useful for
2910
- * conditionally redirecting after a 404 response.
2911
- *
2912
- * @see {@link https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect Creating URL redirects in Shopify}
2913
- * @publicDocs
2914
- */
2915
- declare function storefrontRedirect(options: StorefrontRedirect): Promise<Response>;
2916
-
2917
- interface SeoConfig {
2918
- /**
2919
- * The `title` HTML element defines the document's title that is shown in a browser's title bar or a page's tab. It
2920
- * only contains text; tags within the element are ignored.
2921
- *
2922
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
2923
- */
2924
- title?: Maybe<string>;
2925
- /**
2926
- * Generate the title from a template that includes a `%s` placeholder for the title.
2927
- *
2928
- * @example
2929
- * ```js
2930
- * {
2931
- * title: 'My Page',
2932
- * titleTemplate: 'My Site - %s',
2933
- * }
2934
- * ```
2935
- */
2936
- titleTemplate?: Maybe<string> | null;
2937
- /**
2938
- * The media associated with the given page (images, videos, etc). If you pass a string, it will be used as the
2939
- * `og:image` meta tag. If you pass an object or an array of objects, that will be used to generate `og:<type of
2940
- * media>` meta tags. The `url` property should be the URL of the media. The `height` and `width` properties are
2941
- * optional and should be the height and width of the media. The `altText` property is optional and should be a
2942
- * description of the media.
2943
- *
2944
- * @example
2945
- * ```js
2946
- * {
2947
- * media: [
2948
- * {
2949
- * url: 'https://example.com/image.jpg',
2950
- * type: 'image',
2951
- * height: '400',
2952
- * width: '400',
2953
- * altText: 'A custom snowboard with an alpine color pallet.',
2954
- * }
2955
- * ]
2956
- * }
2957
- * ```
2958
- *
2959
- */
2960
- media?: Maybe<string> | Partial<SeoMedia> | (Partial<SeoMedia> | Maybe<string>)[];
2961
- /**
2962
- * The description of the page. This is used in the `name="description"` meta tag as well as the `og:description` meta
2963
- * tag.
2964
- *
2965
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
2966
- */
2967
- description?: Maybe<string>;
2968
- /**
2969
- * The canonical URL of the page. This is used to tell search engines which URL is the canonical version of a page.
2970
- * This is useful when you have multiple URLs that point to the same page. The value here will be used in the
2971
- * `rel="canonical"` link tag as well as the `og:url` meta tag.
2972
- *
2973
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
2974
- */
2975
- url?: Maybe<string>;
2976
- /**
2977
- * The handle is used to generate the `twitter:site` and `twitter:creator` meta tags. Include the `@` symbol in the
2978
- * handle.
2979
- *
2980
- * @example
2981
- * ```js
2982
- * {
2983
- * handle: '@shopify'
2984
- * }
2985
- * ```
2986
- */
2987
- handle?: Maybe<string>;
2988
- /**
2989
- * The `jsonLd` property is used to generate the `application/ld+json` script tag. This is used to provide structured
2990
- * data to search engines. The value should be an object that conforms to the schema.org spec. The `type` property
2991
- * should be the type of schema you are using. The `type` property is required and should be one of the following:
2992
- *
2993
- * - `Product`
2994
- * - `ItemList`
2995
- * - `Organization`
2996
- * - `WebSite`
2997
- * - `WebPage`
2998
- * - `BlogPosting`
2999
- * - `Thing`
3000
- *
3001
- * The value is validated via [schema-dts](https://www.npmjs.com/package/schema-dts)
3002
- *
3003
- * @example
3004
- * ```js
3005
- * {
3006
- * jsonLd: {
3007
- * '@context': 'https://schema.org',
3008
- * '@type': 'Product',
3009
- * name: 'My Product',
3010
- * image: 'https://hydrogen.shop/image.jpg',
3011
- * description: 'A product that is great',
3012
- * sku: '12345',
3013
- * mpn: '12345',
3014
- * brand: {
3015
- * '@type': 'Thing',
3016
- * name: 'My Brand',
3017
- * },
3018
- * aggregateRating: {
3019
- * '@type': 'AggregateRating',
3020
- * ratingValue: '4.5',
3021
- * reviewCount: '100',
3022
- * },
3023
- * offers: {
3024
- * '@type': 'Offer',
3025
- * priceCurrency: 'USD',
3026
- * price: '100',
3027
- * priceValidUntil: '2020-11-05',
3028
- * itemCondition: 'https://schema.org/NewCondition',
3029
- * availability: 'https://schema.org/InStock',
3030
- * seller: {
3031
- * '@type': 'Organization',
3032
- * name: 'My Brand',
3033
- * },
3034
- * },
3035
- * }
3036
- * }
3037
- * ```
3038
- *
3039
- * @see https://schema.org/docs/schemas.html
3040
- * @see https://developers.google.com/search/docs/guides/intro-structured-data
3041
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
3042
- *
3043
- */
3044
- jsonLd?: WithContext<Thing> | WithContext<Thing>[];
3045
- /**
3046
- * The `alternates` property is used to specify the language and geographical targeting when you have multiple
3047
- * versions of the same page in different languages. The `url` property tells search engines about these variations
3048
- * and helps them to serve the correct version to their users.
3049
- *
3050
- * @example
3051
- * ```js
3052
- * {
3053
- * alternates: [
3054
- * {
3055
- * language: 'en-US',
3056
- * url: 'https://hydrogen.shop/en-us',
3057
- * default: true,
3058
- * },
3059
- * {
3060
- * language: 'fr-CA',
3061
- * url: 'https://hydrogen.shop/fr-ca',
3062
- * },
3063
- * ]
3064
- * }
3065
- * ```
3066
- *
3067
- * @see https://support.google.com/webmasters/answer/189077?hl=en
3068
- */
3069
- alternates?: LanguageAlternate | LanguageAlternate[];
3070
- /**
3071
- * The `robots` property is used to specify the robots meta tag. This is used to tell search engines which pages
3072
- * should be indexed and which should not.
3073
- *
3074
- * @see https://developers.google.com/search/reference/robots_meta_tag
3075
- */
3076
- robots?: RobotsOptions;
3077
- }
3078
- /**
3079
- * @see https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag
3080
- */
3081
- interface RobotsOptions {
3082
- /**
3083
- * Set the maximum size of an image preview for this page in a search results Can be one of the following:
3084
- *
3085
- * - `none` - No image preview is to be shown.
3086
- * - `standard` - A default image preview may be shown.
3087
- * - `large` - A larger image preview, up to the width of the viewport, may be shown.
3088
- *
3089
- * If no value is specified a default image preview size is used.
3090
- */
3091
- maxImagePreview?: 'none' | 'standard' | 'large';
3092
- /**
3093
- * A number representing the maximum of amount characters to use as a textual snippet for a search result. This value
3094
- * can also be set to one of the following special values:
3095
- *
3096
- * - 0 - No snippet is to be shown. Equivalent to nosnippet.
3097
- * - 1 - The Search engine will choose the snippet length that it believes is most effective to help users discover
3098
- * your content and direct users to your site
3099
- * - -1 - No limit on the number of characters that can be shown in the snippet.
3100
- */
3101
- maxSnippet?: number;
3102
- /**
3103
- * The maximum number of seconds for videos on this page to show in search results. This value can also be set to one
3104
- * of the following special values:
3105
- *
3106
- * - 0 - A static image may be used with the `maxImagePreview` setting.
3107
- * - 1 - There is no limit to the size of the video preview.
3108
- *
3109
- * This applies to all forms of search results (at Google: web search, Google Images, Google Videos, Discover,
3110
- * Assistant).
3111
- */
3112
- maxVideoPreview?: number;
3113
- /**
3114
- * Do not show a cached link in search results.
3115
- */
3116
- noArchive?: boolean;
3117
- /**
3118
- * Do not follow the links on this page.
3119
- *
3120
- * @see https://developers.google.com/search/docs/advanced/guidelines/qualify-outbound-links
3121
- */
3122
- noFollow?: boolean;
3123
- /**
3124
- * Do not index images on this page.
3125
- */
3126
- noImageIndex?: boolean;
3127
- /**
3128
- * Do not show this page, media, or resource in search results.
3129
- */
3130
- noIndex?: boolean;
3131
- /**
3132
- * Do not show a text snippet or video preview in the search results for this page.
3133
- */
3134
- noSnippet?: boolean;
3135
- /**
3136
- * Do not offer translation of this page in search results.
3137
- */
3138
- noTranslate?: boolean;
3139
- /**
3140
- * Do not show this page in search results after the specified date/time.
3141
- */
3142
- unavailableAfter?: string;
3143
- }
3144
- interface LanguageAlternate {
3145
- /**
3146
- * Language code for the alternate page. This is used to generate the hreflang meta tag property.
3147
- */
3148
- language: string;
3149
- /**
3150
- * Whether the alternate page is the default page. This will add the `x-default` attribution to the language code.
3151
- */
3152
- default?: boolean;
3153
- /**
3154
- * The url of the alternate page. This is used to generate the hreflang meta tag property.
3155
- */
3156
- url: string;
3157
- }
3158
- type SeoMedia = {
3159
- /**
3160
- * Used to generate og:<type of media> meta tag
3161
- */
3162
- type: 'image' | 'video' | 'audio';
3163
- /**
3164
- * The url value populates both url and secure_url and is used to infer the og:<type of media>:type meta tag.
3165
- */
3166
- url: Maybe<string> | undefined;
3167
- /**
3168
- * The height in pixels of the media. This is used to generate the og:<type of media>:height meta tag.
3169
- */
3170
- height: Maybe<number> | undefined;
3171
- /**
3172
- * The width in pixels of the media. This is used to generate the og:<type of media>:width meta tag.
3173
- */
3174
- width: Maybe<number> | undefined;
3175
- /**
3176
- * The alt text for the media. This is used to generate the og:<type of media>:alt meta tag.
3177
- */
3178
- altText: Maybe<string> | undefined;
3179
- };
3180
-
3181
- type GetSeoMetaReturn = ReturnType<MetaFunction>;
3182
- type Optional<T> = T | null | undefined;
3183
- /**
3184
- * Generate a Remix meta array from one or more SEO configuration objects. This is useful to pass SEO configuration for the parent route(s) and the current route. Similar to `Object.assign()`, each property is overwritten based on the object order. The exception is `jsonLd`, which is preserved so that each route has it's own independent jsonLd meta data.
3185
- * @publicDocs
3186
- */
3187
- declare function getSeoMeta(...seoInputs: Optional<SeoConfig>[]): GetSeoMetaReturn;
3188
-
3189
- interface SeoHandleFunction<Loader extends LoaderFunction | unknown = unknown> {
3190
- (args: {
3191
- data: Loader extends LoaderFunction ? Awaited<ReturnType<Loader>> : unknown;
3192
- id: string;
3193
- params: Params;
3194
- pathname: Location['pathname'];
3195
- search: Location['search'];
3196
- hash: Location['hash'];
3197
- key: string;
3198
- }): Partial<SeoConfig>;
3199
- }
3200
- interface SeoProps {
3201
- /** Enable debug mode that prints SEO properties for route in the console */
3202
- debug?: boolean;
3203
- }
3204
- /**
3205
- * @deprecated - use `getSeoMeta` instead
3206
- * @publicDocs
3207
- */
3208
- declare function Seo({ debug }: SeoProps): react.FunctionComponentElement<{
3209
- children?: react.ReactNode | undefined;
3210
- }>;
3211
-
3212
- declare function ShopPayButton(props: ComponentProps<typeof ShopPayButton$1>): react_jsx_runtime.JSX.Element;
3213
-
3214
- type SITEMAP_INDEX_TYPE = 'pages' | 'products' | 'collections' | 'blogs' | 'articles' | 'metaObjects';
3215
- interface SitemapIndexOptions {
3216
- /** The Storefront API Client from Hydrogen */
3217
- storefront: Storefront;
3218
- /** A Remix Request object */
3219
- request: Request;
3220
- /** The types of pages to include in the sitemap index. */
3221
- types?: SITEMAP_INDEX_TYPE[];
3222
- /** Add a URL to a custom child sitemap */
3223
- customChildSitemaps?: string[];
3224
- }
3225
- /**
3226
- * Generate a sitemap index that links to separate sitemaps for each resource type. Returns a standard Response object.
3227
- * @publicDocs
3228
- */
3229
- declare function getSitemapIndex(options: SitemapIndexOptions): Promise<Response>;
3230
- interface GetSiteMapOptions {
3231
- /** The params object from Remix */
3232
- params: LoaderFunctionArgs['params'];
3233
- /** The Storefront API Client from Hydrogen */
3234
- storefront: Storefront;
3235
- /** A Remix Request object */
3236
- request: Request;
3237
- /** A function that produces a canonical url for a resource. It is called multiple times for each locale supported by the app. */
3238
- getLink: (options: {
3239
- type: string | SITEMAP_INDEX_TYPE;
3240
- baseUrl: string;
3241
- handle?: string;
3242
- locale?: string;
3243
- }) => string;
3244
- /** An array of locales to generate alternate tags */
3245
- locales?: string[];
3246
- /** Optionally customize the changefreq property for each URL */
3247
- getChangeFreq?: (options: {
3248
- type: string | SITEMAP_INDEX_TYPE;
3249
- handle: string;
3250
- }) => string;
3251
- /** If the sitemap has no links, fallback to rendering a link to the homepage. This prevents errors in Google's search console. Defaults to `/`. */
3252
- noItemsFallback?: string;
3253
- }
3254
- /**
3255
- * Generate a sitemap for a specific resource type.
3256
- * @publicDocs
3257
- */
3258
- declare function getSitemap(options: GetSiteMapOptions): Promise<Response>;
3259
-
3260
- export { Analytics, AnalyticsEvent, CacheCustom, type CacheKey, CacheLong, CacheNone, CacheShort, type CachingStrategy, type CartActionInput, CartForm, type CartLineUpdatePayload, type CartQueryDataReturn, type CartQueryOptions, type CartQueryReturn, type CartReturn, type CartUpdatePayload, type CartViewPayload, type CollectionViewPayload, type ConsentStatus, type CookieOptions, type CreateStorefrontClientForDocs, type CreateStorefrontClientOptions, type CustomEventMap$1 as CustomEventMap, type CustomerAccount, type CustomerAccountMutations, type CustomerAccountQueries, type CustomerPrivacy, type CustomerPrivacyApiProps, type CustomerPrivacyConsentConfig, type HydrogenCart, type HydrogenCartCustom, type HydrogenContext, type HydrogenEnv, type HydrogenRouterContextProvider, type HydrogenSession, type HydrogenSessionData, type I18nBase, InMemoryCache, type MetafieldWithoutOwnerId, type NoStoreStrategy, NonceProvider, type OptimisticCart, type OptimisticCartLine, type OptimisticCartLineInput, OptimisticInput, type PageViewPayload, Pagination, type PrivacyBanner, type ProductViewPayload, RichText, Script, type SearchViewPayload, Seo, type SeoConfig, type SeoHandleFunction, type SetConsentHeadlessParams, type ShopAnalytics, ShopPayButton, type Storefront, type StorefrontApiErrors, type StorefrontClient, type StorefrontForDoc, type StorefrontMutationOptionsForDocs, type StorefrontMutations, type StorefrontQueries, type StorefrontQueryOptionsForDocs, type VariantOption, type VariantOptionValue, VariantSelector, type VisitorConsent, type VisitorConsentCollected, type WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartGiftCardCodesAddDefault, cartGiftCardCodesRemoveDefault, cartGiftCardCodesUpdateDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createHydrogenContext, createRequestHandler, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, getSeoMeta, getShopAnalytics, getSitemap, getSitemapIndex, graphiqlLoader, hydrogenContext, hydrogenPreset, hydrogenRoutes, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData, useOptimisticVariant };