@koi-design/callkit 2.3.0-beta.2 → 2.3.0-beta.4

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/dist/index.d.ts CHANGED
@@ -4907,6 +4907,8 @@ declare class Config {
4907
4907
  reset: (form: string) => Promise<void>;
4908
4908
  validate: () => boolean;
4909
4909
  isLogin: () => boolean;
4910
+ /** 判断当前坐席类型是否为 SIP */
4911
+ isPhoneTypeSIP: () => boolean;
4910
4912
  check(): boolean;
4911
4913
  getTrackLogsConfig(): {
4912
4914
  enabled: boolean;
@@ -5338,7 +5340,7 @@ declare class CallKit {
5338
5340
  */
5339
5341
  setUserStatus(status: number, extra?: {
5340
5342
  [key: string]: any;
5341
- }): Promise<any>;
5343
+ }): Promise<void>;
5342
5344
  /**
5343
5345
  * reset callkit
5344
5346
  * @description recover the callkit to the initial state
@@ -3889,7 +3889,7 @@ var WebCall = (() => {
3889
3889
  // package.json
3890
3890
  var package_default = {
3891
3891
  name: "@koi-design/callkit",
3892
- version: "2.3.0-beta.2",
3892
+ version: "2.3.0-beta.4",
3893
3893
  description: "callkit",
3894
3894
  author: "koi",
3895
3895
  license: "ISC",
@@ -4034,6 +4034,8 @@ var WebCall = (() => {
4034
4034
  return true;
4035
4035
  };
4036
4036
  isLogin = () => this.validate();
4037
+ /** 判断当前坐席类型是否为 SIP */
4038
+ isPhoneTypeSIP = () => this.config.userInfo.phoneType === PhoneTypeEnum.SIP;
4037
4039
  check() {
4038
4040
  if (!this.isLogin()) {
4039
4041
  this.callKit.logger.warn("User not logged in", {
@@ -20550,7 +20552,9 @@ ${log}` : log;
20550
20552
  caller: "CallKit.register",
20551
20553
  content: {}
20552
20554
  });
20553
- this.connect.register();
20555
+ if (!this.config.isPhoneTypeSIP()) {
20556
+ this.connect.register();
20557
+ }
20554
20558
  }
20555
20559
  async unregister() {
20556
20560
  if (!this.config.check())
@@ -20638,13 +20642,12 @@ ${log}` : log;
20638
20642
  agentId
20639
20643
  }
20640
20644
  });
20641
- const res = await this.api.updateUserStatus({
20645
+ await this.api.updateUserStatus({
20642
20646
  agentId,
20643
20647
  userStatus: status,
20644
20648
  timestamp: Date.now(),
20645
20649
  ...extra
20646
20650
  });
20647
- return res;
20648
20651
  }
20649
20652
  /**
20650
20653
  * reset callkit
@@ -20661,10 +20664,12 @@ ${log}` : log;
20661
20664
  force
20662
20665
  }
20663
20666
  });
20664
- if (this.connect.isCalling()) {
20665
- await this.hangup();
20667
+ if (this.config.isPhoneTypeSIP()) {
20668
+ if (this.connect.isCalling()) {
20669
+ await this.hangup();
20670
+ }
20671
+ await this.connect.reset({ force });
20666
20672
  }
20667
- await this.connect.reset({ force });
20668
20673
  if (this.config.isLogin()) {
20669
20674
  await this.logout({ isReset: false });
20670
20675
  } else {