polymorph-sdk 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +391 -247
- package/package.json +1 -1
- package/src/IdentityForm.tsx +27 -1
- package/src/PolymorphWidget.tsx +14 -1
- package/src/WidgetPanel.tsx +30 -4
- package/src/__tests__/IdentityForm.test.tsx +10 -1
- package/src/__tests__/PolymorphWidget.test.tsx +31 -7
- package/src/__tests__/usePolymorphSession.test.ts +6 -0
- package/src/styles.module.css +19 -0
- package/src/types.ts +24 -0
- package/src/usePolymorphSession.ts +181 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Dispatch } from 'react';
|
|
1
2
|
import { JSX } from 'react/jsx-runtime';
|
|
2
3
|
import { Room } from 'livekit-client';
|
|
4
|
+
import { SetStateAction } from 'react';
|
|
3
5
|
|
|
4
6
|
export declare interface ChatMessage {
|
|
5
7
|
id: string;
|
|
@@ -32,6 +34,9 @@ export declare interface ResolvedWidgetConfig {
|
|
|
32
34
|
greeting: string;
|
|
33
35
|
collectEmail: FieldRequirement;
|
|
34
36
|
collectPhone: FieldRequirement;
|
|
37
|
+
alwaysOn: boolean;
|
|
38
|
+
enableTermsAndConditions: boolean;
|
|
39
|
+
termsAndConditionsText: string;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
declare interface RoomConnection {
|
|
@@ -66,6 +71,10 @@ export declare function usePolymorphSession(config: WidgetConfig): {
|
|
|
66
71
|
setUser: (user: WidgetUser) => void;
|
|
67
72
|
clearUnread: () => void;
|
|
68
73
|
setPanelOpen: (open: boolean) => void;
|
|
74
|
+
emitEvent: (type: WidgetEventType, payload?: Record<string, unknown>) => void;
|
|
75
|
+
setError: Dispatch<SetStateAction<string | null>>;
|
|
76
|
+
needsTermsAcceptance: boolean;
|
|
77
|
+
acceptTerms: () => void;
|
|
69
78
|
};
|
|
70
79
|
|
|
71
80
|
export declare interface WidgetConfig {
|
|
@@ -87,8 +96,12 @@ export declare interface WidgetConfig {
|
|
|
87
96
|
roomId: string;
|
|
88
97
|
joinToken: string;
|
|
89
98
|
}) => void;
|
|
99
|
+
/** Auto-capture behavioral events (page_view, idle, rage_click). Defaults to true. */
|
|
100
|
+
autoCapture?: boolean;
|
|
90
101
|
}
|
|
91
102
|
|
|
103
|
+
declare type WidgetEventType = "page_view" | "click" | "form_start" | "form_abandon" | "error_seen" | "idle" | "rage_click" | "scroll_depth" | "custom";
|
|
104
|
+
|
|
92
105
|
export declare interface WidgetUser {
|
|
93
106
|
/** Display name (e.g. "Jane Smith") */
|
|
94
107
|
name?: string;
|