scribe-widget 1.0.7 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scribe-widget",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Floating panel widget for medical transcription using eka.scribe",
5
5
  "main": "dist/scribe-widget.umd.js",
6
6
  "module": "dist/scribe-widget.es.js",
package/src/App.tsx CHANGED
@@ -17,8 +17,8 @@ interface AppProps {
17
17
 
18
18
  export function App({ config: initialConfig, onClose }: AppProps) {
19
19
  const [isMinimized, setIsMinimized] = useState(false);
20
- const [credentials, setCredentials] = useState<{ apiKey?: string; baseUrl: string } | null>(
21
- initialConfig.baseUrl ? { apiKey: initialConfig.apiKey, baseUrl: initialConfig.baseUrl } : null
20
+ const [credentials, setCredentials] = useState<{ accessToken?: string; baseUrl: string } | null>(
21
+ initialConfig.baseUrl ? { accessToken: initialConfig.accessToken, baseUrl: initialConfig.baseUrl } : null
22
22
  );
23
23
 
24
24
  // Merge initial config with user-provided credentials
@@ -28,7 +28,7 @@ export function App({ config: initialConfig, onClose }: AppProps) {
28
28
  }
29
29
  return {
30
30
  ...initialConfig,
31
- apiKey: credentials.apiKey,
31
+ accessToken: credentials.accessToken,
32
32
  baseUrl: credentials.baseUrl,
33
33
  };
34
34
  }, [initialConfig, credentials]);
@@ -51,8 +51,8 @@ export function App({ config: initialConfig, onClose }: AppProps) {
51
51
  return null;
52
52
  }
53
53
 
54
- const handleConfigSubmit = (apiKey: string, baseUrl: string) => {
55
- setCredentials({ apiKey, baseUrl });
54
+ const handleConfigSubmit = (accessToken: string, baseUrl: string) => {
55
+ setCredentials({ accessToken, baseUrl });
56
56
  };
57
57
 
58
58
  const renderContent = () => {
@@ -61,7 +61,7 @@ export function App({ config: initialConfig, onClose }: AppProps) {
61
61
  return (
62
62
  <ConfigState
63
63
  onSubmit={handleConfigSubmit}
64
- initialApiKey={initialConfig.apiKey || ''}
64
+ initialAccessToken={initialConfig.accessToken || ''}
65
65
  initialBaseUrl={initialConfig.baseUrl || ''}
66
66
  />
67
67
  );
@@ -2,17 +2,17 @@ import { useState } from 'react';
2
2
  import { LogoIcon } from './Icons';
3
3
 
4
4
  interface ConfigStateProps {
5
- onSubmit: (apiKey: string, baseUrl: string) => void;
6
- initialApiKey?: string;
5
+ onSubmit: (accessToken: string, baseUrl: string) => void;
6
+ initialAccessToken?: string;
7
7
  initialBaseUrl?: string;
8
8
  }
9
9
 
10
10
  export function ConfigState({
11
11
  onSubmit,
12
- initialApiKey = '',
12
+ initialAccessToken = '',
13
13
  initialBaseUrl = '',
14
14
  }: ConfigStateProps) {
15
- const [apiKey, setApiKey] = useState(initialApiKey);
15
+ const [accessToken, setAccessToken] = useState(initialAccessToken);
16
16
  const [baseUrl, setBaseUrl] = useState(initialBaseUrl);
17
17
  const [error, setError] = useState('');
18
18
 
@@ -25,7 +25,7 @@ export function ConfigState({
25
25
  }
26
26
 
27
27
  setError('');
28
- onSubmit(apiKey.trim(), baseUrl.trim());
28
+ onSubmit(accessToken.trim(), baseUrl.trim());
29
29
  };
30
30
 
31
31
  return (
@@ -44,13 +44,13 @@ export function ConfigState({
44
44
 
45
45
  <form className="config-form" onSubmit={handleSubmit}>
46
46
  <div className="form-group">
47
- <label htmlFor="eka-api-key">API Key</label>
47
+ <label htmlFor="eka-access-token">Access Token</label>
48
48
  <input
49
- id="eka-api-key"
49
+ id="eka-access-token"
50
50
  type="text"
51
- value={apiKey}
52
- onChange={(e) => setApiKey(e.target.value)}
53
- placeholder="Enter your API key (optional)"
51
+ value={accessToken}
52
+ onChange={(e) => setAccessToken(e.target.value)}
53
+ placeholder="Enter your access token (optional)"
54
54
  />
55
55
  </div>
56
56
 
@@ -25,11 +25,14 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
25
25
  const startTimeRef = useRef<number>(0);
26
26
  const pausedTimeRef = useRef<number>(0);
27
27
 
28
- const log = useCallback((...args: unknown[]) => {
29
- if (config.debug) {
30
- console.log('[EkaScribe]', ...args);
31
- }
32
- }, [config.debug]);
28
+ const log = useCallback(
29
+ (...args: unknown[]) => {
30
+ if (config.debug) {
31
+ console.log('[EkaScribe]', ...args);
32
+ }
33
+ },
34
+ [config.debug]
35
+ );
33
36
 
34
37
  // Initialize SDK client only when baseUrl is provided
35
38
  useEffect(() => {
@@ -40,8 +43,9 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
40
43
 
41
44
  const initClient = async () => {
42
45
  try {
43
- clientRef.current = new ScribeClient({
44
- apiKey: config.apiKey,
46
+ // Use getInstance instead of new ScribeClient
47
+ clientRef.current = ScribeClient.getInstance({
48
+ accessToken: config.accessToken,
45
49
  baseUrl: config.baseUrl,
46
50
  debug: config.debug,
47
51
  });
@@ -59,7 +63,7 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
59
63
  clearInterval(timerRef.current);
60
64
  }
61
65
  };
62
- }, [config.apiKey, config.baseUrl, config.debug, log]);
66
+ }, [config.accessToken, config.baseUrl, config.debug, log]);
63
67
 
64
68
  const startTimer = useCallback(() => {
65
69
  timerRef.current = window.setInterval(() => {
@@ -87,7 +91,7 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
87
91
  const requestMicrophonePermission = async (): Promise<boolean> => {
88
92
  try {
89
93
  const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
90
- stream.getTracks().forEach(track => track.stop());
94
+ stream.getTracks().forEach((track) => track.stop());
91
95
  return true;
92
96
  } catch (error) {
93
97
  log('Microphone permission denied', error);
@@ -126,7 +130,7 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
126
130
  setState('recording');
127
131
 
128
132
  await clientRef.current.startRecording({
129
- templates: config.templates || ['soap'],
133
+ templates: config.templates || ['eka_emr_template'],
130
134
  languageHint: config.languageHint,
131
135
  });
132
136
 
package/src/index.tsx CHANGED
@@ -124,7 +124,9 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
124
124
 
125
125
  console.log(widgetInstance, 'widget instance');
126
126
  if (!widgetInstance) {
127
- init({});
127
+ init({
128
+ baseUrl: '',
129
+ });
128
130
  }
129
131
  };
130
132
 
package/src/types.ts CHANGED
@@ -1,10 +1,17 @@
1
1
  import { GetSessionStatusResponse } from 'med-scribe-alliance-ts-sdk';
2
2
 
3
- export type WidgetState = 'idle' | 'permission' | 'recording' | 'paused' | 'processing' | 'results' | 'error';
3
+ export type WidgetState =
4
+ | 'idle'
5
+ | 'permission'
6
+ | 'recording'
7
+ | 'paused'
8
+ | 'processing'
9
+ | 'results'
10
+ | 'error';
4
11
 
5
12
  export interface ScribeWidgetConfig {
6
- apiKey?: string;
7
- baseUrl?: string;
13
+ accessToken?: string;
14
+ baseUrl: string;
8
15
  templates?: string[];
9
16
  languageHint?: string[];
10
17
  position?: { bottom?: number; right?: number; top?: number; left?: number };