chayns-api 1.0.10-beta.1 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) 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 -47
  7. package/dist/cjs/calls/dialogs/date.js +10 -10
  8. package/dist/cjs/calls/index.js +97 -102
  9. package/dist/cjs/calls/sendMessage.js +8 -8
  10. package/dist/cjs/calls/visibilityChangeListener.js +4 -4
  11. package/dist/cjs/components/ChaynsProvider.js +2 -5
  12. package/dist/cjs/components/withCompatMode.js +27 -5
  13. package/dist/cjs/hooks/geoLocationListener.js +4 -4
  14. package/dist/cjs/hooks/index.js +1 -14
  15. package/dist/cjs/hooks/scrollListener.js +8 -8
  16. package/dist/cjs/hooks/useAccessToken.js +2 -2
  17. package/dist/cjs/hooks/useCurrentPage.js +2 -2
  18. package/dist/cjs/hooks/useCustomData.js +2 -2
  19. package/dist/cjs/hooks/useDevice.js +2 -2
  20. package/dist/cjs/hooks/useEnvironment.js +2 -2
  21. package/dist/cjs/hooks/useFunctions.js +2 -2
  22. package/dist/cjs/hooks/useIsAdminMode.js +2 -2
  23. package/dist/cjs/hooks/useLanguage.js +2 -2
  24. package/dist/cjs/hooks/usePages.js +4 -4
  25. package/dist/cjs/hooks/useParameters.js +2 -2
  26. package/dist/cjs/hooks/useSite.js +2 -2
  27. package/dist/cjs/hooks/useUser.js +2 -2
  28. package/dist/cjs/hooks/useValues.js +2 -2
  29. package/dist/cjs/hooks/windowMetricsListener.js +4 -4
  30. package/dist/cjs/host/ChaynsHost.js +3 -6
  31. package/dist/cjs/host/iframe/HostIframe.js +3 -6
  32. package/dist/cjs/host/module/ModuleHost.js +1 -1
  33. package/dist/cjs/types/IChaynsReact.js +2 -22
  34. package/dist/cjs/util/deviceHelper.js +6 -7
  35. package/dist/cjs/wrapper/AppWrapper.js +0 -59
  36. package/dist/cjs/wrapper/FrameWrapper.js +1 -16
  37. package/dist/cjs/wrapper/ModuleFederationWrapper.js +0 -11
  38. package/dist/esm/calls/dialogs/date.js +34 -34
  39. package/dist/esm/calls/index.js +96 -102
  40. package/dist/esm/calls/sendMessage.js +8 -8
  41. package/dist/esm/calls/visibilityChangeListener.js +4 -4
  42. package/dist/esm/components/ChaynsProvider.js +2 -5
  43. package/dist/esm/components/withCompatMode.js +27 -5
  44. package/dist/esm/hooks/geoLocationListener.js +4 -4
  45. package/dist/esm/hooks/index.js +1 -2
  46. package/dist/esm/hooks/scrollListener.js +8 -8
  47. package/dist/esm/hooks/useAccessToken.js +2 -2
  48. package/dist/esm/hooks/useCurrentPage.js +2 -2
  49. package/dist/esm/hooks/useCustomData.js +2 -2
  50. package/dist/esm/hooks/useDevice.js +2 -2
  51. package/dist/esm/hooks/useEnvironment.js +2 -2
  52. package/dist/esm/hooks/useFunctions.js +2 -2
  53. package/dist/esm/hooks/useIsAdminMode.js +2 -2
  54. package/dist/esm/hooks/useLanguage.js +2 -2
  55. package/dist/esm/hooks/usePages.js +4 -4
  56. package/dist/esm/hooks/useParameters.js +2 -2
  57. package/dist/esm/hooks/useSite.js +2 -2
  58. package/dist/esm/hooks/useUser.js +2 -2
  59. package/dist/esm/hooks/useValues.js +2 -2
  60. package/dist/esm/hooks/windowMetricsListener.js +4 -4
  61. package/dist/esm/host/ChaynsHost.js +3 -6
  62. package/dist/esm/host/iframe/HostIframe.js +3 -6
  63. package/dist/esm/host/module/ModuleHost.js +1 -1
  64. package/dist/esm/types/IChaynsReact.js +1 -19
  65. package/dist/esm/util/deviceHelper.js +6 -7
  66. package/dist/esm/wrapper/AppWrapper.js +0 -60
  67. package/dist/esm/wrapper/FrameWrapper.js +1 -16
  68. package/dist/esm/wrapper/ModuleFederationWrapper.js +0 -11
  69. package/dist/types/calls/dialogs/alert.d.ts +1 -1
  70. package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
  71. package/dist/types/calls/dialogs/close.d.ts +1 -1
  72. package/dist/types/calls/dialogs/communication.d.ts +3 -3
  73. package/dist/types/calls/dialogs/confirm.d.ts +13 -13
  74. package/dist/types/calls/dialogs/date.d.ts +96 -96
  75. package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
  76. package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
  77. package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
  78. package/dist/types/calls/dialogs/index.d.ts +14 -14
  79. package/dist/types/calls/dialogs/input.d.ts +15 -15
  80. package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
  81. package/dist/types/calls/dialogs/open.d.ts +1 -1
  82. package/dist/types/calls/dialogs/select.d.ts +6 -6
  83. package/dist/types/calls/dialogs/signature.d.ts +7 -7
  84. package/dist/types/calls/dialogs/toast.d.ts +1 -1
  85. package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
  86. package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
  87. package/dist/types/calls/getUserInfo.d.ts +9 -9
  88. package/dist/types/calls/index.d.ts +233 -237
  89. package/dist/types/calls/sendMessage.d.ts +13 -13
  90. package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
  91. package/dist/types/components/ChaynsContext.d.ts +3 -3
  92. package/dist/types/components/ChaynsProvider.d.ts +14 -14
  93. package/dist/types/components/WaitUntil.d.ts +8 -8
  94. package/dist/types/components/withCompatMode.d.ts +13 -13
  95. package/dist/types/helper/apiListenerHelper.d.ts +6 -6
  96. package/dist/types/hooks/geoLocationListener.d.ts +18 -18
  97. package/dist/types/hooks/index.d.ts +16 -17
  98. package/dist/types/hooks/scrollListener.d.ts +28 -28
  99. package/dist/types/hooks/useAccessToken.d.ts +5 -5
  100. package/dist/types/hooks/useCurrentPage.d.ts +4 -4
  101. package/dist/types/hooks/useCustomData.d.ts +4 -4
  102. package/dist/types/hooks/useDevice.d.ts +5 -5
  103. package/dist/types/hooks/useEnvironment.d.ts +5 -5
  104. package/dist/types/hooks/useFunctions.d.ts +5 -5
  105. package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
  106. package/dist/types/hooks/useLanguage.d.ts +5 -5
  107. package/dist/types/hooks/usePages.d.ts +18 -18
  108. package/dist/types/hooks/useParameters.d.ts +5 -5
  109. package/dist/types/hooks/useSite.d.ts +5 -5
  110. package/dist/types/hooks/useUser.d.ts +5 -5
  111. package/dist/types/hooks/useValues.d.ts +5 -5
  112. package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
  113. package/dist/types/host/ChaynsHost.d.ts +29 -30
  114. package/dist/types/host/iframe/HostIframe.d.ts +25 -26
  115. package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
  116. package/dist/types/host/module/ModuleHost.d.ts +25 -25
  117. package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
  118. package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
  119. package/dist/types/index.d.ts +16 -16
  120. package/dist/types/types/IChaynsReact.d.ts +623 -700
  121. package/dist/types/types/dialog.d.ts +41 -41
  122. package/dist/types/util/appCall.d.ts +2 -2
  123. package/dist/types/util/deviceHelper.d.ts +7 -7
  124. package/dist/types/util/heightHelper.d.ts +1 -1
  125. package/dist/types/util/postIframeForm.d.ts +1 -1
  126. package/dist/types/util/url.d.ts +1 -1
  127. package/dist/types/wrapper/AppWrapper.d.ts +18 -27
  128. package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
  129. package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
  130. package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
  131. package/package.json +75 -75
  132. package/tsconfig.json +56 -56
  133. package/dist/cjs/components/AppDialogWrapper.js +0 -40
  134. package/dist/cjs/hooks/useDialogState.js +0 -31
  135. package/dist/esm/components/AppDialogWrapper.js +0 -31
  136. package/dist/esm/hooks/useDialogState.js +0 -24
  137. package/dist/types/components/AppDialogWrapper.d.ts +0 -5
  138. package/dist/types/hooks/useDialogState.d.ts +0 -9
