@sitecore-jss/sitecore-jss-nextjs 21.1.0-canary.91 → 21.1.0-canary.93

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.
@@ -53,10 +53,9 @@ exports.Link = (0, react_1.forwardRef)((props, ref) => {
53
53
  const text = showLinkTextWithChildrenPresent || !children ? value.text || value.href : null;
54
54
  // determine if a link is a route or not.
55
55
  if (internalLinkMatcher.test(href)) {
56
- return (react_1.default.createElement(link_1.default, { href: { pathname: href, query: querystring, hash: anchor }, key: "link", locale: false },
57
- react_1.default.createElement("a", Object.assign({ title: value.title, target: value.target, className: value.class }, htmlLinkProps, { ref: ref }),
58
- text,
59
- children)));
56
+ return (react_1.default.createElement(link_1.default, Object.assign({ href: { pathname: href, query: querystring, hash: anchor }, key: "link", locale: false, title: value.title, target: value.target, className: value.class }, htmlLinkProps, { ref: ref }),
57
+ text,
58
+ children));
60
59
  }
61
60
  }
62
61
  // prevent passing internalLinkMatcher as it is an invalid DOM element prop
@@ -58,7 +58,7 @@ const NextImage = (_a) => {
58
58
  src: media_1.mediaApi.replaceMediaUrlPrefix(attrs.src, mediaUrlPrefix) });
59
59
  const loader = (otherProps.loader ? otherProps.loader : exports.sitecoreLoader);
60
60
  if (attrs) {
61
- return react_1.default.createElement(image_1.default, Object.assign({ loader: loader }, imageProps));
61
+ return react_1.default.createElement(image_1.default, Object.assign({ alt: "", loader: loader }, imageProps));
62
62
  }
63
63
  return null; // we can't handle the truth
64
64
  };
