chayns-api 1.1.0-2 → 1.1.0-21

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 (92) hide show
  1. package/dist/chayns-api.js +2 -0
  2. package/dist/chayns-api.js.LICENSE.txt +41 -0
  3. package/dist/cjs/calls/dialogs/chaynsDialog.js +3 -6
  4. package/dist/cjs/calls/dialogs/date.js +29 -2
  5. package/dist/cjs/calls/dialogs/fileSelect.js +1 -2
  6. package/dist/cjs/calls/dialogs/input.js +2 -3
  7. package/dist/cjs/calls/dialogs/select.js +2 -3
  8. package/dist/cjs/calls/getUserInfo.js +1 -2
  9. package/dist/cjs/calls/index.js +93 -82
  10. package/dist/cjs/calls/toolbarChangeListener.js +1 -0
  11. package/dist/cjs/components/AppDialogWrapper.js +7 -7
  12. package/dist/cjs/components/ChaynsContext.js +2 -4
  13. package/dist/cjs/components/ChaynsProvider.js +10 -13
  14. package/dist/cjs/components/ErrorBoundary.js +31 -0
  15. package/dist/cjs/components/moduleWrapper.js +9 -0
  16. package/dist/cjs/components/withCompatMode.js +8 -7
  17. package/dist/cjs/components/withHydrationBoundary.js +54 -0
  18. package/dist/cjs/constants/hydrationContext.js +16 -0
  19. package/dist/cjs/constants/index.js +16 -0
  20. package/dist/cjs/constants/languages.js +19 -0
  21. package/dist/cjs/handler/DialogHandler.js +4 -2
  22. package/dist/cjs/hooks/useAccessToken.js +1 -0
  23. package/dist/cjs/hooks/useDialogState.js +2 -2
  24. package/dist/cjs/hooks/usePages.js +2 -2
  25. package/dist/cjs/host/ChaynsHost.js +21 -41
  26. package/dist/cjs/host/iframe/HostIframe.js +4 -6
  27. package/dist/cjs/host/iframe/utils/useUpdateData.js +1 -2
  28. package/dist/cjs/host/module/ModuleHost.js +9 -24
  29. package/dist/cjs/host/module/Test3.js +141 -0
  30. package/dist/cjs/host/module/utils/loadComponent.js +94 -49
  31. package/dist/cjs/index.js +63 -5
  32. package/dist/cjs/types/IChaynsReact.js +140 -107
  33. package/dist/cjs/util/appCall.js +3 -4
  34. package/dist/cjs/util/deviceHelper.js +18 -13
  35. package/dist/cjs/util/transferNestedFunctions.js +39 -0
  36. package/dist/cjs/util/url.js +1 -1
  37. package/dist/cjs/wrapper/AppWrapper.js +79 -16
  38. package/dist/cjs/wrapper/FrameWrapper.js +16 -5
  39. package/dist/cjs/wrapper/StaticChaynsApi.js +22 -0
  40. package/dist/esm/calls/index.js +22 -1
  41. package/dist/esm/calls/toolbarChangeListener.js +0 -0
  42. package/dist/esm/components/AppDialogWrapper.js +4 -3
  43. package/dist/esm/components/ChaynsProvider.js +6 -7
  44. package/dist/esm/components/ErrorBoundary.js +23 -0
  45. package/dist/esm/components/moduleWrapper.js +3 -0
  46. package/dist/esm/components/withCompatMode.js +5 -4
  47. package/dist/esm/components/withHydrationBoundary.js +47 -0
  48. package/dist/esm/constants/hydrationContext.js +10 -0
  49. package/dist/esm/constants/index.js +1 -0
  50. package/dist/esm/constants/languages.js +13 -0
  51. package/dist/esm/handler/DialogHandler.js +6 -4
  52. package/dist/esm/hooks/useAccessToken.js +1 -0
  53. package/dist/esm/hooks/useDialogState.js +2 -2
  54. package/dist/esm/hooks/usePages.js +1 -1
  55. package/dist/esm/host/ChaynsHost.js +18 -39
  56. package/dist/esm/host/iframe/HostIframe.js +1 -2
  57. package/dist/esm/host/module/ModuleHost.js +6 -20
  58. package/dist/esm/host/module/Test3.js +135 -0
  59. package/dist/esm/host/module/utils/loadComponent.js +95 -49
  60. package/dist/esm/index.js +7 -1
  61. package/dist/esm/types/IChaynsReact.js +142 -87
  62. package/dist/esm/util/appCall.js +2 -2
  63. package/dist/esm/util/deviceHelper.js +17 -11
  64. package/dist/esm/util/transferNestedFunctions.js +35 -0
  65. package/dist/esm/util/url.js +2 -2
  66. package/dist/esm/wrapper/AppWrapper.js +80 -16
  67. package/dist/esm/wrapper/FrameWrapper.js +16 -5
  68. package/dist/esm/wrapper/StaticChaynsApi.js +20 -0
  69. package/dist/types/calls/index.d.ts +19 -5
  70. package/dist/types/calls/toolbarChangeListener.d.ts +0 -0
  71. package/dist/types/components/AppDialogWrapper.d.ts +2 -2
  72. package/dist/types/components/ChaynsProvider.d.ts +1 -4
  73. package/dist/types/components/ErrorBoundary.d.ts +13 -0
  74. package/dist/types/components/moduleWrapper.d.ts +4 -0
  75. package/dist/types/components/withHydrationBoundary.d.ts +17 -0
  76. package/dist/types/constants/hydrationContext.d.ts +9 -0
  77. package/dist/types/constants/index.d.ts +1 -0
  78. package/dist/types/constants/languages.d.ts +12 -0
  79. package/dist/types/handler/DialogHandler.d.ts +0 -1
  80. package/dist/types/hooks/useAccessToken.d.ts +1 -0
  81. package/dist/types/hooks/useCurrentPage.d.ts +4 -1
  82. package/dist/types/host/ChaynsHost.d.ts +0 -1
  83. package/dist/types/host/module/ModuleHost.d.ts +2 -0
  84. package/dist/types/host/module/Test3.d.ts +8 -0
  85. package/dist/types/host/module/utils/loadComponent.d.ts +3 -1
  86. package/dist/types/index.d.ts +7 -1
  87. package/dist/types/types/IChaynsReact.d.ts +136 -28
  88. package/dist/types/util/deviceHelper.d.ts +2 -2
  89. package/dist/types/util/transferNestedFunctions.d.ts +1 -0
  90. package/dist/types/wrapper/StaticChaynsApi.d.ts +9 -0
  91. package/package.json +33 -22
  92. package/toolkit.config.js +20 -0
