@servicemind.tis/tis-image-and-file-upload-and-view 1.2.20 → 1.2.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.
@@ -24,13 +24,6 @@ export interface TisSocketAdapter {
24
24
  * @param channelName - The channel name to unsubscribe from
25
25
  */
26
26
  unsubscribeFromChannel?(channelName: string): void;
27
- /**
28
- * Send a message via the socket connection
29
- * @param action - The action/route to call
30
- * @param data - The data payload to send
31
- * @returns Observable of the response (optional)
32
- */
33
- callApi?(action: string, data: any): Observable<any>;
34
27
  /**
35
28
  * Get unique device/browser ID for pairing
36
29
  * @returns Device ID string or Promise that resolves to device ID
@@ -45,6 +38,39 @@ export interface TisSocketAdapter {
45
38
  * Observable that emits connection status changes
46
39
  */
47
40
  connectionStatus$: Observable<boolean>;
41
+ /**
42
+ * Get current auth token (for passing to mobile app)
43
+ * @returns Current access token or null
44
+ */
45
+ getAuthToken?(): string | null | Promise<string | null>;
46
+ /**
47
+ * Get current refresh token (for passing to mobile app)
48
+ * @returns Current refresh token or null
49
+ */
50
+ getRefreshToken?(): string | null | Promise<string | null>;
51
+ /**
52
+ * Get the WebSocket URL (for passing to mobile app)
53
+ * @returns WebSocket URL string
54
+ */
55
+ getSocketUrl?(): string;
56
+ /**
57
+ * Get the API base URL (for passing to mobile app)
58
+ * @returns API base URL string
59
+ */
60
+ getApiUrl?(): string;
61
+ /**
62
+ * Get the current user ID
63
+ * @returns User ID string
64
+ */
65
+ getUserId?(): string | Promise<string>;
66
+ /**
67
+ * Send a message directly via socket (for handshake and communication)
68
+ * @param message - The message to send { action: string, data: any }
69
+ */
70
+ sendViaSocket?(message: {
71
+ action: string;
72
+ data: any;
73
+ }): void;
48
74
  }
49
75
  /**
50
76
  * Configuration for remote upload feature
@@ -76,15 +102,21 @@ export interface TisRemoteUploadConfig {
76
102
  */
