@burdenoff/microfe-healthybowl 2026.902.12 → 2026.902.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,86 @@
1
1
  import { useTr as e } from "../../../shared/hooks/useTr.js";
2
- import { ATTACHMENT_ACCEPT as t } from "../../../utils/assistantAttachments.js";
3
- import { useCallback as n, useRef as r } from "react";
4
- import { Plus as i } from "lucide-react";
5
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
2
+ import "../../../utils/assistantAttachments.js";
3
+ import { availableAttachmentSources as t, deviceHasCamera as n } from "../../../utils/attachmentSources.js";
4
+ import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
5
+ import { Camera as c, FileText as l, FolderOpen as u, ImageIcon as d, Plus as f } from "lucide-react";
6
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
7
  //#region src/components/assistant/composer/AssistantAttachmentButton.tsx
7
- var c = ({ onFiles: c, canAddMore: l, disabled: u = !1 }) => {
8
- let d = e(), f = r(null), p = l ? d("healthybowl.assistant.composer.attach", "Attach files or photos") : d("healthybowl.assistant.composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
9
- return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("input", {
10
- ref: f,
11
- type: "file",
12
- multiple: !0,
13
- accept: t,
14
- className: "hidden",
15
- onChange: n((e) => {
16
- c(e.target.files), e.target.value = "";
17
- }, [c]),
18
- tabIndex: -1,
19
- "aria-hidden": "true",
20
- "data-testid": "assistant-attach-input"
21
- }), /* @__PURE__ */ o("button", {
22
- type: "button",
23
- onClick: () => f.current?.click(),
24
- disabled: u || !l,
25
- title: p,
26
- "aria-label": p,
27
- className: "flex size-9 flex-shrink-0 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated",
28
- "data-testid": "assistant-attach",
29
- children: /* @__PURE__ */ o(i, { className: "size-4" })
30
- })] });
8
+ var h = {
9
+ camera: c,
10
+ gallery: d,
11
+ documents: l,
12
+ files: u
13
+ }, g = ({ onFiles: c, canAddMore: l, disabled: u = !1 }) => {
14
+ let d = e(), g = o(null), _ = o(null), v = o(null), [y, b] = s(!1), x = a(() => t(n()), []), S = l ? d("healthybowl.assistant.composer.attach", "Attach files or photos") : d("healthybowl.assistant.composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
15
+ i(() => {
16
+ if (!y) return;
17
+ let e = (e) => {
18
+ e.key === "Escape" && (b(!1), v.current?.focus());
19
+ }, t = (e) => {
20
+ let t = e.target;
21
+ _.current?.contains(t) || v.current?.contains(t) || b(!1);
22
+ };
23
+ return window.addEventListener("keydown", e), window.addEventListener("mousedown", t), () => {
24
+ window.removeEventListener("keydown", e), window.removeEventListener("mousedown", t);
25
+ };
26
+ }, [y]);
27
+ let C = r((e) => {
28
+ c(e.target.files), e.target.value = "";
29
+ }, [c]), w = r((e) => {
30
+ let t = g.current;
31
+ t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), b(!1), t.click());
32
+ }, []);
33
+ return /* @__PURE__ */ m("div", {
34
+ className: "relative flex-shrink-0",
35
+ children: [
36
+ /* @__PURE__ */ p("input", {
37
+ ref: g,
38
+ type: "file",
39
+ multiple: !0,
40
+ className: "hidden",
41
+ onChange: C,
42
+ tabIndex: -1,
43
+ "aria-hidden": "true",
44
+ "data-testid": "assistant-attach-input"
45
+ }),
46
+ /* @__PURE__ */ p("button", {
47
+ ref: v,
48
+ type: "button",
49
+ onClick: () => b((e) => !e),
50
+ disabled: u || !l,
51
+ title: S,
52
+ "aria-label": S,
53
+ "aria-haspopup": "menu",
54
+ "aria-expanded": y,
55
+ className: "flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated",
56
+ "data-testid": "assistant-attach",
57
+ children: /* @__PURE__ */ p(f, { className: "size-4" })
58
+ }),
59
+ y ? /* @__PURE__ */ p("div", {
60
+ ref: _,
61
+ role: "menu",
62
+ "aria-label": d("healthybowl.assistant.composer.attachSource", "Attach from"),
63
+ className: "absolute bottom-full left-0 z-30 mb-2 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg",
64
+ "data-testid": "assistant-attach-menu",
65
+ children: x.map((e) => {
66
+ let t = h[e.id];
67
+ return /* @__PURE__ */ m("button", {
68
+ type: "button",
69
+ role: "menuitem",
70
+ onClick: () => w(e),
71
+ className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken",
72
+ "data-testid": `assistant-attach-source-${e.id}`,
73
+ children: [/* @__PURE__ */ p(t, {
74
+ className: "size-4 flex-shrink-0 text-text-secondary",
75
+ "aria-hidden": "true"
76
+ }), d(e.labelKey, e.labelFallback)]
77
+ }, e.id);
78
+ })
79
+ }) : null
80
+ ]
81
+ });
31
82
  };