@@ -1,6 +1,6 @@
1
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); }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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 */
5
5
  // @ts-nocheck
6
6
 
@@ -12,15 +12,37 @@ 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";
15
16
  let appWrapperDialogId = 0;
16
17
  export class AppWrapper {
17
18
  mapOldApiToNew(retVal) {
18
- var _window, _window2, _AppInfo$TappSelected;
19
+ var _window, _colorMode, _window2, _AppInfo$TappSelected;
19
20
  const {
20
21
  AppInfo,
21
- AppUser
22
+ AppUser,
23
+ Device
22
24
  } = retVal;
23
25
  this.accessToken = AppUser.TobitAccessToken;
26
+ const urlParams = new URLSearchParams(location.search);
27
+ const urlParamsLowerCase = new URLSearchParams(location.search.toLowerCase());
28
+ let tappId = urlParamsLowerCase.get('tappid');
29
+ let colorMode = urlParamsLowerCase.get('colormode');
30
+ if (colorMode) {
31
+ try {
32
+ colorMode = Number.parseInt(colorMode, 10);
33
+ } catch {}
34
+ }
35
+ if (tappId) {
36
+ try {
37
+ tappId = Number.parseInt(tappId, 10);
38
+ } catch {
39
+ // ignore
40
+ }
41
+ }
42
+ let language = AppInfo.Language;
43
+ if (!language) {
44
+ language = DeviceLanguage[Number.parseInt(Device === null || Device === void 0 ? void 0 : Device.LanguageID, 10)] || 'de';
45
+ }
24
46
  return {
25
47
  device: getDeviceInfo(navigator.userAgent, 'image/webp'),
26
48
  environment: {
@@ -28,12 +50,11 @@ export class AppWrapper {
28
50
  runtimeEnvironment: RuntimeEnviroment.Unknown
29
51
  },
30
52
  language: {
31
- site: AppInfo.Language,
53
+ site: language,
32
54
  translation: null,
33
- device: AppInfo.Language,
34
- active: AppInfo.Language
55
+ device: language,
56
+ active: language
35
57
  },
36
- // ToDo: Find better way to detect
37
58
  site: {
38
59
  id: AppInfo.SiteID,
39
60
  locationId: AppInfo.LocationID,
@@ -48,7 +69,7 @@ export class AppWrapper {
48
69
  docked: false
49
70
  },
50
71
  title: AppInfo.Title,
51
- colorMode: AppInfo.colorMode,
72
+ colorMode: (_colorMode = colorMode) !== null && _colorMode !== void 0 ? _colorMode : AppInfo.colorMode,
52
73
  color: AppInfo.color,
53
74
  domain: AppInfo.domain,
54
75
  font: {
@@ -60,7 +81,7 @@ export class AppWrapper {
60
81
  locationPersonId: AppInfo.LocationPersonId,
61
82
  urlHash: (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.location.hash.replace('#', '')
62
83
  },
63
- parameters: Object.fromEntries(new URLSearchParams(location.search)),
84
+ parameters: Object.fromEntries(urlParams),
64
85
  user: {
65
86
  firstName: AppUser.FirstName,
66
87
  lastName: AppUser.LastName,
@@ -72,7 +93,7 @@ export class AppWrapper {
72
93
  customData: null,
73
94
  isAdminModeActive: AppUser.AdminMode,
74
95
  currentPage: {
75
- id: (_AppInfo$TappSelected = AppInfo.TappSelected) === null || _AppInfo$TappSelected === void 0 ? void 0 : _AppInfo$TappSelected.TappID,
96
+ id: ((_AppInfo$TappSelected = AppInfo.TappSelected) === null || _AppInfo$TappSelected === void 0 ? void 0 : _AppInfo$TappSelected.TappID) || tappId,
76
97
  siteId: AppInfo.SiteID
77
98
  },
78
99
  pages: AppInfo.Tapps.map(x => ({
@@ -106,12 +127,13 @@ export class AppWrapper {
106
127
  permanent: true
107
128
  }, {
108
129
  callback: v => {
109
- var _v$accuracy, _v$code;
130
+ var _v$accuracy, _v$isAccurate, _v$code;
110
131
  dispatchApiEvent('geoLocationListener', {
111
132
  latitude: v.latitude,
112
133
  longitude: v.longitude,
113
134
  accuracy: (_v$accuracy = v.accuracy) !== null && _v$accuracy !== void 0 ? _v$accuracy : null,
114
135
  speed: v.speed,
136
+ isAccurate: (_v$isAccurate = v.isAccurate) !== null && _v$isAccurate !== void 0 ? _v$isAccurate : null,
115
137
  code: (_v$code = v.code) !== null && _v$code !== void 0 ? _v$code : null
116
138
  });
117
139
  }
@@ -157,6 +179,23 @@ export class AppWrapper {
157
179
  }
158
180
  return id;
159
181
  },
182
+ addToolbarChangeListener: async callback => {
183
+ const {
184
+ id,
185
+ shouldInitialize
186
+ } = addApiListener('toolbarChangeListener', callback);
187
+ if (shouldInitialize) {
188
+ this.appCall(293, {}, {
189
+ callback: v => {
190
+ dispatchApiEvent('toolbarChangeListener', {
191
+ isVisible: v.isVisible,
192
+ toolbarHeight: v.toolbarHeight
193
+ });
194
+ }
195
+ });
196
+ }
197
+ return id;
198
+ },
160
199
  addWindowMetricsListener: async callback => {
161
200
  const {
162
201
  id,
@@ -182,13 +221,15 @@ export class AppWrapper {
182
221
  };
183
222
  },
184
223
  getGeoLocation: async () => {
224
+ var _res$accuracy, _res$isAccurate, _res$code;
185
225
  const res = await this.appCall(14);
186
226
  return {
187
227
  latitude: res.latitude,
188
228
  longitude: res.longitude,
189
229
  speed: res.speed,
190
- code: res.code,
191
- isAccurate: res.isAccurate
230
+ accuracy: (_res$accuracy = res.accuracy) !== null && _res$accuracy !== void 0 ? _res$accuracy : null,
231
+ isAccurate: (_res$isAccurate = res.isAccurate) !== null && _res$isAccurate !== void 0 ? _res$isAccurate : null,
232
+ code: (_res$code = res.code) !== null && _res$code !== void 0 ? _res$code : null
192
233
  };
193
234
  },
194
235
  getUserInfo: async query => {
@@ -220,7 +261,7 @@ export class AppWrapper {
220
261
  let {
221
262
  retVal
222
263
  } = _ref;
223
- callback === null || callback === void 0 ? void 0 : callback(retVal);
264
+ callback === null || callback === void 0 || callback(retVal);
224
265
  delete window[callbackName];
225
266
  };
226
267
  const callObj = {
@@ -250,6 +291,7 @@ export class AppWrapper {
250
291
  },
251
292
  openImage: async value => {
252
293
  this.appCall(4, {
294
+ urls: value.items.map(x => x.url),
253
295
  items: value.items.map(x => ({
254
296
  url: x.url,
255
297
  title: x.title,
@@ -304,6 +346,14 @@ export class AppWrapper {
304
346
  // App does not support removal of onActivate callback which makes this a no-op
305
347
  }
306
348
  },
349
+ removeToolbarChangeListener: async id => {
350
+ const {
351
+ shouldRemove
352
+ } = removeApiListener('toolbarChangeListener', id);
353
+ if (shouldRemove) {
354
+ // App does not support removal of onToolbarBarRemove callback which makes this a no-op
355
+ }
356
+ },
307
357
  removeWindowMetricsListener: async id => {
308
358
  const shouldRemove = removeApiListener('windowMetricsListener', id);
309
359
  if (shouldRemove) {
@@ -317,7 +367,7 @@ export class AppWrapper {
317
367
  id: options.id,
318
368
  showName: options.showName,
319
369
  position: options.position,
320
- params: options.params
370
+ params: new URLSearchParams(options.params).toString() || undefined
321
371
  }, {
322
372
  awaitResult: false
323
373
  });
@@ -506,6 +556,20 @@ export class AppWrapper {
506
556
  }
507
557
  async init() {
508
558
  this.values = this.mapOldApiToNew(await this.appCall(18));
559
+ const callbackName = `chaynsApiV5Callback_${this.counter++}`;
560
+ window.disablev4AccessTokenChangeListener = true;
561
+ window[callbackName] = _ref2 => {
562
+ let {
563
+ retVal: value
564
+ } = _ref2;
565
+ this.mapOldApiToNew(value);
566
+ };
567
+ this.appCall(66, {
568
+ enabled: true,
569
+ callback: callbackName
570
+ }, {
571
+ awaitResult: false
572
+ });
509
573
  return undefined;
510
574
  }
511
575
  getSSRData() {
@@ -1,6 +1,6 @@
1
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); }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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 */
5
5
  import * as comlink from 'comlink';
6
6
  import DialogHandler from '../handler/DialogHandler';
@@ -28,6 +28,10 @@ export class FrameWrapper {
28
28
  return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
29
29
  },
30
30
  addVisibilityChangeListener: async callback => addVisibilityChangeListener(callback),
31
+ addToolbarChangeListener: async callback => {
32
+ if (!this.initialized) await this.ready;
33
+ return this.exposedFunctions.addToolbarChangeListener(callback && comlink.proxy(result => callback(result)));
34
+ },
31
35
  addWindowMetricsListener: async callback => {
32
36
  if (!this.initialized) await this.ready;
33
37
  const {
@@ -99,6 +103,10 @@ export class FrameWrapper {
99
103
  if (!this.initialized) await this.ready;
100
104
  return this.exposedFunctions.openImage(value);
101
105
  },
106
+ openMedia: async value => {
107
+ if (!this.initialized) await this.ready;
108
+ return this.exposedFunctions.openMedia(value);
109
+ },
102
110
  openUrl: async value => {
103
111
  if (!this.initialized) await this.ready;
104
112
  return this.exposedFunctions.openUrl(value);
@@ -136,6 +144,10 @@ export class FrameWrapper {
136
144
  this.resizeListener = null;
137
145
  }
138
146
  },
147
+ removeToolbarChangeListener: async id => {
148
+ if (!this.initialized) await this.ready;
149
+ return this.exposedFunctions.removeToolbarChangeListener(id);
150
+ },
139
151
  selectPage: async options => {
140
152
  if (!this.initialized) await this.ready;
141
153
  await this.exposedFunctions.selectPage(options);
@@ -240,9 +252,9 @@ export class FrameWrapper {
240
252
  if (!this.initialized) await this.ready;
241
253
  return this.exposedFunctions.openDialog(config, comlink.proxy(callback));
242
254
  },
243
- setDialogResult: async result => {
255
+ setDialogResult: async (buttonType, result) => {
244
256
  if (!this.initialized) await this.ready;
245
- return this.exposedFunctions.setDialogResult(result);
257
+ return this.exposedFunctions.setDialogResult(buttonType, result);
246
258
  },
247
259
  dispatchEventToDialogClient: async (dialogId, data) => {
248
260
  if (!this.initialized) await this.ready;
@@ -297,7 +309,6 @@ export class FrameWrapper {
297
309
  if (this.initialized) {
298
310
  this.values[type] = value;
299
311
  }
300
- this.values[type] = value;
301
312
  document.dispatchEvent(new CustomEvent('chayns_api_data', {
302
313
  detail: {
303
314
  type,
@@ -0,0 +1,20 @@
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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
+ import { moduleWrapper } from '../components/moduleWrapper';
5
+ import { FrameWrapper } from './FrameWrapper';
6
+ class StaticChaynsApi {
7
+ constructor() {
8
+ _defineProperty(this, "getSite", () => this._wrapper.values.site);
9
+ const wrapper = new FrameWrapper();
10
+ moduleWrapper.current = wrapper;
11
+ this._wrapper = wrapper;
12
+ this.ready = wrapper.init();
13
+ this.addDataListener = wrapper.addDataListener;
14
+ Object.entries(wrapper.functions).forEach(_ref => {
15
+ let [k, v] = _ref;
16
+ this[k] = v;
17
+ });
18
+ }
19
+ }
20
+ export default StaticChaynsApi;
@@ -19,6 +19,11 @@ export declare const addScrollListener: (value: {
19
19
  * @category Event listener
20
20
  */
21
21
  export declare const addVisibilityChangeListener: (callback: (result: import("../types/IChaynsReact").VisibilityChangeListenerResult) => void) => Promise<number>;
22
+ /**
23
+ * This method will be executed when the toolbar gets displayed or hidden.
24
+ * @category Event listener
25
+ */
26
+ export declare const addToolbarChangeListener: (callback: (result: import("../types/IChaynsReact").ToolbarChangeListenerResult) => void) => Promise<number>;
22
27
  /**
23
28
  * This adds a listener to get the actual height of the page.
24
29
  * @category Event listener
@@ -75,6 +80,10 @@ export declare const navigateBack: () => Promise<void>;
75
80
  * The images specified in the url array is shown in gallery mode.
76
81
  */
77
82
  export declare const openImage: (value: import("../types/IChaynsReact").OpenImage) => Promise<void>;
83
+ /**
84
+ * The images and videos specified in the items array is shown in gallery mode.
85
+ */
86
+ export declare const openMedia: (value: import("../types/IChaynsReact").OpenMedia) => Promise<void>;
78
87
  /**
79
88
  * Opens an URL in the chayns environment.
80
89
  */
@@ -96,6 +105,11 @@ export declare const refreshAccessToken: () => Promise<void>;
96
105
  * @category Event listener
97
106
  */
98
107
  export declare const removeGeoLocationListener: (value: number) => Promise<void>;
108
+ /**
109
+ * This removes a listener for changing toolbar visibility
110
+ * @category Event listener
111
+ */
112
+ export declare const removeToolbarChangeListener: (value: number) => Promise<void>;
99
113
  /**
100
114
  * Removes scroll listener.
101
115
  * @category Event listener
@@ -186,7 +200,7 @@ export declare const vibrate: (value: import("../types/IChaynsReact").Vibrate) =
186
200
  /**
187
201
  * This method creates a dialog
188
202
  */
189
- export declare const createDialog: (config: import("../types/IChaynsReact").Dialog) => import("../handler/DialogHandler").default;
203
+ export declare const createDialog: (config: import("../types/IChaynsReact").Dialog) => import("..").DialogHandler;
190
204
  /**
191
205
  * Displays an overlay
192
206
  */
@@ -209,8 +223,8 @@ export declare const getLanguage: () => {
209
223
  active: import("../types/IChaynsReact").Language;
210
224
  };
211
225
  export declare const getParameters: () => {
212
- [key: string]: string;
213
- [key: symbol]: string;
226
+ [key: string]: string | string[];
227
+ [key: symbol]: string | string[];
214
228
  };
215
229
  export declare const getPages: () => import("../types/IChaynsReact").Page[];
216
230
  export declare const getEnvironment: () => {
@@ -227,8 +241,8 @@ export declare const language: {
227
241
  active: import("../types/IChaynsReact").Language;
228
242
  };
229
243
  export declare const parameters: {
230
- [key: string]: string;
231
- [key: symbol]: string;
244
+ [key: string]: string | string[];
245
+ [key: symbol]: string | string[];
232
246
  };
233
247
  export declare const pages: import("../types/IChaynsReact").Page[];
234
248
  export declare const environment: {
File without changes
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  declare const AppDialogWrapper: ({ dialogEventTarget }: {
3
3
  dialogEventTarget: any;
4
- }) => JSX.Element;
4
+ }) => React.JSX.Element;
5
5
  export default AppDialogWrapper;
@@ -1,8 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { ChaynsReactFunctions, ChaynsReactValues, IChaynsReact } from '../types/IChaynsReact';
3
- export declare const moduleWrapper: {
4
- current: IChaynsReact;
5
- };
2
+ import { ChaynsReactFunctions, ChaynsReactValues } from '../types/IChaynsReact';
6
3
  type ChaynsProviderProps = {
7
4
  data?: ChaynsReactValues;
8
5
  functions?: ChaynsReactFunctions;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ export default class ErrorBoundary extends React.Component<{
3
+ children: React.ReactNode;
4
+ }, {
5
+ hasError: boolean;
6
+ }> {
7
+ constructor(props: any);
8
+ static getDerivedStateFromError(): {
9
+ hasError: boolean;
10
+ };
11
+ componentDidCatch(error: any, errorInfo: any): void;
12
+ render(): React.ReactNode;
13
+ }
@@ -0,0 +1,4 @@
1
+ import { IChaynsReact } from '../types/IChaynsReact';
2
+ export declare const moduleWrapper: {
3
+ current: IChaynsReact;
4
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ type StoreLikeValue = object & {
3
+ getState: () => object;
4
+ abort?: () => Promise<void>;
5
+ type?: 'raw' | 'json';
6
+ };
7
+ type HydrationComponent = React.FC<{
8
+ value: StoreLikeValue;
9
+ children?: React.ReactNode;
10
+ }>;
11
+ type Initializer = (initialValue: object | undefined) => StoreLikeValue;
12
+ type HydrationBoundary = React.FC<{
13
+ id?: string;
14
+ children?: React.ReactNode;
15
+ }>;
16
+ declare const withHydrationBoundary: (Component: HydrationComponent, initializer: Initializer, useHydrationId: undefined | (() => string)) => HydrationBoundary;
17
+ export default withHydrationBoundary;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type HydrationContextValueType = {
3
+ [key: string]: {
4
+ getState: () => object;
5
+ abort?: () => Promise<void>;
6
+ type?: 'raw' | 'json';
7
+ };
8
+ };
9
+ export declare let HydrationContext: React.Context<HydrationContextValueType>;
@@ -0,0 +1 @@
1
+ export * from './hydrationContext';
@@ -0,0 +1,12 @@
1
+ export declare enum DeviceLanguage {
2
+ de = 1,
3
+ en = 2,
4
+ fr = 3,
5
+ it = 4,
6
+ nl = 5,
7
+ es = 6,
8
+ pt = 7,
9
+ tr = 8,
10
+ pl = 9,
11
+ uk = 10
12
+ }
@@ -7,7 +7,6 @@ export default class DialogHandler {
7
7
  private readonly _config;
8
8
  private readonly _dispatchEvent;
9
9
  private readonly _addDataListener;
10
- private readonly _removeDataListener;
11
10
  private readonly listeners;
12
11
  constructor(config: any, open: any, close: any, dispatchEvent: any, addDataListener: any);
13
12
  open(): Promise<unknown>;
@@ -1,5 +1,6 @@
1
1
  import { AccessToken } from "../types/IChaynsReact";
2
2
  /**
3
3
  * @category Hooks
4
+ * @deprecated Use {@link getAccessToken} instead
4
5
  */
5
6
  export declare const useAccessToken: (accessToken?: AccessToken) => string | undefined;
@@ -1,4 +1,7 @@
1
1
  /**
2
2
  * @category Hooks
3
3
  */
4
- export declare const useCurrentPage: () => any;
4
+ export declare const useCurrentPage: () => {
5
+ id: number;
6
+ siteId: string;
7
+ };
@@ -11,7 +11,6 @@ type ChaynsHostType = {
11
11
  src?: string;
12
12
  iFrameRef?: React.MutableRefObject<HTMLIFrameElement | null> | undefined;
13
13
  loadingComponent?: JSX.Element;
14
- children?: JSX.Element;
15
14
  system?: TypeSystem;
16
15
  pages: Page[];
17
16
  isAdminModeActive: boolean;
@@ -3,7 +3,9 @@ import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, Ch
3
3
  export type TypeSystem = {
4
4
  scope: string;
5
5
  url: string;
6
+ serverUrl?: string;
6
7
  module: string;
8
+ preventSingleton?: boolean;
7
9
  };
8
10
  type ModulePropTypes = {
9
11
  system: TypeSystem;
@@ -0,0 +1,8 @@
1
+ export declare function fetchData(url: any): {
2
+ read: () => any;
3
+ };
4
+ declare const Component: ({ fallback, system }: {
5
+ fallback: any;
6
+ system: any;
7
+ }) => JSX.Element;
8
+ export default Component;
@@ -1 +1,3 @@
1
- export default function loadComponent(scope: any, module: any, url: any, skipCompatMode?: boolean): () => Promise<any>;
1
+ export declare const loadModule: (scope: any, module: any, url: any, preventSingleton?: boolean) => any;
2
+ declare const loadComponent: (scope: any, module: any, url: any, skipCompatMode?: boolean, preventSingleton?: boolean) => any;
3
+ export default loadComponent;
@@ -1,5 +1,6 @@
1
+ import './util/transferNestedFunctions';
1
2
  export { default as ChaynsProvider } from './components/ChaynsProvider';
2
- export { default as getDeviceInfo, getScreenSize } from './util/deviceHelper';
3
+ export { default as getDeviceInfo, getScreenSize, getClientDeviceInfo } from './util/deviceHelper';
3
4
  export { default as ChaynsHost } from './host/ChaynsHost';
4
5
  export { withCompatMode } from './components/withCompatMode';
5
6
  export * from './calls';
@@ -7,6 +8,11 @@ export * from './hooks';
7
8
  export * from './components/WaitUntil';
8
9
  export * from './types/IChaynsReact';
9
10
  export * from './components/withCompatMode';
11
+ export * from './constants';
12
+ export { default as withHydrationBoundary } from './components/withHydrationBoundary';
13
+ export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
14
+ export { default as loadComponent, loadModule } from './host/module/utils/loadComponent';
15
+ export { default as DialogHandler } from './handler/DialogHandler';
10
16
  export * as dialog from './calls/dialogs/index';
11
17
  export * from './types/IChaynsReact';
12
18
  declare const _default: {