chayns-api 3.0.0-beta.4 → 3.1.0-beta.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.
- package/README.md +4 -11
- package/dist/cjs/calls/index.js +4 -1
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/ChaynsProvider.js +34 -6
- package/dist/cjs/components/withHydrationBoundary.js +2 -2
- package/dist/cjs/constants/index.js +0 -22
- package/dist/cjs/contexts/HistoryLayerContext.js +89 -0
- package/dist/cjs/contexts/index.js +38 -0
- package/dist/cjs/handler/history/FrameHistoryLayer.js +100 -0
- package/dist/cjs/handler/history/HistoryLayer.js +321 -0
- package/dist/cjs/handler/history/index.js +19 -0
- package/dist/cjs/hooks/history.js +454 -0
- package/dist/cjs/hooks/index.js +62 -1
- package/dist/cjs/host/ChaynsHost.js +113 -54
- package/dist/cjs/host/iframe/HostIframe.js +70 -5
- package/dist/cjs/host/module/ModuleHost.js +50 -44
- package/dist/cjs/index.js +139 -6
- package/dist/cjs/types/history.js +1 -0
- package/dist/cjs/umd.index.js +2 -2
- package/dist/cjs/utils/EventBus.js +33 -0
- package/dist/cjs/{util → utils}/appStorage.js +2 -2
- package/dist/cjs/utils/equality.js +19 -0
- package/dist/cjs/utils/history/BlockRegistry.js +110 -0
- package/dist/cjs/utils/history/NavigationQueue.js +388 -0
- package/dist/cjs/utils/history/layerTree.js +32 -0
- package/dist/cjs/utils/history/navigationIndex.js +42 -0
- package/dist/cjs/utils/history/rootLayer.js +175 -0
- package/dist/cjs/utils/history/segments.js +15 -0
- package/dist/cjs/utils/history/stateProjector.js +156 -0
- package/dist/cjs/utils/history/url.js +47 -0
- package/dist/cjs/utils/history/window.js +9 -0
- package/dist/cjs/wrapper/AppWrapper.js +23 -23
- package/dist/cjs/wrapper/FrameWrapper.js +35 -2
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -1
- package/dist/esm/calls/index.js +2 -0
- package/dist/esm/calls/visibilityChangeListener.js +1 -1
- package/dist/esm/components/ChaynsProvider.js +34 -6
- package/dist/esm/components/withHydrationBoundary.js +1 -1
- package/dist/esm/constants/index.js +1 -3
- package/dist/esm/contexts/HistoryLayerContext.js +76 -0
- package/dist/esm/contexts/index.js +3 -0
- package/dist/esm/handler/history/FrameHistoryLayer.js +105 -0
- package/dist/esm/handler/history/HistoryLayer.js +321 -0
- package/dist/esm/handler/history/index.js +2 -0
- package/dist/esm/hooks/history.js +428 -0
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/host/ChaynsHost.js +113 -54
- package/dist/esm/host/iframe/HostIframe.js +70 -5
- package/dist/esm/host/module/ModuleHost.js +50 -44
- package/dist/esm/index.js +15 -6
- package/dist/esm/types/history.js +1 -0
- package/dist/esm/umd.index.js +2 -2
- package/dist/esm/utils/EventBus.js +31 -0
- package/dist/esm/{util → utils}/appStorage.js +1 -1
- package/dist/esm/utils/equality.js +12 -0
- package/dist/esm/utils/history/BlockRegistry.js +108 -0
- package/dist/esm/utils/history/NavigationQueue.js +385 -0
- package/dist/esm/utils/history/layerTree.js +24 -0
- package/dist/esm/utils/history/navigationIndex.js +33 -0
- package/dist/esm/utils/history/rootLayer.js +167 -0
- package/dist/esm/utils/history/segments.js +7 -0
- package/dist/esm/utils/history/stateProjector.js +147 -0
- package/dist/esm/utils/history/url.js +40 -0
- package/dist/esm/utils/history/window.js +3 -0
- package/dist/esm/wrapper/AppWrapper.js +5 -5
- package/dist/esm/wrapper/FrameWrapper.js +35 -2
- package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/esm/wrapper/StaticChaynsApi.js +2 -1
- package/dist/types/calls/index.d.ts +5 -0
- package/dist/types/components/ChaynsProvider.d.ts +21 -0
- package/dist/types/constants/index.d.ts +0 -2
- package/dist/types/contexts/HistoryLayerContext.d.ts +33 -0
- package/dist/types/contexts/index.d.ts +3 -0
- package/dist/types/handler/history/FrameHistoryLayer.d.ts +99 -0
- package/dist/types/handler/history/HistoryLayer.d.ts +117 -0
- package/dist/types/handler/history/index.d.ts +2 -0
- package/dist/types/hooks/history.d.ts +89 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/host/ChaynsHost.d.ts +12 -0
- package/dist/types/host/iframe/HostIframe.d.ts +4 -0
- package/dist/types/host/module/ModuleHost.d.ts +4 -0
- package/dist/types/index.d.ts +15 -6
- package/dist/types/types/IChaynsReact.d.ts +3 -0
- package/dist/types/types/history.d.ts +74 -0
- package/dist/types/umd.index.d.ts +2 -2
- package/dist/types/utils/EventBus.d.ts +10 -0
- package/dist/types/{util → utils}/collectCssChunks.d.ts +1 -1
- package/dist/types/utils/equality.d.ts +2 -0
- package/dist/types/utils/history/BlockRegistry.d.ts +38 -0
- package/dist/types/utils/history/NavigationQueue.d.ts +109 -0
- package/dist/types/utils/history/layerTree.d.ts +10 -0
- package/dist/types/utils/history/navigationIndex.d.ts +14 -0
- package/dist/types/utils/history/rootLayer.d.ts +42 -0
- package/dist/types/utils/history/segments.d.ts +2 -0
- package/dist/types/utils/history/stateProjector.d.ts +24 -0
- package/dist/types/utils/history/url.d.ts +17 -0
- package/dist/types/utils/history/window.d.ts +1 -0
- package/dist/types/wrapper/FrameWrapper.d.ts +1 -0
- package/dist/types/wrapper/StaticChaynsApi.d.ts +1 -0
- package/package.json +2 -1
- /package/dist/cjs/{constants → contexts}/hydrationContext.js +0 -0
- /package/dist/cjs/{constants → contexts}/moduleContext.js +0 -0
- /package/dist/cjs/{helper/apiListenerHelper.js → utils/apiListener.js} +0 -0
- /package/dist/cjs/{util → utils}/appCall.js +0 -0
- /package/dist/cjs/{util → utils}/bindChaynsApi.js +0 -0
- /package/dist/cjs/{util → utils}/collectCssChunks.js +0 -0
- /package/dist/cjs/{util → utils}/deviceHelper.js +0 -0
- /package/dist/cjs/{util → utils}/heightHelper.js +0 -0
- /package/dist/cjs/{util → utils}/initModuleFederationSharing.js +0 -0
- /package/dist/cjs/{util → utils}/is.js +0 -0
- /package/dist/cjs/{util → utils}/postIframeForm.js +0 -0
- /package/dist/cjs/{util → utils}/transferNestedFunctions.js +0 -0
- /package/dist/cjs/{util → utils}/url.js +0 -0
- /package/dist/esm/{constants → contexts}/hydrationContext.js +0 -0
- /package/dist/esm/{constants → contexts}/moduleContext.js +0 -0
- /package/dist/esm/{helper/apiListenerHelper.js → utils/apiListener.js} +0 -0
- /package/dist/esm/{util → utils}/appCall.js +0 -0
- /package/dist/esm/{util → utils}/bindChaynsApi.js +0 -0
- /package/dist/esm/{util → utils}/collectCssChunks.js +0 -0
- /package/dist/esm/{util → utils}/deviceHelper.js +0 -0
- /package/dist/esm/{util → utils}/heightHelper.js +0 -0
- /package/dist/esm/{util → utils}/initModuleFederationSharing.js +0 -0
- /package/dist/esm/{util → utils}/is.js +0 -0
- /package/dist/esm/{util → utils}/postIframeForm.js +0 -0
- /package/dist/esm/{util → utils}/transferNestedFunctions.js +0 -0
- /package/dist/esm/{util → utils}/url.js +0 -0
- /package/dist/types/{constants → contexts}/hydrationContext.d.ts +0 -0
- /package/dist/types/{constants → contexts}/moduleContext.d.ts +0 -0
- /package/dist/types/{helper/apiListenerHelper.d.ts → utils/apiListener.d.ts} +0 -0
- /package/dist/types/{util → utils}/appCall.d.ts +0 -0
- /package/dist/types/{util → utils}/appStorage.d.ts +0 -0
- /package/dist/types/{util → utils}/bindChaynsApi.d.ts +0 -0
- /package/dist/types/{util → utils}/deviceHelper.d.ts +0 -0
- /package/dist/types/{util → utils}/heightHelper.d.ts +0 -0
- /package/dist/types/{util → utils}/initModuleFederationSharing.d.ts +0 -0
- /package/dist/types/{util → utils}/is.d.ts +0 -0
- /package/dist/types/{util → utils}/postIframeForm.d.ts +0 -0
- /package/dist/types/{util → utils}/transferNestedFunctions.d.ts +0 -0
- /package/dist/types/{util → utils}/url.d.ts +0 -0
|
@@ -8,11 +8,13 @@ var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _HostIframe = _interopRequireDefault(require("./iframe/HostIframe"));
|
|
10
10
|
var _ModuleHost = _interopRequireDefault(require("./module/ModuleHost"));
|
|
11
|
+
var _HistoryLayerContext = require("../contexts/HistoryLayerContext");
|
|
12
|
+
var _rootLayer = require("../utils/history/rootLayer");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
14
|
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
15
|
const subscribeToHydration = () => () => {};
|
|
14
16
|
const ChaynsHost = t0 => {
|
|
15
|
-
const $ = (0, _reactCompilerRuntime.c)(
|
|
17
|
+
const $ = (0, _reactCompilerRuntime.c)(53);
|
|
16
18
|
const {
|
|
17
19
|
type,
|
|
18
20
|
iFrameProps,
|
|
@@ -34,24 +36,51 @@ const ChaynsHost = t0 => {
|
|
|
34
36
|
environment,
|
|
35
37
|
preventStagingReplacement,
|
|
36
38
|
dialog,
|
|
37
|
-
styleSettings
|
|
39
|
+
styleSettings,
|
|
40
|
+
historyLayer,
|
|
41
|
+
historyChildId,
|
|
42
|
+
isHistoryDisabled: t3
|
|
38
43
|
} = t0;
|
|
39
44
|
const iFrameRef = t1 === undefined ? undefined : t1;
|
|
40
45
|
const loadingComponent = t2 === undefined ? undefined : t2;
|
|
46
|
+
const isHistoryDisabled = t3 === undefined ? true : t3;
|
|
41
47
|
const isInitiallyVisible = type !== "client-module" && (type !== "server-module" || !!(system !== null && system !== void 0 && system.serverUrl));
|
|
42
48
|
const isHydrated = (0, _react.useSyncExternalStore)(subscribeToHydration, _temp, _temp2);
|
|
43
49
|
const isVisible = (0, _react.useDeferredValue)(isInitiallyVisible || isHydrated);
|
|
44
50
|
if (!isVisible) {
|
|
45
51
|
return null;
|
|
46
52
|
}
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[0] !== historyLayer) {
|
|
55
|
+
t4 = historyLayer !== null && historyLayer !== void 0 ? historyLayer : (0, _rootLayer.getOrInitRootChaynsHistoryLayer)().rootLayer;
|
|
56
|
+
$[0] = historyLayer;
|
|
57
|
+
$[1] = t4;
|
|
58
|
+
} else {
|
|
59
|
+
t4 = $[1];
|
|
60
|
+
}
|
|
61
|
+
const resolvedLayer = t4;
|
|
62
|
+
let layer;
|
|
63
|
+
if (!isHistoryDisabled) {
|
|
64
|
+
let t5;
|
|
65
|
+
if ($[2] !== historyChildId || $[3] !== resolvedLayer) {
|
|
66
|
+
var _resolvedLayer$getChi;
|
|
67
|
+
t5 = historyChildId ? (_resolvedLayer$getChi = resolvedLayer.getChildLayer(historyChildId)) !== null && _resolvedLayer$getChi !== void 0 ? _resolvedLayer$getChi : resolvedLayer.createChildLayer(historyChildId) : resolvedLayer;
|
|
68
|
+
$[2] = historyChildId;
|
|
69
|
+
$[3] = resolvedLayer;
|
|
70
|
+
$[4] = t5;
|
|
71
|
+
} else {
|
|
72
|
+
t5 = $[4];
|
|
73
|
+
}
|
|
74
|
+
layer = t5;
|
|
75
|
+
}
|
|
47
76
|
switch (type) {
|
|
48
77
|
case "client-iframe":
|
|
49
78
|
case "server-iframe":
|
|
50
79
|
{
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
if ($[
|
|
54
|
-
|
|
80
|
+
const t5 = type === "server-iframe";
|
|
81
|
+
let t6;
|
|
82
|
+
if ($[5] !== currentPage || $[6] !== customData || $[7] !== customFunctions || $[8] !== device || $[9] !== dialog || $[10] !== environment || $[11] !== functions || $[12] !== iFrameProps || $[13] !== iFrameRef || $[14] !== isAdminModeActive || $[15] !== isHistoryDisabled || $[16] !== language || $[17] !== layer || $[18] !== pages || $[19] !== parameters || $[20] !== preventStagingReplacement || $[21] !== site || $[22] !== src || $[23] !== styleSettings || $[24] !== t5 || $[25] !== user) {
|
|
83
|
+
t6 = _react.default.createElement(_HostIframe.default, {
|
|
55
84
|
iFrameRef: iFrameRef,
|
|
56
85
|
iFrameProps: iFrameProps,
|
|
57
86
|
pages: pages,
|
|
@@ -63,46 +92,61 @@ const ChaynsHost = t0 => {
|
|
|
63
92
|
functions: functions,
|
|
64
93
|
customFunctions: customFunctions,
|
|
65
94
|
src: src,
|
|
66
|
-
postForm:
|
|
95
|
+
postForm: t5,
|
|
67
96
|
language: language,
|
|
68
97
|
parameters: parameters,
|
|
69
98
|
environment: environment,
|
|
70
99
|
customData: customData,
|
|
71
100
|
preventStagingReplacement: preventStagingReplacement,
|
|
72
101
|
dialog: dialog,
|
|
73
|
-
styleSettings: styleSettings
|
|
102
|
+
styleSettings: styleSettings,
|
|
103
|
+
historyLayer: layer,
|
|
104
|
+
isHistoryDisabled: isHistoryDisabled
|
|
74
105
|
});
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
106
|
+
$[5] = currentPage;
|
|
107
|
+
$[6] = customData;
|
|
108
|
+
$[7] = customFunctions;
|
|
109
|
+
$[8] = device;
|
|
110
|
+
$[9] = dialog;
|
|
111
|
+
$[10] = environment;
|
|
112
|
+
$[11] = functions;
|
|
113
|
+
$[12] = iFrameProps;
|
|
114
|
+
$[13] = iFrameRef;
|
|
115
|
+
$[14] = isAdminModeActive;
|
|
116
|
+
$[15] = isHistoryDisabled;
|
|
117
|
+
$[16] = language;
|
|
118
|
+
$[17] = layer;
|
|
119
|
+
$[18] = pages;
|
|
120
|
+
$[19] = parameters;
|
|
121
|
+
$[20] = preventStagingReplacement;
|
|
122
|
+
$[21] = site;
|
|
123
|
+
$[22] = src;
|
|
124
|
+
$[23] = styleSettings;
|
|
125
|
+
$[24] = t5;
|
|
126
|
+
$[25] = user;
|
|
127
|
+
$[26] = t6;
|
|
128
|
+
} else {
|
|
129
|
+
t6 = $[26];
|
|
130
|
+
}
|
|
131
|
+
let t7;
|
|
132
|
+
if ($[27] !== resolvedLayer || $[28] !== t6) {
|
|
133
|
+
t7 = _react.default.createElement(_HistoryLayerContext.ChaynsHistoryLayerProvider, {
|
|
134
|
+
layer: resolvedLayer
|
|
135
|
+
}, t6);
|
|
136
|
+
$[27] = resolvedLayer;
|
|
137
|
+
$[28] = t6;
|
|
138
|
+
$[29] = t7;
|
|
95
139
|
} else {
|
|
96
|
-
|
|
140
|
+
t7 = $[29];
|
|
97
141
|
}
|
|
98
|
-
return
|
|
142
|
+
return t7;
|
|
99
143
|
}
|
|
100
144
|
case "client-module":
|
|
101
145
|
case "server-module":
|
|
102
146
|
{
|
|
103
|
-
let
|
|
104
|
-
if ($[
|
|
105
|
-
|
|
147
|
+
let t5;
|
|
148
|
+
if ($[30] !== currentPage || $[31] !== customData || $[32] !== customFunctions || $[33] !== device || $[34] !== dialog || $[35] !== environment || $[36] !== functions || $[37] !== isAdminModeActive || $[38] !== isHistoryDisabled || $[39] !== language || $[40] !== layer || $[41] !== loadingComponent || $[42] !== pages || $[43] !== parameters || $[44] !== preventStagingReplacement || $[45] !== site || $[46] !== styleSettings || $[47] !== system || $[48] !== user) {
|
|
149
|
+
t5 = _react.default.createElement(_ModuleHost.default, {
|
|
106
150
|
system: system,
|
|
107
151
|
pages: pages,
|
|
108
152
|
isAdminModeActive: isAdminModeActive,
|
|
@@ -119,30 +163,45 @@ const ChaynsHost = t0 => {
|
|
|
119
163
|
environment: environment,
|
|
120
164
|
preventStagingReplacement: preventStagingReplacement,
|
|
121
165
|
dialog: dialog,
|
|
122
|
-
styleSettings: styleSettings
|
|
166
|
+
styleSettings: styleSettings,
|
|
167
|
+
historyLayer: layer,
|
|
168
|
+
isHistoryDisabled: isHistoryDisabled
|
|
123
169
|
});
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
170
|
+
$[30] = currentPage;
|
|
171
|
+
$[31] = customData;
|
|
172
|
+
$[32] = customFunctions;
|
|
173
|
+
$[33] = device;
|
|
174
|
+
$[34] = dialog;
|
|
175
|
+
$[35] = environment;
|
|
176
|
+
$[36] = functions;
|
|
177
|
+
$[37] = isAdminModeActive;
|
|
178
|
+
$[38] = isHistoryDisabled;
|
|
179
|
+
$[39] = language;
|
|
180
|
+
$[40] = layer;
|
|
181
|
+
$[41] = loadingComponent;
|
|
182
|
+
$[42] = pages;
|
|
183
|
+
$[43] = parameters;
|
|
184
|
+
$[44] = preventStagingReplacement;
|
|
185
|
+
$[45] = site;
|
|
186
|
+
$[46] = styleSettings;
|
|
187
|
+
$[47] = system;
|
|
188
|
+
$[48] = user;
|
|
189
|
+
$[49] = t5;
|
|
190
|
+
} else {
|
|
191
|
+
t5 = $[49];
|
|
192
|
+
}
|
|
193
|
+
let t6;
|
|
194
|
+
if ($[50] !== resolvedLayer || $[51] !== t5) {
|
|
195
|
+
t6 = _react.default.createElement(_HistoryLayerContext.ChaynsHistoryLayerProvider, {
|
|
196
|
+
layer: resolvedLayer
|
|
197
|
+
}, t5);
|
|
198
|
+
$[50] = resolvedLayer;
|
|
199
|
+
$[51] = t5;
|
|
200
|
+
$[52] = t6;
|
|
142
201
|
} else {
|
|
143
|
-
|
|
202
|
+
t6 = $[52];
|
|
144
203
|
}
|
|
145
|
-
return
|
|
204
|
+
return t6;
|
|
146
205
|
}
|
|
147
206
|
default:
|
|
148
207
|
{
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var comlink = _interopRequireWildcard(require("comlink"));
|
|
9
|
-
var _postIframeForm = _interopRequireDefault(require("../../
|
|
9
|
+
var _postIframeForm = _interopRequireDefault(require("../../utils/postIframeForm"));
|
|
10
10
|
var _useUpdateData = _interopRequireDefault(require("./utils/useUpdateData"));
|
|
11
|
-
var _url = require("../../
|
|
12
|
-
var _transferNestedFunctions = require("../../
|
|
11
|
+
var _url = require("../../utils/url");
|
|
12
|
+
var _transferNestedFunctions = require("../../utils/transferNestedFunctions");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
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); }
|
|
15
15
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
@@ -32,13 +32,17 @@ const HostIframe = ({
|
|
|
32
32
|
customData,
|
|
33
33
|
preventStagingReplacement,
|
|
34
34
|
dialog,
|
|
35
|
-
styleSettings
|
|
35
|
+
styleSettings,
|
|
36
|
+
historyLayer,
|
|
37
|
+
isHistoryDisabled
|
|
36
38
|
}) => {
|
|
37
39
|
const eventTarget = (0, _react.useRef)();
|
|
38
40
|
const ref = (0, _react.useRef)();
|
|
39
41
|
const currentDataRef = (0, _react.useRef)();
|
|
40
42
|
const customFunctionsRef = (0, _react.useRef)();
|
|
41
43
|
customFunctionsRef.current = customFunctions;
|
|
44
|
+
const historyLayerRef = (0, _react.useRef)(undefined);
|
|
45
|
+
historyLayerRef.current = historyLayer;
|
|
42
46
|
if (!eventTarget.current) {
|
|
43
47
|
eventTarget.current = global.document ? document.createElement('div') : undefined;
|
|
44
48
|
}
|
|
@@ -50,6 +54,7 @@ const HostIframe = ({
|
|
|
50
54
|
const initialData = {
|
|
51
55
|
site,
|
|
52
56
|
isAdminModeActive,
|
|
57
|
+
isHistoryDisabled,
|
|
53
58
|
pages,
|
|
54
59
|
currentPage,
|
|
55
60
|
device,
|
|
@@ -95,7 +100,66 @@ const HostIframe = ({
|
|
|
95
100
|
addDataListener: cb => {
|
|
96
101
|
if (eventTarget.current) eventTarget.current.addEventListener('data_update', e => e.detail && cb(e.detail));
|
|
97
102
|
},
|
|
98
|
-
getInitialData: () => currentDataRef.current
|
|
103
|
+
getInitialData: () => currentDataRef.current,
|
|
104
|
+
history: historyLayerRef.current ? {
|
|
105
|
+
getInitialState: () => {
|
|
106
|
+
const l = historyLayerRef.current;
|
|
107
|
+
if (!l) return null;
|
|
108
|
+
return {
|
|
109
|
+
id: l.id,
|
|
110
|
+
depth: l.depth,
|
|
111
|
+
segments: l.getRoute(),
|
|
112
|
+
params: l.getParams(),
|
|
113
|
+
hash: l.getHash(),
|
|
114
|
+
state: l.getState(),
|
|
115
|
+
activeChildId: l.getActiveChildId(),
|
|
116
|
+
segmentCount: l.getSegmentCount()
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
setRoute: (route, opts) => {
|
|
120
|
+
var _historyLayerRef$curr;
|
|
121
|
+
return (_historyLayerRef$curr = historyLayerRef.current) === null || _historyLayerRef$curr === void 0 ? void 0 : _historyLayerRef$curr.setRoute(route, opts);
|
|
122
|
+
},
|
|
123
|
+
setParams: (params, opts) => {
|
|
124
|
+
var _historyLayerRef$curr2;
|
|
125
|
+
return (_historyLayerRef$curr2 = historyLayerRef.current) === null || _historyLayerRef$curr2 === void 0 ? void 0 : _historyLayerRef$curr2.setParams(params, opts);
|
|
126
|
+
},
|
|
127
|
+
setHash: (hash, opts) => {
|
|
128
|
+
var _historyLayerRef$curr3;
|
|
129
|
+
return (_historyLayerRef$curr3 = historyLayerRef.current) === null || _historyLayerRef$curr3 === void 0 ? void 0 : _historyLayerRef$curr3.setHash(hash, opts);
|
|
130
|
+
},
|
|
131
|
+
setState: (state, opts) => {
|
|
132
|
+
var _historyLayerRef$curr4;
|
|
133
|
+
return (_historyLayerRef$curr4 = historyLayerRef.current) === null || _historyLayerRef$curr4 === void 0 ? void 0 : _historyLayerRef$curr4.setState(state, opts);
|
|
134
|
+
},
|
|
135
|
+
navigate: opts => {
|
|
136
|
+
var _historyLayerRef$curr5;
|
|
137
|
+
return (_historyLayerRef$curr5 = historyLayerRef.current) === null || _historyLayerRef$curr5 === void 0 ? void 0 : _historyLayerRef$curr5.navigate(opts);
|
|
138
|
+
},
|
|
139
|
+
setActiveChild: (id, init) => {
|
|
140
|
+
var _historyLayerRef$curr6;
|
|
141
|
+
return (_historyLayerRef$curr6 = historyLayerRef.current) === null || _historyLayerRef$curr6 === void 0 ? void 0 : _historyLayerRef$curr6.setActiveChild(id, init);
|
|
142
|
+
},
|
|
143
|
+
setSegmentCount: n => {
|
|
144
|
+
var _historyLayerRef$curr7;
|
|
145
|
+
return (_historyLayerRef$curr7 = historyLayerRef.current) === null || _historyLayerRef$curr7 === void 0 ? void 0 : _historyLayerRef$curr7.setSegmentCount(n);
|
|
146
|
+
},
|
|
147
|
+
addChangeListener: callback => {
|
|
148
|
+
var _historyLayerRef$curr8, _historyLayerRef$curr9;
|
|
149
|
+
const unsub = (_historyLayerRef$curr8 = (_historyLayerRef$curr9 = historyLayerRef.current) === null || _historyLayerRef$curr9 === void 0 ? void 0 : _historyLayerRef$curr9.addEventListener('change', callback)) !== null && _historyLayerRef$curr8 !== void 0 ? _historyLayerRef$curr8 : () => {};
|
|
150
|
+
return comlink.proxy(unsub);
|
|
151
|
+
},
|
|
152
|
+
addPopstateListener: callback => {
|
|
153
|
+
var _historyLayerRef$curr0, _historyLayerRef$curr1;
|
|
154
|
+
const unsub = (_historyLayerRef$curr0 = (_historyLayerRef$curr1 = historyLayerRef.current) === null || _historyLayerRef$curr1 === void 0 ? void 0 : _historyLayerRef$curr1.addEventListener('popstate', callback)) !== null && _historyLayerRef$curr0 !== void 0 ? _historyLayerRef$curr0 : () => {};
|
|
155
|
+
return comlink.proxy(unsub);
|
|
156
|
+
},
|
|
157
|
+
addBlock: (callback, opts) => {
|
|
158
|
+
var _historyLayerRef$curr10, _historyLayerRef$curr11;
|
|
159
|
+
const unsub = (_historyLayerRef$curr10 = (_historyLayerRef$curr11 = historyLayerRef.current) === null || _historyLayerRef$curr11 === void 0 ? void 0 : _historyLayerRef$curr11.addBlock(callback, opts)) !== null && _historyLayerRef$curr10 !== void 0 ? _historyLayerRef$curr10 : () => {};
|
|
160
|
+
return comlink.proxy(unsub);
|
|
161
|
+
}
|
|
162
|
+
} : undefined
|
|
99
163
|
}
|
|
100
164
|
};
|
|
101
165
|
comlink.expose(obj, comlink.windowEndpoint(ref.current.contentWindow));
|
|
@@ -106,6 +170,7 @@ const HostIframe = ({
|
|
|
106
170
|
}
|
|
107
171
|
return undefined;
|
|
108
172
|
}, []);
|
|
173
|
+
(0, _useUpdateData.default)(eventTarget.current, 'isHistoryDisabled', isHistoryDisabled);
|
|
109
174
|
(0, _useUpdateData.default)(eventTarget.current, 'isAdminModeActive', isAdminModeActive);
|
|
110
175
|
(0, _useUpdateData.default)(eventTarget.current, 'user', user);
|
|
111
176
|
(0, _useUpdateData.default)(eventTarget.current, 'site', site);
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _moduleContext = require("../../
|
|
9
|
+
var _moduleContext = require("../../contexts/moduleContext");
|
|
10
10
|
var _loadComponent = _interopRequireDefault(require("./utils/loadComponent"));
|
|
11
|
-
var _url = require("../../
|
|
11
|
+
var _url = require("../../utils/url");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
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); }
|
|
14
14
|
const System = ({
|
|
@@ -32,7 +32,7 @@ const System = ({
|
|
|
32
32
|
}, _react.default.createElement(Component, props));
|
|
33
33
|
};
|
|
34
34
|
const ModuleHost = t0 => {
|
|
35
|
-
const $ = (0, _reactCompilerRuntime.c)(
|
|
35
|
+
const $ = (0, _reactCompilerRuntime.c)(36);
|
|
36
36
|
const {
|
|
37
37
|
system,
|
|
38
38
|
children: t1,
|
|
@@ -50,14 +50,17 @@ const ModuleHost = t0 => {
|
|
|
50
50
|
dialog,
|
|
51
51
|
environment,
|
|
52
52
|
preventStagingReplacement,
|
|
53
|
-
styleSettings
|
|
53
|
+
styleSettings,
|
|
54
|
+
historyLayer,
|
|
55
|
+
isHistoryDisabled
|
|
54
56
|
} = t0;
|
|
55
57
|
const children = t1 === undefined ? null : t1;
|
|
56
58
|
let result;
|
|
57
|
-
if ($[0] !== currentPage || $[1] !== customData || $[2] !== device || $[3] !== dialog || $[4] !== environment || $[5] !== isAdminModeActive || $[6] !==
|
|
59
|
+
if ($[0] !== currentPage || $[1] !== customData || $[2] !== device || $[3] !== dialog || $[4] !== environment || $[5] !== isAdminModeActive || $[6] !== isHistoryDisabled || $[7] !== language || $[8] !== pages || $[9] !== parameters || $[10] !== site || $[11] !== styleSettings || $[12] !== user) {
|
|
58
60
|
result = {
|
|
59
61
|
site,
|
|
60
62
|
isAdminModeActive,
|
|
63
|
+
isHistoryDisabled,
|
|
61
64
|
pages,
|
|
62
65
|
currentPage,
|
|
63
66
|
device,
|
|
@@ -79,49 +82,50 @@ const ModuleHost = t0 => {
|
|
|
79
82
|
$[3] = dialog;
|
|
80
83
|
$[4] = environment;
|
|
81
84
|
$[5] = isAdminModeActive;
|
|
82
|
-
$[6] =
|
|
83
|
-
$[7] =
|
|
84
|
-
$[8] =
|
|
85
|
-
$[9] =
|
|
86
|
-
$[10] =
|
|
87
|
-
$[11] =
|
|
88
|
-
$[12] =
|
|
85
|
+
$[6] = isHistoryDisabled;
|
|
86
|
+
$[7] = language;
|
|
87
|
+
$[8] = pages;
|
|
88
|
+
$[9] = parameters;
|
|
89
|
+
$[10] = site;
|
|
90
|
+
$[11] = styleSettings;
|
|
91
|
+
$[12] = user;
|
|
92
|
+
$[13] = result;
|
|
89
93
|
} else {
|
|
90
|
-
result = $[
|
|
94
|
+
result = $[13];
|
|
91
95
|
}
|
|
92
96
|
const data = result;
|
|
93
97
|
let t2;
|
|
94
|
-
if ($[
|
|
98
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
95
99
|
t2 = _react.default.createElement("div", {
|
|
96
100
|
className: "module-css"
|
|
97
101
|
});
|
|
98
|
-
$[
|
|
102
|
+
$[14] = t2;
|
|
99
103
|
} else {
|
|
100
|
-
t2 = $[
|
|
104
|
+
t2 = $[14];
|
|
101
105
|
}
|
|
102
106
|
const t3 = system.scope;
|
|
103
107
|
let t4;
|
|
104
|
-
if ($[
|
|
108
|
+
if ($[15] !== environment.buildEnvironment || $[16] !== preventStagingReplacement || $[17] !== system.url) {
|
|
105
109
|
t4 = (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.buildEnvironment);
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
+
$[15] = environment.buildEnvironment;
|
|
111
|
+
$[16] = preventStagingReplacement;
|
|
112
|
+
$[17] = system.url;
|
|
113
|
+
$[18] = t4;
|
|
110
114
|
} else {
|
|
111
|
-
t4 = $[
|
|
115
|
+
t4 = $[18];
|
|
112
116
|
}
|
|
113
117
|
let t5;
|
|
114
|
-
if ($[
|
|
118
|
+
if ($[19] !== environment.buildEnvironment || $[20] !== preventStagingReplacement || $[21] !== system.serverUrl) {
|
|
115
119
|
t5 = (0, _url.replaceStagingUrl)(preventStagingReplacement, system.serverUrl, environment.buildEnvironment);
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
+
$[19] = environment.buildEnvironment;
|
|
121
|
+
$[20] = preventStagingReplacement;
|
|
122
|
+
$[21] = system.serverUrl;
|
|
123
|
+
$[22] = t5;
|
|
120
124
|
} else {
|
|
121
|
-
t5 = $[
|
|
125
|
+
t5 = $[22];
|
|
122
126
|
}
|
|
123
127
|
let t6;
|
|
124
|
-
if ($[
|
|
128
|
+
if ($[23] !== system.module || $[24] !== system.preventSingleton || $[25] !== system.scope || $[26] !== t4 || $[27] !== t5) {
|
|
125
129
|
t6 = {
|
|
126
130
|
scope: t3,
|
|
127
131
|
url: t4,
|
|
@@ -129,33 +133,35 @@ const ModuleHost = t0 => {
|
|
|
129
133
|
module: system.module,
|
|
130
134
|
preventSingleton: system.preventSingleton
|
|
131
135
|
};
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
136
|
+
$[23] = system.module;
|
|
137
|
+
$[24] = system.preventSingleton;
|
|
138
|
+
$[25] = system.scope;
|
|
139
|
+
$[26] = t4;
|
|
140
|
+
$[27] = t5;
|
|
141
|
+
$[28] = t6;
|
|
138
142
|
} else {
|
|
139
|
-
t6 = $[
|
|
143
|
+
t6 = $[28];
|
|
140
144
|
}
|
|
141
145
|
let t7;
|
|
142
|
-
if ($[
|
|
146
|
+
if ($[29] !== children || $[30] !== customFunctions || $[31] !== data || $[32] !== functions || $[33] !== historyLayer || $[34] !== t6) {
|
|
143
147
|
t7 = _react.default.createElement(_react.default.Fragment, null, t2, _react.default.createElement(System, {
|
|
144
148
|
system: t6,
|
|
145
149
|
data: data,
|
|
146
150
|
functions: functions,
|
|
147
151
|
customFunctions: customFunctions,
|
|
148
152
|
fallback: children,
|
|
153
|
+
historyLayer: historyLayer,
|
|
149
154
|
isModule: true
|
|
150
155
|
}));
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
156
|
+
$[29] = children;
|
|
157
|
+
$[30] = customFunctions;
|
|
158
|
+
$[31] = data;
|
|
159
|
+
$[32] = functions;
|
|
160
|
+
$[33] = historyLayer;
|
|
161
|
+
$[34] = t6;
|
|
162
|
+
$[35] = t7;
|
|
157
163
|
} else {
|
|
158
|
-
t7 = $[
|
|
164
|
+
t7 = $[35];
|
|
159
165
|
}
|
|
160
166
|
return t7;
|
|
161
167
|
};
|