@sitecore-jss/sitecore-jss-nextjs 22.6.0 → 22.7.0-canary.10

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.
package/LICENSE.txt CHANGED
@@ -1,202 +1,202 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Sitecore JavaScript Rendering SDK for Next.js
2
-
3
- This module is provided as a part of Sitecore JavaScript Rendering SDK. It contains Next.js components and integration for JSS.
4
-
5
- <!---
6
- @TODO: Update to next version docs before release
7
- -->
8
- [Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
9
-
10
- [Documentation (XM Cloud)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
11
-
1
+ # Sitecore JavaScript Rendering SDK for Next.js
2
+
3
+ This module is provided as a part of Sitecore JavaScript Rendering SDK. It contains Next.js components and integration for JSS.
4
+
5
+ <!---
6
+ @TODO: Update to next version docs before release
7
+ -->
8
+ [Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
9
+
10
+ [Documentation (XM Cloud)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
11
+
12
12
  [API reference documentation](/ref-docs/sitecore-jss-nextjs/)
@@ -39,7 +39,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.Link = void 0;
41
41
  const react_1 = __importStar(require("react"));
42
- const prop_types_1 = __importDefault(require("prop-types"));
43
42
  const link_1 = __importDefault(require("next/link"));
44
43
  const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
45
44
  /**
@@ -68,7 +67,9 @@ exports.Link = (0, react_1.forwardRef)((props, ref) => {
68
67
  // determine if a link is a route or not. File extensions are not routes and should not be pre-fetched.
69
68
  if (isMatching && !isFileUrl) {
70
69
  delete htmlLinkProps.emptyFieldEditingComponent;
71
- 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, prefetch: props.prefetch }, htmlLinkProps, { ref: ref }),
70
+ 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, prefetch: props.prefetch }, htmlLinkProps, { ref: ref }, (process.env.TEST
71
+ ? { 'data-nextjs-link': true, 'data-nextjs-link-prefetch': props.prefetch }
72
+ : {})),
72
73
  text,
73
74
  children));
74
75
  }
@@ -77,7 +78,6 @@ exports.Link = (0, react_1.forwardRef)((props, ref) => {
77
78
  const reactLinkProps = Object.assign({}, props);
78
79
  delete reactLinkProps.internalLinkMatcher;
79
80
  delete reactLinkProps.prefetch;
80
- return react_1.default.createElement(sitecore_jss_react_1.Link, Object.assign({}, reactLinkProps, { ref: ref }));
81
+ return (react_1.default.createElement(sitecore_jss_react_1.Link, Object.assign({}, reactLinkProps, { ref: ref }, (process.env.TEST ? { 'data-react-link': true } : {}))));
81
82
  });
82
83
  exports.Link.displayName = 'NextLink';
83
- exports.Link.propTypes = Object.assign({ internalLinkMatcher: prop_types_1.default.instanceOf(RegExp) }, sitecore_jss_react_1.LinkPropTypes);
@@ -16,7 +16,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.NextImage = void 0;
18
18
  const media_1 = require("@sitecore-jss/sitecore-jss/media");
19
- const prop_types_1 = __importDefault(require("prop-types"));
20
19
  const react_1 = __importDefault(require("react"));
21
20
  const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
22
21
  const image_1 = __importDefault(require("next/image"));
@@ -63,26 +62,8 @@ exports.NextImage = (0, sitecore_jss_react_1.withFieldMetadata)((0, sitecore_jss
63
62
  delete imageProps.height;
64
63
  }
65
64
  if (attrs) {
66
- return react_1.default.createElement(image_1.default, Object.assign({ alt: "" }, imageProps));
65
+ return (react_1.default.createElement(image_1.default, Object.assign({ alt: "" }, imageProps, (process.env.TEST ? { 'data-unoptimized': unoptimized } : {}))));
67
66
  }
68
67
  return null; // we can't handle the truth
69
68
  }, { defaultEmptyFieldEditingComponent: sitecore_jss_react_3.DefaultEmptyFieldEditingComponentImage }));
70
- exports.NextImage.propTypes = {
71
- field: prop_types_1.default.oneOfType([
72
- prop_types_1.default.shape({
73
- src: prop_types_1.default.string.isRequired,
74
- }),
75
- prop_types_1.default.shape({
76
- value: prop_types_1.default.object,
77
- editable: prop_types_1.default.string,
78
- }),
79
- ]),
80
- editable: prop_types_1.default.bool,
81
- mediaUrlPrefix: prop_types_1.default.instanceOf(RegExp),
82
- imageParams: prop_types_1.default.objectOf(prop_types_1.default.oneOfType([prop_types_1.default.number.isRequired, prop_types_1.default.string.isRequired]).isRequired),
83
- emptyFieldEditingComponent: prop_types_1.default.oneOfType([
84
- prop_types_1.default.object,
85
- prop_types_1.default.func,
86
- ]),
87
- };
88
69
  exports.NextImage.displayName = 'NextImage';
@@ -33,13 +33,9 @@ var __rest = (this && this.__rest) || function (s, e) {
33
33
  }
34
34
  return t;
35
35
  };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
36
  Object.defineProperty(exports, "__esModule", { value: true });
40
37
  exports.RichText = exports.prefetched = void 0;
41
38
  const react_1 = __importStar(require("react"));
42
- const prop_types_1 = __importDefault(require("prop-types"));
43
39
  const router_1 = require("next/router");
44
40
  const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
45
41
  exports.prefetched = {};
@@ -93,5 +89,4 @@ const RichText = (props) => {
93
89
  return react_1.default.createElement(sitecore_jss_react_1.RichText, Object.assign({ ref: richTextRef, editable: editable }, rest));
94
90
  };
95
91
  exports.RichText = RichText;
96
- exports.RichText.propTypes = Object.assign({ internalLinksSelector: prop_types_1.default.string }, sitecore_jss_react_1.RichTextPropTypes);
97
92
  exports.RichText.displayName = 'NextRichText';
@@ -26,7 +26,7 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
26
26
  constructor(config) {
27
27
  super(config);
28
28
  this.config = config;
29
- this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
29
+ this.handler = (req, res, options) => __awaiter(this, void 0, void 0, function* () {
30
30
  const pathname = req.nextUrl.pathname;
31
31
  const language = this.getLanguage(req);
32
32
  const hostname = this.getHostHeader(req) || this.defaultHostname;
@@ -86,6 +86,7 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
86
86
  params,
87
87
  language,
88
88
  timeout,
89
+ options,
89
90
  }, req).then((personalization) => {
90
91
  const variantId = personalization.variantId;
91
92
  if (variantId) {
@@ -124,9 +125,9 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
124
125
  * @returns middleware handler
125
126
  */
126
127
  getHandler() {
127
- return (req, res) => __awaiter(this, void 0, void 0, function* () {
128
+ return (req, res, options) => __awaiter(this, void 0, void 0, function* () {
128
129
  try {
129
- return yield this.handler(req, res);
130
+ return yield this.handler(req, res, options);
130
131
  }
131
132
  catch (error) {
132
133
  console.log('Personalize middleware failed:');
@@ -149,7 +150,7 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
149
150
  });
150
151
  }
151
152
  personalize(_a, request_1) {
152
- return __awaiter(this, arguments, void 0, function* ({ params, friendlyId, language, timeout, variantIds, }, request) {
153
+ return __awaiter(this, arguments, void 0, function* ({ params, friendlyId, language, timeout, variantIds, options, }, request) {
153
154
  var _b;
154
155
  sitecore_jss_1.debug.personalize('executing experience for %s %o', friendlyId, params);
155
156
  return (yield (0, server_3.personalize)(request, {
@@ -159,6 +160,7 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
159
160
  params,
160
161
  language,
161
162
  pageVariantIds: variantIds,
163
+ geo: options === null || options === void 0 ? void 0 : options.geo,
162
164
  }, { timeout }));
163
165
  });
164
166
  }
@@ -10,9 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React, { forwardRef } from 'react';
13
- import PropTypes from 'prop-types';
14
13
  import NextLink from 'next/link';
15
- import { Link as ReactLink, LinkPropTypes, } from '@sitecore-jss/sitecore-jss-react';
14
+ import { Link as ReactLink, } from '@sitecore-jss/sitecore-jss-react';
16
15
  /**
17
16
  * Matches relative URLs that end with a file extension.
18
17
  */
@@ -39,7 +38,9 @@ export const Link = forwardRef((props, ref) => {
39
38
  // determine if a link is a route or not. File extensions are not routes and should not be pre-fetched.
40
39
  if (isMatching && !isFileUrl) {
41
40
  delete htmlLinkProps.emptyFieldEditingComponent;
42
- 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, prefetch: props.prefetch }, htmlLinkProps, { ref: ref }),
41
+ 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, prefetch: props.prefetch }, htmlLinkProps, { ref: ref }, (process.env.TEST
42
+ ? { 'data-nextjs-link': true, 'data-nextjs-link-prefetch': props.prefetch }
43
+ : {})),
43
44
  text,
44
45
  children));
45
46
  }
@@ -48,7 +49,6 @@ export const Link = forwardRef((props, ref) => {
48
49
  const reactLinkProps = Object.assign({}, props);
49
50
  delete reactLinkProps.internalLinkMatcher;
50
51
  delete reactLinkProps.prefetch;
51
- return React.createElement(ReactLink, Object.assign({}, reactLinkProps, { ref: ref }));
52
+ return (React.createElement(ReactLink, Object.assign({}, reactLinkProps, { ref: ref }, (process.env.TEST ? { 'data-react-link': true } : {}))));
52
53
  });
53
54
  Link.displayName = 'NextLink';
54
- Link.propTypes = Object.assign({ internalLinkMatcher: PropTypes.instanceOf(RegExp) }, LinkPropTypes);
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { mediaApi } from '@sitecore-jss/sitecore-jss/media';
13
- import PropTypes from 'prop-types';
14
13
  import React from 'react';
15
14
  import { getEEMarkup, withFieldMetadata, SitecoreContextReactContext, } from '@sitecore-jss/sitecore-jss-react';
16
15
  import Image from 'next/image';
@@ -57,26 +56,8 @@ export const NextImage = withFieldMetadata(withEmptyFieldEditingComponent((_a) =
57
56
  delete imageProps.height;
58
57
  }
59
58
  if (attrs) {
60
- return React.createElement(Image, Object.assign({ alt: "" }, imageProps));
59
+ return (React.createElement(Image, Object.assign({ alt: "" }, imageProps, (process.env.TEST ? { 'data-unoptimized': unoptimized } : {}))));
61
60
  }
62
61
  return null; // we can't handle the truth
63
62
  }, { defaultEmptyFieldEditingComponent: DefaultEmptyFieldEditingComponentImage }));
64
- NextImage.propTypes = {
65
- field: PropTypes.oneOfType([
66
- PropTypes.shape({
67
- src: PropTypes.string.isRequired,
68
- }),
69
- PropTypes.shape({
70
- value: PropTypes.object,
71
- editable: PropTypes.string,
72
- }),
73
- ]),
74
- editable: PropTypes.bool,
75
- mediaUrlPrefix: PropTypes.instanceOf(RegExp),
76
- imageParams: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired]).isRequired),
77
- emptyFieldEditingComponent: PropTypes.oneOfType([
78
- PropTypes.object,
79
- PropTypes.func,
80
- ]),
81
- };
82
63
  NextImage.displayName = 'NextImage';
