@eka-care/medical-records-ui 1.0.6 → 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.d.mts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +95 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -27,11 +27,6 @@ interface SdkProviderProps {
|
|
|
27
27
|
config: SdkConfig;
|
|
28
28
|
bid?: string;
|
|
29
29
|
patientId?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Document-type definitions from the host's onboarding config
|
|
32
|
-
* (`mr_document_type`). Drives the code → display-name labels shown across
|
|
33
|
-
* the feature; the SDK's static map is the fallback when a code is absent.
|
|
34
|
-
*/
|
|
35
30
|
documentTypes?: DocumentTypeConfig[];
|
|
36
31
|
children: ReactNode;
|
|
37
32
|
}
|
|
@@ -234,6 +229,7 @@ interface SdkContextValue {
|
|
|
234
229
|
ready: boolean;
|
|
235
230
|
labelOf: DocumentTypeLabelResolver;
|
|
236
231
|
documentTypes: DocumentTypeConfig[];
|
|
232
|
+
environment?: string;
|
|
237
233
|
}
|
|
238
234
|
|
|
239
235
|
declare function useSdk(): SdkContextValue;
|
|
@@ -246,7 +242,6 @@ declare function logoutMedicalRecords(bid?: string): Promise<void>;
|
|
|
246
242
|
interface RecordsViewProps {
|
|
247
243
|
className?: string;
|
|
248
244
|
onUpload?: () => void;
|
|
249
|
-
allowUpload?: boolean;
|
|
250
245
|
onCopyToNote?: (text: string, anchor?: {
|
|
251
246
|
x: number;
|
|
252
247
|
y: number;
|
|
@@ -259,7 +254,7 @@ interface RecordsViewProps {
|
|
|
259
254
|
onRemoveAttachment?: (documentId: string) => void | Promise<void>;
|
|
260
255
|
onToast?: (message: string, type?: 'error' | 'success') => void;
|
|
261
256
|
}
|
|
262
|
-
declare function RecordsView({ className, onUpload,
|
|
257
|
+
declare function RecordsView({ className, onUpload, onCopyToNote, attachedIds, onAttachManyToContext, onRemoveAttachment, onToast, }: RecordsViewProps): react.JSX.Element;
|
|
263
258
|
|
|
264
259
|
interface RecordsConnectionActions {
|
|
265
260
|
refresh: () => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,11 +27,6 @@ interface SdkProviderProps {
|
|
|
27
27
|
config: SdkConfig;
|
|
28
28
|
bid?: string;
|
|
29
29
|
patientId?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Document-type definitions from the host's onboarding config
|
|
32
|
-
* (`mr_document_type`). Drives the code → display-name labels shown across
|
|
33
|
-
* the feature; the SDK's static map is the fallback when a code is absent.
|
|
34
|
-
*/
|
|
35
30
|
documentTypes?: DocumentTypeConfig[];
|
|
36
31
|
children: ReactNode;
|
|
37
32
|
}
|
|
@@ -234,6 +229,7 @@ interface SdkContextValue {
|
|
|
234
229
|
ready: boolean;
|
|
235
230
|
labelOf: DocumentTypeLabelResolver;
|
|
236
231
|
documentTypes: DocumentTypeConfig[];
|
|
232
|
+
environment?: string;
|
|
237
233
|
}
|
|
238
234
|
|
|
239
235
|
declare function useSdk(): SdkContextValue;
|
|
@@ -246,7 +242,6 @@ declare function logoutMedicalRecords(bid?: string): Promise<void>;
|
|
|
246
242
|
interface RecordsViewProps {
|
|
247
243
|
className?: string;
|
|
248
244
|
onUpload?: () => void;
|
|
249
|
-
allowUpload?: boolean;
|
|
250
245
|
onCopyToNote?: (text: string, anchor?: {
|
|
251
246
|
x: number;
|
|
252
247
|
y: number;
|
|
@@ -259,7 +254,7 @@ interface RecordsViewProps {
|
|
|
259
254
|
onRemoveAttachment?: (documentId: string) => void | Promise<void>;
|
|
260
255
|
onToast?: (message: string, type?: 'error' | 'success') => void;
|
|
261
256
|
}
|
|
262
|
-
declare function RecordsView({ className, onUpload,
|
|
257
|
+
declare function RecordsView({ className, onUpload, onCopyToNote, attachedIds, onAttachManyToContext, onRemoveAttachment, onToast, }: RecordsViewProps): react.JSX.Element;
|
|
263
258
|
|
|
264
259
|
interface RecordsConnectionActions {
|
|
265
260
|
refresh: () => Promise<void>;
|
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, () => {
|
|
@@ -528,8 +531,8 @@ function SdkProviderInner({ config, bid, patientId, documentTypes, children }) {
|
|
|
528
531
|
[documentTypes]
|
|
529
532
|
);
|
|
530
533
|
const value = _react.useMemo.call(void 0,
|
|
531
|
-
() => ({ bid, patientId, store, ready: true, labelOf, documentTypes: docTypes }),
|
|
532
|
-
[bid, patientId, store, labelOf, docTypes]
|
|
534
|
+
() => ({ bid, patientId, store, ready: true, labelOf, documentTypes: docTypes, environment: config.environment }),
|
|
535
|
+
[bid, patientId, store, labelOf, docTypes, config.environment]
|
|
533
536
|
);
|
|
534
537
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SdkContext.Provider, { value, children });
|
|
535
538
|
}
|
|
@@ -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 {
|
|
@@ -1513,6 +1516,28 @@ function useLogout() {
|
|
|
1513
1516
|
}, []);
|
|
1514
1517
|
}
|
|
1515
1518
|
|
|
1519
|
+
// src/connection/useDenialList.ts
|
|
1520
|
+
|
|
1521
|
+
var HUB_URLS = {
|
|
1522
|
+
prod: "https://hub.eka.care",
|
|
1523
|
+
dev: "https://hub.dev.eka.care"
|
|
1524
|
+
};
|
|
1525
|
+
function useDenialList(environment) {
|
|
1526
|
+
const [denialList, setDenialList] = _react.useState.call(void 0, []);
|
|
1527
|
+
_react.useEffect.call(void 0, () => {
|
|
1528
|
+
const controller = new AbortController();
|
|
1529
|
+
const hubUrl = _nullishCoalesce(HUB_URLS[_nullishCoalesce(environment, () => ( "prod"))], () => ( HUB_URLS.prod));
|
|
1530
|
+
const url = `${hubUrl}/onboarding/5/configuration/?config_keys=denial_list&format=json`;
|
|
1531
|
+
fetch(url, { signal: controller.signal }).then((res) => res.json()).then((data) => {
|
|
1532
|
+
const list = _optionalChain([data, 'optionalAccess', _38 => _38.denial_list]);
|
|
1533
|
+
if (Array.isArray(list)) setDenialList(list);
|
|
1534
|
+
}).catch(() => {
|
|
1535
|
+
});
|
|
1536
|
+
return () => controller.abort();
|
|
1537
|
+
}, [environment]);
|
|
1538
|
+
return denialList;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1516
1541
|
// src/stores/selectors/recordsSelectors.ts
|
|
1517
1542
|
|
|
1518
1543
|
|
|
@@ -1530,7 +1555,7 @@ function useRecordsStatus(store) {
|
|
|
1530
1555
|
return _zustand.useStore.call(void 0, store, (s) => s.records.status);
|
|
1531
1556
|
}
|
|
1532
1557
|
function useThumbnailUrl(store, id) {
|
|
1533
|
-
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)));
|
|
1534
1559
|
}
|
|
1535
1560
|
function useIsSelected(store, id) {
|
|
1536
1561
|
return _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.has(id));
|
|
@@ -1674,7 +1699,7 @@ function FilterPopover({ onClose }) {
|
|
|
1674
1699
|
const ids = _zustand.useStore.call(void 0, store, (s) => s.records.ids);
|
|
1675
1700
|
const typeOptions = _react.useMemo.call(void 0, () => {
|
|
1676
1701
|
const seen = /* @__PURE__ */ new Set();
|
|
1677
|
-
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) }));
|
|
1678
1703
|
}, [ids, byId, labelOf]);
|
|
1679
1704
|
const [docType, setDocType] = _react.useState.call(void 0, _nullishCoalesce(filters.type, () => ( "")));
|
|
1680
1705
|
const [docPreset, setDocPreset] = _react.useState.call(void 0, filters.documentDatePreset);
|
|
@@ -1849,7 +1874,7 @@ function RecordsToolbar({
|
|
|
1849
1874
|
if (!filterOpen) return;
|
|
1850
1875
|
const onDown = (e) => {
|
|
1851
1876
|
const t = e.target;
|
|
1852
|
-
if (_optionalChain([t, 'access',
|
|
1877
|
+
if (_optionalChain([t, 'access', _45 => _45.closest, 'optionalCall', _46 => _46("[data-mr-portal]")])) return;
|
|
1853
1878
|
if (filterRef.current && !filterRef.current.contains(t)) setFilterOpen(false);
|
|
1854
1879
|
};
|
|
1855
1880
|
document.addEventListener("mousedown", onDown);
|
|
@@ -1865,7 +1890,7 @@ function RecordsToolbar({
|
|
|
1865
1890
|
if (isRefreshing) return;
|
|
1866
1891
|
setIsRefreshing(true);
|
|
1867
1892
|
try {
|
|
1868
|
-
await _optionalChain([onRefresh, 'optionalCall',
|
|
1893
|
+
await _optionalChain([onRefresh, 'optionalCall', _47 => _47()]);
|
|
1869
1894
|
} finally {
|
|
1870
1895
|
setIsRefreshing(false);
|
|
1871
1896
|
}
|
|
@@ -1891,7 +1916,7 @@ function RecordsToolbar({
|
|
|
1891
1916
|
store.getState().filters.setType(id === ALL ? null : id);
|
|
1892
1917
|
};
|
|
1893
1918
|
const scrollBy = (delta) => {
|
|
1894
|
-
_optionalChain([scrollRef, 'access',
|
|
1919
|
+
_optionalChain([scrollRef, 'access', _48 => _48.current, 'optionalAccess', _49 => _49.scrollBy, 'call', _50 => _50({ left: delta, behavior: "smooth" })]);
|
|
1895
1920
|
};
|
|
1896
1921
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-records-toolbar", children: [
|
|
1897
1922
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-toolbar-filter", ref: filterRef, children: [
|
|
@@ -1904,7 +1929,7 @@ function RecordsToolbar({
|
|
|
1904
1929
|
"aria-expanded": filterOpen,
|
|
1905
1930
|
onClick: () => {
|
|
1906
1931
|
setFilterOpen((o) => !o);
|
|
1907
|
-
_optionalChain([onFilter, 'optionalCall',
|
|
1932
|
+
_optionalChain([onFilter, 'optionalCall', _51 => _51()]);
|
|
1908
1933
|
},
|
|
1909
1934
|
children: [
|
|
1910
1935
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Filter, { size: 16, "aria-hidden": true, color: "var(--mr-primary)" }),
|
|
@@ -1931,7 +1956,7 @@ function RecordsToolbar({
|
|
|
1931
1956
|
{
|
|
1932
1957
|
id: ALL,
|
|
1933
1958
|
label: "All Records",
|
|
1934
|
-
count: _optionalChain([filteredIds, 'optionalAccess',
|
|
1959
|
+
count: _optionalChain([filteredIds, 'optionalAccess', _52 => _52.length]),
|
|
1935
1960
|
active: activeType == null,
|
|
1936
1961
|
onSelect: selectType
|
|
1937
1962
|
}
|
|
@@ -2174,8 +2199,8 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2174
2199
|
}
|
|
2175
2200
|
const onDown = (e) => {
|
|
2176
2201
|
const t = e.target;
|
|
2177
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2178
|
-
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;
|
|
2179
2204
|
setMenuPos(null);
|
|
2180
2205
|
};
|
|
2181
2206
|
const onResize = () => setMenuPos(null);
|
|
@@ -2262,7 +2287,7 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2262
2287
|
) : (
|
|
2263
2288
|
// List mode — show cases + footer button
|
|
2264
2289
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "mr-case-picker__list", children: filtered.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { className: "mr-case-picker__empty", children: "No cases found" }) : filtered.map((c) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2290
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "mr-case-picker__list", children: filtered.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { className: "mr-case-picker__empty text-center", children: "No cases found" }) : filtered.map((c) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2266
2291
|
"button",
|
|
2267
2292
|
{
|
|
2268
2293
|
type: "button",
|
|
@@ -2346,7 +2371,7 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2346
2371
|
onClick: () => open ? setMenuPos(null) : place(),
|
|
2347
2372
|
children: [
|
|
2348
2373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Search, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon" }),
|
|
2349
|
-
/* @__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")) }),
|
|
2350
2375
|
selected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon", onClick: (e) => {
|
|
2351
2376
|
e.stopPropagation();
|
|
2352
2377
|
onChange(null);
|
|
@@ -2562,7 +2587,7 @@ var TagChip = _react.memo.call(void 0, function TagChip2({ label, removable, onR
|
|
|
2562
2587
|
"aria-label": `Remove ${label}`,
|
|
2563
2588
|
onClick: (e) => {
|
|
2564
2589
|
e.stopPropagation();
|
|
2565
|
-
_optionalChain([onRemove, 'optionalCall',
|
|
2590
|
+
_optionalChain([onRemove, 'optionalCall', _62 => _62()]);
|
|
2566
2591
|
},
|
|
2567
2592
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 12, "aria-hidden": true })
|
|
2568
2593
|
}
|
|
@@ -2601,7 +2626,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2601
2626
|
bitmapRef.current = null;
|
|
2602
2627
|
} else {
|
|
2603
2628
|
const ctx2d = canvas.getContext("2d");
|
|
2604
|
-
_optionalChain([ctx2d, 'optionalAccess',
|
|
2629
|
+
_optionalChain([ctx2d, 'optionalAccess', _63 => _63.drawImage, 'call', _64 => _64(bitmap, 0, 0)]);
|
|
2605
2630
|
bitmap.close();
|
|
2606
2631
|
bitmapRef.current = null;
|
|
2607
2632
|
}
|
|
@@ -2630,8 +2655,8 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2630
2655
|
}
|
|
2631
2656
|
const dpr = typeof window === "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
2632
2657
|
const box = wrapRef.current;
|
|
2633
|
-
const boxW = size || _optionalChain([box, 'optionalAccess',
|
|
2634
|
-
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;
|
|
2635
2660
|
const boxRatio = boxW > 0 && boxH > 0 ? boxW / boxH : probe.width / probe.height;
|
|
2636
2661
|
const srcRatio = probe.width / probe.height;
|
|
2637
2662
|
let sw = probe.width;
|
|
@@ -2666,7 +2691,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2666
2691
|
return () => {
|
|
2667
2692
|
cancelled = true;
|
|
2668
2693
|
controller.abort();
|
|
2669
|
-
_optionalChain([bitmapRef, 'access',
|
|
2694
|
+
_optionalChain([bitmapRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.close, 'call', _69 => _69()]);
|
|
2670
2695
|
bitmapRef.current = null;
|
|
2671
2696
|
};
|
|
2672
2697
|
}, [url, size]);
|
|
@@ -2756,8 +2781,8 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2756
2781
|
if (!open) return;
|
|
2757
2782
|
const onDown = (e) => {
|
|
2758
2783
|
const node = e.target;
|
|
2759
|
-
if (_optionalChain([triggerRef, 'access',
|
|
2760
|
-
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;
|
|
2761
2786
|
close();
|
|
2762
2787
|
};
|
|
2763
2788
|
const onKey = (e) => {
|
|
@@ -2800,7 +2825,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2800
2825
|
"data-mr-portal": true,
|
|
2801
2826
|
style: { top: coords.top, bottom: coords.bottom, right: coords.right },
|
|
2802
2827
|
onClick: (e) => e.stopPropagation(),
|
|
2803
|
-
children: _optionalChain([activeItem, 'optionalAccess',
|
|
2828
|
+
children: _optionalChain([activeItem, 'optionalAccess', _78 => _78.subPanel]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-overflow-subpanel", children: [
|
|
2804
2829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-overflow-subpanel__back", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2805
2830
|
"button",
|
|
2806
2831
|
{
|
|
@@ -2825,7 +2850,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2825
2850
|
if (item.subPanel) {
|
|
2826
2851
|
setActiveSubPanel(item.key);
|
|
2827
2852
|
} else if (item.onSelect) {
|
|
2828
|
-
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()));
|
|
2829
2854
|
close();
|
|
2830
2855
|
item.onSelect(triggerRect);
|
|
2831
2856
|
}
|
|
@@ -2953,8 +2978,8 @@ function AddToContextSubPanel({
|
|
|
2953
2978
|
}
|
|
2954
2979
|
const onDown = (e) => {
|
|
2955
2980
|
const t = e.target;
|
|
2956
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2957
|
-
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;
|
|
2958
2983
|
setDropPos(null);
|
|
2959
2984
|
};
|
|
2960
2985
|
document.addEventListener("mousedown", onDown);
|
|
@@ -2964,10 +2989,10 @@ function AddToContextSubPanel({
|
|
|
2964
2989
|
if (!selected) return;
|
|
2965
2990
|
try {
|
|
2966
2991
|
await editRecord(recordId, { cases: [selected] });
|
|
2967
|
-
_optionalChain([onToast, 'optionalCall',
|
|
2992
|
+
_optionalChain([onToast, 'optionalCall', _90 => _90(`Moved to ${_nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _91 => _91.name]), () => ( "care context"))}`, "success")]);
|
|
2968
2993
|
onClose();
|
|
2969
2994
|
} catch (e4) {
|
|
2970
|
-
_optionalChain([onToast, 'optionalCall',
|
|
2995
|
+
_optionalChain([onToast, 'optionalCall', _92 => _92("Failed to add to care context", "error")]);
|
|
2971
2996
|
}
|
|
2972
2997
|
};
|
|
2973
2998
|
const handleCreate = async () => {
|
|
@@ -2978,10 +3003,10 @@ function AddToContextSubPanel({
|
|
|
2978
3003
|
const occurred_at = newDate ? Math.floor((/* @__PURE__ */ new Date(newDate + "T00:00:00")).getTime() / 1e3) : void 0;
|
|
2979
3004
|
const id = await createCase({ display_name: name, type: newType, occurred_at });
|
|
2980
3005
|
await editRecord(recordId, { cases: [id] });
|
|
2981
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3006
|
+
_optionalChain([onToast, 'optionalCall', _93 => _93(`Created and added to "${name}"`, "success")]);
|
|
2982
3007
|
onClose();
|
|
2983
3008
|
} catch (e5) {
|
|
2984
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3009
|
+
_optionalChain([onToast, 'optionalCall', _94 => _94("Failed to create care context", "error")]);
|
|
2985
3010
|
} finally {
|
|
2986
3011
|
setSaving(false);
|
|
2987
3012
|
}
|
|
@@ -2997,7 +3022,7 @@ function AddToContextSubPanel({
|
|
|
2997
3022
|
className: `mr-ctx-subpanel__field${dropOpen ? " mr-ctx-subpanel__field--open" : ""}`,
|
|
2998
3023
|
onClick: () => dropOpen ? setDropPos(null) : openDrop(),
|
|
2999
3024
|
children: [
|
|
3000
|
-
/* @__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")) }),
|
|
3001
3026
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronsUpDown, { size: 16, "aria-hidden": true, className: "mr-ctx-subpanel__field-chevron" })
|
|
3002
3027
|
]
|
|
3003
3028
|
}
|
|
@@ -3041,7 +3066,7 @@ function AddToContextSubPanel({
|
|
|
3041
3066
|
}
|
|
3042
3067
|
)
|
|
3043
3068
|
] }),
|
|
3044
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "mr-ctx-subpanel__list", children: filtered.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { className: "mr-ctx-subpanel__empty", children: "No cases found" }) : filtered.map((c) => {
|
|
3069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "mr-ctx-subpanel__list", children: filtered.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { className: "mr-ctx-subpanel__empty text-center", children: "No cases found" }) : filtered.map((c) => {
|
|
3045
3070
|
const isCurrent = linkedCaseIds.includes(c.id);
|
|
3046
3071
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3047
3072
|
"button",
|
|
@@ -3355,8 +3380,8 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3355
3380
|
const thumbnailUrl = useThumbnailUrl2(id);
|
|
3356
3381
|
const pendingSelected = useIsSelected2(id);
|
|
3357
3382
|
const pendingCount = _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.size);
|
|
3358
|
-
const attachedCount = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3359
|
-
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));
|
|
3360
3385
|
const checked = pendingSelected || attached;
|
|
3361
3386
|
const attachDisabled = attachedCount >= maxSelectable && !attached;
|
|
3362
3387
|
const selectDisabled = attachedCount + pendingCount >= maxSelectable && !checked;
|
|
@@ -3367,14 +3392,14 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3367
3392
|
);
|
|
3368
3393
|
const handleSelect = _react.useCallback.call(void 0, () => {
|
|
3369
3394
|
if (attached) {
|
|
3370
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3395
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _99 => _99(id)]);
|
|
3371
3396
|
} else {
|
|
3372
3397
|
store.getState().selection.toggleRecord(id, pendingLimit);
|
|
3373
3398
|
}
|
|
3374
3399
|
}, [store, id, pendingLimit, attached, onRemoveAttachment]);
|
|
3375
3400
|
const handleAddToContext = _react.useCallback.call(void 0, () => {
|
|
3376
3401
|
if (attached) {
|
|
3377
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3402
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _100 => _100(id)]);
|
|
3378
3403
|
} else {
|
|
3379
3404
|
const r = store.getState().records.byId[id];
|
|
3380
3405
|
if (r && onAttachToContext) void onAttachToContext([{ documentId: id, name: r.title }]);
|
|
@@ -3404,7 +3429,7 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3404
3429
|
[store, id, bid, patientId, onCopyToNote]
|
|
3405
3430
|
);
|
|
3406
3431
|
const handleDelete = _react.useCallback.call(void 0, () => {
|
|
3407
|
-
_optionalChain([onRequestDelete, 'optionalCall',
|
|
3432
|
+
_optionalChain([onRequestDelete, 'optionalCall', _101 => _101(id)]);
|
|
3408
3433
|
}, [onRequestDelete, id]);
|
|
3409
3434
|
if (!record) return null;
|
|
3410
3435
|
return {
|
|
@@ -3609,7 +3634,7 @@ function RecordsGrid({
|
|
|
3609
3634
|
const headerRefs = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
3610
3635
|
_react.useEffect.call(void 0, () => {
|
|
3611
3636
|
if (!scrollToKey) return;
|
|
3612
|
-
_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" })]);
|
|
3613
3638
|
}, [scrollToKey]);
|
|
3614
3639
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-records-grid", children: sections.map((section, i) => {
|
|
3615
3640
|
const showMonth = showMonths && (i === 0 || sections[i - 1].monthKey !== section.monthKey);
|
|
@@ -3910,12 +3935,12 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3910
3935
|
const { attachedIds, onAttachToContext, onRemoveAttachment, onCopyToNote } = useRecordsActions();
|
|
3911
3936
|
const [smartOpen, setSmartOpen] = _react.useState.call(void 0, true);
|
|
3912
3937
|
if (!record) return null;
|
|
3913
|
-
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3914
|
-
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;
|
|
3915
3940
|
const handleAttach = () => {
|
|
3916
3941
|
if (attachFull) return;
|
|
3917
|
-
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3918
|
-
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 }])]);
|
|
3919
3944
|
};
|
|
3920
3945
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-record-preview", children: [
|
|
3921
3946
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "header", { className: "mr-record-preview__header", children: [
|
|
@@ -3943,13 +3968,13 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3943
3968
|
children: "Show smart report"
|
|
3944
3969
|
}
|
|
3945
3970
|
),
|
|
3946
|
-
_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,
|
|
3947
3972
|
"button",
|
|
3948
3973
|
{
|
|
3949
3974
|
type: "button",
|
|
3950
3975
|
className: "mr-record-preview__copy-btn",
|
|
3951
3976
|
onClick: async (e) => {
|
|
3952
|
-
const url = _optionalChain([preview, 'access',
|
|
3977
|
+
const url = _optionalChain([preview, 'access', _115 => _115.files, 'access', _116 => _116[0], 'optionalAccess', _117 => _117.url]);
|
|
3953
3978
|
if (!url) return;
|
|
3954
3979
|
const res = await fetch(url);
|
|
3955
3980
|
const html = await res.text();
|
|
@@ -3996,7 +4021,7 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3996
4021
|
{
|
|
3997
4022
|
files: preview.files,
|
|
3998
4023
|
title: record.title,
|
|
3999
|
-
isHtml: _optionalChain([record, 'access',
|
|
4024
|
+
isHtml: _optionalChain([record, 'access', _118 => _118.fileType, 'optionalAccess', _119 => _119.toUpperCase, 'call', _120 => _120()]) === "HTML"
|
|
4000
4025
|
}
|
|
4001
4026
|
) }),
|
|
4002
4027
|
preview.hasSmartReport && smartOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4068,7 +4093,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4068
4093
|
}));
|
|
4069
4094
|
onClose();
|
|
4070
4095
|
void onUpload(items).then(() => {
|
|
4071
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
4096
|
+
_optionalChain([onSuccess, 'optionalCall', _121 => _121(items.length > 1 ? `${items.length} records uploaded` : "Record uploaded")]);
|
|
4072
4097
|
}).catch((e) => {
|
|
4073
4098
|
onError(e instanceof Error ? e.message : "Upload failed. Please try again.");
|
|
4074
4099
|
});
|
|
@@ -4076,7 +4101,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4076
4101
|
const onDrop = (e) => {
|
|
4077
4102
|
e.preventDefault();
|
|
4078
4103
|
setDragging(false);
|
|
4079
|
-
if (_optionalChain([e, 'access',
|
|
4104
|
+
if (_optionalChain([e, 'access', _122 => _122.dataTransfer, 'access', _123 => _123.files, 'optionalAccess', _124 => _124.length])) addFiles(e.dataTransfer.files);
|
|
4080
4105
|
};
|
|
4081
4106
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-upload-modal", role: "presentation", onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4082
4107
|
"div",
|
|
@@ -4102,7 +4127,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4102
4127
|
] }),
|
|
4103
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 }) })
|
|
4104
4129
|
] }),
|
|
4105
|
-
/* @__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: [
|
|
4106
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 }) }),
|
|
4107
4132
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__title", children: "Drop files here or click to browse" }),
|
|
4108
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" })
|
|
@@ -4243,7 +4268,7 @@ function useRecordSections(tab, ids) {
|
|
|
4243
4268
|
return caseIds.map((caseId) => {
|
|
4244
4269
|
const c = casesById[caseId];
|
|
4245
4270
|
if (!c) return null;
|
|
4246
|
-
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)]));
|
|
4247
4272
|
const type = (_nullishCoalesce(c.typeCode, () => ( ""))).toUpperCase();
|
|
4248
4273
|
return {
|
|
4249
4274
|
key: caseId,
|
|
@@ -4320,14 +4345,15 @@ function useSectionPages(tab, sections, page) {
|
|
|
4320
4345
|
// src/views/RecordsView/useRecordsView.ts
|
|
4321
4346
|
function useRecordsView({
|
|
4322
4347
|
onUpload,
|
|
4323
|
-
allowUpload = true,
|
|
4324
4348
|
onCopyToNote,
|
|
4325
4349
|
attachedIds,
|
|
4326
4350
|
onAttachManyToContext,
|
|
4327
4351
|
onRemoveAttachment,
|
|
4328
4352
|
onToast
|
|
4329
4353
|
}) {
|
|
4330
|
-
const { store, labelOf } = useSdk();
|
|
4354
|
+
const { store, labelOf, environment } = useSdk();
|
|
4355
|
+
const denialList = useDenialList(environment);
|
|
4356
|
+
const allowUpload = !denialList.includes("UPLOAD_MEDICAL_RECORDS");
|
|
4331
4357
|
const { refresh, sourceRefreshedAt, deleteRecord } = useRecordsConnection();
|
|
4332
4358
|
const { upload } = useUploadConnection();
|
|
4333
4359
|
const status = useRecordsStatus2();
|
|
@@ -4405,7 +4431,7 @@ function useRecordsView({
|
|
|
4405
4431
|
if (records.length && onAttachManyToContext) void onAttachManyToContext(records);
|
|
4406
4432
|
}, [store, onAttachManyToContext]);
|
|
4407
4433
|
const openUpload = _react.useCallback.call(void 0, () => {
|
|
4408
|
-
_optionalChain([onUpload, 'optionalCall',
|
|
4434
|
+
_optionalChain([onUpload, 'optionalCall', _132 => _132()]);
|
|
4409
4435
|
setUploadOpen(true);
|
|
4410
4436
|
}, [onUpload]);
|
|
4411
4437
|
const requestDelete = _react.useCallback.call(void 0, (id) => setDeleteTargetId(id), []);
|
|
@@ -4418,11 +4444,11 @@ function useRecordsView({
|
|
|
4418
4444
|
setDeleting(true);
|
|
4419
4445
|
try {
|
|
4420
4446
|
await deleteRecord(deleteTargetId);
|
|
4421
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4447
|
+
_optionalChain([onToast, 'optionalCall', _133 => _133(`${_nullishCoalesce(_optionalChain([target, 'optionalAccess', _134 => _134.title]), () => ( "Record"))} deleted`, "success")]);
|
|
4422
4448
|
setDeleteTargetId(null);
|
|
4423
4449
|
} catch (e) {
|
|
4424
4450
|
const msg = e instanceof Error ? e.message : "Delete failed";
|
|
4425
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4451
|
+
_optionalChain([onToast, 'optionalCall', _135 => _135(`Could not delete record. ${msg}`, "error")]);
|
|
4426
4452
|
} finally {
|
|
4427
4453
|
setDeleting(false);
|
|
4428
4454
|
}
|
|
@@ -4499,7 +4525,6 @@ var MAX_CONTEXT_ATTACHMENTS = 1;
|
|
|
4499
4525
|
function RecordsView({
|
|
4500
4526
|
className,
|
|
4501
4527
|
onUpload,
|
|
4502
|
-
allowUpload = true,
|
|
4503
4528
|
onCopyToNote,
|
|
4504
4529
|
attachedIds,
|
|
4505
4530
|
onAttachManyToContext,
|
|
@@ -4533,6 +4558,7 @@ function RecordsView({
|
|
|
4533
4558
|
refresh,
|
|
4534
4559
|
sourceRefreshedAt,
|
|
4535
4560
|
actions,
|
|
4561
|
+
allowUpload,
|
|
4536
4562
|
handleTabChange,
|
|
4537
4563
|
handleSelectSection,
|
|
4538
4564
|
handleToggleSelectionMode,
|
|
@@ -4544,7 +4570,6 @@ function RecordsView({
|
|
|
4544
4570
|
setPage
|
|
4545
4571
|
} = useRecordsView({
|
|
4546
4572
|
onUpload,
|
|
4547
|
-
allowUpload,
|
|
4548
4573
|
onCopyToNote,
|
|
4549
4574
|
attachedIds,
|
|
4550
4575
|
onAttachManyToContext,
|
|
@@ -4561,8 +4586,8 @@ function RecordsView({
|
|
|
4561
4586
|
UploadModal,
|
|
4562
4587
|
{
|
|
4563
4588
|
onUpload: upload,
|
|
4564
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4565
|
-
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")]),
|
|
4566
4591
|
onClose: () => setUploadOpen(false)
|
|
4567
4592
|
}
|
|
4568
4593
|
)
|
|
@@ -4656,8 +4681,8 @@ function RecordsView({
|
|
|
4656
4681
|
UploadModal,
|
|
4657
4682
|
{
|
|
4658
4683
|
onUpload: upload,
|
|
4659
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4660
|
-
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")]),
|
|
4661
4686
|
onClose: () => setUploadOpen(false)
|
|
4662
4687
|
}
|
|
4663
4688
|
)
|