@sitecore-jss/sitecore-jss-nextjs 21.1.0-canary.75 → 21.1.0-canary.77

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.
Files changed (29) hide show
  1. package/dist/cjs/components/ComponentPropsContext.js +7 -3
  2. package/dist/cjs/components/Link.js +6 -2
  3. package/dist/cjs/components/NextImage.js +1 -1
  4. package/dist/cjs/components/Placeholder.js +6 -2
  5. package/dist/cjs/components/RichText.js +8 -4
  6. package/dist/cjs/editing/editing-data-middleware.js +2 -2
  7. package/dist/cjs/editing/editing-data-service.js +1 -1
  8. package/dist/cjs/editing/editing-render-middleware.js +5 -4
  9. package/dist/cjs/middleware/multisite-middleware.js +1 -1
  10. package/dist/cjs/middleware/personalize-middleware.js +2 -2
  11. package/dist/cjs/middleware/redirects-middleware.js +2 -2
  12. package/dist/cjs/services/graphql-sitemap-service.js +10 -10
  13. package/dist/cjs/utils.js +3 -3
  14. package/dist/esm/editing/editing-render-middleware.js +2 -1
  15. package/dist/esm/services/graphql-sitemap-service.js +9 -9
  16. package/package.json +27 -27
  17. package/types/components/ComponentPropsContext.d.ts +1 -1
  18. package/types/components/Link.d.ts +1 -1
  19. package/types/components/NextImage.d.ts +1 -1
  20. package/types/components/RichText.d.ts +1 -1
  21. package/types/editing/editing-data.d.ts +1 -1
  22. package/types/index.d.ts +1 -1
  23. package/types/middleware/multisite-middleware.d.ts +1 -1
  24. package/types/middleware/personalize-middleware.d.ts +1 -1
  25. package/types/middleware/redirects-middleware.d.ts +1 -1
  26. package/types/services/component-props-service.d.ts +3 -3
  27. package/types/services/graphql-sitemap-service.d.ts +2 -2
  28. package/types/sharedTypes/component-module.d.ts +2 -2
  29. package/types/sharedTypes/component-props.d.ts +4 -4
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -24,7 +28,7 @@ const react_1 = __importStar(require("react"));
24
28
  /**
25
29
  * Component props context which we are using in order to store data fetched on components level (getStaticProps/getServerSideProps)
26
30
  */
