chayns-api 1.0.10-beta.1 → 1.0.11
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 -47
- package/dist/cjs/calls/dialogs/date.js +10 -10
- package/dist/cjs/calls/index.js +97 -102
- package/dist/cjs/calls/sendMessage.js +8 -8
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/ChaynsProvider.js +2 -5
- package/dist/cjs/components/withCompatMode.js +27 -5
- package/dist/cjs/hooks/geoLocationListener.js +4 -4
- package/dist/cjs/hooks/index.js +1 -14
- 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/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 +3 -6
- package/dist/cjs/host/iframe/HostIframe.js +3 -6
- package/dist/cjs/host/module/ModuleHost.js +1 -1
- package/dist/cjs/types/IChaynsReact.js +2 -22
- package/dist/cjs/util/deviceHelper.js +6 -7
- package/dist/cjs/wrapper/AppWrapper.js +0 -59
- package/dist/cjs/wrapper/FrameWrapper.js +1 -16
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +0 -11
- package/dist/esm/calls/dialogs/date.js +34 -34
- package/dist/esm/calls/index.js +96 -102
- package/dist/esm/calls/sendMessage.js +8 -8
- package/dist/esm/calls/visibilityChangeListener.js +4 -4
- package/dist/esm/components/ChaynsProvider.js +2 -5
- package/dist/esm/components/withCompatMode.js +27 -5
- package/dist/esm/hooks/geoLocationListener.js +4 -4
- package/dist/esm/hooks/index.js +1 -2
- 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/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 +3 -6
- package/dist/esm/host/iframe/HostIframe.js +3 -6
- package/dist/esm/host/module/ModuleHost.js +1 -1
- package/dist/esm/types/IChaynsReact.js +1 -19
- package/dist/esm/util/deviceHelper.js +6 -7
- package/dist/esm/wrapper/AppWrapper.js +0 -60
- package/dist/esm/wrapper/FrameWrapper.js +1 -16
- package/dist/esm/wrapper/ModuleFederationWrapper.js +0 -11
- 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 +233 -237
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- 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 +8 -8
- package/dist/types/components/withCompatMode.d.ts +13 -13
- 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 +16 -17
- 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/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 +29 -30
- package/dist/types/host/iframe/HostIframe.d.ts +25 -26
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +25 -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 +623 -700
- 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 +18 -27
- 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
- package/dist/cjs/components/AppDialogWrapper.js +0 -40
- package/dist/cjs/hooks/useDialogState.js +0 -31
- package/dist/esm/components/AppDialogWrapper.js +0 -31
- package/dist/esm/hooks/useDialogState.js +0 -24
- package/dist/types/components/AppDialogWrapper.d.ts +0 -5
- package/dist/types/hooks/useDialogState.d.ts +0 -9
|
@@ -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,8 +28,7 @@ const ChaynsHost = ({
|
|
|
28
28
|
parameters,
|
|
29
29
|
customData,
|
|
30
30
|
environment,
|
|
31
|
-
preventStagingReplacement
|
|
32
|
-
dialog
|
|
31
|
+
preventStagingReplacement
|
|
33
32
|
}) => {
|
|
34
33
|
switch (type) {
|
|
35
34
|
case 'client-iframe':
|
|
@@ -48,8 +47,7 @@ const ChaynsHost = ({
|
|
|
48
47
|
parameters: parameters,
|
|
49
48
|
environment: environment,
|
|
50
49
|
customData: customData,
|
|
51
|
-
preventStagingReplacement: preventStagingReplacement
|
|
52
|
-
dialog: dialog
|
|
50
|
+
preventStagingReplacement: preventStagingReplacement
|
|
53
51
|
});
|
|
54
52
|
case 'client-module':
|
|
55
53
|
return /*#__PURE__*/_react.default.createElement(_ModuleHost.default, {
|
|
@@ -85,8 +83,7 @@ const ChaynsHost = ({
|
|
|
85
83
|
parameters: parameters,
|
|
86
84
|
environment: environment,
|
|
87
85
|
customData: customData,
|
|
88
|
-
preventStagingReplacement: preventStagingReplacement
|
|
89
|
-
dialog: dialog
|
|
86
|
+
preventStagingReplacement: preventStagingReplacement
|
|
90
87
|
});
|
|
91
88
|
case 'server-module':
|
|
92
89
|
return /*#__PURE__*/_react.default.createElement(_ModuleHost.default, {
|
|
@@ -30,8 +30,7 @@ const HostIframe = ({
|
|
|
30
30
|
parameters,
|
|
31
31
|
environment,
|
|
32
32
|
customData,
|
|
33
|
-
preventStagingReplacement
|
|
34
|
-
dialog
|
|
33
|
+
preventStagingReplacement
|
|
35
34
|
}) => {
|
|
36
35
|
const eventTarget = (0, _react.useRef)();
|
|
37
36
|
const ref = (0, _react.useRef)();
|
|
@@ -57,8 +56,7 @@ const HostIframe = ({
|
|
|
57
56
|
language,
|
|
58
57
|
parameters,
|
|
59
58
|
environment,
|
|
60
|
-
customData
|
|
61
|
-
dialog
|
|
59
|
+
customData
|
|
62
60
|
};
|
|
63
61
|
// endregion
|
|
64
62
|
|
|
@@ -118,7 +116,6 @@ const HostIframe = ({
|
|
|
118
116
|
(0, _useUpdateData.default)(eventTarget.current, 'parameters', parameters);
|
|
119
117
|
(0, _useUpdateData.default)(eventTarget.current, 'environment', environment);
|
|
120
118
|
(0, _useUpdateData.default)(eventTarget.current, 'customData', customData);
|
|
121
|
-
(0, _useUpdateData.default)(eventTarget.current, 'dialog', dialog);
|
|
122
119
|
// endregion
|
|
123
120
|
|
|
124
121
|
return /*#__PURE__*/_react.default.createElement("iframe", _extends({
|
|
@@ -131,7 +128,7 @@ const HostIframe = ({
|
|
|
131
128
|
},
|
|
132
129
|
title: " "
|
|
133
130
|
}, iFrameProps, {
|
|
134
|
-
src: postForm ? undefined : (0, _url.replaceStagingUrl)(preventStagingReplacement, src, environment.
|
|
131
|
+
src: postForm ? undefined : (0, _url.replaceStagingUrl)(preventStagingReplacement, src, environment.buildEnvironment)
|
|
135
132
|
}));
|
|
136
133
|
};
|
|
137
134
|
var _default = HostIframe;
|
|
@@ -75,7 +75,7 @@ const ModuleHost = ({
|
|
|
75
75
|
}), /*#__PURE__*/_react.default.createElement(System, {
|
|
76
76
|
system: {
|
|
77
77
|
scope: system.scope,
|
|
78
|
-
url: (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.
|
|
78
|
+
url: (0, _url.replaceStagingUrl)(preventStagingReplacement, system.url, environment.buildEnvironment),
|
|
79
79
|
module: system.module
|
|
80
80
|
},
|
|
81
81
|
data: initialData,
|
|
@@ -3,14 +3,7 @@
|
|
|
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.
|
|
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 = {}));
|
|
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;
|
|
14
7
|
let ScreenSize;
|
|
15
8
|
exports.ScreenSize = ScreenSize;
|
|
16
9
|
(function (ScreenSize) {
|
|
@@ -265,17 +258,4 @@ var selectType;
|
|
|
265
258
|
(function (selectType) {
|
|
266
259
|
selectType[selectType["DEFAULT"] = 0] = "DEFAULT";
|
|
267
260
|
selectType[selectType["ICON"] = 1] = "ICON";
|
|
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 = {}));
|
|
261
|
+
})(selectType || (selectType = {}));
|
|
@@ -35,7 +35,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
35
35
|
result.accessToken = undefined; // TODO
|
|
36
36
|
result.os = parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.os;
|
|
37
37
|
if (typeof window !== 'undefined') {
|
|
38
|
-
result.screenSize = getScreenSize(window.innerWidth
|
|
38
|
+
result.screenSize = getScreenSize(window.innerWidth);
|
|
39
39
|
} else {
|
|
40
40
|
// estimate size over user agent, very inaccurate, could be improved by setting a cookie with the screensize
|
|
41
41
|
const screenSizeByUA = /mobi/i.test(userAgent) ? _IChaynsReact.ScreenSize.SM : _IChaynsReact.ScreenSize.XL;
|
|
@@ -49,16 +49,15 @@ const getClientDeviceInfo = () => ({
|
|
|
49
49
|
isTouch: navigator.maxTouchPoints > 0 && window.matchMedia('(pointer: coarse)')
|
|
50
50
|
});
|
|
51
51
|
exports.getClientDeviceInfo = getClientDeviceInfo;
|
|
52
|
-
const getScreenSize =
|
|
53
|
-
const size = Math.max(width, height);
|
|
52
|
+
const getScreenSize = width => {
|
|
54
53
|
let value;
|
|
55
|
-
if (
|
|
54
|
+
if (width > 1200) {
|
|
56
55
|
value = _IChaynsReact.ScreenSize.XL;
|
|
57
|
-
} else if (
|
|
56
|
+
} else if (width > 993) {
|
|
58
57
|
value = _IChaynsReact.ScreenSize.LG;
|
|
59
|
-
} else if (
|
|
58
|
+
} else if (width > 769) {
|
|
60
59
|
value = _IChaynsReact.ScreenSize.MD;
|
|
61
|
-
} else if (
|
|
60
|
+
} else if (width > 556) {
|
|
62
61
|
value = _IChaynsReact.ScreenSize.SM;
|
|
63
62
|
} else {
|
|
64
63
|
value = _IChaynsReact.ScreenSize.XS;
|
|
@@ -17,7 +17,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
/* eslint-disable */
|
|
18
18
|
// @ts-nocheck
|
|
19
19
|
|
|
20
|
-
let appWrapperDialogId = 0;
|
|
21
20
|
class AppWrapper {
|
|
22
21
|
values = null;
|
|
23
22
|
accessToken = '';
|
|
@@ -99,12 +98,6 @@ class AppWrapper {
|
|
|
99
98
|
notImplemented(call) {
|
|
100
99
|
console.warn(`call ${call} not implement in app`);
|
|
101
100
|
}
|
|
102
|
-
dispatchDialogChange(detail) {
|
|
103
|
-
this.dialogs = detail;
|
|
104
|
-
this.dialogEventTarget.dispatchEvent(new CustomEvent('change', {
|
|
105
|
-
detail
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
101
|
counter = 0;
|
|
109
102
|
appCall(action, value = {}, {
|
|
110
103
|
callback,
|
|
@@ -472,51 +465,8 @@ class AppWrapper {
|
|
|
472
465
|
void this.appCall(19, value, {
|
|
473
466
|
awaitResult: false
|
|
474
467
|
});
|
|
475
|
-
},
|
|
476
|
-
openDialog: async (...args) => {
|
|
477
|
-
return this.openDialog(...args);
|
|
478
|
-
},
|
|
479
|
-
createDialog: config => {
|
|
480
|
-
return {
|
|
481
|
-
close: async value => {
|
|
482
|
-
this.dialogs.find(x => x.dialogId === dialogId).eventTarget.dispatchEvent(new CustomEvent('close', {
|
|
483
|
-
detail: data
|
|
484
|
-
}));
|
|
485
|
-
},
|
|
486
|
-
open: async () => {
|
|
487
|
-
return await this.openDialog(config);
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
},
|
|
491
|
-
closeDialog: (dialogId, data) => {
|
|
492
|
-
try {
|
|
493
|
-
this.dialogs.find(x => x.dialogId === dialogId).eventTarget.dispatchEvent(new CustomEvent('requestClose', {
|
|
494
|
-
detail: data
|
|
495
|
-
}));
|
|
496
|
-
} catch (e) {
|
|
497
|
-
console.error(e);
|
|
498
|
-
}
|
|
499
468
|
}
|
|
500
469
|
};
|
|
501
|
-
async openDialog(config) {
|
|
502
|
-
const currentDialogId = appWrapperDialogId;
|
|
503
|
-
const res = await new Promise(resolve => {
|
|
504
|
-
const eventTarget = new EventTarget();
|
|
505
|
-
this.dispatchDialogChange([...(this.dialogs || []), {
|
|
506
|
-
config,
|
|
507
|
-
resolve,
|
|
508
|
-
dialogId: appWrapperDialogId++,
|
|
509
|
-
eventTarget
|
|
510
|
-
}]);
|
|
511
|
-
});
|
|
512
|
-
this.dispatchDialogChange(this.dialogs.filter(x => x.dialogId !== currentDialogId));
|
|
513
|
-
return res;
|
|
514
|
-
}
|
|
515
|
-
dialogs = [];
|
|
516
|
-
dialogEventTarget = new EventTarget();
|
|
517
|
-
getDialogEventTarget() {
|
|
518
|
-
return this.dialogEventTarget;
|
|
519
|
-
}
|
|
520
470
|
async init() {
|
|
521
471
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
522
472
|
return undefined;
|
|
@@ -534,14 +484,5 @@ class AppWrapper {
|
|
|
534
484
|
getInitialData() {
|
|
535
485
|
return this.values;
|
|
536
486
|
}
|
|
537
|
-
createDialog(config) {
|
|
538
|
-
return {
|
|
539
|
-
close: () => {},
|
|
540
|
-
open: async () => {
|
|
541
|
-
const dialog = await functions.openDialog(config);
|
|
542
|
-
return dialog;
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
487
|
}
|
|
547
488
|
exports.AppWrapper = AppWrapper;
|
|
@@ -233,22 +233,7 @@ class FrameWrapper {
|
|
|
233
233
|
scrollByY: async (value, duration) => {
|
|
234
234
|
if (!this.initialized) await this.ready;
|
|
235
235
|
return this.exposedFunctions.scrollByY(value, duration);
|
|
236
|
-
}
|
|
237
|
-
createDialog: config => {
|
|
238
|
-
return {
|
|
239
|
-
close: async (buttonType, data) => {
|
|
240
|
-
await this.exposedFunctions.closeDialog(buttonType, data);
|
|
241
|
-
},
|
|
242
|
-
open: async () => {
|
|
243
|
-
return await this.exposedFunctions.openDialog(config);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
},
|
|
247
|
-
closeDialog: async (buttonType, value) => {
|
|
248
|
-
if (!this.initialized) await this.ready;
|
|
249
|
-
return this.exposedFunctions.closeDialog(buttonType, value);
|
|
250
|
-
},
|
|
251
|
-
openDialog: async value => {}
|
|
236
|
+
}
|
|
252
237
|
};
|
|
253
238
|
initialized = false;
|
|
254
239
|
constructor() {
|
|
@@ -24,17 +24,6 @@ class ModuleFederationWrapper {
|
|
|
24
24
|
// eslint-disable-next-line
|
|
25
25
|
this.functions[k] = async (...args) => fn(...args);
|
|
26
26
|
});
|
|
27
|
-
this.functions.createDialog = config => {
|
|
28
|
-
return {
|
|
29
|
-
close: (buttonType, data) => {
|
|
30
|
-
return functions.closeDialog(buttonType, data);
|
|
31
|
-
},
|
|
32
|
-
open: async () => {
|
|
33
|
-
const dialog = await functions.openDialog(config);
|
|
34
|
-
return dialog;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
27
|
this.functions.addWindowMetricsListener = async callback => {
|
|
39
28
|
const {
|
|
40
29
|
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,
|