chayns-api 1.2.0-12 → 1.2.0-14
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.
- package/dist/cjs/host/ChaynsHost.js +2 -1
- package/dist/cjs/host/module/ModuleHost.js +3 -1
- package/dist/cjs/host/module/utils/loadComponent.js +2 -0
- package/dist/esm/host/ChaynsHost.js +2 -1
- package/dist/esm/host/module/ModuleHost.js +3 -1
- package/dist/esm/host/module/utils/loadComponent.js +2 -0
- package/dist/types/host/ChaynsHost.d.ts +1 -0
- package/package.json +1 -1
|
@@ -30,7 +30,8 @@ const ChaynsHost = ({
|
|
|
30
30
|
customData,
|
|
31
31
|
environment,
|
|
32
32
|
preventStagingReplacement,
|
|
33
|
-
dialog
|
|
33
|
+
dialog,
|
|
34
|
+
shareScope
|
|
34
35
|
}) => {
|
|
35
36
|
const [isVisible, setIsVisible] = (0, _react.useState)(type !== 'client-module' && (type !== 'server-module' || !!(system !== null && system !== void 0 && system.serverUrl)));
|
|
36
37
|
(0, _react.useEffect)(() => {
|
|
@@ -15,6 +15,7 @@ const System = ({
|
|
|
15
15
|
fallback,
|
|
16
16
|
...props
|
|
17
17
|
}) => {
|
|
18
|
+
console.log("share3", system, system.shareScope);
|
|
18
19
|
const Component = (0, _react.useMemo)(() => (0, _loadComponent.default)(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton, system.shareScope), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
19
20
|
return /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
|
|
20
21
|
fallback: fallback || ''
|
|
@@ -66,7 +67,8 @@ const ModuleHost = ({
|
|
|
66
67
|
url: (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.buildEnvironment),
|
|
67
68
|
serverUrl: (0, _url.replaceStagingUrl)(preventStagingReplacement, system.serverUrl, environment.buildEnvironment),
|
|
68
69
|
module: system.module,
|
|
69
|
-
preventSingleton: system.preventSingleton
|
|
70
|
+
preventSingleton: system.preventSingleton,
|
|
71
|
+
shareScope: system.shareScope
|
|
70
72
|
},
|
|
71
73
|
data: initialData,
|
|
72
74
|
functions: functions,
|
|
@@ -8,6 +8,7 @@ var _semver = _interopRequireDefault(require("semver"));
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
const loadModule = (scope, module, url, preventSingleton = false, shareScope = 'chayns-api2') => {
|
|
11
|
+
console.log("share2", shareScope);
|
|
11
12
|
const {
|
|
12
13
|
loadRemote,
|
|
13
14
|
registerRemotes
|
|
@@ -53,6 +54,7 @@ const loadModule = (scope, module, url, preventSingleton = false, shareScope = '
|
|
|
53
54
|
};
|
|
54
55
|
exports.loadModule = loadModule;
|
|
55
56
|
const loadComponent = (scope, module, url, skipCompatMode = false, preventSingleton = false, shareScope) => {
|
|
57
|
+
console.log("share1", shareScope);
|
|
56
58
|
if (skipCompatMode) {
|
|
57
59
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
58
60
|
}
|
|
@@ -22,7 +22,8 @@ const ChaynsHost = _ref => {
|
|
|
22
22
|
customData,
|
|
23
23
|
environment,
|
|
24
24
|
preventStagingReplacement,
|
|
25
|
-
dialog
|
|
25
|
+
dialog,
|
|
26
|
+
shareScope
|
|
26
27
|
} = _ref;
|
|
27
28
|
const [isVisible, setIsVisible] = useState(type !== 'client-module' && (type !== 'server-module' || !!(system !== null && system !== void 0 && system.serverUrl)));
|
|
28
29
|
useEffect(() => {
|
|
@@ -7,6 +7,7 @@ const System = _ref => {
|
|
|
7
7
|
fallback,
|
|
8
8
|
...props
|
|
9
9
|
} = _ref;
|
|
10
|
+
console.log("share3", system, system.shareScope);
|
|
10
11
|
const Component = useMemo(() => loadComponent(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton, system.shareScope), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
11
12
|
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
12
13
|
fallback: fallback || ''
|
|
@@ -59,7 +60,8 @@ const ModuleHost = _ref2 => {
|
|
|
59
60
|
url: replaceStagingUrl(preventStagingReplacement, system.url, environment.buildEnvironment),
|
|
60
61
|
serverUrl: replaceStagingUrl(preventStagingReplacement, system.serverUrl, environment.buildEnvironment),
|
|
61
62
|
module: system.module,
|
|
62
|
-
preventSingleton: system.preventSingleton
|
|
63
|
+
preventSingleton: system.preventSingleton,
|
|
64
|
+
shareScope: system.shareScope
|
|
63
65
|
},
|
|
64
66
|
data: initialData,
|
|
65
67
|
functions: functions,
|
|
@@ -3,6 +3,7 @@ import React from "react";
|
|
|
3
3
|
export const loadModule = function (scope, module, url) {
|
|
4
4
|
let preventSingleton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
5
5
|
let shareScope = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'chayns-api2';
|
|
6
|
+
console.log("share2", shareScope);
|
|
6
7
|
const {
|
|
7
8
|
loadRemote,
|
|
8
9
|
registerRemotes
|
|
@@ -50,6 +51,7 @@ const loadComponent = function (scope, module, url) {
|
|
|
50
51
|
let skipCompatMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
51
52
|
let preventSingleton = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
52
53
|
let shareScope = arguments.length > 5 ? arguments[5] : undefined;
|
|
54
|
+
console.log("share1", shareScope);
|
|
53
55
|
if (skipCompatMode) {
|
|
54
56
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
55
57
|
}
|
|
@@ -24,6 +24,7 @@ type ChaynsHostType = {
|
|
|
24
24
|
environment: ChaynsReactValues["environment"];
|
|
25
25
|
preventStagingReplacement?: boolean;
|
|
26
26
|
dialog: ChaynsReactValues["dialog"];
|
|
27
|
+
shareScope?: string;
|
|
27
28
|
};
|
|
28
29
|
declare const ChaynsHost: FC<ChaynsHostType>;
|
|
29
30
|
export default ChaynsHost;
|