@sitecore-jss/sitecore-jss-nextjs 22.1.0-canary.17 → 22.1.0-canary.19

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.
@@ -13,6 +13,7 @@ exports.EditingConfigMiddleware = void 0;
13
13
  const constants_1 = require("./constants");
14
14
  const utils_1 = require("../utils/utils");
15
15
  const sitecore_jss_1 = require("@sitecore-jss/sitecore-jss");
16
+ const layout_1 = require("@sitecore-jss/sitecore-jss/layout");
16
17
  const utils_2 = require("@sitecore-jss/sitecore-jss/utils");
17
18
  /**
18
19
  * Middleware / handler used in the editing config API route in xmcloud add on (e.g. '/api/editing/config')
@@ -37,9 +38,11 @@ class EditingConfigMiddleware {
37
38
  const components = Array.isArray(this.config.components)
38
39
  ? this.config.components
39
40
  : Array.from(this.config.components.keys());
41
+ const editMode = this.config.pagesEditMode || layout_1.EditMode.Metadata;
40
42
  return res.status(200).json({
41
43
  components,
42
44
  packages: this.config.metadata.packages,
45
+ editMode,
43
46
  });
44
47
  });
45
48
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { EDITING_ALLOWED_ORIGINS, QUERY_PARAM_EDITING_SECRET } from './constants';
11
11
  import { getJssEditingSecret } from '../utils/utils';
12
12
  import { debug } from '@sitecore-jss/sitecore-jss';
13
+ import { EditMode } from '@sitecore-jss/sitecore-jss/layout';
13
14
  import { enforceCors } from '@sitecore-jss/sitecore-jss/utils';
14
15
  /**
15
16
  * Middleware / handler used in the editing config API route in xmcloud add on (e.g. '/api/editing/config')
@@ -34,9 +35,11 @@ export class EditingConfigMiddleware {
34
35
  const components = Array.isArray(this.config.components)
35
36
  ? this.config.components
36
37
  : Array.from(this.config.components.keys());
38
+ const editMode = this.config.pagesEditMode || EditMode.Metadata;
37
39
  return res.status(200).json({
38
40
  components,
39
41
  packages: this.config.metadata.packages,
42
+ editMode,
40
43
  });
41
44
  });
42
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "22.1.0-canary.17",
3
+ "version": "22.1.0-canary.19",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -72,9 +72,9 @@
72
72
  "react-dom": "^18.2.0"
73
73
  },
74
74
  "dependencies": {
75
- "@sitecore-jss/sitecore-jss": "^22.1.0-canary.17",
76
- "@sitecore-jss/sitecore-jss-dev-tools": "^22.1.0-canary.17",
77
- "@sitecore-jss/sitecore-jss-react": "^22.1.0-canary.17",
75
+ "@sitecore-jss/sitecore-jss": "^22.1.0-canary.19",
76
+ "@sitecore-jss/sitecore-jss-dev-tools": "^22.1.0-canary.19",
77
+ "@sitecore-jss/sitecore-jss-react": "^22.1.0-canary.19",
78
78
  "@vercel/kv": "^0.2.1",
79
79
  "node-html-parser": "^6.1.4",
80
80
  "prop-types": "^15.8.1",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "description": "",
85
85
  "types": "types/index.d.ts",
86
- "gitHead": "f822681a1d1042735cbf912e3315eb1da306f5ac",
86
+ "gitHead": "2da1f09fc76a46fbd3e092dd12dcc793cced4224",
87
87
  "files": [
88
88
  "dist",
89
89
  "types",
@@ -1,4 +1,5 @@
1
1
  import { NextApiRequest, NextApiResponse } from 'next';
2
+ import { EditMode } from '@sitecore-jss/sitecore-jss/layout';
2
3
  import { Metadata } from '@sitecore-jss/sitecore-jss-dev-tools';
3
4
  export type EditingConfigMiddlewareConfig = {
4
5
  /**
@@ -9,6 +10,12 @@ export type EditingConfigMiddlewareConfig = {
9
10
  * Application metadata
10
11
  */
11
12
  metadata: Metadata;
13
+ /**
14
+ * Determines which editing mode should be used by Pages.
15
+ * Can be either 'chromes' or 'metadata'.
16
+ * By default its 'metadata'
17
+ */
18
+ pagesEditMode?: EditMode;
12
19
  };
13
20
  /**
14
21
  * Middleware / handler used in the editing config API route in xmcloud add on (e.g. '/api/editing/config')