@sitecore-content-sdk/content 2.0.0-canary.9 → 2.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.
Files changed (68) hide show
  1. package/LICENSE.txt +202 -202
  2. package/dist/cjs/client/sitecore-client.js +3 -5
  3. package/dist/cjs/config/define-config.js +4 -4
  4. package/dist/cjs/constants.js +1 -5
  5. package/dist/cjs/editing/codegen/index.js +2 -2
  6. package/dist/cjs/editing/codegen/preview.js +43 -15
  7. package/dist/cjs/editing/component-layout-service.js +2 -2
  8. package/dist/cjs/editing/design-library.js +26 -18
  9. package/dist/cjs/form/form.js +7 -5
  10. package/dist/cjs/i18n/dictionary-service.js +4 -6
  11. package/dist/cjs/site/error-pages-service.js +3 -2
  12. package/dist/cjs/site/redirects-service.js +2 -2
  13. package/dist/cjs/site/robots-service.js +3 -2
  14. package/dist/cjs/site/site-resolver.js +3 -1
  15. package/dist/cjs/site/sitemap-xml-service.js +3 -2
  16. package/dist/cjs/site/sitepath-service.js +5 -4
  17. package/dist/cjs/tools/codegen/component-generation.js +3 -3
  18. package/dist/cjs/tools/codegen/extract-files.js +4 -3
  19. package/dist/cjs/tools/codegen/import-map.js +7 -13
  20. package/dist/cjs/tools/codegen/utils.js +2 -1
  21. package/dist/cjs/tools/generateSites.js +4 -2
  22. package/dist/esm/client/sitecore-client.js +4 -6
  23. package/dist/esm/config/define-config.js +5 -5
  24. package/dist/esm/constants.js +0 -4
  25. package/dist/esm/editing/codegen/index.js +1 -1
  26. package/dist/esm/editing/codegen/preview.js +43 -15
  27. package/dist/esm/editing/component-layout-service.js +2 -2
  28. package/dist/esm/editing/design-library.js +24 -17
  29. package/dist/esm/form/form.js +6 -4
  30. package/dist/esm/i18n/dictionary-service.js +4 -6
  31. package/dist/esm/site/error-pages-service.js +3 -2
  32. package/dist/esm/site/redirects-service.js +3 -3
  33. package/dist/esm/site/robots-service.js +3 -2
  34. package/dist/esm/site/site-resolver.js +3 -1
  35. package/dist/esm/site/sitemap-xml-service.js +3 -2
  36. package/dist/esm/site/sitepath-service.js +4 -3
  37. package/dist/esm/tools/codegen/component-generation.js +3 -3
  38. package/dist/esm/tools/codegen/extract-files.js +5 -4
  39. package/dist/esm/tools/codegen/import-map.js +7 -13
  40. package/dist/esm/tools/codegen/utils.js +3 -2
  41. package/dist/esm/tools/generateSites.js +4 -2
  42. package/package.json +5 -5
  43. package/types/client/sitecore-client.d.ts.map +1 -1
  44. package/types/config/define-config.d.ts.map +1 -1
  45. package/types/constants.d.ts +0 -4
  46. package/types/constants.d.ts.map +1 -1
  47. package/types/editing/codegen/index.d.ts +1 -1
  48. package/types/editing/codegen/index.d.ts.map +1 -1
  49. package/types/editing/codegen/preview.d.ts +42 -9
  50. package/types/editing/codegen/preview.d.ts.map +1 -1
  51. package/types/editing/component-layout-service.d.ts.map +1 -1
  52. package/types/editing/design-library.d.ts +7 -0
  53. package/types/editing/design-library.d.ts.map +1 -1
  54. package/types/form/form.d.ts.map +1 -1
  55. package/types/i18n/dictionary-service.d.ts +0 -2
  56. package/types/i18n/dictionary-service.d.ts.map +1 -1
  57. package/types/site/error-pages-service.d.ts.map +1 -1
  58. package/types/site/redirects-service.d.ts.map +1 -1
  59. package/types/site/robots-service.d.ts.map +1 -1
  60. package/types/site/site-resolver.d.ts.map +1 -1
  61. package/types/site/sitemap-xml-service.d.ts.map +1 -1
  62. package/types/site/sitepath-service.d.ts +0 -1
  63. package/types/site/sitepath-service.d.ts.map +1 -1
  64. package/types/tools/codegen/component-generation.d.ts.map +1 -1
  65. package/types/tools/codegen/extract-files.d.ts.map +1 -1
  66. package/types/tools/codegen/import-map.d.ts.map +1 -1
  67. package/types/tools/codegen/utils.d.ts.map +1 -1
  68. package/types/tools/generateSites.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
