@expressms/smartapp-sdk 1.9.0-alpha.0 → 1.9.0-alpha.2
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/build/main/lib/client/file.d.ts +8 -8
- package/build/main/lib/client/file.js +18 -9
- package/build/main/types/bridge.d.ts +1 -1
- package/build/main/types/client.d.ts +17 -1
- package/build/module/lib/client/file.d.ts +8 -8
- package/build/module/lib/client/file.js +19 -10
- package/build/module/types/bridge.d.ts +1 -1
- package/build/module/types/client.d.ts +17 -1
- package/build/umd/index.js +17 -8
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { File } from '../../types';
|
|
1
|
+
import { File, StatusResponse, UploadFilesTypeResponse, UploadFileTypeResponse } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Download and open single file with client
|
|
4
4
|
* @param file File data to be opened
|
|
5
5
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
6
6
|
*/
|
|
7
|
-
declare const openFile: (file: File) => Promise<
|
|
7
|
+
declare const openFile: (file: File) => Promise<StatusResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* Download file list with client
|
|
10
10
|
* @param files Files list to be opened
|
|
11
11
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
12
12
|
*/
|
|
13
|
-
declare const openFiles: (files: File[]) => Promise<
|
|
13
|
+
declare const openFiles: (files: File[]) => Promise<StatusResponse>;
|
|
14
14
|
/**
|
|
15
15
|
* Upload single file with client
|
|
16
16
|
* @param mimeType Mime type of allowed files
|
|
17
17
|
* @param maxSize Max file size in bytes
|
|
18
18
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
19
19
|
*/
|
|
20
|
-
declare const uploadFile: ({ mimeType, maxSize }: {
|
|
20
|
+
declare const uploadFile: ({ mimeType, maxSize, }: {
|
|
21
21
|
mimeType: string;
|
|
22
22
|
maxSize?: number | undefined;
|
|
23
|
-
}) => Promise<
|
|
23
|
+
}) => Promise<UploadFileTypeResponse>;
|
|
24
24
|
/**
|
|
25
25
|
* Upload files list with client
|
|
26
26
|
* @param mimeType Mime type of allowed files
|
|
27
27
|
* @param maxSize Max file size in bytes
|
|
28
28
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
29
29
|
*/
|
|
30
|
-
declare const uploadFiles: ({ mimeType, maxSize }: {
|
|
30
|
+
declare const uploadFiles: ({ mimeType, maxSize, }: {
|
|
31
31
|
mimeType: string;
|
|
32
32
|
maxSize?: number | undefined;
|
|
33
|
-
}) => Promise<
|
|
34
|
-
export { openFile, openFiles, uploadFile, uploadFiles
|
|
33
|
+
}) => Promise<UploadFilesTypeResponse>;
|
|
34
|
+
export { openFile, openFiles, uploadFile, uploadFiles };
|
|
@@ -6,18 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.uploadFiles = exports.uploadFile = exports.openFiles = exports.openFile = void 0;
|
|
7
7
|
const smartapp_bridge_1 = __importDefault(require("@expressms/smartapp-bridge"));
|
|
8
8
|
const types_1 = require("../../types");
|
|
9
|
+
const FILE_LOAD_TIMEOUT = 60 * 60 * 1000;
|
|
9
10
|
/**
|
|
10
11
|
* Download and open single file with client
|
|
11
12
|
* @param file File data to be opened
|
|
12
13
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
13
14
|
*/
|
|
14
|
-
const openFile = (file) => {
|
|
15
|
+
const openFile = async (file) => {
|
|
15
16
|
if (!smartapp_bridge_1.default)
|
|
16
17
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
17
|
-
|
|
18
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
18
19
|
method: types_1.METHODS.OPEN_FILE,
|
|
19
20
|
params: file,
|
|
21
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
20
22
|
});
|
|
23
|
+
return response;
|
|
21
24
|
};
|
|
22
25
|
exports.openFile = openFile;
|
|
23
26
|
/**
|
|
@@ -25,13 +28,15 @@ exports.openFile = openFile;
|
|
|
25
28
|
* @param files Files list to be opened
|
|
26
29
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
27
30
|
*/
|
|
28
|
-
const openFiles = (files) => {
|
|
31
|
+
const openFiles = async (files) => {
|
|
29
32
|
if (!smartapp_bridge_1.default)
|
|
30
33
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
31
|
-
|
|
34
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
32
35
|
method: types_1.METHODS.OPEN_FILES,
|
|
33
36
|
params: files,
|
|
37
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
34
38
|
});
|
|
39
|
+
return response;
|
|
35
40
|
};
|
|
36
41
|
exports.openFiles = openFiles;
|
|
37
42
|
/**
|
|
@@ -40,16 +45,18 @@ exports.openFiles = openFiles;
|
|
|
40
45
|
* @param maxSize Max file size in bytes
|
|
41
46
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
42
47
|
*/
|
|
43
|
-
const uploadFile = ({ mimeType, maxSize }) => {
|
|
48
|
+
const uploadFile = async ({ mimeType, maxSize, }) => {
|
|
44
49
|
if (!smartapp_bridge_1.default)
|
|
45
50
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
46
|
-
|
|
51
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
47
52
|
method: types_1.METHODS.UPLOAD_FILE,
|
|
48
53
|
params: {
|
|
49
54
|
type: mimeType,
|
|
50
55
|
maxSize,
|
|
51
56
|
},
|
|
57
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
52
58
|
});
|
|
59
|
+
return response;
|
|
53
60
|
};
|
|
54
61
|
exports.uploadFile = uploadFile;
|
|
55
62
|
/**
|
|
@@ -58,16 +65,18 @@ exports.uploadFile = uploadFile;
|
|
|
58
65
|
* @param maxSize Max file size in bytes
|
|
59
66
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
60
67
|
*/
|
|
61
|
-
const uploadFiles = ({ mimeType, maxSize }) => {
|
|
68
|
+
const uploadFiles = async ({ mimeType, maxSize, }) => {
|
|
62
69
|
if (!smartapp_bridge_1.default)
|
|
63
70
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
64
|
-
|
|
71
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
65
72
|
method: types_1.METHODS.UPLOAD_FILES,
|
|
66
73
|
params: {
|
|
67
74
|
type: mimeType,
|
|
68
75
|
maxSize,
|
|
69
76
|
},
|
|
77
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
70
78
|
});
|
|
79
|
+
return response;
|
|
71
80
|
};
|
|
72
81
|
exports.uploadFiles = uploadFiles;
|
|
73
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvY2xpZW50L2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsaUZBQStDO0FBQy9DLHVDQU9vQjtBQUVwQixNQUFNLGlCQUFpQixHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsSUFBSSxDQUFBO0FBRXhDOzs7O0dBSUc7QUFDSCxNQUFNLFFBQVEsR0FBRyxLQUFLLEVBQUUsSUFBVSxFQUEyQixFQUFFO0lBQzdELElBQUksQ0FBQyx5QkFBTTtRQUFFLE9BQU8sT0FBTyxDQUFDLE1BQU0sQ0FBQyxtQkFBVyxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBRXpELE1BQU0sUUFBUSxHQUFHLE1BQU0seUJBQU0sQ0FBQyxlQUFlLENBQUM7UUFDNUMsTUFBTSxFQUFFLGVBQU8sQ0FBQyxTQUFTO1FBQ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FBQzNDLENBQUMsQ0FBQTtBQTZCNkIsZ0NBQVU7QUEzQnhDOzs7OztHQUtHO0FBQ0gsTUFBTSxXQUFXLEdBQUcsS0FBSyxFQUFFLEVBQ3pCLFFBQVEsRUFDUixPQUFPLEdBSVIsRUFBb0MsRUFBRTtJQUNyQyxJQUFJLENBQUMseUJBQU07UUFBRSxPQUFPLE9BQU8sQ0FBQyxNQUFNLENBQUMsbUJBQVcsQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUV6RCxNQUFNLFFBQVEsR0FBRyxNQUFNLHlCQUFNLENBQUMsZUFBZSxDQUFDO1FBQzVDLE1BQU0sRUFBRSxlQUFPLENBQUMsWUFBWTtRQUM1QixNQUFNLEVBQUU7WUFDTixJQUFJLEVBQUUsUUFBUTtZQUNkLE9BQU87U0FDUjtRQUNELE9BQU8sRUFBRSxpQkFBaUI7S0FDM0IsQ0FBQyxDQUFBO0lBRUYsT0FBTyxRQUFtQyxDQUFBO0FBQzVDLENBQUMsQ0FBQTtBQUV5QyxrQ0FBVyJ9
|
|
@@ -79,7 +79,7 @@ export interface InitialDataProfileAction extends InitialData {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
export interface InitialDataPush extends InitialData {
|
|
82
|
-
initiator: '
|
|
82
|
+
initiator: 'push_notification';
|
|
83
83
|
meta?: object;
|
|
84
84
|
}
|
|
85
85
|
export interface InitialDataDeeplink extends InitialData {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmitterEventPayload } from '@expressms/smartapp-bridge/build/main/types/eventEmitter';
|
|
2
|
-
import { STATUS } from './bridge';
|
|
2
|
+
import { File, STATUS } from './bridge';
|
|
3
3
|
export declare enum SubscriptionEventType {
|
|
4
4
|
CONNECTION_STATUS = "connection_status",
|
|
5
5
|
UNREAD_COUNTER_CHANGE = "unread_counter_change",
|
|
@@ -56,3 +56,19 @@ export type GetLayoutTypeResponse = {
|
|
|
56
56
|
layoutType: "minimal" | "full" | "half";
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
export type UploadFileTypeResponse = {
|
|
60
|
+
ref: string;
|
|
61
|
+
payload: {
|
|
62
|
+
status: STATUS;
|
|
63
|
+
errorCode?: string | null;
|
|
64
|
+
record: File;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type UploadFilesTypeResponse = {
|
|
68
|
+
ref: string;
|
|
69
|
+
payload: {
|
|
70
|
+
status: STATUS;
|
|
71
|
+
errorCode?: string | null;
|
|
72
|
+
records: File[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { File } from '../../types';
|
|
1
|
+
import { File, StatusResponse, UploadFilesTypeResponse, UploadFileTypeResponse } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Download and open single file with client
|
|
4
4
|
* @param file File data to be opened
|
|
5
5
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
6
6
|
*/
|
|
7
|
-
declare const openFile: (file: File) => Promise<
|
|
7
|
+
declare const openFile: (file: File) => Promise<StatusResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* Download file list with client
|
|
10
10
|
* @param files Files list to be opened
|
|
11
11
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
12
12
|
*/
|
|
13
|
-
declare const openFiles: (files: File[]) => Promise<
|
|
13
|
+
declare const openFiles: (files: File[]) => Promise<StatusResponse>;
|
|
14
14
|
/**
|
|
15
15
|
* Upload single file with client
|
|
16
16
|
* @param mimeType Mime type of allowed files
|
|
17
17
|
* @param maxSize Max file size in bytes
|
|
18
18
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
19
19
|
*/
|
|
20
|
-
declare const uploadFile: ({ mimeType, maxSize }: {
|
|
20
|
+
declare const uploadFile: ({ mimeType, maxSize, }: {
|
|
21
21
|
mimeType: string;
|
|
22
22
|
maxSize?: number | undefined;
|
|
23
|
-
}) => Promise<
|
|
23
|
+
}) => Promise<UploadFileTypeResponse>;
|
|
24
24
|
/**
|
|
25
25
|
* Upload files list with client
|
|
26
26
|
* @param mimeType Mime type of allowed files
|
|
27
27
|
* @param maxSize Max file size in bytes
|
|
28
28
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
29
29
|
*/
|
|
30
|
-
declare const uploadFiles: ({ mimeType, maxSize }: {
|
|
30
|
+
declare const uploadFiles: ({ mimeType, maxSize, }: {
|
|
31
31
|
mimeType: string;
|
|
32
32
|
maxSize?: number | undefined;
|
|
33
|
-
}) => Promise<
|
|
34
|
-
export { openFile, openFiles, uploadFile, uploadFiles
|
|
33
|
+
}) => Promise<UploadFilesTypeResponse>;
|
|
34
|
+
export { openFile, openFiles, uploadFile, uploadFiles };
|
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
import bridge from '@expressms/smartapp-bridge';
|
|
2
2
|
import { ERROR_CODES, METHODS, } from '../../types';
|
|
3
|
+
const FILE_LOAD_TIMEOUT = 60 * 60 * 1000;
|
|
3
4
|
/**
|
|
4
5
|
* Download and open single file with client
|
|
5
6
|
* @param file File data to be opened
|
|
6
7
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
7
8
|
*/
|
|
8
|
-
const openFile = (file) => {
|
|
9
|
+
const openFile = async (file) => {
|
|
9
10
|
if (!bridge)
|
|
10
11
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
11
|
-
|
|
12
|
+
const response = await bridge.sendClientEvent({
|
|
12
13
|
method: METHODS.OPEN_FILE,
|
|
13
14
|
params: file,
|
|
15
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
14
16
|
});
|
|
17
|
+
return response;
|
|
15
18
|
};
|
|
16
19
|
/**
|
|
17
20
|
* Download file list with client
|
|
18
21
|
* @param files Files list to be opened
|
|
19
22
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
20
23
|
*/
|
|
21
|
-
const openFiles = (files) => {
|
|
24
|
+
const openFiles = async (files) => {
|
|
22
25
|
if (!bridge)
|
|
23
26
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
24
|
-
|
|
27
|
+
const response = await bridge.sendClientEvent({
|
|
25
28
|
method: METHODS.OPEN_FILES,
|
|
26
29
|
params: files,
|
|
30
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
27
31
|
});
|
|
32
|
+
return response;
|
|
28
33
|
};
|
|
29
34
|
/**
|
|
30
35
|
* Upload single file with client
|
|
@@ -32,16 +37,18 @@ const openFiles = (files) => {
|
|
|
32
37
|
* @param maxSize Max file size in bytes
|
|
33
38
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
34
39
|
*/
|
|
35
|
-
const uploadFile = ({ mimeType, maxSize }) => {
|
|
40
|
+
const uploadFile = async ({ mimeType, maxSize, }) => {
|
|
36
41
|
if (!bridge)
|
|
37
42
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
38
|
-
|
|
43
|
+
const response = await bridge.sendClientEvent({
|
|
39
44
|
method: METHODS.UPLOAD_FILE,
|
|
40
45
|
params: {
|
|
41
46
|
type: mimeType,
|
|
42
47
|
maxSize,
|
|
43
48
|
},
|
|
49
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
44
50
|
});
|
|
51
|
+
return response;
|
|
45
52
|
};
|
|
46
53
|
/**
|
|
47
54
|
* Upload files list with client
|
|
@@ -49,16 +56,18 @@ const uploadFile = ({ mimeType, maxSize }) => {
|
|
|
49
56
|
* @param maxSize Max file size in bytes
|
|
50
57
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
51
58
|
*/
|
|
52
|
-
const uploadFiles = ({ mimeType, maxSize }) => {
|
|
59
|
+
const uploadFiles = async ({ mimeType, maxSize, }) => {
|
|
53
60
|
if (!bridge)
|
|
54
61
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
55
|
-
|
|
62
|
+
const response = await bridge.sendClientEvent({
|
|
56
63
|
method: METHODS.UPLOAD_FILES,
|
|
57
64
|
params: {
|
|
58
65
|
type: mimeType,
|
|
59
66
|
maxSize,
|
|
60
67
|
},
|
|
68
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
61
69
|
});
|
|
70
|
+
return response;
|
|
62
71
|
};
|
|
63
|
-
export { openFile, openFiles, uploadFile, uploadFiles
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
export { openFile, openFiles, uploadFile, uploadFiles };
|
|
73
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvY2xpZW50L2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNLE1BQU0sNEJBQTRCLENBQUE7QUFDL0MsT0FBTyxFQUNMLFdBQVcsRUFFWCxPQUFPLEdBSVIsTUFBTSxhQUFhLENBQUE7QUFFcEIsTUFBTSxpQkFBaUIsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLElBQUksQ0FBQTtBQUV4Qzs7OztHQUlHO0FBQ0gsTUFBTSxRQUFRLEdBQUcsS0FBSyxFQUFFLElBQVUsRUFBMkIsRUFBRTtJQUM3RCxJQUFJLENBQUMsTUFBTTtRQUFFLE9BQU8sT0FBTyxDQUFDLE1BQU0sQ0FBQyxXQUFXLENBQUMsU0FBUyxDQUFDLENBQUE7SUFFekQsTUFBTSxRQUFRLEdBQUcsTUFBTSxNQUFNLENBQUMsZUFBZSxDQUFDO1FBQzVDLE1BQU0sRUFBRSxPQUFPLENBQUMsU0FBUztRQUN6QixNQUFNLEVBQUUsSUFBSTtRQUNaLE9BQU8sRUFBRSxpQkFBaUI7S0FDM0IsQ0FBQyxDQUFBO0lBRUYsT0FBTyxRQUEwQixDQUFBO0FBQ25DLENBQUMsQ0FBQTtBQUVEOzs7O0dBSUc7QUFDSCxNQUF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TSxDQUFDLFdBQVcsQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUV6RCxNQUFNLFFBQVEsR0FBRyxNQUFNLE1BQU0sQ0FBQyxlQUFlLENBQUM7UUFDNUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxZQUFZO1FBQzVCLE1BQU0sRUFBRTtZQUNOLElBQUksRUFBRSxRQUFRO1lBQ2QsT0FBTztTQUNSO1FBQ0QsT0FBTyxFQUFFLGlCQUFpQjtLQUMzQixDQUFDLENBQUE7SUFFRixPQUFPLFFBQW1DLENBQUE7QUFDNUMsQ0FBQyxDQUFBO0FBRUQsT0FBTyxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLFdBQVcsRUFBRSxDQUFBIn0=
|
|
@@ -79,7 +79,7 @@ export interface InitialDataProfileAction extends InitialData {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
export interface InitialDataPush extends InitialData {
|
|
82
|
-
initiator: '
|
|
82
|
+
initiator: 'push_notification';
|
|
83
83
|
meta?: object;
|
|
84
84
|
}
|
|
85
85
|
export interface InitialDataDeeplink extends InitialData {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmitterEventPayload } from '@expressms/smartapp-bridge/build/main/types/eventEmitter';
|
|
2
|
-
import { STATUS } from './bridge';
|
|
2
|
+
import { File, STATUS } from './bridge';
|
|
3
3
|
export declare enum SubscriptionEventType {
|
|
4
4
|
CONNECTION_STATUS = "connection_status",
|
|
5
5
|
UNREAD_COUNTER_CHANGE = "unread_counter_change",
|
|
@@ -56,3 +56,19 @@ export type GetLayoutTypeResponse = {
|
|
|
56
56
|
layoutType: "minimal" | "full" | "half";
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
export type UploadFileTypeResponse = {
|
|
60
|
+
ref: string;
|
|
61
|
+
payload: {
|
|
62
|
+
status: STATUS;
|
|
63
|
+
errorCode?: string | null;
|
|
64
|
+
record: File;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type UploadFilesTypeResponse = {
|
|
68
|
+
ref: string;
|
|
69
|
+
payload: {
|
|
70
|
+
status: STATUS;
|
|
71
|
+
errorCode?: string | null;
|
|
72
|
+
records: File[];
|
|
73
|
+
};
|
|
74
|
+
};
|
package/build/umd/index.js
CHANGED
|
@@ -2314,31 +2314,36 @@
|
|
|
2314
2314
|
return response;
|
|
2315
2315
|
};
|
|
2316
2316
|
|
|
2317
|
+
const FILE_LOAD_TIMEOUT = 60 * 60 * 1000;
|
|
2317
2318
|
/**
|
|
2318
2319
|
* Download and open single file with client
|
|
2319
2320
|
* @param file File data to be opened
|
|
2320
2321
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
2321
2322
|
*/
|
|
2322
|
-
const openFile = (file) => {
|
|
2323
|
+
const openFile = async (file) => {
|
|
2323
2324
|
if (!bridge)
|
|
2324
2325
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2325
|
-
|
|
2326
|
+
const response = await bridge.sendClientEvent({
|
|
2326
2327
|
method: METHODS.OPEN_FILE,
|
|
2327
2328
|
params: file,
|
|
2329
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
2328
2330
|
});
|
|
2331
|
+
return response;
|
|
2329
2332
|
};
|
|
2330
2333
|
/**
|
|
2331
2334
|
* Download file list with client
|
|
2332
2335
|
* @param files Files list to be opened
|
|
2333
2336
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
2334
2337
|
*/
|
|
2335
|
-
const openFiles = (files) => {
|
|
2338
|
+
const openFiles = async (files) => {
|
|
2336
2339
|
if (!bridge)
|
|
2337
2340
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2338
|
-
|
|
2341
|
+
const response = await bridge.sendClientEvent({
|
|
2339
2342
|
method: METHODS.OPEN_FILES,
|
|
2340
2343
|
params: files,
|
|
2344
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
2341
2345
|
});
|
|
2346
|
+
return response;
|
|
2342
2347
|
};
|
|
2343
2348
|
/**
|
|
2344
2349
|
* Upload single file with client
|
|
@@ -2346,16 +2351,18 @@
|
|
|
2346
2351
|
* @param maxSize Max file size in bytes
|
|
2347
2352
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
2348
2353
|
*/
|
|
2349
|
-
const uploadFile = ({ mimeType, maxSize }) => {
|
|
2354
|
+
const uploadFile = async ({ mimeType, maxSize, }) => {
|
|
2350
2355
|
if (!bridge)
|
|
2351
2356
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2352
|
-
|
|
2357
|
+
const response = await bridge.sendClientEvent({
|
|
2353
2358
|
method: METHODS.UPLOAD_FILE,
|
|
2354
2359
|
params: {
|
|
2355
2360
|
type: mimeType,
|
|
2356
2361
|
maxSize,
|
|
2357
2362
|
},
|
|
2363
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
2358
2364
|
});
|
|
2365
|
+
return response;
|
|
2359
2366
|
};
|
|
2360
2367
|
/**
|
|
2361
2368
|
* Upload files list with client
|
|
@@ -2363,16 +2370,18 @@
|
|
|
2363
2370
|
* @param maxSize Max file size in bytes
|
|
2364
2371
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
2365
2372
|
*/
|
|
2366
|
-
const uploadFiles = ({ mimeType, maxSize }) => {
|
|
2373
|
+
const uploadFiles = async ({ mimeType, maxSize, }) => {
|
|
2367
2374
|
if (!bridge)
|
|
2368
2375
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2369
|
-
|
|
2376
|
+
const response = await bridge.sendClientEvent({
|
|
2370
2377
|
method: METHODS.UPLOAD_FILES,
|
|
2371
2378
|
params: {
|
|
2372
2379
|
type: mimeType,
|
|
2373
2380
|
maxSize,
|
|
2374
2381
|
},
|
|
2382
|
+
timeout: FILE_LOAD_TIMEOUT,
|
|
2375
2383
|
});
|
|
2384
|
+
return response;
|
|
2376
2385
|
};
|
|
2377
2386
|
|
|
2378
2387
|
const addContact = ({ phone, name }) => {
|