cat-documents-ng 0.4.2 → 0.4.3

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.
@@ -49,11 +49,6 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy, On
49
49
  */
50
50
  contentScrollContainer: ElementRef;
51
51
  selectedDocument: EventEmitter<any>;
52
- emitSelectedDocumentInNewTab: EventEmitter<{
53
- selectedDocument: any;
54
- contextId: string;
55
- documentList: any[];
56
- }>;
57
52
  /**
58
53
  * Subscription to track selected menu item changes
59
54
  */
@@ -151,24 +146,11 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy, On
151
146
  * Sets up subscription to listen for filtered document responses
152
147
  */
153
148
  setupFilteredDocumentSubscription(): void;
154
- /**
155
- * Handles the selected document event
156
- * @param document - The document to be selected
157
- */
158
149
  onDocumentSelected(document: any): void;
159
- /**
160
- * Handles the selected document in new tab event
161
- * @param data - The data containing the selected document, contextId, and document list
162
- */
163
- handleSelectedDocumentInNewTab(data: {
164
- selectedDocument: any;
165
- contextId: string;
166
- documentList: any[];
167
- }): void;
168
150
  /**
169
151
  * Unsubscribe subscription on destroy of component and clean up state.
170
152
  */
171
153
  ngOnDestroy(): void;
172
154
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContainerComponent, never>;
173
- static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContainerComponent, "lib-document-container", never, { "contextId": { "alias": "contextId"; "required": false; }; }, { "selectedDocument": "selectedDocument"; "emitSelectedDocumentInNewTab": "emitSelectedDocumentInNewTab"; }, never, ["*"], false, never>;
155
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContainerComponent, "lib-document-container", never, { "contextId": { "alias": "contextId"; "required": false; }; }, { "selectedDocument": "selectedDocument"; }, never, ["*"], false, never>;
174
156
  }
@@ -1,9 +1,11 @@
1
1
  import { OnChanges, SimpleChanges, OnInit } from '@angular/core';
2
2
  import { ExcelParserService, ExcelRowData } from '../../services/excel-parser.service';
3
3
  import { CsvParserService, CsvRowData } from '../../services/csv-parser.service';
4
+ import { EmlParserService, ParsedEmailData } from '../../services/eml-parser.service';
4
5
  import { DocumentHttpService } from '../../services/document-http.service';
5
6
  import { DocumentZoomService } from '../../services/document-zoom.service';
6
7
  import { DocumentListItem } from '../../models/document-list-response.model';
8
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
7
9
  import * as i0 from "@angular/core";
8
10
  /**
9
11
  * Component for viewing different types of document content.
@@ -14,8 +16,10 @@ import * as i0 from "@angular/core";
14
16
  export declare class DocumentContentViewerComponent implements OnChanges, OnInit {
15
17
  private excelParserService;
16
18
  private csvParserService;
19
+ private emlParserService;
17
20
  private documentHttpService;
18
21
  private zoomService;
22
+ private sanitizer;
19
23
  /**
20
24
  * The document URL to display
21
25
  * @type {string}
@@ -116,13 +120,31 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
116
120
  * @type {number}
117
121
  */
118
122
  currentZoom: number;
123
+ /**
124
+ * Email data for display
125
+ * @type {ParsedEmailData | null}
126
+ */
127
+ emailData: ParsedEmailData | null;
128
+ /**
129
+ * Loading state for Email files
130
+ * @type {boolean}
131
+ */
132
+ isLoadingEmail: boolean;
133
+ /**
134
+ * Error state for Email files
135
+ * @type {string | null}
136
+ */
137
+ emailError: string | null;
119
138
  /**
120
139
  * Constructor
121
140
  * @param {ExcelParserService} excelParserService - Service for parsing Excel files
122
- * @param {DocumentHttpService} documentHttpService - Service for making HTTP requests with authentication
141
+ * @param {CsvParserService} csvParserService - Service for parsing CSV files
142
+ * @param {EmlParserService} emlParserService - Service for parsing EML files
143
+ * @param {DocumentHttpService} documentHttpService - Service for making HTTP requests for Excel/CSV files
123
144
  * @param {DocumentZoomService} zoomService - Service for handling zoom functionality
145
+ * @param {DomSanitizer} sanitizer - Service for sanitizing HTML content
124
146
  */
