@mgamadeus/ddd-agents 0.6.0 → 0.6.2

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.
@@ -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 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. A call the answer names no entry\n * for has none here: its row then shows no state and no costs.\n */\nexport const agentVoiceAdminCallDerivedValuesByCallIdOf = (\n agentVoiceCallDerivedValues: readonly AgentVoiceAdminCallDerivedValues[] | null | undefined,\n): ReadonlyMap<number, AgentVoiceAdminCallDerivedValues> => {\n const derivedValuesByCallId = new Map<number, AgentVoiceAdminCallDerivedValues>();\n for (const derivedValuesOfCall of agentVoiceCallDerivedValues ?? [])\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,MAA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AA,CACF;AAAA,EAAA,GACF;AAEJ;"}
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,S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