@94ai/nf-microphone 7.0.0 → 8.0.5
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/lib/index.d.ts +1515 -1509
- package/lib/nf-microphone.cjs.js +208 -151
- package/lib/nf-microphone.esm-bundler.js +208 -151
- package/lib/nf-microphone.vue.d.ts +310 -307
- package/lib/style/css.d.ts +1 -1
- package/lib/style/index.d.ts +1 -1
- package/lib/types.d.ts +79 -78
- package/package/microphone.ts +110 -68
- package/package/nf-microphone.vue +105 -67
- package/package/types.ts +1 -0
- package/package.json +3 -3
package/lib/types.d.ts
CHANGED
|
@@ -1,78 +1,79 @@
|
|
|
1
|
-
export declare type Env = 'test' | 'dev' | 'sg' | 'gray' | 'prod';
|
|
2
|
-
export declare type Option = {
|
|
3
|
-
mode?: 'qiankun' | 'wujie';
|
|
4
|
-
envMap?: Partial<Record<Env, Record<string, any>>>;
|
|
5
|
-
env?: Env;
|
|
6
|
-
agentId?: string;
|
|
7
|
-
agentTag?: string;
|
|
8
|
-
appKey?: string;
|
|
9
|
-
appSecret?: string;
|
|
10
|
-
timestamp?: number | string;
|
|
11
|
-
sign?: string;
|
|
12
|
-
extStatus?: string;
|
|
13
|
-
origin?: string;
|
|
14
|
-
ancestorOrigin?: string;
|
|
15
|
-
destinationOrigin?: string;
|
|
16
|
-
callShow?: '0' | '1';
|
|
17
|
-
transferToLaborShow?: '0' | '1';
|
|
18
|
-
restShow?: '0' | '1';
|
|
19
|
-
networkDetectShow?: '0' | '1';
|
|
20
|
-
muteShow?: '0' | '1';
|
|
21
|
-
logShow?: '0' | '1';
|
|
22
|
-
timingShow?: '0' | '1';
|
|
23
|
-
signShow?: '0' | '1';
|
|
24
|
-
lang?: 'zh' | 'en';
|
|
25
|
-
name?: string;
|
|
26
|
-
extensionInfo?: {
|
|
27
|
-
status: 0 | 1;
|
|
28
|
-
wsRegisterAddress?: string;
|
|
29
|
-
wsProtocol?: string;
|
|
30
|
-
accountCode?: string;
|
|
31
|
-
};
|
|
32
|
-
blackList?: string[];
|
|
33
|
-
extPassword?: string;
|
|
34
|
-
extensionNumber?: string;
|
|
35
|
-
wsRegisterAddress?: string;
|
|
36
|
-
wsProtocol?: string;
|
|
37
|
-
isOem?: boolean;
|
|
38
|
-
numberKeyBoard?: boolean;
|
|
39
|
-
accessMode?: 'mobile' | 'pc';
|
|
40
|
-
sipHeaders?: string[];
|
|
41
|
-
sgGateway?: string;
|
|
42
|
-
open?: string;
|
|
43
|
-
sgOpen?: string;
|
|
44
|
-
sgDomain?: string;
|
|
45
|
-
sgBase?: string;
|
|
46
|
-
token?: string;
|
|
47
|
-
timeZone?: string;
|
|
48
|
-
getOfflineInfo?: Function;
|
|
49
|
-
changeALittleRest?: Function;
|
|
50
|
-
quickCallWin?: Function;
|
|
51
|
-
phoneRegex?: string;
|
|
52
|
-
account?: string;
|
|
53
|
-
extAccount?: string;
|
|
54
|
-
socketHost?: string;
|
|
55
|
-
sid?: number;
|
|
56
|
-
uid?: number;
|
|
57
|
-
newUserId?: number;
|
|
58
|
-
companyId?: number;
|
|
59
|
-
company?: string;
|
|
60
|
-
countryId?: number;
|
|
61
|
-
countryName?: string;
|
|
62
|
-
authUserType?: 4 | 3 | 2 | 1;
|
|
63
|
-
userType?: 4 | 3 | 2 | 1;
|
|
64
|
-
recordPath?: string;
|
|
65
|
-
constMap?: Record<string, any>;
|
|
66
|
-
el: string;
|
|
67
|
-
instanceMap: Record<string, any>;
|
|
68
|
-
softphoneConnectCallBack: Function;
|
|
69
|
-
softphoneCallRefreshCallBack: Function;
|
|
70
|
-
softphoneSeatStatusChangeCallBack: Function;
|
|
71
|
-
softphoneAcceptCallBack: Function;
|
|
72
|
-
softphoneIgnoreCallBack: Function;
|
|
73
|
-
softphoneHangupCallBack: Function;
|
|
74
|
-
softphoneSessionStateChangeCallBack: Function;
|
|
75
|
-
softphoneIncomingCallBack: Function;
|
|
76
|
-
softphoneSendDtmfCallBack: Function;
|
|
77
|
-
softphoneConnectRegisteredCallBack: Function;
|
|
78
|
-
|
|
1
|
+
export declare type Env = 'test' | 'dev' | 'sg' | 'gray' | 'prod';
|
|
2
|
+
export declare type Option = {
|
|
3
|
+
mode?: 'qiankun' | 'wujie';
|
|
4
|
+
envMap?: Partial<Record<Env, Record<string, any>>>;
|
|
5
|
+
env?: Env;
|
|
6
|
+
agentId?: string;
|
|
7
|
+
agentTag?: string;
|
|
8
|
+
appKey?: string;
|
|
9
|
+
appSecret?: string;
|
|
10
|
+
timestamp?: number | string;
|
|
11
|
+
sign?: string;
|
|
12
|
+
extStatus?: string;
|
|
13
|
+
origin?: string;
|
|
14
|
+
ancestorOrigin?: string;
|
|
15
|
+
destinationOrigin?: string;
|
|
16
|
+
callShow?: '0' | '1';
|
|
17
|
+
transferToLaborShow?: '0' | '1';
|
|
18
|
+
restShow?: '0' | '1';
|
|
19
|
+
networkDetectShow?: '0' | '1';
|
|
20
|
+
muteShow?: '0' | '1';
|
|
21
|
+
logShow?: '0' | '1';
|
|
22
|
+
timingShow?: '0' | '1';
|
|
23
|
+
signShow?: '0' | '1';
|
|
24
|
+
lang?: 'zh' | 'en';
|
|
25
|
+
name?: string;
|
|
26
|
+
extensionInfo?: {
|
|
27
|
+
status: 0 | 1;
|
|
28
|
+
wsRegisterAddress?: string;
|
|
29
|
+
wsProtocol?: string;
|
|
30
|
+
accountCode?: string;
|
|
31
|
+
};
|
|
32
|
+
blackList?: string[];
|
|
33
|
+
extPassword?: string;
|
|
34
|
+
extensionNumber?: string;
|
|
35
|
+
wsRegisterAddress?: string;
|
|
36
|
+
wsProtocol?: string;
|
|
37
|
+
isOem?: boolean;
|
|
38
|
+
numberKeyBoard?: boolean;
|
|
39
|
+
accessMode?: 'mobile' | 'pc';
|
|
40
|
+
sipHeaders?: string[];
|
|
41
|
+
sgGateway?: string;
|
|
42
|
+
open?: string;
|
|
43
|
+
sgOpen?: string;
|
|
44
|
+
sgDomain?: string;
|
|
45
|
+
sgBase?: string;
|
|
46
|
+
token?: string;
|
|
47
|
+
timeZone?: string;
|
|
48
|
+
getOfflineInfo?: Function;
|
|
49
|
+
changeALittleRest?: Function;
|
|
50
|
+
quickCallWin?: Function;
|
|
51
|
+
phoneRegex?: string;
|
|
52
|
+
account?: string;
|
|
53
|
+
extAccount?: string;
|
|
54
|
+
socketHost?: string;
|
|
55
|
+
sid?: number;
|
|
56
|
+
uid?: number;
|
|
57
|
+
newUserId?: number;
|
|
58
|
+
companyId?: number;
|
|
59
|
+
company?: string;
|
|
60
|
+
countryId?: number;
|
|
61
|
+
countryName?: string;
|
|
62
|
+
authUserType?: 4 | 3 | 2 | 1;
|
|
63
|
+
userType?: 4 | 3 | 2 | 1;
|
|
64
|
+
recordPath?: string;
|
|
65
|
+
constMap?: Record<string, any>;
|
|
66
|
+
el: string;
|
|
67
|
+
instanceMap: Record<string, any>;
|
|
68
|
+
softphoneConnectCallBack: Function;
|
|
69
|
+
softphoneCallRefreshCallBack: Function;
|
|
70
|
+
softphoneSeatStatusChangeCallBack: Function;
|
|
71
|
+
softphoneAcceptCallBack: Function;
|
|
72
|
+
softphoneIgnoreCallBack: Function;
|
|
73
|
+
softphoneHangupCallBack: Function;
|
|
74
|
+
softphoneSessionStateChangeCallBack: Function;
|
|
75
|
+
softphoneIncomingCallBack: Function;
|
|
76
|
+
softphoneSendDtmfCallBack: Function;
|
|
77
|
+
softphoneConnectRegisteredCallBack: Function;
|
|
78
|
+
softphoneSignOverduedCallBack: Function;
|
|
79
|
+
};
|
package/package/microphone.ts
CHANGED
|
@@ -84,6 +84,12 @@ export class SoftphoneManager {
|
|
|
84
84
|
softphoneIncomingCallBack: () => {console.log('softphone-incoming')},
|
|
85
85
|
softphoneSendDtmfCallBack: () => {console.log('softphone-send-dtmf')},
|
|
86
86
|
softphoneConnectRegisteredCallBack: () => {console.log('softphone-connect-registered')},
|
|
87
|
+
softphoneSignOverduedCallBack: (done) => {
|
|
88
|
+
done({
|
|
89
|
+
timestamp: undefined,
|
|
90
|
+
sign: undefined
|
|
91
|
+
})
|
|
92
|
+
},
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
initSoftphone = (option) => {
|
|
@@ -92,6 +98,13 @@ export class SoftphoneManager {
|
|
|
92
98
|
}
|
|
93
99
|
const props = this.option = option ? { ...this.option, ...option } :this.option
|
|
94
100
|
|
|
101
|
+
const setUserInfo = (userInfo) => {
|
|
102
|
+
if (userInfo.sign && props.sign && userInfo.sign !== props.sign) {
|
|
103
|
+
this.option.sign = userInfo.sign
|
|
104
|
+
this.option.timestamp = userInfo.timestamp
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
95
108
|
const getUserInfo = () => {
|
|
96
109
|
const {
|
|
97
110
|
agentId,
|
|
@@ -398,62 +411,6 @@ export class SoftphoneManager {
|
|
|
398
411
|
}
|
|
399
412
|
}
|
|
400
413
|
|
|
401
|
-
// 通知
|
|
402
|
-
class SoftphoneNotity {
|
|
403
|
-
communicationList = {
|
|
404
|
-
'softphone-connect-registered': (data) => {
|
|
405
|
-
props.softphoneConnectRegisteredCallBack?.(data)
|
|
406
|
-
},
|
|
407
|
-
'softphone-session-state-change': (data) => {
|
|
408
|
-
props.softphoneSessionStateChangeCallBack?.(data)
|
|
409
|
-
},
|
|
410
|
-
'softphone-call-refresh': (data) => {
|
|
411
|
-
props.softphoneCallRefreshCallBack?.(data)
|
|
412
|
-
},
|
|
413
|
-
'softphone-connect': (data) => {
|
|
414
|
-
props.softphoneConnectCallBack?.(data)
|
|
415
|
-
},
|
|
416
|
-
'softphone-accept': (data) => {
|
|
417
|
-
props.softphoneAcceptCallBack?.(data)
|
|
418
|
-
},
|
|
419
|
-
'softphone-seats-status-change': (data) => {
|
|
420
|
-
props.softphoneSeatStatusChangeCallBack?.(data)
|
|
421
|
-
},
|
|
422
|
-
'softphone-ignore': (data) => {
|
|
423
|
-
props.softphoneIgnoreCallBack?.(data)
|
|
424
|
-
},
|
|
425
|
-
'softphone-hangup': (data) => {
|
|
426
|
-
props.softphoneHangupCallBack?.(data)
|
|
427
|
-
},
|
|
428
|
-
'softphone-incoming': (data) => {
|
|
429
|
-
props.softphoneIncomingCallBack?.(data)
|
|
430
|
-
},
|
|
431
|
-
'softphone-send-dtmf': (data) => {
|
|
432
|
-
props.softphoneSendDtmfCallBack?.(data)
|
|
433
|
-
},
|
|
434
|
-
}
|
|
435
|
-
useQinkunSoftphoneNotity = (state) => {
|
|
436
|
-
if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
|
|
437
|
-
(state.ancestorOrigin === props.origin && state.origin === props.origin)) {
|
|
438
|
-
if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
|
|
439
|
-
this.communicationList[state.type]?.(state.data)
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
useWujieSoftphoneNotity() {
|
|
444
|
-
Object.keys(this.communicationList).forEach(key => {
|
|
445
|
-
bus.$on(key, (state) => {
|
|
446
|
-
if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
|
|
447
|
-
(state.ancestorOrigin === props.origin && state.origin === props.origin)) {
|
|
448
|
-
if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
|
|
449
|
-
this.communicationList[key]?.(state.data)
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
})
|
|
453
|
-
})
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
414
|
// 实例+动作管理
|
|
458
415
|
class MicroManager {
|
|
459
416
|
showSoftPhone = true
|
|
@@ -471,15 +428,21 @@ export class SoftphoneManager {
|
|
|
471
428
|
return bus
|
|
472
429
|
}
|
|
473
430
|
|
|
474
|
-
microCommunicat(
|
|
431
|
+
microCommunicat(
|
|
432
|
+
type: string,
|
|
433
|
+
data: Record<string, any> = {},
|
|
434
|
+
operationType = 'manual',
|
|
435
|
+
ancestorOrigin = props.ancestorOrigin,
|
|
436
|
+
destinationOrigin = props.destinationOrigin
|
|
437
|
+
) {
|
|
475
438
|
const state = {
|
|
476
439
|
origin: 'nf-softphone',
|
|
477
|
-
ancestorOrigin: props.ancestorOrigin,
|
|
478
|
-
destinationOrigin: props.destinationOrigin,
|
|
440
|
+
ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
|
|
441
|
+
destinationOrigin: destinationOrigin || props.destinationOrigin,
|
|
479
442
|
type,
|
|
480
443
|
data: {
|
|
481
|
-
|
|
482
|
-
type:
|
|
444
|
+
...data,
|
|
445
|
+
type: operationType
|
|
483
446
|
}
|
|
484
447
|
}
|
|
485
448
|
if (this.mode === 'qiankun') {
|
|
@@ -492,15 +455,21 @@ export class SoftphoneManager {
|
|
|
492
455
|
|
|
493
456
|
// 签入
|
|
494
457
|
connect() {
|
|
495
|
-
this.microCommunicat('softphone-connect',
|
|
458
|
+
this.microCommunicat('softphone-connect', {
|
|
459
|
+
status: true
|
|
460
|
+
})
|
|
496
461
|
}
|
|
497
462
|
|
|
498
463
|
disconnect() {
|
|
499
|
-
this.microCommunicat('softphone-connect',
|
|
464
|
+
this.microCommunicat('softphone-connect', {
|
|
465
|
+
status: false
|
|
466
|
+
})
|
|
500
467
|
}
|
|
501
468
|
|
|
502
469
|
seatsStatusChange(status: boolean) {
|
|
503
|
-
this.microCommunicat('softphone-connect',
|
|
470
|
+
this.microCommunicat('softphone-connect', {
|
|
471
|
+
status
|
|
472
|
+
})
|
|
504
473
|
}
|
|
505
474
|
accept() {
|
|
506
475
|
this.microCommunicat('softphone-connect')
|
|
@@ -515,6 +484,10 @@ export class SoftphoneManager {
|
|
|
515
484
|
this.microCommunicat('softphone-send-dtmf')
|
|
516
485
|
}
|
|
517
486
|
|
|
487
|
+
signOverdued(data) {
|
|
488
|
+
this.microCommunicat('softphone-sign-overdued', data, 'auto', props.ancestorOrigin, 'ai-softphone')
|
|
489
|
+
}
|
|
490
|
+
|
|
518
491
|
changeServerToRegister() {
|
|
519
492
|
this.microCommunicat('softphone-change-server-to-register')
|
|
520
493
|
}
|
|
@@ -596,7 +569,7 @@ export class SoftphoneManager {
|
|
|
596
569
|
loadQiankunMicroApps() {
|
|
597
570
|
const appConfig = this.getMicroAppConfig()[0]
|
|
598
571
|
appConfig.props.shared.getUserInfo = getUserInfo
|
|
599
|
-
appConfig.props.shared.setUserInfo =
|
|
572
|
+
appConfig.props.shared.setUserInfo = setUserInfo
|
|
600
573
|
this.initState()
|
|
601
574
|
this.app = loadMicroApp(appConfig, {
|
|
602
575
|
sandbox: {
|
|
@@ -623,7 +596,7 @@ export class SoftphoneManager {
|
|
|
623
596
|
const appConfig = this.getMicroAppConfig()[0]
|
|
624
597
|
const url = appConfig.entry
|
|
625
598
|
appConfig.props.shared.getUserInfo = getUserInfo
|
|
626
|
-
appConfig.props.shared.setUserInfo =
|
|
599
|
+
appConfig.props.shared.setUserInfo = setUserInfo
|
|
627
600
|
|
|
628
601
|
setupApp({
|
|
629
602
|
name: props.name,
|
|
@@ -663,7 +636,7 @@ export class SoftphoneManager {
|
|
|
663
636
|
registerQiankunMicroApps() {
|
|
664
637
|
const appConfig = this.getMicroAppConfig()[0]
|
|
665
638
|
appConfig.props.shared.getUserInfo = getUserInfo
|
|
666
|
-
appConfig.props.shared.setUserInfo =
|
|
639
|
+
appConfig.props.shared.setUserInfo = setUserInfo
|
|
667
640
|
|
|
668
641
|
registerMicroApps([appConfig], {
|
|
669
642
|
// qiankun 生命周期钩子 - 加载前
|
|
@@ -715,7 +688,76 @@ export class SoftphoneManager {
|
|
|
715
688
|
}
|
|
716
689
|
}
|
|
717
690
|
|
|
718
|
-
this.nfMicrophoneInstance = new MicroManager()
|
|
691
|
+
const nfMicrophoneInstance = this.nfMicrophoneInstance = new MicroManager()
|
|
692
|
+
|
|
693
|
+
// 通知
|
|
694
|
+
class SoftphoneNotity {
|
|
695
|
+
communicationList = {
|
|
696
|
+
'softphone-connect-registered': (data) => {
|
|
697
|
+
props.softphoneConnectRegisteredCallBack?.(data)
|
|
698
|
+
},
|
|
699
|
+
'softphone-session-state-change': (data) => {
|
|
700
|
+
props.softphoneSessionStateChangeCallBack?.(data)
|
|
701
|
+
},
|
|
702
|
+
'softphone-call-refresh': (data) => {
|
|
703
|
+
props.softphoneCallRefreshCallBack?.(data)
|
|
704
|
+
},
|
|
705
|
+
'softphone-connect': (data) => {
|
|
706
|
+
props.softphoneConnectCallBack?.(data)
|
|
707
|
+
},
|
|
708
|
+
'softphone-accept': (data) => {
|
|
709
|
+
props.softphoneAcceptCallBack?.(data)
|
|
710
|
+
},
|
|
711
|
+
'softphone-seats-status-change': (data) => {
|
|
712
|
+
props.softphoneSeatStatusChangeCallBack?.(data)
|
|
713
|
+
},
|
|
714
|
+
'softphone-ignore': (data) => {
|
|
715
|
+
props.softphoneIgnoreCallBack?.(data)
|
|
716
|
+
},
|
|
717
|
+
'softphone-hangup': (data) => {
|
|
718
|
+
props.softphoneHangupCallBack?.(data)
|
|
719
|
+
},
|
|
720
|
+
'softphone-incoming': (data) => {
|
|
721
|
+
props.softphoneIncomingCallBack?.(data)
|
|
722
|
+
},
|
|
723
|
+
'softphone-send-dtmf': (data) => {
|
|
724
|
+
props.softphoneSendDtmfCallBack?.(data)
|
|
725
|
+
},
|
|
726
|
+
'softphone-sign-overdued': () => {
|
|
727
|
+
const done = (data) => {
|
|
728
|
+
const {
|
|
729
|
+
sign,
|
|
730
|
+
timestamp
|
|
731
|
+
} = data
|
|
732
|
+
nfMicrophoneInstance.signOverdued({
|
|
733
|
+
sign,
|
|
734
|
+
timestamp
|
|
735
|
+
})
|
|
736
|
+
}
|
|
737
|
+
props.softphoneSignOverduedCallBack?.(done)
|
|
738
|
+
},
|
|
739
|
+
}
|
|
740
|
+
useQinkunSoftphoneNotity = (state) => {
|
|
741
|
+
if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
|
|
742
|
+
(state.ancestorOrigin === props.origin && state.origin === props.origin)) {
|
|
743
|
+
if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
|
|
744
|
+
this.communicationList[state.type]?.(state.data)
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
useWujieSoftphoneNotity() {
|
|
749
|
+
Object.keys(this.communicationList).forEach(key => {
|
|
750
|
+
bus.$on(key, (state) => {
|
|
751
|
+
if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
|
|
752
|
+
(state.ancestorOrigin === props.origin && state.origin === props.origin)) {
|
|
753
|
+
if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
|
|
754
|
+
this.communicationList[key]?.(state.data)
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
})
|
|
758
|
+
})
|
|
759
|
+
}
|
|
760
|
+
}
|
|
719
761
|
|
|
720
762
|
// 注册软电话微应用
|
|
721
763
|
if (this.option.mode === 'qiankun') {
|
|
@@ -202,6 +202,9 @@ const emit = defineEmits<{
|
|
|
202
202
|
(e: 'softphone-session-state-change', event: any): void
|
|
203
203
|
(e: 'softphone-incoming', event: any): void
|
|
204
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
|
|
205
208
|
}>()
|
|
206
209
|
|
|
207
210
|
const showSoftPhone = ref(true)
|
|
@@ -394,62 +397,6 @@ class Shared {
|
|
|
394
397
|
}
|
|
395
398
|
}
|
|
396
399
|
|
|
397
|
-
// 通知
|
|
398
|
-
class SoftphoneNotity {
|
|
399
|
-
communicationList = {
|
|
400
|
-
'softphone-connect-registered': (data) => {
|
|
401
|
-
emit('softphone-connect-registered', data)
|
|
402
|
-
},
|
|
403
|
-
'softphone-session-state-change': (data) => {
|
|
404
|
-
emit('softphone-session-state-change', data)
|
|
405
|
-
},
|
|
406
|
-
'softphone-call-refresh': (data) => {
|
|
407
|
-
emit('softphone-call-refresh', data)
|
|
408
|
-
},
|
|
409
|
-
'softphone-connect': (data) => {
|
|
410
|
-
emit('softphone-connect', data)
|
|
411
|
-
},
|
|
412
|
-
'softphone-accept': (data) => {
|
|
413
|
-
emit('softphone-accept', data)
|
|
414
|
-
},
|
|
415
|
-
'softphone-seats-status-change': (data) => {
|
|
416
|
-
emit('softphone-seats-status-change', data)
|
|
417
|
-
},
|
|
418
|
-
'softphone-ignore': (data) => {
|
|
419
|
-
emit('softphone-ignore', data)
|
|
420
|
-
},
|
|
421
|
-
'softphone-hangup': (data) => {
|
|
422
|
-
emit('softphone-hangup', data)
|
|
423
|
-
},
|
|
424
|
-
'softphone-incoming': (data) => {
|
|
425
|
-
emit( 'softphone-incoming', data)
|
|
426
|
-
},
|
|
427
|
-
'softphone-send-dtmf': (data) => {
|
|
428
|
-
emit('softphone-send-dtmf', data)
|
|
429
|
-
},
|
|
430
|
-
}
|
|
431
|
-
useQinkunSoftphoneNotity = (state) => {
|
|
432
|
-
if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
|
|
433
|
-
(state.ancestorOrigin === props.origin && state.origin === props.origin)) {
|
|
434
|
-
if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
|
|
435
|
-
this.communicationList[state.type]?.(state.data)
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
useWujieSoftphoneNotity() {
|
|
440
|
-
Object.keys(this.communicationList).forEach(key => {
|
|
441
|
-
bus.$on(key, (state) => {
|
|
442
|
-
if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
|
|
443
|
-
(state.ancestorOrigin === props.origin && state.origin === props.origin)) {
|
|
444
|
-
if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
|
|
445
|
-
this.communicationList[key]?.(state.data)
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
})
|
|
449
|
-
})
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
400
|
// 实例+动作管理
|
|
454
401
|
class MicroManager {
|
|
455
402
|
app
|
|
@@ -465,15 +412,21 @@ class MicroManager {
|
|
|
465
412
|
return bus
|
|
466
413
|
}
|
|
467
414
|
|
|
468
|
-
microCommunicat(
|
|
415
|
+
microCommunicat(
|
|
416
|
+
type: string,
|
|
417
|
+
data: Record<string, any> = {},
|
|
418
|
+
operationType = 'manual',
|
|
419
|
+
ancestorOrigin = props.ancestorOrigin,
|
|
420
|
+
destinationOrigin = props.destinationOrigin
|
|
421
|
+
) {
|
|
469
422
|
const state = {
|
|
470
423
|
origin: 'nf-softphone',
|
|
471
|
-
ancestorOrigin: props.ancestorOrigin,
|
|
472
|
-
destinationOrigin: props.destinationOrigin,
|
|
424
|
+
ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
|
|
425
|
+
destinationOrigin: destinationOrigin || props.destinationOrigin,
|
|
473
426
|
type,
|
|
474
427
|
data: {
|
|
475
|
-
|
|
476
|
-
type:
|
|
428
|
+
...data,
|
|
429
|
+
type: operationType
|
|
477
430
|
}
|
|
478
431
|
}
|
|
479
432
|
if (this.mode === 'qiankun') {
|
|
@@ -483,18 +436,27 @@ class MicroManager {
|
|
|
483
436
|
}
|
|
484
437
|
}
|
|
485
438
|
|
|
439
|
+
signOverdued(data) {
|
|
440
|
+
this.microCommunicat('softphone-sign-overdued', data, 'auto', props.ancestorOrigin, 'ai-softphone')
|
|
441
|
+
}
|
|
486
442
|
|
|
487
443
|
// 签入
|
|
488
444
|
connect() {
|
|
489
|
-
this.microCommunicat('softphone-connect',
|
|
445
|
+
this.microCommunicat('softphone-connect', {
|
|
446
|
+
status: true
|
|
447
|
+
})
|
|
490
448
|
}
|
|
491
449
|
|
|
492
450
|
disconnect() {
|
|
493
|
-
this.microCommunicat('softphone-connect',
|
|
451
|
+
this.microCommunicat('softphone-connect', {
|
|
452
|
+
status: false
|
|
453
|
+
})
|
|
494
454
|
}
|
|
495
455
|
|
|
496
456
|
seatsStatusChange(status: boolean) {
|
|
497
|
-
this.microCommunicat('softphone-connect',
|
|
457
|
+
this.microCommunicat('softphone-connect', {
|
|
458
|
+
status
|
|
459
|
+
})
|
|
498
460
|
}
|
|
499
461
|
accept() {
|
|
500
462
|
this.microCommunicat('softphone-connect')
|
|
@@ -590,7 +552,7 @@ class MicroManager {
|
|
|
590
552
|
loadQiankunMicroApps() {
|
|
591
553
|
const appConfig = this.getMicroAppConfig()[0]
|
|
592
554
|
appConfig.props.shared.getUserInfo = getUserInfo
|
|
593
|
-
appConfig.props.shared.setUserInfo =
|
|
555
|
+
appConfig.props.shared.setUserInfo = setUserInfo
|
|
594
556
|
this.initState()
|
|
595
557
|
this.app = loadMicroApp(appConfig, {
|
|
596
558
|
sandbox: {
|
|
@@ -618,7 +580,7 @@ class MicroManager {
|
|
|
618
580
|
const appConfig = this.getMicroAppConfig()[0]
|
|
619
581
|
const url = appConfig.entry
|
|
620
582
|
appConfig.props.shared.getUserInfo = getUserInfo
|
|
621
|
-
appConfig.props.shared.setUserInfo =
|
|
583
|
+
appConfig.props.shared.setUserInfo = setUserInfo
|
|
622
584
|
|
|
623
585
|
setupApp({
|
|
624
586
|
name: props.name,
|
|
@@ -658,7 +620,7 @@ class MicroManager {
|
|
|
658
620
|
registerQiankunMicroApps() {
|
|
659
621
|
const appConfig = this.getMicroAppConfig()[0]
|
|
660
622
|
appConfig.props.shared.getUserInfo = getUserInfo
|
|
661
|
-
appConfig.props.shared.setUserInfo =
|
|
623
|
+
appConfig.props.shared.setUserInfo = setUserInfo
|
|
662
624
|
|
|
663
625
|
registerMicroApps([appConfig], {
|
|
664
626
|
// qiankun 生命周期钩子 - 加载前
|
|
@@ -710,6 +672,75 @@ class MicroManager {
|
|
|
710
672
|
}
|
|
711
673
|
}
|
|
712
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
|
+
}
|
|
713
744
|
|
|
714
745
|
const getUserInfo = () => {
|
|
715
746
|
const {
|
|
@@ -830,6 +861,13 @@ const getUserInfo = () => {
|
|
|
830
861
|
}
|
|
831
862
|
}
|
|
832
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
|
+
|
|
833
871
|
onMounted(() => {
|
|
834
872
|
// 注册软电话微应用
|
|
835
873
|
if (props.mode === 'qiankun') {
|
package/package/types.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-microphone",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.5",
|
|
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": "^
|
|
17
|
+
"@94ai/nf-theme-chalk": "^8.0.5",
|
|
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": "
|
|
36
|
+
"gitHead": "fab708c9a9c54ca34e3fea3c92a4a378184da4b3"
|
|
37
37
|
}
|