chayns-api 2.0.8 → 2.0.9-1
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/.babelrc +30 -30
- package/.eslintrc +17 -17
- package/.github/workflows/deploy_docs.yml +28 -28
- package/.github/workflows/publish.yml +21 -21
- package/LICENSE +21 -21
- package/README.md +67 -67
- package/dist/cjs/calls/dialogs/date.js +34 -34
- package/dist/cjs/calls/index.js +108 -108
- package/dist/cjs/calls/sendMessage.js +8 -8
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/AppDialogWrapper.js +2 -2
- package/dist/cjs/components/ChaynsContext.js +2 -4
- package/dist/cjs/components/ChaynsProvider.js +11 -21
- package/dist/cjs/components/ErrorBoundary.js +1 -1
- package/dist/cjs/components/withCompatMode.js +3 -3
- package/dist/cjs/components/withHydrationBoundary.js +1 -1
- package/dist/cjs/hooks/context.js +20 -5
- package/dist/cjs/hooks/geoLocationListener.js +6 -7
- package/dist/cjs/hooks/scrollListener.js +11 -12
- package/dist/cjs/hooks/useAccessToken.js +4 -5
- package/dist/cjs/hooks/useCurrentPage.js +3 -4
- package/dist/cjs/hooks/useCustomCallbackFunction.js +5 -10
- package/dist/cjs/hooks/useCustomData.js +3 -4
- package/dist/cjs/hooks/useDevice.js +3 -4
- package/dist/cjs/hooks/useDialogState.js +12 -13
- package/dist/cjs/hooks/useEnvironment.js +3 -4
- package/dist/cjs/hooks/useFunctions.js +3 -6
- package/dist/cjs/hooks/useIsAdminMode.js +6 -7
- package/dist/cjs/hooks/useLanguage.js +3 -4
- package/dist/cjs/hooks/usePages.js +6 -7
- package/dist/cjs/hooks/useParameters.js +3 -4
- package/dist/cjs/hooks/useSite.js +3 -4
- package/dist/cjs/hooks/useUser.js +6 -4
- package/dist/cjs/hooks/useValues.js +3 -6
- package/dist/cjs/hooks/windowMetricsListener.js +7 -8
- package/dist/cjs/host/ChaynsHost.js +1 -1
- package/dist/cjs/host/iframe/HostIframe.js +2 -2
- package/dist/cjs/host/module/ModuleHost.js +1 -1
- package/dist/cjs/host/module/utils/loadComponent.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/IChaynsReact.js +4 -4
- package/dist/cjs/util/heightHelper.js +1 -1
- package/dist/cjs/util/initModuleFederationSharing.js +1 -1
- package/dist/cjs/wrapper/AppWrapper.js +11 -1
- package/dist/cjs/wrapper/FrameWrapper.js +11 -1
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +11 -1
- package/dist/cjs/wrapper/SsrWrapper.js +10 -0
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -1
- package/dist/esm/calls/dialogs/date.js +34 -34
- package/dist/esm/calls/index.js +108 -108
- package/dist/esm/calls/sendMessage.js +8 -8
- package/dist/esm/calls/visibilityChangeListener.js +4 -4
- package/dist/esm/components/AppDialogWrapper.js +1 -1
- package/dist/esm/components/ChaynsContext.js +1 -3
- package/dist/esm/components/ChaynsProvider.js +11 -21
- package/dist/esm/components/withCompatMode.js +2 -2
- package/dist/esm/components/withHydrationBoundary.js +1 -1
- package/dist/esm/handler/DialogHandler.js +1 -1
- package/dist/esm/hooks/context.js +18 -4
- package/dist/esm/hooks/geoLocationListener.js +7 -8
- package/dist/esm/hooks/scrollListener.js +12 -13
- package/dist/esm/hooks/useAccessToken.js +6 -7
- package/dist/esm/hooks/useCurrentPage.js +4 -5
- package/dist/esm/hooks/useCustomCallbackFunction.js +5 -10
- package/dist/esm/hooks/useCustomData.js +4 -5
- package/dist/esm/hooks/useDevice.js +4 -5
- package/dist/esm/hooks/useDialogState.js +13 -14
- package/dist/esm/hooks/useEnvironment.js +4 -5
- package/dist/esm/hooks/useFunctions.js +4 -7
- package/dist/esm/hooks/useIsAdminMode.js +7 -8
- package/dist/esm/hooks/useLanguage.js +4 -5
- package/dist/esm/hooks/usePages.js +7 -8
- package/dist/esm/hooks/useParameters.js +4 -5
- package/dist/esm/hooks/useSite.js +4 -5
- package/dist/esm/hooks/useUser.js +7 -5
- package/dist/esm/hooks/useValues.js +4 -7
- package/dist/esm/hooks/windowMetricsListener.js +8 -9
- package/dist/esm/host/iframe/HostIframe.js +1 -1
- package/dist/esm/types/IChaynsReact.js +4 -4
- package/dist/esm/wrapper/AppWrapper.js +11 -1
- package/dist/esm/wrapper/FrameWrapper.js +11 -1
- package/dist/esm/wrapper/ModuleFederationWrapper.js +13 -0
- package/dist/esm/wrapper/SsrWrapper.js +13 -0
- package/dist/esm/wrapper/StaticChaynsApi.js +1 -1
- package/dist/types/calls/dialogs/alert.d.ts +1 -1
- package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
- package/dist/types/calls/dialogs/close.d.ts +1 -1
- package/dist/types/calls/dialogs/communication.d.ts +3 -3
- package/dist/types/calls/dialogs/confirm.d.ts +13 -13
- package/dist/types/calls/dialogs/date.d.ts +96 -96
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
- package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
- package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
- package/dist/types/calls/dialogs/index.d.ts +14 -14
- package/dist/types/calls/dialogs/input.d.ts +15 -15
- package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
- package/dist/types/calls/dialogs/open.d.ts +1 -1
- package/dist/types/calls/dialogs/select.d.ts +6 -6
- package/dist/types/calls/dialogs/signature.d.ts +7 -7
- package/dist/types/calls/dialogs/toast.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
- package/dist/types/calls/getUserInfo.d.ts +9 -9
- package/dist/types/calls/index.d.ts +255 -255
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- package/dist/types/components/AppDialogWrapper.d.ts +5 -5
- package/dist/types/components/ChaynsContext.d.ts +3 -4
- package/dist/types/components/ChaynsProvider.d.ts +11 -11
- package/dist/types/components/ErrorBoundary.d.ts +13 -13
- package/dist/types/components/WaitUntil.d.ts +7 -7
- package/dist/types/components/moduleWrapper.d.ts +4 -4
- package/dist/types/components/withCompatMode.d.ts +14 -14
- package/dist/types/components/withHydrationBoundary.d.ts +24 -24
- package/dist/types/constants/hydrationContext.d.ts +6 -6
- package/dist/types/constants/index.d.ts +1 -1
- package/dist/types/constants/languages.d.ts +12 -12
- package/dist/types/handler/DialogHandler.d.ts +24 -24
- package/dist/types/helper/apiListenerHelper.d.ts +6 -6
- package/dist/types/hooks/context.d.ts +3 -2
- package/dist/types/hooks/geoLocationListener.d.ts +18 -18
- package/dist/types/hooks/index.d.ts +18 -18
- package/dist/types/hooks/scrollListener.d.ts +28 -28
- package/dist/types/hooks/useAccessToken.d.ts +6 -6
- package/dist/types/hooks/useCurrentPage.d.ts +4 -7
- package/dist/types/hooks/useCustomCallbackFunction.d.ts +5 -5
- package/dist/types/hooks/useCustomData.d.ts +4 -4
- package/dist/types/hooks/useDevice.d.ts +5 -5
- package/dist/types/hooks/useDialogState.d.ts +9 -9
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunctions.d.ts +4 -5
- package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
- package/dist/types/hooks/useLanguage.d.ts +5 -5
- package/dist/types/hooks/usePages.d.ts +18 -18
- package/dist/types/hooks/useParameters.d.ts +5 -5
- package/dist/types/hooks/useSite.d.ts +5 -5
- package/dist/types/hooks/useUser.d.ts +4 -5
- package/dist/types/hooks/useValues.d.ts +4 -5
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
- package/dist/types/host/ChaynsHost.d.ts +29 -29
- package/dist/types/host/iframe/HostIframe.d.ts +26 -26
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +28 -28
- package/dist/types/host/module/utils/loadComponent.d.ts +3 -3
- package/dist/types/index.d.ts +20 -20
- package/dist/types/types/IChaynsReact.d.ts +899 -897
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/bindChaynsApi.d.ts +1 -1
- package/dist/types/util/deviceHelper.d.ts +9 -9
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/initModuleFederationSharing.d.ts +3 -3
- package/dist/types/util/is.d.ts +5 -5
- package/dist/types/util/postIframeForm.d.ts +1 -1
- package/dist/types/util/transferNestedFunctions.d.ts +1 -1
- package/dist/types/util/url.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +22 -19
- package/dist/types/wrapper/FrameWrapper.d.ts +18 -15
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +13 -10
- package/dist/types/wrapper/SsrWrapper.d.ts +14 -11
- package/dist/types/wrapper/StaticChaynsApi.d.ts +16 -16
- package/package.json +88 -87
- package/toolkit.config.js +20 -20
- package/tsconfig.json +56 -56
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _defineProperty(
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
export default class DialogHandler {
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import { useContext } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
3
|
+
import { ChaynsContext } from '../components/ChaynsContext';
|
|
4
|
+
export const useValuesSelector = selector => {
|
|
5
|
+
const store = useContext(ChaynsContext);
|
|
6
|
+
if (!store) {
|
|
7
|
+
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
8
|
+
}
|
|
9
|
+
const getSnapshot = () => selector(store.values);
|
|
10
|
+
return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
11
|
+
};
|
|
12
|
+
export const useFunctionsSelector = selector => {
|
|
13
|
+
const store = useContext(ChaynsContext);
|
|
14
|
+
if (!store) {
|
|
15
|
+
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
16
|
+
}
|
|
17
|
+
const getSnapshot = () => selector(store.functions);
|
|
18
|
+
return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
5
19
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @category Hooks
|
|
2
|
+
import { useFunctionsSelector } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
6
|
export const useGeoLocationListener = () => {
|
|
8
|
-
const addListener =
|
|
9
|
-
const removeListener =
|
|
7
|
+
const addListener = useFunctionsSelector(f => f.addGeoLocationListener);
|
|
8
|
+
const removeListener = useFunctionsSelector(f => f.removeGeoLocationListener);
|
|
10
9
|
const promiseRef = useRef();
|
|
11
10
|
return useCallback((value, callback) => {
|
|
12
11
|
promiseRef.current = addListener(value, callback);
|
|
@@ -17,8 +16,8 @@ export const useGeoLocationListener = () => {
|
|
|
17
16
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
17
|
}, []);
|
|
19
18
|
};
|
|
20
|
-
/**
|
|
21
|
-
* @category Hooks
|
|
19
|
+
/**
|
|
20
|
+
* @category Hooks
|
|
22
21
|
*/
|
|
23
22
|
export const useGeoLocation = function () {
|
|
24
23
|
let {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
3
2
|
import { useWindowMetrics } from './windowMetricsListener';
|
|
4
|
-
import {
|
|
5
|
-
/**
|
|
6
|
-
* @category Hooks
|
|
3
|
+
import { useFunctionsSelector } from './context';
|
|
4
|
+
/**
|
|
5
|
+
* @category Hooks
|
|
7
6
|
*/
|
|
8
7
|
export const useScrollListener = () => {
|
|
9
|
-
const addListener =
|
|
10
|
-
const removeListener =
|
|
8
|
+
const addListener = useFunctionsSelector(f => f.addScrollListener);
|
|
9
|
+
const removeListener = useFunctionsSelector(f => f.removeScrollListener);
|
|
11
10
|
const promiseRef = useRef();
|
|
12
11
|
return useCallback((value, callback) => {
|
|
13
12
|
promiseRef.current = addListener(value, callback);
|
|
@@ -18,8 +17,8 @@ export const useScrollListener = () => {
|
|
|
18
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
18
|
}, []);
|
|
20
19
|
};
|
|
21
|
-
/**
|
|
22
|
-
* @category Hooks
|
|
20
|
+
/**
|
|
21
|
+
* @category Hooks
|
|
23
22
|
*/
|
|
24
23
|
export const useScrollPosition = function () {
|
|
25
24
|
let {
|
|
@@ -31,7 +30,7 @@ export const useScrollPosition = function () {
|
|
|
31
30
|
scrollX: null
|
|
32
31
|
});
|
|
33
32
|
const addListener = useScrollListener();
|
|
34
|
-
const getScrollPosition =
|
|
33
|
+
const getScrollPosition = useFunctionsSelector(f => f.getScrollPosition);
|
|
35
34
|
useEffect(() => {
|
|
36
35
|
if (enabled) {
|
|
37
36
|
return addListener({
|
|
@@ -46,8 +45,8 @@ export const useScrollPosition = function () {
|
|
|
46
45
|
}, [getScrollPosition]);
|
|
47
46
|
return value;
|
|
48
47
|
};
|
|
49
|
-
/**
|
|
50
|
-
* @category Hooks
|
|
48
|
+
/**
|
|
49
|
+
* @category Hooks
|
|
51
50
|
*/
|
|
52
51
|
export const useScrollOffsetTop = function () {
|
|
53
52
|
let {
|
|
@@ -69,8 +68,8 @@ export const useScrollOffsetTop = function () {
|
|
|
69
68
|
}
|
|
70
69
|
return 0;
|
|
71
70
|
};
|
|
72
|
-
/**
|
|
73
|
-
* @category Hooks
|
|
71
|
+
/**
|
|
72
|
+
* @category Hooks
|
|
74
73
|
*/
|
|
75
74
|
export const useScrollOffsetBottom = function () {
|
|
76
75
|
let {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { useEffect, useState } from
|
|
2
|
-
import {
|
|
3
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useFunctionsSelector } from './context';
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* @category Hooks
|
|
7
|
-
* @deprecated Use {@link getAccessToken} instead
|
|
4
|
+
/**
|
|
5
|
+
* @category Hooks
|
|
6
|
+
* @deprecated Use {@link getAccessToken} instead
|
|
8
7
|
*/
|
|
9
8
|
export const useAccessToken = accessToken => {
|
|
10
9
|
const [token, setToken] = useState(null);
|
|
11
10
|
const [externalToken, setExternalToken] = useState(null);
|
|
12
|
-
const getAccessToken =
|
|
11
|
+
const getAccessToken = useFunctionsSelector(f => f.getAccessToken);
|
|
13
12
|
useEffect(() => {
|
|
14
13
|
if (accessToken !== null && accessToken !== void 0 && accessToken.external) {
|
|
15
14
|
void getAccessToken({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
3
2
|
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
export const useCurrentPage = () =>
|
|
6
|
+
export const useCurrentPage = () => useValuesSelector(v => v.currentPage);
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useFunctionsSelector } from './context';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @category Hooks
|
|
5
|
-
* Returns customCallbackFunction
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
5
|
+
* Returns customCallbackFunction
|
|
6
6
|
*/
|
|
7
|
-
export const useCustomCallbackFunction = () =>
|
|
8
|
-
const {
|
|
9
|
-
customCallbackFunction
|
|
10
|
-
} = useFunctions();
|
|
11
|
-
return customCallbackFunction;
|
|
12
|
-
};
|
|
7
|
+
export const useCustomCallbackFunction = () => useFunctionsSelector(f => f.customCallbackFunction);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
3
2
|
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
export const useCustomData = () =>
|
|
6
|
+
export const useCustomData = () => useValuesSelector(v => v.customData);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @category Hooks
|
|
1
|
+
import { useValuesSelector } from "./context";
|
|
2
|
+
/**
|
|
3
|
+
* @category Hooks
|
|
5
4
|
*/
|
|
6
|
-
export const useDevice = () =>
|
|
5
|
+
export const useDevice = () => useValuesSelector(v => v.device);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useFunctionsSelector, useValuesSelector } from './context';
|
|
3
2
|
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
6
|
export const useDialogState = () => {
|
|
8
|
-
const setResult =
|
|
9
|
-
const sendData =
|
|
10
|
-
const addDataListener =
|
|
11
|
-
const isClosingRequested =
|
|
12
|
-
var _v$dialog;
|
|
13
|
-
return
|
|
7
|
+
const setResult = useFunctionsSelector(f => f.setDialogResult);
|
|
8
|
+
const sendData = useFunctionsSelector(f => f.dispatchEventToDialogHost);
|
|
9
|
+
const addDataListener = useFunctionsSelector(f => f.addDialogHostEventListener);
|
|
10
|
+
const isClosingRequested = useValuesSelector(v => {
|
|
11
|
+
var _v$dialog$isClosingRe, _v$dialog;
|
|
12
|
+
return (_v$dialog$isClosingRe = (_v$dialog = v.dialog) === null || _v$dialog === void 0 ? void 0 : _v$dialog.isClosingRequested) !== null && _v$dialog$isClosingRe !== void 0 ? _v$dialog$isClosingRe : false;
|
|
14
13
|
});
|
|
15
14
|
return {
|
|
16
15
|
setResult,
|
|
@@ -20,12 +19,12 @@ export const useDialogState = () => {
|
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
/**
|
|
24
|
-
* @category Hooks
|
|
22
|
+
/**
|
|
23
|
+
* @category Hooks
|
|
25
24
|
*/
|
|
26
25
|
export const useDialogData = () => {
|
|
27
|
-
return
|
|
26
|
+
return useValuesSelector(v => {
|
|
28
27
|
var _v$dialog2;
|
|
29
|
-
return
|
|
28
|
+
return (_v$dialog2 = v.dialog) === null || _v$dialog2 === void 0 ? void 0 : _v$dialog2.dialogInput;
|
|
30
29
|
});
|
|
31
30
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @category Hooks
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* @category Hooks
|
|
5
4
|
*/
|
|
6
|
-
export const useEnvironment = () =>
|
|
5
|
+
export const useEnvironment = () => useValuesSelector(v => v.environment);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useFunctionsSelector } from './context';
|
|
3
2
|
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
export const useFunctions = () =>
|
|
8
|
-
return useInternalContextSelector(ChaynsFunctionsContext, f => f || {});
|
|
9
|
-
};
|
|
6
|
+
export const useFunctions = () => useFunctionsSelector(f => f);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @category Hooks
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* @category Hooks
|
|
5
4
|
*/
|
|
6
|
-
export const useIsAdminMode = () => {
|
|
7
|
-
var
|
|
8
|
-
return (
|
|
9
|
-
};
|
|
5
|
+
export const useIsAdminMode = () => useValuesSelector(v => {
|
|
6
|
+
var _v$isAdminModeActive;
|
|
7
|
+
return (_v$isAdminModeActive = v.isAdminModeActive) !== null && _v$isAdminModeActive !== void 0 ? _v$isAdminModeActive : false;
|
|
8
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @category Hooks
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* @category Hooks
|
|
5
4
|
*/
|
|
6
|
-
export const useLanguage = () =>
|
|
5
|
+
export const useLanguage = () => useValuesSelector(v => v.language);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ChaynsContext } from '../components/ChaynsContext';
|
|
2
1
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
3
|
-
import {
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
2
|
+
import { useValuesSelector } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
6
|
export const usePages = function () {
|
|
8
7
|
let {
|
|
@@ -10,21 +9,21 @@ export const usePages = function () {
|
|
|
10
9
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
11
10
|
siteId: undefined
|
|
12
11
|
};
|
|
13
|
-
const pages =
|
|
12
|
+
const pages = useValuesSelector(v => v.pages);
|
|
14
13
|
if (siteId) {
|
|
15
14
|
pages.filter(tapp => tapp.siteId === siteId);
|
|
16
15
|
}
|
|
17
16
|
return pages;
|
|
18
17
|
};
|
|
19
|
-
/**
|
|
20
|
-
* @category Hooks
|
|
18
|
+
/**
|
|
19
|
+
* @category Hooks
|
|
21
20
|
*/
|
|
22
21
|
export const usePage = _ref => {
|
|
23
22
|
let {
|
|
24
23
|
id,
|
|
25
24
|
siteId
|
|
26
25
|
} = _ref;
|
|
27
|
-
const pages =
|
|
26
|
+
const pages = useValuesSelector(v => v.pages);
|
|
28
27
|
if (id) {
|
|
29
28
|
var _pages$find;
|
|
30
29
|
return (_pages$find = pages.find(x => x.id === id && (!siteId || x.siteId === siteId))) !== null && _pages$find !== void 0 ? _pages$find : null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @category Hooks
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* @category Hooks
|
|
5
4
|
*/
|
|
6
|
-
export const useParameters = () =>
|
|
5
|
+
export const useParameters = () => useValuesSelector(v => v.parameters || []);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @category Hooks
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* @category Hooks
|
|
5
4
|
*/
|
|
6
|
-
export const useSite = () =>
|
|
5
|
+
export const useSite = () => useValuesSelector(v => v.site);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
3
2
|
const empty = {};
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
export const useUser = () =>
|
|
6
|
+
export const useUser = () => useValuesSelector(v => {
|
|
7
|
+
var _v$user;
|
|
8
|
+
return (_v$user = v.user) !== null && _v$user !== void 0 ? _v$user : empty;
|
|
9
|
+
});
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useInternalContextSelector } from "./context";
|
|
1
|
+
import { useValuesSelector } from './context';
|
|
3
2
|
|
|
4
|
-
/**
|
|
5
|
-
* @category Hooks
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
6
5
|
*/
|
|
7
|
-
export const useValues = () =>
|
|
8
|
-
return useInternalContextSelector(ChaynsContext, v => v || {});
|
|
9
|
-
};
|
|
6
|
+
export const useValues = () => useValuesSelector(v => v);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { ChaynsFunctionsContext } from '../components/ChaynsContext';
|
|
3
2
|
import { ScreenSize } from '../types/IChaynsReact';
|
|
4
|
-
import {
|
|
5
|
-
/**
|
|
6
|
-
* @category Hooks
|
|
3
|
+
import { useFunctionsSelector } from './context';
|
|
4
|
+
/**
|
|
5
|
+
* @category Hooks
|
|
7
6
|
*/
|
|
8
7
|
export const useWindowMetricsListener = () => {
|
|
9
|
-
const addListener =
|
|
10
|
-
const removeListener =
|
|
8
|
+
const addListener = useFunctionsSelector(f => f.addWindowMetricsListener);
|
|
9
|
+
const removeListener = useFunctionsSelector(f => f.removeWindowMetricsListener);
|
|
11
10
|
const promiseRef = useRef();
|
|
12
11
|
return useCallback(callback => {
|
|
13
12
|
promiseRef.current = addListener(callback);
|
|
@@ -18,8 +17,8 @@ export const useWindowMetricsListener = () => {
|
|
|
18
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
18
|
}, []);
|
|
20
19
|
};
|
|
21
|
-
/**
|
|
22
|
-
* @category Hooks
|
|
20
|
+
/**
|
|
21
|
+
* @category Hooks
|
|
23
22
|
*/
|
|
24
23
|
export const useWindowMetrics = function () {
|
|
25
24
|
let {
|
|
@@ -35,7 +34,7 @@ export const useWindowMetrics = function () {
|
|
|
35
34
|
pageSize: ScreenSize.XS
|
|
36
35
|
});
|
|
37
36
|
const addListener = useWindowMetricsListener();
|
|
38
|
-
const getWindowMetrics =
|
|
37
|
+
const getWindowMetrics = useFunctionsSelector(f => f.getWindowMetrics);
|
|
39
38
|
useEffect(() => {
|
|
40
39
|
if (enabled) {
|
|
41
40
|
return addListener(v => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() {
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import * as comlink from 'comlink';
|
|
4
4
|
import postIframeForm from '../../util/postIframeForm';
|
|
@@ -51,12 +51,12 @@ export let ScreenSize = /*#__PURE__*/function (ScreenSize) {
|
|
|
51
51
|
return ScreenSize;
|
|
52
52
|
}({});
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* @ignore
|
|
54
|
+
/**
|
|
55
|
+
* @ignore
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
* @ignore
|
|
58
|
+
/**
|
|
59
|
+
* @ignore
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
export let AccessMode = /*#__PURE__*/function (AccessMode) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _defineProperty(
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
/* eslint-disable */
|
|
@@ -131,6 +131,7 @@ export class AppWrapper {
|
|
|
131
131
|
var _this = this;
|
|
132
132
|
_defineProperty(this, "values", null);
|
|
133
133
|
_defineProperty(this, "accessToken", '');
|
|
134
|
+
_defineProperty(this, "listeners", []);
|
|
134
135
|
_defineProperty(this, "counter", 0);
|
|
135
136
|
_defineProperty(this, "functions", {
|
|
136
137
|
getAccessToken: async () => ({
|
|
@@ -561,6 +562,15 @@ export class AppWrapper {
|
|
|
561
562
|
}
|
|
562
563
|
});
|
|
563
564
|
_defineProperty(this, "dialogs", []);
|
|
565
|
+
_defineProperty(this, "subscribe", listener => {
|
|
566
|
+
this.listeners.push(listener);
|
|
567
|
+
return () => {
|
|
568
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
569
|
+
};
|
|
570
|
+
});
|
|
571
|
+
_defineProperty(this, "emitChange", () => {
|
|
572
|
+
this.listeners.forEach(l => l());
|
|
573
|
+
});
|
|
564
574
|
}
|
|
565
575
|
notImplemented(call) {
|
|
566
576
|
console.warn(`call ${call} not implement in app`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _defineProperty(
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
@@ -18,6 +18,7 @@ export class FrameWrapper {
|
|
|
18
18
|
this.resolve = res;
|
|
19
19
|
}));
|
|
20
20
|
_defineProperty(this, "values", null);
|
|
21
|
+
_defineProperty(this, "listeners", []);
|
|
21
22
|
_defineProperty(this, "functions", {
|
|
22
23
|
addGeoLocationListener: async (value, callback) => {
|
|
23
24
|
if (!this.initialized) await this.ready;
|
|
@@ -297,6 +298,15 @@ export class FrameWrapper {
|
|
|
297
298
|
}
|
|
298
299
|
});
|
|
299
300
|
_defineProperty(this, "initialized", false);
|
|
301
|
+
_defineProperty(this, "subscribe", listener => {
|
|
302
|
+
this.listeners.push(listener);
|
|
303
|
+
return () => {
|
|
304
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
_defineProperty(this, "emitChange", () => {
|
|
308
|
+
this.listeners.forEach(l => l());
|
|
309
|
+
});
|
|
300
310
|
const initialDataTag = document.querySelector('#__CHAYNS_DATA__');
|
|
301
311
|
if (initialDataTag) {
|
|
302
312
|
this.values = JSON.parse(initialDataTag.innerHTML);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
4
|
import DialogHandler from '../handler/DialogHandler';
|
|
2
5
|
import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
|
|
3
6
|
import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
|
|
@@ -5,6 +8,16 @@ import getUserInfo from '../calls/getUserInfo';
|
|
|
5
8
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
6
9
|
export class ModuleFederationWrapper {
|
|
7
10
|
constructor(values, functions) {
|
|
11
|
+
_defineProperty(this, "listeners", []);
|
|
12
|
+
_defineProperty(this, "subscribe", listener => {
|
|
13
|
+
this.listeners.push(listener);
|
|
14
|
+
return () => {
|
|
15
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
_defineProperty(this, "emitChange", () => {
|
|
19
|
+
this.listeners.forEach(l => l());
|
|
20
|
+
});
|
|
8
21
|
this.values = values;
|
|
9
22
|
this.functions = {};
|
|
10
23
|
this.functions.addVisibilityChangeListener = async callback => addVisibilityChangeListener(callback);
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
4
|
export class SsrWrapper {
|
|
2
5
|
constructor(values, functions) {
|
|
6
|
+
_defineProperty(this, "listeners", []);
|
|
7
|
+
_defineProperty(this, "subscribe", listener => {
|
|
8
|
+
this.listeners.push(listener);
|
|
9
|
+
return () => {
|
|
10
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
_defineProperty(this, "emitChange", () => {
|
|
14
|
+
this.listeners.forEach(l => l());
|
|
15
|
+
});
|
|
3
16
|
this.initialData = values;
|
|
4
17
|
this.values = values;
|
|
5
18
|
this.functions = functions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _defineProperty(
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function alert(title?: string, message?: string): Promise<any> | "unsupported";
|
|
1
|
+
export declare function alert(title?: string, message?: string): Promise<any> | "unsupported";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export declare const buttonText: {
|
|
2
|
-
YES: string;
|
|
3
|
-
NO: string;
|
|
4
|
-
OK: string;
|
|
5
|
-
CANCEL: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const buttonType: {
|
|
8
|
-
CANCEL: number;
|
|
9
|
-
NEGATIVE: number;
|
|
10
|
-
POSITIVE: number;
|
|
11
|
-
};
|
|
12
|
-
export declare const dialogAction: {
|
|
13
|
-
ALERT_CONFIRM: number;
|
|
14
|
-
INPUT: number;
|
|
15
|
-
SELECT: number;
|
|
16
|
-
DATE: number;
|
|
17
|
-
ADVANCED_DATE: number;
|
|
18
|
-
DROP_UP_ALERT: number;
|
|
19
|
-
MEDIA_SELECT: number;
|
|
20
|
-
FILE_SELECT: number;
|
|
21
|
-
SIGNATURE: number;
|
|
22
|
-
IFRAME: number;
|
|
23
|
-
};
|
|
24
|
-
export declare function chaynsDialog(config: any): Promise<any> | "unsupported";
|
|
1
|
+
export declare const buttonText: {
|
|
2
|
+
YES: string;
|
|
3
|
+
NO: string;
|
|
4
|
+
OK: string;
|
|
5
|
+
CANCEL: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const buttonType: {
|
|
8
|
+
CANCEL: number;
|
|
9
|
+
NEGATIVE: number;
|
|
10
|
+
POSITIVE: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const dialogAction: {
|
|
13
|
+
ALERT_CONFIRM: number;
|
|
14
|
+
INPUT: number;
|
|
15
|
+
SELECT: number;
|
|
16
|
+
DATE: number;
|
|
17
|
+
ADVANCED_DATE: number;
|
|
18
|
+
DROP_UP_ALERT: number;
|
|
19
|
+
MEDIA_SELECT: number;
|
|
20
|
+
FILE_SELECT: number;
|
|
21
|
+
SIGNATURE: number;
|
|
22
|
+
IFRAME: number;
|
|
23
|
+
};
|
|
24
|
+
export declare function chaynsDialog(config: any): Promise<any> | "unsupported";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function close(): Promise<any>;
|
|
1
|
+
export declare function close(): Promise<any>;
|