chayns-api 1.0.11 → 1.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 (229) hide show
  1. package/.babelrc +30 -30
  2. package/.eslintrc +17 -17
  3. package/.github/workflows/deploy_docs.yml +28 -28
  4. package/.github/workflows/publish.yml +21 -21
  5. package/LICENSE +21 -21
  6. package/README.md +54 -54
  7. package/dist/cjs/bootstrap.js +11 -0
  8. package/dist/cjs/calls/abstractApiListener.js +40 -0
  9. package/dist/cjs/calls/apiEventListener.js +40 -0
  10. package/dist/cjs/calls/dialogs/date.js +10 -10
  11. package/dist/cjs/calls/index.js +102 -97
  12. package/dist/cjs/calls/sendMessage.js +8 -8
  13. package/dist/cjs/calls/setVisibilityChangeListener.js +1 -0
  14. package/dist/cjs/calls/visibilityChangeListener.js +4 -4
  15. package/dist/cjs/calls/windowMetricsListener.js +18 -0
  16. package/dist/cjs/client.js +93 -0
  17. package/dist/cjs/components/App.js +32 -0
  18. package/dist/cjs/components/App.spec.js +16 -0
  19. package/dist/cjs/components/AppDialogWrapper.js +42 -0
  20. package/dist/cjs/components/Button.js +32 -0
  21. package/dist/cjs/components/ChaynsModuleProvider.js +457 -0
  22. package/dist/cjs/components/ChaynsProvider.js +5 -2
  23. package/dist/cjs/components/ChaynsProviderExposed.js +16 -0
  24. package/dist/cjs/components/Dialog.js +1 -0
  25. package/dist/cjs/components/TestProvider.js +236 -0
  26. package/dist/cjs/components/Title.js +162 -0
  27. package/dist/cjs/components/withCompatMode.js +1 -1
  28. package/dist/cjs/functions/addApiListener.js +37 -0
  29. package/dist/cjs/functions/addGeoLocationListener.js +26 -0
  30. package/dist/cjs/functions/addScrollListener.js +26 -0
  31. package/dist/cjs/functions/addWindowMetricsListener.js +37 -0
  32. package/dist/cjs/handler/DialogHandler.js +40 -0
  33. package/dist/cjs/helper/cssLoader.js +28 -0
  34. package/dist/cjs/hooks/addGeoLocationListener.js +26 -0
  35. package/dist/cjs/hooks/addScrollListener.js +26 -0
  36. package/dist/cjs/hooks/addWindowMetricsListener.js +37 -0
  37. package/dist/cjs/hooks/geoLocation.js +48 -0
  38. package/dist/cjs/hooks/geoLocationListener.js +4 -4
  39. package/dist/cjs/hooks/index.js +14 -1
  40. package/dist/cjs/hooks/scrollListener.js +8 -8
  41. package/dist/cjs/hooks/useAccessToken.js +2 -2
  42. package/dist/cjs/hooks/useAddGeoLocationListener.js +26 -0
  43. package/dist/cjs/hooks/useAddScrollListener.js +48 -0
  44. package/dist/cjs/hooks/useAddWindowMetricsListener.js +45 -0
  45. package/dist/cjs/hooks/useAdddScrollListener.js +26 -0
  46. package/dist/cjs/hooks/useCurrentPage.js +2 -2
  47. package/dist/cjs/hooks/useCustomData.js +2 -2
  48. package/dist/cjs/hooks/useDevice.js +2 -2
  49. package/dist/cjs/hooks/useDialogState.js +35 -0
  50. package/dist/cjs/hooks/useEnvironment.js +2 -2
  51. package/dist/cjs/hooks/useFunction.js +13 -0
  52. package/dist/cjs/hooks/useFunctions.js +2 -2
  53. package/dist/cjs/hooks/useIsAdminMode.js +2 -2
  54. package/dist/cjs/hooks/useLanguage.js +2 -2
  55. package/dist/cjs/hooks/usePages.js +4 -4
  56. package/dist/cjs/hooks/useParameters.js +2 -2
  57. package/dist/cjs/hooks/useSite.js +2 -2
  58. package/dist/cjs/hooks/useUser.js +2 -2
  59. package/dist/cjs/hooks/useValues.js +2 -2
  60. package/dist/cjs/hooks/windowMetrics.js +45 -0
  61. package/dist/cjs/hooks/windowMetricsListener.js +4 -4
  62. package/dist/cjs/host/ChaynsHost.js +10 -5
  63. package/dist/cjs/host/HostIframe.js +157 -0
  64. package/dist/cjs/host/ModuleHost.js +11 -0
  65. package/dist/cjs/host/iframe/HostIframe.js +5 -2
  66. package/dist/cjs/host/module/ModuleHost.js +4 -0
  67. package/dist/cjs/host/module/utils.js +25 -0
  68. package/dist/cjs/index.example.js +7 -0
  69. package/dist/cjs/index2.js +64 -0
  70. package/dist/cjs/types/DynamicApiImport.d.js +5 -0
  71. package/dist/cjs/types/DynamicImport.d.js +5 -0
  72. package/dist/cjs/types/IChaynsReact.js +22 -2
  73. package/dist/cjs/types/chayns-components.d.js +1 -0
  74. package/dist/cjs/types/chayns-logger.d.js +1 -0
  75. package/dist/cjs/types/chayns.d.js +1 -0
  76. package/dist/cjs/types/tobit-websocket-service-client.d.js +1 -0
  77. package/dist/cjs/types/toolkit-types.d.js +1 -0
  78. package/dist/cjs/util/deviceHelper.js +7 -6
  79. package/dist/cjs/util/useFunctionsContext.js +16 -0
  80. package/dist/cjs/util/useIsAdminMode.js +18 -0
  81. package/dist/cjs/util/useUser.js +16 -0
  82. package/dist/cjs/wrapper/AppWrapper.js +39 -0
  83. package/dist/cjs/wrapper/Dialog.js +35 -0
  84. package/dist/cjs/wrapper/DialogHandler.js +35 -0
  85. package/dist/cjs/wrapper/FrameWrapper.js +17 -0
  86. package/dist/cjs/wrapper/ModuleFederationWrapper.js +4 -0
  87. package/dist/esm/bootstrap.js +4 -0
  88. package/dist/esm/calls/dialogs/date.js +34 -34
  89. package/dist/esm/calls/index.js +102 -96
  90. package/dist/esm/calls/sendMessage.js +8 -8
  91. package/dist/esm/calls/visibilityChangeListener.js +4 -4
  92. package/dist/esm/client.js +8 -0
  93. package/dist/esm/components/App.js +35 -0
  94. package/dist/esm/components/App.spec.js +9 -0
  95. package/dist/esm/components/AppDialogWrapper.js +33 -0
  96. package/dist/esm/components/Button.js +34 -0
  97. package/dist/esm/components/ChaynsModuleProvider.js +517 -0
  98. package/dist/esm/components/ChaynsProvider.js +5 -2
  99. package/dist/esm/components/ChaynsProviderExposed.js +3 -0
  100. package/dist/esm/components/Dialog.js +0 -0
  101. package/dist/esm/components/TestProvider.js +308 -0
  102. package/dist/esm/components/Title.js +210 -0
  103. package/dist/esm/components/withCompatMode.js +1 -1
  104. package/dist/esm/handler/DialogHandler.js +36 -0
  105. package/dist/esm/helper/cssLoader.js +21 -0
  106. package/dist/esm/hooks/geoLocationListener.js +4 -4
  107. package/dist/esm/hooks/index.js +2 -1
  108. package/dist/esm/hooks/scrollListener.js +8 -8
  109. package/dist/esm/hooks/useAccessToken.js +2 -2
  110. package/dist/esm/hooks/useAddGeoLocationListener.js +18 -0
  111. package/dist/esm/hooks/useAddScrollListener.js +18 -0
  112. package/dist/esm/hooks/useAddWindowMetricsListener.js +18 -0
  113. package/dist/esm/hooks/useCurrentPage.js +2 -2
  114. package/dist/esm/hooks/useCustomData.js +2 -2
  115. package/dist/esm/hooks/useDevice.js +2 -2
  116. package/dist/esm/hooks/useDialogState.js +28 -0
  117. package/dist/esm/hooks/useEnvironment.js +2 -2
  118. package/dist/esm/hooks/useFunction.js +6 -0
  119. package/dist/esm/hooks/useFunctions.js +2 -2
  120. package/dist/esm/hooks/useIsAdminMode.js +2 -2
  121. package/dist/esm/hooks/useLanguage.js +2 -2
  122. package/dist/esm/hooks/usePages.js +4 -4
  123. package/dist/esm/hooks/useParameters.js +2 -2
  124. package/dist/esm/hooks/useSite.js +2 -2
  125. package/dist/esm/hooks/useUser.js +2 -2
  126. package/dist/esm/hooks/useValues.js +2 -2
  127. package/dist/esm/hooks/windowMetricsListener.js +4 -4
  128. package/dist/esm/host/ChaynsHost.js +10 -5
  129. package/dist/esm/host/HostIframe.js +153 -0
  130. package/dist/esm/host/iframe/HostIframe.js +5 -2
  131. package/dist/esm/host/module/ModuleHost.js +4 -0
  132. package/dist/esm/index.example.js +1 -0
  133. package/dist/esm/index2.js +5 -0
  134. package/dist/esm/types/DynamicApiImport.d.js +1 -0
  135. package/dist/esm/types/DynamicImport.d.js +1 -0
  136. package/dist/esm/types/IChaynsReact.js +19 -1
  137. package/dist/esm/types/chayns-components.d.js +0 -0
  138. package/dist/esm/types/chayns-logger.d.js +0 -0
  139. package/dist/esm/types/chayns.d.js +0 -0
  140. package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
  141. package/dist/esm/types/toolkit-types.d.js +0 -0
  142. package/dist/esm/util/deviceHelper.js +7 -6
  143. package/dist/esm/util/useIsAdminMode.js +9 -0
  144. package/dist/esm/util/useUser.js +7 -0
  145. package/dist/esm/wrapper/AppWrapper.js +39 -0
  146. package/dist/esm/wrapper/Dialog.js +31 -0
  147. package/dist/esm/wrapper/DialogHandler.js +31 -0
  148. package/dist/esm/wrapper/FrameWrapper.js +17 -0
  149. package/dist/esm/wrapper/ModuleFederationWrapper.js +4 -0
  150. package/dist/types/bootstrap.d.ts +1 -0
  151. package/dist/types/calls/dialogs/alert.d.ts +1 -1
  152. package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
  153. package/dist/types/calls/dialogs/close.d.ts +1 -1
  154. package/dist/types/calls/dialogs/communication.d.ts +3 -3
  155. package/dist/types/calls/dialogs/confirm.d.ts +13 -13
  156. package/dist/types/calls/dialogs/date.d.ts +96 -96
  157. package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
  158. package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
  159. package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
  160. package/dist/types/calls/dialogs/index.d.ts +14 -14
  161. package/dist/types/calls/dialogs/input.d.ts +15 -15
  162. package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
  163. package/dist/types/calls/dialogs/open.d.ts +1 -1
  164. package/dist/types/calls/dialogs/select.d.ts +6 -6
  165. package/dist/types/calls/dialogs/signature.d.ts +7 -7
  166. package/dist/types/calls/dialogs/toast.d.ts +1 -1
  167. package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
  168. package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
  169. package/dist/types/calls/getUserInfo.d.ts +9 -9
  170. package/dist/types/calls/index.d.ts +237 -233
  171. package/dist/types/calls/sendMessage.d.ts +13 -13
  172. package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
  173. package/dist/types/client.d.ts +7 -0
  174. package/dist/types/components/App.d.ts +5 -0
  175. package/dist/types/components/AppDialogWrapper.d.ts +5 -0
  176. package/dist/types/components/Button.d.ts +8 -0
  177. package/dist/types/components/ChaynsContext.d.ts +3 -3
  178. package/dist/types/components/ChaynsModuleProvider.d.ts +170 -0
  179. package/dist/types/components/ChaynsProvider.d.ts +14 -14
  180. package/dist/types/components/ChaynsProviderExposed.d.ts +13 -0
  181. package/dist/types/components/Dialog.d.ts +0 -0
  182. package/dist/types/components/Title.d.ts +3 -0
  183. package/dist/types/components/WaitUntil.d.ts +8 -8
  184. package/dist/types/components/withCompatMode.d.ts +13 -13
  185. package/dist/types/handler/DialogHandler.d.ts +12 -0
  186. package/dist/types/helper/apiListenerHelper.d.ts +6 -6
  187. package/dist/types/hooks/geoLocationListener.d.ts +18 -18
  188. package/dist/types/hooks/index.d.ts +17 -16
  189. package/dist/types/hooks/scrollListener.d.ts +28 -28
  190. package/dist/types/hooks/useAccessToken.d.ts +5 -5
  191. package/dist/types/hooks/useCurrentPage.d.ts +4 -4
  192. package/dist/types/hooks/useCustomData.d.ts +4 -4
  193. package/dist/types/hooks/useDevice.d.ts +5 -5
  194. package/dist/types/hooks/useDialogState.d.ts +9 -0
  195. package/dist/types/hooks/useEnvironment.d.ts +5 -5
  196. package/dist/types/hooks/useFunction.d.ts +2 -0
  197. package/dist/types/hooks/useFunctions.d.ts +5 -5
  198. package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
  199. package/dist/types/hooks/useLanguage.d.ts +5 -5
  200. package/dist/types/hooks/usePages.d.ts +18 -18
  201. package/dist/types/hooks/useParameters.d.ts +5 -5
  202. package/dist/types/hooks/useSite.d.ts +5 -5
  203. package/dist/types/hooks/useUser.d.ts +5 -5
  204. package/dist/types/hooks/useValues.d.ts +5 -5
  205. package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
  206. package/dist/types/host/ChaynsHost.d.ts +30 -29
  207. package/dist/types/host/HostIframe.d.ts +20 -0
  208. package/dist/types/host/iframe/HostIframe.d.ts +26 -25
  209. package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
  210. package/dist/types/host/module/ModuleHost.d.ts +26 -25
  211. package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
  212. package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
  213. package/dist/types/index.d.ts +16 -16
  214. package/dist/types/index.example.d.ts +0 -0
  215. package/dist/types/types/IChaynsReact.d.ts +702 -623
  216. package/dist/types/types/dialog.d.ts +41 -41
  217. package/dist/types/util/appCall.d.ts +2 -2
  218. package/dist/types/util/deviceHelper.d.ts +7 -7
  219. package/dist/types/util/heightHelper.d.ts +1 -1
  220. package/dist/types/util/postIframeForm.d.ts +1 -1
  221. package/dist/types/util/url.d.ts +1 -1
  222. package/dist/types/wrapper/AppWrapper.d.ts +22 -18
  223. package/dist/types/wrapper/Dialog.d.ts +10 -0
  224. package/dist/types/wrapper/DialogHandler.d.ts +10 -0
  225. package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
  226. package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
  227. package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
  228. package/package.json +75 -75
  229. package/tsconfig.json +56 -56
