chayns-api 1.1.0-9 → 1.1.3

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 (168) 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/calls/dialogs/date.js +34 -34
  8. package/dist/cjs/calls/index.js +116 -108
  9. package/dist/cjs/calls/sendMessage.js +8 -8
  10. package/dist/cjs/calls/visibilityChangeListener.js +4 -4
  11. package/dist/cjs/components/AppDialogWrapper.js +2 -2
  12. package/dist/cjs/components/ChaynsProvider.js +3 -6
  13. package/dist/cjs/components/ErrorBoundary.js +1 -1
  14. package/dist/cjs/components/withCompatMode.js +2 -2
  15. package/dist/cjs/constants/languages.js +19 -0
  16. package/dist/cjs/handler/DialogHandler.js +1 -2
  17. package/dist/cjs/hooks/geoLocationListener.js +4 -4
  18. package/dist/cjs/hooks/scrollListener.js +8 -8
  19. package/dist/cjs/hooks/useAccessToken.js +3 -3
  20. package/dist/cjs/hooks/useCurrentPage.js +2 -2
  21. package/dist/cjs/hooks/useCustomData.js +2 -2
  22. package/dist/cjs/hooks/useDevice.js +2 -2
  23. package/dist/cjs/hooks/useDialogState.js +4 -4
  24. package/dist/cjs/hooks/useEnvironment.js +2 -2
  25. package/dist/cjs/hooks/useFunctions.js +2 -2
  26. package/dist/cjs/hooks/useIsAdminMode.js +2 -2
  27. package/dist/cjs/hooks/useLanguage.js +2 -2
  28. package/dist/cjs/hooks/usePages.js +4 -4
  29. package/dist/cjs/hooks/useParameters.js +2 -2
  30. package/dist/cjs/hooks/useSite.js +2 -2
  31. package/dist/cjs/hooks/useUser.js +2 -2
  32. package/dist/cjs/hooks/useValues.js +2 -2
  33. package/dist/cjs/hooks/windowMetricsListener.js +4 -4
  34. package/dist/cjs/host/ChaynsHost.js +1 -1
  35. package/dist/cjs/host/iframe/HostIframe.js +2 -2
  36. package/dist/cjs/host/module/ModuleHost.js +20 -23
  37. package/dist/cjs/host/module/utils/loadComponent.js +54 -57
  38. package/dist/cjs/host/module/utils/useDynamicScript.js +5 -7
  39. package/dist/cjs/index.js +5 -21
  40. package/dist/cjs/types/IChaynsReact.js +5 -4
  41. package/dist/cjs/util/deviceHelper.js +9 -2
  42. package/dist/cjs/util/heightHelper.js +1 -1
  43. package/dist/cjs/util/is.js +30 -0
  44. package/dist/cjs/util/transferNestedFunctions.js +5 -2
  45. package/dist/cjs/wrapper/AppWrapper.js +86 -43
  46. package/dist/cjs/wrapper/FrameWrapper.js +6 -2
  47. package/dist/cjs/wrapper/ModuleFederationWrapper.js +1 -1
  48. package/dist/cjs/wrapper/StaticChaynsApi.js +7 -0
  49. package/dist/esm/calls/dialogs/date.js +34 -34
  50. package/dist/esm/calls/index.js +114 -109
  51. package/dist/esm/calls/sendMessage.js +8 -8
  52. package/dist/esm/calls/visibilityChangeListener.js +4 -4
  53. package/dist/esm/components/AppDialogWrapper.js +1 -1
  54. package/dist/esm/components/ChaynsProvider.js +2 -5
  55. package/dist/esm/components/withCompatMode.js +1 -1
  56. package/dist/esm/constants/languages.js +13 -0
  57. package/dist/esm/handler/DialogHandler.js +2 -3
  58. package/dist/esm/hooks/geoLocationListener.js +4 -4
  59. package/dist/esm/hooks/scrollListener.js +8 -8
  60. package/dist/esm/hooks/useAccessToken.js +3 -3
  61. package/dist/esm/hooks/useCurrentPage.js +2 -2
  62. package/dist/esm/hooks/useCustomData.js +2 -2
  63. package/dist/esm/hooks/useDevice.js +2 -2
  64. package/dist/esm/hooks/useDialogState.js +4 -4
  65. package/dist/esm/hooks/useEnvironment.js +2 -2
  66. package/dist/esm/hooks/useFunctions.js +2 -2
  67. package/dist/esm/hooks/useIsAdminMode.js +2 -2
  68. package/dist/esm/hooks/useLanguage.js +2 -2
  69. package/dist/esm/hooks/usePages.js +4 -4
  70. package/dist/esm/hooks/useParameters.js +2 -2
  71. package/dist/esm/hooks/useSite.js +2 -2
  72. package/dist/esm/hooks/useUser.js +2 -2
  73. package/dist/esm/hooks/useValues.js +2 -2
  74. package/dist/esm/hooks/windowMetricsListener.js +4 -4
  75. package/dist/esm/host/iframe/HostIframe.js +1 -1
  76. package/dist/esm/host/module/ModuleHost.js +19 -22
  77. package/dist/esm/host/module/utils/loadComponent.js +53 -56
  78. package/dist/esm/index.js +1 -3
  79. package/dist/esm/types/IChaynsReact.js +5 -4
  80. package/dist/esm/util/deviceHelper.js +9 -2
  81. package/dist/esm/util/is.js +23 -0
  82. package/dist/esm/util/transferNestedFunctions.js +5 -2
  83. package/dist/esm/wrapper/AppWrapper.js +90 -45
  84. package/dist/esm/wrapper/FrameWrapper.js +6 -2
  85. package/dist/esm/wrapper/StaticChaynsApi.js +8 -1
  86. package/dist/types/calls/dialogs/alert.d.ts +1 -1
  87. package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
  88. package/dist/types/calls/dialogs/close.d.ts +1 -1
  89. package/dist/types/calls/dialogs/communication.d.ts +3 -3
  90. package/dist/types/calls/dialogs/confirm.d.ts +13 -13
  91. package/dist/types/calls/dialogs/date.d.ts +96 -96
  92. package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
  93. package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
  94. package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
  95. package/dist/types/calls/dialogs/index.d.ts +14 -14
  96. package/dist/types/calls/dialogs/input.d.ts +15 -15
  97. package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
  98. package/dist/types/calls/dialogs/open.d.ts +1 -1
  99. package/dist/types/calls/dialogs/select.d.ts +6 -6
  100. package/dist/types/calls/dialogs/signature.d.ts +7 -7
  101. package/dist/types/calls/dialogs/toast.d.ts +1 -1
  102. package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
  103. package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
  104. package/dist/types/calls/getUserInfo.d.ts +9 -9
  105. package/dist/types/calls/index.d.ts +255 -251
  106. package/dist/types/calls/sendMessage.d.ts +13 -13
  107. package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
  108. package/dist/types/components/AppDialogWrapper.d.ts +5 -5
  109. package/dist/types/components/ChaynsContext.d.ts +3 -3
  110. package/dist/types/components/ChaynsProvider.d.ts +11 -11
  111. package/dist/types/components/ErrorBoundary.d.ts +13 -13
  112. package/dist/types/components/WaitUntil.d.ts +7 -7
  113. package/dist/types/components/moduleWrapper.d.ts +4 -4
  114. package/dist/types/components/withCompatMode.d.ts +13 -13
  115. package/dist/types/constants/languages.d.ts +12 -0
  116. package/dist/types/handler/DialogHandler.d.ts +24 -18
  117. package/dist/types/helper/apiListenerHelper.d.ts +6 -6
  118. package/dist/types/hooks/geoLocationListener.d.ts +18 -18
  119. package/dist/types/hooks/index.d.ts +17 -17
  120. package/dist/types/hooks/scrollListener.d.ts +28 -28
  121. package/dist/types/hooks/useAccessToken.d.ts +6 -6
  122. package/dist/types/hooks/useCurrentPage.d.ts +4 -4
  123. package/dist/types/hooks/useCustomData.d.ts +4 -4
  124. package/dist/types/hooks/useDevice.d.ts +5 -5
  125. package/dist/types/hooks/useDialogState.d.ts +9 -9
  126. package/dist/types/hooks/useEnvironment.d.ts +5 -5
  127. package/dist/types/hooks/useFunctions.d.ts +5 -5
  128. package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
  129. package/dist/types/hooks/useLanguage.d.ts +5 -5
  130. package/dist/types/hooks/usePages.d.ts +18 -18
  131. package/dist/types/hooks/useParameters.d.ts +5 -5
  132. package/dist/types/hooks/useSite.d.ts +5 -5
  133. package/dist/types/hooks/useUser.d.ts +5 -5
  134. package/dist/types/hooks/useValues.d.ts +5 -5
  135. package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
  136. package/dist/types/host/ChaynsHost.d.ts +30 -30
  137. package/dist/types/host/iframe/HostIframe.d.ts +26 -26
  138. package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
  139. package/dist/types/host/module/ModuleHost.d.ts +27 -27
  140. package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
  141. package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
  142. package/dist/types/index.d.ts +20 -22
  143. package/dist/types/types/IChaynsReact.d.ts +859 -816
  144. package/dist/types/types/dialog.d.ts +41 -41
  145. package/dist/types/util/appCall.d.ts +2 -2
  146. package/dist/types/util/deviceHelper.d.ts +7 -7
  147. package/dist/types/util/heightHelper.d.ts +1 -1
  148. package/dist/types/util/is.d.ts +5 -0
  149. package/dist/types/util/postIframeForm.d.ts +1 -1
  150. package/dist/types/util/transferNestedFunctions.d.ts +1 -1
  151. package/dist/types/util/url.d.ts +1 -1
  152. package/dist/types/wrapper/AppWrapper.d.ts +19 -22
  153. package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
  154. package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
  155. package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
  156. package/dist/types/wrapper/StaticChaynsApi.d.ts +16 -9
  157. package/package.json +78 -86
  158. package/toolkit.config.js +20 -20
  159. package/tsconfig.json +56 -56
  160. package/dist/cjs/components/withHydrationBoundary.js +0 -58
  161. package/dist/cjs/constants/hydrationContext.js +0 -16
  162. package/dist/cjs/constants/index.js +0 -16
  163. package/dist/esm/components/withHydrationBoundary.js +0 -51
  164. package/dist/esm/constants/hydrationContext.js +0 -10
  165. package/dist/esm/constants/index.js +0 -1
  166. package/dist/types/components/withHydrationBoundary.d.ts +0 -17
  167. package/dist/types/constants/hydrationContext.d.ts +0 -9
  168. package/dist/types/constants/index.d.ts +0 -1
