@sitecore-jss/sitecore-jss-nextjs 22.4.1-canary.1 → 22.4.1-canary.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.
@@ -49,7 +49,10 @@ class ChromesHandler extends render_middleware_1.RenderMiddlewareBase {
49
49
  * @param {NextApiRequest} req
50
50
  */
51
51
  this.defaultResolveServerUrl = (req) => {
52
- return `${process.env.VERCEL ? 'https' : 'http'}://${req.headers.host}`;
52
+ // to preserve auth headers, use https if we're in our 3 main hosting options
53
+ const useHttps = (process.env.VERCEL || process.env.SITECORE || process.env.NETLIFY) !== undefined;
54
+ // use https for requests with auth but also support unsecured http rendering hosts
55
+ return `${useHttps ? 'https' : 'http'}://${req.headers.host}`;
53
56
  };
54
57
  this.editingDataService = (_a = config === null || config === void 0 ? void 0 : config.editingDataService) !== null && _a !== void 0 ? _a : editing_data_service_1.editingDataService;
55
58
  this.dataFetcher = (_b = config === null || config === void 0 ? void 0 : config.dataFetcher) !== null && _b !== void 0 ? _b : new sitecore_jss_1.NativeDataFetcher({ debugger: sitecore_jss_1.debug.editing });
@@ -90,6 +93,7 @@ class ChromesHandler extends render_middleware_1.RenderMiddlewareBase {
90
93
  requestUrl.searchParams.append('timestamp', Date.now().toString());
91
94
  const pageRes = yield this.dataFetcher
92
95
  .get(requestUrl.toString(), {
96
+ credentials: 'include',
93
97
  headers,
94
98
  })
95
99
  .catch((err) => {
@@ -46,7 +46,10 @@ export class ChromesHandler extends RenderMiddlewareBase {
46
46
  * @param {NextApiRequest} req
47
47
  */
48
48
  this.defaultResolveServerUrl = (req) => {
49
- return `${process.env.VERCEL ? 'https' : 'http'}://${req.headers.host}`;
49
+ // to preserve auth headers, use https if we're in our 3 main hosting options
50
+ const useHttps = (process.env.VERCEL || process.env.SITECORE || process.env.NETLIFY) !== undefined;
51
+ // use https for requests with auth but also support unsecured http rendering hosts
52
+ return `${useHttps ? 'https' : 'http'}://${req.headers.host}`;
50
53
  };
51
54
  this.editingDataService = (_a = config === null || config === void 0 ? void 0 : config.editingDataService) !== null && _a !== void 0 ? _a : editingDataService;
52
55
  this.dataFetcher = (_b = config === null || config === void 0 ? void 0 : config.dataFetcher) !== null && _b !== void 0 ? _b : new NativeDataFetcher({ debugger: debug.editing });
@@ -87,6 +90,7 @@ export class ChromesHandler extends RenderMiddlewareBase {
87
90
  requestUrl.searchParams.append('timestamp', Date.now().toString());
88
91
  const pageRes = yield this.dataFetcher
89
92
  .get(requestUrl.toString(), {
93
+ credentials: 'include',
90
94
  headers,
91
95
  })
92
96
  .catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "22.4.1-canary.1",
3
+ "version": "22.4.1-canary.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -73,9 +73,9 @@
73
73
  "react-dom": "^18.2.0"
74
74
  },
75
75
  "dependencies": {
76
- "@sitecore-jss/sitecore-jss": "^22.4.1-canary.1",
77
- "@sitecore-jss/sitecore-jss-dev-tools": "^22.4.1-canary.1",
78
- "@sitecore-jss/sitecore-jss-react": "^22.4.1-canary.1",
76
+ "@sitecore-jss/sitecore-jss": "^22.4.1-canary.2",
77
+ "@sitecore-jss/sitecore-jss-dev-tools": "^22.4.1-canary.2",
78
+ "@sitecore-jss/sitecore-jss-react": "^22.4.1-canary.2",
79
79
  "@vercel/kv": "^0.2.1",
80
80
  "prop-types": "^15.8.1",
81
81
  "regex-parser": "^2.2.11",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "description": "",
85
85
  "types": "types/index.d.ts",
86
- "gitHead": "1f486f82cb985e9a78f94d58d3c5fa9ed55216dc",
86
+ "gitHead": "7cec13189f26fb9287541720fd1491bfcc9c24b8",
87
87
  "files": [
88
88
  "dist",
89
89
  "types",