@shopify/hydrogen 0.11.0-experimental.2 → 0.11.1-experimental.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 (47) hide show
  1. package/CHANGELOG.md +505 -0
  2. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +2 -2
  3. package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +1 -1
  4. package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +1 -1
  5. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +13 -4
  6. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +3 -2
  7. package/dist/esnext/components/Metafield/Metafield.client.d.ts +3 -3
  8. package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +3 -3
  9. package/dist/esnext/components/Money/Money.client.d.ts +3 -3
  10. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.d.ts +2 -2
  11. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +2 -2
  12. package/dist/esnext/components/ProductTitle/ProductTitle.client.d.ts +1 -1
  13. package/dist/esnext/components/RawHtml/RawHtml.d.ts +3 -3
  14. package/dist/esnext/components/Seo/ProductSeo.client.js +3 -1
  15. package/dist/esnext/components/Seo/types.d.ts +1 -1
  16. package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +3 -3
  17. package/dist/esnext/entry-server.js +29 -23
  18. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -1
  19. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +43 -4
  20. package/dist/esnext/foundation/useQuery/hooks.d.ts +10 -2
  21. package/dist/esnext/foundation/useQuery/hooks.js +13 -3
  22. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +17 -1
  23. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +48 -0
  24. package/dist/esnext/hooks/useShopQuery/hooks.d.ts +10 -3
  25. package/dist/esnext/hooks/useShopQuery/hooks.js +2 -2
  26. package/dist/esnext/types.d.ts +1 -0
  27. package/dist/esnext/utilities/log/index.d.ts +1 -0
  28. package/dist/esnext/utilities/log/index.js +1 -0
  29. package/dist/esnext/utilities/log/log-query-timeline.d.ts +12 -0
  30. package/dist/esnext/utilities/log/log-query-timeline.js +83 -0
  31. package/dist/esnext/utilities/log/log.d.ts +1 -0
  32. package/dist/esnext/version.d.ts +1 -1
  33. package/dist/esnext/version.js +1 -1
  34. package/dist/node/entry-server.js +27 -21
  35. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -1
  36. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +45 -5
  37. package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +17 -1
  38. package/dist/node/framework/Hydration/ServerComponentRequest.server.js +48 -0
  39. package/dist/node/types.d.ts +1 -0
  40. package/dist/node/utilities/log/index.d.ts +1 -0
  41. package/dist/node/utilities/log/index.js +4 -1
  42. package/dist/node/utilities/log/log-query-timeline.d.ts +12 -0
  43. package/dist/node/utilities/log/log-query-timeline.js +88 -0
  44. package/dist/node/utilities/log/log.d.ts +1 -0
  45. package/package.json +3 -4
  46. package/web-polyfills.js +1 -0
  47. package/LICENSE.md +0 -7