32
83
  //#endregion
33
- export { c as AssistantAttachmentButton };
84
+ export { g as AssistantAttachmentButton };
34
85
 
35
86
  //# sourceMappingURL=AssistantAttachmentButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantAttachmentButton.js","names":[],"sources":["../../../../src/components/assistant/composer/AssistantAttachmentButton.tsx"],"sourcesContent":["import { useCallback, useRef, type ChangeEvent, type FC } from 'react';\nimport { Plus } from 'lucide-react';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { ATTACHMENT_ACCEPT, MAX_ATTACHMENTS } from '@/utils/assistantAttachments';\n\ninterface Props {\n onFiles: (files: FileList | null) => void;\n /** False once MAX_ATTACHMENTS is reached — the control explains why. */\n canAddMore: boolean;\n disabled?: boolean;\n}\n\n/**\n * Leading circular \"+\" attach control in the composer (Workstream 3). Opens the\n * native picker over a hidden multi-file input; drag-drop and paste are handled\n * by the composer itself so all three entry points converge on `onFiles`.\n *\n * `accept` is advisory — the picker still allows \"All files\" on most platforms —\n * so validation lives in `validateFile`, not here. It is nonetheless the app's\n * only PROMISE about what the assistant can read, which is why it is derived\n * from the classifier/extractor tables (`ATTACHMENT_ACCEPT`) rather than typed\n * out: the previous hand-written list advertised .pdf/.docx/.xlsx a year before\n * anything could open them.\n */\nexport const AssistantAttachmentButton: FC<Props> = ({ onFiles, canAddMore, disabled = false }) => {\n const tr = useTr();\n const inputRef = useRef<HTMLInputElement>(null);\n\n const label = canAddMore\n ? tr('healthybowl.assistant.composer.attach', 'Attach files or photos')\n : tr('healthybowl.assistant.composer.attachFull', 'Attachment limit reached ({{max}})', {\n max: MAX_ATTACHMENTS,\n });\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onFiles(event.target.files);\n // Reset so picking the SAME file twice in a row still fires a change event.\n event.target.value = '';\n },\n [onFiles]\n );\n\n return (\n <>\n <input\n ref={inputRef}\n type=\"file\"\n multiple\n accept={ATTACHMENT_ACCEPT}\n className=\"hidden\"\n onChange={handleChange}\n tabIndex={-1}\n aria-hidden=\"true\"\n data-testid=\"assistant-attach-input\"\n />\n <button\n type=\"button\"\n onClick={() => inputRef.current?.click()}\n disabled={disabled || !canAddMore}\n title={label}\n aria-label={label}\n className=\"flex size-9 flex-shrink-0 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated\"\n data-testid=\"assistant-attach\"\n >\n <Plus className=\"size-4\" />\n </button>\n </>\n );\n};\n"],"mappings":";;;;;;AAwBA,IAAa,KAAwC,EAAE,YAAS,eAAY,cAAW,SAAY;CACjG,IAAM,IAAK,EAAM,GACX,IAAW,EAAyB,IAAI,GAExC,IAAQ,IACV,EAAG,yCAAyC,wBAAwB,IACpE,EAAG,6CAA6C,sCAAsC,EACpF,KAAA,EACF,CAAC;CAWL,OACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,SAAD;EACE,KAAK;EACL,MAAK;EACL,UAAA;EACA,QAAQ;EACR,WAAU;EACV,UAjBe,GAClB,MAAyC;GAGxC,AAFA,EAAQ,EAAM,OAAO,KAAK,GAE1B,EAAM,OAAO,QAAQ;EACvB,GACA,CAAC,CAAO,CAWM;EACV,UAAU;EACV,eAAY;EACZ,eAAY;CACb,CAAA,GACD,kBAAC,UAAD;EACE,MAAK;EACL,eAAe,EAAS,SAAS,MAAM;EACvC,UAAU,KAAY,CAAC;EACvB,OAAO;EACP,cAAY;EACZ,WAAU;EACV,eAAY;YAEZ,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;CACpB,CAAA,CACR,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"AssistantAttachmentButton.js","names":[],"sources":["../../../../src/components/assistant/composer/AssistantAttachmentButton.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState, type ChangeEvent, type FC } from 'react';\nimport { Camera, FileText, FolderOpen, ImageIcon, Plus } from 'lucide-react';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { MAX_ATTACHMENTS } from '@/utils/assistantAttachments';\nimport {\n availableAttachmentSources,\n deviceHasCamera,\n type AttachmentSource,\n type AttachmentSourceId,\n} from '@/utils/attachmentSources';\n\ninterface Props {\n onFiles: (files: FileList | null) => void;\n /** False once MAX_ATTACHMENTS is reached — the control explains why. */\n canAddMore: boolean;\n disabled?: boolean;\n}\n\nconst SOURCE_ICONS: Record<AttachmentSourceId, typeof Camera> = {\n camera: Camera,\n gallery: ImageIcon,\n documents: FileText,\n files: FolderOpen,\n};\n\n/**\n * Leading circular \"+\" attach control in the composer.\n *\n * ★ Opens a SOURCE MENU rather than the OS picker directly. One picker had to\n * stand in for every source, and on a phone it lands in Files — so\n * photographing a diseased leaf, the single most likely thing a farmer wants to\n * show the assistant, meant leaving for the camera app and coming back.\n *\n * ★ One input, reconfigured per source, rather than one input each. `accept` and\n * `capture` are set immediately before `.click()`, so there is exactly one place\n * a change event can arrive from and the existing `onFiles` contract — shared\n * with drag-drop and paste — is untouched.\n *\n * ★ Camera uses the `capture` attribute rather than a bespoke `getUserMedia`\n * viewfinder. That hands capture → preview → retake → use to the OS camera,\n * which does it better, is already localised, and cannot be exercised on a\n * desktop CI box at all; on a device without a camera the attribute is ignored\n * and the picker opens as usual, so it degrades instead of breaking.\n *\n * `accept` is advisory — the picker still allows \"All files\" on most platforms —\n * so validation lives in `validateFile`, not here.\n */\nexport const AssistantAttachmentButton: FC<Props> = ({ onFiles, canAddMore, disabled = false }) => {\n const tr = useTr();\n const inputRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n\n // Read once per mount: a device does not sprout a camera mid-session, and\n // matchMedia in render would run on every keystroke in the composer.\n const sources = useMemo(() => availableAttachmentSources(deviceHasCamera()), []);\n\n const label = canAddMore\n ? tr('healthybowl.assistant.composer.attach', 'Attach files or photos')\n : tr('healthybowl.assistant.composer.attachFull', 'Attachment limit reached ({{max}})', {\n max: MAX_ATTACHMENTS,\n });\n\n // Escape closes, and a click anywhere else closes — the same contract as the\n // export menu, so the two dropdowns in this panel behave identically.\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 window.addEventListener('mousedown', onPointerDown);\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('mousedown', onPointerDown);\n };\n }, [open]);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onFiles(event.target.files);\n // Reset so picking the SAME file twice in a row still fires a change event.\n event.target.value = '';\n },\n [onFiles]\n );\n\n const pick = useCallback((source: AttachmentSource) => {\n const input = inputRef.current;\n if (!input) return;\n input.accept = source.accept;\n input.multiple = source.multiple;\n // A property, not an attribute: `capture=\"\"` still means \"use the camera\",\n // so it has to be removed rather than blanked when the source is not camera.\n if (source.capture) input.setAttribute('capture', source.capture);\n else input.removeAttribute('capture');\n setOpen(false);\n input.click();\n }, []);\n\n return (\n <div className=\"relative flex-shrink-0\">\n <input\n ref={inputRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n onChange={handleChange}\n tabIndex={-1}\n aria-hidden=\"true\"\n data-testid=\"assistant-attach-input\"\n />\n <button\n ref={buttonRef}\n type=\"button\"\n onClick={() => setOpen((wasOpen) => !wasOpen)}\n disabled={disabled || !canAddMore}\n title={label}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n className=\"flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated\"\n data-testid=\"assistant-attach\"\n >\n <Plus className=\"size-4\" />\n </button>\n\n {open ? (\n <div\n ref={menuRef}\n role=\"menu\"\n aria-label={tr('healthybowl.assistant.composer.attachSource', 'Attach from')}\n // Opens UPWARD: the composer sits at the bottom of the panel, so a\n // downward menu would be clipped by the panel edge on every size.\n className=\"absolute bottom-full left-0 z-30 mb-2 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg\"\n data-testid=\"assistant-attach-menu\"\n >\n {sources.map((source) => {\n const Icon = SOURCE_ICONS[source.id];\n return (\n <button\n key={source.id}\n type=\"button\"\n role=\"menuitem\"\n onClick={() => pick(source)}\n className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken\"\n data-testid={`assistant-attach-source-${source.id}`}\n >\n <Icon className=\"size-4 flex-shrink-0 text-text-secondary\" aria-hidden=\"true\" />\n {tr(source.labelKey, source.labelFallback)}\n </button>\n );\n })}\n </div>\n ) : null}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAkBA,IAAM,IAA0D;CAC9D,QAAQ;CACR,SAAS;CACT,WAAW;CACX,OAAO;AACT,GAwBa,KAAwC,EAAE,YAAS,eAAY,cAAW,SAAY;CACjG,IAAM,IAAK,EAAM,GACX,IAAW,EAAyB,IAAI,GACxC,IAAU,EAAuB,IAAI,GACrC,IAAY,EAA0B,IAAI,GAC1C,CAAC,GAAM,KAAW,EAAS,EAAK,GAIhC,IAAU,QAAc,EAA2B,EAAgB,CAAC,GAAG,CAAC,CAAC,GAEzE,IAAQ,IACV,EAAG,yCAAyC,wBAAwB,IACpE,EAAG,6CAA6C,sCAAsC,EACpF,KAAA,EACF,CAAC;CAIL,QAAgB;EACd,IAAI,CAAC,GAAM;EACX,IAAM,KAAa,MAAyB;GAC1C,AAAI,EAAM,QAAQ,aAChB,EAAQ,EAAK,GACb,EAAU,SAAS,MAAM;EAE7B,GACM,KAAiB,MAAsB;GAC3C,IAAM,IAAS,EAAM;GACjB,EAAQ,SAAS,SAAS,CAAM,KAAK,EAAU,SAAS,SAAS,CAAM,KAC3E,EAAQ,EAAK;EACf;EAGA,OAFA,OAAO,iBAAiB,WAAW,CAAS,GAC5C,OAAO,iBAAiB,aAAa,CAAa,SACrC;GAEX,AADA,OAAO,oBAAoB,WAAW,CAAS,GAC/C,OAAO,oBAAoB,aAAa,CAAa;EACvD;CACF,GAAG,CAAC,CAAI,CAAC;CAET,IAAM,IAAe,GAClB,MAAyC;EAGxC,AAFA,EAAQ,EAAM,OAAO,KAAK,GAE1B,EAAM,OAAO,QAAQ;CACvB,GACA,CAAC,CAAO,CACV,GAEM,IAAO,GAAa,MAA6B;EACrD,IAAM,IAAQ,EAAS;EAClB,MACL,EAAM,SAAS,EAAO,QACtB,EAAM,WAAW,EAAO,UAGpB,EAAO,UAAS,EAAM,aAAa,WAAW,EAAO,OAAO,IAC3D,EAAM,gBAAgB,SAAS,GACpC,EAAQ,EAAK,GACb,EAAM,MAAM;CACd,GAAG,CAAC,CAAC;CAEL,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,SAAD;IACE,KAAK;IACL,MAAK;IACL,UAAA;IACA,WAAU;IACV,UAAU;IACV,UAAU;IACV,eAAY;IACZ,eAAY;GACb,CAAA;GACD,kBAAC,UAAD;IACE,KAAK;IACL,MAAK;IACL,eAAe,GAAS,MAAY,CAAC,CAAO;IAC5C,UAAU,KAAY,CAAC;IACvB,OAAO;IACP,cAAY;IACZ,iBAAc;IACd,iBAAe;IACf,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;GACpB,CAAA;GAEP,IACC,kBAAC,OAAD;IACE,KAAK;IACL,MAAK;IACL,cAAY,EAAG,+CAA+C,aAAa;IAG3E,WAAU;IACV,eAAY;cAEX,EAAQ,KAAK,MAAW;KACvB,IAAM,IAAO,EAAa,EAAO;KACjC,OACE,kBAAC,UAAD;MAEE,MAAK;MACL,MAAK;MACL,eAAe,EAAK,CAAM;MAC1B,WAAU;MACV,eAAa,2BAA2B,EAAO;gBANjD,CAQE,kBAAC,GAAD;OAAM,WAAU;OAA2C,eAAY;MAAQ,CAAA,GAC9E,EAAG,EAAO,UAAU,EAAO,aAAa,CACnC;QATD,EAAO,EASN;IAEZ,CAAC;GACE,CAAA,IACH;EACD;;AAET"}
