@shopify/hydrogen 0.20.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/dist/esnext/client.d.ts +1 -0
  3. package/dist/esnext/client.js +1 -0
  4. package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +1 -1
  5. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
  6. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +7 -4
  7. package/dist/esnext/components/CartProvider/CartProvider.client.js +22 -12
  8. package/dist/esnext/components/Image/Image.d.ts +3 -3
  9. package/dist/esnext/components/Image/Image.js +12 -9
  10. package/dist/esnext/components/MediaFile/MediaFile.js +3 -2
  11. package/dist/esnext/components/Money/Money.client.d.ts +11 -5
  12. package/dist/esnext/components/Money/Money.client.js +16 -3
  13. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +1 -2
  14. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +1 -2
  15. package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +3 -0
  16. package/dist/esnext/components/Seo/NoIndexSeo.client.js +10 -0
  17. package/dist/esnext/components/Seo/Seo.client.d.ts +4 -0
  18. package/dist/esnext/components/Seo/Seo.client.js +3 -0
  19. package/dist/esnext/components/index.d.ts +0 -3
  20. package/dist/esnext/components/index.js +0 -3
  21. package/dist/esnext/config.d.ts +3 -3
  22. package/dist/esnext/entry-client.js +0 -3
  23. package/dist/esnext/entry-server.d.ts +2 -2
  24. package/dist/esnext/entry-server.js +97 -73
  25. package/dist/esnext/foundation/Analytics/Analytics.client.js +1 -1
  26. package/dist/esnext/foundation/Analytics/ClientAnalytics.js +2 -2
  27. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +2 -2
  28. package/dist/esnext/foundation/Analytics/index.d.ts +0 -1
  29. package/dist/esnext/foundation/Analytics/index.js +0 -1
  30. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -10
  31. package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +2 -1
  32. package/dist/esnext/foundation/Router/BrowserRouter.client.js +1 -1
  33. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +0 -2
  34. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +18 -3
  35. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +0 -1
  36. package/dist/esnext/foundation/useQuery/hooks.js +8 -9
  37. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +2 -1
  38. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +1 -1
  39. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +2 -2
  40. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +1 -10
  41. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +2 -20
  42. package/dist/esnext/framework/Hydration/rsc.js +55 -7
  43. package/dist/esnext/framework/cache/in-memory.js +0 -6
  44. package/dist/esnext/framework/cache-sub-request.d.ts +17 -0
  45. package/dist/esnext/framework/cache-sub-request.js +64 -0
  46. package/dist/esnext/framework/cache.d.ts +6 -6
  47. package/dist/esnext/framework/cache.js +36 -33
  48. package/dist/esnext/framework/middleware.js +1 -15
  49. package/dist/esnext/framework/plugin.js +4 -0
  50. package/dist/esnext/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
  51. package/dist/esnext/framework/plugins/vite-plugin-client-imports.js +25 -0
  52. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +8 -3
  53. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
  54. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +2 -1
  55. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -47
  56. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +6 -11
  57. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
  58. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +99 -0
  59. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +4 -4
  60. package/dist/esnext/framework/viteception.d.ts +4 -0
  61. package/dist/esnext/framework/viteception.js +15 -0
  62. package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -2
  63. package/dist/esnext/hooks/useShopQuery/hooks.js +0 -1
  64. package/dist/esnext/index.d.ts +24 -9
  65. package/dist/esnext/index.js +24 -13
  66. package/dist/esnext/storefront-api-types.d.ts +1 -1
  67. package/dist/esnext/streaming.server.d.ts +3 -1
  68. package/dist/esnext/types.d.ts +13 -5
  69. package/dist/esnext/utilities/apiRoutes.d.ts +4 -5
  70. package/dist/esnext/utilities/apiRoutes.js +2 -8
  71. package/dist/esnext/utilities/fetch.d.ts +1 -2
  72. package/dist/esnext/utilities/fetch.js +1 -3
  73. package/dist/esnext/utilities/graphql-tag.d.ts +1 -0
  74. package/dist/esnext/utilities/graphql-tag.js +6 -0
  75. package/dist/esnext/utilities/graphql-tracker.d.ts +1 -1
  76. package/dist/esnext/utilities/graphql-tracker.js +4 -0
  77. package/dist/esnext/utilities/html-encoding.d.ts +1 -0
  78. package/dist/esnext/utilities/html-encoding.js +8 -0
  79. package/dist/esnext/utilities/index.d.ts +1 -0
  80. package/dist/esnext/utilities/index.js +1 -0
  81. package/dist/esnext/utilities/log/log-cache-api-status.js +5 -1
  82. package/dist/esnext/version.d.ts +1 -1
  83. package/dist/esnext/version.js +1 -1
  84. package/dist/node/components/Image/Image.d.ts +3 -3
  85. package/dist/node/components/Image/Image.js +12 -9
  86. package/dist/node/entry-server.d.ts +2 -2
  87. package/dist/node/entry-server.js +97 -73
  88. package/dist/node/foundation/Analytics/Analytics.client.js +6 -6
  89. package/dist/node/foundation/Analytics/ClientAnalytics.js +2 -2
  90. package/dist/node/foundation/Router/BrowserRouter.client.d.ts +2 -1
  91. package/dist/node/foundation/Router/BrowserRouter.client.js +1 -1
  92. package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +0 -2
  93. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +18 -3
  94. package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +2 -2
  95. package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +1 -10
  96. package/dist/node/framework/Hydration/ServerComponentResponse.server.js +2 -20
  97. package/dist/node/framework/Hydration/rsc.js +55 -7
  98. package/dist/node/framework/cache/in-memory.js +0 -6
  99. package/dist/node/framework/cache-sub-request.d.ts +17 -0
  100. package/dist/node/framework/cache-sub-request.js +95 -0
  101. package/dist/node/framework/cache.d.ts +6 -6
  102. package/dist/node/framework/cache.js +38 -35
  103. package/dist/node/framework/middleware.js +1 -15
  104. package/dist/node/framework/plugin.js +4 -0
  105. package/dist/node/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
  106. package/dist/node/framework/plugins/vite-plugin-client-imports.js +28 -0
  107. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +8 -3
  108. package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
  109. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +2 -1
  110. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +5 -46
  111. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +6 -11
  112. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
  113. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +105 -0
  114. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +4 -4
  115. package/dist/node/framework/viteception.d.ts +4 -0
  116. package/dist/node/framework/viteception.js +19 -0
  117. package/dist/node/storefront-api-types.d.ts +1 -1
  118. package/dist/node/streaming.server.d.ts +3 -1
  119. package/dist/node/types.d.ts +13 -5
  120. package/dist/node/utilities/apiRoutes.d.ts +4 -5
  121. package/dist/node/utilities/apiRoutes.js +2 -8
  122. package/dist/node/utilities/fetch.d.ts +1 -2
  123. package/dist/node/utilities/fetch.js +1 -3
  124. package/dist/node/utilities/html-encoding.d.ts +1 -0
  125. package/dist/node/utilities/html-encoding.js +12 -0
  126. package/dist/node/utilities/index.d.ts +1 -0
  127. package/dist/node/utilities/index.js +3 -1
  128. package/dist/node/utilities/log/log-cache-api-status.js +5 -1
  129. package/dist/node/version.d.ts +1 -1
  130. package/dist/node/version.js +1 -1
  131. package/package.json +6 -5
  132. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +48 -6
  133. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +48 -6
  134. package/vendor/react-server-dom-vite/package.json +2 -1
  135. package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +0 -13
  136. package/dist/esnext/components/ProductDescription/ProductDescription.client.js +0 -16
  137. package/dist/esnext/components/ProductDescription/index.d.ts +0 -1
  138. package/dist/esnext/components/ProductDescription/index.js +0 -1
  139. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.d.ts +0 -21
  140. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +0 -42
  141. package/dist/esnext/components/ProductMetafield/index.d.ts +0 -2
  142. package/dist/esnext/components/ProductMetafield/index.js +0 -1
  143. package/dist/esnext/components/ProductTitle/ProductTitle.client.d.ts +0 -13
  144. package/dist/esnext/components/ProductTitle/ProductTitle.client.js +0 -16
  145. package/dist/esnext/components/ProductTitle/index.d.ts +0 -1
  146. package/dist/esnext/components/ProductTitle/index.js +0 -1
  147. package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +0 -15
  148. package/dist/esnext/components/UnitPrice/UnitPrice.client.js +0 -22
  149. package/dist/esnext/components/UnitPrice/index.d.ts +0 -1
  150. package/dist/esnext/components/UnitPrice/index.js +0 -1
  151. package/dist/esnext/utilities/findRoutePrefix.d.ts +0 -1
  152. package/dist/esnext/utilities/findRoutePrefix.js +0 -17
  153. package/dist/node/foundation/Analytics/index.d.ts +0 -2
  154. package/dist/node/foundation/Analytics/index.js +0 -7
  155. package/dist/node/utilities/findRoutePrefix.d.ts +0 -1
  156. package/dist/node/utilities/findRoutePrefix.js +0 -21
