@sitecore-content-sdk/react 0.3.0-canary.5 → 0.3.0-canary.6

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.
@@ -12,12 +12,11 @@ const editing_2 = require("@sitecore-content-sdk/core/editing");
12
12
  /**
13
13
  * Renders client scripts and data for editing/preview mode for Pages.
14
14
  * Renders script required for the Design Library (when RenderingType is `component`).
15
- * @param {EditingScriptsProps} props - The props for the EditingScripts component.
16
- * @param {string} props.sitecoreEdgeUrl - Sitecore Edge Platform URL.
17
15
  * @returns A JSX element containing the editing scripts or an empty fragment if not in editing/preview mode.
18
16
  */
19
- const EditingScripts = (props) => {
20
- const { pageContext: { pageState, clientData, clientScripts, renderingType }, } = (0, withSitecore_1.useSitecore)();
17
+ const EditingScripts = () => {
18
+ var _a;
19
+ const { pageContext: { pageState, clientData, clientScripts, renderingType }, api, } = (0, withSitecore_1.useSitecore)();
21
20
  // Don't render anything if not in editing/preview mode and rendering type is not component
22
21
  if (renderingType !== layout_1.RenderingType.Component &&
23
22
  (pageState === layout_1.LayoutServicePageState.Normal ||
@@ -28,7 +27,7 @@ const EditingScripts = (props) => {
28
27
  // In case of RenderingType.Component - render only the script for Design Libnrary
29
28
  if (renderingType === layout_1.RenderingType.Component) {
30
29
  // Add cache buster to the script URL
31
- const scriptUrl = `${(0, editing_2.getDesignLibraryScriptLink)(props.sitecoreEdgeUrl)}?cb=${Date.now()}`;
30
+ const scriptUrl = `${(0, editing_2.getDesignLibraryScriptLink)((_a = api === null || api === void 0 ? void 0 : api.edge) === null || _a === void 0 ? void 0 : _a.edgeUrl)}?cb=${Date.now()}`;
32
31
  return (react_1.default.createElement(react_1.default.Fragment, null,
33
32
  react_1.default.createElement("script", { src: scriptUrl, suppressHydrationWarning: true })));
34
33
  }
@@ -6,12 +6,11 @@ import { getDesignLibraryScriptLink } from '@sitecore-content-sdk/core/editing';
6
6
  /**
7
7
  * Renders client scripts and data for editing/preview mode for Pages.
8
8
  * Renders script required for the Design Library (when RenderingType is `component`).
9
- * @param {EditingScriptsProps} props - The props for the EditingScripts component.
10
- * @param {string} props.sitecoreEdgeUrl - Sitecore Edge Platform URL.
11
9
  * @returns A JSX element containing the editing scripts or an empty fragment if not in editing/preview mode.
12
10
  */
13
- export const EditingScripts = (props) => {
14
- const { pageContext: { pageState, clientData, clientScripts, renderingType }, } = useSitecore();
11
+ export const EditingScripts = () => {
12
+ var _a;
13
+ const { pageContext: { pageState, clientData, clientScripts, renderingType }, api, } = useSitecore();
15
14
  // Don't render anything if not in editing/preview mode and rendering type is not component
16
15
  if (renderingType !== RenderingType.Component &&
17
16
  (pageState === LayoutServicePageState.Normal ||
@@ -22,7 +21,7 @@ export const EditingScripts = (props) => {
22
21
  // In case of RenderingType.Component - render only the script for Design Libnrary
23
22
  if (renderingType === RenderingType.Component) {
24
23
  // Add cache buster to the script URL
25
- const scriptUrl = `${getDesignLibraryScriptLink(props.sitecoreEdgeUrl)}?cb=${Date.now()}`;
24
+ const scriptUrl = `${getDesignLibraryScriptLink((_a = api === null || api === void 0 ? void 0 : api.edge) === null || _a === void 0 ? void 0 : _a.edgeUrl)}?cb=${Date.now()}`;
26
25
  return (React.createElement(React.Fragment, null,
27
26
  React.createElement("script", { src: scriptUrl, suppressHydrationWarning: true })));
28
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/react",
3
- "version": "0.3.0-canary.5",
3
+ "version": "0.3.0-canary.6",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -63,12 +63,12 @@
63
63
  "react-dom": "^19.1.0"
64
64
  },
65
65
  "dependencies": {
66
- "@sitecore-content-sdk/core": "0.3.0-canary.5",
66
+ "@sitecore-content-sdk/core": "0.3.0-canary.6",
67
67
  "fast-deep-equal": "^3.1.3"
68
68
  },
69
69
  "description": "",
70
70
  "types": "types/index.d.ts",
71
- "gitHead": "cebd6afbb856ecb458024fa3e2ad1f605f007e8c",
71
+ "gitHead": "05bcb3eb3d6ed5aa507df5de56ac0a21b754b809",
72
72
  "files": [
73
73
  "dist",
74
74
  "types"
@@ -1,18 +1,7 @@
1
1
  import { JSX } from 'react';
2
- /**
3
- * Props for the EditingScripts component.
4
- */
5
- export type EditingScriptsProps = {
6
- /**
7
- * Sitecore Edge Platform URL.
8
- */
9
- sitecoreEdgeUrl?: string;
10
- };
11
2
  /**
12
3
  * Renders client scripts and data for editing/preview mode for Pages.
13
4
  * Renders script required for the Design Library (when RenderingType is `component`).
14
- * @param {EditingScriptsProps} props - The props for the EditingScripts component.
15
- * @param {string} props.sitecoreEdgeUrl - Sitecore Edge Platform URL.
16
5
  * @returns A JSX element containing the editing scripts or an empty fragment if not in editing/preview mode.
17
6
  */
18
- export declare const EditingScripts: (props: EditingScriptsProps) => JSX.Element;
7
+ export declare const EditingScripts: () => JSX.Element;