77
103
  export interface TisRemoteUploadApiEndpoints {
78
104
  /**
79
- * Endpoint to generate a pairing code
105
+ * Endpoint to generate a mobile upload link token (UUID)
106
+ * POST request with deviceId, userId, returns { token, expiresAt }
107
+ * Default: {apiUrl}/ease-of-access/mobile-upload-link-token
108
+ */
109
+ generateMobileLinkToken?: string;
110
+ /**
111
+ * Endpoint to generate a pairing code (legacy)
80
112
  * POST request with deviceId, returns { pairingCode, channel, expiresAt }
81
113
  */
82
- generatePairingCode: string;
114
+ generatePairingCode?: string;
83
115
  /**
84
116
  * Endpoint to validate a pairing code (used by mobile)
85
117
  * POST request with pairingCode, returns { valid, deviceId, channel }
86
118
  */
87
- validatePairingCode: string;
119
+ validatePairingCode?: string;
88
120
  /**
89
121
  * Endpoint called by mobile after uploading to notify desktop
90
122
  * POST request with { channel, uploadedFile }
@@ -1,23 +1,50 @@
1
1
  import { OnDestroy } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { HttpClient } from '@angular/common/http';
4
- import { TisRemoteUploadConfig, TisPairingSession, TisRemoteUploadEvent, TisRemoteUploadedFile } from '../interfaces/socket-adapter.interface';
4
+ import { TisRemoteUploadConfig, TisPairingSession, TisRemoteUploadEvent } from '../interfaces/socket-adapter.interface';
5
5
  import * as i0 from "@angular/core";
6
+ /**
7
+ * Mobile connection info stored in localStorage
8
+ */
9
+ interface MobileConnectionInfo {
10
+ mobileDeviceId: string;
11
+ connectedAt: number;
12
+ lastActivity: number;
13
+ }
6
14
  export declare class TisRemoteUploadService implements OnDestroy {
7
15
  private http;
16
+ private static readonly COMPONENT;
17
+ private static readonly MOBILE_CONNECTION_KEY;
8
18
  private destroy$;
9
19
  private channelSubscription;
10
20
  private config;
11
21
  private socketAdapter;
22
+ private deviceId;
23
+ private userId;
24
+ private apiUrl;
25
+ private channelName;
12
26
  private pairingSession$;
13
27
  private connectionStatus$;
28
+ private mobileConnection$;
14
29
  private remoteUpload$;
15
30
  private error$;
16
31
  constructor(http: HttpClient);
17
32
  /**
18
33
  * Configure the remote upload service
19
34
  */
20
- configure(config: TisRemoteUploadConfig): void;
35
+ configure(config: TisRemoteUploadConfig): Promise<void>;
36
+ /**
37
+ * Get desktop device ID
38
+ */
39
+ getDesktopDeviceId(): string;
40
+ /**
41
+ * Get current mobile connection info
42
+ */
43
+ getMobileConnection(): Observable<MobileConnectionInfo | null>;
44
+ /**
45
+ * Get current mobile device ID (if connected)
46
+ */
47
+ getMobileDeviceId(): string | null;
21
48
  /**
22
49
  * Get current pairing session
23
50
  */
@@ -39,49 +66,51 @@ export declare class TisRemoteUploadService implements OnDestroy {
39
66
  */
40
67
  isAvailable(): boolean;
41
68
  /**
42
- * Check if currently paired with a mobile device
69
+ * Check if currently connected to a mobile device
70
+ */
71
+ isConnectedToMobile(): boolean;
72
+ /**
73
+ * Alias for isConnectedToMobile - Check if paired with mobile
43
74
  */
44
75
  isPaired(): boolean;
45
76
  /**
46
- * Generate a new pairing code and QR data
77
+ * Generate QR code data for mobile app
78
+ * Flow:
79
+ * 1. Call API to get a short-lived link token (UUID)
80
+ * 2. Build QR URL with: apiUrl, deviceId, userId, token
47
81
  */
48
- generatePairingCode(): Promise<{
82
+ generateQrCode(): Promise<{
49
83
  qrData: string;
50
- pairingCode: string;
51
84
  expiresAt: number;
52
85
  }>;
53
86
  /**
54
- * Validate a pairing code (used by mobile app)
87
+ * Build QR URL with minimal parameters
55
88
  */
56
- validatePairingCode(pairingCode: string): Promise<{
57
- valid: boolean;
58
- desktopDeviceId?: string;
59
- channel?: string;
60
- }>;
89
+ private buildQrUrl;
61
90
  /**
62
- * Disconnect and clear pairing
91
+ * Send message to mobile device
63
92
  */
64
- disconnect(): void;
93
+ sendToMobile(type: string, data: any): void;
65
94
  /**
66
- * Notify desktop about uploaded file (called by mobile)
95
+ * Accept mobile connection (send SUCCESS response)
67
96
  */
68
- notifyUpload(channel: string, uploadedFile: TisRemoteUploadedFile, sessionId?: string): Promise<void>;
97
+ private acceptMobileConnection;
69
98
  /**
70
- * Get device ID from socket adapter
99
+ * Disconnect from mobile device
71
100
  */
72
- private getDeviceId;
101
+ disconnect(): void;
73
102
  /**
74
- * Subscribe to a channel for receiving remote upload messages
103
+ * Subscribe to channel for receiving messages from mobile
75
104
  */
76
105
  private subscribeToChannel;
77
106
  /**
78
- * Handle incoming channel messages
107
+ * Handle incoming channel messages from mobile
79
108
  */
80
109
  private handleChannelMessage;
81
110
  /**
82
- * Handle pairing accepted from mobile
111
+ * Handle connection state messages from mobile
83
112
  */
84
- private handlePairingAccepted;
113
+ private handleConnectionState;
85
114
  /**
86
115
  * Handle upload complete from mobile
87
116
  */
@@ -91,26 +120,23 @@ export declare class TisRemoteUploadService implements OnDestroy {
91
120
  */
92
121
  private handleMobileDisconnect;
93
122
  /**
94
- * Call API endpoint
95
- */
96
- private callApi;
97
- /**
98
- * Check if session is expired
123
+ * Save mobile connection to localStorage
99
124
  */
100
- private isSessionExpired;
125
+ private saveMobileConnection;
101
126
  /**
102
- * Save session to localStorage
127
+ * Restore mobile connection from localStorage
103
128
  */
104
- private saveSession;
129
+ private restoreMobileConnection;
105
130
  /**
106
- * Restore session from localStorage
131
+ * Clear mobile connection from localStorage
107
132
  */
108
- private restoreSession;
133
+ private clearMobileConnection;
109
134
  /**
110
- * Clear stored session
135
+ * Call HTTP API endpoint
111
136
  */
112
- private clearStoredSession;
137
+ private callHttpApi;
113
138
  ngOnDestroy(): void;
114
139
  static ɵfac: i0.ɵɵFactoryDeclaration<TisRemoteUploadService, never>;
115
140
  static ɵprov: i0.ɵɵInjectableDeclaration<TisRemoteUploadService>;
116
141
  }
142
+ export {};
@@ -16,7 +16,6 @@ export declare class TisQrCodeDialogComponent implements OnInit, OnDestroy {
16
16
  private remoteUploadService;
17
17
  qrCanvas: ElementRef<HTMLCanvasElement>;
18
18
  qrData: string;
19
- pairingCode: string;
20
19
  expiresAt: number;
21
20
  remainingTime: string;
22
21
  isLoading: boolean;
@@ -25,11 +24,17 @@ export declare class TisQrCodeDialogComponent implements OnInit, OnDestroy {
25
24
  errorMessage: string | null;
26
25
  connectionStatus: 'disconnected' | 'pending' | 'connected';
27
26
  uploadedFiles: TisRemoteUploadEvent[];
27
+ desktopDeviceId: string;
28
+ mobileDeviceId: string | null;
28
29
  private destroy$;
29
30
  private countdownSubscription;
30
31
  constructor(dialogRef: MatDialogRef<TisQrCodeDialogComponent>, data: TisQrCodeDialogData, remoteUploadService: TisRemoteUploadService);
31
32
  ngOnInit(): void;
32
33
  ngOnDestroy(): void;
34
+ /**
35
+ * Check if there's an existing mobile connection
36
+ */
37
+ private checkExistingConnection;
33
38
  private generateQrCode;
34
39
  private subscribeToEvents;
35
40
  private startCountdown;
@@ -41,10 +46,26 @@ export declare class TisQrCodeDialogComponent implements OnInit, OnDestroy {
41
46
  private generateQrCodeOnCanvas;
42
47
  private generatePattern;
43
48
  private drawFinderPattern;
49
+ /**
50
+ * Format device ID for display
51
+ */
52
+ formatDeviceId(id: string | null): string;
53
+ /**
54
+ * Refresh QR code
55
+ */
44
56
  refreshQrCode(): void;
57
+ /**
58
+ * Connect to mobile (show QR if disconnected)
59
+ */
60
+ connectToMobile(): void;
61
+ /**
62
+ * Disconnect from mobile
63
+ */
45
64
  disconnect(): void;
65
+ /**
66
+ * Close dialog
67
+ */
46
68
  close(): void;
47
- copyPairingCode(): void;
48
69
  static ɵfac: i0.ɵɵFactoryDeclaration<TisQrCodeDialogComponent, never>;
49
70
  static ɵcmp: i0.ɵɵComponentDeclaration<TisQrCodeDialogComponent, "tis-qr-code-dialog", never, {}, {}, never, never, false, never>;
50
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicemind.tis/tis-image-and-file-upload-and-view",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.2.0",
6
6
  "@angular/core": "^19.2.0",