chayns-api 1.0.12 → 1.0.14
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 +54 -54
- package/dist/cjs/calls/dialogs/date.js +10 -10
- package/dist/cjs/calls/index.js +102 -97
- package/dist/cjs/calls/sendMessage.js +8 -8
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/AppDialogWrapper.js +42 -0
- package/dist/cjs/components/ChaynsProvider.js +5 -2
- package/dist/cjs/handler/DialogHandler.js +63 -0
- package/dist/cjs/hooks/geoLocationListener.js +4 -4
- package/dist/cjs/hooks/index.js +14 -1
- package/dist/cjs/hooks/scrollListener.js +8 -8
- package/dist/cjs/hooks/useAccessToken.js +2 -2
- package/dist/cjs/hooks/useCurrentPage.js +2 -2
- package/dist/cjs/hooks/useCustomData.js +2 -2
- package/dist/cjs/hooks/useDevice.js +2 -2
- package/dist/cjs/hooks/useDialogState.js +39 -0
- package/dist/cjs/hooks/useEnvironment.js +2 -2
- package/dist/cjs/hooks/useFunctions.js +2 -2
- package/dist/cjs/hooks/useIsAdminMode.js +2 -2
- package/dist/cjs/hooks/useLanguage.js +2 -2
- package/dist/cjs/hooks/usePages.js +4 -4
- package/dist/cjs/hooks/useParameters.js +2 -2
- package/dist/cjs/hooks/useSite.js +2 -2
- package/dist/cjs/hooks/useUser.js +2 -2
- package/dist/cjs/hooks/useValues.js +2 -2
- package/dist/cjs/hooks/windowMetricsListener.js +4 -4
- package/dist/cjs/host/ChaynsHost.js +10 -5
- package/dist/cjs/host/iframe/HostIframe.js +5 -2
- package/dist/cjs/host/module/ModuleHost.js +4 -0
- package/dist/cjs/types/IChaynsReact.js +22 -2
- package/dist/cjs/wrapper/AppWrapper.js +45 -3
- package/dist/cjs/wrapper/FrameWrapper.js +52 -1
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +4 -0
- package/dist/esm/calls/dialogs/date.js +34 -34
- package/dist/esm/calls/index.js +102 -96
- package/dist/esm/calls/sendMessage.js +8 -8
- package/dist/esm/calls/visibilityChangeListener.js +4 -4
- package/dist/esm/components/AppDialogWrapper.js +33 -0
- package/dist/esm/components/ChaynsProvider.js +5 -2
- package/dist/esm/handler/DialogHandler.js +59 -0
- package/dist/esm/hooks/geoLocationListener.js +4 -4
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/scrollListener.js +8 -8
- package/dist/esm/hooks/useAccessToken.js +2 -2
- package/dist/esm/hooks/useCurrentPage.js +2 -2
- package/dist/esm/hooks/useCustomData.js +2 -2
- package/dist/esm/hooks/useDevice.js +2 -2
- package/dist/esm/hooks/useDialogState.js +32 -0
- package/dist/esm/hooks/useEnvironment.js +2 -2
- package/dist/esm/hooks/useFunctions.js +2 -2
- package/dist/esm/hooks/useIsAdminMode.js +2 -2
- package/dist/esm/hooks/useLanguage.js +2 -2
- package/dist/esm/hooks/usePages.js +4 -4
- package/dist/esm/hooks/useParameters.js +2 -2
- package/dist/esm/hooks/useSite.js +2 -2
- package/dist/esm/hooks/useUser.js +2 -2
- package/dist/esm/hooks/useValues.js +2 -2
- package/dist/esm/hooks/windowMetricsListener.js +4 -4
- package/dist/esm/host/ChaynsHost.js +10 -5
- package/dist/esm/host/iframe/HostIframe.js +5 -2
- package/dist/esm/host/module/ModuleHost.js +4 -0
- package/dist/esm/types/IChaynsReact.js +19 -1
- package/dist/esm/wrapper/AppWrapper.js +45 -3
- package/dist/esm/wrapper/FrameWrapper.js +52 -1
- package/dist/esm/wrapper/ModuleFederationWrapper.js +4 -0
- 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 +237 -233
- 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 -0
- package/dist/types/components/ChaynsContext.d.ts +3 -3
- package/dist/types/components/ChaynsProvider.d.ts +14 -14
- package/dist/types/components/WaitUntil.d.ts +7 -8
- package/dist/types/components/withCompatMode.d.ts +13 -13
- package/dist/types/handler/DialogHandler.d.ts +19 -0
- package/dist/types/helper/apiListenerHelper.d.ts +6 -6
- package/dist/types/hooks/geoLocationListener.d.ts +18 -18
- package/dist/types/hooks/index.d.ts +17 -16
- package/dist/types/hooks/scrollListener.d.ts +28 -28
- package/dist/types/hooks/useAccessToken.d.ts +5 -5
- package/dist/types/hooks/useCurrentPage.d.ts +4 -4
- 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 -0
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunctions.d.ts +5 -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 +5 -5
- package/dist/types/hooks/useValues.d.ts +5 -5
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
- package/dist/types/host/ChaynsHost.d.ts +30 -29
- package/dist/types/host/iframe/HostIframe.d.ts +26 -25
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +26 -25
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
- package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
- package/dist/types/index.d.ts +16 -16
- package/dist/types/types/IChaynsReact.d.ts +709 -623
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/deviceHelper.d.ts +7 -7
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/postIframeForm.d.ts +1 -1
- package/dist/types/util/url.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +22 -18
- package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
- package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
- package/package.json +75 -75
- package/tsconfig.json +56 -56
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useCustomData = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useCustomData = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => v === null || v === void 0 ? void 0 : v.customData);
|
|
13
13
|
exports.useCustomData = useCustomData;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useDevice = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useDevice = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => v === null || v === void 0 ? void 0 : v.device);
|
|
13
13
|
exports.useDevice = useDevice;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDialogState = exports.useDialogData = void 0;
|
|
7
|
+
var _useContextSelector = require("use-context-selector");
|
|
8
|
+
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
|
+
*/
|
|
12
|
+
const useDialogState = () => {
|
|
13
|
+
const setResult = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsFunctionsContext, v => v === null || v === void 0 ? void 0 : v.setDialogResult);
|
|
14
|
+
const sendData = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsFunctionsContext, v => v === null || v === void 0 ? void 0 : v.dispatchEventToDialogHost);
|
|
15
|
+
const addDataListener = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsFunctionsContext, v => v === null || v === void 0 ? void 0 : v.addDialogHostEventListener);
|
|
16
|
+
const isClosingRequested = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => {
|
|
17
|
+
var _v$dialog;
|
|
18
|
+
return v === null || v === void 0 ? void 0 : (_v$dialog = v.dialog) === null || _v$dialog === void 0 ? void 0 : _v$dialog.isClosingRequested;
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
setResult,
|
|
22
|
+
sendData,
|
|
23
|
+
addDataListener,
|
|
24
|
+
isClosingRequested
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @category Hooks
|
|
30
|
+
*/
|
|
31
|
+
exports.useDialogState = useDialogState;
|
|
32
|
+
const useDialogData = () => {
|
|
33
|
+
const inputData = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => {
|
|
34
|
+
var _v$dialog2;
|
|
35
|
+
return v === null || v === void 0 ? void 0 : (_v$dialog2 = v.dialog) === null || _v$dialog2 === void 0 ? void 0 : _v$dialog2.dialogInput;
|
|
36
|
+
});
|
|
37
|
+
return inputData;
|
|
38
|
+
};
|
|
39
|
+
exports.useDialogData = useDialogData;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useEnvironment = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useEnvironment = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => v === null || v === void 0 ? void 0 : v.environment);
|
|
13
13
|
exports.useEnvironment = useEnvironment;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useFunctions = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useFunctions = () => {
|
|
13
13
|
const t = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsFunctionsContext, f => f || {});
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useIsAdminMode = void 0;
|
|
7
7
|
var _useContextSelector2 = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useIsAdminMode = () => {
|
|
13
13
|
var _useContextSelector;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useLanguage = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useLanguage = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => v === null || v === void 0 ? void 0 : v.language);
|
|
13
13
|
exports.useLanguage = useLanguage;
|
|
@@ -7,8 +7,8 @@ exports.usePages = exports.usePage = exports.getPage = void 0;
|
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
9
|
var _ChaynsProvider = require("../components/ChaynsProvider");
|
|
10
|
-
/**
|
|
11
|
-
* @category Hooks
|
|
10
|
+
/**
|
|
11
|
+
* @category Hooks
|
|
12
12
|
*/
|
|
13
13
|
const usePages = ({
|
|
14
14
|
siteId
|
|
@@ -21,8 +21,8 @@ const usePages = ({
|
|
|
21
21
|
}
|
|
22
22
|
return pages;
|
|
23
23
|
};
|
|
24
|
-
/**
|
|
25
|
-
* @category Hooks
|
|
24
|
+
/**
|
|
25
|
+
* @category Hooks
|
|
26
26
|
*/
|
|
27
27
|
exports.usePages = usePages;
|
|
28
28
|
const usePage = ({
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useParameters = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useParameters = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => (v === null || v === void 0 ? void 0 : v.parameters) || []);
|
|
13
13
|
exports.useParameters = useParameters;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useSite = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useSite = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => v === null || v === void 0 ? void 0 : v.site);
|
|
13
13
|
exports.useSite = useSite;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useUser = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useUser = () => (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => (v === null || v === void 0 ? void 0 : v.user) || {});
|
|
13
13
|
exports.useUser = useUser;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useValues = void 0;
|
|
7
7
|
var _useContextSelector = require("use-context-selector");
|
|
8
8
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
9
|
-
/**
|
|
10
|
-
* @category Hooks
|
|
9
|
+
/**
|
|
10
|
+
* @category Hooks
|
|
11
11
|
*/
|
|
12
12
|
const useValues = () => {
|
|
13
13
|
const t = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsContext, v => v || {});
|
|
@@ -8,8 +8,8 @@ var _useContextSelector = require("use-context-selector");
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
10
10
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
11
|
-
/**
|
|
12
|
-
* @category Hooks
|
|
11
|
+
/**
|
|
12
|
+
* @category Hooks
|
|
13
13
|
*/
|
|
14
14
|
const useWindowMetricsListener = () => {
|
|
15
15
|
const addListener = (0, _useContextSelector.useContextSelector)(_ChaynsContext.ChaynsFunctionsContext, v => v.addWindowMetricsListener);
|
|
@@ -24,8 +24,8 @@ const useWindowMetricsListener = () => {
|
|
|
24
24
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
25
|
}, []);
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
28
|
-
* @category Hooks
|
|
27
|
+
/**
|
|
28
|
+
* @category Hooks
|
|
29
29
|
*/
|
|
30
30
|
exports.useWindowMetricsListener = useWindowMetricsListener;
|
|
31
31
|
const useWindowMetrics = ({
|
|
@@ -28,7 +28,8 @@ const ChaynsHost = ({
|
|
|
28
28
|
parameters,
|
|
29
29
|
customData,
|
|
30
30
|
environment,
|
|
31
|
-
preventStagingReplacement
|
|
31
|
+
preventStagingReplacement,
|
|
32
|
+
dialog
|
|
32
33
|
}) => {
|
|
33
34
|
switch (type) {
|
|
34
35
|
case 'client-iframe':
|
|
@@ -47,7 +48,8 @@ const ChaynsHost = ({
|
|
|
47
48
|
parameters: parameters,
|
|
48
49
|
environment: environment,
|
|
49
50
|
customData: customData,
|
|
50
|
-
preventStagingReplacement: preventStagingReplacement
|
|
51
|
+
preventStagingReplacement: preventStagingReplacement,
|
|
52
|
+
dialog: dialog
|
|
51
53
|
});
|
|
52
54
|
case 'client-module':
|
|
53
55
|
return /*#__PURE__*/_react.default.createElement(_ModuleHost.default, {
|
|
@@ -64,7 +66,8 @@ const ChaynsHost = ({
|
|
|
64
66
|
parameters: parameters,
|
|
65
67
|
customData: customData,
|
|
66
68
|
environment: environment,
|
|
67
|
-
preventStagingReplacement: preventStagingReplacement
|
|
69
|
+
preventStagingReplacement: preventStagingReplacement,
|
|
70
|
+
dialog: dialog
|
|
68
71
|
});
|
|
69
72
|
case 'server-iframe':
|
|
70
73
|
return /*#__PURE__*/_react.default.createElement(_HostIframe.default, {
|
|
@@ -83,7 +86,8 @@ const ChaynsHost = ({
|
|
|
83
86
|
parameters: parameters,
|
|
84
87
|
environment: environment,
|
|
85
88
|
customData: customData,
|
|
86
|
-
preventStagingReplacement: preventStagingReplacement
|
|
89
|
+
preventStagingReplacement: preventStagingReplacement,
|
|
90
|
+
dialog: dialog
|
|
87
91
|
});
|
|
88
92
|
case 'server-module':
|
|
89
93
|
return /*#__PURE__*/_react.default.createElement(_ModuleHost.default, {
|
|
@@ -99,7 +103,8 @@ const ChaynsHost = ({
|
|
|
99
103
|
parameters: parameters,
|
|
100
104
|
customData: customData,
|
|
101
105
|
environment: environment,
|
|
102
|
-
preventStagingReplacement: preventStagingReplacement
|
|
106
|
+
preventStagingReplacement: preventStagingReplacement,
|
|
107
|
+
dialog: dialog
|
|
103
108
|
}, children);
|
|
104
109
|
default:
|
|
105
110
|
return null;
|
|
@@ -30,7 +30,8 @@ const HostIframe = ({
|
|
|
30
30
|
parameters,
|
|
31
31
|
environment,
|
|
32
32
|
customData,
|
|
33
|
-
preventStagingReplacement
|
|
33
|
+
preventStagingReplacement,
|
|
34
|
+
dialog
|
|
34
35
|
}) => {
|
|
35
36
|
const eventTarget = (0, _react.useRef)();
|
|
36
37
|
const ref = (0, _react.useRef)();
|
|
@@ -56,7 +57,8 @@ const HostIframe = ({
|
|
|
56
57
|
language,
|
|
57
58
|
parameters,
|
|
58
59
|
environment,
|
|
59
|
-
customData
|
|
60
|
+
customData,
|
|
61
|
+
dialog
|
|
60
62
|
};
|
|
61
63
|
// endregion
|
|
62
64
|
|
|
@@ -116,6 +118,7 @@ const HostIframe = ({
|
|
|
116
118
|
(0, _useUpdateData.default)(eventTarget.current, 'parameters', parameters);
|
|
117
119
|
(0, _useUpdateData.default)(eventTarget.current, 'environment', environment);
|
|
118
120
|
(0, _useUpdateData.default)(eventTarget.current, 'customData', customData);
|
|
121
|
+
(0, _useUpdateData.default)(eventTarget.current, 'dialog', dialog);
|
|
119
122
|
// endregion
|
|
120
123
|
|
|
121
124
|
return /*#__PURE__*/_react.default.createElement("iframe", _extends({
|
|
@@ -50,6 +50,7 @@ const ModuleHost = ({
|
|
|
50
50
|
language,
|
|
51
51
|
parameters,
|
|
52
52
|
customData,
|
|
53
|
+
dialog,
|
|
53
54
|
environment,
|
|
54
55
|
preventStagingReplacement
|
|
55
56
|
}) => {
|
|
@@ -68,6 +69,9 @@ const ModuleHost = ({
|
|
|
68
69
|
if (user) {
|
|
69
70
|
initialData.user = user;
|
|
70
71
|
}
|
|
72
|
+
if (dialog) {
|
|
73
|
+
initialData.dialog = dialog;
|
|
74
|
+
}
|
|
71
75
|
// endregion
|
|
72
76
|
|
|
73
77
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DeviceOs = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
6
|
+
exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogButtonType = exports.DeviceOs = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
7
|
+
let DialogButtonType;
|
|
8
|
+
exports.DialogButtonType = DialogButtonType;
|
|
9
|
+
(function (DialogButtonType) {
|
|
10
|
+
DialogButtonType[DialogButtonType["OK"] = 1] = "OK";
|
|
11
|
+
DialogButtonType[DialogButtonType["CANCEL"] = -1] = "CANCEL";
|
|
12
|
+
DialogButtonType[DialogButtonType["NEGATIVE"] = 0] = "NEGATIVE";
|
|
13
|
+
})(DialogButtonType || (exports.DialogButtonType = DialogButtonType = {}));
|
|
7
14
|
let ScreenSize;
|
|
8
15
|
exports.ScreenSize = ScreenSize;
|
|
9
16
|
(function (ScreenSize) {
|
|
@@ -258,4 +265,17 @@ var selectType;
|
|
|
258
265
|
(function (selectType) {
|
|
259
266
|
selectType[selectType["DEFAULT"] = 0] = "DEFAULT";
|
|
260
267
|
selectType[selectType["ICON"] = 1] = "ICON";
|
|
261
|
-
})(selectType || (selectType = {}));
|
|
268
|
+
})(selectType || (selectType = {}));
|
|
269
|
+
let DialogType;
|
|
270
|
+
exports.DialogType = DialogType;
|
|
271
|
+
(function (DialogType) {
|
|
272
|
+
DialogType["ALERT"] = "alert";
|
|
273
|
+
DialogType["CONFIRM"] = "confirm";
|
|
274
|
+
DialogType["DATE"] = "date";
|
|
275
|
+
DialogType["FILE_SELECT"] = "fileSelect";
|
|
276
|
+
DialogType["IFRAME"] = "iframe";
|
|
277
|
+
DialogType["MODULE"] = "module";
|
|
278
|
+
DialogType["INPUT"] = "input";
|
|
279
|
+
DialogType["SELECT"] = "select";
|
|
280
|
+
DialogType["TOAST"] = "toast";
|
|
281
|
+
})(DialogType || (exports.DialogType = DialogType = {}));
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.AppWrapper = void 0;
|
|
7
7
|
var _lodash = _interopRequireDefault(require("lodash.throttle"));
|
|
8
|
+
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
8
9
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
10
|
var _appCall = _interopRequireDefault(require("../util/appCall"));
|
|
10
11
|
var _deviceHelper = _interopRequireWildcard(require("../util/deviceHelper"));
|
|
@@ -17,6 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
18
|
/* eslint-disable */
|
|
18
19
|
// @ts-nocheck
|
|
19
20
|
|
|
21
|
+
let appWrapperDialogId = 0;
|
|
20
22
|
class AppWrapper {
|
|
21
23
|
values = null;
|
|
22
24
|
accessToken = '';
|
|
@@ -98,6 +100,12 @@ class AppWrapper {
|
|
|
98
100
|
notImplemented(call) {
|
|
99
101
|
console.warn(`call ${call} not implement in app`);
|
|
100
102
|
}
|
|
103
|
+
dispatchDialogChange(detail) {
|
|
104
|
+
this.dialogs = detail;
|
|
105
|
+
this.dialogEventTarget.dispatchEvent(new CustomEvent('change', {
|
|
106
|
+
detail
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
101
109
|
counter = 0;
|
|
102
110
|
appCall(action, value = {}, {
|
|
103
111
|
callback,
|
|
@@ -143,12 +151,13 @@ class AppWrapper {
|
|
|
143
151
|
permanent: true
|
|
144
152
|
}, {
|
|
145
153
|
callback: v => {
|
|
146
|
-
var _v$accuracy, _v$code;
|
|
154
|
+
var _v$accuracy, _v$isAccurate, _v$code;
|
|
147
155
|
(0, _apiListenerHelper.dispatchApiEvent)('geoLocationListener', {
|
|
148
156
|
latitude: v.latitude,
|
|
149
157
|
longitude: v.longitude,
|
|
150
158
|
accuracy: (_v$accuracy = v.accuracy) !== null && _v$accuracy !== void 0 ? _v$accuracy : null,
|
|
151
159
|
speed: v.speed,
|
|
160
|
+
isAccurate: (_v$isAccurate = v.isAccurate) !== null && _v$isAccurate !== void 0 ? _v$isAccurate : null,
|
|
152
161
|
code: (_v$code = v.code) !== null && _v$code !== void 0 ? _v$code : null
|
|
153
162
|
});
|
|
154
163
|
}
|
|
@@ -219,13 +228,15 @@ class AppWrapper {
|
|
|
219
228
|
};
|
|
220
229
|
},
|
|
221
230
|
getGeoLocation: async () => {
|
|
231
|
+
var _res$accuracy, _res$isAccurate, _res$code;
|
|
222
232
|
const res = await this.appCall(14);
|
|
223
233
|
return {
|
|
224
234
|
latitude: res.latitude,
|
|
225
235
|
longitude: res.longitude,
|
|
226
236
|
speed: res.speed,
|
|
227
|
-
|
|
228
|
-
isAccurate: res.isAccurate
|
|
237
|
+
accuracy: (_res$accuracy = res.accuracy) !== null && _res$accuracy !== void 0 ? _res$accuracy : null,
|
|
238
|
+
isAccurate: (_res$isAccurate = res.isAccurate) !== null && _res$isAccurate !== void 0 ? _res$isAccurate : null,
|
|
239
|
+
code: (_res$code = res.code) !== null && _res$code !== void 0 ? _res$code : null
|
|
229
240
|
};
|
|
230
241
|
},
|
|
231
242
|
getUserInfo: async query => {
|
|
@@ -465,8 +476,39 @@ class AppWrapper {
|
|
|
465
476
|
void this.appCall(19, value, {
|
|
466
477
|
awaitResult: false
|
|
467
478
|
});
|
|
479
|
+
},
|
|
480
|
+
createDialog: config => {
|
|
481
|
+
return new _DialogHandler.default(config, this.functions.openDialog, this.functions.closeDialog);
|
|
482
|
+
},
|
|
483
|
+
openDialog: async (config, callback) => {
|
|
484
|
+
const currentDialogId = appWrapperDialogId++;
|
|
485
|
+
const eventTarget = new EventTarget();
|
|
486
|
+
const resolve = result => {
|
|
487
|
+
callback(result);
|
|
488
|
+
this.dispatchDialogChange(this.dialogs.filter(x => x.dialogId !== currentDialogId));
|
|
489
|
+
};
|
|
490
|
+
this.dispatchDialogChange([...this.dialogs, {
|
|
491
|
+
config,
|
|
492
|
+
resolve,
|
|
493
|
+
dialogId: currentDialogId,
|
|
494
|
+
eventTarget
|
|
495
|
+
}]);
|
|
496
|
+
return currentDialogId;
|
|
497
|
+
},
|
|
498
|
+
closeDialog: dialogId => {
|
|
499
|
+
const dialog = this.dialogs.find(x => x.dialogId === dialogId);
|
|
500
|
+
if (dialog) {
|
|
501
|
+
dialog.resolve({
|
|
502
|
+
buttonType: -1
|
|
503
|
+
});
|
|
504
|
+
}
|
|
468
505
|
}
|
|
469
506
|
};
|
|
507
|
+
dialogs = [];
|
|
508
|
+
dialogEventTarget = new EventTarget();
|
|
509
|
+
getDialogEventTarget() {
|
|
510
|
+
return this.dialogEventTarget;
|
|
511
|
+
}
|
|
470
512
|
async init() {
|
|
471
513
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
472
514
|
return undefined;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FrameWrapper = void 0;
|
|
7
7
|
var comlink = _interopRequireWildcard(require("comlink"));
|
|
8
|
+
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
8
9
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
9
10
|
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
10
11
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
@@ -233,7 +234,57 @@ class FrameWrapper {
|
|
|
233
234
|
scrollByY: async (value, duration) => {
|
|
234
235
|
if (!this.initialized) await this.ready;
|
|
235
236
|
return this.exposedFunctions.scrollByY(value, duration);
|
|
236
|
-
}
|
|
237
|
+
},
|
|
238
|
+
createDialog: config => {
|
|
239
|
+
return new _DialogHandler.default(config, this.functions.openDialog, this.exposedFunctions.closeDialog, this.functions.dispatchEventToDialogClient, this.functions.addDialogClientEventListener);
|
|
240
|
+
},
|
|
241
|
+
closeDialog: async dialogId => {
|
|
242
|
+
if (!this.initialized) await this.ready;
|
|
243
|
+
return this.exposedFunctions.closeDialog(dialogId);
|
|
244
|
+
},
|
|
245
|
+
openDialog: async (config, callback) => {
|
|
246
|
+
if (!this.initialized) await this.ready;
|
|
247
|
+
return this.exposedFunctions.openDialog(config, comlink.proxy(callback));
|
|
248
|
+
},
|
|
249
|
+
setDialogResult: async result => {
|
|
250
|
+
if (!this.initialized) await this.ready;
|
|
251
|
+
return this.exposedFunctions.setDialogResult(result);
|
|
252
|
+
},
|
|
253
|
+
dispatchEventToDialogClient: async (dialogId, data) => {
|
|
254
|
+
if (!this.initialized) await this.ready;
|
|
255
|
+
return this.exposedFunctions.dispatchEventToDialogClient(dialogId, data);
|
|
256
|
+
},
|
|
257
|
+
addDialogClientEventListener: async (dialogId, callback) => {
|
|
258
|
+
if (!this.initialized) await this.ready;
|
|
259
|
+
return this.exposedFunctions.addDialogClientEventListener(dialogId, comlink.proxy(callback));
|
|
260
|
+
},
|
|
261
|
+
dispatchEventToDialogHost: async data => {
|
|
262
|
+
if (!this.initialized) await this.ready;
|
|
263
|
+
return this.exposedFunctions.dispatchEventToDialogHost(data);
|
|
264
|
+
},
|
|
265
|
+
addDialogHostEventListener: async callback => {
|
|
266
|
+
if (!this.initialized) await this.ready;
|
|
267
|
+
const listenerKey = `dialogHostEventListener`;
|
|
268
|
+
const {
|
|
269
|
+
id,
|
|
270
|
+
shouldInitialize
|
|
271
|
+
} = (0, _apiListenerHelper.addApiListener)(listenerKey, callback);
|
|
272
|
+
if (shouldInitialize) {
|
|
273
|
+
this.exposedFunctions.addDialogHostEventListener(comlink.proxy(data => {
|
|
274
|
+
(0, _apiListenerHelper.dispatchApiEvent)(listenerKey, data);
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
return id;
|
|
278
|
+
},
|
|
279
|
+
removeDialogHostEventListener: async id => {
|
|
280
|
+
if (!this.initialized) await this.ready;
|
|
281
|
+
const listenerKey = `dialogHostEventListener`;
|
|
282
|
+
const shouldRemove = (0, _apiListenerHelper.removeApiListener)(listenerKey, id);
|
|
283
|
+
if (shouldRemove) {
|
|
284
|
+
// this.exposedFunctions.removeDialogHostEventListener(0);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
removeDialogClientEventListener: async () => {}
|
|
237
288
|
};
|
|
238
289
|
initialized = false;
|
|
239
290
|
constructor() {
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ModuleFederationWrapper = void 0;
|
|
7
|
+
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
7
8
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
8
9
|
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
9
10
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
@@ -24,6 +25,9 @@ class ModuleFederationWrapper {
|
|
|
24
25
|
// eslint-disable-next-line
|
|
25
26
|
this.functions[k] = async (...args) => fn(...args);
|
|
26
27
|
});
|
|
28
|
+
this.functions.createDialog = config => {
|
|
29
|
+
return new _DialogHandler.default(config, functions.openDialog, functions.closeDialog, functions.dispatchEventToDialogClient, functions.addDialogClientEventListener);
|
|
30
|
+
};
|
|
27
31
|
this.functions.addWindowMetricsListener = async callback => {
|
|
28
32
|
const {
|
|
29
33
|
id,
|
|
@@ -3,32 +3,32 @@ import { isDate, isNumber, isObject } from './utils/is';
|
|
|
3
3
|
import { open } from './open';
|
|
4
4
|
import { getDevice } from "../index";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The config object for date dialog
|
|
8
|
-
* @typedef {Object} dateConfig
|
|
9
|
-
* @property {Date} preSelect - The date object which should be preselected.
|
|
10
|
-
* @property {Date} minDate - The min date which you could select.
|
|
11
|
-
* @property {Date} maxDate - The max date which you could select.
|
|
12
|
-
* @property {dateDialogType} dateType - The type of dialog you want to display.
|
|
13
|
-
* @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
|
|
14
|
-
* @property {string} message - The message that is displayed above the date dialog, only in apps supported
|
|
15
|
-
* @property {string} title - The title that is displayed above the message, only in apps supported
|
|
6
|
+
/**
|
|
7
|
+
* The config object for date dialog
|
|
8
|
+
* @typedef {Object} dateConfig
|
|
9
|
+
* @property {Date} preSelect - The date object which should be preselected.
|
|
10
|
+
* @property {Date} minDate - The min date which you could select.
|
|
11
|
+
* @property {Date} maxDate - The max date which you could select.
|
|
12
|
+
* @property {dateDialogType} dateType - The type of dialog you want to display.
|
|
13
|
+
* @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
|
|
14
|
+
* @property {string} message - The message that is displayed above the date dialog, only in apps supported
|
|
15
|
+
* @property {string} title - The title that is displayed above the message, only in apps supported
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* This call will open a date select dialog.
|
|
20
|
-
* <div>Call: 30</div>
|
|
21
|
-
* @param {dateConfig} config - Define the configuration of this call
|
|
22
|
-
* @return {Promise} contains a timestamp as result
|
|
23
|
-
* @example chayns.dialog.date({
|
|
24
|
-
* 'dateType': chayns.dialog.dateType.DATE_TIME,
|
|
25
|
-
* 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
|
|
26
|
-
* 'minDate': new Date(2018, 6, 1, 15, 0, 0),
|
|
27
|
-
* 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
|
|
28
|
-
* 'minuteInterval': 15
|
|
29
|
-
* ).then(function (data) {
|
|
30
|
-
* console.log(data);
|
|
31
|
-
* });
|
|
18
|
+
/**
|
|
19
|
+
* This call will open a date select dialog.
|
|
20
|
+
* <div>Call: 30</div>
|
|
21
|
+
* @param {dateConfig} config - Define the configuration of this call
|
|
22
|
+
* @return {Promise} contains a timestamp as result
|
|
23
|
+
* @example chayns.dialog.date({
|
|
24
|
+
* 'dateType': chayns.dialog.dateType.DATE_TIME,
|
|
25
|
+
* 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
|
|
26
|
+
* 'minDate': new Date(2018, 6, 1, 15, 0, 0),
|
|
27
|
+
* 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
|
|
28
|
+
* 'minuteInterval': 15
|
|
29
|
+
* ).then(function (data) {
|
|
30
|
+
* console.log(data);
|
|
31
|
+
* });
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
export function date() {
|
|
@@ -165,18 +165,18 @@ export function advancedDate() {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
/**
|
|
169
|
-
* @typedef {number} dateDialogType
|
|
168
|
+
/**
|
|
169
|
+
* @typedef {number} dateDialogType
|
|
170
170
|
*/
|
|
171
171
|
|
|
172
|
-
/**
|
|
173
|
-
* Enum for date dialog
|
|
174
|
-
* <div>DATE will open a dialog where you can select a special day</div>
|
|
175
|
-
* <div>TIME will open a dialog where you can only select a special time</div>
|
|
176
|
-
* <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
|
|
177
|
-
* @readonly
|
|
178
|
-
* @enum {dateDialogType}
|
|
179
|
-
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
172
|
+
/**
|
|
173
|
+
* Enum for date dialog
|
|
174
|
+
* <div>DATE will open a dialog where you can select a special day</div>
|
|
175
|
+
* <div>TIME will open a dialog where you can only select a special time</div>
|
|
176
|
+
* <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
|
|
177
|
+
* @readonly
|
|
178
|
+
* @enum {dateDialogType}
|
|
179
|
+
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
180
180
|
*/
|
|
181
181
|
export const dateType = {
|
|
182
182
|
'DATE': 1,
|