@sitecore-content-sdk/react 2.0.0-canary.9 → 2.0.2-canary.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 (44) hide show
  1. package/dist/cjs/components/DesignLibrary/DesignLibrary.js +2 -2
  2. package/dist/cjs/components/DesignLibrary/DesignLibraryErrorBoundary.js +6 -0
  3. package/dist/cjs/components/DesignLibrary/index.js +3 -3
  4. package/dist/cjs/components/ErrorBoundary.js +1 -0
  5. package/dist/cjs/components/Form.js +4 -2
  6. package/dist/cjs/components/Placeholder/PlaceholderMetadata.js +1 -0
  7. package/dist/cjs/index.js +6 -3
  8. package/dist/esm/components/DesignLibrary/DesignLibrary.js +2 -2
  9. package/dist/esm/components/DesignLibrary/DesignLibraryErrorBoundary.js +6 -0
  10. package/dist/esm/components/DesignLibrary/index.js +1 -1
  11. package/dist/esm/components/ErrorBoundary.js +1 -0
  12. package/dist/esm/components/Form.js +4 -2
  13. package/dist/esm/components/Placeholder/PlaceholderMetadata.js +1 -0
  14. package/dist/esm/index.js +3 -2
  15. package/package.json +7 -6
  16. package/types/components/DesignLibrary/DesignLibraryErrorBoundary.d.ts +13 -0
  17. package/types/components/DesignLibrary/DesignLibraryErrorBoundary.d.ts.map +1 -1
  18. package/types/components/DesignLibrary/index.d.ts +2 -1
  19. package/types/components/DesignLibrary/index.d.ts.map +1 -1
  20. package/types/components/DesignLibrary/models.d.ts +13 -55
  21. package/types/components/DesignLibrary/models.d.ts.map +1 -1
  22. package/types/components/ErrorBoundary.d.ts +1 -0
  23. package/types/components/ErrorBoundary.d.ts.map +1 -1
  24. package/types/components/Form.d.ts.map +1 -1
  25. package/types/components/Placeholder/PlaceholderMetadata.d.ts +1 -0
  26. package/types/components/Placeholder/PlaceholderMetadata.d.ts.map +1 -1
  27. package/types/index.d.ts +3 -2
  28. package/types/index.d.ts.map +1 -1
  29. package/dist/cjs/components/DesignLibrary/DesignLibraryApp.js +0 -31
  30. package/dist/cjs/components/DesignLibrary/DesignLibraryClientEvents.js +0 -139
  31. package/dist/cjs/components/DesignLibrary/DesignLibraryServer.js +0 -212
  32. package/dist/cjs/server-actions/update-server-component-action.js +0 -51
  33. package/dist/esm/components/DesignLibrary/DesignLibraryApp.js +0 -24
  34. package/dist/esm/components/DesignLibrary/DesignLibraryClientEvents.js +0 -100
  35. package/dist/esm/components/DesignLibrary/DesignLibraryServer.js +0 -169
  36. package/dist/esm/server-actions/update-server-component-action.js +0 -47
  37. package/types/components/DesignLibrary/DesignLibraryApp.d.ts +0 -14
  38. package/types/components/DesignLibrary/DesignLibraryApp.d.ts.map +0 -1
  39. package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts +0 -21
  40. package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts.map +0 -1
  41. package/types/components/DesignLibrary/DesignLibraryServer.d.ts +0 -38
  42. package/types/components/DesignLibrary/DesignLibraryServer.d.ts.map +0 -1
  43. package/types/server-actions/update-server-component-action.d.ts +0 -58
  44. package/types/server-actions/update-server-component-action.d.ts.map +0 -1
