chayns-api 2.5.1 → 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.
Files changed (55) hide show
  1. package/dist/cjs/calls/dialogs/date.js +1 -1
  2. package/dist/cjs/calls/dialogs/iFrame.js +9 -6
  3. package/dist/cjs/components/ChaynsProvider.js +1 -2
  4. package/dist/cjs/components/withCompatMode.js +1 -2
  5. package/dist/cjs/components/withHydrationBoundary.js +1 -2
  6. package/dist/cjs/host/ChaynsHost.js +1 -2
  7. package/dist/cjs/host/iframe/HostIframe.js +1 -2
  8. package/dist/cjs/host/module/ModuleHost.js +1 -2
  9. package/dist/cjs/index.js +1 -2
  10. package/dist/cjs/umd.index.js +1 -2
  11. package/dist/cjs/util/transferNestedFunctions.js +1 -2
  12. package/dist/cjs/wrapper/AppWrapper.js +4 -3
  13. package/dist/cjs/wrapper/FrameWrapper.js +2 -3
  14. package/dist/cjs/wrapper/StaticChaynsApi.js +1 -3
  15. package/dist/esm/calls/dialogs/alert.js +1 -3
  16. package/dist/esm/calls/dialogs/communication.js +3 -6
  17. package/dist/esm/calls/dialogs/confirm.js +1 -4
  18. package/dist/esm/calls/dialogs/date.js +4 -8
  19. package/dist/esm/calls/dialogs/dropUpAlert.js +1 -2
  20. package/dist/esm/calls/dialogs/fileSelect.js +1 -2
  21. package/dist/esm/calls/dialogs/iFrame.js +11 -9
  22. package/dist/esm/calls/dialogs/input.js +1 -2
  23. package/dist/esm/calls/dialogs/mediaSelect.js +1 -2
  24. package/dist/esm/calls/dialogs/toast.js +1 -2
  25. package/dist/esm/calls/dialogs/utils/callback.js +1 -2
  26. package/dist/esm/calls/index.js +53 -159
  27. package/dist/esm/components/ChaynsProvider.js +16 -19
  28. package/dist/esm/components/WaitUntil.js +5 -6
  29. package/dist/esm/components/withHydrationBoundary.js +5 -6
  30. package/dist/esm/handler/DialogHandler.js +1 -2
  31. package/dist/esm/hooks/geoLocationListener.js +5 -6
  32. package/dist/esm/hooks/scrollListener.js +12 -15
  33. package/dist/esm/hooks/usePages.js +16 -19
  34. package/dist/esm/hooks/windowMetricsListener.js +3 -4
  35. package/dist/esm/host/ChaynsHost.js +23 -24
  36. package/dist/esm/host/iframe/HostIframe.js +21 -22
  37. package/dist/esm/host/module/ModuleHost.js +24 -26
  38. package/dist/esm/host/module/utils/loadComponent.js +2 -5
  39. package/dist/esm/util/appStorage.js +3 -6
  40. package/dist/esm/util/deviceHelper.js +3 -4
  41. package/dist/esm/util/initModuleFederationSharing.js +3 -4
  42. package/dist/esm/util/is.js +4 -5
  43. package/dist/esm/util/transferNestedFunctions.js +1 -2
  44. package/dist/esm/wrapper/AppWrapper.js +18 -26
  45. package/dist/esm/wrapper/FrameWrapper.js +10 -21
  46. package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -5
  47. package/dist/esm/wrapper/StaticChaynsApi.js +2 -5
  48. package/dist/types/calls/dialogs/iFrame.d.ts +10 -4
  49. package/dist/types/types/IChaynsReact.d.ts +21 -4
  50. package/dist/types/wrapper/StaticChaynsApi.d.ts +68 -4
  51. package/eslint.config.mjs +3 -0
  52. package/package.json +23 -21
  53. package/{toolkit.config.js → toolkit.config.ts} +6 -3
  54. package/tsconfig.json +1 -0
  55. package/.eslintrc +0 -17
@@ -1,161 +1,57 @@
1
1
  import { moduleWrapper } from '../components/moduleWrapper';
