@alfadocs/ui-kit 1.135.0 → 1.137.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 (216) hide show
  1. package/dist/_chunks/{ai-prompt-input-JIPbrTF3.js → ai-prompt-input-CVNeusoW.js} +2 -2
  2. package/dist/_chunks/ai-summary-panel-BhCo2vZF.js +1045 -0
  3. package/dist/_chunks/{alia-sidebar-CtwhdASP.js → alia-sidebar-CVBlKur9.js} +3 -3
  4. package/dist/_chunks/{anamnesis-summary-rows-CCNmkq55.js → anamnesis-summary-rows-Dr2V1Rtf.js} +3 -3
  5. package/dist/_chunks/appointment-details-panel.history-DrIMDQYf.js +314 -0
  6. package/dist/_chunks/appointment-details-panel.identity-C20Y9xNC.js +223 -0
  7. package/dist/_chunks/{audio-recorder-CsnM_WDy.js → audio-recorder-BOF5YYoC.js} +2 -2
  8. package/dist/_chunks/{balance-badge-cell-DTiMdnCZ.js → balance-badge-cell-BSB02Bwo.js} +4 -4
  9. package/dist/_chunks/{bill-line-table-DHKb_O7c.js → bill-line-table-By-YL2ms.js} +2 -2
  10. package/dist/_chunks/{bishop-score-CKztphVz.js → bishop-score-DWGESRP9.js} +2 -2
  11. package/dist/_chunks/calendar-appointment-editor-dialog-D0n_bVsT.js +5518 -0
  12. package/dist/_chunks/calendar-editor-discard-host-1UfmMOEb.js +1336 -0
  13. package/dist/_chunks/calendar-editor-guard-9fShhNIA.js +31 -0
  14. package/dist/_chunks/calendar-waiting-list-panel-Ckd6tSeu.js +981 -0
  15. package/dist/_chunks/calendar-workspace.model-DrOoxY1b.js +1557 -0
  16. package/dist/_chunks/calendar.sheets-Datc0-IT.js +4585 -0
  17. package/dist/_chunks/call-status-chip-pajxN5eZ.js +180 -0
  18. package/dist/_chunks/calls-panel-BIfatK90.js +1094 -0
  19. package/dist/_chunks/{chat-input-CX4dxBq7.js → chat-input-BmvnuZqj.js} +114 -109
  20. package/dist/_chunks/{chat-message-CfIyXrxA.js → chat-message-B4TMeZ2m.js} +35 -30
  21. package/dist/_chunks/circle-x-W8Enq3i4.js +16 -0
  22. package/dist/_chunks/color-picker-CC8ZfntU.js +582 -0
  23. package/dist/_chunks/communications-panel-SQ-55e3V.js +1079 -0
  24. package/dist/_chunks/{data-grid-B2oaI7Lt.js → data-grid-CxKz8flO.js} +2 -2
  25. package/dist/_chunks/{data-table-FTV3uRjX.js → data-table-_tgj0C_T.js} +2 -2
  26. package/dist/_chunks/{default-tabs-DbebYO04.js → default-tabs-oDWQzbN7.js} +3 -3
  27. package/dist/_chunks/{document-preview-DLVIrOYV.js → document-preview-CirR3C_m.js} +3 -3
  28. package/dist/_chunks/entity-summary-CPUHzyil.js +297 -0
  29. package/dist/_chunks/{file-manager-Bzr5NK1t.js → file-manager-CEi4z2i0.js} +2 -2
  30. package/dist/_chunks/{fiscal-code-input-BBvU7sAo.js → fiscal-code-input-DZlpaMGg.js} +2 -2
  31. package/dist/_chunks/{gestational-age-calculator-mB6brTlp.js → gestational-age-calculator-CHbpC4vL.js} +2 -2
  32. package/dist/_chunks/{heatmap-C5gJin_F.js → heatmap-_546qI2V.js} +2 -2
  33. package/dist/_chunks/{iban-input-DuTwKok5.js → iban-input-CdSLRzQN.js} +2 -2
  34. package/dist/_chunks/{invoice-upload-list-B5aMffTy.js → invoice-upload-list-CQI9MUl6.js} +3 -3
  35. package/dist/_chunks/{kit-extensions-DUaIYyMD.js → kit-extensions-BNBf4m8O.js} +3 -3
  36. package/dist/_chunks/{link-cell-renderer-D3JLPURZ.js → link-cell-renderer-Xx5T8u5Q.js} +3 -3
  37. package/dist/_chunks/list-todo-KWvUhmT_.js +33 -0
  38. package/dist/_chunks/{muscle-scheme-BGJD62op.js → muscle-scheme-D_rSyGDj.js} +2 -2
  39. package/dist/_chunks/{notes-panel-BvjAo4RQ.js → notes-panel-DsEKNtsw.js} +2 -2
  40. package/dist/_chunks/{optical-prescription-Da_r8pMr.js → optical-prescription-DaSbsh4p.js} +2 -2
  41. package/dist/_chunks/palettes-CKVXYTzo.js +172 -0
  42. package/dist/_chunks/{patient-account-settings-B2XbN_Fe.js → patient-account-settings-COybehKx.js} +3 -3
  43. package/dist/_chunks/{patient-card-DTh3QTyS.js → patient-card-Cpr8iD19.js} +4 -4
  44. package/dist/_chunks/{patient-check-in-resume-B7NY-6KI.js → patient-check-in-resume-DZnyYDKH.js} +40 -40
  45. package/dist/_chunks/{patient-details-DBtEITfE.js → patient-details-Dv7EiTCo.js} +2 -2
  46. package/dist/_chunks/{patient-field-row-a5d4QijH.js → patient-field-row-DuHWGlLz.js} +3 -3
  47. package/dist/_chunks/patient-picker-BZJuOgMw.js +173 -0
  48. package/dist/_chunks/{patient-sign-in-pin-CDBqV254.js → patient-sign-in-pin-DmMBwWet.js} +2 -2
  49. package/dist/_chunks/{patient-sign-in-steps-C2JSqlok.js → patient-sign-in-steps-BKcxNkdY.js} +37 -59
  50. package/dist/_chunks/{patient-summary-card-Bl2NknPe.js → patient-summary-card-D-cDzOim.js} +2 -2
  51. package/dist/_chunks/phone-off-DQSTLz4l.js +28 -0
  52. package/dist/_chunks/{portal-details-DCIiGkHA.js → portal-details-DdzvroYP.js} +2 -2
  53. package/dist/_chunks/{portal-documents-DJOH8pZx.js → portal-documents-CNmoYWFc.js} +3 -3
  54. package/dist/_chunks/{pregnancy-dating-BNI32qNw.js → pregnancy-dating-lJbzai73.js} +2 -2
  55. package/dist/_chunks/{privacy-mask-C19dJFMk.js → privacy-mask-C2ZLKrMh.js} +5 -5
  56. package/dist/_chunks/{registration-form-DS3RuKHu.js → registration-form-CuLiTA52.js} +2 -2
  57. package/dist/_chunks/{reserved.agent-DOzOBUW7.js → reserved.agent-CabZHFJC.js} +2 -2
  58. package/dist/_chunks/{rich-text-editor-DjHL1b3E.js → rich-text-editor-C48omVjq.js} +2 -2
  59. package/dist/_chunks/{select-uESzXTX6.js → select-CIXKyUMw.js} +172 -149
  60. package/dist/_chunks/{session-countdown-DOx1IBUB.js → session-countdown-StcyUU5O.js} +56 -66
  61. package/dist/_chunks/{signature-request-CHsM_iWi.js → signature-request-vJDSHZld.js} +2 -2
  62. package/dist/_chunks/{tabs-CRIDBLP7.js → tabs-Czkmw5ou.js} +2 -2
  63. package/dist/_chunks/task-editor-wKbFbGqW.js +1093 -0
  64. package/dist/_chunks/{tasks-panel-6EzdnwT8.js → tasks-panel-DbtJS4QI.js} +2 -2
  65. package/dist/_chunks/{toolbar-CfdoJzMV.js → toolbar-DjG-cpD_.js} +2 -2
  66. package/dist/_chunks/{unit-converter-YKlHyUC2.js → unit-converter-CUAUTu2B.js} +2 -2
  67. package/dist/_chunks/use-appointment-details-read-jGkJalX8.js +1966 -0
  68. package/dist/_chunks/{voice-control-panel-Be_c0CQ0.js → voice-control-panel-Cp4vs1iy.js} +2 -2
  69. package/dist/agent-catalog.json +282 -6
  70. package/dist/agent-i18n/en.json +26 -4
  71. package/dist/appointment-editor-panel/index.js +100 -0
  72. package/dist/booking-tools-data/index.js +82 -0
  73. package/dist/browser-support.js +1 -1
  74. package/dist/calendar-action-buttons/index.js +178 -0
  75. package/dist/components/ai-prompt-input/index.js +1 -1
  76. package/dist/components/ai-summary-panel/ai-summary-panel.d.ts +68 -5
  77. package/dist/components/ai-summary-panel/index.d.ts +1 -1
  78. package/dist/components/ai-summary-panel/index.js +1 -1
  79. package/dist/components/ai-summary-panel/summary-markdown.d.ts +15 -0
  80. package/dist/components/appointment-details-panel/index.js +6 -5
  81. package/dist/components/audio-recorder/index.js +1 -1
  82. package/dist/components/bill-line-table/index.js +1 -1
  83. package/dist/components/bill-table/index.js +1 -1
  84. package/dist/components/bishop-score/index.js +1 -1
  85. package/dist/components/booking/index.js +1 -1
  86. package/dist/components/call-status-chip/call-status-chip.d.ts +30 -0
  87. package/dist/components/call-status-chip/index.d.ts +3 -0
  88. package/dist/components/call-status-chip/index.js +5 -0
  89. package/dist/components/calls-panel/calls-panel.agent.d.ts +4 -0
  90. package/dist/components/calls-panel/calls-panel.d.ts +153 -0
  91. package/dist/components/calls-panel/index.d.ts +4 -0
  92. package/dist/components/calls-panel/index.js +6 -0
  93. package/dist/components/chat-input/chat-input.d.ts +17 -0
  94. package/dist/components/chat-input/index.js +1 -1
  95. package/dist/components/chat-message/index.js +1 -1
  96. package/dist/components/color-picker/index.js +5 -4
  97. package/dist/components/communications-panel/communications-panel.d.ts +15 -3
  98. package/dist/components/communications-panel/index.js +1 -1
  99. package/dist/components/data-grid/index.js +2 -2
  100. package/dist/components/data-table/index.js +2 -2
  101. package/dist/components/document-preview/index.js +1 -1
  102. package/dist/components/entity-summary/entity-summary.d.ts +29 -1
  103. package/dist/components/entity-summary/index.js +1 -1
  104. package/dist/components/file-manager/index.js +1 -1
  105. package/dist/components/fiscal-code-input/index.js +1 -1
  106. package/dist/components/gestational-age-calculator/index.js +1 -1
  107. package/dist/components/heatmap/index.js +1 -1
  108. package/dist/components/iban-input/index.js +1 -1
  109. package/dist/components/index.d.ts +2 -0
  110. package/dist/components/invoice-upload-list/index.js +1 -1
  111. package/dist/components/muscle-scheme/index.js +1 -1
  112. package/dist/components/notes-panel/index.js +1 -1
  113. package/dist/components/optical-prescription/index.js +1 -1
  114. package/dist/components/patient-details/index.js +1 -1
  115. package/dist/components/patient-summary-card/index.js +1 -1
  116. package/dist/components/patient-table/index.js +1 -1
  117. package/dist/components/pregnancy-dating/index.js +1 -1
  118. package/dist/components/rich-text-editor/index.js +2 -2
  119. package/dist/components/select/index.js +1 -1
  120. package/dist/components/select/select.d.ts +8 -0
  121. package/dist/components/session-countdown/index.js +1 -1
  122. package/dist/components/skeleton-scheme/index.js +1 -1
  123. package/dist/components/tabs/index.js +1 -1
  124. package/dist/components/task-editor/index.js +1 -1
  125. package/dist/components/tasks-panel/index.js +1 -1
  126. package/dist/components/unit-converter/index.js +1 -1
  127. package/dist/components/voice-control-panel/index.js +1 -1
  128. package/dist/core.css +1 -1
  129. package/dist/find-free-slots-panel/index.js +58 -0
  130. package/dist/host-compat.css +4 -1
  131. package/dist/i18n/locales/ar.d.ts +72 -3
  132. package/dist/i18n/locales/ar.js +74 -5
  133. package/dist/i18n/locales/de.d.ts +72 -3
  134. package/dist/i18n/locales/de.js +74 -5
  135. package/dist/i18n/locales/el.d.ts +72 -3
  136. package/dist/i18n/locales/el.js +74 -5
  137. package/dist/i18n/locales/en.d.ts +72 -3
  138. package/dist/i18n/locales/en.js +73 -4
  139. package/dist/i18n/locales/es.d.ts +72 -3
  140. package/dist/i18n/locales/es.js +74 -5
  141. package/dist/i18n/locales/fr.d.ts +72 -3
  142. package/dist/i18n/locales/fr.js +74 -5
  143. package/dist/i18n/locales/hi.d.ts +72 -3
  144. package/dist/i18n/locales/hi.js +74 -5
  145. package/dist/i18n/locales/it.d.ts +83 -14
  146. package/dist/i18n/locales/it.js +84 -15
  147. package/dist/i18n/locales/ja.d.ts +72 -3
  148. package/dist/i18n/locales/ja.js +74 -5
  149. package/dist/i18n/locales/nl.d.ts +72 -3
  150. package/dist/i18n/locales/nl.js +74 -5
  151. package/dist/i18n/locales/pl.d.ts +72 -3
  152. package/dist/i18n/locales/pl.js +74 -5
  153. package/dist/i18n/locales/pt.d.ts +72 -3
  154. package/dist/i18n/locales/pt.js +74 -5
  155. package/dist/i18n/locales/ro.d.ts +72 -3
  156. package/dist/i18n/locales/ro.js +74 -5
  157. package/dist/i18n/locales/ru.d.ts +72 -3
  158. package/dist/i18n/locales/ru.js +74 -5
  159. package/dist/i18n/locales/sq.d.ts +72 -3
  160. package/dist/i18n/locales/sq.js +74 -5
  161. package/dist/i18n/locales/sv.d.ts +72 -3
  162. package/dist/i18n/locales/sv.js +74 -5
  163. package/dist/i18n/locales/tr.d.ts +72 -3
  164. package/dist/i18n/locales/tr.js +74 -5
  165. package/dist/i18n/locales/zh.d.ts +72 -3
  166. package/dist/i18n/locales/zh.js +74 -5
  167. package/dist/index.js +1329 -1318
  168. package/dist/locales/ar.json +74 -5
  169. package/dist/locales/de.json +74 -5
  170. package/dist/locales/el.json +74 -5
  171. package/dist/locales/en.json +73 -4
  172. package/dist/locales/es.json +74 -5
  173. package/dist/locales/fr.json +74 -5
  174. package/dist/locales/hi.json +74 -5
  175. package/dist/locales/it.json +84 -15
  176. package/dist/locales/ja.json +74 -5
  177. package/dist/locales/nl.json +74 -5
  178. package/dist/locales/pl.json +74 -5
  179. package/dist/locales/pt.json +74 -5
  180. package/dist/locales/ro.json +74 -5
  181. package/dist/locales/ru.json +74 -5
  182. package/dist/locales/sq.json +74 -5
  183. package/dist/locales/sv.json +74 -5
  184. package/dist/locales/tr.json +74 -5
  185. package/dist/locales/zh.json +74 -5
  186. package/dist/online-bookings-panel/index.js +69 -0
  187. package/dist/patterns/alia-assistant/index.js +1 -1
  188. package/dist/patterns/anamnesis/index.js +1 -1
  189. package/dist/patterns/calendar/booking-tools/appointment-editor-panel.d.ts +46 -0
  190. package/dist/patterns/calendar/booking-tools/booking-tools-data.d.ts +48 -0
  191. package/dist/patterns/calendar/booking-tools/calendar-action-buttons.d.ts +55 -0
  192. package/dist/patterns/calendar/booking-tools/find-free-slots-panel.d.ts +35 -0
  193. package/dist/patterns/calendar/booking-tools/online-bookings-panel.d.ts +61 -0
  194. package/dist/patterns/calendar/booking-tools/waiting-list-panel.d.ts +58 -0
  195. package/dist/patterns/calendar/calendar-editor-discard-host.d.ts +20 -0
  196. package/dist/patterns/calendar/calendar-print-sheet.d.ts +16 -0
  197. package/dist/patterns/calendar/calendar-workspace.model.d.ts +7 -0
  198. package/dist/patterns/calendar/calendar.model.d.ts +9 -0
  199. package/dist/patterns/calendar/calendar.sheets.d.ts +59 -17
  200. package/dist/patterns/calendar/index.js +24 -20
  201. package/dist/patterns/patient-account-settings/index.js +1 -1
  202. package/dist/patterns/patient-check-in/index.js +1 -1
  203. package/dist/patterns/patient-portal/index.js +2 -2
  204. package/dist/patterns/patient-sign-in/index.js +2 -2
  205. package/dist/patterns/registration-form/index.js +1 -1
  206. package/dist/patterns/signature-request/index.js +1 -1
  207. package/dist/tokens.css +1 -1
  208. package/dist/waiting-list-panel/index.js +158 -0
  209. package/package.json +35 -2
  210. package/dist/_chunks/ai-summary-panel-B70S2lgC.js +0 -455
  211. package/dist/_chunks/calendar-appointment-editor-dialog-I5PfWudy.js +0 -13773
  212. package/dist/_chunks/color-picker-AcaWuKah.js +0 -745
  213. package/dist/_chunks/communications-panel-BKPHCiMB.js +0 -973
  214. package/dist/_chunks/entity-summary-CpNk6ybN.js +0 -266
  215. package/dist/_chunks/task-editor-DvwqPfFR.js +0 -1257
  216. package/dist/_chunks/use-appointment-details-read-6_OmOwUs.js +0 -2476
