@94ai/nf-microphone 6.1.30 → 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.
@@ -41,6 +41,9 @@ const props = withDefaults(defineProps<{
41
41
  agentTag?: string,
42
42
  appKey?: string,
43
43
  appSecret?: string,
44
+ timestamp?: string | number,
45
+ sign?: string,
46
+
44
47
  extStatus?: string,
45
48
 
46
49
  origin?: string,
@@ -164,6 +167,8 @@ const props = withDefaults(defineProps<{
164
167
  origin: 'ai-softphone',
165
168
  ancestorOrigin: 'nf-softphone',
166
169
  destinationOrigin: '*',
170
+ timestamp: undefined,
171
+ sign: undefined,
167
172
 
168
173
  callShow: '1',
169
174
  transferToLaborShow: '1',
@@ -179,7 +184,10 @@ const props = withDefaults(defineProps<{
179
184
  isOem: true,
180
185
  accessMode: 'pc',
181
186
  numberKeyBoard: true,
182
- sgOpen: '1',
187
+ sgOpen: undefined,
188
+ sgDomain: undefined,
189
+ sgBase: undefined,
190
+ sgGateway: undefined,
183
191
  open: '1',
184
192
  })
185
193
 
@@ -194,6 +202,9 @@ const emit = defineEmits<{
194
202
  (e: 'softphone-session-state-change', event: any): void
195
203
  (e: 'softphone-incoming', event: any): void
196
204
  (e: 'softphone-connect-registered', event: any): void
205
+ (e: 'softphone-sign-overdued', event: any): void
206
+ (e: 'update:sign', event: any): void
207
+ (e: 'update:timestamp', event: any): void
197
208
  }>()
198
209
 
199
210
  const showSoftPhone = ref(true)
@@ -289,38 +300,62 @@ class Shared {
289
300
  }
290
301
 
291
302
  getSoftPhoneShowCall () {
292
- return props.callShow
303
+ if (props.callShow === '0') {
304
+ return false
305
+ }
306
+ return true
293
307
  }
294
308
 
295
309
  getSoftPhoneShowTransferToLabor () {
296
- return props.transferToLaborShow
310
+ if (props.transferToLaborShow === '0') {
311
+ return false
312
+ }
313
+ return true
297
314
  }
298
315
 
299
316
  getSoftPhoneShowRest () {
300
- return props.restShow
317
+ if (props.restShow === '0') {
318
+ return false
319
+ }
320
+ return true
301
321
  }
302
322
 
303
323
  getSoftPhoneShowNetworkDetect () {
304
- return props.networkDetectShow
324
+ if (props.networkDetectShow === '0') {
325
+ return false
326
+ }
327
+ return true
305
328
  }
306
329
 
307
330
  getSoftPhoneShowMute () {
308
- return props.muteShow
331
+ if (props.muteShow === '0') {
332
+ return false
333
+ }
334
+ return true
309
335
  }
310
336
 
311
337
  /**
312
338
  * 是否展示对话记录功能
313
339
  */
314
340
  getSoftPhoneShowLog() {
315
- return props.logShow
341
+ if (props.logShow === '0') {
342
+ return false
343
+ }
344
+ return true
316
345
  }
317
346
 
318
347
  getSoftPhoneShowTiming () {
319
- return props.timingShow
348
+ if (props.timingShow === '0') {
349
+ return false
350
+ }
351
+ return true
320
352
  }
321
353
 
322
354
  getSoftPhoneShowSign () {
323
- return props.signShow
355
+ if (props.signShow === '0') {
356
+ return false
357
+ }
358
+ return true
324
359
  }
325
360
 
326
361
  /**
@@ -362,62 +397,6 @@ class Shared {
362
397
  }
363
398
  }
364
399
 
365
- // 通知
366
- class SoftphoneNotity {
367
- communicationList = {
368
- 'softphone-connect-registered': (data) => {
369
- emit('softphone-connect-registered', data)
370
- },
371
- 'softphone-session-state-change': (data) => {
372
- emit('softphone-session-state-change', data)
373
- },
374
- 'softphone-call-refresh': (data) => {
375
- emit('softphone-call-refresh', data)
376
- },
377
- 'softphone-connect': (data) => {
378
- emit('softphone-connect', data)
379
- },
380
- 'softphone-accept': (data) => {
381
- emit('softphone-accept', data)
382
- },
383
- 'softphone-seats-status-change': (data) => {
384
- emit('softphone-seats-status-change', data)
385
- },
386
- 'softphone-ignore': (data) => {
387
- emit('softphone-ignore', data)
388
- },
389
- 'softphone-hangup': (data) => {
390
- emit('softphone-hangup', data)
391
- },
392
- 'softphone-incoming': (data) => {
393
- emit( 'softphone-incoming', data)
394
- },
395
- 'softphone-send-dtmf': (data) => {
396
- emit('softphone-send-dtmf', data)
397
- },
398
- }
399
- useQinkunSoftphoneNotity = (state) => {
400
- if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
401
- (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
402
- if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
403
- this.communicationList[state.type]?.(state.data)
404
- }
405
- }
406
- }
407
- useWujieSoftphoneNotity() {
408
- Object.keys(this.communicationList).forEach(key => {
409
- bus.$on(key, (state) => {
410
- if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
411
- (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
412
- if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
413
- this.communicationList[key]?.(state.data)
414
- }
415
- }
416
- })
417
- })
418
- }
419
- }
420
-
421
400
  // 实例+动作管理
422
401
  class MicroManager {
423
402
  app
@@ -433,15 +412,21 @@ class MicroManager {
433
412
  return bus
434
413
  }
435
414
 
436
- microCommunicat(type: string, status?: boolean) {
415
+ microCommunicat(
416
+ type: string,
417
+ data: Record<string, any> = {},
418
+ operationType = 'manual',
419
+ ancestorOrigin = props.ancestorOrigin,
420
+ destinationOrigin = props.destinationOrigin
421
+ ) {
437
422
  const state = {
438
423
  origin: 'nf-softphone',
439
- ancestorOrigin: props.ancestorOrigin,
440
- destinationOrigin: props.destinationOrigin,
424
+ ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
425
+ destinationOrigin: destinationOrigin || props.destinationOrigin,
441
426
  type,
442
427
  data: {
443
- status,
444
- type: 'manual'
428
+ ...data,
429
+ type: operationType
445
430
  }
446
431
  }
447
432
  if (this.mode === 'qiankun') {
@@ -451,18 +436,27 @@ class MicroManager {
451
436
  }
452
437
  }
453
438
 
439
+ signOverdued(data) {
440
+ this.microCommunicat('softphone-sign-overdued', data, 'auto', props.ancestorOrigin, 'ai-softphone')
441
+ }
454
442
 
455
443
  // 签入
456
444
  connect() {
457
- this.microCommunicat('softphone-connect', true)
445
+ this.microCommunicat('softphone-connect', {
446
+ status: true
447
+ })
458
448
  }
459
449
 
460
450
  disconnect() {
461
- this.microCommunicat('softphone-connect', false)
451
+ this.microCommunicat('softphone-connect', {
452
+ status: false
453
+ })
462
454
  }
463
455
 
464
456
  seatsStatusChange(status: boolean) {
465
- this.microCommunicat('softphone-connect', status)
457
+ this.microCommunicat('softphone-connect', {
458
+ status
459
+ })
466
460
  }
467
461
  accept() {
468
462
  this.microCommunicat('softphone-connect')
@@ -558,7 +552,7 @@ class MicroManager {
558
552
  loadQiankunMicroApps() {
559
553
  const appConfig = this.getMicroAppConfig()[0]
560
554
  appConfig.props.shared.getUserInfo = getUserInfo
561
- appConfig.props.shared.setUserInfo = () => {}
555
+ appConfig.props.shared.setUserInfo = setUserInfo
562
556
  this.initState()
563
557
  this.app = loadMicroApp(appConfig, {
564
558
  sandbox: {
@@ -586,7 +580,7 @@ class MicroManager {
586
580
  const appConfig = this.getMicroAppConfig()[0]
587
581
  const url = appConfig.entry
588
582
  appConfig.props.shared.getUserInfo = getUserInfo
589
- appConfig.props.shared.setUserInfo = () => {}
583
+ appConfig.props.shared.setUserInfo = setUserInfo
590
584
 
591
585
  setupApp({
592
586
  name: props.name,
@@ -626,7 +620,7 @@ class MicroManager {
626
620
  registerQiankunMicroApps() {
627
621
  const appConfig = this.getMicroAppConfig()[0]
628
622
  appConfig.props.shared.getUserInfo = getUserInfo
629
- appConfig.props.shared.setUserInfo = () => {}
623
+ appConfig.props.shared.setUserInfo = setUserInfo
630
624
 
631
625
  registerMicroApps([appConfig], {
632
626
  // qiankun 生命周期钩子 - 加载前
@@ -678,6 +672,75 @@ class MicroManager {
678
672
  }
679
673
  }
680
674
  const nfMicrophoneInstance = new MicroManager()
675
+ // 通知
676
+ class SoftphoneNotity {
677
+ communicationList = {
678
+ 'softphone-connect-registered': (data) => {
679
+ emit('softphone-connect-registered', data)
680
+ },
681
+ 'softphone-session-state-change': (data) => {
682
+ emit('softphone-session-state-change', data)
683
+ },
684
+ 'softphone-call-refresh': (data) => {
685
+ emit('softphone-call-refresh', data)
686
+ },
687
+ 'softphone-connect': (data) => {
688
+ emit('softphone-connect', data)
689
+ },
690
+ 'softphone-accept': (data) => {
691
+ emit('softphone-accept', data)
692
+ },
693
+ 'softphone-seats-status-change': (data) => {
694
+ emit('softphone-seats-status-change', data)
695
+ },
696
+ 'softphone-ignore': (data) => {
697
+ emit('softphone-ignore', data)
698
+ },
699
+ 'softphone-hangup': (data) => {
700
+ emit('softphone-hangup', data)
701
+ },
702
+ 'softphone-incoming': (data) => {
703
+ emit( 'softphone-incoming', data)
704
+ },
705
+ 'softphone-send-dtmf': (data) => {
706
+ emit('softphone-send-dtmf', data)
707
+ },
708
+ 'softphone-sign-overdued': (data) => {
709
+ const done = (data) => {
710
+ const {
711
+ sign,
712
+ timestamp
713
+ } = data
714
+ nfMicrophoneInstance.signOverdued({
715
+ sign,
716
+ timestamp
717
+ })
718
+ }
719
+ emit('softphone-sign-overdued', done)
720
+ },
721
+
722
+ }
723
+ useQinkunSoftphoneNotity = (state) => {
724
+ if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
725
+ (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
726
+ if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
727
+ this.communicationList[state.type]?.(state.data)
728
+ }
729
+ }
730
+ }
731
+ useWujieSoftphoneNotity() {
732
+ Object.keys(this.communicationList).forEach(key => {
733
+ bus.$on(key, (state) => {
734
+ if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
735
+ (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
736
+ if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
737
+ this.communicationList[key]?.(state.data)
738
+ }
739
+ }
740
+ })
741
+ })
742
+ }
743
+ }
681
744
 
682
745
  const getUserInfo = () => {
683
746
  const {
@@ -734,6 +797,8 @@ const getUserInfo = () => {
734
797
  userType,
735
798
  recordPath,
736
799
  constMap,
800
+ timestamp,
801
+ sign,
737
802
  } = props
738
803
 
739
804
  return {
@@ -741,6 +806,8 @@ const getUserInfo = () => {
741
806
  agentTag,
742
807
  appKey,
743
808
  appSecret,
809
+ timestamp,
810
+ sign,
744
811
  extStatus,
745
812
  origin,
746
813
  ancestorOrigin,
@@ -794,6 +861,13 @@ const getUserInfo = () => {
794
861
  }
795
862
  }
796
863
 
864
+ const setUserInfo = (userInfo) => {
865
+ if (userInfo.sign && props.sign && userInfo.sign !== props.sign) {
866
+ emit('update:sign', userInfo.sign)
867
+ emit('update:timestamp', userInfo.timestamp)
868
+ }
869
+ }
870
+
797
871
  onMounted(() => {
798
872
  // 注册软电话微应用
799
873
  if (props.mode === 'qiankun') {
package/package/types.ts CHANGED
@@ -10,6 +10,8 @@ export type Option = {
10
10
  agentTag?: string,
11
11
  appKey?: string,
12
12
  appSecret?: string,
13
+ timestamp?: number | string,
14
+ sign?: string
13
15
  extStatus?: string,
14
16
 
15
17
  origin?: string,
@@ -111,4 +113,5 @@ export type Option = {
111
113
  softphoneIncomingCallBack: Function
112
114
  softphoneSendDtmfCallBack: Function
113
115
  softphoneConnectRegisteredCallBack: Function
116
+ softphoneSignOverduedCallBack: Function
114
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-microphone",
3
- "version": "6.1.30",
3
+ "version": "8.0.1",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,7 +14,7 @@
14
14
  "url": "http://94ai.gitlab.com/ui/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^6.1.30",
17
+ "@94ai/nf-theme-chalk": "^8.0.1",
18
18
  "crypto-js": "^4.2.0",
19
19
  "qiankun": "^2.10.16",
20
20
  "vue-demi": "^0.14.5",
@@ -33,5 +33,5 @@
33
33
  "types": "lib/index.d.ts",
34
34
  "main": "lib/nf-microphone.cjs.js",
35
35
  "module": "lib/nf-microphone.esm-bundler.js",
36
- "gitHead": "a9bc8a7b3e9017ff13cede7afcabf135ccd949c5"
36
+ "gitHead": "316144e9cd2a06b10e14476d5fdc7f1d42fa88c6"
37
37
  }