@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,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,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC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,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,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,M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,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":"commonjs"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PickedFile {
|
|
3
|
+
uri: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
size: number;
|
|
7
|
+
}
|
|
8
|
+
export interface AttachmentPickerProps {
|
|
9
|
+
/** Called when a file is selected. */
|
|
10
|
+
onFilePicked: (file: PickedFile) => void;
|
|
11
|
+
/** Called to dismiss the picker. */
|
|
12
|
+
onDismiss: () => void;
|
|
13
|
+
/** Max file size in bytes. Default: 25MB. */
|
|
14
|
+
maxFileSize?: number;
|
|
15
|
+
/** Allowed MIME types. Default: images + documents. */
|
|
16
|
+
allowedTypes?: string[];
|
|
17
|
+
/** Accent color. */
|
|
18
|
+
accentColor?: string;
|
|
19
|
+
/** Locale. */
|
|
20
|
+
locale?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function AttachmentPicker({ onFilePicked, onDismiss, maxFileSize, accentColor: accentColorProp, locale, }: AttachmentPickerProps): React.JSX.Element;
|
|
23
|
+
//# sourceMappingURL=AttachmentPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentPicker.tsx"],"names":[],"mappings":"AASA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAcvD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,oCAAoC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAkED,wBAAgB,gBAAgB,CAAC,EAC/B,YAAY,EACZ,SAAS,EACT,WAAmC,EACnC,WAAW,EAAE,eAAe,EAC5B,MAAM,GACP,EAAE,qBAAqB,qBA4JvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PickedFile } from './AttachmentPicker';
|
|
3
|
+
export interface AttachmentPreviewProps {
|
|
4
|
+
/** The file to preview. */
|
|
5
|
+
file: PickedFile;
|
|
6
|
+
/** Called when the user removes the attachment. */
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
/** Called when the user confirms and sends. */
|
|
9
|
+
onSend: () => void;
|
|
10
|
+
/** Accent color. */
|
|
11
|
+
accentColor?: string;
|
|
12
|
+
/** Locale. */
|
|
13
|
+
locale?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function AttachmentPreview({ file, onRemove, onSend, accentColor: accentColorProp, locale, }: AttachmentPreviewProps): React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=AttachmentPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentPreview.d.ts","sourceRoot":"","sources":["../../../../src/components/AttachmentPreview.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMrD,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2BD,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,WAAW,EAAE,eAAe,EAC5B,MAAM,GACP,EAAE,sBAAsB,qBAuDxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Message } from '../core/types';
|
|
3
|
+
import type { RichAction } from './RichMessage';
|
|
4
|
+
interface ChatBubbleProps {
|
|
5
|
+
message: Message;
|
|
6
|
+
accentColor?: string;
|
|
7
|
+
/** If true, apply the entrance animation (for newly-appended messages). */
|
|
8
|
+
animated?: boolean;
|
|
9
|
+
/** Called when a rich message action is triggered. */
|
|
10
|
+
onRichAction?: (action: RichAction) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ChatBubble({ message, accentColor, animated, onRichAction, }: ChatBubbleProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ChatBubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatBubble.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatBubble.tsx"],"names":[],"mappings":"AASA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAapD,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CAC7C;AA+ID,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,QAAgB,EAChB,YAAY,GACb,EAAE,eAAe,qBAsGjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface EmptyStateProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
accentColor?: string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function EmptyState({ title, description, accentColor, locale, }: EmptyStateProps): React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=EmptyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../../../src/components/EmptyState.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAmBD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,WAAW,EACX,MAAM,GACP,EAAE,eAAe,qBA2BjB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ParlrUser } from '../core/types';
|
|
3
|
+
export interface ParlrChatProps {
|
|
4
|
+
/** Identify the user on mount (optional — can also call `useParlr().identify`). */
|
|
5
|
+
user?: ParlrUser;
|
|
6
|
+
/** Existing conversation id. If omitted, a new one is created on first message. */
|
|
7
|
+
conversationId?: string;
|
|
8
|
+
/** Back button handler. If provided, a back arrow is shown in the header. */
|
|
9
|
+
onBack?: () => void;
|
|
10
|
+
/** Header title. Default: "Support". */
|
|
11
|
+
headerTitle?: string;
|
|
12
|
+
/** Input placeholder text. */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Empty state title. */
|
|
15
|
+
emptyStateTitle?: string;
|
|
16
|
+
/** Empty state description. */
|
|
17
|
+
emptyStateDescription?: string;
|
|
18
|
+
/** Primary accent color for contact bubbles, send button, etc. */
|
|
19
|
+
accentColor?: string;
|
|
20
|
+
/** Show the header bar. Default: true. */
|
|
21
|
+
showHeader?: boolean;
|
|
22
|
+
/** Show the pre-chat form if user is not identified. Default: false. */
|
|
23
|
+
showPreChatForm?: boolean;
|
|
24
|
+
/** Fields for pre-chat form. Default: ['name', 'email']. */
|
|
25
|
+
preChatFields?: Array<'name' | 'email' | 'phone'>;
|
|
26
|
+
/** Show CSAT survey after conversation is closed. Default: true. */
|
|
27
|
+
showSatisfactionSurvey?: boolean;
|
|
28
|
+
/** Called when conversation is closed. */
|
|
29
|
+
onConversationClosed?: () => void;
|
|
30
|
+
/** Bottom safe-area inset the host app applies (default 0). Set this to your bottom inset so the input bar sits flush above the keyboard. */
|
|
31
|
+
safeAreaBottom?: number;
|
|
32
|
+
}
|
|
33
|
+
export declare function ParlrChat({ user, conversationId, onBack, headerTitle, placeholder, emptyStateTitle, emptyStateDescription, accentColor: accentColorProp, showHeader, showPreChatForm, preChatFields, showSatisfactionSurvey, onConversationClosed, safeAreaBottom, }: ParlrChatProps): React.JSX.Element;
|
|
34
|
+
//# sourceMappingURL=ParlrChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParlrChat.d.ts","sourceRoot":"","sources":["../../../../src/components/ParlrChat.tsx"],"names":[],"mappings":"AAWA,OAAO,KAMN,MAAM,OAAO,CAAC;AAsBf,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,eAAe,CAAC;AAgBxD,MAAM,WAAW,cAAc;IAC7B,mFAAmF;IACnF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IAClD,oEAAoE;IACpE,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,0CAA0C;IAC1C,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,6IAA6I;IAC7I,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAmID,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,cAAc,EACd,MAAM,EACN,WAAW,EACX,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,WAAW,EAAE,eAAe,EAC5B,UAAiB,EACjB,eAAuB,EACvB,aAAiC,EACjC,sBAA6B,EAC7B,oBAAoB,EACpB,cAAkB,GACnB,EAAE,cAAc,qBA4dhB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ParlrConversationListProps {
|
|
3
|
+
/** Callback when a conversation is tapped. */
|
|
4
|
+
onSelectConversation: (conversationId: string) => void;
|
|
5
|
+
/** Callback for the "New Conversation" button. */
|
|
6
|
+
onNewConversation?: () => void;
|
|
7
|
+
/** Header title. Default: "Conversations". */
|
|
8
|
+
headerTitle?: string;
|
|
9
|
+
/** Primary accent color. */
|
|
10
|
+
accentColor?: string;
|
|
11
|
+
/** Show header bar. Default: true. */
|
|
12
|
+
showHeader?: boolean;
|
|
13
|
+
/** Filter conversations by status. */
|
|
14
|
+
statusFilter?: 'open' | 'closed' | 'pending';
|
|
15
|
+
}
|
|
16
|
+
export declare function ParlrConversationList({ onSelectConversation, onNewConversation, headerTitle, accentColor: accentColorProp, showHeader, statusFilter, }: ParlrConversationListProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=ParlrConversationList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParlrConversationList.d.ts","sourceRoot":"","sources":["../../../../src/components/ParlrConversationList.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmB5E,MAAM,WAAW,0BAA0B;IACzC,8CAA8C;IAC9C,oBAAoB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC9C;AAsMD,wBAAgB,qBAAqB,CAAC,EACpC,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,WAAW,EAAE,eAAe,EAC5B,UAAiB,EACjB,YAAY,GACb,EAAE,0BAA0B,qBA8G5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ParlrUser } from '../core/types';
|
|
3
|
+
export interface PreChatFormProps {
|
|
4
|
+
/** Called when the form is submitted with user data. */
|
|
5
|
+
onSubmit: (user: ParlrUser) => Promise<void>;
|
|
6
|
+
/** Fields to collect. Default: ['name', 'email']. */
|
|
7
|
+
fields?: Array<'name' | 'email' | 'phone'>;
|
|
8
|
+
/** Title text. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Description text. */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Submit button label. */
|
|
13
|
+
submitLabel?: string;
|
|
14
|
+
/** Accent color for the submit button. */
|
|
15
|
+
accentColor?: string;
|
|
16
|
+
/** Locale for default text. */
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function PreChatForm({ onSubmit, fields, title, description, submitLabel, accentColor: accentColorProp, locale, }: PreChatFormProps): React.JSX.Element;
|
|
20
|
+
//# sourceMappingURL=PreChatForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreChatForm.d.ts","sourceRoot":"","sources":["../../../../src/components/PreChatForm.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAYrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/C,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,qDAAqD;IACrD,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IAC3C,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2CD,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,MAA0B,EAC1B,KAAK,EACL,WAAW,EACX,WAAW,EACX,WAAW,EAAE,eAAe,EAC5B,MAAM,GACP,EAAE,gBAAgB,qBA6IlB"}
|