@senior-gestao-relacionamento/angular-components 2.3.0 → 2.4.0-master-b35869c1
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.
- package/esm2022/lib/components/chatbot/chatbot.component.mjs +198 -0
- package/esm2022/lib/components/chatbot/pipes/markdown.pipe.mjs +48 -0
- package/esm2022/lib/components/chatbot/services/chatbot.service.mjs +30 -0
- package/esm2022/lib/components/export-data/entities/export-data.interface.mjs +2 -0
- package/esm2022/lib/components/export-data/enums/export-data.enums.mjs +25 -0
- package/esm2022/lib/components/export-data/export-data.component.mjs +610 -0
- package/esm2022/lib/components/export-data/services/export-data.service.mjs +36 -0
- package/esm2022/lib/i18n/en-US.json +10 -1
- package/esm2022/lib/i18n/es-ES.json +10 -1
- package/esm2022/lib/i18n/pt-BR.json +10 -1
- package/esm2022/public-api.mjs +7 -1
- package/fesm2022/senior-gestao-relacionamento-angular-components.mjs +957 -17
- package/fesm2022/senior-gestao-relacionamento-angular-components.mjs.map +1 -1
- package/lib/components/chatbot/chatbot.component.d.ts +49 -0
- package/lib/components/chatbot/pipes/markdown.pipe.d.ts +23 -0
- package/lib/components/chatbot/services/chatbot.service.d.ts +17 -0
- package/lib/components/export-data/entities/export-data.interface.d.ts +82 -0
- package/lib/components/export-data/enums/export-data.enums.d.ts +20 -0
- package/lib/components/export-data/export-data.component.d.ts +70 -0
- package/lib/components/export-data/services/export-data.service.d.ts +24 -0
- package/package.json +5 -3
- package/public-api.d.ts +6 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export interface ChatbotMessage {
|
|
4
|
+
role: 'user' | 'assistant';
|
|
5
|
+
content: string;
|
|
6
|
+
timestamp: Date;
|
|
7
|
+
responseTime?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Chatbot global do CRM.
|
|
11
|
+
*
|
|
12
|
+
* Standalone, plug-and-play: basta declarar `<s-chatbot></s-chatbot>` no
|
|
13
|
+
* `app.component.html` da aplicação consumidora. Toda a integração
|
|
14
|
+
* (WebSocket de respostas, REST de envio, traduções e renderização de
|
|
15
|
+
* Markdown) está encapsulada na biblioteca.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ChatbotComponent implements OnInit, OnDestroy {
|
|
18
|
+
private readonly chatMessagesContainer;
|
|
19
|
+
isOpen: boolean;
|
|
20
|
+
userInput: string;
|
|
21
|
+
sendingMessage: boolean;
|
|
22
|
+
chatMessages: ChatbotMessage[];
|
|
23
|
+
chatId: string | null;
|
|
24
|
+
unreadCount: number;
|
|
25
|
+
typingPhraseKey: string;
|
|
26
|
+
private wsSubscription;
|
|
27
|
+
private typingPhraseTimer;
|
|
28
|
+
private typingPhraseIndex;
|
|
29
|
+
private readonly wsConfig;
|
|
30
|
+
private readonly webSocketService;
|
|
31
|
+
private readonly ngZone;
|
|
32
|
+
private readonly chatbotService;
|
|
33
|
+
private readonly translationService;
|
|
34
|
+
ngOnInit(): void;
|
|
35
|
+
ngOnDestroy(): void;
|
|
36
|
+
toggleChat(): void;
|
|
37
|
+
sendMessage(): void;
|
|
38
|
+
onChatKeydown(event: KeyboardEvent): void;
|
|
39
|
+
private subscribeToWebSocket;
|
|
40
|
+
private scrollChatToBottom;
|
|
41
|
+
/**
|
|
42
|
+
* Starts cycling through the typing phrases. Always begins from the first
|
|
43
|
+
* key so the user sees the same friendly opening every time.
|
|
44
|
+
*/
|
|
45
|
+
private startTypingPhraseRotation;
|
|
46
|
+
private stopTypingPhraseRotation;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotComponent, never>;
|
|
48
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatbotComponent, "s-chatbot", never, {}, {}, never, never, true, never>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Pipe interno do chatbot para renderizar Markdown como HTML seguro.
|
|
6
|
+
*
|
|
7
|
+
* Fluxo de segurança:
|
|
8
|
+
* 1. `marked.parse` converte Markdown em HTML (sem JS executável por padrão).
|
|
9
|
+
* 2. `DOMPurify.sanitize` remove qualquer tag/atributo potencialmente
|
|
10
|
+
* malicioso (script, on*, javascript:..., etc.).
|
|
11
|
+
* 3. `bypassSecurityTrustHtml` libera o HTML já sanitizado para o
|
|
12
|
+
* `[innerHTML]` sem que o Angular faça uma segunda sanitização que
|
|
13
|
+
* removeria estilos e classes legítimas do markdown.
|
|
14
|
+
*
|
|
15
|
+
* Não exportado no public-api: uso restrito ao componente de chatbot.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ChatbotMarkdownPipe implements PipeTransform {
|
|
18
|
+
private readonly sanitizer;
|
|
19
|
+
constructor(sanitizer: DomSanitizer);
|
|
20
|
+
transform(value: string): SafeHtml;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotMarkdownPipe, never>;
|
|
22
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<ChatbotMarkdownPipe, "sChatbotMarkdown", true>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Serviço de integração com o backend do chatbot.
|
|
6
|
+
*
|
|
7
|
+
* Endpoint fixo: `crmx/chatbot/signals/chat` (compartilhado por todos os
|
|
8
|
+
* frontends do CRM).
|
|
9
|
+
*/
|
|
10
|
+
export declare class ChatbotService {
|
|
11
|
+
private readonly http;
|
|
12
|
+
private readonly signalsUrl;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
chat(message: string, chatId?: string): Observable<void>;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatbotService, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ChatbotService>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ExportColumnType, ExportFileFormat, ExportFileType, ExportOrientation } from '../enums/export-data.enums';
|
|
2
|
+
/**
|
|
3
|
+
* Configuração de uma coluna para exportação.
|
|
4
|
+
* Espelha o `columnsRecord` do backend (main.sdl).
|
|
5
|
+
*/
|
|
6
|
+
export interface ExportColumn {
|
|
7
|
+
/** Nome do campo no registro (suporta paths aninhados: "address.city") */
|
|
8
|
+
columnName: string;
|
|
9
|
+
/** Chave de tradução ou label exibido no cabeçalho */
|
|
10
|
+
translateKey: string;
|
|
11
|
+
/** Tipo do dado — define a máscara aplicada pelo backend */
|
|
12
|
+
columnType: ExportColumnType;
|
|
13
|
+
/** Prefixo da chave de tradução do enum (ex: "statusenum") */
|
|
14
|
+
translationKeyPrefix?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Coluna no formato simplificado (compatível com ColumnConfig do projeto).
|
|
18
|
+
* O componente converte automaticamente para ExportColumn.
|
|
19
|
+
*/
|
|
20
|
+
export interface ExportColumnInput {
|
|
21
|
+
/** Nome do campo (ex: "name", "stage.name") */
|
|
22
|
+
field: string;
|
|
23
|
+
/** Label exibido no cabeçalho */
|
|
24
|
+
header: string;
|
|
25
|
+
/** Tipo para exportação: TEXT, NUMBER, ENUM, DATE, DATETIME, CURRENCY */
|
|
26
|
+
exportType?: string;
|
|
27
|
+
/** Prefixo da chave de tradução do enum */
|
|
28
|
+
translationKeyPrefix?: string;
|
|
29
|
+
/** Qualquer outra propriedade (sortable, width, type, etc) é ignorada */
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Datasource que identifica de onde buscar os dados no backend.
|
|
34
|
+
*/
|
|
35
|
+
export interface ExportDatasource {
|
|
36
|
+
nameDomain: string;
|
|
37
|
+
nameService: string;
|
|
38
|
+
primitive: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Payload enviado ao signal `exportSelectedRecordsSignal`.
|
|
42
|
+
*/
|
|
43
|
+
export interface ExportSelectedPayload {
|
|
44
|
+
fileType: ExportFileType;
|
|
45
|
+
datasource: ExportDatasource;
|
|
46
|
+
fields: ExportColumn[];
|
|
47
|
+
selectedIds: string[];
|
|
48
|
+
entityName: string;
|
|
49
|
+
orientation?: ExportOrientation;
|
|
50
|
+
fileFormat?: ExportFileFormat;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Payload enviado ao signal `exportAllRecordsSignal`.
|
|
54
|
+
*/
|
|
55
|
+
export interface ExportAllPayload {
|
|
56
|
+
fileType: ExportFileType;
|
|
57
|
+
datasource: ExportDatasource;
|
|
58
|
+
fields: ExportColumn[];
|
|
59
|
+
filter: string;
|
|
60
|
+
entityName: string;
|
|
61
|
+
orientation?: ExportOrientation;
|
|
62
|
+
fileFormat?: ExportFileFormat;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Configuração passada ao componente de exportação.
|
|
66
|
+
*
|
|
67
|
+
* Aceita colunas em dois formatos:
|
|
68
|
+
* - `ExportColumn[]` (formato completo com columnName/translateKey/columnType)
|
|
69
|
+
* - `ExportColumnInput[]` (formato simplificado com field/header/exportType — compatível com ColumnConfig)
|
|
70
|
+
*
|
|
71
|
+
* O componente normaliza internamente.
|
|
72
|
+
*/
|
|
73
|
+
export interface ExportDataConfig {
|
|
74
|
+
/** Nome da entidade exibido no título do arquivo */
|
|
75
|
+
entityName: string;
|
|
76
|
+
/** Datasource: domínio, serviço e primitiva de listagem */
|
|
77
|
+
datasource: ExportDatasource;
|
|
78
|
+
/** Colunas disponíveis para exportação */
|
|
79
|
+
columns: (ExportColumn | ExportColumnInput)[];
|
|
80
|
+
/** Filtro ativo na listagem (usado quando exporta todos) */
|
|
81
|
+
activeFilter?: string;
|
|
82
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum ExportFileType {
|
|
2
|
+
Excel = "EXCEL",
|
|
3
|
+
Pdf = "PDF"
|
|
4
|
+
}
|
|
5
|
+
export declare enum ExportOrientation {
|
|
6
|
+
Portrait = "PORTRAIT",
|
|
7
|
+
Landscape = "LANDSCAPE"
|
|
8
|
+
}
|
|
9
|
+
export declare enum ExportFileFormat {
|
|
10
|
+
A3 = "A3",
|
|
11
|
+
A4 = "A4"
|
|
12
|
+
}
|
|
13
|
+
export declare enum ExportColumnType {
|
|
14
|
+
Text = "TEXT",
|
|
15
|
+
Enum = "ENUM",
|
|
16
|
+
Date = "DATE",
|
|
17
|
+
Datetime = "DATETIME",
|
|
18
|
+
Currency = "CURRENCY",
|
|
19
|
+
Number = "NUMBER"
|
|
20
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { OnChanges, OnDestroy } from '@angular/core';
|
|
2
|
+
import { ExportDataConfig, ExportColumn } from './entities/export-data.interface';
|
|
3
|
+
import { ExportFileType, ExportOrientation, ExportFileFormat } from './enums/export-data.enums';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ExportDataComponent implements OnChanges, OnDestroy {
|
|
6
|
+
private readonly exportService;
|
|
7
|
+
private readonly webSocketService;
|
|
8
|
+
private readonly ngZone;
|
|
9
|
+
private wsSubscription;
|
|
10
|
+
private readonly wsConfig;
|
|
11
|
+
visible: import("@angular/core").InputSignal<boolean>;
|
|
12
|
+
visibleChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
13
|
+
config: import("@angular/core").InputSignal<ExportDataConfig>;
|
|
14
|
+
selectedIds: import("@angular/core").InputSignal<string[]>;
|
|
15
|
+
exported: import("@angular/core").OutputEmitterRef<void>;
|
|
16
|
+
exportError: import("@angular/core").OutputEmitterRef<string>;
|
|
17
|
+
readonly selectedFileType: import("@angular/core").WritableSignal<ExportFileType>;
|
|
18
|
+
readonly selectedOrientation: import("@angular/core").WritableSignal<ExportOrientation>;
|
|
19
|
+
readonly selectedFileFormat: import("@angular/core").WritableSignal<ExportFileFormat>;
|
|
20
|
+
readonly exportScope: import("@angular/core").WritableSignal<"all" | "selected">;
|
|
21
|
+
readonly exporting: import("@angular/core").WritableSignal<boolean>;
|
|
22
|
+
readonly columnSelections: import("@angular/core").WritableSignal<{
|
|
23
|
+
column: ExportColumn;
|
|
24
|
+
selected: boolean;
|
|
25
|
+
}[]>;
|
|
26
|
+
get selectedFileTypeModel(): ExportFileType;
|
|
27
|
+
set selectedFileTypeModel(v: ExportFileType);
|
|
28
|
+
get selectedOrientationModel(): ExportOrientation;
|
|
29
|
+
set selectedOrientationModel(v: ExportOrientation);
|
|
30
|
+
get selectedFileFormatModel(): ExportFileFormat;
|
|
31
|
+
set selectedFileFormatModel(v: ExportFileFormat);
|
|
32
|
+
get exportScopeModel(): string;
|
|
33
|
+
set exportScopeModel(v: string);
|
|
34
|
+
readonly selectedColumnsCount: import("@angular/core").Signal<number>;
|
|
35
|
+
readonly hasSelectedIds: import("@angular/core").Signal<boolean>;
|
|
36
|
+
readonly canExport: import("@angular/core").Signal<boolean>;
|
|
37
|
+
readonly fileTypes: {
|
|
38
|
+
value: ExportFileType;
|
|
39
|
+
label: string;
|
|
40
|
+
icon: string;
|
|
41
|
+
description: string;
|
|
42
|
+
}[];
|
|
43
|
+
readonly orientations: {
|
|
44
|
+
value: ExportOrientation;
|
|
45
|
+
label: string;
|
|
46
|
+
icon: string;
|
|
47
|
+
}[];
|
|
48
|
+
readonly fileFormats: {
|
|
49
|
+
value: ExportFileFormat;
|
|
50
|
+
label: string;
|
|
51
|
+
description: string;
|
|
52
|
+
}[];
|
|
53
|
+
ngOnChanges(): void;
|
|
54
|
+
ngOnDestroy(): void;
|
|
55
|
+
private subscribeToWebSocket;
|
|
56
|
+
private isExportColumn;
|
|
57
|
+
private normalizeColumn;
|
|
58
|
+
selectAllColumns(): void;
|
|
59
|
+
deselectAllColumns(): void;
|
|
60
|
+
toggleColumn(col: {
|
|
61
|
+
column: ExportColumn;
|
|
62
|
+
selected: boolean;
|
|
63
|
+
}): void;
|
|
64
|
+
refreshColumns(): void;
|
|
65
|
+
onDialogHide(): void;
|
|
66
|
+
doExport(): Promise<void>;
|
|
67
|
+
private exportViaBackend;
|
|
68
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExportDataComponent, never>;
|
|
69
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ExportDataComponent, "s-export-data", never, { "visible": { "alias": "visible"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "selectedIds": { "alias": "selectedIds"; "required": false; "isSignal": true; }; }, { "visibleChange": "visibleChange"; "exported": "exported"; "exportError": "exportError"; }, never, never, true, never>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { ExportAllPayload, ExportSelectedPayload } from '../entities/export-data.interface';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Serviço que dispara os signals de exportação no `crmx-data-export-backend`.
|
|
6
|
+
*
|
|
7
|
+
* Os signals são fire-and-forget: o backend gera o arquivo, faz upload
|
|
8
|
+
* e notifica o usuário via WebSocket/notificação.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ExportDataService {
|
|
11
|
+
private readonly http;
|
|
12
|
+
private readonly signalsUrl;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
/**
|
|
15
|
+
* Dispara `exportSelectedRecordsSignal` — exporta apenas os IDs informados.
|
|
16
|
+
*/
|
|
17
|
+
exportSelectedRecords(payload: ExportSelectedPayload): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Dispara `exportAllRecordsSignal` — exporta todos os registros com filtro.
|
|
20
|
+
*/
|
|
21
|
+
exportAllRecords(payload: ExportAllPayload): Promise<void>;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExportDataService, never>;
|
|
23
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ExportDataService>;
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senior-gestao-relacionamento/angular-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-master-b35869c1",
|
|
4
4
|
"description": "Biblioteca de componentes reutilizáveis para aplicações Angular do CRM Senior Sistemas",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"@seniorsistemas/components-ai": ">=2.1.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"tslib": "^2.3.0"
|
|
33
|
+
"tslib": "^2.3.0",
|
|
34
|
+
"marked": "^18.0.2",
|
|
35
|
+
"dompurify": "^2.5.9"
|
|
34
36
|
},
|
|
35
37
|
"sideEffects": false,
|
|
36
38
|
"module": "fesm2022/senior-gestao-relacionamento-angular-components.mjs",
|
|
@@ -46,4 +48,4 @@
|
|
|
46
48
|
"default": "./fesm2022/senior-gestao-relacionamento-angular-components.mjs"
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
}
|
|
51
|
+
}
|
package/public-api.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { StorageService } from './lib/services/storage/storage.service';
|
|
|
3
3
|
export { CurrentCollaboratorService } from './lib/services/current-collaborator/current-collaborator.service';
|
|
4
4
|
export { provideAngularComponentsTranslations } from './lib/config/provide-angular-components-translations';
|
|
5
5
|
export type { Collaborator, CollaboratorLeader, CollaboratorBranch, Branch, Company, JobTitle } from './lib/services/current-collaborator/models/collaborator.model';
|
|
6
|
+
export { ChatbotComponent } from './lib/components/chatbot/chatbot.component';
|
|
7
|
+
export type { ChatbotMessage } from './lib/components/chatbot/chatbot.component';
|
|
6
8
|
export { ScheduleFormComponent } from './lib/components/schedule/schedule-form/schedule-form.component';
|
|
7
9
|
export { ScheduleDetailComponent } from './lib/components/schedule/schedule-detail/schedule-detail.component';
|
|
8
10
|
export { ScheduleService } from './lib/components/schedule/services/schedule.service';
|
|
@@ -11,3 +13,7 @@ export type { Schedule, ScheduleRecurrenceItem, RecurrenceDatesRecord, ScheduleP
|
|
|
11
13
|
export type { ScheduleType } from './lib/components/schedule/entities/schedule-type.interface';
|
|
12
14
|
export type { ParticipantLookup, ParticipantOrigin, ScheduleSummaryByDate } from './lib/components/schedule/entities/participant-lookup.interface';
|
|
13
15
|
export { SchedulePriority, ScheduleRecurrence, WeekDay, Month, RepeatWhen, OrdinalWeekDay, ParticipantConfirmation, Status } from './lib/components/schedule/enums/schedule.enums';
|
|
16
|
+
export { ExportDataComponent } from './lib/components/export-data/export-data.component';
|
|
17
|
+
export { ExportDataService } from './lib/components/export-data/services/export-data.service';
|
|
18
|
+
export { ExportFileType, ExportOrientation, ExportFileFormat, ExportColumnType } from './lib/components/export-data/enums/export-data.enums';
|
|
19
|
+
export type { ExportColumn, ExportColumnInput, ExportDatasource, ExportDataConfig, ExportSelectedPayload, ExportAllPayload } from './lib/components/export-data/entities/export-data.interface';
|