2
- export const addGeoLocationListener = function () {
3
- return moduleWrapper.current.functions.addGeoLocationListener(...arguments);
4
- };
5
- export const addScrollListener = function () {
6
- return moduleWrapper.current.functions.addScrollListener(...arguments);
7
- };
8
- export const addVisibilityChangeListener = function () {
9
- return moduleWrapper.current.functions.addVisibilityChangeListener(...arguments);
10
- };
11
- export const addToolbarChangeListener = function () {
12
- return moduleWrapper.current.functions.addToolbarChangeListener(...arguments);
13
- };
14
- export const addAccessTokenChangeListener = function () {
15
- return moduleWrapper.current.functions.addAccessTokenChangeListener(...arguments);
16
- };
17
- export const addWindowMetricsListener = function () {
18
- return moduleWrapper.current.functions.addWindowMetricsListener(...arguments);
19
- };
20
- export const customCallbackFunction = function () {
21
- return moduleWrapper.current.functions.customCallbackFunction(...arguments);
22
- };
23
- export const getAccessToken = function () {
24
- return moduleWrapper.current.functions.getAccessToken(...arguments);
25
- };
26
- export const getAvailableSharingServices = function () {
27
- return moduleWrapper.current.functions.getAvailableSharingServices(...arguments);
28
- };
29
- export const getCustomCookie = function () {
30
- return moduleWrapper.current.functions.getCustomCookie(...arguments);
31
- };
32
- export const getGeoLocation = function () {
33
- return moduleWrapper.current.functions.getGeoLocation(...arguments);
34
- };
35
- export const getUserInfo = function () {
36
- return moduleWrapper.current.functions.getUserInfo(...arguments);
37
- };
38
- export const getScrollPosition = function () {
39
- return moduleWrapper.current.functions.getScrollPosition(...arguments);
40
- };
41
- export const getWindowMetrics = function () {
42
- return moduleWrapper.current.functions.getWindowMetrics(...arguments);
43
- };
44
- export const invokeCall = function () {
45
- return moduleWrapper.current.functions.invokeCall(...arguments);
46
- };
47
- export const invokePaymentCall = function () {
48
- return moduleWrapper.current.functions.invokePaymentCall(...arguments);
49
- };
50
- export const invokeDialogCall = function () {
51
- return moduleWrapper.current.functions.invokeDialogCall(...arguments);
52
- };
53
- export const login = function () {
54
- return moduleWrapper.current.functions.login(...arguments);
55
- };
56
- export const logout = function () {
57
- return moduleWrapper.current.functions.logout(...arguments);
58
- };
59
- export const navigateBack = function () {
60
- return moduleWrapper.current.functions.navigateBack(...arguments);
61
- };
62
- export const openImage = function () {
63
- return moduleWrapper.current.functions.openImage(...arguments);
64
- };
65
- export const openMedia = function () {
66
- return moduleWrapper.current.functions.openMedia(...arguments);
67
- };
68
- export const openUrl = function () {
69
- return moduleWrapper.current.functions.openUrl(...arguments);
70
- };
71
- export const openVideo = function () {
72
- return moduleWrapper.current.functions.openVideo(...arguments);
73
- };
74
- export const refreshData = function () {
75
- return moduleWrapper.current.functions.refreshData(...arguments);
76
- };
77
- export const refreshAccessToken = function () {
78
- return moduleWrapper.current.functions.refreshAccessToken(...arguments);
79
- };
80
- export const removeGeoLocationListener = function () {
81
- return moduleWrapper.current.functions.removeGeoLocationListener(...arguments);
82
- };
83
- export const removeToolbarChangeListener = function () {
84
- return moduleWrapper.current.functions.removeToolbarChangeListener(...arguments);
85
- };
86
- export const removeAccessTokenChangeListener = function () {
87
- return moduleWrapper.current.functions.removeAccessTokenChangeListener(...arguments);
88
- };
89
- export const removeScrollListener = function () {
90
- return moduleWrapper.current.functions.removeScrollListener(...arguments);
91
- };
92
- export const removeVisibilityChangeListener = function () {
93
- return moduleWrapper.current.functions.removeVisibilityChangeListener(...arguments);
94
- };
95
- export const removeWindowMetricsListener = function () {
96
- return moduleWrapper.current.functions.removeWindowMetricsListener(...arguments);
97
- };
98
- export const selectPage = function () {
99
- return moduleWrapper.current.functions.selectPage(...arguments);
100
- };
101
- export const scrollByY = function () {
102
- return moduleWrapper.current.functions.scrollByY(...arguments);
103
- };
104
- export const scrollToY = function () {
105
- return moduleWrapper.current.functions.scrollToY(...arguments);
106
- };
107
- export const sendMessageToGroup = function () {
108
- return moduleWrapper.current.functions.sendMessageToGroup(...arguments);
109
- };
110
- export const sendMessageToPage = function () {
111
- return moduleWrapper.current.functions.sendMessageToPage(...arguments);
112
- };
113
- export const sendMessageToUser = function () {
114
- return moduleWrapper.current.functions.sendMessageToUser(...arguments);
115
- };
116
- export const setAdminMode = function () {
117
- return moduleWrapper.current.functions.setAdminMode(...arguments);
118
- };
119
- export const setCustomCookie = function () {
120
- return moduleWrapper.current.functions.setCustomCookie(...arguments);
121
- };
122
- export const setDisplayTimeout = function () {
123
- return moduleWrapper.current.functions.setDisplayTimeout(...arguments);
124
- };
125
- export const setFloatingButton = function () {
126
- return moduleWrapper.current.functions.setFloatingButton(...arguments);
127
- };
128
- export const setHeight = function () {
129
- return moduleWrapper.current.functions.setHeight(...arguments);
130
- };
131
- export const setRefreshScrollEnabled = function () {
132
- return moduleWrapper.current.functions.setRefreshScrollEnabled(...arguments);
133
- };
134
- export const setScanQrCode = function () {
135
- return moduleWrapper.current.functions.setScanQrCode(...arguments);
136
- };
137
- export const setTempDesignSettings = function () {
138
- return moduleWrapper.current.functions.setTempDesignSettings(...arguments);
139
- };
140
- export const setWaitCursor = function () {
141
- return moduleWrapper.current.functions.setWaitCursor(...arguments);
142
- };
143
- export const storageGetItem = function () {
144
- return moduleWrapper.current.functions.storageGetItem(...arguments);
145
- };
146
- export const storageRemoveItem = function () {
147
- return moduleWrapper.current.functions.storageRemoveItem(...arguments);
148
- };
149
- export const storageSetItem = function () {
150
- return moduleWrapper.current.functions.storageSetItem(...arguments);
151
- };
152
- export const vibrate = function () {
153
- return moduleWrapper.current.functions.vibrate(...arguments);
154
- };
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);
155
53
  export const createDialog = config => moduleWrapper.current.functions.createDialog(config);