@@ -10,9 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React, { useEffect, useRef } from 'react';
13
- import PropTypes from 'prop-types';
14
13
  import { useRouter } from 'next/router';
15
- import { RichText as ReactRichText, RichTextPropTypes, } from '@sitecore-jss/sitecore-jss-react';
14
+ import { RichText as ReactRichText, } from '@sitecore-jss/sitecore-jss-react';
16
15
  export const prefetched = {};
17
16
  export const RichText = (props) => {
18
17
  const { internalLinksSelector = 'a[href^="/"]', prefetchLinks = true, editable = true } = props, rest = __rest(props, ["internalLinksSelector", "prefetchLinks", "editable"]);
@@ -63,5 +62,4 @@ export const RichText = (props) => {
63
62
  };
64
63
  return React.createElement(ReactRichText, Object.assign({ ref: richTextRef, editable: editable }, rest));
65
64
  };
66
- RichText.propTypes = Object.assign({ internalLinksSelector: PropTypes.string }, RichTextPropTypes);
67
65
  RichText.displayName = 'NextRichText';
@@ -23,7 +23,7 @@ export class PersonalizeMiddleware extends MiddlewareBase {
23
23
  constructor(config) {
24
24
  super(config);
25
25
  this.config = config;
26
- this.handler = (req, res) => __awaiter(this, void 0, void 0, function* () {
26
+ this.handler = (req, res, options) => __awaiter(this, void 0, void 0, function* () {
27
27
  const pathname = req.nextUrl.pathname;
28
28
  const language = this.getLanguage(req);
29
29
  const hostname = this.getHostHeader(req) || this.defaultHostname;
@@ -83,6 +83,7 @@ export class PersonalizeMiddleware extends MiddlewareBase {
83
83
  params,
84
84
  language,
85
85
  timeout,
86
+ options,
86
87
  }, req).then((personalization) => {
87
88
  const variantId = personalization.variantId;
88
89
  if (variantId) {
@@ -121,9 +122,9 @@ export class PersonalizeMiddleware extends MiddlewareBase {
121
122
  * @returns middleware handler
122
123
  */
123
124
  getHandler() {
124
- return (req, res) => __awaiter(this, void 0, void 0, function* () {
125
+ return (req, res, options) => __awaiter(this, void 0, void 0, function* () {
125
126
  try {
126
- return yield this.handler(req, res);
127
+ return yield this.handler(req, res, options);
127
128
  }
128
129
  catch (error) {
129
130
  console.log('Personalize middleware failed:');
@@ -146,7 +147,7 @@ export class PersonalizeMiddleware extends MiddlewareBase {
146
147
  });
147
148
  }
148
149
  personalize(_a, request_1) {
149
- return __awaiter(this, arguments, void 0, function* ({ params, friendlyId, language, timeout, variantIds, }, request) {
150
+ return __awaiter(this, arguments, void 0, function* ({ params, friendlyId, language, timeout, variantIds, options, }, request) {
150
151
  var _b;
151
152
  debug.personalize('executing experience for %s %o', friendlyId, params);
152
153
  return (yield personalize(request, {
@@ -156,6 +157,7 @@ export class PersonalizeMiddleware extends MiddlewareBase {
156
157
  params,
157
158
  language,
158
159
  pageVariantIds: variantIds,
160
+ geo: options === null || options === void 0 ? void 0 : options.geo,
159
161
  }, { timeout }));
160
162
  });
161
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "22.6.0",
3
+ "version": "22.7.0-canary.10",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -9,6 +9,7 @@
9
9
  "clean": "del-cli dist types",
10
10
  "lint": "eslint \"./src/**/*.tsx\" \"./src/**/*.ts\"",
11
11
  "test": "mocha --require ./test/setup.js \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\" --exit",
12
+ "test-dev": "mocha --require ./test/setup.js \"./src/**/RichText.test.tsx\" --exit",
12
13
  "prepublishOnly": "npm run build",
13
14
  "coverage": "nyc npm test",
14
15
  "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/sitecore-jss-nextjs --entryPoints src/index.ts --entryPoints src/monitoring/index.ts --entryPoints src/editing/index.ts --entryPoints src/middleware/index.ts --entryPoints src/context/index.ts --entryPoints src/utils/index.ts --entryPoints src/site/index.ts --entryPoints src/graphql/index.ts --githubPages false"
@@ -29,62 +30,58 @@
29
30
  "url": "https://github.com/sitecore/jss/issues"
30
31
  },
31
32
  "devDependencies": {
32
- "@sitecore-cloudsdk/core": "^0.4.2",
33
- "@sitecore-cloudsdk/personalize": "^0.4.2",
33
+ "@sitecore-cloudsdk/core": "^0.5.1",
34
+ "@sitecore-cloudsdk/personalize": "^0.5.1",
35
+ "@testing-library/dom": "^10.4.0",
36
+ "@testing-library/react": "^16.3.0",
34
37
  "@types/chai": "^4.3.4",
35
38
  "@types/chai-as-promised": "^7.1.5",
36
39
  "@types/chai-string": "^1.4.2",
37
- "@types/enzyme": "^3.10.12",
38
40
  "@types/mocha": "^10.0.1",
39
41
  "@types/node": "~22.9.0",
40
- "@types/prop-types": "^15.7.5",
41
- "@types/react": "^18.2.45",
42
- "@types/react-dom": "^18.0.10",
42
+ "@types/react": "^19.1.2",
43
+ "@types/react-dom": "^19.1.3",
43
44
  "@types/sinon": "^10.0.13",
44
45
  "@types/sinon-chai": "^3.2.9",
45
- "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
46
46
  "chai": "^4.3.7",
47
47
  "chai-as-promised": "^7.1.1",
48
48
  "chai-string": "^1.5.0",
49
49
  "chalk": "^4.1.2",
50
- "cheerio": "1.0.0-rc.12",
51
50
  "cross-fetch": "^3.1.5",
52
51
  "del-cli": "^5.0.0",
53
- "enzyme": "^3.11.0",
54
52
  "eslint": "^8.56.0",
55
- "eslint-plugin-react": "^7.32.1",
53
+ "eslint-plugin-react": "^7.37.5",
56
54
  "jsdom": "^21.1.0",
57
55
  "mocha": "^10.2.0",
58
- "next": "^14.2.18",
56
+ "next": "^15.3.1",
59
57
  "nock": "^13.3.0",
60
58
  "nyc": "^15.1.0",
61
- "react": "^18.2.0",
62
- "react-dom": "^18.2.0",
59
+ "react": "^19.1.0",
60
+ "react-dom": "^19.1.0",
63
61
  "sinon": "^15.0.1",
64
62
  "sinon-chai": "^3.7.0",
65
63
  "ts-node": "^10.9.1",
66
64
  "typescript": "~5.4.0"
67
65
  },
68
66
  "peerDependencies": {
69
- "@sitecore-cloudsdk/core": "^0.4.2",
70
- "@sitecore-cloudsdk/events": "^0.4.2",
71
- "@sitecore-cloudsdk/personalize": "^0.4.2",
72
- "next": "^14.2.18",
73
- "react": "^18.2.0",
74
- "react-dom": "^18.2.0"
67
+ "@sitecore-cloudsdk/core": "^0.5.1",
68
+ "@sitecore-cloudsdk/events": "^0.5.1",
69
+ "@sitecore-cloudsdk/personalize": "^0.5.1",
70
+ "next": "^15.3.1",
71
+ "react": "^19.1.0",
72
+ "react-dom": "^19.1.0"
75
73
  },
76
74
  "dependencies": {
77
- "@sitecore-jss/sitecore-jss": "22.6.0",
78
- "@sitecore-jss/sitecore-jss-dev-tools": "22.6.0",
79
- "@sitecore-jss/sitecore-jss-react": "22.6.0",
75
+ "@sitecore-jss/sitecore-jss": "22.7.0-canary.10",
76
+ "@sitecore-jss/sitecore-jss-dev-tools": "22.7.0-canary.10",
77
+ "@sitecore-jss/sitecore-jss-react": "22.7.0-canary.10",
80
78
  "@vercel/kv": "^0.2.1",
81
- "prop-types": "^15.8.1",
82
79
  "regex-parser": "^2.2.11",
83
80
  "sync-disk-cache": "^2.1.0"
84
81
  },
85
82
  "description": "",
86
83
  "types": "types/index.d.ts",
87
- "gitHead": "e75a84e27a017ba303b4e9b3a8e65d4dac4c8a59",
84
+ "gitHead": "98bc01faa6487f50b8f39498af7eac98ecc86445",
88
85
  "files": [
89
86
  "dist",
90
87
  "types",
@@ -1,5 +1,5 @@
1
1
  /// <reference types="@types/react" />
2
- import React, { ReactNode } from 'react';
2
+ import React, { ReactNode, JSX } from 'react';
3
3
  import { ComponentPropsCollection } from '../sharedTypes/component-props';
4
4
  /**
5
5
  * Component props context which we are using in order to store data fetched on components level (getStaticProps/getServerSideProps)
@@ -1,6 +1,4 @@
1
- /// <reference types="@types/react" />
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
1
+ import { JSX } from 'react';
4
2
  import { RichTextProps as ReactRichTextProps } from '@sitecore-jss/sitecore-jss-react';
5
3
  export type RichTextProps = ReactRichTextProps & {
6
4
  /**
@@ -23,18 +21,5 @@ export declare const prefetched: {
23
21
  };
24
22
  export declare const RichText: {
25
23
  (props: RichTextProps): JSX.Element;
26
- propTypes: {
27
- field: PropTypes.Requireable<PropTypes.InferProps<{
28
- value: PropTypes.Requireable<string>;
29
- editable: PropTypes.Requireable<string>;
30
- metadata: PropTypes.Requireable<{
31
- [x: string]: any;
32
- }>;
33
- }>>;
34
- tag: PropTypes.Requireable<string>;
35
- editable: PropTypes.Requireable<boolean>;
36
- emptyFieldEditingComponent: PropTypes.Requireable<NonNullable<React.ComponentClass<unknown, any> | React.FC<unknown>>>;
37
- internalLinksSelector: PropTypes.Requireable<string>;
38
- };
39
24
  displayName: string;
40
25
  };
@@ -38,6 +38,23 @@ export type PersonalizeMiddlewareConfig = MiddlewareBaseConfig & {
38
38
  */
39
39
  scope?: string;
40
40
  };
41
+ /**
42
+ * Personalization options
43
+ */
44
+ export type PersonalizeOptions = {
45
+ /**
46
+ * Geolocation data used for personalization
47
+ */
48
+ geo?: PersonalizeGeoData;
49
+ };
50
+ /**
51
+ * Represents the geolocation data used for personalization
52
+ */
53
+ export type PersonalizeGeoData = {
54
+ city?: string;
55
+ country?: string;
56
+ region?: string;
57
+ };
41
58
  /**
42
59
  * Object model of Experience Context data
43
60
  */
@@ -72,19 +89,20 @@ export declare class PersonalizeMiddleware extends MiddlewareBase {
72
89
  * Gets the Next.js middleware handler with error handling
73
90
  * @returns middleware handler
74
91
  */
75
- getHandler(): (req: NextRequest, res?: NextResponse) => Promise<NextResponse>;
92
+ getHandler(): (req: NextRequest, res?: NextResponse, options?: PersonalizeOptions) => Promise<NextResponse>;
76
93
  protected initPersonalizeServer({ hostname, siteName, request, response, }: {
77
94
  hostname: string;
78
95
  siteName: string;
79
96
  request: NextRequest;
80
97
  response: NextResponse;
81
98
  }): Promise<void>;
82
- protected personalize({ params, friendlyId, language, timeout, variantIds, }: {
99
+ protected personalize({ params, friendlyId, language, timeout, variantIds, options, }: {
83
100
  params: ExperienceParams;
84
101
  friendlyId: string;
85
102
  language: string;
86
103
  timeout?: number;
87
104
  variantIds?: string[];
105
+ options?: PersonalizeOptions;
88
106
  }, request: NextRequest): Promise<{
89
107
  variantId: string;
90
108
  }>;