cat-documents-ng 0.4.9 → 0.4.10

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.
@@ -3739,6 +3739,9 @@ class DocumentUploadComponent {
3739
3739
  this.onFilesUploaded.emit([...this.uploadedFiles]);
3740
3740
  }
3741
3741
  else {
3742
+ // When form is not hidden, emit the structured payload format
3743
+ const payload = this.createUploadPayload();
3744
+ this.onFilesUploaded.emit(payload);
3742
3745
  this.onFormValidationChange.emit();
3743
3746
  }
3744
3747
  }
@@ -3790,6 +3793,26 @@ class DocumentUploadComponent {
3790
3793
  getUploadedFiles() {
3791
3794
  return [...this.uploadedFiles];
3792
3795
  }
3796
+ /**
3797
+ * Creates the upload payload in the required format for onFilesUploaded event
3798
+ * @returns The structured payload object
3799
+ */
3800
+ createUploadPayload() {
3801
+ const contextId = this.selectedApplicant || this.contextId;
3802
+ return {
3803
+ source: this.selectedAssignmentType || "Application",
3804
+ categoryId: this.selectedCategory,
3805
+ documentTypeId: this.selectedDocumentType,
3806
+ contextId: contextId,
3807
+ documents: this.uploadedFiles.map(file => ({
3808
+ fileName: file.file.name,
3809
+ fileSize: file.file.size,
3810
+ url: file.url,
3811
+ contentType: file.contentType,
3812
+ uploadedFileId: file.uploadResponse?.id || file.uploadResponse?.fileName || file.file.name
3813
+ }))
3814
+ };
3815
+ }
3793
3816
  /**
3794
3817
  * Resets the upload component to its initial state (useful when form is hidden)
3795
3818
  */