@94ai/nf-microphone 7.0.0 → 8.0.1

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.
@@ -15870,62 +15870,6 @@ __sfc_main.setup = (__props, __ctx) => {
15870
15870
  return 3;
15871
15871
  }
15872
15872
  }
15873
- class SoftphoneNotity {
15874
- constructor() {
15875
- this.communicationList = {
15876
- "softphone-connect-registered": (data) => {
15877
- emit("softphone-connect-registered", data);
15878
- },
15879
- "softphone-session-state-change": (data) => {
15880
- emit("softphone-session-state-change", data);
15881
- },
15882
- "softphone-call-refresh": (data) => {
15883
- emit("softphone-call-refresh", data);
15884
- },
15885
- "softphone-connect": (data) => {
15886
- emit("softphone-connect", data);
15887
- },
15888
- "softphone-accept": (data) => {
15889
- emit("softphone-accept", data);
15890
- },
15891
- "softphone-seats-status-change": (data) => {
15892
- emit("softphone-seats-status-change", data);
15893
- },
15894
- "softphone-ignore": (data) => {
15895
- emit("softphone-ignore", data);
15896
- },
15897
- "softphone-hangup": (data) => {
15898
- emit("softphone-hangup", data);
15899
- },
15900
- "softphone-incoming": (data) => {
15901
- emit("softphone-incoming", data);
15902
- },
15903
- "softphone-send-dtmf": (data) => {
15904
- emit("softphone-send-dtmf", data);
15905
- }
15906
- };
15907
- this.useQinkunSoftphoneNotity = (state) => {
15908
- var _a, _b;
15909
- if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
15910
- if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
15911
- (_b = (_a = this.communicationList)[state.type]) == null ? void 0 : _b.call(_a, state.data);
15912
- }
15913
- }
15914
- };
15915
- }
15916
- useWujieSoftphoneNotity() {
15917
- Object.keys(this.communicationList).forEach((key) => {
15918
- bus.$on(key, (state) => {
15919
- var _a, _b;
15920
- if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
15921
- if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
15922
- (_b = (_a = this.communicationList)[key]) == null ? void 0 : _b.call(_a, state.data);
15923
- }
15924
- }
15925
- });
15926
- });
15927
- }
15928
- }
15929
15873
  class MicroManager {
15930
15874
  constructor() {
15931
15875
  __privateAdd(this, _qiankunActions, void 0);
@@ -15937,15 +15881,15 @@ __sfc_main.setup = (__props, __ctx) => {
15937
15881
  getWejieActions() {
15938
15882
  return bus;
15939
15883
  }
15940
- microCommunicat(type, status) {
15884
+ microCommunicat(type, data = {}, operationType = "manual", ancestorOrigin = props.ancestorOrigin, destinationOrigin = props.destinationOrigin) {
15941
15885
  const state = {
15942
15886
  origin: "nf-softphone",
15943
- ancestorOrigin: props.ancestorOrigin,
15944
- destinationOrigin: props.destinationOrigin,
15887
+ ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
15888
+ destinationOrigin: destinationOrigin || props.destinationOrigin,
15945
15889
  type,
15946
15890
  data: {
15947
- status,
15948
- type: "manual"
15891
+ ...data,
15892
+ type: operationType
15949
15893
  }
15950
15894
  };
15951
15895
  if (this.mode === "qiankun") {
@@ -15954,15 +15898,24 @@ __sfc_main.setup = (__props, __ctx) => {
15954
15898
  this.getWejieActions().$emit("ai-softphone", state);
15955
15899
  }
15956
15900
  }
15901
+ signOverdued(data) {
15902
+ this.microCommunicat("softphone-sign-overdued", data, "auto", props.ancestorOrigin, "ai-softphone");
15903
+ }
15957
15904
  // 签入
15958
15905
  connect() {
15959
- this.microCommunicat("softphone-connect", true);
15906
+ this.microCommunicat("softphone-connect", {
15907
+ status: true
15908
+ });
15960
15909
  }
15961
15910
  disconnect() {
15962
- this.microCommunicat("softphone-connect", false);
15911
+ this.microCommunicat("softphone-connect", {
15912
+ status: false
15913
+ });
15963
15914
  }
15964
15915
  seatsStatusChange(status) {
15965
- this.microCommunicat("softphone-connect", status);
15916
+ this.microCommunicat("softphone-connect", {
15917
+ status
15918
+ });
15966
15919
  }
15967
15920
  accept() {
15968
15921
  this.microCommunicat("softphone-connect");
@@ -16057,8 +16010,7 @@ __sfc_main.setup = (__props, __ctx) => {
16057
16010
  loadQiankunMicroApps() {
16058
16011
  const appConfig = this.getMicroAppConfig()[0];
16059
16012
  appConfig.props.shared.getUserInfo = getUserInfo;
16060
- appConfig.props.shared.setUserInfo = () => {
16061
- };
16013
+ appConfig.props.shared.setUserInfo = setUserInfo;
16062
16014
  this.initState();
16063
16015
  this.app = loadMicroApp(appConfig, {
16064
16016
  sandbox: {
@@ -16083,8 +16035,7 @@ __sfc_main.setup = (__props, __ctx) => {
16083
16035
  const appConfig = this.getMicroAppConfig()[0];
16084
16036
  const url = appConfig.entry;
16085
16037
  appConfig.props.shared.getUserInfo = getUserInfo;
16086
- appConfig.props.shared.setUserInfo = () => {
16087
- };
16038
+ appConfig.props.shared.setUserInfo = setUserInfo;
16088
16039
  setupApp({
16089
16040
  name: props.name,
16090
16041
  plugins: [{
@@ -16125,8 +16076,7 @@ __sfc_main.setup = (__props, __ctx) => {
16125
16076
  registerQiankunMicroApps() {
16126
16077
  const appConfig = this.getMicroAppConfig()[0];
16127
16078
  appConfig.props.shared.getUserInfo = getUserInfo;
16128
- appConfig.props.shared.setUserInfo = () => {
16129
- };
16079
+ appConfig.props.shared.setUserInfo = setUserInfo;
16130
16080
  registerMicroApps([appConfig], {
16131
16081
  // qiankun 生命周期钩子 - 加载前
16132
16082
  beforeLoad: [(app) => {
@@ -16170,6 +16120,75 @@ __sfc_main.setup = (__props, __ctx) => {
16170
16120
  }
16171
16121
  _qiankunActions = new WeakMap();
16172
16122
  const nfMicrophoneInstance = new MicroManager();
16123
+ class SoftphoneNotity {
16124
+ constructor() {
16125
+ this.communicationList = {
16126
+ "softphone-connect-registered": (data) => {
16127
+ emit("softphone-connect-registered", data);
16128
+ },
16129
+ "softphone-session-state-change": (data) => {
16130
+ emit("softphone-session-state-change", data);
16131
+ },
16132
+ "softphone-call-refresh": (data) => {
16133
+ emit("softphone-call-refresh", data);
16134
+ },
16135
+ "softphone-connect": (data) => {
16136
+ emit("softphone-connect", data);
16137
+ },
16138
+ "softphone-accept": (data) => {
16139
+ emit("softphone-accept", data);
16140
+ },
16141
+ "softphone-seats-status-change": (data) => {
16142
+ emit("softphone-seats-status-change", data);
16143
+ },
16144
+ "softphone-ignore": (data) => {
16145
+ emit("softphone-ignore", data);
16146
+ },
16147
+ "softphone-hangup": (data) => {
16148
+ emit("softphone-hangup", data);
16149
+ },
16150
+ "softphone-incoming": (data) => {
16151
+ emit("softphone-incoming", data);
16152
+ },
16153
+ "softphone-send-dtmf": (data) => {
16154
+ emit("softphone-send-dtmf", data);
16155
+ },
16156
+ "softphone-sign-overdued": (data) => {
16157
+ const done = (data2) => {
16158
+ const {
16159
+ sign,
16160
+ timestamp
16161
+ } = data2;
16162
+ nfMicrophoneInstance.signOverdued({
16163
+ sign,
16164
+ timestamp
16165
+ });
16166
+ };
16167
+ emit("softphone-sign-overdued", done);
16168
+ }
16169
+ };
16170
+ this.useQinkunSoftphoneNotity = (state) => {
16171
+ var _a, _b;
16172
+ if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
16173
+ if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
16174
+ (_b = (_a = this.communicationList)[state.type]) == null ? void 0 : _b.call(_a, state.data);
16175
+ }
16176
+ }
16177
+ };
16178
+ }
16179
+ useWujieSoftphoneNotity() {
16180
+ Object.keys(this.communicationList).forEach((key) => {
16181
+ bus.$on(key, (state) => {
16182
+ var _a, _b;
16183
+ if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
16184
+ if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
16185
+ (_b = (_a = this.communicationList)[key]) == null ? void 0 : _b.call(_a, state.data);
16186
+ }
16187
+ }
16188
+ });
16189
+ });
16190
+ }
16191
+ }
16173
16192
  const getUserInfo = () => {
16174
16193
  const {
16175
16194
  agentId,
@@ -16287,6 +16306,12 @@ __sfc_main.setup = (__props, __ctx) => {
16287
16306
  seats: true
16288
16307
  };
16289
16308
  };
16309
+ const setUserInfo = (userInfo) => {
16310
+ if (userInfo.sign && props.sign && userInfo.sign !== props.sign) {
16311
+ emit("update:sign", userInfo.sign);
16312
+ emit("update:timestamp", userInfo.timestamp);
16313
+ }
16314
+ };
16290
16315
  onMounted(() => {
16291
16316
  if (props.mode === "qiankun") {
16292
16317
  nfMicrophoneInstance.loadQiankunMicroApps();
@@ -16437,6 +16462,12 @@ class SoftphoneManager {
16437
16462
  },
16438
16463
  softphoneConnectRegisteredCallBack: () => {
16439
16464
  console.log("softphone-connect-registered");
16465
+ },
16466
+ softphoneSignOverduedCallBack: (done) => {
16467
+ done({
16468
+ timestamp: void 0,
16469
+ sign: void 0
16470
+ });
16440
16471
  }
16441
16472
  };
16442
16473
  this.initSoftphone = (option) => {
@@ -16445,6 +16476,12 @@ class SoftphoneManager {
16445
16476
  return;
16446
16477
  }
16447
16478
  const props = this.option = option ? { ...this.option, ...option } : this.option;
16479
+ const setUserInfo = (userInfo) => {
16480
+ if (userInfo.sign && props.sign && userInfo.sign !== props.sign) {
16481
+ this.option.sign = userInfo.sign;
16482
+ this.option.timestamp = userInfo.timestamp;
16483
+ }
16484
+ };
16448
16485
  const getUserInfo = () => {
16449
16486
  const {
16450
16487
  agentId,
@@ -16721,72 +16758,6 @@ class SoftphoneManager {
16721
16758
  return 3;
16722
16759
  }
16723
16760
  }
16724
- class SoftphoneNotity {
16725
- constructor() {
16726
- this.communicationList = {
16727
- "softphone-connect-registered": (data) => {
16728
- var _a;
16729
- (_a = props.softphoneConnectRegisteredCallBack) == null ? void 0 : _a.call(props, data);
16730
- },
16731
- "softphone-session-state-change": (data) => {
16732
- var _a;
16733
- (_a = props.softphoneSessionStateChangeCallBack) == null ? void 0 : _a.call(props, data);
16734
- },
16735
- "softphone-call-refresh": (data) => {
16736
- var _a;
16737
- (_a = props.softphoneCallRefreshCallBack) == null ? void 0 : _a.call(props, data);
16738
- },
16739
- "softphone-connect": (data) => {
16740
- var _a;
16741
- (_a = props.softphoneConnectCallBack) == null ? void 0 : _a.call(props, data);
16742
- },
16743
- "softphone-accept": (data) => {
16744
- var _a;
16745
- (_a = props.softphoneAcceptCallBack) == null ? void 0 : _a.call(props, data);
16746
- },
16747
- "softphone-seats-status-change": (data) => {
16748
- var _a;
16749
- (_a = props.softphoneSeatStatusChangeCallBack) == null ? void 0 : _a.call(props, data);
16750
- },
16751
- "softphone-ignore": (data) => {
16752
- var _a;
16753
- (_a = props.softphoneIgnoreCallBack) == null ? void 0 : _a.call(props, data);
16754
- },
16755
- "softphone-hangup": (data) => {
16756
- var _a;
16757
- (_a = props.softphoneHangupCallBack) == null ? void 0 : _a.call(props, data);
16758
- },
16759
- "softphone-incoming": (data) => {
16760
- var _a;
16761
- (_a = props.softphoneIncomingCallBack) == null ? void 0 : _a.call(props, data);
16762
- },
16763
- "softphone-send-dtmf": (data) => {
16764
- var _a;
16765
- (_a = props.softphoneSendDtmfCallBack) == null ? void 0 : _a.call(props, data);
16766
- }
16767
- };
16768
- this.useQinkunSoftphoneNotity = (state) => {
16769
- var _a, _b;
16770
- if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
16771
- if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
16772
- (_b = (_a = this.communicationList)[state.type]) == null ? void 0 : _b.call(_a, state.data);
16773
- }
16774
- }
16775
- };
16776
- }
16777
- useWujieSoftphoneNotity() {
16778
- Object.keys(this.communicationList).forEach((key) => {
16779
- bus.$on(key, (state) => {
16780
- var _a, _b;
16781
- if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
16782
- if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
16783
- (_b = (_a = this.communicationList)[key]) == null ? void 0 : _b.call(_a, state.data);
16784
- }
16785
- }
16786
- });
16787
- });
16788
- }
16789
- }
16790
16761
  class MicroManager {
16791
16762
  constructor() {
16792
16763
  __privateAdd(this, _qiankunActions, void 0);
@@ -16799,15 +16770,15 @@ class SoftphoneManager {
16799
16770
  getWejieActions() {
16800
16771
  return bus;
16801
16772
  }
16802
- microCommunicat(type, status) {
16773
+ microCommunicat(type, data = {}, operationType = "manual", ancestorOrigin = props.ancestorOrigin, destinationOrigin = props.destinationOrigin) {
16803
16774
  const state = {
16804
16775
  origin: "nf-softphone",
16805
- ancestorOrigin: props.ancestorOrigin,
16806
- destinationOrigin: props.destinationOrigin,
16776
+ ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
16777
+ destinationOrigin: destinationOrigin || props.destinationOrigin,
16807
16778
  type,
16808
16779
  data: {
16809
- status,
16810
- type: "manual"
16780
+ ...data,
16781
+ type: operationType
16811
16782
  }
16812
16783
  };
16813
16784
  if (this.mode === "qiankun") {
@@ -16818,13 +16789,19 @@ class SoftphoneManager {
16818
16789
  }
16819
16790
  // 签入
16820
16791
  connect() {
16821
- this.microCommunicat("softphone-connect", true);
16792
+ this.microCommunicat("softphone-connect", {
16793
+ status: true
16794
+ });
16822
16795
  }
16823
16796
  disconnect() {
16824
- this.microCommunicat("softphone-connect", false);
16797
+ this.microCommunicat("softphone-connect", {
16798
+ status: false
16799
+ });
16825
16800
  }
16826
16801
  seatsStatusChange(status) {
16827
- this.microCommunicat("softphone-connect", status);
16802
+ this.microCommunicat("softphone-connect", {
16803
+ status
16804
+ });
16828
16805
  }
16829
16806
  accept() {
16830
16807
  this.microCommunicat("softphone-connect");
@@ -16838,6 +16815,9 @@ class SoftphoneManager {
16838
16815
  sendDtmf() {
16839
16816
  this.microCommunicat("softphone-send-dtmf");
16840
16817
  }
16818
+ signOverdued(data) {
16819
+ this.microCommunicat("softphone-sign-overdued", data, "auto", props.ancestorOrigin, "ai-softphone");
16820
+ }
16841
16821
  changeServerToRegister() {
16842
16822
  this.microCommunicat("softphone-change-server-to-register");
16843
16823
  }
@@ -16916,8 +16896,7 @@ class SoftphoneManager {
16916
16896
  loadQiankunMicroApps() {
16917
16897
  const appConfig = this.getMicroAppConfig()[0];
16918
16898
  appConfig.props.shared.getUserInfo = getUserInfo;
16919
- appConfig.props.shared.setUserInfo = () => {
16920
- };
16899
+ appConfig.props.shared.setUserInfo = setUserInfo;
16921
16900
  this.initState();
16922
16901
  this.app = loadMicroApp(appConfig, {
16923
16902
  sandbox: {
@@ -16942,8 +16921,7 @@ class SoftphoneManager {
16942
16921
  const appConfig = this.getMicroAppConfig()[0];
16943
16922
  const url = appConfig.entry;
16944
16923
  appConfig.props.shared.getUserInfo = getUserInfo;
16945
- appConfig.props.shared.setUserInfo = () => {
16946
- };
16924
+ appConfig.props.shared.setUserInfo = setUserInfo;
16947
16925
  setupApp({
16948
16926
  name: props.name,
16949
16927
  plugins: [
@@ -16981,8 +16959,7 @@ class SoftphoneManager {
16981
16959
  registerQiankunMicroApps() {
16982
16960
  const appConfig = this.getMicroAppConfig()[0];
16983
16961
  appConfig.props.shared.getUserInfo = getUserInfo;
16984
- appConfig.props.shared.setUserInfo = () => {
16985
- };
16962
+ appConfig.props.shared.setUserInfo = setUserInfo;
16986
16963
  registerMicroApps([appConfig], {
16987
16964
  // qiankun 生命周期钩子 - 加载前
16988
16965
  beforeLoad: [() => {
@@ -17025,7 +17002,87 @@ class SoftphoneManager {
17025
17002
  }
17026
17003
  }
17027
17004
  _qiankunActions = new WeakMap();
17028
- this.nfMicrophoneInstance = new MicroManager();
17005
+ const nfMicrophoneInstance = this.nfMicrophoneInstance = new MicroManager();
17006
+ class SoftphoneNotity {
17007
+ constructor() {
17008
+ this.communicationList = {
17009
+ "softphone-connect-registered": (data) => {
17010
+ var _a;
17011
+ (_a = props.softphoneConnectRegisteredCallBack) == null ? void 0 : _a.call(props, data);
17012
+ },
17013
+ "softphone-session-state-change": (data) => {
17014
+ var _a;
17015
+ (_a = props.softphoneSessionStateChangeCallBack) == null ? void 0 : _a.call(props, data);
17016
+ },
17017
+ "softphone-call-refresh": (data) => {
17018
+ var _a;
17019
+ (_a = props.softphoneCallRefreshCallBack) == null ? void 0 : _a.call(props, data);
17020
+ },
17021
+ "softphone-connect": (data) => {
17022
+ var _a;
17023
+ (_a = props.softphoneConnectCallBack) == null ? void 0 : _a.call(props, data);
17024
+ },
17025
+ "softphone-accept": (data) => {
17026
+ var _a;
17027
+ (_a = props.softphoneAcceptCallBack) == null ? void 0 : _a.call(props, data);
17028
+ },
17029
+ "softphone-seats-status-change": (data) => {
17030
+ var _a;
17031
+ (_a = props.softphoneSeatStatusChangeCallBack) == null ? void 0 : _a.call(props, data);
17032
+ },
17033
+ "softphone-ignore": (data) => {
17034
+ var _a;
17035
+ (_a = props.softphoneIgnoreCallBack) == null ? void 0 : _a.call(props, data);
17036
+ },
17037
+ "softphone-hangup": (data) => {
17038
+ var _a;
17039
+ (_a = props.softphoneHangupCallBack) == null ? void 0 : _a.call(props, data);
17040
+ },
17041
+ "softphone-incoming": (data) => {
17042
+ var _a;
17043
+ (_a = props.softphoneIncomingCallBack) == null ? void 0 : _a.call(props, data);
17044
+ },
17045
+ "softphone-send-dtmf": (data) => {
17046
+ var _a;
17047
+ (_a = props.softphoneSendDtmfCallBack) == null ? void 0 : _a.call(props, data);
17048
+ },
17049
+ "softphone-sign-overdued": () => {
17050
+ var _a;
17051
+ const done = (data) => {
17052
+ const {
17053
+ sign,
17054
+ timestamp
17055
+ } = data;
17056
+ nfMicrophoneInstance.signOverdued({
17057
+ sign,
17058
+ timestamp
17059
+ });
17060
+ };
17061
+ (_a = props.softphoneSignOverduedCallBack) == null ? void 0 : _a.call(props, done);
17062
+ }
17063
+ };
17064
+ this.useQinkunSoftphoneNotity = (state) => {
17065
+ var _a, _b;
17066
+ if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
17067
+ if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
17068
+ (_b = (_a = this.communicationList)[state.type]) == null ? void 0 : _b.call(_a, state.data);
17069
+ }
17070
+ }
17071
+ };
17072
+ }
17073
+ useWujieSoftphoneNotity() {
17074
+ Object.keys(this.communicationList).forEach((key) => {
17075
+ bus.$on(key, (state) => {
17076
+ var _a, _b;
17077
+ if (state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin || state.ancestorOrigin === props.origin && state.origin === props.origin) {
17078
+ if (state.destinationOrigin === "*" || state.destinationOrigin === props.destinationOrigin) {
17079
+ (_b = (_a = this.communicationList)[key]) == null ? void 0 : _b.call(_a, state.data);
17080
+ }
17081
+ }
17082
+ });
17083
+ });
17084
+ }
17085
+ }
17029
17086
  if (this.option.mode === "qiankun") {
17030
17087
  this.nfMicrophoneInstance.loadQiankunMicroApps();
17031
17088
  } else {
@@ -138,6 +138,9 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
138
138
  "softphone-session-state-change": (event: any) => void;
139
139
  "softphone-incoming": (event: any) => void;
140
140
  "softphone-connect-registered": (event: any) => void;
141
+ "softphone-sign-overdued": (event: any) => void;
142
+ "update:sign": (event: any) => void;
143
+ "update:timestamp": (event: any) => void;
141
144
  }, string, Readonly<import("vue-demi").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
142
145
  mode?: "qiankun" | "wujie" | undefined;
143
146
  envMap?: Partial<Record<Env, Record<string, any>>> | undefined;
package/lib/types.d.ts CHANGED
@@ -75,4 +75,5 @@ export declare type Option = {
75
75
  softphoneIncomingCallBack: Function;
76
76
  softphoneSendDtmfCallBack: Function;
77
77
  softphoneConnectRegisteredCallBack: Function;
78
+ softphoneSignOverduedCallBack: Function;
78
79
  };