cat-documents-ng 0.4.8 → 0.4.9

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.
@@ -4,7 +4,7 @@ import * as i5 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { firstValueFrom, EMPTY, tap, catchError, throwError, of, combineLatest, Subject, Observable, takeUntil, Subscription, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, BehaviorSubject } from 'rxjs';
6
6
  import * as i2 from '@angular/common/http';
7
- import { HttpHeaders, HttpParams, HttpClientModule } from '@angular/common/http';
7
+ import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
8
8
  import { __decorate } from 'tslib';
9
9
  import { EntityStore, StoreConfig, QueryEntity } from '@datorama/akita';
10
10
  import { debounceTime, distinctUntilChanged, switchMap, map, catchError as catchError$1 } from 'rxjs/operators';
@@ -1423,12 +1423,7 @@ class DocumentHttpService {
1423
1423
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
1424
1424
  */
1425
1425
  getDocumentCatagories(contextId) {
1426
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1427
- return this.http.get(`${this.apiUrl}${URLS.DOCUMENTS_CATAGORIES}/${contextId}`, {
1428
- headers: new HttpHeaders({
1429
- 'Authorization': Authorization
1430
- })
1431
- })
1426
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENTS_CATAGORIES}/${contextId}`)
1432
1427
  .pipe(tap((response) => {
1433
1428
  if (response && response.categories) {
1434
1429
  this.documentStore.setDocumentCategories(response.categories);
@@ -1458,12 +1453,7 @@ class DocumentHttpService {
1458
1453
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
1459
1454
  */
1460
1455
  getAlertsByDocumentID(documentId) {
1461
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1462
- return this.http.get(`${this.apiUrl}${URLS.ALERT_BY_DOCUMENT_ID}${documentId}`, {
1463
- headers: new HttpHeaders({
1464
- 'Authorization': Authorization
1465
- })
1466
- }).pipe(tap((documentAlert) => {
1456
+ return this.http.get(`${this.apiUrl}${URLS.ALERT_BY_DOCUMENT_ID}${documentId}`).pipe(tap((documentAlert) => {
1467
1457
  this.documentStore.setDocumentAlert(documentAlert);
1468
1458
  }), catchError((error) => {
1469
1459
  return throwError(() => new Error(error));
@@ -1476,12 +1466,7 @@ class DocumentHttpService {
1476
1466
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
1477
1467
  */
1478
1468
  getDocumentByFolderID(folderId, contextId) {
1479
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1480
- return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.PARENT_DOCUMENT_TYPE_ID}${folderId}${URLS.CONTEXT_ID}${contextId}`, {
1481
- headers: new HttpHeaders({
1482
- 'Authorization': Authorization
1483
- })
1484
- }).pipe(tap((records) => {
1469
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.PARENT_DOCUMENT_TYPE_ID}${folderId}${URLS.CONTEXT_ID}${contextId}`).pipe(tap((records) => {
1485
1470
  this.documentStore.set(records);
1486
1471
  }), catchError((error) => {
1487
1472
  return throwError(() => new Error(error));
@@ -1496,12 +1481,7 @@ class DocumentHttpService {
1496
1481
  * @returns {Observable<DocumentModel>} An observable that emits the updated DocumentModel.
1497
1482
  */
1498
1483
  updateDocumentName(documentId, payload) {
1499
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1500
- return this.http.put(`${this.apiUrl}${URLS.ALIAS_NAME}${documentId}`, payload, {
1501
- headers: new HttpHeaders({
1502
- 'Authorization': Authorization
1503
- })
1504
- }).pipe(catchError((error) => {
1484
+ return this.http.put(`${this.apiUrl}${URLS.ALIAS_NAME}${documentId}`, payload).pipe(catchError((error) => {
1505
1485
  return throwError(() => new Error(error));
1506
1486
  }));
1507
1487
  }
@@ -1513,12 +1493,7 @@ class DocumentHttpService {
1513
1493
  getUserListByContextId(contextId) {
1514
1494
  if (!contextId)
1515
1495
  return EMPTY;
1516
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1517
- return this.http.get(`${this.apiUrl}${URLS.USERLIST}${contextId}`, {
1518
- headers: new HttpHeaders({
1519
- 'Authorization': Authorization
1520
- })
1521
- }).pipe(tap((userList) => {
1496
+ return this.http.get(`${this.apiUrl}${URLS.USERLIST}${contextId}`).pipe(tap((userList) => {
1522
1497
  this.documentStore.setUserList(userList);
1523
1498
  }), catchError((error) => {
1524
1499
  return throwError(() => new Error(error));
@@ -1527,29 +1502,23 @@ class DocumentHttpService {
1527
1502
  /**
1528
1503
  * Fetches document status count data by application ID with optional context ID and category parameters.
1529
1504
  * @param {string} applicationId - The application ID to fetch status data.
1530
- * @param {string | null} contextId - The context ID (applicant ID) to filter by. If null, omitted from query.
1531
- * @param {string | null} categoryId - The category ID to filter by. If null, omitted from query.
1505
+ * @param {string | null} contextId - The context ID (applicant ID) to filter by. If null, uses applicationId.
1506
+ * @param {string | null} categoryId - The category ID to filter by.
1532
1507
  * @returns {Observable<StatusDataModel[]>} Observable that emits the status data.
1533
1508
  */
1534
1509
  getStatusDocumentCount(applicationId, contextId = null, categoryId = null) {
1535
1510
  if (!applicationId)
1536
1511
  return EMPTY;
1537
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1538
- // Build query parameters, only adding non-null values
1512
+ let url = `${this.apiUrl}${URLS.STATUS_DOCUMENT_COUNT}${applicationId}`;
1539
1513
  let params = new HttpParams();
1540
- if (contextId !== null && contextId !== undefined) {
1541
- params = params.set('contextId', contextId);
1542
- }
1543
- if (categoryId !== null && categoryId !== undefined) {
1544
- params = params.set('categoryId', categoryId);
1545
- }
1546
- const url = `${this.apiUrl}${URLS.STATUS_DOCUMENT_COUNT}${applicationId}`;
1547
- return this.http.get(url, {
1548
- headers: new HttpHeaders({
1549
- 'Authorization': Authorization
1550
- }),
1551
- params: params
1552
- }).pipe(tap((statusData) => {
1514
+ const contextParam = contextId || null;
1515
+ if (contextParam) {
1516
+ params = params.set(SHARED.CONTEXT_ID, contextParam);
1517
+ }
1518
+ if (categoryId) {
1519
+ params = params.set(SHARED.CATEGORY, categoryId);
1520
+ }
1521
+ return this.http.get(url, { params }).pipe(tap((statusData) => {
1553
1522
  this.documentStore.setStatusData(statusData);
1554
1523
  }), catchError((error) => {
1555
1524
  return throwError(() => new Error(error));
@@ -1567,7 +1536,6 @@ class DocumentHttpService {
1567
1536
  * @returns {Observable<any>} An observable that emits the filtered document data.
1568
1537
  */
1569
1538
  getDocumentsBySelection(contextId, menuItem, userId, status, searchKey = null) {
1570
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1571
1539
  let params = new HttpParams();
1572
1540
  if (userId) {
1573
1541
  params = params.set(SHARED.CONTEXT_ID, userId);
@@ -1578,9 +1546,7 @@ class DocumentHttpService {
1578
1546
  if (searchKey) {
1579
1547
  params = params.set(SHARED.SEARCH_KEY, searchKey);
1580
1548
  }
1581
- return this.http.get(`${this.apiUrl}${URLS.GETALL}/${contextId}`, { params, headers: new HttpHeaders({
1582
- 'Authorization': Authorization
1583
- }) }).pipe(tap((response) => {
1549
+ return this.http.get(`${this.apiUrl}${URLS.GETALL}/${contextId}`, { params }).pipe(tap((response) => {
1584
1550
  if (response.documents) {
1585
1551
  this.documentStore.setDocumentList(response.documents);
1586
1552
  }
@@ -1589,13 +1555,10 @@ class DocumentHttpService {
1589
1555
  }));
1590
1556
  }
1591
1557
  getDocumentHistory(documentId) {
1592
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1593
1558
  if (!documentId) {
1594
1559
  return of([]);
1595
1560
  }
1596
- return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_HISTORY}${documentId}`, { headers: new HttpHeaders({
1597
- 'Authorization': Authorization
1598
- }) }).pipe(catchError((error) => {
1561
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_HISTORY}${documentId}`).pipe(catchError((error) => {
1599
1562
  return throwError(() => new Error(error));
1600
1563
  }));
1601
1564
  }
@@ -1605,12 +1568,9 @@ class DocumentHttpService {
1605
1568
  * @returns {Observable<DocumentCategory[]>} Observable that emits the categories.
1606
1569
  */
1607
1570
  getCategoriesBySource(source) {
1608
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1609
1571
  if (!source)
1610
1572
  return EMPTY;
1611
- return this.http.get(`${this.apiUrl}${URLS.GET_CATEGORIES_BY_SOURCE}${source}`, { headers: new HttpHeaders({
1612
- 'Authorization': Authorization
1613
- }) }).pipe(catchError((error) => {
1573
+ return this.http.get(`${this.apiUrl}${URLS.GET_CATEGORIES_BY_SOURCE}${source}`).pipe(catchError((error) => {
1614
1574
  return throwError(() => new Error(error));
1615
1575
  }));
1616
1576
  }
@@ -1622,10 +1582,7 @@ class DocumentHttpService {
1622
1582
  getDocumentTypesByCategory(categoryId) {
1623
1583
  if (!categoryId)
1624
1584
  return EMPTY;
1625
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1626
- return this.http.get(`${this.apiUrl}${URLS.GET_DOCUMENT_TYPES_BY_CATEGORY}${categoryId}`, { headers: new HttpHeaders({
1627
- 'Authorization': Authorization
1628
- }) }).pipe(catchError((error) => {
1585
+ return this.http.get(`${this.apiUrl}${URLS.GET_DOCUMENT_TYPES_BY_CATEGORY}${categoryId}`).pipe(catchError((error) => {
1629
1586
  return throwError(() => new Error(error));
1630
1587
  }));
1631
1588
  }
@@ -1635,10 +1592,7 @@ class DocumentHttpService {
1635
1592
  * @returns {Observable<any>} Observable that emits the upload response.
1636
1593
  */
1637
1594
  uploadFile(formData) {
1638
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1639
- return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, formData, { headers: new HttpHeaders({
1640
- 'Authorization': Authorization
1641
- }) }).pipe(catchError((error) => {
1595
+ return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, formData).pipe(catchError((error) => {
1642
1596
  return throwError(() => new Error(error));
1643
1597
  }));
1644
1598
  }
@@ -1648,10 +1602,7 @@ class DocumentHttpService {
1648
1602
  * @returns {Observable<any>} Observable that emits the save response.
1649
1603
  */
1650
1604
  saveDocumentUpload(payload) {
1651
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1652
- return this.http.post(`${this.apiUrl}${URLS.SAVE_DOCUMENT_UPLOAD}`, payload, { headers: new HttpHeaders({
1653
- 'Authorization': Authorization
1654
- }) }).pipe(catchError((error) => {
1605
+ return this.http.post(`${this.apiUrl}${URLS.SAVE_DOCUMENT_UPLOAD}`, payload).pipe(catchError((error) => {
1655
1606
  return throwError(() => new Error(error));
1656
1607
  }));
1657
1608
  }
@@ -1666,10 +1617,7 @@ class DocumentHttpService {
1666
1617
  const payload = {
1667
1618
  statusUpdateDescription: statusUpdateDescription
1668
1619
  };
1669
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1670
- return this.http.put(`${this.apiUrl}${URLS.UPDATE_DOCUMENT_STATUS}${documentId}/${status}`, payload, { headers: new HttpHeaders({
1671
- 'Authorization': Authorization
1672
- }) }).pipe(tap((response) => {
1620
+ return this.http.put(`${this.apiUrl}${URLS.UPDATE_DOCUMENT_STATUS}${documentId}/${status}`, payload).pipe(tap((response) => {
1673
1621
  if (response && response.status) {
1674
1622
  const normalizedStatus = this.normalizeStatus(response.status);
1675
1623
  response.normalizedStatus = normalizedStatus;
@@ -1702,10 +1650,7 @@ class DocumentHttpService {
1702
1650
  * @returns {Observable<any>} Observable that emits the delete response
1703
1651
  */
1704
1652
  deleteDocument(documentId, contextId) {
1705
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1706
- return this.http.delete(`${this.apiUrl}${URLS.DELETE_DOCUMENT}${documentId}`, { headers: new HttpHeaders({
1707
- 'Authorization': Authorization
1708
- }) }).pipe(tap(() => {
1653
+ return this.http.delete(`${this.apiUrl}${URLS.DELETE_DOCUMENT}${documentId}`).pipe(tap(() => {
1709
1654
  this.getDocumentCatagories(contextId).subscribe();
1710
1655
  this.getUserListByContextId(contextId).subscribe();
1711
1656
  this.getStatusDocumentCount(contextId).subscribe();
@@ -1721,11 +1666,7 @@ class DocumentHttpService {
1721
1666
  * @returns {Observable<ArrayBuffer>} Observable that emits the file data as ArrayBuffer
1722
1667
  */
1723
1668
  downloadExcelFile(documentUrl) {
1724
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1725
1669
  return this.http.get(documentUrl, {
1726
- headers: new HttpHeaders({
1727
- 'Authorization': Authorization
1728
- }),
1729
1670
  responseType: 'arraybuffer'
1730
1671
  }).pipe(catchError((error) => {
1731
1672
  return throwError(() => new Error(error));
@@ -1738,11 +1679,7 @@ class DocumentHttpService {
1738
1679
  * @returns {Observable<string>} Observable that emits the file data as string
1739
1680
  */
1740
1681
  downloadCsvFile(documentUrl) {
1741
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1742
1682
  return this.http.get(documentUrl, {
1743
- headers: new HttpHeaders({
1744
- 'Authorization': Authorization
1745
- }),
1746
1683
  responseType: 'text'
1747
1684
  }).pipe(catchError((error) => {
1748
1685
  return throwError(() => new Error(error));
@@ -1754,29 +1691,17 @@ class DocumentHttpService {
1754
1691
  * @returns Observable of file content as text
1755
1692
  */
1756
1693
  downloadEmailFile(documentUrl) {
1757
- // Check if it's Azure Blob Storage URL
1758
1694
  const isAzureBlobStorage = documentUrl.includes('.blob.core.windows.net');
1759
1695
  if (isAzureBlobStorage) {
1760
- // For Azure Blob Storage, don't send Authorization header
1761
- // The URL should contain a SAS token or the blob should be publicly accessible
1762
1696
  return this.http.get(documentUrl, {
1763
1697
  responseType: 'text'
1764
1698
  }).pipe(catchError((error) => {
1765
- console.error('Error downloading email from blob storage:', error);
1766
1699
  return throwError(() => new Error('Failed to download email file. Please check if the file URL is valid and accessible.'));
1767
1700
  }));
1768
1701
  }
1769
1702
  else {
1770
- // For other storage types, use Bearer token authentication
1771
- let Authorization = `Bearer fd98f1e1-3c2e-4af0-8b8f-42fabb4c3b8c`;
1772
- return this.http.get(documentUrl, {
1773
- headers: new HttpHeaders({
1774
- 'Authorization': Authorization
1775
- }),
1776
- responseType: 'text'
1777
- }).pipe(catchError((error) => {
1778
- console.error('Error downloading email file:', error);
1779
- return throwError(() => new Error('Failed to download email file. Please check authentication.'));
1703
+ return this.http.get(documentUrl).pipe(catchError((error) => {
1704
+ return throwError(() => new Error('Failed to download email file. Please check if the file URL is valid and accessible.'));
1780
1705
  }));
1781
1706
  }
1782
1707
  }
@@ -10931,5 +10856,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
10931
10856
  * Generated bundle index. Do not edit.
10932
10857
  */
10933
10858
 
10934
- export { COUNTRIES, ConfirmationDialogComponent, CsvParserService, DOCUMENTTYPES, DUMMYDOCUMENTLIST, DUMMYSUMMARY, DUMMY_DOCUMENT_SECTIONS, DocumentActionsComponent, DocumentAlertList, DocumentContainerComponent, DocumentContentTypeService, DocumentContentViewerComponent, DocumentDirective, DocumentHistoryComponent, DocumentListComponent, DocumentModule, DocumentSearchComponent, DocumentTableBuilderService, DocumentUploadComponent, DocumentViewerComponent, DocumentZoomControlsComponent, DocumentZoomService, EmlParserService, ExcelParserService, HasPermissionDirective, OPEN_DOCUMENT_EXTENSIONS, SAMPLE_STATUS_DATA, SHARED, SUPPORTED_IMAGE_TYPES, SharedModule, SidebarComponent, TablePrimaryComponent, USERLIST };
10859
+ export { COUNTRIES, ConfirmationDialogComponent, CsvParserService, DOCUMENTTYPES, DUMMYDOCUMENTLIST, DUMMYSUMMARY, DUMMY_DOCUMENT_SECTIONS, DocumentActionsComponent, DocumentAlertList, DocumentContainerComponent, DocumentContentTypeService, DocumentContentViewerComponent, DocumentDirective, DocumentHistoryComponent, DocumentListComponent, DocumentModule, DocumentSearchComponent, DocumentTableBuilderService, DocumentUploadComponent, DocumentViewerComponent, DocumentZoomControlsComponent, DocumentZoomService, EmlParserService, ExcelParserService, FolderContainerComponent, HasPermissionDirective, OPEN_DOCUMENT_EXTENSIONS, SAMPLE_STATUS_DATA, SHARED, SUPPORTED_IMAGE_TYPES, SharedModule, SidebarComponent, TablePrimaryComponent, USERLIST };
10935
10860
  //# sourceMappingURL=cat-documents-ng.mjs.map