125
- constructor(excelParserService: ExcelParserService, csvParserService: CsvParserService, documentHttpService: DocumentHttpService, zoomService: DocumentZoomService);
147
+ constructor(excelParserService: ExcelParserService, csvParserService: CsvParserService, emlParserService: EmlParserService, documentHttpService: DocumentHttpService, zoomService: DocumentZoomService, sanitizer: DomSanitizer);
126
148
  /**
127
149
  * Computed property to determine if the document is a PDF
128
150
  * @type {boolean}
@@ -256,6 +278,19 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
256
278
  private isCsvDataValid;
257
279
  private getFileExtension;
258
280
  get isImage(): boolean;
281
+ /**
282
+ * Loads Email data for display
283
+ */
284
+ private loadEmailData;
285
+ /**
286
+ * Resets Email data to initial state
287
+ */
288
+ private resetEmailData;
289
+ /**
290
+ * Gets sanitized HTML for email body
291
+ * @returns {SafeHtml} Sanitized HTML
292
+ */
293
+ getSafeEmailHtml(): SafeHtml;
259
294
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContentViewerComponent, never>;
260
295
  static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContentViewerComponent, "document-content-viewer", never, { "documentUrl": { "alias": "documentUrl"; "required": false; }; "contentType": { "alias": "contentType"; "required": false; }; "documentName": { "alias": "documentName"; "required": false; }; "selectedDocument": { "alias": "selectedDocument"; "required": false; }; "contextId": { "alias": "contextId"; "required": false; }; "isFormHide": { "alias": "isFormHide"; "required": false; }; }, {}, never, never, false, never>;
261
296
  }
@@ -126,11 +126,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
126
126
  * Message to display for document deletion
127
127
  */
128
128
  deleteMessage: Message[];
129
- handleSelectedDocumentInNewTab: EventEmitter<{
130
- selectedDocument: DocumentListItem;
131
- contextId: string;
132
- documentList: DocumentListItem[];
133
- }>;
134
129
  handleSelectedDocument: EventEmitter<DocumentListItem>;
135
130
  /**
136
131
  * Getter to return category labels as they come from the API
@@ -181,11 +176,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
181
176
  * @param {any} rowData - The row data containing the document to delete
182
177
  */
183
178
  handleDeleteAction(rowData: any): void;
184
- /**
185
- * Handles table row ctrl click event
186
- * @param {any} rowData - The row data containing the document to open in a new tab
187
- */
188
- handleTableRowCtrlClick(rowData: any): void;
189
179
  /**
190
180
  * Closes the document viewer dialog and resets the selected document
191
181
  */
@@ -299,5 +289,5 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
299
289
  */
300
290
  ngOnDestroy(): void;
301
291
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
302
- static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "selectedMenuItemId": { "alias": "selectedMenuItemId"; "required": false; }; "navigationInfo": { "alias": "navigationInfo"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "handleSelectedDocumentInNewTab": "handleSelectedDocumentInNewTab"; "handleSelectedDocument": "handleSelectedDocument"; }, never, ["*"], false, never>;
292
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "selectedMenuItemId": { "alias": "selectedMenuItemId"; "required": false; }; "navigationInfo": { "alias": "navigationInfo"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "handleSelectedDocument": "handleSelectedDocument"; }, never, ["*"], false, never>;
303
293
  }
@@ -161,6 +161,12 @@ export declare class DocumentHttpService {
161
161
  * @returns {Observable<string>} Observable that emits the file data as string
162
162
  */
163
163
  downloadCsvFile(documentUrl: string): Observable<string>;
164
+ /**
165
+ * Downloads an email file (EML) with appropriate handling for different storage types
166
+ * @param documentUrl - URL of the email file
167
+ * @returns Observable of file content as text
168
+ */
169
+ downloadEmailFile(documentUrl: string): Observable<string>;
164
170
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHttpService, never>;
165
171
  static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHttpService>;
166
172
  }