@@ -5,12 +5,14 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
5
5
  // @ts-nocheck
6
6
 
7
7
  import throttle from 'lodash.throttle';
8
+ import DialogHandler from '../handler/DialogHandler';
8
9
  import { Environment, Font, Gender, IconType, RuntimeEnviroment, TappEvent } from '../types/IChaynsReact';
9
10
  import invokeAppCall from '../util/appCall';
10
11
  import getDeviceInfo, { getScreenSize } from '../util/deviceHelper';
11
12
  import getUserInfo from '../calls/getUserInfo';
12
13
  import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
13
14
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
15
+ let appWrapperDialogId = 0;
14
16
  export class AppWrapper {
15
17
  mapOldApiToNew(retVal) {
16
18
  var _window, _window2, _AppInfo$TappSelected;
@@ -427,12 +429,46 @@ export class AppWrapper {
427
429
  void this.appCall(19, value, {
428
430
  awaitResult: false
429
431
  });
432
+ },
433
+ createDialog: config => {
434
+ return new DialogHandler(config, this.functions.openDialog, this.functions.closeDialog);
435
+ },
436
+ openDialog: async (config, callback) => {
437
+ const currentDialogId = appWrapperDialogId++;
438
+ const eventTarget = new EventTarget();
439
+ const resolve = result => {
440
+ callback(result);
441
+ this.dispatchDialogChange(this.dialogs.filter(x => x.dialogId !== currentDialogId));
442
+ };
443
+ this.dispatchDialogChange([...this.dialogs, {
444
+ config,
445
+ resolve,
446
+ dialogId: currentDialogId,
447
+ eventTarget
448
+ }]);
449
+ return currentDialogId;
450
+ },
451
+ closeDialog: dialogId => {
452
+ const dialog = this.dialogs.find(x => x.dialogId === dialogId);
453
+ if (dialog) {
454
+ dialog.resolve({
455
+ buttonType: -1
456
+ });
457
+ }
430
458
  }
431
459
  });