package/CHANGELOG.md CHANGED
@@ -1,5 +1,156 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.22.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1394](https://github.com/Shopify/hydrogen/pull/1394) [`3a681ac2`](https://github.com/Shopify/hydrogen/commit/3a681ac289cc7850f79bc080a445bc6c0b6926fb) Thanks [@jplhomer](https://github.com/jplhomer)! - Make graphql-tag a dependency instead of a devDependency
8
+
9
+ ## 0.22.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#930](https://github.com/Shopify/hydrogen/pull/930) [`750baf8f`](https://github.com/Shopify/hydrogen/commit/750baf8ff069d0e06fb92e78a142049a1ce2b1ae) Thanks [@michenly](https://github.com/michenly)! - With the introduction of authenticated pages, we also now provide the ability to prevent pages from being indexed by bots. You can do so by passing `noindex` to the `Seo` component:
14
+
15
+ ```jsx
16
+ <Seo type="noindex" data={{title: 'Login'}} />
17
+ ```
18
+
19
+ * [#1313](https://github.com/Shopify/hydrogen/pull/1313) [`ed1933e3`](https://github.com/Shopify/hydrogen/commit/ed1933e339927322d8008034982b05ff4590e6d8) Thanks [@frandiox](https://github.com/frandiox)! - **Breaking change**: The `routes` property in `hydrogen.config.js` file has been simplified. It is now a string that represents the path to the routes from the project root:
20
+
21
+ ```diff
22
+ // hydrogen.config.js
23
+
24
+ export default defineConfig({
25
+ - routes: import('./src/routes/**/*.server.[jt](s|sx)'),
26
+ + routes: '/src/routes',
27
+ });
28
+ ```
29
+
30
+ Its default value is `/src/routes` so this property can be removed when using this directory.
31
+
32
+ In the object syntax version, `dirPrefix` is removed and `files` becomes a string:
33
+
34
+ ```diff
35
+ // hydrogen.config.js
36
+
37
+ export default defineConfig({
38
+ routes: {
39
+ - files: import('./src/routes/**/*.server.[jt](s|sx)'),
40
+ - dirPrefix: './src/routes',
41
+ + files: '/src/routes',
42
+ basePath: '/',
43
+ },
44
+ });
45
+ ```
46
+
47
+ - [#1332](https://github.com/Shopify/hydrogen/pull/1332) [`5ec1bc62`](https://github.com/Shopify/hydrogen/commit/5ec1bc62cf9e4348aa389d4154f8c80dccfb96bb) Thanks [@frandiox](https://github.com/frandiox)! - A new `gql` utility is exported from `@shopify/hydrogen` that replaces `graphql-tag` dependency when using `useShopQuery`. It helps reducing bundle size in production when compared to the original `graphql-tag`.
48
+
49
+ Before:
50
+
51
+ ```js
52
+ import gql from 'graphql-tag';
53
+
54
+ // ...
55
+
56
+ useShopQuery({
57
+ query: gql`...`,
58
+ // ...
59
+ });
60
+ ```
61
+
62
+ After:
63
+
64
+ ```js
65
+ import {gql} from '@shopify/hydrogen';
66
+
67
+ // ...
68
+
69
+ useShopQuery({
70
+ query: gql`...`,
71
+ // ...
72
+ });
73
+ ```
74
+
75
+ * [#1340](https://github.com/Shopify/hydrogen/pull/1340) [`631832ec`](https://github.com/Shopify/hydrogen/commit/631832ecaef26b918e774515ada6b80668ec5e4e) Thanks [@jplhomer](https://github.com/jplhomer)! - **Breaking change**: The `response.send()` function has been removed. Use `export async function api()` to send custom responses instead.
76
+
77
+ ### Patch Changes
78
+
79
+ - [#1371](https://github.com/Shopify/hydrogen/pull/1371) [`84a2fd09`](https://github.com/Shopify/hydrogen/commit/84a2fd09b7150b1d5e1f92b786f4a6af09e18739) Thanks [@frehner](https://github.com/frehner)! - Made updates to `<Image/>`:
80
+
81
+ - Fixed some TypeScript type issues with Image.
82
+ - `data.url` and `alt` are now required props in Typescript, but won't break the actual component if you don't pass them.
83
+
84
+ * [#1348](https://github.com/Shopify/hydrogen/pull/1348) [`211093e5`](https://github.com/Shopify/hydrogen/commit/211093e5f1a9e2ad115eb667746bfa2c6dd05b82) Thanks [@developit](https://github.com/developit)! - Fix HTML double-decoding in flight response
85
+
86
+ - [#1345](https://github.com/Shopify/hydrogen/pull/1345) [`331ff3c0`](https://github.com/Shopify/hydrogen/commit/331ff3c0f58143df3e7c542116f9a94838710352) Thanks [@frandiox](https://github.com/frandiox)! - Reduce the amount of user app files downloaded in the browser.
87
+
88
+ * [#1322](https://github.com/Shopify/hydrogen/pull/1322) [`36bd77c4`](https://github.com/Shopify/hydrogen/commit/36bd77c4619ec071ea11b764bb16b5670b0afa6b) Thanks [@frandiox](https://github.com/frandiox)! - Fix server hanging in Node.js environment when not using Hydrogen Middleware.
89
+
90
+ - [#1360](https://github.com/Shopify/hydrogen/pull/1360) [`d9b0d03b`](https://github.com/Shopify/hydrogen/commit/d9b0d03b64d2207b314d15fc0acf6a5143610b92) Thanks [@blittle](https://github.com/blittle)! - Fix a problem where encoded html content props passed from server to client components would get double decoded, and break hydration on app load.
91
+
92
+ * [#1355](https://github.com/Shopify/hydrogen/pull/1355) [`c45a45e8`](https://github.com/Shopify/hydrogen/commit/c45a45e895b8407da04c6b4608e7f16170452c24) Thanks [@jplhomer](https://github.com/jplhomer)! - Ensure all Hydrogen components are exported properly
93
+
94
+ - [#1339](https://github.com/Shopify/hydrogen/pull/1339) [`fef4cb84`](https://github.com/Shopify/hydrogen/commit/fef4cb8496d985d37b6113865ac1252f78058aaa) Thanks [@jplhomer](https://github.com/jplhomer)! - Use `import.meta.env.DEV` instead of `process.env.LOCAL_DEV` to hash asset filenames and show performance metrics debugging
95
+
96
+ * [#1320](https://github.com/Shopify/hydrogen/pull/1320) [`7e9df897`](https://github.com/Shopify/hydrogen/commit/7e9df897465012cd0cf374a1a35deb2ca8a16fc3) Thanks [@jplhomer](https://github.com/jplhomer)! - Properly log errors during flight responses
97
+
98
+ - [#1363](https://github.com/Shopify/hydrogen/pull/1363) [`0941d3be`](https://github.com/Shopify/hydrogen/commit/0941d3be12b52edc045b898864435f591fc2c42e) Thanks [@frandiox](https://github.com/frandiox)! - Remove some server utilities from client build.
99
+
100
+ ## 0.21.0
101
+
102
+ ### Minor Changes
103
+
104
+ - [#1327](https://github.com/Shopify/hydrogen/pull/1327) [`ce56311f`](https://github.com/Shopify/hydrogen/commit/ce56311fc1b63df22f77b199980439548f76997a) Thanks [@frehner](https://github.com/frehner)! - **Breaking Change**: `<Money />` updates and `<UnitPrice />` Removed.
105
+
106
+ - `<UnitPrice/>` has been removed
107
+ - `<Money/>` has two new props: `measurement` and `measurementSeparator` which do the work that `UnitPrice` used to do
108
+ - The TypeScript types for `<Money/>` have been improved and should provide a better typed experience now
109
+
110
+ * [#1216](https://github.com/Shopify/hydrogen/pull/1216) [`771786a6`](https://github.com/Shopify/hydrogen/commit/771786a6475c4caadb1abe5f6644e2b5c2abc021) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Fixes an issue where cached sub-requests were not revalidating properly.
111
+
112
+ - [#1304](https://github.com/Shopify/hydrogen/pull/1304) [`aa196150`](https://github.com/Shopify/hydrogen/commit/aa19615024de4fe16d548429665a863e9aae0248) Thanks [@frehner](https://github.com/frehner)! - Removed `<ProductTitle/>` and `<ProductDescription/>` components. To migrate, use `{product.title}` and `{product.description}` instead.
113
+
114
+ * [#1335](https://github.com/Shopify/hydrogen/pull/1335) [`0d90f92b`](https://github.com/Shopify/hydrogen/commit/0d90f92b448b0c4d99be3e5f5fa25d0b70a8315e) Thanks [@blittle](https://github.com/blittle)! - **Breaking Change**
115
+
116
+ The `<ProductMetafield />` component has been removed. Instead, directly use the `<Metafield>` component.
117
+
118
+ ### Patch Changes
119
+
120
+ - [#1311](https://github.com/Shopify/hydrogen/pull/1311) [`3e3fd72f`](https://github.com/Shopify/hydrogen/commit/3e3fd72f7016c0993deceefc121306cf957ef564) Thanks [@jplhomer](https://github.com/jplhomer)! - Client components no longer need to use `@shopify/hydrogen/client` as the import path. All Hydrogen components can now be imported from `@shopify/hydrogen` regardless of their context.
121
+
122
+ * [#1259](https://github.com/Shopify/hydrogen/pull/1259) [`110e9aca`](https://github.com/Shopify/hydrogen/commit/110e9aca385d553e3a87fea406f8bd8a43a0788f) Thanks [@blittle](https://github.com/blittle)! - You can now easily disable streaming on any page conditionally with the `enableStreaming` option inside `hydrogen.config.js`:
123
+
124
+ ```ts
125
+ import {CookieSessionStorage} from '@shopify/hydrogen';
126
+ import {defineConfig} from '@shopify/hydrogen/config';
127
+
128
+ export default defineConfig({
129
+ routes: import.meta.globEager('./src/routes/**/*.server.[jt](s|sx)'),
130
+ shopify: {
131
+ defaultLocale: 'en-us',
132
+ storeDomain: 'hydrogen-preview.myshopify.com',
133
+ storefrontToken: '3b580e70970c4528da70c98e097c2fa0',
134
+ storefrontApiVersion: '2022-07',
135
+ },
136
+ enableStreaming: (req) => req.headers.get('user-agent') !== 'custom bot',
137
+ });
138
+ ```
139
+
140
+ By default all pages are stream rendered except for SEO bots. There shouldn't be many reasons to disable streaming, unless there is a custom bot not covered by Hydrogen's bot detection.
141
+
142
+ - [#1318](https://github.com/Shopify/hydrogen/pull/1318) [`668a24da`](https://github.com/Shopify/hydrogen/commit/668a24daebf180747a002c8020c2e712f5d9a458) Thanks [@blittle](https://github.com/blittle)! - Buffer RSC flight responses. There isn't any benefit to streaming them, because we start a transition on page navigation. Buffering also fixes caching problems on the flight response.
143
+
144
+ * [#1293](https://github.com/Shopify/hydrogen/pull/1293) [`e378ed61`](https://github.com/Shopify/hydrogen/commit/e378ed6199553f64d9e73ad27f9409ef501aa724) Thanks [@jplhomer](https://github.com/jplhomer)! - Reverts [#1272](https://github.com/Shopify/hydrogen/pull/1272) and properly escapes terminating script sequences
145
+
146
+ - [#1283](https://github.com/Shopify/hydrogen/pull/1283) [`eea82cb0`](https://github.com/Shopify/hydrogen/commit/eea82cb02064471d274e534c557caa5d3527bc93) Thanks [@jplhomer](https://github.com/jplhomer)! - Hydrogen has been updated to use the latest stable version of React.
147
+
148
+ To update an existing Hydrogen app:
149
+
150
+ ```bash
151
+ yarn add react@latest react-dom@latest
152
+ ```
153
+
3
154
  ## 0.20.0
4
155
 
5
156
  ### Minor Changes
@@ -6,6 +6,7 @@ export * from './foundation/ServerPropsProvider';
6
6
  export * from './foundation/useUrl';
7
7
  export { Head } from './foundation/Head';
8
8
  export * from './utilities';
9
+ export { gql } from './utilities/graphql-tag';
9
10
  export { ClientAnalytics } from './foundation/Analytics';
10
11
  export { useRouteParams } from './foundation/useRouteParams/useRouteParams';
11
12
  export { useNavigate } from './foundation/useNavigate/useNavigate';
@@ -6,6 +6,7 @@ export * from './foundation/ServerPropsProvider';
6
6
  export * from './foundation/useUrl';
7
7
  export { Head } from './foundation/Head';
8
8
  export * from './utilities';
9
+ export { gql } from './utilities/graphql-tag';
9
10
  export { ClientAnalytics } from './foundation/Analytics';
10
11
  export { useRouteParams } from './foundation/useRouteParams/useRouteParams';
11
12
  export { useNavigate } from './foundation/useNavigate/useNavigate';
@@ -11,4 +11,4 @@ export interface CartEstimatedCostProps {
11
11
  * cost associated with the `amountType` prop. If no `amountType` prop is specified, then it defaults to `totalAmount`.
12
12
  * If `children` is a function, then it will pass down the render props provided by the parent component.
13
13
  */
14
- export declare function CartEstimatedCost<TTag extends keyof JSX.IntrinsicElements>(props: Omit<React.ComponentProps<typeof Money>, 'data'> & CartEstimatedCostProps): JSX.Element | null;
14
+ export declare function CartEstimatedCost(props: Omit<React.ComponentProps<typeof Money>, 'data'> & CartEstimatedCostProps): JSX.Element | null;
@@ -8,5 +8,5 @@ interface CartLinePriceProps {
8
8
  * The `CartLinePrice` component renders a `Money` component for the cart line merchandise's price or
9
9
  * compare at price. It must be a descendent of a `CartLineProvider` component.
10
10
  */
11
- export declare function CartLinePrice<TTag extends keyof JSX.IntrinsicElements>(props: Omit<React.ComponentProps<typeof Money>, 'data'> & CartLinePriceProps): JSX.Element | null;
11
+ export declare function CartLinePrice(props: Omit<React.ComponentProps<typeof Money>, 'data'> & CartLinePriceProps): JSX.Element | null;
12
12
  export {};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { CartBuyerIdentityInput, CountryCode } from '../../storefront-api-types';
2
3
  import { CartFragmentFragment } from './graphql/CartFragment';
3
4
  /**
4
5
  * The `CartProvider` component creates a context for using a cart. It creates a cart object and callbacks
@@ -9,7 +10,7 @@ import { CartFragmentFragment } from './graphql/CartFragment';
9
10
  * The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
10
11
  * You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
11
12
  */
12
- export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment, }: {
13
+ export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment, customerAccessToken, countryCode, }: {
13
14
  /** Any `ReactNode` elements. */
14
15
  children: React.ReactNode;
15
16
  numCartLines?: number;
@@ -29,10 +30,12 @@ export declare function CartProvider({ children, numCartLines, onCreate, onLineA
29
30
  onAttributesUpdate?: () => void;
30
31
  /** A callback that is invoked when the process to update the cart discount codes begins, but before the discount codes are updated in the Storefront API. */
31
32
  onDiscountCodesUpdate?: () => void;
32
- /**
33
- * An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart).
34
- */
33
+ /** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart). */
35
34
  data?: CartFragmentFragment;
36
35
  /** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
37
36
  cartFragment?: string;
37
+ /** A customer access token that's accessible on the server if there's a customer login. */
38
+ customerAccessToken?: CartBuyerIdentityInput['customerAccessToken'];
39
+ /** The ISO country code for i18n. */
40
+ countryCode?: CountryCode;
38
41
  }): JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import React, { useEffect, useCallback, useReducer, useMemo, useRef, } from 'react';
2
- import { flattenConnection } from '../../utilities';
2
+ import { flattenConnection } from '../../utilities/flattenConnection';
3
3
  import { CartLineAdd, CartCreate, CartLineRemove, CartLineUpdate, CartNoteUpdate, CartBuyerIdentityUpdate, CartAttributesUpdate, CartDiscountCodesUpdate, CartQuery, defaultCartFragment, } from './cart-queries';
4
+ import { CountryCode, } from '../../storefront-api-types';
4
5
  import { useCartFetch } from './hooks.client';
5
6
  import { CartContext } from './context';
6
7
  import { CART_ID_STORAGE_KEY } from './constants';
7
- import { useServerProps } from '../../foundation/useServerProps';
8
- import { ClientAnalytics } from '../../foundation/Analytics';
8
+ import { ClientAnalytics } from '../../foundation/Analytics/ClientAnalytics';
9
9
  function cartReducer(state, action) {
10
10
  switch (action.type) {
11
11
  case 'cartFetch': {
@@ -150,10 +150,7 @@ function cartReducer(state, action) {
150
150
  * The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
151
151
  * You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
152
152
  */
153
- export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment = defaultCartFragment, }) {
154
- var _a;
155
- const { serverProps } = useServerProps();
156
- const countryCode = (_a = serverProps === null || serverProps === void 0 ? void 0 : serverProps.country) === null || _a === void 0 ? void 0 : _a.isoCode;
153
+ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment = defaultCartFragment, customerAccessToken, countryCode = CountryCode.Us, }) {
157
154
  const initialStatus = cart
158
155
  ? { status: 'idle', cart: cartFromGraphQL(cart) }
159
156
  : { status: 'uninitialized' };
@@ -177,7 +174,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
177
174
  dispatch({ type: 'resolve', cart: cartFromGraphQL(data.cart) });
178
175
  }, [fetchCart, cartFragment, numCartLines, countryCode]);
179
176
  const cartCreate = useCallback(async (cart) => {
180
- var _a, _b;
177
+ var _a, _b, _c;
181
178
  dispatch({ type: 'cartCreate' });
182
179
  onCreate === null || onCreate === void 0 ? void 0 : onCreate();
183
180
  if (countryCode && !((_a = cart.buyerIdentity) === null || _a === void 0 ? void 0 : _a.countryCode)) {
@@ -186,6 +183,12 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
186
183
  }
187
184
  cart.buyerIdentity.countryCode = countryCode;
188
185
  }
186
+ if (customerAccessToken && !((_b = cart.buyerIdentity) === null || _b === void 0 ? void 0 : _b.customerAccessToken)) {
187
+ if (cart.buyerIdentity == null) {
188
+ cart.buyerIdentity = {};
189
+ }
190
+ cart.buyerIdentity.customerAccessToken = customerAccessToken;
191
+ }
189
192
  const { data, error } = await fetchCart({
190
193
  query: CartCreate(cartFragment),
191
194
  variables: {
@@ -200,7 +203,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
200
203
  error,
201
204
  });
202
205
  }
203
- if ((_b = data === null || data === void 0 ? void 0 : data.cartCreate) === null || _b === void 0 ? void 0 : _b.cart) {
206
+ if ((_c = data === null || data === void 0 ? void 0 : data.cartCreate) === null || _c === void 0 ? void 0 : _c.cart) {
204
207
  if (cart.lines) {
205
208
  ClientAnalytics.publish(ClientAnalytics.eventNames.ADD_TO_CART, true, {
206
209
  addedCartLines: cart.lines,
@@ -213,7 +216,14 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
213
216
  });
214
217
  window.localStorage.setItem(CART_ID_STORAGE_KEY, data.cartCreate.cart.id);
215
218
  }
216
- }, [onCreate, countryCode, fetchCart, cartFragment, numCartLines]);
219
+ }, [
220
+ onCreate,
221
+ countryCode,
222
+ fetchCart,
223
+ cartFragment,
224
+ numCartLines,
225
+ customerAccessToken,
226
+ ]);
217
227
  const addLineItem = useCallback(async (lines, state) => {
218
228
  var _a;
219
229
  if (state.status === 'idle') {
@@ -439,9 +449,9 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
439
449
  if (state.status !== 'idle') {
440
450
  return;
441
451
  }
442
- buyerIdentityUpdate({ countryCode }, state);
452
+ buyerIdentityUpdate({ countryCode, customerAccessToken }, state);
443
453
  // eslint-disable-next-line react-hooks/exhaustive-deps
444
- }, [countryCode]);
454
+ }, [countryCode, customerAccessToken]);
445
455
  const cartContextValue = useMemo(() => {
446
456
  return {
447
457
  ...('cart' in state
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import type { Image as ImageType } from '../../storefront-api-types';
3
3
  import type { PartialDeep, Simplify, SetRequired } from 'type-fest';
4
4
  declare type HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
5
- declare type ImageProps<GenericLoaderOpts> = Simplify<ShopifyImageProps | ExternalImageProps<GenericLoaderOpts>>;
5
+ declare type ImageProps<GenericLoaderOpts> = ShopifyImageProps | ExternalImageProps<GenericLoaderOpts>;
6
6
  export declare function Image<GenericLoaderOpts>(props: ImageProps<GenericLoaderOpts>): JSX.Element;
7
7
  export declare type ShopifyLoaderOptions = {
8
8
  crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';
@@ -19,7 +19,7 @@ export declare type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {
19
19
  * The `data` prop is required if `src` isn't used, but both props shouldn't be used
20
20
  * at the same time. If both `src` and `data` are passed, then `data` takes priority.
21
21
  */
22
- data: PartialDeep<ImageType>;
22
+ data: SetRequired<PartialDeep<ImageType>, 'url'>;
23
23
  /** A custom function that generates the image URL. Parameters passed in
24
24
  * are either `ShopifyLoaderParams` if using the `data` prop, or the
25
25
  * `LoaderOptions` object that you pass to `loaderOptions`.
@@ -62,7 +62,7 @@ declare type LoaderProps<GenericLoaderOpts> = {
62
62
  */
63
63
  loaderOptions?: GenericLoaderOpts;
64
64
  };
65
- declare type ExternalImageProps<GenericLoaderOpts> = SetRequired<HtmlImageProps, 'src' | 'width' | 'height'> & {
65
+ declare type ExternalImageProps<GenericLoaderOpts> = SetRequired<HtmlImageProps, 'src' | 'width' | 'height' | 'alt'> & {
66
66
  /** A custom function that generates the image URL. Parameters passed in
67
67
  * are either `ShopifyLoaderParams` if using the `data` prop, or the
68
68
  * `LoaderOptions` object that you pass to `loaderOptions`.
@@ -4,7 +4,7 @@ export function Image(props) {
4
4
  if (!props.data && !props.src) {
5
5
  throw new Error(`<Image/>: requires either a 'data' or 'src' prop.`);
6
6
  }
7
- if (props.data && props.src) {
7
+ if (__DEV__ && props.data && props.src) {
8
8
  console.warn(`<Image/>: using both 'data' and 'src' props is not supported; using the 'data' prop by default`);
9
9
  }
10
10
  if (props.data) {
@@ -15,16 +15,16 @@ export function Image(props) {
15
15
  }
16
16
  }
17
17
  function ShopifyImage({ data, width, height, loading, loader = shopifyImageLoader, loaderOptions, ...rest }) {
18
- var _a, _b, _c;
18
+ var _a, _b, _c, _d, _e, _f;
19
19
  if (!data.url) {
20
20
  throw new Error(`<Image/>: the 'data' prop requires the 'url' property`);
21
21
  }
22
- if (!data.altText && !rest.alt) {
23
- console.warn(`<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. ${data.id ? `Image ID: ${data.id}` : ''}`);
22
+ if (__DEV__ && !data.altText && !rest.alt) {
23
+ console.warn(`<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. ${`Image: ${(_a = data.id) !== null && _a !== void 0 ? _a : data.url}`}`);
24
24
  }
25
25
  const { width: finalWidth, height: finalHeight } = getShopifyImageDimensions(data, loaderOptions);
26
- if (!finalWidth || !finalHeight) {
27
- console.warn(`<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties`);
26
+ if ((__DEV__ && !finalWidth) || !finalHeight) {
27
+ console.warn(`<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. ${`Image: ${(_b = data.id) !== null && _b !== void 0 ? _b : data.url}`}`);
28
28
  }
29
29
  let finalSrc = data.url;
30
30
  if (loader) {
@@ -34,17 +34,20 @@ function ShopifyImage({ data, width, height, loading, loader = shopifyImageLoade
34
34
  width: finalWidth,
35
35
  height: finalHeight,
36
36
  });
37
+ if (typeof finalSrc !== 'string' || !finalSrc) {
38
+ throw new Error(`<Image/>: 'loader' did not return a valid string. ${`Image: ${(_c = data.id) !== null && _c !== void 0 ? _c : data.url}`}`);
39
+ }
37
40
  }
38
41
  /* eslint-disable hydrogen/prefer-image-component */
39
- return (React.createElement("img", { id: (_a = data.id) !== null && _a !== void 0 ? _a : '', alt: (_c = (_b = data.altText) !== null && _b !== void 0 ? _b : rest.alt) !== null && _c !== void 0 ? _c : '', loading: loading !== null && loading !== void 0 ? loading : 'lazy', ...rest, src: finalSrc, width: finalWidth !== null && finalWidth !== void 0 ? finalWidth : undefined, height: finalHeight !== null && finalHeight !== void 0 ? finalHeight : undefined }));
42
+ return (React.createElement("img", { id: (_d = data.id) !== null && _d !== void 0 ? _d : '', alt: (_f = (_e = data.altText) !== null && _e !== void 0 ? _e : rest.alt) !== null && _f !== void 0 ? _f : '', loading: loading !== null && loading !== void 0 ? loading : 'lazy', ...rest, src: finalSrc, width: finalWidth !== null && finalWidth !== void 0 ? finalWidth : undefined, height: finalHeight !== null && finalHeight !== void 0 ? finalHeight : undefined }));
40
43
  /* eslint-enable hydrogen/prefer-image-component */
41
44
  }
42
45
  function ExternalImage({ src, width, height, alt, loader, loaderOptions, loading, ...rest }) {
43
46
  if (!width || !height) {
44
47
  throw new Error(`<Image/>: when 'src' is provided, 'width' and 'height' are required and need to be valid values (i.e. greater than zero). Provided values: 'src': ${src}, 'width': ${width}, 'height': ${height}`);
45
48
  }
46
- if (!alt) {
47
- console.warn(`<Image/>: when 'src' is provided, 'alt' should also be provided`);
49
+ if (__DEV__ && !alt) {
50
+ console.warn(`<Image/>: when 'src' is provided, 'alt' should also be provided. ${`Image: ${src}`}`);
48
51
  }
49
52
  let finalSrc = src;
50
53
  if (loader) {
@@ -12,8 +12,9 @@ import { ModelViewer } from '../ModelViewer';
12
12
  export function MediaFile({ data, options, ...passthroughProps }) {
13
13
  switch (data.mediaContentType) {
14
14
  case 'IMAGE': {
15
- const dataImage = data.image;
16
- if (!dataImage) {
15
+ const dataImage = data
16
+ .image;
17
+ if (!dataImage || !dataImage.url) {
17
18
  console.warn(`No "image" property was found on the "data" prop for <MediaFile/>, for the "type='image'"`);
18
19
  return null;
19
20
  }
@@ -1,19 +1,25 @@
1
- import type { MoneyV2 } from '../../storefront-api-types';
1
+ import React, { type ReactNode } from 'react';
2
+ import type { MoneyV2, UnitPriceMeasurement } from '../../storefront-api-types';
2
3
  import type { PartialDeep } from 'type-fest';
3
- interface MoneyProps<TTag> {
4
- /** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
5
- as?: TTag;
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;
6
7
  /** An object with fields that correspond to the Storefront API's [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2). */
7
8
  data: PartialDeep<MoneyV2>;
8
9
  /** Whether to remove the currency symbol from the output. */
9
10
  withoutCurrency?: boolean;
10
11
  /** Whether to remove trailing zeros (fractional money) from the output. */
11
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;
12
17
  }
18
+ declare type MoneyProps<ComponentGeneric extends React.ElementType> = CustomProps<ComponentGeneric> & Omit<React.ComponentPropsWithoutRef<ComponentGeneric>, keyof CustomProps<ComponentGeneric>>;
13
19
  /**
14
20
  * The `Money` component renders a string of the Storefront API's
15
21
  * [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the
16
22
  * `defaultLocale` in [the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
17
23
  */
18
- export declare function Money<TTag extends keyof JSX.IntrinsicElements = 'div'>(props: JSX.IntrinsicElements[TTag] & MoneyProps<TTag>): JSX.Element;
24
+ export declare function Money<TTag extends React.ElementType>({ data, as, withoutCurrency, withoutTrailingZeros, measurement, measurementSeparator, ...passthroughProps }: MoneyProps<TTag>): JSX.Element;
19
25
  export {};
@@ -5,8 +5,10 @@ import { useMoney } from '../../hooks';
5
5
  * [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the
6
6
  * `defaultLocale` in [the `hydrogen.config.js` file](https://shopify.dev/custom-storefronts/hydrogen/framework/hydrogen-config).
7
7
  */
8
- export function Money(props) {
9
- const { data, as, withoutCurrency, withoutTrailingZeros, ...passthroughProps } = props;
8
+ export function Money({ data, as, withoutCurrency, withoutTrailingZeros, measurement, measurementSeparator = '/', ...passthroughProps }) {
9
+ if (!isMoney(data)) {
10
+ throw new Error(`<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'`);
11
+ }
10
12
  const moneyObject = useMoney(data);
11
13
  const Wrapper = as !== null && as !== void 0 ? as : 'div';
12
14
  let output = moneyObject.localizedString;
@@ -22,5 +24,16 @@ export function Money(props) {
22
24
  output = moneyObject.withoutTrailingZerosAndCurrency;
23
25
  }
24
26
  }
25
- return React.createElement(Wrapper, { ...passthroughProps }, output);
27
+ return (React.createElement(Wrapper, { ...passthroughProps },
28
+ output,
29
+ measurement && measurement.referenceUnit && (React.createElement(React.Fragment, null,
30
+ measurementSeparator,
31
+ measurement.referenceUnit))));
32
+ }
33
+ // required in order to narrow the money object down and make TS happy
34
+ function isMoney(maybeMoney) {
35
+ return (typeof maybeMoney.amount === 'string' &&
36
+ !!maybeMoney.amount &&
37
+ typeof maybeMoney.currencyCode === 'string' &&
38
+ !!maybeMoney.currencyCode);
26
39
  }
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { Money } from '../Money';
3
- import { UnitPrice } from '../UnitPrice';
4
3
  export interface ProductPriceProps {
5
4
  /** The type of price. Valid values: `regular` (default) or `compareAt`. */
6
5
  priceType?: 'regular' | 'compareAt';
@@ -13,4 +12,4 @@ export interface ProductPriceProps {
13
12
  * The `ProductPrice` component renders a `Money` component with the product
14
13
  * [`priceRange`](https://shopify.dev/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range. It must be a descendent of the `ProductProvider` component.
15
14
  */
16
- export declare function ProductPrice<TTag extends keyof JSX.IntrinsicElements>(props: (Omit<React.ComponentProps<typeof UnitPrice>, 'data' | 'measurement'> | Omit<React.ComponentProps<typeof Money>, 'data'>) & ProductPriceProps): JSX.Element | null;
15
+ export declare function ProductPrice<TTag extends keyof JSX.IntrinsicElements>(props: Omit<React.ComponentProps<typeof Money>, 'data' | 'measurement'> & ProductPriceProps): JSX.Element | null;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Money } from '../Money';
3
3
  import { useProduct } from '../ProductProvider';
4
- import { UnitPrice } from '../UnitPrice';
5
4
  /**
6
5
  * The `ProductPrice` component renders a `Money` component with the product
7
6
  * [`priceRange`](https://shopify.dev/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range. It must be a descendent of the `ProductProvider` component.
@@ -51,7 +50,7 @@ export function ProductPrice(props) {
51
50
  return null;
52
51
  }
53
52
  if (measurement) {
54
- return (React.createElement(UnitPrice, { ...passthroughProps, data: price, measurement: measurement }));
53
+ return (React.createElement(Money, { ...passthroughProps, data: price, measurement: measurement }));
55
54
  }
56
55
  return React.createElement(Money, { ...passthroughProps, data: price });
57
56
  }
@@ -0,0 +1,3 @@
1
+ import type { DefaultPage } from './seo-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function NoIndexPageSeo({ title, titleTemplate, lang, }: PartialDeep<DefaultPage>): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { useShop } from '../../foundation';
3
+ import { Head } from '../../client';
4
+ export function NoIndexPageSeo({ title, titleTemplate, lang, }) {
5
+ const { languageCode: fallBacklang } = useShop();
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement(Head, { defaultTitle: title !== null && title !== void 0 ? title : '', titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
8
+ React.createElement("html", { lang: lang !== null && lang !== void 0 ? lang : fallBacklang }),
9
+ React.createElement("meta", { name: "robots", content: "noindex" }))));
10
+ }
@@ -2,6 +2,7 @@ import { type ComponentProps } from 'react';
2
2
  import { ProductSeo } from './ProductSeo.client';
3
3
  import { CollectionSeo } from './CollectionSeo.client';
4
4
  import { PageSeo } from './PageSeo.client';
5
+ import { NoIndexPageSeo } from './NoIndexSeo.client';
5
6
  import type { DefaultPage as DefaultPageType, HomePage as HomePageType } from './seo-types';
6
7
  declare type Props = {
7
8
  type: 'defaultSeo';
@@ -18,6 +19,9 @@ declare type Props = {
18
19
  } | {
19
20
  type: 'page';
20
21
  data: ComponentProps<typeof PageSeo>;
22
+ } | {
23
+ type: 'noindex';
24
+ data: ComponentProps<typeof NoIndexPageSeo>;
21
25
  };
22
26
  /**
23
27
  * The `Seo` component renders SEO information on a webpage.
@@ -5,6 +5,7 @@ import { HomePageSeo } from './HomePageSeo.client';
5
5
  import { ProductSeo } from './ProductSeo.client';
6
6
  import { CollectionSeo } from './CollectionSeo.client';
7
7
  import { PageSeo } from './PageSeo.client';
8
+ import { NoIndexPageSeo } from './NoIndexSeo.client';
8
9
  /**
9
10
  * The `Seo` component renders SEO information on a webpage.
10
11
  */
@@ -21,6 +22,8 @@ export function Seo(props) {
21
22
  return React.createElement(CollectionSeo, { ...props.data });
22
23
  case 'page':
23
24
  return React.createElement(PageSeo, { ...props.data });
25
+ case 'noindex':
26
+ return React.createElement(NoIndexPageSeo, { ...props.data });
24
27
  default:
25
28
  console.warn('The <Seo/> only accepts type prop with values of defaultSeo, homepage, product, collection, or page.');
26
29
  return null;
@@ -21,10 +21,7 @@ export { CartEstimatedCost } from './CartEstimatedCost';
21
21
  export { CartProvider, useCart, useInstantCheckout } from './CartProvider';
22
22
  export type { State, Status, Cart, CartWithActions, CartAction, } from './CartProvider';
23
23
  export { ProductProvider, useProduct } from './ProductProvider';
24
- export { ProductDescription } from './ProductDescription';
25
- export { ProductTitle } from './ProductTitle';
26
24
  export { ProductPrice } from './ProductPrice';
27
- export { ProductMetafield } from './ProductMetafield';
28
25
  export { BuyNowButton } from './BuyNowButton';
29
26
  export { ShopPayButton } from './ShopPayButton';
30
27
  export { useCountry } from '../hooks/useCountry';
@@ -19,10 +19,7 @@ export { CartShopPayButton } from './CartShopPayButton';
19
19
  export { CartEstimatedCost } from './CartEstimatedCost';
20
20
  export { CartProvider, useCart, useInstantCheckout } from './CartProvider';
21
21
  export { ProductProvider, useProduct } from './ProductProvider';
22
- export { ProductDescription } from './ProductDescription';
23
- export { ProductTitle } from './ProductTitle';
24
22
  export { ProductPrice } from './ProductPrice';
25
- export { ProductMetafield } from './ProductMetafield';
26
23
  export { BuyNowButton } from './BuyNowButton';
27
24
  export { ShopPayButton } from './ShopPayButton';
28
25
  export { useCountry } from '../hooks/useCountry';
@@ -1,3 +1,3 @@
1
- import type { HydrogenConfig } from './types';
2
- export declare const defineConfig: (params: HydrogenConfig) => HydrogenConfig;
3
- export type { HydrogenConfig };
1
+ import type { InlineHydrogenConfig } from './types';
2
+ export declare const defineConfig: (params: InlineHydrogenConfig) => InlineHydrogenConfig;
3
+ export type { InlineHydrogenConfig as HydrogenConfig };
@@ -1,6 +1,4 @@
1
- /* eslint-disable hydrogen/no-state-in-server-components */
2
1
  import React, { Suspense, useState, StrictMode, Fragment, } from 'react';
3
- // @ts-expect-error hydrateRoot isn't on the TS types yet, but we're using React 18 so it exists
4
2
  import { hydrateRoot } from 'react-dom/client';
5
3
  import { ErrorBoundary } from 'react-error-boundary';
6
4
  import { useServerResponse } from './framework/Hydration/rsc';
@@ -70,4 +68,3 @@ function Error({ error }) {
70
68
  React.createElement("a", { href: "/", style: { textDecoration: 'underline' } }, "home page"),
71
69
  "."))));
72
70
  }
73
- /* eslint-enable hydrogen/no-state-in-server-components */
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { Logger } from './utilities/log';
3
- import type { HydrogenConfig, ImportGlobEagerOutput } from './types';
3
+ import type { ImportGlobEagerOutput } from './types';
4
4
  import { ServerComponentResponse } from './framework/Hydration/ServerComponentResponse.server';
5
5
  import { ServerComponentRequest } from './framework/Hydration/ServerComponentRequest.server';
6
6
  import type { ServerResponse, IncomingMessage } from 'http';
@@ -22,7 +22,7 @@ interface RequestHandlerOptions {
22
22
  export interface RequestHandler {
23
23
  (request: Request | IncomingMessage, options: RequestHandlerOptions): Promise<Response | undefined>;
24
24
  }
25
- export declare const renderHydrogen: (App: any, hydrogenConfig?: HydrogenConfig | undefined) => RequestHandler;
25
+ export declare const renderHydrogen: (App: any) => RequestHandler;
26
26
  declare type SharedServerProps = {
27
27
  state?: object | null;
28
28
  request: ServerComponentRequest;