@94ai/nf-softphone 8.3.23 → 10.0.0
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 +6 -6
- package/lib/nf-softphone.cjs.js +28 -15
- package/lib/nf-softphone.esm-bundler.js +30 -17
- package/lib/nf-softphone.vue.d.ts +2 -2
- package/lib/softphone-pure.d.ts +1 -1
- package/package/html/softphone.js +2 -4
- package/package/html/util.js +2 -1
- package/package/nf-softphone.vue +14 -3
- package/package/softphone-pure.ts +10 -26
- package/package/softphone.ts +4 -5
- package/package.json +9 -8
package/lib/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
19
19
|
};
|
|
20
20
|
scrollingText: {
|
|
21
21
|
type: import("vue-demi").PropType<string>;
|
|
22
|
-
default:
|
|
22
|
+
default: undefined;
|
|
23
23
|
};
|
|
24
24
|
scrollview: {
|
|
25
25
|
type: import("vue-demi").PropType<string>;
|
|
@@ -130,7 +130,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
130
130
|
};
|
|
131
131
|
scrollingText: {
|
|
132
132
|
type: import("vue-demi").PropType<string>;
|
|
133
|
-
default:
|
|
133
|
+
default: undefined;
|
|
134
134
|
};
|
|
135
135
|
scrollview: {
|
|
136
136
|
type: import("vue-demi").PropType<string>;
|
|
@@ -281,7 +281,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
281
281
|
};
|
|
282
282
|
scrollingText: {
|
|
283
283
|
type: import("vue-demi").PropType<string>;
|
|
284
|
-
default:
|
|
284
|
+
default: undefined;
|
|
285
285
|
};
|
|
286
286
|
scrollview: {
|
|
287
287
|
type: import("vue-demi").PropType<string>;
|
|
@@ -405,7 +405,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
405
405
|
};
|
|
406
406
|
scrollingText: {
|
|
407
407
|
type: import("vue-demi").PropType<string>;
|
|
408
|
-
default:
|
|
408
|
+
default: undefined;
|
|
409
409
|
};
|
|
410
410
|
scrollview: {
|
|
411
411
|
type: import("vue-demi").PropType<string>;
|
|
@@ -516,7 +516,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
516
516
|
};
|
|
517
517
|
scrollingText: {
|
|
518
518
|
type: import("vue-demi").PropType<string>;
|
|
519
|
-
default:
|
|
519
|
+
default: undefined;
|
|
520
520
|
};
|
|
521
521
|
scrollview: {
|
|
522
522
|
type: import("vue-demi").PropType<string>;
|
|
@@ -681,7 +681,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
681
681
|
};
|
|
682
682
|
scrollingText: {
|
|
683
683
|
type: import("vue-demi").PropType<string>;
|
|
684
|
-
default:
|
|
684
|
+
default: undefined;
|
|
685
685
|
};
|
|
686
686
|
scrollview: {
|
|
687
687
|
type: import("vue-demi").PropType<string>;
|
package/lib/nf-softphone.cjs.js
CHANGED
|
@@ -35,7 +35,7 @@ __sfc_main.props = {
|
|
|
35
35
|
key: "scrollingText",
|
|
36
36
|
required: false,
|
|
37
37
|
type: String,
|
|
38
|
-
default:
|
|
38
|
+
default: void 0
|
|
39
39
|
},
|
|
40
40
|
scrollview: {
|
|
41
41
|
key: "scrollview",
|
|
@@ -173,6 +173,15 @@ __sfc_main.props = {
|
|
|
173
173
|
__sfc_main.setup = (__props, __ctx) => {
|
|
174
174
|
var _a;
|
|
175
175
|
const props = __props;
|
|
176
|
+
const {
|
|
177
|
+
t
|
|
178
|
+
} = commonUtils.useLocale();
|
|
179
|
+
const localeText = vueDemi.computed(() => {
|
|
180
|
+
var _a2;
|
|
181
|
+
return {
|
|
182
|
+
scrollingText: (_a2 = props.scrollingText) != null ? _a2 : t("nf.softphone.scrolling")
|
|
183
|
+
};
|
|
184
|
+
});
|
|
176
185
|
const requestOpenApiCallBackMap = {};
|
|
177
186
|
const emit = __ctx.emit;
|
|
178
187
|
const container = vueDemi.ref();
|
|
@@ -305,11 +314,14 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
305
314
|
}
|
|
306
315
|
}, 500, false);
|
|
307
316
|
vueDemi.onMounted(async () => {
|
|
308
|
-
var _a2, _b;
|
|
317
|
+
var _a2, _b, _c;
|
|
318
|
+
const position = await refreshStyle();
|
|
319
|
+
if (!position || !iframeDom.value)
|
|
320
|
+
return;
|
|
309
321
|
const {
|
|
310
322
|
top,
|
|
311
323
|
left
|
|
312
|
-
} =
|
|
324
|
+
} = position;
|
|
313
325
|
const {
|
|
314
326
|
envMap,
|
|
315
327
|
env,
|
|
@@ -335,7 +347,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
335
347
|
sgOpen,
|
|
336
348
|
sgDomain
|
|
337
349
|
} = props;
|
|
338
|
-
let url = `${(envMap == null ? void 0 : envMap[env])
|
|
350
|
+
let url = `${(_a2 = envMap == null ? void 0 : envMap[env]) != null ? _a2 : env}/#/?cross=1&open=1`;
|
|
339
351
|
url += sgGateway ? `&sgGateway=${sgGateway}` : "";
|
|
340
352
|
url += sgBase ? `&sgBase=${sgBase}` : "";
|
|
341
353
|
url += sgOpen ? `&sgOpen=${sgOpen}` : "";
|
|
@@ -358,8 +370,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
358
370
|
contentWindow = iframeDom.value.contentWindow;
|
|
359
371
|
window.addEventListener("message", handlingCommunication, false);
|
|
360
372
|
if (props.scrollview) {
|
|
361
|
-
(
|
|
362
|
-
(
|
|
373
|
+
(_b = document.querySelector(props.scrollview)) == null ? void 0 : _b.addEventListener("scroll", handlingScroll);
|
|
374
|
+
(_c = document.querySelector(props.scrollview)) == null ? void 0 : _c.addEventListener("scroll", handlingScrollTransparent);
|
|
363
375
|
}
|
|
364
376
|
});
|
|
365
377
|
vueDemi.onBeforeUnmount(async () => {
|
|
@@ -435,6 +447,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
435
447
|
postMessageCommunicate("softphone-sign-overdued", data, "auto", props.ancestorOrigin, "ai-softphone");
|
|
436
448
|
};
|
|
437
449
|
return Object.assign({
|
|
450
|
+
localeText,
|
|
438
451
|
container,
|
|
439
452
|
iframeContainer,
|
|
440
453
|
iframeDom,
|
|
@@ -484,7 +497,7 @@ var _sfc_render = function render() {
|
|
|
484
497
|
style: {
|
|
485
498
|
"display": _vm.containerScrolling === true ? "block" : "none"
|
|
486
499
|
}
|
|
487
|
-
}, [_vm._v(_vm._s(_vm.scrollingText))])]);
|
|
500
|
+
}, [_vm._v(_vm._s(_vm.localeText.scrollingText))])]);
|
|
488
501
|
};
|
|
489
502
|
var _sfc_staticRenderFns = [];
|
|
490
503
|
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(__sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
@@ -496,7 +509,7 @@ class SoftphoneManager {
|
|
|
496
509
|
ancestorOrigin: "nf-softphone",
|
|
497
510
|
destinationOrigin: "*",
|
|
498
511
|
scrollview: void 0,
|
|
499
|
-
scrollingText:
|
|
512
|
+
scrollingText: void 0,
|
|
500
513
|
envMap: {
|
|
501
514
|
test: "http://softphone.test.k8s.com",
|
|
502
515
|
dev: "http://softphone.dev.k8s.com",
|
|
@@ -588,13 +601,12 @@ class SoftphoneManager {
|
|
|
588
601
|
const styleId = "nf-softphone";
|
|
589
602
|
const css = document.getElementById(styleId);
|
|
590
603
|
if (css) {
|
|
591
|
-
|
|
592
|
-
css.parentNode.removeChild(css);
|
|
593
|
-
}
|
|
604
|
+
css.parentNode.removeChild(css);
|
|
594
605
|
}
|
|
595
606
|
};
|
|
596
607
|
this.getContextDomElement = (el) => {
|
|
597
|
-
|
|
608
|
+
var _a;
|
|
609
|
+
return (this.option.selector ? (_a = document.querySelector(this.option.selector)) != null ? _a : document : document).querySelector(el);
|
|
598
610
|
};
|
|
599
611
|
this.getSoftphoneDomElement = (el) => {
|
|
600
612
|
var _a;
|
|
@@ -789,9 +801,10 @@ class SoftphoneManager {
|
|
|
789
801
|
};
|
|
790
802
|
};
|
|
791
803
|
this.handlerDomGenerater = async () => {
|
|
804
|
+
var _a, _b, _c;
|
|
792
805
|
const nfSoftphone = document.createElement("div");
|
|
793
806
|
const nfSoftphoneText = document.createElement("div");
|
|
794
|
-
nfSoftphoneText.innerText = this.option.scrollingText
|
|
807
|
+
nfSoftphoneText.innerText = (_a = this.option.scrollingText) != null ? _a : commonUtils.useLocale().t("nf.softphone.scrolling");
|
|
795
808
|
const nfSoftphoneContainer = document.createElement("div");
|
|
796
809
|
const iframeContainer = document.createElement("div");
|
|
797
810
|
const iframe = document.createElement("iframe");
|
|
@@ -812,7 +825,7 @@ class SoftphoneManager {
|
|
|
812
825
|
nfSoftphoneContainer.appendChild(iframeContainer);
|
|
813
826
|
nfSoftphone.appendChild(nfSoftphoneContainer);
|
|
814
827
|
nfSoftphone.appendChild(nfSoftphoneText);
|
|
815
|
-
const destination = this.option.el ? this.getSoftphoneDomElement(this.option.el)
|
|
828
|
+
const destination = this.option.el ? (_b = this.getSoftphoneDomElement(this.option.el)) != null ? _b : document.body : document.body;
|
|
816
829
|
destination.appendChild(nfSoftphone);
|
|
817
830
|
await vueDemi.nextTick();
|
|
818
831
|
const {
|
|
@@ -844,7 +857,7 @@ class SoftphoneManager {
|
|
|
844
857
|
sgOpen,
|
|
845
858
|
sgDomain
|
|
846
859
|
} = this.option;
|
|
847
|
-
let url = `${(envMap == null ? void 0 : envMap[env])
|
|
860
|
+
let url = `${(_c = envMap == null ? void 0 : envMap[env]) != null ? _c : env}/#/?cross=1&open=1`;
|
|
848
861
|
url += agentTag ? `&agentTag=${agentTag}` : "";
|
|
849
862
|
url += agentId ? `&agentId=${agentId}` : "";
|
|
850
863
|
url += appSecret ? `&appSecret=${appSecret}` : "";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, ref, getCurrentInstance, onMounted, onBeforeUnmount, nextTick } from "vue-demi";
|
|
2
|
-
import { debounce, generateUUID } from "@94ai/common-utils";
|
|
1
|
+
import { defineComponent, computed, ref, getCurrentInstance, onMounted, onBeforeUnmount, nextTick } from "vue-demi";
|
|
2
|
+
import { useLocale, debounce, generateUUID } from "@94ai/common-utils";
|
|
3
3
|
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
4
4
|
const __sfc_main = defineComponent({
|
|
5
5
|
name: "nf-softphone"
|
|
@@ -33,7 +33,7 @@ __sfc_main.props = {
|
|
|
33
33
|
key: "scrollingText",
|
|
34
34
|
required: false,
|
|
35
35
|
type: String,
|
|
36
|
-
default:
|
|
36
|
+
default: void 0
|
|
37
37
|
},
|
|
38
38
|
scrollview: {
|
|
39
39
|
key: "scrollview",
|
|
@@ -171,6 +171,15 @@ __sfc_main.props = {
|
|
|
171
171
|
__sfc_main.setup = (__props, __ctx) => {
|
|
172
172
|
var _a;
|
|
173
173
|
const props = __props;
|
|
174
|
+
const {
|
|
175
|
+
t
|
|
176
|
+
} = useLocale();
|
|
177
|
+
const localeText = computed(() => {
|
|
178
|
+
var _a2;
|
|
179
|
+
return {
|
|
180
|
+
scrollingText: (_a2 = props.scrollingText) != null ? _a2 : t("nf.softphone.scrolling")
|
|
181
|
+
};
|
|
182
|
+
});
|
|
174
183
|
const requestOpenApiCallBackMap = {};
|
|
175
184
|
const emit = __ctx.emit;
|
|
176
185
|
const container = ref();
|
|
@@ -303,11 +312,14 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
303
312
|
}
|
|
304
313
|
}, 500, false);
|
|
305
314
|
onMounted(async () => {
|
|
306
|
-
var _a2, _b;
|
|
315
|
+
var _a2, _b, _c;
|
|
316
|
+
const position = await refreshStyle();
|
|
317
|
+
if (!position || !iframeDom.value)
|
|
318
|
+
return;
|
|
307
319
|
const {
|
|
308
320
|
top,
|
|
309
321
|
left
|
|
310
|
-
} =
|
|
322
|
+
} = position;
|
|
311
323
|
const {
|
|
312
324
|
envMap,
|
|
313
325
|
env,
|
|
@@ -333,7 +345,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
333
345
|
sgOpen,
|
|
334
346
|
sgDomain
|
|
335
347
|
} = props;
|
|
336
|
-
let url = `${(envMap == null ? void 0 : envMap[env])
|
|
348
|
+
let url = `${(_a2 = envMap == null ? void 0 : envMap[env]) != null ? _a2 : env}/#/?cross=1&open=1`;
|
|
337
349
|
url += sgGateway ? `&sgGateway=${sgGateway}` : "";
|
|
338
350
|
url += sgBase ? `&sgBase=${sgBase}` : "";
|
|
339
351
|
url += sgOpen ? `&sgOpen=${sgOpen}` : "";
|
|
@@ -356,8 +368,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
356
368
|
contentWindow = iframeDom.value.contentWindow;
|
|
357
369
|
window.addEventListener("message", handlingCommunication, false);
|
|
358
370
|
if (props.scrollview) {
|
|
359
|
-
(
|
|
360
|
-
(
|
|
371
|
+
(_b = document.querySelector(props.scrollview)) == null ? void 0 : _b.addEventListener("scroll", handlingScroll);
|
|
372
|
+
(_c = document.querySelector(props.scrollview)) == null ? void 0 : _c.addEventListener("scroll", handlingScrollTransparent);
|
|
361
373
|
}
|
|
362
374
|
});
|
|
363
375
|
onBeforeUnmount(async () => {
|
|
@@ -433,6 +445,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
433
445
|
postMessageCommunicate("softphone-sign-overdued", data, "auto", props.ancestorOrigin, "ai-softphone");
|
|
434
446
|
};
|
|
435
447
|
return Object.assign({
|
|
448
|
+
localeText,
|
|
436
449
|
container,
|
|
437
450
|
iframeContainer,
|
|
438
451
|
iframeDom,
|
|
@@ -482,7 +495,7 @@ var _sfc_render = function render() {
|
|
|
482
495
|
style: {
|
|
483
496
|
"display": _vm.containerScrolling === true ? "block" : "none"
|
|
484
497
|
}
|
|
485
|
-
}, [_vm._v(_vm._s(_vm.scrollingText))])]);
|
|
498
|
+
}, [_vm._v(_vm._s(_vm.localeText.scrollingText))])]);
|
|
486
499
|
};
|
|
487
500
|
var _sfc_staticRenderFns = [];
|
|
488
501
|
var __component__ = /* @__PURE__ */ normalizeComponent(__sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
@@ -494,7 +507,7 @@ class SoftphoneManager {
|
|
|
494
507
|
ancestorOrigin: "nf-softphone",
|
|
495
508
|
destinationOrigin: "*",
|
|
496
509
|
scrollview: void 0,
|
|
497
|
-
scrollingText:
|
|
510
|
+
scrollingText: void 0,
|
|
498
511
|
envMap: {
|
|
499
512
|
test: "http://softphone.test.k8s.com",
|
|
500
513
|
dev: "http://softphone.dev.k8s.com",
|
|
@@ -586,13 +599,12 @@ class SoftphoneManager {
|
|
|
586
599
|
const styleId = "nf-softphone";
|
|
587
600
|
const css = document.getElementById(styleId);
|
|
588
601
|
if (css) {
|
|
589
|
-
|
|
590
|
-
css.parentNode.removeChild(css);
|
|
591
|
-
}
|
|
602
|
+
css.parentNode.removeChild(css);
|
|
592
603
|
}
|
|
593
604
|
};
|
|
594
605
|
this.getContextDomElement = (el) => {
|
|
595
|
-
|
|
606
|
+
var _a;
|
|
607
|
+
return (this.option.selector ? (_a = document.querySelector(this.option.selector)) != null ? _a : document : document).querySelector(el);
|
|
596
608
|
};
|
|
597
609
|
this.getSoftphoneDomElement = (el) => {
|
|
598
610
|
var _a;
|
|
@@ -787,9 +799,10 @@ class SoftphoneManager {
|
|
|
787
799
|
};
|
|
788
800
|
};
|
|
789
801
|
this.handlerDomGenerater = async () => {
|
|
802
|
+
var _a, _b, _c;
|
|
790
803
|
const nfSoftphone = document.createElement("div");
|
|
791
804
|
const nfSoftphoneText = document.createElement("div");
|
|
792
|
-
nfSoftphoneText.innerText = this.option.scrollingText
|
|
805
|
+
nfSoftphoneText.innerText = (_a = this.option.scrollingText) != null ? _a : useLocale().t("nf.softphone.scrolling");
|
|
793
806
|
const nfSoftphoneContainer = document.createElement("div");
|
|
794
807
|
const iframeContainer = document.createElement("div");
|
|
795
808
|
const iframe = document.createElement("iframe");
|
|
@@ -810,7 +823,7 @@ class SoftphoneManager {
|
|
|
810
823
|
nfSoftphoneContainer.appendChild(iframeContainer);
|
|
811
824
|
nfSoftphone.appendChild(nfSoftphoneContainer);
|
|
812
825
|
nfSoftphone.appendChild(nfSoftphoneText);
|
|
813
|
-
const destination = this.option.el ? this.getSoftphoneDomElement(this.option.el)
|
|
826
|
+
const destination = this.option.el ? (_b = this.getSoftphoneDomElement(this.option.el)) != null ? _b : document.body : document.body;
|
|
814
827
|
destination.appendChild(nfSoftphone);
|
|
815
828
|
await nextTick();
|
|
816
829
|
const {
|
|
@@ -842,7 +855,7 @@ class SoftphoneManager {
|
|
|
842
855
|
sgOpen,
|
|
843
856
|
sgDomain
|
|
844
857
|
} = this.option;
|
|
845
|
-
let url = `${(envMap == null ? void 0 : envMap[env])
|
|
858
|
+
let url = `${(_c = envMap == null ? void 0 : envMap[env]) != null ? _c : env}/#/?cross=1&open=1`;
|
|
846
859
|
url += agentTag ? `&agentTag=${agentTag}` : "";
|
|
847
860
|
url += agentId ? `&agentId=${agentId}` : "";
|
|
848
861
|
url += appSecret ? `&appSecret=${appSecret}` : "";
|
|
@@ -27,7 +27,7 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
27
27
|
timingShow?: "0" | "1" | undefined;
|
|
28
28
|
signShow?: "0" | "1" | undefined;
|
|
29
29
|
}>, {
|
|
30
|
-
scrollingText:
|
|
30
|
+
scrollingText: undefined;
|
|
31
31
|
scrollview: undefined;
|
|
32
32
|
envMap: () => {
|
|
33
33
|
test: string;
|
|
@@ -113,7 +113,7 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
|
|
|
113
113
|
timingShow?: "0" | "1" | undefined;
|
|
114
114
|
signShow?: "0" | "1" | undefined;
|
|
115
115
|
}>, {
|
|
116
|
-
scrollingText:
|
|
116
|
+
scrollingText: undefined;
|
|
117
117
|
scrollview: undefined;
|
|
118
118
|
envMap: () => {
|
|
119
119
|
test: string;
|
package/lib/softphone-pure.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export declare class SoftphoneManager {
|
|
|
65
65
|
data: 'expand' | 'shrink'
|
|
66
66
|
}` | string;
|
|
67
67
|
}) => void;
|
|
68
|
-
handlingScroll: (...
|
|
68
|
+
handlingScroll: (...callArgs: any[]) => any;
|
|
69
69
|
handlerInteractive: () => void;
|
|
70
70
|
handlerDomRemove: () => void;
|
|
71
71
|
_containerScrolling: any;
|
|
@@ -95,9 +95,7 @@ class SoftphoneManager {
|
|
|
95
95
|
const styleId = 'nf-softphone'
|
|
96
96
|
const css = document.getElementById(styleId)
|
|
97
97
|
if (css) {
|
|
98
|
-
|
|
99
|
-
css.parentNode.removeChild(css);
|
|
100
|
-
}
|
|
98
|
+
css.parentNode.removeChild(css);
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
|
|
@@ -111,7 +109,7 @@ class SoftphoneManager {
|
|
|
111
109
|
* 隔离软电话容器内容
|
|
112
110
|
*/
|
|
113
111
|
getSoftphoneDomElement = (el) => {
|
|
114
|
-
return this.getContextDomElement(this.option.el)
|
|
112
|
+
return this.getContextDomElement(this.option.el)?.querySelector(el) || this.getContextDomElement(el) || document.querySelector(el)
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
signOverdued = (data) => {
|
package/package/html/util.js
CHANGED
package/package/nf-softphone.vue
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
></iframe>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
|
-
<div :class="{'nf-softphone-text': true}" :style="{'display': containerScrolling === true ? 'block' : 'none'}">{{ scrollingText }}</div>
|
|
15
|
+
<div :class="{'nf-softphone-text': true}" :style="{'display': containerScrolling === true ? 'block' : 'none'}">{{ localeText.scrollingText }}</div>
|
|
16
16
|
</div>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
@@ -25,6 +25,9 @@ export default defineComponent({
|
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<script lang="ts" setup>
|
|
28
|
+
import { computed } from 'vue-demi'
|
|
29
|
+
import { useLocale } from '@94ai/common-utils'
|
|
30
|
+
|
|
28
31
|
import { Env } from './type'
|
|
29
32
|
import {
|
|
30
33
|
getCurrentInstance,
|
|
@@ -71,7 +74,7 @@ const props = withDefaults(defineProps<{
|
|
|
71
74
|
timingShow?: '0' | '1',
|
|
72
75
|
signShow?: '0' | '1',
|
|
73
76
|
}>(), {
|
|
74
|
-
scrollingText:
|
|
77
|
+
scrollingText: undefined,
|
|
75
78
|
scrollview: undefined,
|
|
76
79
|
|
|
77
80
|
envMap: () => ({
|
|
@@ -110,6 +113,12 @@ const props = withDefaults(defineProps<{
|
|
|
110
113
|
signShow: '1',
|
|
111
114
|
})
|
|
112
115
|
|
|
116
|
+
const { t } = useLocale()
|
|
117
|
+
const localeText = computed(() => ({
|
|
118
|
+
scrollingText: props.scrollingText ?? t('nf.softphone.scrolling'),
|
|
119
|
+
}))
|
|
120
|
+
|
|
121
|
+
|
|
113
122
|
const requestOpenApiCallBackMap: Record<string, any> = {}
|
|
114
123
|
|
|
115
124
|
const emit = defineEmits<{
|
|
@@ -267,10 +276,12 @@ const handlingScroll = debounce(async () => {
|
|
|
267
276
|
}, 500, false)
|
|
268
277
|
|
|
269
278
|
onMounted(async () => {
|
|
279
|
+
const position = await refreshStyle()
|
|
280
|
+
if (!position || !iframeDom.value) return
|
|
270
281
|
const {
|
|
271
282
|
top,
|
|
272
283
|
left
|
|
273
|
-
} =
|
|
284
|
+
} = position
|
|
274
285
|
const {
|
|
275
286
|
envMap,
|
|
276
287
|
env,
|
|
@@ -61,7 +61,8 @@ function generateUUID() { // Public Domain/MIT
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
// Private scroll scheduler: the only call site uses trailing execution.
|
|
65
|
+
function debounce(func, wait) {
|
|
65
66
|
let timeout, args, context, timestamp, result
|
|
66
67
|
|
|
67
68
|
const later = function() {
|
|
@@ -73,26 +74,18 @@ function debounce(func, wait, immediate) {
|
|
|
73
74
|
timeout = setTimeout(later, wait - last)
|
|
74
75
|
} else {
|
|
75
76
|
timeout = null
|
|
76
|
-
|
|
77
|
-
if (!
|
|
78
|
-
result = func.apply(context, args)
|
|
79
|
-
if (!timeout) context = args = null
|
|
80
|
-
}
|
|
77
|
+
result = func.apply(context, args)
|
|
78
|
+
if (!timeout) context = args = null
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
return function(...
|
|
82
|
+
return function(...callArgs) {
|
|
83
|
+
args = callArgs
|
|
85
84
|
// @ts-ignore
|
|
86
85
|
context = this
|
|
87
86
|
timestamp = +new Date()
|
|
88
|
-
const callNow = immediate && !timeout
|
|
89
87
|
// 如果延时不存在,重新设定延时
|
|
90
88
|
if (!timeout) timeout = setTimeout(later, wait)
|
|
91
|
-
if (callNow) {
|
|
92
|
-
result = func.apply(context, args)
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
context = args = null
|
|
95
|
-
}
|
|
96
89
|
|
|
97
90
|
return result
|
|
98
91
|
}
|
|
@@ -151,18 +144,11 @@ if (typeof Promise !== 'undefined') {
|
|
|
151
144
|
};
|
|
152
145
|
}
|
|
153
146
|
|
|
154
|
-
//
|
|
155
|
-
async function nextTick(
|
|
147
|
+
// Private DOM-generation barrier; all callers await it without a callback.
|
|
148
|
+
async function nextTick() {
|
|
156
149
|
return new Promise((resolve) => {
|
|
157
150
|
// 将回调函数和 resolve 函数封装成一个新的回调
|
|
158
151
|
callbacks.push(() => {
|
|
159
|
-
if (cb) {
|
|
160
|
-
try {
|
|
161
|
-
cb();
|
|
162
|
-
} catch (e) {
|
|
163
|
-
console.error('Error in nextTick callback:', e);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
152
|
// 当回调执行完毕后,resolve Promise
|
|
167
153
|
resolve(true);
|
|
168
154
|
});
|
|
@@ -291,9 +277,7 @@ export class SoftphoneManager {
|
|
|
291
277
|
const styleId = 'nf-softphone'
|
|
292
278
|
const css = document.getElementById(styleId)
|
|
293
279
|
if (css) {
|
|
294
|
-
|
|
295
|
-
css.parentNode.removeChild(css);
|
|
296
|
-
}
|
|
280
|
+
css.parentNode!.removeChild(css);
|
|
297
281
|
}
|
|
298
282
|
}
|
|
299
283
|
|
|
@@ -405,7 +389,7 @@ export class SoftphoneManager {
|
|
|
405
389
|
}
|
|
406
390
|
}), '*')
|
|
407
391
|
}
|
|
408
|
-
}, 500
|
|
392
|
+
}, 500)
|
|
409
393
|
|
|
410
394
|
handlerInteractive = () => {
|
|
411
395
|
/**
|
package/package/softphone.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Option } from 'packages/nf-softphone/lib/type'
|
|
2
2
|
import {
|
|
3
|
+
useLocale,
|
|
3
4
|
debounce,
|
|
4
5
|
generateUUID
|
|
5
6
|
} from '@94ai/common-utils'
|
|
@@ -23,7 +24,7 @@ export class SoftphoneManager {
|
|
|
23
24
|
destinationOrigin: '*',
|
|
24
25
|
|
|
25
26
|
scrollview: undefined,
|
|
26
|
-
scrollingText:
|
|
27
|
+
scrollingText: undefined,
|
|
27
28
|
|
|
28
29
|
envMap: {
|
|
29
30
|
test: 'http://softphone.test.k8s.com',
|
|
@@ -122,9 +123,7 @@ export class SoftphoneManager {
|
|
|
122
123
|
const styleId = 'nf-softphone'
|
|
123
124
|
const css = document.getElementById(styleId)
|
|
124
125
|
if (css) {
|
|
125
|
-
|
|
126
|
-
css.parentNode.removeChild(css);
|
|
127
|
-
}
|
|
126
|
+
css.parentNode!.removeChild(css);
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
|
|
@@ -363,7 +362,7 @@ export class SoftphoneManager {
|
|
|
363
362
|
handlerDomGenerater = async () => {
|
|
364
363
|
const nfSoftphone = document.createElement('div');
|
|
365
364
|
const nfSoftphoneText = document.createElement('div');
|
|
366
|
-
nfSoftphoneText.innerText = this.option.scrollingText
|
|
365
|
+
nfSoftphoneText.innerText = this.option.scrollingText ?? useLocale().t('nf.softphone.scrolling')
|
|
367
366
|
|
|
368
367
|
const nfSoftphoneContainer = document.createElement('div');
|
|
369
368
|
const iframeContainer = document.createElement('div');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-softphone",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "http://94ai.
|
|
14
|
+
"url": "http://gitlab.94ai.pro/ui/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/
|
|
18
|
-
"
|
|
17
|
+
"@94ai/common-utils": "^10.0.0",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^10.0.0",
|
|
19
|
+
"vue-demi": "^0.14.5",
|
|
20
|
+
"@94ai/vue2-runtime-helpers": "1.0.1"
|
|
19
21
|
},
|
|
20
22
|
"peerDependenciesMeta": {
|
|
21
23
|
"@vue/composition-api": {
|
|
@@ -24,11 +26,10 @@
|
|
|
24
26
|
},
|
|
25
27
|
"peerDependencies": {
|
|
26
28
|
"@vue/composition-api": "^1.0.0-rc.1",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
+
"vue": "^2.0.0 || >=3.0.0",
|
|
30
|
+
"element-ui": ">=2.13.2"
|
|
29
31
|
},
|
|
30
32
|
"types": "lib/index.d.ts",
|
|
31
33
|
"main": "lib/nf-softphone.cjs.js",
|
|
32
|
-
"module": "lib/nf-softphone.esm-bundler.js"
|
|
33
|
-
"gitHead": "74e871c7972dc4576480bee02b1dc61a3eafc6ba"
|
|
34
|
+
"module": "lib/nf-softphone.esm-bundler.js"
|
|
34
35
|
}
|