1
  import { NativeDataFetcher, constants } from '@sitecore-content-sdk/core';
2
- import { validateEvent } from '../design-library';
2
+ import { validateEvent, findComponent } from '../design-library';
3
3
  import debug from '../../debug';
4
- const { SITECORE_EDGE_PLATFORM_URL_DEFAULT } = constants;
4
+ const { SITECORE_EDGE_PLATFORM_URL_DEFAULT, ERROR_MESSAGES } = constants;
5
5
  /**
6
6
  * Event to send import map to design library
7
7
  */
@@ -15,9 +15,13 @@ const DESIGN_LIBRARY_COMPONENT_PROPS_EVENT_NAME = 'component:generation:componen
15
15
  */
16
16
  const DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME = 'component:generation:component-preview';
17
17
  /**
18
- * Event to send component error to design library
18
+ * Event to send component preview error to design library
19
19
  */
20
20
  const DESIGN_LIBRARY_COMPONENT_PREVIEW_ERROR_EVENT_NAME = 'component:generation:component-preview-error';
21
+ /**
22
+ * Event to send general component preview error to design library
23
+ */
24
+ const DESIGN_LIBRARY_ERROR_EVENT_NAME = 'component:generation:error';
21
25
  /**
22
26
  * Enumeration of error types for the design library preview.
23
27
  * @internal
@@ -32,6 +36,18 @@ export var DesignLibraryPreviewError;
32
36
  * Error occurred during component and event handlers initialization.
33
37
  */
34
38
  DesignLibraryPreviewError["RenderInit"] = "render-init";
39
+ /**
40
+ * The import map is missing
41
+ */
42
+ DesignLibraryPreviewError["ImportMapMissing"] = "import-map-missing";
43
+ /**
44
+ * Error during loading of the import map
45
+ */
46
+ DesignLibraryPreviewError["ImportMapLoad"] = "import-map-load-error";
47
+ /**
48
+ * Error during fetching the generated component data from secured endpoint
49
+ */
50
+ DesignLibraryPreviewError["GeneratedComponentFetch"] = "generated-component-fetch-error";
35
51
  })(DesignLibraryPreviewError || (DesignLibraryPreviewError = {}));
36
52
  /**
37
53
  * Builds the component dependencies from the component imports and the import map.
@@ -108,16 +124,19 @@ export const addComponentPreviewHandler = (importMap, callback) => {
108
124
  /**
109
125
  * Adds the browser-side event handler for 'component:generation:component-preview' message used in Design Library for server components
110
126
  * The event should contain the cache id and token which will be used to fetch the component code, styles and imports from secured endpoint
127
+ * @param {ComponentRendering} rootComponent - The root component rendering object.
111
128
  * @param {Function} callback callback to be called after component is received
112
129
  * @internal
113
130
  */
