@eka-care/medical-records-ui 1.0.8 → 1.0.10
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.
- package/dist/index.js +69 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45,6 +45,9 @@ function getCore() {
|
|
|
45
45
|
}
|
|
46
46
|
return core;
|
|
47
47
|
}
|
|
48
|
+
function setAuthToken(token) {
|
|
49
|
+
_optionalChain([core, 'optionalAccess', _2 => _2.setAuthToken, 'call', _3 => _3(token)]);
|
|
50
|
+
}
|
|
48
51
|
function teardownWorkerClient() {
|
|
49
52
|
core = null;
|
|
50
53
|
}
|
|
@@ -263,7 +266,7 @@ var createDetailsSlice = (set) => ({
|
|
|
263
266
|
details: {
|
|
264
267
|
byId: {},
|
|
265
268
|
setDetailLoading: (id) => set((state) => {
|
|
266
|
-
if (_optionalChain([state, 'access',
|
|
269
|
+
if (_optionalChain([state, 'access', _4 => _4.details, 'access', _5 => _5.byId, 'access', _6 => _6[id], 'optionalAccess', _7 => _7.status]) === "loading") return state;
|
|
267
270
|
return {
|
|
268
271
|
details: {
|
|
269
272
|
...state.details,
|
|
@@ -506,10 +509,10 @@ function RecordsPlaceholder() {
|
|
|
506
509
|
] });
|
|
507
510
|
}
|
|
508
511
|
function SdkProviderInner({ config, bid, patientId, documentTypes, children }) {
|
|
509
|
-
_react.useEffect.call(void 0, () => {
|
|
510
|
-
initWorkerClient(config, patientId);
|
|
511
|
-
}, []);
|
|
512
512
|
initWorkerClient(config, patientId);
|
|
513
|
+
_react.useEffect.call(void 0, () => {
|
|
514
|
+
setAuthToken(config.accessToken);
|
|
515
|
+
}, [config.accessToken]);
|
|
513
516
|
const store = _react.useMemo.call(void 0, () => createPatientStore(bid, patientId), [bid, patientId]);
|
|
514
517
|
_react.useEffect.call(void 0, () => () => store.getState().__cleanup(), [store]);
|
|
515
518
|
_react.useEffect.call(void 0, () => {
|
|
@@ -827,7 +830,7 @@ function PresetSelect({
|
|
|
827
830
|
if (!open) return;
|
|
828
831
|
const onDown = (e) => {
|
|
829
832
|
const n = e.target;
|
|
830
|
-
if (_optionalChain([fieldRef, 'access',
|
|
833
|
+
if (_optionalChain([fieldRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.contains, 'call', _10 => _10(n)]) || _optionalChain([menuRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.contains, 'call', _13 => _13(n)])) return;
|
|
831
834
|
setMenu(null);
|
|
832
835
|
};
|
|
833
836
|
const onScroll = (e) => {
|
|
@@ -859,7 +862,7 @@ function PresetSelect({
|
|
|
859
862
|
"span",
|
|
860
863
|
{
|
|
861
864
|
className: `mr-preset-select__value${selected ? "" : " mr-preset-select__value--placeholder"}`,
|
|
862
|
-
children: _nullishCoalesce(_nullishCoalesce(_optionalChain([selected, 'optionalAccess',
|
|
865
|
+
children: _nullishCoalesce(_nullishCoalesce(_optionalChain([selected, 'optionalAccess', _14 => _14.label]), () => ( placeholder)), () => ( ""))
|
|
863
866
|
}
|
|
864
867
|
),
|
|
865
868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronsUpDown, { size: 16, "aria-hidden": true, className: "mr-preset-select__chevron" })
|
|
@@ -943,7 +946,7 @@ function MultiSelect({
|
|
|
943
946
|
if (!open) return;
|
|
944
947
|
const onDown = (e) => {
|
|
945
948
|
const n = e.target;
|
|
946
|
-
if (_optionalChain([fieldRef, 'access',
|
|
949
|
+
if (_optionalChain([fieldRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.contains, 'call', _17 => _17(n)]) || _optionalChain([menuRef, 'access', _18 => _18.current, 'optionalAccess', _19 => _19.contains, 'call', _20 => _20(n)])) return;
|
|
947
950
|
setMenu(null);
|
|
948
951
|
};
|
|
949
952
|
const onScroll = (e) => {
|
|
@@ -1305,7 +1308,7 @@ function parseVitals(report) {
|
|
|
1305
1308
|
}
|
|
1306
1309
|
var isOutOfRange = (v) => v.status === "high" || v.status === "low";
|
|
1307
1310
|
function vitalsNoteHeading(opts) {
|
|
1308
|
-
return `**Vitals / Lab parameters \u2014 ${_nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
1311
|
+
return `**Vitals / Lab parameters \u2014 ${_nullishCoalesce(_optionalChain([opts, 'optionalAccess', _21 => _21.reportName]), () => ( "Report"))}${_optionalChain([opts, 'optionalAccess', _22 => _22.date]) ? ` (${opts.date})` : ""}:**`;
|
|
1309
1312
|
}
|
|
1310
1313
|
function vitalsToNoteText(vitals, opts) {
|
|
1311
1314
|
const lines = vitals.map((v) => {
|
|
@@ -1439,7 +1442,7 @@ function resolveContentType(file) {
|
|
|
1439
1442
|
if (t === "image/jpeg" || t === "image/jpg" || t === "image/png" || t === "application/pdf") {
|
|
1440
1443
|
return t;
|
|
1441
1444
|
}
|
|
1442
|
-
const ext = _optionalChain([file, 'access',
|
|
1445
|
+
const ext = _optionalChain([file, 'access', _23 => _23.name, 'access', _24 => _24.split, 'call', _25 => _25("."), 'access', _26 => _26.pop, 'call', _27 => _27(), 'optionalAccess', _28 => _28.toLowerCase, 'call', _29 => _29()]);
|
|
1443
1446
|
if (ext === "pdf") return "application/pdf";
|
|
1444
1447
|
if (ext === "png") return "image/png";
|
|
1445
1448
|
if (ext === "jpg" || ext === "jpeg") return "image/jpeg";
|
|
@@ -1479,12 +1482,12 @@ function useUploadConnection() {
|
|
|
1479
1482
|
patientId
|
|
1480
1483
|
});
|
|
1481
1484
|
const queue = store.getState().uploadQueue;
|
|
1482
|
-
if (res.message === "queued_offline" || !_optionalChain([res, 'access',
|
|
1485
|
+
if (res.message === "queued_offline" || !_optionalChain([res, 'access', _30 => _30.batch_response, 'optionalAccess', _31 => _31.length])) {
|
|
1483
1486
|
throw new Error("No internet connection. Your upload will retry automatically when you're back online.");
|
|
1484
1487
|
}
|
|
1485
1488
|
localIds.forEach((id, i) => {
|
|
1486
|
-
const documentId = _nullishCoalesce(_optionalChain([res, 'access',
|
|
1487
|
-
const errorDetails = _optionalChain([res, 'access',
|
|
1489
|
+
const documentId = _nullishCoalesce(_optionalChain([res, 'access', _32 => _32.batch_response, 'optionalAccess', _33 => _33[i], 'optionalAccess', _34 => _34.document_id]), () => ( ""));
|
|
1490
|
+
const errorDetails = _optionalChain([res, 'access', _35 => _35.batch_response, 'optionalAccess', _36 => _36[i], 'optionalAccess', _37 => _37.error_details]);
|
|
1488
1491
|
if (errorDetails) {
|
|
1489
1492
|
queue.markFailed(id);
|
|
1490
1493
|
} else {
|
|
@@ -1522,13 +1525,15 @@ var HUB_URLS = {
|
|
|
1522
1525
|
function useDenialList(environment) {
|
|
1523
1526
|
const [denialList, setDenialList] = _react.useState.call(void 0, []);
|
|
1524
1527
|
_react.useEffect.call(void 0, () => {
|
|
1528
|
+
const controller = new AbortController();
|
|
1525
1529
|
const hubUrl = _nullishCoalesce(HUB_URLS[_nullishCoalesce(environment, () => ( "prod"))], () => ( HUB_URLS.prod));
|
|
1526
1530
|
const url = `${hubUrl}/onboarding/5/configuration/?config_keys=denial_list&format=json`;
|
|
1527
|
-
fetch(url).then((res) => res.json()).then((data) => {
|
|
1528
|
-
const list = _optionalChain([data, 'optionalAccess',
|
|
1531
|
+
fetch(url, { signal: controller.signal }).then((res) => res.json()).then((data) => {
|
|
1532
|
+
const list = _optionalChain([data, 'optionalAccess', _38 => _38.denial_list]);
|
|
1529
1533
|
if (Array.isArray(list)) setDenialList(list);
|
|
1530
1534
|
}).catch(() => {
|
|
1531
1535
|
});
|
|
1536
|
+
return () => controller.abort();
|
|
1532
1537
|
}, [environment]);
|
|
1533
1538
|
return denialList;
|
|
1534
1539
|
}
|
|
@@ -1550,7 +1555,7 @@ function useRecordsStatus(store) {
|
|
|
1550
1555
|
return _zustand.useStore.call(void 0, store, (s) => s.records.status);
|
|
1551
1556
|
}
|
|
1552
1557
|
function useThumbnailUrl(store, id) {
|
|
1553
|
-
return _zustand.useStore.call(void 0, store, (s) => _nullishCoalesce(_optionalChain([s, 'access',
|
|
1558
|
+
return _zustand.useStore.call(void 0, store, (s) => _nullishCoalesce(_optionalChain([s, 'access', _39 => _39.records, 'access', _40 => _40.byId, 'access', _41 => _41[id], 'optionalAccess', _42 => _42.thumbnailUrl]), () => ( null)));
|
|
1554
1559
|
}
|
|
1555
1560
|
function useIsSelected(store, id) {
|
|
1556
1561
|
return _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.has(id));
|
|
@@ -1694,7 +1699,7 @@ function FilterPopover({ onClose }) {
|
|
|
1694
1699
|
const ids = _zustand.useStore.call(void 0, store, (s) => s.records.ids);
|
|
1695
1700
|
const typeOptions = _react.useMemo.call(void 0, () => {
|
|
1696
1701
|
const seen = /* @__PURE__ */ new Set();
|
|
1697
|
-
return ids.map((id) => _optionalChain([byId, 'access',
|
|
1702
|
+
return ids.map((id) => _optionalChain([byId, 'access', _43 => _43[id], 'optionalAccess', _44 => _44.typeCode])).filter((code) => !!code && !seen.has(code) && !!seen.add(code)).map((code) => ({ value: code, label: labelOf(code) }));
|
|
1698
1703
|
}, [ids, byId, labelOf]);
|
|
1699
1704
|
const [docType, setDocType] = _react.useState.call(void 0, _nullishCoalesce(filters.type, () => ( "")));
|
|
1700
1705
|
const [docPreset, setDocPreset] = _react.useState.call(void 0, filters.documentDatePreset);
|
|
@@ -1869,7 +1874,7 @@ function RecordsToolbar({
|
|
|
1869
1874
|
if (!filterOpen) return;
|
|
1870
1875
|
const onDown = (e) => {
|
|
1871
1876
|
const t = e.target;
|
|
1872
|
-
if (_optionalChain([t, 'access',
|
|
1877
|
+
if (_optionalChain([t, 'access', _45 => _45.closest, 'optionalCall', _46 => _46("[data-mr-portal]")])) return;
|
|
1873
1878
|
if (filterRef.current && !filterRef.current.contains(t)) setFilterOpen(false);
|
|
1874
1879
|
};
|
|
1875
1880
|
document.addEventListener("mousedown", onDown);
|
|
@@ -1885,7 +1890,7 @@ function RecordsToolbar({
|
|
|
1885
1890
|
if (isRefreshing) return;
|
|
1886
1891
|
setIsRefreshing(true);
|
|
1887
1892
|
try {
|
|
1888
|
-
await _optionalChain([onRefresh, 'optionalCall',
|
|
1893
|
+
await _optionalChain([onRefresh, 'optionalCall', _47 => _47()]);
|
|
1889
1894
|
} finally {
|
|
1890
1895
|
setIsRefreshing(false);
|
|
1891
1896
|
}
|
|
@@ -1911,7 +1916,7 @@ function RecordsToolbar({
|
|
|
1911
1916
|
store.getState().filters.setType(id === ALL ? null : id);
|
|
1912
1917
|
};
|
|
1913
1918
|
const scrollBy = (delta) => {
|
|
1914
|
-
_optionalChain([scrollRef, 'access',
|
|
1919
|
+
_optionalChain([scrollRef, 'access', _48 => _48.current, 'optionalAccess', _49 => _49.scrollBy, 'call', _50 => _50({ left: delta, behavior: "smooth" })]);
|
|
1915
1920
|
};
|
|
1916
1921
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-records-toolbar", children: [
|
|
1917
1922
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-toolbar-filter", ref: filterRef, children: [
|
|
@@ -1924,7 +1929,7 @@ function RecordsToolbar({
|
|
|
1924
1929
|
"aria-expanded": filterOpen,
|
|
1925
1930
|
onClick: () => {
|
|
1926
1931
|
setFilterOpen((o) => !o);
|
|
1927
|
-
_optionalChain([onFilter, 'optionalCall',
|
|
1932
|
+
_optionalChain([onFilter, 'optionalCall', _51 => _51()]);
|
|
1928
1933
|
},
|
|
1929
1934
|
children: [
|
|
1930
1935
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Filter, { size: 16, "aria-hidden": true, color: "var(--mr-primary)" }),
|
|
@@ -1951,7 +1956,7 @@ function RecordsToolbar({
|
|
|
1951
1956
|
{
|
|
1952
1957
|
id: ALL,
|
|
1953
1958
|
label: "All Records",
|
|
1954
|
-
count: _optionalChain([filteredIds, 'optionalAccess',
|
|
1959
|
+
count: _optionalChain([filteredIds, 'optionalAccess', _52 => _52.length]),
|
|
1955
1960
|
active: activeType == null,
|
|
1956
1961
|
onSelect: selectType
|
|
1957
1962
|
}
|
|
@@ -2194,8 +2199,8 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2194
2199
|
}
|
|
2195
2200
|
const onDown = (e) => {
|
|
2196
2201
|
const t = e.target;
|
|
2197
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2198
|
-
if (_optionalChain([t, 'access',
|
|
2202
|
+
if (_optionalChain([fieldRef, 'access', _53 => _53.current, 'optionalAccess', _54 => _54.contains, 'call', _55 => _55(t)]) || _optionalChain([menuRef, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.contains, 'call', _58 => _58(t)])) return;
|
|
2203
|
+
if (_optionalChain([t, 'access', _59 => _59.closest, 'optionalCall', _60 => _60("[data-mr-portal]")])) return;
|
|
2199
2204
|
setMenuPos(null);
|
|
2200
2205
|
};
|
|
2201
2206
|
const onResize = () => setMenuPos(null);
|
|
@@ -2366,7 +2371,7 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2366
2371
|
onClick: () => open ? setMenuPos(null) : place(),
|
|
2367
2372
|
children: [
|
|
2368
2373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Search, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon" }),
|
|
2369
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-case-picker__field-value" : "mr-case-picker__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess',
|
|
2374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-case-picker__field-value" : "mr-case-picker__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _61 => _61.name]), () => ( "Search or select case\u2026")) }),
|
|
2370
2375
|
selected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon", onClick: (e) => {
|
|
2371
2376
|
e.stopPropagation();
|
|
2372
2377
|
onChange(null);
|
|
@@ -2582,7 +2587,7 @@ var TagChip = _react.memo.call(void 0, function TagChip2({ label, removable, onR
|
|
|
2582
2587
|
"aria-label": `Remove ${label}`,
|
|
2583
2588
|
onClick: (e) => {
|
|
2584
2589
|
e.stopPropagation();
|
|
2585
|
-
_optionalChain([onRemove, 'optionalCall',
|
|
2590
|
+
_optionalChain([onRemove, 'optionalCall', _62 => _62()]);
|
|
2586
2591
|
},
|
|
2587
2592
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 12, "aria-hidden": true })
|
|
2588
2593
|
}
|
|
@@ -2621,7 +2626,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2621
2626
|
bitmapRef.current = null;
|
|
2622
2627
|
} else {
|
|
2623
2628
|
const ctx2d = canvas.getContext("2d");
|
|
2624
|
-
_optionalChain([ctx2d, 'optionalAccess',
|
|
2629
|
+
_optionalChain([ctx2d, 'optionalAccess', _63 => _63.drawImage, 'call', _64 => _64(bitmap, 0, 0)]);
|
|
2625
2630
|
bitmap.close();
|
|
2626
2631
|
bitmapRef.current = null;
|
|
2627
2632
|
}
|
|
@@ -2650,8 +2655,8 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2650
2655
|
}
|
|
2651
2656
|
const dpr = typeof window === "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
2652
2657
|
const box = wrapRef.current;
|
|
2653
|
-
const boxW = size || _optionalChain([box, 'optionalAccess',
|
|
2654
|
-
const boxH = size || _optionalChain([box, 'optionalAccess',
|
|
2658
|
+
const boxW = size || _optionalChain([box, 'optionalAccess', _65 => _65.clientWidth]) || probe.width;
|
|
2659
|
+
const boxH = size || _optionalChain([box, 'optionalAccess', _66 => _66.clientHeight]) || probe.height;
|
|
2655
2660
|
const boxRatio = boxW > 0 && boxH > 0 ? boxW / boxH : probe.width / probe.height;
|
|
2656
2661
|
const srcRatio = probe.width / probe.height;
|
|
2657
2662
|
let sw = probe.width;
|
|
@@ -2686,7 +2691,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2686
2691
|
return () => {
|
|
2687
2692
|
cancelled = true;
|
|
2688
2693
|
controller.abort();
|
|
2689
|
-
_optionalChain([bitmapRef, 'access',
|
|
2694
|
+
_optionalChain([bitmapRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.close, 'call', _69 => _69()]);
|
|
2690
2695
|
bitmapRef.current = null;
|
|
2691
2696
|
};
|
|
2692
2697
|
}, [url, size]);
|
|
@@ -2776,8 +2781,8 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2776
2781
|
if (!open) return;
|
|
2777
2782
|
const onDown = (e) => {
|
|
2778
2783
|
const node = e.target;
|
|
2779
|
-
if (_optionalChain([triggerRef, 'access',
|
|
2780
|
-
if (_optionalChain([node, 'access',
|
|
2784
|
+
if (_optionalChain([triggerRef, 'access', _70 => _70.current, 'optionalAccess', _71 => _71.contains, 'call', _72 => _72(node)]) || _optionalChain([menuRef, 'access', _73 => _73.current, 'optionalAccess', _74 => _74.contains, 'call', _75 => _75(node)])) return;
|
|
2785
|
+
if (_optionalChain([node, 'access', _76 => _76.closest, 'optionalCall', _77 => _77("[data-mr-portal]")])) return;
|
|
2781
2786
|
close();
|
|
2782
2787
|
};
|
|
2783
2788
|
const onKey = (e) => {
|
|
@@ -2820,7 +2825,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2820
2825
|
"data-mr-portal": true,
|
|
2821
2826
|
style: { top: coords.top, bottom: coords.bottom, right: coords.right },
|
|
2822
2827
|
onClick: (e) => e.stopPropagation(),
|
|
2823
|
-
children: _optionalChain([activeItem, 'optionalAccess',
|
|
2828
|
+
children: _optionalChain([activeItem, 'optionalAccess', _78 => _78.subPanel]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-overflow-subpanel", children: [
|
|
2824
2829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-overflow-subpanel__back", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2825
2830
|
"button",
|
|
2826
2831
|
{
|
|
@@ -2845,7 +2850,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2845
2850
|
if (item.subPanel) {
|
|
2846
2851
|
setActiveSubPanel(item.key);
|
|
2847
2852
|
} else if (item.onSelect) {
|
|
2848
|
-
const triggerRect = _nullishCoalesce(_optionalChain([triggerRef, 'access',
|
|
2853
|
+
const triggerRect = _nullishCoalesce(_optionalChain([triggerRef, 'access', _79 => _79.current, 'optionalAccess', _80 => _80.getBoundingClientRect, 'call', _81 => _81()]), () => ( new DOMRect()));
|
|
2849
2854
|
close();
|
|
2850
2855
|
item.onSelect(triggerRect);
|
|
2851
2856
|
}
|
|
@@ -2973,8 +2978,8 @@ function AddToContextSubPanel({
|
|
|
2973
2978
|
}
|
|
2974
2979
|
const onDown = (e) => {
|
|
2975
2980
|
const t = e.target;
|
|
2976
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2977
|
-
if (_optionalChain([t, 'access',
|
|
2981
|
+
if (_optionalChain([fieldRef, 'access', _82 => _82.current, 'optionalAccess', _83 => _83.contains, 'call', _84 => _84(t)]) || _optionalChain([dropRef, 'access', _85 => _85.current, 'optionalAccess', _86 => _86.contains, 'call', _87 => _87(t)])) return;
|
|
2982
|
+
if (_optionalChain([t, 'access', _88 => _88.closest, 'optionalCall', _89 => _89("[data-mr-portal]")])) return;
|
|
2978
2983
|
setDropPos(null);
|
|
2979
2984
|
};
|
|
2980
2985
|
document.addEventListener("mousedown", onDown);
|
|
@@ -2984,10 +2989,10 @@ function AddToContextSubPanel({
|
|
|
2984
2989
|
if (!selected) return;
|
|
2985
2990
|
try {
|
|
2986
2991
|
await editRecord(recordId, { cases: [selected] });
|
|
2987
|
-
_optionalChain([onToast, 'optionalCall',
|
|
2992
|
+
_optionalChain([onToast, 'optionalCall', _90 => _90(`Moved to ${_nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _91 => _91.name]), () => ( "care context"))}`, "success")]);
|
|
2988
2993
|
onClose();
|
|
2989
2994
|
} catch (e4) {
|
|
2990
|
-
_optionalChain([onToast, 'optionalCall',
|
|
2995
|
+
_optionalChain([onToast, 'optionalCall', _92 => _92("Failed to add to care context", "error")]);
|
|
2991
2996
|
}
|
|
2992
2997
|
};
|
|
2993
2998
|
const handleCreate = async () => {
|
|
@@ -2998,10 +3003,10 @@ function AddToContextSubPanel({
|
|
|
2998
3003
|
const occurred_at = newDate ? Math.floor((/* @__PURE__ */ new Date(newDate + "T00:00:00")).getTime() / 1e3) : void 0;
|
|
2999
3004
|
const id = await createCase({ display_name: name, type: newType, occurred_at });
|
|
3000
3005
|
await editRecord(recordId, { cases: [id] });
|
|
3001
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3006
|
+
_optionalChain([onToast, 'optionalCall', _93 => _93(`Created and added to "${name}"`, "success")]);
|
|
3002
3007
|
onClose();
|
|
3003
3008
|
} catch (e5) {
|
|
3004
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3009
|
+
_optionalChain([onToast, 'optionalCall', _94 => _94("Failed to create care context", "error")]);
|
|
3005
3010
|
} finally {
|
|
3006
3011
|
setSaving(false);
|
|
3007
3012
|
}
|
|
@@ -3017,7 +3022,7 @@ function AddToContextSubPanel({
|
|
|
3017
3022
|
className: `mr-ctx-subpanel__field${dropOpen ? " mr-ctx-subpanel__field--open" : ""}`,
|
|
3018
3023
|
onClick: () => dropOpen ? setDropPos(null) : openDrop(),
|
|
3019
3024
|
children: [
|
|
3020
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-ctx-subpanel__field-value" : "mr-ctx-subpanel__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess',
|
|
3025
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-ctx-subpanel__field-value" : "mr-ctx-subpanel__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _95 => _95.name]), () => ( "Search or select")) }),
|
|
3021
3026
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronsUpDown, { size: 16, "aria-hidden": true, className: "mr-ctx-subpanel__field-chevron" })
|
|
3022
3027
|
]
|
|
3023
3028
|
}
|
|
@@ -3375,8 +3380,8 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3375
3380
|
const thumbnailUrl = useThumbnailUrl2(id);
|
|
3376
3381
|
const pendingSelected = useIsSelected2(id);
|
|
3377
3382
|
const pendingCount = _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.size);
|
|
3378
|
-
const attachedCount = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3379
|
-
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3383
|
+
const attachedCount = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _96 => _96.size]), () => ( 0));
|
|
3384
|
+
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _97 => _97.has, 'call', _98 => _98(id)]), () => ( false));
|
|
3380
3385
|
const checked = pendingSelected || attached;
|
|
3381
3386
|
const attachDisabled = attachedCount >= maxSelectable && !attached;
|
|
3382
3387
|
const selectDisabled = attachedCount + pendingCount >= maxSelectable && !checked;
|
|
@@ -3387,14 +3392,14 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3387
3392
|
);
|
|
3388
3393
|
const handleSelect = _react.useCallback.call(void 0, () => {
|
|
3389
3394
|
if (attached) {
|
|
3390
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3395
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _99 => _99(id)]);
|
|
3391
3396
|
} else {
|
|
3392
3397
|
store.getState().selection.toggleRecord(id, pendingLimit);
|
|
3393
3398
|
}
|
|
3394
3399
|
}, [store, id, pendingLimit, attached, onRemoveAttachment]);
|
|
3395
3400
|
const handleAddToContext = _react.useCallback.call(void 0, () => {
|
|
3396
3401
|
if (attached) {
|
|
3397
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3402
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _100 => _100(id)]);
|
|
3398
3403
|
} else {
|
|
3399
3404
|
const r = store.getState().records.byId[id];
|
|
3400
3405
|
if (r && onAttachToContext) void onAttachToContext([{ documentId: id, name: r.title }]);
|
|
@@ -3424,7 +3429,7 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3424
3429
|
[store, id, bid, patientId, onCopyToNote]
|
|
3425
3430
|
);
|
|
3426
3431
|
const handleDelete = _react.useCallback.call(void 0, () => {
|
|
3427
|
-
_optionalChain([onRequestDelete, 'optionalCall',
|
|
3432
|
+
_optionalChain([onRequestDelete, 'optionalCall', _101 => _101(id)]);
|
|
3428
3433
|
}, [onRequestDelete, id]);
|
|
3429
3434
|
if (!record) return null;
|
|
3430
3435
|
return {
|
|
@@ -3629,7 +3634,7 @@ function RecordsGrid({
|
|
|
3629
3634
|
const headerRefs = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
3630
3635
|
_react.useEffect.call(void 0, () => {
|
|
3631
3636
|
if (!scrollToKey) return;
|
|
3632
|
-
_optionalChain([headerRefs, 'access',
|
|
3637
|
+
_optionalChain([headerRefs, 'access', _102 => _102.current, 'access', _103 => _103.get, 'call', _104 => _104(scrollToKey), 'optionalAccess', _105 => _105.scrollIntoView, 'call', _106 => _106({ behavior: "smooth", block: "start" })]);
|
|
3633
3638
|
}, [scrollToKey]);
|
|
3634
3639
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-records-grid", children: sections.map((section, i) => {
|
|
3635
3640
|
const showMonth = showMonths && (i === 0 || sections[i - 1].monthKey !== section.monthKey);
|
|
@@ -3930,12 +3935,12 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3930
3935
|
const { attachedIds, onAttachToContext, onRemoveAttachment, onCopyToNote } = useRecordsActions();
|
|
3931
3936
|
const [smartOpen, setSmartOpen] = _react.useState.call(void 0, true);
|
|
3932
3937
|
if (!record) return null;
|
|
3933
|
-
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3934
|
-
const attachFull = !attached && (_nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3938
|
+
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _107 => _107.has, 'call', _108 => _108(recordId)]), () => ( false));
|
|
3939
|
+
const attachFull = !attached && (_nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _109 => _109.size]), () => ( 0))) >= MAX_CONTEXT_ATTACHMENTS;
|
|
3935
3940
|
const handleAttach = () => {
|
|
3936
3941
|
if (attachFull) return;
|
|
3937
|
-
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3938
|
-
else void _optionalChain([onAttachToContext, 'optionalCall',
|
|
3942
|
+
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall', _110 => _110(recordId)]);
|
|
3943
|
+
else void _optionalChain([onAttachToContext, 'optionalCall', _111 => _111([{ documentId: recordId, name: record.title }])]);
|
|
3939
3944
|
};
|
|
3940
3945
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-record-preview", children: [
|
|
3941
3946
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "header", { className: "mr-record-preview__header", children: [
|
|
@@ -3963,13 +3968,13 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3963
3968
|
children: "Show smart report"
|
|
3964
3969
|
}
|
|
3965
3970
|
),
|
|
3966
|
-
_optionalChain([record, 'access',
|
|
3971
|
+
_optionalChain([record, 'access', _112 => _112.fileType, 'optionalAccess', _113 => _113.toUpperCase, 'call', _114 => _114()]) === "HTML" && onCopyToNote && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3967
3972
|
"button",
|
|
3968
3973
|
{
|
|
3969
3974
|
type: "button",
|
|
3970
3975
|
className: "mr-record-preview__copy-btn",
|
|
3971
3976
|
onClick: async (e) => {
|
|
3972
|
-
const url = _optionalChain([preview, 'access',
|
|
3977
|
+
const url = _optionalChain([preview, 'access', _115 => _115.files, 'access', _116 => _116[0], 'optionalAccess', _117 => _117.url]);
|
|
3973
3978
|
if (!url) return;
|
|
3974
3979
|
const res = await fetch(url);
|
|
3975
3980
|
const html = await res.text();
|
|
@@ -4016,7 +4021,7 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
4016
4021
|
{
|
|
4017
4022
|
files: preview.files,
|
|
4018
4023
|
title: record.title,
|
|
4019
|
-
isHtml: _optionalChain([record, 'access',
|
|
4024
|
+
isHtml: _optionalChain([record, 'access', _118 => _118.fileType, 'optionalAccess', _119 => _119.toUpperCase, 'call', _120 => _120()]) === "HTML"
|
|
4020
4025
|
}
|
|
4021
4026
|
) }),
|
|
4022
4027
|
preview.hasSmartReport && smartOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4088,7 +4093,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4088
4093
|
}));
|
|
4089
4094
|
onClose();
|
|
4090
4095
|
void onUpload(items).then(() => {
|
|
4091
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
4096
|
+
_optionalChain([onSuccess, 'optionalCall', _121 => _121(items.length > 1 ? `${items.length} records uploaded` : "Record uploaded")]);
|
|
4092
4097
|
}).catch((e) => {
|
|
4093
4098
|
onError(e instanceof Error ? e.message : "Upload failed. Please try again.");
|
|
4094
4099
|
});
|
|
@@ -4096,7 +4101,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4096
4101
|
const onDrop = (e) => {
|
|
4097
4102
|
e.preventDefault();
|
|
4098
4103
|
setDragging(false);
|
|
4099
|
-
if (_optionalChain([e, 'access',
|
|
4104
|
+
if (_optionalChain([e, 'access', _122 => _122.dataTransfer, 'access', _123 => _123.files, 'optionalAccess', _124 => _124.length])) addFiles(e.dataTransfer.files);
|
|
4100
4105
|
};
|
|
4101
4106
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-upload-modal", role: "presentation", onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4102
4107
|
"div",
|
|
@@ -4122,7 +4127,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4122
4127
|
] }),
|
|
4123
4128
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "mr-upload-modal__close", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 18, "aria-hidden": true }) })
|
|
4124
4129
|
] }),
|
|
4125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "mr-upload-dropzone", onClick: () => _optionalChain([inputRef, 'access',
|
|
4130
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "mr-upload-dropzone", onClick: () => _optionalChain([inputRef, 'access', _125 => _125.current, 'optionalAccess', _126 => _126.click, 'call', _127 => _127()]), children: [
|
|
4126
4131
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Upload, { size: 20, "aria-hidden": true }) }),
|
|
4127
4132
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__title", children: "Drop files here or click to browse" }),
|
|
4128
4133
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__hint", children: "PDF, JPG, PNG \xB7 up to 25 MB each \xB7 multiple files supported" })
|
|
@@ -4263,7 +4268,7 @@ function useRecordSections(tab, ids) {
|
|
|
4263
4268
|
return caseIds.map((caseId) => {
|
|
4264
4269
|
const c = casesById[caseId];
|
|
4265
4270
|
if (!c) return null;
|
|
4266
|
-
const recordIds = ids.filter((id) => _optionalChain([byId, 'access',
|
|
4271
|
+
const recordIds = ids.filter((id) => _optionalChain([byId, 'access', _128 => _128[id], 'optionalAccess', _129 => _129.cases, 'access', _130 => _130.includes, 'call', _131 => _131(caseId)]));
|
|
4267
4272
|
const type = (_nullishCoalesce(c.typeCode, () => ( ""))).toUpperCase();
|
|
4268
4273
|
return {
|
|
4269
4274
|
key: caseId,
|
|
@@ -4426,7 +4431,7 @@ function useRecordsView({
|
|
|
4426
4431
|
if (records.length && onAttachManyToContext) void onAttachManyToContext(records);
|
|
4427
4432
|
}, [store, onAttachManyToContext]);
|
|
4428
4433
|
const openUpload = _react.useCallback.call(void 0, () => {
|
|
4429
|
-
_optionalChain([onUpload, 'optionalCall',
|
|
4434
|
+
_optionalChain([onUpload, 'optionalCall', _132 => _132()]);
|
|
4430
4435
|
setUploadOpen(true);
|
|
4431
4436
|
}, [onUpload]);
|
|
4432
4437
|
const requestDelete = _react.useCallback.call(void 0, (id) => setDeleteTargetId(id), []);
|
|
@@ -4439,11 +4444,11 @@ function useRecordsView({
|
|
|
4439
4444
|
setDeleting(true);
|
|
4440
4445
|
try {
|
|
4441
4446
|
await deleteRecord(deleteTargetId);
|
|
4442
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4447
|
+
_optionalChain([onToast, 'optionalCall', _133 => _133(`${_nullishCoalesce(_optionalChain([target, 'optionalAccess', _134 => _134.title]), () => ( "Record"))} deleted`, "success")]);
|
|
4443
4448
|
setDeleteTargetId(null);
|
|
4444
4449
|
} catch (e) {
|
|
4445
4450
|
const msg = e instanceof Error ? e.message : "Delete failed";
|
|
4446
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4451
|
+
_optionalChain([onToast, 'optionalCall', _135 => _135(`Could not delete record. ${msg}`, "error")]);
|
|
4447
4452
|
} finally {
|
|
4448
4453
|
setDeleting(false);
|
|
4449
4454
|
}
|
|
@@ -4581,8 +4586,8 @@ function RecordsView({
|
|
|
4581
4586
|
UploadModal,
|
|
4582
4587
|
{
|
|
4583
4588
|
onUpload: upload,
|
|
4584
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4585
|
-
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4589
|
+
onError: (msg) => _optionalChain([onToast, 'optionalCall', _136 => _136(msg, "error")]),
|
|
4590
|
+
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall', _137 => _137(msg, "success")]),
|
|
4586
4591
|
onClose: () => setUploadOpen(false)
|
|
4587
4592
|
}
|
|
4588
4593
|
)
|
|
@@ -4676,8 +4681,8 @@ function RecordsView({
|
|
|
4676
4681
|
UploadModal,
|
|
4677
4682
|
{
|
|
4678
4683
|
onUpload: upload,
|
|
4679
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4680
|
-
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4684
|
+
onError: (msg) => _optionalChain([onToast, 'optionalCall', _138 => _138(msg, "error")]),
|
|
4685
|
+
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall', _139 => _139(msg, "success")]),
|
|
4681
4686
|
onClose: () => setUploadOpen(false)
|
|
4682
4687
|
}
|
|
4683
4688
|
)
|