@alfadocs/ui-kit 1.140.0 → 1.141.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/_chunks/{appointment-card-CaxFXtSn.js → appointment-card-r0OZm77v.js} +170 -168
  2. package/dist/_chunks/appointment-timeline-Bs-rTMzi.js +689 -0
  3. package/dist/_chunks/{appointment-tray-DPpeR9JT.js → appointment-tray-t_ltp-Yi.js} +2 -2
  4. package/dist/_chunks/{calendar-appointment-editor-dialog-BBrJlmyd.js → calendar-appointment-editor-dialog-CuXpgLCw.js} +4 -4
  5. package/dist/_chunks/{calendar-waiting-list-panel-Cdg9YssA.js → calendar-waiting-list-panel-BNQrUndD.js} +2 -2
  6. package/dist/_chunks/{calendar.sheets-DbMOO7YV.js → calendar.sheets-DcW8A3DI.js} +2 -2
  7. package/dist/_chunks/calls-panel-CJNQm7r8.js +1446 -0
  8. package/dist/_chunks/{notes-panel-CnmQqhwq.js → notes-panel-C4HSUudf.js} +2 -2
  9. package/dist/_chunks/{patient-account-settings-DfEPHmCh.js → patient-account-settings-nSvNKKOL.js} +2 -2
  10. package/dist/_chunks/{patient-check-in-resume-TWs8CPQr.js → patient-check-in-resume-Cj2wg_NQ.js} +4 -4
  11. package/dist/_chunks/{portal-details-VfeOI4PB.js → portal-details-Cnyqf9kY.js} +2 -2
  12. package/dist/_chunks/{portal-documents-hGHlwmbv.js → portal-documents-g109Dl0O.js} +2 -2
  13. package/dist/_chunks/{portal-parts-C99CreYO.js → portal-parts-DgDFuED8.js} +2 -2
  14. package/dist/_chunks/{rich-text-editor-DFsH5RAj.js → rich-text-editor-orJ-hPgm.js} +1323 -1308
  15. package/dist/agent-catalog.json +134 -3
  16. package/dist/agent-i18n/en.json +8 -2
  17. package/dist/appointment-editor-panel/index.js +1 -1
  18. package/dist/browser-support.js +1 -1
  19. package/dist/components/appointment-card/appointment-card.d.ts +4 -0
  20. package/dist/components/appointment-card/index.js +2 -2
  21. package/dist/components/appointment-timeline/appointment-timeline.d.ts +51 -0
  22. package/dist/components/appointment-timeline/index.d.ts +1 -1
  23. package/dist/components/appointment-timeline/index.js +1 -1
  24. package/dist/components/calls-panel/calls-panel.d.ts +91 -0
  25. package/dist/components/calls-panel/index.d.ts +1 -1
  26. package/dist/components/calls-panel/index.js +1 -1
  27. package/dist/components/notes-panel/index.js +1 -1
  28. package/dist/components/rich-text-editor/index.js +1 -1
  29. package/dist/core.css +1 -1
  30. package/dist/find-free-slots-panel/index.js +1 -1
  31. package/dist/host-compat.css +13 -1
  32. package/dist/i18n/locales/ar.d.ts +45 -0
  33. package/dist/i18n/locales/ar.js +44 -2
  34. package/dist/i18n/locales/de.d.ts +45 -0
  35. package/dist/i18n/locales/de.js +44 -2
  36. package/dist/i18n/locales/el.d.ts +45 -0
  37. package/dist/i18n/locales/el.js +47 -2
  38. package/dist/i18n/locales/en.d.ts +37 -0
  39. package/dist/i18n/locales/en.js +39 -2
  40. package/dist/i18n/locales/es.d.ts +45 -0
  41. package/dist/i18n/locales/es.js +44 -2
  42. package/dist/i18n/locales/fr.d.ts +45 -0
  43. package/dist/i18n/locales/fr.js +44 -2
  44. package/dist/i18n/locales/hi.d.ts +45 -0
  45. package/dist/i18n/locales/hi.js +47 -2
  46. package/dist/i18n/locales/it.d.ts +45 -0
  47. package/dist/i18n/locales/it.js +44 -2
  48. package/dist/i18n/locales/ja.d.ts +45 -0
  49. package/dist/i18n/locales/ja.js +47 -2
  50. package/dist/i18n/locales/nl.d.ts +45 -0
  51. package/dist/i18n/locales/nl.js +44 -2
  52. package/dist/i18n/locales/pl.d.ts +45 -0
  53. package/dist/i18n/locales/pl.js +47 -2
  54. package/dist/i18n/locales/pt.d.ts +45 -0
  55. package/dist/i18n/locales/pt.js +44 -2
  56. package/dist/i18n/locales/ro.d.ts +45 -0
  57. package/dist/i18n/locales/ro.js +44 -2
  58. package/dist/i18n/locales/ru.d.ts +45 -0
  59. package/dist/i18n/locales/ru.js +44 -2
  60. package/dist/i18n/locales/sq.d.ts +45 -0
  61. package/dist/i18n/locales/sq.js +47 -2
  62. package/dist/i18n/locales/sv.d.ts +45 -0
  63. package/dist/i18n/locales/sv.js +44 -2
  64. package/dist/i18n/locales/tr.d.ts +45 -0
  65. package/dist/i18n/locales/tr.js +44 -2
  66. package/dist/i18n/locales/zh.d.ts +45 -0
  67. package/dist/i18n/locales/zh.js +44 -2
  68. package/dist/index.js +12 -12
  69. package/dist/locales/ar.json +47 -2
  70. package/dist/locales/de.json +47 -2
  71. package/dist/locales/el.json +47 -2
  72. package/dist/locales/en.json +39 -2
  73. package/dist/locales/es.json +47 -2
  74. package/dist/locales/fr.json +47 -2
  75. package/dist/locales/hi.json +47 -2
  76. package/dist/locales/it.json +47 -2
  77. package/dist/locales/ja.json +47 -2
  78. package/dist/locales/nl.json +47 -2
  79. package/dist/locales/pl.json +47 -2
  80. package/dist/locales/pt.json +47 -2
  81. package/dist/locales/ro.json +47 -2
  82. package/dist/locales/ru.json +47 -2
  83. package/dist/locales/sq.json +47 -2
  84. package/dist/locales/sv.json +47 -2
  85. package/dist/locales/tr.json +47 -2
  86. package/dist/locales/zh.json +47 -2
  87. package/dist/online-bookings-panel/index.js +1 -1
  88. package/dist/patterns/calendar/index.js +2 -2
  89. package/dist/patterns/patient-account-settings/index.js +1 -1
  90. package/dist/patterns/patient-check-in/index.js +1 -1
  91. package/dist/patterns/patient-portal/index.js +2 -2
  92. package/dist/tokens.css +1 -1
  93. package/dist/waiting-list-panel/index.js +2 -2
  94. package/package.json +1 -1
  95. package/dist/_chunks/appointment-timeline-BEwgbYyG.js +0 -455
  96. package/dist/_chunks/calls-panel-CtxJAzkJ.js +0 -1094
