@parlr/react-native 0.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/LICENSE +21 -0
- package/README.md +918 -0
- package/lib/commonjs/components/AttachmentPicker.js +292 -0
- package/lib/commonjs/components/AttachmentPicker.js.map +1 -0
- package/lib/commonjs/components/AttachmentPreview.js +200 -0
- package/lib/commonjs/components/AttachmentPreview.js.map +1 -0
- package/lib/commonjs/components/ChatBubble.js +391 -0
- package/lib/commonjs/components/ChatBubble.js.map +1 -0
- package/lib/commonjs/components/EmptyState.js +115 -0
- package/lib/commonjs/components/EmptyState.js.map +1 -0
- package/lib/commonjs/components/ParlrChat.js +745 -0
- package/lib/commonjs/components/ParlrChat.js.map +1 -0
- package/lib/commonjs/components/ParlrConversationList.js +509 -0
- package/lib/commonjs/components/ParlrConversationList.js.map +1 -0
- package/lib/commonjs/components/PreChatForm.js +263 -0
- package/lib/commonjs/components/PreChatForm.js.map +1 -0
- package/lib/commonjs/components/RichMessage.js +284 -0
- package/lib/commonjs/components/RichMessage.js.map +1 -0
- package/lib/commonjs/components/SatisfactionSurvey.js +292 -0
- package/lib/commonjs/components/SatisfactionSurvey.js.map +1 -0
- package/lib/commonjs/components/TypingIndicator.js +86 -0
- package/lib/commonjs/components/TypingIndicator.js.map +1 -0
- package/lib/commonjs/core/api.js +310 -0
- package/lib/commonjs/core/api.js.map +1 -0
- package/lib/commonjs/core/config.js +40 -0
- package/lib/commonjs/core/config.js.map +1 -0
- package/lib/commonjs/core/errors.js +73 -0
- package/lib/commonjs/core/errors.js.map +1 -0
- package/lib/commonjs/core/offlineQueue.js +89 -0
- package/lib/commonjs/core/offlineQueue.js.map +1 -0
- package/lib/commonjs/core/pushNotifications.js +21 -0
- package/lib/commonjs/core/pushNotifications.js.map +1 -0
- package/lib/commonjs/core/session.js +130 -0
- package/lib/commonjs/core/session.js.map +1 -0
- package/lib/commonjs/core/theme.js +110 -0
- package/lib/commonjs/core/theme.js.map +1 -0
- package/lib/commonjs/core/types.js +6 -0
- package/lib/commonjs/core/types.js.map +1 -0
- package/lib/commonjs/core/websocket.js +245 -0
- package/lib/commonjs/core/websocket.js.map +1 -0
- package/lib/commonjs/hooks/useChat.js +462 -0
- package/lib/commonjs/hooks/useChat.js.map +1 -0
- package/lib/commonjs/hooks/useParlr.js +44 -0
- package/lib/commonjs/hooks/useParlr.js.map +1 -0
- package/lib/commonjs/index.js +185 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/provider/ParlrContext.js +38 -0
- package/lib/commonjs/provider/ParlrContext.js.map +1 -0
- package/lib/commonjs/provider/ParlrProvider.js +256 -0
- package/lib/commonjs/provider/ParlrProvider.js.map +1 -0
- package/lib/module/components/AttachmentPicker.js +287 -0
- package/lib/module/components/AttachmentPicker.js.map +1 -0
- package/lib/module/components/AttachmentPreview.js +195 -0
- package/lib/module/components/AttachmentPreview.js.map +1 -0
- package/lib/module/components/ChatBubble.js +386 -0
- package/lib/module/components/ChatBubble.js.map +1 -0
- package/lib/module/components/EmptyState.js +110 -0
- package/lib/module/components/EmptyState.js.map +1 -0
- package/lib/module/components/ParlrChat.js +740 -0
- package/lib/module/components/ParlrChat.js.map +1 -0
- package/lib/module/components/ParlrConversationList.js +504 -0
- package/lib/module/components/ParlrConversationList.js.map +1 -0
- package/lib/module/components/PreChatForm.js +258 -0
- package/lib/module/components/PreChatForm.js.map +1 -0
- package/lib/module/components/RichMessage.js +280 -0
- package/lib/module/components/RichMessage.js.map +1 -0
- package/lib/module/components/SatisfactionSurvey.js +287 -0
- package/lib/module/components/SatisfactionSurvey.js.map +1 -0
- package/lib/module/components/TypingIndicator.js +81 -0
- package/lib/module/components/TypingIndicator.js.map +1 -0
- package/lib/module/core/api.js +305 -0
- package/lib/module/core/api.js.map +1 -0
- package/lib/module/core/config.js +36 -0
- package/lib/module/core/config.js.map +1 -0
- package/lib/module/core/errors.js +64 -0
- package/lib/module/core/errors.js.map +1 -0
- package/lib/module/core/offlineQueue.js +82 -0
- package/lib/module/core/offlineQueue.js.map +1 -0
- package/lib/module/core/pushNotifications.js +16 -0
- package/lib/module/core/pushNotifications.js.map +1 -0
- package/lib/module/core/session.js +122 -0
- package/lib/module/core/session.js.map +1 -0
- package/lib/module/core/theme.js +105 -0
- package/lib/module/core/theme.js.map +1 -0
- package/lib/module/core/types.js +4 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/websocket.js +241 -0
- package/lib/module/core/websocket.js.map +1 -0
- package/lib/module/hooks/useChat.js +458 -0
- package/lib/module/hooks/useChat.js.map +1 -0
- package/lib/module/hooks/useParlr.js +40 -0
- package/lib/module/hooks/useParlr.js.map +1 -0
- package/lib/module/index.js +58 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/provider/ParlrContext.js +35 -0
- package/lib/module/provider/ParlrContext.js.map +1 -0
- package/lib/module/provider/ParlrProvider.js +251 -0
- package/lib/module/provider/ParlrProvider.js.map +1 -0
- package/lib/typescript/commonjs/components/AttachmentPicker.d.ts +23 -0
- package/lib/typescript/commonjs/components/AttachmentPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/AttachmentPreview.d.ts +16 -0
- package/lib/typescript/commonjs/components/AttachmentPreview.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ChatBubble.d.ts +14 -0
- package/lib/typescript/commonjs/components/ChatBubble.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/EmptyState.d.ts +10 -0
- package/lib/typescript/commonjs/components/EmptyState.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ParlrChat.d.ts +34 -0
- package/lib/typescript/commonjs/components/ParlrChat.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ParlrConversationList.d.ts +17 -0
- package/lib/typescript/commonjs/components/ParlrConversationList.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/PreChatForm.d.ts +20 -0
- package/lib/typescript/commonjs/components/PreChatForm.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/RichMessage.d.ts +41 -0
- package/lib/typescript/commonjs/components/RichMessage.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/SatisfactionSurvey.d.ts +17 -0
- package/lib/typescript/commonjs/components/SatisfactionSurvey.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/TypingIndicator.d.ts +7 -0
- package/lib/typescript/commonjs/components/TypingIndicator.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/api.d.ts +37 -0
- package/lib/typescript/commonjs/core/api.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/config.d.ts +9 -0
- package/lib/typescript/commonjs/core/config.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/errors.d.ts +35 -0
- package/lib/typescript/commonjs/core/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/offlineQueue.d.ts +16 -0
- package/lib/typescript/commonjs/core/offlineQueue.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/pushNotifications.d.ts +6 -0
- package/lib/typescript/commonjs/core/pushNotifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/session.d.ts +15 -0
- package/lib/typescript/commonjs/core/session.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/theme.d.ts +43 -0
- package/lib/typescript/commonjs/core/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/types.d.ts +185 -0
- package/lib/typescript/commonjs/core/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/websocket.d.ts +17 -0
- package/lib/typescript/commonjs/core/websocket.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useChat.d.ts +35 -0
- package/lib/typescript/commonjs/hooks/useChat.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useParlr.d.ts +11 -0
- package/lib/typescript/commonjs/hooks/useParlr.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +30 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/provider/ParlrContext.d.ts +13 -0
- package/lib/typescript/commonjs/provider/ParlrContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/provider/ParlrProvider.d.ts +5 -0
- package/lib/typescript/commonjs/provider/ParlrProvider.d.ts.map +1 -0
- package/lib/typescript/module/components/AttachmentPicker.d.ts +23 -0
- package/lib/typescript/module/components/AttachmentPicker.d.ts.map +1 -0
- package/lib/typescript/module/components/AttachmentPreview.d.ts +16 -0
- package/lib/typescript/module/components/AttachmentPreview.d.ts.map +1 -0
- package/lib/typescript/module/components/ChatBubble.d.ts +14 -0
- package/lib/typescript/module/components/ChatBubble.d.ts.map +1 -0
- package/lib/typescript/module/components/EmptyState.d.ts +10 -0
- package/lib/typescript/module/components/EmptyState.d.ts.map +1 -0
- package/lib/typescript/module/components/ParlrChat.d.ts +34 -0
- package/lib/typescript/module/components/ParlrChat.d.ts.map +1 -0
- package/lib/typescript/module/components/ParlrConversationList.d.ts +17 -0
- package/lib/typescript/module/components/ParlrConversationList.d.ts.map +1 -0
- package/lib/typescript/module/components/PreChatForm.d.ts +20 -0
- package/lib/typescript/module/components/PreChatForm.d.ts.map +1 -0
- package/lib/typescript/module/components/RichMessage.d.ts +41 -0
- package/lib/typescript/module/components/RichMessage.d.ts.map +1 -0
- package/lib/typescript/module/components/SatisfactionSurvey.d.ts +17 -0
- package/lib/typescript/module/components/SatisfactionSurvey.d.ts.map +1 -0
- package/lib/typescript/module/components/TypingIndicator.d.ts +7 -0
- package/lib/typescript/module/components/TypingIndicator.d.ts.map +1 -0
- package/lib/typescript/module/core/api.d.ts +37 -0
- package/lib/typescript/module/core/api.d.ts.map +1 -0
- package/lib/typescript/module/core/config.d.ts +9 -0
- package/lib/typescript/module/core/config.d.ts.map +1 -0
- package/lib/typescript/module/core/errors.d.ts +35 -0
- package/lib/typescript/module/core/errors.d.ts.map +1 -0
- package/lib/typescript/module/core/offlineQueue.d.ts +16 -0
- package/lib/typescript/module/core/offlineQueue.d.ts.map +1 -0
- package/lib/typescript/module/core/pushNotifications.d.ts +6 -0
- package/lib/typescript/module/core/pushNotifications.d.ts.map +1 -0
- package/lib/typescript/module/core/session.d.ts +15 -0
- package/lib/typescript/module/core/session.d.ts.map +1 -0
- package/lib/typescript/module/core/theme.d.ts +43 -0
- package/lib/typescript/module/core/theme.d.ts.map +1 -0
- package/lib/typescript/module/core/types.d.ts +185 -0
- package/lib/typescript/module/core/types.d.ts.map +1 -0
- package/lib/typescript/module/core/websocket.d.ts +17 -0
- package/lib/typescript/module/core/websocket.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useChat.d.ts +35 -0
- package/lib/typescript/module/hooks/useChat.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useParlr.d.ts +11 -0
- package/lib/typescript/module/hooks/useParlr.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +30 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/provider/ParlrContext.d.ts +13 -0
- package/lib/typescript/module/provider/ParlrContext.d.ts.map +1 -0
- package/lib/typescript/module/provider/ParlrProvider.d.ts +5 -0
- package/lib/typescript/module/provider/ParlrProvider.d.ts.map +1 -0
- package/package.json +120 -0
- package/src/components/AttachmentPicker.tsx +310 -0
- package/src/components/AttachmentPreview.tsx +209 -0
- package/src/components/ChatBubble.tsx +424 -0
- package/src/components/EmptyState.tsx +118 -0
- package/src/components/ParlrChat.tsx +863 -0
- package/src/components/ParlrConversationList.tsx +559 -0
- package/src/components/PreChatForm.tsx +313 -0
- package/src/components/RichMessage.tsx +353 -0
- package/src/components/SatisfactionSurvey.tsx +333 -0
- package/src/components/TypingIndicator.tsx +89 -0
- package/src/core/api.ts +406 -0
- package/src/core/config.ts +39 -0
- package/src/core/errors.ts +68 -0
- package/src/core/offlineQueue.ts +94 -0
- package/src/core/pushNotifications.ts +22 -0
- package/src/core/session.ts +156 -0
- package/src/core/theme.ts +133 -0
- package/src/core/types.ts +237 -0
- package/src/core/websocket.ts +270 -0
- package/src/hooks/useChat.ts +534 -0
- package/src/hooks/useParlr.ts +43 -0
- package/src/index.ts +98 -0
- package/src/provider/ParlrContext.ts +40 -0
- package/src/provider/ParlrProvider.tsx +338 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface RichCard {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
imageUrl?: string;
|
|
6
|
+
actions?: RichAction[];
|
|
7
|
+
}
|
|
8
|
+
export interface RichAction {
|
|
9
|
+
type: 'link' | 'postback' | 'reply';
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RichCarousel {
|
|
14
|
+
cards: RichCard[];
|
|
15
|
+
}
|
|
16
|
+
export interface RichQuickReplies {
|
|
17
|
+
text?: string;
|
|
18
|
+
replies: Array<{
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
export interface RichContent {
|
|
24
|
+
type: 'card' | 'carousel' | 'quick_replies' | 'buttons';
|
|
25
|
+
card?: RichCard;
|
|
26
|
+
carousel?: RichCarousel;
|
|
27
|
+
quickReplies?: RichQuickReplies;
|
|
28
|
+
buttons?: RichAction[];
|
|
29
|
+
}
|
|
30
|
+
export interface RichMessageProps {
|
|
31
|
+
/** The rich content to render. Parsed from message metadata. */
|
|
32
|
+
content: RichContent;
|
|
33
|
+
/** Called when a postback/reply action is triggered. */
|
|
34
|
+
onAction?: (action: RichAction) => void;
|
|
35
|
+
/** Accent color for buttons. */
|
|
36
|
+
accentColor?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function tryParseRichContent(metadata?: Record<string, unknown>): RichContent | null;
|
|
39
|
+
export { tryParseRichContent };
|
|
40
|
+
export declare function RichMessage({ content, onAction, accentColor: accentColorProp, }: RichMessageProps): React.JSX.Element | null;
|
|
41
|
+
//# sourceMappingURL=RichMessage.d.ts.map
|
|
@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AAM,EAAE,OAAO,CAAC,GAAG,WAAW,GAAG,IAAI,CAMnF;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AA+F/B,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,WAAW,EAAE,eAAe,GAC7B,EAAE,gBAAgB,4BAwFlB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SatisfactionSurveyProps {
|
|
3
|
+
/** Called when the survey is submitted. */
|
|
4
|
+
onSubmit: (score: number, comment?: string) => Promise<void>;
|
|
5
|
+
/** Called when the user dismisses without rating. */
|
|
6
|
+
onDismiss?: () => void;
|
|
7
|
+
/** Title text. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Description text. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Accent color. */
|
|
12
|
+
accentColor?: string;
|
|
13
|
+
/** Locale for default text. */
|
|
14
|
+
locale?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function SatisfactionSurvey({ onSubmit, onDismiss, title, description, accentColor: accentColorProp, locale, }: SatisfactionSurveyProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=SatisfactionSurvey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SatisfactionSurvey.d.ts","sourceRoot":"","sources":["../../../../src/components/SatisfactionSurvey.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAerD,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2DD,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,WAAW,EAAE,eAAe,EAC5B,MAAM,GACP,EAAE,uBAAuB,qBAqHzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/TypingIndicator.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAYzC,UAAU,oBAAoB;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8BD,wBAAgB,eAAe,CAAC,EAAE,WAAW,EAAE,EAAE,oBAAoB,qBAepE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Attachment, Conversation, ParlrUser, Message, PaginatedResponse, ResolvedConfig, Session } from './types';
|
|
2
|
+
export interface ParlrApiClient {
|
|
3
|
+
/** Create a new anonymous session. */
|
|
4
|
+
createSession(): Promise<Session>;
|
|
5
|
+
/** Identify (or re-identify) the contact behind the current session. */
|
|
6
|
+
identify(user: ParlrUser): Promise<void>;
|
|
7
|
+
/** List conversations for the current contact. */
|
|
8
|
+
listConversations(page?: number): Promise<PaginatedResponse<Conversation>>;
|
|
9
|
+
/** Create a new conversation (optionally with a first message). */
|
|
10
|
+
createConversation(initialMessage?: string): Promise<Conversation>;
|
|
11
|
+
/** Fetch messages for a conversation. */
|
|
12
|
+
getMessages(conversationId: string, page?: number): Promise<PaginatedResponse<Message>>;
|
|
13
|
+
/** Send a message within a conversation. */
|
|
14
|
+
sendMessage(conversationId: string, content: string, clientId: string): Promise<Message>;
|
|
15
|
+
/** Notify the server that the contact is typing. */
|
|
16
|
+
sendTypingIndicator(conversationId: string, isTyping: boolean): Promise<void>;
|
|
17
|
+
/** Close a conversation. */
|
|
18
|
+
closeConversation(conversationId: string): Promise<Conversation>;
|
|
19
|
+
/** Reopen a closed conversation. */
|
|
20
|
+
reopenConversation(conversationId: string): Promise<Conversation>;
|
|
21
|
+
/** Upload an attachment to a conversation. */
|
|
22
|
+
uploadAttachment(conversationId: string, formData: FormData): Promise<Attachment>;
|
|
23
|
+
/** Subscribe to push notifications. */
|
|
24
|
+
subscribePush(token: string, platform: 'ios' | 'android'): Promise<void>;
|
|
25
|
+
/** Unsubscribe from push notifications. */
|
|
26
|
+
unsubscribePush(token: string): Promise<void>;
|
|
27
|
+
/** Submit a CSAT rating for a conversation. */
|
|
28
|
+
submitRating(conversationId: string, score: number, comment?: string): Promise<void>;
|
|
29
|
+
/** Search messages in a conversation. */
|
|
30
|
+
searchMessages(conversationId: string, query: string): Promise<PaginatedResponse<Message>>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a configured API client bound to a resolved config and an optional
|
|
34
|
+
* session token accessor (so the token can be refreshed externally).
|
|
35
|
+
*/
|
|
36
|
+
export declare function createApiClient(config: ResolvedConfig, getToken: () => string | null): ParlrApiClient;
|
|
37
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/core/api.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,OAAO,EACR,MAAM,SAAS,CAAC;AA6IjB,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC,kDAAkD;IAClD,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAA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,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,MAAM,GAAG,IAAI,GAC5B,cAAc,CAiLhB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ParlrConfig, ResolvedConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a partial user-supplied config into a fully-qualified config with
|
|
4
|
+
* all defaults applied.
|
|
5
|
+
*
|
|
6
|
+
* @throws {Error} if `workspaceId` is missing or empty.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveConfig(partial: ParlrConfig): ResolvedConfig;
|
|
9
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/core/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAY3D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAgBlE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Parlr SDK errors.
|
|
3
|
+
*/
|
|
4
|
+
export declare class ParlrError extends Error {
|
|
5
|
+
constructor(message: string, options?: ErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Network-level error (timeout, DNS failure, no internet).
|
|
9
|
+
*/
|
|
10
|
+
export declare class ParlrNetworkError extends ParlrError {
|
|
11
|
+
readonly statusCode?: number;
|
|
12
|
+
constructor(message: string, statusCode?: number, options?: ErrorOptions);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Authentication / session error (expired token, invalid session).
|
|
16
|
+
*/
|
|
17
|
+
export declare class ParlrAuthError extends ParlrError {
|
|
18
|
+
constructor(message: string, options?: ErrorOptions);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Validation error (invalid payload from API or WebSocket).
|
|
22
|
+
*/
|
|
23
|
+
export declare class ParlrValidationError extends ParlrError {
|
|
24
|
+
readonly field?: string;
|
|
25
|
+
constructor(message: string, field?: string, options?: ErrorOptions);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* WebSocket connection error (failed to connect, unexpected close).
|
|
29
|
+
*/
|
|
30
|
+
export declare class ParlrConnectionError extends ParlrError {
|
|
31
|
+
readonly code?: number;
|
|
32
|
+
readonly reason?: string;
|
|
33
|
+
constructor(message: string, code?: number, reason?: string, options?: ErrorOptions);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/core/errors.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKzE;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;gBAChC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKpE;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEpB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAMpF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ParlrApiClient } from './api';
|
|
2
|
+
export interface QueuedMessage {
|
|
3
|
+
conversationId: string;
|
|
4
|
+
content: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}
|
|
8
|
+
/** Enqueue a message for later delivery. */
|
|
9
|
+
export declare function queueMessage(msg: QueuedMessage): Promise<void>;
|
|
10
|
+
/** Return all currently queued messages. */
|
|
11
|
+
export declare function getQueuedMessages(): Promise<QueuedMessage[]>;
|
|
12
|
+
/** Remove a single message from the queue by clientId. */
|
|
13
|
+
export declare function removeFromQueue(clientId: string): Promise<void>;
|
|
14
|
+
/** Attempt to send all queued messages via the API, removing successful ones. */
|
|
15
|
+
export declare function flushQueue(api: ParlrApiClient): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=offlineQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offlineQueue.d.ts","sourceRoot":"","sources":["../../../../src/core/offlineQueue.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAgDD,4CAA4C;AAC5C,wBAAsB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpE;AAED,4CAA4C;AAC5C,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAElE;AAED,0DAA0D;AAC1D,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrE;AAED,iFAAiF;AACjF,wBAAsB,UAAU,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAYnE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParlrApiClient } from './api';
|
|
2
|
+
/** Register a device push token with the Parlr backend. */
|
|
3
|
+
export declare function registerPushToken(api: ParlrApiClient, token: string, platform: 'ios' | 'android'): Promise<void>;
|
|
4
|
+
/** Unregister a previously registered push token. */
|
|
5
|
+
export declare function unregisterPushToken(api: ParlrApiClient, token: string): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=pushNotifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushNotifications.d.ts","sourceRoot":"","sources":["../../../../src/core/pushNotifications.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,2DAA2D;AAC3D,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,KAAK,GAAG,SAAS,GAC1B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,qDAAqD;AACrD,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Session } from './types';
|
|
2
|
+
/** Persist session to secure storage (or memory fallback). */
|
|
3
|
+
export declare function saveSession(workspaceId: string, session: Session): Promise<void>;
|
|
4
|
+
/** Retrieve persisted session, or null if none exists. */
|
|
5
|
+
export declare function loadSession(workspaceId: string): Promise<Session | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns true when the session token has not yet expired.
|
|
8
|
+
* Adds a 60-second safety margin to avoid edge-case failures.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isSessionValid(session: Session): boolean;
|
|
11
|
+
/** Delete persisted session for a workspace. */
|
|
12
|
+
export declare function clearSession(workspaceId: string): Promise<void>;
|
|
13
|
+
/** Reset the storage adapter (for testing). */
|
|
14
|
+
export declare function _resetAdapter(): void;
|
|
15
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/core/session.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA+DvC,8DAA8D;AAC9D,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,0DAA0D;AAC1D,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CA+BzB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAmBxD;AAED,gDAAgD;AAChD,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrE;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,IAAI,IAAI,CAGpC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ParlrTheme {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: string;
|
|
4
|
+
primaryText: string;
|
|
5
|
+
background: string;
|
|
6
|
+
surface: string;
|
|
7
|
+
surfaceDark: string;
|
|
8
|
+
text: string;
|
|
9
|
+
textSecondary: string;
|
|
10
|
+
border: string;
|
|
11
|
+
success: string;
|
|
12
|
+
error: string;
|
|
13
|
+
agentBubble: string;
|
|
14
|
+
agentBubbleDark: string;
|
|
15
|
+
agentText: string;
|
|
16
|
+
agentTextDark: string;
|
|
17
|
+
contactBubble: string;
|
|
18
|
+
contactText: string;
|
|
19
|
+
};
|
|
20
|
+
borderRadius: {
|
|
21
|
+
bubble: number;
|
|
22
|
+
input: number;
|
|
23
|
+
button: number;
|
|
24
|
+
avatar: number;
|
|
25
|
+
};
|
|
26
|
+
spacing: {
|
|
27
|
+
xs: number;
|
|
28
|
+
sm: number;
|
|
29
|
+
md: number;
|
|
30
|
+
lg: number;
|
|
31
|
+
xl: number;
|
|
32
|
+
};
|
|
33
|
+
typography: {
|
|
34
|
+
headerSize: number;
|
|
35
|
+
bodySize: number;
|
|
36
|
+
captionSize: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export declare const defaultLightTheme: ParlrTheme;
|
|
40
|
+
export declare const defaultDarkTheme: ParlrTheme;
|
|
41
|
+
/** Deep-merge a base theme with partial overrides. */
|
|
42
|
+
export declare function mergeTheme(base: ParlrTheme, overrides: Partial<ParlrTheme>): ParlrTheme;
|
|
43
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/core/theme.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,UAqC/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,UAqC9B,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,GAC7B,UAAU,CAOZ"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { ParlrError } from './errors';
|
|
2
|
+
import type { ParlrTheme } from './theme';
|
|
3
|
+
/** SDK configuration. Only `workspaceId` is required. */
|
|
4
|
+
export interface ParlrConfig {
|
|
5
|
+
/** Unique workspace identifier (e.g. "ws_abc123"). */
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
/** REST API base URL. Defaults to https://api.parlr.chat/api/v1/widget */
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
/** WebSocket endpoint. Defaults to wss://ws.parlr.chat/ws */
|
|
10
|
+
wsUrl?: string;
|
|
11
|
+
/** Locale code (BCP-47). Defaults to "fr". */
|
|
12
|
+
locale?: string;
|
|
13
|
+
/** Enable verbose console logging. Defaults to false. */
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
/** Global error callback for the host app to monitor SDK errors. */
|
|
16
|
+
onError?: (error: ParlrError) => void;
|
|
17
|
+
/** HMAC identity verification token for secure identification. */
|
|
18
|
+
identityToken?: string;
|
|
19
|
+
/** Custom theme overrides. Merged with the default light/dark theme. */
|
|
20
|
+
theme?: Partial<ParlrTheme>;
|
|
21
|
+
}
|
|
22
|
+
/** Resolved configuration with all defaults applied. */
|
|
23
|
+
export interface ResolvedConfig {
|
|
24
|
+
workspaceId: string;
|
|
25
|
+
apiBaseUrl: string;
|
|
26
|
+
wsUrl: string;
|
|
27
|
+
locale: string;
|
|
28
|
+
debug: boolean;
|
|
29
|
+
onError?: (error: ParlrError) => void;
|
|
30
|
+
identityToken?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Visitor / contact identity passed by the host app. */
|
|
33
|
+
export interface ParlrUser {
|
|
34
|
+
email?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
firstName?: string;
|
|
37
|
+
lastName?: string;
|
|
38
|
+
externalId?: string;
|
|
39
|
+
phone?: string;
|
|
40
|
+
company?: string;
|
|
41
|
+
customAttributes?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/** Persisted session returned by the widget API. */
|
|
44
|
+
export interface Session {
|
|
45
|
+
token: string;
|
|
46
|
+
contactId: string;
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
expiresAt: string;
|
|
49
|
+
}
|
|
50
|
+
/** Conversation summary. */
|
|
51
|
+
export interface Conversation {
|
|
52
|
+
id: string;
|
|
53
|
+
status: 'open' | 'resolved' | 'pending' | 'closed';
|
|
54
|
+
subject: string | null;
|
|
55
|
+
lastMessageAt: string | null;
|
|
56
|
+
unreadCount: number;
|
|
57
|
+
assignee?: {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
avatarUrl?: string;
|
|
61
|
+
} | null;
|
|
62
|
+
}
|
|
63
|
+
/** Attachment on a message. */
|
|
64
|
+
export interface Attachment {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
url: string;
|
|
68
|
+
contentType: string;
|
|
69
|
+
size: number;
|
|
70
|
+
}
|
|
71
|
+
/** Content type of a message. */
|
|
72
|
+
export type MessageContentType = 'text' | 'image' | 'file' | 'rich';
|
|
73
|
+
/** CSAT rating request. */
|
|
74
|
+
export interface RatingRequest {
|
|
75
|
+
score: number;
|
|
76
|
+
comment?: string;
|
|
77
|
+
}
|
|
78
|
+
/** Chat message within a conversation. */
|
|
79
|
+
export interface Message {
|
|
80
|
+
id: string;
|
|
81
|
+
conversationId: string;
|
|
82
|
+
senderType: 'contact' | 'agent';
|
|
83
|
+
senderName?: string;
|
|
84
|
+
senderAvatarUrl?: string;
|
|
85
|
+
content: string;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
/** Client-generated UUID used for optimistic updates and idempotency. */
|
|
88
|
+
clientId?: string;
|
|
89
|
+
/** Delivery status for optimistic messages. */
|
|
90
|
+
status?: 'sending' | 'sent' | 'failed' | 'read';
|
|
91
|
+
/** File/media attachments. */
|
|
92
|
+
attachments?: Attachment[];
|
|
93
|
+
/** Content type of the message body. */
|
|
94
|
+
contentType?: MessageContentType;
|
|
95
|
+
/** Rich content metadata (cards, buttons, etc.). */
|
|
96
|
+
metadata?: Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
export type WsOutgoingType = 'auth' | 'send_message' | 'typing_start' | 'typing_stop' | 'message_seen' | 'ping';
|
|
99
|
+
export type WsIncomingType = 'auth_ok' | 'auth_error' | 'new_message' | 'typing_start' | 'typing_stop' | 'message_seen' | 'conversation_updated' | 'pong' | 'disconnected' | 'error';
|
|
100
|
+
export interface WsOutgoingPayload {
|
|
101
|
+
type: WsOutgoingType;
|
|
102
|
+
payload?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
export interface WsIncomingPayload {
|
|
105
|
+
type: WsIncomingType;
|
|
106
|
+
payload?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
export interface WsNewMessagePayload {
|
|
109
|
+
id: string;
|
|
110
|
+
conversationId: string;
|
|
111
|
+
senderType: 'contact' | 'agent';
|
|
112
|
+
senderName?: string;
|
|
113
|
+
senderAvatarUrl?: string;
|
|
114
|
+
content: string;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
clientId?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface WsTypingPayload {
|
|
119
|
+
conversationId: string;
|
|
120
|
+
senderType?: 'agent' | 'contact';
|
|
121
|
+
senderName?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface WsMessageSeenPayload {
|
|
124
|
+
conversationId: string;
|
|
125
|
+
messageId: string;
|
|
126
|
+
seenBy: string;
|
|
127
|
+
}
|
|
128
|
+
export interface WsConversationUpdatedPayload {
|
|
129
|
+
conversationId: string;
|
|
130
|
+
status?: 'open' | 'resolved' | 'pending' | 'closed';
|
|
131
|
+
assignee?: {
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
} | null;
|
|
135
|
+
}
|
|
136
|
+
export interface WsAuthOkPayload {
|
|
137
|
+
contactId: string;
|
|
138
|
+
}
|
|
139
|
+
export interface WsAuthErrorPayload {
|
|
140
|
+
code?: number;
|
|
141
|
+
reason?: string;
|
|
142
|
+
message?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface WsErrorPayload {
|
|
145
|
+
code?: string;
|
|
146
|
+
message?: string;
|
|
147
|
+
}
|
|
148
|
+
/** Type-safe mapping from incoming WS event type to its payload. */
|
|
149
|
+
export interface WsEventMap {
|
|
150
|
+
auth_ok: WsAuthOkPayload;
|
|
151
|
+
auth_error: WsAuthErrorPayload;
|
|
152
|
+
new_message: WsNewMessagePayload;
|
|
153
|
+
typing_start: WsTypingPayload;
|
|
154
|
+
typing_stop: WsTypingPayload;
|
|
155
|
+
message_seen: WsMessageSeenPayload;
|
|
156
|
+
conversation_updated: WsConversationUpdatedPayload;
|
|
157
|
+
pong: Record<string, never>;
|
|
158
|
+
disconnected: {
|
|
159
|
+
code?: number;
|
|
160
|
+
reason?: string;
|
|
161
|
+
};
|
|
162
|
+
error: WsErrorPayload;
|
|
163
|
+
}
|
|
164
|
+
export interface PaginatedResponse<T> {
|
|
165
|
+
data: T[];
|
|
166
|
+
meta: {
|
|
167
|
+
page: number;
|
|
168
|
+
perPage: number;
|
|
169
|
+
total: number;
|
|
170
|
+
hasMore: boolean;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface ParlrContextValue {
|
|
174
|
+
config: ResolvedConfig;
|
|
175
|
+
session: Session | null;
|
|
176
|
+
isReady: boolean;
|
|
177
|
+
isConnected: boolean;
|
|
178
|
+
conversations: Conversation[];
|
|
179
|
+
unreadCount: number;
|
|
180
|
+
identify: (user: ParlrUser) => Promise<void>;
|
|
181
|
+
refreshConversations: () => Promise<void>;
|
|
182
|
+
/** Resolved theme (light or dark, merged with user overrides). */
|
|
183
|
+
theme: ParlrTheme;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,yDAAyD;AACzD,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,KAA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AAI,CAAC,CAAC;IAC1C,kEAAkE;IAClE,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ResolvedConfig, WsEventMap, WsIncomingType, WsOutgoingPayload } from './types';
|
|
2
|
+
type Listener<T extends WsIncomingType> = (payload: WsEventMap[T]) => void;
|
|
3
|
+
export interface ParlrWebSocket {
|
|
4
|
+
/** Open the connection (idempotent). */
|
|
5
|
+
connect(sessionToken: string): void;
|
|
6
|
+
/** Gracefully close the connection. Will NOT auto-reconnect. */
|
|
7
|
+
disconnect(): void;
|
|
8
|
+
/** Send a typed frame. */
|
|
9
|
+
send(frame: WsOutgoingPayload): void;
|
|
10
|
+
/** Subscribe to a specific incoming event type. Returns unsubscribe fn. */
|
|
11
|
+
on<T extends WsIncomingType>(type: T, listener: Listener<T>): () => void;
|
|
12
|
+
/** Whether the socket is currently open. */
|
|
13
|
+
readonly connected: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function createWebSocket(config: ResolvedConfig): ParlrWebSocket;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../../src/core/websocket.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EAEV,cAAc,EACd,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAMjB,KAAK,QAAQ,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,gEAAgE;IAChE,UAAU,IAAI,IAAI,CAAC;IACnB,0BAA0B;IAC1B,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACrC,2EAA2E;IAC3E,EAAE,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IACzE,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AA4BD,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CA+MtE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Conversation, Message } from '../core/types';
|
|
2
|
+
export interface UseChatReturn {
|
|
3
|
+
/** Ordered message list (newest last). */
|
|
4
|
+
messages: Message[];
|
|
5
|
+
/** True while the initial message page is loading. */
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
/** True if a load/send error occurred. */
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
/** The active conversation (may be null until first message). */
|
|
10
|
+
conversation: Conversation | null;
|
|
11
|
+
/** Whether an agent is currently typing. */
|
|
12
|
+
agentTyping: boolean;
|
|
13
|
+
/** Send a text message. Creates the conversation on first call if needed. */
|
|
14
|
+
sendMessage: (content: string) => Promise<void>;
|
|
15
|
+
/** Retry sending a failed message by its clientId. */
|
|
16
|
+
retryMessage: (clientId: string) => Promise<void>;
|
|
17
|
+
/** Notify the server that the contact started/stopped typing. */
|
|
18
|
+
notifyTyping: (isTyping: boolean) => void;
|
|
19
|
+
/** Load older messages (pagination). */
|
|
20
|
+
loadMore: () => Promise<void>;
|
|
21
|
+
/** Whether there are older messages to load. */
|
|
22
|
+
hasMore: boolean;
|
|
23
|
+
/** Close the current conversation. */
|
|
24
|
+
closeConversation: () => Promise<void>;
|
|
25
|
+
/** Reopen the current conversation. */
|
|
26
|
+
reopenConversation: () => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Chat hook — manages messages and typing for one conversation.
|
|
30
|
+
*
|
|
31
|
+
* @param conversationId - Existing conversation ID, or undefined to create
|
|
32
|
+
* one on first `sendMessage`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useChat(conversationId?: string): UseChatReturn;
|
|
35
|
+
//# sourceMappingURL=useChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useChat.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EAIR,MAAM,eAAe,CAAC;AAKvB,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,sDAAsD;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,sDAAsD;IACtD,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,iEAAiE;IACjE,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,wCAAwC;IACxC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,uCAAuC;IACvC,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAqBD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,aAAa,CAuc9D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParlrContextValue } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Access the Parlr SDK from any component within a `<ParlrProvider>`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const { isReady, identify, conversations, unreadCount } = useParlr();
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare function useParlr(): ParlrContextValue;
|
|
11
|
+
//# sourceMappingURL=useParlr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useParlr.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useParlr.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAsB5C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { ParlrProvider } from './provider/ParlrProvider';
|
|
2
|
+
export { ParlrChat } from './components/ParlrChat';
|
|
3
|
+
export { ParlrConversationList } from './components/ParlrConversationList';
|
|
4
|
+
export { ChatBubble } from './components/ChatBubble';
|
|
5
|
+
export { TypingIndicator } from './components/TypingIndicator';
|
|
6
|
+
export { EmptyState } from './components/EmptyState';
|
|
7
|
+
export { PreChatForm } from './components/PreChatForm';
|
|
8
|
+
export { SatisfactionSurvey } from './components/SatisfactionSurvey';
|
|
9
|
+
export { AttachmentPicker } from './components/AttachmentPicker';
|
|
10
|
+
export { AttachmentPreview } from './components/AttachmentPreview';
|
|
11
|
+
export { RichMessage } from './components/RichMessage';
|
|
12
|
+
export { useParlr } from './hooks/useParlr';
|
|
13
|
+
export { useChat } from './hooks/useChat';
|
|
14
|
+
export { ParlrError, ParlrNetworkError, ParlrAuthError, ParlrValidationError, ParlrConnectionError, } from './core/errors';
|
|
15
|
+
export type { Attachment, MessageContentType, RatingRequest, ParlrConfig, ParlrUser, Conversation, Message, Session, ResolvedConfig, ParlrContextValue, WsEventMap, WsNewMessagePayload, WsTypingPayload, WsConversationUpdatedPayload, } from './core/types';
|
|
16
|
+
export { queueMessage, getQueuedMessages, removeFromQueue, flushQueue, } from './core/offlineQueue';
|
|
17
|
+
export type { QueuedMessage } from './core/offlineQueue';
|
|
18
|
+
export { registerPushToken, unregisterPushToken } from './core/pushNotifications';
|
|
19
|
+
export { defaultLightTheme, defaultDarkTheme, mergeTheme, } from './core/theme';
|
|
20
|
+
export type { ParlrTheme } from './core/theme';
|
|
21
|
+
export type { ParlrProviderProps } from './provider/ParlrProvider';
|
|
22
|
+
export type { ParlrChatProps } from './components/ParlrChat';
|
|
23
|
+
export type { ParlrConversationListProps } from './components/ParlrConversationList';
|
|
24
|
+
export type { PreChatFormProps } from './components/PreChatForm';
|
|
25
|
+
export type { SatisfactionSurveyProps } from './components/SatisfactionSurvey';
|
|
26
|
+
export type { AttachmentPickerProps, PickedFile } from './components/AttachmentPicker';
|
|
27
|
+
export type { AttachmentPreviewProps } from './components/AttachmentPreview';
|
|
28
|
+
export type { RichMessageProps, RichContent, RichCard, RichAction } from './components/RichMessage';
|
|
29
|
+
export type { UseChatReturn } from './hooks/useChat';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAA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CAAC;AACvF,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACpG,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ParlrApiClient } from '../core/api';
|
|
2
|
+
import type { ParlrContextValue } from '../core/types';
|
|
3
|
+
import type { ParlrWebSocket } from '../core/websocket';
|
|
4
|
+
/**
|
|
5
|
+
* Public context consumed by hooks (`useParlr`, `useChat`).
|
|
6
|
+
* Includes both user-facing state and internal plumbing (api, ws).
|
|
7
|
+
*/
|
|
8
|
+
export interface ParlrContextInternal extends ParlrContextValue {
|
|
9
|
+
api: ParlrApiClient | null;
|
|
10
|
+
ws: ParlrWebSocket | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const ParlrContext: import("react").Context<ParlrContextInternal>;
|
|
13
|
+
//# sourceMappingURL=ParlrContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParlrContext.d.ts","sourceRoot":"","sources":["../../../../src/provider/ParlrContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,GAAG,EAAE,cAAc,GAAG,IAAI,CAAC;IAC3B,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;CAC3B;AAID,eAAO,MAAM,YAAY,+CAkBvB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
import type { ParlrConfig } from '../core/types';
|
|
3
|
+
export type ParlrProviderProps = PropsWithChildren<ParlrConfig>;
|
|
4
|
+
export declare function ParlrProvider({ children, ...configProps }: ParlrProviderProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=ParlrProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParlrProvider.d.ts","sourceRoot":"","sources":["../../../../src/provider/ParlrProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAMZ,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAgBf,OAAO,KAAK,EAEV,WAAW,EAIZ,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AA2BhE,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,GAAG,WAAW,EACf,EAAE,kBAAkB,qBAsQpB"}
|