farvex 1.0.0 → 2.0.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/CHANGELOG.md +19 -0
- package/README.md +150 -224
- package/dist/index.cjs +652 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +652 -61
- package/dist/index.js.map +1 -1
- package/dist/livekit/index.cjs +43 -1
- package/dist/livekit/index.cjs.map +1 -1
- package/dist/livekit/index.d.cts +18 -0
- package/dist/livekit/index.d.ts +18 -0
- package/dist/livekit/index.js +46 -0
- package/dist/livekit/index.js.map +1 -1
- package/dist/react/index.cjs +17 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +11 -8
- package/dist/react/index.d.ts +11 -8
- package/dist/react/index.js +16 -3
- package/dist/react/index.js.map +1 -1
- package/dist/{types-DhJEeeui.d.cts → types-BjVaSMZ6.d.cts} +68 -5
- package/dist/{types-DhJEeeui.d.ts → types-BjVaSMZ6.d.ts} +68 -5
- package/package.json +3 -2
|
@@ -8,6 +8,10 @@ declare class CallpadError extends Error {
|
|
|
8
8
|
constructor(code: string, message: string, status?: number | undefined);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Canonical E.164 phone number with a leading plus.
|
|
13
|
+
*/
|
|
14
|
+
type E164Phone = string;
|
|
11
15
|
type RealtimeToken = {
|
|
12
16
|
url: string;
|
|
13
17
|
token: string;
|
|
@@ -31,7 +35,7 @@ type VoiceParticipant = {
|
|
|
31
35
|
userId: number | null;
|
|
32
36
|
agentId: string | null;
|
|
33
37
|
contactId: string | null;
|
|
34
|
-
phone:
|
|
38
|
+
phone: E164Phone | null;
|
|
35
39
|
firstName: string | null;
|
|
36
40
|
lastName: string | null;
|
|
37
41
|
profilePhoto: string | null;
|
|
@@ -106,6 +110,55 @@ type SessionDuration = {
|
|
|
106
110
|
endedAt: Nullable<string>;
|
|
107
111
|
running: boolean;
|
|
108
112
|
};
|
|
113
|
+
type SessionPhase = "incoming" | "outgoing" | "connecting" | "active" | "ending" | "ended" | "failed";
|
|
114
|
+
type SessionDirection = "inbound" | "outbound";
|
|
115
|
+
type CurrentSession = {
|
|
116
|
+
phase: SessionPhase;
|
|
117
|
+
direction: SessionDirection;
|
|
118
|
+
sessionId: string;
|
|
119
|
+
participantId: Nullable<string>;
|
|
120
|
+
session: Nullable<VoiceSession>;
|
|
121
|
+
join: Nullable<VoiceJoinGrant>;
|
|
122
|
+
startedBy: "start" | "accept" | "join";
|
|
123
|
+
error: Nullable<CallpadError>;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
answeredAt: Nullable<string>;
|
|
126
|
+
endedAt: Nullable<string>;
|
|
127
|
+
};
|
|
128
|
+
type CurrentSessionSnapshot = {
|
|
129
|
+
current: Nullable<CurrentSession>;
|
|
130
|
+
incoming: readonly SessionInvite[];
|
|
131
|
+
busy: boolean;
|
|
132
|
+
};
|
|
133
|
+
type SessionStartBehavior = "rejectWhileBusy" | "focusExisting" | "allowParallel";
|
|
134
|
+
type SessionMediaRequirement = "required" | "optional";
|
|
135
|
+
type SessionStartOptions = {
|
|
136
|
+
behavior?: SessionStartBehavior;
|
|
137
|
+
media?: SessionMediaRequirement;
|
|
138
|
+
};
|
|
139
|
+
type SessionAcceptOptions = {
|
|
140
|
+
replaceCurrent?: boolean;
|
|
141
|
+
media?: SessionMediaRequirement;
|
|
142
|
+
};
|
|
143
|
+
type SessionJoinOptions = {
|
|
144
|
+
replaceCurrent?: boolean;
|
|
145
|
+
};
|
|
146
|
+
type SessionSyncMode = "merge" | "replaceVisible";
|
|
147
|
+
type SessionSyncOptions = {
|
|
148
|
+
mode?: SessionSyncMode;
|
|
149
|
+
};
|
|
150
|
+
type SessionControls<TStartInput> = {
|
|
151
|
+
get: () => CurrentSessionSnapshot;
|
|
152
|
+
start: (input: TStartInput, options?: SessionStartOptions) => Promise<CurrentSession>;
|
|
153
|
+
accept: (input: ParticipantRef, options?: SessionAcceptOptions) => Promise<CurrentSession>;
|
|
154
|
+
join: (sessionId: string, options?: SessionJoinOptions) => Promise<CurrentSession>;
|
|
155
|
+
end: () => Promise<void>;
|
|
156
|
+
clear: () => void;
|
|
157
|
+
mediaConnected: (sessionId?: string) => void;
|
|
158
|
+
mediaDisconnected: (sessionId?: string) => void;
|
|
159
|
+
mediaFailed: (error: Error, sessionId?: string) => void;
|
|
160
|
+
subscribe: (fn: () => void) => Unsubscribe;
|
|
161
|
+
};
|
|
109
162
|
type ClientEvents = {
|
|
110
163
|
status: ClientStatus;
|
|
111
164
|
"session.added": VoiceSession;
|
|
@@ -115,6 +168,14 @@ type ClientEvents = {
|
|
|
115
168
|
vendor?: string;
|
|
116
169
|
version?: number;
|
|
117
170
|
};
|
|
171
|
+
"session.current.changed": CurrentSessionSnapshot;
|
|
172
|
+
"session.current.started": CurrentSession;
|
|
173
|
+
"session.current.connected": CurrentSession;
|
|
174
|
+
"session.current.ended": CurrentSession;
|
|
175
|
+
"session.current.failed": {
|
|
176
|
+
session: Nullable<CurrentSession>;
|
|
177
|
+
error: CallpadError;
|
|
178
|
+
};
|
|
118
179
|
error: Error;
|
|
119
180
|
};
|
|
120
181
|
type SessionClientConfig = {
|
|
@@ -166,8 +227,8 @@ type Invites = {
|
|
|
166
227
|
};
|
|
167
228
|
type Sessions = {
|
|
168
229
|
list: () => readonly VoiceSession[];
|
|
169
|
-
get: (sessionId
|
|
170
|
-
sync: (query?: ListQuery) => Promise<readonly VoiceSession[]>;
|
|
230
|
+
get: (sessionId: string) => Nullable<VoiceSession>;
|
|
231
|
+
sync: (query?: ListQuery, options?: SessionSyncOptions) => Promise<readonly VoiceSession[]>;
|
|
171
232
|
start: (input: CustomerStartInput) => Promise<StartedSession>;
|
|
172
233
|
join: (sessionId: string) => Promise<VoiceJoinGrant>;
|
|
173
234
|
accept: (input: ParticipantRef) => Promise<StartedSession>;
|
|
@@ -190,17 +251,19 @@ type SessionClient = {
|
|
|
190
251
|
readonly status: ClientStatus;
|
|
191
252
|
readonly sessions: Sessions;
|
|
192
253
|
readonly invites: Invites;
|
|
254
|
+
readonly session: SessionControls<CustomerStartInput>;
|
|
193
255
|
connect: () => Promise<void>;
|
|
194
256
|
disconnect: () => Promise<void>;
|
|
195
257
|
dispose: () => Promise<void>;
|
|
196
258
|
on: <K extends keyof ClientEvents>(event: K, fn: (payload: ClientEvents[K]) => void) => Unsubscribe;
|
|
197
259
|
subscribe: (topic: StoreTopic, fn: () => void) => Unsubscribe;
|
|
198
260
|
};
|
|
199
|
-
type HostClient = Omit<SessionClient, "kind" | "sessions"> & {
|
|
261
|
+
type HostClient = Omit<SessionClient, "kind" | "sessions" | "session"> & {
|
|
200
262
|
readonly kind: "host";
|
|
201
263
|
readonly vendor: string;
|
|
202
264
|
readonly sessions: HostSessions;
|
|
265
|
+
readonly session: SessionControls<HostStartInput>;
|
|
203
266
|
readonly host: HostControls;
|
|
204
267
|
};
|
|
205
268
|
|
|
206
|
-
export { CallpadError as C, type HostClient as H, type Invites as I, type ListQuery as L, type Nullable as N, type ParticipantRef as P, type RealtimeToken as R, type
|
|
269
|
+
export { type SessionSyncOptions as A, type Sessions as B, CallpadError as C, type StartedSession as D, type StoreTopic as E, type VoiceParticipant as F, type VoiceSession as G, type HostClient as H, type Invites as I, type ListQuery as L, type Nullable as N, type ParticipantRef as P, type RealtimeToken as R, type SessionAcceptOptions as S, type Unsubscribe as U, type VoiceJoinGrant as V, type ClientEvents as a, type ClientStatus as b, type CurrentSession as c, type CurrentSessionSnapshot as d, type CustomerStartInput as e, type HostClientConfig as f, type HostControls as g, type HostParticipantInput as h, type HostSessions as i, type HostStartInput as j, type ListSessionsResponse as k, type SessionAction as l, type SessionClient as m, type SessionClientConfig as n, type SessionControls as o, type SessionDirection as p, type SessionDuration as q, type SessionInvite as r, type SessionJoinOptions as s, type SessionMediaRequirement as t, type SessionPhase as u, type SessionRecording as v, type SessionRecordingControl as w, type SessionStartBehavior as x, type SessionStartOptions as y, type SessionSyncMode as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "farvex",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Web SDK for Callpad voice sessions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"callpad",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"prepublishOnly": "bun run check && bun run build"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"centrifuge": "5.6.0"
|
|
72
|
+
"centrifuge": "5.6.0",
|
|
73
|
+
"libphonenumber-js": "^1.13.6"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
76
|
"@changesets/cli": "^2.27.0",
|