@eka-care/ekascribe-ts-sdk 1.4.22 → 1.4.24

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.
@@ -1,10 +1,11 @@
1
1
  import fetchWrapper from '../fetch-client';
2
+ import { GET_COG_HOST } from '../fetch-client/helper';
2
3
  async function postCogInit() {
3
4
  try {
4
5
  const options = {
5
6
  method: 'GET',
6
7
  };
7
- const respJson = await fetchWrapper(`https://cog.eka.care/credentials`, options);
8
+ const respJson = await fetchWrapper(`${GET_COG_HOST()}/credentials`, options);
8
9
  const resp = await respJson.json();
9
10
  return resp;
10
11
  }
@@ -0,0 +1,3 @@
1
+ import { TPostV1ConvertToTemplateRequest, TPostV1ConvertToTemplateResponse } from '../../constants/types';
2
+ declare function postV1ConvertToTemplate({ txn_id, template_id, }: TPostV1ConvertToTemplateRequest): Promise<TPostV1ConvertToTemplateResponse>;
3
+ export default postV1ConvertToTemplate;
@@ -0,0 +1,29 @@
1
+ import { SDK_STATUS_CODE } from '../../constants/constant';
2
+ import fetchWrapper from '../../fetch-client';
3
+ import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
4
+ async function postV1ConvertToTemplate({ txn_id, template_id, }) {
5
+ try {
6
+ const headers = new Headers();
7
+ headers.append('Content-Type', 'application/json');
8
+ const options = {
9
+ method: 'POST',
10
+ headers,
11
+ body: JSON.stringify({}),
12
+ };
13
+ const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/transaction/${txn_id}/convert-to-template/${template_id}`, options);
14
+ let res = await response.json();
15
+ res = {
16
+ ...res,
17
+ code: response.status,
18
+ };
19
+ return res;
20
+ }
21
+ catch (error) {
22
+ console.log('%c postV1ConvertToTemplate -> error', 'color:#f5ce50', error);
23
+ return {
24
+ code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
25
+ message: `Something went wrong! ${error}`,
26
+ };
27
+ }
28
+ }
29
+ export default postV1ConvertToTemplate;
@@ -310,3 +310,21 @@ export interface TPatchVoiceApiV2ConfigResponse extends TPatchVoiceApiV2ConfigRe
310
310
  message: string;
311
311
  };
312
312
  }
313
+ export type TPostV1ConvertToTemplateRequest = {
314
+ txn_id: string;
315
+ template_id: string;
316
+ };
317
+ export type TPostV1ConvertToTemplateResponse = {
318
+ status: 'success' | 'failed';
319
+ message: string;
320
+ txn_id: string;
321
+ template_id: string;
322
+ b_id: string;
323
+ code: number;
324
+ msg: string;
325
+ error?: {
326
+ code: string;
327
+ message: string;
328
+ display_message: string;
329
+ };
330
+ };
@@ -3,11 +3,11 @@ declare const setEnv: ({ env, clientId, auth_token, }: {
3
3
  clientId?: string;
4
4
  auth_token?: string;
5
5
  }) => void;
6
- export declare const GET_EKA_HOST: () => string;
7
6
  export declare const GET_CLIENT_ID: () => string;
8
7
  export declare const GET_AUTH_TOKEN: () => string;
9
8
  export declare const GET_EKA_VOICE_HOST_V1: () => string;
10
9
  export declare const GET_EKA_VOICE_HOST_V2: () => string;
11
10
  export declare const GET_EKA_VOICE_HOST_V3: () => string;
12
11
  export declare const GET_COOK_HOST_V1: () => string;
12
+ export declare const GET_COG_HOST: () => string;
13
13
  export default setEnv;
@@ -1,12 +1,12 @@
1
1
  const DEV = {
2
- EKA_HOST: 'https://api.dev.eka.care',
2
+ COG_HOST: 'https://cog.dev.eka.care',
3
3
  EKA_VOICE_HOST_V1: 'https://v2rxbe.dev.eka.care/voice/api/v1',
4
4
  EKA_VOICE_HOST_V2: 'https://v2rxbe.dev.eka.care/voice/api/v2',
5
5
  EKA_VOICE_HOST_V3: 'https://v2rxbe.dev.eka.care/voice/api/v3',
6
6
  COOK_V1: ' https://deepthought-genai.dev.eka.care/api/v1',
7
7
  };
8
8
  const PROD = {
9
- EKA_HOST: 'https://api.eka.care',
9
+ COG_HOST: 'https://cog.eka.care',
10
10
  EKA_VOICE_HOST_V1: 'https://api.eka.care/voice/api/v1',
11
11
  EKA_VOICE_HOST_V2: 'https://api.eka.care/voice/api/v2',
12
12
  EKA_VOICE_HOST_V3: 'https://api.eka.care/voice/api/v3',
@@ -26,11 +26,11 @@ const setEnv = ({ env, clientId, auth_token, }) => {
26
26
  auth = auth_token;
27
27
  }
28
28
  };
29
- export const GET_EKA_HOST = () => envVar.EKA_HOST;
30
29
  export const GET_CLIENT_ID = () => client_id;
31
30
  export const GET_AUTH_TOKEN = () => auth;
32
31
  export const GET_EKA_VOICE_HOST_V1 = () => envVar.EKA_VOICE_HOST_V1;
33
32
  export const GET_EKA_VOICE_HOST_V2 = () => envVar.EKA_VOICE_HOST_V2;
34
33
  export const GET_EKA_VOICE_HOST_V3 = () => envVar.EKA_VOICE_HOST_V3;
35
34
  export const GET_COOK_HOST_V1 = () => envVar.COOK_V1;
35
+ export const GET_COG_HOST = () => envVar.COG_HOST;
36
36
  export default setEnv;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TGetStatusResponse } from './api/transaction/get-voice-api-v3-status';
2
- import { TEndRecordingResponse, TErrorCallback, TFileUploadProgressCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPatchVoiceApiV2ConfigRequest, TPostTransactionResponse, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TStartRecordingRequest } from './constants/types';
2
+ import { TEndRecordingResponse, TErrorCallback, TFileUploadProgressCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPatchVoiceApiV2ConfigRequest, TPostTransactionResponse, TPostV1ConvertToTemplateRequest, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TStartRecordingRequest } from './constants/types';
3
3
  declare class EkaScribe {
4
4
  private static instance;
5
5
  private vadInstance;
@@ -61,6 +61,7 @@ declare class EkaScribe {
61
61
  createTemplateSection(templateSection: TPostV1TemplateSectionRequest): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
62
62
  updateTemplateSection(templateSection: TPostV1TemplateSectionRequest): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
63
63
  deleteTemplateSection(section_id: string): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
64
+ postTransactionConvertToTemplate({ txn_id, template_id }: TPostV1ConvertToTemplateRequest): Promise<import("./constants/types").TPostV1ConvertToTemplateResponse>;
64
65
  }
65
66
  export declare const getEkaScribeInstance: ({ access_token, env, clientId, }: {
66
67
  access_token?: string;
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ import patchV1TemplateSection from './api/template-sections/patch-v1-template-se
27
27
  import deleteV1TemplateSection from './api/template-sections/delete-v1-template-section';
28
28
  import patchVoiceApiV2Config from './api/config/patch-voice-api-v2-config';
29
29
  import cookV1MediaAiCreateTemplate from './api/templates/cook-v1-medai-ai-create-template';
30
+ import postV1ConvertToTemplate from './api/templates/post-transaction-convert-to-template';
30
31
  class EkaScribe {
31
32
  // Private constructor to prevent direct instantiation
32
33
  constructor() {
@@ -307,6 +308,10 @@ class EkaScribe {
307
308
  const templateSectionsResponse = await deleteV1TemplateSection(section_id);
308
309
  return templateSectionsResponse;
309
310
  }
311
+ async postTransactionConvertToTemplate({ txn_id, template_id }) {
312
+ const convertToTemplateResponse = await postV1ConvertToTemplate({ txn_id, template_id });
313
+ return convertToTemplateResponse;
314
+ }
310
315
  }
311
316
  Object.defineProperty(EkaScribe, "instance", {
312
317
  enumerable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.4.22",
3
+ "version": "1.4.24",
4
4
  "main": "dist/index.js",
5
5
  "repository": "git@github.com:eka-care/eka-js-sdk.git",
6
6
  "author": "Sanikagoyal28 <sanikagoyal9@gmail.com>",