@eka-care/medical-records-ui 1.0.19 → 1.0.21

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.mjs CHANGED
@@ -1336,7 +1336,8 @@ var EMPTY = {
1336
1336
  status: "loading",
1337
1337
  files: [],
1338
1338
  vitals: [],
1339
- hasSmartReport: false
1339
+ hasSmartReport: false,
1340
+ isHtml: false
1340
1341
  };
1341
1342
  function useRecordPreview(documentId) {
1342
1343
  const { bid, patientId } = useSdk();
@@ -1355,16 +1356,19 @@ function useRecordPreview(documentId) {
1355
1356
  try {
1356
1357
  const res = await getCore().describeDocument({ documentId, bid, patientId, preferenceType: "HTML" });
1357
1358
  if (cancelled) return;
1358
- const files = (res.files ?? []).filter((f) => f.asset_url).map((f) => ({ url: f.asset_url, kind: classifyFile(f.file_type) }));
1359
+ const rawFiles = res.files ?? [];
1360
+ const files = rawFiles.filter((f) => f.asset_url).map((f) => ({ url: f.asset_url, kind: classifyFile(f.file_type) }));
1361
+ const isHtml = (rawFiles[0]?.file_type ?? "").toUpperCase() === "HTML";
1359
1362
  const vitals = res.smart_report ? parseVitals(res.smart_report) : [];
1360
1363
  setData({
1361
1364
  status: "loaded",
1362
1365
  files,
1363
1366
  vitals,
1364
- hasSmartReport: res.smart_report != null
1367
+ hasSmartReport: res.smart_report != null,
1368
+ isHtml
1365
1369
  });
1366
1370
  } catch {
1367
- if (!cancelled) setData({ status: "error", files: [], vitals: [], hasSmartReport: false });
1371
+ if (!cancelled) setData({ status: "error", files: [], vitals: [], hasSmartReport: false, isHtml: false });
1368
1372
  }
1369
1373
  })();
1370
1374
  return () => {
@@ -3998,7 +4002,7 @@ function RecordPreview({ recordId, onBack }) {
3998
4002
  children: "Show smart report"
3999
4003
  }
4000
4004
  ),
4001
- record.fileType?.toUpperCase() === "HTML" && onCopyToNote && /* @__PURE__ */ jsxs28(
4005
+ preview.isHtml && onCopyToNote && /* @__PURE__ */ jsxs28(
4002
4006
  "button",
4003
4007
  {
4004
4008
  type: "button",
@@ -4046,12 +4050,12 @@ function RecordPreview({ recordId, onBack }) {
4046
4050
  ] })
4047
4051
  ] }),
4048
4052
  /* @__PURE__ */ jsxs28("div", { className: "mr-record-preview__body", children: [
4049
- preview.status === "loading" ? /* @__PURE__ */ jsx33("div", { className: "mr-record-preview__loading", children: /* @__PURE__ */ jsx33(Skeleton, { variant: "card" }) }) : /* @__PURE__ */ jsx33(Suspense, { fallback: /* @__PURE__ */ jsx33("div", { className: "mr-doc-viewer__status", children: "Loading viewer\u2026" }), children: /* @__PURE__ */ jsx33(
4053
+ preview.status === "loading" ? /* @__PURE__ */ jsx33("div", { className: "mr-record-preview__loading", children: /* @__PURE__ */ jsx33(Skeleton, { variant: "card" }) }) : preview.isHtml && preview.files.length === 0 ? /* @__PURE__ */ jsx33("div", { className: "mr-doc-viewer__status", style: { color: "var(--mr-muted-foreground)" }, children: "Document not available for this record." }) : /* @__PURE__ */ jsx33(Suspense, { fallback: /* @__PURE__ */ jsx33("div", { className: "mr-doc-viewer__status", children: "Loading viewer\u2026" }), children: /* @__PURE__ */ jsx33(
4050
4054
  DocumentViewer,
4051
4055
  {
4052
4056
  files: preview.files,
4053
4057
  title: record.title,
4054
- isHtml: record.fileType?.toUpperCase() === "HTML"
4058
+ isHtml: preview.isHtml
4055
4059
  }
4056
4060
  ) }),
4057
4061
  preview.hasSmartReport && smartOpen && /* @__PURE__ */ jsx33(