chayns-api 2.5.0 → 2.5.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.
- package/dist/cjs/calls/dialogs/date.js +1 -1
- package/dist/cjs/calls/dialogs/iFrame.js +9 -6
- package/dist/cjs/calls/index.js +3 -1
- package/dist/cjs/components/ChaynsProvider.js +1 -2
- package/dist/cjs/components/withCompatMode.js +1 -2
- package/dist/cjs/components/withHydrationBoundary.js +1 -2
- package/dist/cjs/host/ChaynsHost.js +1 -2
- package/dist/cjs/host/iframe/HostIframe.js +1 -2
- package/dist/cjs/host/module/ModuleHost.js +1 -2
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/umd.index.js +1 -2
- package/dist/cjs/util/transferNestedFunctions.js +1 -2
- package/dist/cjs/wrapper/AppWrapper.js +9 -3
- package/dist/cjs/wrapper/FrameWrapper.js +6 -3
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -3
- package/dist/esm/calls/dialogs/alert.js +1 -3
- package/dist/esm/calls/dialogs/communication.js +3 -6
- package/dist/esm/calls/dialogs/confirm.js +1 -4
- package/dist/esm/calls/dialogs/date.js +4 -8
- package/dist/esm/calls/dialogs/dropUpAlert.js +1 -2
- package/dist/esm/calls/dialogs/fileSelect.js +1 -2
- package/dist/esm/calls/dialogs/iFrame.js +11 -9
- package/dist/esm/calls/dialogs/input.js +1 -2
- package/dist/esm/calls/dialogs/mediaSelect.js +1 -2
- package/dist/esm/calls/dialogs/toast.js +1 -2
- package/dist/esm/calls/dialogs/utils/callback.js +1 -2
- package/dist/esm/calls/index.js +53 -156
- package/dist/esm/components/ChaynsProvider.js +16 -19
- package/dist/esm/components/WaitUntil.js +5 -6
- package/dist/esm/components/withHydrationBoundary.js +5 -6
- package/dist/esm/handler/DialogHandler.js +1 -2
- package/dist/esm/hooks/geoLocationListener.js +5 -6
- package/dist/esm/hooks/scrollListener.js +12 -15
- package/dist/esm/hooks/usePages.js +16 -19
- package/dist/esm/hooks/windowMetricsListener.js +3 -4
- package/dist/esm/host/ChaynsHost.js +23 -24
- package/dist/esm/host/iframe/HostIframe.js +21 -22
- package/dist/esm/host/module/ModuleHost.js +24 -26
- package/dist/esm/host/module/utils/loadComponent.js +2 -5
- package/dist/esm/util/appStorage.js +3 -6
- package/dist/esm/util/deviceHelper.js +3 -4
- package/dist/esm/util/initModuleFederationSharing.js +3 -4
- package/dist/esm/util/is.js +4 -5
- package/dist/esm/util/transferNestedFunctions.js +1 -2
- package/dist/esm/wrapper/AppWrapper.js +23 -26
- package/dist/esm/wrapper/FrameWrapper.js +14 -21
- package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -5
- package/dist/esm/wrapper/StaticChaynsApi.js +2 -5
- package/dist/types/calls/dialogs/iFrame.d.ts +10 -4
- package/dist/types/calls/index.d.ts +2 -0
- package/dist/types/types/IChaynsReact.d.ts +22 -4
- package/dist/types/wrapper/StaticChaynsApi.d.ts +68 -4
- package/eslint.config.mjs +3 -0
- package/package.json +23 -21
- package/{toolkit.config.js → toolkit.config.ts} +6 -3
- package/tsconfig.json +1 -0
- package/.eslintrc +0 -17
package/dist/esm/calls/index.js
CHANGED
|
@@ -1,158 +1,57 @@
|
|
|
1
1
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
2
|
-
export const addGeoLocationListener =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export const logout = function () {
|
|
54
|
-
return moduleWrapper.current.functions.logout(...arguments);
|
|
55
|
-
};
|
|
56
|
-
export const navigateBack = function () {
|
|
57
|
-
return moduleWrapper.current.functions.navigateBack(...arguments);
|
|
58
|
-
};
|
|
59
|
-
export const openImage = function () {
|
|
60
|
-
return moduleWrapper.current.functions.openImage(...arguments);
|
|
61
|
-
};
|
|
62
|
-
export const openMedia = function () {
|
|
63
|
-
return moduleWrapper.current.functions.openMedia(...arguments);
|
|
64
|
-
};
|
|
65
|
-
export const openUrl = function () {
|
|
66
|
-
return moduleWrapper.current.functions.openUrl(...arguments);
|
|
67
|
-
};
|
|
68
|
-
export const openVideo = function () {
|
|
69
|
-
return moduleWrapper.current.functions.openVideo(...arguments);
|
|
70
|
-
};
|
|
71
|
-
export const refreshData = function () {
|
|
72
|
-
return moduleWrapper.current.functions.refreshData(...arguments);
|
|
73
|
-
};
|
|
74
|
-
export const refreshAccessToken = function () {
|
|
75
|
-
return moduleWrapper.current.functions.refreshAccessToken(...arguments);
|
|
76
|
-
};
|
|
77
|
-
export const removeGeoLocationListener = function () {
|
|
78
|
-
return moduleWrapper.current.functions.removeGeoLocationListener(...arguments);
|
|
79
|
-
};
|
|
80
|
-
export const removeToolbarChangeListener = function () {
|
|
81
|
-
return moduleWrapper.current.functions.removeToolbarChangeListener(...arguments);
|
|
82
|
-
};
|
|
83
|
-
export const removeAccessTokenChangeListener = function () {
|
|
84
|
-
return moduleWrapper.current.functions.removeAccessTokenChangeListener(...arguments);
|
|
85
|
-
};
|
|
86
|
-
export const removeScrollListener = function () {
|
|
87
|
-
return moduleWrapper.current.functions.removeScrollListener(...arguments);
|
|
88
|
-
};
|
|
89
|
-
export const removeVisibilityChangeListener = function () {
|
|
90
|
-
return moduleWrapper.current.functions.removeVisibilityChangeListener(...arguments);
|
|
91
|
-
};
|
|
92
|
-
export const removeWindowMetricsListener = function () {
|
|
93
|
-
return moduleWrapper.current.functions.removeWindowMetricsListener(...arguments);
|
|
94
|
-
};
|
|
95
|
-
export const selectPage = function () {
|
|
96
|
-
return moduleWrapper.current.functions.selectPage(...arguments);
|
|
97
|
-
};
|
|
98
|
-
export const scrollByY = function () {
|
|
99
|
-
return moduleWrapper.current.functions.scrollByY(...arguments);
|
|
100
|
-
};
|
|
101
|
-
export const scrollToY = function () {
|
|
102
|
-
return moduleWrapper.current.functions.scrollToY(...arguments);
|
|
103
|
-
};
|
|
104
|
-
export const sendMessageToGroup = function () {
|
|
105
|
-
return moduleWrapper.current.functions.sendMessageToGroup(...arguments);
|
|
106
|
-
};
|
|
107
|
-
export const sendMessageToPage = function () {
|
|
108
|
-
return moduleWrapper.current.functions.sendMessageToPage(...arguments);
|
|
109
|
-
};
|
|
110
|
-
export const sendMessageToUser = function () {
|
|
111
|
-
return moduleWrapper.current.functions.sendMessageToUser(...arguments);
|
|
112
|
-
};
|
|
113
|
-
export const setAdminMode = function () {
|
|
114
|
-
return moduleWrapper.current.functions.setAdminMode(...arguments);
|
|
115
|
-
};
|
|
116
|
-
export const setCustomCookie = function () {
|
|
117
|
-
return moduleWrapper.current.functions.setCustomCookie(...arguments);
|
|
118
|
-
};
|
|
119
|
-
export const setDisplayTimeout = function () {
|
|
120
|
-
return moduleWrapper.current.functions.setDisplayTimeout(...arguments);
|
|
121
|
-
};
|
|
122
|
-
export const setFloatingButton = function () {
|
|
123
|
-
return moduleWrapper.current.functions.setFloatingButton(...arguments);
|
|
124
|
-
};
|
|
125
|
-
export const setHeight = function () {
|
|
126
|
-
return moduleWrapper.current.functions.setHeight(...arguments);
|
|
127
|
-
};
|
|
128
|
-
export const setRefreshScrollEnabled = function () {
|
|
129
|
-
return moduleWrapper.current.functions.setRefreshScrollEnabled(...arguments);
|
|
130
|
-
};
|
|
131
|
-
export const setScanQrCode = function () {
|
|
132
|
-
return moduleWrapper.current.functions.setScanQrCode(...arguments);
|
|
133
|
-
};
|
|
134
|
-
export const setTempDesignSettings = function () {
|
|
135
|
-
return moduleWrapper.current.functions.setTempDesignSettings(...arguments);
|
|
136
|
-
};
|
|
137
|
-
export const setWaitCursor = function () {
|
|
138
|
-
return moduleWrapper.current.functions.setWaitCursor(...arguments);
|
|
139
|
-
};
|
|
140
|
-
export const storageGetItem = function () {
|
|
141
|
-
return moduleWrapper.current.functions.storageGetItem(...arguments);
|
|
142
|
-
};
|
|
143
|
-
export const storageRemoveItem = function () {
|
|
144
|
-
return moduleWrapper.current.functions.storageRemoveItem(...arguments);
|
|
145
|
-
};
|
|
146
|
-
export const storageSetItem = function () {
|
|
147
|
-
return moduleWrapper.current.functions.storageSetItem(...arguments);
|
|
148
|
-
};
|
|
149
|
-
export const vibrate = function () {
|
|
150
|
-
return moduleWrapper.current.functions.vibrate(...arguments);
|
|
151
|
-
};
|
|
2
|
+
export const addGeoLocationListener = (...args) => moduleWrapper.current.functions.addGeoLocationListener(...args);
|
|
3
|
+
export const addScrollListener = (...args) => moduleWrapper.current.functions.addScrollListener(...args);
|
|
4
|
+
export const addVisibilityChangeListener = (...args) => moduleWrapper.current.functions.addVisibilityChangeListener(...args);
|
|
5
|
+
export const addToolbarChangeListener = (...args) => moduleWrapper.current.functions.addToolbarChangeListener(...args);
|
|
6
|
+
export const addAccessTokenChangeListener = (...args) => moduleWrapper.current.functions.addAccessTokenChangeListener(...args);
|
|
7
|
+
export const addWindowMetricsListener = (...args) => moduleWrapper.current.functions.addWindowMetricsListener(...args);
|
|
8
|
+
export const customCallbackFunction = (...args) => moduleWrapper.current.functions.customCallbackFunction(...args);
|
|
9
|
+
export const getAccessToken = (...args) => moduleWrapper.current.functions.getAccessToken(...args);
|
|
10
|
+
export const getAvailableSharingServices = (...args) => moduleWrapper.current.functions.getAvailableSharingServices(...args);
|
|
11
|
+
export const getCustomCookie = (...args) => moduleWrapper.current.functions.getCustomCookie(...args);
|
|
12
|
+
export const getGeoLocation = (...args) => moduleWrapper.current.functions.getGeoLocation(...args);
|
|
13
|
+
export const getUserInfo = (...args) => moduleWrapper.current.functions.getUserInfo(...args);
|
|
14
|
+
export const getScrollPosition = (...args) => moduleWrapper.current.functions.getScrollPosition(...args);
|
|
15
|
+
export const getWindowMetrics = (...args) => moduleWrapper.current.functions.getWindowMetrics(...args);
|
|
16
|
+
export const invokeCall = (...args) => moduleWrapper.current.functions.invokeCall(...args);
|
|
17
|
+
export const invokePaymentCall = (...args) => moduleWrapper.current.functions.invokePaymentCall(...args);
|
|
18
|
+
export const invokeDialogCall = (...args) => moduleWrapper.current.functions.invokeDialogCall(...args);
|
|
19
|
+
export const login = (...args) => moduleWrapper.current.functions.login(...args);
|
|
20
|
+
export const logout = (...args) => moduleWrapper.current.functions.logout(...args);
|
|
21
|
+
export const navigateBack = (...args) => moduleWrapper.current.functions.navigateBack(...args);
|
|
22
|
+
export const openImage = (...args) => moduleWrapper.current.functions.openImage(...args);
|
|
23
|
+
export const openMedia = (...args) => moduleWrapper.current.functions.openMedia(...args);
|
|
24
|
+
export const openUrl = (...args) => moduleWrapper.current.functions.openUrl(...args);
|
|
25
|
+
export const openVideo = (...args) => moduleWrapper.current.functions.openVideo(...args);
|
|
26
|
+
export const refreshData = (...args) => moduleWrapper.current.functions.refreshData(...args);
|
|
27
|
+
export const refreshAccessToken = (...args) => moduleWrapper.current.functions.refreshAccessToken(...args);
|
|
28
|
+
export const removeGeoLocationListener = (...args) => moduleWrapper.current.functions.removeGeoLocationListener(...args);
|
|
29
|
+
export const removeToolbarChangeListener = (...args) => moduleWrapper.current.functions.removeToolbarChangeListener(...args);
|
|
30
|
+
export const removeAccessTokenChangeListener = (...args) => moduleWrapper.current.functions.removeAccessTokenChangeListener(...args);
|
|
31
|
+
export const removeScrollListener = (...args) => moduleWrapper.current.functions.removeScrollListener(...args);
|
|
32
|
+
export const removeVisibilityChangeListener = (...args) => moduleWrapper.current.functions.removeVisibilityChangeListener(...args);
|
|
33
|
+
export const removeWindowMetricsListener = (...args) => moduleWrapper.current.functions.removeWindowMetricsListener(...args);
|
|
34
|
+
export const selectPage = (...args) => moduleWrapper.current.functions.selectPage(...args);
|
|
35
|
+
export const scrollByY = (...args) => moduleWrapper.current.functions.scrollByY(...args);
|
|
36
|
+
export const scrollToY = (...args) => moduleWrapper.current.functions.scrollToY(...args);
|
|
37
|
+
export const sendMessageToGroup = (...args) => moduleWrapper.current.functions.sendMessageToGroup(...args);
|
|
38
|
+
export const sendMessageToPage = (...args) => moduleWrapper.current.functions.sendMessageToPage(...args);
|
|
39
|
+
export const sendMessageToUser = (...args) => moduleWrapper.current.functions.sendMessageToUser(...args);
|
|
40
|
+
export const setAdminMode = (...args) => moduleWrapper.current.functions.setAdminMode(...args);
|
|
41
|
+
export const setCustomCookie = (...args) => moduleWrapper.current.functions.setCustomCookie(...args);
|
|
42
|
+
export const setDisplayTimeout = (...args) => moduleWrapper.current.functions.setDisplayTimeout(...args);
|
|
43
|
+
export const setFloatingButton = (...args) => moduleWrapper.current.functions.setFloatingButton(...args);
|
|
44
|
+
export const setHeight = (...args) => moduleWrapper.current.functions.setHeight(...args);
|
|
45
|
+
export const setRefreshScrollEnabled = (...args) => moduleWrapper.current.functions.setRefreshScrollEnabled(...args);
|
|
46
|
+
export const setScanQrCode = (...args) => moduleWrapper.current.functions.setScanQrCode(...args);
|
|
47
|
+
export const setTempDesignSettings = (...args) => moduleWrapper.current.functions.setTempDesignSettings(...args);
|
|
48
|
+
export const setWaitCursor = (...args) => moduleWrapper.current.functions.setWaitCursor(...args);
|
|
49
|
+
export const storageGetItem = (...args) => moduleWrapper.current.functions.storageGetItem(...args);
|
|
50
|
+
export const storageRemoveItem = (...args) => moduleWrapper.current.functions.storageRemoveItem(...args);
|
|
51
|
+
export const storageSetItem = (...args) => moduleWrapper.current.functions.storageSetItem(...args);
|
|
52
|
+
export const vibrate = (...args) => moduleWrapper.current.functions.vibrate(...args);
|
|
152
53
|
export const createDialog = config => moduleWrapper.current.functions.createDialog(config);
|
|
153
|
-
export const setOverlay =
|
|
154
|
-
return moduleWrapper.current.functions.setOverlay(...arguments);
|
|
155
|
-
};
|
|
54
|
+
export const setOverlay = (...args) => moduleWrapper.current.functions.setOverlay(...args);
|
|
156
55
|
export const addAnonymousAccount = () => moduleWrapper.current.functions.addAnonymousAccount();
|
|
157
56
|
export const getUser = () => moduleWrapper.current.values.user;
|
|
158
57
|
export const getSite = () => moduleWrapper.current.values.site;
|
|
@@ -238,6 +137,4 @@ export const environment = new Proxy({}, {
|
|
|
238
137
|
return (_moduleWrapper$curren8 = moduleWrapper.current.values.environment) === null || _moduleWrapper$curren8 === void 0 ? void 0 : _moduleWrapper$curren8[prop];
|
|
239
138
|
}
|
|
240
139
|
});
|
|
241
|
-
export const redirect =
|
|
242
|
-
return moduleWrapper.current.functions.redirect(...arguments);
|
|
243
|
-
};
|
|
140
|
+
export const redirect = (...args) => moduleWrapper.current.functions.redirect(...args);
|
|
@@ -9,11 +9,10 @@ import { SsrWrapper } from '../wrapper/SsrWrapper';
|
|
|
9
9
|
import { ChaynsContext } from './ChaynsContext';
|
|
10
10
|
import { addModuleWrapper, moduleWrapper, removeModuleWrapper } from './moduleWrapper';
|
|
11
11
|
const isServer = typeof window === 'undefined';
|
|
12
|
-
const InitialDataProvider = React.memo(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
12
|
+
const InitialDataProvider = React.memo(({
|
|
13
|
+
data,
|
|
14
|
+
renderedByServer
|
|
15
|
+
}) => {
|
|
17
16
|
if (!renderedByServer) {
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
@@ -25,16 +24,15 @@ const InitialDataProvider = React.memo(_ref => {
|
|
|
25
24
|
}
|
|
26
25
|
});
|
|
27
26
|
}, () => true);
|
|
28
|
-
const ChaynsProvider =
|
|
27
|
+
const ChaynsProvider = ({
|
|
28
|
+
children,
|
|
29
|
+
data,
|
|
30
|
+
functions,
|
|
31
|
+
customFunctions,
|
|
32
|
+
renderedByServer,
|
|
33
|
+
isModule
|
|
34
|
+
}) => {
|
|
29
35
|
var _customWrapper$curren, _customWrapper$curren2;
|
|
30
|
-
let {
|
|
31
|
-
children,
|
|
32
|
-
data,
|
|
33
|
-
functions,
|
|
34
|
-
customFunctions,
|
|
35
|
-
renderedByServer,
|
|
36
|
-
isModule
|
|
37
|
-
} = _ref2;
|
|
38
36
|
const customWrapper = useRef(null);
|
|
39
37
|
if (!customWrapper.current) {
|
|
40
38
|
if (isModule) {
|
|
@@ -64,11 +62,10 @@ const ChaynsProvider = _ref2 => {
|
|
|
64
62
|
useEffect(() => {
|
|
65
63
|
void (async () => {
|
|
66
64
|
await customWrapper.current.init();
|
|
67
|
-
customWrapper.current.addDataListener(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} = _ref3;
|
|
65
|
+
customWrapper.current.addDataListener(({
|
|
66
|
+
type,
|
|
67
|
+
value
|
|
68
|
+
}) => {
|
|
72
69
|
customWrapper.current.emitChange();
|
|
73
70
|
});
|
|
74
71
|
if (!isInitialized) {
|
|
@@ -9,12 +9,11 @@ const handleTasks = async tasks => {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
export const WaitUntil =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = _ref;
|
|
12
|
+
export const WaitUntil = ({
|
|
13
|
+
tasks,
|
|
14
|
+
children,
|
|
15
|
+
loadingComponent
|
|
16
|
+
}) => {
|
|
18
17
|
const [loaded, setLoaded] = useState(() => !tasks.length);
|
|
19
18
|
useEffect(() => {
|
|
20
19
|
handleTasks(tasks).finally(() => setLoaded(true));
|
|
@@ -3,12 +3,11 @@ import React, { useContext, useEffect, useState } from 'react';
|
|
|
3
3
|
import { HydrationContext } from '../constants';
|
|
4
4
|
function withHydrationBoundary(Component, initializer, useHydrationId, useProps) {
|
|
5
5
|
const stores = {};
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
6
|
+
return ({
|
|
7
|
+
id: idProp,
|
|
8
|
+
children,
|
|
9
|
+
...rest
|
|
10
|
+
}) => {
|
|
12
11
|
let value;
|
|
13
12
|
if (!globalThis.window) {
|
|
14
13
|
value = useContext(HydrationContext);
|
|
@@ -28,8 +28,7 @@ export default class DialogHandler {
|
|
|
28
28
|
});
|
|
29
29
|
return this.result = res;
|
|
30
30
|
}
|
|
31
|
-
close(buttonType) {
|
|
32
|
-
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
31
|
+
close(buttonType, data = undefined) {
|
|
33
32
|
if (!this.isOpen) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
@@ -12,12 +12,11 @@ export const useGeoLocationListener = () => {
|
|
|
12
12
|
};
|
|
13
13
|
}, []);
|
|
14
14
|
};
|
|
15
|
-
export const useGeoLocation =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
+
export const useGeoLocation = ({
|
|
16
|
+
enabled = true,
|
|
17
|
+
timeout = 0,
|
|
18
|
+
silent = false
|
|
19
|
+
} = {}) => {
|
|
21
20
|
const [value, setValue] = useState(null);
|
|
22
21
|
const addListener = useGeoLocationListener();
|
|
23
22
|
useEffect(() => {
|
|
@@ -13,11 +13,10 @@ export const useScrollListener = () => {
|
|
|
13
13
|
};
|
|
14
14
|
}, []);
|
|
15
15
|
};
|
|
16
|
-
export const useScrollPosition =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
export const useScrollPosition = ({
|
|
17
|
+
enabled = true,
|
|
18
|
+
throttle = 200
|
|
19
|
+
} = {}) => {
|
|
21
20
|
const [value, setValue] = useState({
|
|
22
21
|
scrollY: null,
|
|
23
22
|
scrollX: null
|
|
@@ -37,11 +36,10 @@ export const useScrollPosition = function () {
|
|
|
37
36
|
}, [getScrollPosition]);
|
|
38
37
|
return value;
|
|
39
38
|
};
|
|
40
|
-
export const useScrollOffsetTop =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
39
|
+
export const useScrollOffsetTop = ({
|
|
40
|
+
enabled = true,
|
|
41
|
+
throttle = 200
|
|
42
|
+
} = {}) => {
|
|
45
43
|
const scrollPosition = useScrollPosition({
|
|
46
44
|
enabled,
|
|
47
45
|
throttle
|
|
@@ -57,11 +55,10 @@ export const useScrollOffsetTop = function () {
|
|
|
57
55
|
}
|
|
58
56
|
return 0;
|
|
59
57
|
};
|
|
60
|
-
export const useScrollOffsetBottom =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
58
|
+
export const useScrollOffsetBottom = ({
|
|
59
|
+
enabled = true,
|
|
60
|
+
throttle = 200
|
|
61
|
+
} = {}) => {
|
|
65
62
|
const scrollPosition = useScrollPosition({
|
|
66
63
|
enabled,
|
|
67
64
|
throttle
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
2
2
|
import { useValuesSelector } from './context';
|
|
3
|
-
export const usePages =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
3
|
+
export const usePages = ({
|
|
4
|
+
siteId
|
|
5
|
+
} = {
|
|
6
|
+
siteId: undefined
|
|
7
|
+
}) => {
|
|
9
8
|
const pages = useValuesSelector(v => v.pages);
|
|
10
9
|
if (siteId) {
|
|
11
10
|
pages.filter(tapp => tapp.siteId === siteId);
|
|
12
11
|
}
|
|
13
12
|
return pages;
|
|
14
13
|
};
|
|
15
|
-
export const usePage =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
14
|
+
export const usePage = ({
|
|
15
|
+
id,
|
|
16
|
+
siteId
|
|
17
|
+
}) => {
|
|
20
18
|
const pages = useValuesSelector(v => v.pages);
|
|
21
19
|
if (id) {
|
|
22
20
|
var _pages$find;
|
|
@@ -24,15 +22,14 @@ export const usePage = _ref => {
|
|
|
24
22
|
}
|
|
25
23
|
return null;
|
|
26
24
|
};
|
|
27
|
-
export const getPage =
|
|
25
|
+
export const getPage = ({
|
|
26
|
+
id,
|
|
27
|
+
siteId
|
|
28
|
+
} = {
|
|
29
|
+
id: null,
|
|
30
|
+
siteId: null
|
|
31
|
+
}) => {
|
|
28
32
|
var _pages$find3;
|
|
29
|
-
let {
|
|
30
|
-
id,
|
|
31
|
-
siteId
|
|
32
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
33
|
-
id: null,
|
|
34
|
-
siteId: null
|
|
35
|
-
};
|
|
36
33
|
const {
|
|
37
34
|
pages,
|
|
38
35
|
currentPage
|
|
@@ -13,10 +13,9 @@ export const useWindowMetricsListener = () => {
|
|
|
13
13
|
};
|
|
14
14
|
}, []);
|
|
15
15
|
};
|
|
16
|
-
export const useWindowMetrics =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
|
+
export const useWindowMetrics = ({
|
|
17
|
+
enabled = true
|
|
18
|
+
} = {}) => {
|
|
20
19
|
const [value, setValue] = useState({
|
|
21
20
|
bottomBarHeight: 0,
|
|
22
21
|
offsetTop: 0,
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import React, { startTransition, useEffect, useState } from 'react';
|
|
2
2
|
import HostIframe from './iframe/HostIframe';
|
|
3
3
|
import ModuleHost from './module/ModuleHost';
|
|
4
|
-
const ChaynsHost =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
4
|
+
const ChaynsHost = ({
|
|
5
|
+
type,
|
|
6
|
+
iFrameProps,
|
|
7
|
+
functions,
|
|
8
|
+
customFunctions,
|
|
9
|
+
src,
|
|
10
|
+
iFrameRef = undefined,
|
|
11
|
+
loadingComponent = undefined,
|
|
12
|
+
system,
|
|
13
|
+
pages,
|
|
14
|
+
language,
|
|
15
|
+
isAdminModeActive,
|
|
16
|
+
site,
|
|
17
|
+
user,
|
|
18
|
+
currentPage,
|
|
19
|
+
device,
|
|
20
|
+
parameters,
|
|
21
|
+
customData,
|
|
22
|
+
environment,
|
|
23
|
+
preventStagingReplacement,
|
|
24
|
+
dialog,
|
|
25
|
+
styleSettings
|
|
26
|
+
}) => {
|
|
28
27
|
const [isVisible, setIsVisible] = useState(type !== 'client-module' && (type !== 'server-module' || !!(system !== null && system !== void 0 && system.serverUrl)));
|
|
29
28
|
useEffect(() => {
|
|
30
29
|
if (isVisible) return;
|
|
@@ -4,28 +4,27 @@ import * as comlink from 'comlink';
|
|
|
4
4
|
import postIframeForm from '../../util/postIframeForm';
|
|
5
5
|
import useUpdateData from './utils/useUpdateData';
|
|
6
6
|
import { replaceStagingUrl } from "../../util/url";
|
|
7
|
-
const HostIframe =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
7
|
+
const HostIframe = ({
|
|
8
|
+
iFrameProps,
|
|
9
|
+
src,
|
|
10
|
+
postForm = false,
|
|
11
|
+
iFrameRef,
|
|
12
|
+
pages,
|
|
13
|
+
isAdminModeActive,
|
|
14
|
+
site,
|
|
15
|
+
user,
|
|
16
|
+
currentPage,
|
|
17
|
+
functions,
|
|
18
|
+
customFunctions,
|
|
19
|
+
device,
|
|
20
|
+
language,
|
|
21
|
+
parameters,
|
|
22
|
+
environment,
|
|
23
|
+
customData,
|
|
24
|
+
preventStagingReplacement,
|
|
25
|
+
dialog,
|
|
26
|
+
styleSettings
|
|
27
|
+
}) => {
|
|
29
28
|
const eventTarget = useRef();
|
|
30
29
|
const ref = useRef();
|
|
31
30
|
const currentDataRef = useRef();
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import loadComponent from './utils/loadComponent';
|
|
3
3
|
import { replaceStagingUrl } from "../../util/url";
|
|
4
|
-
const System =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} = _ref;
|
|
4
|
+
const System = ({
|
|
5
|
+
system,
|
|
6
|
+
fallback,
|
|
7
|
+
...props
|
|
8
|
+
}) => {
|
|
10
9
|
const Component = useMemo(() => loadComponent(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
11
10
|
return React.createElement(React.Suspense, {
|
|
12
11
|
fallback: fallback || ''
|
|
13
12
|
}, React.createElement(Component, props));
|
|
14
13
|
};
|
|
15
|
-
const ModuleHost =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = _ref2;
|
|
14
|
+
const ModuleHost = ({
|
|
15
|
+
system,
|
|
16
|
+
children = null,
|
|
17
|
+
functions,
|
|
18
|
+
customFunctions,
|
|
19
|
+
pages,
|
|
20
|
+
isAdminModeActive,
|
|
21
|
+
site,
|
|
22
|
+
user,
|
|
23
|
+
currentPage,
|
|
24
|
+
device,
|
|
25
|
+
language,
|
|
26
|
+
parameters,
|
|
27
|
+
customData,
|
|
28
|
+
dialog,
|
|
29
|
+
environment,
|
|
30
|
+
preventStagingReplacement,
|
|
31
|
+
styleSettings
|
|
32
|
+
}) => {
|
|
35
33
|
const data = useMemo(() => {
|
|
36
34
|
const result = {
|
|
37
35
|
site,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export const loadModule =
|
|
3
|
-
let preventSingleton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2
|
+
export const loadModule = (scope, module, url, preventSingleton = false) => {
|
|
4
3
|
if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
|
|
5
4
|
throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
|
|
6
5
|
}
|
|
@@ -43,9 +42,7 @@ export const loadModule = function (scope, module, url) {
|
|
|
43
42
|
}
|
|
44
43
|
return moduleMap[scope][module];
|
|
45
44
|
};
|
|
46
|
-
const loadComponent =
|
|
47
|
-
let skipCompatMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
48
|
-
let preventSingleton = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
45
|
+
const loadComponent = (scope, module, url, skipCompatMode = false, preventSingleton = false) => {
|
|
49
46
|
if (skipCompatMode) {
|
|
50
47
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
51
48
|
}
|