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 668ad4843f..0000000000 --- a/.changeset/funny-cows-perform.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch -'@shopify/cli-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 ae9d78bce3..0000000000 --- a/.changeset/olive-fishes-reflect.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch ---- - -Change `` to set up Customer Privacy without the Shopify's cookie banner by default. - -# Breaking Change - -If you are using `` in your app, you need to add `withPrivacyBanner={true}` to the `` component if you are using the Shopify's cookie banner. Without this props, the Shopify cookie banner will not appear. - -```diff - - ... - -``` 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 0cdde00820..0000000000 --- a/.changeset/quick-hotels-tell.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@shopify/hydrogen-react': patch -'skeleton': patch -'@shopify/hydrogen': patch -'@shopify/cli-hydrogen': patch -'@shopify/create-hydrogen': patch ---- - -Update to 2024-10 SFAPI 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 fdb4d97587..0000000000 --- a/.changeset/strange-zebras-travel.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -'skeleton': patch -'@shopify/hydrogen': patch -'@shopify/cli-hydrogen': patch -'@shopify/create-hydrogen': patch ---- - -SFAPI update - 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 8fd1a43a28..0000000000 --- a/.changeset/wicked-schools-reflect.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -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 447a9b2fdf..0000000000 --- a/.changeset/yellow-toes-mix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/mini-oxygen': minor ---- - -Support worker compatibility date that aligns with SFAPI release diff --git a/examples/express/package.json b/examples/express/package.json index 4073b06877..dd89784262 100644 --- a/examples/express/package.json +++ b/examples/express/package.json @@ -14,7 +14,7 @@ "@remix-run/node": "^2.13.1", "@remix-run/react": "^2.13.1", "@remix-run/server-runtime": "^2.13.1", - "@shopify/hydrogen": "2024.10.0", + "@shopify/hydrogen": "2024.10.1", "compression": "^1.7.4", "cross-env": "^7.0.3", "express": "^4.19.2", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 4d2179db0d..6ea70609e5 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,68 @@ # @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 + +- 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 + +- 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) + +- Update to 2024-10 SFAPI ([#2570](https://github.com/Shopify/hydrogen/pull/2570)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- SFAPI update - Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. ([#2585](https://github.com/Shopify/hydrogen/pull/2585)) by [@wizardlyhel](https://github.com/wizardlyhel) + + 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 [[`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..3bad2499a5 100644 --- a/packages/create-hydrogen/CHANGELOG.md +++ b/packages/create-hydrogen/CHANGELOG.md @@ -1,5 +1,40 @@ # @shopify/create-hydrogen +## 5.0.10 + +### Patch Changes + +- Update to 2024-10 SFAPI ([#2570](https://github.com/Shopify/hydrogen/pull/2570)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- SFAPI update - Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. ([#2585](https://github.com/Shopify/hydrogen/pull/2585)) by [@wizardlyhel](https://github.com/wizardlyhel) + + 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} + > + ``` + ## 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..ad7e0990e4 100644 --- a/packages/hydrogen-react/CHANGELOG.md +++ b/packages/hydrogen-react/CHANGELOG.md @@ -1,5 +1,15 @@ # @shopify/hydrogen-react +## 2024.10.1 + +### 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-react/package.json b/packages/hydrogen-react/package.json index 86684f1777..6aff83aac7 100644 --- a/packages/hydrogen-react/package.json +++ b/packages/hydrogen-react/package.json @@ -1,6 +1,6 @@ { "name": "@shopify/hydrogen-react", - "version": "2024.10.0", + "version": "2024.10.1", "description": "React components, hooks, and utilities for creating custom Shopify storefronts", "homepage": "https://github.com/Shopify/hydrogen/tree/main/packages/hydrogen-react", "license": "MIT", diff --git a/packages/hydrogen/CHANGELOG.md b/packages/hydrogen/CHANGELOG.md index 2ec546749b..e8f7886c2e 100644 --- a/packages/hydrogen/CHANGELOG.md +++ b/packages/hydrogen/CHANGELOG.md @@ -1,5 +1,156 @@ # @shopify/hydrogen +## 2024.10.1 + +### 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) + +- Change `` to set up Customer Privacy without the Shopify's cookie banner by default. ([#2588](https://github.com/Shopify/hydrogen/pull/2588)) by [@wizardlyhel](https://github.com/wizardlyhel) + + # Breaking Change + + If you are using `` in your app, you need to add `withPrivacyBanner={true}` to the `` component if you are using the Shopify's cookie banner. Without this props, the Shopify cookie banner will not appear. + + ```diff + + ... + + ``` + +- 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', + }, + ); + ``` + +- SFAPI update - Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. ([#2585](https://github.com/Shopify/hydrogen/pull/2585)) by [@wizardlyhel](https://github.com/wizardlyhel) + + 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) + +- Update all cart mutation methods from `createCartHandler` to return cart warnings. ([#2572](https://github.com/Shopify/hydrogen/pull/2572)) by [@wizardlyhel](https://github.com/wizardlyhel) + + 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.1 + ## 2024.7.9 ### Patch Changes diff --git a/packages/hydrogen/package.json b/packages/hydrogen/package.json index a57642b8e7..e16a7a5236 100644 --- a/packages/hydrogen/package.json +++ b/packages/hydrogen/package.json @@ -5,7 +5,7 @@ "@shopify:registry": "https://registry.npmjs.org" }, "type": "module", - "version": "2024.10.0", + "version": "2024.10.1", "license": "MIT", "main": "dist/index.cjs", "module": "dist/production/index.js", @@ -63,7 +63,7 @@ "dist" ], "dependencies": { - "@shopify/hydrogen-react": "2024.10.0", + "@shopify/hydrogen-react": "2024.10.1", "content-security-policy-builder": "^2.2.0", "source-map-support": "^0.5.21", "type-fest": "^4.26.1", diff --git a/packages/hydrogen/src/version.ts b/packages/hydrogen/src/version.ts index 43216710af..d5e917e68c 100644 --- a/packages/hydrogen/src/version.ts +++ b/packages/hydrogen/src/version.ts @@ -1 +1 @@ -export const LIB_VERSION = '2024.10.0'; +export const LIB_VERSION = '2024.10.1'; diff --git a/packages/mini-oxygen/CHANGELOG.md b/packages/mini-oxygen/CHANGELOG.md index 7e30ff769a..99f5e9a4e2 100644 --- a/packages/mini-oxygen/CHANGELOG.md +++ b/packages/mini-oxygen/CHANGELOG.md @@ -1,5 +1,11 @@ # @shopify/mini-oxygen +## 3.1.0 + +### Minor Changes + +- Support worker compatibility date that aligns with SFAPI release by [@wizardlyhel](https://github.com/wizardlyhel) + ## 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/templates/skeleton/CHANGELOG.md b/templates/skeleton/CHANGELOG.md index 323b88e83d..8ab892c2b1 100644 --- a/templates/skeleton/CHANGELOG.md +++ b/templates/skeleton/CHANGELOG.md @@ -1,5 +1,146 @@ # skeleton +## 2024.7.11 + +### 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 + +- Change `` to set up Customer Privacy without the Shopify's cookie banner by default. ([#2588](https://github.com/Shopify/hydrogen/pull/2588)) by [@wizardlyhel](https://github.com/wizardlyhel) + + # Breaking Change + + If you are using `` in your app, you need to add `withPrivacyBanner={true}` to the `` component if you are using the Shopify's cookie banner. Without this props, the Shopify cookie banner will not appear. + + ```diff + + ... + + ``` + +- 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', + }, + ); + ``` + +- SFAPI update - Deprecate usages of `product.options.values` and use `product.options.optionValues` instead. ([#2585](https://github.com/Shopify/hydrogen/pull/2585)) by [@wizardlyhel](https://github.com/wizardlyhel) + + 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), [`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.1 + ## 2024.7.10 ### Patch Changes diff --git a/templates/skeleton/package.json b/templates/skeleton/package.json index ce3be80074..513c1f8b11 100644 --- a/templates/skeleton/package.json +++ b/templates/skeleton/package.json @@ -2,7 +2,7 @@ "name": "skeleton", "private": true, "sideEffects": false, - "version": "2024.7.10", + "version": "2024.7.11", "type": "module", "scripts": { "build": "shopify hydrogen build --codegen", @@ -16,7 +16,7 @@ "dependencies": { "@remix-run/react": "^2.13.1", "@remix-run/server-runtime": "^2.13.1", - "@shopify/hydrogen": "2024.10.0", + "@shopify/hydrogen": "2024.10.1", "@shopify/remix-oxygen": "^2.0.8", "graphql": "^16.6.0", "graphql-tag": "^2.12.6", @@ -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",