chayns-api 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/calls/dialogs/alert.js +0 -2
- package/dist/cjs/calls/dialogs/chaynsDialog.js +2 -8
- package/dist/cjs/calls/dialogs/close.js +0 -2
- package/dist/cjs/calls/dialogs/communication.js +1 -16
- package/dist/cjs/calls/dialogs/confirm.js +0 -4
- package/dist/cjs/calls/dialogs/date.js +36 -53
- package/dist/cjs/calls/dialogs/dropUpAlert.js +0 -3
- package/dist/cjs/calls/dialogs/fileSelect.js +0 -10
- package/dist/cjs/calls/dialogs/iFrame.js +0 -8
- package/dist/cjs/calls/dialogs/index.js +0 -27
- package/dist/cjs/calls/dialogs/input.js +0 -6
- package/dist/cjs/calls/dialogs/mediaSelect.js +0 -7
- package/dist/cjs/calls/dialogs/open.js +0 -2
- package/dist/cjs/calls/dialogs/select.js +0 -9
- package/dist/cjs/calls/dialogs/signature.js +0 -5
- package/dist/cjs/calls/dialogs/toast.js +0 -3
- package/dist/cjs/calls/dialogs/utils/callback.js +0 -2
- package/dist/cjs/calls/dialogs/utils/environment.js +10 -0
- package/dist/cjs/calls/dialogs/utils/is.js +0 -4
- package/dist/cjs/calls/getUserInfo.js +0 -11
- package/dist/cjs/calls/index.js +3 -155
- package/dist/cjs/calls/sendMessage.js +0 -26
- package/dist/cjs/calls/visibilityChangeListener.js +1 -12
- package/dist/cjs/components/ChaynsContext.js +2 -4
- package/dist/cjs/components/ChaynsProvider.js +6 -28
- package/dist/cjs/components/WaitUntil.js +0 -5
- package/dist/cjs/components/withCompatMode.js +1 -16
- package/dist/cjs/helper/apiListenerHelper.js +0 -9
- package/dist/cjs/hooks/geoLocationListener.js +2 -11
- package/dist/cjs/hooks/index.js +6 -16
- package/dist/cjs/hooks/scrollListener.js +4 -23
- package/dist/cjs/hooks/useAccessToken.js +0 -5
- package/dist/cjs/hooks/useCurrentPage.js +0 -4
- package/dist/cjs/hooks/useCustomData.js +0 -4
- package/dist/cjs/hooks/useDevice.js +0 -4
- package/dist/cjs/hooks/useEnvironment.js +0 -4
- package/dist/cjs/hooks/useFunctions.js +0 -4
- package/dist/cjs/hooks/useIsAdminMode.js +0 -5
- package/dist/cjs/hooks/useLanguage.js +0 -4
- package/dist/cjs/hooks/usePages.js +22 -14
- package/dist/cjs/hooks/useParameters.js +0 -4
- package/dist/cjs/hooks/useSite.js +0 -4
- package/dist/cjs/hooks/useUser.js +0 -5
- package/dist/cjs/hooks/useValues.js +0 -4
- package/dist/cjs/hooks/windowMetricsListener.js +2 -12
- package/dist/cjs/host/ChaynsHost.js +0 -10
- package/dist/cjs/host/iframe/HostIframe.js +23 -30
- package/dist/cjs/host/iframe/utils/useUpdateData.js +0 -3
- package/dist/cjs/host/module/ModuleHost.js +3 -13
- package/dist/cjs/host/{HostIframe.js → module/PagemakerFrame.js} +23 -75
- package/dist/cjs/host/module/utils/loadComponent.js +1 -18
- package/dist/cjs/host/module/utils/useDynamicScript.js +0 -18
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/types/IChaynsReact.js +27 -48
- package/dist/cjs/util/appCall.js +1 -4
- package/dist/cjs/util/deviceHelper.js +4 -21
- package/dist/cjs/util/heightHelper.js +0 -9
- package/dist/cjs/util/postIframeForm.js +0 -5
- package/dist/cjs/wrapper/AppWrapper.js +318 -159
- package/dist/cjs/wrapper/FrameWrapper.js +215 -248
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -27
- package/dist/cjs/wrapper/SsrWrapper.js +0 -8
- package/dist/esm/calls/dialogs/alert.js +4 -4
- package/dist/esm/calls/dialogs/chaynsDialog.js +7 -11
- package/dist/esm/calls/dialogs/communication.js +15 -26
- package/dist/esm/calls/dialogs/confirm.js +5 -8
- package/dist/esm/calls/dialogs/date.js +85 -94
- package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
- package/dist/esm/calls/dialogs/fileSelect.js +23 -62
- package/dist/esm/calls/dialogs/iFrame.js +7 -10
- package/dist/esm/calls/dialogs/input.js +2 -5
- package/dist/esm/calls/dialogs/mediaSelect.js +18 -55
- package/dist/esm/calls/dialogs/open.js +2 -2
- package/dist/esm/calls/dialogs/select.js +5 -9
- package/dist/esm/calls/dialogs/signature.js +0 -2
- package/dist/esm/calls/dialogs/toast.js +6 -11
- package/dist/esm/calls/dialogs/utils/callback.js +3 -5
- package/dist/esm/calls/dialogs/utils/environment.js +3 -0
- package/dist/esm/calls/dialogs/utils/is.js +1 -3
- package/dist/esm/calls/getUserInfo.js +32 -92
- package/dist/esm/calls/index.js +124 -276
- package/dist/esm/calls/sendMessage.js +91 -221
- package/dist/esm/calls/visibilityChangeListener.js +10 -15
- package/dist/esm/components/ChaynsContext.js +3 -3
- package/dist/esm/components/ChaynsProvider.js +45 -86
- package/dist/esm/components/WaitUntil.js +21 -86
- package/dist/esm/components/withCompatMode.js +35 -77
- package/dist/esm/helper/apiListenerHelper.js +10 -15
- package/dist/esm/hooks/geoLocationListener.js +20 -46
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/scrollListener.js +50 -86
- package/dist/esm/hooks/useAccessToken.js +6 -28
- package/dist/esm/hooks/useCurrentPage.js +2 -6
- package/dist/esm/hooks/useCustomData.js +2 -6
- package/dist/esm/hooks/useDevice.js +1 -6
- package/dist/esm/hooks/useEnvironment.js +1 -6
- package/dist/esm/hooks/useFunctions.js +2 -5
- package/dist/esm/hooks/useIsAdminMode.js +2 -6
- package/dist/esm/hooks/useLanguage.js +1 -6
- package/dist/esm/hooks/usePages.js +34 -27
- package/dist/esm/hooks/useParameters.js +1 -6
- package/dist/esm/hooks/useSite.js +1 -6
- package/dist/esm/hooks/useUser.js +1 -7
- package/dist/esm/hooks/useValues.js +2 -5
- package/dist/esm/hooks/windowMetricsListener.js +18 -44
- package/dist/esm/host/ChaynsHost.js +22 -29
- package/dist/esm/host/iframe/HostIframe.js +86 -142
- package/dist/esm/host/iframe/utils/useUpdateData.js +4 -6
- package/dist/esm/host/module/ModuleHost.js +42 -49
- package/dist/esm/host/module/PagemakerFrame.js +97 -0
- package/dist/esm/host/module/utils/loadComponent.js +47 -85
- package/dist/esm/host/module/utils/useDynamicScript.js +27 -74
- package/dist/esm/types/IChaynsReact.js +37 -61
- package/dist/esm/util/appCall.js +2 -4
- package/dist/esm/util/deviceHelper.js +12 -36
- package/dist/esm/util/heightHelper.js +10 -13
- package/dist/esm/util/postIframeForm.js +25 -57
- package/dist/esm/wrapper/AppWrapper.js +380 -781
- package/dist/esm/wrapper/FrameWrapper.js +258 -1509
- package/dist/esm/wrapper/ModuleFederationWrapper.js +47 -284
- package/dist/esm/wrapper/SsrWrapper.js +19 -65
- package/dist/types/calls/dialogs/confirm.d.ts +1 -1
- package/dist/types/calls/dialogs/date.d.ts +4 -4
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +1 -1
- package/dist/types/calls/dialogs/fileSelect.d.ts +1 -1
- package/dist/types/calls/dialogs/iFrame.d.ts +1 -1
- package/dist/types/calls/dialogs/input.d.ts +1 -1
- package/dist/types/calls/dialogs/mediaSelect.d.ts +1 -1
- package/dist/types/calls/dialogs/signature.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/environment.d.ts +3 -0
- package/dist/types/calls/index.d.ts +0 -6
- package/dist/types/components/ChaynsProvider.d.ts +1 -1
- package/dist/types/components/WaitUntil.d.ts +1 -1
- package/dist/types/components/withCompatMode.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/hooks/useAccessToken.d.ts +1 -1
- package/dist/types/hooks/usePages.d.ts +4 -0
- package/dist/types/host/ChaynsHost.d.ts +1 -1
- package/dist/types/host/iframe/HostIframe.d.ts +1 -1
- package/dist/types/host/module/ModuleHost.d.ts +2 -2
- package/dist/types/host/{HostIframe.d.ts → module/PagemakerFrame.d.ts} +7 -5
- package/dist/types/types/IChaynsReact.d.ts +55 -24
- package/dist/types/util/deviceHelper.d.ts +2 -2
- package/dist/types/wrapper/AppWrapper.d.ts +6 -4
- package/package.json +1 -1
- package/dist/cjs/bootstrap.js +0 -11
- package/dist/cjs/calls/abstractApiListener.js +0 -40
- package/dist/cjs/calls/apiEventListener.js +0 -40
- package/dist/cjs/calls/setVisibilityChangeListener.js +0 -1
- package/dist/cjs/calls/windowMetricsListener.js +0 -18
- package/dist/cjs/components/App.js +0 -32
- package/dist/cjs/components/App.spec.js +0 -16
- package/dist/cjs/components/Button.js +0 -32
- package/dist/cjs/components/ChaynsProviderExposed.js +0 -16
- package/dist/cjs/components/TestProvider.js +0 -236
- package/dist/cjs/components/Title.js +0 -162
- package/dist/cjs/functions/addApiListener.js +0 -37
- package/dist/cjs/functions/addGeoLocationListener.js +0 -26
- package/dist/cjs/functions/addScrollListener.js +0 -26
- package/dist/cjs/functions/addWindowMetricsListener.js +0 -37
- package/dist/cjs/helper/cssLoader.js +0 -28
- package/dist/cjs/hooks/addGeoLocationListener.js +0 -26
- package/dist/cjs/hooks/addScrollListener.js +0 -26
- package/dist/cjs/hooks/addWindowMetricsListener.js +0 -37
- package/dist/cjs/hooks/geoLocation.js +0 -48
- package/dist/cjs/hooks/useAddGeoLocationListener.js +0 -26
- package/dist/cjs/hooks/useAddScrollListener.js +0 -48
- package/dist/cjs/hooks/useAddWindowMetricsListener.js +0 -45
- package/dist/cjs/hooks/useAdddScrollListener.js +0 -26
- package/dist/cjs/hooks/windowMetrics.js +0 -45
- package/dist/cjs/host/ModuleHost.js +0 -11
- package/dist/cjs/host/module/utils.js +0 -25
- package/dist/cjs/index.example.js +0 -7
- package/dist/cjs/index2.js +0 -64
- package/dist/cjs/types/DynamicImport.d.js +0 -5
- package/dist/cjs/types/chayns-components.d.js +0 -1
- package/dist/cjs/types/chayns-logger.d.js +0 -1
- package/dist/cjs/types/chayns.d.js +0 -1
- package/dist/cjs/types/tobit-websocket-service-client.d.js +0 -1
- package/dist/cjs/types/toolkit-types.d.js +0 -1
- package/dist/cjs/util/useFunctionsContext.js +0 -16
- package/dist/cjs/util/useIsAdminMode.js +0 -18
- package/dist/cjs/util/useUser.js +0 -16
- package/dist/esm/bootstrap.js +0 -4
- package/dist/esm/components/App.js +0 -35
- package/dist/esm/components/App.spec.js +0 -9
- package/dist/esm/components/Button.js +0 -34
- package/dist/esm/components/ChaynsProviderExposed.js +0 -3
- package/dist/esm/components/TestProvider.js +0 -308
- package/dist/esm/components/Title.js +0 -210
- package/dist/esm/helper/cssLoader.js +0 -21
- package/dist/esm/hooks/useAddGeoLocationListener.js +0 -18
- package/dist/esm/hooks/useAddScrollListener.js +0 -18
- package/dist/esm/hooks/useAddWindowMetricsListener.js +0 -18
- package/dist/esm/host/HostIframe.js +0 -153
- package/dist/esm/index.example.js +0 -1
- package/dist/esm/index2.js +0 -5
- package/dist/esm/types/DynamicImport.d.js +0 -1
- package/dist/esm/types/chayns-components.d.js +0 -0
- package/dist/esm/types/chayns-logger.d.js +0 -0
- package/dist/esm/types/chayns.d.js +0 -0
- package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
- package/dist/esm/types/toolkit-types.d.js +0 -0
- package/dist/esm/util/useIsAdminMode.js +0 -9
- package/dist/esm/util/useUser.js +0 -7
- package/dist/types/bootstrap.d.ts +0 -1
- package/dist/types/components/App.d.ts +0 -5
- package/dist/types/components/Button.d.ts +0 -8
- package/dist/types/components/ChaynsProviderExposed.d.ts +0 -13
- package/dist/types/components/Title.d.ts +0 -3
- package/dist/types/index.example.d.ts +0 -0
|
@@ -6,11 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.buttonType = exports.buttonText = void 0;
|
|
7
7
|
exports.chaynsDialog = chaynsDialog;
|
|
8
8
|
exports.dialogAction = void 0;
|
|
9
|
-
|
|
10
9
|
var _open = require("./open");
|
|
11
|
-
|
|
12
10
|
var _callback = require("./utils/callback");
|
|
13
|
-
|
|
14
11
|
const buttonText = {
|
|
15
12
|
'YES': {
|
|
16
13
|
'de': 'Ja',
|
|
@@ -50,16 +47,13 @@ const dialogAction = {
|
|
|
50
47
|
'IFRAME': 191
|
|
51
48
|
};
|
|
52
49
|
exports.dialogAction = dialogAction;
|
|
53
|
-
|
|
54
50
|
function chaynsDialog(config) {
|
|
55
51
|
const callbackName = 'chaynsDialog';
|
|
56
52
|
config.callback = (0, _callback.getCallbackName)(callbackName);
|
|
57
|
-
|
|
58
53
|
if (config.dialog) {
|
|
59
|
-
config.dialog.callType = dialogAction.ALERT_CONFIRM;
|
|
60
|
-
|
|
54
|
+
config.dialog.callType = dialogAction.ALERT_CONFIRM;
|
|
55
|
+
// @ts-ignore
|
|
61
56
|
return (0, _open.open)(config.dialog).then(data => Promise.resolve(data.selection ? data : data.buttonType));
|
|
62
57
|
}
|
|
63
|
-
|
|
64
58
|
return "unsupported";
|
|
65
59
|
}
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addDialogDataListener = addDialogDataListener;
|
|
7
7
|
exports.removeDialogDataListener = removeDialogDataListener;
|
|
8
8
|
exports.sendData = sendData;
|
|
9
|
-
|
|
10
9
|
var _index = require("../index");
|
|
11
|
-
|
|
12
10
|
// @ts-nocheck
|
|
11
|
+
|
|
13
12
|
function sendData(data, isApiEvent) {
|
|
14
13
|
return (0, _index.invokeDialogCall)({
|
|
15
14
|
action: 218,
|
|
@@ -19,22 +18,17 @@ function sendData(data, isApiEvent) {
|
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
const listeners = [];
|
|
24
22
|
const apiListeners = [];
|
|
25
|
-
|
|
26
23
|
function _dialogDataListener(e = {}) {
|
|
27
24
|
if (!e.data || !e.data.action && typeof e.data !== 'string') {
|
|
28
25
|
return;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
const messageObj = e.data.action ? e.data : JSON.parse(e.data.match(/(\{(?:.*)\})/)[0]);
|
|
32
|
-
|
|
33
28
|
if (messageObj.action === 218) {
|
|
34
29
|
const {
|
|
35
30
|
data
|
|
36
31
|
} = messageObj.value;
|
|
37
|
-
|
|
38
32
|
if (messageObj.value.isApiEvent) {
|
|
39
33
|
apiListeners.forEach(listener => {
|
|
40
34
|
listener(data);
|
|
@@ -46,41 +40,32 @@ function _dialogDataListener(e = {}) {
|
|
|
46
40
|
}
|
|
47
41
|
}
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
function addDialogDataListener(callback, getApiEvents = false) {
|
|
51
44
|
if (listeners.length === 0 || apiListeners.length === 0) {
|
|
52
45
|
window.addEventListener('message', _dialogDataListener);
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
if (getApiEvents) {
|
|
56
48
|
apiListeners.push(callback);
|
|
57
49
|
} else {
|
|
58
50
|
listeners.push(callback);
|
|
59
51
|
}
|
|
60
|
-
|
|
61
52
|
return true;
|
|
62
53
|
}
|
|
63
|
-
|
|
64
54
|
function removeDialogDataListener(callback, getApiEvents = false) {
|
|
65
55
|
let index;
|
|
66
|
-
|
|
67
56
|
if (getApiEvents) {
|
|
68
57
|
index = apiListeners.indexOf(callback);
|
|
69
|
-
|
|
70
58
|
if (index !== -1) {
|
|
71
59
|
apiListeners.splice(index, 1);
|
|
72
60
|
}
|
|
73
61
|
} else {
|
|
74
62
|
index = listeners.indexOf(callback);
|
|
75
|
-
|
|
76
63
|
if (index !== -1) {
|
|
77
64
|
listeners.splice(index, 1);
|
|
78
65
|
}
|
|
79
66
|
}
|
|
80
|
-
|
|
81
67
|
if (listeners.length === 0 && apiListeners.length === 0) {
|
|
82
68
|
window.removeEventListener('message', _dialogDataListener);
|
|
83
69
|
}
|
|
84
|
-
|
|
85
70
|
return index !== -1;
|
|
86
71
|
}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.confirm = confirm;
|
|
7
|
-
|
|
8
7
|
var _chaynsDialog = require("./chaynsDialog");
|
|
9
|
-
|
|
10
8
|
function confirm(title = '', message = '', config = {}) {
|
|
11
9
|
// backward compatibility
|
|
12
10
|
if (Array.isArray(config)) {
|
|
@@ -14,7 +12,6 @@ function confirm(title = '', message = '', config = {}) {
|
|
|
14
12
|
'buttons': config
|
|
15
13
|
};
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
if (!config.buttons || !Array.isArray(config.buttons)) {
|
|
19
16
|
config.buttons = [{
|
|
20
17
|
'text': _chaynsDialog.buttonText.YES,
|
|
@@ -24,7 +21,6 @@ function confirm(title = '', message = '', config = {}) {
|
|
|
24
21
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
25
22
|
}];
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
return (0, _chaynsDialog.chaynsDialog)({
|
|
29
25
|
'dialog': {
|
|
30
26
|
title,
|
|
@@ -6,38 +6,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.advancedDate = advancedDate;
|
|
7
7
|
exports.date = date;
|
|
8
8
|
exports.dateType = void 0;
|
|
9
|
-
|
|
10
9
|
var _chaynsDialog = require("./chaynsDialog");
|
|
11
|
-
|
|
12
10
|
var _is = require("./utils/is");
|
|
13
|
-
|
|
14
11
|
var _open = require("./open");
|
|
15
|
-
|
|
16
12
|
var _index = require("../index");
|
|
17
|
-
|
|
18
13
|
function date(config = {}) {
|
|
19
14
|
let {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
preSelect,
|
|
16
|
+
minDate,
|
|
17
|
+
maxDate,
|
|
18
|
+
title,
|
|
19
|
+
message,
|
|
20
|
+
minuteInterval,
|
|
21
|
+
autoSelectDate
|
|
22
|
+
} = config,
|
|
23
|
+
type = config.dateType || dateType.DATE;
|
|
24
|
+
|
|
25
|
+
// This will fix the iOS problem with not preselectedDate without user interaction. That it return the wrog time.
|
|
30
26
|
const {
|
|
31
27
|
os,
|
|
32
28
|
app
|
|
33
29
|
} = (0, _index.getDevice)();
|
|
34
|
-
|
|
35
30
|
if (minuteInterval && minuteInterval > 1 && os === 'iOS' && app) {
|
|
36
31
|
preSelect = roundInterval(preSelect, minuteInterval);
|
|
37
32
|
} else {
|
|
38
33
|
preSelect = validateValue(preSelect);
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
minDate = validateValue(minDate);
|
|
42
36
|
maxDate = validateValue(maxDate);
|
|
43
37
|
let buttons = [];
|
|
@@ -61,31 +55,30 @@ function date(config = {}) {
|
|
|
61
55
|
return Promise.resolve(data.selectedDate);
|
|
62
56
|
});
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
function advancedDate(config = {}) {
|
|
66
59
|
let {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
60
|
+
preSelect,
|
|
61
|
+
minDate,
|
|
62
|
+
maxDate,
|
|
63
|
+
title,
|
|
64
|
+
message,
|
|
65
|
+
minuteInterval,
|
|
66
|
+
buttons,
|
|
67
|
+
multiselect,
|
|
68
|
+
disabledDates,
|
|
69
|
+
textBlocks,
|
|
70
|
+
monthSelect,
|
|
71
|
+
yearSelect,
|
|
72
|
+
interval,
|
|
73
|
+
maxInterval,
|
|
74
|
+
minInterval,
|
|
75
|
+
disabledIntervals,
|
|
76
|
+
disabledWeekDayIntervals,
|
|
77
|
+
getLocalTime,
|
|
78
|
+
autoSelectDate
|
|
79
|
+
} = config,
|
|
80
|
+
// minInterval and maxInterval in minutes
|
|
81
|
+
type = config.dateType || dateType.DATE;
|
|
89
82
|
minDate = validateValue(minDate);
|
|
90
83
|
maxDate = validateValue(maxDate);
|
|
91
84
|
const {
|
|
@@ -93,7 +86,6 @@ function advancedDate(config = {}) {
|
|
|
93
86
|
app
|
|
94
87
|
} = (0, _index.getDevice)();
|
|
95
88
|
if (!preSelect) preSelect = {};
|
|
96
|
-
|
|
97
89
|
if (Array.isArray(preSelect)) {
|
|
98
90
|
preSelect = preSelect.map(p => validateValue(p));
|
|
99
91
|
} else if ((0, _is.isObject)(preSelect)) {
|
|
@@ -113,18 +105,15 @@ function advancedDate(config = {}) {
|
|
|
113
105
|
preSelect = validateValue(preSelect);
|
|
114
106
|
}
|
|
115
107
|
}
|
|
116
|
-
|
|
117
108
|
if (Array.isArray(disabledDates)) {
|
|
118
109
|
disabledDates = disabledDates.map(d => validateValue(d));
|
|
119
110
|
}
|
|
120
|
-
|
|
121
111
|
if (!buttons || !Array.isArray(buttons)) {
|
|
122
112
|
buttons = [{
|
|
123
113
|
'text': _chaynsDialog.buttonText.OK,
|
|
124
114
|
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
125
115
|
}];
|
|
126
116
|
}
|
|
127
|
-
|
|
128
117
|
return (0, _open.open)({
|
|
129
118
|
'callType': _chaynsDialog.dialogAction.ADVANCED_DATE,
|
|
130
119
|
type,
|
|
@@ -152,6 +141,7 @@ function advancedDate(config = {}) {
|
|
|
152
141
|
return Promise.resolve(data);
|
|
153
142
|
});
|
|
154
143
|
}
|
|
144
|
+
|
|
155
145
|
/**
|
|
156
146
|
* @typedef {number} dateDialogType
|
|
157
147
|
*/
|
|
@@ -165,28 +155,22 @@ function advancedDate(config = {}) {
|
|
|
165
155
|
* @enum {dateDialogType}
|
|
166
156
|
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
167
157
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
158
|
const dateType = {
|
|
171
159
|
'DATE': 1,
|
|
172
160
|
'TIME': 2,
|
|
173
161
|
'DATE_TIME': 3
|
|
174
162
|
};
|
|
175
163
|
exports.dateType = dateType;
|
|
176
|
-
|
|
177
164
|
function validateValue(value) {
|
|
178
165
|
if (!(0, _is.isNumber)(value)) {
|
|
179
166
|
if ((0, _is.isDate)(value)) {
|
|
180
167
|
// TODO: Find out whats the purpose of parsing to int
|
|
181
168
|
return parseInt(value.getTime() / 1000 + "", 10);
|
|
182
169
|
}
|
|
183
|
-
|
|
184
170
|
return undefined;
|
|
185
171
|
}
|
|
186
|
-
|
|
187
172
|
return value;
|
|
188
173
|
}
|
|
189
|
-
|
|
190
174
|
function roundInterval(preDate = new Date(), interval) {
|
|
191
175
|
if (!(0, _is.isDate)(preDate)) {
|
|
192
176
|
if ((0, _is.isNumber)(preDate)) {
|
|
@@ -195,10 +179,9 @@ function roundInterval(preDate = new Date(), interval) {
|
|
|
195
179
|
return -1;
|
|
196
180
|
}
|
|
197
181
|
}
|
|
198
|
-
|
|
199
182
|
let minutes = preDate.getMinutes();
|
|
200
183
|
preDate.setMinutes(minutes - minutes % interval);
|
|
201
|
-
preDate.setSeconds(0);
|
|
202
|
-
|
|
184
|
+
preDate.setSeconds(0);
|
|
185
|
+
// TODO: Why?
|
|
203
186
|
return parseInt(preDate.getTime() / 1000 + "", 10);
|
|
204
187
|
}
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dropUpAlert = dropUpAlert;
|
|
7
|
-
|
|
8
7
|
var _open = require("./open");
|
|
9
|
-
|
|
10
8
|
var _chaynsDialog = require("./chaynsDialog");
|
|
11
|
-
|
|
12
9
|
function dropUpAlert(dialog = {}) {
|
|
13
10
|
dialog.callType = _chaynsDialog.dialogAction.DROP_UP_ALERT;
|
|
14
11
|
return (0, _open.open)(dialog);
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.fileSelect = fileSelect;
|
|
7
7
|
exports.fileType = void 0;
|
|
8
|
-
|
|
9
8
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
-
|
|
11
9
|
var _open = require("./open");
|
|
12
|
-
|
|
13
10
|
var _index = require("../index");
|
|
14
|
-
|
|
15
11
|
const fileType = {
|
|
16
12
|
'IMAGE': 'image',
|
|
17
13
|
'VIDEO': 'video',
|
|
@@ -19,31 +15,25 @@ const fileType = {
|
|
|
19
15
|
'DOCUMENT': ['application/x-latex', 'application/x-tex', 'text/', 'application/json', 'application/pdf', 'application/msword', 'application/msexcel', 'application/mspowerpoint', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument', 'application/vnd.oasis.opendocument']
|
|
20
16
|
};
|
|
21
17
|
exports.fileType = fileType;
|
|
22
|
-
|
|
23
18
|
async function fileSelect(dialog = {}) {
|
|
24
19
|
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
25
20
|
dialog.buttons = [];
|
|
26
|
-
|
|
27
21
|
if (dialog.multiselect || dialog.directory) {
|
|
28
22
|
dialog.buttons.push({
|
|
29
23
|
'text': _chaynsDialog.buttonText.OK,
|
|
30
24
|
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
31
25
|
});
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
dialog.buttons.push({
|
|
35
28
|
'text': _chaynsDialog.buttonText.CANCEL,
|
|
36
29
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
37
30
|
});
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
dialog.callType = _chaynsDialog.dialogAction.FILE_SELECT;
|
|
41
33
|
const user = (0, _index.getUser)();
|
|
42
|
-
|
|
43
34
|
if (!user) {
|
|
44
35
|
return (0, _index.login)();
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
dialog.chaynsToken = (await (0, _index.getAccessToken)()).accessToken;
|
|
48
38
|
return (0, _open.open)(dialog);
|
|
49
39
|
}
|
|
@@ -5,15 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports._chaynsCallResponder = _chaynsCallResponder;
|
|
7
7
|
exports.iFrame = iFrame;
|
|
8
|
-
|
|
9
8
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
-
|
|
11
9
|
var _open = require("./open");
|
|
12
|
-
|
|
13
10
|
var _communication = require("./communication");
|
|
14
|
-
|
|
15
11
|
var _index = require("../index");
|
|
16
|
-
|
|
17
12
|
function iFrame(dialog = {
|
|
18
13
|
url: ""
|
|
19
14
|
}) {
|
|
@@ -26,7 +21,6 @@ function iFrame(dialog = {
|
|
|
26
21
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
27
22
|
}];
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
dialog.tappIframeName = window.name;
|
|
31
25
|
dialog.callType = _chaynsDialog.dialogAction.IFRAME;
|
|
32
26
|
const site = (0, _index.getSite)();
|
|
@@ -34,11 +28,9 @@ function iFrame(dialog = {
|
|
|
34
28
|
(0, _communication.addDialogDataListener)(_chaynsCallResponder, true);
|
|
35
29
|
return (0, _open.open)(dialog);
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
function _chaynsCallResponder(obj) {
|
|
39
32
|
if (obj.call.value.callback) {
|
|
40
33
|
const call = JSON.parse(JSON.stringify(obj)); // deep copy
|
|
41
|
-
|
|
42
34
|
(0, _index.invokeDialogCall)(obj).then(result => {
|
|
43
35
|
(0, _communication.sendData)({
|
|
44
36
|
result,
|
|
@@ -19,11 +19,8 @@ Object.defineProperty(exports, "buttonType", {
|
|
|
19
19
|
return _chaynsDialog.buttonType;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
22
|
var _chaynsDialog = require("./chaynsDialog");
|
|
24
|
-
|
|
25
23
|
var _alert = require("./alert");
|
|
26
|
-
|
|
27
24
|
Object.keys(_alert).forEach(function (key) {
|
|
28
25
|
if (key === "default" || key === "__esModule") return;
|
|
29
26
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -35,9 +32,7 @@ Object.keys(_alert).forEach(function (key) {
|
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
});
|
|
38
|
-
|
|
39
35
|
var _confirm = require("./confirm");
|
|
40
|
-
|
|
41
36
|
Object.keys(_confirm).forEach(function (key) {
|
|
42
37
|
if (key === "default" || key === "__esModule") return;
|
|
43
38
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -49,9 +44,7 @@ Object.keys(_confirm).forEach(function (key) {
|
|
|
49
44
|
}
|
|
50
45
|
});
|
|
51
46
|
});
|
|
52
|
-
|
|
53
47
|
var _select = require("./select");
|
|
54
|
-
|
|
55
48
|
Object.keys(_select).forEach(function (key) {
|
|
56
49
|
if (key === "default" || key === "__esModule") return;
|
|
57
50
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -63,9 +56,7 @@ Object.keys(_select).forEach(function (key) {
|
|
|
63
56
|
}
|
|
64
57
|
});
|
|
65
58
|
});
|
|
66
|
-
|
|
67
59
|
var _date = require("./date");
|
|
68
|
-
|
|
69
60
|
Object.keys(_date).forEach(function (key) {
|
|
70
61
|
if (key === "default" || key === "__esModule") return;
|
|
71
62
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -77,9 +68,7 @@ Object.keys(_date).forEach(function (key) {
|
|
|
77
68
|
}
|
|
78
69
|
});
|
|
79
70
|
});
|
|
80
|
-
|
|
81
71
|
var _input = require("./input");
|
|
82
|
-
|
|
83
72
|
Object.keys(_input).forEach(function (key) {
|
|
84
73
|
if (key === "default" || key === "__esModule") return;
|
|
85
74
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -91,9 +80,7 @@ Object.keys(_input).forEach(function (key) {
|
|
|
91
80
|
}
|
|
92
81
|
});
|
|
93
82
|
});
|
|
94
|
-
|
|
95
83
|
var _close = require("./close");
|
|
96
|
-
|
|
97
84
|
Object.keys(_close).forEach(function (key) {
|
|
98
85
|
if (key === "default" || key === "__esModule") return;
|
|
99
86
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -105,9 +92,7 @@ Object.keys(_close).forEach(function (key) {
|
|
|
105
92
|
}
|
|
106
93
|
});
|
|
107
94
|
});
|
|
108
|
-
|
|
109
95
|
var _dropUpAlert = require("./dropUpAlert");
|
|
110
|
-
|
|
111
96
|
Object.keys(_dropUpAlert).forEach(function (key) {
|
|
112
97
|
if (key === "default" || key === "__esModule") return;
|
|
113
98
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -119,9 +104,7 @@ Object.keys(_dropUpAlert).forEach(function (key) {
|
|
|
119
104
|
}
|
|
120
105
|
});
|
|
121
106
|
});
|
|
122
|
-
|
|
123
107
|
var _iFrame = require("./iFrame");
|
|
124
|
-
|
|
125
108
|
Object.keys(_iFrame).forEach(function (key) {
|
|
126
109
|
if (key === "default" || key === "__esModule") return;
|
|
127
110
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -133,9 +116,7 @@ Object.keys(_iFrame).forEach(function (key) {
|
|
|
133
116
|
}
|
|
134
117
|
});
|
|
135
118
|
});
|
|
136
|
-
|
|
137
119
|
var _mediaSelect = require("./mediaSelect");
|
|
138
|
-
|
|
139
120
|
Object.keys(_mediaSelect).forEach(function (key) {
|
|
140
121
|
if (key === "default" || key === "__esModule") return;
|
|
141
122
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -147,9 +128,7 @@ Object.keys(_mediaSelect).forEach(function (key) {
|
|
|
147
128
|
}
|
|
148
129
|
});
|
|
149
130
|
});
|
|
150
|
-
|
|
151
131
|
var _fileSelect = require("./fileSelect");
|
|
152
|
-
|
|
153
132
|
Object.keys(_fileSelect).forEach(function (key) {
|
|
154
133
|
if (key === "default" || key === "__esModule") return;
|
|
155
134
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -161,9 +140,7 @@ Object.keys(_fileSelect).forEach(function (key) {
|
|
|
161
140
|
}
|
|
162
141
|
});
|
|
163
142
|
});
|
|
164
|
-
|
|
165
143
|
var _communication = require("./communication");
|
|
166
|
-
|
|
167
144
|
Object.keys(_communication).forEach(function (key) {
|
|
168
145
|
if (key === "default" || key === "__esModule") return;
|
|
169
146
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -175,9 +152,7 @@ Object.keys(_communication).forEach(function (key) {
|
|
|
175
152
|
}
|
|
176
153
|
});
|
|
177
154
|
});
|
|
178
|
-
|
|
179
155
|
var _toast = require("./toast");
|
|
180
|
-
|
|
181
156
|
Object.keys(_toast).forEach(function (key) {
|
|
182
157
|
if (key === "default" || key === "__esModule") return;
|
|
183
158
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -189,9 +164,7 @@ Object.keys(_toast).forEach(function (key) {
|
|
|
189
164
|
}
|
|
190
165
|
});
|
|
191
166
|
});
|
|
192
|
-
|
|
193
167
|
var _signature = require("./signature");
|
|
194
|
-
|
|
195
168
|
Object.keys(_signature).forEach(function (key) {
|
|
196
169
|
if (key === "default" || key === "__esModule") return;
|
|
197
170
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -5,11 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.input = input;
|
|
7
7
|
exports.inputType = void 0;
|
|
8
|
-
|
|
9
8
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
-
|
|
11
9
|
var _open = require("./open");
|
|
12
|
-
|
|
13
10
|
function input(dialog = {}) {
|
|
14
11
|
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
15
12
|
dialog.buttons = [{
|
|
@@ -20,15 +17,12 @@ function input(dialog = {}) {
|
|
|
20
17
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
21
18
|
}];
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
if (dialog.formatter) {
|
|
25
21
|
dialog.formatter = dialog.formatter.toString();
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
dialog.callType = _chaynsDialog.dialogAction.INPUT;
|
|
29
24
|
return (0, _open.open)(dialog);
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
const inputType = {
|
|
33
27
|
'DEFAULT': 0,
|
|
34
28
|
'PASSWORD': 1,
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.mediaSelect = mediaSelect;
|
|
7
|
-
|
|
8
7
|
var _chaynsDialog = require("./chaynsDialog");
|
|
9
|
-
|
|
10
8
|
var _open = require("./open");
|
|
11
|
-
|
|
12
9
|
var _index = require("../index");
|
|
13
|
-
|
|
14
10
|
async function mediaSelect(dialog = {}) {
|
|
15
11
|
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
16
12
|
dialog.buttons = [{
|
|
@@ -21,14 +17,11 @@ async function mediaSelect(dialog = {}) {
|
|
|
21
17
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
22
18
|
}];
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
dialog.callType = _chaynsDialog.dialogAction.MEDIA_SELECT;
|
|
26
21
|
const user = (0, _index.getUser)();
|
|
27
|
-
|
|
28
22
|
if (!user) {
|
|
29
23
|
return (0, _index.login)();
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
dialog.chaynsToken = (await (0, _index.getAccessToken)()).accessToken;
|
|
33
26
|
return (0, _open.open)(dialog);
|
|
34
27
|
}
|
|
@@ -5,16 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.select = select;
|
|
7
7
|
exports.selectType = void 0;
|
|
8
|
-
|
|
9
8
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
-
|
|
11
9
|
var _open = require("./open");
|
|
12
|
-
|
|
13
10
|
var _is = require("./utils/is");
|
|
14
|
-
|
|
15
11
|
function select(config) {
|
|
16
12
|
const list = [];
|
|
17
|
-
|
|
18
13
|
for (let i = 0, l = config.list.length; i < l; i++) {
|
|
19
14
|
const item = config.list[i];
|
|
20
15
|
list.push({
|
|
@@ -27,11 +22,9 @@ function select(config) {
|
|
|
27
22
|
'url': item.url
|
|
28
23
|
});
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
if (config.list.length === 0) {
|
|
32
26
|
return Promise.reject(new Error('Invalid Parameters'));
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
if (!config.buttons || !Array.isArray(config.buttons)) {
|
|
36
29
|
config.buttons = [{
|
|
37
30
|
'text': _chaynsDialog.buttonText.OK,
|
|
@@ -41,7 +34,6 @@ function select(config) {
|
|
|
41
34
|
'buttonType': _chaynsDialog.buttonType.CANCEL
|
|
42
35
|
}];
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
return (0, _open.open)({
|
|
46
38
|
'callType': _chaynsDialog.dialogAction.SELECT,
|
|
47
39
|
'title': config.title || '',
|
|
@@ -56,7 +48,6 @@ function select(config) {
|
|
|
56
48
|
list
|
|
57
49
|
});
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
const selectType = {
|
|
61
52
|
'DEFAULT': 0,
|
|
62
53
|
'ICON': 1
|
|
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.signature = signature;
|
|
7
|
-
|
|
8
7
|
var _chaynsDialog = require("./chaynsDialog");
|
|
9
|
-
|
|
10
8
|
var _open = require("./open");
|
|
11
|
-
|
|
12
9
|
function signature(dialog) {
|
|
13
10
|
if (!dialog) dialog = {};
|
|
14
|
-
|
|
15
11
|
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
16
12
|
dialog.buttons = [];
|
|
17
13
|
dialog.buttons.push({
|
|
@@ -23,7 +19,6 @@ function signature(dialog) {
|
|
|
23
19
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
24
20
|
});
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
dialog.callType = _chaynsDialog.dialogAction.SIGNATURE;
|
|
28
23
|
return (0, _open.open)(dialog);
|
|
29
24
|
}
|