@@ -1,973 +0,0 @@
1
- import { jsx as t, jsxs as f, Fragment as vn } from "react/jsx-runtime";
2
- import { forwardRef as wn, useId as Ue, useRef as p, useImperativeHandle as bn, useState as k, useEffect as T, useMemo as D, useCallback as Ve } from "react";
3
- import { c as xn } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Je } from "react-i18next";
5
- import { u as Sn } from "./registry-DvAUVLHh.js";
6
- import { g as kn } from "./get-error-message-DbFUzuja.js";
7
- import { SafeHtml as Pn } from "../safe-html/index.js";
8
- import { A as V } from "./alert-C4WKViaS.js";
9
- import { B as W } from "./badge-BUk4RjTS.js";
10
- import { B as q } from "./button-DohK_Ak_.js";
11
- import { C as Tn } from "./chat-container-CoOT7dzB.js";
12
- import { C as Nn } from "./chat-input-CX4dxBq7.js";
13
- import { C as Cn } from "./chat-message-CfIyXrxA.js";
14
- import { E as ce } from "./empty-state-DwJ5YNzz.js";
15
- import { P as We } from "./panel-header-CbtlTe85.js";
16
- import { S as Mn } from "./select-uESzXTX6.js";
17
- import { S as Xe } from "./skeleton-tTWJpvAq.js";
18
- import { T as An } from "./timestamp-DPLDWdxA.js";
19
- import { a as me } from "./whatsapp-button-XbozeDl_.js";
20
- import { M as qe } from "./message-square-Bye4ATvx.js";
21
- import { C as Qe } from "./circle-alert-rGDZ73Wh.js";
22
- import { T as Oe } from "./triangle-alert-CBnO6nq_.js";
23
- import { M as In } from "./megaphone-CzeTT9B3.js";
24
- import { c as pe } from "./createLucideIcon-DhHxpK9K.js";
25
- import { F as le } from "./file-text-5yv6r2ls.js";
26
- import { S as En } from "./smartphone-C0rFF2if.js";
27
- import { M as Dn } from "./mail-BqXVF2zH.js";
28
- import { C as Rn } from "./circle-check-BN6rz4NV.js";
29
- import { C as _n } from "./clock-Drd4Wtis.js";
30
- /**
31
- * @license lucide-react v1.22.0 - ISC
32
- *
33
- * This source code is licensed under the ISC license.
34
- * See the LICENSE file in the root directory of this source tree.
35
- */
36
- const zn = [
37
- ["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }],
38
- ["path", { d: "M10 4v4", key: "pp8u80" }],
39
- ["path", { d: "M2 8h20", key: "d11cs7" }],
40
- ["path", { d: "M6 4v4", key: "1svtjw" }]
41
- ], Fn = pe("app-window", zn);
42
- /**
43
- * @license lucide-react v1.22.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */
48
- const jn = [
49
- ["path", { d: "M12 2v4", key: "3427ic" }],
50
- ["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
51
- ["path", { d: "M18 12h4", key: "wj9ykh" }],
52
- ["path", { d: "m16.2 16.2 2.9 2.9", key: "1bxg5t" }],
53
- ["path", { d: "M12 18v4", key: "jadmvz" }],
54
- ["path", { d: "m4.9 19.1 2.9-2.9", key: "bwix9q" }],
55
- ["path", { d: "M2 12h4", key: "j09sii" }],
56
- ["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
57
- ], Kn = pe("loader", jn);
58
- /**
59
- * @license lucide-react v1.22.0 - ISC
60
- *
61
- * This source code is licensed under the ISC license.
62
- * See the LICENSE file in the root directory of this source tree.
63
- */
64
- const Ln = [
65
- ["rect", { width: "8", height: "8", x: "3", y: "3", rx: "2", key: "by2w9f" }],
66
- ["path", { d: "M7 11v4a2 2 0 0 0 2 2h4", key: "xkn7yn" }],
67
- ["rect", { width: "8", height: "8", x: "13", y: "13", rx: "2", key: "1cgmvn" }]
68
- ], $n = pe("workflow", Ln), Bn = `@£$¥èéùìòÇ
69
- Øø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà`, Hn = "^{}\\[~]|€\f", Yn = " // ", Gn = 612, Un = 268;
70
- function Vn(n) {
71
- let c = !0, l = 0;
72
- for (const m of n)
73
- if (Bn.includes(m)) l += 1;
74
- else if (Hn.includes(m))
75
- l += 2;
76
- else {
77
- c = !1;
78
- break;
79
- }
80
- if (c) {
81
- const m = l <= 160 ? 1 : Math.ceil(l / 153);
82
- return {
83
- chars: l,
84
- parts: Math.max(1, m),
85
- encoding: "gsm",
86
- max: Gn
87
- };
88
- }
89
- let g = 0;
90
- for (const m of n) g += (m.codePointAt(0) ?? 0) > 65535 ? 2 : 1;
91
- const w = g <= 70 ? 1 : Math.ceil(g / 67);
92
- return {
93
- chars: g,
94
- parts: Math.max(1, w),
95
- encoding: "ucs2",
96
- max: Un
97
- };
98
- }
99
- function de(n, c) {
100
- const l = c == null ? void 0 : c.trim(), g = l ? `${n}${Yn}${l}` : n, w = Vn(g);
101
- return { ...w, overLimit: w.chars > w.max };
102
- }
103
- const Wn = {
104
- id: "communications-panel",
105
- // 'submit' backs send_message. select_channel and mark_seen have no
106
- // dedicated capability in the closed vocabulary.
107
- capabilities: ["submit"],
108
- state: {
109
- channel: {
110
- type: "'app' | 'sms' | 'email' | null",
111
- descriptionKey: "ui.agent.communicationsPanel.state.channel",
112
- description: "The channel the composer will send by. Null when no channel can be used.",
113
- read: (n) => n.getState().channel
114
- },
115
- messageCount: {
116
- type: "number",
117
- descriptionKey: "ui.agent.communicationsPanel.state.messageCount",
118
- description: "How many messages the thread holds. A count only, never a message. Zero under privacy.",
119
- read: (n) => n.getState().messageCount
120
- },
121
- unreadCount: {
122
- type: "number",
123
- descriptionKey: "ui.agent.communicationsPanel.state.unreadCount",
124
- description: "How many incoming messages are new.",
125
- read: (n) => n.getState().unreadCount
126
- },
127
- status: {
128
- type: "'ready' | 'loading' | 'error'",
129
- descriptionKey: "ui.agent.communicationsPanel.state.status",
130
- description: "The state of the host's read of the thread.",
131
- read: (n) => n.getState().status
132
- },
133
- limitReached: {
134
- type: "boolean",
135
- descriptionKey: "ui.agent.communicationsPanel.state.limitReached",
136
- description: "Whether the daily send limit is reached. SMS and Email are then unavailable; App stays.",
137
- read: (n) => n.getState().limitReached
138
- },
139
- privacy: {
140
- type: "{ masked: true } | null",
141
- descriptionKey: "ui.agent.communicationsPanel.state.privacy",
142
- description: "Reads { masked: true } when privacy mode withholds the thread, else null.",
143
- read: (n) => n.getState().privacy ? { masked: !0 } : null
144
- }
145
- },
146
- actions: {
147
- select_channel: {
148
- safety: "write",
149
- argsType: "{ channel: 'app' | 'sms' | 'email' }",
150
- argsSchema: {
151
- type: "object",
152
- properties: {
153
- channel: { type: "string", enum: ["app", "sms", "email"] }
154
- },
155
- required: ["channel"]
156
- },
157
- idempotent: !0,
158
- errors: [
159
- "The channel is not available for this patient, or the daily limit closed it.",
160
- "The panel is read-only or privacy mode is on."
161
- ],
162
- descriptionKey: "ui.agent.communicationsPanel.actions.selectChannel",
163
- description: "Choose the channel the composer sends by. Rejects when the channel is not available.",
164
- examples: [{ args: { channel: "sms" }, note: "Switch to SMS." }],
165
- invoke: (n, c) => n.selectChannel(c.channel)
166
- },
167
- mark_seen: {
168
- safety: "write",
169
- idempotent: !0,
170
- openWorld: !0,
171
- errors: [
172
- "The panel is read-only or privacy mode is on.",
173
- "The host refused to clear the unread flag."
174
- ],
175
- descriptionKey: "ui.agent.communicationsPanel.actions.markSeen",
176
- description: "Tell the host the new incoming messages were seen. Settles with the host's answer.",
177
- invoke: (n) => n.markSeen()
178
- },
179
- send_message: {
180
- // A message to a patient is patient-identifiable. PHI.
181
- safety: "phi",
182
- argsType: "{ channel: 'app' | 'sms' | 'email'; body: string }",
183
- argsSchema: {
184
- type: "object",
185
- properties: {
186
- channel: { type: "string", enum: ["app", "sms", "email"] },
187
- body: {
188
- type: "string",
189
- description: "Plain text. For SMS the sender name is added to the end."
190
- }
191
- },
192
- required: ["channel", "body"]
193
- },
194
- openWorld: !0,
195
- errors: [
196
- "The channel is not available for this patient, or the daily limit closed it.",
197
- "The message is empty, or an SMS is above the length cap.",
198
- "The panel is read-only or privacy mode is on.",
199
- "A send is already in progress.",
200
- "The host refused the send. The panel keeps the draft and shows the host's message."
201
- ],
202
- descriptionKey: "ui.agent.communicationsPanel.actions.sendMessage",
203
- description: "Send a message to the patient by App, SMS or Email. Settles with the host's answer; a refusal rejects.",
204
- examples: [
205
- {
206
- args: { channel: "app", body: "See you on Tuesday." },
207
- note: "Send a short App message."
208
- }
209
- ],
210
- invoke: (n, c) => n.sendMessage(c)
211
- }
212
- },
213
- domHooks: {
214
- root: {
215
- attr: "data-component",
216
- value: "communications-panel",
217
- description: "Marks the CommunicationsPanel region."
218
- },
219
- instanceId: {
220
- attr: "data-component-id",
221
- sourceProp: "id",
222
- description: "Sourced from the id prop. Required to address a specific panel from the agent."
223
- },
224
- item: {
225
- attr: "data-message-id",
226
- description: "Stable message id on each rendered message. Also carries data-direction and data-channel. Never a name, number or text."
227
- }
228
- }
229
- }, Ze = xn(
230
- "ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:bg-[color:var(--card)]"
231
- ), X = ["app", "sms", "email"], Xn = 50, ue = {
232
- app: "communicationsPanel.channelApp",
233
- sms: "communicationsPanel.channelSms",
234
- email: "communicationsPanel.channelEmail",
235
- whatsapp: "communicationsPanel.channelWhatsApp"
236
- }, qn = {
237
- app: "communicationsPanel.appDisabled",
238
- sms: "communicationsPanel.smsDisabled",
239
- email: "communicationsPanel.emailDisabled"
240
- }, Zn = {
241
- sending: "communicationsPanel.statusSending",
242
- awaiting: "communicationsPanel.statusAwaiting",
243
- delivered: "communicationsPanel.statusDelivered",
244
- "not-delivered": "communicationsPanel.statusNotDelivered",
245
- "out-of-credit": "communicationsPanel.statusOutOfCredit"
246
- }, Jn = {
247
- sending: "info",
248
- awaiting: "neutral",
249
- delivered: "success",
250
- "not-delivered": "error",
251
- "out-of-credit": "warning"
252
- }, Qn = {
253
- sending: /* @__PURE__ */ t(Kn, { "aria-hidden": "true" }),
254
- awaiting: /* @__PURE__ */ t(_n, { "aria-hidden": "true" }),
255
- delivered: /* @__PURE__ */ t(Rn, { "aria-hidden": "true" }),
256
- "not-delivered": /* @__PURE__ */ t(Qe, { "aria-hidden": "true" }),
257
- "out-of-credit": /* @__PURE__ */ t(Oe, { "aria-hidden": "true" })
258
- };
259
- function he({ channel: n }) {
260
- return n === "sms" ? /* @__PURE__ */ t(En, { "aria-hidden": "true" }) : n === "email" ? /* @__PURE__ */ t(Dn, { "aria-hidden": "true" }) : n === "whatsapp" ? /* @__PURE__ */ t(me, { "aria-hidden": "true" }) : /* @__PURE__ */ t(Fn, { "aria-hidden": "true" });
261
- }
262
- function On(n) {
263
- return typeof n == "object" && n !== null && "status" in n && n.status === 429;
264
- }
265
- function et(n) {
266
- const c = new Date(n);
267
- return Number.isNaN(c.getTime()) ? n : `${c.getFullYear()}-${c.getMonth() + 1}-${c.getDate()}`;
268
- }
269
- const nt = wn(
270
- ({
271
- id: n,
272
- title: c,
273
- "aria-label": l,
274
- nowIso: g,
275
- locale: w,
276
- messages: m,
277
- status: i = "ready",
278
- onRetry: M,
279
- channels: A,
280
- defaultChannel: x,
281
- senderName: S,
282
- limitReached: h = !1,
283
- whatsApp: y,
284
- privacy: r = !1,
285
- readOnly: N = !1,
286
- onSend: R,
287
- onMessagesSeen: fe,
288
- onWriteError: ge,
289
- onEnableChannel: ye,
290
- onOpenWhatsApp: en,
291
- onBuyWhatsApp: nn,
292
- onOpenProvenance: ve,
293
- onOpenAttachment: we,
294
- className: be,
295
- ...xe
296
- }, tn) => {
297
- const { t: s, i18n: an } = Je("ui"), j = Ue(), _ = Ue(), sn = `${_}-input`, Se = `${_}-reason`, ke = `${_}-meter`, Pe = `${_}-empty-hint`, Te = `${_}-sender`, Ne = c ?? s("communicationsPanel.title"), Z = w ?? an.language, K = p(null);
298
- bn(tn, () => K.current, []);
299
- const [on, Ce] = k(!1);
300
- T(() => {
301
- Ce(!1);
302
- }, [h]);
303
- const L = h || on, I = (e) => A[e].available && (e === "app" || !L), [J, Me] = k(
304
- x
305
- ), v = J && I(J) ? J : x && I(x) ? x : X.find(I), Q = X.every((e) => !A[e].available), Ae = X.filter(
306
- (e) => !A[e].available
307
- ), z = D(
308
- () => [...m].sort(
309
- (e, a) => new Date(e.createdAtIso).getTime() - new Date(a.createdAtIso).getTime()
310
- ),
311
- [m]
312
- ), b = D(
313
- () => m.filter((e) => e.isNew && e.direction === "in").map((e) => e.id),
314
- [m]
315
- ), [Ie, rn] = k(
316
- () => /* @__PURE__ */ new Set()
317
- );
318
- T(() => {
319
- r || b.length === 0 || rn((e) => b.every((a) => e.has(a)) ? e : /* @__PURE__ */ new Set([...e, ...b]));
320
- }, [r, b]);
321
- const $ = p(R);
322
- $.current = R;
323
- const Ee = p(fe);
324
- Ee.current = fe;
325
- const C = p(ge);
326
- C.current = ge;
327
- const E = p(!0);
328
- T(() => (E.current = !0, () => {
329
- E.current = !1;
330
- }), []);
331
- const O = p(/* @__PURE__ */ new Set()), B = Ve(async (e) => {
332
- var u;
333
- const a = Ee.current;
334
- if (!(!a || e.length === 0)) {
335
- e.forEach((o) => O.current.add(o));
336
- try {
337
- await a(e);
338
- } catch (o) {
339
- throw e.forEach((yn) => O.current.delete(yn)), (u = C.current) == null || u.call(C, { kind: "mark-seen", error: o, shown: !1 }), o;
340
- }
341
- }
342
- }, []);
343
- T(() => {
344
- if (r || N || i !== "ready") return;
345
- const e = b.filter((a) => !O.current.has(a));
346
- e.length !== 0 && B(e).catch(() => {
347
- });
348
- }, [r, N, i, b, B]);
349
- const [H, ee] = k(""), [De, Re] = k(!1), Y = p(!1), [_e, ne] = k(null), [cn, G] = k(!1), [ln, U] = k(!1);
350
- T(() => {
351
- r && (ee(""), ne(null), G(!1), U(!1));
352
- }, [r]);
353
- const te = Ve(
354
- async (e) => {
355
- var a, u;
356
- if (!Y.current) {
357
- Y.current = !0, Re(!0), ne(null), G(!1);
358
- try {
359
- await ((a = $.current) == null ? void 0 : a.call($, e)), E.current && (ee((o) => o.trim() === e.body ? "" : o), G(!0));
360
- } catch (o) {
361
- throw E.current && (On(o) && Ce(!0), ne(
362
- kn(o, s("communicationsPanel.sendFailed"))
363
- )), (u = C.current) == null || u.call(C, {
364
- kind: "send",
365
- id: e.channel,
366
- error: o,
367
- shown: E.current
368
- }), o;
369
- } finally {
370
- Y.current = !1, E.current && Re(!1);
371
- }
372
- }
373
- },
374
- [s]
375
- ), d = v === "sms" && H.trim() ? de(H.trim(), S) : null, P = !!(d != null && d.overLimit), ae = !!d && !d.overLimit && d.chars >= d.max - Xn, se = !H.trim(), dn = (e) => {
376
- const a = e.trim();
377
- if (!(!v || !a || Y.current)) {
378
- if (v === "sms" && de(a, S).overLimit) {
379
- U(!0);
380
- return;
381
- }
382
- te({ channel: v, body: a }).catch(() => {
383
- });
384
- }
385
- }, ie = p({
386
- channel: v,
387
- messageCount: m.length,
388
- unreadCount: b.length,
389
- status: i,
390
- limitReached: L,
391
- privacy: r
392
- });
393
- ie.current = {
394
- channel: v,
395
- messageCount: r ? 0 : m.length,
396
- unreadCount: r ? 0 : b.length,
397
- status: i,
398
- limitReached: L,
399
- privacy: r
400
- };
401
- const ze = p({ readOnly: N, privacy: r });
402
- ze.current = { readOnly: N, privacy: r };
403
- const oe = p(I);
404
- oe.current = I;
405
- const Fe = p(b);
406
- Fe.current = b;
407
- const mn = D(() => {
408
- const e = async () => {
409
- const a = ze.current;
410
- if (a.privacy)
411
- throw new Error("Messages are hidden by privacy mode.");
412
- if (a.readOnly) throw new Error("The panel is read-only.");
413
- };
414
- return {
415
- getState: () => ({
416
- ...ie.current,
417
- channel: ie.current.channel ?? null
418
- }),
419
- selectChannel: async (a) => {
420
- if (await e(), !oe.current(a))
421
- throw new Error(`The ${a} channel is not available.`);
422
- Me(a);
423
- },
424
- markSeen: async () => {
425
- await e(), await B(Fe.current);
426
- },
427
- sendMessage: async (a) => {
428
- if (await e(), !oe.current(a.channel))
429
- throw new Error(`The ${a.channel} channel is not available.`);
430
- if (!a.body.trim()) throw new Error("The message is empty.");
431
- if (a.channel === "sms" && de(a.body.trim(), S).overLimit)
432
- throw new Error("The message is too long.");
433
- await te({
434
- channel: a.channel,
435
- body: a.body.trim()
436
- });
437
- }
438
- };
439
- }, [te, B, S]);
440
- Sn(Wn, mn, n);
441
- const je = p(!1), re = p(!1);
442
- T(() => {
443
- const e = K.current;
444
- if (!e) return;
445
- const a = re.current && (!document.activeElement || document.activeElement === document.body);
446
- if (je.current && !a || !a && !r && i !== "ready") return;
447
- je.current = !0;
448
- const u = r || i !== "ready" ? null : e.querySelector("textarea") ?? e.querySelector("[data-comms-enable]");
449
- if (u) {
450
- u.focus({ preventScroll: !0 });
451
- return;
452
- }
453
- const o = e.querySelector("h2");
454
- o && (o.setAttribute("tabindex", "-1"), o.focus({ preventScroll: !0, focusVisible: !1 }));
455
- }, [r, i]);
456
- const Ke = D(() => {
457
- const e = new Date(g ?? Date.now()).getFullYear();
458
- return (a) => ({
459
- day: "numeric",
460
- month: "long",
461
- ...new Date(a).getFullYear() === e ? {} : { year: "numeric" }
462
- });
463
- }, [g]), un = D(() => {
464
- const e = [];
465
- let a = "";
466
- for (const u of z) {
467
- const o = et(u.createdAtIso);
468
- o !== a && (a = o, e.push({
469
- id: `day-${o}`,
470
- node: /* @__PURE__ */ t(
471
- "div",
472
- {
473
- "data-comms-day": o,
474
- className: "ds:flex ds:justify-center ds:py-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]",
475
- children: /* @__PURE__ */ t(
476
- An,
477
- {
478
- value: u.createdAtIso,
479
- format: "absolute",
480
- absoluteFormat: Ke(u.createdAtIso),
481
- locale: Z
482
- }
483
- )
484
- }
485
- )
486
- })), e.push({
487
- id: u.id,
488
- node: /* @__PURE__ */ t(
489
- tt,
490
- {
491
- message: u,
492
- senderName: S,
493
- lang: Z,
494
- showNew: !!u.isNew || Ie.has(u.id),
495
- onOpenProvenance: ve,
496
- onOpenAttachment: we
497
- }
498
- )
499
- });
500
- }
501
- return e;
502
- }, [
503
- z,
504
- S,
505
- Z,
506
- Ie,
507
- Ke,
508
- ve,
509
- we
510
- ]), Le = i === "loading" ? s("communicationsPanel.loading") : De ? s("communicationsPanel.sending") : cn && se ? s("communicationsPanel.sent") : P || ln ? s("communicationsPanel.smsTooLong", { max: (d == null ? void 0 : d.max) ?? 0 }) : "", [hn, pn] = k("");
511
- T(() => {
512
- pn(Le);
513
- }, [Le]);
514
- const $e = p(null), Be = !r && i !== "loading" && i !== "error" && z.length > 0;
515
- T(() => {
516
- var a;
517
- if (!Be) return;
518
- const e = (a = $e.current) == null ? void 0 : a.querySelector('[role="log"]');
519
- e == null || e.scrollTo({ top: e.scrollHeight, behavior: "instant" });
520
- }, [Be]);
521
- const He = {
522
- onFocusCapture: () => {
523
- re.current = !0;
524
- },
525
- onBlurCapture: (e) => {
526
- e.relatedTarget && (re.current = !1);
527
- }
528
- };
529
- if (r)
530
- return /* @__PURE__ */ f(
531
- "section",
532
- {
533
- ref: K,
534
- "data-component": "communications-panel",
535
- "data-component-id": n,
536
- "data-privacy": "masked",
537
- "aria-labelledby": l ? void 0 : j,
538
- "aria-label": l,
539
- className: [Ze(), be].filter(Boolean).join(" "),
540
- ...He,
541
- ...He,
542
- ...xe,
543
- children: [
544
- /* @__PURE__ */ t(
545
- We,
546
- {
547
- title: Ne,
548
- icon: /* @__PURE__ */ t(qe, { "aria-hidden": "true" }),
549
- headingId: l ? void 0 : j,
550
- divider: !0
551
- }
552
- ),
553
- /* @__PURE__ */ t("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ t(
554
- ce,
555
- {
556
- variant: "first-use",
557
- size: "sm",
558
- title: s("communicationsPanel.privacyTitle"),
559
- description: s("communicationsPanel.privacyDescription")
560
- }
561
- ) })
562
- ]
563
- }
564
- );
565
- const Ye = v ? A[v].recipient : void 0, fn = X.map((e) => ({
566
- value: e,
567
- label: s(ue[e]),
568
- disabled: !I(e),
569
- startAdornment: /* @__PURE__ */ t(he, { channel: e })
570
- })), gn = [
571
- se ? Pe : void 0,
572
- d ? ke : void 0,
573
- d && v === "sms" ? Te : void 0,
574
- P ? Se : void 0
575
- ].filter(Boolean).join(" ") || void 0;
576
- let F;
577
- i === "loading" ? F = /* @__PURE__ */ t(
578
- "div",
579
- {
580
- "data-comms-state": "loading",
581
- className: "ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-md)] ds:overflow-y-auto ds:p-[var(--spacing-md)]",
582
- "aria-hidden": "true",
583
- children: ["a", "b", "c"].map((e, a) => /* @__PURE__ */ f(
584
- "div",
585
- {
586
- className: [
587
- "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
588
- a % 2 === 1 ? "ds:items-end" : "ds:items-start"
589
- ].join(" "),
590
- children: [
591
- /* @__PURE__ */ t(
592
- Xe,
593
- {
594
- variant: "rounded",
595
- width: "70%",
596
- height: "3rem",
597
- stagger: a
598
- }
599
- ),
600
- /* @__PURE__ */ t(Xe, { variant: "text", size: "sm", width: "30%", stagger: a })
601
- ]
602
- },
603
- e
604
- ))
605
- }
606
- ) : i === "error" ? F = /* @__PURE__ */ t(
607
- "div",
608
- {
609
- "data-comms-state": "error",
610
- className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
611
- children: /* @__PURE__ */ t(
612
- ce,
613
- {
614
- variant: "error",
615
- size: "sm",
616
- title: s("communicationsPanel.errorTitle"),
617
- primaryAction: M ? { label: s("communicationsPanel.retry"), onClick: M } : void 0
618
- }
619
- )
620
- }
621
- ) : z.length === 0 ? F = /* @__PURE__ */ t(
622
- "div",
623
- {
624
- "data-comms-state": "empty",
625
- className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
626
- children: /* @__PURE__ */ t(
627
- ce,
628
- {
629
- variant: "first-use",
630
- size: "sm",
631
- title: s(Q ? "communicationsPanel.noChannelsTitle" : "communicationsPanel.emptyTitle"),
632
- description: Q ? void 0 : s("communicationsPanel.emptyDescription")
633
- }
634
- )
635
- }
636
- ) : F = /* @__PURE__ */ t(
637
- Tn,
638
- {
639
- ref: $e,
640
- messages: un,
641
- showScrollToLatest: !0,
642
- logLabel: s("communicationsPanel.messagesLabel"),
643
- className: "ds:min-h-0 ds:flex-1"
644
- }
645
- );
646
- const Ge = y === "no-phone" ? s("communicationsPanel.whatsAppNoPhone") : y === "no-sms-phone" ? s("communicationsPanel.whatsAppNoSmsPhone") : null;
647
- return /* @__PURE__ */ f(
648
- "section",
649
- {
650
- ref: K,
651
- "data-component": "communications-panel",
652
- "data-component-id": n,
653
- "aria-labelledby": l ? void 0 : j,
654
- "aria-label": l,
655
- className: [Ze(), be].filter(Boolean).join(" "),
656
- ...xe,
657
- children: [
658
- /* @__PURE__ */ t(
659
- We,
660
- {
661
- title: Ne,
662
- icon: /* @__PURE__ */ t(qe, { "aria-hidden": "true" }),
663
- headingId: l ? void 0 : j,
664
- divider: !0
665
- }
666
- ),
667
- /* @__PURE__ */ t("span", { role: "status", className: "ds:sr-only", children: hn }),
668
- L ? /* @__PURE__ */ t("div", { className: "ds:shrink-0 ds:px-[var(--spacing-md)] ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(V, { variant: "warning", announce: "polite", "data-comms-limit": "", children: /* @__PURE__ */ t(V.Description, { children: s("communicationsPanel.limitReached") }) }) }) : null,
669
- F,
670
- !N && i === "ready" ? /* @__PURE__ */ f(
671
- "div",
672
- {
673
- "data-comms-composer": "",
674
- className: "ds:@container ds:flex ds:shrink-0 ds:flex-col ds:gap-[var(--spacing-sm)] ds:border-t ds:border-[color:var(--border)] ds:bg-[color:var(--card)] ds:p-[var(--spacing-md)]",
675
- children: [
676
- Q && z.length > 0 ? /* @__PURE__ */ t(
677
- "p",
678
- {
679
- "data-comms-blocked": "",
680
- className: "ds:m-0 type-body-sm ds:font-semibold ds:text-[color:var(--foreground)]",
681
- children: s("communicationsPanel.noChannelsTitle")
682
- }
683
- ) : null,
684
- Ae.length > 0 ? /* @__PURE__ */ t("ul", { className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-xs)] ds:p-0", children: Ae.map((e) => /* @__PURE__ */ f(
685
- "li",
686
- {
687
- "data-comms-disabled": e,
688
- className: "ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-xs)] type-meta ds:text-[color:var(--muted-foreground)]",
689
- children: [
690
- /* @__PURE__ */ f("span", { className: "ds:inline-flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-[var(--spacing-xs)]", children: [
691
- /* @__PURE__ */ t("span", { className: "ds:inline-flex ds:shrink-0 ds:[&_svg]:size-4", children: /* @__PURE__ */ t(he, { channel: e }) }),
692
- /* @__PURE__ */ t("span", { className: "ds:[overflow-wrap:anywhere]", children: s(qn[e]) })
693
- ] }),
694
- ye ? /* @__PURE__ */ t(
695
- q,
696
- {
697
- type: "button",
698
- size: "sm",
699
- intent: "outline",
700
- "data-comms-enable": e,
701
- onClick: () => ye(e),
702
- children: s("communicationsPanel.enableChannel", {
703
- channel: s(ue[e])
704
- })
705
- }
706
- ) : null
707
- ]
708
- },
709
- e
710
- )) }) : null,
711
- v ? /* @__PURE__ */ f(vn, { children: [
712
- /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:@[320px]:flex-row ds:@[320px]:items-center ds:@[320px]:gap-[var(--spacing-sm)]", children: [
713
- /* @__PURE__ */ t(
714
- Mn,
715
- {
716
- size: "md",
717
- value: v,
718
- options: fn,
719
- "aria-label": s("communicationsPanel.channelLabel"),
720
- adornmentInTrigger: !0,
721
- className: "ds:w-full ds:@[320px]:w-44",
722
- onValueChange: (e) => {
723
- e && (Me(e), U(!1));
724
- }
725
- }
726
- ),
727
- Ye ? /* @__PURE__ */ t(
728
- "span",
729
- {
730
- dir: "auto",
731
- className: "type-meta ds:min-w-0 ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
732
- children: s("communicationsPanel.toRecipient", { recipient: Ye })
733
- }
734
- ) : null
735
- ] }),
736
- _e ? /* @__PURE__ */ t(V, { variant: "error", "data-comms-send-error": "", children: /* @__PURE__ */ t(V.Description, { children: _e }) }) : null,
737
- /* @__PURE__ */ t(
738
- Nn,
739
- {
740
- id: sn,
741
- value: H,
742
- submitOnEnter: !1,
743
- minRows: 2,
744
- maxRows: 6,
745
- submitDisabled: P || De,
746
- onKeyDown: (e) => {
747
- e.key === "Enter" && (e.ctrlKey || e.metaKey) && e.preventDefault();
748
- },
749
- label: s("communicationsPanel.composerLabel"),
750
- placeholder: s("communicationsPanel.placeholder"),
751
- "aria-describedby": gn,
752
- "aria-invalid": P || void 0,
753
- onChange: (e) => {
754
- ee(e.target.value), G(!1), U(!1);
755
- },
756
- onSubmit: dn
757
- }
758
- ),
759
- se ? /* @__PURE__ */ t(
760
- "p",
761
- {
762
- id: Pe,
763
- className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)]",
764
- children: s("communicationsPanel.emptyDraft")
765
- }
766
- ) : null,
767
- d ? /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
768
- /* @__PURE__ */ f(
769
- "p",
770
- {
771
- id: ke,
772
- "data-comms-meter": P ? "over" : ae ? "near" : "ok",
773
- className: [
774
- "ds:m-0 ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:tabular-nums",
775
- P ? "ds:text-[color:var(--destructive)]" : ae ? "ds:text-[color:var(--warning-foreground)]" : "ds:text-[color:var(--muted-foreground)]"
776
- ].join(" "),
777
- children: [
778
- P ? /* @__PURE__ */ t(
779
- Qe,
780
- {
781
- "aria-hidden": "true",
782
- className: "ds:size-3.5 ds:shrink-0"
783
- }
784
- ) : ae ? /* @__PURE__ */ t(
785
- Oe,
786
- {
787
- "aria-hidden": "true",
788
- className: "ds:size-3.5 ds:shrink-0"
789
- }
790
- ) : null,
791
- s("communicationsPanel.smsCount", {
792
- count: d.chars,
793
- chars: d.chars,
794
- parts: d.parts
795
- })
796
- ]
797
- }
798
- ),
799
- P ? /* @__PURE__ */ t(
800
- "p",
801
- {
802
- id: Se,
803
- className: "ds:m-0 type-meta ds:text-[color:var(--destructive)]",
804
- children: s("communicationsPanel.smsTooLong", { max: d.max })
805
- }
806
- ) : null,
807
- /* @__PURE__ */ t(
808
- "p",
809
- {
810
- id: Te,
811
- className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
812
- children: s("communicationsPanel.senderNote", {
813
- sender: S
814
- })
815
- }
816
- )
817
- ] }) : null
818
- ] }) : null,
819
- y === "ready" || y === "off" ? /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
820
- q,
821
- {
822
- type: "button",
823
- size: "sm",
824
- intent: "outline",
825
- startIcon: /* @__PURE__ */ t(me, { "aria-hidden": "true" }),
826
- "data-comms-whatsapp": y,
827
- onClick: y === "ready" ? en : nn,
828
- children: s(y === "ready" ? "communicationsPanel.whatsApp" : "communicationsPanel.whatsAppBuy")
829
- }
830
- ) }) : Ge ? /* @__PURE__ */ f(
831
- "p",
832
- {
833
- "data-comms-whatsapp": y,
834
- className: "ds:m-0 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:text-[color:var(--muted-foreground)]",
835
- children: [
836
- /* @__PURE__ */ t(
837
- me,
838
- {
839
- "aria-hidden": "true",
840
- className: "ds:size-4 ds:shrink-0"
841
- }
842
- ),
843
- Ge
844
- ]
845
- }
846
- ) : null
847
- ]
848
- }
849
- ) : null
850
- ]
851
- }
852
- );
853
- }
854
- );
855
- nt.displayName = "CommunicationsPanel";
856
- function tt({
857
- message: n,
858
- senderName: c,
859
- lang: l,
860
- showNew: g,
861
- onOpenProvenance: w,
862
- onOpenAttachment: m
863
- }) {
864
- const { t: i } = Je("ui"), M = i(ue[n.channel]), A = D(() => {
865
- const R = new Date(n.createdAtIso);
866
- return Number.isNaN(R.getTime()) ? "" : new Intl.DateTimeFormat(l, {
867
- dateStyle: "medium",
868
- timeStyle: "short"
869
- }).format(R);
870
- }, [n.createdAtIso, l]), x = n.direction === "out", S = i(
871
- x ? "communicationsPanel.messageFromPractice" : "communicationsPanel.messageFromPatient",
872
- { channel: M, time: A }
873
- ), h = n.provenance, y = h ? h.kind === "document-share" ? i("communicationsPanel.provenanceDocument") : i(
874
- h.kind === "campaign" ? "communicationsPanel.provenanceCampaign" : "communicationsPanel.provenanceWorkflow",
875
- { name: h.name ?? "" }
876
- ) : "", r = h ? h.kind === "campaign" ? /* @__PURE__ */ t(In, { "aria-hidden": "true" }) : h.kind === "workflow" ? /* @__PURE__ */ t($n, { "aria-hidden": "true" }) : /* @__PURE__ */ t(le, { "aria-hidden": "true" }) : null, N = /* @__PURE__ */ f("div", { className: "ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
877
- /* @__PURE__ */ t(
878
- W,
879
- {
880
- variant: "neutral",
881
- size: "md",
882
- leading: /* @__PURE__ */ t(he, { channel: n.channel }),
883
- children: n.recipient ? i("communicationsPanel.viaTo", {
884
- channel: M,
885
- recipient: n.recipient
886
- }) : i("communicationsPanel.via", { channel: M })
887
- }
888
- ),
889
- x && n.channel === "sms" && n.smsStatus ? /* @__PURE__ */ t(
890
- W,
891
- {
892
- variant: Jn[n.smsStatus],
893
- size: "md",
894
- leading: Qn[n.smsStatus],
895
- "data-sms-status": n.smsStatus,
896
- children: i(Zn[n.smsStatus])
897
- }
898
- ) : null,
899
- g ? /* @__PURE__ */ t(W, { variant: "brand", size: "md", "data-comms-new": "", children: i("communicationsPanel.newMessages") }) : null,
900
- h ? w ? /* @__PURE__ */ t(
901
- q,
902
- {
903
- type: "button",
904
- size: "sm",
905
- intent: "ghost",
906
- startIcon: r,
907
- "data-comms-provenance": h.kind,
908
- onClick: () => w(h.kind, h.id),
909
- children: y
910
- }
911
- ) : /* @__PURE__ */ t(
912
- W,
913
- {
914
- variant: "info",
915
- size: "md",
916
- leading: r,
917
- "data-comms-provenance": h.kind,
918
- children: y
919
- }
920
- ) : null
921
- ] });
922
- return /* @__PURE__ */ t(
923
- Cn,
924
- {
925
- role: x ? "user" : "assistant",
926
- content: n.body,
927
- timestamp: n.createdAtIso,
928
- avatar: x ? { name: c } : void 0,
929
- "aria-label": S,
930
- "data-message-id": n.id,
931
- "data-direction": n.direction,
932
- "data-channel": n.channel,
933
- body: /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
934
- n.bodyHtml && n.channel !== "sms" ? /* @__PURE__ */ t(Pn, { html: n.bodyHtml, profile: "email" }) : /* @__PURE__ */ t("span", { className: "ds:whitespace-pre-wrap", children: n.body }),
935
- n.attachment ? m ? /* @__PURE__ */ t(
936
- q,
937
- {
938
- type: "button",
939
- size: "sm",
940
- intent: "outline",
941
- startIcon: /* @__PURE__ */ t(le, { "aria-hidden": "true" }),
942
- "data-comms-attachment": n.attachment.id,
943
- onClick: () => m(n.attachment.id),
944
- children: n.attachment.name
945
- }
946
- ) : /* @__PURE__ */ f(
947
- "span",
948
- {
949
- "data-comms-attachment": n.attachment.id,
950
- className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm",
951
- children: [
952
- /* @__PURE__ */ t(
953
- le,
954
- {
955
- "aria-hidden": "true",
956
- className: "ds:size-4 ds:shrink-0"
957
- }
958
- ),
959
- n.attachment.name
960
- ]
961
- }
962
- ) : null
963
- ] }),
964
- actions: N
965
- }
966
- );
967
- }
968
- export {
969
- nt as C,
970
- Wn as c,
971
- de as s
972
- };
973
- //# sourceMappingURL=communications-panel-BKPHCiMB.js.map