scribe-widget 1.0.14 → 1.0.16
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/scribe-widget.es.js +49 -15
- package/dist/scribe-widget.umd.js +2 -2
- package/package.json +1 -1
- package/src/App.tsx +13 -1
- package/src/components/EMRListState.tsx +50 -0
- package/src/components/ResultsState.tsx +30 -3
- package/src/hooks/useScribeSession.ts +1 -1
- package/src/styles/widget.css +131 -1
- package/src/types.ts +2 -1
package/dist/scribe-widget.es.js
CHANGED
|
@@ -5897,16 +5897,41 @@ function ProcessingState() {
|
|
|
5897
5897
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "processing-text", children: "Processing your recording..." })
|
|
5898
5898
|
] });
|
|
5899
5899
|
}
|
|
5900
|
-
|
|
5901
|
-
|
|
5900
|
+
const EMR_LIST = [
|
|
5901
|
+
{ id: "eka_emr", name: "Eka EMR", description: "Eka Care Electronic Medical Records" },
|
|
5902
|
+
{ id: "open_emr", name: "OpenEMR", description: "Open-source Electronic Health Records" },
|
|
5903
|
+
{ id: "open_mrs", name: "OpenMRS", description: "Open Medical Record System" }
|
|
5904
|
+
];
|
|
5905
|
+
function ResultsState({ result: i, onNewRecording: e, onSelectEMR: s }) {
|
|
5906
|
+
return console.log("prescription result - WIDGET", i), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "results-state", children: [
|
|
5902
5907
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "results-header", children: [
|
|
5903
5908
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "results-title", children: "Recording Complete" }),
|
|
5904
5909
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "new-recording-btn", onClick: e, children: "New Recording" })
|
|
5905
5910
|
] }),
|
|
5906
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
5907
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
5908
|
-
|
|
5909
|
-
|
|
5911
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "results-content", children: [
|
|
5912
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "transcript-section", children: [
|
|
5913
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "section-title", children: "Transcript" }),
|
|
5914
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "transcript-text", children: i.transcript || "No transcript available." })
|
|
5915
|
+
] }),
|
|
5916
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "emr-section", children: [
|
|
5917
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "section-title", children: "Integrated EMRs" }),
|
|
5918
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "emr-list-inline", children: EMR_LIST.map((c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
5919
|
+
"button",
|
|
5920
|
+
{
|
|
5921
|
+
className: "emr-item",
|
|
5922
|
+
onClick: () => s(c.id),
|
|
5923
|
+
children: [
|
|
5924
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "emr-item-info", children: [
|
|
5925
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "emr-item-name", children: c.name }),
|
|
5926
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "emr-item-desc", children: c.description })
|
|
5927
|
+
] }),
|
|
5928
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { className: "emr-item-arrow", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M9 18l6-6-6-6" }) })
|
|
5929
|
+
]
|
|
5930
|
+
},
|
|
5931
|
+
c.id
|
|
5932
|
+
)) })
|
|
5933
|
+
] })
|
|
5934
|
+
] })
|
|
5910
5935
|
] });
|
|
5911
5936
|
}
|
|
5912
5937
|
function ErrorState({ message: i, onRetry: e }) {
|
|
@@ -35926,7 +35951,7 @@ function useScribeSession(i) {
|
|
|
35926
35951
|
}
|
|
35927
35952
|
try {
|
|
35928
35953
|
s("recording"), await et.current.startRecording({
|
|
35929
|
-
templates:
|
|
35954
|
+
templates: ["eka_emr_template"],
|
|
35930
35955
|
languageHint: i.languageHint
|
|
35931
35956
|
}), a.current = Date.now(), o.current = 0, h(0), g(), d("Recording started");
|
|
35932
35957
|
} catch (wt) {
|
|
@@ -35983,17 +36008,19 @@ function App({ config: i, onClose: e }) {
|
|
|
35983
36008
|
reset: tt
|
|
35984
36009
|
} = useScribeSession(_), ot = reactExports.useCallback(() => {
|
|
35985
36010
|
tt(), $(null);
|
|
35986
|
-
}, [tt])
|
|
36011
|
+
}, [tt]), rt = reactExports.useCallback((lt) => {
|
|
36012
|
+
console.log("Selected EMR:", lt);
|
|
36013
|
+
}, []);
|
|
35987
36014
|
if (s)
|
|
35988
36015
|
return null;
|
|
35989
|
-
const
|
|
35990
|
-
$({ accessToken:
|
|
35991
|
-
},
|
|
36016
|
+
const at = (lt, ct) => {
|
|
36017
|
+
$({ accessToken: lt, baseUrl: ct });
|
|
36018
|
+
}, ut = () => {
|
|
35992
36019
|
if (j)
|
|
35993
36020
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
35994
36021
|
ConfigState,
|
|
35995
36022
|
{
|
|
35996
|
-
onSubmit:
|
|
36023
|
+
onSubmit: at,
|
|
35997
36024
|
initialAccessToken: i.accessToken || "",
|
|
35998
36025
|
initialBaseUrl: i.baseUrl || ""
|
|
35999
36026
|
}
|
|
@@ -36018,7 +36045,14 @@ function App({ config: i, onClose: e }) {
|
|
|
36018
36045
|
case "processing":
|
|
36019
36046
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ProcessingState, {});
|
|
36020
36047
|
case "results":
|
|
36021
|
-
return b ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36048
|
+
return b ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36049
|
+
ResultsState,
|
|
36050
|
+
{
|
|
36051
|
+
result: b,
|
|
36052
|
+
onNewRecording: ot,
|
|
36053
|
+
onSelectEMR: rt
|
|
36054
|
+
}
|
|
36055
|
+
) : null;
|
|
36022
36056
|
case "polling_error":
|
|
36023
36057
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36024
36058
|
PollingErrorState,
|
|
@@ -36040,11 +36074,11 @@ function App({ config: i, onClose: e }) {
|
|
|
36040
36074
|
position: _.position,
|
|
36041
36075
|
onClose: e,
|
|
36042
36076
|
onMinimize: () => c(!0),
|
|
36043
|
-
children:
|
|
36077
|
+
children: ut()
|
|
36044
36078
|
}
|
|
36045
36079
|
);
|
|
36046
36080
|
}
|
|
36047
|
-
const widgetStyles = ":host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,sans-serif}*{box-sizing:border-box;margin:0;padding:0}.scribe-panel{position:fixed;bottom:20px;right:20px;background:#fff;border-radius:16px;box-shadow:0 4px 24px #0000001f,0 0 0 1px #0000000d;z-index:2147483647;overflow:hidden;
|
|
36081
|
+
const widgetStyles = ":host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,sans-serif}*{box-sizing:border-box;margin:0;padding:0}.scribe-panel{position:fixed;bottom:20px;right:20px;background:#fff;border-radius:16px;box-shadow:0 4px 24px #0000001f,0 0 0 1px #0000000d;z-index:2147483647;overflow:hidden;width:380px;max-width:calc(100vw - 40px)}.panel-header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#fafafa;border-bottom:1px solid #eee;cursor:grab}.panel-header:active{cursor:grabbing}.drag-handle{display:flex;gap:2px;flex-wrap:wrap;width:16px;opacity:.4}.drag-handle span{width:4px;height:4px;background:#666;border-radius:50%}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;cursor:pointer;padding:4px;color:#666;display:flex;align-items:center;justify-content:center;width:24px;height:24px}.header-btn:hover{color:#333}.header-btn svg{width:16px;height:16px}.panel-content{padding:20px 24px}.idle-state{display:flex;align-items:center;gap:24px}.logo{display:flex;align-items:center;gap:8px}.logo-icon{width:32px;height:32px}.logo-icon svg{width:100%;height:100%}.logo-text{font-size:20px;font-weight:600;color:#2563eb}.start-btn{display:flex;align-items:center;gap:8px;background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:24px;font-size:16px;font-weight:500;cursor:pointer;transition:background .2s}.start-btn:hover{background:#1d4ed8}.start-btn:disabled{background:#93c5fd;cursor:not-allowed}.mic-icon{width:20px;height:20px}.mic-icon svg{width:100%;height:100%}.recording-state{display:flex;align-items:center;gap:16px}.recording-indicator{display:flex;align-items:center;gap:12px;color:#666}.recording-icon{width:24px;height:24px;color:#666}.recording-icon svg{width:100%;height:100%}.recording-icon.active{color:#ef4444;animation:pulse 1.5s infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.timer{font-size:20px;font-weight:500;font-variant-numeric:tabular-nums;color:#374151}.recording-actions{display:flex;gap:8px;margin-left:auto}.resume-btn{background:#fff;color:#2563eb;border:2px solid #2563eb;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.resume-btn:hover{background:#eff6ff}.pause-btn{background:#fff;color:#f59e0b;border:2px solid #f59e0b;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.pause-btn:hover{background:#fffbeb}.stop-btn{background:#ef4444;color:#fff;border:none;padding:10px 16px;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}.stop-btn:hover{background:#dc2626}.stop-icon{width:16px;height:16px;background:#fff;border-radius:2px}.processing-state{display:flex;flex-direction:column;align-items:center;gap:16px;padding:20px}.spinner{width:40px;height:40px;border:3px solid #e5e7eb;border-top-color:#2563eb;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.processing-text{color:#6b7280;font-size:14px}.results-state{display:flex;flex-direction:column;gap:16px;max-height:400px}.results-header{display:flex;align-items:center;justify-content:space-between}.results-title{font-size:16px;font-weight:600;color:#111827}.new-recording-btn{background:#2563eb;color:#fff;border:none;padding:8px 16px;border-radius:6px;font-size:13px;cursor:pointer;transition:background .2s}.new-recording-btn:hover{background:#1d4ed8}.results-content{overflow-y:auto;max-height:300px}.transcript-section{margin-bottom:16px}.section-title{font-size:13px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}.transcript-text{font-size:14px;line-height:1.6;color:#374151;background:#f9fafb;padding:12px;border-radius:8px;white-space:pre-wrap}.error-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;text-align:center}.error-icon{width:48px;height:48px;color:#ef4444}.error-icon svg{width:100%;height:100%}.error-message{color:#ef4444;font-size:14px}.retry-btn{background:#ef4444;color:#fff;border:none;padding:10px 20px;border-radius:8px;font-size:14px;cursor:pointer;transition:background .2s}.retry-btn:hover{background:#dc2626}.permission-state{display:flex;flex-direction:column;align-items:center;gap:16px;padding:20px;text-align:center}.permission-icon{width:48px;height:48px;color:#2563eb}.permission-icon svg{width:100%;height:100%}.permission-text{color:#374151;font-size:14px;line-height:1.5}.permission-btn{background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s}.permission-btn:hover{background:#1d4ed8}.config-state{display:flex;flex-direction:column;gap:20px}.config-state .logo{justify-content:center}.config-form{display:flex;flex-direction:column;gap:12px}.config-form .form-group{display:flex;flex-direction:column;gap:4px}.config-form label{font-size:13px;font-weight:500;color:#374151}.config-form input{padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;font-size:14px;color:#111827;background:#fff;transition:border-color .2s,box-shadow .2s}.config-form input:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px #2563eb1a}.config-form input::placeholder{color:#9ca3af}.config-error{color:#ef4444;font-size:13px;margin:0}.config-submit-btn{background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;margin-top:4px}.config-submit-btn:hover{background:#1d4ed8}.polling-error-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;text-align:center}.polling-error-actions{display:flex;flex-direction:column;gap:8px;width:100%;margin-top:8px}.retry-polling-btn{background:#2563eb;color:#fff;border:none;padding:12px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;width:100%}.retry-polling-btn:hover{background:#1d4ed8}.start-new-btn{background:transparent;color:#6b7280;border:1px solid #d1d5db;padding:10px 20px;border-radius:8px;font-size:13px;cursor:pointer;transition:all .2s;width:100%}.start-new-btn:hover{background:#f3f4f6;color:#374151}.emr-section{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.emr-list-inline{display:flex;flex-direction:column;gap:8px}.emr-list-state{display:flex;flex-direction:column;gap:16px}.emr-list-header{display:flex;align-items:center;gap:12px}.back-btn{background:none;border:none;cursor:pointer;padding:4px;color:#6b7280;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:6px;transition:all .2s}.back-btn:hover{background:#f3f4f6;color:#374151}.back-btn svg{width:20px;height:20px}.emr-list-title{font-size:16px;font-weight:600;color:#111827}.emr-list-content{display:flex;flex-direction:column;gap:8px;max-height:240px;overflow-y:auto}.emr-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;text-align:left}.emr-item:hover{background:#f3f4f6;border-color:#d1d5db}.emr-item-info{display:flex;flex-direction:column;gap:2px}.emr-item-name{font-size:14px;font-weight:500;color:#111827}.emr-item-desc{font-size:12px;color:#6b7280}.emr-item-arrow{width:20px;height:20px;color:#9ca3af;flex-shrink:0}.emr-list-footer{padding-top:12px;border-top:1px solid #e5e7eb}.start-new-recording-btn{width:100%;background:#2563eb;color:#fff;border:none;padding:12px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s}.start-new-recording-btn:hover{background:#1d4ed8}";
|
|
36048
36082
|
class ScribeWidget {
|
|
36049
36083
|
constructor(e) {
|
|
36050
36084
|
Qr(this, "container");
|