diff --git a/.changeset/eight-poems-explode.md b/.changeset/eight-poems-explode.md deleted file mode 100644 index 27fe03b632..0000000000 --- a/.changeset/eight-poems-explode.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Add optional headers param for logout redirect diff --git a/.changeset/funny-cows-perform.md b/.changeset/funny-cows-perform.md deleted file mode 100644 index 08a6dbd1ee..0000000000 --- a/.changeset/funny-cows-perform.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch ---- - -Stabilize `getSitemap`, `getSitemapIndex` and implement on skeleton - -1. Update the `getSitemapIndex` at `/app/routes/[sitemap.xml].tsx` - -```diff -- import {unstable__getSitemapIndex as getSitemapIndex} from '@shopify/hydrogen'; -+ import {getSitemapIndex} from '@shopify/hydrogen'; -``` - -2. Update the `getSitemap` at `/app/routes/sitemap.$type.$page[.xml].tsx` - -```diff -- import {unstable__getSitemap as getSitemap} from '@shopify/hydrogen'; -+ import {getSitemap} from '@shopify/hydrogen'; -``` - -For a reference implementation please see the skeleton template sitemap routes diff --git a/.changeset/gorgeous-berries-matter.md b/.changeset/gorgeous-berries-matter.md deleted file mode 100644 index be5e1a1ec2..0000000000 --- a/.changeset/gorgeous-berries-matter.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen-codegen': patch ---- - -Checks anywhere in generated filename for "customer" or "caapi" diff --git a/.changeset/gorgeous-paws-move.md b/.changeset/gorgeous-paws-move.md deleted file mode 100644 index 9d4c464f4e..0000000000 --- a/.changeset/gorgeous-paws-move.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/cli-hydrogen': minor ---- - -Remove deprecated --worker cli flag diff --git a/.changeset/modern-suits-shop.md b/.changeset/modern-suits-shop.md deleted file mode 100644 index e400435510..0000000000 --- a/.changeset/modern-suits-shop.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@shopify/hydrogen-react': patch -'@shopify/hydrogen': patch ---- - -Update `` to remove deprecated code usage for `priceV2` and `compareAtPriceV2`. Remove export for `getCustomerPrivacy`. diff --git a/.changeset/olive-fishes-reflect.md b/.changeset/olive-fishes-reflect.md deleted file mode 100644 index e0b166d071..0000000000 --- a/.changeset/olive-fishes-reflect.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch ---- - -[**Breaking change**] - -Set up Customer Privacy without the Shopify's cookie banner by default. - -If you are using Shopify's cookie banner to handle user consent in your app, you need to set `withPrivacyBanner: true` to the consent config. Without this update, the Shopify cookie banner will not appear. - -```diff - return defer({ - ... - consent: { - checkoutDomain: env.PUBLIC_CHECKOUT_DOMAIN, - storefrontAccessToken: env.PUBLIC_STOREFRONT_API_TOKEN, -+ withPrivacyBanner: true, - // localize the privacy banner - country: args.context.storefront.i18n.country, - language: args.context.storefront.i18n.language, - }, - }); -``` diff --git a/.changeset/quick-carrots-perform.md b/.changeset/quick-carrots-perform.md deleted file mode 100644 index 8b309ce1d2..0000000000 --- a/.changeset/quick-carrots-perform.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/cli-hydrogen': patch ---- - -Add warnings to the Shopify CLI when your app uses reserved routes. These routes are reserved by Oxygen, and any local routes that conflict with them will not be used. diff --git a/.changeset/quick-hotels-tell.md b/.changeset/quick-hotels-tell.md deleted file mode 100644 index e0af5f426c..0000000000 --- a/.changeset/quick-hotels-tell.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@shopify/hydrogen-react': patch -'skeleton': patch -'@shopify/hydrogen': patch ---- - -Update to 2024-10 SFAPI diff --git a/.changeset/rare-carpets-rush.md b/.changeset/rare-carpets-rush.md deleted file mode 100644 index a23ab10ef3..0000000000 --- a/.changeset/rare-carpets-rush.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@shopify/create-hydrogen': patch -'@shopify/remix-oxygen': patch ---- - -Bump package versions diff --git a/.changeset/serious-pillows-hug.md b/.changeset/serious-pillows-hug.md deleted file mode 100644 index edb2da2ad7..0000000000 --- a/.changeset/serious-pillows-hug.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch ---- - -[**Breaking change**] - -Update `createWithCache` to make it harder to accidentally cache undesired results. `request` is now mandatory prop when initializing `createWithCache`. - -```diff -// server.ts -export default { - async fetch( - request: Request, - env: Env, - executionContext: ExecutionContext, - ): Promise { - try { - // ... -- const withCache = createWithCache({cache, waitUntil}); -+ const withCache = createWithCache({cache, waitUntil, request}); -``` - -`createWithCache` now returns an object with two utility functions: `withCache.run` and `withCache.fetch`. Both have a new prop `shouldCacheResult` that must be defined. - -The original `withCache` callback function is now `withCache.run`. This is useful to run *multiple* fetch calls and merge their responses, or run any arbitrary code. It caches anything you return, but you can throw if you don't want to cache anything. - -```diff - const withCache = createWithCache({cache, waitUntil, request}); - - const fetchMyCMS = (query) => { -- return withCache(['my-cms', query], CacheLong(), async (params) => { -+ return withCache.run({ -+ cacheKey: ['my-cms', query], -+ cacheStrategy: CacheLong(), -+ // Cache if there are no data errors or a specific data that make this result not suited for caching -+ shouldCacheResult: (result) => !result?.errors, -+ }, async(params) => { - const response = await fetch('my-cms.com/api', { - method: 'POST', - body: query, - }); - if (!response.ok) throw new Error(response.statusText); - const {data, error} = await response.json(); - if (error || !data) throw new Error(error ?? 'Missing data'); - params.addDebugData({displayName: 'My CMS query', response}); - return data; - }); - }; -``` - -New `withCache.fetch` is for caching simple fetch requests. This method caches the responses if they are OK responses, and you can pass `shouldCacheResponse`, `cacheKey`, etc. to modify behavior. `data` is the consumed body of the response (we need to consume to cache it). - -```ts - const withCache = createWithCache({cache, waitUntil, request}); - - const {data, response} = await withCache.fetch<{data: T; error: string}>( - 'my-cms.com/api', - { - method: 'POST', - headers: {'Content-type': 'application/json'}, - body, - }, - { - cacheStrategy: CacheLong(), - // Cache if there are no data errors or a specific data that make this result not suited for caching - shouldCacheResponse: (result) => !result?.error, - cacheKey: ['my-cms', body], - displayName: 'My CMS query', - }, - ); -``` diff --git a/.changeset/strange-zebras-travel.md b/.changeset/strange-zebras-travel.md deleted file mode 100644 index 204f08c193..0000000000 --- a/.changeset/strange-zebras-travel.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch ---- - -[**Breaking change**] - -Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. - -1. Update your product graphql query to use the new `optionValues` field. - -```diff - const PRODUCT_FRAGMENT = `#graphql - fragment Product on Product { - id - title - options { - name -- values -+ optionValues { -+ name -+ } - } -``` - -2. Update your `` to use the new `optionValues` field. - -```diff - option.values.length > 1)} -+ options={product.options.filter((option) => option.optionValues.length > 1)} - variants={variants} - > -``` diff --git a/.changeset/wet-garlics-trade.md b/.changeset/wet-garlics-trade.md deleted file mode 100644 index bdeae0f906..0000000000 --- a/.changeset/wet-garlics-trade.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@shopify/hydrogen': patch -'@shopify/hydrogen-react': patch ---- - -Add utility functions `decodeEncodedVariant` and `isOptionValueCombinationInEncodedVariant` for parsing `product.encodedVariantExistence` and `product.encodedVariantAvailability` fields. diff --git a/.changeset/wicked-schools-reflect.md b/.changeset/wicked-schools-reflect.md deleted file mode 100644 index b0389a11ae..0000000000 --- a/.changeset/wicked-schools-reflect.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -[**Breaking change**] - -Update all cart mutation methods from `createCartHandler` to return cart warnings. - -As of API version 2024-10, inventory errors about stock levels will no longer be included in the `userErrors` of cart mutations. Inventory errors will now be available in a new return field `warnings` and will contain explicit code values of `MERCHANDISE_NOT_ENOUGH_STOCK` or `MERCHANDISE_OUT_OF_STOCK`. Reference: https://shopify.dev/changelog/cart-warnings-in-storefront-api-cart diff --git a/.changeset/yellow-toes-mix.md b/.changeset/yellow-toes-mix.md deleted file mode 100644 index 81651a1e6e..0000000000 --- a/.changeset/yellow-toes-mix.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -'@shopify/mini-oxygen': minor ---- - -[**Breaking change**] - -Support worker compatibility date that aligns with SFAPI release. - -Starting from this major version, on each deploy to Oxygen, Hydrogen will be on Cloudflare worker compatibility date `2024-10-01`. Onwards, Hydrogen will update worker compatibility date on every SFAPI release. - -There is no specific project update that needs to be done in order to get this feature. However, please ensure your project is working properly in an Oxygen deployment when updating to this Hydrogen version. ([#2380](https://github.com/Shopify/hydrogen/pull/2380)) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 4d2179db0d..5f3233e325 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,19 @@ # @shopify/cli-hydrogen +## 9.0.0 + +### Minor Changes + +- Remove deprecated --worker cli flag ([#2603](https://github.com/Shopify/hydrogen/pull/2603)) by [@rbshop](https://github.com/rbshop) + +### Patch Changes + +- Add warnings to the Shopify CLI when your app uses reserved routes. These routes are reserved by Oxygen, and any local routes that conflict with them will not be used. ([#2613](https://github.com/Shopify/hydrogen/pull/2613)) by [@blittle](https://github.com/blittle) + +- Updated dependencies [[`a0f660aa`](https://github.com/Shopify/hydrogen/commit/a0f660aac56a5c3c41502c17d2ed44d3468ee6aa), [`29876f12`](https://github.com/Shopify/hydrogen/commit/29876f12c39ed23b0b80443769e566d29e84b56c)]: + - @shopify/hydrogen-codegen@0.3.2 + - @shopify/mini-oxygen@3.1.0 + ## 8.4.6 ### Patch Changes diff --git a/packages/cli/oclif.manifest.json b/packages/cli/oclif.manifest.json index edea7fe98f..e56ebad0a4 100644 --- a/packages/cli/oclif.manifest.json +++ b/packages/cli/oclif.manifest.json @@ -1748,5 +1748,5 @@ ] } }, - "version": "8.4.6" + "version": "9.0.0" } \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index 555d2f6dbd..7a5a54a16a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -4,7 +4,7 @@ "access": "public", "@shopify:registry": "https://registry.npmjs.org" }, - "version": "8.4.6", + "version": "9.0.0", "license": "MIT", "type": "module", "scripts": { @@ -55,8 +55,8 @@ "peerDependencies": { "@graphql-codegen/cli": "^5.0.2", "@remix-run/dev": "^2.1.0", - "@shopify/hydrogen-codegen": "^0.3.1", - "@shopify/mini-oxygen": "^3.0.6", + "@shopify/hydrogen-codegen": "^0.3.2", + "@shopify/mini-oxygen": "^3.1.0", "graphql-config": "^5.0.3", "vite": "^5.1.0" }, diff --git a/packages/create-hydrogen/CHANGELOG.md b/packages/create-hydrogen/CHANGELOG.md index 6971b2ef1b..438e4e2420 100644 --- a/packages/create-hydrogen/CHANGELOG.md +++ b/packages/create-hydrogen/CHANGELOG.md @@ -1,5 +1,11 @@ # @shopify/create-hydrogen +## 5.0.10 + +### Patch Changes + +- Bump package versions by [@wizardlyhel](https://github.com/wizardlyhel) + ## 5.0.9 ### Patch Changes diff --git a/packages/create-hydrogen/package.json b/packages/create-hydrogen/package.json index ddfd791494..cb4d75e2d3 100644 --- a/packages/create-hydrogen/package.json +++ b/packages/create-hydrogen/package.json @@ -5,7 +5,7 @@ "@shopify:registry": "https://registry.npmjs.org" }, "license": "MIT", - "version": "5.0.9", + "version": "5.0.10", "type": "module", "scripts": { "build": "tsup --clean", diff --git a/packages/hydrogen-codegen/CHANGELOG.md b/packages/hydrogen-codegen/CHANGELOG.md index 9648eb51c4..ca68823bc0 100644 --- a/packages/hydrogen-codegen/CHANGELOG.md +++ b/packages/hydrogen-codegen/CHANGELOG.md @@ -1,5 +1,11 @@ # @shopify/hydrogen-codegen +## 0.3.2 + +### Patch Changes + +- Checks anywhere in generated filename for "customer" or "caapi" ([#2600](https://github.com/Shopify/hydrogen/pull/2600)) by [@weotch](https://github.com/weotch) + ## 0.3.1 ### Patch Changes diff --git a/packages/hydrogen-codegen/package.json b/packages/hydrogen-codegen/package.json index 475ad6cd48..e8bd836efa 100644 --- a/packages/hydrogen-codegen/package.json +++ b/packages/hydrogen-codegen/package.json @@ -4,7 +4,7 @@ "access": "public", "@shopify:registry": "https://registry.npmjs.org" }, - "version": "0.3.1", + "version": "0.3.2", "license": "MIT", "type": "module", "main": "dist/cjs/index.cjs", diff --git a/packages/hydrogen-react/CHANGELOG.md b/packages/hydrogen-react/CHANGELOG.md index 2b3db2c36d..408d1208a9 100644 --- a/packages/hydrogen-react/CHANGELOG.md +++ b/packages/hydrogen-react/CHANGELOG.md @@ -1,5 +1,15 @@ # @shopify/hydrogen-react +## 2024.10.0 + +### Patch Changes + +- Update `` to remove deprecated code usage for `priceV2` and `compareAtPriceV2`. Remove export for `getCustomerPrivacy`. ([#2601](https://github.com/Shopify/hydrogen/pull/2601)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Update to 2024-10 SFAPI ([#2570](https://github.com/Shopify/hydrogen/pull/2570)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Add utility functions `decodeEncodedVariant` and `isOptionValueCombinationInEncodedVariant` for parsing `product.encodedVariantExistence` and `product.encodedVariantAvailability` fields. ([#2425](https://github.com/Shopify/hydrogen/pull/2425)) by [@lhoffbeck](https://github.com/lhoffbeck) + ## 2024.7.6 ### Patch Changes diff --git a/packages/hydrogen/CHANGELOG.md b/packages/hydrogen/CHANGELOG.md index 2ec546749b..dc46aca5f4 100644 --- a/packages/hydrogen/CHANGELOG.md +++ b/packages/hydrogen/CHANGELOG.md @@ -1,5 +1,163 @@ # @shopify/hydrogen +## 2024.10.0 + +### Patch Changes + +- Add optional headers param for logout redirect ([#2602](https://github.com/Shopify/hydrogen/pull/2602)) by [@coryagami](https://github.com/coryagami) + +- Stabilize `getSitemap`, `getSitemapIndex` and implement on skeleton ([#2589](https://github.com/Shopify/hydrogen/pull/2589)) by [@juanpprieto](https://github.com/juanpprieto) + + 1. Update the `getSitemapIndex` at `/app/routes/[sitemap.xml].tsx` + + ```diff + - import {unstable__getSitemapIndex as getSitemapIndex} from '@shopify/hydrogen'; + + import {getSitemapIndex} from '@shopify/hydrogen'; + ``` + + 2. Update the `getSitemap` at `/app/routes/sitemap.$type.$page[.xml].tsx` + + ```diff + - import {unstable__getSitemap as getSitemap} from '@shopify/hydrogen'; + + import {getSitemap} from '@shopify/hydrogen'; + ``` + + For a reference implementation please see the skeleton template sitemap routes + +- Update `` to remove deprecated code usage for `priceV2` and `compareAtPriceV2`. Remove export for `getCustomerPrivacy`. ([#2601](https://github.com/Shopify/hydrogen/pull/2601)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- [**Breaking change**] ([#2588](https://github.com/Shopify/hydrogen/pull/2588)) by [@wizardlyhel](https://github.com/wizardlyhel) + + Set up Customer Privacy without the Shopify's cookie banner by default. + + If you are using Shopify's cookie banner to handle user consent in your app, you need to set `withPrivacyBanner: true` to the consent config. Without this update, the Shopify cookie banner will not appear. + + ```diff + return defer({ + ... + consent: { + checkoutDomain: env.PUBLIC_CHECKOUT_DOMAIN, + storefrontAccessToken: env.PUBLIC_STOREFRONT_API_TOKEN, + + withPrivacyBanner: true, + // localize the privacy banner + country: args.context.storefront.i18n.country, + language: args.context.storefront.i18n.language, + }, + }); + ``` + +- Update to 2024-10 SFAPI ([#2570](https://github.com/Shopify/hydrogen/pull/2570)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- [**Breaking change**] ([#2546](https://github.com/Shopify/hydrogen/pull/2546)) by [@frandiox](https://github.com/frandiox) + + Update `createWithCache` to make it harder to accidentally cache undesired results. `request` is now mandatory prop when initializing `createWithCache`. + + ```diff + // server.ts + export default { + async fetch( + request: Request, + env: Env, + executionContext: ExecutionContext, + ): Promise { + try { + // ... + - const withCache = createWithCache({cache, waitUntil}); + + const withCache = createWithCache({cache, waitUntil, request}); + ``` + + `createWithCache` now returns an object with two utility functions: `withCache.run` and `withCache.fetch`. Both have a new prop `shouldCacheResult` that must be defined. + + The original `withCache` callback function is now `withCache.run`. This is useful to run _multiple_ fetch calls and merge their responses, or run any arbitrary code. It caches anything you return, but you can throw if you don't want to cache anything. + + ```diff + const withCache = createWithCache({cache, waitUntil, request}); + + const fetchMyCMS = (query) => { + - return withCache(['my-cms', query], CacheLong(), async (params) => { + + return withCache.run({ + + cacheKey: ['my-cms', query], + + cacheStrategy: CacheLong(), + + // Cache if there are no data errors or a specific data that make this result not suited for caching + + shouldCacheResult: (result) => !result?.errors, + + }, async(params) => { + const response = await fetch('my-cms.com/api', { + method: 'POST', + body: query, + }); + if (!response.ok) throw new Error(response.statusText); + const {data, error} = await response.json(); + if (error || !data) throw new Error(error ?? 'Missing data'); + params.addDebugData({displayName: 'My CMS query', response}); + return data; + }); + }; + ``` + + New `withCache.fetch` is for caching simple fetch requests. This method caches the responses if they are OK responses, and you can pass `shouldCacheResponse`, `cacheKey`, etc. to modify behavior. `data` is the consumed body of the response (we need to consume to cache it). + + ```ts + const withCache = createWithCache({cache, waitUntil, request}); + + const {data, response} = await withCache.fetch<{data: T; error: string}>( + 'my-cms.com/api', + { + method: 'POST', + headers: {'Content-type': 'application/json'}, + body, + }, + { + cacheStrategy: CacheLong(), + // Cache if there are no data errors or a specific data that make this result not suited for caching + shouldCacheResponse: (result) => !result?.error, + cacheKey: ['my-cms', body], + displayName: 'My CMS query', + }, + ); + ``` + +- [**Breaking change**] ([#2585](https://github.com/Shopify/hydrogen/pull/2585)) by [@wizardlyhel](https://github.com/wizardlyhel) + + Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. + + 1. Update your product graphql query to use the new `optionValues` field. + + ```diff + const PRODUCT_FRAGMENT = `#graphql + fragment Product on Product { + id + title + options { + name + - values + + optionValues { + + name + + } + } + ``` + + 2. Update your `` to use the new `optionValues` field. + + ```diff + option.values.length > 1)} + + options={product.options.filter((option) => option.optionValues.length > 1)} + variants={variants} + > + ``` + +- Add utility functions `decodeEncodedVariant` and `isOptionValueCombinationInEncodedVariant` for parsing `product.encodedVariantExistence` and `product.encodedVariantAvailability` fields. ([#2425](https://github.com/Shopify/hydrogen/pull/2425)) by [@lhoffbeck](https://github.com/lhoffbeck) + +- [**Breaking change**] ([#2572](https://github.com/Shopify/hydrogen/pull/2572)) by [@wizardlyhel](https://github.com/wizardlyhel) + + Update all cart mutation methods from `createCartHandler` to return cart warnings. + + As of API version 2024-10, inventory errors about stock levels will no longer be included in the `userErrors` of cart mutations. Inventory errors will now be available in a new return field `warnings` and will contain explicit code values of `MERCHANDISE_NOT_ENOUGH_STOCK` or `MERCHANDISE_OUT_OF_STOCK`. Reference: https://shopify.dev/changelog/cart-warnings-in-storefront-api-cart + +- Updated dependencies [[`8c89f298`](https://github.com/Shopify/hydrogen/commit/8c89f298a8d9084ee510fb4d0d17766ec43c249c), [`84a66b1e`](https://github.com/Shopify/hydrogen/commit/84a66b1e9d07bd6d6a10e5379ad3350b6bbecde9), [`76cd4f9b`](https://github.com/Shopify/hydrogen/commit/76cd4f9ba3dd8eff4433d72f4422c06a7d567537)]: + - @shopify/hydrogen-react@2024.10.0 + ## 2024.7.9 ### Patch Changes diff --git a/packages/mini-oxygen/CHANGELOG.md b/packages/mini-oxygen/CHANGELOG.md index 7e30ff769a..064ebb0680 100644 --- a/packages/mini-oxygen/CHANGELOG.md +++ b/packages/mini-oxygen/CHANGELOG.md @@ -1,5 +1,17 @@ # @shopify/mini-oxygen +## 3.1.0 + +### Minor Changes + +- [**Breaking change**] by [@wizardlyhel](https://github.com/wizardlyhel) + + Support worker compatibility date that aligns with SFAPI release. + + Starting from this major version, on each deploy to Oxygen, Hydrogen will be on Cloudflare worker compatibility date `2024-10-01`. Onwards, Hydrogen will update worker compatibility date on every SFAPI release. + + There is no specific project update that needs to be done in order to get this feature. However, please ensure your project is working properly in an Oxygen deployment when updating to this Hydrogen version. ([#2380](https://github.com/Shopify/hydrogen/pull/2380)) + ## 3.0.6 ### Patch Changes diff --git a/packages/mini-oxygen/package.json b/packages/mini-oxygen/package.json index a54d4fb03c..70cac93754 100644 --- a/packages/mini-oxygen/package.json +++ b/packages/mini-oxygen/package.json @@ -4,7 +4,7 @@ "access": "public", "@shopify:registry": "https://registry.npmjs.org" }, - "version": "3.0.6", + "version": "3.1.0", "license": "MIT", "type": "module", "description": "Development assistant for custom Shopify Oxygen hosted storefronts", diff --git a/packages/remix-oxygen/CHANGELOG.md b/packages/remix-oxygen/CHANGELOG.md index 9621b2e756..7d129a7372 100644 --- a/packages/remix-oxygen/CHANGELOG.md +++ b/packages/remix-oxygen/CHANGELOG.md @@ -1,5 +1,11 @@ # @shopify/remix-oxygen +## 2.0.9 + +### Patch Changes + +- Bump package versions by [@wizardlyhel](https://github.com/wizardlyhel) + ## 2.0.8 ### Patch Changes diff --git a/packages/remix-oxygen/package.json b/packages/remix-oxygen/package.json index 51f1ae6192..46d5785e25 100644 --- a/packages/remix-oxygen/package.json +++ b/packages/remix-oxygen/package.json @@ -5,7 +5,7 @@ "@shopify:registry": "https://registry.npmjs.org" }, "type": "module", - "version": "2.0.8", + "version": "2.0.9", "license": "MIT", "main": "dist/index.cjs", "module": "dist/production/index.js", diff --git a/templates/skeleton/CHANGELOG.md b/templates/skeleton/CHANGELOG.md index 323b88e83d..6d5cd998e5 100644 --- a/templates/skeleton/CHANGELOG.md +++ b/templates/skeleton/CHANGELOG.md @@ -1,5 +1,152 @@ # skeleton +## 2024.10.0 + +### Patch Changes + +- Stabilize `getSitemap`, `getSitemapIndex` and implement on skeleton ([#2589](https://github.com/Shopify/hydrogen/pull/2589)) by [@juanpprieto](https://github.com/juanpprieto) + + 1. Update the `getSitemapIndex` at `/app/routes/[sitemap.xml].tsx` + + ```diff + - import {unstable__getSitemapIndex as getSitemapIndex} from '@shopify/hydrogen'; + + import {getSitemapIndex} from '@shopify/hydrogen'; + ``` + + 2. Update the `getSitemap` at `/app/routes/sitemap.$type.$page[.xml].tsx` + + ```diff + - import {unstable__getSitemap as getSitemap} from '@shopify/hydrogen'; + + import {getSitemap} from '@shopify/hydrogen'; + ``` + + For a reference implementation please see the skeleton template sitemap routes + +- [**Breaking change**] ([#2588](https://github.com/Shopify/hydrogen/pull/2588)) by [@wizardlyhel](https://github.com/wizardlyhel) + + Set up Customer Privacy without the Shopify's cookie banner by default. + + If you are using Shopify's cookie banner to handle user consent in your app, you need to set `withPrivacyBanner: true` to the consent config. Without this update, the Shopify cookie banner will not appear. + + ```diff + return defer({ + ... + consent: { + checkoutDomain: env.PUBLIC_CHECKOUT_DOMAIN, + storefrontAccessToken: env.PUBLIC_STOREFRONT_API_TOKEN, + + withPrivacyBanner: true, + // localize the privacy banner + country: args.context.storefront.i18n.country, + language: args.context.storefront.i18n.language, + }, + }); + ``` + +- Update to 2024-10 SFAPI ([#2570](https://github.com/Shopify/hydrogen/pull/2570)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- [**Breaking change**] ([#2546](https://github.com/Shopify/hydrogen/pull/2546)) by [@frandiox](https://github.com/frandiox) + + Update `createWithCache` to make it harder to accidentally cache undesired results. `request` is now mandatory prop when initializing `createWithCache`. + + ```diff + // server.ts + export default { + async fetch( + request: Request, + env: Env, + executionContext: ExecutionContext, + ): Promise { + try { + // ... + - const withCache = createWithCache({cache, waitUntil}); + + const withCache = createWithCache({cache, waitUntil, request}); + ``` + + `createWithCache` now returns an object with two utility functions: `withCache.run` and `withCache.fetch`. Both have a new prop `shouldCacheResult` that must be defined. + + The original `withCache` callback function is now `withCache.run`. This is useful to run _multiple_ fetch calls and merge their responses, or run any arbitrary code. It caches anything you return, but you can throw if you don't want to cache anything. + + ```diff + const withCache = createWithCache({cache, waitUntil, request}); + + const fetchMyCMS = (query) => { + - return withCache(['my-cms', query], CacheLong(), async (params) => { + + return withCache.run({ + + cacheKey: ['my-cms', query], + + cacheStrategy: CacheLong(), + + // Cache if there are no data errors or a specific data that make this result not suited for caching + + shouldCacheResult: (result) => !result?.errors, + + }, async(params) => { + const response = await fetch('my-cms.com/api', { + method: 'POST', + body: query, + }); + if (!response.ok) throw new Error(response.statusText); + const {data, error} = await response.json(); + if (error || !data) throw new Error(error ?? 'Missing data'); + params.addDebugData({displayName: 'My CMS query', response}); + return data; + }); + }; + ``` + + New `withCache.fetch` is for caching simple fetch requests. This method caches the responses if they are OK responses, and you can pass `shouldCacheResponse`, `cacheKey`, etc. to modify behavior. `data` is the consumed body of the response (we need to consume to cache it). + + ```ts + const withCache = createWithCache({cache, waitUntil, request}); + + const {data, response} = await withCache.fetch<{data: T; error: string}>( + 'my-cms.com/api', + { + method: 'POST', + headers: {'Content-type': 'application/json'}, + body, + }, + { + cacheStrategy: CacheLong(), + // Cache if there are no data errors or a specific data that make this result not suited for caching + shouldCacheResponse: (result) => !result?.error, + cacheKey: ['my-cms', body], + displayName: 'My CMS query', + }, + ); + ``` + +- [**Breaking change**] ([#2585](https://github.com/Shopify/hydrogen/pull/2585)) by [@wizardlyhel](https://github.com/wizardlyhel) + + Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. + + 1. Update your product graphql query to use the new `optionValues` field. + + ```diff + const PRODUCT_FRAGMENT = `#graphql + fragment Product on Product { + id + title + options { + name + - values + + optionValues { + + name + + } + } + ``` + + 2. Update your `` to use the new `optionValues` field. + + ```diff + option.values.length > 1)} + + options={product.options.filter((option) => option.optionValues.length > 1)} + variants={variants} + > + ``` + +- Updated dependencies [[`d97cd56e`](https://github.com/Shopify/hydrogen/commit/d97cd56e859abf8dd005fef2589d99e07fa87b6e), [`809c9f3d`](https://github.com/Shopify/hydrogen/commit/809c9f3d342b56dd3c0d340cb733e6f00053b71d), [`8c89f298`](https://github.com/Shopify/hydrogen/commit/8c89f298a8d9084ee510fb4d0d17766ec43c249c), [`a253ef97`](https://github.com/Shopify/hydrogen/commit/a253ef971acb08f2ee3a2743ca5c901c2922acc0), [`84a66b1e`](https://github.com/Shopify/hydrogen/commit/84a66b1e9d07bd6d6a10e5379ad3350b6bbecde9), [`227035e7`](https://github.com/Shopify/hydrogen/commit/227035e7e11df5fec5ac475b98fa6a318bdbe366), [`ac12293c`](https://github.com/Shopify/hydrogen/commit/ac12293c7b36e1b278bc929c682c65779c300cc7), [`c7c9f2eb`](https://github.com/Shopify/hydrogen/commit/c7c9f2ebd869a9d361504a10566c268e88b6096a), [`76cd4f9b`](https://github.com/Shopify/hydrogen/commit/76cd4f9ba3dd8eff4433d72f4422c06a7d567537), [`8337e534`](https://github.com/Shopify/hydrogen/commit/8337e5342ecca563fab557c3e833485466456cd5)]: + - @shopify/hydrogen@2024.10.0 + - @shopify/remix-oxygen@2.0.9 + ## 2024.7.10 ### Patch Changes diff --git a/templates/skeleton/package.json b/templates/skeleton/package.json index 04e934f829..4e5e7ff394 100644 --- a/templates/skeleton/package.json +++ b/templates/skeleton/package.json @@ -17,7 +17,7 @@ "@remix-run/react": "^2.13.1", "@remix-run/server-runtime": "^2.13.1", "@shopify/hydrogen": "2024.10.0", - "@shopify/remix-oxygen": "^2.0.8", + "@shopify/remix-oxygen": "^2.0.9", "graphql": "^16.6.0", "graphql-tag": "^2.12.6", "isbot": "^3.8.0", @@ -29,8 +29,8 @@ "@remix-run/dev": "^2.13.1", "@remix-run/eslint-config": "^2.13.1", "@shopify/cli": "~3.69.2", - "@shopify/hydrogen-codegen": "^0.3.1", - "@shopify/mini-oxygen": "^3.0.5", + "@shopify/hydrogen-codegen": "^0.3.2", + "@shopify/mini-oxygen": "^3.1.0", "@shopify/oxygen-workers-types": "^4.1.2", "@shopify/prettier-config": "^1.1.2", "@total-typescript/ts-reset": "^0.4.2",