@servicemind.tis/tis-image-and-file-upload-and-view 1.2.36 → 1.2.37

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.
@@ -1105,7 +1105,7 @@ class TisRemoteUploadService {
1105
1105
  }
1106
1106
  /**
1107
1107
  * Handle upload complete from mobile
1108
- * Files are added to pending queue for user to accept/reject
1108
+ * Files are either auto-accepted or added to pending queue based on config
1109
1109
  */
1110
1110
  handleUploadComplete(message) {
1111
1111
  const data = message.data || message.payload || message;
@@ -1116,7 +1116,7 @@ class TisRemoteUploadService {
1116
1116
  // Normalize the file object
1117
1117
  const normalizedFile = {
1118
1118
  s3Url: file.s3Url || file.resourceUrl || file.uploadData?.resourceUrl || '',
1119
- fileName: file.fileName || file.filename || file.name || file.title || 'unknown',
1119
+ fileName: file.fileName || file.filename || file.name || file.title || file.uploadData?.fileName || file.uploadData?.photoFilename || 'unknown',
1120
1120
  mimeType: file.mimeType || file.type || 'application/octet-stream',
1121
1121
  size: file.size || 0,
1122
1122
  thumbnailUrl: file.thumbnailUrl,
@@ -1129,10 +1129,26 @@ class TisRemoteUploadService {
1129
1129
  timestamp: data.timestamp || Date.now(),
1130
1130
  sessionId: data.sessionId
1131
1131
  };
1132
- // Add to pending files (user will accept/reject)
1133
- const currentPending = this.pendingFiles$.value;
1134
- this.pendingFiles$.next([...currentPending, event]);
1135
- console.log(`[${TisRemoteUploadService.COMPONENT}] File added to pending:`, normalizedFile.fileName);
1132
+ // Check if auto-accept is enabled
1133
+ if (this.config?.autoAcceptFiles) {
1134
+ // Auto-accept: emit to remoteUpload$ (component will show in UI and attach to form)
1135
+ this.remoteUpload$.next(event);
1136
+ console.log(`[${TisRemoteUploadService.COMPONENT}] File auto-accepted (showing in UI):`, normalizedFile.fileName);
1137
+ // Call onFileAccept callback if provided
1138
+ if (this.config?.onFileAccept) {
1139
+ this.config.onFileAccept(normalizedFile);
1140
+ }
1141
+ }
1142
+ else {
1143
+ // Auto-accept OFF: Only call callback, don't show in UI or attach to form
1144
+ console.log(`[${TisRemoteUploadService.COMPONENT}] File received (not auto-accepting, callback only):`, normalizedFile.fileName);
1145
+ // Call onFileAccept callback if provided (host app handles display/processing)
1146
+ if (this.config?.onFileAccept) {
1147
+ this.config.onFileAccept(normalizedFile);
1148
+ }
1149
+ // Note: File is NOT added to pending queue or emitted to remoteUpload$
1150
+ // The host app's onFileAccept callback is responsible for handling the file
1151
+ }
1136
1152
  }
1137
1153
  }
1138
1154
  // Update last activity