@sitecore-jss/sitecore-jss-nextjs 22.7.0-canary.1 → 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/dist/cjs/components/Link.js +4 -4
- package/dist/cjs/components/NextImage.js +1 -20
- package/dist/cjs/components/RichText.js +0 -5
- package/dist/cjs/middleware/personalize-middleware.js +6 -4
- package/dist/esm/components/Link.js +5 -5
- package/dist/esm/components/NextImage.js +1 -20
- package/dist/esm/components/RichText.js +1 -3
- package/dist/esm/middleware/personalize-middleware.js +6 -4
- package/package.json +22 -25
- package/types/components/ComponentPropsContext.d.ts +1 -1
- package/types/components/RichText.d.ts +1 -16
- package/types/middleware/personalize-middleware.d.ts +20 -2
|
@@ -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,
|
|
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,
|
|
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.7.0-canary.
|
|
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.5.
|
|
33
|
-
"@sitecore-cloudsdk/personalize": "^0.5.
|
|
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/
|
|
41
|
-
"@types/react": "^
|
|
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.
|
|
53
|
+
"eslint-plugin-react": "^7.37.5",
|
|
56
54
|
"jsdom": "^21.1.0",
|
|
57
55
|
"mocha": "^10.2.0",
|
|
58
|
-
"next": "^
|
|
56
|
+
"next": "^15.3.1",
|
|
59
57
|
"nock": "^13.3.0",
|
|
60
58
|
"nyc": "^15.1.0",
|
|
61
|
-
"react": "^
|
|
62
|
-
"react-dom": "^
|
|
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.5.
|
|
70
|
-
"@sitecore-cloudsdk/events": "^0.5.
|
|
71
|
-
"@sitecore-cloudsdk/personalize": "^0.5.
|
|
72
|
-
"next": "^
|
|
73
|
-
"react": "^
|
|
74
|
-
"react-dom": "^
|
|
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.7.0-canary.
|
|
78
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "22.7.0-canary.
|
|
79
|
-
"@sitecore-jss/sitecore-jss-react": "22.7.0-canary.
|
|
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": "
|
|
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
|
-
|
|
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
|
}>;
|