@utilia-os/sdk-js 1.0.0 → 1.1.0
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/dist/index.d.mts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +26 -0
- package/dist/index.mjs +26 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -310,6 +310,13 @@ interface TicketMessage {
|
|
|
310
310
|
attachments: TicketAttachment[];
|
|
311
311
|
createdAt: string;
|
|
312
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Datos del usuario que reporto el ticket
|
|
315
|
+
*/
|
|
316
|
+
interface TicketReporter {
|
|
317
|
+
name: string;
|
|
318
|
+
email?: string;
|
|
319
|
+
}
|
|
313
320
|
/**
|
|
314
321
|
* Detalle completo de un ticket
|
|
315
322
|
*/
|
|
@@ -327,6 +334,10 @@ interface TicketDetail {
|
|
|
327
334
|
messages: TicketMessage[];
|
|
328
335
|
/** Archivos adjuntos del ticket original */
|
|
329
336
|
attachments: TicketAttachment[];
|
|
337
|
+
/** Contexto capturado al crear el ticket */
|
|
338
|
+
context?: TicketContext | null;
|
|
339
|
+
/** Datos del usuario que reporto el ticket */
|
|
340
|
+
reporter?: TicketReporter | null;
|
|
330
341
|
}
|
|
331
342
|
/**
|
|
332
343
|
* Respuesta al crear un mensaje
|
|
@@ -580,7 +591,19 @@ interface AiSuggestInput {
|
|
|
580
591
|
description?: string;
|
|
581
592
|
category?: string;
|
|
582
593
|
priority?: string;
|
|
594
|
+
/** URL actual donde se reporta el problema */
|
|
595
|
+
currentUrl?: string;
|
|
596
|
+
/** User agent del navegador */
|
|
597
|
+
userAgent?: string;
|
|
598
|
+
/** Version de la aplicacion */
|
|
599
|
+
appVersion?: string;
|
|
583
600
|
};
|
|
601
|
+
/** Imagenes adjuntas para analisis con vision (base64, max 5) */
|
|
602
|
+
images?: Array<{
|
|
603
|
+
base64: string;
|
|
604
|
+
filename: string;
|
|
605
|
+
mimeType: string;
|
|
606
|
+
}>;
|
|
584
607
|
}
|
|
585
608
|
/**
|
|
586
609
|
* Sugerencias generadas por IA
|
|
@@ -609,6 +632,8 @@ interface AiJobStatus {
|
|
|
609
632
|
transcription?: string;
|
|
610
633
|
/** Sugerencias generadas */
|
|
611
634
|
suggestions?: AiSuggestions;
|
|
635
|
+
/** ID del evento de analytics para tracking de aceptacion/rechazo */
|
|
636
|
+
analyticsEventId?: string;
|
|
612
637
|
};
|
|
613
638
|
/** Mensaje de error (si status es 'failed') */
|
|
614
639
|
error?: string;
|
|
@@ -616,6 +641,29 @@ interface AiJobStatus {
|
|
|
616
641
|
/**
|
|
617
642
|
* Opciones para el metodo getSuggestions con polling
|
|
618
643
|
*/
|
|
644
|
+
/**
|
|
645
|
+
* Acciones del usuario sobre sugerencias de IA
|
|
646
|
+
*/
|
|
647
|
+
type AiUserAction = 'ACCEPTED_ALL' | 'ACCEPTED_PARTIAL' | 'REJECTED' | 'MODIFIED' | 'IGNORED';
|
|
648
|
+
/**
|
|
649
|
+
* Entrada para reportar la accion del usuario sobre sugerencias de IA
|
|
650
|
+
*/
|
|
651
|
+
interface TrackAiActionInput {
|
|
652
|
+
/** ID del evento de analytics retornado en el resultado de sugerencias */
|
|
653
|
+
eventId: string;
|
|
654
|
+
/** Accion tomada por el usuario */
|
|
655
|
+
userAction: AiUserAction;
|
|
656
|
+
/** Campos que el usuario acepto */
|
|
657
|
+
fieldsAccepted?: string[];
|
|
658
|
+
/** Campos que el usuario modifico */
|
|
659
|
+
fieldsModified?: string[];
|
|
660
|
+
/** Campos que el usuario rechazo */
|
|
661
|
+
fieldsRejected?: string[];
|
|
662
|
+
/** Tiempo en milisegundos desde que se mostraron las sugerencias hasta la decision */
|
|
663
|
+
timeToDecisionMs?: number;
|
|
664
|
+
/** Origen de la accion */
|
|
665
|
+
source?: 'SDK_EXTERNAL' | 'WIDGET';
|
|
666
|
+
}
|
|
619
667
|
interface GetSuggestionsOptions {
|
|
620
668
|
/** Intervalo de polling en ms (default: 1000) */
|
|
621
669
|
pollInterval?: number;
|
|
@@ -720,6 +768,32 @@ declare class AiService {
|
|
|
720
768
|
* ```
|
|
721
769
|
*/
|
|
722
770
|
getSuggestions(data: AiSuggestInput, options?: GetSuggestionsOptions): Promise<AiJobStatus['result']>;
|
|
771
|
+
/**
|
|
772
|
+
* Reporta la accion del usuario sobre sugerencias de IA.
|
|
773
|
+
* Permite trackear si el usuario acepto, rechazo o modifico las sugerencias.
|
|
774
|
+
*
|
|
775
|
+
* @param data - Datos de la accion del usuario
|
|
776
|
+
* @returns Confirmacion de que la accion fue registrada
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```typescript
|
|
780
|
+
* const result = await sdk.ai.getSuggestions({
|
|
781
|
+
* userId: 'user-123',
|
|
782
|
+
* text: 'No puedo iniciar sesion',
|
|
783
|
+
* });
|
|
784
|
+
*
|
|
785
|
+
* // El usuario revisa las sugerencias y acepta todas
|
|
786
|
+
* await sdk.ai.trackAiAction({
|
|
787
|
+
* eventId: result?.analyticsEventId!,
|
|
788
|
+
* userAction: 'ACCEPTED_ALL',
|
|
789
|
+
* fieldsAccepted: ['title', 'description', 'category', 'priority'],
|
|
790
|
+
* timeToDecisionMs: 3500,
|
|
791
|
+
* });
|
|
792
|
+
* ```
|
|
793
|
+
*/
|
|
794
|
+
trackAiAction(data: TrackAiActionInput): Promise<{
|
|
795
|
+
success: boolean;
|
|
796
|
+
}>;
|
|
723
797
|
/**
|
|
724
798
|
* Helper para esperar un tiempo
|
|
725
799
|
*/
|
|
@@ -869,4 +943,4 @@ declare class UtiliaSDK {
|
|
|
869
943
|
constructor(config: UtiliaSDKConfig);
|
|
870
944
|
}
|
|
871
945
|
|
|
872
|
-
export { type AddMessageInput, type AiJobStatus, type AiSuggestInput, type AiSuggestions, type CreateTicketInput, type CreateTicketUser, type CreatedMessage, type CreatedTicket, ErrorCode, type ExternalUser, type FileQuota, type GetSuggestionsOptions, type IdentifyUserInput, type MessageAuthor, type PaginatedResponse, type PaginationMeta, type RequestConfig, SDK_LIMITS, type TicketAttachment, type TicketCategory, type TicketContext, type TicketDetail, type TicketFilters, type TicketListItem, type TicketMessage, type TicketPriority, type TicketStatus, type UnreadCount, type UploadFileOptions, type UploadedFile, UtiliaSDK, type UtiliaSDKConfig, UtiliaSDKError };
|
|
946
|
+
export { type AddMessageInput, type AiJobStatus, type AiSuggestInput, type AiSuggestions, type AiUserAction, type CreateTicketInput, type CreateTicketUser, type CreatedMessage, type CreatedTicket, ErrorCode, type ExternalUser, type FileQuota, type GetSuggestionsOptions, type IdentifyUserInput, type MessageAuthor, type PaginatedResponse, type PaginationMeta, type RequestConfig, SDK_LIMITS, type TicketAttachment, type TicketCategory, type TicketContext, type TicketDetail, type TicketFilters, type TicketListItem, type TicketMessage, type TicketPriority, type TicketReporter, type TicketStatus, type TrackAiActionInput, type UnreadCount, type UploadFileOptions, type UploadedFile, UtiliaSDK, type UtiliaSDKConfig, UtiliaSDKError };
|
package/dist/index.d.ts
CHANGED
|
@@ -310,6 +310,13 @@ interface TicketMessage {
|
|
|
310
310
|
attachments: TicketAttachment[];
|
|
311
311
|
createdAt: string;
|
|
312
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Datos del usuario que reporto el ticket
|
|
315
|
+
*/
|
|
316
|
+
interface TicketReporter {
|
|
317
|
+
name: string;
|
|
318
|
+
email?: string;
|
|
319
|
+
}
|
|
313
320
|
/**
|
|
314
321
|
* Detalle completo de un ticket
|
|
315
322
|
*/
|
|
@@ -327,6 +334,10 @@ interface TicketDetail {
|
|
|
327
334
|
messages: TicketMessage[];
|
|
328
335
|
/** Archivos adjuntos del ticket original */
|
|
329
336
|
attachments: TicketAttachment[];
|
|
337
|
+
/** Contexto capturado al crear el ticket */
|
|
338
|
+
context?: TicketContext | null;
|
|
339
|
+
/** Datos del usuario que reporto el ticket */
|
|
340
|
+
reporter?: TicketReporter | null;
|
|
330
341
|
}
|
|
331
342
|
/**
|
|
332
343
|
* Respuesta al crear un mensaje
|
|
@@ -580,7 +591,19 @@ interface AiSuggestInput {
|
|
|
580
591
|
description?: string;
|
|
581
592
|
category?: string;
|
|
582
593
|
priority?: string;
|
|
594
|
+
/** URL actual donde se reporta el problema */
|
|
595
|
+
currentUrl?: string;
|
|
596
|
+
/** User agent del navegador */
|
|
597
|
+
userAgent?: string;
|
|
598
|
+
/** Version de la aplicacion */
|
|
599
|
+
appVersion?: string;
|
|
583
600
|
};
|
|
601
|
+
/** Imagenes adjuntas para analisis con vision (base64, max 5) */
|
|
602
|
+
images?: Array<{
|
|
603
|
+
base64: string;
|
|
604
|
+
filename: string;
|
|
605
|
+
mimeType: string;
|
|
606
|
+
}>;
|
|
584
607
|
}
|
|
585
608
|
/**
|
|
586
609
|
* Sugerencias generadas por IA
|
|
@@ -609,6 +632,8 @@ interface AiJobStatus {
|
|
|
609
632
|
transcription?: string;
|
|
610
633
|
/** Sugerencias generadas */
|
|
611
634
|
suggestions?: AiSuggestions;
|
|
635
|
+
/** ID del evento de analytics para tracking de aceptacion/rechazo */
|
|
636
|
+
analyticsEventId?: string;
|
|
612
637
|
};
|
|
613
638
|
/** Mensaje de error (si status es 'failed') */
|
|
614
639
|
error?: string;
|
|
@@ -616,6 +641,29 @@ interface AiJobStatus {
|
|
|
616
641
|
/**
|
|
617
642
|
* Opciones para el metodo getSuggestions con polling
|
|
618
643
|
*/
|
|
644
|
+
/**
|
|
645
|
+
* Acciones del usuario sobre sugerencias de IA
|
|
646
|
+
*/
|
|
647
|
+
type AiUserAction = 'ACCEPTED_ALL' | 'ACCEPTED_PARTIAL' | 'REJECTED' | 'MODIFIED' | 'IGNORED';
|
|
648
|
+
/**
|
|
649
|
+
* Entrada para reportar la accion del usuario sobre sugerencias de IA
|
|
650
|
+
*/
|
|
651
|
+
interface TrackAiActionInput {
|
|
652
|
+
/** ID del evento de analytics retornado en el resultado de sugerencias */
|
|
653
|
+
eventId: string;
|
|
654
|
+
/** Accion tomada por el usuario */
|
|
655
|
+
userAction: AiUserAction;
|
|
656
|
+
/** Campos que el usuario acepto */
|
|
657
|
+
fieldsAccepted?: string[];
|
|
658
|
+
/** Campos que el usuario modifico */
|
|
659
|
+
fieldsModified?: string[];
|
|
660
|
+
/** Campos que el usuario rechazo */
|
|
661
|
+
fieldsRejected?: string[];
|
|
662
|
+
/** Tiempo en milisegundos desde que se mostraron las sugerencias hasta la decision */
|
|
663
|
+
timeToDecisionMs?: number;
|
|
664
|
+
/** Origen de la accion */
|
|
665
|
+
source?: 'SDK_EXTERNAL' | 'WIDGET';
|
|
666
|
+
}
|
|
619
667
|
interface GetSuggestionsOptions {
|
|
620
668
|
/** Intervalo de polling en ms (default: 1000) */
|
|
621
669
|
pollInterval?: number;
|
|
@@ -720,6 +768,32 @@ declare class AiService {
|
|
|
720
768
|
* ```
|
|
721
769
|
*/
|
|
722
770
|
getSuggestions(data: AiSuggestInput, options?: GetSuggestionsOptions): Promise<AiJobStatus['result']>;
|
|
771
|
+
/**
|
|
772
|
+
* Reporta la accion del usuario sobre sugerencias de IA.
|
|
773
|
+
* Permite trackear si el usuario acepto, rechazo o modifico las sugerencias.
|
|
774
|
+
*
|
|
775
|
+
* @param data - Datos de la accion del usuario
|
|
776
|
+
* @returns Confirmacion de que la accion fue registrada
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```typescript
|
|
780
|
+
* const result = await sdk.ai.getSuggestions({
|
|
781
|
+
* userId: 'user-123',
|
|
782
|
+
* text: 'No puedo iniciar sesion',
|
|
783
|
+
* });
|
|
784
|
+
*
|
|
785
|
+
* // El usuario revisa las sugerencias y acepta todas
|
|
786
|
+
* await sdk.ai.trackAiAction({
|
|
787
|
+
* eventId: result?.analyticsEventId!,
|
|
788
|
+
* userAction: 'ACCEPTED_ALL',
|
|
789
|
+
* fieldsAccepted: ['title', 'description', 'category', 'priority'],
|
|
790
|
+
* timeToDecisionMs: 3500,
|
|
791
|
+
* });
|
|
792
|
+
* ```
|
|
793
|
+
*/
|
|
794
|
+
trackAiAction(data: TrackAiActionInput): Promise<{
|
|
795
|
+
success: boolean;
|
|
796
|
+
}>;
|
|
723
797
|
/**
|
|
724
798
|
* Helper para esperar un tiempo
|
|
725
799
|
*/
|
|
@@ -869,4 +943,4 @@ declare class UtiliaSDK {
|
|
|
869
943
|
constructor(config: UtiliaSDKConfig);
|
|
870
944
|
}
|
|
871
945
|
|
|
872
|
-
export { type AddMessageInput, type AiJobStatus, type AiSuggestInput, type AiSuggestions, type CreateTicketInput, type CreateTicketUser, type CreatedMessage, type CreatedTicket, ErrorCode, type ExternalUser, type FileQuota, type GetSuggestionsOptions, type IdentifyUserInput, type MessageAuthor, type PaginatedResponse, type PaginationMeta, type RequestConfig, SDK_LIMITS, type TicketAttachment, type TicketCategory, type TicketContext, type TicketDetail, type TicketFilters, type TicketListItem, type TicketMessage, type TicketPriority, type TicketStatus, type UnreadCount, type UploadFileOptions, type UploadedFile, UtiliaSDK, type UtiliaSDKConfig, UtiliaSDKError };
|
|
946
|
+
export { type AddMessageInput, type AiJobStatus, type AiSuggestInput, type AiSuggestions, type AiUserAction, type CreateTicketInput, type CreateTicketUser, type CreatedMessage, type CreatedTicket, ErrorCode, type ExternalUser, type FileQuota, type GetSuggestionsOptions, type IdentifyUserInput, type MessageAuthor, type PaginatedResponse, type PaginationMeta, type RequestConfig, SDK_LIMITS, type TicketAttachment, type TicketCategory, type TicketContext, type TicketDetail, type TicketFilters, type TicketListItem, type TicketMessage, type TicketPriority, type TicketReporter, type TicketStatus, type TrackAiActionInput, type UnreadCount, type UploadFileOptions, type UploadedFile, UtiliaSDK, type UtiliaSDKConfig, UtiliaSDKError };
|
package/dist/index.js
CHANGED
|
@@ -766,6 +766,32 @@ var AiService = class {
|
|
|
766
766
|
}
|
|
767
767
|
throw new Error("Timeout: el job excedio el tiempo maximo de espera");
|
|
768
768
|
}
|
|
769
|
+
/**
|
|
770
|
+
* Reporta la accion del usuario sobre sugerencias de IA.
|
|
771
|
+
* Permite trackear si el usuario acepto, rechazo o modifico las sugerencias.
|
|
772
|
+
*
|
|
773
|
+
* @param data - Datos de la accion del usuario
|
|
774
|
+
* @returns Confirmacion de que la accion fue registrada
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```typescript
|
|
778
|
+
* const result = await sdk.ai.getSuggestions({
|
|
779
|
+
* userId: 'user-123',
|
|
780
|
+
* text: 'No puedo iniciar sesion',
|
|
781
|
+
* });
|
|
782
|
+
*
|
|
783
|
+
* // El usuario revisa las sugerencias y acepta todas
|
|
784
|
+
* await sdk.ai.trackAiAction({
|
|
785
|
+
* eventId: result?.analyticsEventId!,
|
|
786
|
+
* userAction: 'ACCEPTED_ALL',
|
|
787
|
+
* fieldsAccepted: ['title', 'description', 'category', 'priority'],
|
|
788
|
+
* timeToDecisionMs: 3500,
|
|
789
|
+
* });
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
async trackAiAction(data) {
|
|
793
|
+
return this.client.post(`${this.basePath}/ai-track-action`, data);
|
|
794
|
+
}
|
|
769
795
|
/**
|
|
770
796
|
* Helper para esperar un tiempo
|
|
771
797
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -727,6 +727,32 @@ var AiService = class {
|
|
|
727
727
|
}
|
|
728
728
|
throw new Error("Timeout: el job excedio el tiempo maximo de espera");
|
|
729
729
|
}
|
|
730
|
+
/**
|
|
731
|
+
* Reporta la accion del usuario sobre sugerencias de IA.
|
|
732
|
+
* Permite trackear si el usuario acepto, rechazo o modifico las sugerencias.
|
|
733
|
+
*
|
|
734
|
+
* @param data - Datos de la accion del usuario
|
|
735
|
+
* @returns Confirmacion de que la accion fue registrada
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```typescript
|
|
739
|
+
* const result = await sdk.ai.getSuggestions({
|
|
740
|
+
* userId: 'user-123',
|
|
741
|
+
* text: 'No puedo iniciar sesion',
|
|
742
|
+
* });
|
|
743
|
+
*
|
|
744
|
+
* // El usuario revisa las sugerencias y acepta todas
|
|
745
|
+
* await sdk.ai.trackAiAction({
|
|
746
|
+
* eventId: result?.analyticsEventId!,
|
|
747
|
+
* userAction: 'ACCEPTED_ALL',
|
|
748
|
+
* fieldsAccepted: ['title', 'description', 'category', 'priority'],
|
|
749
|
+
* timeToDecisionMs: 3500,
|
|
750
|
+
* });
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
async trackAiAction(data) {
|
|
754
|
+
return this.client.post(`${this.basePath}/ai-track-action`, data);
|
|
755
|
+
}
|
|
730
756
|
/**
|
|
731
757
|
* Helper para esperar un tiempo
|
|
732
758
|
*/
|