@sitecore-jss/sitecore-jss-nextjs 22.2.0-canary.9 → 22.2.0
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 +202 -202
- package/README.md +11 -11
- package/dist/cjs/components/NextImage.js +6 -1
- package/dist/cjs/editing/constants.js +1 -1
- package/dist/cjs/editing/editing-render-middleware.js +1 -1
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/middleware/index.js +3 -1
- package/dist/cjs/middleware/personalize-middleware.js +7 -4
- package/dist/cjs/middleware/redirects-middleware.js +157 -42
- package/dist/esm/components/NextImage.js +8 -3
- package/dist/esm/editing/constants.js +1 -1
- package/dist/esm/editing/editing-render-middleware.js +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/middleware/index.js +1 -0
- package/dist/esm/middleware/personalize-middleware.js +6 -3
- package/dist/esm/middleware/redirects-middleware.js +157 -42
- package/package.json +11 -10
- package/types/editing/editing-render-middleware.d.ts +3 -0
- package/types/index.d.ts +1 -2
- package/types/middleware/index.d.ts +1 -0
- package/types/middleware/redirects-middleware.d.ts +29 -1
- package/context.d.ts +0 -1
- package/context.js +0 -1
- package/dist/cjs/context/context.js +0 -83
- package/dist/cjs/context/index.js +0 -5
- package/dist/esm/context/context.js +0 -79
- package/dist/esm/context/index.js +0 -1
- package/types/context/context.d.ts +0 -116
- package/types/context/index.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-nextjs",
|
|
3
|
-
"version": "22.2.0
|
|
3
|
+
"version": "22.2.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"url": "https://github.com/sitecore/jss/issues"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@sitecore-cloudsdk/
|
|
32
|
+
"@sitecore-cloudsdk/core": "^0.4.0",
|
|
33
|
+
"@sitecore-cloudsdk/personalize": "^0.4.0",
|
|
33
34
|
"@types/chai": "^4.3.4",
|
|
34
35
|
"@types/chai-as-promised": "^7.1.5",
|
|
35
36
|
"@types/chai-string": "^1.4.2",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"eslint-plugin-react": "^7.32.1",
|
|
55
56
|
"jsdom": "^21.1.0",
|
|
56
57
|
"mocha": "^10.2.0",
|
|
57
|
-
"next": "^14.
|
|
58
|
+
"next": "^14.2.7",
|
|
58
59
|
"nock": "^13.3.0",
|
|
59
60
|
"nyc": "^15.1.0",
|
|
60
61
|
"react": "^18.2.0",
|
|
@@ -65,16 +66,16 @@
|
|
|
65
66
|
"typescript": "~4.9.4"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"@sitecore-cloudsdk/
|
|
69
|
-
"@sitecore-cloudsdk/personalize": "^0.
|
|
70
|
-
"next": "^14.
|
|
69
|
+
"@sitecore-cloudsdk/core": "^0.4.0",
|
|
70
|
+
"@sitecore-cloudsdk/personalize": "^0.4.0",
|
|
71
|
+
"next": "^14.2.7",
|
|
71
72
|
"react": "^18.2.0",
|
|
72
73
|
"react-dom": "^18.2.0"
|
|
73
74
|
},
|
|
74
75
|
"dependencies": {
|
|
75
|
-
"@sitecore-jss/sitecore-jss": "
|
|
76
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "
|
|
77
|
-
"@sitecore-jss/sitecore-jss-react": "
|
|
76
|
+
"@sitecore-jss/sitecore-jss": "22.2.0",
|
|
77
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "22.2.0",
|
|
78
|
+
"@sitecore-jss/sitecore-jss-react": "22.2.0",
|
|
78
79
|
"@vercel/kv": "^0.2.1",
|
|
79
80
|
"prop-types": "^15.8.1",
|
|
80
81
|
"regex-parser": "^2.2.11",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
},
|
|
83
84
|
"description": "",
|
|
84
85
|
"types": "types/index.d.ts",
|
|
85
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "628c78c44857670879a1ade67f58c61d516425e9",
|
|
86
87
|
"files": [
|
|
87
88
|
"dist",
|
|
88
89
|
"types",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
2
2
|
import { AxiosDataFetcher } from '@sitecore-jss/sitecore-jss';
|
|
3
3
|
import { EditMode, LayoutServicePageState } from '@sitecore-jss/sitecore-jss/layout';
|
|
4
|
+
import { LayoutKind } from '@sitecore-jss/sitecore-jss/editing';
|
|
4
5
|
import { EditingDataService } from './editing-data-service';
|
|
5
6
|
import { RenderMiddlewareBase } from './render-middleware';
|
|
6
7
|
/**
|
|
@@ -108,6 +109,7 @@ export type MetadataQueryParams = {
|
|
|
108
109
|
mode: Exclude<LayoutServicePageState, 'normal'>;
|
|
109
110
|
sc_variant?: string;
|
|
110
111
|
sc_version?: string;
|
|
112
|
+
sc_layoutKind?: LayoutKind;
|
|
111
113
|
};
|
|
112
114
|
/**
|
|
113
115
|
* Next.js API request with Metadata query parameters.
|
|
@@ -126,6 +128,7 @@ export type EditingMetadataPreviewData = {
|
|
|
126
128
|
pageState: Exclude<LayoutServicePageState, 'Normal'>;
|
|
127
129
|
variantIds: string[];
|
|
128
130
|
version?: string;
|
|
131
|
+
layoutKind?: LayoutKind;
|
|
129
132
|
};
|
|
130
133
|
/**
|
|
131
134
|
* Type guard for EditingMetadataPreviewData
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, HTMLLink, enableDebug, debug, } from '@sitecore-jss/sitecore-jss';
|
|
1
|
+
export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, HTMLLink, enableDebug, debug, CacheClient, CacheOptions, MemoryCacheClient, } from '@sitecore-jss/sitecore-jss';
|
|
2
2
|
export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, GraphQLLayoutServiceConfig, RestLayoutService, RestLayoutServiceConfig, PlaceholderData, PlaceholdersData, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams, getContentStylesheetLink, EditMode, } from '@sitecore-jss/sitecore-jss/layout';
|
|
3
3
|
export { mediaApi } from '@sitecore-jss/sitecore-jss/media';
|
|
4
4
|
export { trackingApi, TrackingRequestOptions, CampaignInstance, GoalInstance, OutcomeInstance, EventInstance, PageViewInstance, } from '@sitecore-jss/sitecore-jss/tracking';
|
|
@@ -22,5 +22,4 @@ import * as BYOCWrapper from './components/BYOCWrapper';
|
|
|
22
22
|
export { FEaaSWrapper };
|
|
23
23
|
export { BYOCWrapper };
|
|
24
24
|
export { ComponentBuilder, ComponentBuilderConfig } from './ComponentBuilder';
|
|
25
|
-
export { Context, ContextConfig, SDK } from './context';
|
|
26
25
|
export { ComponentFactory, Image, ImageField, ImageFieldValue, ImageProps, LinkField, LinkFieldValue, Text, TextField, DateField, EditFrame, FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponentParams, BYOCComponent, BYOCComponentProps, getComponentLibraryStylesheetLinks, File, FileField, RichTextField, DefaultEmptyFieldEditingComponentImage, DefaultEmptyFieldEditingComponentText, VisitorIdentification, PlaceholderComponentProps, SitecoreContext, SitecoreContextState, SitecoreContextValue, SitecoreContextReactContext, withSitecoreContext, useSitecoreContext, withEditorChromes, withPlaceholder, withDatasourceCheck, ImageSizeParameters, WithSitecoreContextOptions, WithSitecoreContextProps, WithSitecoreContextHocProps, withFieldMetadata, withEmptyFieldEditingComponent, EditingScripts, } from '@sitecore-jss/sitecore-jss-react';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { debug } from '@sitecore-jss/sitecore-jss';
|
|
2
|
+
export { MiddlewareBase, MiddlewareBaseConfig } from './middleware';
|
|
2
3
|
export { RedirectsMiddleware, RedirectsMiddlewareConfig } from './redirects-middleware';
|
|
3
4
|
export { PersonalizeMiddleware, PersonalizeMiddlewareConfig } from './personalize-middleware';
|
|
4
5
|
export { MultisiteMiddleware, MultisiteMiddlewareConfig } from './multisite-middleware';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NextResponse, NextRequest } from 'next/server';
|
|
2
1
|
import { GraphQLRedirectsServiceConfig } from '@sitecore-jss/sitecore-jss/site';
|
|
2
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
3
3
|
import { MiddlewareBase, MiddlewareBaseConfig } from './middleware';
|
|
4
4
|
/**
|
|
5
5
|
* extended RedirectsMiddlewareConfig config type for RedirectsMiddleware
|
|
@@ -37,4 +37,32 @@ export declare class RedirectsMiddleware extends MiddlewareBase {
|
|
|
37
37
|
* @private
|
|
38
38
|
*/
|
|
39
39
|
private getExistsRedirect;
|
|
40
|
+
/**
|
|
41
|
+
* When a user clicks on a link generated by the Link component from next/link,
|
|
42
|
+
* Next.js adds special parameters in the route called path.
|
|
43
|
+
* This method removes these special parameters.
|
|
44
|
+
* @param {NextURL} url
|
|
45
|
+
* @returns {string} normalize url
|
|
46
|
+
*/
|
|
47
|
+
private normalizeUrl;
|
|
48
|
+
/**
|
|
49
|
+
* Helper function to create a redirect response and remove the x-middleware-next header.
|
|
50
|
+
* @param {NextURL} url The URL to redirect to.
|
|
51
|
+
* @param {Response} res The response object.
|
|
52
|
+
* @param {number} status The HTTP status code of the redirect.
|
|
53
|
+
* @param {string} statusText The status text of the redirect.
|
|
54
|
+
* @returns {NextResponse<unknown>} The redirect response.
|
|
55
|
+
*/
|
|
56
|
+
private createRedirectResponse;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if the current URL query matches the provided pattern, considering all permutations of query parameters.
|
|
59
|
+
* It constructs all possible query parameter permutations and tests them against the pattern.
|
|
60
|
+
* @param {Object} params - The parameters for the URL match.
|
|
61
|
+
* @param {string} params.pathname - The current URL pathname.
|
|
62
|
+
* @param {string} params.queryString - The current URL query string.
|
|
63
|
+
* @param {string} params.pattern - The regex pattern to test the constructed URLs against.
|
|
64
|
+
* @param {string} [params.locale] - The locale prefix to include in the URL if present.
|
|
65
|
+
* @returns {string | undefined} - return query string if any of the query permutations match the provided pattern, undefined otherwise.
|
|
66
|
+
*/
|
|
67
|
+
private isPermutedQueryMatch;
|
|
40
68
|
}
|
package/context.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types/context/index';
|
package/context.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./dist/cjs/context/index');
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Context = void 0;
|
|
4
|
-
const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
|
|
5
|
-
/**
|
|
6
|
-
* Context instance that is used to initialize the application Context and associated Software Development Kits (SDKs).
|
|
7
|
-
*/
|
|
8
|
-
class Context {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
this.props = props;
|
|
11
|
-
/**
|
|
12
|
-
* Indicates whether the Context and SDK(s) have been initialized
|
|
13
|
-
*/
|
|
14
|
-
this.isInitialized = false;
|
|
15
|
-
/**
|
|
16
|
-
* Software Development Kits (SDKs) to be initialized
|
|
17
|
-
*/
|
|
18
|
-
this.sdks = {};
|
|
19
|
-
/**
|
|
20
|
-
* Promises for the SDKs
|
|
21
|
-
*/
|
|
22
|
-
this.sdkPromises = {};
|
|
23
|
-
this.sdkErrors = {};
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves the Software Development Kit (SDK) instance, ensuring it is initialized before returning
|
|
26
|
-
*
|
|
27
|
-
* @param {string} name SDK name
|
|
28
|
-
* @returns initialized SDK
|
|
29
|
-
*/
|
|
30
|
-
this.getSDK = (name) => {
|
|
31
|
-
if (!this.sdkPromises[name]) {
|
|
32
|
-
return Promise.reject(`Unknown SDK '${String(name)}'`);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return this.sdkPromises[name].then((result) => {
|
|
36
|
-
return ((this.sdkErrors[name] && Promise.reject(this.sdkErrors[name])) || Promise.resolve(result));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
this.sitecoreEdgeUrl = props.sitecoreEdgeUrl;
|
|
41
|
-
this.sitecoreEdgeContextId = props.sitecoreEdgeContextId;
|
|
42
|
-
this.siteName = props.siteName;
|
|
43
|
-
this.pageState = sitecore_jss_react_1.LayoutServicePageState.Normal;
|
|
44
|
-
}
|
|
45
|
-
init(props = {}) {
|
|
46
|
-
// Context and SDKs are initialized only once
|
|
47
|
-
if (this.isInitialized)
|
|
48
|
-
return;
|
|
49
|
-
this.isInitialized = true;
|
|
50
|
-
if (props.siteName) {
|
|
51
|
-
this.siteName = props.siteName;
|
|
52
|
-
}
|
|
53
|
-
if (props.pageState) {
|
|
54
|
-
this.pageState = props.pageState;
|
|
55
|
-
}
|
|
56
|
-
// iterate over the SDKs and initialize them
|
|
57
|
-
for (const sdkName of Object.keys(this.props.sdks)) {
|
|
58
|
-
this.initSDK(sdkName);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Initializes the Software Development Kit (SDK)
|
|
63
|
-
*
|
|
64
|
-
* @param {T} name SDK name
|
|
65
|
-
* @returns {void}
|
|
66
|
-
*/
|
|
67
|
-
initSDK(name) {
|
|
68
|
-
this.sdkPromises[name] = new Promise((resolve) => {
|
|
69
|
-
this.props.sdks[name]
|
|
70
|
-
.init(this)
|
|
71
|
-
.then(() => {
|
|
72
|
-
this.sdks[name] = this.props.sdks[name].sdk;
|
|
73
|
-
resolve(this.sdks[name]);
|
|
74
|
-
})
|
|
75
|
-
.catch((e) => {
|
|
76
|
-
// if init rejects, we mark SDK as failed - so getSDK call would reject with a reason
|
|
77
|
-
this.sdkErrors[name] = e;
|
|
78
|
-
resolve(undefined);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.Context = Context;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { LayoutServicePageState } from '@sitecore-jss/sitecore-jss-react';
|
|
2
|
-
/**
|
|
3
|
-
* Context instance that is used to initialize the application Context and associated Software Development Kits (SDKs).
|
|
4
|
-
*/
|
|
5
|
-
export class Context {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
this.props = props;
|
|
8
|
-
/**
|
|
9
|
-
* Indicates whether the Context and SDK(s) have been initialized
|
|
10
|
-
*/
|
|
11
|
-
this.isInitialized = false;
|
|
12
|
-
/**
|
|
13
|
-
* Software Development Kits (SDKs) to be initialized
|
|
14
|
-
*/
|
|
15
|
-
this.sdks = {};
|
|
16
|
-
/**
|
|
17
|
-
* Promises for the SDKs
|
|
18
|
-
*/
|
|
19
|
-
this.sdkPromises = {};
|
|
20
|
-
this.sdkErrors = {};
|
|
21
|
-
/**
|
|
22
|
-
* Retrieves the Software Development Kit (SDK) instance, ensuring it is initialized before returning
|
|
23
|
-
*
|
|
24
|
-
* @param {string} name SDK name
|
|
25
|
-
* @returns initialized SDK
|
|
26
|
-
*/
|
|
27
|
-
this.getSDK = (name) => {
|
|
28
|
-
if (!this.sdkPromises[name]) {
|
|
29
|
-
return Promise.reject(`Unknown SDK '${String(name)}'`);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return this.sdkPromises[name].then((result) => {
|
|
33
|
-
return ((this.sdkErrors[name] && Promise.reject(this.sdkErrors[name])) || Promise.resolve(result));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
this.sitecoreEdgeUrl = props.sitecoreEdgeUrl;
|
|
38
|
-
this.sitecoreEdgeContextId = props.sitecoreEdgeContextId;
|
|
39
|
-
this.siteName = props.siteName;
|
|
40
|
-
this.pageState = LayoutServicePageState.Normal;
|
|
41
|
-
}
|
|
42
|
-
init(props = {}) {
|
|
43
|
-
// Context and SDKs are initialized only once
|
|
44
|
-
if (this.isInitialized)
|
|
45
|
-
return;
|
|
46
|
-
this.isInitialized = true;
|
|
47
|
-
if (props.siteName) {
|
|
48
|
-
this.siteName = props.siteName;
|
|
49
|
-
}
|
|
50
|
-
if (props.pageState) {
|
|
51
|
-
this.pageState = props.pageState;
|
|
52
|
-
}
|
|
53
|
-
// iterate over the SDKs and initialize them
|
|
54
|
-
for (const sdkName of Object.keys(this.props.sdks)) {
|
|
55
|
-
this.initSDK(sdkName);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Initializes the Software Development Kit (SDK)
|
|
60
|
-
*
|
|
61
|
-
* @param {T} name SDK name
|
|
62
|
-
* @returns {void}
|
|
63
|
-
*/
|
|
64
|
-
initSDK(name) {
|
|
65
|
-
this.sdkPromises[name] = new Promise((resolve) => {
|
|
66
|
-
this.props.sdks[name]
|
|
67
|
-
.init(this)
|
|
68
|
-
.then(() => {
|
|
69
|
-
this.sdks[name] = this.props.sdks[name].sdk;
|
|
70
|
-
resolve(this.sdks[name]);
|
|
71
|
-
})
|
|
72
|
-
.catch((e) => {
|
|
73
|
-
// if init rejects, we mark SDK as failed - so getSDK call would reject with a reason
|
|
74
|
-
this.sdkErrors[name] = e;
|
|
75
|
-
resolve(undefined);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Context } from './context';
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { LayoutServicePageState } from '@sitecore-jss/sitecore-jss-react';
|
|
2
|
-
/**
|
|
3
|
-
* Software Development Kit (SDK) instance
|
|
4
|
-
*/
|
|
5
|
-
export type SDK<SDKType = unknown> = {
|
|
6
|
-
/**
|
|
7
|
-
* The Software Development Kit (SDK) library instance
|
|
8
|
-
*/
|
|
9
|
-
sdk: SDKType;
|
|
10
|
-
/**
|
|
11
|
-
* Initializes the Software Development Kit (SDK)
|
|
12
|
-
*/
|
|
13
|
-
init: (props: InitSDKProps) => Promise<void>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Software Development Kits (SDKs) to be initialized
|
|
17
|
-
*/
|
|
18
|
-
type SDKModulesType = Record<string, SDK>;
|
|
19
|
-
/**
|
|
20
|
-
* Properties that are passed to the Context.
|
|
21
|
-
*/
|
|
22
|
-
export interface ContextInitProps {
|
|
23
|
-
/**
|
|
24
|
-
* Your Sitecore site name
|
|
25
|
-
*/
|
|
26
|
-
siteName?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Sitecore page state (normal, preview, edit)
|
|
29
|
-
*/
|
|
30
|
-
pageState?: LayoutServicePageState;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Configuration that is passed to the Context.
|
|
34
|
-
*/
|
|
35
|
-
export interface ContextConfig<SDKModules extends SDKModulesType> {
|
|
36
|
-
/**
|
|
37
|
-
* Your Sitecore Edge URL
|
|
38
|
-
*/
|
|
39
|
-
sitecoreEdgeUrl: string;
|
|
40
|
-
/**
|
|
41
|
-
* Your Sitecore Edge Context ID
|
|
42
|
-
*/
|
|
43
|
-
sitecoreEdgeContextId: string;
|
|
44
|
-
/**
|
|
45
|
-
* Your Sitecore site name
|
|
46
|
-
*/
|
|
47
|
-
siteName: string;
|
|
48
|
-
/**
|
|
49
|
-
* Software Development Kits (SDKs) to be initialized
|
|
50
|
-
*/
|
|
51
|
-
sdks: {
|
|
52
|
-
[module in keyof SDKModules]: SDKModules[module];
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Properties that are passed to the Software Development Kit (SDK) initialization function.
|
|
57
|
-
*/
|
|
58
|
-
type InitSDKProps = Omit<ContextConfig<SDKModulesType>, 'sdks'>;
|
|
59
|
-
/**
|
|
60
|
-
* Context instance that is used to initialize the application Context and associated Software Development Kits (SDKs).
|
|
61
|
-
*/
|
|
62
|
-
export declare class Context<SDKModules extends SDKModulesType> {
|
|
63
|
-
protected props: ContextConfig<SDKModules>;
|
|
64
|
-
/**
|
|
65
|
-
* Indicates whether the Context and SDK(s) have been initialized
|
|
66
|
-
*/
|
|
67
|
-
isInitialized: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* The Sitecore Edge URL
|
|
70
|
-
*/
|
|
71
|
-
readonly sitecoreEdgeUrl: string;
|
|
72
|
-
/**
|
|
73
|
-
* The Sitecore Edge Context ID
|
|
74
|
-
*/
|
|
75
|
-
readonly sitecoreEdgeContextId: string;
|
|
76
|
-
/**
|
|
77
|
-
* The Sitecore site name
|
|
78
|
-
*/
|
|
79
|
-
siteName: string;
|
|
80
|
-
/**
|
|
81
|
-
* Sitecore page state (normal, preview, edit)
|
|
82
|
-
*/
|
|
83
|
-
pageState: LayoutServicePageState;
|
|
84
|
-
/**
|
|
85
|
-
* Software Development Kits (SDKs) to be initialized
|
|
86
|
-
*/
|
|
87
|
-
readonly sdks: {
|
|
88
|
-
[module in keyof SDKModules]?: SDKModules[module]['sdk'];
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Promises for the SDKs
|
|
92
|
-
*/
|
|
93
|
-
protected sdkPromises: {
|
|
94
|
-
[module in keyof SDKModules]?: Promise<SDKModules[module]['sdk']>;
|
|
95
|
-
};
|
|
96
|
-
protected sdkErrors: {
|
|
97
|
-
[module in keyof SDKModules]?: string;
|
|
98
|
-
};
|
|
99
|
-
constructor(props: ContextConfig<SDKModules>);
|
|
100
|
-
init(props?: ContextInitProps): void;
|
|
101
|
-
/**
|
|
102
|
-
* Retrieves the Software Development Kit (SDK) instance, ensuring it is initialized before returning
|
|
103
|
-
*
|
|
104
|
-
* @param {string} name SDK name
|
|
105
|
-
* @returns initialized SDK
|
|
106
|
-
*/
|
|
107
|
-
getSDK: <T extends keyof SDKModules>(name: T) => Promise<SDKModules[T]["sdk"]>;
|
|
108
|
-
/**
|
|
109
|
-
* Initializes the Software Development Kit (SDK)
|
|
110
|
-
*
|
|
111
|
-
* @param {T} name SDK name
|
|
112
|
-
* @returns {void}
|
|
113
|
-
*/
|
|
114
|
-
protected initSDK<T extends keyof SDKModules>(name: T): void;
|
|
115
|
-
}
|
|
116
|
-
export {};
|
package/types/context/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Context, ContextConfig, SDK } from './context';
|