@sitecore-content-sdk/content 1.5.0-canary.5
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 -0
- package/README.md +7 -0
- package/client.d.ts +1 -0
- package/codegen.d.ts +1 -0
- package/config-cli.d.ts +1 -0
- package/config.d.ts +1 -0
- package/dist/cjs/client/edge-proxy.js +24 -0
- package/dist/cjs/client/index.js +14 -0
- package/dist/cjs/client/models.js +2 -0
- package/dist/cjs/client/sitecore-client.js +420 -0
- package/dist/cjs/client/utils.js +53 -0
- package/dist/cjs/config/define-config.js +195 -0
- package/dist/cjs/config/index.js +7 -0
- package/dist/cjs/config/models.js +12 -0
- package/dist/cjs/config-cli/define-cli-config.js +23 -0
- package/dist/cjs/config-cli/index.js +7 -0
- package/dist/cjs/config-cli/models.js +8 -0
- package/dist/cjs/constants.js +12 -0
- package/dist/cjs/debug.js +21 -0
- package/dist/cjs/editing/codegen/index.js +14 -0
- package/dist/cjs/editing/codegen/preview.js +277 -0
- package/dist/cjs/editing/component-layout-service.js +62 -0
- package/dist/cjs/editing/design-library.js +184 -0
- package/dist/cjs/editing/editing-service.js +81 -0
- package/dist/cjs/editing/index.js +33 -0
- package/dist/cjs/editing/models.js +44 -0
- package/dist/cjs/editing/utils.js +105 -0
- package/dist/cjs/form/form.js +81 -0
- package/dist/cjs/form/index.js +7 -0
- package/dist/cjs/i18n/dictionary-service.js +144 -0
- package/dist/cjs/i18n/index.js +7 -0
- package/dist/cjs/i18n/utils.js +16 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/layout/content-styles.js +73 -0
- package/dist/cjs/layout/index.js +24 -0
- package/dist/cjs/layout/layout-service.js +68 -0
- package/dist/cjs/layout/models.js +39 -0
- package/dist/cjs/layout/themes.js +77 -0
- package/dist/cjs/layout/utils.js +117 -0
- package/dist/cjs/media/index.js +38 -0
- package/dist/cjs/media/media-api.js +100 -0
- package/dist/cjs/models.js +2 -0
- package/dist/cjs/personalize/index.js +15 -0
- package/dist/cjs/personalize/layout-personalizer.js +98 -0
- package/dist/cjs/personalize/personalize-service.js +109 -0
- package/dist/cjs/personalize/utils.js +143 -0
- package/dist/cjs/site/error-pages-service.js +82 -0
- package/dist/cjs/site/index.js +26 -0
- package/dist/cjs/site/models.js +2 -0
- package/dist/cjs/site/redirects-service.js +109 -0
- package/dist/cjs/site/robots-service.js +74 -0
- package/dist/cjs/site/site-resolver.js +73 -0
- package/dist/cjs/site/siteinfo-service.js +94 -0
- package/dist/cjs/site/sitemap-xml-service.js +92 -0
- package/dist/cjs/site/sitepath-service.js +201 -0
- package/dist/cjs/site/utils.js +55 -0
- package/dist/cjs/sitecore-service-base.js +33 -0
- package/dist/cjs/tools/codegen/component-generation.js +49 -0
- package/dist/cjs/tools/codegen/extract-files.js +105 -0
- package/dist/cjs/tools/codegen/import-map.js +411 -0
- package/dist/cjs/tools/codegen/utils.js +418 -0
- package/dist/cjs/tools/generate-map.js +2 -0
- package/dist/cjs/tools/generateSites.js +59 -0
- package/dist/cjs/tools/index.js +30 -0
- package/dist/cjs/tools/scaffold.js +62 -0
- package/dist/cjs/tools/templating/components.js +96 -0
- package/dist/cjs/tools/templating/index.js +6 -0
- package/dist/esm/client/edge-proxy.js +19 -0
- package/dist/esm/client/index.js +4 -0
- package/dist/esm/client/models.js +1 -0
- package/dist/esm/client/sitecore-client.js +416 -0
- package/dist/esm/client/utils.js +49 -0
- package/dist/esm/config/define-config.js +189 -0
- package/dist/esm/config/index.js +2 -0
- package/dist/esm/config/models.js +9 -0
- package/dist/esm/config-cli/define-cli-config.js +19 -0
- package/dist/esm/config-cli/index.js +2 -0
- package/dist/esm/config-cli/models.js +5 -0
- package/dist/esm/constants.js +9 -0
- package/dist/esm/debug.js +19 -0
- package/dist/esm/editing/codegen/index.js +1 -0
- package/dist/esm/editing/codegen/preview.js +263 -0
- package/dist/esm/editing/component-layout-service.js +55 -0
- package/dist/esm/editing/design-library.js +172 -0
- package/dist/esm/editing/editing-service.js +74 -0
- package/dist/esm/editing/index.js +6 -0
- package/dist/esm/editing/models.js +41 -0
- package/dist/esm/editing/utils.js +98 -0
- package/dist/esm/form/form.js +72 -0
- package/dist/esm/form/index.js +1 -0
- package/dist/esm/i18n/dictionary-service.js +137 -0
- package/dist/esm/i18n/index.js +2 -0
- package/dist/esm/i18n/utils.js +13 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/layout/content-styles.js +65 -0
- package/dist/esm/layout/index.js +6 -0
- package/dist/esm/layout/layout-service.js +61 -0
- package/dist/esm/layout/models.js +36 -0
- package/dist/esm/layout/themes.js +72 -0
- package/dist/esm/layout/utils.js +109 -0
- package/dist/esm/media/index.js +2 -0
- package/dist/esm/media/media-api.js +90 -0
- package/dist/esm/models.js +1 -0
- package/dist/esm/personalize/index.js +3 -0
- package/dist/esm/personalize/layout-personalizer.js +93 -0
- package/dist/esm/personalize/personalize-service.js +102 -0
- package/dist/esm/personalize/utils.js +135 -0
- package/dist/esm/site/error-pages-service.js +75 -0
- package/dist/esm/site/index.js +8 -0
- package/dist/esm/site/models.js +1 -0
- package/dist/esm/site/redirects-service.js +102 -0
- package/dist/esm/site/robots-service.js +67 -0
- package/dist/esm/site/site-resolver.js +69 -0
- package/dist/esm/site/siteinfo-service.js +87 -0
- package/dist/esm/site/sitemap-xml-service.js +85 -0
- package/dist/esm/site/sitepath-service.js +193 -0
- package/dist/esm/site/utils.js +49 -0
- package/dist/esm/sitecore-service-base.js +29 -0
- package/dist/esm/tools/codegen/component-generation.js +44 -0
- package/dist/esm/tools/codegen/extract-files.js +99 -0
- package/dist/esm/tools/codegen/import-map.js +368 -0
- package/dist/esm/tools/codegen/utils.js +373 -0
- package/dist/esm/tools/generate-map.js +1 -0
- package/dist/esm/tools/generateSites.js +52 -0
- package/dist/esm/tools/index.js +6 -0
- package/dist/esm/tools/scaffold.js +54 -0
- package/dist/esm/tools/templating/components.js +59 -0
- package/dist/esm/tools/templating/index.js +1 -0
- package/editing.d.ts +1 -0
- package/i18n.d.ts +1 -0
- package/layout.d.ts +1 -0
- package/media.d.ts +1 -0
- package/package.json +157 -0
- package/personalize.d.ts +1 -0
- package/site.d.ts +1 -0
- package/tools.d.ts +1 -0
- package/types/client/edge-proxy.d.ts +17 -0
- package/types/client/edge-proxy.d.ts.map +1 -0
- package/types/client/index.d.ts +7 -0
- package/types/client/index.d.ts.map +1 -0
- package/types/client/models.d.ts +21 -0
- package/types/client/models.d.ts.map +1 -0
- package/types/client/sitecore-client.d.ts +338 -0
- package/types/client/sitecore-client.d.ts.map +1 -0
- package/types/client/utils.d.ts +15 -0
- package/types/client/utils.d.ts.map +1 -0
- package/types/config/define-config.d.ts +20 -0
- package/types/config/define-config.d.ts.map +1 -0
- package/types/config/index.d.ts +3 -0
- package/types/config/index.d.ts.map +1 -0
- package/types/config/models.d.ts +287 -0
- package/types/config/models.d.ts.map +1 -0
- package/types/config-cli/define-cli-config.d.ts +9 -0
- package/types/config-cli/define-cli-config.d.ts.map +1 -0
- package/types/config-cli/index.d.ts +3 -0
- package/types/config-cli/index.d.ts.map +1 -0
- package/types/config-cli/models.d.ts +6 -0
- package/types/config-cli/models.d.ts.map +1 -0
- package/types/constants.d.ts +10 -0
- package/types/constants.d.ts.map +1 -0
- package/types/debug.d.ts +19 -0
- package/types/debug.d.ts.map +1 -0
- package/types/editing/codegen/index.d.ts +2 -0
- package/types/editing/codegen/index.d.ts.map +1 -0
- package/types/editing/codegen/preview.d.ts +256 -0
- package/types/editing/codegen/preview.d.ts.map +1 -0
- package/types/editing/component-layout-service.d.ts +84 -0
- package/types/editing/component-layout-service.d.ts.map +1 -0
- package/types/editing/design-library.d.ts +111 -0
- package/types/editing/design-library.d.ts.map +1 -0
- package/types/editing/editing-service.d.ts +71 -0
- package/types/editing/editing-service.d.ts.map +1 -0
- package/types/editing/index.d.ts +7 -0
- package/types/editing/index.d.ts.map +1 -0
- package/types/editing/models.d.ts +103 -0
- package/types/editing/models.d.ts.map +1 -0
- package/types/editing/utils.d.ts +82 -0
- package/types/editing/utils.d.ts.map +1 -0
- package/types/form/form.d.ts +25 -0
- package/types/form/form.d.ts.map +1 -0
- package/types/form/index.d.ts +2 -0
- package/types/form/index.d.ts.map +1 -0
- package/types/i18n/dictionary-service.d.ts +133 -0
- package/types/i18n/dictionary-service.d.ts.map +1 -0
- package/types/i18n/index.d.ts +3 -0
- package/types/i18n/index.d.ts.map +1 -0
- package/types/i18n/utils.d.ts +9 -0
- package/types/i18n/utils.d.ts.map +1 -0
- package/types/index.d.ts +7 -0
- package/types/index.d.ts.map +1 -0
- package/types/layout/content-styles.d.ts +20 -0
- package/types/layout/content-styles.d.ts.map +1 -0
- package/types/layout/index.d.ts +6 -0
- package/types/layout/index.d.ts.map +1 -0
- package/types/layout/layout-service.d.ts +45 -0
- package/types/layout/layout-service.d.ts.map +1 -0
- package/types/layout/models.d.ts +174 -0
- package/types/layout/models.d.ts.map +1 -0
- package/types/layout/themes.d.ts +13 -0
- package/types/layout/themes.d.ts.map +1 -0
- package/types/layout/utils.d.ts +56 -0
- package/types/layout/utils.d.ts.map +1 -0
- package/types/media/index.d.ts +3 -0
- package/types/media/index.d.ts.map +1 -0
- package/types/media/media-api.d.ts +60 -0
- package/types/media/media-api.d.ts.map +1 -0
- package/types/models.d.ts +32 -0
- package/types/models.d.ts.map +1 -0
- package/types/personalize/index.d.ts +4 -0
- package/types/personalize/index.d.ts.map +1 -0
- package/types/personalize/layout-personalizer.d.ts +29 -0
- package/types/personalize/layout-personalizer.d.ts.map +1 -0
- package/types/personalize/personalize-service.d.ts +89 -0
- package/types/personalize/personalize-service.d.ts.map +1 -0
- package/types/personalize/utils.d.ts +78 -0
- package/types/personalize/utils.d.ts.map +1 -0
- package/types/site/error-pages-service.d.ts +64 -0
- package/types/site/error-pages-service.d.ts.map +1 -0
- package/types/site/index.d.ts +10 -0
- package/types/site/index.d.ts.map +1 -0
- package/types/site/models.d.ts +23 -0
- package/types/site/models.d.ts.map +1 -0
- package/types/site/redirects-service.d.ts +91 -0
- package/types/site/redirects-service.d.ts.map +1 -0
- package/types/site/robots-service.d.ts +57 -0
- package/types/site/robots-service.d.ts.map +1 -0
- package/types/site/site-resolver.d.ts +28 -0
- package/types/site/site-resolver.d.ts.map +1 -0
- package/types/site/siteinfo-service.d.ts +64 -0
- package/types/site/siteinfo-service.d.ts.map +1 -0
- package/types/site/sitemap-xml-service.d.ts +63 -0
- package/types/site/sitemap-xml-service.d.ts.map +1 -0
- package/types/site/sitepath-service.d.ts +137 -0
- package/types/site/sitepath-service.d.ts.map +1 -0
- package/types/site/utils.d.ts +41 -0
- package/types/site/utils.d.ts.map +1 -0
- package/types/sitecore-service-base.d.ts +31 -0
- package/types/sitecore-service-base.d.ts.map +1 -0
- package/types/tools/codegen/component-generation.d.ts +50 -0
- package/types/tools/codegen/component-generation.d.ts.map +1 -0
- package/types/tools/codegen/extract-files.d.ts +24 -0
- package/types/tools/codegen/extract-files.d.ts.map +1 -0
- package/types/tools/codegen/import-map.d.ts +103 -0
- package/types/tools/codegen/import-map.d.ts.map +1 -0
- package/types/tools/codegen/utils.d.ts +76 -0
- package/types/tools/codegen/utils.d.ts.map +1 -0
- package/types/tools/generate-map.d.ts +36 -0
- package/types/tools/generate-map.d.ts.map +1 -0
- package/types/tools/generateSites.d.ts +25 -0
- package/types/tools/generateSites.d.ts.map +1 -0
- package/types/tools/index.d.ts +8 -0
- package/types/tools/index.d.ts.map +1 -0
- package/types/tools/scaffold.d.ts +27 -0
- package/types/tools/scaffold.d.ts.map +1 -0
- package/types/tools/templating/components.d.ts +104 -0
- package/types/tools/templating/components.d.ts.map +1 -0
- package/types/tools/templating/index.d.ts +2 -0
- package/types/tools/templating/index.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get a locale rewrite path for given pathname
|
|
3
|
+
* @param {string} pathname the pathname
|
|
4
|
+
* @param {string} locale the site data to include in the rewrite
|
|
5
|
+
* @returns {string} the rewrite path
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare function getLocaleRewrite(pathname: string, locale: string): string;
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/i18n/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMzE"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as form from './form';
|
|
2
|
+
export { default as debug } from './debug';
|
|
3
|
+
export { HTMLLink, StaticPath } from './models';
|
|
4
|
+
export { form };
|
|
5
|
+
export { defineConfig } from './config';
|
|
6
|
+
export { HIDDEN_RENDERING_NAME } from './constants';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentRendering, Field, Item, LayoutServiceData, RouteData } from './index';
|
|
2
|
+
import { HTMLLink } from '../models';
|
|
3
|
+
type Config = {
|
|
4
|
+
loadStyles: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Get the content styles link to be loaded from the Sitecore Edge Platform
|
|
8
|
+
* @param {LayoutServiceData} layoutData Layout service data
|
|
9
|
+
* @param {string} sitecoreEdgeContextId Sitecore Edge Context ID
|
|
10
|
+
* @param {string} [sitecoreEdgeUrl] Sitecore Edge Platform URL. Default is https://edge-platform.sitecorecloud.io
|
|
11
|
+
* @returns {HTMLLink | null} content styles link, null if no styles are used in layout
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare const getContentStylesheetLink: (layoutData: LayoutServiceData, sitecoreEdgeContextId: string, sitecoreEdgeUrl?: string) => HTMLLink | null;
|
|
15
|
+
export declare const getContentStylesheetUrl: (sitecoreEdgeContextId: string, sitecoreEdgeUrl?: string) => string;
|
|
16
|
+
export declare const traversePlaceholder: (components: Array<ComponentRendering>, config: Config) => void;
|
|
17
|
+
export declare const traverseField: (field: Field | Item | Item[] | undefined, config: Config) => void;
|
|
18
|
+
export declare const traverseComponent: (component: RouteData | ComponentRendering, config: Config) => void;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=content-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-styles.d.ts","sourceRoot":"","sources":["../../src/layout/content-styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AASrC,KAAK,MAAM,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,iBAAiB,EAC7B,uBAAuB,MAAM,EAC7B,wBAA2C,KAC1C,QAAQ,GAAG,IAab,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,uBAAuB,MAAM,EAC7B,wBAA2C,KAC1C,MAGsF,CAAC;AAE1F,eAAO,MAAM,mBAAmB,GAAI,YAAY,KAAK,CAAC,kBAAkB,CAAC,EAAE,QAAQ,MAAM,SAMxF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,QAAQ,MAAM,SAcrF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,WAAW,SAAS,GAAG,kBAAkB,EAAE,QAAQ,MAAM,SAc1F,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { LayoutServiceData, LayoutServicePageState, LayoutServiceContext, LayoutServiceContextData, RouteData, PlaceholderData, ComponentRendering, Field, GenericFieldValue, Item, PlaceholdersData, ComponentFields, ComponentParams, EditMode, FieldMetadata, RenderingType, RouteOptions, EDITING_COMPONENT_PLACEHOLDER, EDITING_COMPONENT_ID, } from './models';
|
|
2
|
+
export { getFieldValue, getChildPlaceholder, isFieldValueEmpty, isDynamicPlaceholder, getDynamicPlaceholderPattern, EMPTY_DATE_FIELD_VALUE, } from './utils';
|
|
3
|
+
export { getContentStylesheetLink } from './content-styles';
|
|
4
|
+
export { LayoutService, LayoutServiceConfig, GRAPHQL_LAYOUT_QUERY_NAME } from './layout-service';
|
|
5
|
+
export { getDesignLibraryStylesheetLinks } from './themes';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,KAAK,EACL,iBAAiB,EACjB,IAAI,EACJ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FetchOptions } from '@sitecore-content-sdk/core';
|
|
2
|
+
import { GraphQLServiceConfig, SitecoreServiceBase } from '../sitecore-service-base';
|
|
3
|
+
import { LayoutServiceData, RouteOptions } from './models';
|
|
4
|
+
import { SitecoreConfigInput } from '../config';
|
|
5
|
+
/**
|
|
6
|
+
* GraphQL layout query name
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const GRAPHQL_LAYOUT_QUERY_NAME = "ContentSdkLayoutQuery";
|
|
10
|
+
/**
|
|
11
|
+
* Layout service configuration
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export type LayoutServiceConfig = GraphQLServiceConfig & Partial<SitecoreConfigInput['layout']>;
|
|
15
|
+
/**
|
|
16
|
+
* Service that fetch layout data using Sitecore's GraphQL API.
|
|
17
|
+
* @augments LayoutServiceBase
|
|
18
|
+
* @mixes GraphQLRequestClient
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare class LayoutService extends SitecoreServiceBase {
|
|
22
|
+
serviceConfig: LayoutServiceConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Fetch layout data using the Sitecore GraphQL endpoint.
|
|
25
|
+
* @param {LayoutServiceConfig} serviceConfig configuration
|
|
26
|
+
*/
|
|
27
|
+
constructor(serviceConfig: LayoutServiceConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Fetch layout data for an item.
|
|
30
|
+
* @param {string} itemPath item path to fetch layout data for.
|
|
31
|
+
* @param {RouteOptions} [routeOptions] Request options like language and site to retrieve data for
|
|
32
|
+
* @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
|
|
33
|
+
* @returns {Promise<LayoutServiceData>} layout service data
|
|
34
|
+
*/
|
|
35
|
+
fetchLayoutData(itemPath: string, routeOptions: RouteOptions, fetchOptions?: FetchOptions): Promise<LayoutServiceData>;
|
|
36
|
+
/**
|
|
37
|
+
* Returns GraphQL Layout query
|
|
38
|
+
* @param {string} itemPath page route
|
|
39
|
+
* @param {string} [site] site name
|
|
40
|
+
* @param {string} [language] language
|
|
41
|
+
* @returns {string} GraphQL query
|
|
42
|
+
*/
|
|
43
|
+
protected getLayoutQuery(itemPath: string, site: string, language?: string): string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=layout-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-service.d.ts","sourceRoot":"","sources":["../../src/layout/layout-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEhG;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,mBAAmB;IAKjC,aAAa,EAAE,mBAAmB;IAJrD;;;OAGG;gBACgB,aAAa,EAAE,mBAAmB;IAIrD;;;;;;OAMG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,YAAY,EAC1B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,iBAAiB,CAAC;IAgB7B;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAe3E"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reply from the Sitecore Layout Service
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface LayoutServiceData {
|
|
6
|
+
sitecore: LayoutServiceContextData & {
|
|
7
|
+
route: RouteData | null;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Layout Service page state enum
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare enum LayoutServicePageState {
|
|
15
|
+
Preview = "preview",
|
|
16
|
+
Edit = "edit",
|
|
17
|
+
Normal = "normal"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents the edit mode for rendering content in Sitecore Editors
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare enum EditMode {
|
|
24
|
+
Metadata = "metadata"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Shape of context data from the Sitecore Layout Service
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export interface LayoutServiceContext {
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
pageEditing?: boolean;
|
|
33
|
+
language?: string;
|
|
34
|
+
itemPath?: string;
|
|
35
|
+
pageState?: LayoutServicePageState;
|
|
36
|
+
visitorIdentificationTimestamp?: number;
|
|
37
|
+
site?: {
|
|
38
|
+
name?: string;
|
|
39
|
+
};
|
|
40
|
+
renderingType?: RenderingType;
|
|
41
|
+
clientScripts?: string[];
|
|
42
|
+
clientData?: Record<string, Record<string, unknown>>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Context information from the Sitecore Layout Service
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export interface LayoutServiceContextData {
|
|
49
|
+
context: LayoutServiceContext;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Shape of route data returned from Sitecore Layout Service
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export interface RouteData<Fields = Record<string, Field | Item | Item[]>> {
|
|
56
|
+
name: string;
|
|
57
|
+
displayName?: string;
|
|
58
|
+
fields?: Fields;
|
|
59
|
+
databaseName?: string;
|
|
60
|
+
deviceId?: string;
|
|
61
|
+
itemLanguage?: string;
|
|
62
|
+
itemVersion?: number;
|
|
63
|
+
layoutId?: string;
|
|
64
|
+
templateId?: string;
|
|
65
|
+
templateName?: string;
|
|
66
|
+
placeholders: PlaceholdersData;
|
|
67
|
+
itemId?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Placeholder contents data (name: placeholder name, then array of components within that placeholder name)
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export type PlaceholdersData<TYPEDNAME extends string = string> = {
|
|
74
|
+
[P in TYPEDNAME]: Array<ComponentRendering>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Content field data passed to a component
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export interface ComponentFields {
|
|
81
|
+
[name: string]: Field | Item | Item[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Component params
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export interface ComponentParams {
|
|
88
|
+
[name: string]: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Definition of a component instance within a placeholder on a route
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export interface ComponentRendering<T = ComponentFields> {
|
|
95
|
+
componentName: string;
|
|
96
|
+
dataSource?: string;
|
|
97
|
+
uid?: string;
|
|
98
|
+
placeholders?: PlaceholdersData;
|
|
99
|
+
fields?: T;
|
|
100
|
+
params?: ComponentParams;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Field value data on a component
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export type GenericFieldValue = string | boolean | number | Date | {
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
} | Array<{
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Field interface
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
export interface Field<T = GenericFieldValue> extends FieldMetadata {
|
|
116
|
+
value: T;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Field metadata in editing mode
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
export interface FieldMetadata {
|
|
123
|
+
metadata?: {
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Content data returned from Layout Service
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
export interface Item {
|
|
132
|
+
name: string;
|
|
133
|
+
displayName?: string;
|
|
134
|
+
id?: string;
|
|
135
|
+
url?: string;
|
|
136
|
+
fields: {
|
|
137
|
+
[name: string]: Field | Item | Item[] | undefined;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Contents of a single placeholder returned from placeholder service
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
export interface PlaceholderData {
|
|
145
|
+
name: string;
|
|
146
|
+
path: string;
|
|
147
|
+
elements: ComponentRendering[];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Editing rendering type
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
export declare enum RenderingType {
|
|
154
|
+
Component = "component"
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Contract for additional route options when requesting layout data
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
export type RouteOptions = {
|
|
161
|
+
site: string;
|
|
162
|
+
locale?: string;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Static placeholder name used for component rendering
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
export declare const EDITING_COMPONENT_PLACEHOLDER = "editing-componentmode-placeholder";
|
|
169
|
+
/**
|
|
170
|
+
* Id of wrapper for component rendering
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
export declare const EDITING_COMPONENT_ID = "editing-component";
|
|
174
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/layout/models.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LayoutServiceData } from '.';
|
|
2
|
+
import { HTMLLink } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Walks through rendering tree and returns list of links of all FEAAS, BYOC or SXA Design Library Stylesheets that are used
|
|
5
|
+
* @param {LayoutServiceData} layoutData Layout service data
|
|
6
|
+
* @param {string} sitecoreEdgeContextId Sitecore Edge Context ID
|
|
7
|
+
* @param {string} [sitecoreEdgeUrl] Sitecore Edge Platform URL. Default is https://edge-platform.sitecorecloud.io
|
|
8
|
+
* @returns {HTMLLink[]} library stylesheet links
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function getDesignLibraryStylesheetLinks(layoutData: LayoutServiceData, sitecoreEdgeContextId: string, sitecoreEdgeUrl?: string): HTMLLink[];
|
|
12
|
+
export declare const getStylesheetUrl: (id: string, sitecoreEdgeContextId: string, sitecoreEdgeUrl?: string) => string;
|
|
13
|
+
//# sourceMappingURL=themes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/layout/themes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,iBAAiB,EAA4B,MAAM,GAAG,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAUrC;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,iBAAiB,EAC7B,qBAAqB,EAAE,MAAM,EAC7B,eAAe,SAA4B,GAC1C,QAAQ,EAAE,CAWZ;AAED,eAAO,MAAM,gBAAgB,GAC3B,IAAI,MAAM,EACV,uBAAuB,MAAM,EAC7B,wBAA2C,WAK5C,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ComponentRendering, ComponentFields, Field, GenericFieldValue } from './models';
|
|
2
|
+
/**
|
|
3
|
+
* Safely extracts a field value from a rendering or fields object.
|
|
4
|
+
* Null will be returned if the field is not defined.
|
|
5
|
+
* @param {ComponentRendering | Fields} renderingOrFields the rendering or fields object to extract the field from
|
|
6
|
+
* @param {string} fieldName the name of the field to extract
|
|
7
|
+
* @returns {T | undefined} the field value or null if the field is not defined
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare function getFieldValue<T>(renderingOrFields: ComponentRendering | ComponentFields, fieldName: string): T | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Safely extracts a field value from a rendering or fields object.
|
|
13
|
+
* @param {ComponentRendering | ComponentFields} renderingOrFields the rendering or fields object to extract the field from
|
|
14
|
+
* @param {string} fieldName the name of the field to extract
|
|
15
|
+
* @param {T} defaultValue the default value to return if the field is not defined
|
|
16
|
+
* @returns {T} the field value or the default value if the field is not defined
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare function getFieldValue<T>(renderingOrFields: ComponentRendering | ComponentFields, fieldName: string, defaultValue: T): T;
|
|
20
|
+
/**
|
|
21
|
+
* Gets rendering definitions in a given child placeholder under a current rendering.
|
|
22
|
+
* @param {ComponentRendering} rendering
|
|
23
|
+
* @param {string} placeholderName
|
|
24
|
+
* @returns {ComponentRendering[]} child placeholder
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare function getChildPlaceholder(rendering: ComponentRendering, placeholderName: string): ComponentRendering[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns a regular expression pattern for a dynamic placeholder name.
|
|
30
|
+
* @param {string} placeholder Placeholder name with a dynamic segment (e.g. 'main-{*}')
|
|
31
|
+
* @returns Regular expression pattern for the dynamic segment
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare const getDynamicPlaceholderPattern: (placeholder: string) => RegExp;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the placeholder name is dynamic.
|
|
37
|
+
* @param {string} placeholder Placeholder name
|
|
38
|
+
* @returns True if the placeholder name is dynamic
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare const isDynamicPlaceholder: (placeholder: string) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The default value for an empty Date field.
|
|
44
|
+
* This value is defined as a default one by .NET
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare const EMPTY_DATE_FIELD_VALUE = "0001-01-01T00:00:00Z";
|
|
48
|
+
/**
|
|
49
|
+
* Determines if the passed in field object's value is empty.
|
|
50
|
+
* @param {GenericFieldValue | Partial<Field>} field the field object.
|
|
51
|
+
* Partial<T> type is used here because _field.value_ could be required or optional for the different field types
|
|
52
|
+
* @returns True if the field value is empty
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare function isFieldValueEmpty(field: GenericFieldValue | Partial<Field> | null | undefined): field is null | undefined;
|
|
56
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/layout/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEzF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,iBAAiB,EAAE,kBAAkB,GAAG,eAAe,EACvD,SAAS,EAAE,MAAM,GAChB,CAAC,GAAG,SAAS,CAAC;AACjB;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,iBAAiB,EAAE,kBAAkB,GAAG,eAAe,EACvD,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,GACd,CAAC,CAAC;AAoCL;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,kBAAkB,EAC7B,eAAe,EAAE,MAAM,GACtB,kBAAkB,EAAE,CAWtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,aAAa,MAAM,WAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,YAAsC,CAAC;AAE/F;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,GAC3D,KAAK,IAAI,IAAI,GAAG,SAAS,CA8C3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get required query string params which should be merged with user params
|
|
3
|
+
* @param {object} qs layout service parsed query string
|
|
4
|
+
* @returns {object} requiredParams
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const getRequiredParams: (qs: {
|
|
8
|
+
[key: string]: string | undefined;
|
|
9
|
+
}) => {
|
|
10
|
+
rev: string | undefined;
|
|
11
|
+
db: string | undefined;
|
|
12
|
+
la: string | undefined;
|
|
13
|
+
vs: string | undefined;
|
|
14
|
+
ts: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Replace `/~/media` or `/-/media` with `/~/jssmedia` or `/-/jssmedia`, respectively.
|
|
18
|
+
* Can use `mediaUrlPrefix` in order to use a custom prefix.
|
|
19
|
+
* @param {string} url The URL to replace the media URL prefix in
|
|
20
|
+
* @param {RegExp} [mediaUrlPrefix] The regex to match the media URL prefix
|
|
21
|
+
* @returns {string} The URL with the media URL prefix replaced
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare const replaceMediaUrlPrefix: (url: string, mediaUrlPrefix?: RegExp) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Prepares a Sitecore media URL with `params` for use by the Content SDK media handler.
|
|
27
|
+
* This is done by replacing `/~/media` or `/-/media` with `/~/jssmedia` or `/-/jssmedia`, respectively.
|
|
28
|
+
* Provided `params` are used as the querystring parameters for the media URL.
|
|
29
|
+
* Can use `mediaUrlPrefix` in order to use a custom prefix.
|
|
30
|
+
* If no `params` are sent, the original media URL is returned.
|
|
31
|
+
* @param {string} url The URL to prepare
|
|
32
|
+
* @param {object} [params] The querystring parameters to use
|
|
33
|
+
* @param {RegExp} [mediaUrlPrefix] The regex to match the media URL prefix
|
|
34
|
+
* @returns {string} The prepared URL
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare const updateImageUrl: (url: string, params?: {
|
|
38
|
+
[key: string]: string | number | undefined;
|
|
39
|
+
} | null, mediaUrlPrefix?: RegExp) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Receives an array of `srcSet` parameters that are iterated and used as parameters to generate
|
|
42
|
+
* a corresponding set of updated Sitecore media URLs via @see updateImageUrl. The result is a comma-delimited
|
|
43
|
+
* list of media URLs with respective dimension parameters.
|
|
44
|
+
* @example
|
|
45
|
+
* // returns '/ipsum.jpg?h=1000&w=1000 1000w, /ipsum.jpg?mh=250&mw=250 250w'
|
|
46
|
+
* getSrcSet('/ipsum.jpg', [{ h: 1000, w: 1000 }, { mh: 250, mw: 250 } ])
|
|
47
|
+
* More information about `srcSet`: {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img}
|
|
48
|
+
* @param {string} url The URL to prepare
|
|
49
|
+
* @param {Array} srcSet The array of parameters to use
|
|
50
|
+
* @param {object} [imageParams] The querystring parameters to use
|
|
51
|
+
* @param {RegExp} [mediaUrlPrefix] The regex to match the media URL prefix
|
|
52
|
+
* @returns {string} The prepared URL
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare const getSrcSet: (url: string, srcSet: Array<{
|
|
56
|
+
[key: string]: string | number | undefined;
|
|
57
|
+
}>, imageParams?: {
|
|
58
|
+
[key: string]: string | number | undefined;
|
|
59
|
+
}, mediaUrlPrefix?: RegExp) => string;
|
|
60
|
+
//# sourceMappingURL=media-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-api.d.ts","sourceRoot":"","sources":["../../src/media/media-api.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE;;;;;;CAI1E,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,KAAK,MAAM,EACX,iBAAgB,MAA4B,KAC3C,MAUF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,MAAM,EACX,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,IAAI,EAC9D,iBAAgB,MAA4B,WA0B7C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,EACX,QAAQ,KAAK,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC,EAC7D,cAAc;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,EAC5D,iBAAiB,MAAM,WAaxB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Html <link> tag data model
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export type HTMLLink = {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
} & Pick<HTMLLinkElement, 'rel' | 'href'>;
|
|
8
|
+
/**
|
|
9
|
+
* Object model of a sitemap's site page item.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type StaticPath = {
|
|
13
|
+
params: {
|
|
14
|
+
path: string[];
|
|
15
|
+
};
|
|
16
|
+
locale?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Data needed to paginate results in graphql
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface PageInfo {
|
|
23
|
+
/**
|
|
24
|
+
* string token that can be used to fetch the next page of results
|
|
25
|
+
*/
|
|
26
|
+
endCursor: string;
|
|
27
|
+
/**
|
|
28
|
+
* a value that indicates whether more pages of results are available
|
|
29
|
+
*/
|
|
30
|
+
hasNext: boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,EAAE,CAAC;KAChB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { personalizeLayout } from './layout-personalizer';
|
|
2
|
+
export { PersonalizeInfo, PersonalizeService, PersonalizeServiceConfig, } from './personalize-service';
|
|
3
|
+
export { getPersonalizedRewrite, getPersonalizedRewriteData, getGroomedVariantIds, normalizePersonalizedRewrite, PersonalizedRewriteData, CdpHelper, DEFAULT_VARIANT, VARIANT_PREFIX, } from './utils';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/personalize/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,4BAA4B,EAC5B,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LayoutServiceData, ComponentRendering, PlaceholdersData } from '../layout/models';
|
|
2
|
+
export type ComponentRenderingWithExperiences = ComponentRendering & {
|
|
3
|
+
experiences: {
|
|
4
|
+
[name: string]: ComponentRenderingWithExperiences;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Apply personalization to layout data. This will recursively go through all placeholders/components, check experiences nodes and replace default with object from specific experience.
|
|
9
|
+
* @param {LayoutServiceData} layout Layout data
|
|
10
|
+
* @param {string} variantId variant id
|
|
11
|
+
* @param {string[]} [componentVariantIds] component variant ids
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare function personalizeLayout(layout: LayoutServiceData, variantId: string, componentVariantIds?: string[]): PlaceholdersData<string> | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* @param {Array} components components within placeholder
|
|
17
|
+
* @param {string[]} variantIds variant ids
|
|
18
|
+
* @param {boolean} isEditing indicates if page is rendered in metadata edit mode
|
|
19
|
+
* @returns {ComponentRendering[]} components with personalization applied
|
|
20
|
+
*/
|
|
21
|
+
export declare function personalizePlaceholder(components: ComponentRendering[], variantIds: string[], isEditing?: boolean): ComponentRendering[];
|
|
22
|
+
/**
|
|
23
|
+
* @param {ComponentRenderingWithExperiences} component component with experiences
|
|
24
|
+
* @param {string[]} variantIds variant ids
|
|
25
|
+
* @param {boolean} isEditing indicates if page is rendered in metadata edit mode
|
|
26
|
+
* @returns {ComponentRendering | null} component with personalization applied or null if hidden
|
|
27
|
+
*/
|
|
28
|
+
export declare function personalizeComponent(component: ComponentRenderingWithExperiences, variantIds: string[], isEditing?: boolean): ComponentRendering | null;
|
|
29
|
+
//# sourceMappingURL=layout-personalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-personalizer.d.ts","sourceRoot":"","sources":["../../src/personalize/layout-personalizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAS3F,MAAM,MAAM,iCAAiC,GAAG,kBAAkB,GAAG;IACnE,WAAW,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iCAAiC,CAAA;KAAE,CAAC;CACpE,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,EACjB,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAC7B,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,CAkBtC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,kBAAkB,EAAE,EAChC,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE,OAAO,GAClB,kBAAkB,EAAE,CA0BtB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,iCAAiC,EAC5C,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,CAAC,EAAE,OAAO,GAClB,kBAAkB,GAAG,IAAI,CA2C3B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { GraphQLClient, GraphQLRequestClientFactory, CacheClient, CacheOptions } from '@sitecore-content-sdk/core';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the PersonalizeService.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type PersonalizeServiceConfig = CacheOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* Timeout (ms) for the Personalize request. Default is 400.
|
|
9
|
+
*/
|
|
10
|
+
timeout?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Optional Sitecore Personalize scope identifier allowing you to isolate your personalization data between XM Cloud environments
|
|
13
|
+
* @deprecated Will be removed in a future release.
|
|
14
|
+
*/
|
|
15
|
+
scope?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Override fetch method. Uses 'GraphQLRequestClient' default otherwise.
|
|
18
|
+
*/
|
|
19
|
+
fetch?: typeof fetch;
|
|
20
|
+
/**
|
|
21
|
+
* A GraphQL Request Client Factory is a function that accepts configuration and returns an instance of a GraphQLRequestClient.
|
|
22
|
+
* This factory function is used to create and configure GraphQL clients for making GraphQL API requests.
|
|
23
|
+
*/
|
|
24
|
+
clientFactory: GraphQLRequestClientFactory;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Object model of personlize info
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export type PersonalizeInfo = {
|
|
31
|
+
/**
|
|
32
|
+
* The page id
|
|
33
|
+
*/
|
|
34
|
+
pageId: string;
|
|
35
|
+
/**
|
|
36
|
+
* The configured variant ids
|
|
37
|
+
*/
|
|
38
|
+
variantIds: string[];
|
|
39
|
+
};
|
|
40
|
+
type PersonalizeQueryResult = {
|
|
41
|
+
layout: {
|
|
42
|
+
item: {
|
|
43
|
+
id: string;
|
|
44
|
+
version: string;
|
|
45
|
+
personalization: {
|
|
46
|
+
variantIds: string[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Fetch personalize data using the Sitecore GraphQL endpoint.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare class PersonalizeService {
|
|
56
|
+
protected config: PersonalizeServiceConfig;
|
|
57
|
+
private graphQLClient;
|
|
58
|
+
private cache;
|
|
59
|
+
/**
|
|
60
|
+
* Fetch personalize data using the Sitecore GraphQL endpoint.
|
|
61
|
+
* @param {PersonalizeServiceConfig} config
|
|
62
|
+
*/
|
|
63
|
+
constructor(config: PersonalizeServiceConfig);
|
|
64
|
+
protected get query(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get personalize information for a route
|
|
67
|
+
* @param {string} itemPath page route
|
|
68
|
+
* @param {string} language language
|
|
69
|
+
* @param {string} siteName site name
|
|
70
|
+
* @returns {Promise<PersonalizeInfo | undefined>} the personalize information or undefined (if itemPath / language not found)
|
|
71
|
+
*/
|
|
72
|
+
getPersonalizeInfo(itemPath: string, language: string, siteName: string): Promise<PersonalizeInfo | undefined>;
|
|
73
|
+
/**
|
|
74
|
+
* Gets cache client implementation
|
|
75
|
+
* Override this method if custom cache needs to be used
|
|
76
|
+
* @returns CacheClient instance
|
|
77
|
+
*/
|
|
78
|
+
protected getCacheClient(): CacheClient<PersonalizeQueryResult>;
|
|
79
|
+
protected getCacheKey(itemPath: string, language: string, siteName: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
|
|
82
|
+
* library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
|
|
83
|
+
* want to use something else.
|
|
84
|
+
* @returns {GraphQLClient} implementation
|
|
85
|
+
*/
|
|
86
|
+
protected getGraphQLClient(): GraphQLClient;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=personalize-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personalize-service.d.ts","sourceRoot":"","sources":["../../src/personalize/personalize-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,WAAW,EACX,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAIpC;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACpD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;;;OAGG;IACH,aAAa,EAAE,2BAA2B,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE;QAAE,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,eAAe,EAAE;gBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAC;CAC9F,CAAC;AAEF;;;GAGG;AACH,qBAAa,kBAAkB;IAQjB,SAAS,CAAC,MAAM,EAAE,wBAAwB;IAPtD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAAsC;IAEnD;;;OAGG;gBACmB,MAAM,EAAE,wBAAwB;IAMtD,SAAS,KAAK,KAAK,IAAI,MAAM,CAc5B;IAED;;;;;;OAMG;IACG,kBAAkB,CACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAgCvC;;;;OAIG;IACH,SAAS,CAAC,cAAc,IAAI,WAAW,CAAC,sBAAsB,CAAC;IAO/D,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAI1E;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAW5C"}
|