@mgamadeus/ddd-agents 0.6.15 → 0.7.1
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/files/i18n-keys.json +49 -0
- package/dist/types/entries/voice-admin.d.ts +2 -0
- package/dist/types/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.d.ts +33 -0
- package/dist/types/voice/samples/agent-voice-sample-player.d.ts +33 -0
- package/dist/voice-admin.js +161 -3
- package/dist/voice-admin.js.map +1 -1
- package/package.json +1 -1
- package/public-api.json +18 -2
|
@@ -1330,6 +1330,17 @@
|
|
|
1330
1330
|
"src/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageThinking/ConversationMessageThinking.tsx"
|
|
1331
1331
|
]
|
|
1332
1332
|
},
|
|
1333
|
+
{
|
|
1334
|
+
"key": "Play the sample of %voiceName%",
|
|
1335
|
+
"defaultText": "Play the sample of %voiceName%",
|
|
1336
|
+
"placeholders": [
|
|
1337
|
+
"voiceName"
|
|
1338
|
+
],
|
|
1339
|
+
"contexts": [],
|
|
1340
|
+
"usedIn": [
|
|
1341
|
+
"src/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.tsx"
|
|
1342
|
+
]
|
|
1343
|
+
},
|
|
1333
1344
|
{
|
|
1334
1345
|
"key": "Play the video %title%",
|
|
1335
1346
|
"defaultText": "Play the video %title%",
|
|
@@ -1797,6 +1808,17 @@
|
|
|
1797
1808
|
"src/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.tsx"
|
|
1798
1809
|
]
|
|
1799
1810
|
},
|
|
1811
|
+
{
|
|
1812
|
+
"key": "Stop the sample of %voiceName%",
|
|
1813
|
+
"defaultText": "Stop the sample of %voiceName%",
|
|
1814
|
+
"placeholders": [
|
|
1815
|
+
"voiceName"
|
|
1816
|
+
],
|
|
1817
|
+
"contexts": [],
|
|
1818
|
+
"usedIn": [
|
|
1819
|
+
"src/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.tsx"
|
|
1820
|
+
]
|
|
1821
|
+
},
|
|
1800
1822
|
{
|
|
1801
1823
|
"key": "Subject",
|
|
1802
1824
|
"defaultText": "Subject",
|
|
@@ -2002,6 +2024,24 @@
|
|
|
2002
2024
|
"src/voice/admin/agent-voice-admin-format.ts"
|
|
2003
2025
|
]
|
|
2004
2026
|
},
|
|
2027
|
+
{
|
|
2028
|
+
"key": "The sample could not be loaded.",
|
|
2029
|
+
"defaultText": "The sample could not be loaded.",
|
|
2030
|
+
"placeholders": [],
|
|
2031
|
+
"contexts": [],
|
|
2032
|
+
"usedIn": [
|
|
2033
|
+
"src/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.tsx"
|
|
2034
|
+
]
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
"key": "The sample could not be played.",
|
|
2038
|
+
"defaultText": "The sample could not be played.",
|
|
2039
|
+
"placeholders": [],
|
|
2040
|
+
"contexts": [],
|
|
2041
|
+
"usedIn": [
|
|
2042
|
+
"src/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.tsx"
|
|
2043
|
+
]
|
|
2044
|
+
},
|
|
2005
2045
|
{
|
|
2006
2046
|
"key": "The session ended on an error of the provider, the model or the worker",
|
|
2007
2047
|
"defaultText": "The session ended on an error of the provider, the model or the worker",
|
|
@@ -2145,6 +2185,15 @@
|
|
|
2145
2185
|
"src/voice/call/agent-voice-call-store.ts"
|
|
2146
2186
|
]
|
|
2147
2187
|
},
|
|
2188
|
+
{
|
|
2189
|
+
"key": "There is no sample of this voice yet.",
|
|
2190
|
+
"defaultText": "There is no sample of this voice yet.",
|
|
2191
|
+
"placeholders": [],
|
|
2192
|
+
"contexts": [],
|
|
2193
|
+
"usedIn": [
|
|
2194
|
+
"src/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.tsx"
|
|
2195
|
+
]
|
|
2196
|
+
},
|
|
2148
2197
|
{
|
|
2149
2198
|
"key": "These files show here once the drive is part of this app.",
|
|
2150
2199
|
"defaultText": "These files show here once the drive is part of this app.",
|
|
@@ -5,3 +5,5 @@ export { AgentVoiceCallConversationLink, type AgentVoiceCallConversationLinkProp
|
|
|
5
5
|
export { AgentVoiceCallStateBadges, type AgentVoiceCallStateBadgesProps, } from "../voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges";
|
|
6
6
|
export { AGENT_VOICE_CALLS_MAX_PAGE_SIZE, AgentVoiceCallsScreen, type AgentVoiceCallsScreenProps, } from "../voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen";
|
|
7
7
|
export { AgentVoiceCallDetailScreen, type AgentVoiceCallDetailScreenProps, } from "../voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen";
|
|
8
|
+
export { AGENT_VOICE_SAMPLE_ERROR_TEXTS, type AgentVoiceSampleButtonProps, AgentVoiceSampleButton, type AgentVoiceSamplePlayer, useAgentVoiceSamplePlayer, type UseAgentVoiceSamplePlayerOptions, } from "../voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton";
|
|
9
|
+
export { type AgentVoiceSampleErrorKind, agentVoiceSampleKeyOf, type AgentVoiceSamplePlayerState, type FetchAgentVoiceSample, isAgentVoiceSampleNotFound, readAgentVoiceSamplePlayerState, resetAgentVoiceSamplePlayer, stopAgentVoiceSample, subscribeAgentVoiceSamplePlayer, toggleAgentVoiceSample, } from "../voice/samples/agent-voice-sample-player";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type AgentVoiceSampleErrorKind, type FetchAgentVoiceSample } from "../agent-voice-sample-player";
|
|
3
|
+
/** The message of each reason a sample did not play, for the application's toast. */
|
|
4
|
+
export declare const AGENT_VOICE_SAMPLE_ERROR_TEXTS: Readonly<Record<AgentVoiceSampleErrorKind, string>>;
|
|
5
|
+
export interface UseAgentVoiceSamplePlayerOptions {
|
|
6
|
+
/** How the application fetches a sample through its backend (e.g. its SDK's lazy query, unwrapped to the Blob). */
|
|
7
|
+
fetchSample: FetchAgentVoiceSample;
|
|
8
|
+
/** Shows why a sample did not play (the translated text and its reason); the package shows no toast of its own. */
|
|
9
|
+
onError?: (message: string, errorKind: AgentVoiceSampleErrorKind) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Plays and stops voice samples; every user of the hook sees the same state (one audio element per page). When the
|
|
13
|
+
* last user leaves the page, the sample stops.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useAgentVoiceSamplePlayer: ({ fetchSample, onError }: UseAgentVoiceSamplePlayerOptions) => {
|
|
16
|
+
toggle: (voiceId: string, languageCode: string) => Promise<void>;
|
|
17
|
+
isPlaying: (voiceId: string, languageCode: string) => boolean;
|
|
18
|
+
isLoading: (voiceId: string, languageCode: string) => boolean;
|
|
19
|
+
};
|
|
20
|
+
export type AgentVoiceSamplePlayer = ReturnType<typeof useAgentVoiceSamplePlayer>;
|
|
21
|
+
export interface AgentVoiceSampleButtonProps {
|
|
22
|
+
voiceId: string;
|
|
23
|
+
languageCode: string;
|
|
24
|
+
/** The voice's name for the label ("Marin") */
|
|
25
|
+
voiceName: string;
|
|
26
|
+
player: AgentVoiceSamplePlayer;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* ▶ / ■ of one sample. Usable inside a select item: a press neither chooses the item nor closes the list. In a select
|
|
31
|
+
* whose value mirrors the item's text, give the select value its own children, so the button is not mirrored.
|
|
32
|
+
*/
|
|
33
|
+
export declare const AgentVoiceSampleButton: ({ voiceId, languageCode, voiceName, player, className }: AgentVoiceSampleButtonProps) => ReactNode;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Fetches the WAV of a voice in a language; rejects with a `status` of 404 when there is no sample. */
|
|
2
|
+
export type FetchAgentVoiceSample = (voiceId: string, languageCode: string) => Promise<Blob>;
|
|
3
|
+
/** Why a sample did not play: none generated yet (404), the fetch failed, or the browser refused to play it. */
|
|
4
|
+
export type AgentVoiceSampleErrorKind = "notFound" | "loadFailed" | "playFailed";
|
|
5
|
+
export interface AgentVoiceSamplePlayerState {
|
|
6
|
+
/** The sample playing now (`voiceId/languageCode`) */
|
|
7
|
+
playingSampleKey: string | null;
|
|
8
|
+
/** The sample being fetched */
|
|
9
|
+
loadingSampleKey: string | null;
|
|
10
|
+
}
|
|
11
|
+
/** The key of a sample: voice and language. */
|
|
12
|
+
export declare const agentVoiceSampleKeyOf: (voiceId: string, languageCode: string) => string;
|
|
13
|
+
/** The state now (a new object after every change, so it can back `useSyncExternalStore`). */
|
|
14
|
+
export declare const readAgentVoiceSamplePlayerState: () => AgentVoiceSamplePlayerState;
|
|
15
|
+
/** Calls `listener` after every change; returns the unsubscribe. */
|
|
16
|
+
export declare const subscribeAgentVoiceSamplePlayer: (listener: () => void) => (() => void);
|
|
17
|
+
/** The number of subscribers (the hook stops the sample when the last one leaves). */
|
|
18
|
+
export declare const countAgentVoiceSamplePlayerSubscribers: () => number;
|
|
19
|
+
/** Stops the sample playing, if any. */
|
|
20
|
+
export declare const stopAgentVoiceSample: () => void;
|
|
21
|
+
/** Whether a rejected fetch was a 404 (an RTK Query error, a `Response`-like or any object with `status: 404`). */
|
|
22
|
+
export declare const isAgentVoiceSampleNotFound: (error: unknown) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Plays the sample of a voice in a language, or stops it when it is the one playing. Starting a sample stops the one
|
|
25
|
+
* playing; a sample asked for while another loads wins over it. Resolves with why it did not play, or null.
|
|
26
|
+
*/
|
|
27
|
+
export declare const toggleAgentVoiceSample: ({ voiceId, languageCode, fetchSample, }: {
|
|
28
|
+
voiceId: string;
|
|
29
|
+
languageCode: string;
|
|
30
|
+
fetchSample: FetchAgentVoiceSample;
|
|
31
|
+
}) => Promise<AgentVoiceSampleErrorKind | null>;
|
|
32
|
+
/** Stops the sample and forgets every fetched one (a sign-out, or a spec between tests). */
|
|
33
|
+
export declare const resetAgentVoiceSamplePlayer: () => void;
|
package/dist/voice-admin.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { trimApiPrefix, toQueryString, injectEndpointsOnce, staticQueryHook } from "@mgamadeus/ddd-admin-ui/logic/pure";
|
|
3
3
|
import { combineFilters, buildFieldFilter } from "@mgamadeus/ddd-web/query";
|
|
4
4
|
import { normalizeDddError } from "@mgamadeus/ddd-web/contract";
|
|
5
|
-
import { Bot, UserRound, Undo2, TimerOff, Ban, BellOff, CircleX, Gauge, CircleCheck, CircleStop, AudioLines, BellRing, RefreshCw, ChevronLeft, ChevronRight, MessagesSquare } from "lucide-react";
|
|
5
|
+
import { Bot, UserRound, Undo2, TimerOff, Ban, BellOff, CircleX, Gauge, CircleCheck, CircleStop, AudioLines, BellRing, RefreshCw, ChevronLeft, ChevronRight, MessagesSquare, LoaderCircle, Square, Play } from "lucide-react";
|
|
6
6
|
import { m, formatUiNumber, useTranslate } from "@mgamadeus/ddd-admin-ui/i18n";
|
|
7
7
|
import { defineStatusMap, useDebouncedValue } from "@mgamadeus/ddd-admin-ui/logic";
|
|
8
8
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
9
9
|
import { useLinkComponent, Button, cn, Skeleton, Card, CardContent } from "@mgamadeus/ddd-admin-ui/primitives";
|
|
10
10
|
import { StatusBadge, DateCell, EmptyValue, EntityListCard, EntityListBody, EntityListToolbar, FilterPanel, FilterText, FilterDateRange, FilterSelect } from "@mgamadeus/ddd-admin-ui/list";
|
|
11
|
-
import { useState } from "react";
|
|
11
|
+
import { useState, useSyncExternalStore, useEffect, useCallback } from "react";
|
|
12
12
|
import { PageHeader, StatusCallout, DefinitionList } from "@mgamadeus/ddd-admin-ui/page";
|
|
13
13
|
import { f as formatAgentVoiceCallDuration } from "./chunks/format-agent-voice-call-duration-C-3hRc9p.js";
|
|
14
14
|
const AGENT_VOICE_CALLS_TAG = "AdminUiAgentVoiceCalls";
|
|
@@ -709,6 +709,154 @@ const AgentVoiceCallDetailScreen = ({
|
|
|
709
709
|
) }) })
|
|
710
710
|
] });
|
|
711
711
|
};
|
|
712
|
+
const agentVoiceSampleKeyOf = (voiceId, languageCode) => `${voiceId}/${languageCode}`;
|
|
713
|
+
let sharedAudioElement = null;
|
|
714
|
+
const objectUrlBySampleKey = /* @__PURE__ */ new Map();
|
|
715
|
+
let playerState = { playingSampleKey: null, loadingSampleKey: null };
|
|
716
|
+
const playerStateListeners = /* @__PURE__ */ new Set();
|
|
717
|
+
const setPlayerState = (change) => {
|
|
718
|
+
playerState = { ...playerState, ...change };
|
|
719
|
+
for (const listener of playerStateListeners) listener();
|
|
720
|
+
};
|
|
721
|
+
const audioElementOf = () => {
|
|
722
|
+
if (sharedAudioElement === null) {
|
|
723
|
+
sharedAudioElement = new Audio();
|
|
724
|
+
sharedAudioElement.preload = "auto";
|
|
725
|
+
const clearPlaying = () => setPlayerState({ playingSampleKey: null });
|
|
726
|
+
sharedAudioElement.addEventListener("ended", clearPlaying);
|
|
727
|
+
sharedAudioElement.addEventListener("pause", clearPlaying);
|
|
728
|
+
}
|
|
729
|
+
return sharedAudioElement;
|
|
730
|
+
};
|
|
731
|
+
const readAgentVoiceSamplePlayerState = () => playerState;
|
|
732
|
+
const subscribeAgentVoiceSamplePlayer = (listener) => {
|
|
733
|
+
playerStateListeners.add(listener);
|
|
734
|
+
return () => {
|
|
735
|
+
playerStateListeners.delete(listener);
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
const countAgentVoiceSamplePlayerSubscribers = () => playerStateListeners.size;
|
|
739
|
+
const stopAgentVoiceSample = () => {
|
|
740
|
+
sharedAudioElement?.pause();
|
|
741
|
+
if (playerState.playingSampleKey !== null) setPlayerState({ playingSampleKey: null });
|
|
742
|
+
};
|
|
743
|
+
const isAgentVoiceSampleNotFound = (error) => typeof error === "object" && error !== null && "status" in error && error.status === 404;
|
|
744
|
+
const toggleAgentVoiceSample = async ({
|
|
745
|
+
voiceId,
|
|
746
|
+
languageCode,
|
|
747
|
+
fetchSample
|
|
748
|
+
}) => {
|
|
749
|
+
const sampleKey = agentVoiceSampleKeyOf(voiceId, languageCode);
|
|
750
|
+
if (playerState.playingSampleKey === sampleKey) {
|
|
751
|
+
stopAgentVoiceSample();
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
stopAgentVoiceSample();
|
|
755
|
+
let objectUrl = objectUrlBySampleKey.get(sampleKey);
|
|
756
|
+
if (objectUrl === void 0) {
|
|
757
|
+
setPlayerState({ loadingSampleKey: sampleKey });
|
|
758
|
+
let sampleBlob;
|
|
759
|
+
try {
|
|
760
|
+
sampleBlob = await fetchSample(voiceId, languageCode);
|
|
761
|
+
} catch (error) {
|
|
762
|
+
if (playerState.loadingSampleKey === sampleKey) setPlayerState({ loadingSampleKey: null });
|
|
763
|
+
return isAgentVoiceSampleNotFound(error) ? "notFound" : "loadFailed";
|
|
764
|
+
}
|
|
765
|
+
objectUrl = URL.createObjectURL(sampleBlob);
|
|
766
|
+
objectUrlBySampleKey.set(sampleKey, objectUrl);
|
|
767
|
+
if (playerState.loadingSampleKey !== sampleKey) return null;
|
|
768
|
+
setPlayerState({ loadingSampleKey: null });
|
|
769
|
+
}
|
|
770
|
+
const audioElement = audioElementOf();
|
|
771
|
+
audioElement.src = objectUrl;
|
|
772
|
+
setPlayerState({ playingSampleKey: sampleKey });
|
|
773
|
+
try {
|
|
774
|
+
await audioElement.play();
|
|
775
|
+
} catch {
|
|
776
|
+
if (playerState.playingSampleKey === sampleKey) setPlayerState({ playingSampleKey: null });
|
|
777
|
+
return "playFailed";
|
|
778
|
+
}
|
|
779
|
+
return null;
|
|
780
|
+
};
|
|
781
|
+
const resetAgentVoiceSamplePlayer = () => {
|
|
782
|
+
stopAgentVoiceSample();
|
|
783
|
+
for (const objectUrl of objectUrlBySampleKey.values()) URL.revokeObjectURL(objectUrl);
|
|
784
|
+
objectUrlBySampleKey.clear();
|
|
785
|
+
sharedAudioElement = null;
|
|
786
|
+
playerState = { playingSampleKey: null, loadingSampleKey: null };
|
|
787
|
+
};
|
|
788
|
+
const AGENT_VOICE_SAMPLE_ERROR_TEXTS = {
|
|
789
|
+
notFound: m("There is no sample of this voice yet."),
|
|
790
|
+
loadFailed: m("The sample could not be loaded."),
|
|
791
|
+
playFailed: m("The sample could not be played.")
|
|
792
|
+
};
|
|
793
|
+
const useAgentVoiceSamplePlayer = ({ fetchSample, onError }) => {
|
|
794
|
+
const { t } = useTranslate();
|
|
795
|
+
const playerState2 = useSyncExternalStore(
|
|
796
|
+
subscribeAgentVoiceSamplePlayer,
|
|
797
|
+
readAgentVoiceSamplePlayerState,
|
|
798
|
+
readAgentVoiceSamplePlayerState
|
|
799
|
+
);
|
|
800
|
+
useEffect(() => {
|
|
801
|
+
const unsubscribe = subscribeAgentVoiceSamplePlayer(() => {
|
|
802
|
+
});
|
|
803
|
+
return () => {
|
|
804
|
+
unsubscribe();
|
|
805
|
+
if (countAgentVoiceSamplePlayerSubscribers() === 0) stopAgentVoiceSample();
|
|
806
|
+
};
|
|
807
|
+
}, []);
|
|
808
|
+
const toggle = useCallback(
|
|
809
|
+
async (voiceId, languageCode) => {
|
|
810
|
+
const errorKind = await toggleAgentVoiceSample({ voiceId, languageCode, fetchSample });
|
|
811
|
+
if (errorKind !== null) onError?.(t(AGENT_VOICE_SAMPLE_ERROR_TEXTS[errorKind]), errorKind);
|
|
812
|
+
},
|
|
813
|
+
[fetchSample, onError, t]
|
|
814
|
+
);
|
|
815
|
+
return {
|
|
816
|
+
toggle,
|
|
817
|
+
isPlaying: (voiceId, languageCode) => playerState2.playingSampleKey === agentVoiceSampleKeyOf(voiceId, languageCode),
|
|
818
|
+
isLoading: (voiceId, languageCode) => playerState2.loadingSampleKey === agentVoiceSampleKeyOf(voiceId, languageCode)
|
|
819
|
+
};
|
|
820
|
+
};
|
|
821
|
+
const keepFromParent = (event) => {
|
|
822
|
+
event.stopPropagation();
|
|
823
|
+
};
|
|
824
|
+
const AgentVoiceSampleButton = ({ voiceId, languageCode, voiceName, player, className }) => {
|
|
825
|
+
const { t } = useTranslate();
|
|
826
|
+
const isPlaying = player.isPlaying(voiceId, languageCode);
|
|
827
|
+
const isLoading = player.isLoading(voiceId, languageCode);
|
|
828
|
+
const label = isPlaying ? t("Stop the sample of %voiceName%", { replacements: { voiceName } }) : t("Play the sample of %voiceName%", { replacements: { voiceName } });
|
|
829
|
+
const toggle = (event) => {
|
|
830
|
+
keepFromParent(event);
|
|
831
|
+
event.preventDefault();
|
|
832
|
+
void player.toggle(voiceId, languageCode);
|
|
833
|
+
};
|
|
834
|
+
return /* @__PURE__ */ jsx(
|
|
835
|
+
"button",
|
|
836
|
+
{
|
|
837
|
+
type: "button",
|
|
838
|
+
"aria-label": label,
|
|
839
|
+
title: label,
|
|
840
|
+
"aria-pressed": isPlaying,
|
|
841
|
+
"data-voice-sample": agentVoiceSampleKeyOf(voiceId, languageCode),
|
|
842
|
+
className: cn(
|
|
843
|
+
"inline-flex size-8 shrink-0 items-center justify-center rounded-full border bg-background text-foreground transition-colors hover:bg-tint focus-visible:outline-2 focus-visible:outline-ring",
|
|
844
|
+
isPlaying && "border-primary text-primary",
|
|
845
|
+
className
|
|
846
|
+
),
|
|
847
|
+
onPointerDown: (event) => {
|
|
848
|
+
keepFromParent(event);
|
|
849
|
+
event.preventDefault();
|
|
850
|
+
},
|
|
851
|
+
onPointerUp: keepFromParent,
|
|
852
|
+
onKeyDown: (event) => {
|
|
853
|
+
if (event.key === "Enter" || event.key === " ") toggle(event);
|
|
854
|
+
},
|
|
855
|
+
onClick: toggle,
|
|
856
|
+
children: isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin", "aria-hidden": true }) : isPlaying ? /* @__PURE__ */ jsx(Square, { className: "size-3.5 fill-current", "aria-hidden": true }) : /* @__PURE__ */ jsx(Play, { className: "size-3.5 translate-x-px fill-current", "aria-hidden": true })
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
};
|
|
712
860
|
export {
|
|
713
861
|
AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND,
|
|
714
862
|
AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE,
|
|
@@ -718,21 +866,31 @@ export {
|
|
|
718
866
|
AGENT_VOICE_CALL_END_REASON,
|
|
719
867
|
AGENT_VOICE_CALL_END_REASONS,
|
|
720
868
|
AGENT_VOICE_CALL_STATE,
|
|
869
|
+
AGENT_VOICE_SAMPLE_ERROR_TEXTS,
|
|
721
870
|
AgentVoiceCallConversationLink,
|
|
722
871
|
AgentVoiceCallDetailScreen,
|
|
723
872
|
AgentVoiceCallStateBadges,
|
|
724
873
|
AgentVoiceCallsScreen,
|
|
874
|
+
AgentVoiceSampleButton,
|
|
725
875
|
agentVoiceAdminCallDerivedValuesByCallIdOf,
|
|
726
876
|
agentVoiceAdminCallDurationInSecondsOf,
|
|
727
877
|
agentVoiceAdminCallStartTimeOf,
|
|
728
878
|
agentVoiceAdminEndpointDefinitions,
|
|
879
|
+
agentVoiceSampleKeyOf,
|
|
729
880
|
buildAgentVoiceAdminCallsFilters,
|
|
730
881
|
buildAgentVoiceAdminRequests,
|
|
731
882
|
createAgentVoiceAdminApi,
|
|
732
883
|
createStaticAgentVoiceAdminApi,
|
|
733
884
|
formatAgentVoiceAdminCallCosts,
|
|
734
885
|
isAgentVoiceAdminError,
|
|
886
|
+
isAgentVoiceSampleNotFound,
|
|
735
887
|
readAgentVoiceAdminWholeNumber,
|
|
736
|
-
|
|
888
|
+
readAgentVoiceSamplePlayerState,
|
|
889
|
+
resetAgentVoiceSamplePlayer,
|
|
890
|
+
stopAgentVoiceSample,
|
|
891
|
+
subscribeAgentVoiceSamplePlayer,
|
|
892
|
+
toAgentVoiceAdminDayBound,
|
|
893
|
+
toggleAgentVoiceSample,
|
|
894
|
+
useAgentVoiceSamplePlayer
|
|
737
895
|
};
|
|
738
896
|
//# sourceMappingURL=voice-admin.js.map
|
package/dist/voice-admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-admin.js","sources":["../src/voice/admin/agent-voice-admin-api.ts","../src/voice/admin/agent-voice-admin-format.ts","../src/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.tsx","../src/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.tsx","../src/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.tsx","../src/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.tsx"],"sourcesContent":["import {\n type ApiQueryHook,\n type InjectableBaseApi,\n type InjectedEndpointDefinition,\n type InjectedRequest,\n injectEndpointsOnce,\n type StaticQueryFailure,\n staticQueryHook,\n toQueryString,\n trimApiPrefix,\n} from \"@mgamadeus/ddd-admin-ui/logic/pure\";\nimport { buildFieldFilter, combineFilters } from \"@mgamadeus/ddd-web/query\";\nimport type {\n AgentVoiceAdminCallIdArg,\n AgentVoiceAdminCallResponse,\n AgentVoiceAdminCallsArg,\n AgentVoiceAdminCallsResponse,\n} from \"./agent-voice-admin-types\";\n\n/** The cache tag type of the call operations (ids `LIST`, `DETAIL`). */\nexport const AGENT_VOICE_CALLS_TAG = \"AdminUiAgentVoiceCalls\";\n\n/** The hooks `createAgentVoiceAdminApi` returns; the call screens take them as their `api`. */\nexport interface AgentVoiceAdminApi {\n /** `GET /calls?filters&top&skip`: the calls the signed-in account may read, newest first. */\n useAgentVoiceCallsQuery: ApiQueryHook<AgentVoiceAdminCallsArg, AgentVoiceAdminCallsResponse>;\n /** `GET /calls/{callId}`: one call (404 `call_not_found`: unknown or not readable). */\n useAgentVoiceCallQuery: ApiQueryHook<AgentVoiceAdminCallIdArg, AgentVoiceAdminCallResponse>;\n}\n\nexport interface CreateAgentVoiceAdminApiOptions {\n /** The host's RTK Query api (`createApi` with the React hooks module). */\n baseApi: InjectableBaseApi;\n /** Where the host mounts `AdminAgentVoiceCallsTrait`, without a trailing slash (`/api/admin/ai/voiceCalls`). */\n apiPrefix: string;\n}\n\n/**\n * The filter expression of the list's arguments, in the query options grammar of the route (`accountId eq '12' and\n * bookedSeconds ge '60'`); undefined when nothing narrows. The date range filters the moment a call was created, so a\n * call nobody answered is found too. Which accounts' calls are read at all is decided on the server.\n */\nexport const buildAgentVoiceAdminCallsFilters = (arg: AgentVoiceAdminCallsArg): string | undefined =>\n combineFilters(\n arg.accountId !== undefined && buildFieldFilter(\"accountId\", arg.accountId, \"eq\"),\n arg.conversationId !== undefined && buildFieldFilter(\"aiConversationId\", arg.conversationId, \"eq\"),\n arg.createdFrom !== undefined && arg.createdFrom !== \"\" && buildFieldFilter(\"created\", arg.createdFrom, \"ge\"),\n arg.createdTo !== undefined && arg.createdTo !== \"\" && buildFieldFilter(\"created\", arg.createdTo, \"le\"),\n arg.bookedSecondsFrom !== undefined && buildFieldFilter(\"bookedSeconds\", arg.bookedSecondsFrom, \"ge\"),\n arg.bookedSecondsTo !== undefined && buildFieldFilter(\"bookedSeconds\", arg.bookedSecondsTo, \"le\"),\n arg.endReason !== undefined && arg.endReason !== \"\" && buildFieldFilter(\"endReason\", arg.endReason, \"eq\"),\n );\n\n/** The request of every operation, on `apiPrefix`. Pure: no RTK runtime. */\nexport const buildAgentVoiceAdminRequests = (apiPrefix: string) => {\n const prefix = trimApiPrefix(apiPrefix);\n return {\n calls: (arg: AgentVoiceAdminCallsArg = {}): InjectedRequest => ({\n url: `${prefix}/calls${toQueryString({ filters: buildAgentVoiceAdminCallsFilters(arg), top: arg.limit, skip: arg.offset })}`,\n }),\n call: ({ callId }: AgentVoiceAdminCallIdArg): InjectedRequest => ({\n url: `${prefix}/calls/${encodeURIComponent(String(callId))}`,\n }),\n };\n};\n\nconst LIST = { type: AGENT_VOICE_CALLS_TAG, id: \"LIST\" } as const;\nconst DETAIL = { type: AGENT_VOICE_CALLS_TAG, id: \"DETAIL\" } as const;\n\n/** The operations as injected. */\nexport const agentVoiceAdminEndpointDefinitions = (apiPrefix: string) => {\n const requests = buildAgentVoiceAdminRequests(apiPrefix);\n return {\n adminUiAgentVoiceCalls: { kind: \"query\", request: requests.calls, providesTags: [LIST] },\n adminUiAgentVoiceCall: { kind: \"query\", request: requests.call, providesTags: [DETAIL] },\n } as const satisfies Record<string, InjectedEndpointDefinition<never>>;\n};\n\n/**\n * Injects the call operations into the host's RTK Query api and returns their hooks. Call it once at module scope:\n * `export const agentVoiceAdminApi = createAgentVoiceAdminApi({ baseApi: adminApi, apiPrefix: \"/api/admin/ai/voiceCalls\" });`\n */\nexport const createAgentVoiceAdminApi = ({ baseApi, apiPrefix }: CreateAgentVoiceAdminApiOptions): AgentVoiceAdminApi =>\n injectEndpointsOnce(\n baseApi,\n `agentVoiceCalls:${trimApiPrefix(apiPrefix)}`,\n [AGENT_VOICE_CALLS_TAG],\n agentVoiceAdminEndpointDefinitions(apiPrefix),\n (hookOf) => ({\n useAgentVoiceCallsQuery: hookOf(\"adminUiAgentVoiceCalls\") as AgentVoiceAdminApi[\"useAgentVoiceCallsQuery\"],\n useAgentVoiceCallQuery: hookOf(\"adminUiAgentVoiceCall\") as AgentVoiceAdminApi[\"useAgentVoiceCallQuery\"],\n }),\n );\n\n/** Fixed answers of a `createStaticAgentVoiceAdminApi`; a query without one stays loading. */\nexport interface StaticAgentVoiceAdminData {\n calls?: (arg: AgentVoiceAdminCallsArg) => AgentVoiceAdminCallsResponse | StaticQueryFailure | undefined;\n call?: (arg: AgentVoiceAdminCallIdArg) => AgentVoiceAdminCallResponse | StaticQueryFailure | undefined;\n}\n\n/** An `AgentVoiceAdminApi` answering fixed payloads, without a store or a request (showcases, tests, reviews). */\nexport const createStaticAgentVoiceAdminApi = (data: StaticAgentVoiceAdminData): AgentVoiceAdminApi => ({\n useAgentVoiceCallsQuery: staticQueryHook((arg) => data.calls?.(arg ?? {})),\n useAgentVoiceCallQuery: staticQueryHook((arg) => data.call?.(arg)),\n});\n","// Labels, states and small helpers of the call screens. Pure: no React.\nimport { normalizeDddError } from \"@mgamadeus/ddd-web/contract\";\nimport {\n AudioLines,\n Ban,\n BellOff,\n BellRing,\n Bot,\n CircleCheck,\n CircleStop,\n CircleX,\n Gauge,\n TimerOff,\n Undo2,\n UserRound,\n} from \"lucide-react\";\n\nimport { formatUiNumber, m } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { defineStatusMap } from \"@mgamadeus/ddd-admin-ui/logic\";\nimport type {\n AgentVoiceAdminCall,\n AgentVoiceAdminCallDerivedValues,\n AgentVoiceAdminCallDirection,\n AgentVoiceAdminCallEndReason,\n AgentVoiceAdminCallState,\n AgentVoiceAdminElements,\n AgentVoiceAdminMoneyAmount,\n} from \"./agent-voice-admin-types\";\n\n/** Where a call stands, as the server read it (`callState` of the answers). */\nexport const AGENT_VOICE_CALL_STATE = defineStatusMap<AgentVoiceAdminCallState>(\n {\n RINGING: {\n label: m(\"Ringing\", { context: \"agent-voice-call-state\" }),\n tone: \"warning\",\n icon: BellRing,\n description: m(\"Nobody has answered yet\", { context: \"agent-voice-call-state\" }),\n },\n IN_PROGRESS: {\n label: m(\"Running\", { context: \"agent-voice-call-state\" }),\n tone: \"success\",\n icon: AudioLines,\n description: m(\"The call was answered and is going on\", { context: \"agent-voice-call-state\" }),\n },\n ENDED: {\n label: m(\"Ended\", { context: \"agent-voice-call-state\" }),\n tone: \"neutral\",\n icon: CircleStop,\n description: m(\"The call is over\", { context: \"agent-voice-call-state\" }),\n },\n },\n { context: \"agent-voice-call-state\" },\n);\n\n/** `AgentVoiceCall.endReason`: the reasons the call writes itself. A diagnostic value shows as it came. */\nexport const AGENT_VOICE_CALL_END_REASON = defineStatusMap<AgentVoiceAdminCallEndReason>(\n {\n COMPLETED: {\n label: m(\"Completed\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"success\",\n icon: CircleCheck,\n description: m(\"Both sides hung up normally\", { context: \"agent-voice-call-end-reason\" }),\n },\n ENDED_BY_AGENT: {\n label: m(\"Ended by the agent\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"info\",\n icon: Bot,\n description: m(\"The agent hung up the running call or withdrew its ring\", { context: \"agent-voice-call-end-reason\" }),\n },\n LIMIT_REACHED: {\n label: m(\"Limit reached\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"warning\",\n icon: Gauge,\n description: m(\"The call ran into its time, daily or budget limit\", { context: \"agent-voice-call-end-reason\" }),\n },\n FAILED: {\n label: m(\"Failed\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"danger\",\n icon: CircleX,\n description: m(\"The session ended on an error of the provider, the model or the worker\", {\n context: \"agent-voice-call-end-reason\",\n }),\n },\n NOT_ANSWERED: {\n label: m(\"Not answered\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: BellOff,\n description: m(\"Nobody picked up\", { context: \"agent-voice-call-end-reason\" }),\n },\n DECLINED: {\n label: m(\"Declined\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: Ban,\n description: m(\"Every client the call rang on declined it\", { context: \"agent-voice-call-end-reason\" }),\n },\n EXPIRED: {\n label: m(\"Expired\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: TimerOff,\n description: m(\"Nobody answered before the ringing stopped\", { context: \"agent-voice-call-end-reason\" }),\n },\n CANCELED: {\n label: m(\"Canceled\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: Undo2,\n description: m(\"The side that started the call withdrew it before anyone answered\", {\n context: \"agent-voice-call-end-reason\",\n }),\n },\n },\n { context: \"agent-voice-call-end-reason\" },\n);\n\n/** The end reasons a list can be filtered by, in the order the filter offers them. */\nexport const AGENT_VOICE_CALL_END_REASONS = [\n \"COMPLETED\",\n \"ENDED_BY_AGENT\",\n \"LIMIT_REACHED\",\n \"FAILED\",\n \"NOT_ANSWERED\",\n \"DECLINED\",\n \"EXPIRED\",\n \"CANCELED\",\n] as const satisfies readonly AgentVoiceAdminCallEndReason[];\n\n/** `AgentVoiceCall.direction`: who started the call. */\nexport const AGENT_VOICE_CALL_DIRECTION = defineStatusMap<AgentVoiceAdminCallDirection>(\n {\n INBOUND: {\n label: m(\"The owner called\", { context: \"agent-voice-call-direction\" }),\n tone: \"neutral\",\n icon: UserRound,\n description: m(\"The owner started a voice chat with the agent\", { context: \"agent-voice-call-direction\" }),\n },\n OUTBOUND: {\n label: m(\"The agent rang\", { context: \"agent-voice-call-direction\" }),\n tone: \"neutral\",\n icon: Bot,\n description: m(\"The agent rang the owner’s open clients\", { context: \"agent-voice-call-direction\" }),\n },\n },\n { context: \"agent-voice-call-direction\" },\n);\n\n/**\n * A backend date-time (`Y-m-d H:i:s`) as milliseconds on one clock, for the difference of two of them only: both are\n * read in the same zone, so the zone the backend writes them in does not matter. Null when it is none.\n */\nconst momentOf = (dateTime: string | null | undefined): number | null => {\n if (!dateTime) return null;\n const moment = Date.parse(`${dateTime.trim().replace(\" \", \"T\")}Z`);\n return Number.isNaN(moment) ? null : moment;\n};\n\n/**\n * When a call began: the moment it was created (the owner opened the voice chat, or the ring started) where the\n * answer carries it, else the moment it was answered; null for a call nobody answered whose creation is not sent.\n */\nexport const agentVoiceAdminCallStartTimeOf = (call: Pick<AgentVoiceAdminCall, \"startedAt\" | \"changeHistory\">): string | null =>\n call.changeHistory?.createdTime ?? call.startedAt ?? null;\n\n/** How long a call lasted, from the moment it was answered to its end; null while it runs or when nobody answered. */\nexport const agentVoiceAdminCallDurationInSecondsOf = (\n call: Pick<AgentVoiceAdminCall, \"startedAt\" | \"endedAt\">,\n): number | null => {\n const startedAt = momentOf(call.startedAt);\n const endedAt = momentOf(call.endedAt);\n if (startedAt === null || endedAt === null) return null;\n return Math.max(0, Math.round((endedAt - startedAt) / 1000));\n};\n\n/**\n * What the server derived for the list's calls (the state, the costs), by call id: reads the set the list answer\n * carries (`AgentVoiceAdminCallsResponse.agentVoiceCallDerivedValues`). A call the answer names no entry for has none\n * here: its row then shows no state and no costs.\n */\nexport const agentVoiceAdminCallDerivedValuesByCallIdOf = (\n agentVoiceCallDerivedValues: AgentVoiceAdminElements<AgentVoiceAdminCallDerivedValues> | null | undefined,\n): ReadonlyMap<number, AgentVoiceAdminCallDerivedValues> => {\n const derivedValuesByCallId = new Map<number, AgentVoiceAdminCallDerivedValues>();\n for (const derivedValuesOfCall of agentVoiceCallDerivedValues?.elements ?? [])\n derivedValuesByCallId.set(derivedValuesOfCall.callId, derivedValuesOfCall);\n return derivedValuesByCallId;\n};\n\n/** The fraction digits a call's costs are rounded to: a call costs cents, two digits would show most calls alike. */\nconst CALL_COSTS_FRACTION_DIGITS = { minimumFractionDigits: 2, maximumFractionDigits: 4 } as const;\n\n/** A call's costs, rounded, in the UI language. Call it at render time, so a language switch formats anew. */\nexport const formatAgentVoiceAdminCallCosts = (bookedCosts: AgentVoiceAdminMoneyAmount): string => {\n try {\n return formatUiNumber(bookedCosts.amount, {\n style: \"currency\",\n currency: bookedCosts.currency.isoCode,\n ...CALL_COSTS_FRACTION_DIGITS,\n });\n } catch {\n // A currency code the browser's number format does not know: the rounded number beside the code as it came.\n return `${formatUiNumber(bookedCosts.amount, CALL_COSTS_FRACTION_DIGITS)} ${bookedCosts.currency.isoCode}`;\n }\n};\n\nconst DAY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** A moment as the routes' filters read it: `Y-m-d H:i:s` in UTC. */\nconst toUtcDateTime = (moment: Date): string => moment.toISOString().slice(0, 19).replace(\"T\", \" \");\n\n/**\n * The viewer's calendar day `YYYY-MM-DD` as a moment in UTC: its first second, or with `isEndOfDay` its last.\n * Undefined for an empty value or a day the calendar lacks.\n */\nexport const toAgentVoiceAdminDayBound = (day: string, isEndOfDay: boolean): string | undefined => {\n const dayParts = DAY_PATTERN.exec(day.trim());\n if (!dayParts) return undefined;\n const [year, month, dayOfMonth] = [Number(dayParts[1]), Number(dayParts[2]), Number(dayParts[3])];\n const moment = isEndOfDay ? new Date(year, month - 1, dayOfMonth, 23, 59, 59) : new Date(year, month - 1, dayOfMonth, 0, 0, 0);\n if (moment.getFullYear() !== year || moment.getMonth() !== month - 1 || moment.getDate() !== dayOfMonth) return undefined;\n return toUtcDateTime(moment);\n};\n\n/** A whole, non-negative number typed into a filter (an account id, seconds); undefined for anything else. */\nexport const readAgentVoiceAdminWholeNumber = (text: string): number | undefined => {\n const trimmedText = text.trim();\n return /^\\d{1,15}$/.test(trimmedText) ? Number(trimmedText) : undefined;\n};\n\n/** The error codes of the call routes a screen shows as a state of its own. */\nexport const AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE = \"feature_not_available\";\nexport const AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND = \"call_not_found\";\n\n/**\n * Whether a failed request was refused with `errorCode`. The routes answer the code as the error message; a base\n * query that translates error bodies keeps the original beside it (`errorEnglish`).\n */\nexport const isAgentVoiceAdminError = (error: unknown, errorCode: string): boolean => {\n if (error === undefined || error === null) return false;\n const normalizedError = normalizeDddError(error);\n const errorBody =\n typeof normalizedError.body === \"object\" && normalizedError.body !== null\n ? (normalizedError.body as { error?: unknown; errorEnglish?: unknown })\n : {};\n return [errorBody.errorEnglish, errorBody.error, normalizedError.message].includes(errorCode);\n};\n","import { type PageLinkComponent, useLinkComponent } from \"@mgamadeus/ddd-admin-ui/primitives\";\n\nexport interface AgentVoiceCallConversationLinkProps {\n conversationId: number;\n /** The host's link of the conversation; `null` = the id as text. */\n href: string | null;\n /** The host's router link; default the one of `AdminUiProvider.linkComponent`, else a plain `<a>` (full page load). */\n linkComponent?: PageLinkComponent;\n}\n\n/** `#<conversationId>` as the host's router link (no full page load inside the admin app), or as text without a link. */\nexport const AgentVoiceCallConversationLink = ({ conversationId, href, linkComponent }: AgentVoiceCallConversationLinkProps) => {\n const Link = useLinkComponent(linkComponent);\n if (!href) return <span className=\"font-mono text-xs\">#{conversationId}</span>;\n return (\n <Link href={href} className=\"font-mono text-xs underline-offset-2 hover:underline\">\n #{conversationId}\n </Link>\n );\n};\n","import { StatusBadge } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { AGENT_VOICE_CALL_END_REASON, AGENT_VOICE_CALL_STATE } from \"../agent-voice-admin-format\";\nimport type { AgentVoiceAdminCallEndReason, AgentVoiceAdminCallState } from \"../agent-voice-admin-types\";\n\nexport interface AgentVoiceCallStateBadgesProps {\n /** The server's reading of where the call stands (`callState` of the answer); without one the empty marker shows. */\n callState: AgentVoiceAdminCallState | null | undefined;\n /** Why the call ended (`endReason` of the call), once it has a reason. */\n endReason: string | null | undefined;\n}\n\n/**\n * Where a call stands (ringing, running, ended), as the server read it, and, once it has one, why it ended. An end\n * reason outside the known ones (a diagnostic value of a teardown path) shows as the text it came as.\n */\nexport const AgentVoiceCallStateBadges = ({ callState, endReason }: AgentVoiceCallStateBadgesProps) => (\n <span className=\"flex flex-wrap items-center gap-1.5\">\n <StatusBadge value={callState} map={AGENT_VOICE_CALL_STATE} />\n {endReason ? <StatusBadge value={endReason as AgentVoiceAdminCallEndReason} map={AGENT_VOICE_CALL_END_REASON} /> : null}\n </span>\n);\n","import { normalizeDddError } from \"@mgamadeus/ddd-web/contract\";\nimport { ChevronLeft, ChevronRight, RefreshCw } from \"lucide-react\";\nimport { type ReactNode, useState } from \"react\";\n\nimport { formatUiNumber, m, useTranslate } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { DateCell } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EmptyValue } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EntityListBody } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EntityListCard } from \"@mgamadeus/ddd-admin-ui/list\";\nimport type { EntityListColumn } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EntityListToolbar } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { FilterDateRange, FilterPanel, FilterSelect, FilterText } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { StatusBadge } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { useDebouncedValue } from \"@mgamadeus/ddd-admin-ui/logic\";\nimport { PageHeader } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { StatusCallout } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { Button } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { cn } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport type { PageLinkComponent } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { formatAgentVoiceCallDuration } from \"../../call/format-agent-voice-call-duration\";\nimport type { AgentVoiceAdminApi } from \"../agent-voice-admin-api\";\nimport { AgentVoiceCallConversationLink } from \"../AgentVoiceCallConversationLink/AgentVoiceCallConversationLink\";\nimport { AgentVoiceCallStateBadges } from \"../AgentVoiceCallStateBadges/AgentVoiceCallStateBadges\";\nimport {\n AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE,\n AGENT_VOICE_CALL_DIRECTION,\n AGENT_VOICE_CALL_END_REASON,\n AGENT_VOICE_CALL_END_REASONS,\n agentVoiceAdminCallDerivedValuesByCallIdOf,\n agentVoiceAdminCallDurationInSecondsOf,\n agentVoiceAdminCallStartTimeOf,\n formatAgentVoiceAdminCallCosts,\n isAgentVoiceAdminError,\n readAgentVoiceAdminWholeNumber,\n toAgentVoiceAdminDayBound,\n} from \"../agent-voice-admin-format\";\nimport type { AgentVoiceAdminCall, AgentVoiceAdminCallDirection } from \"../agent-voice-admin-types\";\n\nexport interface AgentVoiceCallsScreenProps {\n /** `createAgentVoiceAdminApi(…)` of the host. */\n api: AgentVoiceAdminApi;\n /** Default \"Voice calls\". */\n title?: ReactNode;\n description?: ReactNode;\n headerActions?: ReactNode;\n /** Opens a call's details (the host's route, e.g. `router.push(…)`). */\n onOpenCall?: (callId: number) => void;\n /** Only the calls of this account (e.g. from the URL); the account filter is then left out. */\n accountId?: number;\n /** Only the calls that ran on this conversation. */\n conversationId?: number;\n /** The link of a conversation in the host's agent screens; `null` = no link. */\n buildConversationHref?: (conversationId: number) => string | null;\n /** The host's router link for the conversation link; default `AdminUiProvider.linkComponent`, else a plain `<a>`. */\n linkComponent?: PageLinkComponent;\n /** Calls per page (default 50, at most 200). */\n pageSize?: number;\n}\n\n/** The most calls one page shows. */\nexport const AGENT_VOICE_CALLS_MAX_PAGE_SIZE = 200;\n\n/** What the filter panel holds, as its fields hold it. */\ninterface AgentVoiceCallsFilterValues {\n /** Digits of an account id, or `\"\"`. */\n accountIdText: string;\n /** The first day of the created range, `YYYY-MM-DD` in the viewer's zone, or `\"\"`. */\n createdFromDay: string;\n /** The last day of the created range, `YYYY-MM-DD` in the viewer's zone, or `\"\"`. */\n createdToDay: string;\n /** Digits of the fewest booked seconds, or `\"\"`. */\n bookedSecondsFromText: string;\n /** An end reason, or `\"\"`. */\n endReason: string;\n}\n\nconst NO_FILTER_VALUES: AgentVoiceCallsFilterValues = {\n accountIdText: \"\",\n createdFromDay: \"\",\n createdToDay: \"\",\n bookedSecondsFromText: \"\",\n endReason: \"\",\n};\n\nconst digitsOf = (text: string): string => text.replace(/\\D/g, \"\");\n\n/**\n * The voice calls the signed-in account may read, newest first: when a call began, its account, who started it, where\n * it stands (the server's reading at answer time) and why it ended, its duration, the booked seconds, their costs, its\n * task and its conversation; filters for the account, the day it was created, the booked seconds and the end reason.\n * Needs the admin call routes mounted (`AdminAgentVoiceCallsTrait`). While voice is switched off the\n * screen says so instead of listing. A call's task is written by the agent or the owner and shown as text only.\n */\nexport const AgentVoiceCallsScreen = ({\n api,\n title,\n description,\n headerActions,\n onOpenCall,\n accountId,\n conversationId,\n buildConversationHref,\n linkComponent,\n pageSize = 50,\n}: AgentVoiceCallsScreenProps) => {\n const { t } = useTranslate();\n const [filterValues, setFilterValues] = useState(NO_FILTER_VALUES);\n const [offset, setOffset] = useState(0);\n const debouncedAccountIdText = useDebouncedValue(filterValues.accountIdText);\n const debouncedBookedSecondsFromText = useDebouncedValue(filterValues.bookedSecondsFromText);\n const callsPerPage = Math.min(Math.max(Math.floor(pageSize), 1), AGENT_VOICE_CALLS_MAX_PAGE_SIZE);\n const isAccountFilterShown = accountId === undefined;\n\n // The answer carries no total count: one call more than a page shows tells whether an older page exists.\n const listQuery = api.useAgentVoiceCallsQuery({\n accountId: accountId ?? readAgentVoiceAdminWholeNumber(debouncedAccountIdText),\n conversationId,\n createdFrom: toAgentVoiceAdminDayBound(filterValues.createdFromDay, false),\n createdTo: toAgentVoiceAdminDayBound(filterValues.createdToDay, true),\n bookedSecondsFrom: readAgentVoiceAdminWholeNumber(debouncedBookedSecondsFromText),\n endReason: filterValues.endReason === \"\" ? undefined : filterValues.endReason,\n limit: callsPerPage + 1,\n offset,\n });\n const loadedCalls = listQuery.data?.agentVoiceCalls?.elements ?? [];\n const calls = loadedCalls.slice(0, callsPerPage);\n const hasOlderCalls = loadedCalls.length > callsPerPage;\n const derivedValuesByCallId = agentVoiceAdminCallDerivedValuesByCallIdOf(listQuery.data?.agentVoiceCallDerivedValues);\n const isVoiceSwitchedOff =\n listQuery.isError && isAgentVoiceAdminError(listQuery.error, AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE);\n\n const changeFilterValues = (changedFilterValues: Partial<AgentVoiceCallsFilterValues>) => {\n setFilterValues((currentFilterValues) => ({ ...currentFilterValues, ...changedFilterValues }));\n setOffset(0);\n };\n const activeFilterCount = [\n isAccountFilterShown && filterValues.accountIdText !== \"\",\n filterValues.createdFromDay !== \"\" || filterValues.createdToDay !== \"\",\n filterValues.bookedSecondsFromText !== \"\",\n filterValues.endReason !== \"\",\n ].filter(Boolean).length;\n const clearFilters = () => changeFilterValues(NO_FILTER_VALUES);\n\n const columns: EntityListColumn<AgentVoiceAdminCall>[] = [\n {\n id: \"started\",\n header: t(\"Started\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => <DateCell value={agentVoiceAdminCallStartTimeOf(call)} />,\n },\n {\n id: \"account\",\n header: t(\"Account\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => (call.accountId ? <span className=\"font-mono text-xs\">#{call.accountId}</span> : <EmptyValue />),\n },\n {\n id: \"direction\",\n header: t(\"Started by\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => <StatusBadge value={call.direction as AgentVoiceAdminCallDirection} map={AGENT_VOICE_CALL_DIRECTION} />,\n },\n {\n id: \"state\",\n header: t(\"State\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => (\n <AgentVoiceCallStateBadges callState={derivedValuesByCallId.get(call.id)?.callState} endReason={call.endReason} />\n ),\n },\n {\n id: \"duration\",\n header: t(\"Duration\", { context: \"agent-voice-call\" }),\n width: \"content\",\n align: \"end\",\n cell: (call) => {\n const durationInSeconds = agentVoiceAdminCallDurationInSecondsOf(call);\n return durationInSeconds === null ? (\n <EmptyValue />\n ) : (\n <span className=\"tabular-nums\">{formatAgentVoiceCallDuration(durationInSeconds)}</span>\n );\n },\n },\n {\n id: \"bookedSeconds\",\n header: t(\"Booked seconds\", { context: \"agent-voice-call\" }),\n width: \"content\",\n align: \"end\",\n cell: (call) => <span className=\"tabular-nums\">{formatUiNumber(call.bookedSeconds ?? 0)}</span>,\n },\n {\n id: \"costs\",\n header: t(\"Costs\", { context: \"agent-voice-call\" }),\n width: \"content\",\n align: \"end\",\n cell: (call) => {\n const bookedCosts = derivedValuesByCallId.get(call.id)?.bookedCosts;\n return bookedCosts ? <span className=\"tabular-nums\">{formatAgentVoiceAdminCallCosts(bookedCosts)}</span> : <EmptyValue />;\n },\n },\n {\n id: \"task\",\n header: t(\"Task\", { context: \"agent-voice-call\" }),\n width: \"2fr\",\n cell: (call) =>\n call.callTask ? (\n <span className=\"block truncate\" title={call.callTask}>\n {call.callTask}\n </span>\n ) : (\n <EmptyValue />\n ),\n },\n {\n id: \"conversation\",\n header: t(\"Conversation\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => {\n if (!call.aiConversationId) return <EmptyValue />;\n const conversationHref = buildConversationHref?.(call.aiConversationId) ?? null;\n return (\n <span data-row-action-ignore>\n <AgentVoiceCallConversationLink\n conversationId={call.aiConversationId}\n href={conversationHref}\n linkComponent={linkComponent}\n />\n </span>\n );\n },\n },\n ];\n\n const endReasonOptions = AGENT_VOICE_CALL_END_REASONS.map((endReason) => ({\n value: endReason,\n label: t(AGENT_VOICE_CALL_END_REASON[endReason].label, { context: AGENT_VOICE_CALL_END_REASON[endReason].context }),\n }));\n\n return (\n <div className=\"space-y-6\" data-testid=\"agent-voice-calls-screen\">\n <PageHeader\n title={title ?? t(\"Voice calls\")}\n description={\n description ??\n t(\"The voice chats the owners started with the agent and the calls the agent rang them with, newest first.\")\n }\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid=\"agent-voice-calls-refresh\"\n onClick={() => void listQuery.refetch?.()}\n disabled={listQuery.isFetching}\n >\n <RefreshCw className={cn(listQuery.isFetching && \"animate-spin\")} />\n {t(\"Refresh\")}\n </Button>\n </div>\n }\n />\n {isVoiceSwitchedOff ? (\n <div data-testid=\"agent-voice-calls-switched-off\">\n <StatusCallout\n tone=\"info\"\n title={t(\"Voice is switched off\")}\n description={t(\"The voice channel is switched off in this application, so its calls are not listed.\")}\n />\n </div>\n ) : (\n <>\n <EntityListCard\n label={m(\"Voice calls\")}\n isRefetching={listQuery.isFetching && !listQuery.isLoading}\n toolbar={\n <EntityListToolbar\n activeFilterCount={activeFilterCount}\n onClearFilters={clearFilters}\n filters={\n <FilterPanel>\n {isAccountFilterShown && (\n <FilterText\n label={t(\"Account\", { context: \"agent-voice-call-filter\" })}\n placeholder={t(\"Account ID\", { context: \"agent-voice-call-filter\" })}\n inputMode=\"numeric\"\n value={filterValues.accountIdText}\n onChange={(accountIdText) => changeFilterValues({ accountIdText: digitsOf(accountIdText) })}\n />\n )}\n <FilterDateRange\n label={t(\"Created\", { context: \"agent-voice-call-filter\" })}\n from={filterValues.createdFromDay}\n to={filterValues.createdToDay}\n onFromChange={(createdFromDay) => changeFilterValues({ createdFromDay })}\n onToChange={(createdToDay) => changeFilterValues({ createdToDay })}\n />\n <FilterText\n label={t(\"Booked seconds, at least\", { context: \"agent-voice-call-filter\" })}\n placeholder={t(\"Seconds\", { context: \"agent-voice-call-filter\" })}\n inputMode=\"numeric\"\n value={filterValues.bookedSecondsFromText}\n onChange={(bookedSecondsFromText) =>\n changeFilterValues({ bookedSecondsFromText: digitsOf(bookedSecondsFromText) })\n }\n />\n <FilterSelect\n label={t(\"End reason\", { context: \"agent-voice-call-filter\" })}\n allLabel={t(\"All\", { context: \"agent-voice-call-filter\" })}\n options={endReasonOptions}\n value={filterValues.endReason}\n onChange={(endReason) => changeFilterValues({ endReason })}\n />\n </FilterPanel>\n }\n />\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={calls}\n getRowKey={(call) => String(call.id)}\n rowAction={onOpenCall ? (call) => () => onOpenCall(call.id) : undefined}\n isLoading={listQuery.isLoading}\n emptyMessage={t(\"No voice call yet: a call starts when an owner opens a voice chat or the agent rings.\")}\n noResultsMessage={t(\"No voice call matches these filters.\")}\n isSearchActive={activeFilterCount > 0}\n onClearSearch={clearFilters}\n loadingMessage={t(\"Loading the voice calls\")}\n error={\n listQuery.isError\n ? normalizeDddError(listQuery.error, t(\"The voice calls could not be loaded.\")).message\n : undefined\n }\n />\n </EntityListCard>\n {(offset > 0 || hasOlderCalls) && (\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"agent-voice-calls-newer\"\n disabled={offset === 0 || listQuery.isFetching}\n onClick={() => setOffset(Math.max(0, offset - callsPerPage))}\n >\n <ChevronLeft />\n {t(\"Newer\", { context: \"agent-voice-pagination\" })}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"agent-voice-calls-older\"\n disabled={!hasOlderCalls || listQuery.isFetching}\n onClick={() => setOffset(offset + callsPerPage)}\n >\n {t(\"Older\", { context: \"agent-voice-pagination\" })}\n <ChevronRight />\n </Button>\n </div>\n )}\n </>\n )}\n </div>\n );\n};\n","import { normalizeDddError } from \"@mgamadeus/ddd-web/contract\";\nimport { MessagesSquare, RefreshCw } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { formatUiNumber, useTranslate } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { DateCell } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { StatusBadge } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { DefinitionList } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { PageHeader } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { StatusCallout } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { Button } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { Card, CardContent } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { cn } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { Skeleton } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { type PageLinkComponent, useLinkComponent } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { formatAgentVoiceCallDuration } from \"../../call/format-agent-voice-call-duration\";\nimport type { AgentVoiceAdminApi } from \"../agent-voice-admin-api\";\nimport { AgentVoiceCallConversationLink } from \"../AgentVoiceCallConversationLink/AgentVoiceCallConversationLink\";\nimport { AgentVoiceCallStateBadges } from \"../AgentVoiceCallStateBadges/AgentVoiceCallStateBadges\";\nimport {\n AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND,\n AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE,\n AGENT_VOICE_CALL_DIRECTION,\n formatAgentVoiceAdminCallCosts,\n isAgentVoiceAdminError,\n} from \"../agent-voice-admin-format\";\nimport type { AgentVoiceAdminCallDirection } from \"../agent-voice-admin-types\";\n\nexport interface AgentVoiceCallDetailScreenProps {\n /** `createAgentVoiceAdminApi(…)` of the host. */\n api: AgentVoiceAdminApi;\n callId: number;\n /** A link back (the list), drawn left of the title. */\n backLink?: ReactNode;\n headerActions?: ReactNode;\n /**\n * The link of a conversation in the host's agent screens; `null` = no link. With it the screen offers to open the\n * call's conversation, whose messages are what was said in the call.\n */\n buildConversationHref?: (conversationId: number) => string | null;\n /** The host's router link for the conversation links; default `AdminUiProvider.linkComponent`, else a plain `<a>`. */\n linkComponent?: PageLinkComponent;\n}\n\n/**\n * One voice call: where it stands (the server's reading at answer time) and why it ended, who started it, its account,\n * its conversation, its times (created, answered, ended, the ring deadline), its duration, the booked seconds and\n * their costs, the provider it ran on and its task. The call's conversation opens through the host's link\n * (`buildConversationHref`): nothing of what was said is in this screen. While voice is switched off the screen says\n * so; a call the signed-in account may not read reads as not found. The task is written by the agent or the owner and\n * shown as text only.\n */\nexport const AgentVoiceCallDetailScreen = ({\n api,\n callId,\n backLink,\n headerActions,\n buildConversationHref,\n linkComponent,\n}: AgentVoiceCallDetailScreenProps) => {\n const { t } = useTranslate();\n const Link = useLinkComponent(linkComponent);\n const callQuery = api.useAgentVoiceCallQuery({ callId });\n const callResponse = callQuery.data;\n const call = callResponse?.agentVoiceCall;\n\n if (callQuery.isLoading) {\n return (\n <div className=\"space-y-4\">\n <Skeleton className=\"h-12 w-80\" />\n <Skeleton className=\"h-32 w-full rounded-2xl\" />\n </div>\n );\n }\n if (callQuery.isError && isAgentVoiceAdminError(callQuery.error, AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE)) {\n return (\n <div className=\"space-y-4\" data-testid=\"agent-voice-call-switched-off\">\n <PageHeader title={`#${callId}`} leading={backLink} />\n <StatusCallout\n tone=\"info\"\n title={t(\"Voice is switched off\")}\n description={t(\"The voice channel is switched off in this application, so its calls cannot be read.\")}\n />\n </div>\n );\n }\n if (!callResponse || !call) {\n const isCallNotFound = !callQuery.isError || isAgentVoiceAdminError(callQuery.error, AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND);\n return (\n <div className=\"space-y-4\" data-testid=\"agent-voice-call-not-shown\">\n <PageHeader title={`#${callId}`} leading={backLink} />\n {isCallNotFound ? (\n <StatusCallout\n tone=\"destructive\"\n title={t(\"This voice call was not found.\")}\n description={t(\"It does not exist, or it belongs to an account you may not read.\")}\n />\n ) : (\n <StatusCallout\n tone=\"destructive\"\n title={t(\"The voice call could not be loaded.\")}\n description={normalizeDddError(callQuery.error, \"\").message}\n />\n )}\n </div>\n );\n }\n\n const conversationId = callResponse.conversationId ?? call.aiConversationId ?? null;\n const conversationHref = conversationId ? (buildConversationHref?.(conversationId) ?? null) : null;\n const startedByAgentInConversationHref = call.startedByAgentInConversationId\n ? (buildConversationHref?.(call.startedByAgentInConversationId) ?? null)\n : null;\n const bookedSeconds = callResponse.bookedSeconds ?? call.bookedSeconds ?? 0;\n const bookedCosts = callResponse.bookedCosts ?? null;\n const durationInSeconds = callResponse.durationInSeconds ?? null;\n\n return (\n <div className=\"space-y-6\" data-testid=\"agent-voice-call-detail-screen\">\n <PageHeader\n leading={backLink}\n title={t(\"Voice call\")}\n description={<span className=\"font-mono text-xs\">#{call.id}</span>}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid=\"agent-voice-call-refresh\"\n onClick={() => void callQuery.refetch?.()}\n disabled={callQuery.isFetching}\n >\n <RefreshCw className={cn(callQuery.isFetching && \"animate-spin\")} />\n {t(\"Refresh\")}\n </Button>\n {conversationHref && (\n <Button asChild variant=\"outline\" data-testid=\"agent-voice-call-open-conversation\">\n <Link href={conversationHref}>\n <MessagesSquare />\n {t(\"Open the conversation\", { context: \"agent-voice-call\" })}\n </Link>\n </Button>\n )}\n </div>\n }\n />\n <Card>\n <CardContent className=\"pt-6\">\n <DefinitionList\n items={[\n {\n id: \"state\",\n label: t(\"State\", { context: \"agent-voice-call\" }),\n value: (\n <AgentVoiceCallStateBadges\n callState={callResponse.callState}\n endReason={callResponse.endReason ?? call.endReason}\n />\n ),\n },\n {\n id: \"direction\",\n label: t(\"Started by\", { context: \"agent-voice-call\" }),\n value: <StatusBadge value={call.direction as AgentVoiceAdminCallDirection} map={AGENT_VOICE_CALL_DIRECTION} />,\n },\n {\n id: \"account\",\n label: t(\"Account\", { context: \"agent-voice-call\" }),\n value: call.accountId ? <span className=\"font-mono text-xs\">#{call.accountId}</span> : null,\n },\n {\n id: \"conversation\",\n label: t(\"Conversation\", { context: \"agent-voice-call\" }),\n value: conversationId ? (\n <AgentVoiceCallConversationLink\n conversationId={conversationId}\n href={conversationHref}\n linkComponent={linkComponent}\n />\n ) : null,\n hint: conversationId ? t(\"Its messages are what was said in the call.\") : undefined,\n },\n {\n id: \"startedByAgentInConversation\",\n label: t(\"Started by the agent in conversation\", { context: \"agent-voice-call\" }),\n value: call.startedByAgentInConversationId ? (\n <AgentVoiceCallConversationLink\n conversationId={call.startedByAgentInConversationId}\n href={startedByAgentInConversationHref}\n linkComponent={linkComponent}\n />\n ) : null,\n },\n {\n id: \"created\",\n label: t(\"Created\", { context: \"agent-voice-call\" }),\n value: call.changeHistory?.createdTime ? <DateCell value={call.changeHistory.createdTime} /> : null,\n },\n {\n id: \"answered\",\n label: t(\"Answered\", { context: \"agent-voice-call\" }),\n value: call.startedAt ? <DateCell value={call.startedAt} /> : null,\n },\n {\n id: \"ended\",\n label: t(\"Ended\", { context: \"agent-voice-call\" }),\n value: call.endedAt ? <DateCell value={call.endedAt} /> : null,\n },\n {\n id: \"ringDeadline\",\n label: t(\"Rings until\", { context: \"agent-voice-call\" }),\n value: call.ringDeadlineAt ? <DateCell value={call.ringDeadlineAt} /> : null,\n },\n {\n id: \"duration\",\n label: t(\"Duration\", { context: \"agent-voice-call\" }),\n value:\n durationInSeconds === null ? null : (\n <span className=\"tabular-nums\">{formatAgentVoiceCallDuration(durationInSeconds)}</span>\n ),\n },\n {\n id: \"bookedSeconds\",\n label: t(\"Booked seconds\", { context: \"agent-voice-call\" }),\n value: <span className=\"tabular-nums\">{formatUiNumber(bookedSeconds)}</span>,\n },\n {\n id: \"costs\",\n label: t(\"Costs\", { context: \"agent-voice-call\" }),\n value: bookedCosts ? <span className=\"tabular-nums\">{formatAgentVoiceAdminCallCosts(bookedCosts)}</span> : null,\n hint: !bookedCosts && bookedSeconds > 0 ? t(\"No price is known for the model this call ran on.\") : undefined,\n },\n {\n id: \"voiceProvider\",\n label: t(\"Voice provider\", { context: \"agent-voice-call\" }),\n value: call.voiceProvider ? <span className=\"font-mono text-xs\">{call.voiceProvider}</span> : null,\n },\n {\n id: \"providerCallId\",\n label: t(\"Provider call ID\", { context: \"agent-voice-call\" }),\n value: call.providerCallId ? <span className=\"break-all font-mono text-xs\">{call.providerCallId}</span> : null,\n },\n {\n id: \"task\",\n label: t(\"Task\", { context: \"agent-voice-call\" }),\n wide: true,\n value: call.callTask ? <p className=\"break-words whitespace-pre-wrap\">{call.callTask}</p> : null,\n },\n ]}\n />\n </CardContent>\n </Card>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBO,MAAM,wBAAwB;AAsB9B,MAAM,mCAAmC,CAAC,QAC/C;AAAA,EACE,IAAI,cAAc,UAAa,iBAAiB,aAAa,IAAI,WAAW,IAAI;AAAA,EAChF,IAAI,mBAAmB,UAAa,iBAAiB,oBAAoB,IAAI,gBAAgB,IAAI;AAAA,EACjG,IAAI,gBAAgB,UAAa,IAAI,gBAAgB,MAAM,iBAAiB,WAAW,IAAI,aAAa,IAAI;AAAA,EAC5G,IAAI,cAAc,UAAa,IAAI,cAAc,MAAM,iBAAiB,WAAW,IAAI,WAAW,IAAI;AAAA,EACtG,IAAI,sBAAsB,UAAa,iBAAiB,iBAAiB,IAAI,mBAAmB,IAAI;AAAA,EACpG,IAAI,oBAAoB,UAAa,iBAAiB,iBAAiB,IAAI,iBAAiB,IAAI;AAAA,EAChG,IAAI,cAAc,UAAa,IAAI,cAAc,MAAM,iBAAiB,aAAa,IAAI,WAAW,IAAI;AAC1G;AAGK,MAAM,+BAA+B,CAAC,cAAsB;AACjE,QAAM,SAAS,cAAc,SAAS;AACtC,SAAO;AAAA,IACL,OAAO,CAAC,MAA+B,QAAyB;AAAA,MAC9D,KAAK,GAAG,MAAM,SAAS,cAAc,EAAE,SAAS,iCAAiC,GAAG,GAAG,KAAK,IAAI,OAAO,MA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-admin.js","sources":["../src/voice/admin/agent-voice-admin-api.ts","../src/voice/admin/agent-voice-admin-format.ts","../src/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.tsx","../src/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.tsx","../src/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.tsx","../src/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.tsx","../src/voice/samples/agent-voice-sample-player.ts","../src/voice/samples/AgentVoiceSampleButton/AgentVoiceSampleButton.tsx"],"sourcesContent":["import {\n type ApiQueryHook,\n type InjectableBaseApi,\n type InjectedEndpointDefinition,\n type InjectedRequest,\n injectEndpointsOnce,\n type StaticQueryFailure,\n staticQueryHook,\n toQueryString,\n trimApiPrefix,\n} from \"@mgamadeus/ddd-admin-ui/logic/pure\";\nimport { buildFieldFilter, combineFilters } from \"@mgamadeus/ddd-web/query\";\nimport type {\n AgentVoiceAdminCallIdArg,\n AgentVoiceAdminCallResponse,\n AgentVoiceAdminCallsArg,\n AgentVoiceAdminCallsResponse,\n} from \"./agent-voice-admin-types\";\n\n/** The cache tag type of the call operations (ids `LIST`, `DETAIL`). */\nexport const AGENT_VOICE_CALLS_TAG = \"AdminUiAgentVoiceCalls\";\n\n/** The hooks `createAgentVoiceAdminApi` returns; the call screens take them as their `api`. */\nexport interface AgentVoiceAdminApi {\n /** `GET /calls?filters&top&skip`: the calls the signed-in account may read, newest first. */\n useAgentVoiceCallsQuery: ApiQueryHook<AgentVoiceAdminCallsArg, AgentVoiceAdminCallsResponse>;\n /** `GET /calls/{callId}`: one call (404 `call_not_found`: unknown or not readable). */\n useAgentVoiceCallQuery: ApiQueryHook<AgentVoiceAdminCallIdArg, AgentVoiceAdminCallResponse>;\n}\n\nexport interface CreateAgentVoiceAdminApiOptions {\n /** The host's RTK Query api (`createApi` with the React hooks module). */\n baseApi: InjectableBaseApi;\n /** Where the host mounts `AdminAgentVoiceCallsTrait`, without a trailing slash (`/api/admin/ai/voiceCalls`). */\n apiPrefix: string;\n}\n\n/**\n * The filter expression of the list's arguments, in the query options grammar of the route (`accountId eq '12' and\n * bookedSeconds ge '60'`); undefined when nothing narrows. The date range filters the moment a call was created, so a\n * call nobody answered is found too. Which accounts' calls are read at all is decided on the server.\n */\nexport const buildAgentVoiceAdminCallsFilters = (arg: AgentVoiceAdminCallsArg): string | undefined =>\n combineFilters(\n arg.accountId !== undefined && buildFieldFilter(\"accountId\", arg.accountId, \"eq\"),\n arg.conversationId !== undefined && buildFieldFilter(\"aiConversationId\", arg.conversationId, \"eq\"),\n arg.createdFrom !== undefined && arg.createdFrom !== \"\" && buildFieldFilter(\"created\", arg.createdFrom, \"ge\"),\n arg.createdTo !== undefined && arg.createdTo !== \"\" && buildFieldFilter(\"created\", arg.createdTo, \"le\"),\n arg.bookedSecondsFrom !== undefined && buildFieldFilter(\"bookedSeconds\", arg.bookedSecondsFrom, \"ge\"),\n arg.bookedSecondsTo !== undefined && buildFieldFilter(\"bookedSeconds\", arg.bookedSecondsTo, \"le\"),\n arg.endReason !== undefined && arg.endReason !== \"\" && buildFieldFilter(\"endReason\", arg.endReason, \"eq\"),\n );\n\n/** The request of every operation, on `apiPrefix`. Pure: no RTK runtime. */\nexport const buildAgentVoiceAdminRequests = (apiPrefix: string) => {\n const prefix = trimApiPrefix(apiPrefix);\n return {\n calls: (arg: AgentVoiceAdminCallsArg = {}): InjectedRequest => ({\n url: `${prefix}/calls${toQueryString({ filters: buildAgentVoiceAdminCallsFilters(arg), top: arg.limit, skip: arg.offset })}`,\n }),\n call: ({ callId }: AgentVoiceAdminCallIdArg): InjectedRequest => ({\n url: `${prefix}/calls/${encodeURIComponent(String(callId))}`,\n }),\n };\n};\n\nconst LIST = { type: AGENT_VOICE_CALLS_TAG, id: \"LIST\" } as const;\nconst DETAIL = { type: AGENT_VOICE_CALLS_TAG, id: \"DETAIL\" } as const;\n\n/** The operations as injected. */\nexport const agentVoiceAdminEndpointDefinitions = (apiPrefix: string) => {\n const requests = buildAgentVoiceAdminRequests(apiPrefix);\n return {\n adminUiAgentVoiceCalls: { kind: \"query\", request: requests.calls, providesTags: [LIST] },\n adminUiAgentVoiceCall: { kind: \"query\", request: requests.call, providesTags: [DETAIL] },\n } as const satisfies Record<string, InjectedEndpointDefinition<never>>;\n};\n\n/**\n * Injects the call operations into the host's RTK Query api and returns their hooks. Call it once at module scope:\n * `export const agentVoiceAdminApi = createAgentVoiceAdminApi({ baseApi: adminApi, apiPrefix: \"/api/admin/ai/voiceCalls\" });`\n */\nexport const createAgentVoiceAdminApi = ({ baseApi, apiPrefix }: CreateAgentVoiceAdminApiOptions): AgentVoiceAdminApi =>\n injectEndpointsOnce(\n baseApi,\n `agentVoiceCalls:${trimApiPrefix(apiPrefix)}`,\n [AGENT_VOICE_CALLS_TAG],\n agentVoiceAdminEndpointDefinitions(apiPrefix),\n (hookOf) => ({\n useAgentVoiceCallsQuery: hookOf(\"adminUiAgentVoiceCalls\") as AgentVoiceAdminApi[\"useAgentVoiceCallsQuery\"],\n useAgentVoiceCallQuery: hookOf(\"adminUiAgentVoiceCall\") as AgentVoiceAdminApi[\"useAgentVoiceCallQuery\"],\n }),\n );\n\n/** Fixed answers of a `createStaticAgentVoiceAdminApi`; a query without one stays loading. */\nexport interface StaticAgentVoiceAdminData {\n calls?: (arg: AgentVoiceAdminCallsArg) => AgentVoiceAdminCallsResponse | StaticQueryFailure | undefined;\n call?: (arg: AgentVoiceAdminCallIdArg) => AgentVoiceAdminCallResponse | StaticQueryFailure | undefined;\n}\n\n/** An `AgentVoiceAdminApi` answering fixed payloads, without a store or a request (showcases, tests, reviews). */\nexport const createStaticAgentVoiceAdminApi = (data: StaticAgentVoiceAdminData): AgentVoiceAdminApi => ({\n useAgentVoiceCallsQuery: staticQueryHook((arg) => data.calls?.(arg ?? {})),\n useAgentVoiceCallQuery: staticQueryHook((arg) => data.call?.(arg)),\n});\n","// Labels, states and small helpers of the call screens. Pure: no React.\nimport { normalizeDddError } from \"@mgamadeus/ddd-web/contract\";\nimport {\n AudioLines,\n Ban,\n BellOff,\n BellRing,\n Bot,\n CircleCheck,\n CircleStop,\n CircleX,\n Gauge,\n TimerOff,\n Undo2,\n UserRound,\n} from \"lucide-react\";\n\nimport { formatUiNumber, m } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { defineStatusMap } from \"@mgamadeus/ddd-admin-ui/logic\";\nimport type {\n AgentVoiceAdminCall,\n AgentVoiceAdminCallDerivedValues,\n AgentVoiceAdminCallDirection,\n AgentVoiceAdminCallEndReason,\n AgentVoiceAdminCallState,\n AgentVoiceAdminElements,\n AgentVoiceAdminMoneyAmount,\n} from \"./agent-voice-admin-types\";\n\n/** Where a call stands, as the server read it (`callState` of the answers). */\nexport const AGENT_VOICE_CALL_STATE = defineStatusMap<AgentVoiceAdminCallState>(\n {\n RINGING: {\n label: m(\"Ringing\", { context: \"agent-voice-call-state\" }),\n tone: \"warning\",\n icon: BellRing,\n description: m(\"Nobody has answered yet\", { context: \"agent-voice-call-state\" }),\n },\n IN_PROGRESS: {\n label: m(\"Running\", { context: \"agent-voice-call-state\" }),\n tone: \"success\",\n icon: AudioLines,\n description: m(\"The call was answered and is going on\", { context: \"agent-voice-call-state\" }),\n },\n ENDED: {\n label: m(\"Ended\", { context: \"agent-voice-call-state\" }),\n tone: \"neutral\",\n icon: CircleStop,\n description: m(\"The call is over\", { context: \"agent-voice-call-state\" }),\n },\n },\n { context: \"agent-voice-call-state\" },\n);\n\n/** `AgentVoiceCall.endReason`: the reasons the call writes itself. A diagnostic value shows as it came. */\nexport const AGENT_VOICE_CALL_END_REASON = defineStatusMap<AgentVoiceAdminCallEndReason>(\n {\n COMPLETED: {\n label: m(\"Completed\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"success\",\n icon: CircleCheck,\n description: m(\"Both sides hung up normally\", { context: \"agent-voice-call-end-reason\" }),\n },\n ENDED_BY_AGENT: {\n label: m(\"Ended by the agent\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"info\",\n icon: Bot,\n description: m(\"The agent hung up the running call or withdrew its ring\", { context: \"agent-voice-call-end-reason\" }),\n },\n LIMIT_REACHED: {\n label: m(\"Limit reached\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"warning\",\n icon: Gauge,\n description: m(\"The call ran into its time, daily or budget limit\", { context: \"agent-voice-call-end-reason\" }),\n },\n FAILED: {\n label: m(\"Failed\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"danger\",\n icon: CircleX,\n description: m(\"The session ended on an error of the provider, the model or the worker\", {\n context: \"agent-voice-call-end-reason\",\n }),\n },\n NOT_ANSWERED: {\n label: m(\"Not answered\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: BellOff,\n description: m(\"Nobody picked up\", { context: \"agent-voice-call-end-reason\" }),\n },\n DECLINED: {\n label: m(\"Declined\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: Ban,\n description: m(\"Every client the call rang on declined it\", { context: \"agent-voice-call-end-reason\" }),\n },\n EXPIRED: {\n label: m(\"Expired\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: TimerOff,\n description: m(\"Nobody answered before the ringing stopped\", { context: \"agent-voice-call-end-reason\" }),\n },\n CANCELED: {\n label: m(\"Canceled\", { context: \"agent-voice-call-end-reason\" }),\n tone: \"neutral\",\n icon: Undo2,\n description: m(\"The side that started the call withdrew it before anyone answered\", {\n context: \"agent-voice-call-end-reason\",\n }),\n },\n },\n { context: \"agent-voice-call-end-reason\" },\n);\n\n/** The end reasons a list can be filtered by, in the order the filter offers them. */\nexport const AGENT_VOICE_CALL_END_REASONS = [\n \"COMPLETED\",\n \"ENDED_BY_AGENT\",\n \"LIMIT_REACHED\",\n \"FAILED\",\n \"NOT_ANSWERED\",\n \"DECLINED\",\n \"EXPIRED\",\n \"CANCELED\",\n] as const satisfies readonly AgentVoiceAdminCallEndReason[];\n\n/** `AgentVoiceCall.direction`: who started the call. */\nexport const AGENT_VOICE_CALL_DIRECTION = defineStatusMap<AgentVoiceAdminCallDirection>(\n {\n INBOUND: {\n label: m(\"The owner called\", { context: \"agent-voice-call-direction\" }),\n tone: \"neutral\",\n icon: UserRound,\n description: m(\"The owner started a voice chat with the agent\", { context: \"agent-voice-call-direction\" }),\n },\n OUTBOUND: {\n label: m(\"The agent rang\", { context: \"agent-voice-call-direction\" }),\n tone: \"neutral\",\n icon: Bot,\n description: m(\"The agent rang the owner’s open clients\", { context: \"agent-voice-call-direction\" }),\n },\n },\n { context: \"agent-voice-call-direction\" },\n);\n\n/**\n * A backend date-time (`Y-m-d H:i:s`) as milliseconds on one clock, for the difference of two of them only: both are\n * read in the same zone, so the zone the backend writes them in does not matter. Null when it is none.\n */\nconst momentOf = (dateTime: string | null | undefined): number | null => {\n if (!dateTime) return null;\n const moment = Date.parse(`${dateTime.trim().replace(\" \", \"T\")}Z`);\n return Number.isNaN(moment) ? null : moment;\n};\n\n/**\n * When a call began: the moment it was created (the owner opened the voice chat, or the ring started) where the\n * answer carries it, else the moment it was answered; null for a call nobody answered whose creation is not sent.\n */\nexport const agentVoiceAdminCallStartTimeOf = (call: Pick<AgentVoiceAdminCall, \"startedAt\" | \"changeHistory\">): string | null =>\n call.changeHistory?.createdTime ?? call.startedAt ?? null;\n\n/** How long a call lasted, from the moment it was answered to its end; null while it runs or when nobody answered. */\nexport const agentVoiceAdminCallDurationInSecondsOf = (\n call: Pick<AgentVoiceAdminCall, \"startedAt\" | \"endedAt\">,\n): number | null => {\n const startedAt = momentOf(call.startedAt);\n const endedAt = momentOf(call.endedAt);\n if (startedAt === null || endedAt === null) return null;\n return Math.max(0, Math.round((endedAt - startedAt) / 1000));\n};\n\n/**\n * What the server derived for the list's calls (the state, the costs), by call id: reads the set the list answer\n * carries (`AgentVoiceAdminCallsResponse.agentVoiceCallDerivedValues`). A call the answer names no entry for has none\n * here: its row then shows no state and no costs.\n */\nexport const agentVoiceAdminCallDerivedValuesByCallIdOf = (\n agentVoiceCallDerivedValues: AgentVoiceAdminElements<AgentVoiceAdminCallDerivedValues> | null | undefined,\n): ReadonlyMap<number, AgentVoiceAdminCallDerivedValues> => {\n const derivedValuesByCallId = new Map<number, AgentVoiceAdminCallDerivedValues>();\n for (const derivedValuesOfCall of agentVoiceCallDerivedValues?.elements ?? [])\n derivedValuesByCallId.set(derivedValuesOfCall.callId, derivedValuesOfCall);\n return derivedValuesByCallId;\n};\n\n/** The fraction digits a call's costs are rounded to: a call costs cents, two digits would show most calls alike. */\nconst CALL_COSTS_FRACTION_DIGITS = { minimumFractionDigits: 2, maximumFractionDigits: 4 } as const;\n\n/** A call's costs, rounded, in the UI language. Call it at render time, so a language switch formats anew. */\nexport const formatAgentVoiceAdminCallCosts = (bookedCosts: AgentVoiceAdminMoneyAmount): string => {\n try {\n return formatUiNumber(bookedCosts.amount, {\n style: \"currency\",\n currency: bookedCosts.currency.isoCode,\n ...CALL_COSTS_FRACTION_DIGITS,\n });\n } catch {\n // A currency code the browser's number format does not know: the rounded number beside the code as it came.\n return `${formatUiNumber(bookedCosts.amount, CALL_COSTS_FRACTION_DIGITS)} ${bookedCosts.currency.isoCode}`;\n }\n};\n\nconst DAY_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** A moment as the routes' filters read it: `Y-m-d H:i:s` in UTC. */\nconst toUtcDateTime = (moment: Date): string => moment.toISOString().slice(0, 19).replace(\"T\", \" \");\n\n/**\n * The viewer's calendar day `YYYY-MM-DD` as a moment in UTC: its first second, or with `isEndOfDay` its last.\n * Undefined for an empty value or a day the calendar lacks.\n */\nexport const toAgentVoiceAdminDayBound = (day: string, isEndOfDay: boolean): string | undefined => {\n const dayParts = DAY_PATTERN.exec(day.trim());\n if (!dayParts) return undefined;\n const [year, month, dayOfMonth] = [Number(dayParts[1]), Number(dayParts[2]), Number(dayParts[3])];\n const moment = isEndOfDay ? new Date(year, month - 1, dayOfMonth, 23, 59, 59) : new Date(year, month - 1, dayOfMonth, 0, 0, 0);\n if (moment.getFullYear() !== year || moment.getMonth() !== month - 1 || moment.getDate() !== dayOfMonth) return undefined;\n return toUtcDateTime(moment);\n};\n\n/** A whole, non-negative number typed into a filter (an account id, seconds); undefined for anything else. */\nexport const readAgentVoiceAdminWholeNumber = (text: string): number | undefined => {\n const trimmedText = text.trim();\n return /^\\d{1,15}$/.test(trimmedText) ? Number(trimmedText) : undefined;\n};\n\n/** The error codes of the call routes a screen shows as a state of its own. */\nexport const AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE = \"feature_not_available\";\nexport const AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND = \"call_not_found\";\n\n/**\n * Whether a failed request was refused with `errorCode`. The routes answer the code as the error message; a base\n * query that translates error bodies keeps the original beside it (`errorEnglish`).\n */\nexport const isAgentVoiceAdminError = (error: unknown, errorCode: string): boolean => {\n if (error === undefined || error === null) return false;\n const normalizedError = normalizeDddError(error);\n const errorBody =\n typeof normalizedError.body === \"object\" && normalizedError.body !== null\n ? (normalizedError.body as { error?: unknown; errorEnglish?: unknown })\n : {};\n return [errorBody.errorEnglish, errorBody.error, normalizedError.message].includes(errorCode);\n};\n","import { type PageLinkComponent, useLinkComponent } from \"@mgamadeus/ddd-admin-ui/primitives\";\n\nexport interface AgentVoiceCallConversationLinkProps {\n conversationId: number;\n /** The host's link of the conversation; `null` = the id as text. */\n href: string | null;\n /** The host's router link; default the one of `AdminUiProvider.linkComponent`, else a plain `<a>` (full page load). */\n linkComponent?: PageLinkComponent;\n}\n\n/** `#<conversationId>` as the host's router link (no full page load inside the admin app), or as text without a link. */\nexport const AgentVoiceCallConversationLink = ({ conversationId, href, linkComponent }: AgentVoiceCallConversationLinkProps) => {\n const Link = useLinkComponent(linkComponent);\n if (!href) return <span className=\"font-mono text-xs\">#{conversationId}</span>;\n return (\n <Link href={href} className=\"font-mono text-xs underline-offset-2 hover:underline\">\n #{conversationId}\n </Link>\n );\n};\n","import { StatusBadge } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { AGENT_VOICE_CALL_END_REASON, AGENT_VOICE_CALL_STATE } from \"../agent-voice-admin-format\";\nimport type { AgentVoiceAdminCallEndReason, AgentVoiceAdminCallState } from \"../agent-voice-admin-types\";\n\nexport interface AgentVoiceCallStateBadgesProps {\n /** The server's reading of where the call stands (`callState` of the answer); without one the empty marker shows. */\n callState: AgentVoiceAdminCallState | null | undefined;\n /** Why the call ended (`endReason` of the call), once it has a reason. */\n endReason: string | null | undefined;\n}\n\n/**\n * Where a call stands (ringing, running, ended), as the server read it, and, once it has one, why it ended. An end\n * reason outside the known ones (a diagnostic value of a teardown path) shows as the text it came as.\n */\nexport const AgentVoiceCallStateBadges = ({ callState, endReason }: AgentVoiceCallStateBadgesProps) => (\n <span className=\"flex flex-wrap items-center gap-1.5\">\n <StatusBadge value={callState} map={AGENT_VOICE_CALL_STATE} />\n {endReason ? <StatusBadge value={endReason as AgentVoiceAdminCallEndReason} map={AGENT_VOICE_CALL_END_REASON} /> : null}\n </span>\n);\n","import { normalizeDddError } from \"@mgamadeus/ddd-web/contract\";\nimport { ChevronLeft, ChevronRight, RefreshCw } from \"lucide-react\";\nimport { type ReactNode, useState } from \"react\";\n\nimport { formatUiNumber, m, useTranslate } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { DateCell } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EmptyValue } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EntityListBody } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EntityListCard } from \"@mgamadeus/ddd-admin-ui/list\";\nimport type { EntityListColumn } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { EntityListToolbar } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { FilterDateRange, FilterPanel, FilterSelect, FilterText } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { StatusBadge } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { useDebouncedValue } from \"@mgamadeus/ddd-admin-ui/logic\";\nimport { PageHeader } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { StatusCallout } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { Button } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { cn } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport type { PageLinkComponent } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { formatAgentVoiceCallDuration } from \"../../call/format-agent-voice-call-duration\";\nimport type { AgentVoiceAdminApi } from \"../agent-voice-admin-api\";\nimport { AgentVoiceCallConversationLink } from \"../AgentVoiceCallConversationLink/AgentVoiceCallConversationLink\";\nimport { AgentVoiceCallStateBadges } from \"../AgentVoiceCallStateBadges/AgentVoiceCallStateBadges\";\nimport {\n AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE,\n AGENT_VOICE_CALL_DIRECTION,\n AGENT_VOICE_CALL_END_REASON,\n AGENT_VOICE_CALL_END_REASONS,\n agentVoiceAdminCallDerivedValuesByCallIdOf,\n agentVoiceAdminCallDurationInSecondsOf,\n agentVoiceAdminCallStartTimeOf,\n formatAgentVoiceAdminCallCosts,\n isAgentVoiceAdminError,\n readAgentVoiceAdminWholeNumber,\n toAgentVoiceAdminDayBound,\n} from \"../agent-voice-admin-format\";\nimport type { AgentVoiceAdminCall, AgentVoiceAdminCallDirection } from \"../agent-voice-admin-types\";\n\nexport interface AgentVoiceCallsScreenProps {\n /** `createAgentVoiceAdminApi(…)` of the host. */\n api: AgentVoiceAdminApi;\n /** Default \"Voice calls\". */\n title?: ReactNode;\n description?: ReactNode;\n headerActions?: ReactNode;\n /** Opens a call's details (the host's route, e.g. `router.push(…)`). */\n onOpenCall?: (callId: number) => void;\n /** Only the calls of this account (e.g. from the URL); the account filter is then left out. */\n accountId?: number;\n /** Only the calls that ran on this conversation. */\n conversationId?: number;\n /** The link of a conversation in the host's agent screens; `null` = no link. */\n buildConversationHref?: (conversationId: number) => string | null;\n /** The host's router link for the conversation link; default `AdminUiProvider.linkComponent`, else a plain `<a>`. */\n linkComponent?: PageLinkComponent;\n /** Calls per page (default 50, at most 200). */\n pageSize?: number;\n}\n\n/** The most calls one page shows. */\nexport const AGENT_VOICE_CALLS_MAX_PAGE_SIZE = 200;\n\n/** What the filter panel holds, as its fields hold it. */\ninterface AgentVoiceCallsFilterValues {\n /** Digits of an account id, or `\"\"`. */\n accountIdText: string;\n /** The first day of the created range, `YYYY-MM-DD` in the viewer's zone, or `\"\"`. */\n createdFromDay: string;\n /** The last day of the created range, `YYYY-MM-DD` in the viewer's zone, or `\"\"`. */\n createdToDay: string;\n /** Digits of the fewest booked seconds, or `\"\"`. */\n bookedSecondsFromText: string;\n /** An end reason, or `\"\"`. */\n endReason: string;\n}\n\nconst NO_FILTER_VALUES: AgentVoiceCallsFilterValues = {\n accountIdText: \"\",\n createdFromDay: \"\",\n createdToDay: \"\",\n bookedSecondsFromText: \"\",\n endReason: \"\",\n};\n\nconst digitsOf = (text: string): string => text.replace(/\\D/g, \"\");\n\n/**\n * The voice calls the signed-in account may read, newest first: when a call began, its account, who started it, where\n * it stands (the server's reading at answer time) and why it ended, its duration, the booked seconds, their costs, its\n * task and its conversation; filters for the account, the day it was created, the booked seconds and the end reason.\n * Needs the admin call routes mounted (`AdminAgentVoiceCallsTrait`). While voice is switched off the\n * screen says so instead of listing. A call's task is written by the agent or the owner and shown as text only.\n */\nexport const AgentVoiceCallsScreen = ({\n api,\n title,\n description,\n headerActions,\n onOpenCall,\n accountId,\n conversationId,\n buildConversationHref,\n linkComponent,\n pageSize = 50,\n}: AgentVoiceCallsScreenProps) => {\n const { t } = useTranslate();\n const [filterValues, setFilterValues] = useState(NO_FILTER_VALUES);\n const [offset, setOffset] = useState(0);\n const debouncedAccountIdText = useDebouncedValue(filterValues.accountIdText);\n const debouncedBookedSecondsFromText = useDebouncedValue(filterValues.bookedSecondsFromText);\n const callsPerPage = Math.min(Math.max(Math.floor(pageSize), 1), AGENT_VOICE_CALLS_MAX_PAGE_SIZE);\n const isAccountFilterShown = accountId === undefined;\n\n // The answer carries no total count: one call more than a page shows tells whether an older page exists.\n const listQuery = api.useAgentVoiceCallsQuery({\n accountId: accountId ?? readAgentVoiceAdminWholeNumber(debouncedAccountIdText),\n conversationId,\n createdFrom: toAgentVoiceAdminDayBound(filterValues.createdFromDay, false),\n createdTo: toAgentVoiceAdminDayBound(filterValues.createdToDay, true),\n bookedSecondsFrom: readAgentVoiceAdminWholeNumber(debouncedBookedSecondsFromText),\n endReason: filterValues.endReason === \"\" ? undefined : filterValues.endReason,\n limit: callsPerPage + 1,\n offset,\n });\n const loadedCalls = listQuery.data?.agentVoiceCalls?.elements ?? [];\n const calls = loadedCalls.slice(0, callsPerPage);\n const hasOlderCalls = loadedCalls.length > callsPerPage;\n const derivedValuesByCallId = agentVoiceAdminCallDerivedValuesByCallIdOf(listQuery.data?.agentVoiceCallDerivedValues);\n const isVoiceSwitchedOff =\n listQuery.isError && isAgentVoiceAdminError(listQuery.error, AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE);\n\n const changeFilterValues = (changedFilterValues: Partial<AgentVoiceCallsFilterValues>) => {\n setFilterValues((currentFilterValues) => ({ ...currentFilterValues, ...changedFilterValues }));\n setOffset(0);\n };\n const activeFilterCount = [\n isAccountFilterShown && filterValues.accountIdText !== \"\",\n filterValues.createdFromDay !== \"\" || filterValues.createdToDay !== \"\",\n filterValues.bookedSecondsFromText !== \"\",\n filterValues.endReason !== \"\",\n ].filter(Boolean).length;\n const clearFilters = () => changeFilterValues(NO_FILTER_VALUES);\n\n const columns: EntityListColumn<AgentVoiceAdminCall>[] = [\n {\n id: \"started\",\n header: t(\"Started\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => <DateCell value={agentVoiceAdminCallStartTimeOf(call)} />,\n },\n {\n id: \"account\",\n header: t(\"Account\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => (call.accountId ? <span className=\"font-mono text-xs\">#{call.accountId}</span> : <EmptyValue />),\n },\n {\n id: \"direction\",\n header: t(\"Started by\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => <StatusBadge value={call.direction as AgentVoiceAdminCallDirection} map={AGENT_VOICE_CALL_DIRECTION} />,\n },\n {\n id: \"state\",\n header: t(\"State\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => (\n <AgentVoiceCallStateBadges callState={derivedValuesByCallId.get(call.id)?.callState} endReason={call.endReason} />\n ),\n },\n {\n id: \"duration\",\n header: t(\"Duration\", { context: \"agent-voice-call\" }),\n width: \"content\",\n align: \"end\",\n cell: (call) => {\n const durationInSeconds = agentVoiceAdminCallDurationInSecondsOf(call);\n return durationInSeconds === null ? (\n <EmptyValue />\n ) : (\n <span className=\"tabular-nums\">{formatAgentVoiceCallDuration(durationInSeconds)}</span>\n );\n },\n },\n {\n id: \"bookedSeconds\",\n header: t(\"Booked seconds\", { context: \"agent-voice-call\" }),\n width: \"content\",\n align: \"end\",\n cell: (call) => <span className=\"tabular-nums\">{formatUiNumber(call.bookedSeconds ?? 0)}</span>,\n },\n {\n id: \"costs\",\n header: t(\"Costs\", { context: \"agent-voice-call\" }),\n width: \"content\",\n align: \"end\",\n cell: (call) => {\n const bookedCosts = derivedValuesByCallId.get(call.id)?.bookedCosts;\n return bookedCosts ? <span className=\"tabular-nums\">{formatAgentVoiceAdminCallCosts(bookedCosts)}</span> : <EmptyValue />;\n },\n },\n {\n id: \"task\",\n header: t(\"Task\", { context: \"agent-voice-call\" }),\n width: \"2fr\",\n cell: (call) =>\n call.callTask ? (\n <span className=\"block truncate\" title={call.callTask}>\n {call.callTask}\n </span>\n ) : (\n <EmptyValue />\n ),\n },\n {\n id: \"conversation\",\n header: t(\"Conversation\", { context: \"agent-voice-call\" }),\n width: \"content\",\n cell: (call) => {\n if (!call.aiConversationId) return <EmptyValue />;\n const conversationHref = buildConversationHref?.(call.aiConversationId) ?? null;\n return (\n <span data-row-action-ignore>\n <AgentVoiceCallConversationLink\n conversationId={call.aiConversationId}\n href={conversationHref}\n linkComponent={linkComponent}\n />\n </span>\n );\n },\n },\n ];\n\n const endReasonOptions = AGENT_VOICE_CALL_END_REASONS.map((endReason) => ({\n value: endReason,\n label: t(AGENT_VOICE_CALL_END_REASON[endReason].label, { context: AGENT_VOICE_CALL_END_REASON[endReason].context }),\n }));\n\n return (\n <div className=\"space-y-6\" data-testid=\"agent-voice-calls-screen\">\n <PageHeader\n title={title ?? t(\"Voice calls\")}\n description={\n description ??\n t(\"The voice chats the owners started with the agent and the calls the agent rang them with, newest first.\")\n }\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid=\"agent-voice-calls-refresh\"\n onClick={() => void listQuery.refetch?.()}\n disabled={listQuery.isFetching}\n >\n <RefreshCw className={cn(listQuery.isFetching && \"animate-spin\")} />\n {t(\"Refresh\")}\n </Button>\n </div>\n }\n />\n {isVoiceSwitchedOff ? (\n <div data-testid=\"agent-voice-calls-switched-off\">\n <StatusCallout\n tone=\"info\"\n title={t(\"Voice is switched off\")}\n description={t(\"The voice channel is switched off in this application, so its calls are not listed.\")}\n />\n </div>\n ) : (\n <>\n <EntityListCard\n label={m(\"Voice calls\")}\n isRefetching={listQuery.isFetching && !listQuery.isLoading}\n toolbar={\n <EntityListToolbar\n activeFilterCount={activeFilterCount}\n onClearFilters={clearFilters}\n filters={\n <FilterPanel>\n {isAccountFilterShown && (\n <FilterText\n label={t(\"Account\", { context: \"agent-voice-call-filter\" })}\n placeholder={t(\"Account ID\", { context: \"agent-voice-call-filter\" })}\n inputMode=\"numeric\"\n value={filterValues.accountIdText}\n onChange={(accountIdText) => changeFilterValues({ accountIdText: digitsOf(accountIdText) })}\n />\n )}\n <FilterDateRange\n label={t(\"Created\", { context: \"agent-voice-call-filter\" })}\n from={filterValues.createdFromDay}\n to={filterValues.createdToDay}\n onFromChange={(createdFromDay) => changeFilterValues({ createdFromDay })}\n onToChange={(createdToDay) => changeFilterValues({ createdToDay })}\n />\n <FilterText\n label={t(\"Booked seconds, at least\", { context: \"agent-voice-call-filter\" })}\n placeholder={t(\"Seconds\", { context: \"agent-voice-call-filter\" })}\n inputMode=\"numeric\"\n value={filterValues.bookedSecondsFromText}\n onChange={(bookedSecondsFromText) =>\n changeFilterValues({ bookedSecondsFromText: digitsOf(bookedSecondsFromText) })\n }\n />\n <FilterSelect\n label={t(\"End reason\", { context: \"agent-voice-call-filter\" })}\n allLabel={t(\"All\", { context: \"agent-voice-call-filter\" })}\n options={endReasonOptions}\n value={filterValues.endReason}\n onChange={(endReason) => changeFilterValues({ endReason })}\n />\n </FilterPanel>\n }\n />\n }\n >\n <EntityListBody\n displayMode=\"table\"\n columns={columns}\n items={calls}\n getRowKey={(call) => String(call.id)}\n rowAction={onOpenCall ? (call) => () => onOpenCall(call.id) : undefined}\n isLoading={listQuery.isLoading}\n emptyMessage={t(\"No voice call yet: a call starts when an owner opens a voice chat or the agent rings.\")}\n noResultsMessage={t(\"No voice call matches these filters.\")}\n isSearchActive={activeFilterCount > 0}\n onClearSearch={clearFilters}\n loadingMessage={t(\"Loading the voice calls\")}\n error={\n listQuery.isError\n ? normalizeDddError(listQuery.error, t(\"The voice calls could not be loaded.\")).message\n : undefined\n }\n />\n </EntityListCard>\n {(offset > 0 || hasOlderCalls) && (\n <div className=\"flex items-center justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"agent-voice-calls-newer\"\n disabled={offset === 0 || listQuery.isFetching}\n onClick={() => setOffset(Math.max(0, offset - callsPerPage))}\n >\n <ChevronLeft />\n {t(\"Newer\", { context: \"agent-voice-pagination\" })}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"agent-voice-calls-older\"\n disabled={!hasOlderCalls || listQuery.isFetching}\n onClick={() => setOffset(offset + callsPerPage)}\n >\n {t(\"Older\", { context: \"agent-voice-pagination\" })}\n <ChevronRight />\n </Button>\n </div>\n )}\n </>\n )}\n </div>\n );\n};\n","import { normalizeDddError } from \"@mgamadeus/ddd-web/contract\";\nimport { MessagesSquare, RefreshCw } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { formatUiNumber, useTranslate } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { DateCell } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { StatusBadge } from \"@mgamadeus/ddd-admin-ui/list\";\nimport { DefinitionList } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { PageHeader } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { StatusCallout } from \"@mgamadeus/ddd-admin-ui/page\";\nimport { Button } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { Card, CardContent } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { cn } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { Skeleton } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { type PageLinkComponent, useLinkComponent } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport { formatAgentVoiceCallDuration } from \"../../call/format-agent-voice-call-duration\";\nimport type { AgentVoiceAdminApi } from \"../agent-voice-admin-api\";\nimport { AgentVoiceCallConversationLink } from \"../AgentVoiceCallConversationLink/AgentVoiceCallConversationLink\";\nimport { AgentVoiceCallStateBadges } from \"../AgentVoiceCallStateBadges/AgentVoiceCallStateBadges\";\nimport {\n AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND,\n AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE,\n AGENT_VOICE_CALL_DIRECTION,\n formatAgentVoiceAdminCallCosts,\n isAgentVoiceAdminError,\n} from \"../agent-voice-admin-format\";\nimport type { AgentVoiceAdminCallDirection } from \"../agent-voice-admin-types\";\n\nexport interface AgentVoiceCallDetailScreenProps {\n /** `createAgentVoiceAdminApi(…)` of the host. */\n api: AgentVoiceAdminApi;\n callId: number;\n /** A link back (the list), drawn left of the title. */\n backLink?: ReactNode;\n headerActions?: ReactNode;\n /**\n * The link of a conversation in the host's agent screens; `null` = no link. With it the screen offers to open the\n * call's conversation, whose messages are what was said in the call.\n */\n buildConversationHref?: (conversationId: number) => string | null;\n /** The host's router link for the conversation links; default `AdminUiProvider.linkComponent`, else a plain `<a>`. */\n linkComponent?: PageLinkComponent;\n}\n\n/**\n * One voice call: where it stands (the server's reading at answer time) and why it ended, who started it, its account,\n * its conversation, its times (created, answered, ended, the ring deadline), its duration, the booked seconds and\n * their costs, the provider it ran on and its task. The call's conversation opens through the host's link\n * (`buildConversationHref`): nothing of what was said is in this screen. While voice is switched off the screen says\n * so; a call the signed-in account may not read reads as not found. The task is written by the agent or the owner and\n * shown as text only.\n */\nexport const AgentVoiceCallDetailScreen = ({\n api,\n callId,\n backLink,\n headerActions,\n buildConversationHref,\n linkComponent,\n}: AgentVoiceCallDetailScreenProps) => {\n const { t } = useTranslate();\n const Link = useLinkComponent(linkComponent);\n const callQuery = api.useAgentVoiceCallQuery({ callId });\n const callResponse = callQuery.data;\n const call = callResponse?.agentVoiceCall;\n\n if (callQuery.isLoading) {\n return (\n <div className=\"space-y-4\">\n <Skeleton className=\"h-12 w-80\" />\n <Skeleton className=\"h-32 w-full rounded-2xl\" />\n </div>\n );\n }\n if (callQuery.isError && isAgentVoiceAdminError(callQuery.error, AGENT_VOICE_ADMIN_ERROR_FEATURE_NOT_AVAILABLE)) {\n return (\n <div className=\"space-y-4\" data-testid=\"agent-voice-call-switched-off\">\n <PageHeader title={`#${callId}`} leading={backLink} />\n <StatusCallout\n tone=\"info\"\n title={t(\"Voice is switched off\")}\n description={t(\"The voice channel is switched off in this application, so its calls cannot be read.\")}\n />\n </div>\n );\n }\n if (!callResponse || !call) {\n const isCallNotFound = !callQuery.isError || isAgentVoiceAdminError(callQuery.error, AGENT_VOICE_ADMIN_ERROR_CALL_NOT_FOUND);\n return (\n <div className=\"space-y-4\" data-testid=\"agent-voice-call-not-shown\">\n <PageHeader title={`#${callId}`} leading={backLink} />\n {isCallNotFound ? (\n <StatusCallout\n tone=\"destructive\"\n title={t(\"This voice call was not found.\")}\n description={t(\"It does not exist, or it belongs to an account you may not read.\")}\n />\n ) : (\n <StatusCallout\n tone=\"destructive\"\n title={t(\"The voice call could not be loaded.\")}\n description={normalizeDddError(callQuery.error, \"\").message}\n />\n )}\n </div>\n );\n }\n\n const conversationId = callResponse.conversationId ?? call.aiConversationId ?? null;\n const conversationHref = conversationId ? (buildConversationHref?.(conversationId) ?? null) : null;\n const startedByAgentInConversationHref = call.startedByAgentInConversationId\n ? (buildConversationHref?.(call.startedByAgentInConversationId) ?? null)\n : null;\n const bookedSeconds = callResponse.bookedSeconds ?? call.bookedSeconds ?? 0;\n const bookedCosts = callResponse.bookedCosts ?? null;\n const durationInSeconds = callResponse.durationInSeconds ?? null;\n\n return (\n <div className=\"space-y-6\" data-testid=\"agent-voice-call-detail-screen\">\n <PageHeader\n leading={backLink}\n title={t(\"Voice call\")}\n description={<span className=\"font-mono text-xs\">#{call.id}</span>}\n actions={\n <div className=\"flex flex-wrap items-center gap-2\">\n {headerActions}\n <Button\n type=\"button\"\n variant=\"outline\"\n data-testid=\"agent-voice-call-refresh\"\n onClick={() => void callQuery.refetch?.()}\n disabled={callQuery.isFetching}\n >\n <RefreshCw className={cn(callQuery.isFetching && \"animate-spin\")} />\n {t(\"Refresh\")}\n </Button>\n {conversationHref && (\n <Button asChild variant=\"outline\" data-testid=\"agent-voice-call-open-conversation\">\n <Link href={conversationHref}>\n <MessagesSquare />\n {t(\"Open the conversation\", { context: \"agent-voice-call\" })}\n </Link>\n </Button>\n )}\n </div>\n }\n />\n <Card>\n <CardContent className=\"pt-6\">\n <DefinitionList\n items={[\n {\n id: \"state\",\n label: t(\"State\", { context: \"agent-voice-call\" }),\n value: (\n <AgentVoiceCallStateBadges\n callState={callResponse.callState}\n endReason={callResponse.endReason ?? call.endReason}\n />\n ),\n },\n {\n id: \"direction\",\n label: t(\"Started by\", { context: \"agent-voice-call\" }),\n value: <StatusBadge value={call.direction as AgentVoiceAdminCallDirection} map={AGENT_VOICE_CALL_DIRECTION} />,\n },\n {\n id: \"account\",\n label: t(\"Account\", { context: \"agent-voice-call\" }),\n value: call.accountId ? <span className=\"font-mono text-xs\">#{call.accountId}</span> : null,\n },\n {\n id: \"conversation\",\n label: t(\"Conversation\", { context: \"agent-voice-call\" }),\n value: conversationId ? (\n <AgentVoiceCallConversationLink\n conversationId={conversationId}\n href={conversationHref}\n linkComponent={linkComponent}\n />\n ) : null,\n hint: conversationId ? t(\"Its messages are what was said in the call.\") : undefined,\n },\n {\n id: \"startedByAgentInConversation\",\n label: t(\"Started by the agent in conversation\", { context: \"agent-voice-call\" }),\n value: call.startedByAgentInConversationId ? (\n <AgentVoiceCallConversationLink\n conversationId={call.startedByAgentInConversationId}\n href={startedByAgentInConversationHref}\n linkComponent={linkComponent}\n />\n ) : null,\n },\n {\n id: \"created\",\n label: t(\"Created\", { context: \"agent-voice-call\" }),\n value: call.changeHistory?.createdTime ? <DateCell value={call.changeHistory.createdTime} /> : null,\n },\n {\n id: \"answered\",\n label: t(\"Answered\", { context: \"agent-voice-call\" }),\n value: call.startedAt ? <DateCell value={call.startedAt} /> : null,\n },\n {\n id: \"ended\",\n label: t(\"Ended\", { context: \"agent-voice-call\" }),\n value: call.endedAt ? <DateCell value={call.endedAt} /> : null,\n },\n {\n id: \"ringDeadline\",\n label: t(\"Rings until\", { context: \"agent-voice-call\" }),\n value: call.ringDeadlineAt ? <DateCell value={call.ringDeadlineAt} /> : null,\n },\n {\n id: \"duration\",\n label: t(\"Duration\", { context: \"agent-voice-call\" }),\n value:\n durationInSeconds === null ? null : (\n <span className=\"tabular-nums\">{formatAgentVoiceCallDuration(durationInSeconds)}</span>\n ),\n },\n {\n id: \"bookedSeconds\",\n label: t(\"Booked seconds\", { context: \"agent-voice-call\" }),\n value: <span className=\"tabular-nums\">{formatUiNumber(bookedSeconds)}</span>,\n },\n {\n id: \"costs\",\n label: t(\"Costs\", { context: \"agent-voice-call\" }),\n value: bookedCosts ? <span className=\"tabular-nums\">{formatAgentVoiceAdminCallCosts(bookedCosts)}</span> : null,\n hint: !bookedCosts && bookedSeconds > 0 ? t(\"No price is known for the model this call ran on.\") : undefined,\n },\n {\n id: \"voiceProvider\",\n label: t(\"Voice provider\", { context: \"agent-voice-call\" }),\n value: call.voiceProvider ? <span className=\"font-mono text-xs\">{call.voiceProvider}</span> : null,\n },\n {\n id: \"providerCallId\",\n label: t(\"Provider call ID\", { context: \"agent-voice-call\" }),\n value: call.providerCallId ? <span className=\"break-all font-mono text-xs\">{call.providerCallId}</span> : null,\n },\n {\n id: \"task\",\n label: t(\"Task\", { context: \"agent-voice-call\" }),\n wide: true,\n value: call.callTask ? <p className=\"break-words whitespace-pre-wrap\">{call.callTask}</p> : null,\n },\n ]}\n />\n </CardContent>\n </Card>\n </div>\n );\n};\n","// The player of the voice samples of a voice picker: ONE audio element per page, so a sample that starts stops the one\n// playing. The application hands in how a sample is fetched (`fetchSample`): the WAV comes only through its backend\n// (`AdminAgentVoiceSamplesTrait`, the admin session), never from the object store. Each sample is fetched once per page\n// and kept as an object URL. Framework-free: the React hook of `AgentVoiceSampleButton` subscribes to the state here.\n\n/** Fetches the WAV of a voice in a language; rejects with a `status` of 404 when there is no sample. */\nexport type FetchAgentVoiceSample = (voiceId: string, languageCode: string) => Promise<Blob>;\n\n/** Why a sample did not play: none generated yet (404), the fetch failed, or the browser refused to play it. */\nexport type AgentVoiceSampleErrorKind = \"notFound\" | \"loadFailed\" | \"playFailed\";\n\nexport interface AgentVoiceSamplePlayerState {\n /** The sample playing now (`voiceId/languageCode`) */\n playingSampleKey: string | null;\n /** The sample being fetched */\n loadingSampleKey: string | null;\n}\n\n/** The key of a sample: voice and language. */\nexport const agentVoiceSampleKeyOf = (voiceId: string, languageCode: string): string => `${voiceId}/${languageCode}`;\n\nlet sharedAudioElement: HTMLAudioElement | null = null;\nconst objectUrlBySampleKey = new Map<string, string>();\nlet playerState: AgentVoiceSamplePlayerState = { playingSampleKey: null, loadingSampleKey: null };\nconst playerStateListeners = new Set<() => void>();\n\nconst setPlayerState = (change: Partial<AgentVoiceSamplePlayerState>): void => {\n playerState = { ...playerState, ...change };\n for (const listener of playerStateListeners) listener();\n};\n\nconst audioElementOf = (): HTMLAudioElement => {\n if (sharedAudioElement === null) {\n sharedAudioElement = new Audio();\n sharedAudioElement.preload = \"auto\";\n const clearPlaying = () => setPlayerState({ playingSampleKey: null });\n sharedAudioElement.addEventListener(\"ended\", clearPlaying);\n sharedAudioElement.addEventListener(\"pause\", clearPlaying);\n }\n return sharedAudioElement;\n};\n\n/** The state now (a new object after every change, so it can back `useSyncExternalStore`). */\nexport const readAgentVoiceSamplePlayerState = (): AgentVoiceSamplePlayerState => playerState;\n\n/** Calls `listener` after every change; returns the unsubscribe. */\nexport const subscribeAgentVoiceSamplePlayer = (listener: () => void): (() => void) => {\n playerStateListeners.add(listener);\n return () => {\n playerStateListeners.delete(listener);\n };\n};\n\n/** The number of subscribers (the hook stops the sample when the last one leaves). */\nexport const countAgentVoiceSamplePlayerSubscribers = (): number => playerStateListeners.size;\n\n/** Stops the sample playing, if any. */\nexport const stopAgentVoiceSample = (): void => {\n sharedAudioElement?.pause();\n if (playerState.playingSampleKey !== null) setPlayerState({ playingSampleKey: null });\n};\n\n/** Whether a rejected fetch was a 404 (an RTK Query error, a `Response`-like or any object with `status: 404`). */\nexport const isAgentVoiceSampleNotFound = (error: unknown): boolean =>\n typeof error === \"object\" && error !== null && \"status\" in error && (error as { status: unknown }).status === 404;\n\n/**\n * Plays the sample of a voice in a language, or stops it when it is the one playing. Starting a sample stops the one\n * playing; a sample asked for while another loads wins over it. Resolves with why it did not play, or null.\n */\nexport const toggleAgentVoiceSample = async ({\n voiceId,\n languageCode,\n fetchSample,\n}: {\n voiceId: string;\n languageCode: string;\n fetchSample: FetchAgentVoiceSample;\n}): Promise<AgentVoiceSampleErrorKind | null> => {\n const sampleKey = agentVoiceSampleKeyOf(voiceId, languageCode);\n if (playerState.playingSampleKey === sampleKey) {\n stopAgentVoiceSample();\n return null;\n }\n stopAgentVoiceSample();\n let objectUrl = objectUrlBySampleKey.get(sampleKey);\n if (objectUrl === undefined) {\n setPlayerState({ loadingSampleKey: sampleKey });\n let sampleBlob: Blob;\n try {\n sampleBlob = await fetchSample(voiceId, languageCode);\n } catch (error) {\n if (playerState.loadingSampleKey === sampleKey) setPlayerState({ loadingSampleKey: null });\n return isAgentVoiceSampleNotFound(error) ? \"notFound\" : \"loadFailed\";\n }\n objectUrl = URL.createObjectURL(sampleBlob);\n objectUrlBySampleKey.set(sampleKey, objectUrl);\n // another sample was asked for while this one loaded: that one wins\n if (playerState.loadingSampleKey !== sampleKey) return null;\n setPlayerState({ loadingSampleKey: null });\n }\n const audioElement = audioElementOf();\n audioElement.src = objectUrl;\n setPlayerState({ playingSampleKey: sampleKey });\n try {\n await audioElement.play();\n } catch {\n if (playerState.playingSampleKey === sampleKey) setPlayerState({ playingSampleKey: null });\n return \"playFailed\";\n }\n return null;\n};\n\n/** Stops the sample and forgets every fetched one (a sign-out, or a spec between tests). */\nexport const resetAgentVoiceSamplePlayer = (): void => {\n stopAgentVoiceSample();\n for (const objectUrl of objectUrlBySampleKey.values()) URL.revokeObjectURL(objectUrl);\n objectUrlBySampleKey.clear();\n sharedAudioElement = null;\n playerState = { playingSampleKey: null, loadingSampleKey: null };\n};\n","import { LoaderCircle, Play, Square } from \"lucide-react\";\nimport { type ReactNode, type SyntheticEvent, useCallback, useEffect, useSyncExternalStore } from \"react\";\n\nimport { m, useTranslate } from \"@mgamadeus/ddd-admin-ui/i18n\";\nimport { cn } from \"@mgamadeus/ddd-admin-ui/primitives\";\nimport {\n type AgentVoiceSampleErrorKind,\n agentVoiceSampleKeyOf,\n countAgentVoiceSamplePlayerSubscribers,\n type FetchAgentVoiceSample,\n readAgentVoiceSamplePlayerState,\n stopAgentVoiceSample,\n subscribeAgentVoiceSamplePlayer,\n toggleAgentVoiceSample,\n} from \"../agent-voice-sample-player\";\n\n/** The message of each reason a sample did not play, for the application's toast. */\nexport const AGENT_VOICE_SAMPLE_ERROR_TEXTS: Readonly<Record<AgentVoiceSampleErrorKind, string>> = {\n notFound: m(\"There is no sample of this voice yet.\"),\n loadFailed: m(\"The sample could not be loaded.\"),\n playFailed: m(\"The sample could not be played.\"),\n};\n\nexport interface UseAgentVoiceSamplePlayerOptions {\n /** How the application fetches a sample through its backend (e.g. its SDK's lazy query, unwrapped to the Blob). */\n fetchSample: FetchAgentVoiceSample;\n /** Shows why a sample did not play (the translated text and its reason); the package shows no toast of its own. */\n onError?: (message: string, errorKind: AgentVoiceSampleErrorKind) => void;\n}\n\n/**\n * Plays and stops voice samples; every user of the hook sees the same state (one audio element per page). When the\n * last user leaves the page, the sample stops.\n */\nexport const useAgentVoiceSamplePlayer = ({ fetchSample, onError }: UseAgentVoiceSamplePlayerOptions) => {\n const { t } = useTranslate();\n const playerState = useSyncExternalStore(\n subscribeAgentVoiceSamplePlayer,\n readAgentVoiceSamplePlayerState,\n readAgentVoiceSamplePlayerState,\n );\n\n useEffect(() => {\n const unsubscribe = subscribeAgentVoiceSamplePlayer(() => {});\n return () => {\n unsubscribe();\n if (countAgentVoiceSamplePlayerSubscribers() === 0) stopAgentVoiceSample();\n };\n }, []);\n\n const toggle = useCallback(\n async (voiceId: string, languageCode: string) => {\n const errorKind = await toggleAgentVoiceSample({ voiceId, languageCode, fetchSample });\n if (errorKind !== null) onError?.(t(AGENT_VOICE_SAMPLE_ERROR_TEXTS[errorKind]), errorKind);\n },\n [fetchSample, onError, t],\n );\n\n return {\n toggle,\n isPlaying: (voiceId: string, languageCode: string) => playerState.playingSampleKey === agentVoiceSampleKeyOf(voiceId, languageCode),\n isLoading: (voiceId: string, languageCode: string) => playerState.loadingSampleKey === agentVoiceSampleKeyOf(voiceId, languageCode),\n };\n};\n\nexport type AgentVoiceSamplePlayer = ReturnType<typeof useAgentVoiceSamplePlayer>;\n\n/** Keeps a press on the button from reaching a surrounding select item (which would choose the voice and close). */\nconst keepFromParent = (event: SyntheticEvent): void => {\n event.stopPropagation();\n};\n\nexport interface AgentVoiceSampleButtonProps {\n voiceId: string;\n languageCode: string;\n /** The voice's name for the label (\"Marin\") */\n voiceName: string;\n player: AgentVoiceSamplePlayer;\n className?: string;\n}\n\n/**\n * ▶ / ■ of one sample. Usable inside a select item: a press neither chooses the item nor closes the list. In a select\n * whose value mirrors the item's text, give the select value its own children, so the button is not mirrored.\n */\nexport const AgentVoiceSampleButton = ({ voiceId, languageCode, voiceName, player, className }: AgentVoiceSampleButtonProps): ReactNode => {\n const { t } = useTranslate();\n const isPlaying = player.isPlaying(voiceId, languageCode);\n const isLoading = player.isLoading(voiceId, languageCode);\n const label = isPlaying\n ? t(\"Stop the sample of %voiceName%\", { replacements: { voiceName } })\n : t(\"Play the sample of %voiceName%\", { replacements: { voiceName } });\n const toggle = (event: SyntheticEvent) => {\n keepFromParent(event);\n event.preventDefault();\n void player.toggle(voiceId, languageCode);\n };\n return (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n aria-pressed={isPlaying}\n data-voice-sample={agentVoiceSampleKeyOf(voiceId, languageCode)}\n className={cn(\n \"inline-flex size-8 shrink-0 items-center justify-center rounded-full border bg-background text-foreground transition-colors hover:bg-tint focus-visible:outline-2 focus-visible:outline-ring\",\n isPlaying && \"border-primary text-primary\",\n className,\n )}\n onPointerDown={event => {\n keepFromParent(event);\n event.preventDefault();\n }}\n onPointerUp={keepFromParent}\n onKeyDown={event => {\n if (event.key === \"Enter\" || event.key === \" \") toggle(event);\n }}\n onClick={toggle}\n >\n {isLoading ? (\n <LoaderCircle className=\"size-4 animate-spin\" aria-hidden />\n ) : isPlaying ? (\n <Square className=\"size-3.5 fill-current\" aria-hidden />\n ) : (\n <Play className=\"size-3.5 translate-x-px fill-current\" aria-hidden />\n )}\n </button>\n );\n};\n"],"names":["playerState"],"mappings":";;;;;;;;;;;;;AAoBO,MAAM,wBAAwB;AAsB9B,MAAM,mCAAmC,CAAC,QAC/C;AAAA,EACE,IAAI,cAAc,UAAa,iBAAi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AAA,IAAM,aAAA;AACd,QAAM,YAAY,OAAO,UAAU,SAAS,YAAY;AACxD,QAAM,YAAY,OAAO,UAAU,SAAS,YAAY;AACxD,QAAM,QAAQ,YACV,EAAE,kCAAkC,EAAE,cAAc,EAAE,UAAA,EAAU,CAAG,IACnE,EAAE,kCAAkC,EAAE,cAAc,EAAE,UAAA,GAAa;AACvE,QAAM,SAAS,CAAC,UAA0B;AACxC,mBAAe,KAAK;AACpB,UAAM,eAAA;AACN,SAAK,OAAO,OAAO,SAAS,YAAY;AAAA,EAC1C;AACA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,OAAO;AAAA,MACP,gBAAc;AAAA,MACd,qBAAmB,sBAAsB,SAAS,YAAY;AAAA,MAC9D,WAAW;AAAA,QACT;AAAA,QACA,aAAa;AAAA,QACb;AAAA,MAAA;AAAA,MAEF,eAAe,CAAA,UAAS;AACtB,uBAAe,KAAK;AACpB,cAAM,eAAA;AAAA,MACR;AAAA,MACA,aAAa;AAAA,MACb,WAAW,CAAA,UAAS;AAClB,YAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,YAAY,KAAK;AAAA,MAC9D;AAAA,MACA,SAAS;AAAA,MAER,UAAA,gCACE,cAAA,EAAa,WAAU,uBAAsB,eAAW,KAAA,CAAC,IACxD,YACF,oBAAC,UAAO,WAAU,yBAAwB,eAAW,KAAA,CAAC,wBAErD,MAAA,EAAK,WAAU,wCAAuC,eAAW,KAAA,CAAC;AAAA,IAAA;AAAA,EAAA;AAI3E;"}
|
package/package.json
CHANGED
package/public-api.json
CHANGED
|
@@ -1196,22 +1196,32 @@
|
|
|
1196
1196
|
"AGENT_VOICE_CALL_END_REASON",
|
|
1197
1197
|
"AGENT_VOICE_CALL_END_REASONS",
|
|
1198
1198
|
"AGENT_VOICE_CALL_STATE",
|
|
1199
|
+
"AGENT_VOICE_SAMPLE_ERROR_TEXTS",
|
|
1199
1200
|
"AgentVoiceCallConversationLink",
|
|
1200
1201
|
"AgentVoiceCallDetailScreen",
|
|
1201
1202
|
"AgentVoiceCallStateBadges",
|
|
1202
1203
|
"AgentVoiceCallsScreen",
|
|
1204
|
+
"AgentVoiceSampleButton",
|
|
1203
1205
|
"agentVoiceAdminCallDerivedValuesByCallIdOf",
|
|
1204
1206
|
"agentVoiceAdminCallDurationInSecondsOf",
|
|
1205
1207
|
"agentVoiceAdminCallStartTimeOf",
|
|
1206
1208
|
"agentVoiceAdminEndpointDefinitions",
|
|
1209
|
+
"agentVoiceSampleKeyOf",
|
|
1207
1210
|
"buildAgentVoiceAdminCallsFilters",
|
|
1208
1211
|
"buildAgentVoiceAdminRequests",
|
|
1209
1212
|
"createAgentVoiceAdminApi",
|
|
1210
1213
|
"createStaticAgentVoiceAdminApi",
|
|
1211
1214
|
"formatAgentVoiceAdminCallCosts",
|
|
1212
1215
|
"isAgentVoiceAdminError",
|
|
1216
|
+
"isAgentVoiceSampleNotFound",
|
|
1213
1217
|
"readAgentVoiceAdminWholeNumber",
|
|
1214
|
-
"
|
|
1218
|
+
"readAgentVoiceSamplePlayerState",
|
|
1219
|
+
"resetAgentVoiceSamplePlayer",
|
|
1220
|
+
"stopAgentVoiceSample",
|
|
1221
|
+
"subscribeAgentVoiceSamplePlayer",
|
|
1222
|
+
"toAgentVoiceAdminDayBound",
|
|
1223
|
+
"toggleAgentVoiceSample",
|
|
1224
|
+
"useAgentVoiceSamplePlayer"
|
|
1215
1225
|
],
|
|
1216
1226
|
"types": [
|
|
1217
1227
|
"AgentVoiceAdminApi",
|
|
@@ -1232,8 +1242,14 @@
|
|
|
1232
1242
|
"AgentVoiceCallDetailScreenProps",
|
|
1233
1243
|
"AgentVoiceCallStateBadgesProps",
|
|
1234
1244
|
"AgentVoiceCallsScreenProps",
|
|
1245
|
+
"AgentVoiceSampleButtonProps",
|
|
1246
|
+
"AgentVoiceSampleErrorKind",
|
|
1247
|
+
"AgentVoiceSamplePlayer",
|
|
1248
|
+
"AgentVoiceSamplePlayerState",
|
|
1235
1249
|
"CreateAgentVoiceAdminApiOptions",
|
|
1236
|
-
"
|
|
1250
|
+
"FetchAgentVoiceSample",
|
|
1251
|
+
"StaticAgentVoiceAdminData",
|
|
1252
|
+
"UseAgentVoiceSamplePlayerOptions"
|
|
1237
1253
|
]
|
|
1238
1254
|
}
|
|
1239
1255
|
}
|