cat-documents-ng 0.3.68 → 0.3.70

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.
@@ -1413,7 +1413,7 @@ class DocumentHttpService {
1413
1413
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
1414
1414
  */
1415
1415
  getDocumentCatagories(contextId) {
1416
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1416
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1417
1417
  return this.http.get(`${this.apiUrl}${URLS.DOCUMENTS_CATAGORIES}/${contextId}`, { headers })
1418
1418
  .pipe(tap((response) => {
1419
1419
  if (response && response.categories) {
@@ -1472,7 +1472,7 @@ class DocumentHttpService {
1472
1472
  * @returns {Observable<DocumentModel>} An observable that emits the updated DocumentModel.
1473
1473
  */
1474
1474
  updateDocumentName(documentId, payload) {
1475
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1475
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1476
1476
  return this.http.put(`${this.apiUrl}${URLS.ALIAS_NAME}${documentId}`, payload, { headers: headers }).pipe(catchError((error) => {
1477
1477
  return throwError(() => new Error(error));
1478
1478
  }));
@@ -1485,7 +1485,7 @@ class DocumentHttpService {
1485
1485
  getUserListByContextId(contextId) {
1486
1486
  if (!contextId)
1487
1487
  return EMPTY;
1488
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1488
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1489
1489
  return this.http.get(`${this.apiUrl}${URLS.USERLIST}${contextId}`, { headers: headers }).pipe(tap((userList) => {
1490
1490
  this.documentStore.setUserList(userList);
1491
1491
  }), catchError((error) => {
@@ -1511,7 +1511,7 @@ class DocumentHttpService {
1511
1511
  if (categoryId) {
1512
1512
  params = params.set(SHARED.CATEGORY, categoryId);
1513
1513
  }
1514
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1514
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1515
1515
  return this.http.get(url, { params, headers }).pipe(tap((statusData) => {
1516
1516
  this.documentStore.setStatusData(statusData);
1517
1517
  }), catchError((error) => {
@@ -1540,7 +1540,7 @@ class DocumentHttpService {
1540
1540
  if (searchKey) {
1541
1541
  params = params.set(SHARED.SEARCH_KEY, searchKey);
1542
1542
  }
1543
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1543
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1544
1544
  return this.http.get(`${this.apiUrl}${URLS.GETALL}/${contextId}`, { params, headers }).pipe(tap((response) => {
1545
1545
  if (response.documents) {
1546
1546
  this.documentStore.setDocumentList(response.documents);
@@ -1553,7 +1553,7 @@ class DocumentHttpService {
1553
1553
  if (!documentId) {
1554
1554
  return of([]);
1555
1555
  }
1556
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1556
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1557
1557
  return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_HISTORY}${documentId}`, { headers }).pipe(catchError((error) => {
1558
1558
  return throwError(() => new Error(error));
1559
1559
  }));
@@ -1566,7 +1566,7 @@ class DocumentHttpService {
1566
1566
  getCategoriesBySource(source) {
1567
1567
  if (!source)
1568
1568
  return EMPTY;
1569
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1569
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1570
1570
  return this.http.get(`${this.apiUrl}${URLS.GET_CATEGORIES_BY_SOURCE}${source}`, { headers }).pipe(catchError((error) => {
1571
1571
  return throwError(() => new Error(error));
1572
1572
  }));
@@ -1579,7 +1579,7 @@ class DocumentHttpService {
1579
1579
  getDocumentTypesByCategory(categoryId) {
1580
1580
  if (!categoryId)
1581
1581
  return EMPTY;
1582
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1582
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1583
1583
  return this.http.get(`${this.apiUrl}${URLS.GET_DOCUMENT_TYPES_BY_CATEGORY}${categoryId}`, { headers }).pipe(catchError((error) => {
1584
1584
  return throwError(() => new Error(error));
1585
1585
  }));
@@ -1590,7 +1590,7 @@ class DocumentHttpService {
1590
1590
  * @returns {Observable<any>} Observable that emits the upload response.
1591
1591
  */
1592
1592
  uploadFile(formData) {
1593
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1593
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1594
1594
  return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, formData, { headers }).pipe(catchError((error) => {
1595
1595
  return throwError(() => new Error(error));
1596
1596
  }));
@@ -1601,7 +1601,7 @@ class DocumentHttpService {
1601
1601
  * @returns {Observable<any>} Observable that emits the save response.
1602
1602
  */
1603
1603
  saveDocumentUpload(payload) {
1604
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1604
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1605
1605
  return this.http.post(`${this.apiUrl}${URLS.SAVE_DOCUMENT_UPLOAD}`, payload, { headers }).pipe(catchError((error) => {
1606
1606
  return throwError(() => new Error(error));
1607
1607
  }));
@@ -1617,7 +1617,7 @@ class DocumentHttpService {
1617
1617
  const payload = {
1618
1618
  statusUpdateDescription: statusUpdateDescription
1619
1619
  };
1620
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1620
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1621
1621
  return this.http.put(`${this.apiUrl}${URLS.UPDATE_DOCUMENT_STATUS}${documentId}/${status}`, payload, { headers }).pipe(tap((response) => {
1622
1622
  if (response && response.status) {
1623
1623
  const normalizedStatus = this.normalizeStatus(response.status);
@@ -1651,7 +1651,7 @@ class DocumentHttpService {
1651
1651
  * @returns {Observable<any>} Observable that emits the delete response
1652
1652
  */
1653
1653
  deleteDocument(documentId, contextId) {
1654
- let headers = new HttpHeaders({ Authorization: 'Bearer 567c2b7f-bb41-4d93-8974-e57853acab12' });
1654
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
1655
1655
  return this.http.delete(`${this.apiUrl}${URLS.DELETE_DOCUMENT}${documentId}`, { headers }).pipe(tap(() => {
1656
1656
  this.getDocumentCatagories(contextId).subscribe();
1657
1657
  this.getUserListByContextId(contextId).subscribe();
@@ -2607,7 +2607,7 @@ class DocumentService {
2607
2607
  * @returns {Observable<any>} Observable that emits the newly created document.
2608
2608
  */
2609
2609
  create(entity) {
2610
- let headers = new HttpHeaders({ Authorization: 'Bearer 525d292d-42c9-4280-be65-caac72727902' });
2610
+ let headers = new HttpHeaders({ Authorization: 'Bearer 0fa14ac8-ea78-4666-b099-eb691653b229' });
2611
2611
  return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, entity, { headers }).pipe(tap((newEntity) => this.documentStore.add(newEntity)));
2612
2612
  }
2613
2613
  /**
@@ -5288,7 +5288,6 @@ class TablePrimaryComponent {
5288
5288
  formatDocumentDisplayName(rowData) {
5289
5289
  let displayName = '';
5290
5290
  if (rowData.aliasName && rowData.aliasName.trim() !== '') {
5291
- // With aliasName: aliasName on top, docName - fileName below
5292
5291
  displayName += `<span class="alias-name">${rowData.aliasName}</span><br>`;
5293
5292
  if (rowData.docName && rowData.fileName) {
5294
5293
  displayName += `<span class="document-info">${rowData.docName} - ${rowData.fileName}</span>`;
@@ -5298,7 +5297,6 @@ class TablePrimaryComponent {
5298
5297
  }
5299
5298
  }
5300
5299
  else {
5301
- // Without aliasName: docName on top, fileName below
5302
5300
  if (rowData.docName) {
5303
5301
  displayName += `<span class="document-info">${rowData.docName}</span>`;
5304
5302
  }
@@ -8862,7 +8860,26 @@ class DocumentsMenuComponent {
8862
8860
  * Maintains the original order as provided by the API
8863
8861
  */
8864
8862
  updateCachedCategories() {
8865
- this._cachedCategories = this.storeCategories.length > 0 ? this.storeCategories : this.catagories;
8863
+ const nextCategories = this.storeCategories.length > 0 ? this.storeCategories : this.catagories;
8864
+ if (!this._cachedCategories || this._cachedCategories.length === 0) {
8865
+ this._cachedCategories = nextCategories;
8866
+ return;
8867
+ }
8868
+ const previousById = new Map();
8869
+ this._cachedCategories.forEach(category => {
8870
+ category.items?.forEach(item => {
8871
+ if (item.isSelectable !== undefined) {
8872
+ previousById.set(item._id, item.isSelectable);
8873
+ }
8874
+ });
8875
+ });
8876
+ this._cachedCategories = nextCategories.map(category => ({
8877
+ ...category,
8878
+ items: category.items?.map(item => ({
8879
+ ...item,
8880
+ isSelectable: previousById.has(item._id) ? previousById.get(item._id) : item.isSelectable
8881
+ }))
8882
+ }));
8866
8883
  }
8867
8884
  /**
8868
8885
  * Finds the label of a menu item by its _id
@@ -8939,19 +8956,12 @@ class DocumentsMenuComponent {
8939
8956
  updateMenuItemsSelectability(documentListResponse) {
8940
8957
  if (this._cachedCategories && this._cachedCategories.length > 0) {
8941
8958
  // Only update if we have a valid response (not null/undefined)
8942
- // If response is null, it means no filters are applied, so all items should be selectable
8959
+ // If response is null, keep previous selectability to avoid flicker/reset during refresh
8943
8960
  if (documentListResponse !== null && documentListResponse !== undefined) {
8944
8961
  this._cachedCategories = this.documentMenuService.updateMenuItemsWithSelectabilityStatus(this._cachedCategories, documentListResponse);
8945
8962
  }
8946
8963
  else {
8947
- // If no response, make all items selectable (default state)
8948
- this._cachedCategories = this._cachedCategories.map(category => ({
8949
- ...category,
8950
- items: category.items?.map(item => ({
8951
- ...item,
8952
- isSelectable: true
8953
- }))
8954
- }));
8964
+ // Do nothing; preserve existing isSelectable values
8955
8965
  }
8956
8966
  }
8957
8967
  }