scribe-widget 1.0.6 → 1.0.8

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.6",
3
+ "version": "1.0.8",
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",
@@ -14,7 +14,7 @@
14
14
  "prepublishOnly": "npm run clean && npm run build"
15
15
  },
16
16
  "dependencies": {
17
- "med-scribe-alliance-ts-sdk": "1.0.2",
17
+ "med-scribe-alliance-ts-sdk": "1.0.3",
18
18
  "react": "^18.2.0",
19
19
  "react-dom": "^18.2.0"
20
20
  },
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
 
@@ -40,8 +40,9 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
40
40
 
41
41
  const initClient = async () => {
42
42
  try {
43
- clientRef.current = new ScribeClient({
44
- apiKey: config.apiKey,
43
+ // Use getInstance instead of new ScribeClient
44
+ clientRef.current = ScribeClient.getInstance({
45
+ accessToken: config.accessToken,
45
46
  baseUrl: config.baseUrl,
46
47
  debug: config.debug,
47
48
  });
@@ -59,7 +60,7 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
59
60
  clearInterval(timerRef.current);
60
61
  }
61
62
  };
62
- }, [config.apiKey, config.baseUrl, config.debug, log]);
63
+ }, [config.accessToken, config.baseUrl, config.debug, log]);
63
64
 
64
65
  const startTimer = useCallback(() => {
65
66
  timerRef.current = window.setInterval(() => {
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 };
package/vite.config.ts CHANGED
@@ -24,7 +24,7 @@ export default defineConfig({
24
24
  },
25
25
  },
26
26
  cssCodeSplit: false,
27
- minify: 'terser',
27
+ minify: 'esbuild',
28
28
  },
29
29
  server: {
30
30
  port: 3000,