@absolutejs/voice 0.0.22-beta.116 → 0.0.22-beta.118
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/angular/index.d.ts +1 -0
- package/dist/angular/index.js +274 -108
- package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
- package/dist/client/campaignDialerProof.d.ts +23 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +120 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +151 -12
- package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
- package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +121 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +174 -17
- package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { VoiceCampaignDialerProofReport, VoiceCampaignDialerProofStatus } from '../campaignDialers';
|
|
2
|
+
export type VoiceCampaignDialerProofClientOptions = {
|
|
3
|
+
fetch?: typeof fetch;
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
runPath?: string;
|
|
6
|
+
};
|
|
7
|
+
export type VoiceCampaignDialerProofSnapshot = {
|
|
8
|
+
error: string | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
report?: VoiceCampaignDialerProofReport;
|
|
11
|
+
status?: VoiceCampaignDialerProofStatus;
|
|
12
|
+
updatedAt?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const fetchVoiceCampaignDialerProofStatus: (path?: string, options?: Pick<VoiceCampaignDialerProofClientOptions, "fetch">) => Promise<VoiceCampaignDialerProofStatus>;
|
|
15
|
+
export declare const runVoiceCampaignDialerProofAction: (path?: string, options?: Pick<VoiceCampaignDialerProofClientOptions, "fetch">) => Promise<VoiceCampaignDialerProofReport>;
|
|
16
|
+
export declare const createVoiceCampaignDialerProofStore: (path?: string, options?: VoiceCampaignDialerProofClientOptions) => {
|
|
17
|
+
close: () => void;
|
|
18
|
+
getServerSnapshot: () => VoiceCampaignDialerProofSnapshot;
|
|
19
|
+
getSnapshot: () => VoiceCampaignDialerProofSnapshot;
|
|
20
|
+
refresh: () => Promise<VoiceCampaignDialerProofStatus | undefined>;
|
|
21
|
+
runProof: () => Promise<VoiceCampaignDialerProofReport>;
|
|
22
|
+
subscribe: (listener: () => void) => () => void;
|
|
23
|
+
};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { createVoiceProviderStatusStore, fetchVoiceProviderStatus } from './prov
|
|
|
15
15
|
export { createVoiceProviderCapabilitiesStore, fetchVoiceProviderCapabilities } from './providerCapabilities';
|
|
16
16
|
export { createVoiceTurnQualityStore, fetchVoiceTurnQuality } from './turnQuality';
|
|
17
17
|
export { createVoiceTurnLatencyStore, fetchVoiceTurnLatency, runVoiceTurnLatencyProof } from './turnLatency';
|
|
18
|
+
export { createVoiceCampaignDialerProofStore, fetchVoiceCampaignDialerProofStatus, runVoiceCampaignDialerProofAction } from './campaignDialerProof';
|
|
18
19
|
export { createVoiceTraceTimelineStore, fetchVoiceTraceTimeline } from './traceTimeline';
|
|
19
20
|
export { createVoiceProviderSimulationControlsStore } from './providerSimulationControls';
|
|
20
21
|
export { bindVoiceProviderSimulationControls, createVoiceProviderSimulationControlsViewModel, defineVoiceProviderSimulationControlsElement, mountVoiceProviderSimulationControls, renderVoiceProviderSimulationControlsHTML } from './providerSimulationControlsWidget';
|
|
@@ -34,6 +35,7 @@ export type { VoiceProviderStatusClientOptions, VoiceProviderStatusSnapshot } fr
|
|
|
34
35
|
export type { VoiceProviderCapabilitiesClientOptions, VoiceProviderCapabilitiesSnapshot } from './providerCapabilities';
|
|
35
36
|
export type { VoiceTurnQualityClientOptions, VoiceTurnQualitySnapshot } from './turnQuality';
|
|
36
37
|
export type { VoiceTurnLatencyClientOptions, VoiceTurnLatencySnapshot } from './turnLatency';
|
|
38
|
+
export type { VoiceCampaignDialerProofClientOptions, VoiceCampaignDialerProofSnapshot } from './campaignDialerProof';
|
|
37
39
|
export type { VoiceTraceTimelineClientOptions, VoiceTraceTimelineSnapshot } from './traceTimeline';
|
|
38
40
|
export type { VoiceProviderSimulationControlsOptions, VoiceProviderSimulationControlsSnapshot, VoiceProviderSimulationProvider } from './providerSimulationControls';
|
|
39
41
|
export type { VoiceProviderSimulationControlsViewModel } from './providerSimulationControlsWidget';
|
package/dist/client/index.js
CHANGED
|
@@ -2560,6 +2560,123 @@ var createVoiceTurnLatencyStore = (path = "/api/turn-latency", options = {}) =>
|
|
|
2560
2560
|
}
|
|
2561
2561
|
};
|
|
2562
2562
|
};
|
|
2563
|
+
// src/client/campaignDialerProof.ts
|
|
2564
|
+
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2565
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2566
|
+
const response = await fetchImpl(path);
|
|
2567
|
+
if (!response.ok) {
|
|
2568
|
+
throw new Error(`Voice campaign dialer proof status failed: HTTP ${response.status}`);
|
|
2569
|
+
}
|
|
2570
|
+
return await response.json();
|
|
2571
|
+
};
|
|
2572
|
+
var runVoiceCampaignDialerProofAction = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2573
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2574
|
+
const response = await fetchImpl(path, { method: "POST" });
|
|
2575
|
+
if (!response.ok) {
|
|
2576
|
+
throw new Error(`Voice campaign dialer proof failed: HTTP ${response.status}`);
|
|
2577
|
+
}
|
|
2578
|
+
return await response.json();
|
|
2579
|
+
};
|
|
2580
|
+
var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2581
|
+
const listeners = new Set;
|
|
2582
|
+
let closed = false;
|
|
2583
|
+
let timer;
|
|
2584
|
+
let snapshot = {
|
|
2585
|
+
error: null,
|
|
2586
|
+
isLoading: false
|
|
2587
|
+
};
|
|
2588
|
+
const emit = () => {
|
|
2589
|
+
for (const listener of listeners) {
|
|
2590
|
+
listener();
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
const refresh = async () => {
|
|
2594
|
+
if (closed) {
|
|
2595
|
+
return snapshot.status;
|
|
2596
|
+
}
|
|
2597
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
2598
|
+
emit();
|
|
2599
|
+
try {
|
|
2600
|
+
const status = await fetchVoiceCampaignDialerProofStatus(path, options);
|
|
2601
|
+
snapshot = {
|
|
2602
|
+
...snapshot,
|
|
2603
|
+
error: null,
|
|
2604
|
+
isLoading: false,
|
|
2605
|
+
status,
|
|
2606
|
+
updatedAt: Date.now()
|
|
2607
|
+
};
|
|
2608
|
+
emit();
|
|
2609
|
+
return status;
|
|
2610
|
+
} catch (error) {
|
|
2611
|
+
snapshot = {
|
|
2612
|
+
...snapshot,
|
|
2613
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2614
|
+
isLoading: false
|
|
2615
|
+
};
|
|
2616
|
+
emit();
|
|
2617
|
+
throw error;
|
|
2618
|
+
}
|
|
2619
|
+
};
|
|
2620
|
+
const runProof = async () => {
|
|
2621
|
+
const runPath = options.runPath ?? snapshot.status?.runPath ?? path;
|
|
2622
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
2623
|
+
emit();
|
|
2624
|
+
try {
|
|
2625
|
+
const report = await runVoiceCampaignDialerProofAction(runPath, options);
|
|
2626
|
+
snapshot = {
|
|
2627
|
+
...snapshot,
|
|
2628
|
+
error: null,
|
|
2629
|
+
isLoading: false,
|
|
2630
|
+
report,
|
|
2631
|
+
status: {
|
|
2632
|
+
generatedAt: Date.now(),
|
|
2633
|
+
mode: report.mode,
|
|
2634
|
+
ok: report.ok,
|
|
2635
|
+
providers: report.providers.map((provider) => provider.provider),
|
|
2636
|
+
runPath,
|
|
2637
|
+
safe: true
|
|
2638
|
+
},
|
|
2639
|
+
updatedAt: Date.now()
|
|
2640
|
+
};
|
|
2641
|
+
emit();
|
|
2642
|
+
return report;
|
|
2643
|
+
} catch (error) {
|
|
2644
|
+
snapshot = {
|
|
2645
|
+
...snapshot,
|
|
2646
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2647
|
+
isLoading: false
|
|
2648
|
+
};
|
|
2649
|
+
emit();
|
|
2650
|
+
throw error;
|
|
2651
|
+
}
|
|
2652
|
+
};
|
|
2653
|
+
const close = () => {
|
|
2654
|
+
closed = true;
|
|
2655
|
+
if (timer) {
|
|
2656
|
+
clearInterval(timer);
|
|
2657
|
+
timer = undefined;
|
|
2658
|
+
}
|
|
2659
|
+
listeners.clear();
|
|
2660
|
+
};
|
|
2661
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
2662
|
+
timer = setInterval(() => {
|
|
2663
|
+
refresh().catch(() => {});
|
|
2664
|
+
}, options.intervalMs);
|
|
2665
|
+
}
|
|
2666
|
+
return {
|
|
2667
|
+
close,
|
|
2668
|
+
getServerSnapshot: () => snapshot,
|
|
2669
|
+
getSnapshot: () => snapshot,
|
|
2670
|
+
refresh,
|
|
2671
|
+
runProof,
|
|
2672
|
+
subscribe: (listener) => {
|
|
2673
|
+
listeners.add(listener);
|
|
2674
|
+
return () => {
|
|
2675
|
+
listeners.delete(listener);
|
|
2676
|
+
};
|
|
2677
|
+
}
|
|
2678
|
+
};
|
|
2679
|
+
};
|
|
2563
2680
|
// src/client/traceTimeline.ts
|
|
2564
2681
|
var fetchVoiceTraceTimeline = async (path = "/api/voice-traces", options = {}) => {
|
|
2565
2682
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
@@ -3423,6 +3540,7 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
3423
3540
|
};
|
|
3424
3541
|
export {
|
|
3425
3542
|
runVoiceTurnLatencyProof,
|
|
3543
|
+
runVoiceCampaignDialerProofAction,
|
|
3426
3544
|
renderVoiceTurnQualityHTML,
|
|
3427
3545
|
renderVoiceTurnLatencyHTML,
|
|
3428
3546
|
renderVoiceTraceTimelineWidgetHTML,
|
|
@@ -3453,6 +3571,7 @@ export {
|
|
|
3453
3571
|
fetchVoiceRoutingStatus,
|
|
3454
3572
|
fetchVoiceProviderStatus,
|
|
3455
3573
|
fetchVoiceProviderCapabilities,
|
|
3574
|
+
fetchVoiceCampaignDialerProofStatus,
|
|
3456
3575
|
fetchVoiceAppKitStatus,
|
|
3457
3576
|
defineVoiceTurnQualityElement,
|
|
3458
3577
|
defineVoiceTurnLatencyElement,
|
|
@@ -3484,6 +3603,7 @@ export {
|
|
|
3484
3603
|
createVoiceDuplexController,
|
|
3485
3604
|
createVoiceController,
|
|
3486
3605
|
createVoiceConnection,
|
|
3606
|
+
createVoiceCampaignDialerProofStore,
|
|
3487
3607
|
createVoiceBargeInMonitor,
|
|
3488
3608
|
createVoiceAudioPlayer,
|
|
3489
3609
|
createVoiceAppKitStatusStore,
|
package/dist/react/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { VoiceTraceTimeline } from './VoiceTraceTimeline';
|
|
|
7
7
|
export { VoiceTurnLatency } from './VoiceTurnLatency';
|
|
8
8
|
export { VoiceTurnQuality } from './VoiceTurnQuality';
|
|
9
9
|
export { useVoiceAppKitStatus } from './useVoiceAppKitStatus';
|
|
10
|
+
export { useVoiceCampaignDialerProof } from './useVoiceCampaignDialerProof';
|
|
10
11
|
export { useVoiceStream } from './useVoiceStream';
|
|
11
12
|
export { useVoiceController } from './useVoiceController';
|
|
12
13
|
export { useVoiceProviderStatus } from './useVoiceProviderStatus';
|
package/dist/react/index.js
CHANGED
|
@@ -2357,9 +2357,147 @@ var VoiceTurnQuality = ({
|
|
|
2357
2357
|
]
|
|
2358
2358
|
}, undefined, true, undefined, this);
|
|
2359
2359
|
};
|
|
2360
|
-
// src/react/
|
|
2360
|
+
// src/react/useVoiceCampaignDialerProof.tsx
|
|
2361
2361
|
import { useEffect as useEffect9, useRef as useRef9, useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
2362
2362
|
|
|
2363
|
+
// src/client/campaignDialerProof.ts
|
|
2364
|
+
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2365
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2366
|
+
const response = await fetchImpl(path);
|
|
2367
|
+
if (!response.ok) {
|
|
2368
|
+
throw new Error(`Voice campaign dialer proof status failed: HTTP ${response.status}`);
|
|
2369
|
+
}
|
|
2370
|
+
return await response.json();
|
|
2371
|
+
};
|
|
2372
|
+
var runVoiceCampaignDialerProofAction = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2373
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
2374
|
+
const response = await fetchImpl(path, { method: "POST" });
|
|
2375
|
+
if (!response.ok) {
|
|
2376
|
+
throw new Error(`Voice campaign dialer proof failed: HTTP ${response.status}`);
|
|
2377
|
+
}
|
|
2378
|
+
return await response.json();
|
|
2379
|
+
};
|
|
2380
|
+
var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2381
|
+
const listeners = new Set;
|
|
2382
|
+
let closed = false;
|
|
2383
|
+
let timer;
|
|
2384
|
+
let snapshot = {
|
|
2385
|
+
error: null,
|
|
2386
|
+
isLoading: false
|
|
2387
|
+
};
|
|
2388
|
+
const emit = () => {
|
|
2389
|
+
for (const listener of listeners) {
|
|
2390
|
+
listener();
|
|
2391
|
+
}
|
|
2392
|
+
};
|
|
2393
|
+
const refresh = async () => {
|
|
2394
|
+
if (closed) {
|
|
2395
|
+
return snapshot.status;
|
|
2396
|
+
}
|
|
2397
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
2398
|
+
emit();
|
|
2399
|
+
try {
|
|
2400
|
+
const status = await fetchVoiceCampaignDialerProofStatus(path, options);
|
|
2401
|
+
snapshot = {
|
|
2402
|
+
...snapshot,
|
|
2403
|
+
error: null,
|
|
2404
|
+
isLoading: false,
|
|
2405
|
+
status,
|
|
2406
|
+
updatedAt: Date.now()
|
|
2407
|
+
};
|
|
2408
|
+
emit();
|
|
2409
|
+
return status;
|
|
2410
|
+
} catch (error) {
|
|
2411
|
+
snapshot = {
|
|
2412
|
+
...snapshot,
|
|
2413
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2414
|
+
isLoading: false
|
|
2415
|
+
};
|
|
2416
|
+
emit();
|
|
2417
|
+
throw error;
|
|
2418
|
+
}
|
|
2419
|
+
};
|
|
2420
|
+
const runProof = async () => {
|
|
2421
|
+
const runPath = options.runPath ?? snapshot.status?.runPath ?? path;
|
|
2422
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
2423
|
+
emit();
|
|
2424
|
+
try {
|
|
2425
|
+
const report = await runVoiceCampaignDialerProofAction(runPath, options);
|
|
2426
|
+
snapshot = {
|
|
2427
|
+
...snapshot,
|
|
2428
|
+
error: null,
|
|
2429
|
+
isLoading: false,
|
|
2430
|
+
report,
|
|
2431
|
+
status: {
|
|
2432
|
+
generatedAt: Date.now(),
|
|
2433
|
+
mode: report.mode,
|
|
2434
|
+
ok: report.ok,
|
|
2435
|
+
providers: report.providers.map((provider) => provider.provider),
|
|
2436
|
+
runPath,
|
|
2437
|
+
safe: true
|
|
2438
|
+
},
|
|
2439
|
+
updatedAt: Date.now()
|
|
2440
|
+
};
|
|
2441
|
+
emit();
|
|
2442
|
+
return report;
|
|
2443
|
+
} catch (error) {
|
|
2444
|
+
snapshot = {
|
|
2445
|
+
...snapshot,
|
|
2446
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2447
|
+
isLoading: false
|
|
2448
|
+
};
|
|
2449
|
+
emit();
|
|
2450
|
+
throw error;
|
|
2451
|
+
}
|
|
2452
|
+
};
|
|
2453
|
+
const close = () => {
|
|
2454
|
+
closed = true;
|
|
2455
|
+
if (timer) {
|
|
2456
|
+
clearInterval(timer);
|
|
2457
|
+
timer = undefined;
|
|
2458
|
+
}
|
|
2459
|
+
listeners.clear();
|
|
2460
|
+
};
|
|
2461
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
2462
|
+
timer = setInterval(() => {
|
|
2463
|
+
refresh().catch(() => {});
|
|
2464
|
+
}, options.intervalMs);
|
|
2465
|
+
}
|
|
2466
|
+
return {
|
|
2467
|
+
close,
|
|
2468
|
+
getServerSnapshot: () => snapshot,
|
|
2469
|
+
getSnapshot: () => snapshot,
|
|
2470
|
+
refresh,
|
|
2471
|
+
runProof,
|
|
2472
|
+
subscribe: (listener) => {
|
|
2473
|
+
listeners.add(listener);
|
|
2474
|
+
return () => {
|
|
2475
|
+
listeners.delete(listener);
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
};
|
|
2480
|
+
|
|
2481
|
+
// src/react/useVoiceCampaignDialerProof.tsx
|
|
2482
|
+
var useVoiceCampaignDialerProof = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2483
|
+
const storeRef = useRef9(null);
|
|
2484
|
+
if (!storeRef.current) {
|
|
2485
|
+
storeRef.current = createVoiceCampaignDialerProofStore(path, options);
|
|
2486
|
+
}
|
|
2487
|
+
const store = storeRef.current;
|
|
2488
|
+
useEffect9(() => {
|
|
2489
|
+
store.refresh().catch(() => {});
|
|
2490
|
+
return () => store.close();
|
|
2491
|
+
}, [store]);
|
|
2492
|
+
return {
|
|
2493
|
+
...useSyncExternalStore9(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2494
|
+
refresh: store.refresh,
|
|
2495
|
+
runProof: store.runProof
|
|
2496
|
+
};
|
|
2497
|
+
};
|
|
2498
|
+
// src/react/useVoiceStream.tsx
|
|
2499
|
+
import { useEffect as useEffect10, useRef as useRef10, useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
2500
|
+
|
|
2363
2501
|
// src/client/actions.ts
|
|
2364
2502
|
var normalizeErrorMessage = (value) => {
|
|
2365
2503
|
if (typeof value === "string" && value.trim()) {
|
|
@@ -2886,13 +3024,13 @@ var EMPTY_SNAPSHOT = {
|
|
|
2886
3024
|
turns: []
|
|
2887
3025
|
};
|
|
2888
3026
|
var useVoiceStream = (path, options = {}) => {
|
|
2889
|
-
const streamRef =
|
|
3027
|
+
const streamRef = useRef10(null);
|
|
2890
3028
|
if (!streamRef.current) {
|
|
2891
3029
|
streamRef.current = createVoiceStream(path, options);
|
|
2892
3030
|
}
|
|
2893
3031
|
const stream = streamRef.current;
|
|
2894
|
-
|
|
2895
|
-
const snapshot =
|
|
3032
|
+
useEffect10(() => () => stream.close(), [stream]);
|
|
3033
|
+
const snapshot = useSyncExternalStore10(stream.subscribe, stream.getSnapshot, stream.getServerSnapshot) ?? EMPTY_SNAPSHOT;
|
|
2896
3034
|
return {
|
|
2897
3035
|
...snapshot,
|
|
2898
3036
|
callControl: (message) => stream.callControl(message),
|
|
@@ -2902,7 +3040,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
2902
3040
|
};
|
|
2903
3041
|
};
|
|
2904
3042
|
// src/react/useVoiceController.tsx
|
|
2905
|
-
import { useEffect as
|
|
3043
|
+
import { useEffect as useEffect11, useRef as useRef11, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
2906
3044
|
|
|
2907
3045
|
// src/client/htmx.ts
|
|
2908
3046
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -3555,13 +3693,13 @@ var EMPTY_SNAPSHOT2 = {
|
|
|
3555
3693
|
turns: []
|
|
3556
3694
|
};
|
|
3557
3695
|
var useVoiceController = (path, options = {}) => {
|
|
3558
|
-
const controllerRef =
|
|
3696
|
+
const controllerRef = useRef11(null);
|
|
3559
3697
|
if (!controllerRef.current) {
|
|
3560
3698
|
controllerRef.current = createVoiceController(path, options);
|
|
3561
3699
|
}
|
|
3562
3700
|
const controller = controllerRef.current;
|
|
3563
|
-
|
|
3564
|
-
const snapshot =
|
|
3701
|
+
useEffect11(() => () => controller.close(), [controller]);
|
|
3702
|
+
const snapshot = useSyncExternalStore11(controller.subscribe, controller.getSnapshot, controller.getServerSnapshot) ?? EMPTY_SNAPSHOT2;
|
|
3565
3703
|
return {
|
|
3566
3704
|
...snapshot,
|
|
3567
3705
|
bindHTMX: controller.bindHTMX,
|
|
@@ -3575,7 +3713,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
3575
3713
|
};
|
|
3576
3714
|
};
|
|
3577
3715
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
3578
|
-
import { useEffect as
|
|
3716
|
+
import { useEffect as useEffect12, useRef as useRef12, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
3579
3717
|
|
|
3580
3718
|
// src/client/workflowStatus.ts
|
|
3581
3719
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -3658,17 +3796,17 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
3658
3796
|
|
|
3659
3797
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
3660
3798
|
var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
3661
|
-
const storeRef =
|
|
3799
|
+
const storeRef = useRef12(null);
|
|
3662
3800
|
if (!storeRef.current) {
|
|
3663
3801
|
storeRef.current = createVoiceWorkflowStatusStore(path, options);
|
|
3664
3802
|
}
|
|
3665
3803
|
const store = storeRef.current;
|
|
3666
|
-
|
|
3804
|
+
useEffect12(() => {
|
|
3667
3805
|
store.refresh().catch(() => {});
|
|
3668
3806
|
return () => store.close();
|
|
3669
3807
|
}, [store]);
|
|
3670
3808
|
return {
|
|
3671
|
-
...
|
|
3809
|
+
...useSyncExternalStore12(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
3672
3810
|
refresh: store.refresh
|
|
3673
3811
|
};
|
|
3674
3812
|
};
|
|
@@ -3683,6 +3821,7 @@ export {
|
|
|
3683
3821
|
useVoiceProviderSimulationControls,
|
|
3684
3822
|
useVoiceProviderCapabilities,
|
|
3685
3823
|
useVoiceController,
|
|
3824
|
+
useVoiceCampaignDialerProof,
|
|
3686
3825
|
useVoiceAppKitStatus,
|
|
3687
3826
|
VoiceTurnQuality,
|
|
3688
3827
|
VoiceTurnLatency,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VoiceCampaignDialerProofClientOptions } from '../client/campaignDialerProof';
|
|
2
|
+
export declare const useVoiceCampaignDialerProof: (path?: string, options?: VoiceCampaignDialerProofClientOptions) => {
|
|
3
|
+
refresh: () => Promise<import("..").VoiceCampaignDialerProofStatus | undefined>;
|
|
4
|
+
runProof: () => Promise<import("..").VoiceCampaignDialerProofReport>;
|
|
5
|
+
error: string | null;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
report?: import("..").VoiceCampaignDialerProofReport;
|
|
8
|
+
status?: import("..").VoiceCampaignDialerProofStatus;
|
|
9
|
+
updatedAt?: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VoiceCampaignDialerProofClientOptions } from '../client/campaignDialerProof';
|
|
2
|
+
export declare const createVoiceCampaignDialerProof: (path?: string, options?: VoiceCampaignDialerProofClientOptions) => {
|
|
3
|
+
close: () => void;
|
|
4
|
+
getServerSnapshot: () => import("../client").VoiceCampaignDialerProofSnapshot;
|
|
5
|
+
getSnapshot: () => import("../client").VoiceCampaignDialerProofSnapshot;
|
|
6
|
+
refresh: () => Promise<import("..").VoiceCampaignDialerProofStatus | undefined>;
|
|
7
|
+
runProof: () => Promise<import("..").VoiceCampaignDialerProofReport>;
|
|
8
|
+
subscribe: (listener: () => void) => () => void;
|
|
9
|
+
};
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createVoiceAppKitStatus } from './createVoiceAppKitStatus';
|
|
2
|
+
export { createVoiceCampaignDialerProof } from './createVoiceCampaignDialerProof';
|
|
2
3
|
export { createVoiceOpsStatus } from './createVoiceOpsStatus';
|
|
3
4
|
export { createVoiceProviderSimulationControls } from './createVoiceProviderSimulationControls';
|
|
4
5
|
export { createVoiceProviderCapabilities } from './createVoiceProviderCapabilities';
|
package/dist/svelte/index.js
CHANGED
|
@@ -150,6 +150,126 @@ var createVoiceAppKitStatusStore = (path = "/app-kit/status", options = {}) => {
|
|
|
150
150
|
|
|
151
151
|
// src/svelte/createVoiceAppKitStatus.ts
|
|
152
152
|
var createVoiceAppKitStatus = (path = "/app-kit/status", options = {}) => createVoiceAppKitStatusStore(path, options);
|
|
153
|
+
// src/client/campaignDialerProof.ts
|
|
154
|
+
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
155
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
156
|
+
const response = await fetchImpl(path);
|
|
157
|
+
if (!response.ok) {
|
|
158
|
+
throw new Error(`Voice campaign dialer proof status failed: HTTP ${response.status}`);
|
|
159
|
+
}
|
|
160
|
+
return await response.json();
|
|
161
|
+
};
|
|
162
|
+
var runVoiceCampaignDialerProofAction = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
163
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
164
|
+
const response = await fetchImpl(path, { method: "POST" });
|
|
165
|
+
if (!response.ok) {
|
|
166
|
+
throw new Error(`Voice campaign dialer proof failed: HTTP ${response.status}`);
|
|
167
|
+
}
|
|
168
|
+
return await response.json();
|
|
169
|
+
};
|
|
170
|
+
var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
171
|
+
const listeners = new Set;
|
|
172
|
+
let closed = false;
|
|
173
|
+
let timer;
|
|
174
|
+
let snapshot = {
|
|
175
|
+
error: null,
|
|
176
|
+
isLoading: false
|
|
177
|
+
};
|
|
178
|
+
const emit = () => {
|
|
179
|
+
for (const listener of listeners) {
|
|
180
|
+
listener();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const refresh = async () => {
|
|
184
|
+
if (closed) {
|
|
185
|
+
return snapshot.status;
|
|
186
|
+
}
|
|
187
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
188
|
+
emit();
|
|
189
|
+
try {
|
|
190
|
+
const status = await fetchVoiceCampaignDialerProofStatus(path, options);
|
|
191
|
+
snapshot = {
|
|
192
|
+
...snapshot,
|
|
193
|
+
error: null,
|
|
194
|
+
isLoading: false,
|
|
195
|
+
status,
|
|
196
|
+
updatedAt: Date.now()
|
|
197
|
+
};
|
|
198
|
+
emit();
|
|
199
|
+
return status;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
snapshot = {
|
|
202
|
+
...snapshot,
|
|
203
|
+
error: error instanceof Error ? error.message : String(error),
|
|
204
|
+
isLoading: false
|
|
205
|
+
};
|
|
206
|
+
emit();
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const runProof = async () => {
|
|
211
|
+
const runPath = options.runPath ?? snapshot.status?.runPath ?? path;
|
|
212
|
+
snapshot = { ...snapshot, error: null, isLoading: true };
|
|
213
|
+
emit();
|
|
214
|
+
try {
|
|
215
|
+
const report = await runVoiceCampaignDialerProofAction(runPath, options);
|
|
216
|
+
snapshot = {
|
|
217
|
+
...snapshot,
|
|
218
|
+
error: null,
|
|
219
|
+
isLoading: false,
|
|
220
|
+
report,
|
|
221
|
+
status: {
|
|
222
|
+
generatedAt: Date.now(),
|
|
223
|
+
mode: report.mode,
|
|
224
|
+
ok: report.ok,
|
|
225
|
+
providers: report.providers.map((provider) => provider.provider),
|
|
226
|
+
runPath,
|
|
227
|
+
safe: true
|
|
228
|
+
},
|
|
229
|
+
updatedAt: Date.now()
|
|
230
|
+
};
|
|
231
|
+
emit();
|
|
232
|
+
return report;
|
|
233
|
+
} catch (error) {
|
|
234
|
+
snapshot = {
|
|
235
|
+
...snapshot,
|
|
236
|
+
error: error instanceof Error ? error.message : String(error),
|
|
237
|
+
isLoading: false
|
|
238
|
+
};
|
|
239
|
+
emit();
|
|
240
|
+
throw error;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const close = () => {
|
|
244
|
+
closed = true;
|
|
245
|
+
if (timer) {
|
|
246
|
+
clearInterval(timer);
|
|
247
|
+
timer = undefined;
|
|
248
|
+
}
|
|
249
|
+
listeners.clear();
|
|
250
|
+
};
|
|
251
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
252
|
+
timer = setInterval(() => {
|
|
253
|
+
refresh().catch(() => {});
|
|
254
|
+
}, options.intervalMs);
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
close,
|
|
258
|
+
getServerSnapshot: () => snapshot,
|
|
259
|
+
getSnapshot: () => snapshot,
|
|
260
|
+
refresh,
|
|
261
|
+
runProof,
|
|
262
|
+
subscribe: (listener) => {
|
|
263
|
+
listeners.add(listener);
|
|
264
|
+
return () => {
|
|
265
|
+
listeners.delete(listener);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// src/svelte/createVoiceCampaignDialerProof.ts
|
|
272
|
+
var createVoiceCampaignDialerProof = (path = "/api/voice/campaigns/dialer-proof", options = {}) => createVoiceCampaignDialerProofStore(path, options);
|
|
153
273
|
// src/client/opsStatusWidget.ts
|
|
154
274
|
var DEFAULT_TITLE = "Voice Ops Status";
|
|
155
275
|
var DEFAULT_DESCRIPTION = "Certified workflow, provider, and handoff readiness from the AbsoluteJS voice app kit.";
|
|
@@ -2897,5 +3017,6 @@ export {
|
|
|
2897
3017
|
createVoiceProviderCapabilities,
|
|
2898
3018
|
createVoiceOpsStatus,
|
|
2899
3019
|
createVoiceController,
|
|
3020
|
+
createVoiceCampaignDialerProof,
|
|
2900
3021
|
createVoiceAppKitStatus
|
|
2901
3022
|
};
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { VoiceRoutingStatus } from './VoiceRoutingStatus';
|
|
|
6
6
|
export { VoiceTurnLatency } from './VoiceTurnLatency';
|
|
7
7
|
export { VoiceTurnQuality } from './VoiceTurnQuality';
|
|
8
8
|
export { useVoiceAppKitStatus } from './useVoiceAppKitStatus';
|
|
9
|
+
export { useVoiceCampaignDialerProof } from './useVoiceCampaignDialerProof';
|
|
9
10
|
export { useVoiceStream } from './useVoiceStream';
|
|
10
11
|
export { useVoiceController } from './useVoiceController';
|
|
11
12
|
export { useVoiceProviderStatus } from './useVoiceProviderStatus';
|