@sitecore-jss/sitecore-jss-nextjs 21.7.0-canary.39 → 21.7.0-canary.40

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Context = void 0;
4
+ const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
4
5
  /**
5
6
  * Context instance that is used to initialize the application Context and associated Software Development Kits (SDKs).
6
7
  */
@@ -31,6 +32,7 @@ class Context {
31
32
  this.sitecoreEdgeUrl = props.sitecoreEdgeUrl;
32
33
  this.sitecoreEdgeContextId = props.sitecoreEdgeContextId;
33
34
  this.siteName = props.siteName;
35
+ this.pageState = sitecore_jss_react_1.LayoutServicePageState.Normal;
34
36
  }
35
37
  init(props = {}) {
36
38
  // Context and SDKs are initialized only once
@@ -40,6 +42,9 @@ class Context {
40
42
  if (props.siteName) {
41
43
  this.siteName = props.siteName;
42
44
  }
45
+ if (props.pageState) {
46
+ this.pageState = props.pageState;
47
+ }
43
48
  // iterate over the SDKs and initialize them
44
49
  for (const sdkName of Object.keys(this.props.sdks)) {
45
50
  this.initSDK(sdkName);
@@ -1,3 +1,4 @@
1
+ import { LayoutServicePageState } from '@sitecore-jss/sitecore-jss-react';
1
2
  /**
2
3
  * Context instance that is used to initialize the application Context and associated Software Development Kits (SDKs).
3
4
  */
@@ -28,6 +29,7 @@ export class Context {
28
29
  this.sitecoreEdgeUrl = props.sitecoreEdgeUrl;
29
30
  this.sitecoreEdgeContextId = props.sitecoreEdgeContextId;
30
31
  this.siteName = props.siteName;
32
+ this.pageState = LayoutServicePageState.Normal;
31
33
  }
32
34
  init(props = {}) {
33
35
  // Context and SDKs are initialized only once
@@ -37,6 +39,9 @@ export class Context {
37
39
  if (props.siteName) {
38
40
  this.siteName = props.siteName;
39
41
  }
42
+ if (props.pageState) {
43
+ this.pageState = props.pageState;
44
+ }
40
45
  // iterate over the SDKs and initialize them
41
46
  for (const sdkName of Object.keys(this.props.sdks)) {
42
47
  this.initSDK(sdkName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "21.7.0-canary.39",
3
+ "version": "21.7.0-canary.40",
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": "^21.7.0-canary.39",
76
- "@sitecore-jss/sitecore-jss-dev-tools": "^21.7.0-canary.39",
77
- "@sitecore-jss/sitecore-jss-react": "^21.7.0-canary.39",
75
+ "@sitecore-jss/sitecore-jss": "^21.7.0-canary.40",
76
+ "@sitecore-jss/sitecore-jss-dev-tools": "^21.7.0-canary.40",
77
+ "@sitecore-jss/sitecore-jss-react": "^21.7.0-canary.40",
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": "c3932d0f640ad9d3ebedbfa9b87feec5b37394e7",
86
+ "gitHead": "0654d14da8950ab6b4139196d6db938adf3b354d",
87
87
  "files": [
88
88
  "dist",
89
89
  "types",
@@ -1,3 +1,4 @@
1
+ import { LayoutServicePageState } from '@sitecore-jss/sitecore-jss-react';
1
2
  /**
2
3
  * Software Development Kit (SDK) instance
3
4
  */
@@ -23,6 +24,10 @@ export interface ContextInitProps {
23
24
  * Your Sitecore site name
24
25
  */
25
26
  siteName?: string;
27
+ /**
28
+ * Sitecore page state (normal, preview, edit)
29
+ */
30
+ pageState?: LayoutServicePageState;
26
31
  }
27
32
  /**
28
33
  * Configuration that is passed to the Context.
@@ -72,6 +77,10 @@ export declare class Context<SDKModules extends SDKModulesType> {
72
77
  * The Sitecore site name
73
78
  */
74
79
  siteName: string;
80
+ /**
81
+ * Sitecore page state (normal, preview, edit)
82
+ */
83
+ pageState: LayoutServicePageState;
75
84
  /**
76
85
  * Software Development Kits (SDKs) to be initialized
77
86
  */