chayns-api 3.0.0-beta.1 → 3.0.0-beta.2
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.
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useValuesSelector = exports.useFunctionsSelector = exports.useCustomFunctionsSelector = exports.useChaynsApiIdSelector = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _shim = require("use-sync-external-store/shim");
|
|
9
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
10
9
|
const createChaynsSelector = key => selector => {
|
|
11
10
|
const store = (0, _react.useContext)(_ChaynsContext.ChaynsContext);
|
|
@@ -13,7 +12,7 @@ const createChaynsSelector = key => selector => {
|
|
|
13
12
|
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
14
13
|
}
|
|
15
14
|
const getSnapshot = () => selector(store[key]);
|
|
16
|
-
return (0,
|
|
15
|
+
return (0, _react.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
|
|
17
16
|
};
|
|
18
17
|
const useValuesSelector = exports.useValuesSelector = createChaynsSelector('values');
|
|
19
18
|
const useFunctionsSelector = exports.useFunctionsSelector = createChaynsSelector('functions');
|
|
@@ -10,8 +10,9 @@ var _HostIframe = _interopRequireDefault(require("./iframe/HostIframe"));
|
|
|
10
10
|
var _ModuleHost = _interopRequireDefault(require("./module/ModuleHost"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
const subscribeToHydration = () => () => {};
|
|
13
14
|
const ChaynsHost = t0 => {
|
|
14
|
-
const $ = (0, _reactCompilerRuntime.c)(
|
|
15
|
+
const $ = (0, _reactCompilerRuntime.c)(38);
|
|
15
16
|
const {
|
|
16
17
|
type,
|
|
17
18
|
iFrameProps,
|
|
@@ -37,34 +38,9 @@ const ChaynsHost = t0 => {
|
|
|
37
38
|
} = t0;
|
|
38
39
|
const iFrameRef = t1 === undefined ? undefined : t1;
|
|
39
40
|
const loadingComponent = t2 === undefined ? undefined : t2;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
t3 = () => {
|
|
44
|
-
if (isVisible) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (typeof _react.startTransition === "function") {
|
|
48
|
-
(0, _react.startTransition)(() => {
|
|
49
|
-
setIsVisible(true);
|
|
50
|
-
});
|
|
51
|
-
} else {
|
|
52
|
-
setIsVisible(true);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
$[0] = isVisible;
|
|
56
|
-
$[1] = t3;
|
|
57
|
-
} else {
|
|
58
|
-
t3 = $[1];
|
|
59
|
-
}
|
|
60
|
-
let t4;
|
|
61
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
62
|
-
t4 = [];
|
|
63
|
-
$[2] = t4;
|
|
64
|
-
} else {
|
|
65
|
-
t4 = $[2];
|
|
66
|
-
}
|
|
67
|
-
(0, _react.useEffect)(t3, t4);
|
|
41
|
+
const isInitiallyVisible = type !== "client-module" && (type !== "server-module" || !!(system !== null && system !== void 0 && system.serverUrl));
|
|
42
|
+
const isHydrated = (0, _react.useSyncExternalStore)(subscribeToHydration, _temp, _temp2);
|
|
43
|
+
const isVisible = (0, _react.useDeferredValue)(isInitiallyVisible || isHydrated);
|
|
68
44
|
if (!isVisible) {
|
|
69
45
|
return null;
|
|
70
46
|
}
|
|
@@ -72,10 +48,10 @@ const ChaynsHost = t0 => {
|
|
|
72
48
|
case "client-iframe":
|
|
73
49
|
case "server-iframe":
|
|
74
50
|
{
|
|
75
|
-
const
|
|
76
|
-
let
|
|
77
|
-
if ($[
|
|
78
|
-
|
|
51
|
+
const t3 = type === "server-iframe";
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[0] !== currentPage || $[1] !== customData || $[2] !== customFunctions || $[3] !== device || $[4] !== dialog || $[5] !== environment || $[6] !== functions || $[7] !== iFrameProps || $[8] !== iFrameRef || $[9] !== isAdminModeActive || $[10] !== language || $[11] !== pages || $[12] !== parameters || $[13] !== preventStagingReplacement || $[14] !== site || $[15] !== src || $[16] !== styleSettings || $[17] !== t3 || $[18] !== user) {
|
|
54
|
+
t4 = _react.default.createElement(_HostIframe.default, {
|
|
79
55
|
iFrameRef: iFrameRef,
|
|
80
56
|
iFrameProps: iFrameProps,
|
|
81
57
|
pages: pages,
|
|
@@ -87,7 +63,7 @@ const ChaynsHost = t0 => {
|
|
|
87
63
|
functions: functions,
|
|
88
64
|
customFunctions: customFunctions,
|
|
89
65
|
src: src,
|
|
90
|
-
postForm:
|
|
66
|
+
postForm: t3,
|
|
91
67
|
language: language,
|
|
92
68
|
parameters: parameters,
|
|
93
69
|
environment: environment,
|
|
@@ -96,37 +72,37 @@ const ChaynsHost = t0 => {
|
|
|
96
72
|
dialog: dialog,
|
|
97
73
|
styleSettings: styleSettings
|
|
98
74
|
});
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
75
|
+
$[0] = currentPage;
|
|
76
|
+
$[1] = customData;
|
|
77
|
+
$[2] = customFunctions;
|
|
78
|
+
$[3] = device;
|
|
79
|
+
$[4] = dialog;
|
|
80
|
+
$[5] = environment;
|
|
81
|
+
$[6] = functions;
|
|
82
|
+
$[7] = iFrameProps;
|
|
83
|
+
$[8] = iFrameRef;
|
|
84
|
+
$[9] = isAdminModeActive;
|
|
85
|
+
$[10] = language;
|
|
86
|
+
$[11] = pages;
|
|
87
|
+
$[12] = parameters;
|
|
88
|
+
$[13] = preventStagingReplacement;
|
|
89
|
+
$[14] = site;
|
|
90
|
+
$[15] = src;
|
|
91
|
+
$[16] = styleSettings;
|
|
92
|
+
$[17] = t3;
|
|
93
|
+
$[18] = user;
|
|
94
|
+
$[19] = t4;
|
|
119
95
|
} else {
|
|
120
|
-
|
|
96
|
+
t4 = $[19];
|
|
121
97
|
}
|
|
122
|
-
return
|
|
98
|
+
return t4;
|
|
123
99
|
}
|
|
124
100
|
case "client-module":
|
|
125
101
|
case "server-module":
|
|
126
102
|
{
|
|
127
|
-
let
|
|
128
|
-
if ($[
|
|
129
|
-
|
|
103
|
+
let t3;
|
|
104
|
+
if ($[20] !== currentPage || $[21] !== customData || $[22] !== customFunctions || $[23] !== device || $[24] !== dialog || $[25] !== environment || $[26] !== functions || $[27] !== isAdminModeActive || $[28] !== language || $[29] !== loadingComponent || $[30] !== pages || $[31] !== parameters || $[32] !== preventStagingReplacement || $[33] !== site || $[34] !== styleSettings || $[35] !== system || $[36] !== user) {
|
|
105
|
+
t3 = _react.default.createElement(_ModuleHost.default, {
|
|
130
106
|
system: system,
|
|
131
107
|
pages: pages,
|
|
132
108
|
isAdminModeActive: isAdminModeActive,
|
|
@@ -145,28 +121,28 @@ const ChaynsHost = t0 => {
|
|
|
145
121
|
dialog: dialog,
|
|
146
122
|
styleSettings: styleSettings
|
|
147
123
|
});
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
124
|
+
$[20] = currentPage;
|
|
125
|
+
$[21] = customData;
|
|
126
|
+
$[22] = customFunctions;
|
|
127
|
+
$[23] = device;
|
|
128
|
+
$[24] = dialog;
|
|
129
|
+
$[25] = environment;
|
|
130
|
+
$[26] = functions;
|
|
131
|
+
$[27] = isAdminModeActive;
|
|
132
|
+
$[28] = language;
|
|
133
|
+
$[29] = loadingComponent;
|
|
134
|
+
$[30] = pages;
|
|
135
|
+
$[31] = parameters;
|
|
136
|
+
$[32] = preventStagingReplacement;
|
|
137
|
+
$[33] = site;
|
|
138
|
+
$[34] = styleSettings;
|
|
139
|
+
$[35] = system;
|
|
140
|
+
$[36] = user;
|
|
141
|
+
$[37] = t3;
|
|
166
142
|
} else {
|
|
167
|
-
|
|
143
|
+
t3 = $[37];
|
|
168
144
|
}
|
|
169
|
-
return
|
|
145
|
+
return t3;
|
|
170
146
|
}
|
|
171
147
|
default:
|
|
172
148
|
{
|
|
@@ -174,4 +150,10 @@ const ChaynsHost = t0 => {
|
|
|
174
150
|
}
|
|
175
151
|
}
|
|
176
152
|
};
|
|
177
|
-
var _default = exports.default = ChaynsHost;
|
|
153
|
+
var _default = exports.default = ChaynsHost;
|
|
154
|
+
function _temp() {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
function _temp2() {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
1
|
+
import { useContext, useSyncExternalStore } from 'react';
|
|
3
2
|
import { ChaynsContext } from '../components/ChaynsContext';
|
|
4
3
|
const createChaynsSelector = key => selector => {
|
|
5
4
|
const store = useContext(ChaynsContext);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { c as _c } from "react-compiler-runtime";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useDeferredValue, useSyncExternalStore } from 'react';
|
|
3
3
|
import HostIframe from './iframe/HostIframe';
|
|
4
4
|
import ModuleHost from './module/ModuleHost';
|
|
5
|
+
const subscribeToHydration = () => () => {};
|
|
5
6
|
const ChaynsHost = t0 => {
|
|
6
|
-
const $ = _c(
|
|
7
|
+
const $ = _c(38);
|
|
7
8
|
const {
|
|
8
9
|
type,
|
|
9
10
|
iFrameProps,
|
|
@@ -29,34 +30,9 @@ const ChaynsHost = t0 => {
|
|
|
29
30
|
} = t0;
|
|
30
31
|
const iFrameRef = t1 === undefined ? undefined : t1;
|
|
31
32
|
const loadingComponent = t2 === undefined ? undefined : t2;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
t3 = () => {
|
|
36
|
-
if (isVisible) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (typeof startTransition === "function") {
|
|
40
|
-
startTransition(() => {
|
|
41
|
-
setIsVisible(true);
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
setIsVisible(true);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
$[0] = isVisible;
|
|
48
|
-
$[1] = t3;
|
|
49
|
-
} else {
|
|
50
|
-
t3 = $[1];
|
|
51
|
-
}
|
|
52
|
-
let t4;
|
|
53
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
54
|
-
t4 = [];
|
|
55
|
-
$[2] = t4;
|
|
56
|
-
} else {
|
|
57
|
-
t4 = $[2];
|
|
58
|
-
}
|
|
59
|
-
useEffect(t3, t4);
|
|
33
|
+
const isInitiallyVisible = type !== "client-module" && (type !== "server-module" || !!(system !== null && system !== void 0 && system.serverUrl));
|
|
34
|
+
const isHydrated = useSyncExternalStore(subscribeToHydration, _temp, _temp2);
|
|
35
|
+
const isVisible = useDeferredValue(isInitiallyVisible || isHydrated);
|
|
60
36
|
if (!isVisible) {
|
|
61
37
|
return null;
|
|
62
38
|
}
|
|
@@ -64,10 +40,10 @@ const ChaynsHost = t0 => {
|
|
|
64
40
|
case "client-iframe":
|
|
65
41
|
case "server-iframe":
|
|
66
42
|
{
|
|
67
|
-
const
|
|
68
|
-
let
|
|
69
|
-
if ($[
|
|
70
|
-
|
|
43
|
+
const t3 = type === "server-iframe";
|
|
44
|
+
let t4;
|
|
45
|
+
if ($[0] !== currentPage || $[1] !== customData || $[2] !== customFunctions || $[3] !== device || $[4] !== dialog || $[5] !== environment || $[6] !== functions || $[7] !== iFrameProps || $[8] !== iFrameRef || $[9] !== isAdminModeActive || $[10] !== language || $[11] !== pages || $[12] !== parameters || $[13] !== preventStagingReplacement || $[14] !== site || $[15] !== src || $[16] !== styleSettings || $[17] !== t3 || $[18] !== user) {
|
|
46
|
+
t4 = React.createElement(HostIframe, {
|
|
71
47
|
iFrameRef: iFrameRef,
|
|
72
48
|
iFrameProps: iFrameProps,
|
|
73
49
|
pages: pages,
|
|
@@ -79,7 +55,7 @@ const ChaynsHost = t0 => {
|
|
|
79
55
|
functions: functions,
|
|
80
56
|
customFunctions: customFunctions,
|
|
81
57
|
src: src,
|
|
82
|
-
postForm:
|
|
58
|
+
postForm: t3,
|
|
83
59
|
language: language,
|
|
84
60
|
parameters: parameters,
|
|
85
61
|
environment: environment,
|
|
@@ -88,37 +64,37 @@ const ChaynsHost = t0 => {
|
|
|
88
64
|
dialog: dialog,
|
|
89
65
|
styleSettings: styleSettings
|
|
90
66
|
});
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
67
|
+
$[0] = currentPage;
|
|
68
|
+
$[1] = customData;
|
|
69
|
+
$[2] = customFunctions;
|
|
70
|
+
$[3] = device;
|
|
71
|
+
$[4] = dialog;
|
|
72
|
+
$[5] = environment;
|
|
73
|
+
$[6] = functions;
|
|
74
|
+
$[7] = iFrameProps;
|
|
75
|
+
$[8] = iFrameRef;
|
|
76
|
+
$[9] = isAdminModeActive;
|
|
77
|
+
$[10] = language;
|
|
78
|
+
$[11] = pages;
|
|
79
|
+
$[12] = parameters;
|
|
80
|
+
$[13] = preventStagingReplacement;
|
|
81
|
+
$[14] = site;
|
|
82
|
+
$[15] = src;
|
|
83
|
+
$[16] = styleSettings;
|
|
84
|
+
$[17] = t3;
|
|
85
|
+
$[18] = user;
|
|
86
|
+
$[19] = t4;
|
|
111
87
|
} else {
|
|
112
|
-
|
|
88
|
+
t4 = $[19];
|
|
113
89
|
}
|
|
114
|
-
return
|
|
90
|
+
return t4;
|
|
115
91
|
}
|
|
116
92
|
case "client-module":
|
|
117
93
|
case "server-module":
|
|
118
94
|
{
|
|
119
|
-
let
|
|
120
|
-
if ($[
|
|
121
|
-
|
|
95
|
+
let t3;
|
|
96
|
+
if ($[20] !== currentPage || $[21] !== customData || $[22] !== customFunctions || $[23] !== device || $[24] !== dialog || $[25] !== environment || $[26] !== functions || $[27] !== isAdminModeActive || $[28] !== language || $[29] !== loadingComponent || $[30] !== pages || $[31] !== parameters || $[32] !== preventStagingReplacement || $[33] !== site || $[34] !== styleSettings || $[35] !== system || $[36] !== user) {
|
|
97
|
+
t3 = React.createElement(ModuleHost, {
|
|
122
98
|
system: system,
|
|
123
99
|
pages: pages,
|
|
124
100
|
isAdminModeActive: isAdminModeActive,
|
|
@@ -137,28 +113,28 @@ const ChaynsHost = t0 => {
|
|
|
137
113
|
dialog: dialog,
|
|
138
114
|
styleSettings: styleSettings
|
|
139
115
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
116
|
+
$[20] = currentPage;
|
|
117
|
+
$[21] = customData;
|
|
118
|
+
$[22] = customFunctions;
|
|
119
|
+
$[23] = device;
|
|
120
|
+
$[24] = dialog;
|
|
121
|
+
$[25] = environment;
|
|
122
|
+
$[26] = functions;
|
|
123
|
+
$[27] = isAdminModeActive;
|
|
124
|
+
$[28] = language;
|
|
125
|
+
$[29] = loadingComponent;
|
|
126
|
+
$[30] = pages;
|
|
127
|
+
$[31] = parameters;
|
|
128
|
+
$[32] = preventStagingReplacement;
|
|
129
|
+
$[33] = site;
|
|
130
|
+
$[34] = styleSettings;
|
|
131
|
+
$[35] = system;
|
|
132
|
+
$[36] = user;
|
|
133
|
+
$[37] = t3;
|
|
158
134
|
} else {
|
|
159
|
-
|
|
135
|
+
t3 = $[37];
|
|
160
136
|
}
|
|
161
|
-
return
|
|
137
|
+
return t3;
|
|
162
138
|
}
|
|
163
139
|
default:
|
|
164
140
|
{
|
|
@@ -166,4 +142,10 @@ const ChaynsHost = t0 => {
|
|
|
166
142
|
}
|
|
167
143
|
}
|
|
168
144
|
};
|
|
169
|
-
export default ChaynsHost;
|
|
145
|
+
export default ChaynsHost;
|
|
146
|
+
function _temp() {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
function _temp2() {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chayns-api",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "new chayns api",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
"htmlescape": "^1.1.1",
|
|
54
54
|
"lodash.throttle": "^4.1.1",
|
|
55
55
|
"react-compiler-runtime": "^1.0.0",
|
|
56
|
-
"ua-parser-js": "^1.0.41"
|
|
57
|
-
"use-sync-external-store": "^1.6.0"
|
|
56
|
+
"ua-parser-js": "^1.0.41"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@babel/cli": "^7.28.3",
|
|
@@ -71,7 +70,6 @@
|
|
|
71
70
|
"@types/react": "^18.3.27",
|
|
72
71
|
"@types/react-dom": "^18.3.7",
|
|
73
72
|
"@types/ua-parser-js": "^0.7.39",
|
|
74
|
-
"@types/use-sync-external-store": "^1.5.0",
|
|
75
73
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
76
74
|
"chayns-toolkit": "^4.0.0-beta.0",
|
|
77
75
|
"concurrently": "^9.2.1",
|
|
@@ -84,7 +82,7 @@
|
|
|
84
82
|
},
|
|
85
83
|
"peerDependencies": {
|
|
86
84
|
"@module-federation/enhanced": "^2.4.0",
|
|
87
|
-
"react": "^
|
|
88
|
-
"react-dom": "^
|
|
85
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
86
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
89
87
|
}
|
|
90
88
|
}
|