@@ -1,4 +1,4 @@
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; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  /* eslint-disable */
@@ -12,19 +12,23 @@ import getDeviceInfo, { getScreenSize } from '../util/deviceHelper';
12
12
  import getUserInfo from '../calls/getUserInfo';
13
13
  import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
14
14
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
15
+ import { DeviceLanguage } from '../constants/languages';
16
+ import { isAppCallSupported } from '../util/is';
15
17
  let appWrapperDialogId = 0;
16
18
  export class AppWrapper {
17
19
  mapOldApiToNew(retVal) {
18
20
  var _window, _colorMode, _window2, _AppInfo$TappSelected;
19
21
  const {
20
22
  AppInfo,
21
- AppUser
23
+ AppUser,
24
+ Device
22
25
  } = retVal;
23
26
  this.accessToken = AppUser.TobitAccessToken;
24
27
  const urlParams = new URLSearchParams(location.search);
25
28
  const urlParamsLowerCase = new URLSearchParams(location.search.toLowerCase());
26
29
  let tappId = urlParamsLowerCase.get('tappid');
27
30
  let colorMode = urlParamsLowerCase.get('colormode');
31
+ let color = AppInfo.color;
28
32
  if (colorMode) {
29
33
  try {
30
34
  colorMode = Number.parseInt(colorMode, 10);
@@ -37,6 +41,24 @@ export class AppWrapper {
37
41
  // ignore
38
42
  }
39
43
  }
44
+ if (!color && urlParamsLowerCase.has('color')) {
45
+ color = urlParamsLowerCase.get('color');
46
+ if (!color.startsWith('#')) {
47
+ color = `#${color}`;
48
+ }
49
+ }
50
+ let userId = AppUser.TobitUserID;
51
+ if (typeof userId === 'string') {
52
+ try {
53
+ userId = Number.parseInt(userId, 10);
54
+ } catch {
55
+ // ignore
56
+ }
57
+ }
58
+ let language = AppInfo.Language;
59
+ if (!language) {
60
+ language = DeviceLanguage[Number.parseInt(Device === null || Device === void 0 ? void 0 : Device.LanguageID, 10)] || 'de';
61
+ }
40
62
  return {
41
63
  device: getDeviceInfo(navigator.userAgent, 'image/webp'),
42
64
  environment: {
@@ -44,12 +66,11 @@ export class AppWrapper {
44
66
  runtimeEnvironment: RuntimeEnviroment.Unknown
45
67
  },
46
68
  language: {
47
- site: AppInfo.Language,
69
+ site: language,
48
70
  translation: null,
49
- device: AppInfo.Language,
50
- active: AppInfo.Language
71
+ device: language,
72
+ active: language
51
73
  },
52
- // ToDo: Find better way to detect
53
74
  site: {
54
75
  id: AppInfo.SiteID,
55
76
  locationId: AppInfo.LocationID,
@@ -65,7 +86,7 @@ export class AppWrapper {
65
86
  },
66
87
  title: AppInfo.Title,
67
88
  colorMode: (_colorMode = colorMode) !== null && _colorMode !== void 0 ? _colorMode : AppInfo.colorMode,
68
- color: AppInfo.color,
89
+ color,
69
90
  domain: AppInfo.domain,
70
91
  font: {
71
92
  id: Font.Roboto,
@@ -81,7 +102,7 @@ export class AppWrapper {
81
102
  firstName: AppUser.FirstName,
82
103
  lastName: AppUser.LastName,
83
104
  gender: Gender.Unknown,
84
- userId: AppUser.TobitUserID,
105
+ userId: userId,
85
106
  personId: AppUser.PersonID,
86
107
  uacGroups: []
87
108
  },
@@ -105,6 +126,7 @@ export class AppWrapper {
105
126
  };
106
127
  }
107
128
  constructor() {
129
+ var _this = this;
108
130
  _defineProperty(this, "values", null);
109
131
  _defineProperty(this, "accessToken", '');
110
132
  _defineProperty(this, "counter", 0);
@@ -269,7 +291,7 @@ export class AppWrapper {
269
291
  invokeAppCall(callObj);
270
292
  },
271
293
  login: async (value, callback, closeCallback) => {
272
- const res = await this.appCall({}, callback);
294
+ const res = await this.appCall(54, value);
273
295
  return {
274
296
  loginState: res === null || res === void 0 ? void 0 : res.loginState
275
297
  };
@@ -321,7 +343,8 @@ export class AppWrapper {
321
343
  shouldRemove
322
344
  } = removeApiListener('geoLocationListener', id);
323
345
  if (shouldRemove) {
324
- // App does not support removal of request geo location call with permanent true which makes this a no-op
346
+ // App does not support removal of request geo location call with permanent true which makes this a
347
+ // no-op
325
348
  }
326
349
  },
327
350
  removeScrollListener: async id => {
@@ -476,44 +499,48 @@ export class AppWrapper {
476
499
  });
477
500
  },
478
501
  createDialog: config => {
479
- return new DialogHandler(config, this.functions.openDialog, this.functions.closeDialog);
502
+ return new DialogHandler(config, this.functions.openDialog, this.functions.closeDialog, this.functions.dispatchEventToDialogClient, this.functions.addDialogClientEventListener);
480
503
  },
481
504
  openDialog: async (config, callback) => {
482
505
  const currentDialogId = appWrapperDialogId++;
483
- const eventTarget = new EventTarget();
484
- const resolve = result => {
506
+ const isSupported = isAppCallSupported({
507
+ minAndroidVersion: 7137,
508
+ minIOSVersion: 6934
509
+ });
510
+ this.appCall(184, {
511
+ dialogContent: {
512
+ apiVersion: 5,
513
+ config
514
+ },
515
+ externalDialogUrl: isSupported ? undefined : 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
516
+ }, {
517
+ awaitResult: true
518
+ }).then(result => {
485
519
  callback(result);
486
- this.dispatchDialogChange(this.dialogs.filter(x => x.dialogId !== currentDialogId));
487
- };
488
- this.dispatchDialogChange([...this.dialogs, {
489
- config,
490
- resolve,
491
- dialogId: currentDialogId,
492
- eventTarget
493
- }]);
520
+ });
494
521
  return currentDialogId;
495
522
  },
496
- closeDialog: dialogId => {
497
- const dialog = this.dialogs.find(x => x.dialogId === dialogId);
523
+ closeDialog: function (dialogId, result) {
524
+ let buttonType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
525
+ const dialog = _this.dialogs.find(x => x.dialogId === dialogId);
498
526
  if (dialog) {
499
527
  dialog.resolve({
500
- buttonType: -1
528
+ buttonType,
529
+ result
501
530
  });
502
531
  }
532
+ },
533
+ dispatchEventToDialogClient: () => this.notImplemented('dispatchEventToDialogClient'),
534
+ addDialogClientEventListener: () => this.notImplemented('addDialogClientEventListener'),
535
+ addAnonymousAccount: async () => {
536
+ return this.appCall(302);
503
537
  }
504
538
  });
505
539
  _defineProperty(this, "dialogs", []);
506
- _defineProperty(this, "dialogEventTarget", new EventTarget());
507
540
  }
508
541
  notImplemented(call) {
509
542
  console.warn(`call ${call} not implement in app`);
510
543
  }
511
- dispatchDialogChange(detail) {
512
- this.dialogs = detail;
513
- this.dialogEventTarget.dispatchEvent(new CustomEvent('change', {
514
- detail
515
- }));
516
- }
517
544
  appCall(action) {
518
545
  let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
519
546
  let {
@@ -546,24 +573,42 @@ export class AppWrapper {
546
573
  });
547
574
  });
548
575
  }
549
- getDialogEventTarget() {
550
- return this.dialogEventTarget;
551
- }
552
576
  async init() {
553
577
  this.values = this.mapOldApiToNew(await this.appCall(18));
554
- const callbackName = `chaynsApiV5Callback_${this.counter++}`;
555
- window.disablev4AccessTokenChangeListener = true;
556
- window[callbackName] = _ref2 => {
557
- let {
558
- retVal: value
559
- } = _ref2;
560
- this.mapOldApiToNew(value);
561
- };
562
578
  this.appCall(66, {
563
- enabled: true,
564
- callback: callbackName
579
+ enabled: true
565
580
  }, {
566
- awaitResult: false
581
+ callback: async () => {
582
+ this.values = this.mapOldApiToNew(await this.appCall(18));
583
+ document.dispatchEvent(new CustomEvent('chayns_api_data', {
584
+ detail: {
585
+ type: 'user',
586
+ value: this.values.user
587
+ }
588
+ }));
589
+ },
590
+ awaitResult: true
591
+ });
592
+ window.disablev4DesignSettingsChangeListener = true;
593
+ this.appCall(254, {
594
+ enabled: true
595
+ }, {
596
+ callback: _ref2 => {
597
+ let {
598
+ colorMode
599
+ } = _ref2;
600
+ this.values.site = {
601
+ ...this.values.site,
602
+ colorMode
603
+ };
604
+ document.dispatchEvent(new CustomEvent('chayns_api_data', {
605
+ detail: {
606
+ type: 'site',
607
+ value: this.values.site
608
+ }
609
+ }));
610
+ },
611
+ awaitResult: true
567
612
  });
568
613
  return undefined;
569
614
  }
@@ -1,4 +1,4 @@
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; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
@@ -290,7 +290,11 @@ export class FrameWrapper {
290
290
  // this.exposedFunctions.removeDialogHostEventListener(0);
291
291
  }
292
292
  },
293
- removeDialogClientEventListener: async () => {}
293
+ removeDialogClientEventListener: async () => {},
294
+ addAnonymousAccount: async () => {
295
+ if (!this.initialized) await this.ready;
296
+ return this.exposedFunctions.addAnonymousAccount();
297
+ }
294
298
  });
