@94ai/nf-softphone 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 +775 -773
- package/lib/nf-softphone.cjs.js +59 -9
- package/lib/nf-softphone.esm-bundler.js +59 -9
- package/lib/nf-softphone.vue.d.ts +191 -190
- package/lib/softphone.d.ts +48 -44
- package/lib/style/css.d.ts +1 -1
- package/lib/style/index.d.ts +1 -1
- package/lib/type.d.ts +43 -42
- package/package/nf-softphone.vue +40 -8
- package/package/softphone.ts +32 -0
- package/package/type.ts +1 -0
- package/package.json +3 -3
package/lib/softphone.d.ts
CHANGED
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import { Option } from '../..nf-softphone/lib/type';
|
|
2
|
-
export declare class SoftphoneManager {
|
|
3
|
-
id: any;
|
|
4
|
-
timer: any;
|
|
5
|
-
constructor();
|
|
6
|
-
option: Partial<Option>;
|
|
7
|
-
loadCssCode: (code: any) => void;
|
|
8
|
-
removeCssCode: () => void;
|
|
9
|
-
getContextDomElement: (el: string) => Element | null;
|
|
10
|
-
getSoftphoneDomElement: (el: string) => Element | null;
|
|
11
|
-
|
|
1
|
+
import { Option } from '../..nf-softphone/lib/type';
|
|
2
|
+
export declare class SoftphoneManager {
|
|
3
|
+
id: any;
|
|
4
|
+
timer: any;
|
|
5
|
+
constructor();
|
|
6
|
+
option: Partial<Option>;
|
|
7
|
+
loadCssCode: (code: any) => void;
|
|
8
|
+
removeCssCode: () => void;
|
|
9
|
+
getContextDomElement: (el: string) => Element | null;
|
|
10
|
+
getSoftphoneDomElement: (el: string) => Element | null;
|
|
11
|
+
signOverdued: (data: {
|
|
12
|
+
sign: string;
|
|
13
|
+
timestamp: string | number;
|
|
14
|
+
}) => void;
|
|
15
|
+
handlingCommunication: (e: {
|
|
12
16
|
data: `{
|
|
13
17
|
type: string,
|
|
14
18
|
ancestorOrigin: string,
|
|
15
19
|
origin: string,
|
|
16
20
|
data: 'expand' | 'shrink'
|
|
17
|
-
}` | string;
|
|
18
|
-
}) => void;
|
|
19
|
-
handlingScroll: (...args: any[]) => any;
|
|
20
|
-
handlerInteractive: () => void;
|
|
21
|
-
handlerDomRemove: () => void;
|
|
22
|
-
_containerScrolling: any;
|
|
23
|
-
get containerScrolling(): boolean;
|
|
24
|
-
set containerScrolling(value: boolean);
|
|
25
|
-
handlingScrollTransparent: () => void;
|
|
26
|
-
refreshStyle: () => Promise<{
|
|
27
|
-
top: number;
|
|
28
|
-
left: number;
|
|
29
|
-
leftMargin: string;
|
|
30
|
-
} | {
|
|
31
|
-
leftMargin: number;
|
|
32
|
-
top: number;
|
|
33
|
-
left: number;
|
|
34
|
-
}>;
|
|
35
|
-
handlerDomGenerater: () => Promise<void>;
|
|
36
|
-
initSoftphone: (option: any) => this;
|
|
37
|
-
postMessageCommunicate: (type: any, status?: boolean | undefined) => void;
|
|
38
|
-
connect: () => void;
|
|
39
|
-
disconnect: () => void;
|
|
40
|
-
seatsStatusChange: (status: boolean) => void;
|
|
41
|
-
accept: () => void;
|
|
42
|
-
ignore: () => void;
|
|
43
|
-
hangup: () => void;
|
|
44
|
-
sendDtmf: () => void;
|
|
45
|
-
removeTimer: () => void;
|
|
46
|
-
destroy: () => void;
|
|
47
|
-
}
|
|
48
|
-
declare const softphoneManager: SoftphoneManager;
|
|
49
|
-
export default softphoneManager;
|
|
21
|
+
}` | string;
|
|
22
|
+
}) => void;
|
|
23
|
+
handlingScroll: (...args: any[]) => any;
|
|
24
|
+
handlerInteractive: () => void;
|
|
25
|
+
handlerDomRemove: () => void;
|
|
26
|
+
_containerScrolling: any;
|
|
27
|
+
get containerScrolling(): boolean;
|
|
28
|
+
set containerScrolling(value: boolean);
|
|
29
|
+
handlingScrollTransparent: () => void;
|
|
30
|
+
refreshStyle: () => Promise<{
|
|
31
|
+
top: number;
|
|
32
|
+
left: number;
|
|
33
|
+
leftMargin: string;
|
|
34
|
+
} | {
|
|
35
|
+
leftMargin: number;
|
|
36
|
+
top: number;
|
|
37
|
+
left: number;
|
|
38
|
+
}>;
|
|
39
|
+
handlerDomGenerater: () => Promise<void>;
|
|
40
|
+
initSoftphone: (option: any) => this;
|
|
41
|
+
postMessageCommunicate: (type: any, status?: boolean | undefined) => void;
|
|
42
|
+
connect: () => void;
|
|
43
|
+
disconnect: () => void;
|
|
44
|
+
seatsStatusChange: (status: boolean) => void;
|
|
45
|
+
accept: () => void;
|
|
46
|
+
ignore: () => void;
|
|
47
|
+
hangup: () => void;
|
|
48
|
+
sendDtmf: () => void;
|
|
49
|
+
removeTimer: () => void;
|
|
50
|
+
destroy: () => void;
|
|
51
|
+
}
|
|
52
|
+
declare const softphoneManager: SoftphoneManager;
|
|
53
|
+
export default softphoneManager;
|
package/lib/style/css.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/lib/style/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/lib/type.d.ts
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
export declare type Option = {
|
|
2
|
-
origin: string;
|
|
3
|
-
ancestorOrigin: string;
|
|
4
|
-
destinationOrigin: string;
|
|
5
|
-
scrollingText: string;
|
|
6
|
-
scrollview: string;
|
|
7
|
-
envMap: Record<Env, string>;
|
|
8
|
-
env: string;
|
|
9
|
-
selector: string;
|
|
10
|
-
el: string;
|
|
11
|
-
agentTag: string;
|
|
12
|
-
agentId: string;
|
|
13
|
-
appKey: string;
|
|
14
|
-
appSecret: string;
|
|
15
|
-
timestamp: string | number;
|
|
16
|
-
sign: string;
|
|
17
|
-
sgGateway: string;
|
|
18
|
-
sgBase: string;
|
|
19
|
-
sgOpen: string;
|
|
20
|
-
sgDomain: string;
|
|
21
|
-
extStatus: '0' | '1';
|
|
22
|
-
instanceMap: Record<string, any>;
|
|
23
|
-
callShow: '0' | '1';
|
|
24
|
-
transferToLaborShow: '0' | '1';
|
|
25
|
-
restShow: '0' | '1';
|
|
26
|
-
networkDetectShow: '0' | '1';
|
|
27
|
-
muteShow: '0' | '1';
|
|
28
|
-
logShow: '0' | '1';
|
|
29
|
-
timingShow: '0' | '1';
|
|
30
|
-
signShow: '0' | '1';
|
|
31
|
-
softphoneConnectCallBack: Function;
|
|
32
|
-
softphoneCallRefreshCallBack: Function;
|
|
33
|
-
softphoneSeatStatusChangeCallBack: Function;
|
|
34
|
-
softphoneAcceptCallBack: Function;
|
|
35
|
-
softphoneIgnoreCallBack: Function;
|
|
36
|
-
softphoneHangupCallBack: Function;
|
|
37
|
-
softphoneSessionStateChangeCallBack: Function;
|
|
38
|
-
softphoneIncomingCallBack: Function;
|
|
39
|
-
softphoneSendDtmfCallBack: Function;
|
|
40
|
-
softphoneConnectRegisteredCallBack: Function;
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
export declare type Option = {
|
|
2
|
+
origin: string;
|
|
3
|
+
ancestorOrigin: string;
|
|
4
|
+
destinationOrigin: string;
|
|
5
|
+
scrollingText: string;
|
|
6
|
+
scrollview: string;
|
|
7
|
+
envMap: Record<Env, string>;
|
|
8
|
+
env: string;
|
|
9
|
+
selector: string;
|
|
10
|
+
el: string;
|
|
11
|
+
agentTag: string;
|
|
12
|
+
agentId: string;
|
|
13
|
+
appKey: string;
|
|
14
|
+
appSecret: string;
|
|
15
|
+
timestamp: string | number;
|
|
16
|
+
sign: string;
|
|
17
|
+
sgGateway: string;
|
|
18
|
+
sgBase: string;
|
|
19
|
+
sgOpen: string;
|
|
20
|
+
sgDomain: string;
|
|
21
|
+
extStatus: '0' | '1';
|
|
22
|
+
instanceMap: Record<string, any>;
|
|
23
|
+
callShow: '0' | '1';
|
|
24
|
+
transferToLaborShow: '0' | '1';
|
|
25
|
+
restShow: '0' | '1';
|
|
26
|
+
networkDetectShow: '0' | '1';
|
|
27
|
+
muteShow: '0' | '1';
|
|
28
|
+
logShow: '0' | '1';
|
|
29
|
+
timingShow: '0' | '1';
|
|
30
|
+
signShow: '0' | '1';
|
|
31
|
+
softphoneConnectCallBack: Function;
|
|
32
|
+
softphoneCallRefreshCallBack: Function;
|
|
33
|
+
softphoneSeatStatusChangeCallBack: Function;
|
|
34
|
+
softphoneAcceptCallBack: Function;
|
|
35
|
+
softphoneIgnoreCallBack: Function;
|
|
36
|
+
softphoneHangupCallBack: Function;
|
|
37
|
+
softphoneSessionStateChangeCallBack: Function;
|
|
38
|
+
softphoneIncomingCallBack: Function;
|
|
39
|
+
softphoneSendDtmfCallBack: Function;
|
|
40
|
+
softphoneConnectRegisteredCallBack: Function;
|
|
41
|
+
softphoneSignOverduedCallBack: Function;
|
|
42
|
+
};
|
|
43
|
+
export declare type Env = 'test' | 'dev' | 'sg' | 'gray' | 'prod';
|
package/package/nf-softphone.vue
CHANGED
|
@@ -118,6 +118,7 @@ const emit = defineEmits<{
|
|
|
118
118
|
(e: 'softphone-session-state-change', event: any): void
|
|
119
119
|
(e: 'softphone-incoming', event: any): void
|
|
120
120
|
(e: 'softphone-connect-registered', event: any): void
|
|
121
|
+
(e: 'softphone-sign-overdued', event: any): void
|
|
121
122
|
}>()
|
|
122
123
|
|
|
123
124
|
const container = ref()
|
|
@@ -168,6 +169,18 @@ const handlingCommunication = (e: {data: `{
|
|
|
168
169
|
emit('softphone-send-dtmf', data)
|
|
169
170
|
} else if (data.type === 'softphone-connect-registered') {
|
|
170
171
|
emit('softphone-connect-registered', data)
|
|
172
|
+
} else if (data.type === 'softphone-sign-overdued') {
|
|
173
|
+
const done = (data) => {
|
|
174
|
+
const {
|
|
175
|
+
sign,
|
|
176
|
+
timestamp
|
|
177
|
+
} = data
|
|
178
|
+
signOverdued({
|
|
179
|
+
sign,
|
|
180
|
+
timestamp
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
emit('softphone-sign-overdued', done)
|
|
171
184
|
}
|
|
172
185
|
}
|
|
173
186
|
}
|
|
@@ -305,29 +318,41 @@ onUnmounted(() => {
|
|
|
305
318
|
}
|
|
306
319
|
})
|
|
307
320
|
|
|
308
|
-
const postMessageCommunicate = (
|
|
321
|
+
const postMessageCommunicate = (
|
|
322
|
+
type,
|
|
323
|
+
data: Record<string, any> = {},
|
|
324
|
+
operationType = 'manual',
|
|
325
|
+
ancestorOrigin = props.ancestorOrigin,
|
|
326
|
+
destinationOrigin = props.destinationOrigin
|
|
327
|
+
) => {
|
|
309
328
|
iframeDom.value?.contentWindow.postMessage(JSON.stringify({
|
|
310
329
|
origin: 'nf-softphone',
|
|
311
|
-
ancestorOrigin: props.ancestorOrigin,
|
|
312
|
-
destinationOrigin: props.destinationOrigin,
|
|
330
|
+
ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
|
|
331
|
+
destinationOrigin: destinationOrigin || props.destinationOrigin,
|
|
313
332
|
type,
|
|
314
333
|
data: {
|
|
315
|
-
|
|
316
|
-
type:
|
|
334
|
+
...data,
|
|
335
|
+
type: operationType
|
|
317
336
|
}
|
|
318
337
|
}), '*')
|
|
319
338
|
}
|
|
320
339
|
const connect = () => {
|
|
321
|
-
postMessageCommunicate('softphone-connect',
|
|
340
|
+
postMessageCommunicate('softphone-connect', {
|
|
341
|
+
status: true
|
|
342
|
+
})
|
|
322
343
|
}
|
|
323
344
|
|
|
324
345
|
|
|
325
346
|
const disconnect = () => {
|
|
326
|
-
postMessageCommunicate('softphone-connect',
|
|
347
|
+
postMessageCommunicate('softphone-connect', {
|
|
348
|
+
status: false
|
|
349
|
+
})
|
|
327
350
|
}
|
|
328
351
|
|
|
329
352
|
const seatsStatusChange = (status) => {
|
|
330
|
-
postMessageCommunicate('softphone-seats-status-change',
|
|
353
|
+
postMessageCommunicate('softphone-seats-status-change', {
|
|
354
|
+
status
|
|
355
|
+
})
|
|
331
356
|
}
|
|
332
357
|
|
|
333
358
|
const accept = () => {
|
|
@@ -343,6 +368,13 @@ const sendDtmf = () => {
|
|
|
343
368
|
postMessageCommunicate('softphone-send-dtmf')
|
|
344
369
|
}
|
|
345
370
|
|
|
371
|
+
const signOverdued = (data: {
|
|
372
|
+
sign: string
|
|
373
|
+
timestamp: string | number
|
|
374
|
+
}) => {
|
|
375
|
+
postMessageCommunicate('softphone-sign-overdued', data, 'auto', props.ancestorOrigin, 'ai-softphone')
|
|
376
|
+
}
|
|
377
|
+
|
|
346
378
|
defineExpose({
|
|
347
379
|
connect,
|
|
348
380
|
disconnect,
|
package/package/softphone.ts
CHANGED
|
@@ -72,6 +72,12 @@ export class SoftphoneManager {
|
|
|
72
72
|
softphoneIncomingCallBack: () => {console.log('softphone-incoming')},
|
|
73
73
|
softphoneSendDtmfCallBack: () => {console.log('softphone-send-dtmf')},
|
|
74
74
|
softphoneConnectRegisteredCallBack: () => {console.log('softphone-connect-registered')},
|
|
75
|
+
softphoneSignOverduedCallBack: (done) => {
|
|
76
|
+
done({
|
|
77
|
+
timestamp: undefined,
|
|
78
|
+
sign: undefined
|
|
79
|
+
})
|
|
80
|
+
},
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
|
|
@@ -115,6 +121,20 @@ export class SoftphoneManager {
|
|
|
115
121
|
return this.getContextDomElement(this.option.el!)?.querySelector(el) || this.getContextDomElement(el) || document.querySelector(el)
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
signOverdued = (data: {
|
|
125
|
+
sign: string
|
|
126
|
+
timestamp: string | number
|
|
127
|
+
}) => {
|
|
128
|
+
const iframe = this.getSoftphoneDomElement('.nf-softphone-iframe') as HTMLIFrameElement
|
|
129
|
+
iframe?.contentWindow?.postMessage(JSON.stringify({
|
|
130
|
+
origin: 'nf-softphone',
|
|
131
|
+
ancestorOrigin: this.option.ancestorOrigin,
|
|
132
|
+
destinationOrigin: 'ai-softphone',
|
|
133
|
+
type: 'softphone-sign-overdued',
|
|
134
|
+
data
|
|
135
|
+
}), '*')
|
|
136
|
+
}
|
|
137
|
+
|
|
118
138
|
handlingCommunication = (e: {data: `{
|
|
119
139
|
type: string,
|
|
120
140
|
ancestorOrigin: string,
|
|
@@ -158,6 +178,18 @@ export class SoftphoneManager {
|
|
|
158
178
|
this.option.softphoneSendDtmfCallBack?.(data)
|
|
159
179
|
} else if (data.type === 'softphone-connect-registered') {
|
|
160
180
|
this.option.softphoneConnectRegisteredCallBack?.(data)
|
|
181
|
+
} else if (data.type === 'softphone-sign-overdued') {
|
|
182
|
+
const done = (data) => {
|
|
183
|
+
const {
|
|
184
|
+
sign,
|
|
185
|
+
timestamp
|
|
186
|
+
} = data
|
|
187
|
+
this.signOverdued({
|
|
188
|
+
sign,
|
|
189
|
+
timestamp
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
this.option.softphoneSignOverduedCallBack?.(done)
|
|
161
193
|
}
|
|
162
194
|
}
|
|
163
195
|
}
|
package/package/type.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-softphone",
|
|
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
|
"vue-demi": "^0.14.5"
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"types": "lib/index.d.ts",
|
|
31
31
|
"main": "lib/nf-softphone.cjs.js",
|
|
32
32
|
"module": "lib/nf-softphone.esm-bundler.js",
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "fab708c9a9c54ca34e3fea3c92a4a378184da4b3"
|
|
34
34
|
}
|