@94ai/nf-softphone 3.3.17

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.
@@ -0,0 +1,566 @@
1
+ import { defineComponent, ref, getCurrentInstance, onMounted, onUnmounted } from "vue-demi";
2
+ import { debounce, generateUUID } from "@94ai/common-utils";
3
+ import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
4
+ const __sfc_main = defineComponent({
5
+ name: "nf-softphone"
6
+ });
7
+ __sfc_main.props = {
8
+ scrollview: {
9
+ key: "scrollview",
10
+ required: false,
11
+ type: String,
12
+ default: void 0
13
+ },
14
+ envMap: {
15
+ key: "envMap",
16
+ required: false,
17
+ type: Object,
18
+ default: () => ({
19
+ test: "http://softphone.test.k8s.com",
20
+ dev: "http://softphone.dev.k8s.com",
21
+ sg: "https://seatsg.94ai.com",
22
+ gray: "http://softphone.gray.94ai.com",
23
+ prod: "https://seat.94ai.com"
24
+ })
25
+ },
26
+ env: {
27
+ key: "env",
28
+ required: false,
29
+ type: null,
30
+ default: "test"
31
+ },
32
+ selector: {
33
+ key: "selector",
34
+ required: false,
35
+ type: String,
36
+ default: void 0
37
+ },
38
+ el: {
39
+ key: "el",
40
+ required: false,
41
+ type: String
42
+ },
43
+ agentId: {
44
+ key: "agentId",
45
+ required: false,
46
+ type: String,
47
+ default: void 0
48
+ },
49
+ agentTag: {
50
+ key: "agentTag",
51
+ required: false,
52
+ type: String,
53
+ default: void 0
54
+ },
55
+ appKey: {
56
+ key: "appKey",
57
+ required: false,
58
+ type: String,
59
+ default: void 0
60
+ },
61
+ appSecret: {
62
+ key: "appSecret",
63
+ required: false,
64
+ type: String,
65
+ default: void 0
66
+ },
67
+ extStatus: {
68
+ key: "extStatus",
69
+ required: false,
70
+ type: String,
71
+ default: "0"
72
+ },
73
+ origin: {
74
+ key: "origin",
75
+ required: false,
76
+ type: String,
77
+ default: "nf-softphone"
78
+ },
79
+ ancestorOrigin: {
80
+ key: "ancestorOrigin",
81
+ required: false,
82
+ type: String,
83
+ default: "nf-softphone"
84
+ }
85
+ };
86
+ __sfc_main.setup = (__props, __ctx) => {
87
+ var _a;
88
+ const props = __props;
89
+ const emit = __ctx.emit;
90
+ const container = ref();
91
+ const iframeContainer = ref();
92
+ const iframe2 = ref();
93
+ const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
94
+ const getContextDomElement = (el) => {
95
+ const parent = (instance == null ? void 0 : instance.$el) || document;
96
+ return (props.selector ? parent.querySelector(props.selector) ?? document.querySelector(props.selector) ?? parent : parent).querySelector(el);
97
+ };
98
+ const handlingCommunication = (e) => {
99
+ const iframe3 = getContextDomElement(".nf-softphone-iframe");
100
+ if (iframe3) {
101
+ let data = {};
102
+ try {
103
+ data = JSON.parse(e.data);
104
+ } catch (e2) {
105
+ }
106
+ if (data.type === "softphone-expand") {
107
+ if (data.data === "expand") {
108
+ iframe3.setAttribute("style", "position: fixed;z-index:999;");
109
+ } else if (data.data === "shrink") {
110
+ iframe3.removeAttribute("style");
111
+ }
112
+ return;
113
+ }
114
+ if (data.origin === "ai-softphone") {
115
+ if (data.type === "softphone-connect") {
116
+ emit("softphone-connect", data);
117
+ } else if (data.type === "softphone-call-refresh") {
118
+ emit("softphone-call-refresh", data);
119
+ } else if (data.type === "softphone-seats-status-change") {
120
+ emit("softphone-seats-status-change", data);
121
+ } else if (data.type === "softphone-accept") {
122
+ emit("softphone-accept", data);
123
+ } else if (data.type === "softphone-ignore") {
124
+ emit("softphone-ignore", data);
125
+ } else if (data.type === "softphone-hangup") {
126
+ emit("softphone-hangup", data);
127
+ } else if (data.type === "softphone-session-state-change") {
128
+ emit("softphone-session-state-change", data);
129
+ } else if (data.type === "softphone-incoming") {
130
+ emit("softphone-incoming", data);
131
+ } else if (data.type === "softphone-send-dtmf") {
132
+ emit("softphone-send-dtmf", data);
133
+ } else if (data.type === "softphone-connect-registered") {
134
+ emit("softphone-connect-registered", data);
135
+ }
136
+ }
137
+ }
138
+ };
139
+ let timer;
140
+ const refreshStyle = async () => {
141
+ clearTimeout(timer);
142
+ timer = void 0;
143
+ const containerStyle = container.value.getAttribute("style");
144
+ const iframeContainerStyle = iframeContainer.value.getAttribute("style");
145
+ container.value.removeAttribute("style");
146
+ iframeContainer.value.removeAttribute("style");
147
+ const leftMargin = getComputedStyle(container.value).marginLeft;
148
+ const top = container.value.getBoundingClientRect().top;
149
+ if (top <= 0) {
150
+ container.value.setAttribute("style", containerStyle);
151
+ iframeContainer.value.setAttribute("style", iframeContainerStyle);
152
+ return {
153
+ top: 0,
154
+ left: 0
155
+ };
156
+ }
157
+ const left = container.value.getBoundingClientRect().left;
158
+ if (left <= 0) {
159
+ container.value.setAttribute("style", containerStyle);
160
+ iframeContainer.value.setAttribute("style", iframeContainerStyle);
161
+ return {
162
+ top: 0,
163
+ left: 0
164
+ };
165
+ }
166
+ container.value.setAttribute("style", `margin-top:${top}px;margin-left:${leftMargin};margin-bottom:${top}px;`);
167
+ iframeContainer.value.setAttribute("style", `margin-top:-${2 * top}px;margin-left:-${left}px;`);
168
+ timer = setTimeout(() => {
169
+ clearTimeout(timer);
170
+ timer = void 0;
171
+ containerScrolling.value = false;
172
+ }, 100);
173
+ return {
174
+ leftMargin,
175
+ top,
176
+ left
177
+ };
178
+ };
179
+ const containerScrolling = ref();
180
+ const handlingScrollTransparent = () => {
181
+ containerScrolling.value = true;
182
+ };
183
+ const handlingScroll = debounce(async () => {
184
+ var _a2;
185
+ const {
186
+ top,
187
+ left
188
+ } = await refreshStyle() || {};
189
+ if (top && left) {
190
+ (_a2 = iframe2.value) == null ? void 0 : _a2.contentWindow.postMessage(JSON.stringify({
191
+ type: "softphone-scroll",
192
+ origin: props.origin,
193
+ ancestorOrigin: props.ancestorOrigin,
194
+ data: {
195
+ paddingTop: top + "px"
196
+ }
197
+ }), "*");
198
+ }
199
+ }, 500, false);
200
+ onMounted(async () => {
201
+ var _a2, _b;
202
+ const {
203
+ top,
204
+ left
205
+ } = await refreshStyle();
206
+ const {
207
+ envMap,
208
+ env,
209
+ agentTag,
210
+ agentId,
211
+ appSecret,
212
+ extStatus,
213
+ appKey
214
+ } = props;
215
+ let url = `${(envMap == null ? void 0 : envMap[env]) ?? env}/#/?cross=1&open=1`;
216
+ url += agentTag ? `&agentTag=${agentTag}` : "";
217
+ url += agentId ? `&agentId=${agentId}` : "";
218
+ url += `&appKey=${appKey}&appSecret=${appSecret}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px`;
219
+ iframe2.value.src = url;
220
+ window.addEventListener("message", handlingCommunication, false);
221
+ if (props.scrollview) {
222
+ (_a2 = document.querySelector(props.scrollview)) == null ? void 0 : _a2.addEventListener("scroll", handlingScroll);
223
+ (_b = document.querySelector(props.scrollview)) == null ? void 0 : _b.addEventListener("scroll", handlingScrollTransparent);
224
+ }
225
+ });
226
+ onUnmounted(() => {
227
+ var _a2, _b;
228
+ window.removeEventListener("message", handlingCommunication, false);
229
+ if (props.scrollview) {
230
+ (_a2 = document.querySelector(props.scrollview)) == null ? void 0 : _a2.removeEventListener("scroll", handlingScroll);
231
+ (_b = document.querySelector(props.scrollview)) == null ? void 0 : _b.removeEventListener("scroll", handlingScrollTransparent);
232
+ }
233
+ });
234
+ const postMessageCommunicate = (type, status) => {
235
+ var _a2;
236
+ (_a2 = iframe2.value) == null ? void 0 : _a2.contentWindow.postMessage(JSON.stringify({
237
+ origin: props.origin,
238
+ ancestorOrigin: props.ancestorOrigin,
239
+ type,
240
+ data: {
241
+ status,
242
+ type: "manual"
243
+ }
244
+ }), "*");
245
+ };
246
+ const connect = () => {
247
+ postMessageCommunicate("softphone-connect", true);
248
+ };
249
+ const disconnect = () => {
250
+ postMessageCommunicate("softphone-connect", false);
251
+ };
252
+ const seatsStatusChange = (status) => {
253
+ postMessageCommunicate("softphone-seats-status-change", status);
254
+ };
255
+ const accept = () => {
256
+ postMessageCommunicate("softphone-accept");
257
+ };
258
+ const ignore = () => {
259
+ postMessageCommunicate("softphone-ignore");
260
+ };
261
+ const hangup = () => {
262
+ postMessageCommunicate("softphone-hangup");
263
+ };
264
+ const sendDtmf = () => {
265
+ postMessageCommunicate("softphone-send-dtmf");
266
+ };
267
+ return Object.assign({
268
+ container,
269
+ iframeContainer,
270
+ iframe: iframe2,
271
+ containerScrolling
272
+ }, {
273
+ connect,
274
+ disconnect,
275
+ seatsStatusChange,
276
+ accept,
277
+ ignore,
278
+ hangup,
279
+ sendDtmf,
280
+ iframe: iframe2,
281
+ containerScrolling
282
+ });
283
+ };
284
+ __sfc_main.components = Object.assign({
285
+ iframe
286
+ }, __sfc_main.components);
287
+ var _sfc_render = function render() {
288
+ var _vm = this, _c = _vm._self._c;
289
+ _vm._self._setupProxy;
290
+ return _c("div", {
291
+ staticClass: "nf-softphone"
292
+ }, [_c("div", {
293
+ ref: "container",
294
+ staticClass: "nf-softphone-container",
295
+ class: {
296
+ "nf-transparent": _vm.containerScrolling === true
297
+ }
298
+ }, [_c("div", {
299
+ ref: "iframeContainer",
300
+ staticClass: "nf-softphone-iframe-container"
301
+ }, [_c("iframe", {
302
+ ref: "iframe",
303
+ staticClass: "nf-softphone-iframe",
304
+ attrs: {
305
+ "src": "",
306
+ "frameborder": "0",
307
+ "scrolling": "no",
308
+ "allow": "camera *; microphone *"
309
+ }
310
+ })])]), _c("div", {
311
+ class: {
312
+ "nf-softphone-text": true
313
+ },
314
+ style: {
315
+ "display": _vm.containerScrolling === true ? "block" : "none"
316
+ }
317
+ }, [_vm._v("正在滚动中...")])]);
318
+ };
319
+ var _sfc_staticRenderFns = [];
320
+ var __component__ = /* @__PURE__ */ normalizeComponent(__sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
321
+ const NfSoftphone = __component__.exports;
322
+ class SoftphoneManager {
323
+ constructor() {
324
+ this.option = {
325
+ origin: "nf-softphone",
326
+ ancestorOrigin: "nf-softphone",
327
+ envMap: {
328
+ test: "http://softphone.test.k8s.com",
329
+ dev: "http://softphone.dev.k8s.com",
330
+ sg: "https://seatsg.94ai.com",
331
+ gray: "http://softphone.gray.94ai.com",
332
+ prod: "https://seat.94ai.com"
333
+ },
334
+ env: "test",
335
+ selector: void 0,
336
+ el: void 0,
337
+ agentId: void 0,
338
+ agentTag: void 0,
339
+ appKey: void 0,
340
+ appSecret: void 0,
341
+ extStatus: "0",
342
+ instanceMap: {},
343
+ softphoneConnectCallBack: () => {
344
+ console.log("softphone-connect");
345
+ },
346
+ softphoneCallRefreshCallBack: () => {
347
+ console.log("softphone-call-refresh");
348
+ },
349
+ softphoneSeatStatusChangeCallBack: () => {
350
+ console.log("softphone-seats-status-change");
351
+ },
352
+ softphoneAcceptCallBack: () => {
353
+ console.log("softphone-accept");
354
+ },
355
+ softphoneIgnoreCallBack: () => {
356
+ console.log("softphone-ignore");
357
+ },
358
+ softphoneHangupCallBack: () => {
359
+ console.log("softphone-hangup");
360
+ },
361
+ softphoneSessionStateChangeCallBack: () => {
362
+ console.log("softphone-session-state-change");
363
+ },
364
+ softphoneIncomingCallBack: () => {
365
+ console.log("softphone-incoming");
366
+ },
367
+ softphoneSendDtmfCallBack: () => {
368
+ console.log("softphone-send-dtmf");
369
+ },
370
+ softphoneConnectRegisteredCallBack: () => {
371
+ console.log("softphone-connect-registered");
372
+ }
373
+ };
374
+ this.loadCssCode = (code) => {
375
+ if (!document.getElementById("nf-softphone")) {
376
+ const style = document.createElement("style");
377
+ style.id = "nf-softphone";
378
+ style.type = "text/css";
379
+ style.rel = "stylesheet";
380
+ style.appendChild(document.createTextNode(code));
381
+ const head = document.getElementsByTagName("head")[0];
382
+ head.appendChild(style);
383
+ }
384
+ };
385
+ this.removeCssCode = () => {
386
+ const css = document.getElementById("nf-softphone");
387
+ if (css) {
388
+ if (css.parentNode) {
389
+ css.parentNode.removeChild(css);
390
+ }
391
+ }
392
+ };
393
+ this.getContextDomElement = (el) => {
394
+ return (this.option.selector ? document.querySelector(this.option.selector) ?? document : document).querySelector(el);
395
+ };
396
+ this.handlingCommunication = (e) => {
397
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
398
+ const iframe2 = this.getContextDomElement(".nf-softphone-iframe");
399
+ if (iframe2) {
400
+ let data = {};
401
+ try {
402
+ data = JSON.parse(e.data);
403
+ } catch (e2) {
404
+ }
405
+ if (data.type === "softphone-expand") {
406
+ if (data.data === "expand") {
407
+ iframe2.setAttribute("style", "position: fixed;z-index:999;");
408
+ } else if (data.data === "shrink") {
409
+ iframe2.removeAttribute("style");
410
+ }
411
+ return;
412
+ }
413
+ if (data.origin === "ai-softphone") {
414
+ if (data.type === "softphone-connect") {
415
+ (_b = (_a = this.option).softphoneConnectCallBack) == null ? void 0 : _b.call(_a, data);
416
+ } else if (data.type === "softphone-call-refresh") {
417
+ (_d = (_c = this.option).softphoneCallRefreshCallBack) == null ? void 0 : _d.call(_c, data);
418
+ } else if (data.type === "softphone-seats-status-change") {
419
+ (_f = (_e = this.option).softphoneSeatStatusChangeCallBack) == null ? void 0 : _f.call(_e, data);
420
+ } else if (data.type === "softphone-accept") {
421
+ (_h = (_g = this.option).softphoneAcceptCallBack) == null ? void 0 : _h.call(_g, data);
422
+ } else if (data.type === "softphone-ignore") {
423
+ (_j = (_i = this.option).softphoneIgnoreCallBack) == null ? void 0 : _j.call(_i, data);
424
+ } else if (data.type === "softphone-hangup") {
425
+ (_l = (_k = this.option).softphoneHangupCallBack) == null ? void 0 : _l.call(_k, data);
426
+ } else if (data.type === "softphone-session-state-change") {
427
+ (_n = (_m = this.option).softphoneSessionStateChangeCallBack) == null ? void 0 : _n.call(_m, data);
428
+ } else if (data.type === "softphone-incoming") {
429
+ (_p = (_o = this.option).softphoneIncomingCallBack) == null ? void 0 : _p.call(_o, data);
430
+ } else if (data.type === "softphone-send-dtmf") {
431
+ (_r = (_q = this.option).softphoneSendDtmfCallBack) == null ? void 0 : _r.call(_q, data);
432
+ } else if (data.type === "softphone-connect-registered") {
433
+ (_t = (_s = this.option).softphoneConnectRegisteredCallBack) == null ? void 0 : _t.call(_s, data);
434
+ }
435
+ }
436
+ }
437
+ };
438
+ this.handlerInteractive = () => {
439
+ window.addEventListener("message", this.handlingCommunication, false);
440
+ this.loadCssCode(`
441
+ body,html {
442
+ overflow: hidden;
443
+ }
444
+ .nf-softphone-container {
445
+ margin-left: 10px;
446
+ height: 32px;
447
+ min-width: 600px;
448
+ }
449
+ .nf-softphone-iframe-container {
450
+ height: 32px;
451
+ width: 100%;
452
+ overflow: visible;
453
+ }
454
+ .nf-softphone-iframe {
455
+ width: 100vw;
456
+ height: 100vh;
457
+ top: 0;
458
+ left: 0;
459
+ }
460
+ `);
461
+ };
462
+ this.handlerDomRemove = () => {
463
+ Object.keys(this.option.instanceMap).forEach((key) => {
464
+ const el = document.getElementById(key);
465
+ if (el && el.parentNode) {
466
+ el.parentNode.removeChild(el);
467
+ }
468
+ });
469
+ };
470
+ this.handlerDomGenerater = () => {
471
+ const container = document.createElement("div");
472
+ const iframeContainer = document.createElement("div");
473
+ const iframe2 = document.createElement("iframe");
474
+ const uuid = generateUUID();
475
+ this.option.instanceMap[uuid] = container;
476
+ container.setAttribute("id", uuid);
477
+ container.setAttribute("class", "nf-softphone-container");
478
+ iframeContainer.setAttribute("class", "nf-softphone-iframe-container");
479
+ iframe2.setAttribute("class", "nf-softphone-iframe");
480
+ iframe2.setAttribute("src", "");
481
+ iframe2.setAttribute("frameborder", "0");
482
+ iframe2.setAttribute("scrolling", "no");
483
+ iframe2.setAttribute("allow", "camera *; microphone *");
484
+ iframeContainer.appendChild(iframe2);
485
+ container.appendChild(iframeContainer);
486
+ const destination = this.option.el ? this.getContextDomElement(this.option.el) ?? document.body : document.body;
487
+ destination.appendChild(container);
488
+ const leftMargin = getComputedStyle(container).marginLeft;
489
+ const top = container.getBoundingClientRect().top;
490
+ const left = container.getBoundingClientRect().left;
491
+ container.setAttribute("style", `margin-top:${top}px;margin-left:${leftMargin};margin-bottom:${top}px;`);
492
+ iframeContainer.setAttribute("style", `margin-top:-${2 * top}px;margin-left:-${left}px;`);
493
+ const {
494
+ envMap,
495
+ env,
496
+ agentTag,
497
+ agentId,
498
+ appSecret,
499
+ extStatus,
500
+ appKey
501
+ } = this.option;
502
+ let url = `${(envMap == null ? void 0 : envMap[env]) ?? env}/#/?cross=1&open=1`;
503
+ url += agentTag ? `&agentTag=${agentTag}` : "";
504
+ url += agentId ? `&agentId=${agentId}` : "";
505
+ url += `&appKey=${appKey}&appSecret=${appSecret}&extStatus=${extStatus}&paddingTop=${top}px&paddingLeft=${left}px`;
506
+ iframe2.src = url;
507
+ };
508
+ this.initSoftphone = (option) => {
509
+ this.option = option ? { ...this.option, ...option } : this.option;
510
+ this.handlerInteractive();
511
+ this.handlerDomGenerater();
512
+ return this;
513
+ };
514
+ this.postMessageCommunicate = (type, status) => {
515
+ const iframe2 = this.getContextDomElement(".nf-softphone-iframe");
516
+ if (iframe2) {
517
+ iframe2.contentWindow.postMessage(JSON.stringify({
518
+ origin: this.option.origin,
519
+ ancestorOrigin: this.option.ancestorOrigin,
520
+ type,
521
+ data: {
522
+ status,
523
+ type: "manual"
524
+ }
525
+ }), "*");
526
+ }
527
+ };
528
+ this.connect = () => {
529
+ this.postMessageCommunicate("softphone-connect", true);
530
+ };
531
+ this.disconnect = () => {
532
+ this.postMessageCommunicate("softphone-connect", false);
533
+ };
534
+ this.seatsStatusChange = (status) => {
535
+ this.postMessageCommunicate("softphone-seats-status-change", status);
536
+ };
537
+ this.accept = () => {
538
+ this.postMessageCommunicate("softphone-accept");
539
+ };
540
+ this.ignore = () => {
541
+ this.postMessageCommunicate("softphone-ignore");
542
+ };
543
+ this.hangup = () => {
544
+ this.postMessageCommunicate("softphone-hangup");
545
+ };
546
+ this.sendDtmf = () => {
547
+ this.postMessageCommunicate("softphone-send-dtmf");
548
+ };
549
+ this.destroy = () => {
550
+ window.removeEventListener("message", this.handlingCommunication, false);
551
+ this.removeCssCode();
552
+ this.handlerDomRemove();
553
+ };
554
+ }
555
+ }
556
+ const softphoneManager = new SoftphoneManager();
557
+ NfSoftphone.install = (app) => {
558
+ app.prototype.$softphoneManager = softphoneManager;
559
+ NfSoftphone.$softphoneManager = softphoneManager;
560
+ app.component("nf-softphone", NfSoftphone);
561
+ };
562
+ export {
563
+ SoftphoneManager,
564
+ NfSoftphone as default,
565
+ softphoneManager
566
+ };
@@ -0,0 +1,115 @@
1
+ import { Env } from './type';
2
+ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ scrollview?: string | undefined;
4
+ envMap?: Partial<Record<Env, string>> | undefined;
5
+ env?: Env | undefined;
6
+ selector?: string | undefined;
7
+ el?: string | undefined;
8
+ agentId?: string | undefined;
9
+ agentTag?: string | undefined;
10
+ appKey?: string | undefined;
11
+ appSecret?: string | undefined;
12
+ extStatus?: string | undefined;
13
+ origin?: string | undefined;
14
+ ancestorOrigin?: string | undefined;
15
+ }>, {
16
+ scrollview: undefined;
17
+ envMap: () => {
18
+ test: string;
19
+ dev: string;
20
+ sg: string;
21
+ gray: string;
22
+ prod: string;
23
+ };
24
+ env: string;
25
+ selector: undefined;
26
+ agentId: undefined;
27
+ agentTag: undefined;
28
+ appKey: undefined;
29
+ appSecret: undefined;
30
+ extStatus: string;
31
+ origin: string;
32
+ ancestorOrigin: string;
33
+ }>, {
34
+ connect: () => void;
35
+ disconnect: () => void;
36
+ seatsStatusChange: (status: any) => void;
37
+ accept: () => void;
38
+ ignore: () => void;
39
+ hangup: () => void;
40
+ sendDtmf: () => void;
41
+ iframe: import("vue-demi").Ref<any>;
42
+ containerScrolling: import("vue-demi").Ref<any>;
43
+ }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
44
+ "softphone-connect": (event: any) => void;
45
+ "softphone-seats-status-change": (event: any) => void;
46
+ "softphone-accept": (event: any) => void;
47
+ "softphone-ignore": (event: any) => void;
48
+ "softphone-hangup": (event: any) => void;
49
+ "softphone-send-dtmf": (event: any) => void;
50
+ "softphone-call-refresh": (event: any) => void;
51
+ "softphone-session-state-change": (event: any) => void;
52
+ "softphone-incoming": (event: any) => void;
53
+ "softphone-connect-registered": (event: any) => void;
54
+ }, string, Readonly<import("vue-demi").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
55
+ scrollview?: string | undefined;
56
+ envMap?: Partial<Record<Env, string>> | undefined;
57
+ env?: Env | undefined;
58
+ selector?: string | undefined;
59
+ el?: string | undefined;
60
+ agentId?: string | undefined;
61
+ agentTag?: string | undefined;
62
+ appKey?: string | undefined;
63
+ appSecret?: string | undefined;
64
+ extStatus?: string | undefined;
65
+ origin?: string | undefined;
66
+ ancestorOrigin?: string | undefined;
67
+ }>, {
68
+ scrollview: undefined;
69
+ envMap: () => {
70
+ test: string;
71
+ dev: string;
72
+ sg: string;
73
+ gray: string;
74
+ prod: string;
75
+ };
76
+ env: string;
77
+ selector: undefined;
78
+ agentId: undefined;
79
+ agentTag: undefined;
80
+ appKey: undefined;
81
+ appSecret: undefined;
82
+ extStatus: string;
83
+ origin: string;
84
+ ancestorOrigin: string;
85
+ }>>>, {
86
+ scrollview: string;
87
+ envMap: Partial<Record<Env, string>>;
88
+ env: Env;
89
+ selector: string;
90
+ agentId: string;
91
+ agentTag: string;
92
+ appKey: string;
93
+ appSecret: string;
94
+ extStatus: string;
95
+ origin: string;
96
+ ancestorOrigin: string;
97
+ }>;
98
+ export default _default;
99
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
100
+ type __VLS_TypePropsToRuntimeProps<T> = {
101
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
102
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
103
+ } : {
104
+ type: import('vue').PropType<T[K]>;
105
+ required: true;
106
+ };
107
+ };
108
+ type __VLS_WithDefaults<P, D> = {
109
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
110
+ default: D[K];
111
+ }> : P[K];
112
+ };
113
+ type __VLS_Prettify<T> = {
114
+ [K in keyof T]: T[K];
115
+ } & {};
@@ -0,0 +1,30 @@
1
+ import { Option } from '../..nf-softphone/lib/type';
2
+ export declare class SoftphoneManager {
3
+ option: Partial<Option>;
4
+ loadCssCode: (code: any) => void;
5
+ removeCssCode: () => void;
6
+ getContextDomElement: (el: string) => Element | null;
7
+ handlingCommunication: (e: {
8
+ data: `{
9
+ type: string,
10
+ ancestorOrigin: string,
11
+ origin: string,
12
+ data: 'expand' | 'shrink'
13
+ }` | string;
14
+ }) => void;
15
+ handlerInteractive: () => void;
16
+ handlerDomRemove: () => void;
17
+ handlerDomGenerater: () => void;
18
+ initSoftphone: (option: any) => this;
19
+ postMessageCommunicate: (type: any, status?: boolean) => void;
20
+ connect: () => void;
21
+ disconnect: () => void;
22
+ seatsStatusChange: (status: boolean) => void;
23
+ accept: () => void;
24
+ ignore: () => void;
25
+ hangup: () => void;
26
+ sendDtmf: () => void;
27
+ destroy: () => void;
28
+ }
29
+ declare const softphoneManager: SoftphoneManager;
30
+ export default softphoneManager;