460
+ _defineProperty(this, "dialogs", []);
461
+ _defineProperty(this, "dialogEventTarget", new EventTarget());
432
462
  }
433
463
  notImplemented(call) {
434
464
  console.warn(`call ${call} not implement in app`);
435
465
  }
466
+ dispatchDialogChange(detail) {
467
+ this.dialogs = detail;
468
+ this.dialogEventTarget.dispatchEvent(new CustomEvent('change', {
469
+ detail
470
+ }));
471
+ }
436
472
  appCall(action) {
437
473
  let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
438
474
  let {
@@ -465,6 +501,9 @@ export class AppWrapper {
465
501
  });
466
502
  });
467
503
  }
504
+ getDialogEventTarget() {
505
+ return this.dialogEventTarget;
506
+ }
468
507
  async init() {
469
508
  this.values = this.mapOldApiToNew(await this.appCall(18));
470
509
  return undefined;
@@ -0,0 +1,31 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ export default class DialogHandler {
5
+ constructor(config, open, close) {
6
+ _defineProperty(this, "isOpen", false);
7
+ this._open = open;
8
+ this._close = close;
9
+ this._config = config;
10
+ }
11
+ async open() {
12
+ if (this.isOpen) {
13
+ throw new Error('cannot open a dialog which is already open');
14
+ }
15
+ return new Promise(async resolve => {
16
+ const callback = data => {
17
+ this.isOpen = false;
18
+ resolve(data);
19
+ };
20
+ this.isOpen = true;
21
+ this.dialogId = await this._open(this._config, callback);
22
+ });
23
+ }
24
+ close(buttonType, data) {
25
+ if (!this.isOpen) {
26
+ return;
27
+ }
28
+ this.isOpen = false;
29
+ this._close(this.dialogId, data);
30
+ }
31
+ }
@@ -0,0 +1,31 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ export default class DialogHandler {
5
+ constructor(config, open, close) {
6
+ _defineProperty(this, "isOpen", false);
7
+ this._open = open;
8
+ this._close = close;
9
+ this._config = config;
10
+ }
11
+ async open() {
12
+ if (this.isOpen) {
13
+ throw new Error('cannot open a dialog which is already open');
14
+ }
15
+ return new Promise(async resolve => {
16
+ const callback = data => {
17
+ this.isOpen = false;
18
+ resolve(data);
19
+ };
20
+ this.isOpen = true;
21
+ this.dialogId = await this._open(this._config, callback);
22
+ });
23
+ }
24
+ close(buttonType, data) {
25
+ if (!this.isOpen) {
26
+ return;
27
+ }
28
+ this.isOpen = false;
29
+ this._close(this.dialogId, data);
30
+ }
31
+ }
@@ -3,6 +3,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
3
3
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
4
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
5
5
  import * as comlink from 'comlink';
6
+ import DialogHandler from '../handler/DialogHandler';
6
7
  import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
7
8
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
8
9
  import getUserInfo from '../calls/getUserInfo';
@@ -227,6 +228,22 @@ export class FrameWrapper {
227
228
  scrollByY: async (value, duration) => {
228
229
  if (!this.initialized) await this.ready;
229
230
  return this.exposedFunctions.scrollByY(value, duration);
231
+ },
232
+ createDialog: config => {
233
+ const openDialog = (config, callback) => this.exposedFunctions.openDialog(config, comlink.proxy(callback));
234
+ return new DialogHandler(config, openDialog, this.exposedFunctions.closeDialog);
235
+ },
236
+ closeDialog: async dialogId => {
237
+ if (!this.initialized) await this.ready;
238
+ return this.exposedFunctions.closeDialog(dialogId);
239
+ },
240
+ openDialog: async (config, callback) => {
241
+ if (!this.initialized) await this.ready;
242
+ return this.exposedFunctions.openDialog(config, comlink.proxy(callback));
243
+ },
244
+ setDialogResult: async result => {
245
+ if (!this.initialized) await this.ready;
246
+ return this.exposedFunctions.setDialogResult(result);
230
247
  }
231
248
  });
