@sitecore-content-sdk/react 2.0.0-canary.15 → 2.0.0-canary.17

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 (39) hide show
  1. package/dist/cjs/components/DesignLibrary/DesignLibraryErrorBoundary.js +6 -0
  2. package/dist/cjs/components/DesignLibrary/index.js +3 -3
  3. package/dist/cjs/components/ErrorBoundary.js +1 -0
  4. package/dist/cjs/components/Placeholder/PlaceholderMetadata.js +1 -0
  5. package/dist/cjs/index.js +6 -3
  6. package/dist/esm/components/DesignLibrary/DesignLibraryErrorBoundary.js +6 -0
  7. package/dist/esm/components/DesignLibrary/index.js +1 -1
  8. package/dist/esm/components/ErrorBoundary.js +1 -0
  9. package/dist/esm/components/Placeholder/PlaceholderMetadata.js +1 -0
  10. package/dist/esm/index.js +3 -2
  11. package/package.json +5 -5
  12. package/types/components/DesignLibrary/DesignLibraryErrorBoundary.d.ts +13 -0
  13. package/types/components/DesignLibrary/DesignLibraryErrorBoundary.d.ts.map +1 -1
  14. package/types/components/DesignLibrary/index.d.ts +2 -1
  15. package/types/components/DesignLibrary/index.d.ts.map +1 -1
  16. package/types/components/DesignLibrary/models.d.ts +13 -61
  17. package/types/components/DesignLibrary/models.d.ts.map +1 -1
  18. package/types/components/ErrorBoundary.d.ts +1 -0
  19. package/types/components/ErrorBoundary.d.ts.map +1 -1
  20. package/types/components/Placeholder/PlaceholderMetadata.d.ts +1 -0
  21. package/types/components/Placeholder/PlaceholderMetadata.d.ts.map +1 -1
  22. package/types/index.d.ts +3 -2
  23. package/types/index.d.ts.map +1 -1
  24. package/dist/cjs/components/DesignLibrary/DesignLibraryApp.js +0 -31
  25. package/dist/cjs/components/DesignLibrary/DesignLibraryClientEvents.js +0 -139
  26. package/dist/cjs/components/DesignLibrary/DesignLibraryServer.js +0 -218
  27. package/dist/cjs/server-actions/update-server-component-action.js +0 -51
  28. package/dist/esm/components/DesignLibrary/DesignLibraryApp.js +0 -24
  29. package/dist/esm/components/DesignLibrary/DesignLibraryClientEvents.js +0 -100
  30. package/dist/esm/components/DesignLibrary/DesignLibraryServer.js +0 -175
  31. package/dist/esm/server-actions/update-server-component-action.js +0 -47
  32. package/types/components/DesignLibrary/DesignLibraryApp.d.ts +0 -14
  33. package/types/components/DesignLibrary/DesignLibraryApp.d.ts.map +0 -1
  34. package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts +0 -21
  35. package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts.map +0 -1
  36. package/types/components/DesignLibrary/DesignLibraryServer.d.ts +0 -38
  37. package/types/components/DesignLibrary/DesignLibraryServer.d.ts.map +0 -1
  38. package/types/server-actions/update-server-component-action.d.ts +0 -58
  39. package/types/server-actions/update-server-component-action.d.ts.map +0 -1
@@ -37,6 +37,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.DesignLibraryErrorBoundary = void 0;
38
38
  const react_1 = __importStar(require("react"));
39
39
  const codegen_1 = require("@sitecore-content-sdk/content/codegen");
