chayns-api 1.0.0
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 -0
- package/.eslintrc +17 -0
- package/.github/workflows/deploy_docs.yml +28 -0
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/cjs/calls/dialogs/alert.js +19 -0
- package/dist/cjs/calls/dialogs/chaynsDialog.js +59 -0
- package/dist/cjs/calls/dialogs/close.js +13 -0
- package/dist/cjs/calls/dialogs/communication.js +71 -0
- package/dist/cjs/calls/dialogs/confirm.js +33 -0
- package/dist/cjs/calls/dialogs/date.js +187 -0
- package/dist/cjs/calls/dialogs/dropUpAlert.js +12 -0
- package/dist/cjs/calls/dialogs/fileSelect.js +39 -0
- package/dist/cjs/calls/dialogs/iFrame.js +43 -0
- package/dist/cjs/calls/dialogs/index.js +178 -0
- package/dist/cjs/calls/dialogs/input.js +33 -0
- package/dist/cjs/calls/dialogs/mediaSelect.js +27 -0
- package/dist/cjs/calls/dialogs/open.js +19 -0
- package/dist/cjs/calls/dialogs/select.js +55 -0
- package/dist/cjs/calls/dialogs/signature.js +24 -0
- package/dist/cjs/calls/dialogs/toast.js +18 -0
- package/dist/cjs/calls/dialogs/utils/callback.js +12 -0
- package/dist/cjs/calls/dialogs/utils/environment.js +10 -0
- package/dist/cjs/calls/dialogs/utils/is.js +21 -0
- package/dist/cjs/calls/getUserInfo.js +40 -0
- package/dist/cjs/calls/index.js +300 -0
- package/dist/cjs/calls/sendMessage.js +120 -0
- package/dist/cjs/calls/visibilityChangeListener.js +38 -0
- package/dist/cjs/client.js +93 -0
- package/dist/cjs/components/ChaynsContext.js +12 -0
- package/dist/cjs/components/ChaynsModuleProvider.js +457 -0
- package/dist/cjs/components/ChaynsProvider.js +116 -0
- package/dist/cjs/components/WaitUntil.js +31 -0
- package/dist/cjs/components/withCompatMode.js +55 -0
- package/dist/cjs/helper/apiListenerHelper.js +34 -0
- package/dist/cjs/hooks/geoLocationListener.js +50 -0
- package/dist/cjs/hooks/index.js +153 -0
- package/dist/cjs/hooks/scrollListener.js +102 -0
- package/dist/cjs/hooks/useAccessToken.js +28 -0
- package/dist/cjs/hooks/useCurrentPage.js +13 -0
- package/dist/cjs/hooks/useCustomData.js +13 -0
- package/dist/cjs/hooks/useDevice.js +13 -0
- package/dist/cjs/hooks/useEnvironment.js +13 -0
- package/dist/cjs/hooks/useFunctions.js +16 -0
- package/dist/cjs/hooks/useIsAdminMode.js +16 -0
- package/dist/cjs/hooks/useLanguage.js +13 -0
- package/dist/cjs/hooks/usePages.js +38 -0
- package/dist/cjs/hooks/useParameters.js +13 -0
- package/dist/cjs/hooks/useSite.js +13 -0
- package/dist/cjs/hooks/useUser.js +14 -0
- package/dist/cjs/hooks/useValues.js +16 -0
- package/dist/cjs/hooks/windowMetricsListener.js +58 -0
- package/dist/cjs/host/ChaynsHost.js +102 -0
- package/dist/cjs/host/iframe/HostIframe.js +133 -0
- package/dist/cjs/host/iframe/utils/useUpdateData.js +21 -0
- package/dist/cjs/host/module/ModuleHost.js +82 -0
- package/dist/cjs/host/module/PagemakerFrame.js +105 -0
- package/dist/cjs/host/module/utils/loadComponent.js +61 -0
- package/dist/cjs/host/module/utils/useDynamicScript.js +61 -0
- package/dist/cjs/index.js +117 -0
- package/dist/cjs/types/DynamicApiImport.d.js +5 -0
- package/dist/cjs/types/IChaynsReact.js +235 -0
- package/dist/cjs/types/dialog.js +5 -0
- package/dist/cjs/util/appCall.js +23 -0
- package/dist/cjs/util/deviceHelper.js +71 -0
- package/dist/cjs/util/heightHelper.js +40 -0
- package/dist/cjs/util/postIframeForm.js +32 -0
- package/dist/cjs/wrapper/AppWrapper.js +244 -0
- package/dist/cjs/wrapper/FrameWrapper.js +288 -0
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +61 -0
- package/dist/cjs/wrapper/SsrWrapper.js +30 -0
- package/dist/esm/calls/dialogs/alert.js +15 -0
- package/dist/esm/calls/dialogs/chaynsDialog.js +48 -0
- package/dist/esm/calls/dialogs/close.js +7 -0
- package/dist/esm/calls/dialogs/communication.js +66 -0
- package/dist/esm/calls/dialogs/confirm.js +30 -0
- package/dist/esm/calls/dialogs/date.js +211 -0
- package/dist/esm/calls/dialogs/dropUpAlert.js +7 -0
- package/dist/esm/calls/dialogs/fileSelect.js +32 -0
- package/dist/esm/calls/dialogs/iFrame.js +37 -0
- package/dist/esm/calls/dialogs/index.js +14 -0
- package/dist/esm/calls/dialogs/input.js +26 -0
- package/dist/esm/calls/dialogs/mediaSelect.js +22 -0
- package/dist/esm/calls/dialogs/open.js +13 -0
- package/dist/esm/calls/dialogs/select.js +47 -0
- package/dist/esm/calls/dialogs/signature.js +18 -0
- package/dist/esm/calls/dialogs/toast.js +13 -0
- package/dist/esm/calls/dialogs/utils/callback.js +7 -0
- package/dist/esm/calls/dialogs/utils/environment.js +3 -0
- package/dist/esm/calls/dialogs/utils/is.js +12 -0
- package/dist/esm/calls/getUserInfo.js +33 -0
- package/dist/esm/calls/index.js +323 -0
- package/dist/esm/calls/sendMessage.js +111 -0
- package/dist/esm/calls/visibilityChangeListener.js +30 -0
- package/dist/esm/client.js +8 -0
- package/dist/esm/components/ChaynsContext.js +4 -0
- package/dist/esm/components/ChaynsModuleProvider.js +517 -0
- package/dist/esm/components/ChaynsProvider.js +109 -0
- package/dist/esm/components/WaitUntil.js +25 -0
- package/dist/esm/components/withCompatMode.js +47 -0
- package/dist/esm/helper/apiListenerHelper.js +25 -0
- package/dist/esm/hooks/geoLocationListener.js +43 -0
- package/dist/esm/hooks/index.js +16 -0
- package/dist/esm/hooks/scrollListener.js +95 -0
- package/dist/esm/hooks/useAccessToken.js +22 -0
- package/dist/esm/hooks/useCurrentPage.js +7 -0
- package/dist/esm/hooks/useCustomData.js +7 -0
- package/dist/esm/hooks/useDevice.js +6 -0
- package/dist/esm/hooks/useEnvironment.js +6 -0
- package/dist/esm/hooks/useFunctions.js +9 -0
- package/dist/esm/hooks/useIsAdminMode.js +9 -0
- package/dist/esm/hooks/useLanguage.js +6 -0
- package/dist/esm/hooks/usePages.js +32 -0
- package/dist/esm/hooks/useParameters.js +6 -0
- package/dist/esm/hooks/useSite.js +6 -0
- package/dist/esm/hooks/useUser.js +7 -0
- package/dist/esm/hooks/useValues.js +9 -0
- package/dist/esm/hooks/windowMetricsListener.js +51 -0
- package/dist/esm/host/ChaynsHost.js +95 -0
- package/dist/esm/host/iframe/HostIframe.js +124 -0
- package/dist/esm/host/iframe/utils/useUpdateData.js +14 -0
- package/dist/esm/host/module/ModuleHost.js +74 -0
- package/dist/esm/host/module/PagemakerFrame.js +97 -0
- package/dist/esm/host/module/utils/loadComponent.js +55 -0
- package/dist/esm/host/module/utils/useDynamicScript.js +50 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/types/DynamicApiImport.d.js +1 -0
- package/dist/esm/types/IChaynsReact.js +215 -0
- package/dist/esm/types/dialog.js +1 -0
- package/dist/esm/util/appCall.js +16 -0
- package/dist/esm/util/deviceHelper.js +62 -0
- package/dist/esm/util/heightHelper.js +32 -0
- package/dist/esm/util/postIframeForm.js +26 -0
- package/dist/esm/wrapper/AppWrapper.js +241 -0
- package/dist/esm/wrapper/FrameWrapper.js +279 -0
- package/dist/esm/wrapper/ModuleFederationWrapper.js +56 -0
- package/dist/esm/wrapper/SsrWrapper.js +23 -0
- package/dist/types/calls/dialogs/alert.d.ts +1 -0
- package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -0
- package/dist/types/calls/dialogs/close.d.ts +1 -0
- package/dist/types/calls/dialogs/communication.d.ts +3 -0
- package/dist/types/calls/dialogs/confirm.d.ts +13 -0
- package/dist/types/calls/dialogs/date.d.ts +96 -0
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -0
- package/dist/types/calls/dialogs/fileSelect.d.ts +16 -0
- package/dist/types/calls/dialogs/iFrame.d.ts +10 -0
- package/dist/types/calls/dialogs/index.d.ts +14 -0
- package/dist/types/calls/dialogs/input.d.ts +15 -0
- package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -0
- package/dist/types/calls/dialogs/open.d.ts +1 -0
- package/dist/types/calls/dialogs/select.d.ts +6 -0
- package/dist/types/calls/dialogs/signature.d.ts +7 -0
- package/dist/types/calls/dialogs/toast.d.ts +1 -0
- package/dist/types/calls/dialogs/utils/callback.d.ts +1 -0
- package/dist/types/calls/dialogs/utils/environment.d.ts +3 -0
- package/dist/types/calls/dialogs/utils/is.d.ts +4 -0
- package/dist/types/calls/getUserInfo.d.ts +9 -0
- package/dist/types/calls/index.d.ts +231 -0
- package/dist/types/calls/sendMessage.d.ts +13 -0
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -0
- package/dist/types/client.d.ts +7 -0
- package/dist/types/components/ChaynsContext.d.ts +3 -0
- package/dist/types/components/ChaynsModuleProvider.d.ts +170 -0
- package/dist/types/components/ChaynsProvider.d.ts +13 -0
- package/dist/types/components/WaitUntil.d.ts +7 -0
- package/dist/types/components/withCompatMode.d.ts +13 -0
- package/dist/types/helper/apiListenerHelper.d.ts +6 -0
- package/dist/types/hooks/geoLocationListener.d.ts +18 -0
- package/dist/types/hooks/index.d.ts +16 -0
- package/dist/types/hooks/scrollListener.d.ts +28 -0
- package/dist/types/hooks/useAccessToken.d.ts +5 -0
- package/dist/types/hooks/useCurrentPage.d.ts +4 -0
- package/dist/types/hooks/useCustomData.d.ts +4 -0
- package/dist/types/hooks/useDevice.d.ts +5 -0
- package/dist/types/hooks/useEnvironment.d.ts +5 -0
- package/dist/types/hooks/useFunctions.d.ts +5 -0
- package/dist/types/hooks/useIsAdminMode.d.ts +4 -0
- package/dist/types/hooks/useLanguage.d.ts +5 -0
- package/dist/types/hooks/usePages.d.ts +14 -0
- package/dist/types/hooks/useParameters.d.ts +5 -0
- package/dist/types/hooks/useSite.d.ts +5 -0
- package/dist/types/hooks/useUser.d.ts +5 -0
- package/dist/types/hooks/useValues.d.ts +5 -0
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -0
- package/dist/types/host/ChaynsHost.d.ts +27 -0
- package/dist/types/host/iframe/HostIframe.d.ts +24 -0
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -0
- package/dist/types/host/module/ModuleHost.d.ts +23 -0
- package/dist/types/host/module/PagemakerFrame.d.ts +22 -0
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -0
- package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/types/IChaynsReact.d.ts +590 -0
- package/dist/types/types/dialog.d.ts +41 -0
- package/dist/types/util/appCall.d.ts +2 -0
- package/dist/types/util/deviceHelper.d.ts +7 -0
- package/dist/types/util/heightHelper.d.ts +1 -0
- package/dist/types/util/postIframeForm.d.ts +1 -0
- package/dist/types/wrapper/AppWrapper.d.ts +16 -0
- package/dist/types/wrapper/FrameWrapper.d.ts +15 -0
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -0
- package/dist/types/wrapper/SsrWrapper.d.ts +11 -0
- package/package.json +76 -0
- package/toolkit.config.js +52 -0
- package/tsconfig.json +56 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
buttonText: true,
|
|
8
|
+
buttonType: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "buttonText", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _chaynsDialog.buttonText;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "buttonType", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _chaynsDialog.buttonType;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _chaynsDialog = require("./chaynsDialog");
|
|
23
|
+
var _alert = require("./alert");
|
|
24
|
+
Object.keys(_alert).forEach(function (key) {
|
|
25
|
+
if (key === "default" || key === "__esModule") return;
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
+
if (key in exports && exports[key] === _alert[key]) return;
|
|
28
|
+
Object.defineProperty(exports, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _alert[key];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var _confirm = require("./confirm");
|
|
36
|
+
Object.keys(_confirm).forEach(function (key) {
|
|
37
|
+
if (key === "default" || key === "__esModule") return;
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
39
|
+
if (key in exports && exports[key] === _confirm[key]) return;
|
|
40
|
+
Object.defineProperty(exports, key, {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return _confirm[key];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
var _select = require("./select");
|
|
48
|
+
Object.keys(_select).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
51
|
+
if (key in exports && exports[key] === _select[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _select[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
var _date = require("./date");
|
|
60
|
+
Object.keys(_date).forEach(function (key) {
|
|
61
|
+
if (key === "default" || key === "__esModule") return;
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
63
|
+
if (key in exports && exports[key] === _date[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _date[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
var _input = require("./input");
|
|
72
|
+
Object.keys(_input).forEach(function (key) {
|
|
73
|
+
if (key === "default" || key === "__esModule") return;
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
75
|
+
if (key in exports && exports[key] === _input[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _input[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _close = require("./close");
|
|
84
|
+
Object.keys(_close).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
87
|
+
if (key in exports && exports[key] === _close[key]) return;
|
|
88
|
+
Object.defineProperty(exports, key, {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () {
|
|
91
|
+
return _close[key];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
var _dropUpAlert = require("./dropUpAlert");
|
|
96
|
+
Object.keys(_dropUpAlert).forEach(function (key) {
|
|
97
|
+
if (key === "default" || key === "__esModule") return;
|
|
98
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
99
|
+
if (key in exports && exports[key] === _dropUpAlert[key]) return;
|
|
100
|
+
Object.defineProperty(exports, key, {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () {
|
|
103
|
+
return _dropUpAlert[key];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
var _iFrame = require("./iFrame");
|
|
108
|
+
Object.keys(_iFrame).forEach(function (key) {
|
|
109
|
+
if (key === "default" || key === "__esModule") return;
|
|
110
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
111
|
+
if (key in exports && exports[key] === _iFrame[key]) return;
|
|
112
|
+
Object.defineProperty(exports, key, {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () {
|
|
115
|
+
return _iFrame[key];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
var _mediaSelect = require("./mediaSelect");
|
|
120
|
+
Object.keys(_mediaSelect).forEach(function (key) {
|
|
121
|
+
if (key === "default" || key === "__esModule") return;
|
|
122
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
123
|
+
if (key in exports && exports[key] === _mediaSelect[key]) return;
|
|
124
|
+
Object.defineProperty(exports, key, {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () {
|
|
127
|
+
return _mediaSelect[key];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
var _fileSelect = require("./fileSelect");
|
|
132
|
+
Object.keys(_fileSelect).forEach(function (key) {
|
|
133
|
+
if (key === "default" || key === "__esModule") return;
|
|
134
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
135
|
+
if (key in exports && exports[key] === _fileSelect[key]) return;
|
|
136
|
+
Object.defineProperty(exports, key, {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
get: function () {
|
|
139
|
+
return _fileSelect[key];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
var _communication = require("./communication");
|
|
144
|
+
Object.keys(_communication).forEach(function (key) {
|
|
145
|
+
if (key === "default" || key === "__esModule") return;
|
|
146
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
147
|
+
if (key in exports && exports[key] === _communication[key]) return;
|
|
148
|
+
Object.defineProperty(exports, key, {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
get: function () {
|
|
151
|
+
return _communication[key];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
var _toast = require("./toast");
|
|
156
|
+
Object.keys(_toast).forEach(function (key) {
|
|
157
|
+
if (key === "default" || key === "__esModule") return;
|
|
158
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
159
|
+
if (key in exports && exports[key] === _toast[key]) return;
|
|
160
|
+
Object.defineProperty(exports, key, {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function () {
|
|
163
|
+
return _toast[key];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
var _signature = require("./signature");
|
|
168
|
+
Object.keys(_signature).forEach(function (key) {
|
|
169
|
+
if (key === "default" || key === "__esModule") return;
|
|
170
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
171
|
+
if (key in exports && exports[key] === _signature[key]) return;
|
|
172
|
+
Object.defineProperty(exports, key, {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () {
|
|
175
|
+
return _signature[key];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.input = input;
|
|
7
|
+
exports.inputType = void 0;
|
|
8
|
+
var _chaynsDialog = require("./chaynsDialog");
|
|
9
|
+
var _open = require("./open");
|
|
10
|
+
function input(dialog = {}) {
|
|
11
|
+
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
12
|
+
dialog.buttons = [{
|
|
13
|
+
'text': _chaynsDialog.buttonText.YES,
|
|
14
|
+
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
15
|
+
}, {
|
|
16
|
+
'text': _chaynsDialog.buttonText.NO,
|
|
17
|
+
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
18
|
+
}];
|
|
19
|
+
}
|
|
20
|
+
if (dialog.formatter) {
|
|
21
|
+
dialog.formatter = dialog.formatter.toString();
|
|
22
|
+
}
|
|
23
|
+
dialog.callType = _chaynsDialog.dialogAction.INPUT;
|
|
24
|
+
return (0, _open.open)(dialog);
|
|
25
|
+
}
|
|
26
|
+
const inputType = {
|
|
27
|
+
'DEFAULT': 0,
|
|
28
|
+
'PASSWORD': 1,
|
|
29
|
+
'TEXTAREA': 2,
|
|
30
|
+
'INPUT': 3,
|
|
31
|
+
'NUMBER': 4
|
|
32
|
+
};
|
|
33
|
+
exports.inputType = inputType;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mediaSelect = mediaSelect;
|
|
7
|
+
var _chaynsDialog = require("./chaynsDialog");
|
|
8
|
+
var _open = require("./open");
|
|
9
|
+
var _index = require("../index");
|
|
10
|
+
async function mediaSelect(dialog = {}) {
|
|
11
|
+
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
12
|
+
dialog.buttons = [{
|
|
13
|
+
'text': _chaynsDialog.buttonText.OK,
|
|
14
|
+
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
15
|
+
}, {
|
|
16
|
+
'text': _chaynsDialog.buttonText.CANCEL,
|
|
17
|
+
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
18
|
+
}];
|
|
19
|
+
}
|
|
20
|
+
dialog.callType = _chaynsDialog.dialogAction.MEDIA_SELECT;
|
|
21
|
+
const user = (0, _index.getUser)();
|
|
22
|
+
if (!user) {
|
|
23
|
+
return (0, _index.login)();
|
|
24
|
+
}
|
|
25
|
+
dialog.chaynsToken = (await (0, _index.getAccessToken)()).accessToken;
|
|
26
|
+
return (0, _open.open)(dialog);
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.open = open;
|
|
7
|
+
var _index = require("../index");
|
|
8
|
+
function open(json) {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
(0, _index.invokeDialogCall)({
|
|
11
|
+
action: 184,
|
|
12
|
+
value: {
|
|
13
|
+
'dialogContent': json
|
|
14
|
+
}
|
|
15
|
+
}, e => {
|
|
16
|
+
resolve(e);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.select = select;
|
|
7
|
+
exports.selectType = void 0;
|
|
8
|
+
var _chaynsDialog = require("./chaynsDialog");
|
|
9
|
+
var _open = require("./open");
|
|
10
|
+
var _is = require("./utils/is");
|
|
11
|
+
function select(config) {
|
|
12
|
+
const list = [];
|
|
13
|
+
for (let i = 0, l = config.list.length; i < l; i++) {
|
|
14
|
+
const item = config.list[i];
|
|
15
|
+
list.push({
|
|
16
|
+
name: item.name,
|
|
17
|
+
'value': (0, _is.isPresent)(item.value) ? item.value : item.name,
|
|
18
|
+
'isSelected': !!item.isSelected,
|
|
19
|
+
'icon': item.icon,
|
|
20
|
+
'backgroundColor': item.backgroundColor,
|
|
21
|
+
'className': item.className,
|
|
22
|
+
'url': item.url
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (config.list.length === 0) {
|
|
26
|
+
return Promise.reject(new Error('Invalid Parameters'));
|
|
27
|
+
}
|
|
28
|
+
if (!config.buttons || !Array.isArray(config.buttons)) {
|
|
29
|
+
config.buttons = [{
|
|
30
|
+
'text': _chaynsDialog.buttonText.OK,
|
|
31
|
+
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
32
|
+
}, {
|
|
33
|
+
'text': _chaynsDialog.buttonText.CANCEL,
|
|
34
|
+
'buttonType': _chaynsDialog.buttonType.CANCEL
|
|
35
|
+
}];
|
|
36
|
+
}
|
|
37
|
+
return (0, _open.open)({
|
|
38
|
+
'callType': _chaynsDialog.dialogAction.SELECT,
|
|
39
|
+
'title': config.title || '',
|
|
40
|
+
'message': config.message || '',
|
|
41
|
+
'buttons': config.buttons,
|
|
42
|
+
'links': config.links,
|
|
43
|
+
'multiselect': !!config.multiselect,
|
|
44
|
+
'quickfind': !!config.quickfind,
|
|
45
|
+
'type': config.type,
|
|
46
|
+
'preventCloseOnClick': !!config.preventCloseOnClick,
|
|
47
|
+
'selectAllButton': config.selectAllButton,
|
|
48
|
+
list
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const selectType = {
|
|
52
|
+
'DEFAULT': 0,
|
|
53
|
+
'ICON': 1
|
|
54
|
+
};
|
|
55
|
+
exports.selectType = selectType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.signature = signature;
|
|
7
|
+
var _chaynsDialog = require("./chaynsDialog");
|
|
8
|
+
var _open = require("./open");
|
|
9
|
+
function signature(dialog) {
|
|
10
|
+
if (!dialog) dialog = {};
|
|
11
|
+
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
12
|
+
dialog.buttons = [];
|
|
13
|
+
dialog.buttons.push({
|
|
14
|
+
'text': _chaynsDialog.buttonText.OK,
|
|
15
|
+
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
16
|
+
});
|
|
17
|
+
dialog.buttons.push({
|
|
18
|
+
'text': _chaynsDialog.buttonText.CANCEL,
|
|
19
|
+
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
dialog.callType = _chaynsDialog.dialogAction.SIGNATURE;
|
|
23
|
+
return (0, _open.open)(dialog);
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toast = toast;
|
|
7
|
+
var _callback = require("./utils/callback");
|
|
8
|
+
var _index = require("../index");
|
|
9
|
+
function toast(config = {}) {
|
|
10
|
+
const callbackName = 'toastCallback';
|
|
11
|
+
return (0, _index.invokeDialogCall)({
|
|
12
|
+
action: 276,
|
|
13
|
+
value: {
|
|
14
|
+
'callback': (0, _callback.getCallbackName)(callbackName),
|
|
15
|
+
...config
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCallbackName = getCallbackName;
|
|
7
|
+
function getCallbackName(fnName, framePrefix = '') {
|
|
8
|
+
if (framePrefix !== '') {
|
|
9
|
+
return `window._chaynsCallbacks.${framePrefix}.${fnName}`;
|
|
10
|
+
}
|
|
11
|
+
return `window._chaynsCallbacks.${fnName}`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.environment = void 0;
|
|
7
|
+
let environment = {
|
|
8
|
+
language: (navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] : navigator.language).substring(0, 2)
|
|
9
|
+
};
|
|
10
|
+
exports.environment = environment;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isDate = isDate;
|
|
7
|
+
exports.isNumber = isNumber;
|
|
8
|
+
exports.isObject = isObject;
|
|
9
|
+
exports.isPresent = isPresent;
|
|
10
|
+
function isObject(value) {
|
|
11
|
+
return value !== null && typeof value === 'object';
|
|
12
|
+
}
|
|
13
|
+
function isNumber(value) {
|
|
14
|
+
return typeof value === 'number' && !isNaN(value);
|
|
15
|
+
}
|
|
16
|
+
function isDate(value) {
|
|
17
|
+
return Object.prototype.toString.call(value) === '[object Date]';
|
|
18
|
+
}
|
|
19
|
+
function isPresent(value) {
|
|
20
|
+
return typeof value !== 'undefined' && value !== null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const getUserInfo = async (api, value) => {
|
|
8
|
+
var _value$personId;
|
|
9
|
+
const query = (_value$personId = value.personId) !== null && _value$personId !== void 0 ? _value$personId : value.userId;
|
|
10
|
+
if (!query) {
|
|
11
|
+
throw new Error('Invalid Parameters - You have to provide at least one of these Parameters: userId, personId');
|
|
12
|
+
}
|
|
13
|
+
const {
|
|
14
|
+
accessToken
|
|
15
|
+
} = await api.functions.getAccessToken();
|
|
16
|
+
if (!accessToken) {
|
|
17
|
+
throw new Error('get user info requires a user to be logged in');
|
|
18
|
+
}
|
|
19
|
+
const res = await fetch(`https://relations.chayns.net/relations/user/findUser?searchString=${query}`, {
|
|
20
|
+
'headers': {
|
|
21
|
+
'authorization': `bearer ${accessToken}`
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (res.ok) {
|
|
25
|
+
const data = await res.json();
|
|
26
|
+
if (data.length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
firstName: data[0].firstName,
|
|
31
|
+
lastName: data[0].lastName,
|
|
32
|
+
userId: data[0].userId,
|
|
33
|
+
personId: data[0].personId,
|
|
34
|
+
name: data[0].name
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`getUserInfo failed with status ${res.status}`);
|
|
38
|
+
};
|
|
39
|
+
var _default = getUserInfo;
|
|
40
|
+
exports.default = _default;
|