27
- exports.ComponentPropsReactContext = react_1.createContext({});
31
+ exports.ComponentPropsReactContext = (0, react_1.createContext)({});
28
32
  /**
29
33
  * Hook in order to get access to props related to specific component. Data comes from ComponentPropsContext.
30
34
  * @see ComponentPropsContext
@@ -35,7 +39,7 @@ function useComponentProps(componentUid) {
35
39
  if (!componentUid) {
36
40
  return undefined;
37
41
  }
38
- const data = react_1.useContext(exports.ComponentPropsReactContext);
42
+ const data = (0, react_1.useContext)(exports.ComponentPropsReactContext);
39
43
  return data[componentUid];
40
44
  }
41
45
  exports.useComponentProps = useComponentProps;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -38,7 +42,7 @@ const react_1 = __importStar(require("react"));
38
42
  const prop_types_1 = __importDefault(require("prop-types"));
39
43
  const link_1 = __importDefault(require("next/link"));
40
44
  const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
41
- exports.Link = react_1.forwardRef((props, ref) => {
45
+ exports.Link = (0, react_1.forwardRef)((props, ref) => {
42
46
  const { field, editable, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, htmlLinkProps = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
43
47
  const value = (field.href
44
48
  ? field
@@ -42,7 +42,7 @@ const NextImage = (_a) => {
42
42
  const imageField = dynamicMedia;
43
43
  // we likely have an experience editor value, should be a string
44
44
  if (editable && imageField.editable) {
45
- return sitecore_jss_react_1.getEEMarkup(imageField, imageParams, mediaUrlPrefix, otherProps);
45
+ return (0, sitecore_jss_react_1.getEEMarkup)(imageField, imageParams, mediaUrlPrefix, otherProps);
46
46
  }
47
47
  // some wise-guy/gal is passing in a 'raw' image object value
48
48
  const img = dynamicMedia.src
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -24,7 +28,7 @@ const react_1 = __importStar(require("react"));
24
28
  const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
25
29
  const ComponentPropsContext_1 = require("./ComponentPropsContext");
26
30
  const Placeholder = (props) => {
27
- const componentPropsContext = react_1.useContext(ComponentPropsContext_1.ComponentPropsReactContext);
31
+ const componentPropsContext = (0, react_1.useContext)(ComponentPropsContext_1.ComponentPropsReactContext);
28
32
  return (react_1.default.createElement(sitecore_jss_react_1.Placeholder, Object.assign({}, props, { modifyComponentProps: (initialProps) => {
29
33
  if (!initialProps.rendering.uid)
30
34
  return initialProps;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -43,9 +47,9 @@ const RichText = (props) => {
43
47
  const { internalLinksSelector = 'a[href^="/"]' } = props, rest = __rest(props, ["internalLinksSelector"]);
44
48
  const hasText = props.field && props.field.value;
45
49
  const isEditing = props.editable && props.field && props.field.editable;
46
- const router = router_1.useRouter();
47
- const richTextRef = react_1.useRef(null);
48
- react_1.useEffect(() => {
50
+ const router = (0, router_1.useRouter)();
51
+ const richTextRef = (0, react_1.useRef)(null);
52
+ (0, react_1.useEffect)(() => {
49
53
  // NOT IN EXPERIENCE EDITOR
50
54
  if (hasText && !isEditing) {
51
55
  initializeLinks();
@@ -29,7 +29,7 @@ class EditingDataMiddleware {
29
29
  const secret = query[editing_data_service_1.QUERY_PARAM_EDITING_SECRET];
30
30
  const key = query[this.queryParamKey];
31
31
  // Validate secret
32
- if (secret !== utils_1.getJssEditingSecret()) {
32
+ if (secret !== (0, utils_1.getJssEditingSecret)()) {
33
33
  res.status(401).end('Missing or invalid secret');
34
34
  return;
35
35
  }
@@ -41,7 +41,7 @@ class EditingDataMiddleware {
41
41
  break;
42
42
  }
43
43
  case 'PUT': {
44
- if (!editing_data_1.isEditingData(body)) {
44
+ if (!(0, editing_data_1.isEditingData)(body)) {
45
45
  res.status(400).end('Missing or invalid editing data');
46
46
  }
47
47
  else {
@@ -136,7 +136,7 @@ class ServerlessEditingDataService {
136
136
  // http://localhost:3000/api/editing/data/52961eea-bafd-5287-a532-a72e36bd8a36-qkb4e3fv5x?secret=1234secret
137
137
  const apiRoute = (_a = this.apiRoute) === null || _a === void 0 ? void 0 : _a.replace('[key]', key);
138
138
  const url = new URL(apiRoute, serverUrl);
139
- url.searchParams.append(exports.QUERY_PARAM_EDITING_SECRET, utils_1.getJssEditingSecret());
139
+ url.searchParams.append(exports.QUERY_PARAM_EDITING_SECRET, (0, utils_1.getJssEditingSecret)());
140
140
  return url.toString();
141
141
  }
142
142
  }
@@ -44,8 +44,8 @@ class EditingRenderMiddleware {
44
44
  }
45
45
  // Validate secret
46
46
  const secret = (_e = query[editing_data_service_1.QUERY_PARAM_EDITING_SECRET]) !== null && _e !== void 0 ? _e : body === null || body === void 0 ? void 0 : body.jssEditingSecret;
47
- if (secret !== utils_1.getJssEditingSecret()) {
48
- sitecore_jss_1.debug.editing('invalid editing secret - sent "%s" expected "%s"', secret, utils_1.getJssEditingSecret());
47
+ if (secret !== (0, utils_1.getJssEditingSecret)()) {
48
+ sitecore_jss_1.debug.editing('invalid editing secret - sent "%s" expected "%s"', secret, (0, utils_1.getJssEditingSecret)());
49
49
  return res.status(401).json({
50
50
  html: '<html><body>Missing or invalid secret</body></html>',
51
51
  });
@@ -98,7 +98,7 @@ class EditingRenderMiddleware {
98
98
  html = html.replace(constants_1.STATIC_PROPS_ID, constants_1.SERVER_PROPS_ID);
99
99
  if (editingData.layoutData.sitecore.context.renderingType === layout_1.RenderingType.Component) {
100
100
  // Handle component rendering. Extract component markup only
101
- html = (_f = node_html_parser_1.parse(html).getElementById(layout_1.EDITING_COMPONENT_ID)) === null || _f === void 0 ? void 0 : _f.innerHTML;
101
+ html = (_f = (0, node_html_parser_1.parse)(html).getElementById(layout_1.EDITING_COMPONENT_ID)) === null || _f === void 0 ? void 0 : _f.innerHTML;
102
102
  if (!html)
103
103
  throw new Error(`Failed to render component for ${requestUrl}`);
104
104
  }
@@ -107,7 +107,8 @@ class EditingRenderMiddleware {
107
107
  sitecore_jss_1.debug.editing('editing render middleware end: %o', { status: 200, body });
108
108
  res.status(200).json(body);
109
109
  }
110
- catch (error) {
110
+ catch (err) {
111
+ const error = err;
111
112
  console.error(error);
112
113
  if (error.response || error.request) {
113
114
  // Axios error, which could mean the server or page URL isn't quite right, so provide a more helpful hint
@@ -48,7 +48,7 @@ class MultisiteMiddleware {
48
48
  req.cookies.get('sc_site')) ||
49
49
  this.config.getSite(hostname).name;
50
50
  // Rewrite to site specific path
51
- const rewritePath = site_1.getSiteRewrite(pathname, {
51
+ const rewritePath = (0, site_1.getSiteRewrite)(pathname, {
52
52
  siteName,
53
53
  });
54
54
  // Note an absolute URL is required: https://nextjs.org/docs/messages/middleware-relative-urls
@@ -69,7 +69,7 @@ class PersonalizeMiddleware {
69
69
  }
70
70
  }
71
71
  // Execute targeted experience in CDP
72
- const { ua } = server_1.userAgent(req);
72
+ const { ua } = (0, server_1.userAgent)(req);
73
73
  const params = this.getExperienceParams(req);
74
74
  const pointOfSale = this.config.getPointOfSale(language);
75
75
  const variantId = yield this.cdpService.executeExperience(personalizeInfo.contentId, browserId, ua, pointOfSale, params);
@@ -84,7 +84,7 @@ class PersonalizeMiddleware {
84
84
  // Path can be rewritten by previously executed middleware
85
85
  const basePath = (res === null || res === void 0 ? void 0 : res.headers.get('x-sc-rewrite')) || pathname;
86
86
  // Rewrite to persononalized path
87
- const rewritePath = personalize_1.getPersonalizedRewrite(basePath, { variantId });
87
+ const rewritePath = (0, personalize_1.getPersonalizedRewrite)(basePath, { variantId });
88
88
  // Note an absolute URL is required: https://nextjs.org/docs/messages/middleware-relative-urls
89
89
  const rewriteUrl = req.nextUrl.clone();
90
90
  rewriteUrl.pathname = rewritePath;
@@ -115,8 +115,8 @@ class RedirectsMiddleware {
115
115
  const redirects = yield this.redirectsService.fetchRedirects(siteName);
116
116
  return redirects.length
117
117
  ? redirects.find((redirect) => {
118
- return ((regex_parser_1.default(redirect.pattern.toLowerCase()).test(req.nextUrl.pathname.toLowerCase()) ||
119
- regex_parser_1.default(redirect.pattern.toLowerCase()).test(`/${req.nextUrl.locale}${req.nextUrl.pathname}`.toLowerCase())) &&
118
+ return (((0, regex_parser_1.default)(redirect.pattern.toLowerCase()).test(req.nextUrl.pathname.toLowerCase()) ||
119
+ (0, regex_parser_1.default)(redirect.pattern.toLowerCase()).test(`/${req.nextUrl.locale}${req.nextUrl.pathname}`.toLowerCase())) &&
120
120
  (redirect.locale
121
121
  ? redirect.locale.toLowerCase() === req.nextUrl.locale.toLowerCase()
122
122
  : true));
@@ -76,6 +76,12 @@ query ${usesPersonalize ? 'PersonalizeSitemapQuery' : 'DefaultSitemapQuery'}(
76
76
  * @mixes SearchQueryService<PageListQueryResult>
77
77
  */