40
+ /**
41
+ * Error boundary for the Design Library component.
42
+ * Catches errors during rendering and sends them to the Design Library
43
+ * @param {DesignLibraryErrorBoundaryProps} props - The props for the error boundary, including the component UID and children to render.
44
+ * @internal
45
+ */
40
46
  class DesignLibraryErrorBoundary extends react_1.default.Component {
41
47
  constructor() {
42
48
  super(...arguments);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DesignLibraryApp = exports.DesignLibrary = void 0;
3
+ exports.DesignLibraryErrorBoundary = exports.DesignLibrary = void 0;
4
4
  var DesignLibrary_1 = require("./DesignLibrary");
5
5
  Object.defineProperty(exports, "DesignLibrary", { enumerable: true, get: function () { return DesignLibrary_1.DesignLibrary; } });
6
- var DesignLibraryApp_1 = require("./DesignLibraryApp");
7
- Object.defineProperty(exports, "DesignLibraryApp", { enumerable: true, get: function () { return DesignLibraryApp_1.DesignLibraryApp; } });
6
+ var DesignLibraryErrorBoundary_1 = require("./DesignLibraryErrorBoundary");
7
+ Object.defineProperty(exports, "DesignLibraryErrorBoundary", { enumerable: true, get: function () { return DesignLibraryErrorBoundary_1.DesignLibraryErrorBoundary; } });
@@ -40,6 +40,7 @@ const SitecoreProvider_1 = require("./SitecoreProvider");
40
40
  /**
41
41
  * Simple error component applying basic error styling.
42
42
  * @param {object} props - Either with `message` (string) or with `children` (ReactNode), but not both.
43
+ * @internal
43
44
  */
44
45
  const ErrorComponent = (props) => {
45
46
  return (react_1.default.createElement("div", { className: "sc-content-sdk-placeholder-error" }, props.message ? props.message : props.children));
@@ -17,6 +17,7 @@ const editing_1 = require("@sitecore-content-sdk/content/editing");
17
17
  * @param {'server' | 'client'} [props.componentRuntime] Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes.
18
18
  * @param {JSX.Element} props.children The child components or elements to be wrapped by the metadata code blocks.
19
19
  * @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
20
+ * @internal
20
21
  */
21
22
  const PlaceholderMetadata = ({ rendering, placeholderName, children, componentRuntime, }) => {
22
23
  const getCodeBlockAttributes = ({ kind, id, placeholderName, }) => {
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withAppPlaceholder = exports.withEmptyFieldEditingComponent = exports.withFieldMetadata = exports.withDatasourceCheck = exports.withSitecore = exports.withEditorChromes = exports.useSitecore = exports.SitecoreProviderReactContext = exports.SitecoreProvider = exports.File = exports.Link = exports.DesignLibraryApp = exports.DesignLibrary = exports.BYOCServerWrapper = exports.FEaaSServerWrapper = exports.FEaaSClientWrapper = exports.FEaaSWrapper = exports.BYOCClientWrapper = exports.BYOCWrapper = exports.fetchBYOCComponentServerProps = exports.BYOCComponent = exports.fetchFEaaSComponentServerProps = exports.FEaaSComponent = exports.DateField = exports.Text = exports.RichText = exports.Image = exports.renderEmptyPlaceholder = exports.AppPlaceholder = exports.Placeholder = exports.Form = exports.mediaApi = exports.ErrorPage = exports.GraphQLRequestClient = exports.DefaultRetryStrategy = exports.DictionaryService = exports.EditMode = exports.getFieldValue = exports.getChildPlaceholder = exports.LayoutService = exports.LayoutServicePageState = exports.getDesignLibraryStylesheetLinks = exports.getContentStylesheetLink = exports.resetEditorChromes = exports.isEditorActive = exports.NativeDataFetcher = exports.MemoryCacheClient = exports.ClientError = exports.enableDebug = exports.constants = void 0;
4
- exports.SitePathService = exports.ClientEditingChromesUpdate = exports.DefaultEmptyFieldEditingComponentImage = exports.DefaultEmptyFieldEditingComponentText = exports.EditingScripts = exports.withPlaceholder = void 0;
3
+ exports.withFieldMetadata = exports.withDatasourceCheck = exports.withSitecore = exports.withEditorChromes = exports.ErrorComponent = exports.useSitecore = exports.SitecoreProviderReactContext = exports.SitecoreProvider = exports.File = exports.Link = exports.DesignLibraryErrorBoundary = exports.DesignLibrary = exports.BYOCServerWrapper = exports.FEaaSServerWrapper = exports.FEaaSClientWrapper = exports.FEaaSWrapper = exports.BYOCClientWrapper = exports.BYOCWrapper = exports.fetchBYOCComponentServerProps = exports.BYOCComponent = exports.fetchFEaaSComponentServerProps = exports.FEaaSComponent = exports.DateField = exports.Text = exports.RichText = exports.Image = exports.renderEmptyPlaceholder = exports.PlaceholderMetadata = exports.AppPlaceholder = exports.Placeholder = exports.Form = exports.mediaApi = exports.ErrorPage = exports.GraphQLRequestClient = exports.DefaultRetryStrategy = exports.DictionaryService = exports.EditMode = exports.getFieldValue = exports.getChildPlaceholder = exports.LayoutService = exports.LayoutServicePageState = exports.getDesignLibraryStylesheetLinks = exports.getContentStylesheetLink = exports.resetEditorChromes = exports.isEditorActive = exports.NativeDataFetcher = exports.MemoryCacheClient = exports.ClientError = exports.enableDebug = exports.constants = void 0;
4
+ exports.SitePathService = exports.ClientEditingChromesUpdate = exports.DefaultEmptyFieldEditingComponentImage = exports.DefaultEmptyFieldEditingComponentText = exports.EditingScripts = exports.withPlaceholder = exports.withAppPlaceholder = exports.withEmptyFieldEditingComponent = void 0;
5
5
  var core_1 = require("@sitecore-content-sdk/core");
6
6
  Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return core_1.constants; } });
7
7
  Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function () { return core_1.enableDebug; } });
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "Form", { enumerable: true, get: function () { re
32
32
  var Placeholder_1 = require("./components/Placeholder");
33
33
  Object.defineProperty(exports, "Placeholder", { enumerable: true, get: function () { return Placeholder_1.Placeholder; } });
34
34
  Object.defineProperty(exports, "AppPlaceholder", { enumerable: true, get: function () { return Placeholder_1.AppPlaceholder; } });
35
+ Object.defineProperty(exports, "PlaceholderMetadata", { enumerable: true, get: function () { return Placeholder_1.PlaceholderMetadata; } });
35
36
  Object.defineProperty(exports, "renderEmptyPlaceholder", { enumerable: true, get: function () { return Placeholder_1.renderEmptyPlaceholder; } });
36
37
  var Image_1 = require("./components/Image");
37
38
  Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return Image_1.Image; } });
