Skip to content

Commit 990727b

Browse files
Version Packages (integrations/makeswift) (#2864)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c87ef34 commit 990727b

6 files changed

Lines changed: 95 additions & 102 deletions

File tree

.changeset/fix-layout-shift.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/heavy-cups-train.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/sync-canary-1-5-0.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/wild-bears-open.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

core/CHANGELOG.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,99 @@
11
# Changelog
22

3+
## 1.5.0
4+
5+
### Minor Changes
6+
7+
- Pulls in changes from the `@bigcommerce/[email protected]` release. For more information about what was included in the `@bigcommerce/[email protected]` release, see the [changelog entry](https://github.com/bigcommerce/catalyst/blob/0d951ab190c6bf1573ca7de925ecb0017d954cb7/core/CHANGELOG.md#150).
8+
9+
### Patch Changes
10+
11+
- [#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 `<Activity>` API instead of `<Suspense>`. 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.
12+
13+
- [#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
14+
15+
- [#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.
16+
17+
The following pages now support Makeswift SEO metadata:
18+
- Home page (`/`)
19+
- Catch-all page (`/[...rest]`)
20+
- Product page (`/product/[slug]`)
21+
- Brand page (`/brand/[slug]`)
22+
- Category page (`/category/[slug]`)
23+
- Blog list page (`/blog`)
24+
- Blog post page (`/blog/[blogId]`)
25+
- Search page (`/search`)
26+
- Cart page (`/cart`)
27+
- Compare page (`/compare`)
28+
- Gift certificates page (`/gift-certificates`)
29+
- Gift certificates balance page (`/gift-certificates/balance`)
30+
- Contact webpage (`/webpages/[id]/contact`)
31+
- Normal webpage (`/webpages/[id]/normal`)
32+
33+
## Migration steps
34+
35+
### Step 1: Add `getMakeswiftPageMetadata` function
36+
37+
Add the `getMakeswiftPageMetadata` function to `core/lib/makeswift/client.ts`:
38+
39+
```diff
40+
+ export async function getMakeswiftPageMetadata({ path, locale }: { path: string; locale: string }) {
41+
+ const { data: pages } = await client.getPages({
42+
+ pathPrefix: path,
43+
+ locale: normalizeLocale(locale),
44+
+ siteVersion: await getSiteVersion(),
45+
+ });
46+
+
47+
+ if (pages.length === 0 || !pages[0]) {
48+
+ return null;
49+
+ }
50+
+
51+
+ const { title, description } = pages[0];
52+
+
53+
+ return {
54+
+ ...(title && { title }),
55+
+ ...(description && { description }),
56+
+ };
57+
+ }
58+
```
59+
60+
Export the function from `core/lib/makeswift/index.ts`:
61+
62+
```diff
63+
export { Page } from './page';
64+
- export { client } from './client';
65+
+ export { client, getMakeswiftPageMetadata } from './client';
66+
```
67+
68+
### Step 2: Update page metadata
69+
70+
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:
71+
72+
Update `core/app/[locale]/(default)/cart/page.tsx`:
73+
74+
```diff
75+
import { getPreferredCurrencyCode } from '~/lib/currency';
76+
+ import { getMakeswiftPageMetadata } from '~/lib/makeswift';
77+
import { Slot } from '~/lib/makeswift/slot';
78+
```
79+
80+
```diff
81+
export async function generateMetadata({ params }: Props): Promise<Metadata> {
82+
const { locale } = await params;
83+
84+
const t = await getTranslations({ locale, namespace: 'Cart' });
85+
+ const makeswiftMetadata = await getMakeswiftPageMetadata({ path: '/cart', locale });
86+
87+
return {
88+
- title: t('title'),
89+
+ title: makeswiftMetadata?.title || t('title'),
90+
+ description: makeswiftMetadata?.description || undefined,
91+
};
92+
}
93+
```
94+
95+
Apply the same pattern to the other pages listed above, using the appropriate path for each page (e.g., `/blog`, `/search`, `/compare`, etc.).
96+
397
## 1.4.2
498

599
### Patch Changes

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@bigcommerce/catalyst-makeswift",
33
"description": "BigCommerce Catalyst is a Next.js starter kit for building headless BigCommerce storefronts.",
4-
"version": "1.4.2",
4+
"version": "1.5.0",
55
"private": true,
66
"engines": {
77
"node": ">=24.0.0"

0 commit comments

Comments
 (0)