@@ -0,0 +1,116 @@
1
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
2
+ import { Observable } from 'rxjs';
3
+ import { HttpClient } from '@angular/common/http';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Interface for parsed email data
7
+ */
8
+ export interface ParsedEmailData {
9
+ from: string;
10
+ to: string;
11
+ cc?: string;
12
+ subject: string;
13
+ date: string;
14
+ body: string;
15
+ isHtml: boolean;
16
+ attachments?: EmailAttachment[];
17
+ }
18
+ /**
19
+ * Interface for email attachments
20
+ */
21
+ export interface EmailAttachment {
22
+ filename: string;
23
+ contentType: string;
24
+ size: number;
25
+ }
26
+ /**
27
+ * Service for parsing EML (email message) files
28
+ * Handles both plain text and HTML email content
29
+ */
30
+ export declare class EmlParserService {
31
+ private sanitizer;
32
+ private http;
33
+ constructor(sanitizer: DomSanitizer, http: HttpClient);
34
+ /**
35
+ * Parses EML file content
36
+ * @param emlContent - Raw EML file content as string
37
+ * @returns Parsed email data
38
+ */
39
+ parseEmlData(emlContent: string): ParsedEmailData | null;
40
+ /**
41
+ * Parses email headers from EML content
42
+ * @param lines - Lines of the EML file
43
+ * @returns Object containing parsed headers
44
+ */
45
+ private parseHeaders;
46
+ /**
47
+ * Parses the email body from EML content
48
+ * @param lines - Lines of the EML file
49
+ * @returns Object containing body content and format information
50
+ */
51
+ private parseBody;
52
+ /**
53
+ * Extracts body from multipart email
54
+ * @param content - Email content
55
+ * @param boundary - Multipart boundary string
56
+ * @param preferredType - Preferred content type
57
+ * @returns Array of body lines
58
+ */
59
+ private extractMultipartBody;
60
+ /**
61
+ * Decodes quoted-printable encoded content
62
+ * @param content - Quoted-printable encoded string
63
+ * @returns Decoded string
64
+ */
65
+ private decodeQuotedPrintable;
66
+ /**
67
+ * Sanitizes HTML content for safe display
68
+ * @param html - Raw HTML content
69
+ * @returns Sanitized HTML
70
+ */
71
+ private sanitizeHtmlContent;
72
+ /**
73
+ * Parses attachment information from EML content
74
+ * @param emlContent - Raw EML content
75
+ * @returns Array of attachment information
76
+ */
77
+ private parseAttachments;
78
+ /**
79
+ * Cleans and formats email addresses
80
+ * @param email - Raw email address string
81
+ * @returns Cleaned email address
82
+ */
83
+ private cleanEmailAddress;
84
+ /**
85
+ * Decodes encoded email headers (RFC 2047)
86
+ * @param header - Encoded header string
87
+ * @returns Decoded header string
88
+ */
89
+ private decodeHeader;
90
+ /**
91
+ * Formats email date to readable format
92
+ * @param dateStr - Raw date string from email
93
+ * @returns Formatted date string
94
+ */
95
+ private formatDate;
96
+ /**
97
+ * Sanitizes HTML for Angular display
98
+ * @param html - HTML string
99
+ * @returns SafeHtml for Angular templates
100
+ */
101
+ getSafeHtml(html: string): SafeHtml;
102
+ /**
103
+ * Downloads and parses an EML file from a URL
104
+ * @param documentUrl - URL of the EML file
105
+ * @returns Observable of parsed email data
106
+ */
107
+ loadAndParseEmail(documentUrl: string): Observable<ParsedEmailData>;
108
+ /**
109
+ * Downloads an email file with appropriate authentication handling
110
+ * @param documentUrl - URL of the email file
111
+ * @returns Observable of file content as text
112
+ */
113
+ private downloadEmailFile;
114
+ static ɵfac: i0.ɵɵFactoryDeclaration<EmlParserService, never>;
115
+ static ɵprov: i0.ɵɵInjectableDeclaration<EmlParserService>;
116
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.4.02",
3
+ "version": "0.4.03",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"
package/public-api.d.ts CHANGED
@@ -14,6 +14,9 @@ export * from './lib/document/models/uploaded-file-response.model';
14
14
  export * from './lib/document/services/document-table-builder.service';
15
15
  export * from './lib/document/services/document-content-type.service';
16
16
  export * from './lib/document/services/document-zoom.service';
17
+ export * from './lib/document/services/eml-parser.service';
18
+ export * from './lib/document/services/excel-parser.service';
19
+ export * from './lib/document/services/csv-parser.service';
17
20
  export * from './lib/document/directives/document.directive';
18
21
  export * from './lib/document/directives/permission.directive';
19
22
  export * from './Shared/components/confirmation-dialog/confirmation-dialog.component';