@sitecore-jss/sitecore-jss-nextjs 22.0.0-canary.8 → 22.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/README.md +12 -10
- package/context.d.ts +1 -0
- package/context.js +1 -0
- package/dist/cjs/ComponentBuilder.js +63 -0
- package/dist/cjs/components/BYOCWrapper.js +47 -0
- package/dist/cjs/components/FEaaSWrapper.js +49 -0
- package/dist/cjs/components/Link.js +5 -4
- package/dist/cjs/components/NextImage.js +3 -14
- package/dist/cjs/components/RichText.js +11 -15
- package/dist/cjs/context/context.js +83 -0
- package/dist/cjs/context/index.js +5 -0
- package/dist/cjs/editing/constants.js +6 -0
- package/dist/cjs/editing/editing-config-middleware.js +49 -0
- package/dist/cjs/editing/editing-data-middleware.js +3 -3
- package/dist/cjs/editing/editing-data-service.js +16 -8
- package/dist/cjs/editing/editing-render-middleware.js +25 -11
- package/dist/cjs/editing/feaas-render-middleware.js +87 -0
- package/dist/cjs/editing/index.js +7 -1
- package/dist/cjs/editing/render-middleware.js +27 -0
- package/dist/cjs/editing/vercel-editing-data-cache.js +48 -0
- package/dist/cjs/graphql/index.js +7 -0
- package/dist/cjs/index.js +38 -14
- package/dist/cjs/middleware/index.js +3 -5
- package/dist/cjs/middleware/middleware.js +18 -2
- package/dist/cjs/middleware/multisite-middleware.js +14 -8
- package/dist/cjs/middleware/personalize-middleware.js +62 -56
- package/dist/cjs/middleware/redirects-middleware.js +64 -21
- package/dist/cjs/services/base-graphql-sitemap-service.js +7 -6
- package/dist/cjs/services/component-props-service.js +6 -6
- package/dist/cjs/site/index.js +5 -0
- package/dist/cjs/utils/index.js +11 -0
- package/dist/cjs/{utils.js → utils/utils.js} +7 -16
- package/dist/esm/ComponentBuilder.js +59 -0
- package/dist/esm/components/BYOCWrapper.js +42 -0
- package/dist/esm/components/FEaaSWrapper.js +44 -0
- package/dist/esm/components/Link.js +5 -4
- package/dist/esm/components/NextImage.js +2 -12
- package/dist/esm/components/RichText.js +11 -15
- package/dist/esm/context/context.js +79 -0
- package/dist/esm/context/index.js +1 -0
- package/dist/esm/editing/constants.js +3 -0
- package/dist/esm/editing/editing-config-middleware.js +45 -0
- package/dist/esm/editing/editing-data-middleware.js +2 -2
- package/dist/esm/editing/editing-data-service.js +14 -6
- package/dist/esm/editing/editing-render-middleware.js +25 -11
- package/dist/esm/editing/feaas-render-middleware.js +83 -0
- package/dist/esm/editing/index.js +3 -0
- package/dist/esm/editing/render-middleware.js +23 -0
- package/dist/esm/editing/vercel-editing-data-cache.js +44 -0
- package/dist/esm/graphql/index.js +1 -0
- package/dist/esm/index.js +10 -7
- package/dist/esm/middleware/index.js +1 -2
- package/dist/esm/middleware/middleware.js +18 -2
- package/dist/esm/middleware/multisite-middleware.js +14 -8
- package/dist/esm/middleware/personalize-middleware.js +65 -59
- package/dist/esm/middleware/redirects-middleware.js +64 -21
- package/dist/esm/services/base-graphql-sitemap-service.js +7 -6
- package/dist/esm/services/component-props-service.js +6 -6
- package/dist/esm/site/index.js +1 -0
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/{utils.js → utils/utils.js} +7 -13
- package/graphql.d.ts +1 -0
- package/graphql.js +1 -0
- package/package.json +15 -12
- package/site.d.ts +1 -0
- package/site.js +1 -0
- package/types/ComponentBuilder.d.ts +61 -0
- package/types/components/BYOCWrapper.d.ts +19 -0
- package/types/components/ComponentPropsContext.d.ts +1 -0
- package/types/components/FEaaSWrapper.d.ts +21 -0
- package/types/components/Link.d.ts +2 -1
- package/types/components/NextImage.d.ts +3 -3
- package/types/components/Placeholder.d.ts +3 -1
- package/types/components/RichText.d.ts +6 -4
- package/types/context/context.d.ts +116 -0
- package/types/context/index.d.ts +1 -0
- package/types/editing/constants.d.ts +3 -0
- package/types/editing/editing-config-middleware.d.ts +29 -0
- package/types/editing/editing-data-service.d.ts +12 -4
- package/types/editing/editing-render-middleware.d.ts +2 -1
- package/types/editing/feaas-render-middleware.d.ts +32 -0
- package/types/editing/index.d.ts +3 -0
- package/types/editing/render-middleware.d.ts +15 -0
- package/types/editing/vercel-editing-data-cache.d.ts +19 -0
- package/types/graphql/index.d.ts +1 -0
- package/types/index.d.ts +12 -9
- package/types/middleware/index.d.ts +1 -2
- package/types/middleware/middleware.d.ts +8 -0
- package/types/middleware/multisite-middleware.d.ts +15 -0
- package/types/middleware/personalize-middleware.d.ts +53 -14
- package/types/middleware/redirects-middleware.d.ts +1 -1
- package/types/services/base-graphql-sitemap-service.d.ts +7 -10
- package/types/services/component-props-service.d.ts +2 -2
- package/types/sharedTypes/component-props.d.ts +5 -1
- package/types/sharedTypes/module-factory.d.ts +33 -0
- package/types/site/index.d.ts +1 -0
- package/types/utils/index.d.ts +2 -0
- package/types/{utils.d.ts → utils/utils.d.ts} +2 -0
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
- package/types/sharedTypes/component-module.d.ts +0 -13
- /package/dist/cjs/sharedTypes/{component-module.js → module-factory.js} +0 -0
- /package/dist/esm/sharedTypes/{component-module.js → module-factory.js} +0 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VercelKV } from '@vercel/kv';
|
|
2
|
+
import { EditingDataCache } from './editing-data-cache';
|
|
3
|
+
import { EditingData } from './editing-data';
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of editing cache for Vercel deployments
|
|
6
|
+
* Uses Vercel KV database and client to store data
|
|
7
|
+
* Set TTL for cache data in constructor (default: 60 seconds)
|
|
8
|
+
*/
|
|
9
|
+
export declare class VercelEditingDataCache implements EditingDataCache {
|
|
10
|
+
protected redisCache: VercelKV;
|
|
11
|
+
private defaultTtl;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} redisUrl KV endpoint URL. Usually stored in process.env.KV_REST_API_URL
|
|
14
|
+
* @param {string} redisToken KV endpoint tokem. Usually stored in process.env.KV_REST_API_TOKEN
|
|
15
|
+
*/
|
|
16
|
+
constructor(redisUrl: string | undefined, redisToken: string | undefined);
|
|
17
|
+
set(key: string, editingData: EditingData): Promise<void>;
|
|
18
|
+
get(key: string): Promise<EditingData | undefined>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GraphQLClientError, RetryStrategy, DefaultRetryStrategy, GraphQLRequestClient, GraphQLRequestClientFactory, GraphQLRequestClientFactoryConfig, getEdgeProxyContentUrl, } from '@sitecore-jss/sitecore-jss/graphql';
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
export { constants, HttpDataFetcher, HttpResponse, AxiosResponse, AxiosDataFetcher, AxiosDataFetcherConfig, NativeDataFetcher, NativeDataFetcherConfig, HTMLLink, enableDebug, } from '@sitecore-jss/sitecore-jss';
|
|
2
|
-
export {
|
|
3
|
-
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';
|
|
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, RenderingType, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, getContentStylesheetLink, } from '@sitecore-jss/sitecore-jss/layout';
|
|
4
3
|
export { mediaApi } from '@sitecore-jss/sitecore-jss/media';
|
|
5
4
|
export { trackingApi, TrackingRequestOptions, CampaignInstance, GoalInstance, OutcomeInstance, EventInstance, PageViewInstance, } from '@sitecore-jss/sitecore-jss/tracking';
|
|
6
5
|
export { DictionaryPhrases, DictionaryService, GraphQLDictionaryService, GraphQLDictionaryServiceConfig, RestDictionaryService, RestDictionaryServiceConfig, } from '@sitecore-jss/sitecore-jss/i18n';
|
|
7
|
-
export { personalizeLayout, getPersonalizedRewrite, getPersonalizedRewriteData, normalizePersonalizedRewrite, CdpHelper,
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export { ComponentModule } from './sharedTypes/component-module';
|
|
6
|
+
export { personalizeLayout, getPersonalizedRewrite, getPersonalizedRewriteData, normalizePersonalizedRewrite, CdpHelper, } from '@sitecore-jss/sitecore-jss/personalize';
|
|
7
|
+
export { ComponentPropsCollection, ComponentPropsError, GetStaticComponentProps, GetServerSideComponentProps, } from './sharedTypes/component-props';
|
|
8
|
+
export { ModuleFactory, Module } from './sharedTypes/module-factory';
|
|
11
9
|
export { ComponentPropsService } from './services/component-props-service';
|
|
12
10
|
export { DisconnectedSitemapService } from './services/disconnected-sitemap-service';
|
|
13
11
|
export { GraphQLSitemapService, GraphQLSitemapServiceConfig, } from './services/graphql-sitemap-service';
|
|
@@ -15,10 +13,15 @@ export { MultisiteGraphQLSitemapService, MultisiteGraphQLSitemapServiceConfig, }
|
|
|
15
13
|
export { GraphQLSitemapXmlService, GraphQLSitemapXmlServiceConfig, GraphQLErrorPagesService, GraphQLErrorPagesServiceConfig, RobotsQueryResult, GraphQLRobotsService, GraphQLRobotsServiceConfig, ErrorPages, SiteInfo, SiteResolver, GraphQLSiteInfoService, GraphQLSiteInfoServiceConfig, getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, } from '@sitecore-jss/sitecore-jss/site';
|
|
16
14
|
export { StaticPath } from './services/graphql-sitemap-service';
|
|
17
15
|
export { ComponentPropsReactContext, ComponentPropsContextProps, ComponentPropsContext, useComponentProps, } from './components/ComponentPropsContext';
|
|
18
|
-
export { handleEditorFastRefresh, getPublicUrl } from './utils';
|
|
19
16
|
export { Link, LinkProps } from './components/Link';
|
|
20
17
|
export { RichText, RichTextProps } from './components/RichText';
|
|
21
18
|
export { Placeholder } from './components/Placeholder';
|
|
22
19
|
export { EditingComponentPlaceholder } from './components/EditingComponentPlaceholder';
|
|
23
20
|
export { NextImage } from './components/NextImage';
|
|
24
|
-
|
|
21
|
+
import * as FEaaSWrapper from './components/FEaaSWrapper';
|
|
22
|
+
import * as BYOCWrapper from './components/BYOCWrapper';
|
|
23
|
+
export { FEaaSWrapper };
|
|
24
|
+
export { BYOCWrapper };
|
|
25
|
+
export { ComponentBuilder, ComponentBuilderConfig } from './ComponentBuilder';
|
|
26
|
+
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, ComponentConsumerProps, WithSitecoreContextOptions, WithSitecoreContextProps, } from '@sitecore-jss/sitecore-jss-react';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
export { debug } from '@sitecore-jss/sitecore-jss';
|
|
1
2
|
export { RedirectsMiddleware, RedirectsMiddlewareConfig } from './redirects-middleware';
|
|
2
3
|
export { PersonalizeMiddleware, PersonalizeMiddlewareConfig } from './personalize-middleware';
|
|
3
4
|
export { MultisiteMiddleware, MultisiteMiddlewareConfig } from './multisite-middleware';
|
|
4
|
-
export { SiteResolver, SiteInfo } from '@sitecore-jss/sitecore-jss/site';
|
|
5
|
-
export { tryParseEnvValue } from '@sitecore-jss/sitecore-jss/utils';
|
|
@@ -28,6 +28,7 @@ export type MiddlewareBaseConfig = {
|
|
|
28
28
|
export declare abstract class MiddlewareBase {
|
|
29
29
|
protected config: MiddlewareBaseConfig;
|
|
30
30
|
protected SITE_SYMBOL: string;
|
|
31
|
+
protected REWRITE_HEADER_NAME: string;
|
|
31
32
|
protected defaultHostname: string;
|
|
32
33
|
constructor(config: MiddlewareBaseConfig);
|
|
33
34
|
/**
|
|
@@ -65,4 +66,11 @@ export declare abstract class MiddlewareBase {
|
|
|
65
66
|
* @returns {SiteInfo} site information
|
|
66
67
|
*/
|
|
67
68
|
protected getSite(req: NextRequest, res?: NextResponse): SiteInfo;
|
|
69
|
+
/**
|
|
70
|
+
* Create a rewrite response
|
|
71
|
+
* @param {string} rewritePath the destionation path
|
|
72
|
+
* @param {NextRequest} req the current request
|
|
73
|
+
* @param {NextResponse} res the current response
|
|
74
|
+
*/
|
|
75
|
+
protected rewrite(rewritePath: string, req: NextRequest, res: NextResponse): NextResponse;
|
|
68
76
|
}
|
|
@@ -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
|
|
@@ -20,5 +34,6 @@ export declare class MultisiteMiddleware extends MiddlewareBase {
|
|
|
20
34
|
* @returns middleware handler
|
|
21
35
|
*/
|
|
22
36
|
getHandler(): (req: NextRequest, res?: NextResponse) => Promise<NextResponse>;
|
|
37
|
+
protected excludeRoute(pathname: string): boolean | undefined;
|
|
23
38
|
private handler;
|
|
24
39
|
}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import { NextResponse, NextRequest } from 'next/server';
|
|
2
|
-
import { GraphQLPersonalizeServiceConfig,
|
|
2
|
+
import { GraphQLPersonalizeServiceConfig, PersonalizeInfo } from '@sitecore-jss/sitecore-jss/personalize';
|
|
3
3
|
import { MiddlewareBase, MiddlewareBaseConfig } from './middleware';
|
|
4
|
-
|
|
4
|
+
export type CdpServiceConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* Your Sitecore Edge Platform endpoint
|
|
7
|
+
* Default is https://edge-platform.sitecorecloud.io
|
|
8
|
+
*/
|
|
9
|
+
sitecoreEdgeUrl?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Your unified Sitecore Edge Context Id
|
|
12
|
+
*/
|
|
13
|
+
sitecoreEdgeContextId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The Sitecore CDP channel to use for events. Uses 'WEB' by default.
|
|
16
|
+
*/
|
|
17
|
+
channel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Currency for CDP request. Uses 'USA' as default.
|
|
20
|
+
*/
|
|
21
|
+
currency?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Timeout (ms) for CDP request. Default is 400.
|
|
24
|
+
*/
|
|
25
|
+
timeout?: number;
|
|
26
|
+
};
|
|
5
27
|
export type PersonalizeMiddlewareConfig = MiddlewareBaseConfig & {
|
|
6
28
|
/**
|
|
7
29
|
* Configuration for your Sitecore Experience Edge endpoint
|
|
@@ -10,14 +32,20 @@ export type PersonalizeMiddlewareConfig = MiddlewareBaseConfig & {
|
|
|
10
32
|
/**
|
|
11
33
|
* Configuration for your Sitecore CDP endpoint
|
|
12
34
|
*/
|
|
13
|
-
cdpConfig:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
cdpConfig: CdpServiceConfig;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Object model of Experience Context data
|
|
39
|
+
*/
|
|
40
|
+
export type ExperienceParams = {
|
|
41
|
+
referrer: string;
|
|
42
|
+
utm: {
|
|
43
|
+
[key: string]: string | undefined;
|
|
44
|
+
campaign: string | undefined;
|
|
45
|
+
source: string | undefined;
|
|
46
|
+
medium: string | undefined;
|
|
47
|
+
content: string | undefined;
|
|
48
|
+
};
|
|
21
49
|
};
|
|
22
50
|
/**
|
|
23
51
|
* Middleware / handler to support Sitecore Personalize
|
|
@@ -25,7 +53,6 @@ export type PersonalizeMiddlewareConfig = MiddlewareBaseConfig & {
|
|
|
25
53
|
export declare class PersonalizeMiddleware extends MiddlewareBase {
|
|
26
54
|
protected config: PersonalizeMiddlewareConfig;
|
|
27
55
|
private personalizeService;
|
|
28
|
-
private cdpService;
|
|
29
56
|
/**
|
|
30
57
|
* @param {PersonalizeMiddlewareConfig} [config] Personalize middleware config
|
|
31
58
|
*/
|
|
@@ -35,9 +62,21 @@ export declare class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
35
62
|
* @returns middleware handler
|
|
36
63
|
*/
|
|
37
64
|
getHandler(): (req: NextRequest, res?: NextResponse) => Promise<NextResponse>;
|
|
38
|
-
protected
|
|
39
|
-
|
|
40
|
-
|
|
65
|
+
protected initPersonalizeServer({ hostname, siteName, request, response, }: {
|
|
66
|
+
hostname: string;
|
|
67
|
+
siteName: string;
|
|
68
|
+
request: NextRequest;
|
|
69
|
+
response: NextResponse;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
protected personalize({ params, personalizeInfo, language, timeout, }: {
|
|
72
|
+
personalizeInfo: PersonalizeInfo;
|
|
73
|
+
params: ExperienceParams;
|
|
74
|
+
language: string;
|
|
75
|
+
timeout?: number;
|
|
76
|
+
}, request: NextRequest): Promise<{
|
|
77
|
+
variantId: string;
|
|
78
|
+
}>;
|
|
41
79
|
protected getExperienceParams(req: NextRequest): ExperienceParams;
|
|
80
|
+
protected excludeRoute(pathname: string): boolean | undefined;
|
|
42
81
|
private handler;
|
|
43
82
|
}
|
|
@@ -24,7 +24,7 @@ export declare class RedirectsMiddleware extends MiddlewareBase {
|
|
|
24
24
|
*/
|
|
25
25
|
constructor(config: RedirectsMiddlewareConfig);
|
|
26
26
|
/**
|
|
27
|
-
* Gets the Next.js
|
|
27
|
+
* Gets the Next.js middleware handler with error handling
|
|
28
28
|
* @returns route handler
|
|
29
29
|
*/
|
|
30
30
|
getHandler(): (req: NextRequest, res?: NextResponse) => Promise<NextResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLClient, PageInfo } from '@sitecore-jss/sitecore-jss/graphql';
|
|
1
|
+
import { GraphQLClient, GraphQLRequestClientFactory, PageInfo } from '@sitecore-jss/sitecore-jss/graphql';
|
|
2
2
|
/** @private */
|
|
3
3
|
export declare const languageError = "The list of languages cannot be empty";
|
|
4
4
|
export declare const siteError = "The service needs a site name";
|
|
@@ -30,7 +30,7 @@ interface SiteRouteQueryVariables {
|
|
|
30
30
|
/** common variable for all GraphQL queries
|
|
31
31
|
* it will be used for every type of query to regulate result batch size
|
|
32
32
|
* Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
|
|
33
|
-
* @default
|
|
33
|
+
* @default 100
|
|
34
34
|
*/
|
|
35
35
|
pageSize?: number;
|
|
36
36
|
}
|
|
@@ -66,19 +66,16 @@ export type RouteListQueryResult = {
|
|
|
66
66
|
* Configuration options for @see GraphQLSitemapService instances
|
|
67
67
|
*/
|
|
68
68
|
export interface BaseGraphQLSitemapServiceConfig extends Omit<SiteRouteQueryVariables, 'language' | 'siteName'> {
|
|
69
|
-
/**
|
|
70
|
-
* Your Graphql endpoint
|
|
71
|
-
*/
|
|
72
|
-
endpoint: string;
|
|
73
|
-
/**
|
|
74
|
-
* The API key to use for authentication.
|
|
75
|
-
*/
|
|
76
|
-
apiKey: string;
|
|
77
69
|
/**
|
|
78
70
|
* A flag for whether to include personalized routes in service output - only works on XM Cloud
|
|
79
71
|
* turned off by default
|
|
80
72
|
*/
|
|
81
73
|
includePersonalizedRoutes?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
|
|
76
|
+
* This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
|
|
77
|
+
*/
|
|
78
|
+
clientFactory: GraphQLRequestClientFactory;
|
|
82
79
|
}
|
|
83
80
|
/**
|
|
84
81
|
* Object model of a site page item.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GetServerSidePropsContext, GetStaticPropsContext } from 'next';
|
|
2
2
|
import { LayoutServiceData, ComponentRendering, PlaceholdersData } from '@sitecore-jss/sitecore-jss/layout';
|
|
3
3
|
import { ComponentPropsCollection, ComponentPropsFetchFunction } from '../sharedTypes/component-props';
|
|
4
|
-
import {
|
|
4
|
+
import { ModuleFactory } from '../sharedTypes/module-factory';
|
|
5
5
|
export type FetchComponentPropsArguments<NextContext> = {
|
|
6
6
|
layoutData: LayoutServiceData;
|
|
7
7
|
context: NextContext;
|
|
8
|
-
|
|
8
|
+
moduleFactory: ModuleFactory;
|
|
9
9
|
};
|
|
10
10
|
export type ComponentPropsRequest<NextContext> = {
|
|
11
11
|
fetch: ComponentPropsFetchFunction<NextContext>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { GetServerSidePropsContext, GetStaticPropsContext } from 'next';
|
|
2
2
|
import { ComponentRendering, LayoutServiceData } from '@sitecore-jss/sitecore-jss/layout';
|
|
3
|
+
export type ComponentPropsError = {
|
|
4
|
+
error: string;
|
|
5
|
+
componentName: string;
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
8
|
* Shape of component props storage
|
|
5
9
|
*/
|
|
6
10
|
export type ComponentPropsCollection = {
|
|
7
|
-
[componentUid: string]: unknown;
|
|
11
|
+
[componentUid: string]: unknown | ComponentPropsError;
|
|
8
12
|
};
|
|
9
13
|
/**
|
|
10
14
|
* Type of side effect function which could be invoked on component level (getStaticProps/getServerSideProps)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="@types/react" />
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { GetServerSideComponentProps, GetStaticComponentProps } from './component-props';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a module (file)
|
|
6
|
+
*/
|
|
7
|
+
export type Module = {
|
|
8
|
+
/**
|
|
9
|
+
* Default SXA export
|
|
10
|
+
*/
|
|
11
|
+
Default?: ComponentType;
|
|
12
|
+
/**
|
|
13
|
+
* Default Next.js export
|
|
14
|
+
*/
|
|
15
|
+
default?: ComponentType;
|
|
16
|
+
/**
|
|
17
|
+
* function for component level data fetching in SSR mode
|
|
18
|
+
*/
|
|
19
|
+
getServerSideProps?: GetServerSideComponentProps;
|
|
20
|
+
/**
|
|
21
|
+
* function for component level data fetching in SSG mode
|
|
22
|
+
*/
|
|
23
|
+
getStaticProps?: GetStaticComponentProps;
|
|
24
|
+
} & {
|
|
25
|
+
/**
|
|
26
|
+
* Custom exports
|
|
27
|
+
*/
|
|
28
|
+
[key: string]: ComponentType;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Represents a module factory
|
|
32
|
+
*/
|
|
33
|
+
export type ModuleFactory = (componentName: string) => Module | Promise<Module> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SiteResolver, SiteInfo } from '@sitecore-jss/sitecore-jss/site';
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* This is set to http://localhost:3000 by default.
|
|
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
|
+
* 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 = ''
|
|
7
9
|
*/
|
|
8
10
|
export declare const getPublicUrl: () => string;
|
|
9
11
|
/**
|
package/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types/utils/index';
|
package/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/cjs/utils/index');
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { GetServerSideComponentProps, GetStaticComponentProps } from './component-props';
|
|
3
|
-
export type Module = {
|
|
4
|
-
default: React.Component;
|
|
5
|
-
getServerSideProps?: GetServerSideComponentProps;
|
|
6
|
-
getStaticProps?: GetStaticComponentProps;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* @returns `undefined` module not found
|
|
10
|
-
* @returns `Module` regular module
|
|
11
|
-
* @returns `Promise<Module>` when module should be lazy loaded
|
|
12
|
-
*/
|
|
13
|
-
export type ComponentModule = (componentName: string) => Module | Promise<Module> | undefined;
|
|
File without changes
|
|
File without changes
|