@@ -55,7 +56,7 @@ Object.defineProperty(exports, "FEaaSServerWrapper", { enumerable: true, get: fu
55
56
  Object.defineProperty(exports, "BYOCServerWrapper", { enumerable: true, get: function () { return FEaaS_1.BYOCServerWrapper; } });
56
57
  var DesignLibrary_1 = require("./components/DesignLibrary");
57
58
  Object.defineProperty(exports, "DesignLibrary", { enumerable: true, get: function () { return DesignLibrary_1.DesignLibrary; } });
58
- Object.defineProperty(exports, "DesignLibraryApp", { enumerable: true, get: function () { return DesignLibrary_1.DesignLibraryApp; } });
59
+ Object.defineProperty(exports, "DesignLibraryErrorBoundary", { enumerable: true, get: function () { return DesignLibrary_1.DesignLibraryErrorBoundary; } });
59
60
  var Link_1 = require("./components/Link");
60
61
  Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
61
62
  var File_1 = require("./components/File");
@@ -64,6 +65,8 @@ var SitecoreProvider_1 = require("./components/SitecoreProvider");
64
65
  Object.defineProperty(exports, "SitecoreProvider", { enumerable: true, get: function () { return SitecoreProvider_1.SitecoreProvider; } });
65
66
  Object.defineProperty(exports, "SitecoreProviderReactContext", { enumerable: true, get: function () { return SitecoreProvider_1.SitecoreProviderReactContext; } });
66
67
  Object.defineProperty(exports, "useSitecore", { enumerable: true, get: function () { return SitecoreProvider_1.useSitecore; } });
68
+ var ErrorBoundary_1 = require("./components/ErrorBoundary");
69
+ Object.defineProperty(exports, "ErrorComponent", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorComponent; } });
67
70
  var withEditorChromes_1 = require("./enhancers/withEditorChromes");
68
71
  Object.defineProperty(exports, "withEditorChromes", { enumerable: true, get: function () { return withEditorChromes_1.withEditorChromes; } });
69
72
  var withSitecore_1 = require("./enhancers/withSitecore");
@@ -1,6 +1,12 @@
1
1
  'use client';
2
2
  import React, { Suspense } from 'react';
3
3
  import { DesignLibraryPreviewError, sendErrorEvent } from '@sitecore-content-sdk/content/codegen';
