@burdenoff/microfe-healthybowl 2026.902.14 → 2026.902.15

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 (32) hide show
  1. package/dist/components/assistant/AssistantAutoSpeakToggle.js +4 -27
  2. package/dist/components/assistant/AssistantHeader.js +38 -42
  3. package/dist/components/assistant/AssistantHeader.js.map +1 -1
  4. package/dist/components/assistant/AssistantMoreMenu.js +111 -0
  5. package/dist/components/assistant/AssistantMoreMenu.js.map +1 -0
  6. package/dist/components/assistant/index.js +2 -2
  7. package/dist/healthybowl/hooks/useConsultationPayments.js +59 -0
  8. package/dist/healthybowl/hooks/useConsultationPayments.js.map +1 -0
  9. package/dist/healthybowl/hooks/useHealthyBowlData.js +15 -0
  10. package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
  11. package/dist/healthybowl/offline/graphql.js.map +1 -1
  12. package/dist/healthybowl/offline/syncEngine.js +2 -1
  13. package/dist/healthybowl/offline/syncEngine.js.map +1 -1
  14. package/dist/healthybowl/offline/types.js.map +1 -1
  15. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +228 -188
  16. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
  17. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +261 -191
  18. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
  19. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +49 -0
  20. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +1 -0
  21. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +48 -0
  22. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +1 -0
  23. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +54 -0
  24. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +1 -0
  25. package/dist/healthybowl/pages/network/ExpertsPage.js +520 -419
  26. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  27. package/dist/hooks/useAssistantKeyboardShortcuts.js +1 -1
  28. package/dist/hooks/useAssistantKeyboardShortcuts.js.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/components/assistant/AssistantAutoSpeakToggle.js.map +0 -1
  31. package/dist/components/assistant/AssistantExportMenu.js +0 -52
  32. package/dist/components/assistant/AssistantExportMenu.js.map +0 -1
