@absolutejs/voice 0.0.22-beta.514 → 0.0.22-beta.516
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/callerCRMLinker.d.ts +29 -0
- package/dist/crmCallLogger.d.ts +37 -0
- package/dist/crmContract.d.ts +70 -0
- package/dist/embed/index.d.ts +38 -0
- package/dist/embed/index.js +1707 -0
- package/dist/embed/voice-widget.js +10 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +157 -0
- package/dist/vue/VoiceWidget.d.ts +1 -1
- package/package.json +12 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { VoiceCallerIdentity } from "./callerMemory";
|
|
2
|
+
import type { VoiceCRMContactSummary, VoiceCRMContract } from "./crmContract";
|
|
3
|
+
export type VoiceCallerCRMLinkRecord = {
|
|
4
|
+
callerKey: string;
|
|
5
|
+
vendor: string;
|
|
6
|
+
contactId: string;
|
|
7
|
+
contact: VoiceCRMContactSummary;
|
|
8
|
+
resolvedAt: number;
|
|
9
|
+
source: "memory" | "phone-lookup" | "email-lookup" | "manual";
|
|
10
|
+
};
|
|
11
|
+
export type VoiceCallerCRMLinkCacheStore = {
|
|
12
|
+
get(key: string): Promise<VoiceCallerCRMLinkRecord | null> | VoiceCallerCRMLinkRecord | null;
|
|
13
|
+
put(record: VoiceCallerCRMLinkRecord): Promise<void> | void;
|
|
14
|
+
remove(key: string): Promise<boolean> | boolean;
|
|
15
|
+
};
|
|
16
|
+
export type CreateVoiceCallerCRMLinkerOptions = {
|
|
17
|
+
contract: VoiceCRMContract;
|
|
18
|
+
cache?: VoiceCallerCRMLinkCacheStore;
|
|
19
|
+
staleAfterMs?: number;
|
|
20
|
+
now?: () => number;
|
|
21
|
+
};
|
|
22
|
+
export declare const createInMemoryVoiceCallerCRMLinkCache: () => VoiceCallerCRMLinkCacheStore;
|
|
23
|
+
export declare const createVoiceCallerCRMLinker: (options: CreateVoiceCallerCRMLinkerOptions) => {
|
|
24
|
+
associate: (identity: VoiceCallerIdentity, contact: VoiceCRMContactSummary) => Promise<VoiceCallerCRMLinkRecord>;
|
|
25
|
+
contract: VoiceCRMContract;
|
|
26
|
+
invalidate: (identity: VoiceCallerIdentity) => Promise<boolean>;
|
|
27
|
+
resolve: (identity: VoiceCallerIdentity) => Promise<VoiceCallerCRMLinkRecord | null>;
|
|
28
|
+
};
|
|
29
|
+
export type VoiceCallerCRMLinker = ReturnType<typeof createVoiceCallerCRMLinker>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { VoiceCRMContract } from "./crmContract";
|
|
2
|
+
export type VoiceCRMCallLoggerInput = {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
contactId?: string;
|
|
5
|
+
startedAt: number;
|
|
6
|
+
endedAt?: number;
|
|
7
|
+
durationSeconds?: number;
|
|
8
|
+
summary?: string;
|
|
9
|
+
disposition?: string;
|
|
10
|
+
recordingUrl?: string;
|
|
11
|
+
transcriptUrl?: string;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
export type VoiceCRMCallLogResult = {
|
|
15
|
+
activityId: string;
|
|
16
|
+
vendor: string;
|
|
17
|
+
loggedAt: number;
|
|
18
|
+
};
|
|
19
|
+
export type VoiceCRMCallLogErrorPolicy = "throw" | "swallow" | "queue";
|
|
20
|
+
export type CreateVoiceCRMCallLoggerOptions = {
|
|
21
|
+
contract: VoiceCRMContract;
|
|
22
|
+
errorPolicy?: VoiceCRMCallLogErrorPolicy;
|
|
23
|
+
onError?: (error: Error, input: VoiceCRMCallLoggerInput) => void | Promise<void>;
|
|
24
|
+
enqueueOnFailure?: (input: VoiceCRMCallLoggerInput) => Promise<void> | void;
|
|
25
|
+
now?: () => number;
|
|
26
|
+
};
|
|
27
|
+
export declare const createVoiceCRMCallLogger: (options: CreateVoiceCRMCallLoggerOptions) => {
|
|
28
|
+
contract: VoiceCRMContract;
|
|
29
|
+
logCallEnd: (input: VoiceCRMCallLoggerInput) => Promise<VoiceCRMCallLogResult | null>;
|
|
30
|
+
noteOnContact: (input: {
|
|
31
|
+
contactId: string;
|
|
32
|
+
body: string;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
noteId: string;
|
|
35
|
+
} | null>;
|
|
36
|
+
};
|
|
37
|
+
export type VoiceCRMCallLogger = ReturnType<typeof createVoiceCRMCallLogger>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type VoiceCRMContactSummary = {
|
|
2
|
+
id: string;
|
|
3
|
+
vendor?: string;
|
|
4
|
+
firstName?: string;
|
|
5
|
+
lastName?: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
jobTitle?: string;
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
export type VoiceCRMLeadInput = {
|
|
12
|
+
firstName?: string;
|
|
13
|
+
lastName?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
phone?: string;
|
|
16
|
+
company?: string;
|
|
17
|
+
jobTitle?: string;
|
|
18
|
+
source?: string;
|
|
19
|
+
notes?: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
export type VoiceCRMCallActivityInput = {
|
|
23
|
+
contactId?: string;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
startedAt: number;
|
|
26
|
+
endedAt: number;
|
|
27
|
+
durationSeconds: number;
|
|
28
|
+
summary?: string;
|
|
29
|
+
disposition?: string;
|
|
30
|
+
recordingUrl?: string;
|
|
31
|
+
transcriptUrl?: string;
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
export type VoiceCRMNoteInput = {
|
|
35
|
+
contactId: string;
|
|
36
|
+
body: string;
|
|
37
|
+
metadata?: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
export type VoiceCRMTaskInput = {
|
|
40
|
+
contactId?: string;
|
|
41
|
+
subject: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
dueAt?: number;
|
|
44
|
+
priority?: "low" | "normal" | "high";
|
|
45
|
+
};
|
|
46
|
+
export type VoiceCRMContract = {
|
|
47
|
+
readonly vendor: string;
|
|
48
|
+
lookupByPhone(phone: string): Promise<VoiceCRMContactSummary | null>;
|
|
49
|
+
lookupByEmail(email: string): Promise<VoiceCRMContactSummary | null>;
|
|
50
|
+
createLead(input: VoiceCRMLeadInput): Promise<VoiceCRMContactSummary>;
|
|
51
|
+
logCall(input: VoiceCRMCallActivityInput): Promise<{
|
|
52
|
+
activityId: string;
|
|
53
|
+
}>;
|
|
54
|
+
addNote(input: VoiceCRMNoteInput): Promise<{
|
|
55
|
+
noteId: string;
|
|
56
|
+
}>;
|
|
57
|
+
createTask?(input: VoiceCRMTaskInput): Promise<{
|
|
58
|
+
taskId: string;
|
|
59
|
+
}>;
|
|
60
|
+
};
|
|
61
|
+
export type VoiceCRMRegistry = {
|
|
62
|
+
default(): VoiceCRMContract | null;
|
|
63
|
+
get(vendor: string): VoiceCRMContract | null;
|
|
64
|
+
list(): VoiceCRMContract[];
|
|
65
|
+
};
|
|
66
|
+
export type CreateVoiceCRMRegistryOptions = {
|
|
67
|
+
contracts: VoiceCRMContract[];
|
|
68
|
+
defaultVendor?: string;
|
|
69
|
+
};
|
|
70
|
+
export declare const createVoiceCRMRegistry: (options: CreateVoiceCRMRegistryOptions) => VoiceCRMRegistry;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createVoiceController } from "../client/controller";
|
|
2
|
+
import { type VoiceWidgetLabels, type VoiceWidgetTheme } from "../client/voiceWidgetView";
|
|
3
|
+
import type { VoiceControllerOptions } from "../types";
|
|
4
|
+
export type VoiceEmbedMountOptions = {
|
|
5
|
+
/** WebSocket route the voice runtime is mounted at. Defaults to "/voice". */
|
|
6
|
+
path?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
theme?: VoiceWidgetTheme;
|
|
9
|
+
labels?: VoiceWidgetLabels;
|
|
10
|
+
controllerOptions?: VoiceControllerOptions;
|
|
11
|
+
/** Auto-start the call as soon as the widget mounts. Defaults to false. */
|
|
12
|
+
autoStart?: boolean;
|
|
13
|
+
onError?: (error: string) => void;
|
|
14
|
+
onStatusChange?: (status: string) => void;
|
|
15
|
+
};
|
|
16
|
+
export type VoiceEmbedHandle = {
|
|
17
|
+
/** Begin recording / open the call. */
|
|
18
|
+
start: () => Promise<void>;
|
|
19
|
+
/** Stop recording (mute). */
|
|
20
|
+
mute: () => void;
|
|
21
|
+
/** End the call and tear down. */
|
|
22
|
+
end: () => Promise<void>;
|
|
23
|
+
/** Remove the widget from the DOM and release all resources. */
|
|
24
|
+
unmount: () => void;
|
|
25
|
+
/** The underlying framework-agnostic controller, for advanced use. */
|
|
26
|
+
controller: ReturnType<typeof createVoiceController>;
|
|
27
|
+
};
|
|
28
|
+
export declare const mount: (target: string | HTMLElement, options?: VoiceEmbedMountOptions) => VoiceEmbedHandle;
|
|
29
|
+
export type VoiceEmbedGlobal = {
|
|
30
|
+
mount: typeof mount;
|
|
31
|
+
version: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const VOICE_EMBED_VERSION = "0.0.22-beta.516";
|
|
34
|
+
declare const globalApi: VoiceEmbedGlobal;
|
|
35
|
+
declare global {
|
|
36
|
+
var AbsoluteVoice: VoiceEmbedGlobal | undefined;
|
|
37
|
+
}
|
|
38
|
+
export default globalApi;
|