chayns-api 1.0.69 → 1.0.71
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 +3 -1
- package/dist/cjs/wrapper/AppWrapper.js +8 -6
- package/dist/esm/calls/index.js +3 -3
- package/dist/esm/wrapper/AppWrapper.js +8 -6
- package/dist/types/calls/index.d.ts +3 -7
- package/dist/types/handler/DialogHandler.d.ts +6 -3
- package/dist/types/types/IChaynsReact.d.ts +34 -8
- package/package.json +1 -1
package/dist/cjs/calls/index.js
CHANGED
|
@@ -241,11 +241,13 @@ 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
|
*/
|
|
@@ -578,12 +578,14 @@ class AppWrapper {
|
|
|
578
578
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
579
579
|
this.appCall(66, {
|
|
580
580
|
enabled: true,
|
|
581
|
-
callback:
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
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
|
+
}));
|
|
587
589
|
}
|
|
588
590
|
});
|
|
589
591
|
return undefined;
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -282,12 +282,12 @@ 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
|
*/
|
|
@@ -576,12 +576,14 @@ export class AppWrapper {
|
|
|
576
576
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
577
577
|
this.appCall(66, {
|
|
578
578
|
enabled: true,
|
|
579
|
-
callback:
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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
|
+
}));
|
|
585
587
|
}
|
|
586
588
|
});
|
|
587
589
|
return undefined;
|
|
@@ -200,7 +200,7 @@ 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
|
*/
|
|
@@ -233,9 +233,7 @@ export declare const getParameters: () => {
|
|
|
233
233
|
export declare const getPages: () => import("../types/IChaynsReact").Page[];
|
|
234
234
|
export declare const getEnvironment: () => {
|
|
235
235
|
buildEnvironment: import("../types/IChaynsReact").Environment;
|
|
236
|
-
runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
|
|
237
|
-
* Refresh accesstoken, should only be used when user object changes, not when token is invalid
|
|
238
|
-
*/
|
|
236
|
+
runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
|
|
239
237
|
};
|
|
240
238
|
export declare const user: UserInfo;
|
|
241
239
|
export declare const site: ChaynsApiSite;
|
|
@@ -253,7 +251,5 @@ export declare const parameters: {
|
|
|
253
251
|
export declare const pages: import("../types/IChaynsReact").Page[];
|
|
254
252
|
export declare const environment: {
|
|
255
253
|
buildEnvironment: import("../types/IChaynsReact").Environment;
|
|
256
|
-
runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
|
|
257
|
-
* Refresh accesstoken, should only be used when user object changes, not when token is invalid
|
|
258
|
-
*/
|
|
254
|
+
runtimeEnvironment: string | import("../types/IChaynsReact").RuntimeEnviroment;
|
|
259
255
|
};
|
|
@@ -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,13 @@ 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
|
+
value: 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(): T;
|
|
18
21
|
}
|
|
@@ -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);
|
|
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
|
}
|
|
@@ -216,6 +218,30 @@ export interface ChaynsReactValues {
|
|
|
216
218
|
isClosingRequested: boolean;
|
|
217
219
|
};
|
|
218
220
|
}
|
|
221
|
+
export interface DialogResultFile {
|
|
222
|
+
blockDownload?: boolean;
|
|
223
|
+
contentType: string;
|
|
224
|
+
filename: string;
|
|
225
|
+
id: number;
|
|
226
|
+
key: string;
|
|
227
|
+
modifyTime: string;
|
|
228
|
+
personId: string;
|
|
229
|
+
protected?: boolean;
|
|
230
|
+
size: number;
|
|
231
|
+
url: string;
|
|
232
|
+
}
|
|
233
|
+
type DialogResultValue<T> = {
|
|
234
|
+
[DialogType.INPUT]: string;
|
|
235
|
+
[DialogType.SELECT]: number[];
|
|
236
|
+
[DialogType.CONFIRM]: void;
|
|
237
|
+
[DialogType.ALERT]: void;
|
|
238
|
+
[DialogType.DATE]: Date;
|
|
239
|
+
[DialogType.FILE_SELECT]: DialogResultFile[];
|
|
240
|
+
[DialogType.IFRAME]: T;
|
|
241
|
+
[DialogType.MODULE]: T;
|
|
242
|
+
[DialogType.SIGNATURE]: string;
|
|
243
|
+
[DialogType.TOAST]: void;
|
|
244
|
+
};
|
|
219
245
|
/**
|
|
220
246
|
* @ignore
|
|
221
247
|
*/
|
|
@@ -275,7 +301,7 @@ export interface ChaynsReactFunctions {
|
|
|
275
301
|
vibrate: (value: Vibrate) => Promise<void>;
|
|
276
302
|
scrollByY: (position: number, duration?: number) => Promise<void>;
|
|
277
303
|
setOverlay: (value: ShowOverlay, callback: () => void) => Promise<void>;
|
|
278
|
-
createDialog: (config:
|
|
304
|
+
createDialog: <I extends any = undefined, T extends any = undefined, Z extends Dialog<I> = Dialog<I>>(config: Z) => DialogHandler<DialogResultValue<T>[Z["type"]], T>;
|
|
279
305
|
openDialog: (value: any, callback: (data: any) => any) => Promise<any>;
|
|
280
306
|
closeDialog: (dialogId: number) => Promise<void>;
|
|
281
307
|
setDialogResult: (buttonType: DialogButtonType, result: any) => Promise<void>;
|