@cmssy/next 0.5.5 → 0.5.6

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/index.cjs CHANGED
@@ -71,6 +71,15 @@ function sessionCookieOptions() {
71
71
  }
72
72
 
73
73
  // src/config.ts
74
+ var DEFAULT_CMSSY_EDITOR_ORIGIN = "https://www.cmssy.io";
75
+ function resolveEditorOrigin(editorOrigin) {
76
+ if (editorOrigin === void 0) return DEFAULT_CMSSY_EDITOR_ORIGIN;
77
+ if (Array.isArray(editorOrigin)) {
78
+ const cleaned = editorOrigin.filter((o) => o && o.trim().length > 0);
79
+ return cleaned.length > 0 ? cleaned : DEFAULT_CMSSY_EDITOR_ORIGIN;
80
+ }
81
+ return editorOrigin.trim().length > 0 ? editorOrigin : DEFAULT_CMSSY_EDITOR_ORIGIN;
82
+ }
74
83
  function assertAuthConfig(config) {
75
84
  const auth = config.auth;
76
85
  if (!auth || typeof auth.modelSlug !== "string" || !auth.modelSlug) {
@@ -122,7 +131,8 @@ function toCspOrigin(origin) {
122
131
  return parsed.origin;
123
132
  }
124
133
  function frameAncestors(editorOrigin) {
125
- const origins = Array.isArray(editorOrigin) ? editorOrigin : [editorOrigin];
134
+ const resolved = resolveEditorOrigin(editorOrigin);
135
+ const origins = Array.isArray(resolved) ? resolved : [resolved];
126
136
  if (origins.length === 0) {
127
137
  throw new Error(
128
138
  "cmssy: editorOrigin must contain at least one valid origin"
@@ -265,7 +275,8 @@ function createCmssyPage(config, blocks, options) {
265
275
  };
266
276
  }
267
277
  function resolveBridgeOrigin(editorOrigin) {
268
- const origins = Array.isArray(editorOrigin) ? editorOrigin : [editorOrigin];
278
+ const resolved = resolveEditorOrigin(editorOrigin);
279
+ const origins = Array.isArray(resolved) ? resolved : [resolved];
269
280
  if (origins.length === 0) {
270
281
  throw new Error("cmssy: editorOrigin must be set to frame the editor");
271
282
  }
@@ -277,7 +288,7 @@ function resolveBridgeOrigin(editorOrigin) {
277
288
  const origin = toCspOrigin(origins[0].trim());
278
289
  if (origin === "*") {
279
290
  throw new Error(
280
- "cmssy: editorOrigin '*' is not allowed for the live-edit bridge; set the concrete editor origin (e.g. https://app.cmssy.io)"
291
+ "cmssy: editorOrigin '*' is not allowed for the live-edit bridge; set the concrete editor origin (e.g. https://www.cmssy.io)"
281
292
  );
282
293
  }
283
294
  return origin;
@@ -659,7 +670,7 @@ var VERIFY_MUTATION = `mutation SiteMemberVerifyEmail($token: String!) {
659
670
  }`;
660
671
  var workspaceIdCache = /* @__PURE__ */ new Map();
661
672
  function workspaceIdFor(config) {
662
- const key = `${config.apiUrl}::${config.workspaceSlug}`;
673
+ const key = `${react.resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
663
674
  const existing = workspaceIdCache.get(key);
664
675
  if (existing) return existing;
665
676
  const fresh = react.resolveWorkspaceId(config).catch((err) => {
@@ -1046,7 +1057,7 @@ var PRODUCT = `query Product($workspaceId: String!, $modelSlug: String!, $filter
1046
1057
  }`;
1047
1058
  var workspaceIdCache2 = /* @__PURE__ */ new Map();
1048
1059
  function workspaceIdFor2(config) {
1049
- const key = `${config.apiUrl}::${config.workspaceSlug}`;
1060
+ const key = `${react.resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
1050
1061
  const existing = workspaceIdCache2.get(key);
1051
1062
  if (existing) return existing;
1052
1063
  const fresh = react.resolveWorkspaceId(config).catch((err) => {
@@ -1454,7 +1465,7 @@ var MY_ORDER = `query MyOrder($workspaceId: ID!, $id: ID!) {
1454
1465
  }`;
1455
1466
  var workspaceIdCache3 = /* @__PURE__ */ new Map();
1456
1467
  function workspaceIdFor3(config) {
1457
- const key = `${config.apiUrl}::${config.workspaceSlug}`;
1468
+ const key = `${react.resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
1458
1469
  const existing = workspaceIdCache3.get(key);
1459
1470
  if (existing) return existing;
1460
1471
  const fresh = react.resolveWorkspaceId(config).catch((err) => {
@@ -1607,11 +1618,20 @@ function verifyCmssyWebhook(options) {
1607
1618
  return parsed;
1608
1619
  }
1609
1620
 
1621
+ Object.defineProperty(exports, "DEFAULT_CMSSY_API_URL", {
1622
+ enumerable: true,
1623
+ get: function () { return react.DEFAULT_CMSSY_API_URL; }
1624
+ });
1625
+ Object.defineProperty(exports, "resolveApiUrl", {
1626
+ enumerable: true,
1627
+ get: function () { return react.resolveApiUrl; }
1628
+ });
1610
1629
  exports.CMSSY_CART_COOKIE = CMSSY_CART_COOKIE;
1611
1630
  exports.CMSSY_EDIT_HEADER = CMSSY_EDIT_HEADER;
1612
1631
  exports.CMSSY_LOCALE_HEADER = CMSSY_LOCALE_HEADER;
1613
1632
  exports.CMSSY_SESSION_COOKIE = CMSSY_SESSION_COOKIE;
1614
1633
  exports.CmssyWebhookError = CmssyWebhookError;
1634
+ exports.DEFAULT_CMSSY_EDITOR_ORIGIN = DEFAULT_CMSSY_EDITOR_ORIGIN;
1615
1635
  exports.SESSION_MAX_AGE_SECONDS = SESSION_MAX_AGE_SECONDS;
1616
1636
  exports.applyCmssyCsp = applyCmssyCsp;
1617
1637
  exports.assertAuthConfig = assertAuthConfig;
@@ -1637,6 +1657,7 @@ exports.isCmssyEditMode = isCmssyEditMode;
1637
1657
  exports.isCmssyEditRequest = isCmssyEditRequest;
1638
1658
  exports.localeForPathname = localeForPathname;
1639
1659
  exports.openSession = openSession;
1660
+ exports.resolveEditorOrigin = resolveEditorOrigin;
1640
1661
  exports.resolveLocaleFromPathname = resolveLocaleFromPathname;
1641
1662
  exports.sealSession = sealSession;
1642
1663
  exports.sessionCookieOptions = sessionCookieOptions;
package/dist/index.d.cts CHANGED
@@ -1,19 +1,36 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import { CmssyPageData, CmssyFormDefinition, BlockDefinition, CmssyClientConfig, CmssyProduct, CmssyOrder } from '@cmssy/react';
4
+ export { DEFAULT_CMSSY_API_URL, resolveApiUrl } from '@cmssy/react';
4
5
  import { EditBridgeConfig } from '@cmssy/react/client';
5
6
  import { MetadataRoute, Metadata } from 'next';
6
7
  import { NextRequest, NextResponse } from 'next/server';
7
8
 
9
+ /**
10
+ * Origin of the cmssy admin/editor that frames your site (postMessage source +
11
+ * CSP `frame-ancestors`). Identical for every workspace on cmssy cloud, so
12
+ * `editorOrigin` defaults to this. Self-hosted admins override it via config.
13
+ */
14
+ declare const DEFAULT_CMSSY_EDITOR_ORIGIN = "https://www.cmssy.io";
15
+ /** Resolves `editorOrigin`, falling back to the cmssy cloud admin when unset. */
16
+ declare function resolveEditorOrigin(editorOrigin: string | string[] | undefined): string | string[];
8
17
  interface CmssyAuthConfig {
9
18
  modelSlug: string;
10
19
  sessionSecret: string;
11
20
  }
12
21
  interface CmssyNextConfig {
13
- apiUrl: string;
22
+ /**
23
+ * Full GraphQL delivery endpoint. Defaults to the cmssy cloud endpoint
24
+ * (`https://api.cmssy.io/graphql`); set it only for self-hosted / staging.
25
+ */
26
+ apiUrl?: string;
14
27
  workspaceSlug: string;
15
28
  draftSecret: string;
16
- editorOrigin: string | string[];
29
+ /**
30
+ * Origin allowed to frame your app in the editor. Defaults to
31
+ * {@link DEFAULT_CMSSY_EDITOR_ORIGIN}; set it only for self-hosted admins.
32
+ */
33
+ editorOrigin?: string | string[];
17
34
  /**
18
35
  * Canonical absolute site URL (e.g. https://cmssy.com), used by
19
36
  * createCmssyRobots / createCmssySitemap. When omitted the helpers derive the
@@ -141,7 +158,8 @@ type CmssyDraftRouteConfig = Pick<CmssyNextConfig, "draftSecret"> & {
141
158
  declare function createDraftRoute(config: CmssyDraftRouteConfig): (request: Request) => Promise<Response>;
142
159
 
143
160
  interface CmssyCspOptions {
144
- editorOrigin: string | string[];
161
+ /** Defaults to the cmssy cloud admin origin when unset. */
162
+ editorOrigin?: string | string[];
145
163
  }
146
164
  interface MutableHeaders {
147
165
  headers: {
@@ -328,4 +346,4 @@ declare class CmssyWebhookError extends Error {
328
346
  */
329
347
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): CmssyWebhookEvent;
330
348
 
331
- export { type BuildCmssyMetadataOptions, CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyNotFoundOptions, type CreateCmssyPageOptions, type CreateCmssyRobotsOptions, type CreateCmssySitemapOptions, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, buildCmssyMetadata, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyNotFound, createCmssyOrdersRoute, createCmssyPage, createCmssyRobots, createCmssySitemap, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
349
+ export { type BuildCmssyMetadataOptions, CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyNotFoundOptions, type CreateCmssyPageOptions, type CreateCmssyRobotsOptions, type CreateCmssySitemapOptions, DEFAULT_CMSSY_EDITOR_ORIGIN, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, buildCmssyMetadata, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyNotFound, createCmssyOrdersRoute, createCmssyPage, createCmssyRobots, createCmssySitemap, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveEditorOrigin, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
package/dist/index.d.ts CHANGED
@@ -1,19 +1,36 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import { CmssyPageData, CmssyFormDefinition, BlockDefinition, CmssyClientConfig, CmssyProduct, CmssyOrder } from '@cmssy/react';
4
+ export { DEFAULT_CMSSY_API_URL, resolveApiUrl } from '@cmssy/react';
4
5
  import { EditBridgeConfig } from '@cmssy/react/client';
5
6
  import { MetadataRoute, Metadata } from 'next';
6
7
  import { NextRequest, NextResponse } from 'next/server';
7
8
 
9
+ /**
10
+ * Origin of the cmssy admin/editor that frames your site (postMessage source +
11
+ * CSP `frame-ancestors`). Identical for every workspace on cmssy cloud, so
12
+ * `editorOrigin` defaults to this. Self-hosted admins override it via config.
13
+ */
14
+ declare const DEFAULT_CMSSY_EDITOR_ORIGIN = "https://www.cmssy.io";
15
+ /** Resolves `editorOrigin`, falling back to the cmssy cloud admin when unset. */
16
+ declare function resolveEditorOrigin(editorOrigin: string | string[] | undefined): string | string[];
8
17
  interface CmssyAuthConfig {
9
18
  modelSlug: string;
10
19
  sessionSecret: string;
11
20
  }
12
21
  interface CmssyNextConfig {
13
- apiUrl: string;
22
+ /**
23
+ * Full GraphQL delivery endpoint. Defaults to the cmssy cloud endpoint
24
+ * (`https://api.cmssy.io/graphql`); set it only for self-hosted / staging.
25
+ */
26
+ apiUrl?: string;
14
27
  workspaceSlug: string;
15
28
  draftSecret: string;
16
- editorOrigin: string | string[];
29
+ /**
30
+ * Origin allowed to frame your app in the editor. Defaults to
31
+ * {@link DEFAULT_CMSSY_EDITOR_ORIGIN}; set it only for self-hosted admins.
32
+ */
33
+ editorOrigin?: string | string[];
17
34
  /**
18
35
  * Canonical absolute site URL (e.g. https://cmssy.com), used by
19
36
  * createCmssyRobots / createCmssySitemap. When omitted the helpers derive the
@@ -141,7 +158,8 @@ type CmssyDraftRouteConfig = Pick<CmssyNextConfig, "draftSecret"> & {
141
158
  declare function createDraftRoute(config: CmssyDraftRouteConfig): (request: Request) => Promise<Response>;
142
159
 
143
160
  interface CmssyCspOptions {
144
- editorOrigin: string | string[];
161
+ /** Defaults to the cmssy cloud admin origin when unset. */
162
+ editorOrigin?: string | string[];
145
163
  }
146
164
  interface MutableHeaders {
147
165
  headers: {
@@ -328,4 +346,4 @@ declare class CmssyWebhookError extends Error {
328
346
  */
329
347
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): CmssyWebhookEvent;
330
348
 
331
- export { type BuildCmssyMetadataOptions, CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyNotFoundOptions, type CreateCmssyPageOptions, type CreateCmssyRobotsOptions, type CreateCmssySitemapOptions, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, buildCmssyMetadata, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyNotFound, createCmssyOrdersRoute, createCmssyPage, createCmssyRobots, createCmssySitemap, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
349
+ export { type BuildCmssyMetadataOptions, CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, type CmssyAuthConfig, type CmssyAuthMiddleware, type CmssyAuthRouteHandlers, type CmssyCartRouteHandlers, type CmssyCspOptions, type CmssyDraftRouteConfig, type CmssyEditorProps, type CmssyNextConfig, type CmssyOrdersRouteHandlers, type CmssySessionPayload, type CmssySessionUser, CmssyWebhookError, type CmssyWebhookEvent, type CmssyWebhookOrder, type CreateCmssyNotFoundOptions, type CreateCmssyPageOptions, type CreateCmssyRobotsOptions, type CreateCmssySitemapOptions, DEFAULT_CMSSY_EDITOR_ORIGIN, type FetchProductOptions, type FetchProductsOptions, type MyOrdersResult, SESSION_MAX_AGE_SECONDS, type SessionCookieOptions, type VerifyCmssyWebhookOptions, applyCmssyCsp, assertAuthConfig, buildCmssyMetadata, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyNotFound, createCmssyOrdersRoute, createCmssyPage, createCmssyRobots, createCmssySitemap, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveEditorOrigin, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { draftMode, headers, cookies } from 'next/headers';
2
2
  import { notFound, redirect } from 'next/navigation';
3
- import { createCmssyClient, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, CmssyServerPage, fetchSiteConfig, fetchPageById, fetchPages, fetchPageMeta, normalizeSlug as normalizeSlug$1, resolveWorkspaceId, graphqlRequest } from '@cmssy/react';
3
+ import { createCmssyClient, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, CmssyServerPage, fetchSiteConfig, fetchPageById, fetchPages, fetchPageMeta, normalizeSlug as normalizeSlug$1, resolveWorkspaceId, graphqlRequest, resolveApiUrl } from '@cmssy/react';
4
+ export { DEFAULT_CMSSY_API_URL, resolveApiUrl } from '@cmssy/react';
4
5
  import { CmssyLocaleProvider } from '@cmssy/react/client';
5
6
  import { EncryptJWT, jwtDecrypt } from 'jose';
6
7
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -69,6 +70,15 @@ function sessionCookieOptions() {
69
70
  }
70
71
 
71
72
  // src/config.ts
73
+ var DEFAULT_CMSSY_EDITOR_ORIGIN = "https://www.cmssy.io";
74
+ function resolveEditorOrigin(editorOrigin) {
75
+ if (editorOrigin === void 0) return DEFAULT_CMSSY_EDITOR_ORIGIN;
76
+ if (Array.isArray(editorOrigin)) {
77
+ const cleaned = editorOrigin.filter((o) => o && o.trim().length > 0);
78
+ return cleaned.length > 0 ? cleaned : DEFAULT_CMSSY_EDITOR_ORIGIN;
79
+ }
80
+ return editorOrigin.trim().length > 0 ? editorOrigin : DEFAULT_CMSSY_EDITOR_ORIGIN;
81
+ }
72
82
  function assertAuthConfig(config) {
73
83
  const auth = config.auth;
74
84
  if (!auth || typeof auth.modelSlug !== "string" || !auth.modelSlug) {
@@ -120,7 +130,8 @@ function toCspOrigin(origin) {
120
130
  return parsed.origin;
121
131
  }
122
132
  function frameAncestors(editorOrigin) {
123
- const origins = Array.isArray(editorOrigin) ? editorOrigin : [editorOrigin];
133
+ const resolved = resolveEditorOrigin(editorOrigin);
134
+ const origins = Array.isArray(resolved) ? resolved : [resolved];
124
135
  if (origins.length === 0) {
125
136
  throw new Error(
126
137
  "cmssy: editorOrigin must contain at least one valid origin"
@@ -263,7 +274,8 @@ function createCmssyPage(config, blocks, options) {
263
274
  };
264
275
  }
265
276
  function resolveBridgeOrigin(editorOrigin) {
266
- const origins = Array.isArray(editorOrigin) ? editorOrigin : [editorOrigin];
277
+ const resolved = resolveEditorOrigin(editorOrigin);
278
+ const origins = Array.isArray(resolved) ? resolved : [resolved];
267
279
  if (origins.length === 0) {
268
280
  throw new Error("cmssy: editorOrigin must be set to frame the editor");
269
281
  }
@@ -275,7 +287,7 @@ function resolveBridgeOrigin(editorOrigin) {
275
287
  const origin = toCspOrigin(origins[0].trim());
276
288
  if (origin === "*") {
277
289
  throw new Error(
278
- "cmssy: editorOrigin '*' is not allowed for the live-edit bridge; set the concrete editor origin (e.g. https://app.cmssy.io)"
290
+ "cmssy: editorOrigin '*' is not allowed for the live-edit bridge; set the concrete editor origin (e.g. https://www.cmssy.io)"
279
291
  );
280
292
  }
281
293
  return origin;
@@ -657,7 +669,7 @@ var VERIFY_MUTATION = `mutation SiteMemberVerifyEmail($token: String!) {
657
669
  }`;
658
670
  var workspaceIdCache = /* @__PURE__ */ new Map();
659
671
  function workspaceIdFor(config) {
660
- const key = `${config.apiUrl}::${config.workspaceSlug}`;
672
+ const key = `${resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
661
673
  const existing = workspaceIdCache.get(key);
662
674
  if (existing) return existing;
663
675
  const fresh = resolveWorkspaceId(config).catch((err) => {
@@ -1044,7 +1056,7 @@ var PRODUCT = `query Product($workspaceId: String!, $modelSlug: String!, $filter
1044
1056
  }`;
1045
1057
  var workspaceIdCache2 = /* @__PURE__ */ new Map();
1046
1058
  function workspaceIdFor2(config) {
1047
- const key = `${config.apiUrl}::${config.workspaceSlug}`;
1059
+ const key = `${resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
1048
1060
  const existing = workspaceIdCache2.get(key);
1049
1061
  if (existing) return existing;
1050
1062
  const fresh = resolveWorkspaceId(config).catch((err) => {
@@ -1452,7 +1464,7 @@ var MY_ORDER = `query MyOrder($workspaceId: ID!, $id: ID!) {
1452
1464
  }`;
1453
1465
  var workspaceIdCache3 = /* @__PURE__ */ new Map();
1454
1466
  function workspaceIdFor3(config) {
1455
- const key = `${config.apiUrl}::${config.workspaceSlug}`;
1467
+ const key = `${resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
1456
1468
  const existing = workspaceIdCache3.get(key);
1457
1469
  if (existing) return existing;
1458
1470
  const fresh = resolveWorkspaceId(config).catch((err) => {
@@ -1605,4 +1617,4 @@ function verifyCmssyWebhook(options) {
1605
1617
  return parsed;
1606
1618
  }
1607
1619
 
1608
- export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, CmssyWebhookError, SESSION_MAX_AGE_SECONDS, applyCmssyCsp, assertAuthConfig, buildCmssyMetadata, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyNotFound, createCmssyOrdersRoute, createCmssyPage, createCmssyRobots, createCmssySitemap, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
1620
+ export { CMSSY_CART_COOKIE, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CMSSY_SESSION_COOKIE, CmssyWebhookError, DEFAULT_CMSSY_EDITOR_ORIGIN, SESSION_MAX_AGE_SECONDS, applyCmssyCsp, assertAuthConfig, buildCmssyMetadata, cmssyCspHeaders, createCmssyAuthMiddleware, createCmssyAuthRoute, createCmssyCartRoute, createCmssyLocaleMiddleware, createCmssyNotFound, createCmssyOrdersRoute, createCmssyPage, createCmssyRobots, createCmssySitemap, createDraftRoute, fetchProduct, fetchProducts, getCmssyAccessToken, getCmssyLocale, getCmssyUser, isAccessExpired, isCmssyEditMode, isCmssyEditRequest, localeForPathname, openSession, resolveEditorOrigin, resolveLocaleFromPathname, sealSession, sessionCookieOptions, splitCmssyLocale, verifyCmssyWebhook };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -41,7 +41,7 @@
41
41
  "dist"
42
42
  ],
43
43
  "peerDependencies": {
44
- "@cmssy/react": "^0.5.5",
44
+ "@cmssy/react": "^0.5.6",
45
45
  "next": ">=15",
46
46
  "react": "^18.2.0 || ^19.0.0",
47
47
  "react-dom": "^18.2.0 || ^19.0.0"
@@ -54,7 +54,7 @@
54
54
  "tsup": "^8.3.0",
55
55
  "typescript": "^5.6.0",
56
56
  "vitest": "^2.1.0",
57
- "@cmssy/react": "0.5.5"
57
+ "@cmssy/react": "0.5.6"
58
58
  },
59
59
  "dependencies": {
60
60
  "jose": "^6.2.3"