@@ -1,27 +1,4 @@
1
- import { useTr as e } from "../../shared/hooks/useTr.js";
2
- import { useAssistantSpeech as t } from "./AssistantSpeechProvider.js";
3
- import { Volume2 as n, VolumeX as r } from "lucide-react";
4
- import { jsx as i } from "react/jsx-runtime";
5
- //#region src/components/assistant/AssistantAutoSpeakToggle.tsx
6
- var a = () => {
7
- let a = e(), { isSupported: o, isBlocked: s, disabledReason: c, autoSpeakEnabled: l, setAutoSpeak: u, stop: d } = t();
8
- if (!o) return null;
9
- let f = s && !l, p = l ? a("healthybowl.assistant.header.autoSpeakOff", "Stop reading replies aloud") : a("healthybowl.assistant.header.autoSpeakOn", "Read replies aloud automatically");
10
- return /* @__PURE__ */ i("button", {
11
- type: "button",
12
- onClick: () => {
13
- l && d(), u(!l);
14
- },
15
- disabled: f,
16
- className: `rounded-lg p-1.5 transition-colors disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent ${l ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
17
- title: f ? c ?? p : p,
18
- "aria-label": p,
19
- "aria-pressed": l,
20
- "data-testid": "assistant-auto-speak",
21
- children: i(l ? n : r, { className: "size-4" })
22
- });
23
- };
24
- //#endregion
25
- export { a as AssistantAutoSpeakToggle };
26
-
27
- //# sourceMappingURL=AssistantAutoSpeakToggle.js.map
1
+ import "../../shared/hooks/useTr.js";
2
+ import "./AssistantSpeechProvider.js";
3
+ import "lucide-react";
4
+ import "react/jsx-runtime";
@@ -1,81 +1,77 @@
1
1
  import { useTr as e } from "../../shared/hooks/useTr.js";
2
- import { AssistantExportMenu as t } from "./AssistantExportMenu.js";
3
- import { AssistantAutoSpeakToggle as n } from "./AssistantAutoSpeakToggle.js";
4
- import { AssistantVoiceSelector as r } from "./composer/AssistantVoiceSelector.js";
5
- import { History as i, PanelBottom as a, PanelRight as o, Plus as s, Sparkles as c, X as l } from "lucide-react";
6
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
2
+ import { AssistantMoreMenu as t } from "./AssistantMoreMenu.js";
3
+ import { History as n, PanelBottom as r, PanelRight as i, Plus as a, Sparkles as o, X as s } from "lucide-react";
4
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
5
  //#region src/components/assistant/AssistantHeader.tsx
8
- var f = ({ contextLabel: f, onNewConversation: p, onOpenHistory: m, historyOpen: h, onClose: g, docked: _, onToggleDock: v }) => {
9
- let y = e();
10
- return /* @__PURE__ */ d("div", {
6
+ var u = ({ contextLabel: u, onNewConversation: d, onOpenHistory: f, historyOpen: p, onClose: m, docked: h, onToggleDock: g }) => {
7
+ let _ = e();
8
+ return /* @__PURE__ */ l("div", {
11
9
  className: "flex items-center gap-2 border-b border-border-default bg-bg-elevated px-3 py-2.5",
12
- children: [/* @__PURE__ */ d("div", {
10
+ children: [/* @__PURE__ */ l("div", {
13
11
  className: "flex min-w-0 flex-1 items-center gap-2",
14
- children: [/* @__PURE__ */ u("span", {
12
+ children: [/* @__PURE__ */ c("span", {
15
13
  className: "flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg",
16
- children: /* @__PURE__ */ u(c, { className: "size-4" })
17
- }), /* @__PURE__ */ d("span", {
14
+ children: /* @__PURE__ */ c(o, { className: "size-4" })
15
+ }), /* @__PURE__ */ l("span", {
18
16
  className: "min-w-0 flex-1",
19
- children: [/* @__PURE__ */ u("span", {
17
+ children: [/* @__PURE__ */ c("span", {
20
18
  className: "block truncate text-[14px] font-semibold leading-tight text-text-primary",
21
- children: y("healthybowl.assistant.header.title", "HealthyBowl AI")
22
- }), /* @__PURE__ */ d("span", {
19
+ children: _("healthybowl.assistant.header.title", "HealthyBowl AI")
20
+ }), /* @__PURE__ */ l("span", {
23
21
  className: "block truncate text-[11px] leading-tight text-text-muted",
24
22
  children: [
25
- y("healthybowl.assistant.header.ready", "Ready"),
26
- /* @__PURE__ */ u("span", {
23
+ _("healthybowl.assistant.header.ready", "Ready"),
24
+ /* @__PURE__ */ c("span", {
27
25
  "aria-hidden": "true",
28
26
  children: " · "
29
27
  }),
30
- y("healthybowl.assistant.header.context", "Context: {{page}}", { page: f })
28
+ _("healthybowl.assistant.header.context", "Context: {{page}}", { page: u })
31
29
  ]
32
30
  })]
33
31
  })]
34
- }), /* @__PURE__ */ d("div", {
32
+ }), /* @__PURE__ */ l("div", {
35
33
  className: "flex flex-shrink-0 items-center gap-0.5",
36
34
  children: [
37
- /* @__PURE__ */ u("button", {
35
+ /* @__PURE__ */ c("button", {
38
36
  type: "button",
39
- onClick: p,
37
+ onClick: d,
40
38
  className: "rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
41
- "aria-label": y("healthybowl.assistant.header.newConversation", "New conversation"),
39
+ "aria-label": _("healthybowl.assistant.header.newConversation", "New conversation"),
42
40
  "data-testid": "assistant-new-conversation",
43
- children: /* @__PURE__ */ u(s, { className: "size-4" })
41
+ children: /* @__PURE__ */ c(a, { className: "size-4" })
44
42
  }),
45
- /* @__PURE__ */ u("button", {
43
+ /* @__PURE__ */ c("button", {
46
44
  type: "button",
47
- onClick: m,
48
- className: `rounded-lg p-1.5 transition-colors ${h ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
49
- "aria-label": y("healthybowl.assistant.header.history", "Conversation history"),
50
- "aria-pressed": h,
45
+ onClick: f,
46
+ className: `rounded-lg p-1.5 transition-colors ${p ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
47
+ "aria-label": _("healthybowl.assistant.header.history", "Conversation history"),
48
+ "aria-pressed": p,
51
49
  "data-testid": "assistant-open-history",
52
- children: /* @__PURE__ */ u(i, { className: "size-4" })
50
+ children: /* @__PURE__ */ c(n, { className: "size-4" })
53
51
  }),
54
- /* @__PURE__ */ u(n, {}),
55
- /* @__PURE__ */ u(r, {}),
56
- /* @__PURE__ */ u(t, {}),
57
- v && /* @__PURE__ */ u("button", {
52
+ /* @__PURE__ */ c(t, {}),
53
+ g && /* @__PURE__ */ c("button", {
58
54
  type: "button",
59
- onClick: v,
55
+ onClick: g,
60
56
  className: "hidden rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary md:inline-flex",
61
- "aria-label": _ ? y("healthybowl.assistant.header.float", "Float chat window") : y("healthybowl.assistant.header.dock", "Dock to side panel"),
62
- "aria-pressed": _,
57
+ "aria-label": h ? _("healthybowl.assistant.header.float", "Float chat window") : _("healthybowl.assistant.header.dock", "Dock to side panel"),
58
+ "aria-pressed": h,
63
59
  "data-testid": "assistant-toggle-dock",
64
- children: u(_ ? a : o, { className: "size-4" })
60
+ children: c(h ? r : i, { className: "size-4" })
65
61
  }),
66
- /* @__PURE__ */ u("button", {
62
+ /* @__PURE__ */ c("button", {
67
63
  type: "button",
68
- onClick: g,
64
+ onClick: m,
69
65
  className: "rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
70
- "aria-label": y("healthybowl.assistant.header.close", "Close assistant"),
66
+ "aria-label": _("healthybowl.assistant.header.close", "Close assistant"),
71
67
  "data-testid": "assistant-close",
72
- children: /* @__PURE__ */ u(l, { className: "size-4" })
68
+ children: /* @__PURE__ */ c(s, { className: "size-4" })
73
69
  })
74
70
  ]
75
71
  })]
76
72
  });
77
73
  };
78
74
  //#endregion
79
- export { f as AssistantHeader };
75
+ export { u as AssistantHeader };
80
76
 
81
77
  //# sourceMappingURL=AssistantHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantHeader.js","names":[],"sources":["../../../src/components/assistant/AssistantHeader.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Sparkles, Plus, History, PanelRight, PanelBottom, X } from 'lucide-react';\nimport { AssistantExportMenu } from './AssistantExportMenu';\nimport { AssistantAutoSpeakToggle } from './AssistantAutoSpeakToggle';\nimport { AssistantVoiceSelector } from './composer/AssistantVoiceSelector';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n /** Friendly label for the page the user is on (e.g. \"Inventory\"). */\n contextLabel: string;\n onNewConversation: () => void;\n onOpenHistory: () => void;\n /** True when the history drawer is currently open (drives the toggle state). */\n historyOpen: boolean;\n onClose: () => void;\n docked?: boolean;\n onToggleDock?: () => void;\n}\n\n/**\n * AssistantHeader — the v2 identity bar (per the ai-assistant-v2 mockups):\n * a ✦ brand mark + \"HealthyBowl AI\", a small availability/context subtitle\n * (\"Ready · Context: <page>\"), and a row of icon actions: New conversation,\n * History (opens the conversation list as an overlay drawer — NOT an accordion),\n * Export, Dock toggle, Close.\n *\n * Replaces the old \"Conversation History\" accordion header. HB semantic tokens\n * only; copy via useTr.\n */\nexport const AssistantHeader: FC<Props> = ({\n contextLabel,\n onNewConversation,\n onOpenHistory,\n historyOpen,\n onClose,\n docked,\n onToggleDock,\n}) => {\n const tr = useTr();\n\n return (\n <div className=\"flex items-center gap-2 border-b border-border-default bg-bg-elevated px-3 py-2.5\">\n {/* Brand + context subtitle */}\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg\">\n <Sparkles className=\"size-4\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-[14px] font-semibold leading-tight text-text-primary\">\n {tr('healthybowl.assistant.header.title', 'HealthyBowl AI')}\n </span>\n <span className=\"block truncate text-[11px] leading-tight text-text-muted\">\n {tr('healthybowl.assistant.header.ready', 'Ready')}\n <span aria-hidden=\"true\"> · </span>\n {tr('healthybowl.assistant.header.context', 'Context: {{page}}', { page: contextLabel })}\n </span>\n </span>\n </div>\n\n {/* Actions */}\n <div className=\"flex flex-shrink-0 items-center gap-0.5\">\n <button\n type=\"button\"\n onClick={onNewConversation}\n className=\"rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n aria-label={tr('healthybowl.assistant.header.newConversation', 'New conversation')}\n data-testid=\"assistant-new-conversation\"\n >\n <Plus className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={onOpenHistory}\n className={`rounded-lg p-1.5 transition-colors ${\n historyOpen\n ? 'bg-action-primary-bg/15 text-action-primary-bg'\n : 'text-text-secondary hover:bg-bg-sunken hover:text-text-primary'\n }`}\n aria-label={tr('healthybowl.assistant.header.history', 'Conversation history')}\n aria-pressed={historyOpen}\n data-testid=\"assistant-open-history\"\n >\n <History className=\"size-4\" />\n </button>\n {/* Renders nothing where the browser has no speech output. */}\n <AssistantAutoSpeakToggle />\n {/* Beside the auto-speak toggle rather than in the composer: it is a\n playback setting, and the composer row is already exactly full at\n 390px — a fourth chip there would push send off the edge. Renders\n nothing when the device offers fewer than two voices. */}\n <AssistantVoiceSelector />\n <AssistantExportMenu />\n {onToggleDock && (\n <button\n type=\"button\"\n onClick={onToggleDock}\n className=\"hidden rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary md:inline-flex\"\n aria-label={\n docked\n ? tr('healthybowl.assistant.header.float', 'Float chat window')\n : tr('healthybowl.assistant.header.dock', 'Dock to side panel')\n }\n aria-pressed={docked}\n data-testid=\"assistant-toggle-dock\"\n >\n {docked ? <PanelBottom className=\"size-4\" /> : <PanelRight className=\"size-4\" />}\n </button>\n )}\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n aria-label={tr('healthybowl.assistant.header.close', 'Close assistant')}\n data-testid=\"assistant-close\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AA6BA,IAAa,KAA8B,EACzC,iBACA,sBACA,kBACA,gBACA,YACA,WACA,sBACI;CACJ,IAAM,IAAK,EAAM;CAEjB,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CAEE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,QAAD;IAAM,WAAU;cACd,kBAAC,GAAD,EAAU,WAAU,SAAU,CAAA;GAC1B,CAAA,GACN,kBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,kBAAC,QAAD;KAAM,WAAU;eACb,EAAG,sCAAsC,gBAAgB;IACtD,CAAA,GACN,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACG,EAAG,sCAAsC,OAAO;MACjD,kBAAC,QAAD;OAAM,eAAY;iBAAO;MAAS,CAAA;MACjC,EAAG,wCAAwC,qBAAqB,EAAE,MAAM,EAAa,CAAC;KACnF;MACF;KACH;MAGL,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cAAY,EAAG,gDAAgD,kBAAkB;KACjF,eAAY;eAEZ,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;IACpB,CAAA;IACR,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAW,sCACT,IACI,mDACA;KAEN,cAAY,EAAG,wCAAwC,sBAAsB;KAC7E,gBAAc;KACd,eAAY;eAEZ,kBAAC,GAAD,EAAS,WAAU,SAAU,CAAA;IACvB,CAAA;IAER,kBAAC,GAAD,CAA2B,CAAA;IAK3B,kBAAC,GAAD,CAAyB,CAAA;IACzB,kBAAC,GAAD,CAAsB,CAAA;IACrB,KACC,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cACE,IACI,EAAG,sCAAsC,mBAAmB,IAC5D,EAAG,qCAAqC,oBAAoB;KAElE,gBAAc;KACd,eAAY;eAEF,EAAT,IAAU,IAAqC,GAAtC,EAAa,WAAU,SAAU,CAAoC;IACzE,CAAA;IAEV,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cAAY,EAAG,sCAAsC,iBAAiB;KACtE,eAAY;eAEZ,kBAAC,GAAD,EAAG,WAAU,SAAU,CAAA;IACjB,CAAA;GACL;IACF;;AAET"}
1
+ {"version":3,"file":"AssistantHeader.js","names":[],"sources":["../../../src/components/assistant/AssistantHeader.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Sparkles, Plus, History, PanelRight, PanelBottom, X } from 'lucide-react';\nimport { AssistantMoreMenu } from './AssistantMoreMenu';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n /** Friendly label for the page the user is on (e.g. \"Inventory\"). */\n contextLabel: string;\n onNewConversation: () => void;\n onOpenHistory: () => void;\n /** True when the history drawer is currently open (drives the toggle state). */\n historyOpen: boolean;\n onClose: () => void;\n docked?: boolean;\n onToggleDock?: () => void;\n}\n\n/**\n * AssistantHeader — the v2 identity bar (per the ai-assistant-v2 mockups):\n * a ✦ brand mark + \"HealthyBowl AI\", a small availability/context subtitle\n * (\"Ready · Context: <page>\"), and a row of icon actions: New conversation,\n * History (opens the conversation list as an overlay drawer — NOT an accordion),\n * Export, Dock toggle, Close.\n *\n * Replaces the old \"Conversation History\" accordion header. HB semantic tokens\n * only; copy via useTr.\n */\nexport const AssistantHeader: FC<Props> = ({\n contextLabel,\n onNewConversation,\n onOpenHistory,\n historyOpen,\n onClose,\n docked,\n onToggleDock,\n}) => {\n const tr = useTr();\n\n return (\n <div className=\"flex items-center gap-2 border-b border-border-default bg-bg-elevated px-3 py-2.5\">\n {/* Brand + context subtitle */}\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg\">\n <Sparkles className=\"size-4\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-[14px] font-semibold leading-tight text-text-primary\">\n {tr('healthybowl.assistant.header.title', 'HealthyBowl AI')}\n </span>\n <span className=\"block truncate text-[11px] leading-tight text-text-muted\">\n {tr('healthybowl.assistant.header.ready', 'Ready')}\n <span aria-hidden=\"true\"> · </span>\n {tr('healthybowl.assistant.header.context', 'Context: {{page}}', { page: contextLabel })}\n </span>\n </span>\n </div>\n\n {/* Actions */}\n <div className=\"flex flex-shrink-0 items-center gap-0.5\">\n <button\n type=\"button\"\n onClick={onNewConversation}\n className=\"rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n aria-label={tr('healthybowl.assistant.header.newConversation', 'New conversation')}\n data-testid=\"assistant-new-conversation\"\n >\n <Plus className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={onOpenHistory}\n className={`rounded-lg p-1.5 transition-colors ${\n historyOpen\n ? 'bg-action-primary-bg/15 text-action-primary-bg'\n : 'text-text-secondary hover:bg-bg-sunken hover:text-text-primary'\n }`}\n aria-label={tr('healthybowl.assistant.header.history', 'Conversation history')}\n aria-pressed={historyOpen}\n data-testid=\"assistant-open-history\"\n >\n <History className=\"size-4\" />\n </button>\n {/* Renders nothing where the browser has no speech output. */}\n <AssistantMoreMenu />\n {onToggleDock && (\n <button\n type=\"button\"\n onClick={onToggleDock}\n className=\"hidden rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary md:inline-flex\"\n aria-label={\n docked\n ? tr('healthybowl.assistant.header.float', 'Float chat window')\n : tr('healthybowl.assistant.header.dock', 'Dock to side panel')\n }\n aria-pressed={docked}\n data-testid=\"assistant-toggle-dock\"\n >\n {docked ? <PanelBottom className=\"size-4\" /> : <PanelRight className=\"size-4\" />}\n </button>\n )}\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary\"\n aria-label={tr('healthybowl.assistant.header.close', 'Close assistant')}\n data-testid=\"assistant-close\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AA2BA,IAAa,KAA8B,EACzC,iBACA,sBACA,kBACA,gBACA,YACA,WACA,sBACI;CACJ,IAAM,IAAK,EAAM;CAEjB,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CAEE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,QAAD;IAAM,WAAU;cACd,kBAAC,GAAD,EAAU,WAAU,SAAU,CAAA;GAC1B,CAAA,GACN,kBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,kBAAC,QAAD;KAAM,WAAU;eACb,EAAG,sCAAsC,gBAAgB;IACtD,CAAA,GACN,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACG,EAAG,sCAAsC,OAAO;MACjD,kBAAC,QAAD;OAAM,eAAY;iBAAO;MAAS,CAAA;MACjC,EAAG,wCAAwC,qBAAqB,EAAE,MAAM,EAAa,CAAC;KACnF;MACF;KACH;MAGL,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cAAY,EAAG,gDAAgD,kBAAkB;KACjF,eAAY;eAEZ,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;IACpB,CAAA;IACR,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAW,sCACT,IACI,mDACA;KAEN,cAAY,EAAG,wCAAwC,sBAAsB;KAC7E,gBAAc;KACd,eAAY;eAEZ,kBAAC,GAAD,EAAS,WAAU,SAAU,CAAA;IACvB,CAAA;IAER,kBAAC,GAAD,CAAoB,CAAA;IACnB,KACC,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cACE,IACI,EAAG,sCAAsC,mBAAmB,IAC5D,EAAG,qCAAqC,oBAAoB;KAElE,gBAAc;KACd,eAAY;eAEF,EAAT,IAAU,IAAqC,GAAtC,EAAa,WAAU,SAAU,CAAoC;IACzE,CAAA;IAEV,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cAAY,EAAG,sCAAsC,iBAAiB;KACtE,eAAY;eAEZ,kBAAC,GAAD,EAAG,WAAU,SAAU,CAAA;IACjB,CAAA;GACL;IACF;;AAET"}
@@ -0,0 +1,111 @@
1
+ import { useAssistantStore as e } from "../../store/assistantStore.js";
2
+ import { useTr as t } from "../../shared/hooks/useTr.js";
3
+ import { downloadFile as n, exportConversation as r } from "../../services/assistantExportService.js";
4
+ import { useAssistantSpeech as i } from "./AssistantSpeechProvider.js";
5
+ import { AssistantVoiceSelector as a } from "./composer/AssistantVoiceSelector.js";
6
+ import { useEffect as o, useRef as s, useState as c } from "react";
7
+ import { Check as l, FileJson as u, FileText as d, MoreHorizontal as f, Volume2 as p } from "lucide-react";
8
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
9
+ //#region src/components/assistant/AssistantMoreMenu.tsx
10
+ var _ = () => {
11
+ let _ = t(), [v, y] = c(!1), b = s(null), x = s(null), { conversations: S, activeConversationId: C } = e(), w = S.find((e) => e.id === C), T = !!(w && w.messages.length > 0), { isSupported: E, isBlocked: D, disabledReason: O, autoSpeakEnabled: k, setAutoSpeak: A, stop: j } = i(), M = D && !k;
12
+ o(() => {
13
+ if (!v) return;
14
+ let e = (e) => {
15
+ e.key === "Escape" && (y(!1), x.current?.focus());
16
+ }, t = (e) => {
17
+ let t = e.target;
18
+ b.current?.contains(t) || x.current?.contains(t) || y(!1);
19
+ };
20
+ return window.addEventListener("keydown", e), document.addEventListener("mousedown", t), () => {
21
+ window.removeEventListener("keydown", e), document.removeEventListener("mousedown", t);
22
+ };
23
+ }, [v]);
24
+ let N = (e) => {
25
+ if (!w) return;
26
+ let { content: t, filename: i, mimeType: a } = r(w, e);
27
+ n(t, i, a), y(!1);
28
+ }, P = () => {
29
+ k && j(), A(!k);
30
+ }, F = _("healthybowl.assistant.header.more", "More options");
31
+ return /* @__PURE__ */ g("div", {
32
+ className: "relative",
33
+ children: [/* @__PURE__ */ h("button", {
34
+ ref: x,
35
+ type: "button",
36
+ onClick: () => y((e) => !e),
37
+ className: "rounded p-1 transition-colors hover:bg-bg-elevated",
38
+ "aria-label": F,
39
+ "aria-haspopup": "menu",
40
+ "aria-expanded": v,
41
+ "data-testid": "assistant-more",
42
+ children: /* @__PURE__ */ h(f, { className: "size-4 text-text-secondary" })
43
+ }), v ? /* @__PURE__ */ g("div", {
44
+ ref: b,
45
+ role: "menu",
46
+ "aria-label": F,
47
+ className: "absolute right-0 top-full z-50 mt-1 min-w-56 overflow-hidden rounded-xl border border-border-default bg-bg-surface py-1 shadow-lg",
48
+ "data-testid": "assistant-more-menu",
49
+ children: [
50
+ E ? /* @__PURE__ */ g("button", {
51
+ type: "button",
52
+ role: "menuitemcheckbox",
53
+ "aria-checked": k,
54
+ onClick: P,
55
+ disabled: M,
56
+ title: M ? O ?? void 0 : void 0,
57
+ className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-transparent",
58
+ "data-testid": "assistant-auto-speak",
59
+ children: [
60
+ /* @__PURE__ */ h(p, {
61
+ className: "size-3.5 flex-shrink-0 text-text-secondary",
62
+ "aria-hidden": "true"
63
+ }),
64
+ /* @__PURE__ */ h("span", {
65
+ className: "flex-1",
66
+ children: _("healthybowl.assistant.header.autoRead", "Auto-read replies")
67
+ }),
68
+ k ? /* @__PURE__ */ h(l, { className: "size-3.5 flex-shrink-0 text-action-primary-bg" }) : null
69
+ ]
70
+ }) : null,
71
+ /* @__PURE__ */ h("div", {
72
+ className: "px-3 py-1.5",
73
+ "data-testid": "assistant-more-voice",
74
+ children: /* @__PURE__ */ h(a, {})
75
+ }),
76
+ T ? /* @__PURE__ */ g(m, { children: [
77
+ /* @__PURE__ */ h("div", {
78
+ className: "my-1 border-t border-border-subtle",
79
+ role: "separator"
80
+ }),
81
+ /* @__PURE__ */ g("button", {
82
+ type: "button",
83
+ role: "menuitem",
84
+ onClick: () => N("json"),
85
+ className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated",
86
+ "data-testid": "export-json",
87
+ children: [/* @__PURE__ */ h(u, {
88
+ className: "size-3.5 flex-shrink-0 text-text-secondary",
89
+ "aria-hidden": "true"
90
+ }), _("healthybowl.assistant.export.json", "Export as JSON")]
91
+ }),
92
+ /* @__PURE__ */ g("button", {
93
+ type: "button",
94
+ role: "menuitem",
95
+ onClick: () => N("markdown"),
96
+ className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated",
97
+ "data-testid": "export-markdown",
98
+ children: [/* @__PURE__ */ h(d, {
99
+ className: "size-3.5 flex-shrink-0 text-text-secondary",
100
+ "aria-hidden": "true"
101
+ }), _("healthybowl.assistant.export.markdown", "Export as Markdown")]
102
+ })
103
+ ] }) : null
104
+ ]
105
+ }) : null]
106
+ });
107
+ };
108
+ //#endregion
109
+ export { _ as AssistantMoreMenu };
110
+
111
+ //# sourceMappingURL=AssistantMoreMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssistantMoreMenu.js","names":[],"sources":["../../../src/components/assistant/AssistantMoreMenu.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type FC } from 'react';\nimport { Check, FileJson, FileText, MoreHorizontal, Volume2 } from 'lucide-react';\nimport { useAssistantStore } from '@/store/assistantStore';\nimport { exportConversation, downloadFile } from '@/services/assistantExportService';\nimport { useAssistantSpeech } from './AssistantSpeechProvider';\nimport { AssistantVoiceSelector } from './composer/AssistantVoiceSelector';\nimport { useTr } from '../../shared/hooks/useTr';\n\n/**\n * The header's secondary surface — everything that CONFIGURES the assistant.\n *\n * ★ `+` supplies content, `⋯` configures. Keeping those two meanings apart is\n * the point: the header carried seven controls, and three of them\n * (auto-read, the voice picker, export) render null under conditions the user\n * cannot see — no speech support, fewer than two voices, an empty conversation —\n * so the row silently changed width between devices and between the first and\n * second message of the same session.\n *\n * Now four primary controls, always present, and one menu that absorbs the\n * conditional ones. A menu ROW may still hide itself; a menu that keeps its\n * position while its contents vary is a much smaller surprise than a toolbar\n * that reflows.\n *\n * ★ Export is FLATTENED into this menu rather than nested inside it. It was\n * itself a dropdown, and a dropdown inside a dropdown is two Escape presses and\n * two outside-click regions for two menu items.\n *\n * ★ The voice picker keeps its native `<select>`. It is deliberate — see that\n * component — and a custom listbox would look tidier in a screenshot while being\n * worse on the phones this product is used on. Because the select lives inside\n * the menu's own subtree, the outside-click handler ignores clicks on it.\n *\n * Not included, deliberately: Live captions and Assistant settings have nothing\n * behind them yet, and a Transcript entry needs a product decision first (the\n * voice transcript is session-scoped, while the chat thread is always visible —\n * one menu label cannot honestly mean both).\n */\nexport const AssistantMoreMenu: FC = () => {\n const tr = useTr();\n const [open, setOpen] = useState(false);\n const menuRef = useRef<HTMLDivElement>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n const { conversations, activeConversationId } = useAssistantStore();\n const activeConversation = conversations.find((conversation) => conversation.id === activeConversationId);\n const canExport = Boolean(activeConversation && activeConversation.messages.length > 0);\n\n const { isSupported, isBlocked, disabledReason, autoSpeakEnabled, setAutoSpeak, stop } = useAssistantSpeech();\n // Blocked and already off means turning it on would do nothing audible.\n const autoReadDisabled = isBlocked && !autoSpeakEnabled;\n\n useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false);\n buttonRef.current?.focus();\n }\n };\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (menuRef.current?.contains(target) || buttonRef.current?.contains(target)) return;\n setOpen(false);\n };\n window.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onPointerDown);\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onPointerDown);\n };\n }, [open]);\n\n const handleExport = (format: 'json' | 'markdown') => {\n if (!activeConversation) return;\n const { content, filename, mimeType } = exportConversation(activeConversation, format);\n downloadFile(content, filename, mimeType);\n setOpen(false);\n };\n\n const toggleAutoRead = () => {\n // Turning it OFF stops whatever is speaking now: leaving audio running\n // after the user switched the feature off reads as the control not working.\n if (autoSpeakEnabled) stop();\n setAutoSpeak(!autoSpeakEnabled);\n };\n\n const label = tr('healthybowl.assistant.header.more', 'More options');\n\n return (\n <div className=\"relative\">\n <button\n ref={buttonRef}\n type=\"button\"\n onClick={() => setOpen((wasOpen) => !wasOpen)}\n className=\"rounded p-1 transition-colors hover:bg-bg-elevated\"\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n data-testid=\"assistant-more\"\n >\n <MoreHorizontal className=\"size-4 text-text-secondary\" />\n </button>\n\n {open ? (\n <div\n ref={menuRef}\n role=\"menu\"\n aria-label={label}\n className=\"absolute right-0 top-full z-50 mt-1 min-w-56 overflow-hidden rounded-xl border border-border-default bg-bg-surface py-1 shadow-lg\"\n data-testid=\"assistant-more-menu\"\n >\n {isSupported ? (\n <button\n type=\"button\"\n role=\"menuitemcheckbox\"\n aria-checked={autoSpeakEnabled}\n onClick={toggleAutoRead}\n disabled={autoReadDisabled}\n title={autoReadDisabled ? (disabledReason ?? undefined) : undefined}\n className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-transparent\"\n data-testid=\"assistant-auto-speak\"\n >\n <Volume2 className=\"size-3.5 flex-shrink-0 text-text-secondary\" aria-hidden=\"true\" />\n <span className=\"flex-1\">{tr('healthybowl.assistant.header.autoRead', 'Auto-read replies')}</span>\n {/* State as a tick rather than the word \"On\": the row is already a\n checkbox to assistive technology via aria-checked. */}\n {autoSpeakEnabled ? <Check className=\"size-3.5 flex-shrink-0 text-action-primary-bg\" /> : null}\n </button>\n ) : null}\n\n {/* Renders nothing when the device offers fewer than two voices, which\n is most of them until a hosted TTS endpoint is configured. */}\n <div className=\"px-3 py-1.5\" data-testid=\"assistant-more-voice\">\n <AssistantVoiceSelector />\n </div>\n\n {canExport ? (\n <>\n <div className=\"my-1 border-t border-border-subtle\" role=\"separator\" />\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => handleExport('json')}\n className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated\"\n data-testid=\"export-json\"\n >\n <FileJson className=\"size-3.5 flex-shrink-0 text-text-secondary\" aria-hidden=\"true\" />\n {tr('healthybowl.assistant.export.json', 'Export as JSON')}\n </button>\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => handleExport('markdown')}\n className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left text-xs text-text-primary transition-colors hover:bg-bg-elevated\"\n data-testid=\"export-markdown\"\n >\n <FileText className=\"size-3.5 flex-shrink-0 text-text-secondary\" aria-hidden=\"true\" />\n {tr('healthybowl.assistant.export.markdown', 'Export as Markdown')}\n </button>\n </>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n};\n"],"mappings":"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"}
@@ -1,7 +1,6 @@
1
- import "./AssistantExportMenu.js";
2
1
  import "./AssistantToolActivity.js";
3
2
  import "./AssistantSpeechProvider.js";
4
- import "./AssistantAutoSpeakToggle.js";
3
+ import "./AssistantMoreMenu.js";
5
4
  import "./AssistantHeader.js";
6
5
  import "./AssistantMarkdownRenderer.js";
7
6
  import "./AssistantMessageAttachments.js";
@@ -17,3 +16,4 @@ import "./composer/AssistantComposer.js";
17
16
  import "./AssistantChatArea.js";
18
17
  import "./AssistantConversationList.js";
19
18
  import "./AIAssistantPanel.js";
19
+ import "./AssistantAutoSpeakToggle.js";
@@ -0,0 +1,59 @@
1
+ import { loadRazorpayCheckout as e } from "./useOrderPayments.js";
2
+ import { useCallback as t, useMemo as n } from "react";
3
+ import { gql as r } from "@apollo/client";
4
+ import { useMutation as i } from "@apollo/client/react";
5
+ //#region src/healthybowl/hooks/useConsultationPayments.ts
6
+ var a = r`
7
+ mutation CheckoutHealthyBowlConsultation($consultationId: ID!, $context: ContextInput!) {
8
+ checkoutHealthyBowlConsultation(consultationId: $consultationId, context: $context) {
9
+ consultationId
10
+ billingOrderId
11
+ provider
12
+ providerOrderId
13
+ razorpayKeyId
14
+ clientSecret
15
+ subtotal
16
+ taxAmount
17
+ total
18
+ currency
19
+ }
20
+ }
21
+ `, o = r`
22
+ mutation SyncHealthyBowlConsultationPayment($consultationId: ID!, $context: ContextInput!) {
23
+ syncHealthyBowlConsultationPayment(consultationId: $consultationId, context: $context) {
24
+ id
25
+ status
26
+ paymentStatus
27
+ paymentProvider
28
+ paymentReference
29
+ paidAmount
30
+ paidAt
31
+ }
32
+ }
33
+ `;
34
+ function s() {
35
+ let r = n(() => ({}), []), [s] = i(a), [c] = i(o);
36
+ return {
37
+ checkoutConsultation: t(async (e) => {
38
+ let t = (await s({ variables: {
39
+ consultationId: e,
40
+ context: r
41
+ } })).data?.checkoutHealthyBowlConsultation;
42
+ if (!t) throw Error("Checkout did not return a payment session");
43
+ return t;
44
+ }, [s, r]),
45
+ syncConsultationPayment: t(async (e) => {
46
+ let t = (await c({ variables: {
47
+ consultationId: e,
48
+ context: r
49
+ } })).data?.syncHealthyBowlConsultationPayment;
50
+ if (!t) throw Error("Payment sync did not return the consultation");
51
+ return t;
52
+ }, [r, c]),
53
+ loadRazorpay: e
54
+ };
55
+ }
56
+ //#endregion
57
+ export { s as useConsultationPayments };
58
+
59
+ //# sourceMappingURL=useConsultationPayments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConsultationPayments.js","names":[],"sources":["../../../src/healthybowl/hooks/useConsultationPayments.ts"],"sourcesContent":["/**\n * Real expert-consultation payments (BOFF-6030, slice B).\n *\n * The client starts checkout and asks HealthyBowl to settle afterwards. HealthyBowl re-reads the\n * authoritative Payment from global-billing, so this MFE never decides that money arrived or handles\n * card data. The documents stay inline because the committed workspace SDL snapshot predates these\n * operations; adding them under `src/operations/wspace` would make codegen validate them too early.\n */\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport { useCallback, useMemo } from 'react';\nimport type { Consultation } from '../types';\nimport { loadRazorpayCheckout } from './useOrderPayments';\n\n/** Everything the client needs to open the payment provider's checkout for one consultation. */\nexport interface ConsultationCheckout {\n consultationId: string;\n billingOrderId: string;\n /** RAZORPAY / STRIPE — selected by platform billing. */\n provider: string;\n /** Razorpay `order_xxx`; absent when billing routes to another provider. */\n providerOrderId?: string | null;\n /** Publishable Razorpay key returned at runtime by billing, never hard-coded. */\n razorpayKeyId?: string | null;\n /** Stripe client secret; this MFE does not implement the Stripe checkout path yet. */\n clientSecret?: string | null;\n subtotal: number;\n taxAmount: number;\n total: number;\n currency: string;\n}\n\n/** Payment details mirrored by HealthyBowl only after it settles against platform billing. */\nexport type ConsultationPayment = Pick<\n Consultation,\n 'id' | 'status' | 'paymentStatus' | 'paymentProvider' | 'paymentReference' | 'paidAmount' | 'paidAt'\n>;\n\nconst CHECKOUT_CONSULTATION = gql`\n mutation CheckoutHealthyBowlConsultation($consultationId: ID!, $context: ContextInput!) {\n checkoutHealthyBowlConsultation(consultationId: $consultationId, context: $context) {\n consultationId\n billingOrderId\n provider\n providerOrderId\n razorpayKeyId\n clientSecret\n subtotal\n taxAmount\n total\n currency\n }\n }\n`;\n\nconst SYNC_CONSULTATION_PAYMENT = gql`\n mutation SyncHealthyBowlConsultationPayment($consultationId: ID!, $context: ContextInput!) {\n syncHealthyBowlConsultationPayment(consultationId: $consultationId, context: $context) {\n id\n status\n paymentStatus\n paymentProvider\n paymentReference\n paidAmount\n paidAt\n }\n }\n`;\n\ninterface CheckoutConsultationData {\n checkoutHealthyBowlConsultation: ConsultationCheckout;\n}\n\ninterface SyncConsultationPaymentData {\n syncHealthyBowlConsultationPayment: ConsultationPayment;\n}\n\ninterface ConsultationCheckoutVariables {\n consultationId: string;\n context: Record<string, never>;\n}\n\ninterface SyncConsultationPaymentVariables {\n consultationId: string;\n context: Record<string, never>;\n}\n\n/**\n * Starts idempotent platform-billing checkout sessions and settles their authoritative result.\n * `loadRazorpay` deliberately delegates to the shared lazy script loader, so marketplace and\n * consultation checkout inject at most one provider script per page.\n */\nexport function useConsultationPayments() {\n // Wspace identity is gateway-authoritative; this required GraphQL input intentionally carries no\n // client-held workspace id.\n const context = useMemo<Record<string, never>>(() => ({}), []);\n const [checkoutMutation] = useMutation<CheckoutConsultationData, ConsultationCheckoutVariables>(\n CHECKOUT_CONSULTATION\n );\n const [syncMutation] = useMutation<SyncConsultationPaymentData, SyncConsultationPaymentVariables>(\n SYNC_CONSULTATION_PAYMENT\n );\n\n const checkoutConsultation = useCallback(\n async (consultationId: string): Promise<ConsultationCheckout> => {\n const result = await checkoutMutation({ variables: { consultationId, context } });\n const checkout = result.data?.checkoutHealthyBowlConsultation;\n if (!checkout) throw new Error('Checkout did not return a payment session');\n return checkout;\n },\n [checkoutMutation, context]\n );\n\n const syncConsultationPayment = useCallback(\n async (consultationId: string): Promise<ConsultationPayment> => {\n const result = await syncMutation({ variables: { consultationId, context } });\n const consultation = result.data?.syncHealthyBowlConsultationPayment;\n if (!consultation) throw new Error('Payment sync did not return the consultation');\n return consultation;\n },\n [context, syncMutation]\n );\n\n const loadRazorpay = loadRazorpayCheckout;\n\n return { checkoutConsultation, syncConsultationPayment, loadRazorpay };\n}\n"],"mappings":";;;;;AAsCA,IAAM,IAAwB,CAAG;;;;;;;;;;;;;;;GAiB3B,IAA4B,CAAG;;;;;;;;;;;;;AAqCrC,SAAgB,IAA0B;CAGxC,IAAM,IAAU,SAAsC,CAAC,IAAI,CAAC,CAAC,GACvD,CAAC,KAAoB,EACzB,CACF,GACM,CAAC,KAAgB,EACrB,CACF;CAwBA,OAAO;EAAE,sBAtBoB,EAC3B,OAAO,MAA0D;GAE/D,IAAM,KAAW,MADI,EAAiB,EAAE,WAAW;IAAE;IAAgB;GAAQ,EAAE,CAAC,GACxD,MAAM;GAC9B,IAAI,CAAC,GAAU,MAAU,MAAM,2CAA2C;GAC1E,OAAO;EACT,GACA,CAAC,GAAkB,CAAO,CAenB;EAAsB,yBAZC,EAC9B,OAAO,MAAyD;GAE9D,IAAM,KAAe,MADA,EAAa,EAAE,WAAW;IAAE;IAAgB;GAAQ,EAAE,CAAC,GAChD,MAAM;GAClC,IAAI,CAAC,GAAc,MAAU,MAAM,8CAA8C;GACjF,OAAO;EACT,GACA,CAAC,GAAS,CAAY,CAKO;EAAyB,cAAA;CAAa;AACvE"}
@@ -289,6 +289,11 @@ var Dt = a`
289
289
  notes
290
290
  fee
291
291
  status
292
+ paymentStatus
293
+ paymentProvider
294
+ paymentReference
295
+ paidAmount
296
+ paidAt
292
297
  createdAt
293
298
  }
294
299
  }
@@ -305,6 +310,11 @@ var Dt = a`
305
310
  notes
306
311
  fee
307
312
  status
313
+ paymentStatus
314
+ paymentProvider
315
+ paymentReference
316
+ paidAmount
317
+ paidAt
308
318
  createdAt
309
319
  }
310
320
  }
@@ -321,6 +331,11 @@ var Dt = a`
321
331
  notes
322
332
  fee
323
333
  status
334
+ paymentStatus
335
+ paymentProvider
336
+ paymentReference
337
+ paidAmount
338
+ paidAt
324
339
  createdAt
325
340
  }
326
341
  }