@eka-care/ekascribe-ts-sdk 1.4.49 → 1.4.51
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.
|
@@ -151,7 +151,7 @@ class VadWebClient {
|
|
|
151
151
|
errorCallback({
|
|
152
152
|
error_code: ERROR_CODE.NO_AUDIO_CAPTURE,
|
|
153
153
|
status_code: SDK_STATUS_CODE.AUDIO_ERROR,
|
|
154
|
-
|
|
154
|
+
error_message: 'No audio detected for a while. Please talk or stop the recording if done.',
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
this.lastWarningTime = now;
|
|
@@ -169,7 +169,7 @@ class VadWebClient {
|
|
|
169
169
|
errorCallback({
|
|
170
170
|
error_code: ERROR_CODE.SPEECH_DETECTED,
|
|
171
171
|
status_code: SDK_STATUS_CODE.SUCCESS,
|
|
172
|
-
|
|
172
|
+
success_message: 'Audio captured. Recording continues.',
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -352,7 +352,7 @@ class VadWebClient {
|
|
|
352
352
|
EkaScribeStore.errorCallback({
|
|
353
353
|
error_code: ERROR_CODE.SPEECH_DETECTED,
|
|
354
354
|
status_code: SDK_STATUS_CODE.SUCCESS,
|
|
355
|
-
|
|
355
|
+
success_message: 'Audio captured. Recording continues.',
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -369,7 +369,7 @@ class VadWebClient {
|
|
|
369
369
|
errorCallback({
|
|
370
370
|
error_code: ERROR_CODE.NO_AUDIO_CAPTURE,
|
|
371
371
|
status_code: SDK_STATUS_CODE.AUDIO_ERROR,
|
|
372
|
-
|
|
372
|
+
error_message: 'No audio is being captured. Please check your microphone.',
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
375
|
return false;
|
|
@@ -25,7 +25,10 @@ export declare enum ERROR_CODE {
|
|
|
25
25
|
SPEECH_DETECTED = "speech_detected",
|
|
26
26
|
TXN_STATUS_MISMATCH = "txn_status_mismatch",
|
|
27
27
|
LONG_SILENCE = "long_silence",
|
|
28
|
-
GET_PRESIGNED_URL_FAILED = "get_presigned_url_failed"
|
|
28
|
+
GET_PRESIGNED_URL_FAILED = "get_presigned_url_failed",
|
|
29
|
+
UPLOAD_FULL_AUDIO = "upload_full_audio",
|
|
30
|
+
FETCH_WRAPPER_RESPONSE = "fetch_wrapper_response",
|
|
31
|
+
FETCH_WRAPPER_ERROR = "fetch_wrapper_error"
|
|
29
32
|
}
|
|
30
33
|
export declare enum PROCESSING_STATUS {
|
|
31
34
|
SUCCESS = "success",
|
package/dist/constants/enums.js
CHANGED
|
@@ -29,6 +29,9 @@ export var ERROR_CODE;
|
|
|
29
29
|
ERROR_CODE["TXN_STATUS_MISMATCH"] = "txn_status_mismatch";
|
|
30
30
|
ERROR_CODE["LONG_SILENCE"] = "long_silence";
|
|
31
31
|
ERROR_CODE["GET_PRESIGNED_URL_FAILED"] = "get_presigned_url_failed";
|
|
32
|
+
ERROR_CODE["UPLOAD_FULL_AUDIO"] = "upload_full_audio";
|
|
33
|
+
ERROR_CODE["FETCH_WRAPPER_RESPONSE"] = "fetch_wrapper_response";
|
|
34
|
+
ERROR_CODE["FETCH_WRAPPER_ERROR"] = "fetch_wrapper_error";
|
|
32
35
|
})(ERROR_CODE || (ERROR_CODE = {}));
|
|
33
36
|
export var PROCESSING_STATUS;
|
|
34
37
|
(function (PROCESSING_STATUS) {
|
|
@@ -221,7 +221,9 @@ export type UploadProgressCallback = (success: string[], total: number) => void;
|
|
|
221
221
|
export type TErrorCallback = (args: {
|
|
222
222
|
error_code?: ERROR_CODE;
|
|
223
223
|
status_code: number;
|
|
224
|
-
|
|
224
|
+
success_message?: string;
|
|
225
|
+
error_message?: string;
|
|
226
|
+
request?: string;
|
|
225
227
|
}) => void;
|
|
226
228
|
export type TSessionStatus = {
|
|
227
229
|
[key: string]: {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { GET_CLIENT_ID, GET_AUTH_TOKEN } from './helper';
|
|
2
|
+
import EkaScribeStore from '../store/store';
|
|
3
|
+
import { ERROR_CODE } from '../constants/enums';
|
|
4
|
+
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
5
|
const API_TIMEOUT_MS = 10000;
|
|
3
6
|
export default async function fetchWrapper(url, options = {}, timeoutMs = API_TIMEOUT_MS) {
|
|
7
|
+
const errorCallback = EkaScribeStore.errorCallback;
|
|
4
8
|
const controller = new AbortController();
|
|
5
9
|
let timeoutId = null;
|
|
6
10
|
try {
|
|
@@ -22,6 +26,14 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
|
|
|
22
26
|
signal: controller.signal,
|
|
23
27
|
credentials: 'include',
|
|
24
28
|
});
|
|
29
|
+
if (errorCallback) {
|
|
30
|
+
errorCallback({
|
|
31
|
+
error_code: ERROR_CODE.FETCH_WRAPPER_RESPONSE,
|
|
32
|
+
status_code: response.status,
|
|
33
|
+
success_message: 'Fetch wrapper response: ' + JSON.stringify(response),
|
|
34
|
+
request: 'Request body: ' + JSON.stringify(options.body),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
25
37
|
if (response.status === 401 || response.status === 403) {
|
|
26
38
|
console.log('unauthorized - fetch wrapper - SDK', response.status);
|
|
27
39
|
}
|
|
@@ -29,6 +41,14 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
|
|
|
29
41
|
}
|
|
30
42
|
catch (error) {
|
|
31
43
|
console.error(error, 'error in fetch wrapper - SDK');
|
|
44
|
+
if (errorCallback) {
|
|
45
|
+
errorCallback({
|
|
46
|
+
error_code: ERROR_CODE.FETCH_WRAPPER_ERROR,
|
|
47
|
+
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
48
|
+
error_message: 'Fetch wrapper response: ' + JSON.stringify(error),
|
|
49
|
+
request: 'Request body: ' + JSON.stringify(options.body),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
32
52
|
throw error;
|
|
33
53
|
}
|
|
34
54
|
finally {
|