114
- export const addServerComponentPreviewHandler = (callback) => {
131
+ export const addServerComponentPreviewHandler = (rootComponent, callback) => {
115
132
  const handler = (e) => {
133
+ var _a, _b;
116
134
  if (!validateEvent(e, DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME)) {
117
135
  return;
118
136
  }
119
137
  console.debug('Component Library: message received', e.data);
120
- callback(e.data);
138
+ const componentToUpdate = findComponent(rootComponent, (_b = (_a = e.data) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.uid);
139
+ callback(componentToUpdate, e.data);
121
140
  };
122
141
  window.addEventListener('message', handler);
123
142
  const unsubscribe = () => {
@@ -175,18 +194,27 @@ export const createComponentInstance = (importMap, generatedComponentData) => {
175
194
  return exports.Component;
176
195
  };
177
196
  /**
178
- * Generates a DesignLibraryComponentPreviewErrorEvent with the given uid and error.
197
+ * Generates a DesignLibraryErrorEvent depending on the type of error with the given uid and error.
179
198
  * @param {string} uid - The unique identifier for the event.
180
199
  * @param {unknown} error - The error to be sent.
181
200
  * @param {DesignLibraryPreviewError} type - The type of error.
182
- * @returns An object representing the DesignLibraryComponentPreviewErrorEvent.
201
+ * @returns An object representing the DesignLibraryErrorEvent.
183
202
  * @internal
184
203
  */
185
- export function getDesignLibraryComponentPreviewErrorEvent(uid, error, type) {
186
- return {
187
- name: DESIGN_LIBRARY_COMPONENT_PREVIEW_ERROR_EVENT_NAME,
188
- message: { uid, error, type },
189
- };
204
+ export function getDesignLibraryErrorEvent(uid, error, type) {
205
+ switch (type) {
206
+ case DesignLibraryPreviewError.Render:
207
+ case DesignLibraryPreviewError.RenderInit:
208
+ return {
209
+ name: DESIGN_LIBRARY_COMPONENT_PREVIEW_ERROR_EVENT_NAME,
210
+ message: { uid, error, type },
211
+ };
212
+ default:
213
+ return {
214
+ name: DESIGN_LIBRARY_ERROR_EVENT_NAME,
215
+ message: { uid, error, type },
216
+ };
217
+ }
190
218
  }
191
219
  /**
192
220
  * Generates a DesignLibraryComponentPropsEvent with the given uid, fields and parameters.
@@ -249,15 +277,15 @@ export function isImportEntryInfoArray(data) {
249
277
  typeof data[0].exports[0] === 'string');
250
278
  }
251
279
  /**
252
- * Sends a component preview error event to the design library
280
+ * Sends a design library error event to the design library
253
281
  * @param {string} uid - The unique identifier of the component that's being edited.
254
282
  * @param {unknown} error - The error object or message to be sent.
255
283
  * @param {DesignLibraryPreviewError} type - The type of error, as defined in DesignLibraryPreviewError.
256
284
  * @internal
257
285
  */
258
286
  export const sendErrorEvent = (uid, error, type) => {
259
- const errorEvent = getDesignLibraryComponentPreviewErrorEvent(uid, error, type);
260
- console.error('Component Library: sending error event', errorEvent);
287
+ const errorEvent = getDesignLibraryErrorEvent(uid, error, type);
288
+ console.error(`Component Library: sending error event. ${ERROR_MESSAGES.CONTACT_SUPPORT}`, errorEvent);
261
289
  if (typeof window !== 'undefined') {
262
290
  const target = window.parent && window.parent !== window ? window.parent : window;
263
291
  target.postMessage(errorEvent, '*');
@@ -2,6 +2,7 @@ import { constants, NativeDataFetcher } from '@sitecore-content-sdk/core';
2
2
  import { normalizeUrl, resolveUrl } from '@sitecore-content-sdk/core/tools';
3
3
  import debug from '../debug';
4
4
  import { DesignLibraryMode } from './models';
5
+ const { ERROR_MESSAGES } = constants;
5
6
  /**
6
7
  * REST service that enables Design Library functionality.
7
8
  * Returns layout data for a single rendered component.
@@ -15,8 +16,7 @@ export class ComponentLayoutService {
15
16
  // Choose the correct Edge ID per environment
16
17
  const sitecoreContextId = this.config.contextId || this.config.clientContextId;
17
18
  if (!sitecoreContextId) {
18
- throw new Error(`ComponentLayoutService misconfigured: contextId is missing.
19
- Provide contextId on the server, and clientContextId in the browser if you need to full client-side functionality.`);
19
+ throw new Error(ERROR_MESSAGES.MV_001);
20
20
  }
21
21
  const fetcher = new NativeDataFetcher({ debugger: debug.layout });
22
22
  debug.layout('fetching component with uid %s for %s %s %s %s', params.componentUid, params.itemId, params.language, params.siteName, params.dataSourceId);
@@ -1,6 +1,7 @@
1
1
  import { constants } from '@sitecore-content-sdk/core';
2
2
  import { normalizeUrl } from '@sitecore-content-sdk/core/tools';
3
3
  import { DesignLibraryMode } from './models';
4
+ const { ERROR_MESSAGES } = constants;
4
5
  /**
5
6
  * Event to be sent when report status to design library
6
7
  */
@@ -80,22 +81,7 @@ export const updateComponentHandler = (e, rootComponent, successCallback) => {
80
81
  console.debug('Received component:update event without uid, aborting event handler...');
81
82
  return;
82
83
  }
83
- const findComponent = (root) => {
84
- var _a, _b;
85
- if (((_a = root.uid) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = eventArgs.details) === null || _b === void 0 ? void 0 : _b.uid.toLowerCase()))
86
- return root;
87
- if (root.placeholders) {
88
- for (const plhName of Object.keys(root.placeholders)) {
89
- for (const rendering of root.placeholders[plhName]) {
90
- const result = findComponent(rendering);
91
- if (result)
92
- return result;
93
- }
94
- }
95
- }
96
- return null;
97
- };
98
- const componentToUpdate = findComponent(rootComponent);
84
+ const componentToUpdate = findComponent(rootComponent, eventArgs.details.uid);
99
85
  if (componentToUpdate) {
100
86
  console.debug('Found component with uid %s to update. Update fields: %o. Update params: %o.', eventArgs.details.uid, eventArgs.details.fields, eventArgs.details.params);
101
87
  updateComponent(componentToUpdate, eventArgs.details.fields, eventArgs.details.params);
@@ -108,6 +94,27 @@ export const updateComponentHandler = (e, rootComponent, successCallback) => {
108
94
  // strictly for testing
109
95
  return rootComponent;
110
96
  };
97
+ /**
98
+ * Recursively searches for a component with the specified UID within the given root component and its placeholders.
99
+ * @param {ComponentRendering} root - The root component to start the search from.
100
+ * @param {string} uid - The unique identifier of the component to find.
101
+ * @returns {ComponentRendering | null} The component with the specified UID if found; otherwise, null.
102
+ */
103
+ export const findComponent = (root, uid) => {
104
+ var _a;
105
+ if (((_a = root.uid) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === uid.toLowerCase())
106
+ return root;
107
+ if (root.placeholders) {
108
+ for (const plhName of Object.keys(root.placeholders)) {
109
+ for (const rendering of root.placeholders[plhName]) {
110
+ const result = findComponent(rendering, uid);
111
+ if (result)
112
+ return result;
113
+ }
114
+ }
115
+ }
116
+ return null;
117
+ };
111
118
  /**
112
119
  * Updates a component's fields and params with the provided values.
113
120
  * @param {ComponentRendering<ComponentFields>} component - The component to update.
@@ -174,6 +181,6 @@ export const postToDesignLibrary = (evt) => {
174
181
  target.postMessage(evt, '*');
175
182
  }
176
183
  catch (err) {
177
- console.error('Component Library: postMessage failed', err, evt);
184
+ console.error(`Component Library: postMessage failed. ${ERROR_MESSAGES.CONTACT_SUPPORT}`, err, evt);
178
185
  }
179
186
  };
@@ -1,6 +1,8 @@
1
- import { form } from '@sitecore-cloudsdk/events/browser';
1
+ import { form } from '@sitecore-content-sdk/events';
2
+ import { constants } from '@sitecore-content-sdk/core';
2
3
  import { getEdgeProxyFormsUrl } from '../client';
3
4
  import debug from '../debug';
5
+ const { ERROR_MESSAGES } = constants;
4
6
  /**
5
7
  * Fetches the form markup from the Sitecore Edge service and renders it in the component's template.
6
8
  * @param {string} contextId - The unique identifier of the current context
@@ -10,7 +12,7 @@ import debug from '../debug';
10
12
  */
11
13
  export const loadForm = async (contextId, formId, edgeUrl) => {
12
14
  if (!contextId) {
13
- debug.form('Form was not able to render since context id was not provided');
15
+ debug.form(`${ERROR_MESSAGES.MV_001}. Form was not able to render.`);
14
16
  return '';
15
17
  }
16
18
  const url = getEdgeProxyFormsUrl(contextId, formId, edgeUrl);
@@ -21,14 +23,14 @@ export const loadForm = async (contextId, formId, edgeUrl) => {
21
23
  cache: 'no-cache',
22
24
  });
23
25
  if (rsp.status !== 200) {
24
- throw new Error('Failed to fetch form data');
26
+ throw new Error(`Failed to fetch form data. ${ERROR_MESSAGES.CONTACT_SUPPORT}`);
25
27
  }
26
28
  const content = await rsp.text();
27
29
  debug.form(`Form data fetch response: ${content}`);
28
30
  return content;
29
31
  }
30
32
  catch (error) {
31
- debug.form(`Form '${formId}' was not able to render`, error);
33
+ debug.form(`Form '${formId}' was not able to render. ${ERROR_MESSAGES.CONTACT_SUPPORT}`, error);
32
34
  throw error;
33
35
  }
34
36
  };
@@ -1,8 +1,6 @@
1
- import { MemoryCacheClient, } from '@sitecore-content-sdk/core';
2
- import { siteNameError, languageError } from '../constants';
1
+ import { MemoryCacheClient, constants, } from '@sitecore-content-sdk/core';
3
2
  import debug from '../debug';
4
- /** @private */
5
- export const queryError = 'Valid value for rootItemId not provided and failed to auto-resolve app root item.';
3
+ const { ERROR_MESSAGES } = constants;
6
4
  /** @default */
7
5
  const siteQuery = /* GraphQL */ `
8
6
  query DictionarySiteQuery(
@@ -65,10 +63,10 @@ export class DictionaryService {
65
63
  let hasNext = true;
66
64
  let after = '';
67
65
  if (!site) {
68
- throw new RangeError(siteNameError);
66
+ throw new RangeError(ERROR_MESSAGES.MV_002);
69
67
  }
70
68
  if (!language) {
71
- throw new RangeError(languageError);
69
+ throw new RangeError(ERROR_MESSAGES.MV_009);
72
70
  }
73
71
  while (hasNext) {
74
72
  const fetchResponse = await this.graphQLClient.request(siteQuery, {
@@ -1,5 +1,6 @@
1
+ import { constants } from '@sitecore-content-sdk/core';
1
2
  import debug from '../debug';
2
- import { siteNameError } from '../constants';
3
+ const { ERROR_MESSAGES } = constants;
3
4
  // The default query for request error handling
4
5
  const defaultQuery = /* GraphQL */ `
5
6
  query ErrorPagesQuery($siteName: String!, $language: String!) {
@@ -46,7 +47,7 @@ export class ErrorPagesService {
46
47
  async fetchErrorPages(siteName, locale, fetchOptions) {
47
48
  const language = locale || this.options.language;
48
49
  if (!siteName) {
49
- throw new Error(siteNameError);
50
+ throw new Error(ERROR_MESSAGES.MV_002);
50
51
  }
51
52
  return this.graphQLClient.request(this.query, {
52
53
  siteName,
@@ -1,6 +1,6 @@
1
- import { MemoryCacheClient, } from '@sitecore-content-sdk/core';
2
- import { siteNameError } from '../constants';
1
+ import { MemoryCacheClient, constants, } from '@sitecore-content-sdk/core';
3
2
  import debug from '../debug';
3
+ const { ERROR_MESSAGES } = constants;
4
4
  /**
5
5
  * Redirect type for 301 redirects
6
6
  * @public
@@ -60,7 +60,7 @@ export class RedirectsService {
60
60
  async fetchRedirects(siteName, fetchOptions) {
61
61
  var _a, _b;
62
62
  if (!siteName) {
63
- throw new Error(siteNameError);
63
+ throw new Error(ERROR_MESSAGES.MV_002);
64
64
  }
65
65
  const cacheKey = `redirects-${siteName}`;
66
66
  let data = this.cache.getCacheValue(cacheKey);
@@ -1,5 +1,6 @@
1
+ import { constants } from '@sitecore-content-sdk/core';
1
2
  import debug from '../debug';
2
- import { siteNameError } from '../constants';
3
+ const { ERROR_MESSAGES } = constants;
3
4
  // The default query for request robots.txt
4
5
  const defaultQuery = /* GraphQL */ `
5
6
  query RobotsQuery($siteName: String!) {
@@ -35,7 +36,7 @@ export class RobotsService {
35
36
  async fetchRobots(fetchOptions) {
36
37
  const siteName = this.options.siteName;
37
38
  if (!siteName) {
38
- throw new Error(siteNameError);
39
+ throw new Error(ERROR_MESSAGES.MV_002);
39
40
  }
40
41
  const robotsResult = this.graphQLClient.request(this.query, {
41
42
  siteName,
@@ -1,3 +1,5 @@
1
+ import { constants } from '@sitecore-content-sdk/core';
2
+ const { ERROR_MESSAGES } = constants;
1
3
  // Delimiters for multi-value hostnames
2
4
  const DELIMITERS = /\||,|;/g;
3
5
  /**
@@ -22,7 +24,7 @@ export class SiteResolver {
22
24
  return site;
23
25
  }
24
26
  }
25
- throw new Error(`Could not resolve site for host ${hostName}`);
27
+ throw new Error(ERROR_MESSAGES.IE_007(hostName));
26
28
  };
27
29
  /**
28
30
  * Resolve site by site name
@@ -1,5 +1,6 @@
1
+ import { constants } from '@sitecore-content-sdk/core';
1
2
  import debug from '../debug';
2
- import { siteNameError } from '../constants';
3
+ const { ERROR_MESSAGES } = constants;
3
4
  const PREFIX_NAME_SITEMAP = 'sitemap';
4
5
  // The default query for request sitemaps
5
6
  const defaultQuery = /* GraphQL */ `
@@ -36,7 +37,7 @@ export class SitemapXmlService {
36
37
  async fetchSitemaps(fetchOptions) {
37
38
  const siteName = this.options.siteName;
38
39
  if (!siteName) {
39
- throw new Error(siteNameError);
40
+ throw new Error(ERROR_MESSAGES.MV_002);
40
41
  }
41
42
  const sitemapResult = this.graphQLClient.request(this.query, {
42
43
  siteName,
@@ -1,16 +1,17 @@
1
+ import { constants } from '@sitecore-content-sdk/core';
1
2
  import { getPersonalizedRewrite } from '../personalize';
2
3
  import { getSiteRewrite } from '../site';
3
4
  import debug from '../debug';
5
+ const { ERROR_MESSAGES } = constants;
4
6
  /** @private */
5
7
  export const languageError = 'The list of languages cannot be empty';
6
- export const siteError = 'The service needs a site name';
7
8
  export const sitesError = 'The list of sites cannot be empty';
8
9
  /**
9
10
  * @param {string} siteName to inject into error text
10
11
  * @private
11
12
  */
12
13
  export function getSiteEmptyError(siteName) {
13
- return `Site "${siteName}" does not exist or site item tree is missing`;
14
+ return ERROR_MESSAGES.IV_007(siteName);
14
15
  }
15
16
  /**
16
17
  * GQL query made dynamic based whether personalization is enabled or not
@@ -103,7 +104,7 @@ export class SitePathService {
103
104
  });
104
105
  const paths = new Array();
105
106
  if (!languages.length) {
106
- throw new RangeError(languageError);
107
+ throw new RangeError(ERROR_MESSAGES.MV_009);
107
108
  }
108
109
  // Get all sites
109
110
  if (!sites || !sites.length) {
@@ -1,5 +1,5 @@
1
1
  import { constants, debug } from '@sitecore-content-sdk/core';
2
- const { SITECORE_EDGE_PLATFORM_URL_DEFAULT } = constants;
2
+ const { SITECORE_EDGE_PLATFORM_URL_DEFAULT, ERROR_MESSAGES } = constants;
3
3
  /**
4
4
  * Gets the component spec url.
5
5
  * @param {GetComponentSpecParams} params - The parameters for getting the component spec url.
@@ -31,14 +31,14 @@ export const getComponentSpec = async ({ componentId, edgeUrl = SITECORE_EDGE_PL
31
31
  throw new Error('The token is incorrect or expired or the component ID is incorrect.');
32
32
  }
33
33
  if (!response.ok) {
34
- throw new Error(`Failed to fetch component ${componentId}`);
34
+ throw new Error(`Failed to fetch component ${componentId}. ${ERROR_MESSAGES.CONTACT_SUPPORT}`);
35
35
  }
36
36
  const spec = await response.json();
37
37
  debug.common('Component spec fetched successfully for %s: %o', componentId, spec);
38
38
  return spec;
39
39
  }
40
40
  catch (error) {
41
- debug.common('Failed to fetch component spec: %s', String(error));
41
+ debug.common(`Failed to fetch component spec: ${String(error)}. ${ERROR_MESSAGES.CONTACT_SUPPORT}`);
42
42
  throw error;
43
43
  }
44
44
  };
@@ -2,9 +2,10 @@
2
2
  import chalk from 'chalk';
3
3
  import { ExtractedFileType, resolveComponentImportFiles, sendCode, validateDeployContext, readNamedExports, } from './utils';
4
4
  import { auth } from '@sitecore-content-sdk/core/node-tools';
5
- import { debug } from '@sitecore-content-sdk/core';
5
+ import { debug, constants } from '@sitecore-content-sdk/core';
6
6
  import path from 'path';
7
7
  import fs from 'fs';
8
+ const { ERROR_MESSAGES } = constants;
8
9
  /**
9
10
  * Extracts components from the app folder and sends them to XMCloud.
10
11
  * @param {ExtractFilesConfig} args - Config for components extraction
@@ -32,7 +33,7 @@ function _extractFiles(args = {}) {
32
33
  const renderingHost = process.env.SITECORE_RENDERINGHOST_NAME;
33
34
  return async ({ scConfig }) => {
34
35
  if (!scConfig) {
35
- throw new Error('Sitecore configuration is required to be provided');
36
+ throw new Error(ERROR_MESSAGES.MV_008);
36
37
  }
37
38
  if ((args.customValidateDeployContext && !args.customValidateDeployContext()) ||
38
39
  !validateDeployContext()) {
@@ -50,7 +51,7 @@ function _extractFiles(args = {}) {
50
51
  const targetUrl = scConfig.api.edge.edgeUrl;
51
52
  const { accessToken } = await auth.clientCredentialsFlow(authParams);
52
53
  if (!accessToken) {
53
- console.error(chalk.red('Failed to get access token, aborting code extraction'));
54
+ console.error(chalk.red(`Failed to get access token, aborting code extraction. ${ERROR_MESSAGES.CONTACT_SUPPORT}`));
54
55
  return;
55
56
  }
56
57
  // Resolve files from component-map
@@ -91,7 +92,7 @@ function _extractFiles(args = {}) {
91
92
  .join('\r\n')}`));
92
93
  }
93
94
  catch (error) {
94
- console.warn(chalk.yellow('Error during code extraction:', error, error.stack));
95
+ console.warn(chalk.yellow(`Error during code extraction:`, error, error.stack, ERROR_MESSAGES.CONTACT_SUPPORT));
95
96
  }
96
97
  };
97
98
  }
@@ -5,6 +5,8 @@ import { debug } from '@sitecore-content-sdk/core';
5
5
  import { getComponentList } from './../templating';
6
6
  import crypto from 'crypto';
7
7
  import { isNodeModuleImportOrAlias, getRelativeImportPath } from './utils';
8
+ import { constants } from '@sitecore-content-sdk/core';
9
+ const { ERROR_MESSAGES } = constants;
8
10
  let _getComponentList = getComponentList;
9
11
  const aliasImport = /^([a-zA-Z0-9]+) as .+$/;
10
12
  export const unitMocks = ({ getComponentListStub, }) => {
@@ -210,19 +212,11 @@ const prepImportMaps = async (paths, separateMaps) => {
210
212
  ? componentPath
211
213
  : path.resolve(appPath, componentPath);
212
214
  // read the start of the file that may be 'use client'
213
- const firstLine = await new Promise((resolve) => {
214
- let readBuffer = '';
215
- const stream = fs.createReadStream(fullPath, { end: 12 });
216
- stream
217
- .on('data', async (chunk) => {
218
- readBuffer += chunk.toString();
219
- })
220
- .on('close', () => resolve(readBuffer))
221
- .on('error', () => resolve(''));
222
- });
223
- if (!firstLine)
215
+ const fileContent = await fs.promises.readFile(fullPath, 'utf8');
216
+ if (!fileContent)
224
217
  continue;
225
- if (firstLine.match(/['"]use client['"]/)) {
218
+ // check if 'use client' directive is present, ignoring any comments or whitespace before it
219
+ if (fileContent.match(/^(?:\s|\/\/[^\n]*\n|\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\/)*['"]use client['"]/)) {
226
220
  clientPaths.push(fullPath);
227
221
  }
228
222
  else {
@@ -244,7 +238,7 @@ export const writeImportMap = (args) => {
244
238
  const defaultTemplate = args.defaultTemplate || defaultMapTemplate;
245
239
  const clientTemplate = args.clientTemplate || defaultMapTemplate;
246
240
  if (!scConfig) {
247
- throw new Error('Sitecore configuration is required to be provided');
241
+ throw new Error(ERROR_MESSAGES.MV_008);
248
242
  }
249
243
  if (scConfig.disableCodeGeneration) {
250
244
  debug.common('Skipping import map generation. Code generation functionality is disabled.');
@@ -3,8 +3,9 @@ import chalk from 'chalk';
3
3
  import path from 'path';
4
4
  import fs from 'fs';
5
5
  import * as ts from 'typescript';
6
- import { debug } from '@sitecore-content-sdk/core';
6
+ import { debug, constants } from '@sitecore-content-sdk/core';
7
7
  import { isBuiltin } from 'module';
8
+ const { ERROR_MESSAGES } = constants;
8
9
  /**
9
10
  * Parse the generated component-map file and return all referenced modules
10
11
  * per map entry (handles both single identifiers and spread objects).
@@ -342,7 +343,7 @@ async function _sendCode({ file, token, targetUrl, }) {
342
343
  }
343
344
  }
344
345
  catch (error) {
345
- console.error(chalk.red(`Fetch request to send extracted code from ${file.path} failed: ${JSON.stringify(error)}`));
346
+ console.error(chalk.red(`Fetch request to send extracted code from ${file.path} failed: ${JSON.stringify(error)}. ${ERROR_MESSAGES.CONTACT_SUPPORT}`));
346
347
  return null;
347
348
  }
348
349
  return file.path;
@@ -2,9 +2,11 @@ import path from 'path';
2
2
  import chalk from 'chalk';
3
3
  import fs from 'fs';
4
4
  import { ensurePathExists } from '@sitecore-content-sdk/core/node-tools';
5
+ import { constants } from '@sitecore-content-sdk/core';
5
6
  import { SiteInfoService } from '../site';
6
7
  import { createGraphQLClientFactory } from '../client';
7
8
  import debug from '../debug';
9
+ const { ERROR_MESSAGES } = constants;
8
10
  const DEFAULT_SITES_DIST_PATH = '.sitecore/sites.json';
9
11
  /**
10
12
  * Generates site information and writes it to a specified destination path.
@@ -15,7 +17,7 @@ const DEFAULT_SITES_DIST_PATH = '.sitecore/sites.json';
15
17
  export const generateSites = ({ destinationPath } = {}) => {
16
18
  return async ({ scConfig }) => {
17
19
  if (!scConfig) {
18
- throw new Error('Sitecore configuration is required to be provided');
20
+ throw new Error(ERROR_MESSAGES.MV_008);
19
21
  }
20
22
  let sites = [];
21
23
  const sitesFilePath = path.resolve(destinationPath !== null && destinationPath !== void 0 ? destinationPath : DEFAULT_SITES_DIST_PATH);
@@ -34,7 +36,7 @@ export const generateSites = ({ destinationPath } = {}) => {
34
36
  sites = await siteInfoService.fetchSiteInfo();
35
37
  }
36
38
  catch (error) {
37
- console.error(chalk.red('Error fetching site information'));
39
+ console.error(chalk.red(`Failed to fetch site information. ${ERROR_MESSAGES.CONTACT_SUPPORT}`));
38
40
  throw error;
39
41
  }
40
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/content",
3
- "version": "2.0.0-canary.9",
3
+ "version": "2.0.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -36,7 +36,7 @@
36
36
  "url": "https://github.com/sitecore/content-sdk/issues"
37
37
  },
38
38
  "devDependencies": {
39
- "@sitecore-cloudsdk/events": "^0.5.1",
39
+ "@sitecore-content-sdk/events": "^2.0.0",
40
40
  "@stylistic/eslint-plugin": "^5.2.2",
41
41
  "@types/chai": "^5.2.2",
42
42
  "@types/chai-spies": "^1.0.6",
@@ -74,10 +74,10 @@
74
74
  "typescript": "~5.8.3"
75
75
  },
76
76
  "peerDependencies": {
77
- "@sitecore-cloudsdk/events": "^0.5.1"
77
+ "@sitecore-content-sdk/events": "^2.0.0"
78
78
  },
79
79
  "dependencies": {
80
- "@sitecore-content-sdk/core": "2.0.0-canary.9",
80
+ "@sitecore-content-sdk/core": "^2.0.0",
81
81
  "chalk": "^4.1.2",
82
82
  "debug": "^4.4.0",
83
83
  "glob": "^11.0.2",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "description": "",
88
88
  "types": "types/index.d.ts",
89
- "gitHead": "152ff7ce9979733dfe56ec6872fd8b466370d594",
89
+ "gitHead": "492d7d718c965bbfe394d6c12c2e4870220cf4bf",
90
90
  "files": [
91
91
  "dist",
92
92
  "types",
@@ -1 +1 @@
1
- {"version":3,"file":"sitecore-client.d.ts","sourceRoot":"","sources":["../../src/client/sitecore-client.ts"],"names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,CAAC;AAG5E;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,cAiDnC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CA8BlE;AA6HD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,mBAAmB,KAAG,cAe1D,CAAC"}
1
+ {"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../../src/config/define-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAK5E;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,cAiDnC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CA8BlE;AAsHD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,mBAAmB,KAAG,cAe1D,CAAC"}
@@ -1,7 +1,3 @@
1
- /** @private */
2
- export declare const siteNameError = "The site name must be a non-empty string";
3
- /** @private */
4
- export declare const languageError = "The language must be a non-empty string";
5
1
  /**
6
2
  * Hidden rendering name
7
3
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,eAAO,MAAM,aAAa,6CAA6C,CAAC;AACxE,eAAe;AACf,eAAO,MAAM,aAAa,4CAA4C,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC"}
@@ -1,2 +1,2 @@
1
- export { addComponentPreviewHandler, addServerComponentPreviewHandler, getDesignLibraryComponentPreviewErrorEvent, getDesignLibraryComponentPropsEvent, getDesignLibraryImportMapEvent, getImportMapInfo, addStyleElement, createComponentInstance, sendErrorEvent, DesignLibraryPreviewError, ImportEntry, ImportEntryInfo, GeneratedComponentData, ComponentPreviewEventArgs, ServerComponentPreviewEventArgs, fetchGeneratedComponentFromCache, } from './preview';
1
+ export { addComponentPreviewHandler, addServerComponentPreviewHandler, getDesignLibraryErrorEvent, getDesignLibraryComponentPropsEvent, getDesignLibraryImportMapEvent, getImportMapInfo, addStyleElement, createComponentInstance, sendErrorEvent, DesignLibraryPreviewError, ImportEntry, ImportEntryInfo, GeneratedComponentData, ComponentPreviewEventArgs, ServerComponentPreviewEventArgs, fetchGeneratedComponentFromCache, } from './preview';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editing/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,0CAA0C,EAC1C,mCAAmC,EACnC,8BAA8B,EAC9B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editing/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,0BAA0B,EAC1B,mCAAmC,EACnC,8BAA8B,EAC9B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,gCAAgC,GACjC,MAAM,WAAW,CAAC"}