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.
Files changed (205) hide show
  1. package/.babelrc +30 -0
  2. package/.eslintrc +17 -0
  3. package/.github/workflows/deploy_docs.yml +28 -0
  4. package/LICENSE +21 -0
  5. package/README.md +47 -0
  6. package/dist/cjs/calls/dialogs/alert.js +19 -0
  7. package/dist/cjs/calls/dialogs/chaynsDialog.js +59 -0
  8. package/dist/cjs/calls/dialogs/close.js +13 -0
  9. package/dist/cjs/calls/dialogs/communication.js +71 -0
  10. package/dist/cjs/calls/dialogs/confirm.js +33 -0
  11. package/dist/cjs/calls/dialogs/date.js +187 -0
  12. package/dist/cjs/calls/dialogs/dropUpAlert.js +12 -0
  13. package/dist/cjs/calls/dialogs/fileSelect.js +39 -0
  14. package/dist/cjs/calls/dialogs/iFrame.js +43 -0
  15. package/dist/cjs/calls/dialogs/index.js +178 -0
  16. package/dist/cjs/calls/dialogs/input.js +33 -0
  17. package/dist/cjs/calls/dialogs/mediaSelect.js +27 -0
  18. package/dist/cjs/calls/dialogs/open.js +19 -0
  19. package/dist/cjs/calls/dialogs/select.js +55 -0
  20. package/dist/cjs/calls/dialogs/signature.js +24 -0
  21. package/dist/cjs/calls/dialogs/toast.js +18 -0
  22. package/dist/cjs/calls/dialogs/utils/callback.js +12 -0
  23. package/dist/cjs/calls/dialogs/utils/environment.js +10 -0
  24. package/dist/cjs/calls/dialogs/utils/is.js +21 -0
  25. package/dist/cjs/calls/getUserInfo.js +40 -0
  26. package/dist/cjs/calls/index.js +300 -0
  27. package/dist/cjs/calls/sendMessage.js +120 -0
  28. package/dist/cjs/calls/visibilityChangeListener.js +38 -0
  29. package/dist/cjs/client.js +93 -0
  30. package/dist/cjs/components/ChaynsContext.js +12 -0
  31. package/dist/cjs/components/ChaynsModuleProvider.js +457 -0
  32. package/dist/cjs/components/ChaynsProvider.js +116 -0
  33. package/dist/cjs/components/WaitUntil.js +31 -0
  34. package/dist/cjs/components/withCompatMode.js +55 -0
  35. package/dist/cjs/helper/apiListenerHelper.js +34 -0
  36. package/dist/cjs/hooks/geoLocationListener.js +50 -0
  37. package/dist/cjs/hooks/index.js +153 -0
  38. package/dist/cjs/hooks/scrollListener.js +102 -0
  39. package/dist/cjs/hooks/useAccessToken.js +28 -0
  40. package/dist/cjs/hooks/useCurrentPage.js +13 -0
  41. package/dist/cjs/hooks/useCustomData.js +13 -0
  42. package/dist/cjs/hooks/useDevice.js +13 -0
  43. package/dist/cjs/hooks/useEnvironment.js +13 -0
  44. package/dist/cjs/hooks/useFunctions.js +16 -0
  45. package/dist/cjs/hooks/useIsAdminMode.js +16 -0
  46. package/dist/cjs/hooks/useLanguage.js +13 -0
  47. package/dist/cjs/hooks/usePages.js +38 -0
  48. package/dist/cjs/hooks/useParameters.js +13 -0
  49. package/dist/cjs/hooks/useSite.js +13 -0
  50. package/dist/cjs/hooks/useUser.js +14 -0
  51. package/dist/cjs/hooks/useValues.js +16 -0
  52. package/dist/cjs/hooks/windowMetricsListener.js +58 -0
  53. package/dist/cjs/host/ChaynsHost.js +102 -0
  54. package/dist/cjs/host/iframe/HostIframe.js +133 -0
  55. package/dist/cjs/host/iframe/utils/useUpdateData.js +21 -0
  56. package/dist/cjs/host/module/ModuleHost.js +82 -0
  57. package/dist/cjs/host/module/PagemakerFrame.js +105 -0
  58. package/dist/cjs/host/module/utils/loadComponent.js +61 -0
  59. package/dist/cjs/host/module/utils/useDynamicScript.js +61 -0
  60. package/dist/cjs/index.js +117 -0
  61. package/dist/cjs/types/DynamicApiImport.d.js +5 -0
  62. package/dist/cjs/types/IChaynsReact.js +235 -0
  63. package/dist/cjs/types/dialog.js +5 -0
  64. package/dist/cjs/util/appCall.js +23 -0
  65. package/dist/cjs/util/deviceHelper.js +71 -0
  66. package/dist/cjs/util/heightHelper.js +40 -0
  67. package/dist/cjs/util/postIframeForm.js +32 -0
  68. package/dist/cjs/wrapper/AppWrapper.js +244 -0
  69. package/dist/cjs/wrapper/FrameWrapper.js +288 -0
  70. package/dist/cjs/wrapper/ModuleFederationWrapper.js +61 -0
  71. package/dist/cjs/wrapper/SsrWrapper.js +30 -0
  72. package/dist/esm/calls/dialogs/alert.js +15 -0
  73. package/dist/esm/calls/dialogs/chaynsDialog.js +48 -0
  74. package/dist/esm/calls/dialogs/close.js +7 -0
  75. package/dist/esm/calls/dialogs/communication.js +66 -0
  76. package/dist/esm/calls/dialogs/confirm.js +30 -0
  77. package/dist/esm/calls/dialogs/date.js +211 -0
  78. package/dist/esm/calls/dialogs/dropUpAlert.js +7 -0
  79. package/dist/esm/calls/dialogs/fileSelect.js +32 -0
  80. package/dist/esm/calls/dialogs/iFrame.js +37 -0
  81. package/dist/esm/calls/dialogs/index.js +14 -0
  82. package/dist/esm/calls/dialogs/input.js +26 -0
  83. package/dist/esm/calls/dialogs/mediaSelect.js +22 -0
  84. package/dist/esm/calls/dialogs/open.js +13 -0
  85. package/dist/esm/calls/dialogs/select.js +47 -0
  86. package/dist/esm/calls/dialogs/signature.js +18 -0
  87. package/dist/esm/calls/dialogs/toast.js +13 -0
  88. package/dist/esm/calls/dialogs/utils/callback.js +7 -0
  89. package/dist/esm/calls/dialogs/utils/environment.js +3 -0
  90. package/dist/esm/calls/dialogs/utils/is.js +12 -0
  91. package/dist/esm/calls/getUserInfo.js +33 -0
  92. package/dist/esm/calls/index.js +323 -0
  93. package/dist/esm/calls/sendMessage.js +111 -0
  94. package/dist/esm/calls/visibilityChangeListener.js +30 -0
  95. package/dist/esm/client.js +8 -0
  96. package/dist/esm/components/ChaynsContext.js +4 -0
  97. package/dist/esm/components/ChaynsModuleProvider.js +517 -0
  98. package/dist/esm/components/ChaynsProvider.js +109 -0
  99. package/dist/esm/components/WaitUntil.js +25 -0
  100. package/dist/esm/components/withCompatMode.js +47 -0
  101. package/dist/esm/helper/apiListenerHelper.js +25 -0
  102. package/dist/esm/hooks/geoLocationListener.js +43 -0
  103. package/dist/esm/hooks/index.js +16 -0
  104. package/dist/esm/hooks/scrollListener.js +95 -0
  105. package/dist/esm/hooks/useAccessToken.js +22 -0
  106. package/dist/esm/hooks/useCurrentPage.js +7 -0
  107. package/dist/esm/hooks/useCustomData.js +7 -0
  108. package/dist/esm/hooks/useDevice.js +6 -0
  109. package/dist/esm/hooks/useEnvironment.js +6 -0
  110. package/dist/esm/hooks/useFunctions.js +9 -0
  111. package/dist/esm/hooks/useIsAdminMode.js +9 -0
  112. package/dist/esm/hooks/useLanguage.js +6 -0
  113. package/dist/esm/hooks/usePages.js +32 -0
  114. package/dist/esm/hooks/useParameters.js +6 -0
  115. package/dist/esm/hooks/useSite.js +6 -0
  116. package/dist/esm/hooks/useUser.js +7 -0
  117. package/dist/esm/hooks/useValues.js +9 -0
  118. package/dist/esm/hooks/windowMetricsListener.js +51 -0
  119. package/dist/esm/host/ChaynsHost.js +95 -0
  120. package/dist/esm/host/iframe/HostIframe.js +124 -0
  121. package/dist/esm/host/iframe/utils/useUpdateData.js +14 -0
  122. package/dist/esm/host/module/ModuleHost.js +74 -0
  123. package/dist/esm/host/module/PagemakerFrame.js +97 -0
  124. package/dist/esm/host/module/utils/loadComponent.js +55 -0
  125. package/dist/esm/host/module/utils/useDynamicScript.js +50 -0
  126. package/dist/esm/index.js +16 -0
  127. package/dist/esm/types/DynamicApiImport.d.js +1 -0
  128. package/dist/esm/types/IChaynsReact.js +215 -0
  129. package/dist/esm/types/dialog.js +1 -0
  130. package/dist/esm/util/appCall.js +16 -0
  131. package/dist/esm/util/deviceHelper.js +62 -0
  132. package/dist/esm/util/heightHelper.js +32 -0
  133. package/dist/esm/util/postIframeForm.js +26 -0
  134. package/dist/esm/wrapper/AppWrapper.js +241 -0
  135. package/dist/esm/wrapper/FrameWrapper.js +279 -0
  136. package/dist/esm/wrapper/ModuleFederationWrapper.js +56 -0
  137. package/dist/esm/wrapper/SsrWrapper.js +23 -0
  138. package/dist/types/calls/dialogs/alert.d.ts +1 -0
  139. package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -0
  140. package/dist/types/calls/dialogs/close.d.ts +1 -0
  141. package/dist/types/calls/dialogs/communication.d.ts +3 -0
  142. package/dist/types/calls/dialogs/confirm.d.ts +13 -0
  143. package/dist/types/calls/dialogs/date.d.ts +96 -0
  144. package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -0
  145. package/dist/types/calls/dialogs/fileSelect.d.ts +16 -0
  146. package/dist/types/calls/dialogs/iFrame.d.ts +10 -0
  147. package/dist/types/calls/dialogs/index.d.ts +14 -0
  148. package/dist/types/calls/dialogs/input.d.ts +15 -0
  149. package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -0
  150. package/dist/types/calls/dialogs/open.d.ts +1 -0
  151. package/dist/types/calls/dialogs/select.d.ts +6 -0
  152. package/dist/types/calls/dialogs/signature.d.ts +7 -0
  153. package/dist/types/calls/dialogs/toast.d.ts +1 -0
  154. package/dist/types/calls/dialogs/utils/callback.d.ts +1 -0
  155. package/dist/types/calls/dialogs/utils/environment.d.ts +3 -0
  156. package/dist/types/calls/dialogs/utils/is.d.ts +4 -0
  157. package/dist/types/calls/getUserInfo.d.ts +9 -0
  158. package/dist/types/calls/index.d.ts +231 -0
  159. package/dist/types/calls/sendMessage.d.ts +13 -0
  160. package/dist/types/calls/visibilityChangeListener.d.ts +9 -0
  161. package/dist/types/client.d.ts +7 -0
  162. package/dist/types/components/ChaynsContext.d.ts +3 -0
  163. package/dist/types/components/ChaynsModuleProvider.d.ts +170 -0
  164. package/dist/types/components/ChaynsProvider.d.ts +13 -0
  165. package/dist/types/components/WaitUntil.d.ts +7 -0
  166. package/dist/types/components/withCompatMode.d.ts +13 -0
  167. package/dist/types/helper/apiListenerHelper.d.ts +6 -0
  168. package/dist/types/hooks/geoLocationListener.d.ts +18 -0
  169. package/dist/types/hooks/index.d.ts +16 -0
  170. package/dist/types/hooks/scrollListener.d.ts +28 -0
  171. package/dist/types/hooks/useAccessToken.d.ts +5 -0
  172. package/dist/types/hooks/useCurrentPage.d.ts +4 -0
  173. package/dist/types/hooks/useCustomData.d.ts +4 -0
  174. package/dist/types/hooks/useDevice.d.ts +5 -0
  175. package/dist/types/hooks/useEnvironment.d.ts +5 -0
  176. package/dist/types/hooks/useFunctions.d.ts +5 -0
  177. package/dist/types/hooks/useIsAdminMode.d.ts +4 -0
  178. package/dist/types/hooks/useLanguage.d.ts +5 -0
  179. package/dist/types/hooks/usePages.d.ts +14 -0
  180. package/dist/types/hooks/useParameters.d.ts +5 -0
  181. package/dist/types/hooks/useSite.d.ts +5 -0
  182. package/dist/types/hooks/useUser.d.ts +5 -0
  183. package/dist/types/hooks/useValues.d.ts +5 -0
  184. package/dist/types/hooks/windowMetricsListener.d.ts +11 -0
  185. package/dist/types/host/ChaynsHost.d.ts +27 -0
  186. package/dist/types/host/iframe/HostIframe.d.ts +24 -0
  187. package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -0
  188. package/dist/types/host/module/ModuleHost.d.ts +23 -0
  189. package/dist/types/host/module/PagemakerFrame.d.ts +22 -0
  190. package/dist/types/host/module/utils/loadComponent.d.ts +1 -0
  191. package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -0
  192. package/dist/types/index.d.ts +16 -0
  193. package/dist/types/types/IChaynsReact.d.ts +590 -0
  194. package/dist/types/types/dialog.d.ts +41 -0
  195. package/dist/types/util/appCall.d.ts +2 -0
  196. package/dist/types/util/deviceHelper.d.ts +7 -0
  197. package/dist/types/util/heightHelper.d.ts +1 -0
  198. package/dist/types/util/postIframeForm.d.ts +1 -0
  199. package/dist/types/wrapper/AppWrapper.d.ts +16 -0
  200. package/dist/types/wrapper/FrameWrapper.d.ts +15 -0
  201. package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -0
  202. package/dist/types/wrapper/SsrWrapper.d.ts +11 -0
  203. package/package.json +76 -0
  204. package/toolkit.config.js +52 -0
  205. 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;