@sitecore-content-sdk/nextjs 2.0.0-canary.9 → 2.0.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/dist/cjs/cache/page-params.js +30 -0
- package/dist/cjs/client/sitecore-nextjs-client.js +57 -94
- package/dist/cjs/components/BYOCWrapper.js +3 -12
- package/dist/cjs/components/DesignLibrary/DesignLibraryApp.js +31 -0
- package/dist/cjs/components/DesignLibrary/DesignLibraryClientEvents.js +139 -0
- package/dist/cjs/components/DesignLibrary/DesignLibraryServer.js +221 -0
- package/dist/cjs/components/DesignLibrary/index.js +5 -0
- package/dist/cjs/components/DesignLibrary/models.js +2 -0
- package/dist/cjs/components/FEaaSWrapper.js +3 -12
- package/dist/cjs/editing/editing-config-middleware.js +2 -11
- package/dist/cjs/editing/editing-render-middleware.js +3 -12
- package/dist/cjs/editing/feaas-render-middleware.js +2 -11
- package/dist/cjs/editing/utils.js +3 -12
- package/dist/cjs/index.js +12 -2
- package/dist/cjs/initialization/proxy/analytics-adapter.js +71 -0
- package/dist/cjs/initialization/proxy/personalize-adapter.js +72 -0
- package/dist/cjs/middleware/robots-middleware.js +16 -25
- package/dist/cjs/middleware/sitemap-middleware.js +19 -28
- package/dist/cjs/monitoring/healthcheck-middleware.js +2 -11
- package/dist/cjs/proxy/locale-proxy.js +2 -11
- package/dist/cjs/proxy/multisite-proxy.js +2 -11
- package/dist/cjs/proxy/personalize-proxy.js +40 -36
- package/dist/cjs/proxy/proxy.js +3 -12
- package/dist/cjs/proxy/redirects-proxy.js +58 -69
- package/dist/cjs/route-handler/editing-config-route-handler.js +4 -13
- package/dist/cjs/route-handler/editing-render-route-handler.js +17 -28
- package/dist/cjs/route-handler/robots-route-handler.js +5 -14
- package/dist/cjs/route-handler/sitemap-route-handler.js +5 -14
- package/dist/cjs/server-actions/update-server-component-action.js +56 -0
- package/dist/cjs/services/component-props-service.js +63 -80
- package/dist/esm/cache/page-params.js +25 -0
- package/dist/esm/client/sitecore-nextjs-client.js +57 -94
- package/dist/esm/components/BYOCWrapper.js +3 -12
- package/dist/esm/components/DesignLibrary/DesignLibraryApp.js +24 -0
- package/dist/esm/components/DesignLibrary/DesignLibraryClientEvents.js +100 -0
- package/dist/esm/components/DesignLibrary/DesignLibraryServer.js +178 -0
- package/dist/esm/components/DesignLibrary/index.js +1 -0
- package/dist/esm/components/DesignLibrary/models.js +1 -0
- package/dist/esm/components/FEaaSWrapper.js +3 -12
- package/dist/esm/editing/editing-config-middleware.js +2 -11
- package/dist/esm/editing/editing-render-middleware.js +3 -12
- package/dist/esm/editing/feaas-render-middleware.js +2 -11
- package/dist/esm/editing/utils.js +3 -12
- package/dist/esm/index.js +6 -1
- package/dist/esm/initialization/proxy/analytics-adapter.js +66 -0
- package/dist/esm/initialization/proxy/personalize-adapter.js +69 -0
- package/dist/esm/middleware/robots-middleware.js +16 -25
- package/dist/esm/middleware/sitemap-middleware.js +19 -28
- package/dist/esm/monitoring/healthcheck-middleware.js +2 -11
- package/dist/esm/proxy/locale-proxy.js +2 -11
- package/dist/esm/proxy/multisite-proxy.js +2 -11
- package/dist/esm/proxy/personalize-proxy.js +40 -36
- package/dist/esm/proxy/proxy.js +3 -12
- package/dist/esm/proxy/redirects-proxy.js +58 -69
- package/dist/esm/route-handler/editing-config-route-handler.js +4 -13
- package/dist/esm/route-handler/editing-render-route-handler.js +17 -28
- package/dist/esm/route-handler/robots-route-handler.js +5 -14
- package/dist/esm/route-handler/sitemap-route-handler.js +5 -14
- package/dist/esm/server-actions/update-server-component-action.js +52 -0
- package/dist/esm/services/component-props-service.js +63 -80
- package/package.json +10 -10
- package/types/cache/page-params.d.ts +30 -0
- package/types/cache/page-params.d.ts.map +1 -0
- package/types/components/DesignLibrary/DesignLibraryApp.d.ts +14 -0
- package/types/components/DesignLibrary/DesignLibraryApp.d.ts.map +1 -0
- package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts +21 -0
- package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts.map +1 -0
- package/types/components/DesignLibrary/DesignLibraryServer.d.ts +38 -0
- package/types/components/DesignLibrary/DesignLibraryServer.d.ts.map +1 -0
- package/types/components/DesignLibrary/index.d.ts +2 -0
- package/types/components/DesignLibrary/index.d.ts.map +1 -0
- package/types/components/DesignLibrary/models.d.ts +60 -0
- package/types/components/DesignLibrary/models.d.ts.map +1 -0
- package/types/index.d.ts +9 -1
- package/types/index.d.ts.map +1 -1
- package/types/initialization/proxy/analytics-adapter.d.ts +30 -0
- package/types/initialization/proxy/analytics-adapter.d.ts.map +1 -0
- package/types/initialization/proxy/personalize-adapter.d.ts +23 -0
- package/types/initialization/proxy/personalize-adapter.d.ts.map +1 -0
- package/types/middleware/robots-middleware.d.ts.map +1 -1
- package/types/middleware/sitemap-middleware.d.ts.map +1 -1
- package/types/proxy/personalize-proxy.d.ts +2 -1
- package/types/proxy/personalize-proxy.d.ts.map +1 -1
- package/types/server-actions/update-server-component-action.d.ts +63 -0
- package/types/server-actions/update-server-component-action.d.ts.map +1 -0
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SiteResolver } from '@sitecore-content-sdk/content/site';
|
|
11
2
|
import { unstable_cache } from 'next/cache';
|
|
12
3
|
import debug from '../debug';
|
|
@@ -27,13 +18,13 @@ export function createSitemapRouteHandler(options) {
|
|
|
27
18
|
const site = siteResolver.getByHost(reqHost);
|
|
28
19
|
return { reqHost, reqProtocol, id, siteName: site.name };
|
|
29
20
|
};
|
|
30
|
-
const getSitemap = unstable_cache((options) =>
|
|
21
|
+
const getSitemap = unstable_cache(async (options) => {
|
|
31
22
|
return client.getSiteMap(options);
|
|
32
|
-
}
|
|
23
|
+
}, ['sitemap'], {
|
|
33
24
|
revalidate,
|
|
34
25
|
tags: ['sitemap'],
|
|
35
26
|
});
|
|
36
|
-
const GET = (req) =>
|
|
27
|
+
const GET = async (req) => {
|
|
37
28
|
try {
|
|
38
29
|
const options = getOptions(req);
|
|
39
30
|
// Access request data first, then capture timestamp for Next.js 16 compatibility
|
|
@@ -41,7 +32,7 @@ export function createSitemapRouteHandler(options) {
|
|
|
41
32
|
debug.sitemap('sitemap route handler start: %o', {
|
|
42
33
|
options,
|
|
43
34
|
});
|
|
44
|
-
const xml =
|
|
35
|
+
const xml = await getSitemap(options);
|
|
45
36
|
debug.sitemap('sitemap route handler end in %dms', Date.now() - startTimestamp);
|
|
46
37
|
return new Response(xml, {
|
|
47
38
|
headers: {
|
|
@@ -63,6 +54,6 @@ export function createSitemapRouteHandler(options) {
|
|
|
63
54
|
return new Response('Internal Server Error', { status: 500 });
|
|
64
55
|
}
|
|
65
56
|
}
|
|
66
|
-
}
|
|
57
|
+
};
|
|
67
58
|
return { GET };
|
|
68
59
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
import { refresh } from 'next/cache';
|
|
3
|
+
import { debug } from '@sitecore-content-sdk/content';
|
|
4
|
+
import { fetchGeneratedComponentFromCache, } from '@sitecore-content-sdk/content/codegen';
|
|
5
|
+
import { setCache } from '@sitecore-content-sdk/core/tools';
|
|
6
|
+
import { COMPONENT_UPDATE_CACHE_KEY_PREFIX, COMPONENT_PREVIEW_CACHE_KEY_PREFIX, } from '@sitecore-content-sdk/content/editing';
|
|
7
|
+
/**
|
|
8
|
+
* Server action to update global cache with the provided component updates received from Design Library.
|
|
9
|
+
* Stores the given {@link ComponentUpdateModel} in the global cache using a key based on the component UID.
|
|
10
|
+
* This enables rendering dynamic updates of server components inside Design Library
|
|
11
|
+
* @param {ComponentUpdateModel} updatedComponent - The component update model containing the UID and optional updated or preview component data.
|
|
12
|
+
* @returns A Promise that resolves when the cache has been updated.
|
|
13
|
+
*/
|
|
14
|
+
export async function updateComponentAction(updatedComponent) {
|
|
15
|
+
debug.editing(`Updating server component cache for Update Component: ${updatedComponent.uid}`);
|
|
16
|
+
setCache(`${COMPONENT_UPDATE_CACHE_KEY_PREFIX}${updatedComponent.uid}`, updatedComponent);
|
|
17
|
+
refresh();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Server action to update global cache with the generated component data in variant generation mode
|
|
21
|
+
* The generated component data is retrieved from a secured cache endpoint via the provided event arguments.
|
|
22
|
+
* This enables rendering dynamic updates of server components inside Design Library
|
|
23
|
+
* @param {PreviewEventModel} previewEvent - The preview event model containing the UID and the preview event arguments with cache information to fetch the generated component data.
|
|
24
|
+
* @param {ComponentRendering} rendering - The component rendering data to use when rendering server side.
|
|
25
|
+
* @param {string} [edgeUrl] - Optional Edge URL to fetch the generated component data.
|
|
26
|
+
* @returns A Promise that resolves when the cache has been updated.
|
|
27
|
+
*/
|
|
28
|
+
export async function previewComponentAction(previewEvent, rendering, edgeUrl) {
|
|
29
|
+
debug.editing(`Updating server component cache for Preview Component: ${previewEvent.uid}`);
|
|
30
|
+
const updatedComponent = {
|
|
31
|
+
uid: previewEvent.uid,
|
|
32
|
+
generatedComponentData: undefined,
|
|
33
|
+
rendering,
|
|
34
|
+
error: undefined,
|
|
35
|
+
};
|
|
36
|
+
if (previewEvent.args) {
|
|
37
|
+
// we've received a component preview event from the Design Library, so we need to fetch the generated component data from secured endpoint
|
|
38
|
+
try {
|
|
39
|
+
updatedComponent.generatedComponentData = await fetchGeneratedComponentFromCache(previewEvent.args.message.cache.id, previewEvent.args.message.cache.token, edgeUrl);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
debug.editing(`Error fetching generated component data from cache for Component: ${previewEvent.uid}`, error);
|
|
43
|
+
updatedComponent.error = error instanceof Error ? error.message : String(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
debug.editing(`No preview event arguments provided for Component: ${previewEvent.uid}`);
|
|
48
|
+
updatedComponent.error = 'No preview event arguments provided';
|
|
49
|
+
}
|
|
50
|
+
setCache(`${COMPONENT_PREVIEW_CACHE_KEY_PREFIX}${updatedComponent.uid}`, updatedComponent);
|
|
51
|
+
refresh();
|
|
52
|
+
}
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import chalk from 'chalk';
|
|
11
2
|
/**
|
|
12
3
|
* The service for fetching component props.
|
|
13
4
|
* @public
|
|
14
5
|
*/
|
|
15
6
|
export class ComponentPropsService {
|
|
16
|
-
fetchComponentProps(params) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
context,
|
|
25
|
-
});
|
|
26
|
-
return yield this.execRequests(requests);
|
|
7
|
+
async fetchComponentProps(params) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { layoutData, context, components } = params;
|
|
10
|
+
const requests = await this.collectRequests({
|
|
11
|
+
placeholders: (_a = layoutData.sitecore.route) === null || _a === void 0 ? void 0 : _a.placeholders,
|
|
12
|
+
components,
|
|
13
|
+
layoutData,
|
|
14
|
+
context,
|
|
27
15
|
});
|
|
16
|
+
return await this.execRequests(requests);
|
|
28
17
|
}
|
|
29
18
|
/**
|
|
30
19
|
* Go through layout service data, check all renderings using displayName, which should make some side effects.
|
|
@@ -37,67 +26,63 @@ export class ComponentPropsService {
|
|
|
37
26
|
* @param {ComponentPropsRequest[]} params.requests
|
|
38
27
|
* @returns {ComponentPropsRequest[]} array of requests
|
|
39
28
|
*/
|
|
40
|
-
collectRequests(params) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
async collectRequests(params) {
|
|
30
|
+
const { placeholders = {}, components, layoutData, context } = params;
|
|
31
|
+
// Will be called on first round
|
|
32
|
+
if (!params.requests) {
|
|
33
|
+
params.requests = [];
|
|
34
|
+
}
|
|
35
|
+
const renderings = this.flatRenderings(placeholders);
|
|
36
|
+
const actions = renderings.map(async (r) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const fetchFunc = (_a = (await this.getModule(components, r.componentName))) === null || _a === void 0 ? void 0 : _a.getComponentServerProps;
|
|
39
|
+
if (fetchFunc) {
|
|
40
|
+
params.requests &&
|
|
41
|
+
params.requests.push({
|
|
42
|
+
fetch: fetchFunc,
|
|
43
|
+
rendering: r,
|
|
44
|
+
layoutData: layoutData,
|
|
45
|
+
context,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// If placeholders exist in current rendering
|
|
49
|
+
if (r.placeholders) {
|
|
50
|
+
await this.collectRequests(Object.assign(Object.assign({}, params), { placeholders: r.placeholders }));
|
|
46
51
|
}
|
|
47
|
-
const renderings = this.flatRenderings(placeholders);
|
|
48
|
-
const actions = renderings.map((r) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _a;
|
|
50
|
-
const fetchFunc = (_a = (yield this.getModule(components, r.componentName))) === null || _a === void 0 ? void 0 : _a.getComponentServerProps;
|
|
51
|
-
if (fetchFunc) {
|
|
52
|
-
params.requests &&
|
|
53
|
-
params.requests.push({
|
|
54
|
-
fetch: fetchFunc,
|
|
55
|
-
rendering: r,
|
|
56
|
-
layoutData: layoutData,
|
|
57
|
-
context,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
// If placeholders exist in current rendering
|
|
61
|
-
if (r.placeholders) {
|
|
62
|
-
yield this.collectRequests(Object.assign(Object.assign({}, params), { placeholders: r.placeholders }));
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
yield Promise.all(actions);
|
|
66
|
-
return params.requests;
|
|
67
52
|
});
|
|
53
|
+
await Promise.all(actions);
|
|
54
|
+
return params.requests;
|
|
68
55
|
}
|
|
69
56
|
/**
|
|
70
57
|
* Execute request for component props
|
|
71
58
|
* @param {ComponentPropsRequest[]} requests requests
|
|
72
59
|
* @returns {Promise<ComponentPropsCollection>} requests result
|
|
73
60
|
*/
|
|
74
|
-
execRequests(requests) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
});
|
|
61
|
+
async execRequests(requests) {
|
|
62
|
+
const componentProps = {};
|
|
63
|
+
const promises = requests.map((req) => {
|
|
64
|
+
const { uid } = req.rendering;
|
|
65
|
+
if (!uid) {
|
|
66
|
+
console.log(`Component ${req.rendering.componentName} doesn't have uid, can't store data for this component`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
return req
|
|
70
|
+
.fetch(req.rendering, req.layoutData, req.context)
|
|
71
|
+
.then((result) => {
|
|
72
|
+
// Set component specific data in componentProps store
|
|
73
|
+
componentProps[uid] = result;
|
|
74
|
+
})
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
const errLog = `Error during preload data for component ${req.rendering.componentName} (${uid}): ${error.message || error}`;
|
|
77
|
+
console.error(chalk.red(errLog));
|
|
78
|
+
componentProps[uid] = {
|
|
79
|
+
error: error.message || errLog,
|
|
80
|
+
componentName: req.rendering.componentName,
|
|
81
|
+
};
|
|
97
82
|
});
|
|
98
|
-
yield Promise.all(promises);
|
|
99
|
-
return componentProps;
|
|
100
83
|
});
|
|
84
|
+
await Promise.all(promises);
|
|
85
|
+
return componentProps;
|
|
101
86
|
}
|
|
102
87
|
/**
|
|
103
88
|
* Take renderings from all placeholders and returns a flat array of renderings.
|
|
@@ -122,14 +107,12 @@ export class ComponentPropsService {
|
|
|
122
107
|
});
|
|
123
108
|
return allComponentRenderings;
|
|
124
109
|
}
|
|
125
|
-
getModule(components, componentName) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return module;
|
|
133
|
-
});
|
|
110
|
+
async getModule(components, componentName) {
|
|
111
|
+
var _a;
|
|
112
|
+
const component = components.get(componentName);
|
|
113
|
+
if (!component)
|
|
114
|
+
return null;
|
|
115
|
+
const module = component.dynamicModule ? await ((_a = component === null || component === void 0 ? void 0 : component.dynamicModule) === null || _a === void 0 ? void 0 : _a.call(component)) : component;
|
|
116
|
+
return module;
|
|
134
117
|
}
|
|
135
118
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/nextjs",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@sitecore-
|
|
36
|
-
"@sitecore-
|
|
35
|
+
"@sitecore-content-sdk/analytics-core": "^2.0.0",
|
|
36
|
+
"@sitecore-content-sdk/personalize": "^2.0.0",
|
|
37
37
|
"@stylistic/eslint-plugin": "^5.2.2",
|
|
38
38
|
"@testing-library/dom": "^10.4.0",
|
|
39
39
|
"@testing-library/react": "^16.3.0",
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"typescript": "~5.8.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@sitecore-
|
|
80
|
-
"@sitecore-
|
|
81
|
-
"@sitecore-
|
|
79
|
+
"@sitecore-content-sdk/analytics-core": "^2.0.0",
|
|
80
|
+
"@sitecore-content-sdk/events": "^2.0.0",
|
|
81
|
+
"@sitecore-content-sdk/personalize": "^2.0.0",
|
|
82
82
|
"next": "^16.1.1",
|
|
83
83
|
"react": "^19.2.1",
|
|
84
84
|
"react-dom": "^19.2.1",
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@babel/parser": "^7.27.2",
|
|
94
|
-
"@sitecore-content-sdk/content": "2.0.0
|
|
95
|
-
"@sitecore-content-sdk/core": "2.0.0
|
|
96
|
-
"@sitecore-content-sdk/react": "2.0.0
|
|
94
|
+
"@sitecore-content-sdk/content": "^2.0.0",
|
|
95
|
+
"@sitecore-content-sdk/core": "^2.0.0",
|
|
96
|
+
"@sitecore-content-sdk/react": "^2.0.0",
|
|
97
97
|
"recast": "^0.23.11",
|
|
98
98
|
"regex-parser": "^2.3.1",
|
|
99
99
|
"sync-disk-cache": "^2.1.0"
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
},
|
|
178
178
|
"description": "",
|
|
179
179
|
"types": "types/index.d.ts",
|
|
180
|
-
"gitHead": "
|
|
180
|
+
"gitHead": "492d7d718c965bbfe394d6c12c2e4870220cf4bf",
|
|
181
181
|
"files": [
|
|
182
182
|
"dist",
|
|
183
183
|
"types",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the page params, including locale and site.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export type CachedPageParams = {
|
|
6
|
+
/**
|
|
7
|
+
* The locale of the current page.
|
|
8
|
+
*/
|
|
9
|
+
locale: string;
|
|
10
|
+
/**
|
|
11
|
+
* The site associated with the current page.
|
|
12
|
+
*/
|
|
13
|
+
site: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Gets the cached page params, including locale and site.
|
|
17
|
+
* @returns An object containing the locale and site information for the current page.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare const getCachedPageParams: () => {
|
|
21
|
+
locale: string;
|
|
22
|
+
site: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Sets the cached page params, including locale and site.
|
|
26
|
+
* @param {CachedPageParams} pageParams An object containing the locale and site information to be set for the current page cache.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare function setCachedPageParams(pageParams: CachedPageParams): void;
|
|
30
|
+
//# sourceMappingURL=page-params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-params.d.ts","sourceRoot":"","sources":["../../src/cache/page-params.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAYF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;CAAoB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,gBAAgB,QAG/D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DesingLibraryAppProps } from './models';
|
|
3
|
+
/**
|
|
4
|
+
* Design Library component intended to be used by the NextJs app router application
|
|
5
|
+
* This component serves as a router between client and server component rendering modes for the Design Library.
|
|
6
|
+
* It inspects the component type from the component map and
|
|
7
|
+
* delegates to the appropriate rendering implementation:
|
|
8
|
+
* - Client components are rendered using the `DesignLibrary` component
|
|
9
|
+
* - Server components are rendered using the `DesignLibraryServer` component
|
|
10
|
+
* @param {DesingLibraryAppProps} props - The properties for the Design Library App.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const DesignLibraryApp: ({ page, componentMap, loadServerImportMap, }: DesingLibraryAppProps) => React.JSX.Element | null;
|
|
14
|
+
//# sourceMappingURL=DesignLibraryApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignLibraryApp.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryApp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,8CAI9B,qBAAqB,6BAsBvB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DesignLibraryPreviewEventsProps, DesignLibraryVariantGenerationEventsProps } from './models';
|
|
3
|
+
export declare const __mockDependencies: (mocks: any) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Design Library component for rendering server components in app router application.
|
|
6
|
+
* DesignLibraryPreviewEvents component serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
|
|
7
|
+
* It posts messages to Design Library Studio and sets up handlers to receive updates and previews which are then passed to the server component via server function updateServerComponentAction.
|
|
8
|
+
* @param {DesignLibraryPreviewEventsProps} props The props. {@link DesignLibraryPreviewEventsProps}
|
|
9
|
+
* @returns {JSX.Element} empty JSX element.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DesignLibraryPreviewEvents: ({ designLibraryStatus, component, }: DesignLibraryPreviewEventsProps) => React.JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Design Library component for rendering server components in app router application.
|
|
14
|
+
* DesignLibraryVariantGenerationEvents component serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side in variant generation mode.
|
|
15
|
+
* It posts messages to Design Library Studio and sets up handlers to receive updates and previews which are then passed to the server component via server function updateServerComponentAction.
|
|
16
|
+
* If the import map is not present then the import map error will be sent to Design Studio.
|
|
17
|
+
* @param {DesignLibraryVariantGenerationEventsProps} props The props. {@link DesignLibraryVariantGenerationEventsProps}
|
|
18
|
+
* @returns {JSX.Element} empty JSX element.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DesignLibraryVariantGenerationEvents: ({ designLibraryStatus, component, importMap, componentInitError, generatedComponentData, }: DesignLibraryVariantGenerationEventsProps) => React.JSX.Element;
|
|
21
|
+
//# sourceMappingURL=DesignLibraryClientEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignLibraryClientEvents.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryClientEvents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EACL,+BAA+B,EAC/B,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAclB,eAAO,MAAM,kBAAkB,GAAI,OAAO,GAAG,SAU5C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,qCAGxC,+BAA+B,sBAgBjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,GAAI,4FAMlD,yCAAyC,sBA8D3C,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DesignLibraryServerProps, DesignLibraryServerPreviewProps, DesignLibraryServerVariantGenerationProps } from './models';
|
|
3
|
+
export declare const __mockDependencies: (mocks: any) => Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* Design Library component for rendering server components in app router application.
|
|
6
|
+
*
|
|
7
|
+
* Renders the **real** Sitecore component for `library` / `library-metadata` modes and,
|
|
8
|
+
* when generation is enabled (`page.mode.designLibrary.isVariantGeneration === true`),
|
|
9
|
+
* wires the **variant generation** handshake so the parent (Design Library) can send
|
|
10
|
+
* generated code to preview and iterate on.
|
|
11
|
+
* Also renders the DesignLibraryClientEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
|
|
12
|
+
* @param {DesignLibraryServerProps} props The props. {@link DesignLibraryServerProps}
|
|
13
|
+
* @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DesignLibraryServer: ({ page, componentMap, rendering, loadServerImportMap, }: DesignLibraryServerProps) => Promise<React.JSX.Element | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Design Library component for rendering server components in app router application in variant generation mode.
|
|
18
|
+
*
|
|
19
|
+
* Renders the **real** Sitecore component for `library` / `library-metadata` modes on first render and,
|
|
20
|
+
* wires the **variant generation** handshake so the parent (Design Library) can send
|
|
21
|
+
* generated code to preview and iterate on.
|
|
22
|
+
* Also renders the DesignLibraryVariantGenerationEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
|
|
23
|
+
* @param {DesignLibraryServerVariantGenerationProps} props The props. {@link DesignLibraryServerVariantGenerationProps}
|
|
24
|
+
* @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DesignLibraryServerVariantGeneration: ({ page, rendering, loadServerImportMap, componentMap, }: DesignLibraryServerVariantGenerationProps) => Promise<React.JSX.Element>;
|
|
27
|
+
/**
|
|
28
|
+
* Design Library component for rendering server components in app router application when variant generation is not enabled.
|
|
29
|
+
*
|
|
30
|
+
* Renders the **real** Sitecore component for `library` / `library-metadata` modes and,
|
|
31
|
+
* wires the **component update** handshake so the parent (Design Library) can send
|
|
32
|
+
* updated component props.
|
|
33
|
+
* Also renders the DesignLibraryPreviewEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
|
|
34
|
+
* @param {DesignLibraryServerPreviewProps} props The props. {@link DesignLibraryServerPreviewProps}
|
|
35
|
+
* @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DesignLibraryServerPreview: ({ page, rendering, componentMap, }: DesignLibraryServerPreviewProps) => Promise<React.JSX.Element>;
|
|
38
|
+
//# sourceMappingURL=DesignLibraryServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignLibraryServer.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAwB1B,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,yCAAyC,EAE1C,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,kBAAkB,GAAU,OAAO,GAAG,kBAUlD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAU,yDAKvC,wBAAwB,sCAoB1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oCAAoC,GAAU,yDAKxD,yCAAyC,+BA+I3C,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GAAU,oCAI9C,+BAA+B,+BAsCjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { DesignLibraryPreviewError, GeneratedComponentData, ImportEntryInfo } from '@sitecore-content-sdk/content/codegen';
|
|
2
|
+
import { ComponentRendering, RouteData } from '@sitecore-content-sdk/content/layout';
|
|
3
|
+
import { DesignLibraryStatus } from '@sitecore-content-sdk/content/editing';
|
|
4
|
+
import { Page } from '@sitecore-content-sdk/content/client';
|
|
5
|
+
import { ComponentMap, ImportMapImport } from '@sitecore-content-sdk/react';
|
|
6
|
+
export type DesignLibraryServerProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Component Map will be used to map Sitecore component names to app implementation
|
|
9
|
+
*/
|
|
10
|
+
componentMap: ComponentMap;
|
|
11
|
+
/**
|
|
12
|
+
* Rendering data to be used when rendering the placeholder.
|
|
13
|
+
*/
|
|
14
|
+
rendering: ComponentRendering | RouteData;
|
|
15
|
+
/**
|
|
16
|
+
* Page data.
|
|
17
|
+
*/
|
|
18
|
+
page: Page;
|
|
19
|
+
/**
|
|
20
|
+
* The dynamic import for sever import map to be used in variant generation mode.
|
|
21
|
+
*/
|
|
22
|
+
loadServerImportMap: () => Promise<ImportMapImport>;
|
|
23
|
+
};
|
|
24
|
+
export type DesingLibraryAppProps = DesignLibraryServerProps;
|
|
25
|
+
export type DesignLibraryServerPreviewProps = Omit<DesignLibraryServerProps, 'loadServerImportMap'>;
|
|
26
|
+
export type DesignLibraryServerVariantGenerationProps = DesignLibraryServerProps;
|
|
27
|
+
export type DesignLibraryPreviewEventsProps = {
|
|
28
|
+
/**
|
|
29
|
+
* The design library status to be posted as a message to the Design Studio.
|
|
30
|
+
*/
|
|
31
|
+
designLibraryStatus: DesignLibraryStatus;
|
|
32
|
+
/**
|
|
33
|
+
* The component rendering data that is being edited in the Design Studio.
|
|
34
|
+
*/
|
|
35
|
+
component: ComponentRendering;
|
|
36
|
+
};
|
|
37
|
+
export type DesignLibraryVariantGenerationEventsProps = DesignLibraryPreviewEventsProps & {
|
|
38
|
+
/**
|
|
39
|
+
* The import map info to be posted as a message to the Design Studio.
|
|
40
|
+
*/
|
|
41
|
+
importMap?: ImportEntryInfo[];
|
|
42
|
+
/**
|
|
43
|
+
* Any error that occurred during initialization of the component:
|
|
44
|
+
* - importMap error
|
|
45
|
+
* - error fetching the generated component data from secured endpoint
|
|
46
|
+
* - error during generation or rendering of the component on the server side
|
|
47
|
+
*/
|
|
48
|
+
componentInitError?: ServerComponentInitError;
|
|
49
|
+
/**
|
|
50
|
+
* The generated component data received from design library.
|
|
51
|
+
*/
|
|
52
|
+
generatedComponentData?: GeneratedComponentData;
|
|
53
|
+
};
|
|
54
|
+
export type ServerComponentInitError = {
|
|
55
|
+
/** The type of error, as defined in DesignLibraryPreviewError. */
|
|
56
|
+
type: DesignLibraryPreviewError;
|
|
57
|
+
/** The error message. */
|
|
58
|
+
message: string;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,SAAS,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC1C;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,mBAAmB,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE7D,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;AAEpG,MAAM,MAAM,yCAAyC,GAAG,wBAAwB,CAAC;AAEjF,MAAM,MAAM,+BAA+B,GAAG;IAC5C;;OAEG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;IACzC;;OAEG;IACH,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,yCAAyC,GAAG,+BAA+B,GAAG;IACxF;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C;;OAEG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,kEAAkE;IAClE,IAAI,EAAE,yBAAyB,CAAC;IAChC,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/types/index.d.ts
CHANGED
|
@@ -23,5 +23,13 @@ import * as BYOCWrapper from './components/BYOCWrapper';
|
|
|
23
23
|
export { FEaaSClientWrapper, FEaaSServerWrapper, BYOCClientWrapper, BYOCServerWrapper, } from '@sitecore-content-sdk/react';
|
|
24
24
|
export { FEaaSWrapper };
|
|
25
25
|
export { BYOCWrapper };
|
|
26
|
-
export { ComponentMap, Image, ImageField, ImageFieldValue, ImageProps, LinkField, LinkFieldValue, Text, TextField, DateField, FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponentParams, BYOCComponent, BYOCComponentProps, getDesignLibraryStylesheetLinks, File, FileField, RichTextField, DesignLibrary,
|
|
26
|
+
export { ComponentMap, Image, ImageField, ImageFieldValue, ImageProps, LinkField, LinkFieldValue, Text, TextField, DateField, FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponentParams, BYOCComponent, BYOCComponentProps, getDesignLibraryStylesheetLinks, File, FileField, RichTextField, DesignLibrary, DefaultEmptyFieldEditingComponentImage, DefaultEmptyFieldEditingComponentText, PlaceholderComponentProps, SitecoreProvider, SitecoreProviderState, SitecoreProviderReactContext, withSitecore, useSitecore, withEditorChromes, withAppPlaceholder, withPlaceholder, withDatasourceCheck, ImageSizeParameters, withFieldMetadata, withEmptyFieldEditingComponent, EditingScripts, Form, ClientEditingChromesUpdate, AppPlaceholder, AppPlaceholderProps, renderEmptyPlaceholder, } from '@sitecore-content-sdk/react';
|
|
27
|
+
export { initContentSdk } from '@sitecore-content-sdk/core';
|
|
28
|
+
export type { PersonalizeGeoData } from './proxy/personalize-proxy';
|
|
29
|
+
export type { PersonalizeProxyAdapter } from './initialization/proxy/personalize-adapter';
|
|
30
|
+
export { personalizeProxyAdapter } from './initialization/proxy/personalize-adapter';
|
|
31
|
+
export type { AnalyticsProxyAdapter } from './initialization/proxy/analytics-adapter';
|
|
32
|
+
export { analyticsProxyAdapter } from './initialization/proxy/analytics-adapter';
|
|
33
|
+
export { DesignLibraryApp } from './components/DesignLibrary/DesignLibraryApp';
|
|
34
|
+
export { type CachedPageParams, getCachedPageParams, setCachedPageParams, } from './cache/page-params';
|
|
27
35
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EACL,SAAS,EAET,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,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,EACnB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,YAAY,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EACL,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AnalyticsAdapter } from '@sitecore-content-sdk/analytics-core/internal';
|
|
2
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the AnalyticsProxyAdapter.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface AnalyticsProxyAdapter extends AnalyticsAdapter {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the adapter.
|
|
10
|
+
*/
|
|
11
|
+
type: 'proxy';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a proxy-based analytics adapter that reads and writes the visitor ID
|
|
15
|
+
* using cookies and can resolve a new client ID from the Edge proxy when needed.
|
|
16
|
+
* The adapter also provides access to the current URL search parameters.
|
|
17
|
+
* @param {NextRequest} request - The Next.js request object.
|
|
18
|
+
* @param {NextResponse} response - The Next.js response object.
|
|
19
|
+
* @returns {AnalyticsProxyAdapter} The analytics proxy adapter.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare function analyticsProxyAdapter(request: NextRequest, response: NextResponse): AnalyticsProxyAdapter;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the client ID from the request cookies.
|
|
25
|
+
* @param {NextRequest} request
|
|
26
|
+
* @returns {string | null} The client ID or null if not found.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare const getClientId: (request: NextRequest) => string | null;
|
|
30
|
+
//# sourceMappingURL=analytics-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/proxy/analytics-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,gBAAgB,EACjB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,GACrB,qBAAqB,CA2DvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,WAAW,KAAG,MAAM,GAAG,IAI3D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PersonalizeAdapter } from '@sitecore-content-sdk/personalize/internal';
|
|
2
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the PersonalizeProxyAdapter.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface PersonalizeProxyAdapter extends Required<PersonalizeAdapter> {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the adapter.
|
|
10
|
+
*/
|
|
11
|
+
type: 'proxy';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a proxy-based personalize adapter that reads and writes the profile ID
|
|
15
|
+
* using cookies and can resolve a new profile ID from the Edge proxy when needed.
|
|
16
|
+
* The adapter also provides access user agent from the request headers.
|
|
17
|
+
* @param {NextRequest} request - The HTTP request object.
|
|
18
|
+
* @param {NextResponse} response - The HTTP response object.
|
|
19
|
+
* @returns {PersonalizeProxyAdapter} The personalize proxy adapter.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare function personalizeProxyAdapter(request: NextRequest, response: NextResponse): PersonalizeProxyAdapter;
|
|
23
|
+
//# sourceMappingURL=personalize-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personalize-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/proxy/personalize-adapter.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,QAAQ,CAAC,kBAAkB,CAAC;IAC3E;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,GACrB,uBAAuB,CA4DzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"robots-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/robots-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"robots-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/robots-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAgB,MAAM,SAAS,CAAC;AAIjD;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,YAAY,CAAe;gBAEvB,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE;IAKrD,UAAU,UAIiB,cAAc,OAAO,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC;YAAjE,OAAO;CAiBtB"}
|