Skip to content

Commit 587f9f8

Browse files
committed
feat: enables client-side navigation in Makeswift builder
Enabled by upgrading to the latest Makeswift runtime
1 parent bcd87c3 commit 587f9f8

7 files changed

Lines changed: 29 additions & 29 deletions

File tree

.changeset/shiny-cougars-drop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bigcommerce/catalyst-makeswift": minor
3+
---
4+
5+
Enable interaction-mode site navigation in Makeswift builder

core/app/api/makeswift/[...makeswift]/route.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ const defaultVariants: Font['variants'] = [
2424

2525
const handler = MakeswiftApiHandler(process.env.MAKESWIFT_SITE_API_KEY, {
2626
runtime,
27-
apiOrigin: process.env.NEXT_PUBLIC_MAKESWIFT_API_ORIGIN ?? process.env.MAKESWIFT_API_ORIGIN,
28-
appOrigin: process.env.NEXT_PUBLIC_MAKESWIFT_APP_ORIGIN ?? process.env.MAKESWIFT_APP_ORIGIN,
2927
getFonts() {
3028
return [
3129
{

core/lib/makeswift/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ strict(process.env.MAKESWIFT_SITE_API_KEY, 'MAKESWIFT_SITE_API_KEY is required')
1111

1212
export const client = new Makeswift(process.env.MAKESWIFT_SITE_API_KEY, {
1313
runtime,
14-
apiOrigin: process.env.NEXT_PUBLIC_MAKESWIFT_API_ORIGIN ?? process.env.MAKESWIFT_API_ORIGIN,
1514
});
1615

1716
export const getPageSnapshot = async ({ path, locale }: { path: string; locale: string }) =>

core/lib/makeswift/provider.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@ export function MakeswiftProvider({
1515
siteVersion: SiteVersion | null;
1616
}) {
1717
return (
18-
<ReactRuntimeProvider
19-
apiOrigin={process.env.NEXT_PUBLIC_MAKESWIFT_API_ORIGIN}
20-
appOrigin={process.env.NEXT_PUBLIC_MAKESWIFT_APP_ORIGIN}
21-
locale={locale}
22-
runtime={runtime}
23-
siteVersion={siteVersion}
24-
>
18+
<ReactRuntimeProvider locale={locale} runtime={runtime} siteVersion={siteVersion}>
2519
<RootStyleRegistry enableCssReset={false}>{children}</RootStyleRegistry>
2620
</ReactRuntimeProvider>
2721
);

core/lib/makeswift/runtime.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { fetch } from '@makeswift/runtime/next';
12
import { registerBoxComponent } from '@makeswift/runtime/react/builtins/box';
23
import { registerDividerComponent } from '@makeswift/runtime/react/builtins/divider';
34
import { registerEmbedComponent } from '@makeswift/runtime/react/builtins/embed';
@@ -10,12 +11,15 @@ import { registerVideoComponent } from '@makeswift/runtime/react/builtins/video'
1011
import { ReactRuntimeCore } from '@makeswift/runtime/react/core';
1112

1213
const runtime = new ReactRuntimeCore({
14+
apiOrigin: process.env.NEXT_PUBLIC_MAKESWIFT_API_ORIGIN,
15+
appOrigin: process.env.NEXT_PUBLIC_MAKESWIFT_APP_ORIGIN,
1316
breakpoints: {
1417
small: { width: 640, viewport: 390, label: 'Small' },
1518
medium: { width: 768, viewport: 765, label: 'Medium' },
1619
large: { width: 1024, viewport: 1000, label: 'Large' },
1720
screen: { width: 1280, label: 'XL' },
1821
},
22+
fetch,
1923
});
2024

2125
// Only register necessary built-in components. Omitted components are:

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@conform-to/react": "^1.6.1",
2323
"@conform-to/zod": "^1.6.1",
2424
"@icons-pack/react-simple-icons": "^11.2.0",
25-
"@makeswift/runtime": "0.26.4",
25+
"@makeswift/runtime": "0.28.5",
2626
"@opentelemetry/api": "^1.9.0",
2727
"@opentelemetry/api-logs": "^0.208.0",
2828
"@opentelemetry/instrumentation": "^0.208.0",

pnpm-lock.yaml

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)