@servicemind.tis/tis-image-and-file-upload-and-view 1.2.28 → 1.2.30
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/fesm2022/servicemind.tis-tis-image-and-file-upload-and-view.mjs +431 -87
- package/fesm2022/servicemind.tis-tis-image-and-file-upload-and-view.mjs.map +1 -1
- package/lib/interfaces/socket-adapter.interface.d.ts +6 -0
- package/lib/services/tis-remote-upload.service.d.ts +108 -5
- package/lib/tis-image-and-file-upload-and-view/tis-image-and-file-upload-and-view.component.d.ts +21 -3
- package/lib/tis-qr-code-dialog/tis-qr-code-dialog.component.d.ts +21 -5
- package/package.json +1 -1
|
@@ -103,6 +103,12 @@ export interface TisRemoteUploadConfig {
|
|
|
103
103
|
* Pairing configuration
|
|
104
104
|
*/
|
|
105
105
|
pairing?: TisPairingConfig;
|
|
106
|
+
/**
|
|
107
|
+
* Callback when user accepts a file from mobile upload
|
|
108
|
+
* This allows the host app to handle the accepted file (e.g., patch a form)
|
|
109
|
+
* @param file - The accepted file data
|
|
110
|
+
*/
|
|
111
|
+
onFileAccept?: (file: TisRemoteUploadedFile) => void;
|
|
106
112
|
}
|
|
107
113
|
/**
|
|
108
114
|
* API endpoints configuration for remote upload
|
|
@@ -11,12 +11,47 @@ interface MobileConnectionInfo {
|
|
|
11
11
|
connectedAt: number;
|
|
12
12
|
lastActivity: number;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Field request info for tracking current upload request
|
|
16
|
+
*/
|
|
17
|
+
export interface FieldRequestInfo {
|
|
18
|
+
label: string;
|
|
19
|
+
accept: string;
|
|
20
|
+
type: 'image' | 'file';
|
|
21
|
+
entityType?: string;
|
|
22
|
+
entityId?: any;
|
|
23
|
+
isMultiple?: boolean;
|
|
24
|
+
limit?: number;
|
|
25
|
+
remainingSlots?: number;
|
|
26
|
+
isCompressed?: boolean;
|
|
27
|
+
requestId?: string;
|
|
28
|
+
requestedAt: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Device online status from health check API
|
|
32
|
+
*/
|
|
33
|
+
export interface DeviceOnlineStatus {
|
|
34
|
+
isOnline: boolean;
|
|
35
|
+
deviceId: string;
|
|
36
|
+
lastPing?: number;
|
|
37
|
+
connectionId?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Combined device status for both desktop and mobile
|
|
41
|
+
*/
|
|
42
|
+
export interface DevicesOnlineStatus {
|
|
43
|
+
desktop: DeviceOnlineStatus;
|
|
44
|
+
mobile: DeviceOnlineStatus;
|
|
45
|
+
lastChecked: number;
|
|
46
|
+
isReadyForTransfer: boolean;
|
|
47
|
+
}
|
|
14
48
|
export declare class TisRemoteUploadService implements OnDestroy {
|
|
15
49
|
private http;
|
|
16
50
|
private static readonly COMPONENT;
|
|
17
51
|
private static readonly MOBILE_CONNECTION_KEY;
|
|
18
52
|
private destroy$;
|
|
19
53
|
private channelSubscription;
|
|
54
|
+
private healthCheckSubscription;
|
|
20
55
|
private config;
|
|
21
56
|
private socketAdapter;
|
|
22
57
|
private deviceId;
|
|
@@ -28,6 +63,11 @@ export declare class TisRemoteUploadService implements OnDestroy {
|
|
|
28
63
|
private mobileConnection$;
|
|
29
64
|
private remoteUpload$;
|
|
30
65
|
private error$;
|
|
66
|
+
private pendingFiles$;
|
|
67
|
+
private isWaitingForUpload$;
|
|
68
|
+
private currentFieldRequest$;
|
|
69
|
+
private devicesStatus$;
|
|
70
|
+
private isCheckingStatus$;
|
|
31
71
|
constructor(http: HttpClient);
|
|
32
72
|
/**
|
|
33
73
|
* Configure the remote upload service
|
|
@@ -73,6 +113,50 @@ export declare class TisRemoteUploadService implements OnDestroy {
|
|
|
73
113
|
* Alias for isConnectedToMobile - Check if paired with mobile
|
|
74
114
|
*/
|
|
75
115
|
isPaired(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Get devices online status (both desktop and mobile)
|
|
118
|
+
*/
|
|
119
|
+
getDevicesStatus(): Observable<DevicesOnlineStatus | null>;
|
|
120
|
+
/**
|
|
121
|
+
* Get current devices status value
|
|
122
|
+
*/
|
|
123
|
+
getDevicesStatusValue(): DevicesOnlineStatus | null;
|
|
124
|
+
/**
|
|
125
|
+
* Check if currently verifying connection status (for blinking indicator)
|
|
126
|
+
*/
|
|
127
|
+
getIsCheckingStatus(): Observable<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Check if both devices are online and ready for transfer
|
|
130
|
+
*/
|
|
131
|
+
isReadyForTransfer(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Get pending files from mobile (waiting to be accepted/rejected)
|
|
134
|
+
*/
|
|
135
|
+
getPendingFiles(): Observable<TisRemoteUploadEvent[]>;
|
|
136
|
+
/**
|
|
137
|
+
* Get current pending files value
|
|
138
|
+
*/
|
|
139
|
+
getPendingFilesValue(): TisRemoteUploadEvent[];
|
|
140
|
+
/**
|
|
141
|
+
* Check if waiting for mobile upload
|
|
142
|
+
*/
|
|
143
|
+
getIsWaitingForUpload(): Observable<boolean>;
|
|
144
|
+
/**
|
|
145
|
+
* Get current field request info
|
|
146
|
+
*/
|
|
147
|
+
getCurrentFieldRequest(): Observable<FieldRequestInfo | null>;
|
|
148
|
+
/**
|
|
149
|
+
* Accept a pending file (emit to remoteUpload$ and call onFileAccept callback)
|
|
150
|
+
*/
|
|
151
|
+
acceptPendingFile(file: TisRemoteUploadEvent): void;
|
|
152
|
+
/**
|
|
153
|
+
* Reject/delete a pending file
|
|
154
|
+
*/
|
|
155
|
+
rejectPendingFile(file: TisRemoteUploadEvent): void;
|
|
156
|
+
/**
|
|
157
|
+
* Clear all pending files
|
|
158
|
+
*/
|
|
159
|
+
clearPendingFiles(): void;
|
|
76
160
|
/**
|
|
77
161
|
* Generate QR code data for mobile app
|
|
78
162
|
* Flow:
|
|
@@ -88,9 +172,9 @@ export declare class TisRemoteUploadService implements OnDestroy {
|
|
|
88
172
|
*/
|
|
89
173
|
private buildQrUrl;
|
|
90
174
|
/**
|
|
91
|
-
*
|
|
175
|
+
* Call API via socket with timeout - helper method
|
|
92
176
|
*/
|
|
93
|
-
|
|
177
|
+
private callApiWithTimeout;
|
|
94
178
|
/**
|
|
95
179
|
* Send field request to mobile - tells mobile to show upload UI for this field
|
|
96
180
|
*/
|
|
@@ -104,13 +188,14 @@ export declare class TisRemoteUploadService implements OnDestroy {
|
|
|
104
188
|
limit?: number;
|
|
105
189
|
remainingSlots?: number;
|
|
106
190
|
isCompressed?: boolean;
|
|
107
|
-
}): void
|
|
191
|
+
}): Promise<void>;
|
|
108
192
|
/**
|
|
109
193
|
* Cancel current field request
|
|
110
194
|
*/
|
|
111
|
-
cancelFieldRequest(): void
|
|
195
|
+
cancelFieldRequest(): Promise<void>;
|
|
112
196
|
/**
|
|
113
|
-
* Accept mobile connection
|
|
197
|
+
* Accept mobile connection - update local state
|
|
198
|
+
* Note: Backend already broadcasts mobile-link-established to both parties
|
|
114
199
|
*/
|
|
115
200
|
private acceptMobileConnection;
|
|
116
201
|
/**
|
|
@@ -121,6 +206,23 @@ export declare class TisRemoteUploadService implements OnDestroy {
|
|
|
121
206
|
* Handle disconnect initiated from remote (mobile) side
|
|
122
207
|
*/
|
|
123
208
|
private handleRemoteDisconnect;
|
|
209
|
+
/**
|
|
210
|
+
* Start periodic health check for device online status
|
|
211
|
+
* Should be called when connection is established
|
|
212
|
+
*/
|
|
213
|
+
startHealthCheck(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Stop health check
|
|
216
|
+
*/
|
|
217
|
+
stopHealthCheck(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Check if both devices are online via API
|
|
220
|
+
*/
|
|
221
|
+
checkDevicesOnline(): Promise<DevicesOnlineStatus | null>;
|
|
222
|
+
/**
|
|
223
|
+
* Force an immediate health check
|
|
224
|
+
*/
|
|
225
|
+
refreshDevicesStatus(): Promise<DevicesOnlineStatus | null>;
|
|
124
226
|
/**
|
|
125
227
|
* Subscribe to channel for receiving messages from mobile
|
|
126
228
|
*/
|
|
@@ -140,6 +242,7 @@ export declare class TisRemoteUploadService implements OnDestroy {
|
|
|
140
242
|
private handleConnectionState;
|
|
141
243
|
/**
|
|
142
244
|
* Handle upload complete from mobile
|
|
245
|
+
* Files are added to pending queue for user to accept/reject
|
|
143
246
|
*/
|
|
144
247
|
private handleUploadComplete;
|
|
145
248
|
/**
|
package/lib/tis-image-and-file-upload-and-view/tis-image-and-file-upload-and-view.component.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare class TisImageAndFileUploadAndViewComponent implements OnDestroy
|
|
|
52
52
|
isTab: boolean;
|
|
53
53
|
isWaitingForMobileUpload: boolean;
|
|
54
54
|
mobileUploadFieldLabel: string;
|
|
55
|
+
pendingFiles: TisRemoteUploadEvent[];
|
|
55
56
|
isHandset$: Observable<boolean>;
|
|
56
57
|
isTab$: Observable<boolean>;
|
|
57
58
|
config: Config;
|
|
@@ -140,15 +141,32 @@ export declare class TisImageAndFileUploadAndViewComponent implements OnDestroy
|
|
|
140
141
|
/**
|
|
141
142
|
* Disconnect from paired mobile device
|
|
142
143
|
*/
|
|
143
|
-
disconnectRemote(): void
|
|
144
|
+
disconnectRemote(): Promise<void>;
|
|
144
145
|
/**
|
|
145
146
|
* Trigger upload from mobile - sends field request to mobile app
|
|
146
147
|
*/
|
|
147
|
-
triggerMobileUpload(): void
|
|
148
|
+
triggerMobileUpload(): Promise<void>;
|
|
148
149
|
/**
|
|
149
150
|
* Cancel waiting for mobile upload
|
|
150
151
|
*/
|
|
151
|
-
cancelMobileUpload(): void
|
|
152
|
+
cancelMobileUpload(): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Accept a pending file from mobile upload
|
|
155
|
+
* This calls the onFileAccept callback if provided, then handles the file
|
|
156
|
+
*/
|
|
157
|
+
acceptPendingFile(pendingFile: TisRemoteUploadEvent): void;
|
|
158
|
+
/**
|
|
159
|
+
* Reject a pending file from mobile upload
|
|
160
|
+
*/
|
|
161
|
+
rejectPendingFile(pendingFile: TisRemoteUploadEvent): void;
|
|
162
|
+
/**
|
|
163
|
+
* Open dialog showing connection status with disconnect option
|
|
164
|
+
*/
|
|
165
|
+
openViewConnectionDialog(): void;
|
|
166
|
+
/**
|
|
167
|
+
* Check if a MIME type is an image type
|
|
168
|
+
*/
|
|
169
|
+
isImageMimeType(mimeType: string | undefined): boolean;
|
|
152
170
|
ngOnDestroy(): void;
|
|
153
171
|
static ɵfac: i0.ɵɵFactoryDeclaration<TisImageAndFileUploadAndViewComponent, never>;
|
|
154
172
|
static ɵcmp: i0.ɵɵComponentDeclaration<TisImageAndFileUploadAndViewComponent, "tis-image-and-file-upload-and-view", never, { "urlConfig": { "alias": "urlConfig"; "required": true; }; "entityType": { "alias": "entityType"; "required": false; }; "entityId": { "alias": "entityId"; "required": false; }; "viewType": { "alias": "viewType"; "required": false; }; "type": { "alias": "type"; "required": false; }; "label": { "alias": "label"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "data": { "alias": "data"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "isValidateMimeType": { "alias": "isValidateMimeType"; "required": false; }; "selectedId": { "alias": "selectedId"; "required": false; }; "options": { "alias": "options"; "required": false; }; "required": { "alias": "required"; "required": false; }; "previewOnly": { "alias": "previewOnly"; "required": false; }; "previewInFlex": { "alias": "previewInFlex"; "required": false; }; "imageItemClass": { "alias": "imageItemClass"; "required": false; }; "isAddUploadedFileInLastNode": { "alias": "isAddUploadedFileInLastNode"; "required": false; }; "isEnableDeleteConfirmation": { "alias": "isEnableDeleteConfirmation"; "required": false; }; "isEnableCapture": { "alias": "isEnableCapture"; "required": false; }; "deleteConfirmationMsg": { "alias": "deleteConfirmationMsg"; "required": false; }; "dialogConfig": { "alias": "dialogConfig"; "required": false; }; "remoteUploadConfig": { "alias": "remoteUploadConfig"; "required": false; }; "isShowImageSequence": { "alias": "isShowImageSequence"; "required": false; }; "enableDragNDrop": { "alias": "enableDragNDrop"; "required": false; }; "showDeleteButtonWhenDisabled": { "alias": "showDeleteButtonWhenDisabled"; "required": false; }; }, { "uploadInProgress": "uploadInProgress"; "onUploaded": "onUploaded"; "onFileSelect": "onFileSelect"; "onFileRemoved": "onFileRemoved"; "onError": "onError"; "onRemoteUpload": "onRemoteUpload"; "dataSequenceChange": "dataSequenceChange"; }, never, never, false, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { MatDialogRef } from '@angular/material/dialog';
|
|
3
|
-
import { TisRemoteUploadService } from '../services/tis-remote-upload.service';
|
|
3
|
+
import { TisRemoteUploadService, DevicesOnlineStatus } from '../services/tis-remote-upload.service';
|
|
4
4
|
import { TisRemoteUploadEvent } from '../interfaces/socket-adapter.interface';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export interface FieldInfo {
|
|
@@ -36,6 +36,8 @@ export declare class TisQrCodeDialogComponent implements OnInit, OnDestroy {
|
|
|
36
36
|
uploadedFiles: TisRemoteUploadEvent[];
|
|
37
37
|
desktopDeviceId: string;
|
|
38
38
|
mobileDeviceId: string | null;
|
|
39
|
+
devicesStatus: DevicesOnlineStatus | null;
|
|
40
|
+
isCheckingStatus: boolean;
|
|
39
41
|
private destroy$;
|
|
40
42
|
private countdownSubscription;
|
|
41
43
|
constructor(dialogRef: MatDialogRef<TisQrCodeDialogComponent>, data: TisQrCodeDialogData, remoteUploadService: TisRemoteUploadService);
|
|
@@ -47,10 +49,6 @@ export declare class TisQrCodeDialogComponent implements OnInit, OnDestroy {
|
|
|
47
49
|
private checkExistingConnection;
|
|
48
50
|
private generateQrCode;
|
|
49
51
|
private subscribeToEvents;
|
|
50
|
-
/**
|
|
51
|
-
* Send field configuration to mobile device
|
|
52
|
-
*/
|
|
53
|
-
private sendFieldInfoToMobile;
|
|
54
52
|
private startCountdown;
|
|
55
53
|
/**
|
|
56
54
|
* Format device ID for display
|
|
@@ -68,6 +66,24 @@ export declare class TisQrCodeDialogComponent implements OnInit, OnDestroy {
|
|
|
68
66
|
* Disconnect from mobile
|
|
69
67
|
*/
|
|
70
68
|
disconnect(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Refresh device status
|
|
71
|
+
*/
|
|
72
|
+
refreshStatus(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Get desktop online status indicator class
|
|
75
|
+
* Returns: 'online' (green), 'offline' (red), 'checking' (blinking yellow)
|
|
76
|
+
*/
|
|
77
|
+
getDesktopStatusClass(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Get mobile online status indicator class
|
|
80
|
+
* Returns: 'online' (green), 'offline' (red), 'checking' (blinking yellow)
|
|
81
|
+
*/
|
|
82
|
+
getMobileStatusClass(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Check if ready for transfer (both devices online)
|
|
85
|
+
*/
|
|
86
|
+
isReadyForTransfer(): boolean;
|
|
71
87
|
/**
|
|
72
88
|
* Close dialog
|
|
73
89
|
*/
|