156
- export const setOverlay = function () {
157
- return moduleWrapper.current.functions.setOverlay(...arguments);
158
- };
54
+ export const setOverlay = (...args) => moduleWrapper.current.functions.setOverlay(...args);
159
55
  export const addAnonymousAccount = () => moduleWrapper.current.functions.addAnonymousAccount();
160
56
  export const getUser = () => moduleWrapper.current.values.user;
161
57
  export const getSite = () => moduleWrapper.current.values.site;
@@ -241,6 +137,4 @@ export const environment = new Proxy({}, {
241
137
  return (_moduleWrapper$curren8 = moduleWrapper.current.values.environment) === null || _moduleWrapper$curren8 === void 0 ? void 0 : _moduleWrapper$curren8[prop];
242
138
  }
243
139
  });
244
- export const redirect = function () {
245
- return moduleWrapper.current.functions.redirect(...arguments);
246
- };
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(_ref => {
13
- let {
14
- data,
15
- renderedByServer
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 = _ref2 => {
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(_ref3 => {
68
- let {
69
- type,
70
- value
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 = _ref => {
13
- let {
14
- tasks,
15
- children,
16
- loadingComponent
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 _ref => {
7
- let {
8
- id: idProp,
9
- children,
10
- ...rest
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 = function () {
16
- let {
17
- enabled = true,
18
- timeout = 0,
19
- silent = false
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 = function () {
17
- let {
18
- enabled = true,
19
- throttle = 200
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 = function () {
41
- let {
42
- enabled = true,
43
- throttle = 200
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 = function () {
61
- let {
62
- enabled = true,
63
- throttle = 200
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 = function () {
4
- let {
5
- siteId
6
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
7
- siteId: undefined
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 = _ref => {
16
- let {
17
- id,
18
- siteId
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 = function () {
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 = function () {
17
- let {
18
- enabled = true
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 = _ref => {
5
- let {
6
- type,
7
- iFrameProps,
8
- functions,
9
- customFunctions,
10
- src,
11
- iFrameRef = undefined,
12
- loadingComponent = undefined,
13
- system,
14
- pages,
15
- language,
16
- isAdminModeActive,
17
- site,
18
- user,
19
- currentPage,
20
- device,
21
- parameters,
22
- customData,
23
- environment,
24
- preventStagingReplacement,
25
- dialog,
26
- styleSettings
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 = _ref => {
8
- let {
9
- iFrameProps,
10
- src,
11
- postForm = false,
12
- iFrameRef,
13
- pages,
14
- isAdminModeActive,
15
- site,
16
- user,
17
- currentPage,
18
- functions,
19
- customFunctions,
20
- device,
21
- language,
22
- parameters,
23
- environment,
24
- customData,
25
- preventStagingReplacement,
26
- dialog,
27
- styleSettings
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 = _ref => {
5
- let {
6
- system,
7
- fallback,
8
- ...props
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 = _ref2 => {
16
- let {
17
- system,
18
- children = null,
19
- functions,
20
- customFunctions,
21
- pages,
22
- isAdminModeActive,
23
- site,
24
- user,
25
- currentPage,
26
- device,
27
- language,
28
- parameters,
29
- customData,
30
- dialog,
31
- environment,
32
- preventStagingReplacement,
33
- styleSettings
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 = function (scope, module, url) {
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 = function (scope, module, url) {
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
  }