@sitecore-content-sdk/content 2.2.1 → 2.3.0-beta.atoms.20260721120640

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 (82) hide show
  1. package/atoms.d.ts +1 -0
  2. package/dist/cjs/atoms/design-library-bridge/constants.js +18 -0
  3. package/dist/cjs/atoms/design-library-bridge/events.js +88 -0
  4. package/dist/cjs/atoms/design-library-bridge/index.js +18 -0
  5. package/dist/cjs/atoms/index.js +8 -0
  6. package/dist/cjs/atoms/types.js +2 -0
  7. package/dist/cjs/client/sitecore-client.js +6 -1
  8. package/dist/cjs/config/define-config.js +55 -86
  9. package/dist/cjs/config/index.js +1 -4
  10. package/dist/cjs/editing/models.js +2 -0
  11. package/dist/cjs/form/form.js +2 -2
  12. package/dist/cjs/layout/index.js +0 -15
  13. package/dist/cjs/site/index.js +1 -2
  14. package/dist/cjs/site/utils.js +0 -34
  15. package/dist/cjs/tools/index.js +1 -3
  16. package/dist/cjs/tools/templating/components.js +3 -13
  17. package/dist/cjs/tools/templating/index.js +1 -4
  18. package/dist/esm/atoms/design-library-bridge/constants.js +15 -0
  19. package/dist/esm/atoms/design-library-bridge/events.js +80 -0
  20. package/dist/esm/atoms/design-library-bridge/index.js +2 -0
  21. package/dist/esm/atoms/index.js +1 -0
  22. package/dist/esm/atoms/types.js +1 -0
  23. package/dist/esm/client/sitecore-client.js +6 -1
  24. package/dist/esm/config/define-config.js +56 -86
  25. package/dist/esm/config/index.js +1 -1
  26. package/dist/esm/editing/models.js +2 -0
  27. package/dist/esm/form/form.js +2 -2
  28. package/dist/esm/layout/index.js +0 -1
  29. package/dist/esm/site/index.js +1 -1
  30. package/dist/esm/site/utils.js +0 -33
  31. package/dist/esm/tools/index.js +1 -1
  32. package/dist/esm/tools/templating/components.js +2 -11
  33. package/dist/esm/tools/templating/index.js +0 -1
  34. package/package.json +38 -34
  35. package/types/atoms/design-library-bridge/constants.d.ts +16 -0
  36. package/types/atoms/design-library-bridge/constants.d.ts.map +1 -0
  37. package/types/atoms/design-library-bridge/events.d.ts +41 -0
  38. package/types/atoms/design-library-bridge/events.d.ts.map +1 -0
  39. package/types/atoms/design-library-bridge/index.d.ts +3 -0
  40. package/types/atoms/design-library-bridge/index.d.ts.map +1 -0
  41. package/types/atoms/design-library-bridge/types.d.ts +63 -0
  42. package/types/atoms/design-library-bridge/types.d.ts.map +1 -0
  43. package/types/atoms/index.d.ts +3 -0
  44. package/types/atoms/index.d.ts.map +1 -0
  45. package/types/atoms/types.d.ts +68 -0
  46. package/types/atoms/types.d.ts.map +1 -0
  47. package/types/client/edge-proxy.d.ts.map +1 -1
  48. package/types/client/sitecore-client.d.ts +4 -0
  49. package/types/client/sitecore-client.d.ts.map +1 -1
  50. package/types/config/define-config.d.ts +2 -17
  51. package/types/config/define-config.d.ts.map +1 -1
  52. package/types/config/index.d.ts +1 -1
  53. package/types/config/index.d.ts.map +1 -1
  54. package/types/config/models.d.ts +17 -1
  55. package/types/config/models.d.ts.map +1 -1
  56. package/types/editing/models.d.ts +3 -1
  57. package/types/editing/models.d.ts.map +1 -1
  58. package/types/form/form.d.ts +1 -1
  59. package/types/form/form.d.ts.map +1 -1
  60. package/types/layout/content-styles.d.ts.map +1 -1
  61. package/types/layout/index.d.ts +0 -1
  62. package/types/layout/index.d.ts.map +1 -1
  63. package/types/layout/rewrite-edge-host.d.ts.map +1 -1
  64. package/types/layout/themes.d.ts.map +1 -1
  65. package/types/site/index.d.ts +1 -1
  66. package/types/site/index.d.ts.map +1 -1
  67. package/types/site/utils.d.ts +0 -11
  68. package/types/site/utils.d.ts.map +1 -1
  69. package/types/tools/index.d.ts +1 -1
  70. package/types/tools/index.d.ts.map +1 -1
  71. package/types/tools/templating/components.d.ts +2 -8
  72. package/types/tools/templating/components.d.ts.map +1 -1
  73. package/types/tools/templating/index.d.ts +0 -1
  74. package/types/tools/templating/index.d.ts.map +1 -1
  75. package/dist/cjs/tools/templating/utils.js +0 -167
  76. package/dist/esm/tools/templating/utils.js +0 -159
  77. package/types/layout/field-types.d.ts +0 -75
  78. package/types/layout/field-types.d.ts.map +0 -1
  79. package/types/tools/templating/utils.d.ts +0 -44
  80. package/types/tools/templating/utils.d.ts.map +0 -1
  81. /package/dist/cjs/{layout/field-types.js → atoms/design-library-bridge/types.js} +0 -0
  82. /package/dist/esm/{layout/field-types.js → atoms/design-library-bridge/types.js} +0 -0