@@ -1,1094 +0,0 @@
1
- import { jsxs as m, jsx as t, Fragment as Jt } from "react/jsx-runtime";
2
- import { forwardRef as Qt, useId as qe, useRef as l, useImperativeHandle as Xt, useEffect as M, useMemo as fe, useCallback as ae, useState as y } from "react";
3
- import { c as Rt } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Ot } from "react-i18next";
5
- import { u as Wt } from "./registry-DvAUVLHh.js";
6
- import { u as er } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
7
- import { g as ze } from "./get-error-message-DbFUzuja.js";
8
- import { formatPhoneForDisplay as tr } from "../format-phone/index.js";
9
- import { f as Kt, c as rr } from "./intl-locale-FWh-Y5_3.js";
10
- import { A as q } from "./alert-C4WKViaS.js";
11
- import { B as D } from "./button-DohK_Ak_.js";
12
- import { I as xt } from "./icon-button-S8_weU3g.js";
13
- import { C as Be } from "./call-status-chip-pajxN5eZ.js";
14
- import { D as nr } from "./date-time-picker-C6b_Vymc.js";
15
- import { D as E } from "./dialog-CVTxyR0v.js";
16
- import { E as je } from "./empty-state-DwJ5YNzz.js";
17
- import { F as he } from "./form-field-CyHfOVKF.js";
18
- import { L as Ct } from "./link-CeV7FoI6.js";
19
- import { P as It } from "./panel-header-CbtlTe85.js";
20
- import { P as Nt } from "./panel-subview-DCyvn-49.js";
21
- import { S as St } from "./select-Bm8s3q-X.js";
22
- import { S as _e } from "./skeleton-tTWJpvAq.js";
23
- import { T as Tt } from "./text-area-COMVJ1yE.js";
24
- import { P as Me } from "./phone-FceYcIFQ.js";
25
- import { P as ar } from "./pencil-B1sKKyuT.js";
26
- import { T as kt } from "./trash-2-uumy3fy1.js";
27
- import { P as sr } from "./plus-DzMQ_c6b.js";
28
- const or = {
29
- id: "calls-panel",
30
- capabilities: ["open", "close", "submit", "edit_inline"],
31
- state: {
32
- callCount: {
33
- type: "number",
34
- descriptionKey: "ui.agent.callsPanel.state.callCount",
35
- description: "How many logged calls the list holds. A count only, never a call. Zero under privacy.",
36
- read: (a) => a.getState().callCount
37
- },
38
- automaticCount: {
39
- type: "number",
40
- descriptionKey: "ui.agent.callsPanel.state.automaticCount",
41
- description: "How many calls were logged by other software, such as a phone system. A count only: never a number, a name or a link. Zero under privacy.",
42
- read: (a) => a.getState().automaticCount
43
- },
44
- missedCount: {
45
- type: "number",
46
- descriptionKey: "ui.agent.callsPanel.state.missedCount",
47
- description: "How many incoming calls nobody answered. A count only. Zero under privacy.",
48
- read: (a) => a.getState().missedCount
49
- },
50
- status: {
51
- type: "'ready' | 'loading' | 'error'",
52
- descriptionKey: "ui.agent.callsPanel.state.status",
53
- description: "The state of the host's read of the calls.",
54
- read: (a) => a.getState().status
55
- },
56
- formOpen: {
57
- type: "boolean",
58
- descriptionKey: "ui.agent.callsPanel.state.formOpen",
59
- description: 'Whether the "Log a call" form is showing.',
60
- read: (a) => a.getState().formOpen
61
- },
62
- privacy: {
63
- type: "{ masked: true } | null",
64
- descriptionKey: "ui.agent.callsPanel.state.privacy",
65
- description: "Reads { masked: true } when privacy mode withholds the calls, else null.",
66
- read: (a) => a.getState().privacy ? { masked: !0 } : null
67
- }
68
- },
69
- actions: {
70
- open_form: {
71
- safety: "write",
72
- idempotent: !0,
73
- errors: [
74
- "The panel is read-only, privacy mode is on, or the host gave no way to log a call."
75
- ],
76
- descriptionKey: "ui.agent.callsPanel.actions.openForm",
77
- description: 'Open the "Log a call" form, as the button does.',
78
- invoke: (a) => a.openForm()
79
- },
80
- close_form: {
81
- // A dismiss, classed as select and dialog class their `close`.
82
- safety: "read",
83
- idempotent: !0,
84
- errors: ["A call is being saved."],
85
- descriptionKey: "ui.agent.callsPanel.actions.closeForm",
86
- description: "Close the form and discard what was typed in it.",
87
- invoke: (a) => a.closeForm()
88
- },
89
- submit_call: {
90
- // A call note is patient-identifiable. PHI.
91
- safety: "phi",
92
- argsType: "{ dateIso: string; purposeId?: string | null; outcomeId?: string | null; description?: string }",
93
- argsSchema: {
94
- type: "object",
95
- properties: {
96
- dateIso: {
97
- type: "string",
98
- description: "ISO-8601 instant the call took place."
99
- },
100
- purposeId: { type: ["string", "null"] },
101
- outcomeId: { type: ["string", "null"] },
102
- description: { type: "string" }
103
- },
104
- required: ["dateIso"]
105
- },
106
- openWorld: !0,
107
- errors: [
108
- "The date is missing or not a date.",
109
- "The purpose or outcome is not one the host offered.",
110
- "The panel is read-only, privacy mode is on, or the host gave no way to log a call.",
111
- "A write is already in progress.",
112
- "The host refused the call. The panel keeps the form and shows the host's message."
113
- ],
114
- descriptionKey: "ui.agent.callsPanel.actions.logCall",
115
- description: "Log a call made to the patient. Settles with the host's answer; a refusal rejects.",
116
- examples: [
117
- {
118
- args: {
119
- dateIso: "2026-06-24T09:30:00Z",
120
- outcomeId: "connected",
121
- description: "Confirmed the visit."
122
- },
123
- note: "Log a connected call."
124
- }
125
- ],
126
- invoke: (a, d) => a.logCall(d)
127
- },
128
- edit_call: {
129
- safety: "phi",
130
- argsType: "{ id: string; description: string }",
131
- argsSchema: {
132
- type: "object",
133
- properties: {
134
- id: { type: "string" },
135
- description: { type: "string", minLength: 1 }
136
- },
137
- required: ["id", "description"]
138
- },
139
- idempotent: !0,
140
- openWorld: !0,
141
- errors: [
142
- "No call has that id.",
143
- "The description is empty.",
144
- "The panel is read-only, privacy mode is on, or the host gave no way to edit a call.",
145
- "A write is already in progress.",
146
- "The host refused the edit. The panel keeps the text and shows the host's message."
147
- ],
148
- descriptionKey: "ui.agent.callsPanel.actions.updateCall",
149
- description: "Replace the description of a logged call. Only the description can change. Settles with the host's answer.",
150
- invoke: (a, d) => a.updateCall(d.id, { description: d.description })
151
- },
152
- delete_call: {
153
- safety: "destructive",
154
- argsType: "{ id: string }",
155
- argsSchema: {
156
- type: "object",
157
- properties: { id: { type: "string" } },
158
- required: ["id"]
159
- },
160
- openWorld: !0,
161
- errors: [
162
- "No call has that id.",
163
- "The panel is read-only, privacy mode is on, or the host gave no way to delete a call.",
164
- "A write is already in progress.",
165
- "The host refused the delete."
166
- ],
167
- descriptionKey: "ui.agent.callsPanel.actions.deleteCall",
168
- description: "Delete a logged call. Settles with the host's answer; a refusal rejects.",
169
- invoke: (a, d) => a.deleteCall(d.id)
170
- }
171
- },
172
- domHooks: {
173
- root: {
174
- attr: "data-component",
175
- value: "calls-panel",
176
- description: "Marks the CallsPanel region."
177
- },
178
- instanceId: {
179
- attr: "data-component-id",
180
- sourceProp: "id",
181
- description: "Sourced from the id prop. Required to address a specific panel from the agent."
182
- },
183
- item: {
184
- attr: "data-call-id",
185
- description: "Stable call id on each rendered call. Never a description, a purpose or a date."
186
- }
187
- }
188
- }, Et = Rt(
189
- "ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:bg-[color:var(--card)]"
190
- ), Dt = Rt(
191
- [
192
- "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-xs)]",
193
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)]",
194
- "ds:bg-[color:var(--card)] ds:p-[var(--spacing-sm)]"
195
- ].join(" ")
196
- ), Lt = {
197
- connected: "positive",
198
- no_answer: "caution",
199
- busy: "caution",
200
- left_voicemail: "caution",
201
- wrong_number: "negative"
202
- }, lr = new Set(Object.keys(Lt));
203
- function Ft(a) {
204
- if (a)
205
- try {
206
- const d = new URL(a.trim());
207
- return d.protocol === "http:" || d.protocol === "https:" ? d.href : void 0;
208
- } catch {
209
- return;
210
- }
211
- }
212
- function ir(a, d) {
213
- const b = Kt(rr(d)), P = Math.round(a), p = [
214
- [Math.floor(P / 3600), "hour"],
215
- [Math.floor(P % 3600 / 60), "minute"],
216
- [P % 60, "second"]
217
- ].filter(([k]) => k > 0);
218
- p.length === 0 && p.push([0, "second"]);
219
- const w = p.map(
220
- ([k, N]) => new Intl.NumberFormat(b, {
221
- style: "unit",
222
- unit: N,
223
- unitDisplay: "short"
224
- }).format(k)
225
- );
226
- return new Intl.ListFormat(b, { type: "unit", style: "narrow" }).format(
227
- w
228
- );
229
- }
230
- function ge(a) {
231
- return !!a && !Number.isNaN(a.getTime());
232
- }
233
- function At(a) {
234
- const d = new Date(a).getTime();
235
- return Number.isNaN(d) ? 0 : d;
236
- }
237
- function dr({ text: a }) {
238
- const { t: d } = Ot("ui"), b = qe(), P = l(null), [T, p] = y(!1), [w, k] = y(!1);
239
- return er(() => {
240
- const N = P.current;
241
- if (!N || T) return;
242
- const se = () => k(N.scrollHeight > N.clientHeight + 1);
243
- if (se(), typeof ResizeObserver > "u") return;
244
- const c = new ResizeObserver(se);
245
- return c.observe(N), () => c.disconnect();
246
- }, [a, T]), /* @__PURE__ */ m("div", { className: "ds:flex ds:min-w-0 ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]", children: [
247
- /* @__PURE__ */ t(
248
- "p",
249
- {
250
- ref: P,
251
- id: b,
252
- dir: "auto",
253
- "data-calls-description": "",
254
- className: [
255
- "ds:m-0 ds:w-full type-body-sm ds:whitespace-pre-line ds:text-[color:var(--foreground)] ds:[overflow-wrap:anywhere]",
256
- T ? "" : "ds:line-clamp-3"
257
- ].join(" "),
258
- children: a
259
- }
260
- ),
261
- w || T ? /* @__PURE__ */ t(
262
- D,
263
- {
264
- type: "button",
265
- intent: "link",
266
- size: "sm",
267
- className: "ds:data-[component=button]:ps-0 ds:data-[component=button]:pe-0",
268
- "aria-expanded": T,
269
- "aria-controls": b,
270
- onClick: () => p((N) => !N),
271
- children: d(T ? "callsPanel.showLess" : "callsPanel.showMore")
272
- }
273
- ) : null
274
- ] });
275
- }
276
- const cr = Qt(
277
- ({
278
- id: a,
279
- title: d,
280
- "aria-label": b,
281
- nowIso: P,
282
- locale: T,
283
- calls: p,
284
- status: w = "ready",
285
- onRetry: k,
286
- purposes: N,
287
- outcomes: se,
288
- privacy: c = !1,
289
- readOnly: V = !1,
290
- onCreate: ve,
291
- onUpdate: ye,
292
- onDelete: we,
293
- onWriteError: Ve,
294
- className: $e,
295
- ...Ze
296
- }, Ht) => {
297
- const { t: n, i18n: zt } = Ot("ui"), oe = qe(), Bt = qe(), Ye = d ?? n("callsPanel.title"), be = T ?? zt.language, F = l(null);
298
- Xt(Ht, () => F.current, []);
299
- const Pe = l(null), Ue = l(null), le = l(!1), K = !V && !c && !!ve, $ = !V && !c && !!ye, L = !V && !c && !!we, Z = N ?? [], H = se ?? [], z = l(ve);
300
- z.current = ve;
301
- const Y = l(ye);
302
- Y.current = ye;
303
- const U = l(we);
304
- U.current = we;
305
- const S = l(Ve);
306
- S.current = Ve;
307
- const g = l(!0);
308
- M(() => (g.current = !0, () => {
309
- g.current = !1;
310
- }), []);
311
- const Ge = fe(
312
- () => new Date(P ?? Date.now()).getFullYear(),
313
- [P]
314
- ), xe = ae(
315
- (e) => {
316
- const r = new Date(e);
317
- return Number.isNaN(r.getTime()) ? e : new Intl.DateTimeFormat(Kt(be), {
318
- calendar: "gregory",
319
- hourCycle: "h23",
320
- day: "numeric",
321
- month: "short",
322
- ...r.getFullYear() === Ge ? {} : { year: "numeric" },
323
- hour: "2-digit",
324
- minute: "2-digit"
325
- }).format(r);
326
- },
327
- [be, Ge]
328
- ), Je = fe(
329
- () => [...p].sort((e, r) => At(r.dateIso) - At(e.dateIso)),
330
- [p]
331
- ), Qe = (e, r) => {
332
- var s;
333
- return r ? (s = e.find((o) => o.id === r)) == null ? void 0 : s.label : void 0;
334
- }, [x, B] = y(null), u = l(!1), A = l(null), G = l(null), [Ce, C] = y(null), [ie, R] = y(!1), [I, j] = y({
335
- date: void 0,
336
- purposeId: "",
337
- outcomeId: "",
338
- description: ""
339
- }), [Xe, de] = y(null), [jt, Ie] = y(!1), Ne = ae(() => {
340
- const e = new Date(P ?? Date.now());
341
- j({
342
- date: ge(e) ? e : void 0,
343
- purposeId: "",
344
- outcomeId: "",
345
- description: ""
346
- }), de(null), Ie(!1), C(null), R(!0);
347
- }, [P]), We = fe(
348
- () => ({
349
- get current() {
350
- var e;
351
- return ((e = Ue.current) == null ? void 0 : e.querySelector(
352
- "[data-calls-date] button"
353
- )) ?? null;
354
- }
355
- }),
356
- []
357
- ), [f, O] = y(
358
- null
359
- ), [J, Q] = y(null), [ce, ue] = y(!1), X = l(null), Se = l(null), [W, ee] = y(null), [et, te] = y(null), Te = l(null), pe = W ? p.find((e) => e.id === W) : void 0, _ = l({
360
- form: !1,
361
- editingId: null,
362
- deleteId: null
363
- });
364
- _.current = {
365
- form: ie,
366
- editingId: (f == null ? void 0 : f.id) ?? null,
367
- deleteId: pe ? W : null
368
- }, M(() => {
369
- c && (R(!1), j({
370
- date: void 0,
371
- purposeId: "",
372
- outcomeId: "",
373
- description: ""
374
- }), de(null), O(null), Q(null), ee(null), te(null), C(null));
375
- }, [c]), M(() => {
376
- var s;
377
- const e = _.current, r = !K && e.form || !$ && e.editingId !== null || !L && e.deleteId !== null;
378
- if (K || R(!1), $ || O(null), L || ee(null), r && !c && le.current) {
379
- const o = document.activeElement;
380
- if (!o || o === document.body || !!o.closest(
381
- '[data-calls-form],[data-calls-editor],[role="alertdialog"]'
382
- )) {
383
- const i = (s = F.current) == null ? void 0 : s.querySelector("h2");
384
- i && (i.setAttribute("tabindex", "-1"), i.focus({
385
- preventScroll: !0,
386
- focusVisible: !1
387
- }));
388
- }
389
- }
390
- }, [K, $, L]);
391
- const ke = ae(
392
- async (e, r = "ui") => {
393
- var s, o;
394
- if (!u.current) {
395
- u.current = !0, A.current = "create", B("create"), de(null), C(null);
396
- try {
397
- await ((s = z.current) == null ? void 0 : s.call(z, e)), g.current && (r === "ui" && R(!1), C("saved"));
398
- } catch (h) {
399
- throw g.current && de(ze(h, n("callsPanel.saveFailed"))), (o = S.current) == null || o.call(S, {
400
- kind: "create",
401
- error: h,
402
- shown: g.current && (r === "ui" || _.current.form)
403
- }), h;
404
- } finally {
405
- u.current = !1, A.current = null, g.current && B(null);
406
- }
407
- }
408
- },
409
- [n]
410
- ), Ee = ae(
411
- async (e, r, s = "ui") => {
412
- var o, h;
413
- if (!u.current) {
414
- u.current = !0, A.current = "update", B("update"), Q(null), C(null);
415
- try {
416
- await ((o = Y.current) == null ? void 0 : o.call(Y, e, { description: r })), g.current && (s === "ui" && (X.current = e, O(null)), C("updated"));
417
- } catch (i) {
418
- throw g.current && Q(ze(i, n("callsPanel.updateFailed"))), (h = S.current) == null || h.call(S, {
419
- kind: "update",
420
- id: e,
421
- error: i,
422
- shown: g.current && (s === "ui" || _.current.editingId === e)
423
- }), i;
424
- } finally {
425
- u.current = !1, A.current = null, g.current && B(null);
426
- }
427
- }
428
- },
429
- [n]
430
- ), De = ae(
431
- async (e, r = "ui") => {
432
- var s, o;
433
- if (!u.current) {
434
- u.current = !0, A.current = "delete", B("delete"), te(null), C(null), G.current = null;
435
- try {
436
- if (await ((s = U.current) == null ? void 0 : s.call(U, e)), g.current) {
437
- const h = _.current.deleteId === e;
438
- ee((i) => i === e ? null : i), O((i) => (i == null ? void 0 : i.id) === e ? null : i), h ? G.current = "deleted" : C("deleted");
439
- }
440
- } catch (h) {
441
- throw g.current && te(
442
- ze(h, n("callsPanel.deleteFailed"))
443
- ), (o = S.current) == null || o.call(S, {
444
- kind: "delete",
445
- id: e,
446
- error: h,
447
- shown: g.current && (r === "ui" || _.current.deleteId === e)
448
- }), h;
449
- } finally {
450
- u.current = !1, A.current = null, g.current && B(null);
451
- }
452
- }
453
- },
454
- [n]
455
- ), tt = () => {
456
- var e;
457
- if (!u.current) {
458
- if (!ge(I.date)) {
459
- Ie(!0), (e = We.current) == null || e.focus();
460
- return;
461
- }
462
- ke({
463
- dateIso: I.date.toISOString(),
464
- purposeId: I.purposeId || null,
465
- outcomeId: I.outcomeId || null,
466
- description: I.description.trim()
467
- }).catch(() => {
468
- });
469
- }
470
- }, rt = () => {
471
- if (!f || u.current) return;
472
- const e = f.text.trim();
473
- if (!e) {
474
- ue(!0);
475
- return;
476
- }
477
- Ee(f.id, e).catch(() => {
478
- });
479
- }, _t = (e) => {
480
- u.current || (Se.current = e.id, O({ id: e.id, text: e.description ?? "" }), Q(null), ue(!1), C(null));
481
- }, nt = () => {
482
- u.current || (X.current = (f == null ? void 0 : f.id) ?? null, O(null), Q(null), ue(!1));
483
- };
484
- M(() => {
485
- var r;
486
- if (f || !X.current) return;
487
- const e = (r = F.current) == null ? void 0 : r.querySelector(
488
- `[data-call-id="${CSS.escape(X.current)}"] [data-calls-edit]`
489
- );
490
- X.current = null, e == null || e.focus();
491
- }, [f, p]);
492
- const at = (e) => e.filter((r) => {
493
- var s;
494
- return ((s = r.source) == null ? void 0 : s.kind) === "integration";
495
- }).length, st = (e) => e.filter((r) => r.missed === !0 && r.direction !== "outgoing").length, ot = l({
496
- callCount: p.length,
497
- automaticCount: at(p),
498
- missedCount: st(p),
499
- status: w,
500
- formOpen: ie,
501
- privacy: c
502
- });
503
- ot.current = {
504
- callCount: c ? 0 : p.length,
505
- automaticCount: c ? 0 : at(p),
506
- missedCount: c ? 0 : st(p),
507
- status: w,
508
- formOpen: ie && K,
509
- privacy: c
510
- };
511
- const lt = l({ readOnly: V, privacy: c });
512
- lt.current = { readOnly: V, privacy: c };
513
- const Fe = l(p);
514
- Fe.current = p;
515
- const it = l({
516
- purposes: Z,
517
- outcomes: H
518
- });
519
- it.current = { purposes: Z, outcomes: H };
520
- const dt = l(Ne);
521
- dt.current = Ne;
522
- const Mt = fe(() => {
523
- const e = async (r, s) => {
524
- const o = lt.current;
525
- if (o.privacy) throw new Error("Calls are hidden by privacy mode.");
526
- if (o.readOnly) throw new Error("The panel is read-only.");
527
- if (!r) throw new Error(`The host gave the panel no way to ${s}.`);
528
- };
529
- return {
530
- getState: () => ({ ...ot.current }),
531
- openForm: async () => {
532
- await e(!!z.current, "log a call"), dt.current();
533
- },
534
- closeForm: async () => {
535
- if (A.current === "create")
536
- throw new Error("A call is being saved.");
537
- R(!1);
538
- },
539
- logCall: async (r) => {
540
- await e(!!z.current, "log a call");
541
- const s = new Date(r.dateIso);
542
- if (!ge(s)) throw new Error("The date is not a date.");
543
- const { purposes: o, outcomes: h } = it.current;
544
- if (r.purposeId && !o.some((i) => i.id === r.purposeId))
545
- throw new Error("That purpose is not offered.");
546
- if (r.outcomeId && !h.some((i) => i.id === r.outcomeId))
547
- throw new Error("That outcome is not offered.");
548
- if (u.current) throw new Error("A write is in progress.");
549
- await ke(
550
- {
551
- dateIso: s.toISOString(),
552
- purposeId: r.purposeId ?? null,
553
- outcomeId: r.outcomeId ?? null,
554
- description: (r.description ?? "").trim()
555
- },
556
- "agent"
557
- );
558
- },
559
- updateCall: async (r, s) => {
560
- if (await e(!!Y.current, "edit a call"), !Fe.current.some((o) => o.id === r))
561
- throw new Error("No call has that id.");
562
- if (!s.description.trim())
563
- throw new Error("The description is empty.");
564
- if (u.current) throw new Error("A write is in progress.");
565
- await Ee(r, s.description.trim(), "agent");
566
- },
567
- deleteCall: async (r) => {
568
- if (await e(!!U.current, "delete a call"), !Fe.current.some((s) => s.id === r))
569
- throw new Error("No call has that id.");
570
- if (u.current) throw new Error("A write is in progress.");
571
- await De(r, "agent");
572
- }
573
- };
574
- }, [ke, Ee, De]);
575
- Wt(or, Mt, a);
576
- const ct = l(!1);
577
- M(() => {
578
- const e = F.current;
579
- if (!e) return;
580
- const r = le.current && (!document.activeElement || document.activeElement === document.body);
581
- if (ct.current && !r || !r && !c && w !== "ready") return;
582
- ct.current = !0;
583
- const s = c || w !== "ready" ? null : Pe.current;
584
- if (s) {
585
- s.focus({ preventScroll: !0 });
586
- return;
587
- }
588
- const o = e.querySelector("h2");
589
- o && (o.setAttribute("tabindex", "-1"), o.focus({ preventScroll: !0, focusVisible: !1 }));
590
- }, [c, w]);
591
- const ut = {
592
- onFocusCapture: () => {
593
- le.current = !0;
594
- },
595
- onBlurCapture: (e) => {
596
- e.relatedTarget && (le.current = !1);
597
- }
598
- }, pt = w === "loading" ? n("callsPanel.loading") : x === "create" || x === "update" ? n("callsPanel.saving") : x === "delete" ? n("callsPanel.deleting") : Ce === "saved" ? n("callsPanel.saved") : Ce === "updated" ? n("callsPanel.updated") : Ce === "deleted" ? n("callsPanel.deleted") : "", [qt, Vt] = y("");
599
- if (M(() => {
600
- Vt(pt);
601
- }, [pt]), c)
602
- return /* @__PURE__ */ m(
603
- "section",
604
- {
605
- ref: F,
606
- "data-component": "calls-panel",
607
- "data-component-id": a,
608
- "data-privacy": "masked",
609
- "aria-labelledby": b ? void 0 : oe,
610
- "aria-label": b,
611
- className: [Et(), $e].filter(Boolean).join(" "),
612
- ...ut,
613
- ...Ze,
614
- children: [
615
- /* @__PURE__ */ t(
616
- It,
617
- {
618
- title: Ye,
619
- icon: /* @__PURE__ */ t(Me, { "aria-hidden": "true" }),
620
- headingId: b ? void 0 : oe,
621
- divider: !0
622
- }
623
- ),
624
- /* @__PURE__ */ t("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ t(
625
- je,
626
- {
627
- variant: "first-use",
628
- size: "sm",
629
- title: n("callsPanel.privacyTitle"),
630
- description: n("callsPanel.privacyDescription")
631
- }
632
- ) })
633
- ]
634
- }
635
- );
636
- let re;
637
- w === "loading" ? re = /* @__PURE__ */ t(
638
- "div",
639
- {
640
- "data-calls-state": "loading",
641
- className: "ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-sm)] ds:overflow-y-auto ds:p-[var(--spacing-md)]",
642
- "aria-hidden": "true",
643
- children: ["a", "b", "c"].map((e, r) => /* @__PURE__ */ m("div", { className: Dt(), children: [
644
- /* @__PURE__ */ t(_e, { variant: "text", size: "md", width: "60%", stagger: r }),
645
- /* @__PURE__ */ t(_e, { variant: "text", size: "sm", width: "90%", stagger: r }),
646
- /* @__PURE__ */ t(_e, { variant: "text", size: "sm", width: "40%", stagger: r })
647
- ] }, e))
648
- }
649
- ) : w === "error" ? re = /* @__PURE__ */ t(
650
- "div",
651
- {
652
- "data-calls-state": "error",
653
- className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
654
- children: /* @__PURE__ */ t(
655
- je,
656
- {
657
- variant: "error",
658
- size: "sm",
659
- title: n("callsPanel.errorTitle"),
660
- primaryAction: k ? { label: n("callsPanel.retry"), onClick: k } : void 0
661
- }
662
- )
663
- }
664
- ) : Je.length === 0 ? re = /* @__PURE__ */ t(
665
- "div",
666
- {
667
- "data-calls-state": "empty",
668
- className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
669
- children: /* @__PURE__ */ t(
670
- je,
671
- {
672
- variant: "first-use",
673
- size: "sm",
674
- title: n("callsPanel.emptyTitle"),
675
- description: n("callsPanel.emptyDescription")
676
- }
677
- )
678
- }
679
- ) : re = /* @__PURE__ */ t("div", { className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ t(
680
- "ul",
681
- {
682
- "aria-label": n("callsPanel.listLabel"),
683
- className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0",
684
- children: Je.map((e) => {
685
- var gt, vt, yt, wt, bt, Pt;
686
- const r = xe(e.dateIso), s = Qe(H, e.outcomeId), o = Qe(Z, e.purposeId), h = ((gt = H.find((v) => v.id === e.outcomeId)) == null ? void 0 : gt.tone) ?? Lt[e.outcomeId ?? ""] ?? "neutral", i = (f == null ? void 0 : f.id) === e.id, mt = (e.description ?? "").trim(), Ut = e.missed === !0 && e.direction !== "outgoing", Ae = typeof e.durationSeconds == "number" && Number.isFinite(e.durationSeconds) && e.durationSeconds >= 0 ? ir(e.durationSeconds, be) : void 0, Re = (vt = e.phoneNumber) != null && vt.trim() ? tr(e.phoneNumber.trim()) : void 0, Oe = (yt = e.handledBy) == null ? void 0 : yt.trim(), Gt = ((wt = e.source) == null ? void 0 : wt.kind) === "integration", ft = (Pt = (bt = e.source) == null ? void 0 : bt.name) == null ? void 0 : Pt.trim(), Ke = Ft(e.recordingHref), Le = Ft(e.transcriptHref), ht = `${Bt}-edit-${e.id}`, He = `${ht}-msg`;
687
- return /* @__PURE__ */ m(
688
- "li",
689
- {
690
- "data-call-id": e.id,
691
- "data-outcome": e.outcomeId || void 0,
692
- className: Dt(),
693
- children: [
694
- /* @__PURE__ */ m("div", { className: "ds:flex ds:min-w-0 ds:items-start ds:gap-[var(--spacing-xs)]", children: [
695
- /* @__PURE__ */ m("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-2xs)] ds:py-[var(--spacing-xs)]", children: [
696
- /* @__PURE__ */ t(
697
- "time",
698
- {
699
- dateTime: e.dateIso,
700
- className: "type-body-sm ds:font-semibold ds:text-[color:var(--foreground)]",
701
- children: r
702
- }
703
- ),
704
- Ut ? /* @__PURE__ */ t(
705
- Be,
706
- {
707
- status: "missed",
708
- label: n("callsPanel.missedCall"),
709
- "data-calls-direction": "missed"
710
- }
711
- ) : e.direction ? /* @__PURE__ */ t(
712
- Be,
713
- {
714
- status: e.direction,
715
- label: e.direction === "incoming" ? n("callsPanel.incoming") : n("callsPanel.outgoing"),
716
- "data-calls-direction": e.direction
717
- }
718
- ) : null,
719
- s ? /* @__PURE__ */ t(
720
- Be,
721
- {
722
- status: lr.has(e.outcomeId ?? "") ? e.outcomeId : "custom",
723
- label: s,
724
- tone: h,
725
- "data-calls-outcome": ""
726
- }
727
- ) : null,
728
- o ? /* @__PURE__ */ t(
729
- "span",
730
- {
731
- "data-calls-purpose": "",
732
- className: "type-meta ds:min-w-0 ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
733
- children: o
734
- }
735
- ) : null
736
- ] }),
737
- !i && ($ || L) ? /* @__PURE__ */ m("div", { className: "ds:-me-[var(--spacing-xs)] ds:flex ds:shrink-0 ds:items-center", children: [
738
- $ ? /* @__PURE__ */ t(
739
- xt,
740
- {
741
- "data-calls-edit": "",
742
- icon: /* @__PURE__ */ t(ar, {}),
743
- intent: "ghost",
744
- "aria-label": n("callsPanel.editNamed", {
745
- date: r
746
- }),
747
- tooltip: n("callsPanel.edit"),
748
- "aria-disabled": x ? !0 : void 0,
749
- onClick: () => _t(e)
750
- }
751
- ) : null,
752
- L ? /* @__PURE__ */ t(
753
- xt,
754
- {
755
- "data-calls-delete": "",
756
- icon: /* @__PURE__ */ t(kt, {}),
757
- intent: "ghost",
758
- "aria-label": n("callsPanel.deleteNamed", {
759
- date: r
760
- }),
761
- tooltip: n("callsPanel.delete"),
762
- "aria-disabled": x ? !0 : void 0,
763
- onClick: () => {
764
- u.current || (te(null), C(null), Te.current = e.id, ee(e.id));
765
- }
766
- }
767
- ) : null
768
- ] }) : null
769
- ] }),
770
- i && f ? /* @__PURE__ */ m(
771
- "div",
772
- {
773
- "data-calls-editor": "",
774
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
775
- children: [
776
- /* @__PURE__ */ t(
777
- Tt,
778
- {
779
- id: ht,
780
- "aria-label": n("callsPanel.editLabel", { date: r }),
781
- value: f.text,
782
- minRows: 3,
783
- autoResize: !0,
784
- ref: (v) => {
785
- v && Se.current === e.id && (Se.current = null, v.focus());
786
- },
787
- tone: ce || J ? "error" : "default",
788
- "aria-invalid": ce || !!J || void 0,
789
- "aria-describedby": ce || J ? He : void 0,
790
- onChange: (v) => {
791
- O({ id: e.id, text: v.target.value }), ue(!1);
792
- },
793
- onKeyDown: (v) => {
794
- v.key === "Enter" && (v.ctrlKey || v.metaKey) && f.text.trim() ? (v.preventDefault(), rt()) : v.key === "Escape" && (v.preventDefault(), v.stopPropagation(), nt());
795
- }
796
- }
797
- ),
798
- ce ? /* @__PURE__ */ t(
799
- "p",
800
- {
801
- id: He,
802
- role: "alert",
803
- "data-calls-edit-error": "",
804
- className: "ds:m-0 type-meta ds:text-[color:var(--destructive)]",
805
- children: n("callsPanel.editRequired")
806
- }
807
- ) : null,
808
- J ? /* @__PURE__ */ t(q, { variant: "error", "data-calls-edit-refused": "", children: /* @__PURE__ */ t(q.Description, { id: He, children: J }) }) : null,
809
- /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]", children: [
810
- /* @__PURE__ */ t(
811
- D,
812
- {
813
- type: "button",
814
- intent: "outline",
815
- size: "sm",
816
- "aria-disabled": x ? !0 : void 0,
817
- onClick: nt,
818
- children: n("callsPanel.editCancel")
819
- }
820
- ),
821
- /* @__PURE__ */ t(
822
- D,
823
- {
824
- type: "button",
825
- size: "sm",
826
- "aria-disabled": x ? !0 : void 0,
827
- "aria-busy": x === "update" || void 0,
828
- onClick: rt,
829
- children: n(x === "update" ? "callsPanel.saving" : "callsPanel.editSave")
830
- }
831
- )
832
- ] })
833
- ]
834
- }
835
- ) : mt ? /* @__PURE__ */ t(dr, { text: mt }) : /* @__PURE__ */ t("p", { className: "ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]", children: n("callsPanel.noDescription") }),
836
- Ae || Re || Oe ? /* @__PURE__ */ m(
837
- "div",
838
- {
839
- "data-calls-details": "",
840
- className: "ds:flex ds:min-w-0 ds:flex-wrap ds:items-baseline ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-2xs)] type-meta ds:text-[color:var(--muted-foreground)]",
841
- children: [
842
- Ae ? /* @__PURE__ */ t("span", { "data-calls-duration": "", children: Ae }) : null,
843
- Re ? /* @__PURE__ */ t(
844
- "span",
845
- {
846
- "data-calls-phone": "",
847
- dir: "ltr",
848
- className: "ds:[overflow-wrap:anywhere]",
849
- children: Re
850
- }
851
- ) : null,
852
- Oe ? /* @__PURE__ */ t(
853
- "span",
854
- {
855
- "data-calls-handled-by": "",
856
- className: "ds:[overflow-wrap:anywhere]",
857
- children: n("callsPanel.takenBy", { name: Oe })
858
- }
859
- ) : null
860
- ]
861
- }
862
- ) : null,
863
- Gt ? /* @__PURE__ */ t(
864
- "p",
865
- {
866
- "data-calls-source": "",
867
- className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
868
- children: ft ? n("callsPanel.loggedAutomaticallyBy", {
869
- app: ft
870
- }) : n("callsPanel.loggedAutomatically")
871
- }
872
- ) : null,
873
- Ke || Le ? /* @__PURE__ */ m(
874
- "div",
875
- {
876
- "data-calls-links": "",
877
- className: "ds:flex ds:min-w-0 ds:flex-wrap ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-2xs)] type-meta",
878
- children: [
879
- Ke ? /* @__PURE__ */ t(Ct, { href: Ke, external: !0, children: n("callsPanel.recording") }) : null,
880
- Le ? /* @__PURE__ */ t(Ct, { href: Le, external: !0, children: n("callsPanel.transcript") }) : null
881
- ]
882
- }
883
- ) : null,
884
- e.createdAtIso ? /* @__PURE__ */ t("p", { className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)]", children: n("callsPanel.addedOn", {
885
- date: xe(e.createdAtIso)
886
- }) }) : null
887
- ]
888
- },
889
- e.id
890
- );
891
- })
892
- }
893
- ) });
894
- const me = x === "create", $t = jt && !ge(I.date) ? n("callsPanel.dateRequired") : void 0, Zt = /* @__PURE__ */ m(Jt, { children: [
895
- /* @__PURE__ */ t(
896
- D,
897
- {
898
- type: "button",
899
- intent: "outline",
900
- "aria-disabled": me || void 0,
901
- onClick: () => {
902
- u.current || R(!1);
903
- },
904
- children: n("callsPanel.cancel")
905
- }
906
- ),
907
- /* @__PURE__ */ t(
908
- D,
909
- {
910
- type: "button",
911
- "aria-disabled": me || void 0,
912
- "aria-busy": me || void 0,
913
- onClick: tt,
914
- children: n(me ? "callsPanel.saving" : "callsPanel.save")
915
- }
916
- )
917
- ] }), Yt = pe ? xe(pe.dateIso) : "", ne = x === "delete";
918
- return /* @__PURE__ */ m(
919
- "section",
920
- {
921
- ref: F,
922
- "data-component": "calls-panel",
923
- "data-component-id": a,
924
- "aria-labelledby": b ? void 0 : oe,
925
- "aria-label": b,
926
- className: [Et(), $e].filter(Boolean).join(" "),
927
- ...ut,
928
- ...Ze,
929
- children: [
930
- /* @__PURE__ */ m(Nt.Host, { className: "ds:flex-1", children: [
931
- /* @__PURE__ */ t(
932
- It,
933
- {
934
- title: Ye,
935
- icon: /* @__PURE__ */ t(Me, { "aria-hidden": "true" }),
936
- headingId: b ? void 0 : oe,
937
- divider: !0
938
- }
939
- ),
940
- /* @__PURE__ */ t("span", { role: "status", className: "ds:sr-only", children: qt }),
941
- K && w === "ready" ? /* @__PURE__ */ t("div", { className: "ds:shrink-0 ds:px-[var(--spacing-md)] ds:pt-[var(--spacing-md)]", children: /* @__PURE__ */ t(
942
- D,
943
- {
944
- ref: Pe,
945
- type: "button",
946
- className: "ds:w-full",
947
- startIcon: /* @__PURE__ */ t(sr, { "aria-hidden": "true" }),
948
- onClick: Ne,
949
- children: n("callsPanel.logCall")
950
- }
951
- ) }) : null,
952
- re,
953
- K ? /* @__PURE__ */ t(
954
- Nt,
955
- {
956
- ref: Ue,
957
- open: ie,
958
- title: n("callsPanel.formTitle"),
959
- icon: /* @__PURE__ */ t(Me, { "aria-hidden": "true" }),
960
- backLabel: n("callsPanel.back"),
961
- headingLevel: 2,
962
- initialFocusRef: We,
963
- onBack: () => {
964
- u.current || R(!1);
965
- },
966
- footer: Zt,
967
- "data-calls-form": "",
968
- children: /* @__PURE__ */ m("div", { className: "ds:-m-[var(--panel-subview-inset)] ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
969
- Xe ? /* @__PURE__ */ t(q, { variant: "error", "data-calls-form-error": "", children: /* @__PURE__ */ t(q.Description, { children: Xe }) }) : null,
970
- /* @__PURE__ */ t("div", { "data-calls-date": "", children: /* @__PURE__ */ t(
971
- he,
972
- {
973
- label: n("callsPanel.dateLabel"),
974
- required: !0,
975
- error: $t,
976
- children: /* @__PURE__ */ t(
977
- nr,
978
- {
979
- value: I.date,
980
- onChange: (e) => {
981
- j((r) => ({ ...r, date: e })), e && Ie(!1);
982
- }
983
- }
984
- )
985
- }
986
- ) }),
987
- Z.length > 0 ? /* @__PURE__ */ t(he, { label: n("callsPanel.purposeLabel"), optional: !0, children: /* @__PURE__ */ t(
988
- St,
989
- {
990
- options: Z.map((e) => ({
991
- value: e.id,
992
- label: e.label
993
- })),
994
- value: I.purposeId,
995
- placeholder: n("callsPanel.notSet"),
996
- clearable: !0,
997
- onValueChange: (e) => j((r) => ({ ...r, purposeId: e }))
998
- }
999
- ) }) : null,
1000
- H.length > 0 ? /* @__PURE__ */ t(he, { label: n("callsPanel.outcomeLabel"), optional: !0, children: /* @__PURE__ */ t(
1001
- St,
1002
- {
1003
- options: H.map((e) => ({
1004
- value: e.id,
1005
- label: e.label
1006
- })),
1007
- value: I.outcomeId,
1008
- placeholder: n("callsPanel.notSet"),
1009
- clearable: !0,
1010
- onValueChange: (e) => j((r) => ({ ...r, outcomeId: e }))
1011
- }
1012
- ) }) : null,
1013
- /* @__PURE__ */ t(he, { label: n("callsPanel.descriptionLabel"), optional: !0, children: /* @__PURE__ */ t(
1014
- Tt,
1015
- {
1016
- value: I.description,
1017
- placeholder: n("callsPanel.descriptionPlaceholder"),
1018
- minRows: 4,
1019
- autoResize: !0,
1020
- onChange: (e) => j((r) => ({ ...r, description: e.target.value })),
1021
- onKeyDown: (e) => {
1022
- e.key === "Enter" && (e.ctrlKey || e.metaKey) && I.description.trim() && (e.preventDefault(), tt());
1023
- }
1024
- }
1025
- ) })
1026
- ] })
1027
- }
1028
- ) : null
1029
- ] }),
1030
- L ? /* @__PURE__ */ t(
1031
- E,
1032
- {
1033
- open: !!pe,
1034
- onOpenChange: (e) => {
1035
- ne || e || (ee(null), te(null));
1036
- },
1037
- children: /* @__PURE__ */ m(
1038
- E.Content,
1039
- {
1040
- size: "sm",
1041
- variant: "alert",
1042
- onCloseAutoFocus: (e) => {
1043
- e.preventDefault(), G.current && (C(G.current), G.current = null);
1044
- const r = F.current, s = (Te.current ? r == null ? void 0 : r.querySelector(
1045
- `[data-call-id="${CSS.escape(Te.current)}"] [data-calls-delete]`
1046
- ) : null) ?? Pe.current ?? (r == null ? void 0 : r.querySelector("h2"));
1047
- s && (s.tagName === "H2" && s.setAttribute("tabindex", "-1"), s.focus({ preventScroll: !0 }));
1048
- },
1049
- children: [
1050
- /* @__PURE__ */ m(E.Header, { children: [
1051
- /* @__PURE__ */ t(E.Title, { children: n("callsPanel.deleteTitle") }),
1052
- /* @__PURE__ */ t(E.Description, { children: n("callsPanel.deleteBody", { date: Yt }) })
1053
- ] }),
1054
- et ? /* @__PURE__ */ t(E.Body, { children: /* @__PURE__ */ t(q, { variant: "error", "data-calls-delete-error": "", children: /* @__PURE__ */ t(q.Description, { children: et }) }) }) : null,
1055
- /* @__PURE__ */ m(E.Footer, { divider: !0, children: [
1056
- /* @__PURE__ */ t(E.Close, { asChild: !0, children: /* @__PURE__ */ t(
1057
- D,
1058
- {
1059
- intent: "outline",
1060
- "aria-disabled": ne || void 0,
1061
- children: n("callsPanel.deleteCancel")
1062
- }
1063
- ) }),
1064
- /* @__PURE__ */ t(
1065
- D,
1066
- {
1067
- intent: "destructive",
1068
- startIcon: /* @__PURE__ */ t(kt, { "aria-hidden": "true" }),
1069
- "aria-disabled": ne || void 0,
1070
- "aria-busy": ne || void 0,
1071
- onClick: () => {
1072
- W && !u.current && De(W).catch(() => {
1073
- });
1074
- },
1075
- children: n(ne ? "callsPanel.deleting" : "callsPanel.deleteConfirm")
1076
- }
1077
- )
1078
- ] })
1079
- ]
1080
- }
1081
- )
1082
- }
1083
- ) : null
1084
- ]
1085
- }
1086
- );
1087
- }
1088
- );
1089
- cr.displayName = "CallsPanel";
1090
- export {
1091
- cr as C,
1092
- or as c
1093
- };
1094
- //# sourceMappingURL=calls-panel-CtxJAzkJ.js.map