@@ -23,7 +23,7 @@ class MultisiteMiddleware {
23
23
  constructor(config) {
24
24
  this.config = config;
25
25
  this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
26
- var _a;
26
+ var _a, _b;
27
27
  const pathname = req.nextUrl.pathname;
28
28
  const hostHeader = (_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0];
29
29
  const hostname = hostHeader || this.defaultHostname;
@@ -45,7 +45,7 @@ class MultisiteMiddleware {
45
45
  const siteName = req.nextUrl.searchParams.get('sc_site') ||
46
46
  (this.config.useCookieResolution &&
47
47
  this.config.useCookieResolution(req) &&
48
- req.cookies.get('sc_site')) ||
48
+ ((_b = req.cookies.get('sc_site')) === null || _b === void 0 ? void 0 : _b.value)) ||
49
49
  this.config.getSite(hostname).name;
50
50
  // Rewrite to site specific path
51
51
  const rewritePath = (0, site_1.getSiteRewrite)(pathname, {
@@ -23,12 +23,12 @@ class PersonalizeMiddleware {
23
23
  constructor(config) {
24
24
  this.config = config;
25
25
  this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
26
- var _a;
26
+ var _a, _b;
27
27
  const hostHeader = (_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0];
28
28
  const hostname = hostHeader || this.defaultHostname;
29
29
  const pathname = req.nextUrl.pathname;
30
30
  const language = req.nextUrl.locale || req.nextUrl.defaultLocale || 'en';
31
- const siteName = (res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) || this.config.getSite(hostname).name;
31
+ const siteName = ((_b = res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) === null || _b === void 0 ? void 0 : _b.value) || this.config.getSite(hostname).name;
32
32
  let browserId = this.getBrowserId(req);
33
33
  sitecore_jss_1.debug.personalize('personalize middleware start: %o', {
34
34
  pathname,
@@ -140,7 +140,8 @@ class PersonalizeMiddleware {
140
140
  return `BID_${this.config.cdpConfig.clientKey}`;
141
141
  }
142
142
  getBrowserId(req) {
143
- return req.cookies.get(this.browserIdCookieName) || undefined;
143
+ var _a;
144
+ return ((_a = req.cookies.get(this.browserIdCookieName)) === null || _a === void 0 ? void 0 : _a.value) || undefined;
144
145
  }
145
146
  setBrowserId(res, browserId) {
146
147
  const expiryDate = new Date(new Date().setFullYear(new Date().getFullYear() + 2));
@@ -169,7 +170,8 @@ class PersonalizeMiddleware {
169
170
  return false;
170
171
  }
171
172
  isPreview(req) {
172
- return req.cookies.get('__prerender_bypass') || req.cookies.get('__next_preview_data');
173
+ var _a, _b;
174
+ return (((_a = req.cookies.get('__prerender_bypass')) === null || _a === void 0 ? void 0 : _a.value) || ((_b = req.cookies.get('__next_preview_data')) === null || _b === void 0 ? void 0 : _b.value));
173
175
  }
174
176
  /**
175
177
  * Safely extract all headers for debug logging
@@ -27,8 +27,9 @@ class RedirectsMiddleware {
27
27
  constructor(config) {
28
28
  this.config = config;
29
29
  this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
30
+ var _a;
30
31
  const hostname = this.getHostname(req);
31
- const siteName = (res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) || this.config.getSite(hostname).name;
32
+ const siteName = ((_a = res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) === null || _a === void 0 ? void 0 : _a.value) || this.config.getSite(hostname).name;
32
33
  const createResponse = () => __awaiter(this, void 0, void 0, function* () {
33
34
  if ((this.config.disabled && this.config.disabled(req, server_1.NextResponse.next())) ||
34
35
  this.excludeRoute(req.nextUrl.pathname) ||
@@ -24,10 +24,9 @@ export const Link = forwardRef((props, ref) => {
24
24
  const text = showLinkTextWithChildrenPresent || !children ? value.text || value.href : null;
25
25
  // determine if a link is a route or not.
26
26
  if (internalLinkMatcher.test(href)) {
27
- return (React.createElement(NextLink, { href: { pathname: href, query: querystring, hash: anchor }, key: "link", locale: false },
28
- React.createElement("a", Object.assign({ title: value.title, target: value.target, className: value.class }, htmlLinkProps, { ref: ref }),
29
- text,
30
- children)));
27
+ return (React.createElement(NextLink, Object.assign({ href: { pathname: href, query: querystring, hash: anchor }, key: "link", locale: false, title: value.title, target: value.target, className: value.class }, htmlLinkProps, { ref: ref }),
28
+ text,
29
+ children));
31
30
  }
32
31
  }
33
32
  // prevent passing internalLinkMatcher as it is an invalid DOM element prop
@@ -51,7 +51,7 @@ export const NextImage = (_a) => {
51
51
  src: mediaApi.replaceMediaUrlPrefix(attrs.src, mediaUrlPrefix) });
52
52
  const loader = (otherProps.loader ? otherProps.loader : sitecoreLoader);
53
53
  if (attrs) {
54
- return React.createElement(Image, Object.assign({ loader: loader }, imageProps));
54
+ return React.createElement(Image, Object.assign({ alt: "", loader: loader }, imageProps));
55
55
  }
56
56
  return null; // we can't handle the truth
57
57
  };
@@ -20,7 +20,7 @@ export class MultisiteMiddleware {
20
20
  constructor(config) {
21
21
  this.config = config;
22
22
  this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
23
- var _a;
23
+ var _a, _b;
24
24
  const pathname = req.nextUrl.pathname;
25
25
  const hostHeader = (_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0];
26
26
  const hostname = hostHeader || this.defaultHostname;
@@ -42,7 +42,7 @@ export class MultisiteMiddleware {
42
42
  const siteName = req.nextUrl.searchParams.get('sc_site') ||
43
43
  (this.config.useCookieResolution &&
44
44
  this.config.useCookieResolution(req) &&
45
- req.cookies.get('sc_site')) ||
45
+ ((_b = req.cookies.get('sc_site')) === null || _b === void 0 ? void 0 : _b.value)) ||
46
46
  this.config.getSite(hostname).name;
47
47
  // Rewrite to site specific path
48
48
  const rewritePath = getSiteRewrite(pathname, {
@@ -20,12 +20,12 @@ export class PersonalizeMiddleware {
20
20
  constructor(config) {
21
21
  this.config = config;
22
22
  this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
23
- var _a;
23
+ var _a, _b;
24
24
  const hostHeader = (_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0];
25
25
  const hostname = hostHeader || this.defaultHostname;
26
26
  const pathname = req.nextUrl.pathname;
27
27
  const language = req.nextUrl.locale || req.nextUrl.defaultLocale || 'en';
28
- const siteName = (res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) || this.config.getSite(hostname).name;
28
+ const siteName = ((_b = res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) === null || _b === void 0 ? void 0 : _b.value) || this.config.getSite(hostname).name;
29
29
  let browserId = this.getBrowserId(req);
30
30
  debug.personalize('personalize middleware start: %o', {
31
31
  pathname,
@@ -137,7 +137,8 @@ export class PersonalizeMiddleware {
137
137
  return `BID_${this.config.cdpConfig.clientKey}`;
138
138
  }
139
139
  getBrowserId(req) {
140
- return req.cookies.get(this.browserIdCookieName) || undefined;
140
+ var _a;
141
+ return ((_a = req.cookies.get(this.browserIdCookieName)) === null || _a === void 0 ? void 0 : _a.value) || undefined;
141
142
  }
142
143
  setBrowserId(res, browserId) {
143
144
  const expiryDate = new Date(new Date().setFullYear(new Date().getFullYear() + 2));
@@ -166,7 +167,8 @@ export class PersonalizeMiddleware {
166
167
  return false;
167
168
  }
168
169
  isPreview(req) {
169
- return req.cookies.get('__prerender_bypass') || req.cookies.get('__next_preview_data');
170
+ var _a, _b;
171
+ return (((_a = req.cookies.get('__prerender_bypass')) === null || _a === void 0 ? void 0 : _a.value) || ((_b = req.cookies.get('__next_preview_data')) === null || _b === void 0 ? void 0 : _b.value));
170
172
  }
171
173
  /**
172
174
  * Safely extract all headers for debug logging
@@ -21,8 +21,9 @@ export class RedirectsMiddleware {
21
21
  constructor(config) {
22
22
  this.config = config;
23
23
  this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
24
+ var _a;
24
25
  const hostname = this.getHostname(req);
25
- const siteName = (res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) || this.config.getSite(hostname).name;
26
+ const siteName = ((_a = res === null || res === void 0 ? void 0 : res.cookies.get('sc_site')) === null || _a === void 0 ? void 0 : _a.value) || this.config.getSite(hostname).name;
26
27
  const createResponse = () => __awaiter(this, void 0, void 0, function* () {
27
28
  if ((this.config.disabled && this.config.disabled(req, NextResponse.next())) ||
28
29
  this.excludeRoute(req.nextUrl.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.91",
3
+ "version": "21.1.0-canary.93",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -54,7 +54,7 @@
54
54
  "eslint-plugin-react": "^7.32.1",
55
55
  "jsdom": "^21.1.0",
56
56
  "mocha": "^10.2.0",
57
- "next": "^12.3.4",
57
+ "next": "^13.1.6",
58
58
  "nock": "^13.3.0",
59
59
  "nyc": "^15.1.0",
60
60
  "react": "^18.2.0",
@@ -65,14 +65,14 @@
65
65
  "typescript": "~4.9.4"
66
66
  },
67
67
  "peerDependencies": {
68
- "next": "^12.3.4",
68
+ "next": "^13.1.6",
69
69
  "react": "^18.2.0",
70
70
  "react-dom": "^18.2.0"
71
71
  },
72
72
  "dependencies": {
73
- "@sitecore-jss/sitecore-jss": "^21.1.0-canary.91",
74
- "@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.91",
75
- "@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.91",
73
+ "@sitecore-jss/sitecore-jss": "^21.1.0-canary.93",
74
+ "@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.93",
75
+ "@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.93",
76
76
  "node-html-parser": "^6.1.4",
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": "2fd48403f90b6ebeb6cd75750807f05f3d27f069",
83
+ "gitHead": "04517c0cbbe3b9a4f475e760ddc2edb927a74df7",
84
84
  "files": [
85
85
  "dist",
86
86
  "types",