@cimplify/cli 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-MX4655EX.mjs → add-BEJH4T3P.mjs} +1 -1
- package/dist/{chunk-DCWHOH2S.mjs → chunk-DZPR5L6H.mjs} +1 -1
- package/dist/{chunk-AY23RQE6.mjs → chunk-MUG454RK.mjs} +1 -1
- package/dist/{chunk-Z5DEA7YM.mjs → chunk-TR65XHUE.mjs} +12 -12
- package/dist/dispatcher.mjs +9 -9
- package/dist/{doctor-DGO3UAJB.mjs → doctor-QO2SRNH6.mjs} +2 -2
- package/dist/{explain-IJLIQUYJ.mjs → explain-CGWT7HMV.mjs} +1 -1
- package/dist/{introspect-KID4YJYV.mjs → introspect-WDGC7BKQ.mjs} +2 -2
- package/dist/{list-5PMRTZV3.mjs → list-NO5SPHSU.mjs} +1 -1
- package/dist/{update-64K4Z3SF.mjs → update-EEQ7JJTP.mjs} +1 -1
- package/package.json +1 -1
- package/templates/manifest.json +2 -2
- package/templates/storefront-auto/.env.example +12 -8
- package/templates/storefront-auto/README.md +1 -3
- package/templates/storefront-auto/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-auto/components/providers.tsx +3 -12
- package/templates/storefront-auto/next.config.ts +11 -16
- package/templates/storefront-bakery/.env.example +2 -7
- package/templates/storefront-bakery/README.md +1 -3
- package/templates/storefront-bakery/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-bakery/components/providers.tsx +3 -12
- package/templates/storefront-bakery/next.config.ts +11 -16
- package/templates/storefront-fashion/.env.example +12 -8
- package/templates/storefront-fashion/README.md +2 -4
- package/templates/storefront-fashion/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-fashion/components/providers.tsx +3 -12
- package/templates/storefront-fashion/next.config.ts +11 -16
- package/templates/storefront-grocery/.env.example +12 -8
- package/templates/storefront-grocery/README.md +2 -4
- package/templates/storefront-grocery/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-grocery/components/providers.tsx +3 -12
- package/templates/storefront-grocery/next.config.ts +11 -16
- package/templates/storefront-pharmacy/.env.example +12 -8
- package/templates/storefront-pharmacy/README.md +1 -3
- package/templates/storefront-pharmacy/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-pharmacy/components/providers.tsx +3 -12
- package/templates/storefront-pharmacy/next.config.ts +11 -16
- package/templates/storefront-restaurant/.env.example +12 -8
- package/templates/storefront-restaurant/README.md +2 -4
- package/templates/storefront-restaurant/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-restaurant/components/providers.tsx +3 -12
- package/templates/storefront-restaurant/next.config.ts +11 -16
- package/templates/storefront-retail/.env.example +12 -8
- package/templates/storefront-retail/README.md +1 -3
- package/templates/storefront-retail/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-retail/components/providers.tsx +3 -12
- package/templates/storefront-retail/next.config.ts +11 -16
- package/templates/storefront-services/.env.example +12 -8
- package/templates/storefront-services/README.md +2 -4
- package/templates/storefront-services/app/.well-known/ucp/route.ts +4 -8
- package/templates/storefront-services/components/providers.tsx +3 -12
- package/templates/storefront-services/next.config.ts +11 -16
package/dist/dispatcher.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { TEMPLATES } from './chunk-
|
|
3
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { TEMPLATES } from './chunk-TR65XHUE.mjs';
|
|
3
|
+
import { package_default } from './chunk-DZPR5L6H.mjs';
|
|
4
4
|
|
|
5
5
|
// src/dispatcher.ts
|
|
6
6
|
var VERSION = package_default.version ?? "unknown";
|
|
@@ -134,15 +134,15 @@ var COMMANDS = {
|
|
|
134
134
|
logs: () => import('./logs-YNN2PQ24.mjs'),
|
|
135
135
|
status: () => import('./status-JSYXM5RT.mjs'),
|
|
136
136
|
dev: () => import('./dev-ONW2S77K.mjs'),
|
|
137
|
-
introspect: () => import('./introspect-
|
|
138
|
-
doctor: () => import('./doctor-
|
|
139
|
-
explain: () => import('./explain-
|
|
137
|
+
introspect: () => import('./introspect-WDGC7BKQ.mjs'),
|
|
138
|
+
doctor: () => import('./doctor-QO2SRNH6.mjs'),
|
|
139
|
+
explain: () => import('./explain-CGWT7HMV.mjs'),
|
|
140
140
|
assets: () => import('./assets-EBEMMENZ.mjs'),
|
|
141
141
|
repo: () => import('./repo-WOBWKEAO.mjs'),
|
|
142
|
-
list: () => import('./list-
|
|
143
|
-
add: () => import('./add-
|
|
144
|
-
update: () => import('./update-
|
|
145
|
-
upgrade: () => import('./update-
|
|
142
|
+
list: () => import('./list-NO5SPHSU.mjs'),
|
|
143
|
+
add: () => import('./add-BEJH4T3P.mjs'),
|
|
144
|
+
update: () => import('./update-EEQ7JJTP.mjs'),
|
|
145
|
+
upgrade: () => import('./update-EEQ7JJTP.mjs'),
|
|
146
146
|
"auth-step-up": () => import('./auth-step-up-BIUYQJP6.mjs')
|
|
147
147
|
};
|
|
148
148
|
var COMMAND_PREFIXES = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { gatherIntrospection } from './chunk-
|
|
2
|
+
import { gatherIntrospection } from './chunk-MUG454RK.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-DZPR5L6H.mjs';
|
|
6
6
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import { ApiClient } from './chunk-MAOO6ZZ5.mjs';
|
|
8
8
|
import { readAuthOrNull } from './chunk-UBAI443T.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-DZPR5L6H.mjs';
|
|
3
3
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { bold, dim, info, result, CliError, CLI_ERROR_CODE } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-
|
|
2
|
+
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-MUG454RK.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-DZPR5L6H.mjs';
|
|
6
6
|
import './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import './chunk-UBAI443T.mjs';
|
|
8
8
|
import './chunk-E2T2SBP5.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { REGISTRY_INDEX } from './chunk-
|
|
2
|
+
import { REGISTRY_INDEX } from './chunk-TR65XHUE.mjs';
|
|
3
3
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { CliError, CLI_ERROR_CODE, info, bold, dim, green, result } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-DZPR5L6H.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-ITAFAORS.mjs';
|
|
4
4
|
import { parseArgs, flagBool, flagString } from './chunk-C4M3DXKC.mjs';
|
|
5
5
|
import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-E2T2SBP5.mjs';
|
package/package.json
CHANGED
package/templates/manifest.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# which Next.js rewrites to the mock at 127.0.0.1:8787 (see next.config.ts).
|
|
4
|
-
# Production: set to your Cimplify host (e.g. https://api.cimplify.io).
|
|
5
|
-
NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
6
|
-
|
|
7
|
-
# Tenant public key. The mock accepts any value.
|
|
1
|
+
# Tenant public key. Get yours from the desk Developers tab. The mock
|
|
2
|
+
# accepts any value, so leave the placeholder during local dev.
|
|
8
3
|
NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
9
4
|
|
|
10
|
-
# Business id used by the mock seed (
|
|
5
|
+
# Business id used by the mock seed (default: Driveline Auto).
|
|
11
6
|
NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_driveline_auto
|
|
12
7
|
|
|
13
8
|
# Canonical public site URL — used by sitemap.xml, robots.txt, llms.txt,
|
|
@@ -20,3 +15,12 @@ NEXT_PUBLIC_SITE_URL=https://example.com
|
|
|
20
15
|
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
16
|
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
17
|
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
18
|
+
|
|
19
|
+
# ── Escape hatches (rarely needed) ────────────────────────────────────
|
|
20
|
+
# Override the storefront API host (where /api/v1/catalogue, /api/v1/orders
|
|
21
|
+
# live). Defaults to https://storefronts.cimplify.io in production,
|
|
22
|
+
# 127.0.0.1:8787 in dev. Set only for self-hosted Cimplify or staging.
|
|
23
|
+
# NEXT_PUBLIC_CIMPLIFY_STOREFRONT_URL=
|
|
24
|
+
|
|
25
|
+
# Override the management/UCP host. Defaults to https://api.cimplify.io.
|
|
26
|
+
# NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
@@ -37,12 +37,10 @@ Update `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID` in `.env.local` to match the seeded bu
|
|
|
37
37
|
|
|
38
38
|
```diff
|
|
39
39
|
# .env.local
|
|
40
|
-
- NEXT_PUBLIC_CIMPLIFY_API_URL=http://127.0.0.1:8787
|
|
41
|
-
+ NEXT_PUBLIC_CIMPLIFY_API_URL=https://api.cimplify.io
|
|
42
40
|
- NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
43
41
|
+ NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=<your tenant key>
|
|
44
42
|
- NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_driveline_auto
|
|
45
43
|
+ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=<your business id>
|
|
46
44
|
```
|
|
47
45
|
|
|
48
|
-
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://
|
|
46
|
+
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://www.cimplify.dev/docs/cli). `next.config.ts` already whitelists the SDK image hosts under `images.remotePatterns`.
|
|
@@ -5,15 +5,11 @@ import { NextResponse } from "next/server";
|
|
|
5
5
|
*
|
|
6
6
|
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
7
|
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
-
* capabilities your storefront supports. We forward
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
-
*
|
|
13
|
-
* Edge-cached for an hour because capabilities change rarely.
|
|
8
|
+
* capabilities your storefront supports. We forward to Cimplify, which
|
|
9
|
+
* returns the canonical manifest. Edge-cached for an hour because
|
|
10
|
+
* capabilities change rarely.
|
|
14
11
|
*/
|
|
15
|
-
const UCP_API_BASE =
|
|
16
|
-
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
12
|
+
const UCP_API_BASE = "https://api.cimplify.io";
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
export async function GET() {
|
|
@@ -4,21 +4,12 @@ import { useMemo, type ReactNode } from "react";
|
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
5
|
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* <CimplifyProvider/>.
|
|
10
|
-
*
|
|
11
|
-
* Base-URL resolution:
|
|
12
|
-
* 1) If NEXT_PUBLIC_CIMPLIFY_API_URL is set, use it verbatim.
|
|
13
|
-
* 2) Otherwise use the current origin so requests flow through the
|
|
14
|
-
* Next.js rewrite in `next.config.ts` to the mock at :8787 (no CORS).
|
|
15
|
-
* 3) Fall back to 127.0.0.1:8787 only during SSR, when there's no window.
|
|
16
|
-
*/
|
|
7
|
+
// Same-origin client — every request goes through the Next.js rewrite in
|
|
8
|
+
// next.config.ts, so no CORS preflight ever hits the browser.
|
|
17
9
|
export function Providers({ children }: { children: ReactNode }) {
|
|
18
10
|
const client = useMemo(() => {
|
|
19
11
|
const baseUrl =
|
|
20
|
-
|
|
21
|
-
(typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787");
|
|
12
|
+
typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787";
|
|
22
13
|
const publicKey = process.env.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY ?? "mock-dev";
|
|
23
14
|
return createCimplifyClient({
|
|
24
15
|
baseUrl,
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Same-origin proxy target for the storefront API. Local mock in dev,
|
|
4
|
+
// hosted Cimplify in prod.
|
|
5
|
+
const STOREFRONT_URL =
|
|
6
|
+
process.env.NODE_ENV === "production"
|
|
7
|
+
? "https://storefronts.cimplify.io"
|
|
8
|
+
: "http://127.0.0.1:8787";
|
|
4
9
|
|
|
5
|
-
/**
|
|
6
|
-
* Same-origin proxy to the Cimplify mock so the browser never makes a
|
|
7
|
-
* cross-origin request in dev (no CORS preflights, no flaky `Origin`
|
|
8
|
-
* mismatches). The SDK's base URL stays empty/relative — requests go to
|
|
9
|
-
* `/api/v1/...` on the Next origin, then this rewrite forwards them to
|
|
10
|
-
* the mock at `127.0.0.1:8787`.
|
|
11
|
-
*
|
|
12
|
-
* In production, point `NEXT_PUBLIC_CIMPLIFY_API_URL` at your Cimplify
|
|
13
|
-
* host and the rewrite continues to work the same way (or remove it and
|
|
14
|
-
* pass the absolute URL through `<CimplifyProvider/>`).
|
|
15
|
-
*/
|
|
16
10
|
const nextConfig: NextConfig = {
|
|
17
11
|
// Enable Next 16's `cacheComponents` mode so we can use `'use cache'` +
|
|
18
12
|
// `cacheTag` / `cacheLife` for SSR caching. Cached chrome streams first,
|
|
@@ -20,10 +14,10 @@ const nextConfig: NextConfig = {
|
|
|
20
14
|
cacheComponents: true,
|
|
21
15
|
async rewrites() {
|
|
22
16
|
return [
|
|
23
|
-
{ source: "/api/v1/:path*", destination: `${
|
|
24
|
-
{ source: "/img/:path*", destination: `${
|
|
25
|
-
{ source: "/elements/:path*", destination: `${
|
|
26
|
-
{ source: "/_mock/:path*", destination: `${
|
|
17
|
+
{ source: "/api/v1/:path*", destination: `${STOREFRONT_URL}/api/v1/:path*` },
|
|
18
|
+
{ source: "/img/:path*", destination: `${STOREFRONT_URL}/img/:path*` },
|
|
19
|
+
{ source: "/elements/:path*", destination: `${STOREFRONT_URL}/elements/:path*` },
|
|
20
|
+
{ source: "/_mock/:path*", destination: `${STOREFRONT_URL}/_mock/:path*` },
|
|
27
21
|
];
|
|
28
22
|
},
|
|
29
23
|
images: {
|
|
@@ -38,6 +32,7 @@ const nextConfig: NextConfig = {
|
|
|
38
32
|
{ protocol: "https", hostname: "static-tmp.cimplify.io", pathname: "/**" },
|
|
39
33
|
{ protocol: "https", hostname: "storefrontassetscdn.cimplify.io", pathname: "/**" },
|
|
40
34
|
{ protocol: "https", hostname: "cdn.cimplify.io", pathname: "/**" },
|
|
35
|
+
{ protocol: "https", hostname: "res.cloudinary.com", pathname: "/cimplify/**" },
|
|
41
36
|
],
|
|
42
37
|
},
|
|
43
38
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# which Next.js rewrites to the mock at 127.0.0.1:8787 (see next.config.ts).
|
|
4
|
-
# Production: set to your Cimplify host (e.g. https://api.cimplify.io).
|
|
5
|
-
NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
6
|
-
|
|
7
|
-
# Tenant public key. The mock accepts any value.
|
|
1
|
+
# Tenant public key. Get yours from the desk Developers tab. The mock
|
|
2
|
+
# accepts any value, so leave the placeholder during local dev.
|
|
8
3
|
NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
9
4
|
|
|
10
5
|
# Business id used by the mock seed (default: Akua's Bakery).
|
|
@@ -62,12 +62,10 @@ Update `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID` in `.env.local` to match the seeded bu
|
|
|
62
62
|
|
|
63
63
|
```diff
|
|
64
64
|
# .env.local
|
|
65
|
-
- NEXT_PUBLIC_CIMPLIFY_API_URL=http://127.0.0.1:8787
|
|
66
|
-
+ NEXT_PUBLIC_CIMPLIFY_API_URL=https://api.cimplify.io
|
|
67
65
|
- NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
68
66
|
+ NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=<your tenant key>
|
|
69
67
|
- NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_default_akua_bakery
|
|
70
68
|
+ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=<your business id>
|
|
71
69
|
```
|
|
72
70
|
|
|
73
|
-
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://
|
|
71
|
+
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://www.cimplify.dev/docs/cli). `next.config.ts` already whitelists the SDK image hosts under `images.remotePatterns`.
|
|
@@ -5,15 +5,11 @@ import { NextResponse } from "next/server";
|
|
|
5
5
|
*
|
|
6
6
|
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
7
|
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
-
* capabilities your storefront supports. We forward
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
-
*
|
|
13
|
-
* Edge-cached for an hour because capabilities change rarely.
|
|
8
|
+
* capabilities your storefront supports. We forward to Cimplify, which
|
|
9
|
+
* returns the canonical manifest. Edge-cached for an hour because
|
|
10
|
+
* capabilities change rarely.
|
|
14
11
|
*/
|
|
15
|
-
const UCP_API_BASE =
|
|
16
|
-
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
12
|
+
const UCP_API_BASE = "https://api.cimplify.io";
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
export async function GET() {
|
|
@@ -4,21 +4,12 @@ import { useMemo, type ReactNode } from "react";
|
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
5
|
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* <CimplifyProvider/>.
|
|
10
|
-
*
|
|
11
|
-
* Base-URL resolution:
|
|
12
|
-
* 1) If NEXT_PUBLIC_CIMPLIFY_API_URL is set, use it verbatim.
|
|
13
|
-
* 2) Otherwise use the current origin so requests flow through the
|
|
14
|
-
* Next.js rewrite in `next.config.ts` to the mock at :8787 (no CORS).
|
|
15
|
-
* 3) Fall back to 127.0.0.1:8787 only during SSR, when there's no window.
|
|
16
|
-
*/
|
|
7
|
+
// Same-origin client — every request goes through the Next.js rewrite in
|
|
8
|
+
// next.config.ts, so no CORS preflight ever hits the browser.
|
|
17
9
|
export function Providers({ children }: { children: ReactNode }) {
|
|
18
10
|
const client = useMemo(() => {
|
|
19
11
|
const baseUrl =
|
|
20
|
-
|
|
21
|
-
(typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787");
|
|
12
|
+
typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787";
|
|
22
13
|
const publicKey = process.env.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY ?? "mock-dev";
|
|
23
14
|
return createCimplifyClient({
|
|
24
15
|
baseUrl,
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Same-origin proxy target for the storefront API. Local mock in dev,
|
|
4
|
+
// hosted Cimplify in prod.
|
|
5
|
+
const STOREFRONT_URL =
|
|
6
|
+
process.env.NODE_ENV === "production"
|
|
7
|
+
? "https://storefronts.cimplify.io"
|
|
8
|
+
: "http://127.0.0.1:8787";
|
|
4
9
|
|
|
5
|
-
/**
|
|
6
|
-
* Same-origin proxy to the Cimplify mock so the browser never makes a
|
|
7
|
-
* cross-origin request in dev (no CORS preflights, no flaky `Origin`
|
|
8
|
-
* mismatches). The SDK's base URL stays empty/relative — requests go to
|
|
9
|
-
* `/api/v1/...` on the Next origin, then this rewrite forwards them to
|
|
10
|
-
* the mock at `127.0.0.1:8787`.
|
|
11
|
-
*
|
|
12
|
-
* In production, point `NEXT_PUBLIC_CIMPLIFY_API_URL` at your Cimplify
|
|
13
|
-
* host and the rewrite continues to work the same way (or remove it and
|
|
14
|
-
* pass the absolute URL through `<CimplifyProvider/>`).
|
|
15
|
-
*/
|
|
16
10
|
const nextConfig: NextConfig = {
|
|
17
11
|
// Enable Next 16's `cacheComponents` mode so we can use `'use cache'` +
|
|
18
12
|
// `cacheTag` / `cacheLife` for SSR caching. Cached chrome streams first,
|
|
@@ -20,10 +14,10 @@ const nextConfig: NextConfig = {
|
|
|
20
14
|
cacheComponents: true,
|
|
21
15
|
async rewrites() {
|
|
22
16
|
return [
|
|
23
|
-
{ source: "/api/v1/:path*", destination: `${
|
|
24
|
-
{ source: "/img/:path*", destination: `${
|
|
25
|
-
{ source: "/elements/:path*", destination: `${
|
|
26
|
-
{ source: "/_mock/:path*", destination: `${
|
|
17
|
+
{ source: "/api/v1/:path*", destination: `${STOREFRONT_URL}/api/v1/:path*` },
|
|
18
|
+
{ source: "/img/:path*", destination: `${STOREFRONT_URL}/img/:path*` },
|
|
19
|
+
{ source: "/elements/:path*", destination: `${STOREFRONT_URL}/elements/:path*` },
|
|
20
|
+
{ source: "/_mock/:path*", destination: `${STOREFRONT_URL}/_mock/:path*` },
|
|
27
21
|
];
|
|
28
22
|
},
|
|
29
23
|
images: {
|
|
@@ -38,6 +32,7 @@ const nextConfig: NextConfig = {
|
|
|
38
32
|
{ protocol: "https", hostname: "static-tmp.cimplify.io", pathname: "/**" },
|
|
39
33
|
{ protocol: "https", hostname: "storefrontassetscdn.cimplify.io", pathname: "/**" },
|
|
40
34
|
{ protocol: "https", hostname: "cdn.cimplify.io", pathname: "/**" },
|
|
35
|
+
{ protocol: "https", hostname: "res.cloudinary.com", pathname: "/cimplify/**" },
|
|
41
36
|
],
|
|
42
37
|
},
|
|
43
38
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# which Next.js rewrites to the mock at 127.0.0.1:8787 (see next.config.ts).
|
|
4
|
-
# Production: set to your Cimplify host (e.g. https://api.cimplify.io).
|
|
5
|
-
NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
6
|
-
|
|
7
|
-
# Tenant public key. The mock accepts any value.
|
|
1
|
+
# Tenant public key. Get yours from the desk Developers tab. The mock
|
|
2
|
+
# accepts any value, so leave the placeholder during local dev.
|
|
8
3
|
NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
9
4
|
|
|
10
|
-
# Business id used by the mock seed (
|
|
5
|
+
# Business id used by the mock seed (default: Studio FRX).
|
|
11
6
|
NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_studio_frx
|
|
12
7
|
|
|
13
8
|
# Canonical public site URL — used by sitemap.xml, robots.txt, llms.txt,
|
|
@@ -20,3 +15,12 @@ NEXT_PUBLIC_SITE_URL=https://example.com
|
|
|
20
15
|
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
16
|
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
17
|
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
18
|
+
|
|
19
|
+
# ── Escape hatches (rarely needed) ────────────────────────────────────
|
|
20
|
+
# Override the storefront API host (where /api/v1/catalogue, /api/v1/orders
|
|
21
|
+
# live). Defaults to https://storefronts.cimplify.io in production,
|
|
22
|
+
# 127.0.0.1:8787 in dev. Set only for self-hosted Cimplify or staging.
|
|
23
|
+
# NEXT_PUBLIC_CIMPLIFY_STOREFRONT_URL=
|
|
24
|
+
|
|
25
|
+
# Override the management/UCP host. Defaults to https://api.cimplify.io.
|
|
26
|
+
# NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
@@ -66,12 +66,10 @@ cimplify init my-store --template grocery # coming soon
|
|
|
66
66
|
|
|
67
67
|
```diff
|
|
68
68
|
# .env.local
|
|
69
|
-
- NEXT_PUBLIC_CIMPLIFY_API_URL=http://127.0.0.1:8787
|
|
70
|
-
+ NEXT_PUBLIC_CIMPLIFY_API_URL=https://api.cimplify.io
|
|
71
69
|
- NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
72
70
|
+ NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=<your tenant key>
|
|
73
|
-
- NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=
|
|
71
|
+
- NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_studio_frx
|
|
74
72
|
+ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=<your business id>
|
|
75
73
|
```
|
|
76
74
|
|
|
77
|
-
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://
|
|
75
|
+
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://www.cimplify.dev/docs/cli). `next.config.ts` already whitelists the SDK image hosts under `images.remotePatterns`.
|
|
@@ -5,15 +5,11 @@ import { NextResponse } from "next/server";
|
|
|
5
5
|
*
|
|
6
6
|
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
7
|
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
-
* capabilities your storefront supports. We forward
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
-
*
|
|
13
|
-
* Edge-cached for an hour because capabilities change rarely.
|
|
8
|
+
* capabilities your storefront supports. We forward to Cimplify, which
|
|
9
|
+
* returns the canonical manifest. Edge-cached for an hour because
|
|
10
|
+
* capabilities change rarely.
|
|
14
11
|
*/
|
|
15
|
-
const UCP_API_BASE =
|
|
16
|
-
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
12
|
+
const UCP_API_BASE = "https://api.cimplify.io";
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
export async function GET() {
|
|
@@ -4,21 +4,12 @@ import { useMemo, type ReactNode } from "react";
|
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
5
|
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* <CimplifyProvider/>.
|
|
10
|
-
*
|
|
11
|
-
* Base-URL resolution:
|
|
12
|
-
* 1) If NEXT_PUBLIC_CIMPLIFY_API_URL is set, use it verbatim.
|
|
13
|
-
* 2) Otherwise use the current origin so requests flow through the
|
|
14
|
-
* Next.js rewrite in `next.config.ts` to the mock at :8787 (no CORS).
|
|
15
|
-
* 3) Fall back to 127.0.0.1:8787 only during SSR, when there's no window.
|
|
16
|
-
*/
|
|
7
|
+
// Same-origin client — every request goes through the Next.js rewrite in
|
|
8
|
+
// next.config.ts, so no CORS preflight ever hits the browser.
|
|
17
9
|
export function Providers({ children }: { children: ReactNode }) {
|
|
18
10
|
const client = useMemo(() => {
|
|
19
11
|
const baseUrl =
|
|
20
|
-
|
|
21
|
-
(typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787");
|
|
12
|
+
typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787";
|
|
22
13
|
const publicKey = process.env.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY ?? "mock-dev";
|
|
23
14
|
return createCimplifyClient({
|
|
24
15
|
baseUrl,
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Same-origin proxy target for the storefront API. Local mock in dev,
|
|
4
|
+
// hosted Cimplify in prod.
|
|
5
|
+
const STOREFRONT_URL =
|
|
6
|
+
process.env.NODE_ENV === "production"
|
|
7
|
+
? "https://storefronts.cimplify.io"
|
|
8
|
+
: "http://127.0.0.1:8787";
|
|
4
9
|
|
|
5
|
-
/**
|
|
6
|
-
* Same-origin proxy to the Cimplify mock so the browser never makes a
|
|
7
|
-
* cross-origin request in dev (no CORS preflights, no flaky `Origin`
|
|
8
|
-
* mismatches). The SDK's base URL stays empty/relative — requests go to
|
|
9
|
-
* `/api/v1/...` on the Next origin, then this rewrite forwards them to
|
|
10
|
-
* the mock at `127.0.0.1:8787`.
|
|
11
|
-
*
|
|
12
|
-
* In production, point `NEXT_PUBLIC_CIMPLIFY_API_URL` at your Cimplify
|
|
13
|
-
* host and the rewrite continues to work the same way (or remove it and
|
|
14
|
-
* pass the absolute URL through `<CimplifyProvider/>`).
|
|
15
|
-
*/
|
|
16
10
|
const nextConfig: NextConfig = {
|
|
17
11
|
// Enable Next 16's `cacheComponents` mode so we can use `'use cache'` +
|
|
18
12
|
// `cacheTag` / `cacheLife` for SSR caching. Cached chrome streams first,
|
|
@@ -20,10 +14,10 @@ const nextConfig: NextConfig = {
|
|
|
20
14
|
cacheComponents: true,
|
|
21
15
|
async rewrites() {
|
|
22
16
|
return [
|
|
23
|
-
{ source: "/api/v1/:path*", destination: `${
|
|
24
|
-
{ source: "/img/:path*", destination: `${
|
|
25
|
-
{ source: "/elements/:path*", destination: `${
|
|
26
|
-
{ source: "/_mock/:path*", destination: `${
|
|
17
|
+
{ source: "/api/v1/:path*", destination: `${STOREFRONT_URL}/api/v1/:path*` },
|
|
18
|
+
{ source: "/img/:path*", destination: `${STOREFRONT_URL}/img/:path*` },
|
|
19
|
+
{ source: "/elements/:path*", destination: `${STOREFRONT_URL}/elements/:path*` },
|
|
20
|
+
{ source: "/_mock/:path*", destination: `${STOREFRONT_URL}/_mock/:path*` },
|
|
27
21
|
];
|
|
28
22
|
},
|
|
29
23
|
images: {
|
|
@@ -38,6 +32,7 @@ const nextConfig: NextConfig = {
|
|
|
38
32
|
{ protocol: "https", hostname: "static-tmp.cimplify.io", pathname: "/**" },
|
|
39
33
|
{ protocol: "https", hostname: "storefrontassetscdn.cimplify.io", pathname: "/**" },
|
|
40
34
|
{ protocol: "https", hostname: "cdn.cimplify.io", pathname: "/**" },
|
|
35
|
+
{ protocol: "https", hostname: "res.cloudinary.com", pathname: "/cimplify/**" },
|
|
41
36
|
],
|
|
42
37
|
},
|
|
43
38
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# which Next.js rewrites to the mock at 127.0.0.1:8787 (see next.config.ts).
|
|
4
|
-
# Production: set to your Cimplify host (e.g. https://api.cimplify.io).
|
|
5
|
-
NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
6
|
-
|
|
7
|
-
# Tenant public key. The mock accepts any value.
|
|
1
|
+
# Tenant public key. Get yours from the desk Developers tab. The mock
|
|
2
|
+
# accepts any value, so leave the placeholder during local dev.
|
|
8
3
|
NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
9
4
|
|
|
10
|
-
# Business id used by the mock seed (
|
|
5
|
+
# Business id used by the mock seed (default: FreshMart).
|
|
11
6
|
NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_freshmart
|
|
12
7
|
|
|
13
8
|
# Canonical public site URL — used by sitemap.xml, robots.txt, llms.txt,
|
|
@@ -20,3 +15,12 @@ NEXT_PUBLIC_SITE_URL=https://example.com
|
|
|
20
15
|
# Gemini) can discover this storefront's commerce capabilities. Set this
|
|
21
16
|
# on production deploys; leave empty in dev unless you're testing UCP.
|
|
22
17
|
NEXT_PUBLIC_CIMPLIFY_BUSINESS_HANDLE=
|
|
18
|
+
|
|
19
|
+
# ── Escape hatches (rarely needed) ────────────────────────────────────
|
|
20
|
+
# Override the storefront API host (where /api/v1/catalogue, /api/v1/orders
|
|
21
|
+
# live). Defaults to https://storefronts.cimplify.io in production,
|
|
22
|
+
# 127.0.0.1:8787 in dev. Set only for self-hosted Cimplify or staging.
|
|
23
|
+
# NEXT_PUBLIC_CIMPLIFY_STOREFRONT_URL=
|
|
24
|
+
|
|
25
|
+
# Override the management/UCP host. Defaults to https://api.cimplify.io.
|
|
26
|
+
# NEXT_PUBLIC_CIMPLIFY_API_URL=
|
|
@@ -62,12 +62,10 @@ Update `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID` in `.env.local` to match the seeded bu
|
|
|
62
62
|
|
|
63
63
|
```diff
|
|
64
64
|
# .env.local
|
|
65
|
-
- NEXT_PUBLIC_CIMPLIFY_API_URL=http://127.0.0.1:8787
|
|
66
|
-
+ NEXT_PUBLIC_CIMPLIFY_API_URL=https://api.cimplify.io
|
|
67
65
|
- NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=mock-dev
|
|
68
66
|
+ NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=<your tenant key>
|
|
69
|
-
- NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=
|
|
67
|
+
- NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=bus_freshmart
|
|
70
68
|
+ NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID=<your business id>
|
|
71
69
|
```
|
|
72
70
|
|
|
73
|
-
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://
|
|
71
|
+
Deploy with `cimplify deploy --prod` after linking the project. See [`cimplify` CLI docs](https://www.cimplify.dev/docs/cli). `next.config.ts` already whitelists the SDK image hosts under `images.remotePatterns`.
|
|
@@ -5,15 +5,11 @@ import { NextResponse } from "next/server";
|
|
|
5
5
|
*
|
|
6
6
|
* Agents — Claude, ChatGPT, Gemini, MCP clients — probe
|
|
7
7
|
* `https://<your-domain>/.well-known/ucp` to learn what commerce
|
|
8
|
-
* capabilities your storefront supports. We forward
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `api.cimplify.io/ucp/v1/<handle>/*` (no per-request proxy here).
|
|
12
|
-
*
|
|
13
|
-
* Edge-cached for an hour because capabilities change rarely.
|
|
8
|
+
* capabilities your storefront supports. We forward to Cimplify, which
|
|
9
|
+
* returns the canonical manifest. Edge-cached for an hour because
|
|
10
|
+
* capabilities change rarely.
|
|
14
11
|
*/
|
|
15
|
-
const UCP_API_BASE =
|
|
16
|
-
process.env.NEXT_PUBLIC_CIMPLIFY_API_URL || "https://api.cimplify.io";
|
|
12
|
+
const UCP_API_BASE = "https://api.cimplify.io";
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
export async function GET() {
|
|
@@ -4,21 +4,12 @@ import { useMemo, type ReactNode } from "react";
|
|
|
4
4
|
import { createCimplifyClient } from "@cimplify/sdk";
|
|
5
5
|
import { CimplifyProvider, CartDrawerProvider } from "@cimplify/sdk/react";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* <CimplifyProvider/>.
|
|
10
|
-
*
|
|
11
|
-
* Base-URL resolution:
|
|
12
|
-
* 1) If NEXT_PUBLIC_CIMPLIFY_API_URL is set, use it verbatim.
|
|
13
|
-
* 2) Otherwise use the current origin so requests flow through the
|
|
14
|
-
* Next.js rewrite in `next.config.ts` to the mock at :8787 (no CORS).
|
|
15
|
-
* 3) Fall back to 127.0.0.1:8787 only during SSR, when there's no window.
|
|
16
|
-
*/
|
|
7
|
+
// Same-origin client — every request goes through the Next.js rewrite in
|
|
8
|
+
// next.config.ts, so no CORS preflight ever hits the browser.
|
|
17
9
|
export function Providers({ children }: { children: ReactNode }) {
|
|
18
10
|
const client = useMemo(() => {
|
|
19
11
|
const baseUrl =
|
|
20
|
-
|
|
21
|
-
(typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787");
|
|
12
|
+
typeof window !== "undefined" ? window.location.origin : "http://127.0.0.1:8787";
|
|
22
13
|
const publicKey = process.env.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY ?? "mock-dev";
|
|
23
14
|
return createCimplifyClient({
|
|
24
15
|
baseUrl,
|