chayns-api 1.1.0-32 → 1.1.0-34
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.
- package/dist/cjs/calls/index.js +11 -3
- package/dist/cjs/components/withHydrationBoundary.js +1 -1
- package/dist/cjs/handler/DialogHandler.js +1 -2
- package/dist/cjs/wrapper/AppWrapper.js +30 -13
- package/dist/cjs/wrapper/FrameWrapper.js +5 -1
- package/dist/cjs/wrapper/StaticChaynsApi.js +7 -0
- package/dist/esm/calls/index.js +8 -3
- package/dist/esm/components/withHydrationBoundary.js +1 -1
- package/dist/esm/handler/DialogHandler.js +1 -2
- package/dist/esm/wrapper/AppWrapper.js +30 -14
- package/dist/esm/wrapper/FrameWrapper.js +5 -1
- package/dist/esm/wrapper/StaticChaynsApi.js +7 -0
- package/dist/types/calls/index.d.ts +5 -1
- package/dist/types/components/withHydrationBoundary.d.ts +1 -1
- package/dist/types/handler/DialogHandler.d.ts +9 -3
- package/dist/types/types/IChaynsReact.d.ts +42 -8
- package/dist/types/wrapper/StaticChaynsApi.d.ts +7 -0
- package/package.json +1 -1
- package/dist/chayns-api.js +0 -2
- package/dist/chayns-api.js.LICENSE.txt +0 -41
- package/dist/cjs/calls/toolbarChangeListener.js +0 -1
- package/dist/cjs/host/module/Test3.js +0 -141
- package/dist/cjs/host/module/utils/useDynamicScript.js +0 -61
- package/dist/esm/calls/toolbarChangeListener.js +0 -0
- package/dist/esm/host/module/Test3.js +0 -135
- package/dist/esm/host/module/utils/useDynamicScript.js +0 -50
- package/dist/types/calls/toolbarChangeListener.d.ts +0 -0
- package/dist/types/host/module/Test3.d.ts +0 -8
- package/dist/types/host/module/utils/useDynamicScript.d.ts +0 -9
package/dist/cjs/calls/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = void 0;
|
|
6
|
+
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = void 0;
|
|
7
7
|
var _moduleWrapper = require("../components/moduleWrapper");
|
|
8
8
|
/**
|
|
9
9
|
* This adds a listener to determine your location.
|
|
@@ -241,21 +241,29 @@ const storageSetItem = (...args) => _moduleWrapper.moduleWrapper.current.functio
|
|
|
241
241
|
*/
|
|
242
242
|
exports.storageSetItem = storageSetItem;
|
|
243
243
|
const vibrate = (...args) => _moduleWrapper.moduleWrapper.current.functions.vibrate(...args);
|
|
244
|
+
|
|
244
245
|
/**
|
|
245
246
|
* This method creates a dialog
|
|
246
247
|
*/
|
|
248
|
+
// @ts-ignore
|
|
247
249
|
exports.vibrate = vibrate;
|
|
248
|
-
const createDialog =
|
|
250
|
+
const createDialog = config => _moduleWrapper.moduleWrapper.current.functions.createDialog(config);
|
|
249
251
|
/**
|
|
250
252
|
* Displays an overlay
|
|
251
253
|
*/
|
|
252
254
|
exports.createDialog = createDialog;
|
|
253
255
|
const setOverlay = (...args) => _moduleWrapper.moduleWrapper.current.functions.setOverlay(...args);
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Generates a temp accesstoken, only valid for short period of time (~3 days), works only when no user is logged in
|
|
259
|
+
*/
|
|
260
|
+
exports.setOverlay = setOverlay;
|
|
261
|
+
const addAnonymousAccount = () => _moduleWrapper.moduleWrapper.current.functions.addAnonymousAccount();
|
|
254
262
|
/**
|
|
255
263
|
* Returns user information, only when user is logged in
|
|
256
264
|
* @category User functions
|
|
257
265
|
*/
|
|
258
|
-
exports.
|
|
266
|
+
exports.addAnonymousAccount = addAnonymousAccount;
|
|
259
267
|
const getUser = () => _moduleWrapper.moduleWrapper.current.values.user;
|
|
260
268
|
exports.getUser = getUser;
|
|
261
269
|
const getSite = () => _moduleWrapper.moduleWrapper.current.values.site;
|
|
@@ -33,7 +33,7 @@ const withHydrationBoundary = (Component, initializer, useHydrationId) => {
|
|
|
33
33
|
initialValue = JSON.parse($elem.innerHTML);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const s = initializer(initialValue);
|
|
36
|
+
const s = initializer(initialValue, id);
|
|
37
37
|
if (!globalThis.window) {
|
|
38
38
|
value[id] = s;
|
|
39
39
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
class DialogHandler {
|
|
8
8
|
isOpen = false;
|
|
9
|
-
result = undefined;
|
|
10
9
|
listeners = [];
|
|
11
10
|
constructor(config, open, close, dispatchEvent, addDataListener) {
|
|
12
11
|
this._open = open;
|
|
@@ -41,7 +40,7 @@ class DialogHandler {
|
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
this.isOpen = false;
|
|
44
|
-
this._close(this.dialogId, data);
|
|
43
|
+
this._close(this.dialogId, data, buttonType);
|
|
45
44
|
}
|
|
46
45
|
dispatchEvent(data) {
|
|
47
46
|
if (!this.isOpen) {
|
|
@@ -35,6 +35,7 @@ class AppWrapper {
|
|
|
35
35
|
const urlParamsLowerCase = new URLSearchParams(location.search.toLowerCase());
|
|
36
36
|
let tappId = urlParamsLowerCase.get('tappid');
|
|
37
37
|
let colorMode = urlParamsLowerCase.get('colormode');
|
|
38
|
+
let color = AppInfo.color;
|
|
38
39
|
if (colorMode) {
|
|
39
40
|
try {
|
|
40
41
|
colorMode = Number.parseInt(colorMode, 10);
|
|
@@ -51,6 +52,20 @@ class AppWrapper {
|
|
|
51
52
|
if (!language) {
|
|
52
53
|
language = _languages.DeviceLanguage[Number.parseInt(Device === null || Device === void 0 ? void 0 : Device.LanguageID, 10)] || 'de';
|
|
53
54
|
}
|
|
55
|
+
if (!color && urlParamsLowerCase.has('color')) {
|
|
56
|
+
color = urlParamsLowerCase.get('color');
|
|
57
|
+
if (!color.startsWith('#')) {
|
|
58
|
+
color = `#${color}`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let userId = AppUser.TobitUserID;
|
|
62
|
+
if (typeof userId === 'string') {
|
|
63
|
+
try {
|
|
64
|
+
userId = Number.parseInt(userId, 10);
|
|
65
|
+
} catch {
|
|
66
|
+
// ignore
|
|
67
|
+
}
|
|
68
|
+
}
|
|
54
69
|
return {
|
|
55
70
|
device: (0, _deviceHelper.default)(navigator.userAgent, 'image/webp'),
|
|
56
71
|
environment: {
|
|
@@ -78,7 +93,7 @@ class AppWrapper {
|
|
|
78
93
|
},
|
|
79
94
|
title: AppInfo.Title,
|
|
80
95
|
colorMode: (_colorMode = colorMode) !== null && _colorMode !== void 0 ? _colorMode : AppInfo.colorMode,
|
|
81
|
-
color
|
|
96
|
+
color,
|
|
82
97
|
domain: AppInfo.domain,
|
|
83
98
|
font: {
|
|
84
99
|
id: _IChaynsReact.Font.Roboto,
|
|
@@ -94,7 +109,7 @@ class AppWrapper {
|
|
|
94
109
|
firstName: AppUser.FirstName,
|
|
95
110
|
lastName: AppUser.LastName,
|
|
96
111
|
gender: _IChaynsReact.Gender.Unknown,
|
|
97
|
-
userId:
|
|
112
|
+
userId: userId,
|
|
98
113
|
personId: AppUser.PersonID,
|
|
99
114
|
uacGroups: []
|
|
100
115
|
},
|
|
@@ -318,7 +333,7 @@ class AppWrapper {
|
|
|
318
333
|
(0, _appCall.default)(callObj);
|
|
319
334
|
},
|
|
320
335
|
login: async (value, callback, closeCallback) => {
|
|
321
|
-
const res = await this.appCall(
|
|
336
|
+
const res = await this.appCall(54, value);
|
|
322
337
|
return {
|
|
323
338
|
loginState: res === null || res === void 0 ? void 0 : res.loginState
|
|
324
339
|
};
|
|
@@ -549,6 +564,9 @@ class AppWrapper {
|
|
|
549
564
|
buttonType: -1
|
|
550
565
|
});
|
|
551
566
|
}
|
|
567
|
+
},
|
|
568
|
+
addAnonymousAccount: async () => {
|
|
569
|
+
return this.appCall(302);
|
|
552
570
|
}
|
|
553
571
|
};
|
|
554
572
|
dialogs = [];
|
|
@@ -558,18 +576,17 @@ class AppWrapper {
|
|
|
558
576
|
}
|
|
559
577
|
async init() {
|
|
560
578
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
561
|
-
const callbackName = `chaynsApiV5Callback_${this.counter++}`;
|
|
562
|
-
window.disablev4AccessTokenChangeListener = true;
|
|
563
|
-
window[callbackName] = ({
|
|
564
|
-
retVal: value
|
|
565
|
-
}) => {
|
|
566
|
-
this.mapOldApiToNew(value);
|
|
567
|
-
};
|
|
568
579
|
this.appCall(66, {
|
|
569
580
|
enabled: true,
|
|
570
|
-
callback:
|
|
571
|
-
|
|
572
|
-
|
|
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
|
+
}
|
|
573
590
|
});
|
|
574
591
|
return undefined;
|
|
575
592
|
}
|
|
@@ -296,7 +296,11 @@ class FrameWrapper {
|
|
|
296
296
|
// this.exposedFunctions.removeDialogHostEventListener(0);
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
|
-
removeDialogClientEventListener: async () => {}
|
|
299
|
+
removeDialogClientEventListener: async () => {},
|
|
300
|
+
addAnonymousAccount: async () => {
|
|
301
|
+
if (!this.initialized) await this.ready;
|
|
302
|
+
return this.exposedFunctions.addAnonymousAccount();
|
|
303
|
+
}
|
|
300
304
|
};
|
|
301
305
|
initialized = false;
|
|
302
306
|
constructor() {
|
|
@@ -17,6 +17,13 @@ class StaticChaynsApi {
|
|
|
17
17
|
this[k] = v;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
+
getUser = () => this._wrapper.values.user;
|
|
20
21
|
getSite = () => this._wrapper.values.site;
|
|
22
|
+
getCurrentPage = () => this._wrapper.values.currentPage;
|
|
23
|
+
getDevice = () => this._wrapper.values.device;
|
|
24
|
+
getLanguage = () => this._wrapper.values.language;
|
|
25
|
+
getParameters = () => this._wrapper.values.parameters;
|
|
26
|
+
getPages = () => this._wrapper.values.pages;
|
|
27
|
+
getEnvironment = () => this._wrapper.values.environment;
|
|
21
28
|
}
|
|
22
29
|
var _default = exports.default = StaticChaynsApi;
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -282,18 +282,23 @@ export const storageSetItem = function () {
|
|
|
282
282
|
export const vibrate = function () {
|
|
283
283
|
return moduleWrapper.current.functions.vibrate(...arguments);
|
|
284
284
|
};
|
|
285
|
+
|
|
285
286
|
/**
|
|
286
287
|
* This method creates a dialog
|
|
287
288
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
};
|
|
289
|
+
// @ts-ignore
|
|
290
|
+
export const createDialog = config => moduleWrapper.current.functions.createDialog(config);
|
|
291
291
|
/**
|
|
292
292
|
* Displays an overlay
|
|
293
293
|
*/
|
|
294
294
|
export const setOverlay = function () {
|
|
295
295
|
return moduleWrapper.current.functions.setOverlay(...arguments);
|
|
296
296
|
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Generates a temp accesstoken, only valid for short period of time (~3 days), works only when no user is logged in
|
|
300
|
+
*/
|
|
301
|
+
export const addAnonymousAccount = () => moduleWrapper.current.functions.addAnonymousAccount();
|
|
297
302
|
/**
|
|
298
303
|
* Returns user information, only when user is logged in
|
|
299
304
|
* @category User functions
|
|
@@ -26,7 +26,7 @@ const withHydrationBoundary = (Component, initializer, useHydrationId) => {
|
|
|
26
26
|
initialValue = JSON.parse($elem.innerHTML);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const s = initializer(initialValue);
|
|
29
|
+
const s = initializer(initialValue, id);
|
|
30
30
|
if (!globalThis.window) {
|
|
31
31
|
value[id] = s;
|
|
32
32
|
}
|
|
@@ -4,7 +4,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
4
4
|
export default class DialogHandler {
|
|
5
5
|
constructor(config, open, close, dispatchEvent, addDataListener) {
|
|
6
6
|
_defineProperty(this, "isOpen", false);
|
|
7
|
-
_defineProperty(this, "result", undefined);
|
|
8
7
|
_defineProperty(this, "listeners", []);
|
|
9
8
|
this._open = open;
|
|
10
9
|
this._close = close;
|
|
@@ -38,7 +37,7 @@ export default class DialogHandler {
|
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
39
|
this.isOpen = false;
|
|
41
|
-
this._close(this.dialogId, data);
|
|
40
|
+
this._close(this.dialogId, data, buttonType);
|
|
42
41
|
}
|
|
43
42
|
dispatchEvent(data) {
|
|
44
43
|
if (!this.isOpen) {
|
|
@@ -27,6 +27,7 @@ export class AppWrapper {
|
|
|
27
27
|
const urlParamsLowerCase = new URLSearchParams(location.search.toLowerCase());
|
|
28
28
|
let tappId = urlParamsLowerCase.get('tappid');
|
|
29
29
|
let colorMode = urlParamsLowerCase.get('colormode');
|
|
30
|
+
let color = AppInfo.color;
|
|
30
31
|
if (colorMode) {
|
|
31
32
|
try {
|
|
32
33
|
colorMode = Number.parseInt(colorMode, 10);
|
|
@@ -43,6 +44,20 @@ export class AppWrapper {
|
|
|
43
44
|
if (!language) {
|
|
44
45
|
language = DeviceLanguage[Number.parseInt(Device === null || Device === void 0 ? void 0 : Device.LanguageID, 10)] || 'de';
|
|
45
46
|
}
|
|
47
|
+
if (!color && urlParamsLowerCase.has('color')) {
|
|
48
|
+
color = urlParamsLowerCase.get('color');
|
|
49
|
+
if (!color.startsWith('#')) {
|
|
50
|
+
color = `#${color}`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
let userId = AppUser.TobitUserID;
|
|
54
|
+
if (typeof userId === 'string') {
|
|
55
|
+
try {
|
|
56
|
+
userId = Number.parseInt(userId, 10);
|
|
57
|
+
} catch {
|
|
58
|
+
// ignore
|
|
59
|
+
}
|
|
60
|
+
}
|
|
46
61
|
return {
|
|
47
62
|
device: getDeviceInfo(navigator.userAgent, 'image/webp'),
|
|
48
63
|
environment: {
|
|
@@ -70,7 +85,7 @@ export class AppWrapper {
|
|
|
70
85
|
},
|
|
71
86
|
title: AppInfo.Title,
|
|
72
87
|
colorMode: (_colorMode = colorMode) !== null && _colorMode !== void 0 ? _colorMode : AppInfo.colorMode,
|
|
73
|
-
color
|
|
88
|
+
color,
|
|
74
89
|
domain: AppInfo.domain,
|
|
75
90
|
font: {
|
|
76
91
|
id: Font.Roboto,
|
|
@@ -86,7 +101,7 @@ export class AppWrapper {
|
|
|
86
101
|
firstName: AppUser.FirstName,
|
|
87
102
|
lastName: AppUser.LastName,
|
|
88
103
|
gender: Gender.Unknown,
|
|
89
|
-
userId:
|
|
104
|
+
userId: userId,
|
|
90
105
|
personId: AppUser.PersonID,
|
|
91
106
|
uacGroups: []
|
|
92
107
|
},
|
|
@@ -274,7 +289,7 @@ export class AppWrapper {
|
|
|
274
289
|
invokeAppCall(callObj);
|
|
275
290
|
},
|
|
276
291
|
login: async (value, callback, closeCallback) => {
|
|
277
|
-
const res = await this.appCall(
|
|
292
|
+
const res = await this.appCall(54, value);
|
|
278
293
|
return {
|
|
279
294
|
loginState: res === null || res === void 0 ? void 0 : res.loginState
|
|
280
295
|
};
|
|
@@ -505,6 +520,9 @@ export class AppWrapper {
|
|
|
505
520
|
buttonType: -1
|
|
506
521
|
});
|
|
507
522
|
}
|
|
523
|
+
},
|
|
524
|
+
addAnonymousAccount: async () => {
|
|
525
|
+
return this.appCall(302);
|
|
508
526
|
}
|
|
509
527
|
});
|
|
510
528
|
_defineProperty(this, "dialogs", []);
|
|
@@ -556,19 +574,17 @@ export class AppWrapper {
|
|
|
556
574
|
}
|
|
557
575
|
async init() {
|
|
558
576
|
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
577
|
this.appCall(66, {
|
|
568
578
|
enabled: true,
|
|
569
|
-
callback:
|
|
570
|
-
|
|
571
|
-
|
|
579
|
+
callback: async () => {
|
|
580
|
+
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
581
|
+
document.dispatchEvent(new CustomEvent('chayns_api_data', {
|
|
582
|
+
detail: {
|
|
583
|
+
type: 'user',
|
|
584
|
+
value: this.values.user
|
|
585
|
+
}
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
572
588
|
});
|
|
573
589
|
return undefined;
|
|
574
590
|
}
|
|
@@ -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__');
|
|
@@ -5,7 +5,14 @@ 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;
|
|
@@ -200,11 +200,15 @@ export declare const vibrate: (value: import("../types/IChaynsReact").Vibrate) =
|
|
|
200
200
|
/**
|
|
201
201
|
* This method creates a dialog
|
|
202
202
|
*/
|
|
203
|
-
export declare const createDialog:
|
|
203
|
+
export declare const createDialog: ChaynsReactFunctions["createDialog"];
|
|
204
204
|
/**
|
|
205
205
|
* Displays an overlay
|
|
206
206
|
*/
|
|
207
207
|
export declare const setOverlay: (value: import("../types/IChaynsReact").ShowOverlay, callback: () => void) => Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Generates a temp accesstoken, only valid for short period of time (~3 days), works only when no user is logged in
|
|
210
|
+
*/
|
|
211
|
+
export declare const addAnonymousAccount: () => Promise<import("../types/IChaynsReact").AnonymousAccountResult>;
|
|
208
212
|
/**
|
|
209
213
|
* Returns user information, only when user is logged in
|
|
210
214
|
* @category User functions
|
|
@@ -8,7 +8,7 @@ type HydrationComponent = React.FC<{
|
|
|
8
8
|
value: StoreLikeValue;
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
}>;
|
|
11
|
-
type Initializer = (initialValue: object | undefined) => StoreLikeValue;
|
|
11
|
+
type Initializer = (initialValue: object | undefined, id: string) => StoreLikeValue;
|
|
12
12
|
type HydrationBoundary = React.FC<{
|
|
13
13
|
id?: string;
|
|
14
14
|
children?: React.ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default class DialogHandler {
|
|
1
|
+
export default class DialogHandler<S = void, T extends any = void> {
|
|
2
2
|
private dialogId;
|
|
3
3
|
private isOpen;
|
|
4
4
|
private result;
|
|
@@ -9,10 +9,16 @@ export default class DialogHandler {
|
|
|
9
9
|
private readonly _addDataListener;
|
|
10
10
|
private readonly listeners;
|
|
11
11
|
constructor(config: any, open: any, close: any, dispatchEvent: any, addDataListener: any);
|
|
12
|
-
open(): Promise<
|
|
12
|
+
open(): Promise<{
|
|
13
|
+
buttonType: number;
|
|
14
|
+
result: T extends undefined ? S : T;
|
|
15
|
+
}>;
|
|
13
16
|
close(buttonType: any, data: any): void;
|
|
14
17
|
dispatchEvent(data: object): void;
|
|
15
18
|
addDataListener(listener: (data: any) => void): void;
|
|
16
19
|
removeDataListener(listener: (data: any) => void): void;
|
|
17
|
-
getResult():
|
|
20
|
+
getResult(): {
|
|
21
|
+
buttonType: number;
|
|
22
|
+
result: T extends undefined ? S : T;
|
|
23
|
+
} | undefined;
|
|
18
24
|
}
|
|
@@ -61,23 +61,25 @@ export interface BaseDialog {
|
|
|
61
61
|
config?: any;
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
export type Dialog = BaseDialog & (DialogAlert | DialogConfirm | DialogInput | DialogModule | DialogIFrame | DialogSelect | DialogDate | DialogToast |
|
|
64
|
+
export type Dialog<T extends any = object> = BaseDialog & (DialogAlert | DialogConfirm | DialogInput | DialogModule<T> | DialogIFrame<T> | DialogSelect | DialogDate | DialogToast | DialogSignature | DialogFileSelect);
|
|
65
65
|
export interface DialogSignature {
|
|
66
66
|
type: DialogType.SIGNATURE;
|
|
67
67
|
}
|
|
68
|
-
export interface DialogModule {
|
|
68
|
+
export interface DialogModule<T extends any = object> {
|
|
69
69
|
type: DialogType.MODULE;
|
|
70
70
|
system: {
|
|
71
71
|
url: string;
|
|
72
72
|
module: string;
|
|
73
73
|
scope: string;
|
|
74
74
|
};
|
|
75
|
-
dialogInput
|
|
75
|
+
dialogInput?: T;
|
|
76
|
+
backgroundColor?: string;
|
|
76
77
|
}
|
|
77
|
-
export interface DialogIFrame {
|
|
78
|
+
export interface DialogIFrame<T extends any = object> {
|
|
78
79
|
type: DialogType.IFRAME;
|
|
79
80
|
url: string;
|
|
80
|
-
dialogInput
|
|
81
|
+
dialogInput?: T;
|
|
82
|
+
backgroundColor?: string;
|
|
81
83
|
}
|
|
82
84
|
export declare enum DialogInputType {
|
|
83
85
|
NUMBER = "number",
|
|
@@ -88,8 +90,8 @@ export declare enum DialogInputType {
|
|
|
88
90
|
}
|
|
89
91
|
export interface DialogInput {
|
|
90
92
|
type: DialogType.INPUT;
|
|
91
|
-
placeholder
|
|
92
|
-
inputType
|
|
93
|
+
placeholder?: string;
|
|
94
|
+
inputType?: DialogInputType;
|
|
93
95
|
defaultValue?: string;
|
|
94
96
|
formatter?: (input: string) => string;
|
|
95
97
|
}
|
|
@@ -104,7 +106,11 @@ export type DialogSelectListItemType = {
|
|
|
104
106
|
disabled?: boolean;
|
|
105
107
|
isSelected?: boolean;
|
|
106
108
|
url?: string;
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated Use {@link icon} instead
|
|
111
|
+
*/
|
|
107
112
|
className?: string;
|
|
113
|
+
icon?: string;
|
|
108
114
|
};
|
|
109
115
|
export interface DialogSelect {
|
|
110
116
|
type: DialogType.SELECT;
|
|
@@ -216,6 +222,30 @@ export interface ChaynsReactValues {
|
|
|
216
222
|
isClosingRequested: boolean;
|
|
217
223
|
};
|
|
218
224
|
}
|
|
225
|
+
export interface DialogResultFile {
|
|
226
|
+
blockDownload?: boolean;
|
|
227
|
+
contentType: string;
|
|
228
|
+
filename: string;
|
|
229
|
+
id: number;
|
|
230
|
+
key: string;
|
|
231
|
+
modifyTime: string;
|
|
232
|
+
personId: string;
|
|
233
|
+
protected?: boolean;
|
|
234
|
+
size: number;
|
|
235
|
+
url: string;
|
|
236
|
+
}
|
|
237
|
+
type DialogResultValue<T> = {
|
|
238
|
+
[DialogType.INPUT]: string;
|
|
239
|
+
[DialogType.SELECT]: number[];
|
|
240
|
+
[DialogType.CONFIRM]: void;
|
|
241
|
+
[DialogType.ALERT]: void;
|
|
242
|
+
[DialogType.DATE]: Date;
|
|
243
|
+
[DialogType.FILE_SELECT]: DialogResultFile[];
|
|
244
|
+
[DialogType.IFRAME]: T;
|
|
245
|
+
[DialogType.MODULE]: T;
|
|
246
|
+
[DialogType.SIGNATURE]: string;
|
|
247
|
+
[DialogType.TOAST]: void;
|
|
248
|
+
};
|
|
219
249
|
/**
|
|
220
250
|
* @ignore
|
|
221
251
|
*/
|
|
@@ -275,7 +305,7 @@ export interface ChaynsReactFunctions {
|
|
|
275
305
|
vibrate: (value: Vibrate) => Promise<void>;
|
|
276
306
|
scrollByY: (position: number, duration?: number) => Promise<void>;
|
|
277
307
|
setOverlay: (value: ShowOverlay, callback: () => void) => Promise<void>;
|
|
278
|
-
createDialog: (config:
|
|
308
|
+
createDialog: <I extends any = undefined, T extends any = undefined, Z extends Dialog<I> = Dialog<I>>(config: Z) => DialogHandler<DialogResultValue<T>[Z["type"]], T>;
|
|
279
309
|
openDialog: (value: any, callback: (data: any) => any) => Promise<any>;
|
|
280
310
|
closeDialog: (dialogId: number) => Promise<void>;
|
|
281
311
|
setDialogResult: (buttonType: DialogButtonType, result: any) => Promise<void>;
|
|
@@ -285,6 +315,7 @@ export interface ChaynsReactFunctions {
|
|
|
285
315
|
dispatchEventToDialogHost: (data: object) => Promise<void>;
|
|
286
316
|
addDialogHostEventListener: (callback: (data: object) => void) => Promise<number>;
|
|
287
317
|
removeDialogHostEventListener: (id: number) => Promise<void>;
|
|
318
|
+
addAnonymousAccount: () => Promise<AnonymousAccountResult>;
|
|
288
319
|
}
|
|
289
320
|
export type DialogResult = {
|
|
290
321
|
open: () => Promise<any>;
|
|
@@ -813,4 +844,7 @@ export declare enum DialogIconType {
|
|
|
813
844
|
WarningIcon = "%%DialogWarningIcon%%",
|
|
814
845
|
ErrorIcon = "%%DialogErrorIcon%%"
|
|
815
846
|
}
|
|
847
|
+
export type AnonymousAccountResult = {
|
|
848
|
+
token: string;
|
|
849
|
+
};
|
|
816
850
|
export {};
|
|
@@ -4,6 +4,13 @@ declare class StaticChaynsApi {
|
|
|
4
4
|
addDataListener: (cb: DataChangeCallback) => () => void;
|
|
5
5
|
private _wrapper;
|
|
6
6
|
constructor();
|
|
7
|
+
getUser: () => any;
|
|
7
8
|
getSite: () => any;
|
|
9
|
+
getCurrentPage: () => any;
|
|
10
|
+
getDevice: () => any;
|
|
11
|
+
getLanguage: () => any;
|
|
12
|
+
getParameters: () => any;
|
|
13
|
+
getPages: () => any;
|
|
14
|
+
getEnvironment: () => any;
|
|
8
15
|
}
|
|
9
16
|
export default StaticChaynsApi;
|