@@ -0,0 +1,43 @@
1
+ import { ATTACHMENT_ACCEPT as e } from "./assistantAttachments.js";
2
+ var t = [
3
+ {
4
+ id: "camera",
5
+ labelKey: "healthybowl.assistant.composer.sourceCamera",
6
+ labelFallback: "Camera",
7
+ accept: "image/*",
8
+ capture: "environment",
9
+ multiple: !1,
10
+ mobileOnly: !0
11
+ },
12
+ {
13
+ id: "gallery",
14
+ labelKey: "healthybowl.assistant.composer.sourceGallery",
15
+ labelFallback: "Photos",
16
+ accept: "image/*",
17
+ multiple: !0
18
+ },
19
+ {
20
+ id: "documents",
21
+ labelKey: "healthybowl.assistant.composer.sourceDocuments",
22
+ labelFallback: "Documents",
23
+ accept: e.split(",").filter((e) => !e.startsWith("image/")).join(","),
24
+ multiple: !0
25
+ },
26
+ {
27
+ id: "files",
28
+ labelKey: "healthybowl.assistant.composer.sourceFiles",
29
+ labelFallback: "Files",
30
+ accept: e,
31
+ multiple: !0
32
+ }
33
+ ];
34
+ function n() {
35
+ return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(pointer: coarse)").matches;
36
+ }
37
+ function r(e) {
38
+ return t.filter((t) => !t.mobileOnly || e);
39
+ }
40
+ //#endregion
41
+ export { r as availableAttachmentSources, n as deviceHasCamera };
42
+
43
+ //# sourceMappingURL=attachmentSources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachmentSources.js","names":[],"sources":["../../src/utils/attachmentSources.ts"],"sourcesContent":["/**\n * Where an attachment can come from.\n *\n * `+` used to open the OS picker directly, which is one source pretending to be\n * all of them: on a phone it lands in Files, so photographing a diseased leaf —\n * the single most likely thing a farmer wants to show the assistant — took a\n * detour through the camera app and back.\n *\n * ★ Every source's `accept` is DERIVED, never typed out. `ATTACHMENT_ACCEPT` is\n * itself built from the classifier and extractor tables precisely so the picker\n * cannot offer a file the model then admits it cannot read — a hand-written list\n * once advertised .pdf a year before anything could open one. Narrowing a source\n * therefore filters that derived list rather than restating it, so a new\n * document format is offered here the moment the extractor learns it.\n *\n * ★ There is deliberately NO generic \"all files\" source, though the spec asks\n * for one. It would restore exactly the failure the derived list was written to\n * prevent. Every format the assistant can actually read is already reachable\n * through Documents or Files here; anything else is a file it would have to\n * refuse after the user had already chosen it.\n */\n\nimport { ATTACHMENT_ACCEPT } from './assistantAttachments';\n\nexport type AttachmentSourceId = 'camera' | 'gallery' | 'documents' | 'files';\n\nexport interface AttachmentSource {\n id: AttachmentSourceId;\n /** i18n key and the English fallback, resolved by the caller. */\n labelKey: string;\n labelFallback: string;\n /** `accept` for this source's hidden input. */\n accept: string;\n /**\n * Ask for the camera rather than the gallery. Honoured on mobile browsers,\n * where the OS camera provides capture → preview → retake → use for free;\n * ignored on desktop, which falls back to the file picker rather than\n * breaking.\n */\n capture?: 'environment' | 'user';\n /** Multi-select. A camera capture is one shot at a time. */\n multiple: boolean;\n /**\n * Only offer where it can work. Camera and gallery are pointless on a desktop\n * without one, and a control that does nothing is worse than an absent one.\n */\n mobileOnly?: boolean;\n}\n\n/**\n * The document half of the derived list: everything except images.\n *\n * Subtracted from `ATTACHMENT_ACCEPT` rather than rebuilt from the extension\n * tables, which are private to that module and should stay that way — and this\n * way a newly-supported document format appears here the moment the extractor\n * learns it, with nothing to remember.\n */\nconst DOCUMENT_ACCEPT = ATTACHMENT_ACCEPT.split(',')\n .filter((entry) => !entry.startsWith('image/'))\n .join(',');\n\nexport const ATTACHMENT_SOURCES: readonly AttachmentSource[] = [\n {\n id: 'camera',\n labelKey: 'healthybowl.assistant.composer.sourceCamera',\n labelFallback: 'Camera',\n accept: 'image/*',\n capture: 'environment',\n multiple: false,\n mobileOnly: true,\n },\n {\n id: 'gallery',\n labelKey: 'healthybowl.assistant.composer.sourceGallery',\n labelFallback: 'Photos',\n accept: 'image/*',\n multiple: true,\n },\n {\n id: 'documents',\n labelKey: 'healthybowl.assistant.composer.sourceDocuments',\n labelFallback: 'Documents',\n accept: DOCUMENT_ACCEPT,\n multiple: true,\n },\n {\n id: 'files',\n labelKey: 'healthybowl.assistant.composer.sourceFiles',\n labelFallback: 'Files',\n accept: ATTACHMENT_ACCEPT,\n multiple: true,\n },\n] as const;\n\n/**\n * Can this device plausibly take a photo?\n *\n * Coarse on purpose. `mediaDevices` is the honest capability check but it needs\n * a permission prompt to be sure, and asking for the camera to decide whether to\n * DRAW a camera button is backwards. A pointer query separates phones and\n * tablets from desktops well enough for a menu entry, and the worst case is a\n * touchscreen laptop seeing one extra option that still opens a working picker.\n */\nexport function deviceHasCamera(): boolean {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;\n return window.matchMedia('(pointer: coarse)').matches;\n}\n\n/** The sources worth showing on this device, in menu order. */\nexport function availableAttachmentSources(hasCamera: boolean): AttachmentSource[] {\n return ATTACHMENT_SOURCES.filter((source) => !source.mobileOnly || hasCamera);\n}\n"],"mappings":";AA6DA,IAAa,IAAkD;CAC7D;EACE,IAAI;EACJ,UAAU;EACV,eAAe;EACf,QAAQ;EACR,SAAS;EACT,UAAU;EACV,YAAY;CACd;CACA;EACE,IAAI;EACJ,UAAU;EACV,eAAe;EACf,QAAQ;EACR,UAAU;CACZ;CACA;EACE,IAAI;EACJ,UAAU;EACV,eAAe;EACf,QAzBoB,EAAkB,MAAM,GAAG,EAChD,QAAQ,MAAU,CAAC,EAAM,WAAW,QAAQ,CAAC,EAC7C,KAAK,GAuBI;EACR,UAAU;CACZ;CACA;EACE,IAAI;EACJ,UAAU;EACV,eAAe;EACf,QAAQ;EACR,UAAU;CACZ;AACF;AAWA,SAAgB,IAA2B;CAEzC,OADI,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe,aAAmB,KAC9E,OAAO,WAAW,mBAAmB,EAAE;AAChD;AAGA,SAAgB,EAA2B,GAAwC;CACjF,OAAO,EAAmB,QAAQ,MAAW,CAAC,EAAO,cAAc,CAAS;AAC9E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.902.12",
3
+ "version": "2026.902.13",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [