scribe-widget 1.0.16 → 1.0.17

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.16",
3
+ "version": "1.0.17",
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
@@ -1,4 +1,4 @@
1
- import { useState, useMemo, useCallback } from 'react';
1
+ import { useState, useMemo, useCallback, useEffect } from 'react';
2
2
  import { FloatingPanel } from './components/FloatingPanel';
3
3
  import { ConfigState } from './components/ConfigState';
4
4
  import { IdleState } from './components/IdleState';
@@ -41,6 +41,7 @@ export function App({ config: initialConfig, onClose }: AppProps) {
41
41
  elapsedTime,
42
42
  result,
43
43
  errorMessage,
44
+ initializeSDK,
44
45
  startRecording,
45
46
  pauseRecording,
46
47
  resumeRecording,
@@ -49,6 +50,13 @@ export function App({ config: initialConfig, onClose }: AppProps) {
49
50
  reset,
50
51
  } = useScribeSession(config);
51
52
 
53
+ // Initialize SDK when credentials are set
54
+ useEffect(() => {
55
+ if (credentials?.baseUrl) {
56
+ initializeSDK();
57
+ }
58
+ }, [credentials, initializeSDK]);
59
+
52
60
  // Start new recording - goes back to config screen
53
61
  const handleStartNewRecording = useCallback(() => {
54
62
  reset();
@@ -11,7 +11,7 @@ export function IdleState({ onStartRecording }: IdleStateProps) {
11
11
  <div className="logo-icon">
12
12
  <LogoIcon />
13
13
  </div>
14
- <span className="logo-text">eka.scribe</span>
14
+ <span className="logo-text">scribe</span>
15
15
  </div>
16
16
  <button className="start-btn" onClick={onStartRecording}>
17
17
  Start Recording
@@ -7,6 +7,7 @@ interface UseScribeSessionReturn {
7
7
  elapsedTime: number;
8
8
  result: GetSessionStatusResponse | null;
9
9
  errorMessage: string;
10
+ initializeSDK: () => Promise<void>;
10
11
  startRecording: () => Promise<void>;
11
12
  pauseRecording: () => void;
12
13
  resumeRecording: () => void;
@@ -35,36 +36,35 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
35
36
  [config.debug]
36
37
  );
37
38
 
38
- // Initialize SDK client only when baseUrl is provided
39
- useEffect(() => {
39
+ // Initialize SDK client - can be called explicitly
40
+ const initializeSDK = useCallback(async () => {
40
41
  if (!config.baseUrl) {
41
42
  log('Skipping SDK init - no baseUrl provided');
42
43
  return;
43
44
  }
44
45
 
45
- const initClient = async () => {
46
- try {
47
- // Use getInstance instead of new ScribeClient
48
- clientRef.current = ScribeClient.getInstance({
49
- accessToken: config.accessToken,
50
- baseUrl: config.baseUrl,
51
- debug: config.debug,
52
- });
53
- await clientRef.current.init();
54
- log('SDK initialized');
55
- } catch (error) {
56
- log('Failed to initialize SDK', error);
57
- }
58
- };
59
-
60
- initClient();
46
+ try {
47
+ // Use getInstance instead of new ScribeClient
48
+ clientRef.current = ScribeClient.getInstance({
49
+ accessToken: config.accessToken,
50
+ baseUrl: config.baseUrl,
51
+ debug: config.debug,
52
+ });
53
+ await clientRef.current.init();
54
+ log('SDK initialized');
55
+ } catch (error) {
56
+ log('Failed to initialize SDK', error);
57
+ }
58
+ }, [config.accessToken, config.baseUrl, config.debug, log]);
61
59
 
60
+ // Cleanup timer on unmount
61
+ useEffect(() => {
62
62
  return () => {
63
63
  if (timerRef.current) {
64
64
  clearInterval(timerRef.current);
65
65
  }
66
66
  };
67
- }, [config.accessToken, config.baseUrl, config.debug, log]);
67
+ }, []);
68
68
 
69
69
  const startTimer = useCallback(() => {
70
70
  timerRef.current = window.setInterval(() => {
@@ -253,6 +253,7 @@ export function useScribeSession(config: ScribeWidgetConfig): UseScribeSessionRe
253
253
  elapsedTime,
254
254
  result,
255
255
  errorMessage,
256
+ initializeSDK,
256
257
  startRecording,
257
258
  pauseRecording,
258
259
  resumeRecording,