4
+ /**
5
+ * Error boundary for the Design Library component.
6
+ * Catches errors during rendering and sends them to the Design Library
7
+ * @param {DesignLibraryErrorBoundaryProps} props - The props for the error boundary, including the component UID and children to render.
8
+ * @internal
9
+ */
4
10
  export class DesignLibraryErrorBoundary extends React.Component {
5
11
  constructor() {
6
12
  super(...arguments);
@@ -1,2 +1,2 @@
1
1
  export { DesignLibrary } from './DesignLibrary';
2
- export { DesignLibraryApp } from './DesignLibraryApp';
2
+ export { DesignLibraryErrorBoundary } from './DesignLibraryErrorBoundary';
@@ -4,6 +4,7 @@ import { useSitecore } from './SitecoreProvider';
4
4
  /**
5
5
  * Simple error component applying basic error styling.
6
6
  * @param {object} props - Either with `message` (string) or with `children` (ReactNode), but not both.
7
+ * @internal
7
8
  */
8
9
  export const ErrorComponent = (props) => {
9
10
  return (React.createElement("div", { className: "sc-content-sdk-placeholder-error" }, props.message ? props.message : props.children));
@@ -11,6 +11,7 @@ import { MetadataKind, DEFAULT_PLACEHOLDER_UID } from '@sitecore-content-sdk/con
11
11
  * @param {'server' | 'client'} [props.componentRuntime] Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes.
12
12
  * @param {JSX.Element} props.children The child components or elements to be wrapped by the metadata code blocks.
13
13
  * @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
14
+ * @internal
14
15
  */
15
16
  export const PlaceholderMetadata = ({ rendering, placeholderName, children, componentRuntime, }) => {
16
17
  const getCodeBlockAttributes = ({ kind, id, placeholderName, }) => {
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { DictionaryService } from '@sitecore-content-sdk/content/i18n';
5
5
  export { DefaultRetryStrategy, GraphQLRequestClient, ErrorPage, } from '@sitecore-content-sdk/content/client';
6
6
  export { mediaApi } from '@sitecore-content-sdk/content/media';
7
7
  export { Form } from './components/Form';
8
- export { Placeholder, AppPlaceholder, renderEmptyPlaceholder, } from './components/Placeholder';
8
+ export { Placeholder, AppPlaceholder, PlaceholderMetadata, renderEmptyPlaceholder, } from './components/Placeholder';
9
9
  export { Image, } from './components/Image';
10
10
  export { RichText } from './components/RichText';
11
11
  export { Text } from './components/Text';
@@ -13,10 +13,11 @@ export { DateField } from './components/Date';
13
13
  export { FEaaSComponent, fetchFEaaSComponentServerProps, BYOCComponent, fetchBYOCComponentServerProps,
14
14
  // leaving original names for backward compatibility
15
15
  BYOCWrapper, BYOCWrapper as BYOCClientWrapper, FEaaSWrapper, FEaaSWrapper as FEaaSClientWrapper, FEaaSServerWrapper, BYOCServerWrapper, } from './components/FEaaS';
16
- export { DesignLibrary, DesignLibraryApp } from './components/DesignLibrary';
16
+ export { DesignLibrary, DesignLibraryErrorBoundary, } from './components/DesignLibrary';
17
17
  export { Link } from './components/Link';
18
18
  export { File } from './components/File';
19
19
  export { SitecoreProvider, SitecoreProviderReactContext, useSitecore, } from './components/SitecoreProvider';
20
+ export { ErrorComponent } from './components/ErrorBoundary';
20
21
  export { withEditorChromes } from './enhancers/withEditorChromes';
21
22
  export { withSitecore } from './enhancers/withSitecore';
22
23
  export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/react",
3
- "version": "2.0.0-canary.15",
3
+ "version": "2.0.0-canary.17",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -77,14 +77,14 @@
77
77
  "react-dom": "^19.2.1"
78
78
  },
79
79
  "dependencies": {
80
- "@sitecore-content-sdk/content": "2.0.0-canary.15",
81
- "@sitecore-content-sdk/core": "2.0.0-canary.15",
82
- "@sitecore-content-sdk/search": "0.2.0-canary.25",
80
+ "@sitecore-content-sdk/content": "2.0.0-canary.17",
81
+ "@sitecore-content-sdk/core": "2.0.0-canary.17",
82
+ "@sitecore-content-sdk/search": "0.2.0-canary.27",
83
83
  "fast-deep-equal": "^3.1.3"
84
84
  },
85
85
  "description": "",
86
86
  "types": "types/index.d.ts",
87
- "gitHead": "1159415b0cb719120735fa7d33e0aaac46a65cdb",
87
+ "gitHead": "876d8a1cdf0eaf830942209c3ee81143c0463ec2",
88
88
  "files": [
89
89
  "dist",
90
90
  "types",
@@ -1,9 +1,22 @@
1
1
  import React from 'react';
2
+ /**
3
+ * Props for the DesignLibraryErrorBoundary component.
4
+ * @property {string} uid - The unique identifier of the component being rendered.
5
+ * @property {React.ReactNode} children - The child components to render within the error boundary.
6
+ * @property {number} [renderKey] - An optional key to trigger re-rendering of the error boundary when changed.
7
+ * @internal
8
+ */
2
9
  type DesignLibraryErrorBoundaryProps = {
3
10
  uid: string;
4
11
  children: React.ReactNode;
5
12
  renderKey?: number;
6
13
  };
14
+ /**
15
+ * Error boundary for the Design Library component.
16
+ * Catches errors during rendering and sends them to the Design Library
17
+ * @param {DesignLibraryErrorBoundaryProps} props - The props for the error boundary, including the component UID and children to render.
18
+ * @internal
19
+ */
7
20
  export declare class DesignLibraryErrorBoundary extends React.Component<DesignLibraryErrorBoundaryProps> {
8
21
  state: {
9
22
  hasError: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"DesignLibraryErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,KAAK,+BAA+B,GAAG;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,+BAA+B,CAAC;IAC9F,KAAK;;MAEH;IAEF,MAAM,CAAC,wBAAwB;;;IAI/B,kBAAkB,CAAC,SAAS,EAAE,+BAA+B;IAM7D,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAI9B,MAAM;CAOP"}
1
+ {"version":3,"file":"DesignLibraryErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC;;;;;;GAMG;AACH,KAAK,+BAA+B,GAAG;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,+BAA+B,CAAC;IAC9F,KAAK;;MAEH;IAEF,MAAM,CAAC,wBAAwB;;;IAI/B,kBAAkB,CAAC,SAAS,EAAE,+BAA+B;IAM7D,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAI9B,MAAM;CAOP"}
@@ -1,3 +1,4 @@
1
1
  export { DesignLibrary } from './DesignLibrary';
2
- export { DesignLibraryApp } from './DesignLibraryApp';
2
+ export { DesignLibraryErrorBoundary } from './DesignLibraryErrorBoundary';
3
+ export { DynamicComponent, ImportMapImport } from './models';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
@@ -1,68 +1,20 @@
1
- import { DesignLibraryPreviewError, GeneratedComponentData, ImportEntry, ImportEntryInfo } from '@sitecore-content-sdk/content/codegen';
2
- import { ComponentFields, ComponentParams, ComponentRendering, RouteData } from '@sitecore-content-sdk/content/layout';
3
- import { DesignLibraryStatus } from '@sitecore-content-sdk/content/editing';
4
- import { Page } from '@sitecore-content-sdk/content/client';
5
- import { ComponentMap } from '../sharedTypes';
6
- export type ImportMapImport = {
7
- default: ImportEntry[];
8
- };
1
+ import { ComponentFields, ComponentParams } from '@sitecore-content-sdk/content/layout';
2
+ import { ImportEntry } from '@sitecore-content-sdk/content/codegen';
3
+ /**
4
+ * Model representing a dynamically generated component in the Design Library.
5
+ * This model includes the component's fields and parameters, which are used for rendering and interaction within the Design Library.
6
+ * @internal
7
+ */
9
8
  export type DynamicComponent = React.ComponentType<{
10
9
  [key: string]: unknown;
11
10
  fields?: ComponentFields;
12
11
  params?: ComponentParams;
13
12
  }>;
14
- export type DesignLibraryServerProps = {
15
- /**
16
- * Component Map will be used to map Sitecore component names to app implementation
17
- */
18
- componentMap: ComponentMap;
19
- /**
20
- * Rendering data to be used when rendering the placeholder.
21
- */
22
- rendering: ComponentRendering | RouteData;
23
- /**
24
- * Page data.
25
- */
26
- page: Page;
27
- /**
28
- * The dynamic import for sever import map to be used in variant generation mode.
29
- */
30
- loadServerImportMap: () => Promise<ImportMapImport>;
31
- };
32
- export type DesingLibraryAppProps = DesignLibraryServerProps;
33
- export type DesignLibraryServerPreviewProps = Omit<DesignLibraryServerProps, 'loadServerImportMap'>;
34
- export type DesignLibraryServerVariantGenerationProps = DesignLibraryServerProps;
35
- export type DesignLibraryPreviewEventsProps = {
36
- /**
37
- * The design library status to be posted as a message to the Design Studio.
38
- */
39
- designLibraryStatus: DesignLibraryStatus;
40
- /**
41
- * The component rendering data that is being edited in the Design Studio.
42
- */
43
- component: ComponentRendering;
44
- };
45
- export type DesignLibraryVariantGenerationEventsProps = DesignLibraryPreviewEventsProps & {
46
- /**
47
- * The import map info to be posted as a message to the Design Studio.
48
- */
49
- importMap?: ImportEntryInfo[];
50
- /**
51
- * Any error that occurred during initialization of the component:
52
- * - importMap error
53
- * - error fetching the generated component data from secured endpoint
54
- * - error during generation or rendering of the component on the server side
55
- */
56
- componentInitError?: ServerComponentInitError;
57
- /**
58
- * The generated component data received from design library.
59
- */
60
- generatedComponentData?: GeneratedComponentData;
61
- };
62
- export type ServerComponentInitError = {
63
- /** The type of error, as defined in DesignLibraryPreviewError. */
64
- type: DesignLibraryPreviewError;
65
- /** The error message. */
66
- message: string;
13
+ /**
14
+ * Model representing the import map in the Design Library.
15
+ * @internal
16
+ */
17
+ export type ImportMapImport = {
18
+ default: ImportEntry[];
67
19
  };
68
20
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,WAAW,EACX,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB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AE,sBAAsB,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,kEAAkE;IAClE,IAAI,EAAE,yBAAyB,CAAC;IAChC,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC"}
@@ -16,6 +16,7 @@ export type ErrorBoundaryProps = {
16
16
  /**
17
17
  * Simple error component applying basic error styling.
18
18
  * @param {object} props - Either with `message` (string) or with `children` (ReactNode), but not both.
19
+ * @internal
19
20
  */
20
21
  export declare const ErrorComponent: (props: {
21
22
  message: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,KAAK,mBAAmB,GAAG;IACzB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GA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AAG,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC;IAC3F,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,OACI;IAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAC9C;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,sBAOnD,CAAC;AAwEF,QAAA,MAAM,aAAa,GAAI,OAAO,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,sBAI7D,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -30,6 +30,7 @@ export type CodeBlockAttributes = {
30
30
  * @param {'server' | 'client'} [props.componentRuntime] Component runtime type. Used to add data-csdk-component-runtime attribute to rendering chromes.
31
31
  * @param {JSX.Element} props.children The child components or elements to be wrapped by the metadata code blocks.
32
32
  * @returns {JSX.Element} A React fragment containing open and close code blocks surrounding the children elements.
33
+ * @internal
33
34
  */
34
35
  export declare const PlaceholderMetadata: ({ rendering, placeholderName, children, componentRuntime, }: PlaceholderMetadataProps) => JSX.Element;
35
36
  //# sourceMappingURL=PlaceholderMetadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceholderMetadata.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/PlaceholderMetadata.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAGnB,MAAM,sCAAsC,CAAC;AAG9C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,Q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kEjC,CAAC"}
package/types/index.d.ts CHANGED
@@ -7,17 +7,18 @@ export { GraphQLClientError, RetryStrategy, DefaultRetryStrategy, GraphQLRequest
7
7
  export { mediaApi } from '@sitecore-content-sdk/content/media';
8
8
  export { Form } from './components/Form';
9
9
  export { ReactContentSdkComponent, ComponentMap, ReactModule } from './components/sharedTypes';
10
- export { Placeholder, PlaceholderProps, PlaceholderProps as PlaceholderComponentProps, AppPlaceholder, AppPlaceholderProps, renderEmptyPlaceholder, } from './components/Placeholder';
10
+ export { Placeholder, PlaceholderProps, PlaceholderProps as PlaceholderComponentProps, AppPlaceholder, PlaceholderMetadata, AppPlaceholderProps, renderEmptyPlaceholder, } from './components/Placeholder';
11
11
  export { Image, ImageProps, ImageField, ImageFieldValue, ImageSizeParameters, } from './components/Image';
12
12
  export { RichText, RichTextProps, RichTextField } from './components/RichText';
13
13
  export { Text, TextField } from './components/Text';
14
14
  export { DateField, DateFieldProps } from './components/Date';
15
15
  export { FEaaSComponent, FEaaSComponentProps, FEaaSComponentParams, fetchFEaaSComponentServerProps, BYOCComponent, BYOCComponentParams, BYOCComponentProps, fetchBYOCComponentServerProps, BYOCWrapper, BYOCWrapper as BYOCClientWrapper, FEaaSWrapper, FEaaSWrapper as FEaaSClientWrapper, FEaaSServerWrapper, BYOCServerWrapper, } from './components/FEaaS';
16
- export { DesignLibrary, DesignLibraryApp } from './components/DesignLibrary';
16
+ export { DesignLibrary, DesignLibraryErrorBoundary, DynamicComponent, ImportMapImport, } from './components/DesignLibrary';
17
17
  export {} from './components/FEaaS/BYOCComponent';
18
18
  export { Link, LinkField, LinkFieldValue, LinkProps } from './components/Link';
19
19
  export { File, FileField } from './components/File';
20
20
  export { SitecoreProvider, SitecoreProviderState, SitecoreProviderReactContext, useSitecore, } from './components/SitecoreProvider';
21
+ export { ErrorComponent } from './components/ErrorBoundary';
21
22
  export { withEditorChromes } from './enhancers/withEditorChromes';
22
23
  export { withSitecore } from './enhancers/withSitecore';
23
24
  export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,SAAS,EACT,KAAK,EACL,IAAI,EACJ,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,QAAQ,GACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC1F,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,iCAAiC,EACjC,oBAAoB,EACpB,QAAQ,EACR,SAAS,EACT,IAAI,GACL,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,gBAAgB,IAAI,yBAAyB,EAC7C,cAAc,EACd,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,EACL,UAAU,EACV,UAAU,EACV,eAAe,EACf,mBAAmB,GACpB,MAAM,oBAAoB,CA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E,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DesignLibraryApp = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const layout_1 = require("@sitecore-content-sdk/content/layout");
9
- const DesignLibraryServer_1 = require("./DesignLibraryServer");
10
- const DesignLibrary_1 = require("./DesignLibrary");
11
- /**
12
- * Design Library component intended to be used by the NextJs app router application
13
- * This component serves as a router between client and server component rendering modes for the Design Library.
14
- * It inspects the component type from the component map and
15
- * delegates to the appropriate rendering implementation:
16
- * - Client components are rendered using the `DesignLibrary` component
17
- * - Server components are rendered using the `DesignLibraryServer` component
18
- * @param {DesingLibraryAppProps} props - The properties for the Design Library App.
19
- * @public
20
- */
21
- const DesignLibraryApp = ({ page, componentMap, loadServerImportMap, }) => {
22
- var _a;
23
- const { route } = page.layout.sitecore;
24
- if (!route)
25
- return null;
26
- const rendering = (_a = route === null || route === void 0 ? void 0 : route.placeholders[layout_1.EDITING_COMPONENT_PLACEHOLDER]) === null || _a === void 0 ? void 0 : _a[0];
27
- const component = componentMap.get((rendering === null || rendering === void 0 ? void 0 : rendering.componentName) || '');
28
- const isClient = component && component.componentType === 'client';
29
- return (react_1.default.createElement(react_1.default.Fragment, null, isClient ? (react_1.default.createElement(DesignLibrary_1.DesignLibrary, null)) : (react_1.default.createElement(DesignLibraryServer_1.DesignLibraryServer, { page: page, componentMap: componentMap, loadServerImportMap: loadServerImportMap, rendering: route }))));
30
- };
31
- exports.DesignLibraryApp = DesignLibraryApp;
@@ -1,139 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.DesignLibraryVariantGenerationEvents = exports.DesignLibraryPreviewEvents = exports.__mockDependencies = void 0;
38
- const react_1 = __importStar(require("react"));
39
- const dlHelpers = __importStar(require("@sitecore-content-sdk/content/editing"));
40
- const codegen = __importStar(require("@sitecore-content-sdk/content/codegen"));
41
- const update_server_component_action_1 = require("../../server-actions/update-server-component-action");
42
- const SitecoreProvider_1 = require("../SitecoreProvider");
43
- let { getDesignLibraryComponentPropsEvent, addServerComponentPreviewHandler, getDesignLibraryImportMapEvent, addStyleElement, sendErrorEvent, } = codegen;
44
- let { getDesignLibraryStatusEvent, addComponentUpdateHandler, postToDesignLibrary } = dlHelpers;
45
- let _updateComponentAction = update_server_component_action_1.updateComponentAction;
46
- let _previewComponentAction = update_server_component_action_1.previewComponentAction;
47
- const __mockDependencies = (mocks) => {
48
- postToDesignLibrary = mocks.postToDesignLibrary;
49
- addComponentUpdateHandler = mocks.addComponentUpdateHandler;
50
- _updateComponentAction = mocks.updateComponentAction;
51
- _previewComponentAction = mocks.previewComponentAction;
52
- addServerComponentPreviewHandler = mocks.addServerComponentPreviewHandler;
53
- getDesignLibraryImportMapEvent = mocks.getDesignLibraryImportMapEvent;
54
- getDesignLibraryComponentPropsEvent = mocks.getDesignLibraryComponentPropsEvent;
55
- addStyleElement = mocks.addStyleElement;
56
- sendErrorEvent = mocks.sendErrorEvent;
57
- };
58
- exports.__mockDependencies = __mockDependencies;
59
- /**
60
- * Design Library component for rendering server components in app router application.
61
- * DesignLibraryPreviewEvents component serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
62
- * It posts messages to Design Library Studio and sets up handlers to receive updates and previews which are then passed to the server component via server function updateServerComponentAction.
63
- * @param {DesignLibraryPreviewEventsProps} props The props. {@link DesignLibraryPreviewEventsProps}
64
- * @returns {JSX.Element} empty JSX element.
65
- */
66
- const DesignLibraryPreviewEvents = ({ designLibraryStatus, component, }) => {
67
- (0, react_1.useEffect)(() => {
68
- if (!(component === null || component === void 0 ? void 0 : component.uid))
69
- return;
70
- postToDesignLibrary(getDesignLibraryStatusEvent(designLibraryStatus, component.uid, true));
71
- const unsubUpdate = addComponentUpdateHandler(component, (rendering) => {
72
- _updateComponentAction({ uid: rendering.uid, rendering });
73
- });
74
- return () => {
75
- unsubUpdate && unsubUpdate();
76
- };
77
- }, [component, designLibraryStatus]);
78
- return react_1.default.createElement(react_1.default.Fragment, null);
79
- };
80
- exports.DesignLibraryPreviewEvents = DesignLibraryPreviewEvents;
81
- /**
82
- * Design Library component for rendering server components in app router application.
83
- * DesignLibraryVariantGenerationEvents component serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side in variant generation mode.
84
- * It posts messages to Design Library Studio and sets up handlers to receive updates and previews which are then passed to the server component via server function updateServerComponentAction.
85
- * If the import map is not present then the import map error will be sent to Design Studio.
86
- * @param {DesignLibraryVariantGenerationEventsProps} props The props. {@link DesignLibraryVariantGenerationEventsProps}
87
- * @returns {JSX.Element} empty JSX element.
88
- */
89
- const DesignLibraryVariantGenerationEvents = ({ designLibraryStatus, component, importMap, componentInitError, generatedComponentData, }) => {
90
- var _a;
91
- const { api } = (0, SitecoreProvider_1.useSitecore)();
92
- const edgeUrl = (_a = api === null || api === void 0 ? void 0 : api.edge) === null || _a === void 0 ? void 0 : _a.edgeUrl;
93
- (0, react_1.useEffect)(() => {
94
- var _a;
95
- if (!(component === null || component === void 0 ? void 0 : component.uid))
96
- return;
97
- postToDesignLibrary(getDesignLibraryStatusEvent(designLibraryStatus, component.uid, true));
98
- const unsubUpdate = addComponentUpdateHandler(component, (rendering) => {
99
- _updateComponentAction({
100
- uid: rendering.uid,
101
- rendering,
102
- generatedComponentData,
103
- });
104
- });
105
- const unsubPreview = addServerComponentPreviewHandler((eventArgs) => {
106
- _previewComponentAction({
107
- uid: component.uid,
108
- args: eventArgs,
109
- }, edgeUrl);
110
- });
111
- if (componentInitError) {
112
- // an error occurred during initialization of the component on the server side
113
- sendErrorEvent(component.uid, componentInitError.message, componentInitError.type);
114
- }
115
- else {
116
- const importMapEvent = getDesignLibraryImportMapEvent(component.uid, importMap);
117
- postToDesignLibrary(importMapEvent);
118
- const propsEvent = getDesignLibraryComponentPropsEvent(component.uid, component.fields, component.params);
119
- postToDesignLibrary(propsEvent);
120
- if ((_a = generatedComponentData === null || generatedComponentData === void 0 ? void 0 : generatedComponentData.styles) === null || _a === void 0 ? void 0 : _a.content) {
121
- // the generated component has custom styles, so add the css in style element and add it to document head
122
- addStyleElement(generatedComponentData.styles.content);
123
- }
124
- }
125
- return () => {
126
- unsubUpdate && unsubUpdate();
127
- unsubPreview && unsubPreview();
128
- };
129
- }, [
130
- component,
131
- designLibraryStatus,
132
- importMap,
133
- componentInitError,
134
- generatedComponentData,
135
- edgeUrl,
136
- ]);
137
- return react_1.default.createElement(react_1.default.Fragment, null);
138
- };
139
- exports.DesignLibraryVariantGenerationEvents = DesignLibraryVariantGenerationEvents;