@sitecore-content-sdk/core 0.1.0-beta.37 → 0.1.0-beta.38

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.
@@ -76,7 +76,7 @@ class SitecoreClient {
76
76
  return null;
77
77
  }
78
78
  else {
79
- const siteInfo = this.siteResolver.getByName(site);
79
+ const siteInfo = this.siteResolver.getByName(site) || layout.sitecore.context.site;
80
80
  // Initialize links to be inserted on the page
81
81
  if ((_c = pageOptions === null || pageOptions === void 0 ? void 0 : pageOptions.personalize) === null || _c === void 0 ? void 0 : _c.variantId) {
82
82
  // Modify layoutData to use specific variant(s) instead of default
@@ -146,13 +146,14 @@ class SitecoreClient {
146
146
  return null;
147
147
  }
148
148
  // If we're in Pages preview (editing) mode, prefetch the editing data
149
- const { site, itemId, language, version, variantIds, layoutKind, } = previewData;
149
+ const { site, itemId, language, version, variantIds, layoutKind, mode, } = previewData;
150
150
  const data = await this.editingService.fetchEditingData({
151
151
  siteName: site,
152
152
  itemId,
153
153
  language,
154
154
  version,
155
155
  layoutKind,
156
+ mode,
156
157
  }, fetchOptions);
157
158
  if (!data) {
158
159
  throw new Error(`Unable to fetch editing data for preview ${JSON.stringify(previewData)}`);
@@ -87,12 +87,13 @@ class GraphQLEditingService {
87
87
  * @param {string} variables.siteName - The site name.
88
88
  * @param {string} variables.itemId - The item id (path) to fetch layout data for.
89
89
  * @param {string} variables.language - The language to fetch layout data for.
90
+ * @param {string} variables.mode - The editing mode to fetch layout data for.
90
91
  * @param {string} [variables.version] - The version of the item (optional).
91
92
  * @param {LayoutKind} [variables.layoutKind] - The final or shared layout variant.
92
93
  * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
93
94
  * @returns {Promise} The layout data and dictionary phrases.
94
95
  */
95
- async fetchEditingData({ siteName, itemId, language, version, layoutKind = models_1.LayoutKind.Final }, fetchOptions) {
96
+ async fetchEditingData({ siteName, itemId, language, version, layoutKind = models_1.LayoutKind.Final, mode }, fetchOptions) {
96
97
  var _a, _b, _c;
97
98
  debug_1.default.editing('fetching editing data for %s %s %s %s', siteName, itemId, language, version, layoutKind);
98
99
  if (!siteName) {
@@ -104,6 +105,7 @@ class GraphQLEditingService {
104
105
  let initDictionary = [];
105
106
  let hasNext = true;
106
107
  let after = '';
108
+ const editModeHeader = mode === 'edit' ? 'true' : 'false';
107
109
  const editingData = await this.graphQLClient.request(exports.query, {
108
110
  siteName,
109
111
  itemId,
@@ -111,6 +113,7 @@ class GraphQLEditingService {
111
113
  language,
112
114
  }, Object.assign(Object.assign({}, fetchOptions), { headers: {
113
115
  sc_layoutKind: layoutKind,
116
+ sc_editMode: editModeHeader,
114
117
  } }));
115
118
  if ((_b = (_a = editingData === null || editingData === void 0 ? void 0 : editingData.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.dictionary) {
116
119
  initDictionary = editingData.site.siteInfo.dictionary.results;
@@ -170,9 +173,6 @@ class GraphQLEditingService {
170
173
  }
171
174
  return this.serviceConfig.clientFactory({
172
175
  debugger: debug_1.default.editing,
173
- headers: {
174
- sc_editMode: 'true',
175
- },
176
176
  });
177
177
  }
178
178
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDesignLibraryScriptLink = exports.getDesignLibraryStatusEvent = exports.DesignLibraryStatus = exports.addComponentUpdateHandler = exports.MetadataKind = exports.LayoutKind = exports.RestComponentLayoutService = exports.PAGES_EDITING_MARKER = exports.QUERY_PARAM_EDITING_SECRET = exports.EDITING_ALLOWED_ORIGINS = exports.getJssPagesClientData = exports.resetEditorChromes = exports.isEditorActive = exports.PagesEditor = exports.DEFAULT_PLACEHOLDER_UID = exports.GraphQLEditingService = void 0;
3
+ exports.getDesignLibraryScriptLink = exports.getDesignLibraryStatusEvent = exports.DesignLibraryStatus = exports.addComponentUpdateHandler = exports.MetadataKind = exports.LayoutKind = exports.RestComponentLayoutService = exports.PREVIEW_KEY = exports.PAGES_EDITING_MARKER = exports.QUERY_PARAM_EDITING_SECRET = exports.EDITING_ALLOWED_ORIGINS = exports.getJssPagesClientData = exports.resetEditorChromes = exports.isEditorActive = exports.PagesEditor = exports.DEFAULT_PLACEHOLDER_UID = exports.GraphQLEditingService = void 0;
4
4
  var graphql_editing_service_1 = require("./graphql-editing-service");
5
5
  Object.defineProperty(exports, "GraphQLEditingService", { enumerable: true, get: function () { return graphql_editing_service_1.GraphQLEditingService; } });
6
6
  var utils_1 = require("./utils");
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "getJssPagesClientData", { enumerable: true, get:
12
12
  Object.defineProperty(exports, "EDITING_ALLOWED_ORIGINS", { enumerable: true, get: function () { return utils_1.EDITING_ALLOWED_ORIGINS; } });
13
13
  Object.defineProperty(exports, "QUERY_PARAM_EDITING_SECRET", { enumerable: true, get: function () { return utils_1.QUERY_PARAM_EDITING_SECRET; } });
14
14
  Object.defineProperty(exports, "PAGES_EDITING_MARKER", { enumerable: true, get: function () { return utils_1.PAGES_EDITING_MARKER; } });
15
+ Object.defineProperty(exports, "PREVIEW_KEY", { enumerable: true, get: function () { return utils_1.PREVIEW_KEY; } });
15
16
  var rest_component_layout_service_1 = require("./rest-component-layout-service");
16
17
  Object.defineProperty(exports, "RestComponentLayoutService", { enumerable: true, get: function () { return rest_component_layout_service_1.RestComponentLayoutService; } });
17
18
  var models_1 = require("./models");
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getJssPagesClientData = exports.resetEditorChromes = exports.isEditorActive = exports.PagesEditor = exports.ChromeRediscoveryGlobalFunctionName = exports.EDITING_ALLOWED_ORIGINS = exports.PAGES_EDITING_MARKER = exports.QUERY_PARAM_EDITING_SECRET = exports.DEFAULT_PLACEHOLDER_UID = void 0;
6
+ exports.getJssPagesClientData = exports.resetEditorChromes = exports.isEditorActive = exports.PagesEditor = exports.ChromeRediscoveryGlobalFunctionName = exports.EDITING_ALLOWED_ORIGINS = exports.PAGES_EDITING_MARKER = exports.PREVIEW_KEY = exports.QUERY_PARAM_EDITING_SECRET = exports.DEFAULT_PLACEHOLDER_UID = void 0;
7
7
  const is_server_1 = __importDefault(require("../utils/is-server"));
8
8
  /**
9
9
  * Default value of uid for root placeholder when uid is not present.
@@ -13,6 +13,10 @@ exports.DEFAULT_PLACEHOLDER_UID = '00000000-0000-0000-0000-000000000000';
13
13
  * Query parameter for editing secret
14
14
  */
15
15
  exports.QUERY_PARAM_EDITING_SECRET = 'secret';
16
+ /**
17
+ * Key to identify whether the app is running in Sitecore Preview mode
18
+ */
19
+ exports.PREVIEW_KEY = 'sc_preview';
16
20
  /**
17
21
  * ID to be used as a marker for a script rendered in XMC Pages
18
22
  * Should identify app is in XM Cloud Pages editing mode
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EDITING_COMPONENT_ID = exports.EDITING_COMPONENT_PLACEHOLDER = exports.RenderingType = exports.EditMode = exports.LayoutServicePageState = void 0;
4
4
  /**
5
5
  * Layout Service page state enum
6
- * library mode would render a single component
7
6
  */
8
7
  var LayoutServicePageState;
9
8
  (function (LayoutServicePageState) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SiteResolver = exports.SITE_PREFIX = exports.normalizeSiteRewrite = exports.getSiteRewriteData = exports.getSiteRewrite = exports.GraphQLSitePathService = exports.GraphQLSiteInfoService = exports.GraphQLErrorPagesService = exports.GraphQLSitemapXmlService = exports.GraphQLRedirectsService = exports.REDIRECT_TYPE_SERVER_TRANSFER = exports.REDIRECT_TYPE_302 = exports.REDIRECT_TYPE_301 = exports.GraphQLRobotsService = void 0;
3
+ exports.SiteResolver = exports.SITE_KEY = exports.SITE_PREFIX = exports.normalizeSiteRewrite = exports.getSiteRewriteData = exports.getSiteRewrite = exports.GraphQLSitePathService = exports.GraphQLSiteInfoService = exports.GraphQLErrorPagesService = exports.GraphQLSitemapXmlService = exports.GraphQLRedirectsService = exports.REDIRECT_TYPE_SERVER_TRANSFER = exports.REDIRECT_TYPE_302 = exports.REDIRECT_TYPE_301 = exports.GraphQLRobotsService = void 0;
4
4
  var graphql_robots_service_1 = require("./graphql-robots-service");
5
5
  Object.defineProperty(exports, "GraphQLRobotsService", { enumerable: true, get: function () { return graphql_robots_service_1.GraphQLRobotsService; } });
6
6
  var graphql_redirects_service_1 = require("./graphql-redirects-service");
@@ -21,5 +21,6 @@ Object.defineProperty(exports, "getSiteRewrite", { enumerable: true, get: functi
21
21
  Object.defineProperty(exports, "getSiteRewriteData", { enumerable: true, get: function () { return utils_1.getSiteRewriteData; } });
22
22
  Object.defineProperty(exports, "normalizeSiteRewrite", { enumerable: true, get: function () { return utils_1.normalizeSiteRewrite; } });
23
23
  Object.defineProperty(exports, "SITE_PREFIX", { enumerable: true, get: function () { return utils_1.SITE_PREFIX; } });
24
+ Object.defineProperty(exports, "SITE_KEY", { enumerable: true, get: function () { return utils_1.SITE_KEY; } });
24
25
  var site_resolver_1 = require("./site-resolver");
25
26
  Object.defineProperty(exports, "SiteResolver", { enumerable: true, get: function () { return site_resolver_1.SiteResolver; } });
@@ -29,14 +29,10 @@ class SiteResolver {
29
29
  /**
30
30
  * Resolve site by site name
31
31
  * @param {string} siteName the site name
32
- * @returns {SiteInfo} the resolved site
33
- * @throws {Error} if a matching site is not found
32
+ * @returns {SiteInfo} the resolved site or undefined if not found
34
33
  */
35
34
  this.getByName = (siteName) => {
36
35
  const siteInfo = this.sites.find((info) => info.name.toLocaleLowerCase() === siteName.toLocaleLowerCase());
37
- if (!siteInfo) {
38
- throw new Error(`Could not resolve site for name ${siteName}`);
39
- }
40
36
  return siteInfo;
41
37
  };
42
38
  this.getHostMap = () => {
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SITE_PREFIX = void 0;
3
+ exports.SITE_KEY = exports.SITE_PREFIX = void 0;
4
4
  exports.getSiteRewrite = getSiteRewrite;
5
5
  exports.getSiteRewriteData = getSiteRewriteData;
6
6
  exports.normalizeSiteRewrite = normalizeSiteRewrite;
7
7
  exports.SITE_PREFIX = '_site_';
8
+ /**
9
+ * Site key for cookie and query string parameter access
10
+ */
11
+ exports.SITE_KEY = 'sc_site';
8
12
  /**
9
13
  * Get a site rewrite path for given pathname
10
14
  * @param {string} pathname the pathname
@@ -73,7 +73,7 @@ export class SitecoreClient {
73
73
  return null;
74
74
  }
75
75
  else {
76
- const siteInfo = this.siteResolver.getByName(site);
76
+ const siteInfo = this.siteResolver.getByName(site) || layout.sitecore.context.site;
77
77
  // Initialize links to be inserted on the page
78
78
  if ((_c = pageOptions === null || pageOptions === void 0 ? void 0 : pageOptions.personalize) === null || _c === void 0 ? void 0 : _c.variantId) {
79
79
  // Modify layoutData to use specific variant(s) instead of default
@@ -143,13 +143,14 @@ export class SitecoreClient {
143
143
  return null;
144
144
  }
145
145
  // If we're in Pages preview (editing) mode, prefetch the editing data
146
- const { site, itemId, language, version, variantIds, layoutKind, } = previewData;
146
+ const { site, itemId, language, version, variantIds, layoutKind, mode, } = previewData;
147
147
  const data = await this.editingService.fetchEditingData({
148
148
  siteName: site,
149
149
  itemId,
150
150
  language,
151
151
  version,
152
152
  layoutKind,
153
+ mode,
153
154
  }, fetchOptions);
154
155
  if (!data) {
155
156
  throw new Error(`Unable to fetch editing data for preview ${JSON.stringify(previewData)}`);
@@ -81,12 +81,13 @@ export class GraphQLEditingService {
81
81
  * @param {string} variables.siteName - The site name.
82
82
  * @param {string} variables.itemId - The item id (path) to fetch layout data for.
83
83
  * @param {string} variables.language - The language to fetch layout data for.
84
+ * @param {string} variables.mode - The editing mode to fetch layout data for.
84
85
  * @param {string} [variables.version] - The version of the item (optional).
85
86
  * @param {LayoutKind} [variables.layoutKind] - The final or shared layout variant.
86
87
  * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
87
88
  * @returns {Promise} The layout data and dictionary phrases.
88
89
  */
89
- async fetchEditingData({ siteName, itemId, language, version, layoutKind = LayoutKind.Final }, fetchOptions) {
90
+ async fetchEditingData({ siteName, itemId, language, version, layoutKind = LayoutKind.Final, mode }, fetchOptions) {
90
91
  var _a, _b, _c;
91
92
  debug.editing('fetching editing data for %s %s %s %s', siteName, itemId, language, version, layoutKind);
92
93
  if (!siteName) {
@@ -98,6 +99,7 @@ export class GraphQLEditingService {
98
99
  let initDictionary = [];
99
100
  let hasNext = true;
100
101
  let after = '';
102
+ const editModeHeader = mode === 'edit' ? 'true' : 'false';
101
103
  const editingData = await this.graphQLClient.request(query, {
102
104
  siteName,
103
105
  itemId,
@@ -105,6 +107,7 @@ export class GraphQLEditingService {
105
107
  language,
106
108
  }, Object.assign(Object.assign({}, fetchOptions), { headers: {
107
109
  sc_layoutKind: layoutKind,
110
+ sc_editMode: editModeHeader,
108
111
  } }));
109
112
  if ((_b = (_a = editingData === null || editingData === void 0 ? void 0 : editingData.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.dictionary) {
110
113
  initDictionary = editingData.site.siteInfo.dictionary.results;
@@ -164,9 +167,6 @@ export class GraphQLEditingService {
164
167
  }
165
168
  return this.serviceConfig.clientFactory({
166
169
  debugger: debug.editing,
167
- headers: {
168
- sc_editMode: 'true',
169
- },
170
170
  });
171
171
  }
172
172
  }
@@ -1,5 +1,5 @@
1
1
  export { GraphQLEditingService } from './graphql-editing-service';
2
- export { DEFAULT_PLACEHOLDER_UID, PagesEditor, isEditorActive, resetEditorChromes, getJssPagesClientData, EDITING_ALLOWED_ORIGINS, QUERY_PARAM_EDITING_SECRET, PAGES_EDITING_MARKER, } from './utils';
2
+ export { DEFAULT_PLACEHOLDER_UID, PagesEditor, isEditorActive, resetEditorChromes, getJssPagesClientData, EDITING_ALLOWED_ORIGINS, QUERY_PARAM_EDITING_SECRET, PAGES_EDITING_MARKER, PREVIEW_KEY, } from './utils';
3
3
  export { RestComponentLayoutService, } from './rest-component-layout-service';
4
4
  export { LayoutKind, MetadataKind, } from './models';
5
5
  export { addComponentUpdateHandler, DesignLibraryStatus, getDesignLibraryStatusEvent, getDesignLibraryScriptLink, } from './design-library';
@@ -7,6 +7,10 @@ export const DEFAULT_PLACEHOLDER_UID = '00000000-0000-0000-0000-000000000000';
7
7
  * Query parameter for editing secret
8
8
  */
9
9
  export const QUERY_PARAM_EDITING_SECRET = 'secret';
10
+ /**
11
+ * Key to identify whether the app is running in Sitecore Preview mode
12
+ */
13
+ export const PREVIEW_KEY = 'sc_preview';
10
14
  /**
11
15
  * ID to be used as a marker for a script rendered in XMC Pages
12
16
  * Should identify app is in XM Cloud Pages editing mode
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Layout Service page state enum
3
- * library mode would render a single component
4
3
  */
5
4
  export var LayoutServicePageState;
6
5
  (function (LayoutServicePageState) {
@@ -4,5 +4,5 @@ export { GraphQLSitemapXmlService, } from './graphql-sitemap-xml-service';
4
4
  export { GraphQLErrorPagesService, } from './graphql-error-pages-service';
5
5
  export { GraphQLSiteInfoService } from './graphql-siteinfo-service';
6
6
  export { GraphQLSitePathService } from './graphql-sitepath-service';
7
- export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SITE_PREFIX, } from './utils';
7
+ export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SITE_PREFIX, SITE_KEY, } from './utils';
8
8
  export { SiteResolver } from './site-resolver';
@@ -26,14 +26,10 @@ export class SiteResolver {
26
26
  /**
27
27
  * Resolve site by site name
28
28
  * @param {string} siteName the site name
29
- * @returns {SiteInfo} the resolved site
30
- * @throws {Error} if a matching site is not found
29
+ * @returns {SiteInfo} the resolved site or undefined if not found
31
30
  */
32
31
  this.getByName = (siteName) => {
33
32
  const siteInfo = this.sites.find((info) => info.name.toLocaleLowerCase() === siteName.toLocaleLowerCase());
34
- if (!siteInfo) {
35
- throw new Error(`Could not resolve site for name ${siteName}`);
36
- }
37
33
  return siteInfo;
38
34
  };
39
35
  this.getHostMap = () => {
@@ -1,4 +1,8 @@
1
1
  export const SITE_PREFIX = '_site_';
2
+ /**
3
+ * Site key for cookie and query string parameter access
4
+ */
5
+ export const SITE_KEY = 'sc_site';
2
6
  /**
3
7
  * Get a site rewrite path for given pathname
4
8
  * @param {string} pathname the pathname
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/core",
3
- "version": "0.1.0-beta.37",
3
+ "version": "0.1.0-beta.38",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "description": "",
79
79
  "types": "types/index.d.ts",
80
- "gitHead": "a2ec7a7854734141e897689e5aa12156cd15a87c",
80
+ "gitHead": "0309249c0004a7eb8d9c8a371b1fe6550ed3051d",
81
81
  "files": [
82
82
  "dist",
83
83
  "types",
@@ -1,7 +1,7 @@
1
1
  import { PageInfo } from '../client';
2
2
  import { GraphQLClient, GraphQLRequestClientFactory } from '../graphql-request-client';
3
3
  import { DictionaryPhrases } from '../i18n';
4
- import { LayoutServiceData } from '../layout';
4
+ import { LayoutServiceData, LayoutServicePageState } from '../layout';
5
5
  import { LayoutKind } from './models';
6
6
  import { FetchOptions } from '../models';
7
7
  /**
@@ -50,6 +50,7 @@ export type EditingOptions = {
50
50
  language: string;
51
51
  version?: string;
52
52
  layoutKind?: LayoutKind;
53
+ mode: Exclude<LayoutServicePageState, 'Normal'>;
53
54
  };
54
55
  /**
55
56
  * Service for fetching editing data from Sitecore using the Sitecore's GraphQL API.
@@ -69,12 +70,13 @@ export declare class GraphQLEditingService {
69
70
  * @param {string} variables.siteName - The site name.
70
71
  * @param {string} variables.itemId - The item id (path) to fetch layout data for.
71
72
  * @param {string} variables.language - The language to fetch layout data for.
73
+ * @param {string} variables.mode - The editing mode to fetch layout data for.
72
74
  * @param {string} [variables.version] - The version of the item (optional).
73
75
  * @param {LayoutKind} [variables.layoutKind] - The final or shared layout variant.
74
76
  * @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
75
77
  * @returns {Promise} The layout data and dictionary phrases.
76
78
  */
77
- fetchEditingData({ siteName, itemId, language, version, layoutKind }: EditingOptions, fetchOptions?: FetchOptions): Promise<{
79
+ fetchEditingData({ siteName, itemId, language, version, layoutKind, mode }: EditingOptions, fetchOptions?: FetchOptions): Promise<{
78
80
  layoutData: LayoutServiceData;
79
81
  dictionary: DictionaryPhrases;
80
82
  }>;
@@ -1,5 +1,5 @@
1
1
  export { GraphQLEditingService } from './graphql-editing-service';
2
- export { DEFAULT_PLACEHOLDER_UID, PagesEditor, isEditorActive, resetEditorChromes, Metadata, getJssPagesClientData, EDITING_ALLOWED_ORIGINS, QUERY_PARAM_EDITING_SECRET, PAGES_EDITING_MARKER, ComponentUpdateEventArgs, } from './utils';
2
+ export { DEFAULT_PLACEHOLDER_UID, PagesEditor, isEditorActive, resetEditorChromes, Metadata, getJssPagesClientData, EDITING_ALLOWED_ORIGINS, QUERY_PARAM_EDITING_SECRET, PAGES_EDITING_MARKER, ComponentUpdateEventArgs, PREVIEW_KEY, } from './utils';
3
3
  export { RestComponentLayoutService, ComponentLayoutRequestParams, } from './rest-component-layout-service';
4
4
  export { EditingRenderQueryParams, RenderComponentQueryParams } from './models';
5
5
  export { LayoutKind, MetadataKind, EditingPreviewData, DesignLibraryRenderPreviewData, } from './models';
@@ -57,7 +57,7 @@ export type EditingPreviewData = {
57
57
  site: string;
58
58
  itemId: string;
59
59
  language: string;
60
- pageState: Exclude<LayoutServicePageState, 'Normal'>;
60
+ mode: Exclude<LayoutServicePageState, 'Normal'>;
61
61
  variantIds: string[];
62
62
  version?: string;
63
63
  layoutKind?: LayoutKind;
@@ -71,7 +71,6 @@ export interface DesignLibraryRenderPreviewData {
71
71
  renderingId: string;
72
72
  componentUid: string;
73
73
  language: string;
74
- pageState: LayoutServicePageState;
75
74
  mode?: 'library';
76
75
  variant?: string;
77
76
  version?: string;
@@ -7,6 +7,10 @@ export declare const DEFAULT_PLACEHOLDER_UID = "00000000-0000-0000-0000-00000000
7
7
  * Query parameter for editing secret
8
8
  */
9
9
  export declare const QUERY_PARAM_EDITING_SECRET = "secret";
10
+ /**
11
+ * Key to identify whether the app is running in Sitecore Preview mode
12
+ */
13
+ export declare const PREVIEW_KEY = "sc_preview";
10
14
  /**
11
15
  * ID to be used as a marker for a script rendered in XMC Pages
12
16
  * Should identify app is in XM Cloud Pages editing mode
@@ -8,7 +8,6 @@ export interface LayoutServiceData {
8
8
  }
9
9
  /**
10
10
  * Layout Service page state enum
11
- * library mode would render a single component
12
11
  */
13
12
  export declare enum LayoutServicePageState {
14
13
  Preview = "preview",
@@ -5,5 +5,5 @@ export { ErrorPages, GraphQLErrorPagesService, GraphQLErrorPagesServiceConfig, }
5
5
  export { GraphQLSiteInfoService, GraphQLSiteInfoServiceConfig } from './graphql-siteinfo-service';
6
6
  export { GraphQLSitePathService, GraphQLSitePathServiceConfig } from './graphql-sitepath-service';
7
7
  export { SiteInfo } from './models';
8
- export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SiteRewriteData, SITE_PREFIX, } from './utils';
8
+ export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SiteRewriteData, SITE_PREFIX, SITE_KEY, } from './utils';
9
9
  export { SiteResolver } from './site-resolver';
@@ -18,10 +18,9 @@ export declare class SiteResolver {
18
18
  /**
19
19
  * Resolve site by site name
20
20
  * @param {string} siteName the site name
21
- * @returns {SiteInfo} the resolved site
22
- * @throws {Error} if a matching site is not found
21
+ * @returns {SiteInfo} the resolved site or undefined if not found
23
22
  */
24
- getByName: (siteName: string) => SiteInfo;
23
+ getByName: (siteName: string) => SiteInfo | undefined;
25
24
  protected getHostMap: () => Map<string, SiteInfo>;
26
25
  protected matchesPattern(hostname: string, pattern: string): boolean;
27
26
  }
@@ -1,4 +1,8 @@
1
1
  export declare const SITE_PREFIX = "_site_";
2
+ /**
3
+ * Site key for cookie and query string parameter access
4
+ */
5
+ export declare const SITE_KEY = "sc_site";
2
6
  export type SiteRewriteData = {
3
7
  siteName: string;
4
8
  };