package/CHANGELOG.md ADDED
@@ -0,0 +1,505 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
8
+ <!-- ## [Unreleased] -->
9
+
10
+ ## 0.11.1-experimental.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 11426471: Fix issue with components that take in the `as` prop not validating other props when a component is passed to `as`.
15
+ - b96179fd: Ensure ProductSeo knows how to handle `featuredImage = null`
16
+ - 2e487b7e: Switch to using Changesets for changelogs.
17
+ - 2d8ab7e2: Hydrogen docs: Preloaded queries and query timing
18
+
19
+ ### Fixed
20
+
21
+ - Make `featuredImage` optional and handle it in <Seo />
22
+
23
+ ## [0.11.0] - 2022-02-24
24
+
25
+ ### Added
26
+
27
+ - New React hook `useScriptLoader` is available to more easily load external scripts
28
+ - Add `totalQuantity` to the returned object from `useCart()`
29
+ - Export `ProductPrice` and `ProductMetafield` standalone components
30
+ - Added `useUrl` hook that allows the consumer to get the current url in server or client component
31
+ - Added logging option `showCacheApiStatus` and `cacheControlHeader` by @wizardlyhel in [#472](https://github.com/Shopify/hydrogen/pull/472)
32
+ - Pass HYDROGEN_ASSET_BASE_URL into config to set base URL for compiled assets
33
+ - Introduce Hydrogen the `<Link>` component and `useNavigate` hook for routing
34
+ - Add a default virtual entry-client in `/@shopify/hydrogen/entry-client` that can be used in `index.html`
35
+ - Enable early hydration when streaming
36
+ - Add variantId prop to `<ProductMetafield />` component [#730](https://github.com/Shopify/hydrogen/pull/730)
37
+ - Add query timing logging option `showQueryTiming` [#699](https://github.com/Shopify/hydrogen/pull/699)
38
+ - Add variantId prop to `<ProductPrice />` component
39
+ - Add `preload` option to `useQuery` and `useShopQuery` [#700](https://github.com/Shopify/hydrogen/pull/700)
40
+
41
+ ### Breaking Change
42
+
43
+ - `<Model3D>` has been renamed to `<ModelViewer>`
44
+ - `<Product />` and `<CartLine />` aliases have been removed; use the original components `<ProductProvider />` and `<CartLineProvider />` instead. Their nested component aliases, such as `<Product.Image />`, have also been removed; in this example you should use `<ProductImage />`.
45
+ - Merge `/src/entry-server.jsx` entry point into `App.server.jsx`
46
+ - The following components had their prop name renamed. Refer to the documentation or [#627](https://github.com/Shopify/hydrogen/issues/627) for more details.
47
+ - `<ExternalVideo />`: renamed video prop to data
48
+ - `<Video />`: renamed video prop to data
49
+ - `<Image>`: renamed image prop to data
50
+ - `<MediaFile>`: renamed media prop to data
51
+ - `<ModelViewer>`: renamed model prop to data
52
+ - `<Metafield>`: renamed metafield prop to data
53
+ - `<Money>`: renamed money prop to data
54
+ - `<UnitPrice>`: renamed unitPrice prop to data, unitPriceMeasurement prop to measurement
55
+ - `<ProductProvider>`: renamed product prop to data
56
+ - `<CartProvider>`: renamed cart prop to data
57
+ - Helmet component has been renamed to Head
58
+ - Remove the `<SelectedVariantBuyNowButton />` component in favour of using `<BuyNowButton variantId={product.selectedVariant.id} />`
59
+ - `<SelectedVariantAddToCartButton />` has been removed; the `<AddToCartButton />` will now use the selectedVariant by default.
60
+ - Remove the `<SelectedVariantImage />` component in favour of using `<Image data={product.selectedVariant.image} />`
61
+ - Remove the `<SelectedVariantMetafield />` component in favour of using `<ProductMetafield variantId={product.selectedVariant.id} />`
62
+ - Remove the `<SelectedVariantShopPayButton />` component in favour of using `<ShopPayButton variantId={product.selectedVariant.id} />`
63
+ - Remove the `<SelectedVariantPrice/>` and `<SelectedVariantUnitPrice/>` component in favour of using `<ProductPrice variantId={product.selectedVariant.id} />`
64
+
65
+ ### Changed
66
+
67
+ - Change `/react` RSC path to `/__rsc`
68
+ - `<ShopifyProvider>` can again be used in server components
69
+ - Use hashes as client component ids instead of absolute paths
70
+ - Transition away from deprecated currency selector in favor of country selector
71
+ - Simplify Helmet usage and make it compatible with RSC
72
+ - The `Seo.client` component has been moved from `src/components` to `@shopify/hydrogen`. The props of the `Seo.client` component also changed to always take in `type` and `data`. Refer to the [`Seo` component reference](../src/components/Seo/README.md) for more details. [#539](https://github.com/Shopify/hydrogen/pull/539)
73
+ - Standardize cache control header into caching strategies by @wizardlyhel in [#629](https://github.com/Shopify/hydrogen/pull/629)
74
+ - Target future release to use '2022-01' API Version
75
+ - Correct Typescript issue where `as` was a default prop for all components when it should not be
76
+ - Update types and docs for `useCart()` hook and `<CartProvider>`
77
+ - Track page load performance
78
+ - The following money components no longer allow the function-as-a-child (also known as "render props") pattern; see [#589](https://github.com/Shopify/hydrogen/pull/589)
79
+ - `<Money>` Use `useMoney()` for customization
80
+ - `<CartLinePrice>` Use `useMoney()` for customization
81
+ - `<ProductPrice>` Use `useMoney()` for customization
82
+ - `<SelectedVariantPrice>` Use `useMoney()` for customization
83
+ - `<Metafield>` Use `useParsedMetafields()` for customization
84
+ - `<ProductMetafield>` Use `useParsedMetafields()` for customization
85
+ - `<SelectedVariantMetafield>` Use `useParsedMetafields()` for customization
86
+ - `<UnitPrice>` Use `useMoney()` for customization
87
+ - `<CartLines>` Use `useCart()` for customization
88
+ - `<Metafield>` now renders `ratings` as a `<span>` with text instead of stars; `multi_line_text_field` inside of a `<span>` instead of a `<div>`
89
+ - Use `featureImage` instead of images(first:1) on product query
90
+ - Update `react-helmet-async` to 1.2.3 and remove our custom types
91
+
92
+ ### Fixed
93
+
94
+ - Fix index routes. See [#562](https://github.com/Shopify/hydrogen/issues/562)
95
+ - Fix missing server state on SSR pass
96
+ - Fix mobile navigation in example that scrolls the body underneath when shown by @Francismori7 in [#582](https://github.com/Shopify/hydrogen/pull/582)
97
+ - Add charset to content type in HTML responses
98
+ - Fix header shift when cart is opened by @Francismori7 in [#600](https://github.com/Shopify/hydrogen/pull/600)
99
+ - Fix bug where search param is not being pass along during RSC streaming call [#623](https://github.com/Shopify/hydrogen/pull/623)
100
+ - Allow custom entry-client filenames
101
+ - Clear browser fetch cache by @wizardlyhel in [#591](https://github.com/Shopify/hydrogen/pull/591)
102
+ - Cannot redefine property error when updating client components
103
+ - `ShopPayButton` supports quantities greater than 1. Also fixed issues with IDs in Storefront API version 2022-01
104
+ - Render error in `Gallery.client.jsx` component when product resource has an external video or no images.
105
+ - Ensure youtube external videos are embed compatible urls
106
+ - Prevent client components from being cached during development
107
+ - Backticks in HTML break RSC hydration.
108
+
109
+ ### Removed
110
+
111
+ - <CartLineSelectedOptions /> and <CartLineAttributes /> components. These components used the “function-as-a-child” pattern which doesn’t allow the `children` prop to be serialized, preventing them from being rendered within Server components.
112
+
113
+ _Migration_
114
+
115
+ The functionality provided by these components can be replicated using the `useCartLine()` hook instead.
116
+
117
+ _Example_
118
+
119
+ ```tsx
120
+ // Before
121
+ function SomeComponent() {
122
+ return (
123
+ <>
124
+ <CartLineSelectedOptions as="ul" className="text-xs space-y-1">
125
+ {({name, value}) => (
126
+ <>
127
+ {name}: {value}
128
+ </>
129
+ )}
130
+ </CartLineSelectedOptions>
131
+ <CartLineAttributes as="ul" className="text-sm space-y-1">
132
+ {({key, value}) => (
133
+ <>
134
+ {key}: {value}
135
+ </>
136
+ )}
137
+ </CartLineAttributes>
138
+ </>
139
+ );
140
+ }
141
+
142
+ // After
143
+ function SomeComponent() {
144
+ const {merchandise} = useCartLine();
145
+
146
+ return (
147
+ <>
148
+ <ul className="text-xs space-y-1">
149
+ {merchandise.selectedOptions.map(({name, value}) => (
150
+ <li key={name}>
151
+ {name}: {value}
152
+ </li>
153
+ ))}
154
+ </ul>
155
+ </>
156
+ );
157
+ }
158
+ ```
159
+
160
+ - Remove `fetch` workaround
161
+ - Remove the following hooks. (All the same functionality can be retrieved through the `useCart()` hook)
162
+ - `useCartAttributesUpdateCallback`
163
+ - `useCartBuyerIdentityUpdateCallback`
164
+ - `useCartCheckoutUrl`
165
+ - `useCartCreateCallback`
166
+ - `useCartDiscountCodesUpdateCallback`
167
+ - `useCartLinesAddCallback`
168
+ - `useCartLinesRemoveCallback`
169
+ - `useCartLinesTotalQuantity`
170
+ - `useCartLinesUpdateCallback`
171
+ - `useCartNoteUpdateCallback`
172
+ - Remove React Router on the client
173
+ - Remove `handleEvent` in favor of `handleRequest`
174
+ - Remove `assetHandler` parameter in the new `handleRequest`
175
+ - `<SelectedVariantAddToCartButton />` has been removed; the `<AddToCartButton />` will now use the selectedVariant by default.
176
+ - Remove the `<SelectedVariantImage />` component in favour of using `<Image data={product.selectedVariant.image} />`
177
+ - Remove the `<SelectedVariantMetafield />` component in favour of using `<ProductMetafield variantId={product.selectedVariant.id} />`
178
+ - Remove the `<SelectedVariantBuyNowButton />` component in favour of using `<BuyNowButton variantId={product.selectedVariant.id} />`
179
+ - Remove the `<SelectedVariantShopPayButton />` component in favour of using `<ShopPayButton variantId={product.selectedVariant.id} />`
180
+
181
+ ## [0.10.1] - 2022-01-26
182
+
183
+ ### Fixed
184
+
185
+ - Hot reload for newly added page files
186
+
187
+ ## [0.10.0] - 2022-01-25
188
+
189
+ ### Changed
190
+
191
+ - Warn instead of error when a page server component is missing valid exports
192
+ - Adopt upstream version of React Server Components. See [#498](https://github.com/Shopify/hydrogen/pull/498) for breaking changes
193
+ - Bump to latest version of React experimental to include [upstream context bugfix](https://github.com/facebook/react/issues/23089)
194
+ - Improve API routes by allowing [strings and JS objects](https://github.com/Shopify/hydrogen/issues/476) to be returned.
195
+
196
+ ### Breaking Change
197
+
198
+ - The 'locale' option in shopify.config.js had been renamed to 'defaultLocale'
199
+ - Rename `graphqlApiVersion` to `storefrontApiVersion` in `shopify.config.js`
200
+
201
+ ### Fixed
202
+
203
+ - Make sure that API routes [hot reload properly](https://github.com/Shopify/hydrogen/issues/497)
204
+
205
+ ## [0.9.1] - 2022-01-20
206
+
207
+ ### Changed
208
+
209
+ - Transitive dependency bump.
210
+
211
+ ## [0.9.0] - 2022-01-20
212
+
213
+ ### Added
214
+
215
+ - API routes 🎉
216
+
217
+ ### Changed
218
+
219
+ - Move to undici instead of node-fetch
220
+
221
+ ## [0.8.3] - 2022-01-13
222
+
223
+ ### Added
224
+
225
+ - Add optional `locale` param to `useShopQuery` to be used as `Accept-Language` in the store Storefront API query
226
+ - Optional purge query cache per build
227
+
228
+ ### Fixed
229
+
230
+ - Replace log abbreviations with full text.
231
+
232
+ ## [0.8.2] - 2022-01-07
233
+
234
+ ### Changed
235
+
236
+ - Warn when requests take longer than 3000ms instead of erroring
237
+ - `useQuery` returns an error if the query's fetch was unsuccessful
238
+ - `useShopQuery` will give error hints to look at `shopify.config.js` when the Storefront API responds with a 403
239
+
240
+ ### Fixed
241
+
242
+ - Load logger only once.
243
+ - Do not attempt to decode product IDs, as they are no longer base64-encoded in `unstable`
244
+
245
+ ## [0.8.1] - 2022-01-04
246
+
247
+ ### Added
248
+
249
+ - Detect bot user agents and give bots a non-streamed response.
250
+ - Add global `Oxygen.env` for server-only environment variables.
251
+ - Logging abstraction with default timing information
252
+
253
+ ### Changed
254
+
255
+ - Upgrade to latest React 18 experimental version
256
+
257
+ ### Fixed
258
+
259
+ - Cart decrease button removes at zero quantity
260
+
261
+ ## [0.8.0] - 2021-12-07
262
+
263
+ ### Fixed
264
+
265
+ - Export `CartLineSelectedOptions` properly
266
+ - Fix suspense utility function
267
+
268
+ ## [0.7.1] - 2021-12-02
269
+
270
+ ### Changed
271
+
272
+ - Allow `useShopQuery` to be skippable if no query is passed
273
+ - Remove usage of `react-query` (Not a breaking change)
274
+
275
+ ### Fixed
276
+
277
+ - Avoid repeating the same identifier for default and named exports
278
+ - Remove sourcemap warnings
279
+
280
+ ## [0.7.0] - 2021-11-22
281
+
282
+ ### Added
283
+
284
+ - Add file reference metafield support
285
+ - Allow custom Model3D poster
286
+ - Support synchronous server redirects
287
+
288
+ ### Fixed
289
+
290
+ - Binding of waitUntil in playground/server-components-worker
291
+ - Default to `retry: false` in `useQuery`
292
+ - Warn and ignore reserved properties in server state
293
+ - Run graphiql middleware before vite, fixing graphiql
294
+
295
+ ## [0.6.4] - 2021-11-11
296
+
297
+ ### Fixed
298
+
299
+ - Let Vite handle public assets in development
300
+ - New lines in hydration request break JSON.parse
301
+ - Normalize POSIX separators to support windows [#201](https://github.com/Shopify/hydrogen/pull/201)
302
+ - Scroll to top on app first load
303
+ - Update variantID to variantId [#78](https://github.com/Shopify/hydrogen/pull/78)
304
+
305
+ ## [0.6.3] - 2021-11-10
306
+
307
+ ### Fixed
308
+
309
+ - Add trailing slash to user components glob
310
+
311
+ ## [0.6.2] - 2021-11-10
312
+
313
+ ### Fixed
314
+
315
+ - Remove CartProvider from BuyNowButton
316
+ - Reading property of null for component props
317
+ - Transform deeply-imported client components
318
+ - Duplicated files and contexts in browser
319
+
320
+ ## [0.6.1] - 2021-11-08
321
+
322
+ ### Changed
323
+
324
+ - Transitive dependency bump.
325
+
326
+ ### Fixed
327
+
328
+ - Do not set headers after they are sent to client
329
+
330
+ ## [0.6.0] - 2021-11-05
331
+
332
+ ### Changed
333
+
334
+ - Disable the quantity adjust button when the cart is not idle
335
+ - Use country server state in cart for the inContext directive
336
+ - Use Image url field instead of deprecated originalSrc field
337
+ - Switch to unstable API
338
+
339
+ ### Fixed
340
+
341
+ - Update interaction prompt and interaction promp style attributes for Model3d
342
+ - Make sure all errors show an error dialog when hydrogen is in dev mode
343
+ - MediaFile component warning on non-Model3D types
344
+ - Remove console logs for caching
345
+ - Lowercased SVG tags in RSC
346
+ - Make the URL search property available via hooks
347
+
348
+ ## 0.5.8 - 2021-11-04
349
+
350
+ ### Fixed
351
+
352
+ - Ensure delayed callback is fired for cache purposes in Workers runtimes.
353
+
354
+ ## 0.5.3 - 2021-11-02
355
+
356
+ ### Changed
357
+
358
+ - No updates. Transitive dependency bump.
359
+
360
+ ## 0.5.2 - 2021-11-02
361
+
362
+ ### Changed
363
+
364
+ - No updates. Transitive dependency bump.
365
+
366
+ ## 0.5.1 - 2021-11-02
367
+
368
+ ### Changed
369
+
370
+ - No updates. Transitive dependency bump.
371
+
372
+ ## 0.5.0 - 2021-11-01
373
+
374
+ ### Fixed
375
+
376
+ - Update the ServerStateProvider context
377
+ - Add tabIndex to ShopPayButton
378
+ - Update LocalizationProvider query, context, and exports
379
+
380
+ ## 0.4.3 - 2021-10-29
381
+
382
+ ### Added
383
+
384
+ - Introduct full-page and sub-request caching API.
385
+
386
+ ## 0.4.2 - 2021-10-29
387
+
388
+ ### Changed
389
+
390
+ - Update Model3D props and add binding to model-viewer events
391
+
392
+ ### Fixed
393
+
394
+ - Add `passthoughProps.disabled` to `AddToCartButton`
395
+ - Do not show undefined currency symbol in production
396
+
397
+ ## 0.4.0 - 2021-10-27
398
+
399
+ ### Added
400
+
401
+ - Add external image support to Image component
402
+
403
+ ### Changed
404
+
405
+ - Make `CartProvider` a client-only concern. [#631](https://github.com/Shopify/hydrogen/pull/631)
406
+ - Use `Accept: application/hydrogen` as a header when making `fetch` calls against a Hydrogen page. Useful for Custom Responses.
407
+
408
+ ### Fixed
409
+
410
+ - Lock model-viewer.js version to 1.8
411
+ - Use the Intl.NumberFormat parts for determining the amount value returned by the useMoney hook
412
+ - Optimize React related dependencies at server start to avoid page reloads
413
+ - Do not throw when `storeDomain` contains protocol.
414
+
415
+ ## 0.3.0 - 2021-10-20
416
+
417
+ ### Added
418
+
419
+ - Export utilities in client bundle
420
+
421
+ ### Fixed
422
+
423
+ - `parseCookies` will split only on first =
424
+ - Make BuyNowButton a client component since it uses useEffect
425
+ - Preserve original aspect ratio for product images
426
+ - Invoke CartProvider callbacks before performing the GraphQL mutations
427
+ - Fix the accessible label in the AddToCartButton component when an item is added to cart
428
+ - Cart fetch to return stringified error
429
+
430
+ ### Removed
431
+
432
+ - Remove sourcemap warnings
433
+
434
+ ## 0.2.1 - 2021-10-12
435
+
436
+ ### Fixed
437
+
438
+ - Starter template GalleryPreview unique key warning
439
+ - Mitigation for upcoming breaking minor Vite update
440
+
441
+ ## 0.2.0 - 2021-10-08
442
+
443
+ ### Added
444
+
445
+ - Added support for images and collections in the ProductProvider component
446
+ - Added more GraphQL fragments for building block components (Metafield, UnitPrice) and updated exports of these fragments
447
+
448
+ ### Breaking Change
449
+
450
+ - `useQuery` now behaves exactly like [react-query's hook of the same name](https://react-query.tanstack.com/reference/useQuery#_top)
451
+
452
+ ### Fixed
453
+
454
+ - Handle products with selling plans
455
+
456
+ ## 0.1.2 - 2021-09-30
457
+
458
+ ### Fixed
459
+
460
+ - SSR issue when running Vite 2.6
461
+ - Occasional `ProductProviderFragment` error when booting Hydrogen dev server [#571](https://github.com/Shopify/hydrogen/issues/571)
462
+
463
+ ## 0.1.1 - 2021-09-24
464
+
465
+ ### Added
466
+
467
+ - New GraphQL fragments for Variants, SellingPlans, and SellingPlanGroups
468
+
469
+ ### Changed
470
+
471
+ - Updated types for the `useProductOptions` hook
472
+
473
+ ### Fixed
474
+
475
+ - `Dynamic require of "stream" is not supported` error in browser logs
476
+
477
+ ## 0.1.0 - 2021-09-23
478
+
479
+ ### Changed
480
+
481
+ - No updates. Transitive dependency bump.
482
+
483
+ ## 1.0.0-alpha.22 - 2021-09-22
484
+
485
+ ### Changed
486
+
487
+ - No updates. Transitive dependency bump.
488
+
489
+ [0.6.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.0
490
+ [0.6.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.1
491
+ [0.6.2]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.2
492
+ [0.6.3]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.3
493
+ [0.6.4]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.4
494
+ [0.7.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.7.0
495
+ [0.7.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.7.1
496
+ [0.8.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.0
497
+ [0.8.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.1
498
+ [0.8.2]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.2
499
+ [0.8.3]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.3
500
+ [0.9.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.9.0
501
+ [0.9.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.9.1
502
+ [0.10.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.10.0
503
+ [0.10.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.10.1
504
+ [0.11.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.11.0
505
+ [unreleased]: https://github.com/Shopify/hydrogen/compare/v0.11.0...HEAD
@@ -1,7 +1,7 @@
1
1
  import { ElementType } from 'react';
2
2
  import { MoneyProps } from '../Money';
3
3
  import { Props } from '../types';
4
- export interface CartLinePriceProps extends Omit<MoneyProps, 'data'> {
4
+ export interface CartLinePriceProps<TTag> extends Omit<MoneyProps<TTag>, 'data'> {
5
5
  /** The type of price. Valid values:`regular` (default) or `compareAt`. */
6
6
  priceType?: 'regular' | 'compareAt';
7
7
  }
@@ -9,4 +9,4 @@ export interface CartLinePriceProps extends Omit<MoneyProps, 'data'> {
9
9
  * The `CartLinePrice` component renders a `Money` component for the cart line merchandise's price or
10
10
  * compare at price. It must be a descendent of a `CartLineProvider` component.
11
11
  */
12
- export declare function CartLinePrice<TTag extends ElementType>(props: Props<TTag> & CartLinePriceProps): JSX.Element | null;
12
+ export declare function CartLinePrice<TTag extends ElementType>(props: Props<TTag> & CartLinePriceProps<TTag>): JSX.Element | null;
@@ -6,5 +6,5 @@ import { Props } from '../types';
6
6
  */
7
7
  export declare function CartLineProductTitle<TTag extends ElementType>(props: Props<TTag> & {
8
8
  /** An HTML tag to be rendered as the base element wrapper. The default is `span`. */
9
- as?: ElementType;
9
+ as?: TTag;
10
10
  }): JSX.Element;
@@ -6,5 +6,5 @@ import { Props } from '../types';
6
6
  */
7
7
  export declare function CartLineQuantity<TTag extends ElementType>(props: Props<TTag> & {
8
8
  /** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
9
- as?: ElementType;
9
+ as?: TTag;
10
10
  }): JSX.Element;
@@ -1,4 +1,15 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, ElementType } from 'react';
2
+ import { PreloadOptions } from '../../types';
3
+ import { Props } from '../types';
4
+ export interface LocalizationProviderProps {
5
+ /** A `ReactNode` element. */
6
+ children: ReactNode;
7
+ /** Whether to preload the query. Defaults to `false`. Specify `true` to
8
+ * [preload the query](/custom-storefronts/hydrogen/framework/preloaded-queries) for the URL
9
+ * or `'*'` to preload the query for all requests.
10
+ */
11
+ preload: PreloadOptions;
12
+ }
2
13
  /**
3
14
  * The `LocalizationProvider` component automatically queries the Storefront API's
4
15
  * [`localization`](/api/storefront/reference/common-objects/queryroot) field
@@ -8,6 +19,4 @@ import { ReactNode } from 'react';
8
19
  * The `isoCode` of the `country` can be used in the Storefront API's
9
20
  * `@inContext` directive as the `country` value.
10
21
  */
11
- export declare function LocalizationProvider({ children }: {
12
- children: ReactNode;
13
- }): JSX.Element;
22
+ export declare function LocalizationProvider<TTag extends ElementType>(props: Props<TTag> & LocalizationProviderProps): JSX.Element;
@@ -12,10 +12,11 @@ import { CacheDays } from '../../framework/CachingStrategy';
12
12
  * The `isoCode` of the `country` can be used in the Storefront API's
13
13
  * `@inContext` directive as the `country` value.
14
14
  */
15
- export function LocalizationProvider({ children }) {
15
+ export function LocalizationProvider(props) {
16
16
  const { data: { localization }, } = useShopQuery({
17
17
  query: Localization,
18
18
  cache: CacheDays(),
19
+ preload: props.preload,
19
20
  });
20
- return (React.createElement(LocalizationClientProvider, { localization: localization }, children));
21
+ return (React.createElement(LocalizationClientProvider, { localization: localization }, props.children));
21
22
  }
@@ -1,11 +1,11 @@
1
1
  import { ElementType } from 'react';
2
2
  import { Props } from '../types';
3
3
  import { ParsedMetafield } from '../../types';
4
- export interface MetafieldProps {
4
+ export interface MetafieldProps<TTag> {
5
5
  /** A [Metafield object](/api/storefront/reference/common-objects/metafield) from the Storefront API. */
6
6
  data: ParsedMetafield;
7
7
  /** An HTML tag to be rendered as the base element wrapper. The default value varies depending on [metafield.type](/apps/metafields/types). */
8
- as?: ElementType;
8
+ as?: TTag;
9
9
  }
10
10
  /**
11
11
  * The `Metafield` component renders the value of a Storefront
@@ -14,7 +14,7 @@ export interface MetafieldProps {
14
14
  * Renders a smart default of the
15
15
  * Metafield's `value`. For more information, refer to the [Default Output](#default-output) section.
16
16
  */
17
- export declare function Metafield<TTag extends ElementType>(props: Props<TTag> & MetafieldProps): JSX.Element | null;
17
+ export declare function Metafield<TTag extends ElementType>(props: Props<TTag> & MetafieldProps<TTag>): JSX.Element | null;
18
18
  export declare namespace Metafield {
19
19
  var Fragment: string;
20
20
  }
@@ -3,12 +3,12 @@ import { Props } from '../../../types';
3
3
  import { Rating } from '../../../../types';
4
4
  export declare const STAR_EMPTY = "\u2606";
5
5
  export declare const STAR_FILLED = "\u2605";
6
- export interface StarRatingProps {
6
+ export interface StarRatingProps<TTag> {
7
7
  rating: Rating;
8
8
  /** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
9
- as?: ElementType;
9
+ as?: TTag;
10
10
  }
11
- export declare function StarRating<TTag extends ElementType>(props: Props<TTag> & StarRatingProps): JSX.Element;
11
+ export declare function StarRating<TTag extends ElementType>(props: Props<TTag> & StarRatingProps<TTag>): JSX.Element;
12
12
  export declare function Star({ percentFilled }: {
13
13
  percentFilled: number;
14
14
  }): JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import { ElementType } from 'react';
2
2
  import { Props } from '../types';
3
3
  import { MoneyV2 } from '../../graphql/types/types';
4
- export interface MoneyProps {
4
+ export interface MoneyProps<TTag> {
5
5
  /** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
6
- as?: ElementType;
6
+ as?: TTag;
7
7
  /** A [`MoneyV2` object](/api/storefront/reference/common-objects/moneyv2). */
8
8
  data: MoneyV2;
9
9
  }
@@ -12,7 +12,7 @@ export interface MoneyProps {
12
12
  * [`MoneyV2` object](/api/storefront/reference/common-objects/moneyv2) according to the
13
13
  * `defaultLocale` in the `shopify.config.js` file.
14
14
  */
15
- export declare function Money<TTag extends ElementType>(props: Props<TTag> & MoneyProps): JSX.Element;
15
+ export declare function Money<TTag extends ElementType>(props: Props<TTag> & MoneyProps<TTag>): JSX.Element;
16
16
  export declare namespace Money {
17
17
  var Fragment: string;
18
18
  }
@@ -1,7 +1,7 @@
1
1
  import { ElementType } from 'react';
2
2
  import { Props } from '../types';
3
3
  import { MetafieldProps } from '../Metafield/Metafield.client';
4
- export interface ProductMetafieldProps extends Omit<MetafieldProps, 'metafield'> {
4
+ export interface ProductMetafieldProps<TTag> extends Omit<MetafieldProps<TTag>, 'metafield'> {
5
5
  /** A string corresponding to the [key](/api/storefront/reference/common-objects/metafield) of the product's
6
6
  * metafield.
7
7
  */
@@ -18,4 +18,4 @@ export interface ProductMetafieldProps extends Omit<MetafieldProps, 'metafield'>
18
18
  * [`Metafield`](/api/hydrogen/components/primitive/metafield) component with the product metafield.
19
19
  * It must be a descendent of a `ProductProvider` component.
20
20
  */
21
- export declare function ProductMetafield<TTag extends ElementType>(props: Props<TTag> & Omit<ProductMetafieldProps, 'data'>): JSX.Element | null;
21
+ export declare function ProductMetafield<TTag extends ElementType>(props: Props<TTag> & Omit<ProductMetafieldProps<TTag>, 'data'>): JSX.Element | null;
@@ -1,7 +1,7 @@
1
1
  import { ElementType } from 'react';
2
2
  import { MoneyProps } from '../Money';
3
3
  import { Props } from '../types';
4
- export interface ProductPriceProps extends Omit<MoneyProps, 'data'> {
4
+ export interface ProductPriceProps<TTag> extends Omit<MoneyProps<TTag>, 'data'> {
5
5
  /** The type of price. Valid values: `regular` (default) or `compareAt`. */
6
6
  priceType?: 'regular' | 'compareAt';
7
7
  /** The type of value. Valid values: `min` (default), `max` or `unit`. */
@@ -13,4 +13,4 @@ export interface ProductPriceProps extends Omit<MoneyProps, 'data'> {
13
13
  * The `ProductPrice` component renders a `Money` component with the product
14
14
  * [`priceRange`](/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
15
  */
16
- export declare function ProductPrice<TTag extends ElementType>(props: Props<TTag> & ProductPriceProps): JSX.Element | null;
16
+ export declare function ProductPrice<TTag extends ElementType>(props: Props<TTag> & ProductPriceProps<TTag>): JSX.Element | null;
@@ -9,5 +9,5 @@ export declare function ProductTitle<TTag extends ElementType = 'span'>(props: P
9
9
  /** An HTML tag to wrap the title. If not specified, then the
10
10
  * title is wrapped in a `span` element.
11
11
  */
12
- as?: ElementType;
12
+ as?: TTag;
13
13
  }): JSX.Element | null;