@cmssy/next 0.7.5 → 0.7.7

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
@@ -204,7 +204,6 @@ function applyCmssyCsp(response, options) {
204
204
  return response;
205
205
  }
206
206
  var EDIT_QUERY_PARAM = "cmssyEdit";
207
- var DEV_QUERY_PARAM = "cmssyDev";
208
207
  function hasEditFlag(value) {
209
208
  return Array.isArray(value) ? value.includes("1") : value === "1";
210
209
  }
@@ -229,9 +228,7 @@ function createCmssyPage(config, blocks, options) {
229
228
  const query = searchParams ? await searchParams : {};
230
229
  const editMode = isEnabled || hasEditFlag(query[EDIT_QUERY_PARAM]);
231
230
  const devAllowed = isDevelopment() && Boolean(config.devToken?.trim());
232
- const devFlagged = hasEditFlag(query[DEV_QUERY_PARAM]);
233
- const devPreview = devAllowed && devFlagged;
234
- const editorActive = editMode || devAllowed && devFlagged;
231
+ const editorActive = editMode;
235
232
  let locale;
236
233
  let pagePath = path;
237
234
  let defaultLocale;
@@ -248,11 +245,11 @@ function createCmssyPage(config, blocks, options) {
248
245
  locale = split.locale;
249
246
  pagePath = split.path;
250
247
  }
251
- const devWorkspaceId = devPreview ? await client$1.resolveWorkspaceId() : void 0;
248
+ const devWorkspaceId = devAllowed ? await client$1.resolveWorkspaceId() : void 0;
252
249
  const page = await react.fetchPage(clientConfig, pagePath, {
253
250
  previewSecret: editMode ? config.draftSecret : void 0,
254
- devPreview: devPreview || void 0,
255
- devToken: devPreview ? config.devToken : void 0,
251
+ devPreview: devAllowed || void 0,
252
+ devToken: devAllowed ? config.devToken : void 0,
256
253
  workspaceId: devWorkspaceId
257
254
  });
258
255
  if (!page) {
package/dist/index.d.cts CHANGED
@@ -20,6 +20,15 @@ interface CmssyNextConfig {
20
20
  apiUrl?: string;
21
21
  workspaceSlug: string;
22
22
  draftSecret: string;
23
+ /**
24
+ * A cmssy API token (`cs_…`) that opts this app into the editor-controlled dev
25
+ * preview. In development only, the SDK sends it on every page fetch so the
26
+ * backend can resolve the token's user and honour that user's dev-preview flag
27
+ * (toggled from the editor's dev-mode switch): flag on + a saved dev draft ⇒
28
+ * the draft overlay renders, otherwise published content. Server-only (never
29
+ * reaches the client); ignored outside development. See the Quickstart
30
+ * "Dev preview" section.
31
+ */
23
32
  devToken?: string;
24
33
  /**
25
34
  * Origin allowed to frame your app in the editor. Defaults to
package/dist/index.d.ts CHANGED
@@ -20,6 +20,15 @@ interface CmssyNextConfig {
20
20
  apiUrl?: string;
21
21
  workspaceSlug: string;
22
22
  draftSecret: string;
23
+ /**
24
+ * A cmssy API token (`cs_…`) that opts this app into the editor-controlled dev
25
+ * preview. In development only, the SDK sends it on every page fetch so the
26
+ * backend can resolve the token's user and honour that user's dev-preview flag
27
+ * (toggled from the editor's dev-mode switch): flag on + a saved dev draft ⇒
28
+ * the draft overlay renders, otherwise published content. Server-only (never
29
+ * reaches the client); ignored outside development. See the Quickstart
30
+ * "Dev preview" section.
31
+ */
23
32
  devToken?: string;
24
33
  /**
25
34
  * Origin allowed to frame your app in the editor. Defaults to
package/dist/index.js CHANGED
@@ -203,7 +203,6 @@ function applyCmssyCsp(response, options) {
203
203
  return response;
204
204
  }
205
205
  var EDIT_QUERY_PARAM = "cmssyEdit";
206
- var DEV_QUERY_PARAM = "cmssyDev";
207
206
  function hasEditFlag(value) {
208
207
  return Array.isArray(value) ? value.includes("1") : value === "1";
209
208
  }
@@ -228,9 +227,7 @@ function createCmssyPage(config, blocks, options) {
228
227
  const query = searchParams ? await searchParams : {};
229
228
  const editMode = isEnabled || hasEditFlag(query[EDIT_QUERY_PARAM]);
230
229
  const devAllowed = isDevelopment() && Boolean(config.devToken?.trim());
231
- const devFlagged = hasEditFlag(query[DEV_QUERY_PARAM]);
232
- const devPreview = devAllowed && devFlagged;
233
- const editorActive = editMode || devAllowed && devFlagged;
230
+ const editorActive = editMode;
234
231
  let locale;
235
232
  let pagePath = path;
236
233
  let defaultLocale;
@@ -247,11 +244,11 @@ function createCmssyPage(config, blocks, options) {
247
244
  locale = split.locale;
248
245
  pagePath = split.path;
249
246
  }
250
- const devWorkspaceId = devPreview ? await client.resolveWorkspaceId() : void 0;
247
+ const devWorkspaceId = devAllowed ? await client.resolveWorkspaceId() : void 0;
251
248
  const page = await fetchPage(clientConfig, pagePath, {
252
249
  previewSecret: editMode ? config.draftSecret : void 0,
253
- devPreview: devPreview || void 0,
254
- devToken: devPreview ? config.devToken : void 0,
250
+ devPreview: devAllowed || void 0,
251
+ devToken: devAllowed ? config.devToken : void 0,
255
252
  workspaceId: devWorkspaceId
256
253
  });
257
254
  if (!page) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
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.7.5",
44
+ "@cmssy/react": "^0.7.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.7.5"
57
+ "@cmssy/react": "0.7.7"
58
58
  },
59
59
  "dependencies": {
60
60
  "jose": "^6.2.3"