@@ -379,7 +379,7 @@ export class SitecoreClient {
379
379
  isPreview: false,
380
380
  isEditing: false,
381
381
  isDesignLibrary: false,
382
- designLibrary: { isVariantGeneration: false },
382
+ designLibrary: { isVariantGeneration: false, isLowCode: false },
383
383
  };
384
384
  switch (mode) {
385
385
  case LayoutServicePageState.Normal:
@@ -398,6 +398,11 @@ export class SitecoreClient {
398
398
  pageMode.isDesignLibrary = true;
399
399
  pageMode.isEditing = true;
400
400
  break;
401
+ case DesignLibraryMode.LowCode:
402
+ pageMode.isDesignLibrary = true;
403
+ pageMode.designLibrary.isLowCode = true;
404
+ pageMode.isEditing = true;
405
+ break;
401
406
  default:
402
407
  break;
403
408
  }
@@ -1,94 +1,65 @@
1
- import { DefaultRetryStrategy, constants } from '@sitecore-content-sdk/core';
2
- import { resolveEdgeUrl, SITECORE_EDGE_PLATFORM_HOSTNAME_ENV, } from '@sitecore-content-sdk/core/tools';
1
+ import { constants, DefaultRetryStrategy } from '@sitecore-content-sdk/core';
2
+ import { resolveEdgeUrl } from '@sitecore-content-sdk/core/tools';
3
3
  import { SITECORE_CLI_MODE_ENV_VAR } from '../config-cli';
4
4
  const { ERROR_MESSAGES } = constants;
5
5
  /**
6
- * Default Sitecore config values sourced from an env-like record (e.g. `process.env` or
7
- * values mapped from an Angular `environment` object). Shared by {@link getFallbackConfig}
8
- * and framework-specific define-config wrappers.
9
- * @param {Record<string, string | undefined>} env - String key/value map using the same names as Node / Sitecore CLI env vars
10
- * @returns {SitecoreConfig} default config before merging `sitecore.config` overrides
11
- * @internal
6
+ * Provides default initial values for SitecoreConfig
7
+ * @returns default config
12
8
  */
13
- export const buildFallbackConfig = (env) => {
14
- const rawEdgeUrl = env.CSDK_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME || env[SITECORE_EDGE_PLATFORM_HOSTNAME_ENV];
15
- return {
16
- api: {
17
- edge: {
18
- contextId: env.SITECORE_EDGE_CONTEXT_ID || '',
19
- clientContextId: env.SITECORE_EDGE_CLIENT_CONTEXT_ID || env.CSDK_PUBLIC_SITECORE_EDGE_CONTEXT_ID || '',
20
- edgeUrl: resolveEdgeUrl(rawEdgeUrl),
21
- },
22
- local: {
23
- apiKey: env.SITECORE_API_KEY ||
24
- env.CSDK_PUBLIC_SITECORE_API_KEY ||
25
- env.NEXT_PUBLIC_SITECORE_API_KEY ||
26
- '',
27
- apiHost: env.SITECORE_API_HOST ||
28
- env.CSDK_PUBLIC_SITECORE_API_HOST ||
29
- env.NEXT_PUBLIC_SITECORE_API_HOST ||
30
- '',
31
- path: '/sitecore/api/graph/edge',
32
- },
33
- },
34
- editingSecret: env.SITECORE_EDITING_SECRET || 'editing-secret-missing',
35
- retries: {
36
- count: 3,
37
- retryStrategy: new DefaultRetryStrategy({
38
- statusCodes: [429, 502, 503, 504, 520, 521, 522, 523, 524],
39
- }),
9
+ export const getFallbackConfig = () => ({
10
+ api: {
11
+ edge: {
12
+ contextId: process.env.SITECORE_EDGE_CONTEXT_ID || '',
13
+ clientContextId: '',
14
+ edgeUrl: resolveEdgeUrl(),
40
15
  },
41
- redirects: {
42
- enabled: env.NODE_ENV !== 'development',
43
- locales: ['en'],
16
+ local: {
17
+ apiKey: process.env.SITECORE_API_KEY || process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
18
+ apiHost: process.env.SITECORE_API_HOST || process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
19
+ path: '/sitecore/api/graph/edge',
44
20
  },
45
- multisite: {
21
+ },
22
+ editingSecret: process.env.SITECORE_EDITING_SECRET || 'editing-secret-missing',
23
+ retries: {
24
+ count: 3,
25
+ retryStrategy: new DefaultRetryStrategy({
26
+ statusCodes: [429, 502, 503, 504, 520, 521, 522, 523, 524],
27
+ }),
28
+ },
29
+ redirects: {
30
+ enabled: process.env.NODE_ENV !== 'development',
31
+ locales: ['en'],
32
+ },
33
+ multisite: {
34
+ enabled: true,
35
+ useCookieResolution: () => false,
36
+ },
37
+ personalize: {
38
+ enabled: process.env.NODE_ENV !== 'development',
39
+ edgeTimeout: parseInt(process.env.PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT, 10) || 400,
40
+ cdpTimeout: parseInt(process.env.PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT, 10) || 400,
41
+ scope: '',
42
+ channel: 'WEB',
43
+ currency: 'USD',
44
+ },
45
+ defaultSite: '',
46
+ defaultLanguage: 'en',
47
+ layout: {
48
+ formatLayoutQuery: null,
49
+ },
50
+ dictionary: {
51
+ caching: {
46
52
  enabled: true,
47
- useCookieResolution: () => false,
48
- },
49
- personalize: {
50
- enabled: env.NODE_ENV !== 'development',
51
- edgeTimeout: parseInt(env.PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT || '', 10) || 400,
52
- cdpTimeout: parseInt(env.PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT || '', 10) || 400,
53
- scope: env.SITECORE_PERSONALIZE_SCOPE ||
54
- env.CSDK_PUBLIC_PERSONALIZE_SCOPE ||
55
- env.NEXT_PUBLIC_PERSONALIZE_SCOPE ||
56
- '',
57
- channel: 'WEB',
58
- currency: 'USD',
59
- },
60
- defaultSite: env.SITECORE_DEFAULT_SITE ||
61
- env.CSDK_PUBLIC_SITECORE_DEFAULT_SITE ||
62
- env.CSDK_PUBLIC_DEFAULT_SITE ||
63
- '',
64
- defaultLanguage: env.SITECORE_DEFAULT_LANGUAGE || env.CSDK_PUBLIC_DEFAULT_LANGUAGE || 'en',
65
- layout: {
66
- formatLayoutQuery: null,
67
- },
68
- dictionary: {
69
- caching: {
70
- enabled: true,
71
- timeout: 60,
72
- },
53
+ timeout: 60,
73
54
  },
74
- rewriteMediaUrls: false,
75
- disableCodeGeneration: false,
76
- };
77
- };
78
- /**
79
- * Provides default initial values for SitecoreConfig from `process.env`
80
- * TODO: remove in favor of buildFallbackConfig
81
- * @returns default config
82
- * @internal
83
- */
84
- export const getFallbackConfig = () => {
85
- return buildFallbackConfig(process.env);
86
- };
55
+ },
56
+ rewriteMediaUrls: false,
57
+ disableCodeGeneration: false,
58
+ });
87
59
  /**
88
60
  * Deep merge utility that skips undefined or empty string values in the override.
89
61
  * @param {T} base base value
90
62
  * @param {DeepPartial<T>} [override] override value
91
- * @internal
92
63
  */
93
64
  export function deepMerge(base, override) {
94
65
  if (!override)
@@ -131,7 +102,9 @@ const resolveConfig = (base, override) => {
131
102
  result.personalize.edgeTimeout = base.personalize.edgeTimeout;
132
103
  }
133
104
  // Resolve edge URL at config level so consumers use the resolved value directly
134
- result.api.edge.edgeUrl = resolveEdgeUrl(result.api.edge.edgeUrl);
105
+ result.api.edge.edgeUrl = result.api.edge.edgeUrl
106
+ ? resolveEdgeUrl(result.api.edge.edgeUrl)
107
+ : resolveEdgeUrl();
135
108
  return result;
136
109
  };
137
110
  const validateApiConfiguration = (config) => {
@@ -204,15 +177,12 @@ const createConfigProxy = (config) => {
204
177
  /**
205
178
  * Accepts a SitecoreConfigInput object and returns full sitecore configuration
206
179
  * @param {SitecoreConfigInput} config override values to be written over default config settings
207
- * @param {Record<string, string | undefined>} [env] optional env-like record to source default config values from; defaults to `process.env` when not provided
208
180
  * @returns {SitecoreConfig} full sitecore configuration to use in application
209
181
  * @public
210
182
  */
211
- export const defineConfig = (config = {}, env) => {
212
- const runtimeEnv = env || (typeof process !== 'undefined' ? process.env : {});
213
- const fallback = buildFallbackConfig(runtimeEnv);
214
- const resolvedConfig = resolveConfig(fallback, config);
215
- const isCLI = (runtimeEnv === null || runtimeEnv === void 0 ? void 0 : runtimeEnv[SITECORE_CLI_MODE_ENV_VAR]) === 'true';
183
+ export const defineConfig = (config) => {
184
+ const resolvedConfig = resolveConfig(getFallbackConfig(), config);
185
+ const isCLI = process.env[SITECORE_CLI_MODE_ENV_VAR] === 'true';
216
186
  // At `build time`, we create a proxy for the config object to validate the config by
217
187
  // accessing the literal paths instead of validating the whole object at once.
218
188
  // At `runtime` all the config should be validated to fail fast in case of invalid configuration.
@@ -1,2 +1,2 @@
1
1
  export { ComponentTemplateType, } from './models';
2
- export { buildFallbackConfig, defineConfig, getFallbackConfig, deepMerge, } from './define-config';
2
+ export { defineConfig } from './define-config';
@@ -30,6 +30,8 @@ export var DesignLibraryMode;
30
30
  DesignLibraryMode["Normal"] = "library";
31
31
  /** Metadata mode */
32
32
  DesignLibraryMode["Metadata"] = "library-metadata";
33
+ /** Low code mode */
34
+ DesignLibraryMode["LowCode"] = "library-low-code";
33
35
  })(DesignLibraryMode || (DesignLibraryMode = {}));
34
36
  /**
35
37
  * Variant generation mode for Design Library
@@ -63,12 +63,12 @@ export const executeScriptElements = (rootElement) => {
63
63
  * @param {string} [componentId] - The unique identifier of the component
64
64
  * @internal
65
65
  */
66
- export const subscribeToFormSubmitEvent = (formElement, componentId, signal) => {
66
+ export const subscribeToFormSubmitEvent = (formElement, componentId) => {
67
67
  formElement.addEventListener('form:engage', ((e) => {
68
68
  const { formId, name } = e.detail;
69
69
  if (formId && name) {
70
70
  debug.form('Sending form event', formId, name);
71
71
  form(formId, name, (componentId === null || componentId === void 0 ? void 0 : componentId.replace(/-/g, '')) || '');
72
72
  }
73
- }), { signal });
73
+ }));
74
74
  };
@@ -5,4 +5,3 @@ export { getContentStylesheetLink } from './content-styles';
5
5
  export { LayoutService, GRAPHQL_LAYOUT_QUERY_NAME } from './layout-service';
6
6
  export { getDesignLibraryStylesheetLinks } from './themes';
7
7
  export { rewriteEdgeHostInResponse, containsDefaultEdgeHost, getDefaultMediaUrlTransformer, applyMediaUrlRewrite, } from './rewrite-edge-host';
8
- export * from './field-types';
@@ -4,5 +4,5 @@ export { SitemapXmlService, } from './sitemap-xml-service';
4
4
  export { ErrorPagesService } from './error-pages-service';
5
5
  export { SiteInfoService } from './siteinfo-service';
6
6
  export { SitePathService } from './sitepath-service';
7
- export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SITE_PREFIX, SITE_KEY, getHostnameFromHostHeader, } from './utils';
7
+ export { getSiteRewrite, getSiteRewriteData, normalizeSiteRewrite, SITE_PREFIX, SITE_KEY, } from './utils';
8
8
  export { SiteResolver } from './site-resolver';
@@ -8,39 +8,6 @@ export const SITE_PREFIX = '_site_';
8
8
  * @public
9
9
  */
10
10
  export const SITE_KEY = 'sc_site';
11
- /**
12
- * Hostname from a `Host` or `x-forwarded-host` value, without port.
13
- * - `[::1]:3000` → `::1`
14
- * - `127.0.0.1:3000` → `127.0.0.1`
15
- * - `example.com:443` → `example.com`
16
- * - `::1` → `::1` (does not treat `:1` as a port)
17
- * @param {string} host - Raw header value
18
- * @returns {string} The hostname
19
- * @internal
20
- */
21
- export function getHostnameFromHostHeader(host) {
22
- const trimmed = host.trim();
23
- // Bracketed IPv6: "[...]:port" or "[...]"
24
- if (trimmed.startsWith('[')) {
25
- const end = trimmed.indexOf(']');
26
- if (end !== -1) {
27
- return trimmed.slice(1, end).toLowerCase();
28
- }
29
- }
30
- // Unbracketed IPv6 (e.g. ::1, 2001:db8::1) — never strip on last ":digits"
31
- if (trimmed.includes('::')) {
32
- return trimmed.toLowerCase();
33
- }
34
- // IPv4 or DNS name with ":port" (port = decimal digits only)
35
- const lastColon = trimmed.lastIndexOf(':');
36
- if (lastColon > 0) {
37
- const after = trimmed.slice(lastColon + 1);
38
- if (/^\d+$/.test(after)) {
39
- return trimmed.slice(0, lastColon).toLowerCase();
40
- }
41
- }
42
- return trimmed.toLowerCase();
43
- }
44
11
  /**
45
12
  * Get a site rewrite path for given pathname
46
13
  * @param {string} pathname the pathname
@@ -1,2 +1,2 @@
1
1
  export { getComponentSpec, getComponentSpecUrl } from './codegen/component-generation';
2
- export { filterComponentsByType, prepareComponentsForMap, buildComponentMapContent, } from './templating';
2
+ export { filterComponentsByType, } from './templating';
@@ -13,15 +13,6 @@ export const componentUnitMocks = {
13
13
  };
14
14
  const componentNamePattern = /^[\/]*(.+[\/\\])*(.+)\.[jt]sx?$/;
15
15
  const componentPathPattern = /^([\/]*.+[\/\\].+)\..+$/;
16
- /**
17
- * Converts string to PascalCase.
18
- * @param {string} name - kebab-case, snake_case, dot.notation, camelCase, or PascalCase string (e.g. `my-component`, `my_component`, `my.component`, `myComponent`)
19
- * @returns {string} PascalCase string (e.g. `MyComponent`)
20
- */
21
- export const toPascalCase = (name) => name
22
- .split(/[-_]/)
23
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
24
- .join('');
25
16
  /**
26
17
  * Get list of components from @var path
27
18
  * Returns a list of components in the following format:
@@ -47,8 +38,8 @@ function _getComponentList(paths, exclude, includeVariants) {
47
38
  return {
48
39
  filePath,
49
40
  importPath: filePath.match(componentPathPattern)[1].replace(/\\/g, '/'), // use forward slashes for consistency
50
- componentName: toPascalCase(name),
51
- moduleName: toPascalCase(name).replace(/[^\w]+/g, ''),
41
+ componentName: name,
42
+ moduleName: name.replace(/[^\w]+/g, ''),
52
43
  };
53
44
  }));
54
45
  }, []);
@@ -1,2 +1 @@
1
1
  export { getComponentList, filterComponentsByType, } from './components';
2
- export { prepareComponentsForMap, buildComponentMapContent } from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/content",
3
- "version": "2.2.1",
3
+ "version": "2.3.0-beta.atoms.20260721120640",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -15,7 +15,7 @@
15
15
  "test": "mocha \"./src/**/*.test.ts\"",
16
16
  "prepublishOnly": "npm run build",
17
17
  "coverage": "nyc npm test",
18
- "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/content --entryPoints src/index.ts --entryPoints src/config/index.ts --entryPoints src/config-cli/index.ts --entryPoints src/client/index.ts --entryPoints src/i18n/index.ts --entryPoints src/layout/index.ts --entryPoints src/media/index.ts --entryPoints src/personalize/index.ts --entryPoints src/site/index.ts --entryPoints src/editing/index.ts --entryPoints src/tools/index.ts --entryPoints src/tools/index-node.ts --entryPoints src/codegen/index.ts --githubPages false",
18
+ "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/content --entryPoints src/index.ts --entryPoints src/config/index.ts --entryPoints src/config-cli/index.ts --entryPoints src/client/index.ts --entryPoints src/i18n/index.ts --entryPoints src/layout/index.ts --entryPoints src/media/index.ts --entryPoints src/personalize/index.ts --entryPoints src/site/index.ts --entryPoints src/editing/index.ts --entryPoints src/atoms/index.ts --entryPoints src/tools/index.ts --entryPoints src/tools/index-node.ts --entryPoints src/codegen/index.ts --githubPages false",
19
19
  "api-extractor": "npm run build && api-extractor run --local --verbose",
20
20
  "api-extractor:verify": "api-extractor run"
21
21
  },
@@ -36,7 +36,7 @@
36
36
  "url": "https://github.com/sitecore/content-sdk/issues"
37
37
  },
38
38
  "devDependencies": {
39
- "@sitecore-content-sdk/events": "^2.1.1",
39
+ "@sitecore-content-sdk/events": "2.1.1-beta.atoms.20260721120640",
40
40
  "@stylistic/eslint-plugin": "^5.2.2",
41
41
  "@types/chai": "^5.2.2",
42
42
  "@types/chai-spies": "^1.0.6",
@@ -49,7 +49,6 @@
49
49
  "@types/proxyquire": "^1.3.31",
50
50
  "@types/sinon": "^17.0.4",
51
51
  "@types/sinon-chai": "^4.0.0",
52
- "@types/url-parse": "1.4.11",
53
52
  "@typescript-eslint/eslint-plugin": "8.39.0",
54
53
  "@typescript-eslint/parser": "8.39.0",
55
54
  "chai": "^4.4.1",
@@ -74,15 +73,15 @@
74
73
  "typescript": "~5.8.3"
75
74
  },
76
75
  "peerDependencies": {
77
- "@sitecore-content-sdk/events": "^2.1.1"
76
+ "@sitecore-content-sdk/events": "2.1.1-beta.atoms.20260721120640"
78
77
  },
79
78
  "dependencies": {
80
- "@sitecore-content-sdk/core": "^2.1.2",
79
+ "@json-render/core": "0.19.0",
80
+ "@sitecore-content-sdk/core": "2.1.2-beta.atoms.20260721120640",
81
81
  "chalk": "^4.1.2",
82
82
  "debug": "^4.4.0",
83
83
  "glob": "^13.0.0",
84
- "graphql": "^16.11.0",
85
- "url-parse": "^1.5.10"
84
+ "graphql": "^16.11.0"
86
85
  },
87
86
  "description": "",
88
87
  "types": "types/index.d.ts",
@@ -94,69 +93,74 @@
94
93
  ],