78
78
  class GraphQLSitemapService {
79
+ /**
80
+ * Gets the default query used for fetching the list of site pages
81
+ */
82
+ get query() {
83
+ return defaultQuery(this.options.includePersonalizedRoutes);
84
+ }
79
85
  /**
80
86
  * Creates an instance of graphQL sitemap service with the provided options
81
87
  * @param {GraphQLSitemapServiceConfig} options instance
@@ -84,12 +90,6 @@ class GraphQLSitemapService {
84
90
  this.options = options;
85
91
  this.graphQLClient = this.getGraphQLClient();
86
92
  }
87
- /**
88
- * Gets the default query used for fetching the list of site pages
89
- */
90
- get query() {
91
- return defaultQuery(this.options.includePersonalizedRoutes);
92
- }
93
93
  /**
94
94
  * Fetch sitemap which could be used for generation of static pages during `next export`.
95
95
  * The `locale` parameter will be used in the item query, but since i18n is not supported,
@@ -173,15 +173,15 @@ class GraphQLSitemapService {
173
173
  aggregatedPaths.push(formatPath(item.path));
174
174
  }
175
175
  else {
176
- aggregatedPaths.push(formatPath(site_1.getSiteRewrite(item.path, { siteName: multiSiteName })));
176
+ aggregatedPaths.push(formatPath((0, site_1.getSiteRewrite)(item.path, { siteName: multiSiteName })));
177
177
  }
178
178
  // check for type safety's sake - personalize may be empty depending on query type
179
179
  if ((_b = (_a = item.route) === null || _a === void 0 ? void 0 : _a.personalization) === null || _b === void 0 ? void 0 : _b.variantIds.length) {
180
180
  multiSiteName
181
- ? aggregatedPaths.push(...(_d = (_c = item.route) === null || _c === void 0 ? void 0 : _c.personalization) === null || _d === void 0 ? void 0 : _d.variantIds.map((varId) => formatPath(personalize_1.getPersonalizedRewrite(site_1.getSiteRewrite(item.path, { siteName: multiSiteName }), {
181
+ ? aggregatedPaths.push(...(((_d = (_c = item.route) === null || _c === void 0 ? void 0 : _c.personalization) === null || _d === void 0 ? void 0 : _d.variantIds.map((varId) => formatPath((0, personalize_1.getPersonalizedRewrite)((0, site_1.getSiteRewrite)(item.path, { siteName: multiSiteName }), {
182
182
  variantId: varId,
183
- }))))
184
- : aggregatedPaths.push(...(_f = (_e = item.route) === null || _e === void 0 ? void 0 : _e.personalization) === null || _f === void 0 ? void 0 : _f.variantIds.map((varId) => formatPath(personalize_1.getPersonalizedRewrite(item.path, { variantId: varId }))));
183
+ })))) || {}))
184
+ : aggregatedPaths.push(...(((_f = (_e = item.route) === null || _e === void 0 ? void 0 : _e.personalization) === null || _f === void 0 ? void 0 : _f.variantIds.map((varId) => formatPath((0, personalize_1.getPersonalizedRewrite)(item.path, { variantId: varId })))) || {}));
185
185
  }
186
186
  });
187
187
  return aggregatedPaths;
package/dist/cjs/utils.js CHANGED
@@ -41,11 +41,11 @@ exports.getPublicUrl = getPublicUrl;
41
41
  * @default forceReload false
42
42
  */
43
43
  const handleEditorFastRefresh = (forceReload = false) => {
44
- if (process.env.NODE_ENV !== 'development' || !utils_1.isEditorActive()) {
44
+ if (process.env.NODE_ENV !== 'development' || !(0, utils_1.isEditorActive)()) {
45
45
  // Only run if development mode and editor is active
46
46
  return;
47
47
  }
48
- const eventSource = new window.EventSource(`${exports.getPublicUrl()}/_next/webpack-hmr`);
48
+ const eventSource = new window.EventSource(`${(0, exports.getPublicUrl)()}/_next/webpack-hmr`);
49
49
  window.addEventListener('beforeunload', () => eventSource.close());
50
50
  eventSource.onopen = () => console.log('[Sitecore Editor Fast Refresh Listener] Online');
51
51
  eventSource.onmessage = (event) => {
@@ -59,7 +59,7 @@ const handleEditorFastRefresh = (forceReload = false) => {
59
59
  return window.location.reload();
60
60
  setTimeout(() => {
61
61
  console.log('[Sitecore Editor HMR Listener] Sitecore editor does not support Fast Refresh, reloading chromes...');
62
- utils_1.resetEditorChromes();
62
+ (0, utils_1.resetEditorChromes)();
63
63
  }, 500);
64
64
  };
65
65
  };
@@ -104,7 +104,8 @@ export class EditingRenderMiddleware {
104
104
  debug.editing('editing render middleware end: %o', { status: 200, body });
105
105
  res.status(200).json(body);
106
106
  }
107
- catch (error) {
107
+ catch (err) {
108
+ const error = err;
108
109
  console.error(error);
109
110
  if (error.response || error.request) {
110
111
  // Axios error, which could mean the server or page URL isn't quite right, so provide a more helpful hint
@@ -72,6 +72,12 @@ query ${usesPersonalize ? 'PersonalizeSitemapQuery' : 'DefaultSitemapQuery'}(
72
72
  * @mixes SearchQueryService<PageListQueryResult>
73
73
  */
74
74
  export class GraphQLSitemapService {
75
+ /**
76
+ * Gets the default query used for fetching the list of site pages
77
+ */
78
+ get query() {
79
+ return defaultQuery(this.options.includePersonalizedRoutes);
80
+ }
75
81
  /**
76
82
  * Creates an instance of graphQL sitemap service with the provided options
77
83
  * @param {GraphQLSitemapServiceConfig} options instance
@@ -80,12 +86,6 @@ export class GraphQLSitemapService {
80
86
  this.options = options;
81
87
  this.graphQLClient = this.getGraphQLClient();
82
88
  }
83
- /**
84
- * Gets the default query used for fetching the list of site pages
85
- */
86
- get query() {
87
- return defaultQuery(this.options.includePersonalizedRoutes);
88
- }
89
89
  /**
90
90
  * Fetch sitemap which could be used for generation of static pages during `next export`.
91
91
  * The `locale` parameter will be used in the item query, but since i18n is not supported,
@@ -174,10 +174,10 @@ export class GraphQLSitemapService {
174
174
  // check for type safety's sake - personalize may be empty depending on query type
175
175
  if ((_b = (_a = item.route) === null || _a === void 0 ? void 0 : _a.personalization) === null || _b === void 0 ? void 0 : _b.variantIds.length) {
176
176
  multiSiteName
177
- ? aggregatedPaths.push(...(_d = (_c = item.route) === null || _c === void 0 ? void 0 : _c.personalization) === null || _d === void 0 ? void 0 : _d.variantIds.map((varId) => formatPath(getPersonalizedRewrite(getSiteRewrite(item.path, { siteName: multiSiteName }), {
177
+ ? aggregatedPaths.push(...(((_d = (_c = item.route) === null || _c === void 0 ? void 0 : _c.personalization) === null || _d === void 0 ? void 0 : _d.variantIds.map((varId) => formatPath(getPersonalizedRewrite(getSiteRewrite(item.path, { siteName: multiSiteName }), {
178
178
  variantId: varId,
179
- }))))
180
- : aggregatedPaths.push(...(_f = (_e = item.route) === null || _e === void 0 ? void 0 : _e.personalization) === null || _f === void 0 ? void 0 : _f.variantIds.map((varId) => formatPath(getPersonalizedRewrite(item.path, { variantId: varId }))));
179
+ })))) || {}))
180
+ : aggregatedPaths.push(...(((_f = (_e = item.route) === null || _e === void 0 ? void 0 : _e.personalization) === null || _f === void 0 ? void 0 : _f.variantIds.map((varId) => formatPath(getPersonalizedRewrite(item.path, { variantId: varId })))) || {}));
181
181
  }
182
182
  });
183
183
  return aggregatedPaths;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "21.1.0-canary.75",
3
+ "version": "21.1.0-canary.77",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -30,57 +30,57 @@
30
30
  "url": "https://github.com/sitecore/jss/issues"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/chai": "^4.2.2",
34
- "@types/chai-as-promised": "^7.1.3",
33
+ "@types/chai": "^4.3.4",
34
+ "@types/chai-as-promised": "^7.1.5",
35
35
  "@types/chai-string": "^1.4.2",
36
36
  "@types/enzyme": "^3.10.12",
37
- "@types/mocha": "^9.0.0",
38
- "@types/node": "17.0.40",
37
+ "@types/mocha": "^10.0.1",
38
+ "@types/node": "~18.11.18",
39
39
  "@types/prop-types": "^15.7.5",
40
- "@types/react": "^18.0.25",
41
- "@types/react-dom": "^18.0.5",
42
- "@types/sinon": "^7.5.0",
43
- "@types/sinon-chai": "^3.2.5",
44
- "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
45
- "chai": "^4.2.0",
40
+ "@types/react": "^18.0.27",
41
+ "@types/react-dom": "^18.0.10",
42
+ "@types/sinon": "^10.0.13",
43
+ "@types/sinon-chai": "^3.2.9",
44
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
45
+ "chai": "^4.3.7",
46
46
  "chai-as-promised": "^7.1.1",
47
47
  "chai-string": "^1.5.0",
48
48
  "chalk": "^4.1.2",
49
- "cheerio": "1.0.0-rc.10",
49
+ "cheerio": "1.0.0-rc.12",
50
50
  "cross-fetch": "^3.1.5",
51
51
  "del-cli": "^5.0.0",
52
52
  "enzyme": "^3.11.0",
53
- "eslint": "^7.15.0",
54
- "eslint-plugin-react": "^7.21.5",
55
- "jsdom": "^15.1.1",
56
- "mocha": "^9.1.3",
57
- "next": "^12.3.1",
58
- "nock": "^13.0.5",
53
+ "eslint": "^8.32.0",
54
+ "eslint-plugin-react": "^7.32.1",
55
+ "jsdom": "^21.1.0",
56
+ "mocha": "^10.2.0",
57
+ "next": "^12.3.4",
58
+ "nock": "^13.3.0",
59
59
  "nyc": "^15.1.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
- "sinon": "^7.5.0",
62
+ "sinon": "^15.0.1",
63
63
  "sinon-chai": "^3.7.0",
64
- "ts-node": "^9.0.0",
65
- "typescript": "~4.3.5"
64
+ "ts-node": "^10.9.1",
65
+ "typescript": "~4.9.4"
66
66
  },
67
67
  "peerDependencies": {
68
- "next": "^12.3.1",
68
+ "next": "^12.3.4",
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.75",
74
- "@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.75",
75
- "@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.75",
76
- "node-html-parser": "^6.0.0",
73
+ "@sitecore-jss/sitecore-jss": "^21.1.0-canary.77",
74
+ "@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.77",
75
+ "@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.77",
76
+ "node-html-parser": "^6.1.4",
77
77
  "prop-types": "^15.8.1",
78
78
  "regex-parser": "^2.2.11",
79
79
  "sync-disk-cache": "^2.1.0"
80
80
  },
81
81
  "description": "",
82
82
  "types": "types/index.d.ts",
83
- "gitHead": "76363e65e2500ee44d7114364764158ff2eb5b29",
83
+ "gitHead": "7b0f7f489d4d79d8691a78ef7d38ff27f6fe144a",
84
84
  "files": [
85
85
  "dist",
86
86
  "types",
@@ -11,7 +11,7 @@ export declare const ComponentPropsReactContext: React.Context<ComponentPropsCol
11
11
  * @returns {ComponentData | undefined} component props
12
12
  */
13
13
  export declare function useComponentProps<ComponentData>(componentUid: string | undefined): ComponentData | undefined;
14
- export declare type ComponentPropsContextProps = {
14
+ export type ComponentPropsContextProps = {
15
15
  children: ReactNode;
16
16
  value: ComponentPropsCollection;
17
17
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { LinkProps as ReactLinkProps } from '@sitecore-jss/sitecore-jss-react';
3
- export declare type LinkProps = ReactLinkProps & {
3
+ export type LinkProps = ReactLinkProps & {
4
4
  /**
5
5
  * If `href` match with `internalLinkMatcher` regexp, then it's internal link and NextLink will be rendered
6
6
  * @default /^\//g
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ImageProps } from '@sitecore-jss/sitecore-jss-react';
3
3
  import { ImageLoader, ImageProps as NextImageProperties } from 'next/image';
4
- declare type NextImageProps = Omit<ImageProps, 'media'> & Partial<NextImageProperties>;
4
+ type NextImageProps = Omit<ImageProps, 'media'> & Partial<NextImageProperties>;
5
5
  export declare const sitecoreLoader: ImageLoader;
6
6
  export declare const NextImage: React.FC<NextImageProps>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { RichTextProps as ReactRichTextProps } from '@sitecore-jss/sitecore-jss-react';
3
- export declare type RichTextProps = ReactRichTextProps & {
3
+ export type RichTextProps = ReactRichTextProps & {
4
4
  /**
5
5
  * Selector which should be used in order to prefetch it and attach event listeners
6
6
  * @default 'a[href^="/"]'
@@ -3,7 +3,7 @@ import { DictionaryPhrases } from '@sitecore-jss/sitecore-jss/i18n';
3
3
  /**
4
4
  * Data sent from Sitecore editors
5
5
  */
6
- export declare type EditingData = {
6
+ export type EditingData = {
7
7
  path: string;
8
8
  language: string;
9
9
  layoutData: LayoutServiceData;
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { constants, HttpDataFetcher, HttpResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, enableDebug, } from '@sitecore-jss/sitecore-jss';
1
+ export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, enableDebug, } from '@sitecore-jss/sitecore-jss';
2
2
  export { isEditorActive, resetEditorChromes, resolveUrl } from '@sitecore-jss/sitecore-jss/utils';
3
3
  export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, GraphQLLayoutServiceConfig, RestLayoutService, RestLayoutServiceConfig, PlaceholderData, PlaceholdersData, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams, RenderingType, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, } from '@sitecore-jss/sitecore-jss/layout';
4
4
  export { mediaApi } from '@sitecore-jss/sitecore-jss/media';
@@ -1,6 +1,6 @@
1
1
  import { NextResponse, NextRequest } from 'next/server';
2
2
  import { SiteInfo } from '@sitecore-jss/sitecore-jss/site';
3
- export declare type MultisiteMiddlewareConfig = {
3
+ export type MultisiteMiddlewareConfig = {
4
4
  /**
5
5
  * Function used to determine if route should be excluded during execution.
6
6
  * By default, files (pathname.includes('.')), Next.js API routes (pathname.startsWith('/api/')), and Sitecore API routes (pathname.startsWith('/sitecore/')) are ignored.
@@ -1,7 +1,7 @@
1
1
  import { NextResponse, NextRequest } from 'next/server';
2
2
  import { GraphQLPersonalizeServiceConfig, CdpServiceConfig, ExperienceParams } from '@sitecore-jss/sitecore-jss/personalize';
3
3
  import { SiteInfo } from '@sitecore-jss/sitecore-jss/site';
4
- export declare type PersonalizeMiddlewareConfig = {
4
+ export type PersonalizeMiddlewareConfig = {
5
5
  /**
6
6
  * Function used to determine if route should be excluded from personalization.
7
7
  * By default, files (pathname.includes('.')), Next.js API routes (pathname.startsWith('/api/')), and Sitecore API routes (pathname.startsWith('/sitecore/')) are ignored.
@@ -3,7 +3,7 @@ import { GraphQLRedirectsServiceConfig, SiteInfo } from '@sitecore-jss/sitecore-
3
3
  /**
4
4
  * extended RedirectsMiddlewareConfig config type for RedirectsMiddleware
5
5
  */
6
- export declare type RedirectsMiddlewareConfig = Omit<GraphQLRedirectsServiceConfig, 'fetch'> & {
6
+ export type RedirectsMiddlewareConfig = Omit<GraphQLRedirectsServiceConfig, 'fetch'> & {
7
7
  locales: string[];
8
8
  /**
9
9
  * Function used to determine if route should be excluded from RedirectsMiddleware.
@@ -2,18 +2,18 @@ import { GetServerSidePropsContext, GetStaticPropsContext } from 'next';
2
2
  import { LayoutServiceData, ComponentRendering, PlaceholdersData } from '@sitecore-jss/sitecore-jss/layout';
3
3
  import { ComponentPropsCollection, ComponentPropsFetchFunction } from '../sharedTypes/component-props';
4
4
  import { ComponentModule } from '../sharedTypes/component-module';
5
- export declare type FetchComponentPropsArguments<NextContext> = {
5
+ export type FetchComponentPropsArguments<NextContext> = {
6
6
  layoutData: LayoutServiceData;
7
7
  context: NextContext;
8
8
  componentModule: ComponentModule;
9
9
  };
10
- export declare type ComponentPropsRequest<NextContext> = {
10
+ export type ComponentPropsRequest<NextContext> = {
11
11
  fetch: ComponentPropsFetchFunction<NextContext>;
12
12
  layoutData: LayoutServiceData;
13
13
  rendering: ComponentRendering;
14
14
  context: NextContext;
15
15
  };
16
- declare type FetchFunctionFactory<NextContext> = (componentName: string) => Promise<ComponentPropsFetchFunction<NextContext> | undefined>;
16
+ type FetchFunctionFactory<NextContext> = (componentName: string) => Promise<ComponentPropsFetchFunction<NextContext> | undefined>;
17
17
  export declare class ComponentPropsService {
18
18
  /**
19
19
  * SSR mode
@@ -54,7 +54,7 @@ export interface SiteRouteQueryResult<T> {
54
54
  /**
55
55
  * The schema of data returned in response to a routes list query request
56
56
  */
57
- export declare type RouteListQueryResult = {
57
+ export type RouteListQueryResult = {
58
58
  path: string;
59
59
  route?: {
60
60
  personalization?: {
@@ -87,7 +87,7 @@ export interface GraphQLSitemapServiceConfig extends Omit<SiteRouteQueryVariable
87
87
  /**
88
88
  * Object model of a site page item.
89
89
  */
90
- export declare type StaticPath = {
90
+ export type StaticPath = {
91
91
  params: {
92
92
  path: string[];
93
93
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { GetServerSideComponentProps, GetStaticComponentProps } from './component-props';
3
- export declare type Module = {
3
+ export type Module = {
4
4
  default: React.Component;
5
5
  getServerSideProps?: GetServerSideComponentProps;
6
6
  getStaticProps?: GetStaticComponentProps;
@@ -10,4 +10,4 @@ export declare type Module = {
10
10
  * @returns `Module` regular module
11
11
  * @returns `Promise<Module>` when module should be lazy loaded
12
12
  */
13
- export declare type ComponentModule = (componentName: string) => Module | Promise<Module> | undefined;
13
+ export type ComponentModule = (componentName: string) => Module | Promise<Module> | undefined;
@@ -3,20 +3,20 @@ import { ComponentRendering, LayoutServiceData } from '@sitecore-jss/sitecore-js
3
3
  /**
4
4
  * Shape of component props storage
5
5
  */
6
- export declare type ComponentPropsCollection = {
6
+ export type ComponentPropsCollection = {
7
7
  [componentUid: string]: unknown;
8
8
  };
9
9
  /**
10
10
  * Type of side effect function which could be invoked on component level (getStaticProps/getServerSideProps)
11
11
  */
12
- export declare type ComponentPropsFetchFunction<NextContext, FetchedProps = unknown> = {
12
+ export type ComponentPropsFetchFunction<NextContext, FetchedProps = unknown> = {
13
13
  (rendering: ComponentRendering, layoutData: LayoutServiceData, context: NextContext): Promise<FetchedProps>;
14
14
  };
15
15
  /**
16
16
  * Shape of getServerSideProps function on component level
17
17
  */
18
- export declare type GetServerSideComponentProps = ComponentPropsFetchFunction<GetServerSidePropsContext>;
18
+ export type GetServerSideComponentProps = ComponentPropsFetchFunction<GetServerSidePropsContext>;
19
19
  /**
20
20
  * Shape of getStaticProps function on component level
21
21
  */
22
- export declare type GetStaticComponentProps = ComponentPropsFetchFunction<GetStaticPropsContext>;
22
+ export type GetStaticComponentProps = ComponentPropsFetchFunction<GetStaticPropsContext>;