@eka-care/medical-records-ui 1.0.8 → 1.0.12
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.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +75 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, MouseEvent } from 'react';
|
|
3
|
-
import { SDKEnvironment, EditRecordRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
|
|
3
|
+
import { SDKEnvironment, SDKLog, EditRecordRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
|
|
4
|
+
export { SDKLog } from '@eka-care/medical-records-ts-sdk';
|
|
4
5
|
import * as zustand from 'zustand';
|
|
5
6
|
|
|
6
7
|
type Environment = SDKEnvironment;
|
|
8
|
+
|
|
7
9
|
interface DocumentTypeConfig {
|
|
8
10
|
id: string;
|
|
9
11
|
display_name: string;
|
|
@@ -18,6 +20,7 @@ interface SdkConfig {
|
|
|
18
20
|
defaultHeaders?: Record<string, string>;
|
|
19
21
|
onError?: (error: unknown) => void;
|
|
20
22
|
onUnauthorized?: () => Promise<string | undefined> | string | undefined;
|
|
23
|
+
onLog?: (log: SDKLog) => void;
|
|
21
24
|
accessToken?: string;
|
|
22
25
|
transport?: 'native' | 'bridge';
|
|
23
26
|
oid?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, MouseEvent } from 'react';
|
|
3
|
-
import { SDKEnvironment, EditRecordRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
|
|
3
|
+
import { SDKEnvironment, SDKLog, EditRecordRequest, CreateCaseRequest, UpdateCaseRequest } from '@eka-care/medical-records-ts-sdk';
|
|
4
|
+
export { SDKLog } from '@eka-care/medical-records-ts-sdk';
|
|
4
5
|
import * as zustand from 'zustand';
|
|
5
6
|
|
|
6
7
|
type Environment = SDKEnvironment;
|
|
8
|
+
|
|
7
9
|
interface DocumentTypeConfig {
|
|
8
10
|
id: string;
|
|
9
11
|
display_name: string;
|
|
@@ -18,6 +20,7 @@ interface SdkConfig {
|
|
|
18
20
|
defaultHeaders?: Record<string, string>;
|
|
19
21
|
onError?: (error: unknown) => void;
|
|
20
22
|
onUnauthorized?: () => Promise<string | undefined> | string | undefined;
|
|
23
|
+
onLog?: (log: SDKLog) => void;
|
|
21
24
|
accessToken?: string;
|
|
22
25
|
transport?: 'native' | 'bridge';
|
|
23
26
|
oid?: string;
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,13 @@ var DOCUMENT_TYPE_LABELS = {
|
|
|
21
21
|
|
|
22
22
|
// src/connection/workerClient.ts
|
|
23
23
|
var core = null;
|
|
24
|
+
var onLogRef;
|
|
25
|
+
function stableOnLog(log) {
|
|
26
|
+
_optionalChain([onLogRef, 'optionalCall', _2 => _2(log)]);
|
|
27
|
+
}
|
|
24
28
|
var CORE_SDK_AVAILABLE = true;
|
|
25
29
|
function initWorkerClient(config, oid) {
|
|
30
|
+
onLogRef = config.onLog;
|
|
26
31
|
if (core) {
|
|
27
32
|
if (config.accessToken) core.setAuthToken(config.accessToken);
|
|
28
33
|
return;
|
|
@@ -34,6 +39,7 @@ function initWorkerClient(config, oid) {
|
|
|
34
39
|
defaultHeaders: config.defaultHeaders,
|
|
35
40
|
onError: config.onError,
|
|
36
41
|
onUnauthorized: config.onUnauthorized,
|
|
42
|
+
onLog: stableOnLog,
|
|
37
43
|
transport: config.transport,
|
|
38
44
|
cache: resolvedOid ? { oid: resolvedOid } : void 0
|
|
39
45
|
});
|
|
@@ -45,6 +51,9 @@ function getCore() {
|
|
|
45
51
|
}
|
|
46
52
|
return core;
|
|
47
53
|
}
|
|
54
|
+
function setAuthToken(token) {
|
|
55
|
+
_optionalChain([core, 'optionalAccess', _3 => _3.setAuthToken, 'call', _4 => _4(token)]);
|
|
56
|
+
}
|
|
48
57
|
function teardownWorkerClient() {
|
|
49
58
|
core = null;
|
|
50
59
|
}
|
|
@@ -263,7 +272,7 @@ var createDetailsSlice = (set) => ({
|
|
|
263
272
|
details: {
|
|
264
273
|
byId: {},
|
|
265
274
|
setDetailLoading: (id) => set((state) => {
|
|
266
|
-
if (_optionalChain([state, 'access',
|
|
275
|
+
if (_optionalChain([state, 'access', _5 => _5.details, 'access', _6 => _6.byId, 'access', _7 => _7[id], 'optionalAccess', _8 => _8.status]) === "loading") return state;
|
|
267
276
|
return {
|
|
268
277
|
details: {
|
|
269
278
|
...state.details,
|
|
@@ -506,10 +515,10 @@ function RecordsPlaceholder() {
|
|
|
506
515
|
] });
|
|
507
516
|
}
|
|
508
517
|
function SdkProviderInner({ config, bid, patientId, documentTypes, children }) {
|
|
509
|
-
_react.useEffect.call(void 0, () => {
|
|
510
|
-
initWorkerClient(config, patientId);
|
|
511
|
-
}, []);
|
|
512
518
|
initWorkerClient(config, patientId);
|
|
519
|
+
_react.useEffect.call(void 0, () => {
|
|
520
|
+
setAuthToken(config.accessToken);
|
|
521
|
+
}, [config.accessToken]);
|
|
513
522
|
const store = _react.useMemo.call(void 0, () => createPatientStore(bid, patientId), [bid, patientId]);
|
|
514
523
|
_react.useEffect.call(void 0, () => () => store.getState().__cleanup(), [store]);
|
|
515
524
|
_react.useEffect.call(void 0, () => {
|
|
@@ -827,7 +836,7 @@ function PresetSelect({
|
|
|
827
836
|
if (!open) return;
|
|
828
837
|
const onDown = (e) => {
|
|
829
838
|
const n = e.target;
|
|
830
|
-
if (_optionalChain([fieldRef, 'access',
|
|
839
|
+
if (_optionalChain([fieldRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.contains, 'call', _11 => _11(n)]) || _optionalChain([menuRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.contains, 'call', _14 => _14(n)])) return;
|
|
831
840
|
setMenu(null);
|
|
832
841
|
};
|
|
833
842
|
const onScroll = (e) => {
|
|
@@ -859,7 +868,7 @@ function PresetSelect({
|
|
|
859
868
|
"span",
|
|
860
869
|
{
|
|
861
870
|
className: `mr-preset-select__value${selected ? "" : " mr-preset-select__value--placeholder"}`,
|
|
862
|
-
children: _nullishCoalesce(_nullishCoalesce(_optionalChain([selected, 'optionalAccess',
|
|
871
|
+
children: _nullishCoalesce(_nullishCoalesce(_optionalChain([selected, 'optionalAccess', _15 => _15.label]), () => ( placeholder)), () => ( ""))
|
|
863
872
|
}
|
|
864
873
|
),
|
|
865
874
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronsUpDown, { size: 16, "aria-hidden": true, className: "mr-preset-select__chevron" })
|
|
@@ -943,7 +952,7 @@ function MultiSelect({
|
|
|
943
952
|
if (!open) return;
|
|
944
953
|
const onDown = (e) => {
|
|
945
954
|
const n = e.target;
|
|
946
|
-
if (_optionalChain([fieldRef, 'access',
|
|
955
|
+
if (_optionalChain([fieldRef, 'access', _16 => _16.current, 'optionalAccess', _17 => _17.contains, 'call', _18 => _18(n)]) || _optionalChain([menuRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.contains, 'call', _21 => _21(n)])) return;
|
|
947
956
|
setMenu(null);
|
|
948
957
|
};
|
|
949
958
|
const onScroll = (e) => {
|
|
@@ -1305,7 +1314,7 @@ function parseVitals(report) {
|
|
|
1305
1314
|
}
|
|
1306
1315
|
var isOutOfRange = (v) => v.status === "high" || v.status === "low";
|
|
1307
1316
|
function vitalsNoteHeading(opts) {
|
|
1308
|
-
return `**Vitals / Lab parameters \u2014 ${_nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
1317
|
+
return `**Vitals / Lab parameters \u2014 ${_nullishCoalesce(_optionalChain([opts, 'optionalAccess', _22 => _22.reportName]), () => ( "Report"))}${_optionalChain([opts, 'optionalAccess', _23 => _23.date]) ? ` (${opts.date})` : ""}:**`;
|
|
1309
1318
|
}
|
|
1310
1319
|
function vitalsToNoteText(vitals, opts) {
|
|
1311
1320
|
const lines = vitals.map((v) => {
|
|
@@ -1439,7 +1448,7 @@ function resolveContentType(file) {
|
|
|
1439
1448
|
if (t === "image/jpeg" || t === "image/jpg" || t === "image/png" || t === "application/pdf") {
|
|
1440
1449
|
return t;
|
|
1441
1450
|
}
|
|
1442
|
-
const ext = _optionalChain([file, 'access',
|
|
1451
|
+
const ext = _optionalChain([file, 'access', _24 => _24.name, 'access', _25 => _25.split, 'call', _26 => _26("."), 'access', _27 => _27.pop, 'call', _28 => _28(), 'optionalAccess', _29 => _29.toLowerCase, 'call', _30 => _30()]);
|
|
1443
1452
|
if (ext === "pdf") return "application/pdf";
|
|
1444
1453
|
if (ext === "png") return "image/png";
|
|
1445
1454
|
if (ext === "jpg" || ext === "jpeg") return "image/jpeg";
|
|
@@ -1479,12 +1488,12 @@ function useUploadConnection() {
|
|
|
1479
1488
|
patientId
|
|
1480
1489
|
});
|
|
1481
1490
|
const queue = store.getState().uploadQueue;
|
|
1482
|
-
if (res.message === "queued_offline" || !_optionalChain([res, 'access',
|
|
1491
|
+
if (res.message === "queued_offline" || !_optionalChain([res, 'access', _31 => _31.batch_response, 'optionalAccess', _32 => _32.length])) {
|
|
1483
1492
|
throw new Error("No internet connection. Your upload will retry automatically when you're back online.");
|
|
1484
1493
|
}
|
|
1485
1494
|
localIds.forEach((id, i) => {
|
|
1486
|
-
const documentId = _nullishCoalesce(_optionalChain([res, 'access',
|
|
1487
|
-
const errorDetails = _optionalChain([res, 'access',
|
|
1495
|
+
const documentId = _nullishCoalesce(_optionalChain([res, 'access', _33 => _33.batch_response, 'optionalAccess', _34 => _34[i], 'optionalAccess', _35 => _35.document_id]), () => ( ""));
|
|
1496
|
+
const errorDetails = _optionalChain([res, 'access', _36 => _36.batch_response, 'optionalAccess', _37 => _37[i], 'optionalAccess', _38 => _38.error_details]);
|
|
1488
1497
|
if (errorDetails) {
|
|
1489
1498
|
queue.markFailed(id);
|
|
1490
1499
|
} else {
|
|
@@ -1522,13 +1531,15 @@ var HUB_URLS = {
|
|
|
1522
1531
|
function useDenialList(environment) {
|
|
1523
1532
|
const [denialList, setDenialList] = _react.useState.call(void 0, []);
|
|
1524
1533
|
_react.useEffect.call(void 0, () => {
|
|
1534
|
+
const controller = new AbortController();
|
|
1525
1535
|
const hubUrl = _nullishCoalesce(HUB_URLS[_nullishCoalesce(environment, () => ( "prod"))], () => ( HUB_URLS.prod));
|
|
1526
1536
|
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',
|
|
1537
|
+
fetch(url, { signal: controller.signal }).then((res) => res.json()).then((data) => {
|
|
1538
|
+
const list = _optionalChain([data, 'optionalAccess', _39 => _39.denial_list]);
|
|
1529
1539
|
if (Array.isArray(list)) setDenialList(list);
|
|
1530
1540
|
}).catch(() => {
|
|
1531
1541
|
});
|
|
1542
|
+
return () => controller.abort();
|
|
1532
1543
|
}, [environment]);
|
|
1533
1544
|
return denialList;
|
|
1534
1545
|
}
|
|
@@ -1550,7 +1561,7 @@ function useRecordsStatus(store) {
|
|
|
1550
1561
|
return _zustand.useStore.call(void 0, store, (s) => s.records.status);
|
|
1551
1562
|
}
|
|
1552
1563
|
function useThumbnailUrl(store, id) {
|
|
1553
|
-
return _zustand.useStore.call(void 0, store, (s) => _nullishCoalesce(_optionalChain([s, 'access',
|
|
1564
|
+
return _zustand.useStore.call(void 0, store, (s) => _nullishCoalesce(_optionalChain([s, 'access', _40 => _40.records, 'access', _41 => _41.byId, 'access', _42 => _42[id], 'optionalAccess', _43 => _43.thumbnailUrl]), () => ( null)));
|
|
1554
1565
|
}
|
|
1555
1566
|
function useIsSelected(store, id) {
|
|
1556
1567
|
return _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.has(id));
|
|
@@ -1694,7 +1705,7 @@ function FilterPopover({ onClose }) {
|
|
|
1694
1705
|
const ids = _zustand.useStore.call(void 0, store, (s) => s.records.ids);
|
|
1695
1706
|
const typeOptions = _react.useMemo.call(void 0, () => {
|
|
1696
1707
|
const seen = /* @__PURE__ */ new Set();
|
|
1697
|
-
return ids.map((id) => _optionalChain([byId, 'access',
|
|
1708
|
+
return ids.map((id) => _optionalChain([byId, 'access', _44 => _44[id], 'optionalAccess', _45 => _45.typeCode])).filter((code) => !!code && !seen.has(code) && !!seen.add(code)).map((code) => ({ value: code, label: labelOf(code) }));
|
|
1698
1709
|
}, [ids, byId, labelOf]);
|
|
1699
1710
|
const [docType, setDocType] = _react.useState.call(void 0, _nullishCoalesce(filters.type, () => ( "")));
|
|
1700
1711
|
const [docPreset, setDocPreset] = _react.useState.call(void 0, filters.documentDatePreset);
|
|
@@ -1869,7 +1880,7 @@ function RecordsToolbar({
|
|
|
1869
1880
|
if (!filterOpen) return;
|
|
1870
1881
|
const onDown = (e) => {
|
|
1871
1882
|
const t = e.target;
|
|
1872
|
-
if (_optionalChain([t, 'access',
|
|
1883
|
+
if (_optionalChain([t, 'access', _46 => _46.closest, 'optionalCall', _47 => _47("[data-mr-portal]")])) return;
|
|
1873
1884
|
if (filterRef.current && !filterRef.current.contains(t)) setFilterOpen(false);
|
|
1874
1885
|
};
|
|
1875
1886
|
document.addEventListener("mousedown", onDown);
|
|
@@ -1885,7 +1896,7 @@ function RecordsToolbar({
|
|
|
1885
1896
|
if (isRefreshing) return;
|
|
1886
1897
|
setIsRefreshing(true);
|
|
1887
1898
|
try {
|
|
1888
|
-
await _optionalChain([onRefresh, 'optionalCall',
|
|
1899
|
+
await _optionalChain([onRefresh, 'optionalCall', _48 => _48()]);
|
|
1889
1900
|
} finally {
|
|
1890
1901
|
setIsRefreshing(false);
|
|
1891
1902
|
}
|
|
@@ -1911,7 +1922,7 @@ function RecordsToolbar({
|
|
|
1911
1922
|
store.getState().filters.setType(id === ALL ? null : id);
|
|
1912
1923
|
};
|
|
1913
1924
|
const scrollBy = (delta) => {
|
|
1914
|
-
_optionalChain([scrollRef, 'access',
|
|
1925
|
+
_optionalChain([scrollRef, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.scrollBy, 'call', _51 => _51({ left: delta, behavior: "smooth" })]);
|
|
1915
1926
|
};
|
|
1916
1927
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-records-toolbar", children: [
|
|
1917
1928
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-toolbar-filter", ref: filterRef, children: [
|
|
@@ -1924,7 +1935,7 @@ function RecordsToolbar({
|
|
|
1924
1935
|
"aria-expanded": filterOpen,
|
|
1925
1936
|
onClick: () => {
|
|
1926
1937
|
setFilterOpen((o) => !o);
|
|
1927
|
-
_optionalChain([onFilter, 'optionalCall',
|
|
1938
|
+
_optionalChain([onFilter, 'optionalCall', _52 => _52()]);
|
|
1928
1939
|
},
|
|
1929
1940
|
children: [
|
|
1930
1941
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Filter, { size: 16, "aria-hidden": true, color: "var(--mr-primary)" }),
|
|
@@ -1951,7 +1962,7 @@ function RecordsToolbar({
|
|
|
1951
1962
|
{
|
|
1952
1963
|
id: ALL,
|
|
1953
1964
|
label: "All Records",
|
|
1954
|
-
count: _optionalChain([filteredIds, 'optionalAccess',
|
|
1965
|
+
count: _optionalChain([filteredIds, 'optionalAccess', _53 => _53.length]),
|
|
1955
1966
|
active: activeType == null,
|
|
1956
1967
|
onSelect: selectType
|
|
1957
1968
|
}
|
|
@@ -2194,8 +2205,8 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2194
2205
|
}
|
|
2195
2206
|
const onDown = (e) => {
|
|
2196
2207
|
const t = e.target;
|
|
2197
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2198
|
-
if (_optionalChain([t, 'access',
|
|
2208
|
+
if (_optionalChain([fieldRef, 'access', _54 => _54.current, 'optionalAccess', _55 => _55.contains, 'call', _56 => _56(t)]) || _optionalChain([menuRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.contains, 'call', _59 => _59(t)])) return;
|
|
2209
|
+
if (_optionalChain([t, 'access', _60 => _60.closest, 'optionalCall', _61 => _61("[data-mr-portal]")])) return;
|
|
2199
2210
|
setMenuPos(null);
|
|
2200
2211
|
};
|
|
2201
2212
|
const onResize = () => setMenuPos(null);
|
|
@@ -2366,7 +2377,7 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2366
2377
|
onClick: () => open ? setMenuPos(null) : place(),
|
|
2367
2378
|
children: [
|
|
2368
2379
|
/* @__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',
|
|
2380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-case-picker__field-value" : "mr-case-picker__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _62 => _62.name]), () => ( "Search or select case\u2026")) }),
|
|
2370
2381
|
selected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon", onClick: (e) => {
|
|
2371
2382
|
e.stopPropagation();
|
|
2372
2383
|
onChange(null);
|
|
@@ -2582,7 +2593,7 @@ var TagChip = _react.memo.call(void 0, function TagChip2({ label, removable, onR
|
|
|
2582
2593
|
"aria-label": `Remove ${label}`,
|
|
2583
2594
|
onClick: (e) => {
|
|
2584
2595
|
e.stopPropagation();
|
|
2585
|
-
_optionalChain([onRemove, 'optionalCall',
|
|
2596
|
+
_optionalChain([onRemove, 'optionalCall', _63 => _63()]);
|
|
2586
2597
|
},
|
|
2587
2598
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 12, "aria-hidden": true })
|
|
2588
2599
|
}
|
|
@@ -2621,7 +2632,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2621
2632
|
bitmapRef.current = null;
|
|
2622
2633
|
} else {
|
|
2623
2634
|
const ctx2d = canvas.getContext("2d");
|
|
2624
|
-
_optionalChain([ctx2d, 'optionalAccess',
|
|
2635
|
+
_optionalChain([ctx2d, 'optionalAccess', _64 => _64.drawImage, 'call', _65 => _65(bitmap, 0, 0)]);
|
|
2625
2636
|
bitmap.close();
|
|
2626
2637
|
bitmapRef.current = null;
|
|
2627
2638
|
}
|
|
@@ -2650,8 +2661,8 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2650
2661
|
}
|
|
2651
2662
|
const dpr = typeof window === "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
2652
2663
|
const box = wrapRef.current;
|
|
2653
|
-
const boxW = size || _optionalChain([box, 'optionalAccess',
|
|
2654
|
-
const boxH = size || _optionalChain([box, 'optionalAccess',
|
|
2664
|
+
const boxW = size || _optionalChain([box, 'optionalAccess', _66 => _66.clientWidth]) || probe.width;
|
|
2665
|
+
const boxH = size || _optionalChain([box, 'optionalAccess', _67 => _67.clientHeight]) || probe.height;
|
|
2655
2666
|
const boxRatio = boxW > 0 && boxH > 0 ? boxW / boxH : probe.width / probe.height;
|
|
2656
2667
|
const srcRatio = probe.width / probe.height;
|
|
2657
2668
|
let sw = probe.width;
|
|
@@ -2686,7 +2697,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2686
2697
|
return () => {
|
|
2687
2698
|
cancelled = true;
|
|
2688
2699
|
controller.abort();
|
|
2689
|
-
_optionalChain([bitmapRef, 'access',
|
|
2700
|
+
_optionalChain([bitmapRef, 'access', _68 => _68.current, 'optionalAccess', _69 => _69.close, 'call', _70 => _70()]);
|
|
2690
2701
|
bitmapRef.current = null;
|
|
2691
2702
|
};
|
|
2692
2703
|
}, [url, size]);
|
|
@@ -2776,8 +2787,8 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2776
2787
|
if (!open) return;
|
|
2777
2788
|
const onDown = (e) => {
|
|
2778
2789
|
const node = e.target;
|
|
2779
|
-
if (_optionalChain([triggerRef, 'access',
|
|
2780
|
-
if (_optionalChain([node, 'access',
|
|
2790
|
+
if (_optionalChain([triggerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.contains, 'call', _73 => _73(node)]) || _optionalChain([menuRef, 'access', _74 => _74.current, 'optionalAccess', _75 => _75.contains, 'call', _76 => _76(node)])) return;
|
|
2791
|
+
if (_optionalChain([node, 'access', _77 => _77.closest, 'optionalCall', _78 => _78("[data-mr-portal]")])) return;
|
|
2781
2792
|
close();
|
|
2782
2793
|
};
|
|
2783
2794
|
const onKey = (e) => {
|
|
@@ -2820,7 +2831,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2820
2831
|
"data-mr-portal": true,
|
|
2821
2832
|
style: { top: coords.top, bottom: coords.bottom, right: coords.right },
|
|
2822
2833
|
onClick: (e) => e.stopPropagation(),
|
|
2823
|
-
children: _optionalChain([activeItem, 'optionalAccess',
|
|
2834
|
+
children: _optionalChain([activeItem, 'optionalAccess', _79 => _79.subPanel]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-overflow-subpanel", children: [
|
|
2824
2835
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-overflow-subpanel__back", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2825
2836
|
"button",
|
|
2826
2837
|
{
|
|
@@ -2845,7 +2856,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2845
2856
|
if (item.subPanel) {
|
|
2846
2857
|
setActiveSubPanel(item.key);
|
|
2847
2858
|
} else if (item.onSelect) {
|
|
2848
|
-
const triggerRect = _nullishCoalesce(_optionalChain([triggerRef, 'access',
|
|
2859
|
+
const triggerRect = _nullishCoalesce(_optionalChain([triggerRef, 'access', _80 => _80.current, 'optionalAccess', _81 => _81.getBoundingClientRect, 'call', _82 => _82()]), () => ( new DOMRect()));
|
|
2849
2860
|
close();
|
|
2850
2861
|
item.onSelect(triggerRect);
|
|
2851
2862
|
}
|
|
@@ -2973,8 +2984,8 @@ function AddToContextSubPanel({
|
|
|
2973
2984
|
}
|
|
2974
2985
|
const onDown = (e) => {
|
|
2975
2986
|
const t = e.target;
|
|
2976
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2977
|
-
if (_optionalChain([t, 'access',
|
|
2987
|
+
if (_optionalChain([fieldRef, 'access', _83 => _83.current, 'optionalAccess', _84 => _84.contains, 'call', _85 => _85(t)]) || _optionalChain([dropRef, 'access', _86 => _86.current, 'optionalAccess', _87 => _87.contains, 'call', _88 => _88(t)])) return;
|
|
2988
|
+
if (_optionalChain([t, 'access', _89 => _89.closest, 'optionalCall', _90 => _90("[data-mr-portal]")])) return;
|
|
2978
2989
|
setDropPos(null);
|
|
2979
2990
|
};
|
|
2980
2991
|
document.addEventListener("mousedown", onDown);
|
|
@@ -2984,10 +2995,10 @@ function AddToContextSubPanel({
|
|
|
2984
2995
|
if (!selected) return;
|
|
2985
2996
|
try {
|
|
2986
2997
|
await editRecord(recordId, { cases: [selected] });
|
|
2987
|
-
_optionalChain([onToast, 'optionalCall',
|
|
2998
|
+
_optionalChain([onToast, 'optionalCall', _91 => _91(`Moved to ${_nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _92 => _92.name]), () => ( "care context"))}`, "success")]);
|
|
2988
2999
|
onClose();
|
|
2989
3000
|
} catch (e4) {
|
|
2990
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3001
|
+
_optionalChain([onToast, 'optionalCall', _93 => _93("Failed to add to care context", "error")]);
|
|
2991
3002
|
}
|
|
2992
3003
|
};
|
|
2993
3004
|
const handleCreate = async () => {
|
|
@@ -2998,10 +3009,10 @@ function AddToContextSubPanel({
|
|
|
2998
3009
|
const occurred_at = newDate ? Math.floor((/* @__PURE__ */ new Date(newDate + "T00:00:00")).getTime() / 1e3) : void 0;
|
|
2999
3010
|
const id = await createCase({ display_name: name, type: newType, occurred_at });
|
|
3000
3011
|
await editRecord(recordId, { cases: [id] });
|
|
3001
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3012
|
+
_optionalChain([onToast, 'optionalCall', _94 => _94(`Created and added to "${name}"`, "success")]);
|
|
3002
3013
|
onClose();
|
|
3003
3014
|
} catch (e5) {
|
|
3004
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3015
|
+
_optionalChain([onToast, 'optionalCall', _95 => _95("Failed to create care context", "error")]);
|
|
3005
3016
|
} finally {
|
|
3006
3017
|
setSaving(false);
|
|
3007
3018
|
}
|
|
@@ -3017,7 +3028,7 @@ function AddToContextSubPanel({
|
|
|
3017
3028
|
className: `mr-ctx-subpanel__field${dropOpen ? " mr-ctx-subpanel__field--open" : ""}`,
|
|
3018
3029
|
onClick: () => dropOpen ? setDropPos(null) : openDrop(),
|
|
3019
3030
|
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',
|
|
3031
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-ctx-subpanel__field-value" : "mr-ctx-subpanel__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _96 => _96.name]), () => ( "Search or select")) }),
|
|
3021
3032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronsUpDown, { size: 16, "aria-hidden": true, className: "mr-ctx-subpanel__field-chevron" })
|
|
3022
3033
|
]
|
|
3023
3034
|
}
|
|
@@ -3375,8 +3386,8 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3375
3386
|
const thumbnailUrl = useThumbnailUrl2(id);
|
|
3376
3387
|
const pendingSelected = useIsSelected2(id);
|
|
3377
3388
|
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',
|
|
3389
|
+
const attachedCount = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _97 => _97.size]), () => ( 0));
|
|
3390
|
+
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _98 => _98.has, 'call', _99 => _99(id)]), () => ( false));
|
|
3380
3391
|
const checked = pendingSelected || attached;
|
|
3381
3392
|
const attachDisabled = attachedCount >= maxSelectable && !attached;
|
|
3382
3393
|
const selectDisabled = attachedCount + pendingCount >= maxSelectable && !checked;
|
|
@@ -3387,14 +3398,14 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3387
3398
|
);
|
|
3388
3399
|
const handleSelect = _react.useCallback.call(void 0, () => {
|
|
3389
3400
|
if (attached) {
|
|
3390
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3401
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _100 => _100(id)]);
|
|
3391
3402
|
} else {
|
|
3392
3403
|
store.getState().selection.toggleRecord(id, pendingLimit);
|
|
3393
3404
|
}
|
|
3394
3405
|
}, [store, id, pendingLimit, attached, onRemoveAttachment]);
|
|
3395
3406
|
const handleAddToContext = _react.useCallback.call(void 0, () => {
|
|
3396
3407
|
if (attached) {
|
|
3397
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3408
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _101 => _101(id)]);
|
|
3398
3409
|
} else {
|
|
3399
3410
|
const r = store.getState().records.byId[id];
|
|
3400
3411
|
if (r && onAttachToContext) void onAttachToContext([{ documentId: id, name: r.title }]);
|
|
@@ -3424,7 +3435,7 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3424
3435
|
[store, id, bid, patientId, onCopyToNote]
|
|
3425
3436
|
);
|
|
3426
3437
|
const handleDelete = _react.useCallback.call(void 0, () => {
|
|
3427
|
-
_optionalChain([onRequestDelete, 'optionalCall',
|
|
3438
|
+
_optionalChain([onRequestDelete, 'optionalCall', _102 => _102(id)]);
|
|
3428
3439
|
}, [onRequestDelete, id]);
|
|
3429
3440
|
if (!record) return null;
|
|
3430
3441
|
return {
|
|
@@ -3629,7 +3640,7 @@ function RecordsGrid({
|
|
|
3629
3640
|
const headerRefs = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
3630
3641
|
_react.useEffect.call(void 0, () => {
|
|
3631
3642
|
if (!scrollToKey) return;
|
|
3632
|
-
_optionalChain([headerRefs, 'access',
|
|
3643
|
+
_optionalChain([headerRefs, 'access', _103 => _103.current, 'access', _104 => _104.get, 'call', _105 => _105(scrollToKey), 'optionalAccess', _106 => _106.scrollIntoView, 'call', _107 => _107({ behavior: "smooth", block: "start" })]);
|
|
3633
3644
|
}, [scrollToKey]);
|
|
3634
3645
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-records-grid", children: sections.map((section, i) => {
|
|
3635
3646
|
const showMonth = showMonths && (i === 0 || sections[i - 1].monthKey !== section.monthKey);
|
|
@@ -3930,12 +3941,12 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3930
3941
|
const { attachedIds, onAttachToContext, onRemoveAttachment, onCopyToNote } = useRecordsActions();
|
|
3931
3942
|
const [smartOpen, setSmartOpen] = _react.useState.call(void 0, true);
|
|
3932
3943
|
if (!record) return null;
|
|
3933
|
-
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3934
|
-
const attachFull = !attached && (_nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3944
|
+
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _108 => _108.has, 'call', _109 => _109(recordId)]), () => ( false));
|
|
3945
|
+
const attachFull = !attached && (_nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _110 => _110.size]), () => ( 0))) >= MAX_CONTEXT_ATTACHMENTS;
|
|
3935
3946
|
const handleAttach = () => {
|
|
3936
3947
|
if (attachFull) return;
|
|
3937
|
-
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3938
|
-
else void _optionalChain([onAttachToContext, 'optionalCall',
|
|
3948
|
+
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall', _111 => _111(recordId)]);
|
|
3949
|
+
else void _optionalChain([onAttachToContext, 'optionalCall', _112 => _112([{ documentId: recordId, name: record.title }])]);
|
|
3939
3950
|
};
|
|
3940
3951
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-record-preview", children: [
|
|
3941
3952
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "header", { className: "mr-record-preview__header", children: [
|
|
@@ -3963,13 +3974,13 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3963
3974
|
children: "Show smart report"
|
|
3964
3975
|
}
|
|
3965
3976
|
),
|
|
3966
|
-
_optionalChain([record, 'access',
|
|
3977
|
+
_optionalChain([record, 'access', _113 => _113.fileType, 'optionalAccess', _114 => _114.toUpperCase, 'call', _115 => _115()]) === "HTML" && onCopyToNote && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3967
3978
|
"button",
|
|
3968
3979
|
{
|
|
3969
3980
|
type: "button",
|
|
3970
3981
|
className: "mr-record-preview__copy-btn",
|
|
3971
3982
|
onClick: async (e) => {
|
|
3972
|
-
const url = _optionalChain([preview, 'access',
|
|
3983
|
+
const url = _optionalChain([preview, 'access', _116 => _116.files, 'access', _117 => _117[0], 'optionalAccess', _118 => _118.url]);
|
|
3973
3984
|
if (!url) return;
|
|
3974
3985
|
const res = await fetch(url);
|
|
3975
3986
|
const html = await res.text();
|
|
@@ -4016,7 +4027,7 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
4016
4027
|
{
|
|
4017
4028
|
files: preview.files,
|
|
4018
4029
|
title: record.title,
|
|
4019
|
-
isHtml: _optionalChain([record, 'access',
|
|
4030
|
+
isHtml: _optionalChain([record, 'access', _119 => _119.fileType, 'optionalAccess', _120 => _120.toUpperCase, 'call', _121 => _121()]) === "HTML"
|
|
4020
4031
|
}
|
|
4021
4032
|
) }),
|
|
4022
4033
|
preview.hasSmartReport && smartOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4088,7 +4099,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4088
4099
|
}));
|
|
4089
4100
|
onClose();
|
|
4090
4101
|
void onUpload(items).then(() => {
|
|
4091
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
4102
|
+
_optionalChain([onSuccess, 'optionalCall', _122 => _122(items.length > 1 ? `${items.length} records uploaded` : "Record uploaded")]);
|
|
4092
4103
|
}).catch((e) => {
|
|
4093
4104
|
onError(e instanceof Error ? e.message : "Upload failed. Please try again.");
|
|
4094
4105
|
});
|
|
@@ -4096,7 +4107,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4096
4107
|
const onDrop = (e) => {
|
|
4097
4108
|
e.preventDefault();
|
|
4098
4109
|
setDragging(false);
|
|
4099
|
-
if (_optionalChain([e, 'access',
|
|
4110
|
+
if (_optionalChain([e, 'access', _123 => _123.dataTransfer, 'access', _124 => _124.files, 'optionalAccess', _125 => _125.length])) addFiles(e.dataTransfer.files);
|
|
4100
4111
|
};
|
|
4101
4112
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-upload-modal", role: "presentation", onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4102
4113
|
"div",
|
|
@@ -4122,7 +4133,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4122
4133
|
] }),
|
|
4123
4134
|
/* @__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
4135
|
] }),
|
|
4125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "mr-upload-dropzone", onClick: () => _optionalChain([inputRef, 'access',
|
|
4136
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "mr-upload-dropzone", onClick: () => _optionalChain([inputRef, 'access', _126 => _126.current, 'optionalAccess', _127 => _127.click, 'call', _128 => _128()]), children: [
|
|
4126
4137
|
/* @__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
4138
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__title", children: "Drop files here or click to browse" }),
|
|
4128
4139
|
/* @__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 +4274,7 @@ function useRecordSections(tab, ids) {
|
|
|
4263
4274
|
return caseIds.map((caseId) => {
|
|
4264
4275
|
const c = casesById[caseId];
|
|
4265
4276
|
if (!c) return null;
|
|
4266
|
-
const recordIds = ids.filter((id) => _optionalChain([byId, 'access',
|
|
4277
|
+
const recordIds = ids.filter((id) => _optionalChain([byId, 'access', _129 => _129[id], 'optionalAccess', _130 => _130.cases, 'access', _131 => _131.includes, 'call', _132 => _132(caseId)]));
|
|
4267
4278
|
const type = (_nullishCoalesce(c.typeCode, () => ( ""))).toUpperCase();
|
|
4268
4279
|
return {
|
|
4269
4280
|
key: caseId,
|
|
@@ -4426,7 +4437,7 @@ function useRecordsView({
|
|
|
4426
4437
|
if (records.length && onAttachManyToContext) void onAttachManyToContext(records);
|
|
4427
4438
|
}, [store, onAttachManyToContext]);
|
|
4428
4439
|
const openUpload = _react.useCallback.call(void 0, () => {
|
|
4429
|
-
_optionalChain([onUpload, 'optionalCall',
|
|
4440
|
+
_optionalChain([onUpload, 'optionalCall', _133 => _133()]);
|
|
4430
4441
|
setUploadOpen(true);
|
|
4431
4442
|
}, [onUpload]);
|
|
4432
4443
|
const requestDelete = _react.useCallback.call(void 0, (id) => setDeleteTargetId(id), []);
|
|
@@ -4439,11 +4450,11 @@ function useRecordsView({
|
|
|
4439
4450
|
setDeleting(true);
|
|
4440
4451
|
try {
|
|
4441
4452
|
await deleteRecord(deleteTargetId);
|
|
4442
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4453
|
+
_optionalChain([onToast, 'optionalCall', _134 => _134(`${_nullishCoalesce(_optionalChain([target, 'optionalAccess', _135 => _135.title]), () => ( "Record"))} deleted`, "success")]);
|
|
4443
4454
|
setDeleteTargetId(null);
|
|
4444
4455
|
} catch (e) {
|
|
4445
4456
|
const msg = e instanceof Error ? e.message : "Delete failed";
|
|
4446
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4457
|
+
_optionalChain([onToast, 'optionalCall', _136 => _136(`Could not delete record. ${msg}`, "error")]);
|
|
4447
4458
|
} finally {
|
|
4448
4459
|
setDeleting(false);
|
|
4449
4460
|
}
|
|
@@ -4581,8 +4592,8 @@ function RecordsView({
|
|
|
4581
4592
|
UploadModal,
|
|
4582
4593
|
{
|
|
4583
4594
|
onUpload: upload,
|
|
4584
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4585
|
-
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4595
|
+
onError: (msg) => _optionalChain([onToast, 'optionalCall', _137 => _137(msg, "error")]),
|
|
4596
|
+
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall', _138 => _138(msg, "success")]),
|
|
4586
4597
|
onClose: () => setUploadOpen(false)
|
|
4587
4598
|
}
|
|
4588
4599
|
)
|
|
@@ -4676,8 +4687,8 @@ function RecordsView({
|
|
|
4676
4687
|
UploadModal,
|
|
4677
4688
|
{
|
|
4678
4689
|
onUpload: upload,
|
|
4679
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4680
|
-
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4690
|
+
onError: (msg) => _optionalChain([onToast, 'optionalCall', _139 => _139(msg, "error")]),
|
|
4691
|
+
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall', _140 => _140(msg, "success")]),
|
|
4681
4692
|
onClose: () => setUploadOpen(false)
|
|
4682
4693
|
}
|
|
4683
4694
|
)
|