@@ -1,6 +1,6 @@
1
1
  import { useContextSelector } from 'use-context-selector';
2
2
  import { ChaynsContext } from '../components/ChaynsContext';
3
- /**
4
- * @category Hooks
3
+ /**
4
+ * @category Hooks
5
5
  */
6
6
  export const useLanguage = () => useContextSelector(ChaynsContext, v => v === null || v === void 0 ? void 0 : v.language);
@@ -1,8 +1,8 @@
1
1
  import { useContextSelector } from 'use-context-selector';
2
2
  import { ChaynsContext } from '../components/ChaynsContext';
3
3
  import { moduleWrapper } from "../components/ChaynsProvider";
4
- /**
5
- * @category Hooks
4
+ /**
5
+ * @category Hooks
6
6
  */
7
7
  export const usePages = function () {
8
8
  let {
@@ -16,8 +16,8 @@ export const usePages = function () {
16
16
  }
17
17
  return pages;
18
18
  };
19
- /**
20
- * @category Hooks
19
+ /**
20
+ * @category Hooks
21
21
  */
22
22
  export const usePage = _ref => {
23
23
  let {
@@ -1,6 +1,6 @@
1
1
  import { useContextSelector } from 'use-context-selector';
2
2
  import { ChaynsContext } from '../components/ChaynsContext';
3
- /**
4
- * @category Hooks
3
+ /**
4
+ * @category Hooks
5
5
  */
6
6
  export const useParameters = () => useContextSelector(ChaynsContext, v => (v === null || v === void 0 ? void 0 : v.parameters) || []);
@@ -1,6 +1,6 @@
1
1
  import { useContextSelector } from 'use-context-selector';
2
2
  import { ChaynsContext } from '../components/ChaynsContext';
3
- /**
4
- * @category Hooks
3
+ /**
4
+ * @category Hooks
5
5
  */
6
6
  export const useSite = () => useContextSelector(ChaynsContext, v => v === null || v === void 0 ? void 0 : v.site);
@@ -1,6 +1,6 @@
1
1
  import { useContextSelector } from 'use-context-selector';
2
2
  import { ChaynsContext } from '../components/ChaynsContext';
3
- /**
4
- * @category Hooks
3
+ /**
4
+ * @category Hooks
5
5
  */
6
6
  export const useUser = () => useContextSelector(ChaynsContext, v => (v === null || v === void 0 ? void 0 : v.user) || {});
@@ -1,7 +1,7 @@
1
1
  import { useContextSelector } from 'use-context-selector';
2
2
  import { ChaynsContext } from '../components/ChaynsContext';
3
- /**
4
- * @category Hooks
3
+ /**
4
+ * @category Hooks
5
5
  */
6
6
  export const useValues = () => {
7
7
  const t = useContextSelector(ChaynsContext, v => v || {});
@@ -2,8 +2,8 @@ import { useContextSelector } from 'use-context-selector';
2
2
  import { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { ChaynsFunctionsContext } from '../components/ChaynsContext';
4
4
  import { ScreenSize } from '../types/IChaynsReact';
5
- /**
6
- * @category Hooks
5
+ /**
6
+ * @category Hooks
7
7
  */
8
8
  export const useWindowMetricsListener = () => {
9
9
  const addListener = useContextSelector(ChaynsFunctionsContext, v => v.addWindowMetricsListener);
@@ -18,8 +18,8 @@ export const useWindowMetricsListener = () => {
18
18
  // eslint-disable-next-line react-hooks/exhaustive-deps
19
19
  }, []);
20
20
  };
21
- /**
22
- * @category Hooks
21
+ /**
22
+ * @category Hooks
23
23
  */
24
24
  export const useWindowMetrics = function () {
25
25
  let {
@@ -22,8 +22,7 @@ const ChaynsHost = _ref => {
22
22
  parameters,
23
23
  customData,
24
24
  environment,
25
- preventStagingReplacement,
26
- dialog
25
+ preventStagingReplacement
27
26
  } = _ref;
28
27
  switch (type) {
29
28
  case 'client-iframe':
@@ -42,8 +41,7 @@ const ChaynsHost = _ref => {
42
41
  parameters: parameters,
43
42
  environment: environment,
44
43
  customData: customData,
45
- preventStagingReplacement: preventStagingReplacement,
46
- dialog: dialog
44
+ preventStagingReplacement: preventStagingReplacement
47
45
  });
48
46
  case 'client-module':
49
47
  return /*#__PURE__*/React.createElement(ModuleHost, {
@@ -79,8 +77,7 @@ const ChaynsHost = _ref => {
79
77
  parameters: parameters,
80
78
  environment: environment,
81
79
  customData: customData,
82
- preventStagingReplacement: preventStagingReplacement,
83
- dialog: dialog
80
+ preventStagingReplacement: preventStagingReplacement
84
81
  });
85
82
  case 'server-module':
86
83
  return /*#__PURE__*/React.createElement(ModuleHost, {
@@ -22,8 +22,7 @@ const HostIframe = _ref => {
22
22
  parameters,
23
23
  environment,
24
24
  customData,
25
- preventStagingReplacement,
26
- dialog
25
+ preventStagingReplacement
27
26
  } = _ref;
28
27
  const eventTarget = useRef();
29
28
  const ref = useRef();
@@ -49,8 +48,7 @@ const HostIframe = _ref => {
49
48
  language,
50
49
  parameters,
51
50
  environment,
52
- customData,
53
- dialog
51
+ customData
54
52
  };
55
53
  // endregion
56
54
 
@@ -110,7 +108,6 @@ const HostIframe = _ref => {
110
108
  useUpdateData(eventTarget.current, 'parameters', parameters);
111
109
  useUpdateData(eventTarget.current, 'environment', environment);
112
110
  useUpdateData(eventTarget.current, 'customData', customData);
113
- useUpdateData(eventTarget.current, 'dialog', dialog);
114
111
  // endregion
115
112
 
116
113
  return /*#__PURE__*/React.createElement("iframe", _extends({
@@ -123,7 +120,7 @@ const HostIframe = _ref => {
123
120
  },
124
121
  title: " "
125
122
  }, iFrameProps, {
126
- src: postForm ? undefined : replaceStagingUrl(preventStagingReplacement, src, environment.runtimeEnvironment)
123
+ src: postForm ? undefined : replaceStagingUrl(preventStagingReplacement, src, environment.buildEnvironment)
127
124
  }));
128
125
  };
129
126
  export default HostIframe;
@@ -68,7 +68,7 @@ const ModuleHost = _ref2 => {
68
68
  }), /*#__PURE__*/React.createElement(System, {
69
69
  system: {
70
70
  scope: system.scope,
71
- url: replaceStagingUrl(preventStagingReplacement, system.url, environment.runtimeEnvironment),
71
+ url: replaceStagingUrl(preventStagingReplacement, system.url, environment.buildEnvironment),
72
72
  module: system.module
73
73
  },
74
74
  data: initialData,
@@ -1,9 +1,3 @@
1
- export let DialogButtonType;
2
- (function (DialogButtonType) {
3
- DialogButtonType[DialogButtonType["OK"] = 1] = "OK";
4
- DialogButtonType[DialogButtonType["CANCEL"] = -1] = "CANCEL";
5
- DialogButtonType[DialogButtonType["NEGATIVE"] = 0] = "NEGATIVE";
6
- })(DialogButtonType || (DialogButtonType = {}));
7
1
  export let ScreenSize;
8
2
  (function (ScreenSize) {
9
3
  ScreenSize[ScreenSize["XS"] = 0] = "XS";
@@ -241,16 +235,4 @@ var selectType;
241
235
  (function (selectType) {
242
236
  selectType[selectType["DEFAULT"] = 0] = "DEFAULT";
243
237
  selectType[selectType["ICON"] = 1] = "ICON";
244
- })(selectType || (selectType = {}));
245
- export let DialogType;
246
- (function (DialogType) {
247
- DialogType["ALERT"] = "alert";
248
- DialogType["CONFIRM"] = "confirm";
249
- DialogType["DATE"] = "date";
250
- DialogType["FILE_SELECT"] = "fileSelect";
251
- DialogType["IFRAME"] = "iframe";
252
- DialogType["MODULE"] = "module";
253
- DialogType["INPUT"] = "input";
254
- DialogType["SELECT"] = "select";
255
- DialogType["TOAST"] = "toast";
256
- })(DialogType || (DialogType = {}));
238
+ })(selectType || (selectType = {}));
@@ -29,7 +29,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
29
29
  result.accessToken = undefined; // TODO
30
30
  result.os = parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.os;
31
31
  if (typeof window !== 'undefined') {
32
- result.screenSize = getScreenSize(window.innerWidth, window.innerHeight);
32
+ result.screenSize = getScreenSize(window.innerWidth);
33
33
  } else {
34
34
  // estimate size over user agent, very inaccurate, could be improved by setting a cookie with the screensize
35
35
  const screenSizeByUA = /mobi/i.test(userAgent) ? ScreenSize.SM : ScreenSize.XL;
@@ -42,16 +42,15 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
42
42
  export const getClientDeviceInfo = () => ({
43
43
  isTouch: navigator.maxTouchPoints > 0 && window.matchMedia('(pointer: coarse)')
44
44
  });
45
- export const getScreenSize = (width, height) => {
46
- const size = Math.max(width, height);
45
+ export const getScreenSize = width => {
47
46
  let value;
48
- if (size > 1200) {
47
+ if (width > 1200) {
49
48
  value = ScreenSize.XL;
50
- } else if (size > 993) {
49
+ } else if (width > 993) {
51
50
  value = ScreenSize.LG;
52
- } else if (size > 769) {
51
+ } else if (width > 769) {
53
52
  value = ScreenSize.MD;
54
- } else if (size > 556) {
53
+ } else if (width > 556) {
55
54
  value = ScreenSize.SM;
56
55
  } else {
57
56
  value = ScreenSize.XS;
@@ -11,7 +11,6 @@ import getDeviceInfo, { getScreenSize } from '../util/deviceHelper';
11
11
  import getUserInfo from '../calls/getUserInfo';
12
12
  import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
13
13
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
14
- let appWrapperDialogId = 0;
15
14
  export class AppWrapper {
16
15
  mapOldApiToNew(retVal) {
17
16
  var _window, _window2, _AppInfo$TappSelected;
@@ -88,7 +87,6 @@ export class AppWrapper {
88
87
  };
89
88
  }
90
89
  constructor() {
91
- var _this = this;
92
90
  _defineProperty(this, "values", null);
93
91
  _defineProperty(this, "accessToken", '');
94
92
  _defineProperty(this, "counter", 0);
@@ -429,44 +427,12 @@ export class AppWrapper {
429
427
  void this.appCall(19, value, {
430
428
  awaitResult: false
431
429
  });
432
- },
433
- openDialog: async function () {
434
- return _this.openDialog(...arguments);
435
- },
436
- createDialog: config => {
437
- return {
438
- close: async value => {
439
- this.dialogs.find(x => x.dialogId === dialogId).eventTarget.dispatchEvent(new CustomEvent('close', {
440
- detail: data
441
- }));
442
- },
443
- open: async () => {
444
- return await this.openDialog(config);
445
- }
446
- };
447
- },
448
- closeDialog: (dialogId, data) => {
449
- try {
450
- this.dialogs.find(x => x.dialogId === dialogId).eventTarget.dispatchEvent(new CustomEvent('requestClose', {
451
- detail: data
452
- }));
453
- } catch (e) {
454
- console.error(e);
455
- }
456
430
  }
457
431
  });
458
- _defineProperty(this, "dialogs", []);
459
- _defineProperty(this, "dialogEventTarget", new EventTarget());
460
432
  }
461
433
  notImplemented(call) {
462
434
  console.warn(`call ${call} not implement in app`);
463
435
  }
464
- dispatchDialogChange(detail) {
465
- this.dialogs = detail;
466
- this.dialogEventTarget.dispatchEvent(new CustomEvent('change', {
467
- detail
468
- }));
469
- }
470
436
  appCall(action) {
471
437
  let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
472
438
  let {
@@ -499,23 +465,6 @@ export class AppWrapper {
499
465
  });
500
466
  });
501
467
  }
502
- async openDialog(config) {
503
- const currentDialogId = appWrapperDialogId;
504
- const res = await new Promise(resolve => {
505
- const eventTarget = new EventTarget();
506
- this.dispatchDialogChange([...(this.dialogs || []), {
507
- config,
508
- resolve,
509
- dialogId: appWrapperDialogId++,
510
- eventTarget
511
- }]);
512
- });
513
- this.dispatchDialogChange(this.dialogs.filter(x => x.dialogId !== currentDialogId));
514
- return res;
515
- }
516
- getDialogEventTarget() {
517
- return this.dialogEventTarget;
518
- }
519
468
  async init() {
520
469
  this.values = this.mapOldApiToNew(await this.appCall(18));
521
470
  return undefined;
@@ -533,13 +482,4 @@ export class AppWrapper {
533
482
  getInitialData() {
534
483
  return this.values;
535
484
  }
536
- createDialog(config) {
537
- return {
538
- close: () => {},
539
- open: async () => {
540
- const dialog = await functions.openDialog(config);
541
- return dialog;
542
- }
543
- };
544
- }
545
485
  }
@@ -227,22 +227,7 @@ export class FrameWrapper {
227
227
  scrollByY: async (value, duration) => {
228
228
  if (!this.initialized) await this.ready;
229
229
  return this.exposedFunctions.scrollByY(value, duration);
230
- },
231
- createDialog: config => {
232
- return {
233
- close: async (buttonType, data) => {
234
- await this.exposedFunctions.closeDialog(buttonType, data);
235
- },
236
- open: async () => {
237
- return await this.exposedFunctions.openDialog(config);
238
- }
239
- };
240
- },
241
- closeDialog: async (buttonType, value) => {
242
- if (!this.initialized) await this.ready;
243
- return this.exposedFunctions.closeDialog(buttonType, value);
244
- },
245
- openDialog: async value => {}
230
+ }
246
231
  });
247
232
  _defineProperty(this, "initialized", false);
248
233
  const initialDataTag = document.querySelector('#__CHAYNS_DATA__');
@@ -20,17 +20,6 @@ export class ModuleFederationWrapper {
20
20
  return fn(...arguments);
21
21
  };
22
22
  });
23
- this.functions.createDialog = config => {
24
- return {
25
- close: (buttonType, data) => {
26
- return functions.closeDialog(buttonType, data);
27
- },
28
- open: async () => {
29
- const dialog = await functions.openDialog(config);
30
- return dialog;
31
- }
32
- };
33
- };
34
23
  this.functions.addWindowMetricsListener = async callback => {
35
24
  const {
36
25
  id,
@@ -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 { 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
+ 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,96 +1,96 @@
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
+ 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 {};