@sitecore-jss/sitecore-jss-nextjs 21.1.0-canary.71 → 21.1.0-canary.72

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.
@@ -43,7 +43,9 @@ class MultisiteMiddleware {
43
43
  }
44
44
  // Site name can be forced by query string parameter or cookie
45
45
  const siteName = req.nextUrl.searchParams.get('sc_site') ||
46
- req.cookies.get('sc_site') ||
46
+ (this.config.useCookieResolution &&
47
+ this.config.useCookieResolution(req) &&
48
+ req.cookies.get('sc_site')) ||
47
49
  this.config.getSite(hostname).name;
48
50
  // Rewrite to site specific path
49
51
  const rewritePath = site_1.getSiteRewrite(pathname, {
@@ -40,7 +40,9 @@ export class MultisiteMiddleware {
40
40
  }
41
41
  // Site name can be forced by query string parameter or cookie
42
42
  const siteName = req.nextUrl.searchParams.get('sc_site') ||
43
- req.cookies.get('sc_site') ||
43
+ (this.config.useCookieResolution &&
44
+ this.config.useCookieResolution(req) &&
45
+ req.cookies.get('sc_site')) ||
44
46
  this.config.getSite(hostname).name;
45
47
  // Rewrite to site specific path
46
48
  const rewritePath = getSiteRewrite(pathname, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "21.1.0-canary.71",
3
+ "version": "21.1.0-canary.72",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -70,9 +70,9 @@
70
70
  "react-dom": "^18.2.0"
71
71
  },
72
72
  "dependencies": {
73
- "@sitecore-jss/sitecore-jss": "^21.1.0-canary.71",
74
- "@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.71",
75
- "@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.71",
73
+ "@sitecore-jss/sitecore-jss": "^21.1.0-canary.72",
74
+ "@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.72",
75
+ "@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.72",
76
76
  "node-html-parser": "^6.0.0",
77
77
  "prop-types": "^15.8.1",
78
78
  "regex-parser": "^2.2.11",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "description": "",
82
82
  "types": "types/index.d.ts",
83
- "gitHead": "61fb3846e35e869452e1143a0b0e092478670d07",
83
+ "gitHead": "82396f95b25548865a64f750bf8d95aabf6e4cf6",
84
84
  "files": [
85
85
  "dist",
86
86
  "types",
@@ -10,7 +10,7 @@ export declare type MultisiteMiddlewareConfig = {
10
10
  */
11
11
  excludeRoute?: (pathname: string) => boolean;
12
12
  /**
13
- * function used to resolve site for given hostname
13
+ * Function used to resolve site for given hostname
14
14
  */
15
15
  getSite: (hostname: string) => SiteInfo;
16
16
  /**
@@ -18,6 +18,10 @@ export declare type MultisiteMiddlewareConfig = {
18
18
  * @default localhost
19
19
  */
20
20
  defaultHostname?: string;
21
+ /**
22
+ * Function used to determine if site should be resolved from sc_site cookie when present
23
+ */
24
+ useCookieResolution?: (req: NextRequest) => boolean;
21
25
  };
22
26
  /**
23
27
  * Middleware / handler for multisite support