@ujet/websdk-headless 6.15.0 → 6.17.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.ts +64 -1
- package/dist/index.js +82 -82
- package/dist/index.mjs +6531 -6210
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,10 @@ interface ChatResponse {
|
|
|
164
164
|
all_virtual_agents: VirtualAgent[];
|
|
165
165
|
redaction_enabled: boolean;
|
|
166
166
|
agent_incoming_ha_enabled: boolean;
|
|
167
|
+
end_user?: {
|
|
168
|
+
id: number;
|
|
169
|
+
identifier?: string | null;
|
|
170
|
+
};
|
|
167
171
|
post_session_required?: boolean;
|
|
168
172
|
post_session_opt_in_required?: boolean;
|
|
169
173
|
post_session_transfer_status?: string;
|
|
@@ -237,6 +241,8 @@ interface MessageResponse {
|
|
|
237
241
|
title?: string;
|
|
238
242
|
type: string;
|
|
239
243
|
unredacted?: string;
|
|
244
|
+
client_message_id?: string | undefined;
|
|
245
|
+
redaction_ref?: number | undefined;
|
|
240
246
|
signature?: string;
|
|
241
247
|
form?: {
|
|
242
248
|
id: number;
|
|
@@ -252,6 +258,13 @@ interface MessageResponse {
|
|
|
252
258
|
reason?: string;
|
|
253
259
|
[key: string]: unknown;
|
|
254
260
|
}
|
|
261
|
+
/** GET /chats/:id/messages/:redaction_ref/original — only the requester's own messages resolve. */
|
|
262
|
+
interface ChatMessageOriginalResponse {
|
|
263
|
+
redaction_ref: number;
|
|
264
|
+
content: string;
|
|
265
|
+
type: string;
|
|
266
|
+
media_id?: number | undefined;
|
|
267
|
+
}
|
|
255
268
|
interface PdfStatusResponse {
|
|
256
269
|
body?: File;
|
|
257
270
|
failed_reason?: string;
|
|
@@ -528,6 +541,7 @@ interface ChatMessageRequest {
|
|
|
528
541
|
message: {
|
|
529
542
|
content: string;
|
|
530
543
|
timestamp: string;
|
|
544
|
+
client_message_id?: string | undefined;
|
|
531
545
|
};
|
|
532
546
|
}
|
|
533
547
|
interface CheckInVisibilityStateRequest {
|
|
@@ -746,6 +760,8 @@ interface ChatHooks {
|
|
|
746
760
|
leaveChat?: () => Promise<void>;
|
|
747
761
|
leaveChatBeacon?: () => void;
|
|
748
762
|
isRiskFlagEnabled?: (flagName: string) => boolean;
|
|
763
|
+
/** Ownership-checked lookup of a redacted message's original; rejects with `{ status }` on HTTP errors. */
|
|
764
|
+
fetchMessageOriginal?: (redactionRef: number) => Promise<ChatMessageOriginalResponse>;
|
|
749
765
|
}
|
|
750
766
|
declare class Chat {
|
|
751
767
|
private provider;
|
|
@@ -758,6 +774,11 @@ declare class Chat {
|
|
|
758
774
|
private events;
|
|
759
775
|
private cachedFiles;
|
|
760
776
|
private hooks;
|
|
777
|
+
private originals;
|
|
778
|
+
private cacheOwner;
|
|
779
|
+
private restoredMessages;
|
|
780
|
+
private nextTrackedSweepAt;
|
|
781
|
+
private destroying;
|
|
761
782
|
private leaveSent;
|
|
762
783
|
private beaconAttempted;
|
|
763
784
|
constructor(state: ChatResponse, issueChatToken: IssueChatTokenMethod, hooks?: ChatHooks, providerContext?: ProviderContext);
|
|
@@ -775,6 +796,16 @@ declare class Chat {
|
|
|
775
796
|
human: HumanAgent[];
|
|
776
797
|
};
|
|
777
798
|
get userIdentity(): string;
|
|
799
|
+
/**
|
|
800
|
+
* The end user's participant id, from the chat payload (both providers) and
|
|
801
|
+
* the provider token identity (`end_user-<id>`). Either alone is enough;
|
|
802
|
+
* when both are known they must agree. null when neither is known or they
|
|
803
|
+
* disagree — ownership then cannot be established and nothing is restored.
|
|
804
|
+
*/
|
|
805
|
+
get ownUserId(): number | null;
|
|
806
|
+
private get ownerConflict();
|
|
807
|
+
private get payloadOwnerId();
|
|
808
|
+
private get providerOwnerId();
|
|
778
809
|
get status(): string;
|
|
779
810
|
get postSessionStatus(): string;
|
|
780
811
|
get statusText(): string;
|
|
@@ -807,6 +838,38 @@ declare class Chat {
|
|
|
807
838
|
sendMessage(message: MessageRequest, file?: File): Promise<number>;
|
|
808
839
|
preview(text: string | undefined): Promise<void>;
|
|
809
840
|
fetchMessages(): Promise<MessageResponse[]>;
|
|
841
|
+
/**
|
|
842
|
+
* Re-binds the cache to the live owner and returns the owner to judge
|
|
843
|
+
* messages by. On a change — payload end_user, provider identity, or a move
|
|
844
|
+
* between the two — everything remembered for the previous owner is dropped
|
|
845
|
+
* and every original already shown is taken back, before any of it can be
|
|
846
|
+
* read for the new one. Metadata that is merely absent (an update without
|
|
847
|
+
* end_user on a provider that carries no identity) is not a change: the
|
|
848
|
+
* established owner stands until a different one, or a conflict, appears.
|
|
849
|
+
*/
|
|
850
|
+
private syncCacheOwner;
|
|
851
|
+
private rebindCacheOwner;
|
|
852
|
+
private revokeOriginals;
|
|
853
|
+
private trackRestored;
|
|
854
|
+
private localOriginalCacheEnabled;
|
|
855
|
+
/**
|
|
856
|
+
* Joins the original onto `message.unredacted` for the end user's own
|
|
857
|
+
* redacted text: local cache → in-band `unredacted` → (returns true) a
|
|
858
|
+
* redaction_ref lookup. Another end user's in-band original is dropped so
|
|
859
|
+
* the userType-only render check cannot expose it. Agent and system
|
|
860
|
+
* messages are left alone.
|
|
861
|
+
*
|
|
862
|
+
* @returns whether a store lookup is still needed for this message
|
|
863
|
+
*/
|
|
864
|
+
private restoreOwnOriginal;
|
|
865
|
+
/**
|
|
866
|
+
* Puts an original onto `message.unredacted` — through the same sanitizer
|
|
867
|
+
* the masked content went through, since the widget renders it as HTML —
|
|
868
|
+
* and tracks the message for revocation. False when there was nothing
|
|
869
|
+
* usable to show; a rejected original is removed rather than kept raw.
|
|
870
|
+
*/
|
|
871
|
+
private applyOriginal;
|
|
872
|
+
private lookupOwnOriginal;
|
|
810
873
|
startTyping(): void;
|
|
811
874
|
stopTyping(): void;
|
|
812
875
|
saveMedia(index: AttachmentKey, file: File): void;
|
|
@@ -1472,4 +1535,4 @@ declare const COBROWSE_EVENTS: {
|
|
|
1472
1535
|
};
|
|
1473
1536
|
type CobrowseEvent = (typeof COBROWSE_EVENTS)[keyof typeof COBROWSE_EVENTS];
|
|
1474
1537
|
|
|
1475
|
-
export { AnotherTabVoiceCallError, type AttachmentKey, BaseProvider, BaseVoiceProvider, COBROWSE_EVENTS, type CallApiResponse, CallInProgressError, type CallRequest, type CallResponse, ChannelType, Chat, type ChatDeflectionResponse, type ChatDocumentItem, type ChatEndUserEventRequest, ChatEndedError, type ChatHistoryItem, type ChatHistoryResponse, type ChatMessageRequest, type ChatMessageResponse, type ChatRequest, type ChatResponse, type ChatSurveyResponse, type ChatTaskMessageResponse, type CheckInModalStateRequest, type CheckInResponse, CheckInStatus, type CheckInVisibilityStateRequest, Client, type ClientEvent, type ClientOption, type CobrowseEvent, type CobrowseMessages, type CobrowseOption, type CobrowseRequest, type CompanyResponse, type ConnectCallback, type ConnectOption, type ConnectRequest, type ConnectResult, type ConnectionQualityLevel, type ConnectionQualityWarning, type CustomFormPayload, ENVIRONMENT, type EmailRequest, type EmailResponse, type EscalateRequest, type EventHandler, EventManager, type FeatureFlagsResponse, FeatureNotEnabledError, type FileTypeItem, type FormData, type GenerateTranscriptResponse, type GetServerMessage, type GetTimeSlotsRequest, type HumanAgent, InboundDisabledError, type IssueChatTokenMethod, type IssueVoiceTokenMethod, type LanguageOption, type LogData, type LogHistoryData, Logger, type LoggerHandler, type MediaIndex, type MediaRef, MediaStore, type MenuChannel, type MenuItem, type MenuResponse, type MenusRoutingInputs, type MessageRequest, type MessageResponse, MessageType, MicPermissionDeniedError, type MicPermissionState, NoActiveVoiceCallError, NotiEvent, OPTIONS, OperationHoursError, type PdfStatusResponse, PostSessionStatus, type ProviderContext, ProviderError, ProviderType, type QuestionItem, RISK_FLAG_EVENTS, type RateRequest, type RecordingOption, type RecordingPermission, type RefusedBy, type RequestMethod, type RequestReturn, type ServerAuthResponse, type ServerVoiceCallStatus, SmartActionError, type SmartActionMediaType, type SmartActionResponse, type SmartActionType, type SurveyAnswers, type TokenResponse, type TriggerItem, type TriggerMessage, type UjetConversationHistoryQuery, type UjetConversationHistoryResponse, type UjetConversationMessageItem, UnauthorizedError, UnknownVoiceError, type UserProfile, UserType, VERSION, VOICE_EVENTS, type VirtualAgent, VoiceCall, VoiceCallError, type VoiceCallRequest, type VoiceCallResponse, type VoiceCallStatus, type VoiceCobrowseRequestedEvent, type VoiceCobrowseResolvedEvent, type VoiceConnectionQualityEvent, type VoiceErrorCode, type VoiceErrorEvent, type VoiceFeedbackType, type VoiceProviderConstructor, type VoiceProviderMessage, type VoiceProviderMessageType, type VoiceRecordingPermissionRequiredEvent, type VoiceSmartActionRequestedEvent, type VoiceSmartActionResolvedEvent, type VoiceStatusChangedEvent, type WaitTimeResponse, addProviderType, addVoiceProviderType, getErrorMessage, getErrorStatus, getVoiceProviderType, hasErrorCode, isAfterHoursError, isMobilePlatform, toIdentity };
|
|
1538
|
+
export { AnotherTabVoiceCallError, type AttachmentKey, BaseProvider, BaseVoiceProvider, COBROWSE_EVENTS, type CallApiResponse, CallInProgressError, type CallRequest, type CallResponse, ChannelType, Chat, type ChatDeflectionResponse, type ChatDocumentItem, type ChatEndUserEventRequest, ChatEndedError, type ChatHistoryItem, type ChatHistoryResponse, type ChatMessageOriginalResponse, type ChatMessageRequest, type ChatMessageResponse, type ChatRequest, type ChatResponse, type ChatSurveyResponse, type ChatTaskMessageResponse, type CheckInModalStateRequest, type CheckInResponse, CheckInStatus, type CheckInVisibilityStateRequest, Client, type ClientEvent, type ClientOption, type CobrowseEvent, type CobrowseMessages, type CobrowseOption, type CobrowseRequest, type CompanyResponse, type ConnectCallback, type ConnectOption, type ConnectRequest, type ConnectResult, type ConnectionQualityLevel, type ConnectionQualityWarning, type CustomFormPayload, ENVIRONMENT, type EmailRequest, type EmailResponse, type EscalateRequest, type EventHandler, EventManager, type FeatureFlagsResponse, FeatureNotEnabledError, type FileTypeItem, type FormData, type GenerateTranscriptResponse, type GetServerMessage, type GetTimeSlotsRequest, type HumanAgent, InboundDisabledError, type IssueChatTokenMethod, type IssueVoiceTokenMethod, type LanguageOption, type LogData, type LogHistoryData, Logger, type LoggerHandler, type MediaIndex, type MediaRef, MediaStore, type MenuChannel, type MenuItem, type MenuResponse, type MenusRoutingInputs, type MessageRequest, type MessageResponse, MessageType, MicPermissionDeniedError, type MicPermissionState, NoActiveVoiceCallError, NotiEvent, OPTIONS, OperationHoursError, type PdfStatusResponse, PostSessionStatus, type ProviderContext, ProviderError, ProviderType, type QuestionItem, RISK_FLAG_EVENTS, type RateRequest, type RecordingOption, type RecordingPermission, type RefusedBy, type RequestMethod, type RequestReturn, type ServerAuthResponse, type ServerVoiceCallStatus, SmartActionError, type SmartActionMediaType, type SmartActionResponse, type SmartActionType, type SurveyAnswers, type TokenResponse, type TriggerItem, type TriggerMessage, type UjetConversationHistoryQuery, type UjetConversationHistoryResponse, type UjetConversationMessageItem, UnauthorizedError, UnknownVoiceError, type UserProfile, UserType, VERSION, VOICE_EVENTS, type VirtualAgent, VoiceCall, VoiceCallError, type VoiceCallRequest, type VoiceCallResponse, type VoiceCallStatus, type VoiceCobrowseRequestedEvent, type VoiceCobrowseResolvedEvent, type VoiceConnectionQualityEvent, type VoiceErrorCode, type VoiceErrorEvent, type VoiceFeedbackType, type VoiceProviderConstructor, type VoiceProviderMessage, type VoiceProviderMessageType, type VoiceRecordingPermissionRequiredEvent, type VoiceSmartActionRequestedEvent, type VoiceSmartActionResolvedEvent, type VoiceStatusChangedEvent, type WaitTimeResponse, addProviderType, addVoiceProviderType, getErrorMessage, getErrorStatus, getVoiceProviderType, hasErrorCode, isAfterHoursError, isMobilePlatform, toIdentity };
|