232
249
  _defineProperty(this, "initialized", false);
@@ -1,3 +1,4 @@
1
+ import DialogHandler from '../handler/DialogHandler';
1
2
  import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
2
3
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
3
4
  import getUserInfo from '../calls/getUserInfo';
@@ -20,6 +21,9 @@ export class ModuleFederationWrapper {
20
21
  return fn(...arguments);
21
22
  };
22
23
  });
24
+ this.functions.createDialog = config => {
25
+ return new DialogHandler(config, functions.openDialog, functions.closeDialog);
26
+ };
23
27
  this.functions.addWindowMetricsListener = async callback => {
24
28
  const {
25
29
  id,
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export declare function alert(title?: string, message?: string): Promise<any> | "unsupported";
1
+ export declare function alert(title?: string, message?: string): Promise<any> | "unsupported";
@@ -1,24 +1,24 @@
1
- export declare const buttonText: {
2
- YES: string;
3
- NO: string;
4
- OK: string;
5
- CANCEL: string;
6
- };
7
- export declare const buttonType: {
8
- CANCEL: number;
9
- NEGATIVE: number;
10
- POSITIVE: number;
11
- };
12
- export declare const dialogAction: {
13
- ALERT_CONFIRM: number;
14
- INPUT: number;
15
- SELECT: number;
16
- DATE: number;
17
- ADVANCED_DATE: number;
18
- DROP_UP_ALERT: number;
19
- MEDIA_SELECT: number;
20
- FILE_SELECT: number;
21
- SIGNATURE: number;
22
- IFRAME: number;
23
- };
24
- export declare function chaynsDialog(config: any): Promise<any> | "unsupported";
1
+ export declare const buttonText: {
2
+ YES: string;
3
+ NO: string;
4
+ OK: string;
5
+ CANCEL: string;
6
+ };
7
+ export declare const buttonType: {
8
+ CANCEL: number;
9
+ NEGATIVE: number;
10
+ POSITIVE: number;
11
+ };
12
+ export declare const dialogAction: {
13
+ ALERT_CONFIRM: number;
14
+ INPUT: number;
15
+ SELECT: number;
16
+ DATE: number;
17
+ ADVANCED_DATE: number;
18
+ DROP_UP_ALERT: number;
19
+ MEDIA_SELECT: number;
20
+ FILE_SELECT: number;
21
+ SIGNATURE: number;
22
+ IFRAME: number;
23
+ };
24
+ export declare function chaynsDialog(config: any): Promise<any> | "unsupported";
@@ -1 +1 @@
1
- export declare function close(): Promise<any>;
1
+ export declare function close(): Promise<any>;
@@ -1,3 +1,3 @@
1
- export declare function sendData(data: any, isApiEvent: any): Promise<any>;
2
- export declare function addDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
3
- export declare function removeDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
1
+ export declare function sendData(data: any, isApiEvent: any): Promise<any>;
2
+ export declare function addDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
3
+ export declare function removeDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
@@ -1,13 +1,13 @@
1
- import { DialogButton } from "../../types/dialog";
2
- type Confirm = {
3
- headline?: string;
4
- text?: string;
5
- buttons?: DialogButton[] | {
6
- buttons?: DialogButton[];
7
- links?: DialogButton[];
8
- };
9
- links?: unknown;
10
- select?: unknown;
11
- };
12
- export declare function confirm(title?: string, message?: string, config?: Confirm): Promise<any> | "unsupported";
13
- export {};
1
+ import { DialogButtonOld } from "../../types/dialog";
2
+ type Confirm = {
3
+ headline?: string;
4
+ text?: string;
5
+ buttons?: DialogButtonOld[] | {
6
+ buttons?: DialogButtonOld[];
7
+ links?: DialogButtonOld[];
8
+ };
9
+ links?: unknown;
10
+ select?: unknown;
11
+ };
12
+ export declare function confirm(title?: string, message?: string, config?: Confirm): Promise<any> | "unsupported";
13
+ export {};
@@ -1,96 +1,96 @@
1
- import { DialogButton, DialogTextBlock, IntervalItem, WeekDayIntervalObject } from "../../types/dialog";
2
- /**
3
- * The config object for date dialog
4
- * @typedef {Object} dateConfig
5
- * @property {Date} preSelect - The date object which should be preselected.
6
- * @property {Date} minDate - The min date which you could select.
7
- * @property {Date} maxDate - The max date which you could select.
8
- * @property {dateDialogType} dateType - The type of dialog you want to display.
9
- * @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
10
- * @property {string} message - The message that is displayed above the date dialog, only in apps supported
11
- * @property {string} title - The title that is displayed above the message, only in apps supported
12
- */
13
- /**
14
- * This call will open a date select dialog.
15
- * <div>Call: 30</div>
16
- * @param {dateConfig} config - Define the configuration of this call
17
- * @return {Promise} contains a timestamp as result
18
- * @example chayns.dialog.date({
19
- * 'dateType': chayns.dialog.dateType.DATE_TIME,
20
- * 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
21
- * 'minDate': new Date(2018, 6, 1, 15, 0, 0),
22
- * 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
23
- * 'minuteInterval': 15
24
- * ).then(function (data) {
25
- * console.log(data);
26
- * });
27
- */
28
- type DateConfig = {
29
- title?: string;
30
- message?: string;
31
- buttons?: DialogButton[];
32
- minDate?: Date | number;
33
- maxDate?: Date | number;
34
- minuteInterval?: number;
35
- preSelect?: Date | undefined | number;
36
- multiselect?: boolean;
37
- disabledDates?: Date[] | number[];
38
- textBlocks?: DialogTextBlock[];
39
- yearSelect?: boolean;
40
- monthSelect?: boolean;
41
- interval?: boolean;
42
- minInterval?: number;
43
- maxInterval?: number;
44
- disabledIntervals?: Array<IntervalItem>;
45
- disabledWeekDayIntervals?: Array<WeekDayIntervalObject>[7];
46
- getLocalTime?: boolean;
47
- dateType?: number;
48
- autoSelectDate?: boolean;
49
- };
50
- export declare function date(config?: DateConfig): Promise<any>;
51
- type preSelectObj = {
52
- start?: number | undefined | Date;
53
- end?: number | undefined | Date;
54
- };
55
- type preSelect = preSelectObj | Date | undefined | number | number[];
56
- type AdvancedDateConfig = {
57
- title?: string;
58
- message?: string;
59
- buttons?: DialogButton[];
60
- minDate?: Date | number;
61
- maxDate?: Date | number;
62
- minuteInterval?: number;
63
- preSelect?: preSelect;
64
- multiselect?: boolean;
65
- disabledDates?: Date[] | number[];
66
- textBlocks?: DialogTextBlock[];
67
- yearSelect?: boolean;
68
- monthSelect?: boolean;
69
- interval?: boolean;
70
- minInterval?: number;
71
- maxInterval?: number;
72
- disabledIntervals?: Array<IntervalItem>;
73
- disabledWeekDayIntervals?: Array<WeekDayIntervalObject>[7];
74
- getLocalTime?: boolean;
75
- dateType?: number;
76
- autoSelectDate?: boolean;
77
- };
78
- export declare function advancedDate(config?: AdvancedDateConfig): Promise<unknown>;
79
- /**
80
- * @typedef {number} dateDialogType
81
- */
82
- /**
83
- * Enum for date dialog
84
- * <div>DATE will open a dialog where you can select a special day</div>
85
- * <div>TIME will open a dialog where you can only select a special time</div>
86
- * <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
87
- * @readonly
88
- * @enum {dateDialogType}
89
- * @type {{DATE: number, TIME: number, DATE_TIME: number}}
90
- */
91
- export declare const dateType: {
92
- DATE: number;
93
- TIME: number;
94
- DATE_TIME: number;
95
- };
96
- export {};
1
+ import { DialogButtonOld, DialogTextBlock, IntervalItem, WeekDayIntervalObject } from "../../types/dialog";
2
+ /**
3
+ * The config object for date dialog
4
+ * @typedef {Object} dateConfig
5
+ * @property {Date} preSelect - The date object which should be preselected.
6
+ * @property {Date} minDate - The min date which you could select.
7
+ * @property {Date} maxDate - The max date which you could select.
8
+ * @property {dateDialogType} dateType - The type of dialog you want to display.
9
+ * @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
10
+ * @property {string} message - The message that is displayed above the date dialog, only in apps supported
11
+ * @property {string} title - The title that is displayed above the message, only in apps supported
12
+ */
13
+ /**
14
+ * This call will open a date select dialog.
15
+ * <div>Call: 30</div>
16
+ * @param {dateConfig} config - Define the configuration of this call
17
+ * @return {Promise} contains a timestamp as result
18
+ * @example chayns.dialog.date({
19
+ * 'dateType': chayns.dialog.dateType.DATE_TIME,
20
+ * 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
21
+ * 'minDate': new Date(2018, 6, 1, 15, 0, 0),
22
+ * 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
23
+ * 'minuteInterval': 15
24
+ * ).then(function (data) {
25
+ * console.log(data);
26
+ * });
27
+ */
28
+ type DateConfig = {
29
+ title?: string;
30
+ message?: string;
31
+ buttons?: DialogButtonOld[];
32
+ minDate?: Date | number;
33
+ maxDate?: Date | number;
34
+ minuteInterval?: number;
35
+ preSelect?: Date | undefined | number;
36
+ multiselect?: boolean;
37
+ disabledDates?: Date[] | number[];
38
+ textBlocks?: DialogTextBlock[];
39
+ yearSelect?: boolean;
40
+ monthSelect?: boolean;
41
+ interval?: boolean;
42
+ minInterval?: number;
43
+ maxInterval?: number;
44
+ disabledIntervals?: Array<IntervalItem>;
45
+ disabledWeekDayIntervals?: Array<WeekDayIntervalObject>[7];
46
+ getLocalTime?: boolean;
47
+ dateType?: number;
48
+ autoSelectDate?: boolean;
49
+ };
50
+ export declare function date(config?: DateConfig): Promise<any>;
51
+ type preSelectObj = {
52
+ start?: number | undefined | Date;
53
+ end?: number | undefined | Date;
54
+ };
55
+ type preSelect = preSelectObj | Date | undefined | number | number[];
56
+ type AdvancedDateConfig = {
57
+ title?: string;
58
+ message?: string;
59
+ buttons?: DialogButtonOld[];
60
+ minDate?: Date | number;
61
+ maxDate?: Date | number;
62
+ minuteInterval?: number;
63
+ preSelect?: preSelect;
64
+ multiselect?: boolean;
65
+ disabledDates?: Date[] | number[];
66
+ textBlocks?: DialogTextBlock[];
67
+ yearSelect?: boolean;
68
+ monthSelect?: boolean;
69
+ interval?: boolean;
70
+ minInterval?: number;
71
+ maxInterval?: number;
72
+ disabledIntervals?: Array<IntervalItem>;
73
+ disabledWeekDayIntervals?: Array<WeekDayIntervalObject>[7];
74
+ getLocalTime?: boolean;
75
+ dateType?: number;
76
+ autoSelectDate?: boolean;
77
+ };
78
+ export declare function advancedDate(config?: AdvancedDateConfig): Promise<unknown>;
79
+ /**
80
+ * @typedef {number} dateDialogType
81
+ */
82
+ /**
83
+ * Enum for date dialog
84
+ * <div>DATE will open a dialog where you can select a special day</div>
85
+ * <div>TIME will open a dialog where you can only select a special time</div>
86
+ * <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
87
+ * @readonly
88
+ * @enum {dateDialogType}
89
+ * @type {{DATE: number, TIME: number, DATE_TIME: number}}
90
+ */
91
+ export declare const dateType: {
92
+ DATE: number;
93
+ TIME: number;
94
+ DATE_TIME: number;
95
+ };
96
+ export {};
@@ -1,5 +1,5 @@
1
- type DropUpAlert = {
2
- callType?: number;
3
- };
4
- export declare function dropUpAlert(dialog?: DropUpAlert): Promise<unknown>;
5
- export {};
1
+ type DropUpAlert = {
2
+ callType?: number;
3
+ };
4
+ export declare function dropUpAlert(dialog?: DropUpAlert): Promise<unknown>;
5
+ export {};
@@ -1,16 +1,16 @@
1
- import { DialogButton } from "../../types/dialog";
2
- export declare const fileType: {
3
- IMAGE: string;
4
- VIDEO: string;
5
- AUDIO: string;
6
- DOCUMENT: string[];
7
- };
8
- type FileSelectInput = {
9
- buttons?: DialogButton[];
10
- callType?: number;
11
- multiselect?: boolean;
12
- directory?: boolean;
13
- chaynsToken?: string;
14
- };
15
- export declare function fileSelect(dialog?: FileSelectInput): Promise<unknown>;
16
- export {};
1
+ import { DialogButtonOld } from "../../types/dialog";
2
+ export declare const fileType: {
3
+ IMAGE: string;
4
+ VIDEO: string;
5
+ AUDIO: string;
6
+ DOCUMENT: string[];
7
+ };
8
+ type FileSelectInput = {
9
+ buttons?: DialogButtonOld[];
10
+ callType?: number;
11
+ multiselect?: boolean;
12
+ directory?: boolean;
13
+ chaynsToken?: string;
14
+ };
15
+ export declare function fileSelect(dialog?: FileSelectInput): Promise<unknown>;
16
+ export {};
@@ -1,10 +1,10 @@
1
- import { DialogButton } from "../../types/dialog";
2
- type iFrameDialog = {
3
- buttons?: DialogButton[];
4
- callType?: number;
5
- tappIframeName?: string;
6
- url: string;
7
- };
8
- export declare function iFrame(dialog?: iFrameDialog): Promise<unknown>;
9
- export declare function _chaynsCallResponder(obj: any): void;
10
- export {};
1
+ import { DialogButtonOld } from "../../types/dialog";
2
+ type iFrameDialog = {
3
+ buttons?: DialogButtonOld[];
4
+ callType?: number;
5
+ tappIframeName?: string;
6
+ url: string;
7
+ };
8
+ export declare function iFrame(dialog?: iFrameDialog): Promise<unknown>;
9
+ export declare function _chaynsCallResponder(obj: any): void;
10
+ export {};
@@ -1,14 +1,14 @@
1
- export { buttonText, buttonType } from './chaynsDialog';
2
- export * from './alert';
3
- export * from './confirm';
4
- export * from './select';
5
- export * from './date';
6
- export * from './input';
7
- export * from './close';
8
- export * from './dropUpAlert';
9
- export * from './iFrame';
10
- export * from './mediaSelect';
11
- export * from './fileSelect';
12
- export * from './communication';
13
- export * from './toast';
14
- export * from './signature';
1
+ export { buttonText, buttonType } from './chaynsDialog';
2
+ export * from './alert';
3
+ export * from './confirm';
4
+ export * from './select';
5
+ export * from './date';
6
+ export * from './input';
7
+ export * from './close';
8
+ export * from './dropUpAlert';
9
+ export * from './iFrame';
10
+ export * from './mediaSelect';
11
+ export * from './fileSelect';
12
+ export * from './communication';
13
+ export * from './toast';
14
+ export * from './signature';
@@ -1,15 +1,15 @@
1
- import { DialogButton } from "../../types/dialog";
2
- type InputDialog = {
3
- buttons?: DialogButton[];
4
- callType?: number;
5
- formatter?: string;
6
- };
7
- export declare function input(dialog?: InputDialog): Promise<unknown>;
8
- export declare const inputType: {
9
- DEFAULT: number;
10
- PASSWORD: number;
11
- TEXTAREA: number;
12
- INPUT: number;
13
- NUMBER: number;
14
- };
15
- export {};
1
+ import { DialogButtonOld } from "../../types/dialog";
2
+ type InputDialog = {
3
+ buttons?: DialogButtonOld[];
4
+ callType?: number;
5
+ formatter?: string;
6
+ };
7
+ export declare function input(dialog?: InputDialog): Promise<unknown>;
8
+ export declare const inputType: {
9
+ DEFAULT: number;
10
+ PASSWORD: number;
11
+ TEXTAREA: number;
12
+ INPUT: number;
13
+ NUMBER: number;
14
+ };
15
+ export {};
@@ -1,8 +1,8 @@
1
- import { DialogButton } from "../../types/dialog";
2
- type MediaSelectInput = {
3
- buttons?: DialogButton[];
4
- callType?: number;
5
- chaynsToken?: string;
6
- };
7
- export declare function mediaSelect(dialog?: MediaSelectInput): Promise<unknown>;
8
- export {};
1
+ import { DialogButtonOld } from "../../types/dialog";
2
+ type MediaSelectInput = {
3
+ buttons?: DialogButtonOld[];
4
+ callType?: number;
5
+ chaynsToken?: string;
6
+ };
7
+ export declare function mediaSelect(dialog?: MediaSelectInput): Promise<unknown>;
8
+ export {};
@@ -1 +1 @@
1
- export declare function open(json: any): Promise<unknown>;
1
+ export declare function open(json: any): Promise<unknown>;
@@ -1,6 +1,6 @@
1
- import { SelectInput } from '../../types/IChaynsReact';
2
- export declare function select(config: SelectInput): Promise<unknown>;
3
- export declare const selectType: {
4
- DEFAULT: number;
5
- ICON: number;
6
- };
1
+ import { SelectInput } from '../../types/IChaynsReact';
2
+ export declare function select(config: SelectInput): Promise<unknown>;
3
+ export declare const selectType: {
4
+ DEFAULT: number;
5
+ ICON: number;
6
+ };
@@ -1,7 +1,7 @@
1
- import { DialogButton } from "../../types/dialog";
2
- type SignatureInput = {
3
- buttons?: DialogButton[];
4
- callType?: number;
5
- };
6
- export declare function signature(dialog?: SignatureInput): Promise<unknown>;
7
- export {};
1
+ import { DialogButtonOld } from "../../types/dialog";
2
+ type SignatureInput = {
3
+ buttons?: DialogButtonOld[];
4
+ callType?: number;
5
+ };
6
+ export declare function signature(dialog?: SignatureInput): Promise<unknown>;
7
+ export {};
@@ -1 +1 @@
1
- export declare function toast(config?: {}): Promise<any>;
1
+ export declare function toast(config?: {}): Promise<any>;