95
94
  "exports": {
96
95
  ".": {
97
- "types": "./types/index.d.ts",
98
96
  "import": "./dist/esm/index.js",
99
- "require": "./dist/cjs/index.js"
97
+ "require": "./dist/cjs/index.js",
98
+ "types": "./types/index.d.ts"
100
99
  },
101
100
  "./client": {
102
- "types": "./types/client/index.d.ts",
103
101
  "import": "./dist/esm/client/index.js",
104
- "require": "./dist/cjs/client/index.js"
102
+ "require": "./dist/cjs/client/index.js",
103
+ "types": "./types/client/index.d.ts"
105
104
  },
106
105
  "./config": {
107
- "types": "./types/config/index.d.ts",
108
106
  "import": "./dist/esm/config/index.js",
109
- "require": "./dist/cjs/config/index.js"
107
+ "require": "./dist/cjs/config/index.js",
108
+ "types": "./types/config/index.d.ts"
110
109
  },
111
110
  "./config-cli": {
112
- "types": "./types/config-cli/index.d.ts",
113
111
  "import": "./dist/esm/config-cli/index.js",
114
- "require": "./dist/cjs/config-cli/index.js"
112
+ "require": "./dist/cjs/config-cli/index.js",
113
+ "types": "./types/config-cli/index.d.ts"
115
114
  },
116
115
  "./codegen": {
117
- "types": "./types/editing/codegen/index.d.ts",
118
116
  "import": "./dist/esm/editing/codegen/index.js",
119
- "require": "./dist/cjs/editing/codegen/index.js"
117
+ "require": "./dist/cjs/editing/codegen/index.js",
118
+ "types": "./types/editing/codegen/index.d.ts"
119
+ },
120
+ "./atoms": {
121
+ "import": "./dist/esm/atoms/index.js",
122
+ "require": "./dist/cjs/atoms/index.js",
123
+ "types": "./types/atoms/index.d.ts"
120
124
  },
121
125
  "./editing": {
122
- "types": "./types/editing/index.d.ts",
123
126
  "import": "./dist/esm/editing/index.js",
124
- "require": "./dist/cjs/editing/index.js"
127
+ "require": "./dist/cjs/editing/index.js",
128
+ "types": "./types/editing/index.d.ts"
125
129
  },
126
130
  "./i18n": {
127
- "types": "./types/i18n/index.d.ts",
128
131
  "import": "./dist/esm/i18n/index.js",
129
- "require": "./dist/cjs/i18n/index.js"
132
+ "require": "./dist/cjs/i18n/index.js",
133
+ "types": "./types/i18n/index.d.ts"
130
134
  },
131
135
  "./layout": {
132
- "types": "./types/layout/index.d.ts",
133
136
  "import": "./dist/esm/layout/index.js",
134
- "require": "./dist/cjs/layout/index.js"
137
+ "require": "./dist/cjs/layout/index.js",
138
+ "types": "./types/layout/index.d.ts"
135
139
  },
136
140
  "./media": {
137
- "types": "./types/media/index.d.ts",
138
141
  "import": "./dist/esm/media/index.js",
139
- "require": "./dist/cjs/media/index.js"
142
+ "require": "./dist/cjs/media/index.js",
143
+ "types": "./types/media/index.d.ts"
140
144
  },
141
145
  "./personalize": {
142
- "types": "./types/personalize/index.d.ts",
143
146
  "import": "./dist/esm/personalize/index.js",
144
- "require": "./dist/cjs/personalize/index.js"
147
+ "require": "./dist/cjs/personalize/index.js",
148
+ "types": "./types/personalize/index.d.ts"
145
149
  },
146
150
  "./site": {
147
- "types": "./types/site/index.d.ts",
148
151
  "import": "./dist/esm/site/index.js",
149
- "require": "./dist/cjs/site/index.js"
152
+ "require": "./dist/cjs/site/index.js",
153
+ "types": "./types/site/index.d.ts"
150
154
  },
151
155
  "./tools": {
152
- "types": "./types/tools/index.d.ts",
153
156
  "import": "./dist/esm/tools/index.js",
154
- "require": "./dist/cjs/tools/index.js"
157
+ "require": "./dist/cjs/tools/index.js",
158
+ "types": "./types/tools/index.d.ts"
155
159
  },
156
160
  "./node-tools": {
157
- "types": "./types/tools/index-node.d.ts",
158
161
  "import": "./dist/esm/tools/index-node.js",
159
- "require": "./dist/cjs/tools/index-node.js"
162
+ "require": "./dist/cjs/tools/index-node.js",
163
+ "types": "./types/tools/index-node.d.ts"
160
164
  }
161
165
  }
