余尚辉 2 months ago
parent
commit
bf320b02c5
7 changed files with 301 additions and 299 deletions
  1. 1 0
      src/Logger.ts
  2. 2 4
      src/api/fetchApi.ts
  3. 1 1
      src/hs-cti/HsCTI-trash.ts
  4. 4 2
      src/hs-cti/HsCTI.ts
  5. 1 0
      src/hs-cti/outputType.ts
  6. 2 2
      src/sdk.html
  7. 290 290
      yarn.lock

+ 1 - 0
src/Logger.ts

@@ -12,6 +12,7 @@ declare global {
   interface Window {
     ctiLoggerLevel?: LoggerLevels
     HS_CTI_CLIENT_ID?: string
+    DOMAINNAME?: string
   }
 }
 /** @class Logger 通用的日志模块 */

+ 2 - 4
src/api/fetchApi.ts

@@ -50,14 +50,12 @@ export const hsTrackJPOST = ({
       const res = await JPOST({
         baseUrl:
           getBaseOption(BaseOption.ENV) == 'production'
-            ? 'https://pbx.fuxicarbon.com/fs_api/'
+            ? `https://${window.DOMAINNAME}/fs_api`
             : baseUrl,
         url,
         data
       })
-      console.log(getBaseOption(BaseOption.ENV), 90000000)
-      const { code, msg } = res
-      console.log(msg)
+      const { code } = res
       if (code === 0) {
         apiLogger.log(`api response | ${url} | ${JSON.stringify(res)}`)
       } else {

+ 1 - 1
src/hs-cti/HsCTI-trash.ts

@@ -281,7 +281,7 @@ export class SdCTI extends EventEmitter {
       // 单次初始化唯一 ID
       ctiSessionId: generateUniqueId(),
       // IM websocket url
-      imWsServer: 'ws://pbx.fuxicarbon.com:8091/ws/cs-im',
+      imWsServer: `ws://${window.DOMAINNAME}:8091/ws/cs-im`,
       // IM websocket path
       imWsPath: 'ws/cs-im'
     }

+ 4 - 2
src/hs-cti/HsCTI.ts

@@ -122,7 +122,8 @@ export class HsCTI extends EventEmitter {
   private constructor(
     hsCTIInitOptions: HsCTIInitOptions | RequiredHsCTIInitOptions
   ) {
-    const { saas_id, agent_id, scene, env, loggerLevel } = hsCTIInitOptions
+    const { saas_id, agent_id, scene, env, loggerLevel, domainName } =
+      hsCTIInitOptions
     super()
     this.loggerLevel = window.ctiLoggerLevel || loggerLevel || LoggerLevels.log
     this.logger = new Logger(this.loggerLevel, 'HsCTI')
@@ -135,6 +136,7 @@ export class HsCTI extends EventEmitter {
     this.agent_id = agent_id
     this.scene = scene
     this._callId = ''
+    window.DOMAINNAME = domainName
     setBaseOption(BaseOption.ENV, env)
     setBaseOption(BaseOption.LoggerLevel, this.loggerLevel)
 
@@ -284,7 +286,7 @@ export class HsCTI extends EventEmitter {
       // 单次初始化唯一 ID
       ctiSessionId: generateUniqueId(),
       // IM websocket url
-      imWsServer: 'wss://pbx.fuxicarbon.com/ws/cs-im',
+      imWsServer: `wss://${window.DOMAINNAME}/ws/cs-im`,
       // IM websocket path
       imWsPath: 'ws/cs-im'
     }

+ 1 - 0
src/hs-cti/outputType.ts

@@ -52,6 +52,7 @@ export interface BaseHsCTIInitOptions extends BaseOptions {
   loggerLevel?: LoggerLevels
   password: string
   env: ENV
+  domainName?: string
 }
 
 export interface HsCTIInitOptions extends BaseHsCTIInitOptions {

+ 2 - 2
src/sdk.html

@@ -41,10 +41,10 @@ const HS_CTI = getInstance({
     // SDK 日志等级
     loggerLevel: LoggerLevels.log,
     // 环境变量
-    env: 'test'
+    env: 'test',
+    domainName:'pbx.fuxicarbon.com'
 })
 HS_CTI.init()
-console.log(HS_CTI)
 const checkin_btn = document.getElementById('checkin')
 const checkout_btn = document.getElementById('checkout')
 const busy_btn = document.getElementById('busy')

File diff suppressed because it is too large
+ 290 - 290
yarn.lock


Some files were not shown because too many files changed in this diff