@shopify/hydrogen 0.22.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (468) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +5 -5
  3. package/dist/esnext/components/CartLines/{CartLines.d.ts → CartLines.client.d.ts} +0 -0
  4. package/dist/esnext/components/CartLines/{CartLines.js → CartLines.client.js} +0 -0
  5. package/dist/esnext/components/CartLines/index.d.ts +1 -1
  6. package/dist/esnext/components/CartLines/index.js +1 -1
  7. package/dist/esnext/components/DevTools.client.js +1 -1
  8. package/dist/esnext/components/Image/Image.d.ts +8 -0
  9. package/dist/esnext/components/Image/Image.js +58 -10
  10. package/dist/esnext/components/Link/Link.client.d.ts +2 -0
  11. package/dist/esnext/components/Link/Link.client.js +7 -4
  12. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +1 -1
  13. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
  14. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +140 -0
  15. package/dist/esnext/components/ProductOptionsProvider/context.d.ts +2 -0
  16. package/dist/esnext/components/{ProductProvider → ProductOptionsProvider}/context.js +0 -1
  17. package/dist/esnext/components/ProductOptionsProvider/index.d.ts +2 -0
  18. package/dist/esnext/components/ProductOptionsProvider/index.js +2 -0
  19. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -2
  20. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +10 -12
  21. package/dist/esnext/components/index.d.ts +1 -1
  22. package/dist/esnext/components/index.js +1 -1
  23. package/dist/esnext/entry-client.js +106 -6
  24. package/dist/esnext/entry-server.d.ts +2 -15
  25. package/dist/esnext/entry-server.js +245 -321
  26. package/dist/esnext/foundation/Analytics/Analytics.client.js +15 -13
  27. package/dist/esnext/foundation/Analytics/Analytics.server.js +27 -20
  28. package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +4 -2
  29. package/dist/esnext/foundation/Analytics/ClientAnalytics.js +15 -13
  30. package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
  31. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.server.d.ts +1 -0
  32. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/{PerformanceMetrics.server.js → ServerAnalyticsConnector.server.js} +7 -6
  33. package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.d.ts +1 -0
  34. package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.js +19 -0
  35. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.d.ts +3 -0
  36. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +190 -0
  37. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.d.ts +3 -0
  38. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +24 -0
  39. package/dist/esnext/foundation/Analytics/connectors/Shopify/const.d.ts +28 -0
  40. package/dist/esnext/foundation/Analytics/connectors/Shopify/const.js +51 -0
  41. package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.d.ts +3 -0
  42. package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.js +56 -0
  43. package/dist/esnext/foundation/Analytics/hook.js +4 -2
  44. package/dist/esnext/foundation/Analytics/utils.d.ts +2 -0
  45. package/dist/esnext/foundation/Analytics/utils.js +21 -0
  46. package/dist/{node/framework → esnext/foundation/Cache}/cache-sub-request.d.ts +1 -1
  47. package/dist/esnext/{framework → foundation/Cache}/cache-sub-request.js +3 -3
  48. package/dist/esnext/{framework → foundation/Cache}/cache.d.ts +1 -1
  49. package/dist/esnext/{framework → foundation/Cache}/cache.js +3 -3
  50. package/dist/{node/framework/CachingStrategy → esnext/foundation/Cache/strategies}/index.d.ts +1 -1
  51. package/dist/esnext/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
  52. package/dist/esnext/foundation/Cookie/Cookie.d.ts +3 -3
  53. package/dist/{node/framework/Hydration → esnext/foundation/Html}/Html.d.ts +3 -1
  54. package/dist/esnext/{framework/Hydration → foundation/Html}/Html.js +15 -2
  55. package/dist/{node/framework/Hydration/ServerComponentRequest.server.d.ts → esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +7 -3
  56. package/dist/esnext/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +1 -1
  57. package/dist/{node/framework/Hydration/ServerComponentResponse.server.d.ts → esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts} +7 -10
  58. package/dist/esnext/{framework/Hydration/ServerComponentResponse.server.js → foundation/HydrogenResponse/HydrogenResponse.server.js} +19 -15
  59. package/dist/esnext/foundation/Router/BrowserRouter.client.js +16 -9
  60. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
  61. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -1
  62. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
  63. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
  64. package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +1 -1
  65. package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +1 -1
  66. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +1 -0
  67. package/dist/esnext/foundation/index.d.ts +1 -1
  68. package/dist/esnext/foundation/index.js +1 -1
  69. package/dist/esnext/foundation/runtime.d.ts +2 -0
  70. package/dist/esnext/foundation/runtime.js +6 -0
  71. package/dist/esnext/foundation/session/session.d.ts +3 -3
  72. package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
  73. package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +2 -0
  74. package/dist/esnext/foundation/useNavigate/useNavigate.js +11 -4
  75. package/dist/esnext/foundation/useQuery/hooks.js +9 -6
  76. package/dist/esnext/framework/Hydration/rsc.js +2 -0
  77. package/dist/esnext/framework/plugin.js +2 -0
  78. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +5 -2
  79. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +1 -1
  80. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +4 -12
  81. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
  82. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +19 -0
  83. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +2 -2
  84. package/dist/esnext/hooks/useProductOptions/types.d.ts +16 -14
  85. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -15
  86. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +8 -107
  87. package/dist/esnext/hooks/useShopQuery/hooks.js +12 -6
  88. package/dist/esnext/index.d.ts +6 -3
  89. package/dist/esnext/index.js +6 -3
  90. package/dist/esnext/streaming.server.d.ts +0 -1
  91. package/dist/esnext/streaming.server.js +0 -4
  92. package/dist/esnext/types.d.ts +32 -23
  93. package/dist/esnext/utilities/apiRoutes.d.ts +2 -2
  94. package/dist/esnext/utilities/graphql-tracker.js +1 -1
  95. package/dist/esnext/utilities/index.d.ts +1 -1
  96. package/dist/esnext/utilities/index.js +1 -1
  97. package/dist/esnext/utilities/isBrowser/index.d.ts +1 -0
  98. package/dist/esnext/utilities/isBrowser/index.js +1 -0
  99. package/dist/esnext/utilities/isBrowser/isBrowser.d.ts +4 -0
  100. package/dist/esnext/utilities/isBrowser/isBrowser.js +6 -0
  101. package/dist/esnext/utilities/isServer/isServer.js +2 -2
  102. package/dist/esnext/utilities/log/index.d.ts +1 -1
  103. package/dist/esnext/utilities/log/index.js +1 -1
  104. package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
  105. package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
  106. package/dist/esnext/utilities/log/log.d.ts +17 -11
  107. package/dist/esnext/utilities/log/log.js +29 -20
  108. package/dist/esnext/version.d.ts +1 -1
  109. package/dist/esnext/version.js +1 -1
  110. package/dist/node/client.d.ts +16 -0
  111. package/dist/node/client.js +43 -0
  112. package/dist/node/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
  113. package/dist/node/components/AddToCartButton/AddToCartButton.client.js +74 -0
  114. package/dist/node/components/AddToCartButton/index.d.ts +1 -0
  115. package/dist/node/components/AddToCartButton/index.js +5 -0
  116. package/dist/node/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
  117. package/dist/node/components/BuyNowButton/BuyNowButton.client.js +53 -0
  118. package/dist/node/components/BuyNowButton/index.d.ts +1 -0
  119. package/dist/node/components/BuyNowButton/index.js +5 -0
  120. package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
  121. package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.js +44 -0
  122. package/dist/node/components/CartCheckoutButton/index.d.ts +1 -0
  123. package/dist/node/components/CartCheckoutButton/index.js +5 -0
  124. package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
  125. package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.js +36 -0
  126. package/dist/node/components/CartEstimatedCost/index.d.ts +1 -0
  127. package/dist/node/components/CartEstimatedCost/index.js +5 -0
  128. package/dist/node/components/CartLineImage/CartLineImage.client.d.ts +9 -0
  129. package/dist/node/components/CartLineImage/CartLineImage.client.js +18 -0
  130. package/dist/node/components/CartLineImage/index.d.ts +1 -0
  131. package/dist/node/components/CartLineImage/index.js +5 -0
  132. package/dist/node/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
  133. package/dist/node/components/CartLinePrice/CartLinePrice.client.js +28 -0
  134. package/dist/node/components/CartLinePrice/index.d.ts +1 -0
  135. package/dist/node/components/CartLinePrice/index.js +5 -0
  136. package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
  137. package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.js +19 -0
  138. package/dist/node/components/CartLineProductTitle/index.d.ts +1 -0
  139. package/dist/node/components/CartLineProductTitle/index.js +5 -0
  140. package/dist/node/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
  141. package/dist/node/components/CartLineProvider/CartLineProvider.client.js +15 -0
  142. package/dist/node/components/CartLineProvider/context.d.ts +26 -0
  143. package/dist/node/components/CartLineProvider/context.js +5 -0
  144. package/dist/node/components/CartLineProvider/index.d.ts +2 -0
  145. package/dist/node/components/CartLineProvider/index.js +7 -0
  146. package/dist/node/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
  147. package/dist/node/components/CartLineQuantity/CartLineQuantity.client.js +19 -0
  148. package/dist/node/components/CartLineQuantity/index.d.ts +1 -0
  149. package/dist/node/components/CartLineQuantity/index.js +5 -0
  150. package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
  151. package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +31 -0
  152. package/dist/node/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
  153. package/dist/node/components/CartLineQuantityAdjustButton/index.js +5 -0
  154. package/dist/node/components/CartLines/CartLines.client.d.ts +15 -0
  155. package/dist/node/components/CartLines/CartLines.client.js +44 -0
  156. package/dist/node/components/CartLines/index.d.ts +1 -0
  157. package/dist/node/components/CartLines/index.js +5 -0
  158. package/dist/node/components/CartProvider/CartProvider.client.d.ts +41 -0
  159. package/dist/node/components/CartProvider/CartProvider.client.js +550 -0
  160. package/dist/node/components/CartProvider/cart-queries.d.ts +10 -0
  161. package/dist/node/components/CartProvider/cart-queries.js +203 -0
  162. package/dist/node/components/CartProvider/constants.d.ts +2 -0
  163. package/dist/node/components/CartProvider/constants.js +5 -0
  164. package/dist/node/components/CartProvider/context.d.ts +2 -0
  165. package/dist/node/components/CartProvider/context.js +5 -0
  166. package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +86 -0
  167. package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.js +2 -0
  168. package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +86 -0
  169. package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +2 -0
  170. package/dist/node/components/CartProvider/graphql/CartCreateMutation.d.ts +85 -0
  171. package/dist/node/components/CartProvider/graphql/CartCreateMutation.js +2 -0
  172. package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +86 -0
  173. package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +2 -0
  174. package/dist/node/components/CartProvider/graphql/CartFragment.d.ts +72 -0
  175. package/dist/node/components/CartProvider/graphql/CartFragment.js +2 -0
  176. package/dist/node/components/CartProvider/graphql/CartLineAddMutation.d.ts +86 -0
  177. package/dist/node/components/CartProvider/graphql/CartLineAddMutation.js +2 -0
  178. package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +86 -0
  179. package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.js +2 -0
  180. package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +86 -0
  181. package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.js +2 -0
  182. package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +86 -0
  183. package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.js +2 -0
  184. package/dist/node/components/CartProvider/graphql/CartQuery.d.ts +81 -0
  185. package/dist/node/components/CartProvider/graphql/CartQuery.js +2 -0
  186. package/dist/node/components/CartProvider/hooks.client.d.ts +15 -0
  187. package/dist/node/components/CartProvider/hooks.client.js +90 -0
  188. package/dist/node/components/CartProvider/index.d.ts +4 -0
  189. package/dist/node/components/CartProvider/index.js +10 -0
  190. package/dist/node/components/CartProvider/types.d.ts +102 -0
  191. package/dist/node/components/CartProvider/types.js +2 -0
  192. package/dist/node/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
  193. package/dist/node/components/CartShopPayButton/CartShopPayButton.client.js +46 -0
  194. package/dist/node/components/CartShopPayButton/index.d.ts +1 -0
  195. package/dist/node/components/CartShopPayButton/index.js +5 -0
  196. package/dist/node/components/ExternalVideo/ExternalVideo.d.ts +21 -0
  197. package/dist/node/components/ExternalVideo/ExternalVideo.js +21 -0
  198. package/dist/node/components/ExternalVideo/index.d.ts +1 -0
  199. package/dist/node/components/ExternalVideo/index.js +5 -0
  200. package/dist/node/components/Image/Image.d.ts +8 -0
  201. package/dist/node/components/Image/Image.js +57 -9
  202. package/dist/node/components/Link/Link.client.d.ts +25 -0
  203. package/dist/node/components/Link/Link.client.js +165 -0
  204. package/dist/node/components/Link/index.d.ts +1 -0
  205. package/dist/node/components/Link/index.js +5 -0
  206. package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
  207. package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.js +11 -0
  208. package/dist/node/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
  209. package/dist/node/components/LocalizationProvider/LocalizationContext.client.js +5 -0
  210. package/dist/node/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
  211. package/dist/node/components/LocalizationProvider/LocalizationProvider.server.js +51 -0
  212. package/dist/node/components/MediaFile/MediaFile.d.ts +19 -0
  213. package/dist/node/components/MediaFile/MediaFile.js +39 -0
  214. package/dist/node/components/MediaFile/index.d.ts +1 -0
  215. package/dist/node/components/MediaFile/index.js +5 -0
  216. package/dist/node/components/Metafield/Metafield.client.d.ts +21 -0
  217. package/dist/node/components/Metafield/Metafield.client.js +75 -0
  218. package/dist/node/components/Metafield/index.d.ts +2 -0
  219. package/dist/node/components/Metafield/index.js +5 -0
  220. package/dist/node/components/Metafield/types.d.ts +4 -0
  221. package/dist/node/components/Metafield/types.js +2 -0
  222. package/dist/node/components/ModelViewer/ModelViewer.client.d.ts +128 -0
  223. package/dist/node/components/ModelViewer/ModelViewer.client.js +132 -0
  224. package/dist/node/components/ModelViewer/index.d.ts +1 -0
  225. package/dist/node/components/ModelViewer/index.js +5 -0
  226. package/dist/node/components/Money/Money.client.d.ts +25 -0
  227. package/dist/node/components/Money/Money.client.js +46 -0
  228. package/dist/node/components/Money/index.d.ts +1 -0
  229. package/dist/node/components/Money/index.js +5 -0
  230. package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
  231. package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.js +167 -0
  232. package/dist/node/components/ProductOptionsProvider/context.d.ts +2 -0
  233. package/dist/node/components/ProductOptionsProvider/context.js +5 -0
  234. package/dist/node/components/ProductOptionsProvider/index.d.ts +2 -0
  235. package/dist/node/components/ProductOptionsProvider/index.js +7 -0
  236. package/dist/node/components/ProductPrice/ProductPrice.client.d.ts +18 -0
  237. package/dist/node/components/ProductPrice/ProductPrice.client.js +61 -0
  238. package/dist/node/components/ProductPrice/index.d.ts +1 -0
  239. package/dist/node/components/ProductPrice/index.js +5 -0
  240. package/dist/node/components/Seo/CollectionSeo.client.d.ts +3 -0
  241. package/dist/node/components/Seo/CollectionSeo.client.js +22 -0
  242. package/dist/node/components/Seo/DefaultPageSeo.client.d.ts +3 -0
  243. package/dist/node/components/Seo/DefaultPageSeo.client.js +25 -0
  244. package/dist/node/components/Seo/DescriptionSeo.client.d.ts +4 -0
  245. package/dist/node/components/Seo/DescriptionSeo.client.js +17 -0
  246. package/dist/node/components/Seo/HomePageSeo.client.d.ts +2 -0
  247. package/dist/node/components/Seo/HomePageSeo.client.js +32 -0
  248. package/dist/node/components/Seo/ImageSeo.client.d.ts +3 -0
  249. package/dist/node/components/Seo/ImageSeo.client.js +17 -0
  250. package/dist/node/components/Seo/NoIndexSeo.client.d.ts +3 -0
  251. package/dist/node/components/Seo/NoIndexSeo.client.js +17 -0
  252. package/dist/node/components/Seo/PageSeo.client.d.ts +3 -0
  253. package/dist/node/components/Seo/PageSeo.client.js +20 -0
  254. package/dist/node/components/Seo/ProductSeo.client.d.ts +5 -0
  255. package/dist/node/components/Seo/ProductSeo.client.js +70 -0
  256. package/dist/node/components/Seo/Seo.client.d.ts +30 -0
  257. package/dist/node/components/Seo/Seo.client.js +38 -0
  258. package/dist/node/components/Seo/TitleSeo.client.d.ts +3 -0
  259. package/dist/node/components/Seo/TitleSeo.client.js +17 -0
  260. package/dist/node/components/Seo/TwitterSeo.client.d.ts +2 -0
  261. package/dist/node/components/Seo/TwitterSeo.client.js +16 -0
  262. package/dist/node/components/Seo/index.d.ts +1 -0
  263. package/dist/node/components/Seo/index.js +5 -0
  264. package/dist/node/components/Seo/seo-types.d.ts +17 -0
  265. package/dist/node/components/Seo/seo-types.js +2 -0
  266. package/dist/node/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
  267. package/dist/node/components/ShopPayButton/ShopPayButton.client.js +60 -0
  268. package/dist/node/components/ShopPayButton/index.d.ts +1 -0
  269. package/dist/node/components/ShopPayButton/index.js +5 -0
  270. package/dist/node/components/Video/Video.d.ts +14 -0
  271. package/dist/node/components/Video/Video.js +31 -0
  272. package/dist/node/components/Video/index.d.ts +1 -0
  273. package/dist/node/components/Video/index.js +5 -0
  274. package/dist/node/components/index.d.ts +28 -0
  275. package/dist/node/components/index.js +59 -0
  276. package/dist/node/components/types.d.ts +71 -0
  277. package/dist/node/components/types.js +11 -0
  278. package/dist/node/entry-server.d.ts +2 -15
  279. package/dist/node/entry-server.js +244 -320
  280. package/dist/node/foundation/Analytics/Analytics.client.js +15 -13
  281. package/dist/node/foundation/Analytics/Analytics.server.js +27 -20
  282. package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +4 -2
  283. package/dist/node/foundation/Analytics/ClientAnalytics.js +14 -12
  284. package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
  285. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
  286. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +68 -0
  287. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
  288. package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +27 -0
  289. package/dist/node/foundation/Analytics/hook.js +4 -2
  290. package/dist/node/foundation/Analytics/index.d.ts +1 -0
  291. package/dist/node/foundation/Analytics/index.js +5 -0
  292. package/dist/node/foundation/Analytics/utils.d.ts +2 -0
  293. package/dist/node/foundation/Analytics/utils.js +24 -1
  294. package/dist/{esnext/framework → node/foundation/Cache}/cache-sub-request.d.ts +1 -1
  295. package/dist/node/{framework → foundation/Cache}/cache-sub-request.js +4 -4
  296. package/dist/node/{framework → foundation/Cache}/cache.d.ts +1 -1
  297. package/dist/node/{framework → foundation/Cache}/cache.js +5 -5
  298. package/dist/{esnext/framework/CachingStrategy → node/foundation/Cache/strategies}/index.d.ts +1 -1
  299. package/dist/node/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
  300. package/dist/node/foundation/Head/Head.client.d.ts +5 -0
  301. package/dist/node/foundation/Head/Head.client.js +17 -0
  302. package/dist/node/foundation/Head/index.d.ts +1 -0
  303. package/dist/node/foundation/Head/index.js +5 -0
  304. package/dist/{esnext/framework/Hydration → node/foundation/Html}/Html.d.ts +3 -1
  305. package/dist/node/{framework/Hydration → foundation/Html}/Html.js +15 -2
  306. package/dist/{esnext/framework/Hydration/ServerComponentRequest.server.d.ts → node/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +7 -3
  307. package/dist/node/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +3 -3
  308. package/dist/{esnext/framework/Hydration/ServerComponentResponse.server.d.ts → node/foundation/HydrogenResponse/HydrogenResponse.server.d.ts} +7 -10
  309. package/dist/node/{framework/Hydration/ServerComponentResponse.server.js → foundation/HydrogenResponse/HydrogenResponse.server.js} +23 -19
  310. package/dist/node/foundation/Router/BrowserRouter.client.js +16 -9
  311. package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
  312. package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -1
  313. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
  314. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
  315. package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
  316. package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.js +35 -0
  317. package/dist/node/foundation/ShopifyProvider/index.d.ts +1 -0
  318. package/dist/node/foundation/ShopifyProvider/index.js +5 -0
  319. package/dist/node/foundation/fetchSync/client/fetchSync.d.ts +10 -0
  320. package/dist/node/foundation/fetchSync/client/fetchSync.js +33 -0
  321. package/dist/node/foundation/fetchSync/server/fetchSync.d.ts +8 -0
  322. package/dist/node/foundation/fetchSync/server/fetchSync.js +33 -0
  323. package/dist/node/foundation/fetchSync/types.d.ts +5 -0
  324. package/dist/node/foundation/fetchSync/types.js +2 -0
  325. package/dist/node/foundation/index.d.ts +3 -0
  326. package/dist/node/foundation/index.js +10 -0
  327. package/dist/node/foundation/runtime.d.ts +2 -0
  328. package/dist/node/foundation/runtime.js +11 -0
  329. package/dist/node/foundation/session/session.d.ts +3 -3
  330. package/dist/node/foundation/ssr-interop.d.ts +2 -2
  331. package/dist/node/foundation/useNavigate/useNavigate.d.ts +2 -0
  332. package/dist/node/foundation/useNavigate/useNavigate.js +11 -4
  333. package/dist/node/foundation/useQuery/hooks.d.ts +36 -0
  334. package/dist/node/foundation/useQuery/hooks.js +104 -0
  335. package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.d.ts +10 -0
  336. package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.js +34 -0
  337. package/dist/node/foundation/useRouteParams/useRouteParams.d.ts +4 -0
  338. package/dist/node/foundation/useRouteParams/useRouteParams.js +13 -0
  339. package/dist/node/foundation/useServerProps/index.d.ts +1 -0
  340. package/dist/node/foundation/useServerProps/index.js +5 -0
  341. package/dist/node/foundation/useSession/useSession.d.ts +2 -0
  342. package/dist/node/foundation/useSession/useSession.js +12 -0
  343. package/dist/node/foundation/useShop/index.d.ts +1 -0
  344. package/dist/node/foundation/useShop/index.js +5 -0
  345. package/dist/node/foundation/useShop/use-shop.d.ts +6 -0
  346. package/dist/node/foundation/useShop/use-shop.js +18 -0
  347. package/dist/node/foundation/useUrl/index.d.ts +1 -0
  348. package/dist/node/foundation/useUrl/index.js +5 -0
  349. package/dist/node/foundation/useUrl/useUrl.d.ts +4 -0
  350. package/dist/node/foundation/useUrl/useUrl.js +32 -0
  351. package/dist/node/framework/Hydration/rsc.js +2 -0
  352. package/dist/node/framework/plugin.js +2 -0
  353. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +5 -2
  354. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +1 -1
  355. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +4 -12
  356. package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
  357. package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +21 -0
  358. package/dist/node/hooks/index.d.ts +6 -0
  359. package/dist/node/hooks/index.js +28 -0
  360. package/dist/node/hooks/useCart/index.d.ts +1 -0
  361. package/dist/node/hooks/useCart/index.js +5 -0
  362. package/dist/node/hooks/useCart/useCart.d.ts +4 -0
  363. package/dist/node/hooks/useCart/useCart.js +19 -0
  364. package/dist/node/hooks/useCartLine/index.d.ts +1 -0
  365. package/dist/node/hooks/useCartLine/index.js +5 -0
  366. package/dist/node/hooks/useCartLine/useCartLine.d.ts +29 -0
  367. package/dist/node/hooks/useCartLine/useCartLine.js +16 -0
  368. package/dist/node/hooks/useCountry/index.d.ts +1 -0
  369. package/dist/node/hooks/useCountry/index.js +5 -0
  370. package/dist/node/hooks/useCountry/useCountry.d.ts +7 -0
  371. package/dist/node/hooks/useCountry/useCountry.js +21 -0
  372. package/dist/node/hooks/useLoadScript/index.d.ts +1 -0
  373. package/dist/node/hooks/useLoadScript/index.js +5 -0
  374. package/dist/node/hooks/useLoadScript/useLoadScript.client.d.ts +8 -0
  375. package/dist/node/hooks/useLoadScript/useLoadScript.client.js +27 -0
  376. package/dist/node/hooks/useMeasurement/hooks.d.ts +9 -0
  377. package/dist/node/hooks/useMeasurement/hooks.js +17 -0
  378. package/dist/node/hooks/useMeasurement/index.d.ts +1 -0
  379. package/dist/node/hooks/useMeasurement/index.js +5 -0
  380. package/dist/node/hooks/useMoney/hooks.d.ts +54 -0
  381. package/dist/node/hooks/useMoney/hooks.js +70 -0
  382. package/dist/node/hooks/useMoney/index.d.ts +1 -0
  383. package/dist/node/hooks/useMoney/index.js +5 -0
  384. package/dist/node/hooks/useParsedMetafields/index.d.ts +1 -0
  385. package/dist/node/hooks/useParsedMetafields/index.js +5 -0
  386. package/dist/node/hooks/useParsedMetafields/useParsedMetafields.d.ts +21 -0
  387. package/dist/node/hooks/useParsedMetafields/useParsedMetafields.js +25 -0
  388. package/dist/node/hooks/useProductOptions/helpers.d.ts +6 -0
  389. package/dist/node/hooks/useProductOptions/helpers.js +46 -0
  390. package/dist/node/hooks/useProductOptions/index.d.ts +2 -0
  391. package/dist/node/hooks/useProductOptions/index.js +20 -0
  392. package/dist/node/hooks/useProductOptions/types.d.ts +44 -0
  393. package/dist/node/hooks/useProductOptions/types.js +2 -0
  394. package/dist/node/hooks/useProductOptions/useProductOptions.client.d.ts +1 -0
  395. package/dist/node/hooks/useProductOptions/useProductOptions.client.js +13 -0
  396. package/dist/node/hooks/useShopQuery/hooks.d.ts +28 -0
  397. package/dist/node/hooks/useShopQuery/hooks.js +171 -0
  398. package/dist/node/hooks/useShopQuery/index.d.ts +1 -0
  399. package/dist/node/hooks/useShopQuery/index.js +5 -0
  400. package/dist/node/streaming.server.d.ts +0 -1
  401. package/dist/node/streaming.server.js +1 -6
  402. package/dist/node/types.d.ts +32 -23
  403. package/dist/node/utilities/apiRoutes.d.ts +2 -2
  404. package/dist/node/utilities/devtools.d.ts +11 -0
  405. package/dist/node/utilities/devtools.js +15 -0
  406. package/dist/node/utilities/graphql-tag.d.ts +1 -0
  407. package/dist/node/utilities/graphql-tag.js +10 -0
  408. package/dist/node/utilities/graphql-tracker.d.ts +17 -0
  409. package/dist/node/utilities/graphql-tracker.js +130 -0
  410. package/dist/node/utilities/index.d.ts +1 -1
  411. package/dist/node/utilities/index.js +3 -3
  412. package/dist/node/utilities/isBrowser/index.d.ts +1 -0
  413. package/dist/node/utilities/isBrowser/index.js +5 -0
  414. package/dist/node/utilities/isBrowser/isBrowser.d.ts +4 -0
  415. package/dist/node/utilities/isBrowser/isBrowser.js +10 -0
  416. package/dist/node/utilities/isServer/isServer.js +2 -2
  417. package/dist/node/utilities/log/index.d.ts +1 -1
  418. package/dist/node/utilities/log/index.js +1 -3
  419. package/dist/node/utilities/log/log-cache-header.d.ts +4 -4
  420. package/dist/node/utilities/log/log-query-timeline.d.ts +3 -3
  421. package/dist/node/utilities/log/log.d.ts +17 -11
  422. package/dist/node/utilities/log/log.js +30 -23
  423. package/dist/node/version.d.ts +1 -1
  424. package/dist/node/version.js +1 -1
  425. package/package.json +3 -1
  426. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +203 -52
  427. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +77 -59
  428. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -30
  429. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +199 -70
  430. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +38 -35
  431. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +9 -8
  432. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +3 -3
  433. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +3 -7
  434. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +204 -53
  435. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +77 -59
  436. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +199 -70
  437. package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +9 -8
  438. package/vendor/react-server-dom-vite/package.json +1 -1
  439. package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +0 -8
  440. package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +0 -12
  441. package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +0 -24
  442. package/dist/esnext/components/ProductProvider/ProductProvider.client.js +0 -34
  443. package/dist/esnext/components/ProductProvider/context.d.ts +0 -29
  444. package/dist/esnext/components/ProductProvider/index.d.ts +0 -2
  445. package/dist/esnext/components/ProductProvider/index.js +0 -2
  446. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +0 -1
  447. package/dist/esnext/framework/config.d.ts +0 -6
  448. package/dist/esnext/framework/config.js +0 -6
  449. package/dist/esnext/framework/runtime.d.ts +0 -13
  450. package/dist/esnext/framework/runtime.js +0 -27
  451. package/dist/esnext/hooks/useProduct/index.d.ts +0 -1
  452. package/dist/esnext/hooks/useProduct/index.js +0 -1
  453. package/dist/esnext/hooks/useProduct/useProduct.d.ts +0 -52
  454. package/dist/esnext/hooks/useProduct/useProduct.js +0 -43
  455. package/dist/esnext/utilities/isClient/index.d.ts +0 -1
  456. package/dist/esnext/utilities/isClient/index.js +0 -1
  457. package/dist/esnext/utilities/isClient/isClient.d.ts +0 -4
  458. package/dist/esnext/utilities/isClient/isClient.js +0 -6
  459. package/dist/node/framework/config.d.ts +0 -6
  460. package/dist/node/framework/config.js +0 -11
  461. package/dist/node/framework/runtime.d.ts +0 -13
  462. package/dist/node/framework/runtime.js +0 -35
  463. package/dist/node/utilities/defer.d.ts +0 -6
  464. package/dist/node/utilities/defer.js +0 -18
  465. package/dist/node/utilities/isClient/index.d.ts +0 -1
  466. package/dist/node/utilities/isClient/index.js +0 -5
  467. package/dist/node/utilities/isClient/isClient.d.ts +0 -4
  468. package/dist/node/utilities/isClient/isClient.js +0 -10
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LocalizationProvider = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const LocalizationClientProvider_client_1 = __importDefault(require("./LocalizationClientProvider.client"));
9
+ const useShop_1 = require("../../foundation/useShop");
10
+ const useShopQuery_1 = require("../../hooks/useShopQuery");
11
+ const strategies_1 = require("../../foundation/Cache/strategies");
12
+ const useSession_1 = require("../../foundation/useSession/useSession");
13
+ /**
14
+ * The `LocalizationProvider` component automatically queries the Storefront API's
15
+ * [`localization`](https://shopify.dev/api/storefront/reference/common-objects/queryroot) field
16
+ * for the `isoCode` and `name` of the `country` and keeps this information in a context.
17
+ *
18
+ * Any descendents of this provider can use the `useCountry` hook.
19
+ * The `isoCode` of the `country` can be used in the Storefront API's
20
+ * `@inContext` directive as the `country` value.
21
+ */
22
+ function LocalizationProvider(props) {
23
+ const { languageCode } = (0, useShop_1.useShop)();
24
+ const { countryCode, countryName } = (0, useSession_1.useSession)();
25
+ const { data: { localization }, } = (0, useShopQuery_1.useShopQuery)({
26
+ query,
27
+ variables: { language: languageCode },
28
+ cache: (0, strategies_1.CacheDays)(),
29
+ preload: props.preload,
30
+ });
31
+ return (react_1.default.createElement(LocalizationClientProvider_client_1.default, { localization: countryCode
32
+ ? {
33
+ country: {
34
+ name: countryName,
35
+ isoCode: countryCode,
36
+ },
37
+ }
38
+ : localization }, props.children));
39
+ }
40
+ exports.LocalizationProvider = LocalizationProvider;
41
+ const query = `
42
+ query Localization($language: LanguageCode)
43
+ @inContext(language: $language) {
44
+ localization {
45
+ country {
46
+ isoCode
47
+ name
48
+ }
49
+ }
50
+ }
51
+ `;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { type ShopifyImageProps } from '../Image';
3
+ import { Video } from '../Video';
4
+ import { ExternalVideo } from '../ExternalVideo';
5
+ import type { MediaEdge as MediaEdgeType } from '../../storefront-api-types';
6
+ import type { PartialDeep } from 'type-fest';
7
+ export interface MediaFileProps {
8
+ /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */
9
+ data: PartialDeep<MediaEdgeType['node']>;
10
+ /** The options for the `Image`, `Video`, or `ExternalVideo` components. */
11
+ options?: ShopifyImageProps | React.ComponentProps<typeof Video>['previewImageOptions'] | React.ComponentProps<typeof ExternalVideo>['options'];
12
+ }
13
+ /**
14
+ * The `MediaFile` component renders the media for the Storefront API's
15
+ * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a
16
+ * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `mediaContentType` of the
17
+ * `media` provided as a prop.
18
+ */
19
+ export declare function MediaFile({ data, options, ...passthroughProps }: MediaFileProps): JSX.Element | null;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MediaFile = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const Image_1 = require("../Image");
9
+ const Video_1 = require("../Video");
10
+ const ExternalVideo_1 = require("../ExternalVideo");
11
+ const ModelViewer_1 = require("../ModelViewer");
12
+ /**
13
+ * The `MediaFile` component renders the media for the Storefront API's
14
+ * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a
15
+ * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `mediaContentType` of the
16
+ * `media` provided as a prop.
17
+ */
18
+ function MediaFile({ data, options, ...passthroughProps }) {
19
+ switch (data.mediaContentType) {
20
+ case 'IMAGE': {
21
+ const dataImage = data
22
+ .image;
23
+ if (!dataImage || !dataImage.url) {
24
+ console.warn(`No "image" property was found on the "data" prop for <MediaFile/>, for the "type='image'"`);
25
+ return null;
26
+ }
27
+ return (react_1.default.createElement(Image_1.Image, { ...passthroughProps, data: dataImage, loaderOptions: options }));
28
+ }
29
+ case 'VIDEO':
30
+ return (react_1.default.createElement(Video_1.Video, { ...passthroughProps, data: data, previewImageOptions: options }));
31
+ case 'EXTERNAL_VIDEO':
32
+ return (react_1.default.createElement(ExternalVideo_1.ExternalVideo, { ...passthroughProps, data: data, options: options }));
33
+ case 'MODEL_3D':
34
+ return (react_1.default.createElement(ModelViewer_1.ModelViewer, { ...passthroughProps, data: data }));
35
+ default:
36
+ return null;
37
+ }
38
+ }
39
+ exports.MediaFile = MediaFile;
@@ -0,0 +1 @@
1
+ export { MediaFile, MediaFileProps } from './MediaFile';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MediaFile = void 0;
4
+ var MediaFile_1 = require("./MediaFile");
5
+ Object.defineProperty(exports, "MediaFile", { enumerable: true, get: function () { return MediaFile_1.MediaFile; } });
@@ -0,0 +1,21 @@
1
+ import { ElementType } from 'react';
2
+ import { Props } from '../types';
3
+ import { ParsedMetafield } from '../../types';
4
+ export interface MetafieldProps<TTag> {
5
+ /** An object with fields that correspond to the Storefront API's [Metafield object](https://shopify.dev/api/storefront/reference/common-objects/metafield). */
6
+ data: ParsedMetafield;
7
+ /** An HTML tag to be rendered as the base element wrapper. The default value varies depending on [metafield.type](https://shopify.dev/apps/metafields/types). */
8
+ as?: TTag;
9
+ }
10
+ /**
11
+ * The `Metafield` component renders the value of a Storefront
12
+ * API's [Metafield object](https://shopify.dev/api/storefront/reference/common-objects/metafield).
13
+ *
14
+ * When a render function is provided, it passes the Metafield object with a value
15
+ * that was parsed according to the Metafield's `type` field. For more information,
16
+ * refer to the [Render props](#render-props) section.
17
+ *
18
+ * When no render function is provided, it renders a smart default of the
19
+ * Metafield's `value`. For more information, refer to the [Default output](#default-output) section.
20
+ */
21
+ export declare function Metafield<TTag extends ElementType>(props: Props<TTag> & MetafieldProps<TTag>): JSX.Element | null;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Metafield = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const foundation_1 = require("../../foundation");
9
+ const utilities_1 = require("../../utilities");
10
+ const Image_1 = require("../Image");
11
+ /**
12
+ * The `Metafield` component renders the value of a Storefront
13
+ * API's [Metafield object](https://shopify.dev/api/storefront/reference/common-objects/metafield).
14
+ *
15
+ * When a render function is provided, it passes the Metafield object with a value
16
+ * that was parsed according to the Metafield's `type` field. For more information,
17
+ * refer to the [Render props](#render-props) section.
18
+ *
19
+ * When no render function is provided, it renders a smart default of the
20
+ * Metafield's `value`. For more information, refer to the [Default output](#default-output) section.
21
+ */
22
+ function Metafield(props) {
23
+ var _a;
24
+ const { data, children, as, ...passthroughProps } = props;
25
+ const { locale } = (0, foundation_1.useShop)();
26
+ if (data.value == null) {
27
+ console.warn(`No metafield value for ${data}`);
28
+ return null;
29
+ }
30
+ switch (data.type) {
31
+ case 'date': {
32
+ const Wrapper = as !== null && as !== void 0 ? as : 'time';
33
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps }, data.value.toLocaleDateString(locale)));
34
+ }
35
+ case 'date_time': {
36
+ const Wrapper = as !== null && as !== void 0 ? as : 'time';
37
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps }, data.value.toLocaleString(locale)));
38
+ }
39
+ case 'weight':
40
+ case 'dimension':
41
+ case 'volume': {
42
+ const Wrapper = as !== null && as !== void 0 ? as : 'span';
43
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps }, (0, utilities_1.getMeasurementAsString)(data.value, locale)));
44
+ }
45
+ case 'rating': {
46
+ const Wrapper = as !== null && as !== void 0 ? as : 'span';
47
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps }, data.value.value));
48
+ }
49
+ case 'single_line_text_field': {
50
+ const Wrapper = as !== null && as !== void 0 ? as : 'span';
51
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps, dangerouslySetInnerHTML: { __html: data.value } }));
52
+ }
53
+ case 'multi_line_text_field': {
54
+ const Wrapper = as !== null && as !== void 0 ? as : 'div';
55
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps, dangerouslySetInnerHTML: {
56
+ __html: data.value.split('\n').join('<br/>'),
57
+ } }));
58
+ }
59
+ case 'url':
60
+ return (react_1.default.createElement("a", { href: data.value, ...passthroughProps }, data.value));
61
+ case 'json': {
62
+ const Wrapper = as !== null && as !== void 0 ? as : 'span';
63
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps }, JSON.stringify(data.value)));
64
+ }
65
+ case 'file_reference': {
66
+ if (((_a = data.reference) === null || _a === void 0 ? void 0 : _a.__typename) === 'MediaImage') {
67
+ const ref = data.reference;
68
+ return ref.image ? (react_1.default.createElement(Image_1.Image, { data: ref.image, ...passthroughProps })) : null;
69
+ }
70
+ }
71
+ }
72
+ const Wrapper = as !== null && as !== void 0 ? as : 'span';
73
+ return react_1.default.createElement(Wrapper, { ...passthroughProps }, data.value.toString());
74
+ }
75
+ exports.Metafield = Metafield;
@@ -0,0 +1,2 @@
1
+ export { Metafield } from './Metafield.client';
2
+ export type { MetafieldType } from './types';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Metafield = void 0;
4
+ var Metafield_client_1 = require("./Metafield.client");
5
+ Object.defineProperty(exports, "Metafield", { enumerable: true, get: function () { return Metafield_client_1.Metafield; } });
@@ -0,0 +1,4 @@
1
+ import { Metafield } from '../../storefront-api-types';
2
+ export declare type MetafieldType = Omit<Partial<Metafield>, 'value'> & {
3
+ value?: string | number | boolean | Date | Record<string, any>;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,128 @@
1
+ import { ReactNode, ElementType } from 'react';
2
+ import { Props } from '../types';
3
+ import type { Model3d } from '../../storefront-api-types';
4
+ import type { PartialDeep } from 'type-fest';
5
+ interface ModelViewerProps {
6
+ /** Any ReactNode elements. */
7
+ children?: ReactNode;
8
+ /** An object with fields that correspond to the Storefront API's [Model3D object](https://shopify.dev/api/storefront/latest/objects/model3d). */
9
+ data: PartialDeep<Model3d>;
10
+ /** A string of either `auto`, `lazy`, or `eager` to indicate the conditions for preloading. Refer to [loading in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-attributes-loading). */
11
+ loading?: 'auto' | 'lazy' | 'eager';
12
+ /** A URL to display an image instead of the model. This is useful for showing the user something before a model is loaded and ready to render. If no URL is provided, then [Model3d.previewImage](https://shopify.dev/api/storefront/latest/objects/model3d) is used. Refer to [poster in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-attributes-poster). */
13
+ poster?: string;
14
+ /** A string of either `auto`, `interaction`, or `manual` to indicate when the model should be revealed. Refer to [reveal in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-attributes-reveal). */
15
+ reveal?: 'auto' | 'interaction' | 'manual';
16
+ /** A boolean to enable an AR experience. Refer to [ar in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-attributes-ar). */
17
+ ar?: boolean;
18
+ /** A prioritized list of `webxr`, `scene-viewer`, and/or `quick-look` to indicate the types of AR experiences to enable. Refer to [ar-modes in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-attributes-arModes). */
19
+ arModes?: 'webxr' | 'scene-viewer' | 'quick-look';
20
+ /** A string of `auto` or `fixed` to control the scaling behaviour. Refer to [ar-scale in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-attributes-arScale). */
21
+ arScale?: 'auto' | 'fixed';
22
+ /** A styring of either `floor` or `wall` to indicate where to place the object in AR. Refer to [ar-placement in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-attributes-arPlacement). */
23
+ arPlacement?: 'floor' | 'wall';
24
+ /** The url to a USDZ model which will be used on supported iOS 12+ devices via AR Quick Look on Safari. Refer to [ios-source in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-attributes-iosSrc). */
25
+ iosSrc?: string;
26
+ /** A boolean to enable camera controls. Refer to [attributes in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#stagingandcameras-attributes). */
27
+ cameraControls?: boolean;
28
+ /** A string of `pan-x`, `pan-y`, or `none`. Refer to [touch-action in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-touch-action). */
29
+ touchAction?: 'pan-x' | 'pan-y' | 'none';
30
+ /** A boolean to disable zoom. Refer to [disable-zoom in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-disable-zoom). */
31
+ disableZoom?: boolean;
32
+ /** A number to adjust the speed of theta and phi orbit interactions. Refer to [orbit-sensitivity in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-orbitSensitivity). */
33
+ orbitSensitivity?: number;
34
+ /** A boolean to enable auto rotate. Refer to [auto-rotate in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-autoRotate). */
35
+ autoRotate?: boolean;
36
+ /** A number in milliseconds to specify the delay before auto rotation begins. Refer to [auto-rotate-delay in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-autoRotateDelay). */
37
+ autoRotateDelay?: number;
38
+ /** The speed of auto rotation. Refer to [rotation-per-second in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-rotationPerSecond). */
39
+ rotationPerSecond?: string;
40
+ /** A string of either `allow-when-focused` or `always-allow` to indicate whether the viewer requires focus before interacting with it. Refer to [interaction-policy in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-interactionPolicy). */
41
+ interactionPolicy?: 'allow-when-focused' | 'always-allow';
42
+ /** A string of either 'auto', 'when-focused', or 'none' indicating the conditions under which the visual and audible interaction prompt will display. Refer to [interaction-prompts in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-interactionPrompt). */
43
+ interactionPrompt?: 'auto' | 'when-focused' | 'none';
44
+ /** A string of either `wiggle` or `basic` indicating the presentation style of the interaction-prompt when it is raised. Refer to [interaction-prompt-style in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-interactionPromptStyle). */
45
+ interactionPromptStyle?: 'wiggle' | 'basic';
46
+ /** A number to indicate how long the model viewer should wait before prompting the user visually for interaction. Refer to [interaction-prompt-threshold in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-interactionPromptThreshold). */
47
+ interactionPromptThreshold?: number;
48
+ /** A string of the starting orbital position of the camera. Refer to [camera-orbit in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-cameraOrbit). */
49
+ cameraOrbit?: string;
50
+ /** A string of the point the camera orbits around. Refer to [camera-target in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-cameraTarget). */
51
+ cameraTarget?: string;
52
+ /** A string of the vertical field of view of the camera. Refer to [field-of-view in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-fieldOfView). */
53
+ fieldOfView?: string;
54
+ /** A string of the maxiumum orbital values of the camera. Refer to [max-camera-orbit in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-maxCameraOrbit). */
55
+ maxCameraOrbit?: string;
56
+ /** A string of the minimum orbital values of the camera. Refer to [min-camera-orbit in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-minCameraOrbit). */
57
+ minCameraOrbit?: string;
58
+ /** A number indicating the max field of view of the camera. Refer to [max-field-of-view in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-maxFieldOfView). */
59
+ maxFieldOfView?: number;
60
+ /** A number indicating the min field of view of the camera. Refer to [min-field-of-view in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-minFieldOfView). */
61
+ minFieldOfView?: number;
62
+ /** A string of `tight` or `legacy` for calculating the model's bounding box. Refer to [bounds in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-bounds). */
63
+ bounds?: 'tight' | 'legacy';
64
+ /** A number indicating the rate of interpolation when the camera or model moves. Refer to [interpolation-decay in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-attributes-interpolationDecay). */
65
+ interpolationDecay?: number;
66
+ /** A string for the background image of the scene. Refer to [skybox-image in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-lightingandenv-attributes-skyboxImage). */
67
+ skyboxImage?: string;
68
+ /** A string to control the environmental reflection of the model. Refer to [environment-image in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-lightingandenv-attributes-environmentImage). */
69
+ environmentImage?: string;
70
+ /** A number indicating the exposure of the model and the skybox. Refer to [exposure in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-lightingandenv-attributes-exposure). */
71
+ exposure?: number;
72
+ /** A number for the opacity of the shadow. Refer to [shadow-intensity in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-lightingandenv-attributes-shadowIntensity). */
73
+ shadowIntensity?: number;
74
+ /** A number for the bluriness of the shadow. Refer to [shadow-softness in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-lightingandenv-attributes-shadowSoftness). */
75
+ shadowSoftness?: number;
76
+ /** A string of the animation to play by name. Refer to [animation-name in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-animation-attributes-animationName). */
77
+ animationName?: string;
78
+ /** A string of the animation crossfade duration between the previous and next animations. Refer to [animation-cross-fade-duration in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-animation-attributes-animationCrossfadeDuration). */
79
+ animationCrossfadeDuration?: string;
80
+ /** A boolean to enable the model animations. Refer to [autoplay in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-animation-attributes-autoplay). */
81
+ autoplay?: boolean;
82
+ /** A string to select a model variant by name. Refer to [variant-name in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-scenegraph-attributes-variantName). */
83
+ variantName?: string;
84
+ /** A string to rotate the model. Refer to [orientation in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-scenegraph-attributes-orientation). */
85
+ orientation?: string;
86
+ /** A string to scale the model. Refer to [scale in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-scenegraph-attributes-scale). */
87
+ scale?: string;
88
+ /** The callback to invoke when the 'error' event is triggered. Refer to [error in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-events-error). */
89
+ onError?: (event: Event) => void;
90
+ /** The callback to invoke when the `load` event is triggered. Refer to [load in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-events-load). */
91
+ onLoad?: (event: Event) => void;
92
+ /** The callback to invoke when the 'preload' event is triggered. Refer to [preload in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-events-preload). */
93
+ onPreload?: (event: Event) => void;
94
+ /** The callback to invoke when the 'model-visibility' event is triggered. Refer to [model-visibility in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-events-modelVisibility). */
95
+ onModelVisibility?: (event: Event) => void;
96
+ /** The callback to invoke when the 'progress' event is triggered. Refer to [progress in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-events-progress). */
97
+ onProgress?: (event: Event) => void;
98
+ /** The callback to invoke when the 'ar-status' event is triggered. Refer to [ar-status in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-events-arStatus). */
99
+ onArStatus?: (event: Event) => void;
100
+ /** The callback to invoke when the 'ar-tracking' event is triggered. Refer to [ar-tracking in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-events-arTracking). */
101
+ onArTracking?: (event: Event) => void;
102
+ /** The callback to invoke when the 'quick-look-button-tapped' event is triggered. Refer to [quick-look-button-tapped in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-events-quickLookButtonTapped). */
103
+ onQuickLookButtonTapped?: (event: Event) => void;
104
+ /** The callback to invoke when the 'camera-change' event is triggered. Refer to [camera-change in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-stagingandcameras-events-cameraChange). */
105
+ onCameraChange?: (event: Event) => void;
106
+ /** The callback to invoke when the 'environment-change' event is triggered. Refer to [environment-change in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-lightingandenv-events-environmentChange). */
107
+ onEnvironmentChange?: (event: Event) => void;
108
+ /** The callback to invoke when the 'play' event is triggered. Refer to [play in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-animation-events-play). */
109
+ onPlay?: (event: Event) => void;
110
+ /** The callback to invoke when the 'pause' event is triggered. Refer to [pause in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-animation-events-pause). */
111
+ onPause?: (event: Event) => void;
112
+ /** The callback to invoke when the 'scene-graph-ready' event is triggered. Refer to [scene-graph-ready in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-scenegraph-events-sceneGraphReady). */
113
+ onSceneGraphReady?: (event: Event) => void;
114
+ }
115
+ declare type PropsWeControl = 'src' | 'poster';
116
+ declare global {
117
+ namespace JSX {
118
+ interface IntrinsicElements {
119
+ 'model-viewer': any;
120
+ }
121
+ }
122
+ }
123
+ /**
124
+ * The `ModelViewer` component renders a 3D model (with the `model-viewer` tag) for
125
+ * the Storefront API's [Model3d object](https://shopify.dev/api/storefront/reference/products/model3d).
126
+ */
127
+ export declare function ModelViewer<TTag extends ElementType>(props: Props<TTag, PropsWeControl> & ModelViewerProps): JSX.Element | null;
128
+ export {};
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ModelViewer = void 0;
27
+ const react_1 = __importStar(require("react"));
28
+ const useLoadScript_client_1 = require("../../hooks/useLoadScript/useLoadScript.client");
29
+ /**
30
+ * The `ModelViewer` component renders a 3D model (with the `model-viewer` tag) for
31
+ * the Storefront API's [Model3d object](https://shopify.dev/api/storefront/reference/products/model3d).
32
+ */
33
+ function ModelViewer(props) {
34
+ var _a, _b, _c, _d, _e, _f, _g, _h;
35
+ const [modelViewer, setModelViewer] = (0, react_1.useState)(undefined);
36
+ const callbackRef = (0, react_1.useCallback)((node) => {
37
+ setModelViewer(node);
38
+ }, []);
39
+ const { data, id = data.id, children, className, ...passthroughProps } = props;
40
+ const modelViewerLoadedStatus = (0, useLoadScript_client_1.useLoadScript)('https://unpkg.com/@google/model-viewer@v1.8.0/dist/model-viewer.min.js', {
41
+ module: true,
42
+ });
43
+ (0, react_1.useEffect)(() => {
44
+ if (modelViewer == null) {
45
+ return;
46
+ }
47
+ if (passthroughProps.onError)
48
+ modelViewer.addEventListener('error', passthroughProps.onError);
49
+ if (passthroughProps.onLoad)
50
+ modelViewer.addEventListener('load', passthroughProps.onLoad);
51
+ if (passthroughProps.onPreload)
52
+ modelViewer.addEventListener('preload', passthroughProps.onPreload);
53
+ if (passthroughProps.onModelVisibility)
54
+ modelViewer.addEventListener('model-visibility', passthroughProps.onModelVisibility);
55
+ if (passthroughProps.onProgress)
56
+ modelViewer.addEventListener('progress', passthroughProps.onProgress);
57
+ if (passthroughProps.onArStatus)
58
+ modelViewer.addEventListener('ar-status', passthroughProps.onArStatus);
59
+ if (passthroughProps.onArTracking)
60
+ modelViewer.addEventListener('ar-tracking', passthroughProps.onArTracking);
61
+ if (passthroughProps.onQuickLookButtonTapped)
62
+ modelViewer.addEventListener('quick-look-button-tapped', passthroughProps.onQuickLookButtonTapped);
63
+ if (passthroughProps.onCameraChange)
64
+ modelViewer.addEventListener('camera-change', passthroughProps.onCameraChange);
65
+ if (passthroughProps.onEnvironmentChange)
66
+ modelViewer.addEventListener('environment-change', passthroughProps.onEnvironmentChange);
67
+ if (passthroughProps.onPlay)
68
+ modelViewer.addEventListener('play', passthroughProps.onPlay);
69
+ if (passthroughProps.onPause)
70
+ modelViewer.addEventListener('ar-status', passthroughProps.onPause);
71
+ if (passthroughProps.onSceneGraphReady)
72
+ modelViewer.addEventListener('scene-graph-ready', passthroughProps.onSceneGraphReady);
73
+ return () => {
74
+ if (modelViewer == null) {
75
+ return;
76
+ }
77
+ if (passthroughProps.onError)
78
+ modelViewer.removeEventListener('error', passthroughProps.onError);
79
+ if (passthroughProps.onLoad)
80
+ modelViewer.removeEventListener('load', passthroughProps.onLoad);
81
+ if (passthroughProps.onPreload)
82
+ modelViewer.removeEventListener('preload', passthroughProps.onPreload);
83
+ if (passthroughProps.onModelVisibility)
84
+ modelViewer.removeEventListener('model-visibility', passthroughProps.onModelVisibility);
85
+ if (passthroughProps.onProgress)
86
+ modelViewer.removeEventListener('progress', passthroughProps.onProgress);
87
+ if (passthroughProps.onArStatus)
88
+ modelViewer.removeEventListener('ar-status', passthroughProps.onArStatus);
89
+ if (passthroughProps.onArTracking)
90
+ modelViewer.removeEventListener('ar-tracking', passthroughProps.onArTracking);
91
+ if (passthroughProps.onQuickLookButtonTapped)
92
+ modelViewer.removeEventListener('quick-look-button-tapped', passthroughProps.onQuickLookButtonTapped);
93
+ if (passthroughProps.onCameraChange)
94
+ modelViewer.removeEventListener('camera-change', passthroughProps.onCameraChange);
95
+ if (passthroughProps.onEnvironmentChange)
96
+ modelViewer.removeEventListener('environment-change', passthroughProps.onEnvironmentChange);
97
+ if (passthroughProps.onPlay)
98
+ modelViewer.removeEventListener('play', passthroughProps.onPlay);
99
+ if (passthroughProps.onPause)
100
+ modelViewer.removeEventListener('ar-status', passthroughProps.onPause);
101
+ if (passthroughProps.onSceneGraphReady)
102
+ modelViewer.removeEventListener('scene-graph-ready', passthroughProps.onSceneGraphReady);
103
+ };
104
+ }, [
105
+ modelViewer,
106
+ passthroughProps.onArStatus,
107
+ passthroughProps.onArTracking,
108
+ passthroughProps.onCameraChange,
109
+ passthroughProps.onEnvironmentChange,
110
+ passthroughProps.onError,
111
+ passthroughProps.onLoad,
112
+ passthroughProps.onModelVisibility,
113
+ passthroughProps.onPause,
114
+ passthroughProps.onPlay,
115
+ passthroughProps.onPreload,
116
+ passthroughProps.onProgress,
117
+ passthroughProps.onQuickLookButtonTapped,
118
+ passthroughProps.onSceneGraphReady,
119
+ ]);
120
+ if (modelViewerLoadedStatus !== 'done') {
121
+ // TODO: What do we want to display while the model-viewer library loads?
122
+ return null;
123
+ }
124
+ if (!((_b = (_a = data.sources) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.url)) {
125
+ throw new Error(`<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it`);
126
+ }
127
+ if (!data.alt) {
128
+ console.warn(`<ModelViewer/> requires the 'data.alt' prop for accessibility`);
129
+ }
130
+ return (react_1.default.createElement("model-viewer", { ref: callbackRef, ...passthroughProps, class: className, id: id, src: data.sources[0].url, alt: data.alt, "camera-controls": (_c = passthroughProps.cameraControls) !== null && _c !== void 0 ? _c : true, poster: passthroughProps.poster || ((_d = data.previewImage) === null || _d === void 0 ? void 0 : _d.url), autoplay: (_e = passthroughProps.autoplay) !== null && _e !== void 0 ? _e : true, loading: passthroughProps.loading, reveal: passthroughProps.reveal, ar: passthroughProps.ar, "ar-modes": passthroughProps.arModes, "ar-scale": passthroughProps.arScale, "ar-placement": passthroughProps.arPlacement, "ios-src": passthroughProps.iosSrc, "touch-action": passthroughProps.touchAction, "disable-zoom": passthroughProps.disableZoom, "orbit-sensitivity": passthroughProps.orbitSensitivity, "auto-rotate": passthroughProps.autoRotate, "auto-rotate-delay": passthroughProps.autoRotateDelay, "rotation-per-second": passthroughProps.rotationPerSecond, "interaction-policy": passthroughProps.interactionPolicy, "interaction-prompt": passthroughProps.interactionPrompt, "interaction-prompt-style": passthroughProps.interactionPromptStyle, "interaction-prompt-threshold": passthroughProps.interactionPromptThreshold, "camera-orbit": passthroughProps.cameraOrbit, "camera-target": passthroughProps.cameraTarget, "field-of-view": passthroughProps.fieldOfView, "max-camera-orbit": passthroughProps.maxCameraOrbit, "min-camera-orbit": passthroughProps.minCameraOrbit, "max-field-of-view": passthroughProps.maxFieldOfView, "min-field-of-view": passthroughProps.minFieldOfView, bounds: passthroughProps.bounds, "interpolation-decay": (_f = passthroughProps.interpolationDecay) !== null && _f !== void 0 ? _f : 100, "skybox-image": passthroughProps.skyboxImage, "environment-image": passthroughProps.environmentImage, exposure: passthroughProps.exposure, "shadow-intensity": (_g = passthroughProps.shadowIntensity) !== null && _g !== void 0 ? _g : 0, "shadow-softness": (_h = passthroughProps.shadowSoftness) !== null && _h !== void 0 ? _h : 0, "animation-name": passthroughProps.animationName, "animation-crossfade-duration": passthroughProps.animationCrossfadeDuration, "variant-name": passthroughProps.variantName, orientation: passthroughProps.orientation, scale: passthroughProps.scale }, children));
131
+ }
132
+ exports.ModelViewer = ModelViewer;
@@ -0,0 +1 @@
1
+ export { ModelViewer } from './ModelViewer.client';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModelViewer = void 0;
4
+ var ModelViewer_client_1 = require("./ModelViewer.client");
5
+ Object.defineProperty(exports, "ModelViewer", { enumerable: true, get: function () { return ModelViewer_client_1.ModelViewer; } });
@@ -0,0 +1,25 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import type { MoneyV2, UnitPriceMeasurement } from '../../storefront-api-types';
3
+ import type { PartialDeep } from 'type-fest';
4
+ interface CustomProps<ComponentGeneric extends React.ElementType> {
5
+ /** An HTML tag or React Component to be rendered as the base element wrapper. The default is `div`. */
6
+ as?: ComponentGeneric;
7
+ /** An object with fields that correspond to the Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2). */
8
+ data: PartialDeep<MoneyV2>;
9
+ /** Whether to remove the currency symbol from the output. */
10
+ withoutCurrency?: boolean;
11
+ /** Whether to remove trailing zeros (fractional money) from the output. */
12
+ withoutTrailingZeros?: boolean;
13
+ /** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/latest/objects/unitpricemeasurement). */
14
+ measurement?: PartialDeep<UnitPriceMeasurement>;
15
+ /** Customizes the separator between the money output and the measurement output. Used with the `measurement` prop. Defaults to `'/'`. */
16
+ measurementSeparator?: ReactNode;
17
+ }
18
+ declare type MoneyProps<ComponentGeneric extends React.ElementType> = CustomProps<ComponentGeneric> & Omit<React.ComponentPropsWithoutRef<ComponentGeneric>, keyof CustomProps<ComponentGeneric>>;
19
+ /**
20
+ * The `Money` component renders a string of the Storefront API's
21
+ * [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the
22
+ * `defaultLocale` in [the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
23
+ */
24
+ export declare function Money<TTag extends React.ElementType>({ data, as, withoutCurrency, withoutTrailingZeros, measurement, measurementSeparator, ...passthroughProps }: MoneyProps<TTag>): JSX.Element;
25
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Money = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const hooks_1 = require("../../hooks");
9
+ /**
10
+ * The `Money` component renders a string of the Storefront API's
11
+ * [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the
12
+ * `defaultLocale` in [the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
13
+ */
14
+ function Money({ data, as, withoutCurrency, withoutTrailingZeros, measurement, measurementSeparator = '/', ...passthroughProps }) {
15
+ if (!isMoney(data)) {
16
+ throw new Error(`<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'`);
17
+ }
18
+ const moneyObject = (0, hooks_1.useMoney)(data);
19
+ const Wrapper = as !== null && as !== void 0 ? as : 'div';
20
+ let output = moneyObject.localizedString;
21
+ if (withoutCurrency || withoutTrailingZeros) {
22
+ if (withoutCurrency && !withoutTrailingZeros) {
23
+ output = moneyObject.amount;
24
+ }
25
+ else if (!withoutCurrency && withoutTrailingZeros) {
26
+ output = moneyObject.withoutTrailingZeros;
27
+ }
28
+ else {
29
+ // both
30
+ output = moneyObject.withoutTrailingZerosAndCurrency;
31
+ }
32
+ }
33
+ return (react_1.default.createElement(Wrapper, { ...passthroughProps },
34
+ output,
35
+ measurement && measurement.referenceUnit && (react_1.default.createElement(react_1.default.Fragment, null,
36
+ measurementSeparator,
37
+ measurement.referenceUnit))));
38
+ }
39
+ exports.Money = Money;
40
+ // required in order to narrow the money object down and make TS happy
41
+ function isMoney(maybeMoney) {
42
+ return (typeof maybeMoney.amount === 'string' &&
43
+ !!maybeMoney.amount &&
44
+ typeof maybeMoney.currencyCode === 'string' &&
45
+ !!maybeMoney.currencyCode);
46
+ }
@@ -0,0 +1 @@
1
+ export { Money } from './Money.client';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Money = void 0;
4
+ var Money_client_1 = require("./Money.client");
5
+ Object.defineProperty(exports, "Money", { enumerable: true, get: function () { return Money_client_1.Money; } });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import type { Product, ProductVariant as ProductVariantType } from '../../storefront-api-types';
3
+ import type { PartialDeep } from 'type-fest';
4
+ declare type InitialVariantId = ProductVariantType['id'] | null;
5
+ interface ProductOptionsProviderProps {
6
+ /** A [Product object](https://shopify.dev/api/storefront/reference/products/product). */
7
+ data: PartialDeep<Product>;
8
+ /** A `ReactNode` element. */
9
+ children: React.ReactNode;
10
+ /**
11
+ * The initially selected variant.
12
+ * The following logic applies to `initialVariantId`:
13
+ * 1. If `initialVariantId` is provided, then it's used even if it's out of stock.
14
+ * 2. If `initialVariantId` is provided but is `null`, then no variant is used.
15
+ * 3. If nothing is passed to `initialVariantId` then the first available / in-stock variant is used.
16
+ * 4. If nothing is passed to `initialVariantId` and no variants are in stock, then the first variant is used.
17
+ */
18
+ initialVariantId?: InitialVariantId;
19
+ }
20
+ export declare function ProductOptionsProvider({ children, data: product, initialVariantId: explicitVariantId, }: ProductOptionsProviderProps): JSX.Element;
21
+ export {};