162
166
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Event name for component preview updates from design library
3
+ * @internal
4
+ */
5
+ export declare const DESIGN_LIBRARY_COMPONENT_PREVIEW_EVENT_NAME = "component:atoms:preview";
6
+ /**
7
+ * Event name for the atoms catalog registration (replaces legacy `atom:registry`).
8
+ * @internal
9
+ */
10
+ export declare const DESIGN_LIBRARY_ATOMS_CATALOG_EVENT_NAME = "atoms:catalog";
11
+ /**
12
+ * Event to send to design library when rendering atoms error occurs
13
+ * @internal
14
+ */
15
+ export declare const DESIGN_LIBRARY_ATOMS_ERROR_EVENT_NAME = "atoms:error";
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/atoms/design-library-bridge/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,2CAA2C,4BAA4B,CAAC;AAErF;;;GAGG;AACH,eAAO,MAAM,uCAAuC,kBAAkB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,qCAAqC,gBAAgB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { ComponentUpdateEventArgs } from '../../editing/design-library';
2
+ import { Document, SerializedCatalog } from '../types';
3
+ import { DesignLibraryAtomsCatalogEvent, DesignLibraryAtomsError, DesignLibraryAtomsErrorEvent } from './types';
4
+ /**
5
+ * Creates a DesignLibraryAtomsCatalogEvent with the given catalog payload.
6
+ * @param {AtomsCatalogPayload} payload - serialized catalog data
7
+ * @returns {DesignLibraryAtomsCatalogEvent} the event ready to be posted to Design Studio
8
+ * @internal
9
+ */
10
+ export declare function getDesignLibraryAtomsCatalogEvent(payload: SerializedCatalog): DesignLibraryAtomsCatalogEvent;
11
+ /**
12
+ * Generates a DesignLibraryAtomsErrorEvent depending on the type of error with the given error.
13
+ * @param {unknown} error - The error to be sent.
14
+ * @param {DesignLibraryAtomsError} type - The type of error.
15
+ * @returns An object representing the DesignLibraryAtomsErrorEvent.
16
+ * @internal
17
+ */
18
+ export declare function getDesignLibraryAtomsErrorEvent(error: unknown, type: DesignLibraryAtomsError): DesignLibraryAtomsErrorEvent;
19
+ /**
20
+ * Sends a design library atoms error event to the design library
21
+ * @param {unknown} error - The error object or message to be sent.
22
+ * @param {DesignLibraryAtomsError} type - The type of error, as defined in DesignLibraryAtomsError.
23
+ * @internal
24
+ */
25
+ export declare const sendAtomsErrorEvent: (error: unknown, type: DesignLibraryAtomsError) => void;
26
+ /**
27
+ * Adds a handler for atom document update events from the design library.
28
+ * @param {(updatedRootComponent: Document) => void} callback - The callback to be invoked when a document update event is received.
29
+ * @returns A function to unsubscribe from the atom document update events.
30
+ * @internal
31
+ */
32
+ export declare const addDocumentUpdateHandler: (callback: (updatedRootComponent: Document) => void) => () => void;
33
+ /**
34
+ * Adds a handler for component props (fields and params) updates from the design library.
35
+ * Listens for 'component:update' events and invokes the callback with the updated fields and params.
36
+ * @param {Function} callback - Called when a 'component:update' message is received.
37
+ * @returns A function to unsubscribe from the event.
38
+ * @internal
39
+ */
40
+ export declare const addComponentPropsUpdateHandler: (callback: (fields: NonNullable<ComponentUpdateEventArgs["details"]>["fields"], params: NonNullable<ComponentUpdateEventArgs["details"]>["params"]) => void) => () => void;
41
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/atoms/design-library-bridge/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMvD,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAIjB;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,iBAAiB,GACzB,8BAA8B,CAKhC;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,uBAAuB,GAC5B,4BAA4B,CAK9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,EAAE,MAAM,uBAAuB,SAUhF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,CAAC,oBAAoB,EAAE,QAAQ,KAAK,IAAI,eAkB1F,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GACzC,UAAU,CACR,MAAM,EAAE,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE,MAAM,EAAE,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,KAC/D,IAAI,eAWV,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './events';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atoms/design-library-bridge/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { DesignLibraryEvent } from '../../editing/design-library';
2
+ import { DESIGN_LIBRARY_ATOMS_CATALOG_EVENT_NAME, DESIGN_LIBRARY_ATOMS_ERROR_EVENT_NAME } from './constants';
3
+ /**
4
+ * Enumeration of error types for the design library atoms.
5
+ * @internal
6
+ */
7
+ export type DesignLibraryAtomsError = 'render' | 'atoms-missing';
8
+ /**
9
+ * Represents a atom rendering error event to be sent to design library
10
+ * @internal
11
+ */
12
+ export interface DesignLibraryAtomsErrorEvent extends DesignLibraryEvent {
13
+ name: typeof DESIGN_LIBRARY_ATOMS_ERROR_EVENT_NAME;
14
+ message: {
15
+ error: unknown;
16
+ type: DesignLibraryAtomsError;
17
+ };
18
+ }
19
+ /**
20
+ * Serialized component entry in the catalog payload sent to Design Studio.
21
+ * @internal
22
+ */
23
+ export interface AtomCatalogEntry {
24
+ /** Component name (key in the catalog). */
25
+ name: string;
26
+ /** JSON Schema representation of the component props. */
27
+ propsSchema: object;
28
+ /** Human-readable description. */
29
+ description: string;
30
+ /** Named slots (children). */
31
+ slots: string[];
32
+ }
33
+ /**
34
+ * Serialized action entry in the catalog payload sent to Design Studio.
35
+ * @internal
36
+ */
37
+ export interface ActionCatalogEntry {
38
+ /** Action name (key in the catalog). */
39
+ name: string;
40
+ /** JSON Schema representation of the action params. */
41
+ paramsSchema: object;
42
+ /** Human-readable description. */
43
+ description: string;
44
+ }
45
+ /**
46
+ * Payload of the atoms:catalog event sent to Design Studio.
47
+ * @internal
48
+ */
49
+ export interface AtomsCatalogPayload {
50
+ /** Serialized component entries. */
51
+ components: AtomCatalogEntry[];
52
+ /** Serialized action entries. */
53
+ actions: ActionCatalogEntry[];
54
+ }
55
+ /**
56
+ * Represents the atoms:catalog event sent to Design Studio.
57
+ * @internal
58
+ */
59
+ export interface DesignLibraryAtomsCatalogEvent extends DesignLibraryEvent {
60
+ name: typeof DESIGN_LIBRARY_ATOMS_CATALOG_EVENT_NAME;
61
+ message: Record<string, unknown>;
62
+ }
63
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atoms/design-library-bridge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACL,uCAAuC,EACvC,qCAAqC,EACtC,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,eAAe,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE,IAAI,EAAE,OAAO,qCAAqC,CAAC;IACnD,OAAO,EAAE;QACP,KAAK,EAAE,OAAO,CAAC;QACf,IAAI,EAAE,uBAAuB,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;IACxE,IAAI,EAAE,OAAO,uCAAuC,CAAC;IACrD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ export type { SerializedCatalog, SitecoreComponentMeta, AtomCatalogComponentEntry, AtomCatalogActionEntry, Document, } from './types';
2
+ export { AtomCatalogEntry, ActionCatalogEntry, AtomsCatalogPayload, getDesignLibraryAtomsCatalogEvent, sendAtomsErrorEvent, DesignLibraryAtomsError, addDocumentUpdateHandler, addComponentPropsUpdateHandler, } from './design-library-bridge';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/atoms/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,QAAQ,GACT,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iCAAiC,EACjC,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC"}