@sitecore-jss/sitecore-jss-nextjs 22.1.0-canary.8 → 22.1.0-canary.80
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 +7 -3
- package/dist/cjs/components/NextImage.js +16 -6
- package/dist/cjs/components/RichText.js +2 -2
- package/dist/cjs/editing/constants.js +12 -3
- package/dist/cjs/editing/editing-config-middleware.js +8 -0
- package/dist/cjs/editing/editing-data-middleware.js +6 -0
- package/dist/cjs/editing/editing-render-middleware.js +228 -103
- package/dist/cjs/editing/feaas-render-middleware.js +8 -0
- package/dist/cjs/editing/index.js +4 -1
- package/dist/cjs/editing/render-middleware.js +18 -4
- package/dist/cjs/index.js +9 -7
- package/dist/cjs/middleware/middleware.js +12 -0
- package/dist/cjs/middleware/personalize-middleware.js +85 -25
- package/dist/cjs/middleware/redirects-middleware.js +53 -21
- package/dist/cjs/services/base-graphql-sitemap-service.js +5 -4
- package/dist/cjs/utils/index.js +4 -3
- package/dist/cjs/utils/utils.js +3 -3
- package/dist/esm/components/Link.js +7 -3
- package/dist/esm/components/NextImage.js +17 -6
- package/dist/esm/components/RichText.js +2 -2
- package/dist/esm/editing/constants.js +11 -2
- package/dist/esm/editing/editing-config-middleware.js +9 -1
- package/dist/esm/editing/editing-data-middleware.js +7 -1
- package/dist/esm/editing/editing-render-middleware.js +226 -103
- package/dist/esm/editing/feaas-render-middleware.js +9 -1
- package/dist/esm/editing/index.js +2 -1
- package/dist/esm/editing/render-middleware.js +19 -5
- package/dist/esm/index.js +3 -4
- package/dist/esm/middleware/middleware.js +12 -0
- package/dist/esm/middleware/personalize-middleware.js +86 -26
- package/dist/esm/middleware/redirects-middleware.js +53 -21
- package/dist/esm/services/base-graphql-sitemap-service.js +5 -4
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/utils/utils.js +1 -1
- package/package.json +10 -11
- package/types/ComponentBuilder.d.ts +3 -5
- package/types/components/Placeholder.d.ts +7 -2
- package/types/components/RichText.d.ts +6 -0
- package/types/editing/constants.d.ts +11 -2
- package/types/editing/editing-config-middleware.d.ts +7 -0
- package/types/editing/editing-data-service.d.ts +1 -0
- package/types/editing/editing-render-middleware.d.ts +111 -23
- package/types/editing/index.d.ts +2 -1
- package/types/editing/render-middleware.d.ts +9 -0
- package/types/index.d.ts +3 -4
- package/types/middleware/middleware.d.ts +6 -0
- package/types/middleware/personalize-middleware.d.ts +22 -2
- package/types/middleware/redirects-middleware.d.ts +9 -0
- package/types/services/base-graphql-sitemap-service.d.ts +3 -2
- package/types/utils/index.d.ts +2 -1
- package/dist/cjs/components/EditingComponentPlaceholder.js +0 -12
- package/dist/esm/components/EditingComponentPlaceholder.js +0 -5
- package/types/components/EditingComponentPlaceholder.d.ts +0 -4
package/types/editing/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export { GraphQLEditingService } from '@sitecore-jss/sitecore-jss/editing';
|
|
1
2
|
export { EditingData } from './editing-data';
|
|
2
3
|
export { EditingDataCache, EditingDataDiskCache } from './editing-data-cache';
|
|
3
4
|
export { EditingDataMiddleware, EditingDataMiddlewareConfig } from './editing-data-middleware';
|
|
4
|
-
export { EditingRenderMiddleware, EditingRenderMiddlewareConfig, } from './editing-render-middleware';
|
|
5
|
+
export { EditingRenderMiddleware, EditingRenderMiddlewareConfig, EditingMetadataPreviewData, isEditingMetadataPreviewData, } from './editing-render-middleware';
|
|
5
6
|
export { EditingPreviewData, EditingDataService, BasicEditingDataService, BasicEditingDataServiceConfig, ServerlessEditingDataService, ServerlessEditingDataServiceConfig, editingDataService, } from './editing-data-service';
|
|
6
7
|
export { VercelEditingDataCache } from './vercel-editing-data-cache';
|
|
7
8
|
export { FEAASRenderMiddleware, FEAASRenderMiddlewareConfig } from './feaas-render-middleware';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IncomingHttpHeaders } from 'http';
|
|
1
2
|
/**
|
|
2
3
|
* Base class for middleware that handles pages and components rendering in Sitecore Editors.
|
|
3
4
|
*/
|
|
@@ -12,4 +13,12 @@ export declare abstract class RenderMiddlewareBase {
|
|
|
12
13
|
}>) => {
|
|
13
14
|
[key: string]: string;
|
|
14
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Get headers that should be passed along to subsequent requests
|
|
18
|
+
* @param {IncomingHttpHeaders} headers Incoming HTTP Headers
|
|
19
|
+
* @returns Object of approved headers
|
|
20
|
+
*/
|
|
21
|
+
protected getHeadersForPropagation: (headers: IncomingHttpHeaders) => {
|
|
22
|
+
[key: string]: string | string[];
|
|
23
|
+
};
|
|
15
24
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, HTMLLink, enableDebug, debug, } from '@sitecore-jss/sitecore-jss';
|
|
2
|
-
export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, GraphQLLayoutServiceConfig, RestLayoutService, RestLayoutServiceConfig, PlaceholderData, PlaceholdersData, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams,
|
|
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';
|
|
5
5
|
export { DictionaryPhrases, DictionaryService, GraphQLDictionaryService, GraphQLDictionaryServiceConfig, RestDictionaryService, RestDictionaryServiceConfig, } from '@sitecore-jss/sitecore-jss/i18n';
|
|
6
|
-
export { personalizeLayout, getPersonalizedRewrite, getPersonalizedRewriteData, normalizePersonalizedRewrite, CdpHelper, } from '@sitecore-jss/sitecore-jss/personalize';
|
|
6
|
+
export { personalizeLayout, getPersonalizedRewrite, getPersonalizedRewriteData, getGroomedVariantIds, normalizePersonalizedRewrite, CdpHelper, } from '@sitecore-jss/sitecore-jss/personalize';
|
|
7
7
|
export { ComponentPropsCollection, ComponentPropsError, GetStaticComponentProps, GetServerSideComponentProps, } from './sharedTypes/component-props';
|
|
8
8
|
export { ModuleFactory, Module } from './sharedTypes/module-factory';
|
|
9
9
|
export { ComponentPropsService } from './services/component-props-service';
|
|
@@ -16,7 +16,6 @@ export { ComponentPropsReactContext, ComponentPropsContextProps, ComponentPropsC
|
|
|
16
16
|
export { Link, LinkProps } from './components/Link';
|
|
17
17
|
export { RichText, RichTextProps } from './components/RichText';
|
|
18
18
|
export { Placeholder } from './components/Placeholder';
|
|
19
|
-
export { EditingComponentPlaceholder } from './components/EditingComponentPlaceholder';
|
|
20
19
|
export { NextImage } from './components/NextImage';
|
|
21
20
|
import * as FEaaSWrapper from './components/FEaaSWrapper';
|
|
22
21
|
import * as BYOCWrapper from './components/BYOCWrapper';
|
|
@@ -24,4 +23,4 @@ export { FEaaSWrapper };
|
|
|
24
23
|
export { BYOCWrapper };
|
|
25
24
|
export { ComponentBuilder, ComponentBuilderConfig } from './ComponentBuilder';
|
|
26
25
|
export { Context, ContextConfig, SDK } from './context';
|
|
27
|
-
export { ComponentFactory, Image, ImageField, ImageFieldValue, ImageProps, LinkField, LinkFieldValue, Text, TextField, DateField, EditFrame, FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponentParams, BYOCComponent, BYOCComponentProps, getComponentLibraryStylesheetLinks, File, FileField, RichTextField, VisitorIdentification, PlaceholderComponentProps, SitecoreContext, SitecoreContextState, SitecoreContextValue, SitecoreContextReactContext, withSitecoreContext, useSitecoreContext, withEditorChromes, withPlaceholder, withDatasourceCheck, ImageSizeParameters,
|
|
26
|
+
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';
|
|
@@ -37,6 +37,12 @@ export declare abstract class MiddlewareBase {
|
|
|
37
37
|
* @returns {boolean} is preview
|
|
38
38
|
*/
|
|
39
39
|
protected isPreview(req: NextRequest): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Determines if the request is a Next.js (next/link) prefetch request
|
|
42
|
+
* @param {NextRequest} req request
|
|
43
|
+
* @returns {boolean} is prefetch
|
|
44
|
+
*/
|
|
45
|
+
protected isPrefetch(req: NextRequest): boolean;
|
|
40
46
|
protected excludeRoute(pathname: string): boolean | undefined;
|
|
41
47
|
/**
|
|
42
48
|
* Safely extract all headers for debug logging
|
|
@@ -33,6 +33,10 @@ export type PersonalizeMiddlewareConfig = MiddlewareBaseConfig & {
|
|
|
33
33
|
* Configuration for your Sitecore CDP endpoint
|
|
34
34
|
*/
|
|
35
35
|
cdpConfig: CdpServiceConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Optional Sitecore Personalize scope identifier allowing you to isolate your personalization data between XM Cloud environments
|
|
38
|
+
*/
|
|
39
|
+
scope?: string;
|
|
36
40
|
};
|
|
37
41
|
/**
|
|
38
42
|
* Object model of Experience Context data
|
|
@@ -47,6 +51,13 @@ export type ExperienceParams = {
|
|
|
47
51
|
content: string | undefined;
|
|
48
52
|
};
|
|
49
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Object model of personalize execution data
|
|
56
|
+
*/
|
|
57
|
+
type PersonalizeExecution = {
|
|
58
|
+
friendlyId: string;
|
|
59
|
+
variantIds: string[];
|
|
60
|
+
};
|
|
50
61
|
/**
|
|
51
62
|
* Middleware / handler to support Sitecore Personalize
|
|
52
63
|
*/
|
|
@@ -68,15 +79,24 @@ export declare class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
68
79
|
request: NextRequest;
|
|
69
80
|
response: NextResponse;
|
|
70
81
|
}): Promise<void>;
|
|
71
|
-
protected personalize({ params,
|
|
72
|
-
personalizeInfo: PersonalizeInfo;
|
|
82
|
+
protected personalize({ params, friendlyId, language, timeout, variantIds, }: {
|
|
73
83
|
params: ExperienceParams;
|
|
84
|
+
friendlyId: string;
|
|
74
85
|
language: string;
|
|
75
86
|
timeout?: number;
|
|
87
|
+
variantIds?: string[];
|
|
76
88
|
}, request: NextRequest): Promise<{
|
|
77
89
|
variantId: string;
|
|
78
90
|
}>;
|
|
79
91
|
protected getExperienceParams(req: NextRequest): ExperienceParams;
|
|
80
92
|
protected excludeRoute(pathname: string): boolean | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Aggregates personalize executions based on the provided route personalize information and language
|
|
95
|
+
* @param {PersonalizeInfo} personalizeInfo the route personalize information
|
|
96
|
+
* @param {string} language the language
|
|
97
|
+
* @returns An array of personalize executions
|
|
98
|
+
*/
|
|
99
|
+
protected getPersonalizeExecutions(personalizeInfo: PersonalizeInfo, language: string): PersonalizeExecution[];
|
|
81
100
|
private handler;
|
|
82
101
|
}
|
|
102
|
+
export {};
|
|
@@ -37,4 +37,13 @@ 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 {string} pathname
|
|
45
|
+
* @param {string} queryString
|
|
46
|
+
* @returns {string} modified url
|
|
47
|
+
*/
|
|
48
|
+
private normalizeUrl;
|
|
40
49
|
}
|
|
@@ -67,8 +67,9 @@ export type RouteListQueryResult = {
|
|
|
67
67
|
*/
|
|
68
68
|
export interface BaseGraphQLSitemapServiceConfig extends Omit<SiteRouteQueryVariables, 'language' | 'siteName'> {
|
|
69
69
|
/**
|
|
70
|
-
* A flag for whether to include personalized routes in service output
|
|
71
|
-
*
|
|
70
|
+
* A flag for whether to include personalized routes in service output.
|
|
71
|
+
* Only works on XM Cloud for pages using Embedded Personalization (not Component A/B testing).
|
|
72
|
+
* Turned off by default.
|
|
72
73
|
*/
|
|
73
74
|
includePersonalizedRoutes?: boolean;
|
|
74
75
|
/**
|
package/types/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { getPublicUrl, handleEditorFastRefresh } from './utils';
|
|
2
|
-
export { tryParseEnvValue,
|
|
2
|
+
export { tryParseEnvValue, resolveUrl } from '@sitecore-jss/sitecore-jss/utils';
|
|
3
|
+
export { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/editing';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EditingComponentPlaceholder = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const layout_1 = require("@sitecore-jss/sitecore-jss/layout");
|
|
9
|
-
const Placeholder_1 = require("./Placeholder");
|
|
10
|
-
const EditingComponentPlaceholder = ({ rendering, }) => (react_1.default.createElement("div", { id: layout_1.EDITING_COMPONENT_ID },
|
|
11
|
-
react_1.default.createElement(Placeholder_1.Placeholder, { name: layout_1.EDITING_COMPONENT_PLACEHOLDER, rendering: rendering })));
|
|
12
|
-
exports.EditingComponentPlaceholder = EditingComponentPlaceholder;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EDITING_COMPONENT_ID, EDITING_COMPONENT_PLACEHOLDER, } from '@sitecore-jss/sitecore-jss/layout';
|
|
3
|
-
import { Placeholder } from './Placeholder';
|
|
4
|
-
export const EditingComponentPlaceholder = ({ rendering, }) => (React.createElement("div", { id: EDITING_COMPONENT_ID },
|
|
5
|
-
React.createElement(Placeholder, { name: EDITING_COMPONENT_PLACEHOLDER, rendering: rendering })));
|