@94ai/nf-softphone 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.
- package/lib/index.d.ts +158 -0
- package/lib/nf-softphone.cjs.js +131 -13
- package/lib/nf-softphone.esm-bundler.js +131 -13
- package/lib/nf-softphone.vue.d.ts +31 -0
- package/lib/softphone.d.ts +4 -0
- package/lib/type.d.ts +7 -0
- package/package/nf-softphone.vue +68 -9
- package/package/softphone.ts +55 -1
- package/package/type.ts +8 -0
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { PluginObject } from 'vue-demi';
|
|
2
2
|
import softphoneManager, { SoftphoneManager } from './softphone';
|
|
3
3
|
declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{}, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
4
|
+
sgGateway: {
|
|
5
|
+
type: import("vue-demi").PropType<string>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
sgBase: {
|
|
9
|
+
type: import("vue-demi").PropType<string>;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
sgOpen: {
|
|
13
|
+
type: import("vue-demi").PropType<string>;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
sgDomain: {
|
|
17
|
+
type: import("vue-demi").PropType<string>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
4
20
|
scrollingText: {
|
|
5
21
|
type: import("vue-demi").PropType<string>;
|
|
6
22
|
default: string;
|
|
@@ -43,6 +59,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
43
59
|
type: import("vue-demi").PropType<string>;
|
|
44
60
|
default: string;
|
|
45
61
|
};
|
|
62
|
+
timestamp: {
|
|
63
|
+
type: import("vue-demi").PropType<string | number>;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
sign: {
|
|
67
|
+
type: import("vue-demi").PropType<string>;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
46
70
|
origin: {
|
|
47
71
|
type: import("vue-demi").PropType<string>;
|
|
48
72
|
default: string;
|
|
@@ -88,6 +112,22 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
88
112
|
default: string;
|
|
89
113
|
};
|
|
90
114
|
}>>, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
115
|
+
sgGateway: {
|
|
116
|
+
type: import("vue-demi").PropType<string>;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
119
|
+
sgBase: {
|
|
120
|
+
type: import("vue-demi").PropType<string>;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
sgOpen: {
|
|
124
|
+
type: import("vue-demi").PropType<string>;
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
sgDomain: {
|
|
128
|
+
type: import("vue-demi").PropType<string>;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
91
131
|
scrollingText: {
|
|
92
132
|
type: import("vue-demi").PropType<string>;
|
|
93
133
|
default: string;
|
|
@@ -130,6 +170,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
130
170
|
type: import("vue-demi").PropType<string>;
|
|
131
171
|
default: string;
|
|
132
172
|
};
|
|
173
|
+
timestamp: {
|
|
174
|
+
type: import("vue-demi").PropType<string | number>;
|
|
175
|
+
default: undefined;
|
|
176
|
+
};
|
|
177
|
+
sign: {
|
|
178
|
+
type: import("vue-demi").PropType<string>;
|
|
179
|
+
default: undefined;
|
|
180
|
+
};
|
|
133
181
|
origin: {
|
|
134
182
|
type: import("vue-demi").PropType<string>;
|
|
135
183
|
default: string;
|
|
@@ -185,7 +233,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
185
233
|
"softphone-session-state-change": (event: any) => void;
|
|
186
234
|
"softphone-incoming": (event: any) => void;
|
|
187
235
|
"softphone-connect-registered": (event: any) => void;
|
|
236
|
+
"softphone-sign-overdued": (event: any) => void;
|
|
188
237
|
}, {
|
|
238
|
+
sgGateway: string;
|
|
239
|
+
sgBase: string;
|
|
240
|
+
sgOpen: string;
|
|
241
|
+
sgDomain: string;
|
|
189
242
|
scrollingText: string;
|
|
190
243
|
scrollview: string;
|
|
191
244
|
envMap: Partial<Record<import("./type").Env, string>>;
|
|
@@ -195,6 +248,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
195
248
|
appKey: string;
|
|
196
249
|
appSecret: string;
|
|
197
250
|
extStatus: string;
|
|
251
|
+
timestamp: string | number;
|
|
252
|
+
sign: string;
|
|
198
253
|
origin: string;
|
|
199
254
|
ancestorOrigin: string;
|
|
200
255
|
destinationOrigin: string;
|
|
@@ -207,6 +262,22 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
207
262
|
timingShow: "0" | "1";
|
|
208
263
|
signShow: "0" | "1";
|
|
209
264
|
}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
265
|
+
sgGateway: {
|
|
266
|
+
type: import("vue-demi").PropType<string>;
|
|
267
|
+
default: undefined;
|
|
268
|
+
};
|
|
269
|
+
sgBase: {
|
|
270
|
+
type: import("vue-demi").PropType<string>;
|
|
271
|
+
default: undefined;
|
|
272
|
+
};
|
|
273
|
+
sgOpen: {
|
|
274
|
+
type: import("vue-demi").PropType<string>;
|
|
275
|
+
default: undefined;
|
|
276
|
+
};
|
|
277
|
+
sgDomain: {
|
|
278
|
+
type: import("vue-demi").PropType<string>;
|
|
279
|
+
default: undefined;
|
|
280
|
+
};
|
|
210
281
|
scrollingText: {
|
|
211
282
|
type: import("vue-demi").PropType<string>;
|
|
212
283
|
default: string;
|
|
@@ -249,6 +320,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
249
320
|
type: import("vue-demi").PropType<string>;
|
|
250
321
|
default: string;
|
|
251
322
|
};
|
|
323
|
+
timestamp: {
|
|
324
|
+
type: import("vue-demi").PropType<string | number>;
|
|
325
|
+
default: undefined;
|
|
326
|
+
};
|
|
327
|
+
sign: {
|
|
328
|
+
type: import("vue-demi").PropType<string>;
|
|
329
|
+
default: undefined;
|
|
330
|
+
};
|
|
252
331
|
origin: {
|
|
253
332
|
type: import("vue-demi").PropType<string>;
|
|
254
333
|
default: string;
|
|
@@ -306,6 +385,22 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
306
385
|
container: import("vue-demi").Ref<any>;
|
|
307
386
|
containerScrolling: import("vue-demi").Ref<any>;
|
|
308
387
|
}> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
|
|
388
|
+
sgGateway: {
|
|
389
|
+
type: import("vue-demi").PropType<string>;
|
|
390
|
+
default: undefined;
|
|
391
|
+
};
|
|
392
|
+
sgBase: {
|
|
393
|
+
type: import("vue-demi").PropType<string>;
|
|
394
|
+
default: undefined;
|
|
395
|
+
};
|
|
396
|
+
sgOpen: {
|
|
397
|
+
type: import("vue-demi").PropType<string>;
|
|
398
|
+
default: undefined;
|
|
399
|
+
};
|
|
400
|
+
sgDomain: {
|
|
401
|
+
type: import("vue-demi").PropType<string>;
|
|
402
|
+
default: undefined;
|
|
403
|
+
};
|
|
309
404
|
scrollingText: {
|
|
310
405
|
type: import("vue-demi").PropType<string>;
|
|
311
406
|
default: string;
|
|
@@ -348,6 +443,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
348
443
|
type: import("vue-demi").PropType<string>;
|
|
349
444
|
default: string;
|
|
350
445
|
};
|
|
446
|
+
timestamp: {
|
|
447
|
+
type: import("vue-demi").PropType<string | number>;
|
|
448
|
+
default: undefined;
|
|
449
|
+
};
|
|
450
|
+
sign: {
|
|
451
|
+
type: import("vue-demi").PropType<string>;
|
|
452
|
+
default: undefined;
|
|
453
|
+
};
|
|
351
454
|
origin: {
|
|
352
455
|
type: import("vue-demi").PropType<string>;
|
|
353
456
|
default: string;
|
|
@@ -393,6 +496,22 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
393
496
|
default: string;
|
|
394
497
|
};
|
|
395
498
|
}>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
499
|
+
sgGateway: {
|
|
500
|
+
type: import("vue-demi").PropType<string>;
|
|
501
|
+
default: undefined;
|
|
502
|
+
};
|
|
503
|
+
sgBase: {
|
|
504
|
+
type: import("vue-demi").PropType<string>;
|
|
505
|
+
default: undefined;
|
|
506
|
+
};
|
|
507
|
+
sgOpen: {
|
|
508
|
+
type: import("vue-demi").PropType<string>;
|
|
509
|
+
default: undefined;
|
|
510
|
+
};
|
|
511
|
+
sgDomain: {
|
|
512
|
+
type: import("vue-demi").PropType<string>;
|
|
513
|
+
default: undefined;
|
|
514
|
+
};
|
|
396
515
|
scrollingText: {
|
|
397
516
|
type: import("vue-demi").PropType<string>;
|
|
398
517
|
default: string;
|
|
@@ -435,6 +554,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
435
554
|
type: import("vue-demi").PropType<string>;
|
|
436
555
|
default: string;
|
|
437
556
|
};
|
|
557
|
+
timestamp: {
|
|
558
|
+
type: import("vue-demi").PropType<string | number>;
|
|
559
|
+
default: undefined;
|
|
560
|
+
};
|
|
561
|
+
sign: {
|
|
562
|
+
type: import("vue-demi").PropType<string>;
|
|
563
|
+
default: undefined;
|
|
564
|
+
};
|
|
438
565
|
origin: {
|
|
439
566
|
type: import("vue-demi").PropType<string>;
|
|
440
567
|
default: string;
|
|
@@ -502,7 +629,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
502
629
|
"softphone-session-state-change": (event: any) => void;
|
|
503
630
|
"softphone-incoming": (event: any) => void;
|
|
504
631
|
"softphone-connect-registered": (event: any) => void;
|
|
632
|
+
"softphone-sign-overdued": (event: any) => void;
|
|
505
633
|
}, string, {
|
|
634
|
+
sgGateway: string;
|
|
635
|
+
sgBase: string;
|
|
636
|
+
sgOpen: string;
|
|
637
|
+
sgDomain: string;
|
|
506
638
|
scrollingText: string;
|
|
507
639
|
scrollview: string;
|
|
508
640
|
envMap: Partial<Record<import("./type").Env, string>>;
|
|
@@ -512,6 +644,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
512
644
|
appKey: string;
|
|
513
645
|
appSecret: string;
|
|
514
646
|
extStatus: string;
|
|
647
|
+
timestamp: string | number;
|
|
648
|
+
sign: string;
|
|
515
649
|
origin: string;
|
|
516
650
|
ancestorOrigin: string;
|
|
517
651
|
destinationOrigin: string;
|
|
@@ -525,6 +659,22 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
525
659
|
signShow: "0" | "1";
|
|
526
660
|
}> & {
|
|
527
661
|
props: {
|
|
662
|
+
sgGateway: {
|
|
663
|
+
type: import("vue-demi").PropType<string>;
|
|
664
|
+
default: undefined;
|
|
665
|
+
};
|
|
666
|
+
sgBase: {
|
|
667
|
+
type: import("vue-demi").PropType<string>;
|
|
668
|
+
default: undefined;
|
|
669
|
+
};
|
|
670
|
+
sgOpen: {
|
|
671
|
+
type: import("vue-demi").PropType<string>;
|
|
672
|
+
default: undefined;
|
|
673
|
+
};
|
|
674
|
+
sgDomain: {
|
|
675
|
+
type: import("vue-demi").PropType<string>;
|
|
676
|
+
default: undefined;
|
|
677
|
+
};
|
|
528
678
|
scrollingText: {
|
|
529
679
|
type: import("vue-demi").PropType<string>;
|
|
530
680
|
default: string;
|
|
@@ -567,6 +717,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
567
717
|
type: import("vue-demi").PropType<string>;
|
|
568
718
|
default: string;
|
|
569
719
|
};
|
|
720
|
+
timestamp: {
|
|
721
|
+
type: import("vue-demi").PropType<string | number>;
|
|
722
|
+
default: undefined;
|
|
723
|
+
};
|
|
724
|
+
sign: {
|
|
725
|
+
type: import("vue-demi").PropType<string>;
|
|
726
|
+
default: undefined;
|
|
727
|
+
};
|
|
570
728
|
origin: {
|
|
571
729
|
type: import("vue-demi").PropType<string>;
|
|
572
730
|
default: string;
|
package/lib/nf-softphone.cjs.js
CHANGED
|
@@ -7,6 +7,30 @@ const __sfc_main = vueDemi.defineComponent({
|
|
|
7
7
|
name: "nf-softphone"
|
|
8
8
|
});
|
|
9
9
|
__sfc_main.props = {
|
|
10
|
+
sgGateway: {
|
|
11
|
+
key: "sgGateway",
|
|
12
|
+
required: false,
|
|
13
|
+
type: String,
|
|
14
|
+
default: void 0
|
|
15
|
+
},
|
|
16
|
+
sgBase: {
|
|
17
|
+
key: "sgBase",
|
|
18
|
+
required: false,
|
|
19
|
+
type: String,
|
|
20
|
+
default: void 0
|
|
21
|
+
},
|
|
22
|
+
sgOpen: {
|
|
23
|
+
key: "sgOpen",
|
|
24
|
+
required: false,
|
|
25
|
+
type: String,
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
sgDomain: {
|
|
29
|
+
key: "sgDomain",
|
|
30
|
+
required: false,
|
|
31
|
+
type: String,
|
|
32
|
+
default: void 0
|
|
33
|
+
},
|
|
10
34
|
scrollingText: {
|
|
11
35
|
key: "scrollingText",
|
|
12
36
|
required: false,
|
|
@@ -67,6 +91,18 @@ __sfc_main.props = {
|
|
|
67
91
|
type: String,
|
|
68
92
|
default: "0"
|
|
69
93
|
},
|
|
94
|
+
timestamp: {
|
|
95
|
+
key: "timestamp",
|
|
96
|
+
required: false,
|
|
97
|
+
type: [String, Number],
|
|
98
|
+
default: void 0
|
|
99
|
+
},
|
|
100
|
+
sign: {
|
|
101
|
+
key: "sign",
|
|
102
|
+
required: false,
|
|
103
|
+
type: String,
|
|
104
|
+
default: void 0
|
|
105
|
+
},
|
|
70
106
|
origin: {
|
|
71
107
|
key: "origin",
|
|
72
108
|
required: false,
|
|
@@ -179,6 +215,18 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
179
215
|
emit("softphone-send-dtmf", data);
|
|
180
216
|
} else if (data.type === "softphone-connect-registered") {
|
|
181
217
|
emit("softphone-connect-registered", data);
|
|
218
|
+
} else if (data.type === "softphone-sign-overdued") {
|
|
219
|
+
const done = (data2) => {
|
|
220
|
+
const {
|
|
221
|
+
sign,
|
|
222
|
+
timestamp
|
|
223
|
+
} = data2;
|
|
224
|
+
signOverdued({
|
|
225
|
+
sign,
|
|
226
|
+
timestamp
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
emit("softphone-sign-overdued", done);
|
|
182
230
|
}
|
|
183
231
|
}
|
|
184
232
|
}
|
|
@@ -270,12 +318,25 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
270
318
|
muteShow,
|
|
271
319
|
logShow,
|
|
272
320
|
timingShow,
|
|
273
|
-
signShow
|
|
321
|
+
signShow,
|
|
322
|
+
sign,
|
|
323
|
+
timestamp,
|
|
324
|
+
sgGateway,
|
|
325
|
+
sgBase,
|
|
326
|
+
sgOpen,
|
|
327
|
+
sgDomain
|
|
274
328
|
} = props;
|
|
275
329
|
let url = `${(envMap == null ? void 0 : envMap[env]) ?? env}/#/?cross=1&open=1`;
|
|
330
|
+
url += sgGateway ? `&sgGateway=${sgGateway}` : "";
|
|
331
|
+
url += sgBase ? `&sgBase=${sgBase}` : "";
|
|
332
|
+
url += sgOpen ? `&sgOpen=${sgOpen}` : "";
|
|
333
|
+
url += sgDomain ? `&sgDomain=${sgDomain}` : "";
|
|
334
|
+
url += timestamp ? `×tamp=${timestamp}` : "";
|
|
335
|
+
url += sign ? `&sign=${sign}` : "";
|
|
276
336
|
url += agentTag ? `&agentTag=${agentTag}` : "";
|
|
277
337
|
url += agentId ? `&agentId=${agentId}` : "";
|
|
278
|
-
url += `&
|
|
338
|
+
url += appSecret ? `&appSecret=${appSecret}` : "";
|
|
339
|
+
url += `&appKey=${appKey}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px&ancestorOrigin=${ancestorOrigin}&destinationOrigin=${destinationOrigin}`;
|
|
279
340
|
url += `&callShow=${callShow}`;
|
|
280
341
|
url += `&transferToLaborShow=${transferToLaborShow}`;
|
|
281
342
|
url += `&restShow=${restShow}`;
|
|
@@ -301,27 +362,33 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
301
362
|
timer = void 0;
|
|
302
363
|
}
|
|
303
364
|
});
|
|
304
|
-
const postMessageCommunicate = (type,
|
|
365
|
+
const postMessageCommunicate = (type, data = {}, operationType = "manual", ancestorOrigin = props.ancestorOrigin, destinationOrigin = props.destinationOrigin) => {
|
|
305
366
|
var _a2;
|
|
306
367
|
(_a2 = iframeDom.value) == null ? void 0 : _a2.contentWindow.postMessage(JSON.stringify({
|
|
307
368
|
origin: "nf-softphone",
|
|
308
|
-
ancestorOrigin: props.ancestorOrigin,
|
|
309
|
-
destinationOrigin: props.destinationOrigin,
|
|
369
|
+
ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
|
|
370
|
+
destinationOrigin: destinationOrigin || props.destinationOrigin,
|
|
310
371
|
type,
|
|
311
372
|
data: {
|
|
312
|
-
|
|
313
|
-
type:
|
|
373
|
+
...data,
|
|
374
|
+
type: operationType
|
|
314
375
|
}
|
|
315
376
|
}), "*");
|
|
316
377
|
};
|
|
317
378
|
const connect = () => {
|
|
318
|
-
postMessageCommunicate("softphone-connect",
|
|
379
|
+
postMessageCommunicate("softphone-connect", {
|
|
380
|
+
status: true
|
|
381
|
+
});
|
|
319
382
|
};
|
|
320
383
|
const disconnect = () => {
|
|
321
|
-
postMessageCommunicate("softphone-connect",
|
|
384
|
+
postMessageCommunicate("softphone-connect", {
|
|
385
|
+
status: false
|
|
386
|
+
});
|
|
322
387
|
};
|
|
323
388
|
const seatsStatusChange = (status) => {
|
|
324
|
-
postMessageCommunicate("softphone-seats-status-change",
|
|
389
|
+
postMessageCommunicate("softphone-seats-status-change", {
|
|
390
|
+
status
|
|
391
|
+
});
|
|
325
392
|
};
|
|
326
393
|
const accept = () => {
|
|
327
394
|
postMessageCommunicate("softphone-accept");
|
|
@@ -335,6 +402,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
335
402
|
const sendDtmf = () => {
|
|
336
403
|
postMessageCommunicate("softphone-send-dtmf");
|
|
337
404
|
};
|
|
405
|
+
const signOverdued = (data) => {
|
|
406
|
+
postMessageCommunicate("softphone-sign-overdued", data, "auto", props.ancestorOrigin, "ai-softphone");
|
|
407
|
+
};
|
|
338
408
|
return Object.assign({
|
|
339
409
|
container,
|
|
340
410
|
iframeContainer,
|
|
@@ -411,6 +481,12 @@ class SoftphoneManager {
|
|
|
411
481
|
agentTag: void 0,
|
|
412
482
|
appKey: void 0,
|
|
413
483
|
appSecret: void 0,
|
|
484
|
+
sgGateway: void 0,
|
|
485
|
+
sgBase: void 0,
|
|
486
|
+
sgOpen: void 0,
|
|
487
|
+
sgDomain: void 0,
|
|
488
|
+
timestamp: void 0,
|
|
489
|
+
sign: void 0,
|
|
414
490
|
extStatus: "0",
|
|
415
491
|
callShow: "1",
|
|
416
492
|
transferToLaborShow: "1",
|
|
@@ -450,6 +526,12 @@ class SoftphoneManager {
|
|
|
450
526
|
},
|
|
451
527
|
softphoneConnectRegisteredCallBack: () => {
|
|
452
528
|
console.log("softphone-connect-registered");
|
|
529
|
+
},
|
|
530
|
+
softphoneSignOverduedCallBack: (done) => {
|
|
531
|
+
done({
|
|
532
|
+
timestamp: void 0,
|
|
533
|
+
sign: void 0
|
|
534
|
+
});
|
|
453
535
|
}
|
|
454
536
|
};
|
|
455
537
|
this.loadCssCode = (code) => {
|
|
@@ -480,8 +562,19 @@ class SoftphoneManager {
|
|
|
480
562
|
var _a;
|
|
481
563
|
return ((_a = this.getContextDomElement(this.option.el)) == null ? void 0 : _a.querySelector(el)) || this.getContextDomElement(el) || document.querySelector(el);
|
|
482
564
|
};
|
|
565
|
+
this.signOverdued = (data) => {
|
|
566
|
+
var _a;
|
|
567
|
+
const iframe = this.getSoftphoneDomElement(".nf-softphone-iframe");
|
|
568
|
+
(_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(JSON.stringify({
|
|
569
|
+
origin: "nf-softphone",
|
|
570
|
+
ancestorOrigin: this.option.ancestorOrigin,
|
|
571
|
+
destinationOrigin: "ai-softphone",
|
|
572
|
+
type: "softphone-sign-overdued",
|
|
573
|
+
data
|
|
574
|
+
}), "*");
|
|
575
|
+
};
|
|
483
576
|
this.handlingCommunication = (e) => {
|
|
484
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
577
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
485
578
|
const iframe = this.getSoftphoneDomElement(".nf-softphone-iframe");
|
|
486
579
|
if (iframe) {
|
|
487
580
|
let data = {};
|
|
@@ -519,6 +612,18 @@ class SoftphoneManager {
|
|
|
519
612
|
(_r = (_q = this.option).softphoneSendDtmfCallBack) == null ? void 0 : _r.call(_q, data);
|
|
520
613
|
} else if (data.type === "softphone-connect-registered") {
|
|
521
614
|
(_t = (_s = this.option).softphoneConnectRegisteredCallBack) == null ? void 0 : _t.call(_s, data);
|
|
615
|
+
} else if (data.type === "softphone-sign-overdued") {
|
|
616
|
+
const done = (data2) => {
|
|
617
|
+
const {
|
|
618
|
+
sign,
|
|
619
|
+
timestamp
|
|
620
|
+
} = data2;
|
|
621
|
+
this.signOverdued({
|
|
622
|
+
sign,
|
|
623
|
+
timestamp
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
(_v = (_u = this.option).softphoneSignOverduedCallBack) == null ? void 0 : _v.call(_u, done);
|
|
522
627
|
}
|
|
523
628
|
}
|
|
524
629
|
}
|
|
@@ -685,12 +790,25 @@ class SoftphoneManager {
|
|
|
685
790
|
muteShow,
|
|
686
791
|
logShow,
|
|
687
792
|
timingShow,
|
|
688
|
-
signShow
|
|
793
|
+
signShow,
|
|
794
|
+
sign,
|
|
795
|
+
timestamp,
|
|
796
|
+
sgGateway,
|
|
797
|
+
sgBase,
|
|
798
|
+
sgOpen,
|
|
799
|
+
sgDomain
|
|
689
800
|
} = this.option;
|
|
690
801
|
let url = `${(envMap == null ? void 0 : envMap[env]) ?? env}/#/?cross=1&open=1`;
|
|
691
802
|
url += agentTag ? `&agentTag=${agentTag}` : "";
|
|
692
803
|
url += agentId ? `&agentId=${agentId}` : "";
|
|
693
|
-
url += `&
|
|
804
|
+
url += appSecret ? `&appSecret=${appSecret}` : "";
|
|
805
|
+
url += sign ? `&sign=${sign}` : "";
|
|
806
|
+
url += timestamp ? `×tamp=${timestamp}` : "";
|
|
807
|
+
url += sgGateway ? `&sgGateway=${sgGateway}` : "";
|
|
808
|
+
url += sgBase ? `&sgBase=${sgBase}` : "";
|
|
809
|
+
url += sgOpen ? `&sgOpen=${sgOpen}` : "";
|
|
810
|
+
url += sgDomain ? `&sgDomain=${sgDomain}` : "";
|
|
811
|
+
url += `&appKey=${appKey}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px&ancestorOrigin=${ancestorOrigin}&destinationOrigin=${destinationOrigin}`;
|
|
694
812
|
url += `&callShow=${callShow}`;
|
|
695
813
|
url += `&transferToLaborShow=${transferToLaborShow}`;
|
|
696
814
|
url += `&restShow=${restShow}`;
|
|
@@ -5,6 +5,30 @@ const __sfc_main = defineComponent({
|
|
|
5
5
|
name: "nf-softphone"
|
|
6
6
|
});
|
|
7
7
|
__sfc_main.props = {
|
|
8
|
+
sgGateway: {
|
|
9
|
+
key: "sgGateway",
|
|
10
|
+
required: false,
|
|
11
|
+
type: String,
|
|
12
|
+
default: void 0
|
|
13
|
+
},
|
|
14
|
+
sgBase: {
|
|
15
|
+
key: "sgBase",
|
|
16
|
+
required: false,
|
|
17
|
+
type: String,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
sgOpen: {
|
|
21
|
+
key: "sgOpen",
|
|
22
|
+
required: false,
|
|
23
|
+
type: String,
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
sgDomain: {
|
|
27
|
+
key: "sgDomain",
|
|
28
|
+
required: false,
|
|
29
|
+
type: String,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
8
32
|
scrollingText: {
|
|
9
33
|
key: "scrollingText",
|
|
10
34
|
required: false,
|
|
@@ -65,6 +89,18 @@ __sfc_main.props = {
|
|
|
65
89
|
type: String,
|
|
66
90
|
default: "0"
|
|
67
91
|
},
|
|
92
|
+
timestamp: {
|
|
93
|
+
key: "timestamp",
|
|
94
|
+
required: false,
|
|
95
|
+
type: [String, Number],
|
|
96
|
+
default: void 0
|
|
97
|
+
},
|
|
98
|
+
sign: {
|
|
99
|
+
key: "sign",
|
|
100
|
+
required: false,
|
|
101
|
+
type: String,
|
|
102
|
+
default: void 0
|
|
103
|
+
},
|
|
68
104
|
origin: {
|
|
69
105
|
key: "origin",
|
|
70
106
|
required: false,
|
|
@@ -177,6 +213,18 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
177
213
|
emit("softphone-send-dtmf", data);
|
|
178
214
|
} else if (data.type === "softphone-connect-registered") {
|
|
179
215
|
emit("softphone-connect-registered", data);
|
|
216
|
+
} else if (data.type === "softphone-sign-overdued") {
|
|
217
|
+
const done = (data2) => {
|
|
218
|
+
const {
|
|
219
|
+
sign,
|
|
220
|
+
timestamp
|
|
221
|
+
} = data2;
|
|
222
|
+
signOverdued({
|
|
223
|
+
sign,
|
|
224
|
+
timestamp
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
emit("softphone-sign-overdued", done);
|
|
180
228
|
}
|
|
181
229
|
}
|
|
182
230
|
}
|
|
@@ -268,12 +316,25 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
268
316
|
muteShow,
|
|
269
317
|
logShow,
|
|
270
318
|
timingShow,
|
|
271
|
-
signShow
|
|
319
|
+
signShow,
|
|
320
|
+
sign,
|
|
321
|
+
timestamp,
|
|
322
|
+
sgGateway,
|
|
323
|
+
sgBase,
|
|
324
|
+
sgOpen,
|
|
325
|
+
sgDomain
|
|
272
326
|
} = props;
|
|
273
327
|
let url = `${(envMap == null ? void 0 : envMap[env]) ?? env}/#/?cross=1&open=1`;
|
|
328
|
+
url += sgGateway ? `&sgGateway=${sgGateway}` : "";
|
|
329
|
+
url += sgBase ? `&sgBase=${sgBase}` : "";
|
|
330
|
+
url += sgOpen ? `&sgOpen=${sgOpen}` : "";
|
|
331
|
+
url += sgDomain ? `&sgDomain=${sgDomain}` : "";
|
|
332
|
+
url += timestamp ? `×tamp=${timestamp}` : "";
|
|
333
|
+
url += sign ? `&sign=${sign}` : "";
|
|
274
334
|
url += agentTag ? `&agentTag=${agentTag}` : "";
|
|
275
335
|
url += agentId ? `&agentId=${agentId}` : "";
|
|
276
|
-
url += `&
|
|
336
|
+
url += appSecret ? `&appSecret=${appSecret}` : "";
|
|
337
|
+
url += `&appKey=${appKey}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px&ancestorOrigin=${ancestorOrigin}&destinationOrigin=${destinationOrigin}`;
|
|
277
338
|
url += `&callShow=${callShow}`;
|
|
278
339
|
url += `&transferToLaborShow=${transferToLaborShow}`;
|
|
279
340
|
url += `&restShow=${restShow}`;
|
|
@@ -299,27 +360,33 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
299
360
|
timer = void 0;
|
|
300
361
|
}
|
|
301
362
|
});
|
|
302
|
-
const postMessageCommunicate = (type,
|
|
363
|
+
const postMessageCommunicate = (type, data = {}, operationType = "manual", ancestorOrigin = props.ancestorOrigin, destinationOrigin = props.destinationOrigin) => {
|
|
303
364
|
var _a2;
|
|
304
365
|
(_a2 = iframeDom.value) == null ? void 0 : _a2.contentWindow.postMessage(JSON.stringify({
|
|
305
366
|
origin: "nf-softphone",
|
|
306
|
-
ancestorOrigin: props.ancestorOrigin,
|
|
307
|
-
destinationOrigin: props.destinationOrigin,
|
|
367
|
+
ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
|
|
368
|
+
destinationOrigin: destinationOrigin || props.destinationOrigin,
|
|
308
369
|
type,
|
|
309
370
|
data: {
|
|
310
|
-
|
|
311
|
-
type:
|
|
371
|
+
...data,
|
|
372
|
+
type: operationType
|
|
312
373
|
}
|
|
313
374
|
}), "*");
|
|
314
375
|
};
|
|
315
376
|
const connect = () => {
|
|
316
|
-
postMessageCommunicate("softphone-connect",
|
|
377
|
+
postMessageCommunicate("softphone-connect", {
|
|
378
|
+
status: true
|
|
379
|
+
});
|
|
317
380
|
};
|
|
318
381
|
const disconnect = () => {
|
|
319
|
-
postMessageCommunicate("softphone-connect",
|
|
382
|
+
postMessageCommunicate("softphone-connect", {
|
|
383
|
+
status: false
|
|
384
|
+
});
|
|
320
385
|
};
|
|
321
386
|
const seatsStatusChange = (status) => {
|
|
322
|
-
postMessageCommunicate("softphone-seats-status-change",
|
|
387
|
+
postMessageCommunicate("softphone-seats-status-change", {
|
|
388
|
+
status
|
|
389
|
+
});
|
|
323
390
|
};
|
|
324
391
|
const accept = () => {
|
|
325
392
|
postMessageCommunicate("softphone-accept");
|
|
@@ -333,6 +400,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
333
400
|
const sendDtmf = () => {
|
|
334
401
|
postMessageCommunicate("softphone-send-dtmf");
|
|
335
402
|
};
|
|
403
|
+
const signOverdued = (data) => {
|
|
404
|
+
postMessageCommunicate("softphone-sign-overdued", data, "auto", props.ancestorOrigin, "ai-softphone");
|
|
405
|
+
};
|
|
336
406
|
return Object.assign({
|
|
337
407
|
container,
|
|
338
408
|
iframeContainer,
|
|
@@ -409,6 +479,12 @@ class SoftphoneManager {
|
|
|
409
479
|
agentTag: void 0,
|
|
410
480
|
appKey: void 0,
|
|
411
481
|
appSecret: void 0,
|
|
482
|
+
sgGateway: void 0,
|
|
483
|
+
sgBase: void 0,
|
|
484
|
+
sgOpen: void 0,
|
|
485
|
+
sgDomain: void 0,
|
|
486
|
+
timestamp: void 0,
|
|
487
|
+
sign: void 0,
|
|
412
488
|
extStatus: "0",
|
|
413
489
|
callShow: "1",
|
|
414
490
|
transferToLaborShow: "1",
|
|
@@ -448,6 +524,12 @@ class SoftphoneManager {
|
|
|
448
524
|
},
|
|
449
525
|
softphoneConnectRegisteredCallBack: () => {
|
|
450
526
|
console.log("softphone-connect-registered");
|
|
527
|
+
},
|
|
528
|
+
softphoneSignOverduedCallBack: (done) => {
|
|
529
|
+
done({
|
|
530
|
+
timestamp: void 0,
|
|
531
|
+
sign: void 0
|
|
532
|
+
});
|
|
451
533
|
}
|
|
452
534
|
};
|
|
453
535
|
this.loadCssCode = (code) => {
|
|
@@ -478,8 +560,19 @@ class SoftphoneManager {
|
|
|
478
560
|
var _a;
|
|
479
561
|
return ((_a = this.getContextDomElement(this.option.el)) == null ? void 0 : _a.querySelector(el)) || this.getContextDomElement(el) || document.querySelector(el);
|
|
480
562
|
};
|
|
563
|
+
this.signOverdued = (data) => {
|
|
564
|
+
var _a;
|
|
565
|
+
const iframe = this.getSoftphoneDomElement(".nf-softphone-iframe");
|
|
566
|
+
(_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(JSON.stringify({
|
|
567
|
+
origin: "nf-softphone",
|
|
568
|
+
ancestorOrigin: this.option.ancestorOrigin,
|
|
569
|
+
destinationOrigin: "ai-softphone",
|
|
570
|
+
type: "softphone-sign-overdued",
|
|
571
|
+
data
|
|
572
|
+
}), "*");
|
|
573
|
+
};
|
|
481
574
|
this.handlingCommunication = (e) => {
|
|
482
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
575
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
483
576
|
const iframe = this.getSoftphoneDomElement(".nf-softphone-iframe");
|
|
484
577
|
if (iframe) {
|
|
485
578
|
let data = {};
|
|
@@ -517,6 +610,18 @@ class SoftphoneManager {
|
|
|
517
610
|
(_r = (_q = this.option).softphoneSendDtmfCallBack) == null ? void 0 : _r.call(_q, data);
|
|
518
611
|
} else if (data.type === "softphone-connect-registered") {
|
|
519
612
|
(_t = (_s = this.option).softphoneConnectRegisteredCallBack) == null ? void 0 : _t.call(_s, data);
|
|
613
|
+
} else if (data.type === "softphone-sign-overdued") {
|
|
614
|
+
const done = (data2) => {
|
|
615
|
+
const {
|
|
616
|
+
sign,
|
|
617
|
+
timestamp
|
|
618
|
+
} = data2;
|
|
619
|
+
this.signOverdued({
|
|
620
|
+
sign,
|
|
621
|
+
timestamp
|
|
622
|
+
});
|
|
623
|
+
};
|
|
624
|
+
(_v = (_u = this.option).softphoneSignOverduedCallBack) == null ? void 0 : _v.call(_u, done);
|
|
520
625
|
}
|
|
521
626
|
}
|
|
522
627
|
}
|
|
@@ -683,12 +788,25 @@ class SoftphoneManager {
|
|
|
683
788
|
muteShow,
|
|
684
789
|
logShow,
|
|
685
790
|
timingShow,
|
|
686
|
-
signShow
|
|
791
|
+
signShow,
|
|
792
|
+
sign,
|
|
793
|
+
timestamp,
|
|
794
|
+
sgGateway,
|
|
795
|
+
sgBase,
|
|
796
|
+
sgOpen,
|
|
797
|
+
sgDomain
|
|
687
798
|
} = this.option;
|
|
688
799
|
let url = `${(envMap == null ? void 0 : envMap[env]) ?? env}/#/?cross=1&open=1`;
|
|
689
800
|
url += agentTag ? `&agentTag=${agentTag}` : "";
|
|
690
801
|
url += agentId ? `&agentId=${agentId}` : "";
|
|
691
|
-
url += `&
|
|
802
|
+
url += appSecret ? `&appSecret=${appSecret}` : "";
|
|
803
|
+
url += sign ? `&sign=${sign}` : "";
|
|
804
|
+
url += timestamp ? `×tamp=${timestamp}` : "";
|
|
805
|
+
url += sgGateway ? `&sgGateway=${sgGateway}` : "";
|
|
806
|
+
url += sgBase ? `&sgBase=${sgBase}` : "";
|
|
807
|
+
url += sgOpen ? `&sgOpen=${sgOpen}` : "";
|
|
808
|
+
url += sgDomain ? `&sgDomain=${sgDomain}` : "";
|
|
809
|
+
url += `&appKey=${appKey}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px&ancestorOrigin=${ancestorOrigin}&destinationOrigin=${destinationOrigin}`;
|
|
692
810
|
url += `&callShow=${callShow}`;
|
|
693
811
|
url += `&transferToLaborShow=${transferToLaborShow}`;
|
|
694
812
|
url += `&restShow=${restShow}`;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Env } from './type';
|
|
2
2
|
declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
sgGateway?: string | undefined;
|
|
4
|
+
sgBase?: string | undefined;
|
|
5
|
+
sgOpen?: string | undefined;
|
|
6
|
+
sgDomain?: string | undefined;
|
|
3
7
|
scrollingText?: string | undefined;
|
|
4
8
|
scrollview?: string | undefined;
|
|
5
9
|
envMap?: Partial<Record<Env, string>> | undefined;
|
|
@@ -9,6 +13,8 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
9
13
|
appKey?: string | undefined;
|
|
10
14
|
appSecret?: string | undefined;
|
|
11
15
|
extStatus?: string | undefined;
|
|
16
|
+
timestamp?: string | number | undefined;
|
|
17
|
+
sign?: string | undefined;
|
|
12
18
|
origin?: string | undefined;
|
|
13
19
|
ancestorOrigin?: string | undefined;
|
|
14
20
|
destinationOrigin?: string | undefined;
|
|
@@ -31,10 +37,16 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
31
37
|
prod: string;
|
|
32
38
|
};
|
|
33
39
|
env: string;
|
|
40
|
+
sgGateway: undefined;
|
|
41
|
+
sgBase: undefined;
|
|
42
|
+
sgOpen: undefined;
|
|
43
|
+
sgDomain: undefined;
|
|
34
44
|
agentId: undefined;
|
|
35
45
|
agentTag: undefined;
|
|
36
46
|
appKey: undefined;
|
|
37
47
|
appSecret: undefined;
|
|
48
|
+
timestamp: undefined;
|
|
49
|
+
sign: undefined;
|
|
38
50
|
extStatus: string;
|
|
39
51
|
origin: string;
|
|
40
52
|
ancestorOrigin: string;
|
|
@@ -70,7 +82,12 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
70
82
|
"softphone-session-state-change": (event: any) => void;
|
|
71
83
|
"softphone-incoming": (event: any) => void;
|
|
72
84
|
"softphone-connect-registered": (event: any) => void;
|
|
85
|
+
"softphone-sign-overdued": (event: any) => void;
|
|
73
86
|
}, string, Readonly<import("vue-demi").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
87
|
+
sgGateway?: string | undefined;
|
|
88
|
+
sgBase?: string | undefined;
|
|
89
|
+
sgOpen?: string | undefined;
|
|
90
|
+
sgDomain?: string | undefined;
|
|
74
91
|
scrollingText?: string | undefined;
|
|
75
92
|
scrollview?: string | undefined;
|
|
76
93
|
envMap?: Partial<Record<Env, string>> | undefined;
|
|
@@ -80,6 +97,8 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
80
97
|
appKey?: string | undefined;
|
|
81
98
|
appSecret?: string | undefined;
|
|
82
99
|
extStatus?: string | undefined;
|
|
100
|
+
timestamp?: string | number | undefined;
|
|
101
|
+
sign?: string | undefined;
|
|
83
102
|
origin?: string | undefined;
|
|
84
103
|
ancestorOrigin?: string | undefined;
|
|
85
104
|
destinationOrigin?: string | undefined;
|
|
@@ -102,10 +121,16 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
102
121
|
prod: string;
|
|
103
122
|
};
|
|
104
123
|
env: string;
|
|
124
|
+
sgGateway: undefined;
|
|
125
|
+
sgBase: undefined;
|
|
126
|
+
sgOpen: undefined;
|
|
127
|
+
sgDomain: undefined;
|
|
105
128
|
agentId: undefined;
|
|
106
129
|
agentTag: undefined;
|
|
107
130
|
appKey: undefined;
|
|
108
131
|
appSecret: undefined;
|
|
132
|
+
timestamp: undefined;
|
|
133
|
+
sign: undefined;
|
|
109
134
|
extStatus: string;
|
|
110
135
|
origin: string;
|
|
111
136
|
ancestorOrigin: string;
|
|
@@ -119,6 +144,10 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
119
144
|
timingShow: string;
|
|
120
145
|
signShow: string;
|
|
121
146
|
}>>>, {
|
|
147
|
+
sgGateway: string;
|
|
148
|
+
sgBase: string;
|
|
149
|
+
sgOpen: string;
|
|
150
|
+
sgDomain: string;
|
|
122
151
|
scrollingText: string;
|
|
123
152
|
scrollview: string;
|
|
124
153
|
envMap: Partial<Record<Env, string>>;
|
|
@@ -128,6 +157,8 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
128
157
|
appKey: string;
|
|
129
158
|
appSecret: string;
|
|
130
159
|
extStatus: string;
|
|
160
|
+
timestamp: string | number;
|
|
161
|
+
sign: string;
|
|
131
162
|
origin: string;
|
|
132
163
|
ancestorOrigin: string;
|
|
133
164
|
destinationOrigin: string;
|
package/lib/softphone.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export declare class SoftphoneManager {
|
|
|
8
8
|
removeCssCode: () => void;
|
|
9
9
|
getContextDomElement: (el: string) => Element | null;
|
|
10
10
|
getSoftphoneDomElement: (el: string) => Element | null;
|
|
11
|
+
signOverdued: (data: {
|
|
12
|
+
sign: string;
|
|
13
|
+
timestamp: string | number;
|
|
14
|
+
}) => void;
|
|
11
15
|
handlingCommunication: (e: {
|
|
12
16
|
data: `{
|
|
13
17
|
type: string,
|
package/lib/type.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export declare type Option = {
|
|
|
12
12
|
agentId: string;
|
|
13
13
|
appKey: string;
|
|
14
14
|
appSecret: string;
|
|
15
|
+
timestamp: string | number;
|
|
16
|
+
sign: string;
|
|
17
|
+
sgGateway: string;
|
|
18
|
+
sgBase: string;
|
|
19
|
+
sgOpen: string;
|
|
20
|
+
sgDomain: string;
|
|
15
21
|
extStatus: '0' | '1';
|
|
16
22
|
instanceMap: Record<string, any>;
|
|
17
23
|
callShow: '0' | '1';
|
|
@@ -32,5 +38,6 @@ export declare type Option = {
|
|
|
32
38
|
softphoneIncomingCallBack: Function;
|
|
33
39
|
softphoneSendDtmfCallBack: Function;
|
|
34
40
|
softphoneConnectRegisteredCallBack: Function;
|
|
41
|
+
softphoneSignOverduedCallBack: Function;
|
|
35
42
|
};
|
|
36
43
|
export declare type Env = 'test' | 'dev' | 'sg' | 'gray' | 'prod';
|
package/package/nf-softphone.vue
CHANGED
|
@@ -36,6 +36,11 @@ import {
|
|
|
36
36
|
import { debounce } from '@94ai/common-utils'
|
|
37
37
|
|
|
38
38
|
const props = withDefaults(defineProps<{
|
|
39
|
+
sgGateway?: string,
|
|
40
|
+
sgBase?: string,
|
|
41
|
+
sgOpen?: string,
|
|
42
|
+
sgDomain?: string,
|
|
43
|
+
|
|
39
44
|
scrollingText?: string,
|
|
40
45
|
scrollview?: string,
|
|
41
46
|
|
|
@@ -47,6 +52,8 @@ const props = withDefaults(defineProps<{
|
|
|
47
52
|
appKey?: string,
|
|
48
53
|
appSecret?: string,
|
|
49
54
|
extStatus?: string,
|
|
55
|
+
timestamp?: string | number,
|
|
56
|
+
sign?: string,
|
|
50
57
|
|
|
51
58
|
origin?: string,
|
|
52
59
|
ancestorOrigin?: string,
|
|
@@ -73,10 +80,17 @@ const props = withDefaults(defineProps<{
|
|
|
73
80
|
}),
|
|
74
81
|
env: 'prod',
|
|
75
82
|
|
|
83
|
+
sgGateway: undefined,
|
|
84
|
+
sgBase: undefined,
|
|
85
|
+
sgOpen: undefined,
|
|
86
|
+
sgDomain: undefined,
|
|
87
|
+
|
|
76
88
|
agentId: undefined,
|
|
77
89
|
agentTag: undefined,
|
|
78
90
|
appKey: undefined,
|
|
79
91
|
appSecret: undefined,
|
|
92
|
+
timestamp: undefined,
|
|
93
|
+
sign: undefined,
|
|
80
94
|
extStatus: '0',
|
|
81
95
|
|
|
82
96
|
origin: 'ai-softphone',
|
|
@@ -104,6 +118,7 @@ const emit = defineEmits<{
|
|
|
104
118
|
(e: 'softphone-session-state-change', event: any): void
|
|
105
119
|
(e: 'softphone-incoming', event: any): void
|
|
106
120
|
(e: 'softphone-connect-registered', event: any): void
|
|
121
|
+
(e: 'softphone-sign-overdued', event: any): void
|
|
107
122
|
}>()
|
|
108
123
|
|
|
109
124
|
const container = ref()
|
|
@@ -154,6 +169,18 @@ const handlingCommunication = (e: {data: `{
|
|
|
154
169
|
emit('softphone-send-dtmf', data)
|
|
155
170
|
} else if (data.type === 'softphone-connect-registered') {
|
|
156
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)
|
|
157
184
|
}
|
|
158
185
|
}
|
|
159
186
|
}
|
|
@@ -247,11 +274,24 @@ onMounted(async () => {
|
|
|
247
274
|
logShow,
|
|
248
275
|
timingShow,
|
|
249
276
|
signShow,
|
|
277
|
+
sign,
|
|
278
|
+
timestamp,
|
|
279
|
+
sgGateway,
|
|
280
|
+
sgBase,
|
|
281
|
+
sgOpen,
|
|
282
|
+
sgDomain,
|
|
250
283
|
} = props
|
|
251
284
|
let url = `${ envMap?.[env!] ?? env }/#/?cross=1&open=1`
|
|
285
|
+
url += sgGateway ? `&sgGateway=${sgGateway}` : ''
|
|
286
|
+
url += sgBase ? `&sgBase=${sgBase}` : ''
|
|
287
|
+
url += sgOpen ? `&sgOpen=${sgOpen}` : ''
|
|
288
|
+
url += sgDomain ? `&sgDomain=${sgDomain}` : ''
|
|
289
|
+
url += timestamp ? `×tamp=${timestamp}` : ''
|
|
290
|
+
url += sign ? `&sign=${sign}` : ''
|
|
252
291
|
url += agentTag ? `&agentTag=${agentTag}` : ''
|
|
253
292
|
url += agentId ? `&agentId=${agentId}` : ''
|
|
254
|
-
url += `&
|
|
293
|
+
url += appSecret ? `&appSecret=${appSecret}` : ''
|
|
294
|
+
url += `&appKey=${appKey}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px&ancestorOrigin=${ancestorOrigin}&destinationOrigin=${destinationOrigin}`
|
|
255
295
|
url += `&callShow=${callShow}`
|
|
256
296
|
url += `&transferToLaborShow=${transferToLaborShow}`
|
|
257
297
|
url += `&restShow=${restShow}`
|
|
@@ -278,29 +318,41 @@ onUnmounted(() => {
|
|
|
278
318
|
}
|
|
279
319
|
})
|
|
280
320
|
|
|
281
|
-
const postMessageCommunicate = (
|
|
321
|
+
const postMessageCommunicate = (
|
|
322
|
+
type,
|
|
323
|
+
data: Record<string, any> = {},
|
|
324
|
+
operationType = 'manual',
|
|
325
|
+
ancestorOrigin = props.ancestorOrigin,
|
|
326
|
+
destinationOrigin = props.destinationOrigin
|
|
327
|
+
) => {
|
|
282
328
|
iframeDom.value?.contentWindow.postMessage(JSON.stringify({
|
|
283
329
|
origin: 'nf-softphone',
|
|
284
|
-
ancestorOrigin: props.ancestorOrigin,
|
|
285
|
-
destinationOrigin: props.destinationOrigin,
|
|
330
|
+
ancestorOrigin: ancestorOrigin || props.ancestorOrigin,
|
|
331
|
+
destinationOrigin: destinationOrigin || props.destinationOrigin,
|
|
286
332
|
type,
|
|
287
333
|
data: {
|
|
288
|
-
|
|
289
|
-
type:
|
|
334
|
+
...data,
|
|
335
|
+
type: operationType
|
|
290
336
|
}
|
|
291
337
|
}), '*')
|
|
292
338
|
}
|
|
293
339
|
const connect = () => {
|
|
294
|
-
postMessageCommunicate('softphone-connect',
|
|
340
|
+
postMessageCommunicate('softphone-connect', {
|
|
341
|
+
status: true
|
|
342
|
+
})
|
|
295
343
|
}
|
|
296
344
|
|
|
297
345
|
|
|
298
346
|
const disconnect = () => {
|
|
299
|
-
postMessageCommunicate('softphone-connect',
|
|
347
|
+
postMessageCommunicate('softphone-connect', {
|
|
348
|
+
status: false
|
|
349
|
+
})
|
|
300
350
|
}
|
|
301
351
|
|
|
302
352
|
const seatsStatusChange = (status) => {
|
|
303
|
-
postMessageCommunicate('softphone-seats-status-change',
|
|
353
|
+
postMessageCommunicate('softphone-seats-status-change', {
|
|
354
|
+
status
|
|
355
|
+
})
|
|
304
356
|
}
|
|
305
357
|
|
|
306
358
|
const accept = () => {
|
|
@@ -316,6 +368,13 @@ const sendDtmf = () => {
|
|
|
316
368
|
postMessageCommunicate('softphone-send-dtmf')
|
|
317
369
|
}
|
|
318
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
|
+
|
|
319
378
|
defineExpose({
|
|
320
379
|
connect,
|
|
321
380
|
disconnect,
|
package/package/softphone.ts
CHANGED
|
@@ -40,6 +40,15 @@ export class SoftphoneManager {
|
|
|
40
40
|
agentTag: undefined,
|
|
41
41
|
appKey: undefined,
|
|
42
42
|
appSecret: undefined,
|
|
43
|
+
|
|
44
|
+
sgGateway: undefined,
|
|
45
|
+
sgBase: undefined,
|
|
46
|
+
sgOpen: undefined,
|
|
47
|
+
sgDomain: undefined,
|
|
48
|
+
|
|
49
|
+
timestamp: undefined,
|
|
50
|
+
sign: undefined,
|
|
51
|
+
|
|
43
52
|
extStatus: '0',
|
|
44
53
|
|
|
45
54
|
callShow: '1',
|
|
@@ -63,6 +72,12 @@ export class SoftphoneManager {
|
|
|
63
72
|
softphoneIncomingCallBack: () => {console.log('softphone-incoming')},
|
|
64
73
|
softphoneSendDtmfCallBack: () => {console.log('softphone-send-dtmf')},
|
|
65
74
|
softphoneConnectRegisteredCallBack: () => {console.log('softphone-connect-registered')},
|
|
75
|
+
softphoneSignOverduedCallBack: (done) => {
|
|
76
|
+
done({
|
|
77
|
+
timestamp: undefined,
|
|
78
|
+
sign: undefined
|
|
79
|
+
})
|
|
80
|
+
},
|
|
66
81
|
}
|
|
67
82
|
|
|
68
83
|
|
|
@@ -106,6 +121,20 @@ export class SoftphoneManager {
|
|
|
106
121
|
return this.getContextDomElement(this.option.el!)?.querySelector(el) || this.getContextDomElement(el) || document.querySelector(el)
|
|
107
122
|
}
|
|
108
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
|
+
|
|
109
138
|
handlingCommunication = (e: {data: `{
|
|
110
139
|
type: string,
|
|
111
140
|
ancestorOrigin: string,
|
|
@@ -149,6 +178,18 @@ export class SoftphoneManager {
|
|
|
149
178
|
this.option.softphoneSendDtmfCallBack?.(data)
|
|
150
179
|
} else if (data.type === 'softphone-connect-registered') {
|
|
151
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)
|
|
152
193
|
}
|
|
153
194
|
}
|
|
154
195
|
}
|
|
@@ -342,11 +383,24 @@ export class SoftphoneManager {
|
|
|
342
383
|
logShow,
|
|
343
384
|
timingShow,
|
|
344
385
|
signShow,
|
|
386
|
+
sign,
|
|
387
|
+
timestamp,
|
|
388
|
+
sgGateway,
|
|
389
|
+
sgBase,
|
|
390
|
+
sgOpen,
|
|
391
|
+
sgDomain,
|
|
345
392
|
} = this.option
|
|
346
393
|
let url = `${ envMap?.[env!] ?? env }/#/?cross=1&open=1`
|
|
347
394
|
url += agentTag ? `&agentTag=${agentTag}` : ''
|
|
348
395
|
url += agentId ? `&agentId=${agentId}` : ''
|
|
349
|
-
url += `&
|
|
396
|
+
url += appSecret ? `&appSecret=${appSecret}` : ''
|
|
397
|
+
url += sign ? `&sign=${sign}` : ''
|
|
398
|
+
url += timestamp ? `×tamp=${timestamp}` : ''
|
|
399
|
+
url += sgGateway ? `&sgGateway=${sgGateway}` : ''
|
|
400
|
+
url += sgBase ? `&sgBase=${sgBase}` : ''
|
|
401
|
+
url += sgOpen ? `&sgOpen=${sgOpen}` : ''
|
|
402
|
+
url += sgDomain ? `&sgDomain=${sgDomain}` : ''
|
|
403
|
+
url += `&appKey=${appKey}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px&ancestorOrigin=${ancestorOrigin}&destinationOrigin=${destinationOrigin}`
|
|
350
404
|
url += `&callShow=${callShow}`
|
|
351
405
|
url += `&transferToLaborShow=${transferToLaborShow}`
|
|
352
406
|
url += `&restShow=${restShow}`
|
package/package/type.ts
CHANGED
|
@@ -12,6 +12,13 @@ export type Option = {
|
|
|
12
12
|
agentId: string
|
|
13
13
|
appKey: string
|
|
14
14
|
appSecret: string
|
|
15
|
+
timestamp: string | number
|
|
16
|
+
sign: string
|
|
17
|
+
sgGateway: string
|
|
18
|
+
sgBase: string
|
|
19
|
+
sgOpen: string
|
|
20
|
+
sgDomain: string
|
|
21
|
+
|
|
15
22
|
extStatus: '0' | '1'
|
|
16
23
|
instanceMap: Record<string, any>,
|
|
17
24
|
|
|
@@ -34,6 +41,7 @@ export type Option = {
|
|
|
34
41
|
softphoneIncomingCallBack: Function
|
|
35
42
|
softphoneSendDtmfCallBack: Function
|
|
36
43
|
softphoneConnectRegisteredCallBack: Function
|
|
44
|
+
softphoneSignOverduedCallBack: Function
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-softphone",
|
|
3
|
-
"version": "
|
|
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": "^
|
|
17
|
+
"@94ai/nf-theme-chalk": "^8.0.1",
|
|
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": "316144e9cd2a06b10e14476d5fdc7f1d42fa88c6"
|
|
34
34
|
}
|