diff --git a/.changeset/fix-layout-shift.md b/.changeset/fix-layout-shift.md deleted file mode 100644 index 8f31fc5b5b..0000000000 --- a/.changeset/fix-layout-shift.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bigcommerce/catalyst-makeswift": patch ---- - -Upgrade `@makeswift/runtime` to `0.26.3`, which uses the `` API instead of ``. This fixes layout shift both when loading a Makeswift page directly and when client-side navigating from a non-Makeswift page to a Makeswift page after a hard refresh. diff --git a/.changeset/heavy-cups-train.md b/.changeset/heavy-cups-train.md deleted file mode 100644 index 926d6ae2e9..0000000000 --- a/.changeset/heavy-cups-train.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bigcommerce/catalyst-makeswift": patch ---- - -fix: handle OPTIONS requests via MakeswiftApiHandler diff --git a/.changeset/sync-canary-1-5-0.md b/.changeset/sync-canary-1-5-0.md deleted file mode 100644 index dc1d471135..0000000000 --- a/.changeset/sync-canary-1-5-0.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bigcommerce/catalyst-makeswift": minor ---- - -Pulls in changes from the `@bigcommerce/catalyst-core@1.5.0` release. For more information about what was included in the `@bigcommerce/catalyst-core@1.5.0` release, see the [changelog entry](https://github.com/bigcommerce/catalyst/blob/0d951ab190c6bf1573ca7de925ecb0017d954cb7/core/CHANGELOG.md#150). diff --git a/.changeset/wild-bears-open.md b/.changeset/wild-bears-open.md deleted file mode 100644 index e65ca0bec0..0000000000 --- a/.changeset/wild-bears-open.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -"@bigcommerce/catalyst-makeswift": patch ---- - -Add explicit Makeswift SEO metadata support to public-facing pages. When configured in Makeswift, the SEO title and description will take priority over the default values from BigCommerce or static translations. - -The following pages now support Makeswift SEO metadata: - -- Home page (`/`) -- Catch-all page (`/[...rest]`) -- Product page (`/product/[slug]`) -- Brand page (`/brand/[slug]`) -- Category page (`/category/[slug]`) -- Blog list page (`/blog`) -- Blog post page (`/blog/[blogId]`) -- Search page (`/search`) -- Cart page (`/cart`) -- Compare page (`/compare`) -- Gift certificates page (`/gift-certificates`) -- Gift certificates balance page (`/gift-certificates/balance`) -- Contact webpage (`/webpages/[id]/contact`) -- Normal webpage (`/webpages/[id]/normal`) - -## Migration steps - -### Step 1: Add `getMakeswiftPageMetadata` function - -Add the `getMakeswiftPageMetadata` function to `core/lib/makeswift/client.ts`: - -```diff -+ export async function getMakeswiftPageMetadata({ path, locale }: { path: string; locale: string }) { -+ const { data: pages } = await client.getPages({ -+ pathPrefix: path, -+ locale: normalizeLocale(locale), -+ siteVersion: await getSiteVersion(), -+ }); -+ -+ if (pages.length === 0 || !pages[0]) { -+ return null; -+ } -+ -+ const { title, description } = pages[0]; -+ -+ return { -+ ...(title && { title }), -+ ...(description && { description }), -+ }; -+ } -``` - -Export the function from `core/lib/makeswift/index.ts`: - -```diff - export { Page } from './page'; -- export { client } from './client'; -+ export { client, getMakeswiftPageMetadata } from './client'; -``` - -### Step 2: Update page metadata - -Each page's `generateMetadata` function has been updated to fetch Makeswift metadata and use it as the primary source, falling back to existing values. Here's an example using the cart page: - -Update `core/app/[locale]/(default)/cart/page.tsx`: - -```diff - import { getPreferredCurrencyCode } from '~/lib/currency'; -+ import { getMakeswiftPageMetadata } from '~/lib/makeswift'; - import { Slot } from '~/lib/makeswift/slot'; -``` - -```diff - export async function generateMetadata({ params }: Props): Promise { - const { locale } = await params; - - const t = await getTranslations({ locale, namespace: 'Cart' }); -+ const makeswiftMetadata = await getMakeswiftPageMetadata({ path: '/cart', locale }); - - return { -- title: t('title'), -+ title: makeswiftMetadata?.title || t('title'), -+ description: makeswiftMetadata?.description || undefined, - }; - } -``` - -Apply the same pattern to the other pages listed above, using the appropriate path for each page (e.g., `/blog`, `/search`, `/compare`, etc.). diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 2c92860ff7..68c77560e3 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,5 +1,99 @@ # Changelog +## 1.5.0 + +### Minor Changes + +- Pulls in changes from the `@bigcommerce/catalyst-core@1.5.0` release. For more information about what was included in the `@bigcommerce/catalyst-core@1.5.0` release, see the [changelog entry](https://github.com/bigcommerce/catalyst/blob/0d951ab190c6bf1573ca7de925ecb0017d954cb7/core/CHANGELOG.md#150). + +### Patch Changes + +- [#2919](https://github.com/bigcommerce/catalyst/pull/2919) [`32be644`](https://github.com/bigcommerce/catalyst/commit/32be6443457965467fb793e524347a9e43a9338e) Thanks [@matthewvolk](https://github.com/matthewvolk)! - Upgrade `@makeswift/runtime` to `0.26.3`, which uses the `` API instead of ``. This fixes layout shift both when loading a Makeswift page directly and when client-side navigating from a non-Makeswift page to a Makeswift page after a hard refresh. + +- [#2862](https://github.com/bigcommerce/catalyst/pull/2862) [`52207b6`](https://github.com/bigcommerce/catalyst/commit/52207b69c50f58027400f716bf18c53cac82189b) Thanks [@Codeseph](https://github.com/Codeseph)! - fix: handle OPTIONS requests via MakeswiftApiHandler + +- [#2860](https://github.com/bigcommerce/catalyst/pull/2860) [`5097034`](https://github.com/bigcommerce/catalyst/commit/5097034e93a9135b646f53445c83c8716fbeb76f) Thanks [@jorgemoya](https://github.com/jorgemoya)! - Add explicit Makeswift SEO metadata support to public-facing pages. When configured in Makeswift, the SEO title and description will take priority over the default values from BigCommerce or static translations. + + The following pages now support Makeswift SEO metadata: + - Home page (`/`) + - Catch-all page (`/[...rest]`) + - Product page (`/product/[slug]`) + - Brand page (`/brand/[slug]`) + - Category page (`/category/[slug]`) + - Blog list page (`/blog`) + - Blog post page (`/blog/[blogId]`) + - Search page (`/search`) + - Cart page (`/cart`) + - Compare page (`/compare`) + - Gift certificates page (`/gift-certificates`) + - Gift certificates balance page (`/gift-certificates/balance`) + - Contact webpage (`/webpages/[id]/contact`) + - Normal webpage (`/webpages/[id]/normal`) + + ## Migration steps + + ### Step 1: Add `getMakeswiftPageMetadata` function + + Add the `getMakeswiftPageMetadata` function to `core/lib/makeswift/client.ts`: + + ```diff + + export async function getMakeswiftPageMetadata({ path, locale }: { path: string; locale: string }) { + + const { data: pages } = await client.getPages({ + + pathPrefix: path, + + locale: normalizeLocale(locale), + + siteVersion: await getSiteVersion(), + + }); + + + + if (pages.length === 0 || !pages[0]) { + + return null; + + } + + + + const { title, description } = pages[0]; + + + + return { + + ...(title && { title }), + + ...(description && { description }), + + }; + + } + ``` + + Export the function from `core/lib/makeswift/index.ts`: + + ```diff + export { Page } from './page'; + - export { client } from './client'; + + export { client, getMakeswiftPageMetadata } from './client'; + ``` + + ### Step 2: Update page metadata + + Each page's `generateMetadata` function has been updated to fetch Makeswift metadata and use it as the primary source, falling back to existing values. Here's an example using the cart page: + + Update `core/app/[locale]/(default)/cart/page.tsx`: + + ```diff + import { getPreferredCurrencyCode } from '~/lib/currency'; + + import { getMakeswiftPageMetadata } from '~/lib/makeswift'; + import { Slot } from '~/lib/makeswift/slot'; + ``` + + ```diff + export async function generateMetadata({ params }: Props): Promise { + const { locale } = await params; + + const t = await getTranslations({ locale, namespace: 'Cart' }); + + const makeswiftMetadata = await getMakeswiftPageMetadata({ path: '/cart', locale }); + + return { + - title: t('title'), + + title: makeswiftMetadata?.title || t('title'), + + description: makeswiftMetadata?.description || undefined, + }; + } + ``` + + Apply the same pattern to the other pages listed above, using the appropriate path for each page (e.g., `/blog`, `/search`, `/compare`, etc.). + ## 1.4.2 ### Patch Changes diff --git a/core/package.json b/core/package.json index 687802f38c..ba89355646 100644 --- a/core/package.json +++ b/core/package.json @@ -1,7 +1,7 @@ { "name": "@bigcommerce/catalyst-makeswift", "description": "BigCommerce Catalyst is a Next.js starter kit for building headless BigCommerce storefronts.", - "version": "1.4.2", + "version": "1.5.0", "private": true, "engines": { "node": ">=24.0.0"