@@ -1,169 +0,0 @@
1
- 'use server';
2
- import React from 'react';
3
- import { EDITING_COMPONENT_PLACEHOLDER } from '@sitecore-content-sdk/content/layout';
4
- import { DesignLibraryPreviewEvents, DesignLibraryVariantGenerationEvents, } from './DesignLibraryClientEvents';
5
- import * as globalCache from '@sitecore-content-sdk/core/tools';
6
- import { DesignLibraryStatus, COMPONENT_UPDATE_CACHE_KEY_PREFIX, COMPONENT_PREVIEW_CACHE_KEY_PREFIX, updateComponent as updateComponentOriginal, } from '@sitecore-content-sdk/content/editing';
7
- import * as codegen from '@sitecore-content-sdk/content/codegen';
8
- import { AppPlaceholder, PlaceholderMetadata } from '../Placeholder';
9
- import { DesignLibraryErrorBoundary } from './DesignLibraryErrorBoundary';
10
- import { ErrorComponent } from '../ErrorBoundary';
11
- let { getCacheAndClean, hasCache } = globalCache;
12
- let { createComponentInstance, getImportMapInfo } = codegen;
13
- let updateComponent = updateComponentOriginal;
14
- export const __mockDependencies = async (mocks) => {
15
- getCacheAndClean = mocks.getCacheAndClean;
16
- hasCache = mocks.hasCache;
17
- createComponentInstance = mocks.createComponentInstance;
18
- if (mocks.updateComponent) {
19
- updateComponent = mocks.updateComponent;
20
- }
21
- if (mocks.getImportMapInfo) {
22
- getImportMapInfo = mocks.getImportMapInfo;
23
- }
24
- };
25
- /**
26
- * Design Library component for rendering server components in app router application.
27
- *
28
- * Renders the **real** Sitecore component for `library` / `library-metadata` modes and,
29
- * when generation is enabled (`page.mode.designLibrary.isVariantGeneration === true`),
30
- * wires the **variant generation** handshake so the parent (Design Library) can send
31
- * generated code to preview and iterate on.
32
- * Also renders the DesignLibraryClientEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
33
- * @param {DesignLibraryServerProps} props The props. {@link DesignLibraryServerProps}
34
- * @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
35
- */
36
- export const DesignLibraryServer = async ({ page, componentMap, rendering, loadServerImportMap, }) => {
37
- var _a;
38
- if (!page.mode.isDesignLibrary) {
39
- return null;
40
- }
41
- const isVariantGeneration = (_a = page.mode.designLibrary) === null || _a === void 0 ? void 0 : _a.isVariantGeneration;
42
- if (isVariantGeneration) {
43
- return (React.createElement(DesignLibraryServerVariantGeneration, { page: page, rendering: rendering, loadServerImportMap: loadServerImportMap, componentMap: componentMap }));
44
- }
45
- return (React.createElement(DesignLibraryServerPreview, { page: page, rendering: rendering, componentMap: componentMap }));
46
- };
47
- /**
48
- * Design Library component for rendering server components in app router application in variant generation mode.
49
- *
50
- * Renders the **real** Sitecore component for `library` / `library-metadata` modes on first render and,
51
- * wires the **variant generation** handshake so the parent (Design Library) can send
52
- * generated code to preview and iterate on.
53
- * Also renders the DesignLibraryVariantGenerationEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
54
- * @param {DesignLibraryServerVariantGenerationProps} props The props. {@link DesignLibraryServerVariantGenerationProps}
55
- * @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
56
- */
57
- export const DesignLibraryServerVariantGeneration = async ({ page, rendering, loadServerImportMap, componentMap, }) => {
58
- var _a, _b;
59
- let designLibraryStatus = DesignLibraryStatus.READY;
60
- let importMap;
61
- let importMapInfo;
62
- let Component;
63
- let componentInitError;
64
- let generatedComponentData;
65
- // load importmap and importmap payload to pass to FE
66
- // if not provided, or errors during load set error to pass to FE
67
- if (!loadServerImportMap) {
68
- componentInitError = 'No loadImportMap provided';
69
- }
70
- else {
71
- try {
72
- const mod = await loadServerImportMap();
73
- importMap = mod.default;
74
- importMapInfo = getImportMapInfo(importMap);
75
- }
76
- catch (e) {
77
- componentInitError = `Error loading import map: ${e}`;
78
- }
79
- }
80
- let componentToUpdate = (_b = (_a = rendering === null || rendering === void 0 ? void 0 : rendering.placeholders) === null || _a === void 0 ? void 0 : _a[EDITING_COMPONENT_PLACEHOLDER]) === null || _b === void 0 ? void 0 : _b[0];
81
- if (!componentToUpdate)
82
- return React.createElement(ErrorComponent, { message: "Rendering data is missing" });
83
- if (!componentToUpdate.uid)
84
- return React.createElement(ErrorComponent, { message: "Rendering UID is missing in the rendering data" });
85
- const uid = componentToUpdate.uid;
86
- const componentUpdateKey = `${COMPONENT_UPDATE_CACHE_KEY_PREFIX}${uid}`;
87
- const componentPreviewKey = `${COMPONENT_PREVIEW_CACHE_KEY_PREFIX}${uid}`;
88
- // check if we have an update for this component in the global cache
89
- if (hasCache(componentUpdateKey)) {
90
- // we have fields/params update, get it and clean the cache
91
- designLibraryStatus = DesignLibraryStatus.RENDERED;
92
- const updateData = getCacheAndClean(componentUpdateKey);
93
- // apply the updates to the component rendering
94
- if (updateData === null || updateData === void 0 ? void 0 : updateData.rendering) {
95
- updateComponent(componentToUpdate, updateData.rendering.fields, updateData.rendering.params);
96
- }
97
- // generate the component instance if we are dealing with an AI-generated component
98
- if ((updateData === null || updateData === void 0 ? void 0 : updateData.generatedComponentData) && !componentInitError && importMap) {
99
- generatedComponentData = updateData.generatedComponentData;
100
- try {
101
- // use provided code and import map to create the component instance
102
- Component = createComponentInstance(importMap, updateData.generatedComponentData);
103
- }
104
- catch (error) {
105
- // error during component initialization - send error to client
106
- componentInitError = error.toString();
107
- }
108
- }
109
- }
110
- else if (hasCache(componentPreviewKey) && !componentInitError && importMap) {
111
- // we have a preview update, get it and clean the cache
112
- designLibraryStatus = DesignLibraryStatus.RENDERED;
113
- const previewData = getCacheAndClean(componentPreviewKey);
114
- componentInitError = previewData === null || previewData === void 0 ? void 0 : previewData.error;
115
- if (previewData === null || previewData === void 0 ? void 0 : previewData.generatedComponentData) {
116
- generatedComponentData = previewData.generatedComponentData;
117
- try {
118
- // use provided code and import map to create the component instance
119
- Component = createComponentInstance(importMap, previewData.generatedComponentData);
120
- }
121
- catch (error) {
122
- // error during component initialization - send error to client
123
- componentInitError = error.toString();
124
- }
125
- }
126
- }
127
- return (React.createElement(React.Fragment, null,
128
- Component ? (React.createElement(DesignLibraryErrorBoundary, { uid: componentToUpdate.uid },
129
- React.createElement(PlaceholderMetadata, { rendering: componentToUpdate },
130
- React.createElement(Component, { fields: componentToUpdate.fields, params: componentToUpdate.params, key: Date.now() })))) : (React.createElement(AppPlaceholder, { name: EDITING_COMPONENT_PLACEHOLDER, page: page, rendering: rendering, componentMap: componentMap, key: Date.now() })),
131
- React.createElement(DesignLibraryVariantGenerationEvents, { designLibraryStatus: designLibraryStatus, importMap: importMapInfo,
132
- // pass a new object since we have mutated the original which leads to old reference passed to the client
133
- component: Object.assign({}, componentToUpdate), componentInitError: componentInitError, generatedComponentData: generatedComponentData })));
134
- };
135
- /**
136
- * Design Library component for rendering server components in app router application when variant generation is not enabled.
137
- *
138
- * Renders the **real** Sitecore component for `library` / `library-metadata` modes and,
139
- * wires the **component update** handshake so the parent (Design Library) can send
140
- * updated component props.
141
- * Also renders the DesignLibraryPreviewEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
142
- * @param {DesignLibraryServerPreviewProps} props The props. {@link DesignLibraryServerPreviewProps}
143
- * @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
144
- */
145
- export const DesignLibraryServerPreview = async ({ page, rendering, componentMap, }) => {
146
- var _a, _b;
147
- let designLibraryStatus = DesignLibraryStatus.READY;
148
- let componentToUpdate = (_b = (_a = rendering === null || rendering === void 0 ? void 0 : rendering.placeholders) === null || _a === void 0 ? void 0 : _a[EDITING_COMPONENT_PLACEHOLDER]) === null || _b === void 0 ? void 0 : _b[0];
149
- if (!componentToUpdate)
150
- return React.createElement(ErrorComponent, { message: "Rendering data is missing" });
151
- if (!componentToUpdate.uid)
152
- return React.createElement(ErrorComponent, { message: "Rendering UID is missing in the rendering data" });
153
- const componentUpdateKey = `${COMPONENT_UPDATE_CACHE_KEY_PREFIX}${componentToUpdate.uid}`;
154
- // check if we have an update for this component in the global cache
155
- if (hasCache(componentUpdateKey)) {
156
- // we have an update, get it and clean the cache
157
- designLibraryStatus = DesignLibraryStatus.RENDERED;
158
- const updateData = getCacheAndClean(componentUpdateKey);
159
- // apply the updates to the component rendering
160
- if (updateData === null || updateData === void 0 ? void 0 : updateData.rendering) {
161
- updateComponent(componentToUpdate, updateData.rendering.fields, updateData.rendering.params);
162
- }
163
- }
164
- return (React.createElement(React.Fragment, null,
165
- React.createElement(AppPlaceholder, { name: EDITING_COMPONENT_PLACEHOLDER, page: page, rendering: rendering, componentMap: componentMap, key: Date.now() }),
166
- React.createElement(DesignLibraryPreviewEvents, { designLibraryStatus: designLibraryStatus,
167
- // pass a new object since we have mutated the original which leads to old reference passed to the client
168
- component: Object.assign({}, componentToUpdate) })));
169
- };
@@ -1,47 +0,0 @@
1
- 'use server';
2
- import { debug } from '@sitecore-content-sdk/content';
3
- import { fetchGeneratedComponentFromCache, } from '@sitecore-content-sdk/content/codegen';
4
- import { setCache } from '@sitecore-content-sdk/core/tools';
5
- import { COMPONENT_UPDATE_CACHE_KEY_PREFIX, COMPONENT_PREVIEW_CACHE_KEY_PREFIX, } from '@sitecore-content-sdk/content/editing';
6
- /**
7
- * Server action to update global cache with the provided component updates received from Design Library.
8
- * Stores the given {@link ComponentUpdateModel} in the global cache using a key based on the component UID.
9
- * This enables rendering dynamic updates of server components inside Design Library
10
- * @param {ComponentUpdateModel} updatedComponent - The component update model containing the UID and optional updated or preview component data.
11
- * @returns A Promise that resolves when the cache has been updated.
12
- */
13
- export async function updateComponentAction(updatedComponent) {
14
- debug.editing(`Updating server component cache for Update Component: ${updatedComponent.uid}`);
15
- setCache(`${COMPONENT_UPDATE_CACHE_KEY_PREFIX}${updatedComponent.uid}`, updatedComponent);
16
- }
17
- /**
18
- * Server action to update global cache with the generated component data in variant generation mode
19
- * The generated component data is retrieved from a secured cache endpoint via the provided event arguments.
20
- * This enables rendering dynamic updates of server components inside Design Library
21
- * @param {PreviewEventModel} previewEvent - The preview event model containing the UID and the preview event arguments with cache information to fetch the generated component data.
22
- * @param {string} [edgeUrl] - Optional Edge URL to fetch the generated component data.
23
- * @returns A Promise that resolves when the cache has been updated.
24
- */
25
- export async function previewComponentAction(previewEvent, edgeUrl) {
26
- debug.editing(`Updating server component cache for Preview Component: ${previewEvent.uid}`);
27
- const updatedComponent = {
28
- uid: previewEvent.uid,
29
- generatedComponentData: undefined,
30
- error: undefined,
31
- };
32
- if (previewEvent.args) {
33
- // we've received a component preview event from the Design Library, so we need to fetch the generated component data from secured endpoint
34
- try {
35
- updatedComponent.generatedComponentData = await fetchGeneratedComponentFromCache(previewEvent.args.message.cache.id, previewEvent.args.message.cache.token, edgeUrl);
36
- }
37
- catch (error) {
38
- debug.editing(`Error fetching generated component data from cache for Component: ${previewEvent.uid}`, error);
39
- updatedComponent.error = error instanceof Error ? error.message : String(error);
40
- }
41
- }
42
- else {
43
- debug.editing(`No preview event arguments provided for Component: ${previewEvent.uid}`);
44
- updatedComponent.error = 'No preview event arguments provided';
45
- }
46
- setCache(`${COMPONENT_PREVIEW_CACHE_KEY_PREFIX}${updatedComponent.uid}`, updatedComponent);
47
- }
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { DesingLibraryAppProps } from './models';
3
- /**
4
- * Design Library component intended to be used by the NextJs app router application
5
- * This component serves as a router between client and server component rendering modes for the Design Library.
6
- * It inspects the component type from the component map and
7
- * delegates to the appropriate rendering implementation:
8
- * - Client components are rendered using the `DesignLibrary` component
9
- * - Server components are rendered using the `DesignLibraryServer` component
10
- * @param {DesingLibraryAppProps} props - The properties for the Design Library App.
11
- * @public
12
- */
13
- export declare const DesignLibraryApp: ({ page, componentMap, loadServerImportMap, }: DesingLibraryAppProps) => React.JSX.Element | null;
14
- //# sourceMappingURL=DesignLibraryApp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DesignLibraryApp.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryApp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAIjD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,8CAI9B,qBAAqB,6BAsBvB,CAAC"}
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { DesignLibraryPreviewEventsProps, DesignLibraryVariantGenerationEventsProps } from './models';
3
- export declare const __mockDependencies: (mocks: any) => void;
4
- /**
5
- * Design Library component for rendering server components in app router application.
6
- * DesignLibraryPreviewEvents component serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
7
- * 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.
8
- * @param {DesignLibraryPreviewEventsProps} props The props. {@link DesignLibraryPreviewEventsProps}
9
- * @returns {JSX.Element} empty JSX element.
10
- */
11
- export declare const DesignLibraryPreviewEvents: ({ designLibraryStatus, component, }: DesignLibraryPreviewEventsProps) => React.JSX.Element;
12
- /**
13
- * Design Library component for rendering server components in app router application.
14
- * DesignLibraryVariantGenerationEvents component serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side in variant generation mode.
15
- * 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.
16
- * If the import map is not present then the import map error will be sent to Design Studio.
17
- * @param {DesignLibraryVariantGenerationEventsProps} props The props. {@link DesignLibraryVariantGenerationEventsProps}
18
- * @returns {JSX.Element} empty JSX element.
19
- */
20
- export declare const DesignLibraryVariantGenerationEvents: ({ designLibraryStatus, component, importMap, componentInitError, generatedComponentData, }: DesignLibraryVariantGenerationEventsProps) => React.JSX.Element;
21
- //# sourceMappingURL=DesignLibraryClientEvents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DesignLibraryClientEvents.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryClientEvents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EACL,+BAA+B,EAC/B,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAclB,eAAO,MAAM,kBAAkB,GAAI,OAAO,GAAG,SAU5C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,qCAGxC,+BAA+B,sBAgBjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,GAAI,4FAMlD,yCAAyC,sBAiE3C,CAAC"}
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { DesignLibraryServerProps, DesignLibraryServerPreviewProps, DesignLibraryServerVariantGenerationProps } from './models';
3
- export declare const __mockDependencies: (mocks: any) => Promise<void>;
4
- /**
5
- * Design Library component for rendering server components in app router application.
6
- *
7
- * Renders the **real** Sitecore component for `library` / `library-metadata` modes and,
8
- * when generation is enabled (`page.mode.designLibrary.isVariantGeneration === true`),
9
- * wires the **variant generation** handshake so the parent (Design Library) can send
10
- * generated code to preview and iterate on.
11
- * Also renders the DesignLibraryClientEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
12
- * @param {DesignLibraryServerProps} props The props. {@link DesignLibraryServerProps}
13
- * @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
14
- */
15
- export declare const DesignLibraryServer: ({ page, componentMap, rendering, loadServerImportMap, }: DesignLibraryServerProps) => Promise<React.JSX.Element | null>;
16
- /**
17
- * Design Library component for rendering server components in app router application in variant generation mode.
18
- *
19
- * Renders the **real** Sitecore component for `library` / `library-metadata` modes on first render and,
20
- * wires the **variant generation** handshake so the parent (Design Library) can send
21
- * generated code to preview and iterate on.
22
- * Also renders the DesignLibraryVariantGenerationEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
23
- * @param {DesignLibraryServerVariantGenerationProps} props The props. {@link DesignLibraryServerVariantGenerationProps}
24
- * @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
25
- */
26
- export declare const DesignLibraryServerVariantGeneration: ({ page, rendering, loadServerImportMap, componentMap, }: DesignLibraryServerVariantGenerationProps) => Promise<React.JSX.Element>;
27
- /**
28
- * Design Library component for rendering server components in app router application when variant generation is not enabled.
29
- *
30
- * Renders the **real** Sitecore component for `library` / `library-metadata` modes and,
31
- * wires the **component update** handshake so the parent (Design Library) can send
32
- * updated component props.
33
- * Also renders the DesignLibraryPreviewEvents component which serves as a communication bridge between DesignLibraryServer and the Design Studio on the client side.
34
- * @param {DesignLibraryServerPreviewProps} props The props. {@link DesignLibraryServerPreviewProps}
35
- * @returns {JSX.Element} The preview surface, or `null` when not in Design Library mode.
36
- */
37
- export declare const DesignLibraryServerPreview: ({ page, rendering, componentMap, }: DesignLibraryServerPreviewProps) => Promise<React.JSX.Element>;
38
- //# sourceMappingURL=DesignLibraryServer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DesignLibraryServer.d.ts","sourceRoot":"","sources":["../../../src/components/DesignLibrary/DesignLibraryServer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,OAAO,EAEL,wBAAwB,EACxB,+BAA+B,EAC/B,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAOlB,eAAO,MAAM,kBAAkB,GAAU,OAAO,GAAG,kBAUlD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAU,yDAKvC,wBAAwB,sCAoB1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oCAAoC,GAAU,yDAKxD,yCAAyC,+BA6G3C,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GAAU,oCAI9C,+BAA+B,+BAsCjC,CAAC"}
@@ -1,58 +0,0 @@
1
- import { ComponentRendering } from '@sitecore-content-sdk/content/layout';
2
- import { ServerComponentPreviewEventArgs, GeneratedComponentData } from '@sitecore-content-sdk/content/codegen';
3
- export type ComponentUpdateModel = {
4
- /**
5
- * Unique identifier of the component being updated.
6
- */
7
- uid: string;
8
- /**
9
- * The updated component rendering data.
10
- */
11
- rendering?: ComponentRendering;
12
- /**
13
- * The data needed for generated component to be rendered on the server. Required if update event is coming for a generated component in variant generation mode.
14
- */
15
- generatedComponentData?: GeneratedComponentData;
16
- };
17
- export type ComponentPreviewModel = {
18
- /**
19
- * Unique identifier of the component being updated.
20
- */
21
- uid: string;
22
- /**
23
- * The data needed for generated component to be rendered on the server
24
- */
25
- generatedComponentData?: GeneratedComponentData;
26
- /**
27
- * Error message in case fetching generated component data from secured cache endpoint fails.
28
- */
29
- error?: string;
30
- };
31
- export type PreviewEventModel = {
32
- /**
33
- * Unique identifier of the component being updated.
34
- */
35
- uid: string;
36
- /**
37
- * The preview component event arguments in variant generation mode.
38
- */
39
- args: ServerComponentPreviewEventArgs;
40
- };
41
- /**
42
- * Server action to update global cache with the provided component updates received from Design Library.
43
- * Stores the given {@link ComponentUpdateModel} in the global cache using a key based on the component UID.
44
- * This enables rendering dynamic updates of server components inside Design Library
45
- * @param {ComponentUpdateModel} updatedComponent - The component update model containing the UID and optional updated or preview component data.
46
- * @returns A Promise that resolves when the cache has been updated.
47
- */
48
- export declare function updateComponentAction(updatedComponent: ComponentUpdateModel): Promise<void>;
49
- /**
50
- * Server action to update global cache with the generated component data in variant generation mode
51
- * The generated component data is retrieved from a secured cache endpoint via the provided event arguments.
52
- * This enables rendering dynamic updates of server components inside Design Library
53
- * @param {PreviewEventModel} previewEvent - The preview event model containing the UID and the preview event arguments with cache information to fetch the generated component data.
54
- * @param {string} [edgeUrl] - Optional Edge URL to fetch the generated component data.
55
- * @returns A Promise that resolves when the cache has been updated.
56
- */
57
- export declare function previewComponentAction(previewEvent: PreviewEventModel, edgeUrl?: string): Promise<void>;
58
- //# sourceMappingURL=update-server-component-action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-server-component-action.d.ts","sourceRoot":"","sources":["../../src/server-actions/update-server-component-action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EAEvB,MAAM,uCAAuC,CAAC;AAO/C,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;OAEG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,+BAA+B,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,gBAAgB,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjG;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,iBAAiB,EAC/B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CA8Bf"}