295
299
  _defineProperty(this, "initialized", false);
296
300
  const initialDataTag = document.querySelector('#__CHAYNS_DATA__');
@@ -1,11 +1,18 @@
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; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import { moduleWrapper } from '../components/moduleWrapper';
5
5
  import { FrameWrapper } from './FrameWrapper';
6
6
  class StaticChaynsApi {
7
7
  constructor() {
8
+ _defineProperty(this, "getUser", () => this._wrapper.values.user);
8
9
  _defineProperty(this, "getSite", () => this._wrapper.values.site);
10
+ _defineProperty(this, "getCurrentPage", () => this._wrapper.values.currentPage);
11
+ _defineProperty(this, "getDevice", () => this._wrapper.values.device);
12
+ _defineProperty(this, "getLanguage", () => this._wrapper.values.language);
13
+ _defineProperty(this, "getParameters", () => this._wrapper.values.parameters);
14
+ _defineProperty(this, "getPages", () => this._wrapper.values.pages);
15
+ _defineProperty(this, "getEnvironment", () => this._wrapper.values.environment);
9
16
  const wrapper = new FrameWrapper();
10
17
  moduleWrapper.current = wrapper;
11
18
  this._wrapper = wrapper;
@@ -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 { 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 { 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 { 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 { 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
+ 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 { 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
+ 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 {};