@sitecore-jss/sitecore-jss-nextjs 21.7.0-canary.9 → 21.7.1-canary.1
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/README.md +1 -4
- package/dist/cjs/components/NextImage.js +2 -10
- package/dist/cjs/components/RichText.js +2 -2
- package/dist/cjs/context/context.js +30 -10
- package/dist/cjs/editing/editing-config-middleware.js +49 -0
- package/dist/cjs/editing/editing-render-middleware.js +3 -16
- package/dist/cjs/editing/feaas-render-middleware.js +87 -0
- package/dist/cjs/editing/index.js +5 -1
- package/dist/cjs/editing/render-middleware.js +27 -0
- package/dist/cjs/graphql/index.js +2 -1
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/middleware/multisite-middleware.js +7 -1
- package/dist/cjs/middleware/personalize-middleware.js +1 -1
- package/dist/cjs/middleware/redirects-middleware.js +24 -10
- package/dist/cjs/utils/utils.js +6 -18
- package/dist/esm/components/NextImage.js +1 -8
- package/dist/esm/components/RichText.js +2 -2
- package/dist/esm/context/context.js +30 -10
- package/dist/esm/editing/editing-config-middleware.js +45 -0
- package/dist/esm/editing/editing-render-middleware.js +4 -17
- package/dist/esm/editing/feaas-render-middleware.js +83 -0
- package/dist/esm/editing/index.js +2 -0
- package/dist/esm/editing/render-middleware.js +23 -0
- package/dist/esm/graphql/index.js +1 -1
- package/dist/esm/index.js +5 -3
- package/dist/esm/middleware/multisite-middleware.js +7 -1
- package/dist/esm/middleware/personalize-middleware.js +1 -1
- package/dist/esm/middleware/redirects-middleware.js +24 -10
- package/dist/esm/utils/utils.js +6 -15
- package/package.json +12 -13
- package/types/components/NextImage.d.ts +1 -2
- package/types/context/context.d.ts +13 -1
- package/types/editing/editing-config-middleware.d.ts +29 -0
- package/types/editing/editing-render-middleware.d.ts +2 -11
- package/types/editing/feaas-render-middleware.d.ts +32 -0
- package/types/editing/index.d.ts +2 -0
- package/types/editing/render-middleware.d.ts +15 -0
- package/types/graphql/index.d.ts +1 -1
- package/types/index.d.ts +5 -3
- package/types/middleware/multisite-middleware.d.ts +14 -0
- package/types/utils/utils.d.ts +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { RenderMiddlewareBase } from './render-middleware';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for `FEAASRenderMiddleware`.
|
|
5
|
+
*/
|
|
6
|
+
export interface FEAASRenderMiddlewareConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Defines FEAAS page route to render.
|
|
9
|
+
* This may be necessary for certain custom Next.js routing configurations.
|
|
10
|
+
* @default /feaas/render
|
|
11
|
+
*/
|
|
12
|
+
pageUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Middleware / handler for use in the feaas render Next.js API route (e.g. '/api/editing/feaas/render')
|
|
16
|
+
* which is required for Sitecore editing support.
|
|
17
|
+
*/
|
|
18
|
+
export declare class FEAASRenderMiddleware extends RenderMiddlewareBase {
|
|
19
|
+
protected config?: FEAASRenderMiddlewareConfig | undefined;
|
|
20
|
+
private pageUrl;
|
|
21
|
+
private defaultPageUrl;
|
|
22
|
+
/**
|
|
23
|
+
* @param {EditingRenderMiddlewareConfig} [config] Editing render middleware config
|
|
24
|
+
*/
|
|
25
|
+
constructor(config?: FEAASRenderMiddlewareConfig | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* Gets the Next.js API route handler
|
|
28
|
+
* @returns route handler
|
|
29
|
+
*/
|
|
30
|
+
getHandler(): (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
31
|
+
private handler;
|
|
32
|
+
}
|
package/types/editing/index.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export { EditingDataMiddleware, EditingDataMiddlewareConfig } from './editing-da
|
|
|
4
4
|
export { EditingRenderMiddleware, EditingRenderMiddlewareConfig, } from './editing-render-middleware';
|
|
5
5
|
export { EditingPreviewData, EditingDataService, BasicEditingDataService, BasicEditingDataServiceConfig, ServerlessEditingDataService, ServerlessEditingDataServiceConfig, editingDataService, } from './editing-data-service';
|
|
6
6
|
export { VercelEditingDataCache } from './vercel-editing-data-cache';
|
|
7
|
+
export { FEAASRenderMiddleware, FEAASRenderMiddlewareConfig } from './feaas-render-middleware';
|
|
8
|
+
export { EditingConfigMiddleware, EditingConfigMiddlewareConfig, } from './editing-config-middleware';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for middleware that handles pages and components rendering in Sitecore Editors.
|
|
3
|
+
*/
|
|
4
|
+
export declare abstract class RenderMiddlewareBase {
|
|
5
|
+
/**
|
|
6
|
+
* Gets query parameters that should be passed along to subsequent requests (e.g. for deployment protection bypass)
|
|
7
|
+
* @param {Object} query Object of query parameters from incoming URL
|
|
8
|
+
* @returns Object of approved query parameters
|
|
9
|
+
*/
|
|
10
|
+
protected getQueryParamsForPropagation: (query: Partial<{
|
|
11
|
+
[key: string]: string | string[];
|
|
12
|
+
}>) => {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
package/types/graphql/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { GraphQLRequestClient, GraphQLRequestClientFactory, GraphQLRequestClientFactoryConfig, getEdgeProxyContentUrl, } from '@sitecore-jss/sitecore-jss/graphql';
|
|
1
|
+
export { GraphQLClientError, RetryStrategy, DefaultRetryStrategy, GraphQLRequestClient, GraphQLRequestClientFactory, GraphQLRequestClientFactoryConfig, getEdgeProxyContentUrl, } from '@sitecore-jss/sitecore-jss/graphql';
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig,
|
|
1
|
+
export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig,
|
|
2
|
+
/** @deprecated use import 'GraphQLClientError' from '@sitecore-jss/sitecore-jss-nextjs/graphql' instead */
|
|
3
|
+
ClientError, NativeDataFetcher, NativeDataFetcherConfig, HTMLLink, enableDebug, debug, } from '@sitecore-jss/sitecore-jss';
|
|
2
4
|
import { GraphQLRequestClient as GraphQLRequestClientDep } from './graphql';
|
|
3
5
|
import { resolveUrl as resolveUrlDep } from '@sitecore-jss/sitecore-jss/utils';
|
|
4
6
|
/** @deprecated use import from '@sitecore-jss/sitecore-jss-nextjs/utils' instead */
|
|
@@ -8,7 +10,7 @@ declare const GraphQLRequestClient: typeof GraphQLRequestClientDep;
|
|
|
8
10
|
export { GraphQLRequestClient };
|
|
9
11
|
export { handleEditorFastRefresh, getPublicUrl };
|
|
10
12
|
export { isEditorActive, resetEditorChromes, resolveUrl, tryParseEnvValue };
|
|
11
|
-
export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, GraphQLLayoutServiceConfig, RestLayoutService, RestLayoutServiceConfig, PlaceholderData, PlaceholdersData, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams, RenderingType, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, } from '@sitecore-jss/sitecore-jss/layout';
|
|
13
|
+
export { LayoutService, LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, GraphQLLayoutService, GraphQLLayoutServiceConfig, RestLayoutService, RestLayoutServiceConfig, PlaceholderData, PlaceholdersData, RouteData, Field, Item, HtmlElementRendering, getChildPlaceholder, getFieldValue, ComponentRendering, ComponentFields, ComponentParams, RenderingType, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, getContentStylesheetLink, } from '@sitecore-jss/sitecore-jss/layout';
|
|
12
14
|
export { mediaApi } from '@sitecore-jss/sitecore-jss/media';
|
|
13
15
|
export { trackingApi, TrackingRequestOptions, CampaignInstance, GoalInstance, OutcomeInstance, EventInstance, PageViewInstance, } from '@sitecore-jss/sitecore-jss/tracking';
|
|
14
16
|
export { DictionaryPhrases, DictionaryService, GraphQLDictionaryService, GraphQLDictionaryServiceConfig, RestDictionaryService, RestDictionaryServiceConfig, } from '@sitecore-jss/sitecore-jss/i18n';
|
|
@@ -33,4 +35,4 @@ export { FEaaSWrapper };
|
|
|
33
35
|
export { BYOCWrapper };
|
|
34
36
|
export { ComponentBuilder, ComponentBuilderConfig } from './ComponentBuilder';
|
|
35
37
|
export { Context, ContextConfig, SDK } from './context';
|
|
36
|
-
export { ComponentFactory, Image, ImageField, ImageFieldValue, ImageProps, LinkField, LinkFieldValue, Text, TextField, DateField, EditFrame, FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponentParams, BYOCComponent, BYOCComponentProps, getFEAASLibraryStylesheetLinks, File, FileField, RichTextField, VisitorIdentification, PlaceholderComponentProps, SitecoreContext, SitecoreContextState, SitecoreContextValue, SitecoreContextReactContext, withSitecoreContext, useSitecoreContext, withEditorChromes, withPlaceholder, withDatasourceCheck, ImageSizeParameters, ComponentConsumerProps, WithSitecoreContextOptions, WithSitecoreContextProps, } from '@sitecore-jss/sitecore-jss-react';
|
|
38
|
+
export { ComponentFactory, Image, ImageField, ImageFieldValue, ImageProps, LinkField, LinkFieldValue, Text, TextField, DateField, EditFrame, FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponentParams, BYOCComponent, BYOCComponentProps, getFEAASLibraryStylesheetLinks, getComponentLibraryStylesheetLinks, File, FileField, RichTextField, VisitorIdentification, PlaceholderComponentProps, SitecoreContext, SitecoreContextState, SitecoreContextValue, SitecoreContextReactContext, withSitecoreContext, useSitecoreContext, withEditorChromes, withPlaceholder, withDatasourceCheck, ImageSizeParameters, ComponentConsumerProps, WithSitecoreContextOptions, WithSitecoreContextProps, } from '@sitecore-jss/sitecore-jss-react';
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { NextResponse, NextRequest } from 'next/server';
|
|
2
2
|
import { MiddlewareBase, MiddlewareBaseConfig } from './middleware';
|
|
3
|
+
export type CookieAttributes = {
|
|
4
|
+
/**
|
|
5
|
+
* the Secure attribute of the site cookie
|
|
6
|
+
*/
|
|
7
|
+
secure: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* the HttpOnly attribute of the site cookie
|
|
10
|
+
*/
|
|
11
|
+
httpOnly: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* the SameSite attribute of the site cookie
|
|
14
|
+
*/
|
|
15
|
+
sameSite?: true | false | 'lax' | 'strict' | 'none' | undefined;
|
|
16
|
+
};
|
|
3
17
|
export type MultisiteMiddlewareConfig = Omit<MiddlewareBaseConfig, 'disabled'> & {
|
|
4
18
|
/**
|
|
5
19
|
* Function used to determine if site should be resolved from sc_site cookie when present
|
package/types/utils/utils.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* VERCEL_URL is provided by Vercel in case if we are in Preview deployment (deployment based on the custom branch),
|
|
6
6
|
* preview deployment has unique url, we don't know exact url.
|
|
7
7
|
* Similarly, DEPLOY_URL is provided by Netlify and would give us the deploy URL
|
|
8
|
+
* In production non-editing environments it is desirable to use relative urls, so in that case set PUBLIC_URL = ''
|
|
8
9
|
*/
|
|
9
10
|
export declare const getPublicUrl: () => string;
|
|
10
11
|
/**
|