@koi-design/callkit 1.0.24-beta.2 → 1.0.24-beta.4
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/dist/index.d.ts +13 -2
- package/dist/index.global.js +41 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +41 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -179,7 +179,11 @@ declare const EncryptionMethod: {
|
|
|
179
179
|
NONE: string;
|
|
180
180
|
INTERNAL: string;
|
|
181
181
|
};
|
|
182
|
-
type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMethod];
|
|
182
|
+
type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMethod];
|
|
183
|
+
declare const CallSourceType: {
|
|
184
|
+
phoneNum: number;
|
|
185
|
+
workOrderId: number;
|
|
186
|
+
};
|
|
183
187
|
|
|
184
188
|
type LoggerLevel = 'debug' | 'log' | 'warn' | 'error' | 'silent';
|
|
185
189
|
declare class Logger {
|
|
@@ -261,7 +265,9 @@ interface IConfig {
|
|
|
261
265
|
username: string;
|
|
262
266
|
password: string;
|
|
263
267
|
encryptionPassword: string;
|
|
268
|
+
sourceType: (typeof CallSourceType)[keyof typeof CallSourceType];
|
|
264
269
|
extno: string;
|
|
270
|
+
workOrderId: string;
|
|
265
271
|
userPart: string;
|
|
266
272
|
agentId: string;
|
|
267
273
|
fsUserId: string;
|
|
@@ -419,6 +425,11 @@ interface Listener {
|
|
|
419
425
|
event: kitEventType;
|
|
420
426
|
callback: (...args: any[]) => void;
|
|
421
427
|
}
|
|
428
|
+
interface CallOptions {
|
|
429
|
+
sourceType: (typeof CallSourceType)[keyof typeof CallSourceType];
|
|
430
|
+
phoneNum?: string;
|
|
431
|
+
workOrderId?: string;
|
|
432
|
+
}
|
|
422
433
|
declare class CallKit {
|
|
423
434
|
api: Api;
|
|
424
435
|
config: Config;
|
|
@@ -433,7 +444,7 @@ declare class CallKit {
|
|
|
433
444
|
[key: string]: any;
|
|
434
445
|
}): Promise<void>;
|
|
435
446
|
logout(): Promise<void>;
|
|
436
|
-
call(extno?: string | number): Promise<void>;
|
|
447
|
+
call(extno?: string | number, options?: CallOptions): Promise<void>;
|
|
437
448
|
refer(uri: string, options?: any): Promise<void>;
|
|
438
449
|
register(): Promise<void>;
|
|
439
450
|
unregister(): Promise<void>;
|
package/dist/index.global.js
CHANGED
|
@@ -3580,6 +3580,10 @@ var WebCall = (() => {
|
|
|
3580
3580
|
video: false
|
|
3581
3581
|
};
|
|
3582
3582
|
var isAutoUpdateUserStatusDefault = true;
|
|
3583
|
+
var CallSourceType = {
|
|
3584
|
+
phoneNum: 1,
|
|
3585
|
+
workOrderId: 2
|
|
3586
|
+
};
|
|
3583
3587
|
|
|
3584
3588
|
// package/call.ts
|
|
3585
3589
|
var Call = class {
|
|
@@ -3596,10 +3600,20 @@ var WebCall = (() => {
|
|
|
3596
3600
|
return;
|
|
3597
3601
|
}
|
|
3598
3602
|
this.callKit.connect.call(async (user) => {
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
+
let queryTrain = {};
|
|
3604
|
+
if (user.sourceType === CallSourceType.phoneNum) {
|
|
3605
|
+
queryTrain = {
|
|
3606
|
+
agentId: user.agentId,
|
|
3607
|
+
phoneNum: user.extno,
|
|
3608
|
+
sourceType: user.sourceType
|
|
3609
|
+
};
|
|
3610
|
+
} else if (user.sourceType === CallSourceType.workOrderId) {
|
|
3611
|
+
queryTrain = {
|
|
3612
|
+
agentId: user.agentId,
|
|
3613
|
+
workOrderId: user.workOrderId,
|
|
3614
|
+
sourceType: user.sourceType
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3603
3617
|
this.callKit.socket.send(SocketSendEvent.CALL, queryTrain);
|
|
3604
3618
|
});
|
|
3605
3619
|
}
|
|
@@ -3672,8 +3686,10 @@ var WebCall = (() => {
|
|
|
3672
3686
|
// Password
|
|
3673
3687
|
password: "",
|
|
3674
3688
|
encryptionPassword: EncryptionMethod.INTERNAL,
|
|
3689
|
+
sourceType: CallSourceType.phoneNum,
|
|
3675
3690
|
// Extension number
|
|
3676
3691
|
extno: "",
|
|
3692
|
+
workOrderId: "",
|
|
3677
3693
|
userPart: "",
|
|
3678
3694
|
agentId: "",
|
|
3679
3695
|
fsUserId: "",
|
|
@@ -3704,7 +3720,9 @@ var WebCall = (() => {
|
|
|
3704
3720
|
password: "",
|
|
3705
3721
|
encryptionPassword: "",
|
|
3706
3722
|
userPart: "",
|
|
3723
|
+
sourceType: CallSourceType.phoneNum,
|
|
3707
3724
|
extno: "",
|
|
3725
|
+
workOrderId: "",
|
|
3708
3726
|
agentId: "",
|
|
3709
3727
|
fsUserId: "",
|
|
3710
3728
|
fsPassword: "",
|
|
@@ -18910,6 +18928,11 @@ var WebCall = (() => {
|
|
|
18910
18928
|
sessionId,
|
|
18911
18929
|
...message
|
|
18912
18930
|
};
|
|
18931
|
+
if (message.sourceType === CallSourceType.phoneNum) {
|
|
18932
|
+
delete msg.workOrderId;
|
|
18933
|
+
} else if (message.sourceType === CallSourceType.workOrderId) {
|
|
18934
|
+
delete msg.phoneNum;
|
|
18935
|
+
}
|
|
18913
18936
|
if (SocketSendEvent.CALL === event) {
|
|
18914
18937
|
msg.phoneNum = extno;
|
|
18915
18938
|
msg.agentId = agentId;
|
|
@@ -19159,15 +19182,26 @@ var WebCall = (() => {
|
|
|
19159
19182
|
this.config.reset();
|
|
19160
19183
|
this.trigger(KitEvent.KIT_LOGIN_CHANGE, false);
|
|
19161
19184
|
}
|
|
19162
|
-
async call(extno
|
|
19185
|
+
async call(extno = "", options = {
|
|
19186
|
+
sourceType: CallSourceType.phoneNum,
|
|
19187
|
+
workOrderId: ""
|
|
19188
|
+
}) {
|
|
19163
19189
|
if (!this.config.check())
|
|
19164
19190
|
return;
|
|
19165
19191
|
if (!this.connect.isRegistered()) {
|
|
19166
19192
|
this.logger.warn("Currently not registered");
|
|
19167
19193
|
return;
|
|
19168
19194
|
}
|
|
19169
|
-
|
|
19170
|
-
|
|
19195
|
+
const { sourceType, workOrderId } = options;
|
|
19196
|
+
this.config.setUserInfo("sourceType", sourceType);
|
|
19197
|
+
if (sourceType === CallSourceType.phoneNum) {
|
|
19198
|
+
if (extno) {
|
|
19199
|
+
this.config.setUserInfo("extno", extno);
|
|
19200
|
+
}
|
|
19201
|
+
} else if (sourceType === CallSourceType.workOrderId) {
|
|
19202
|
+
if (workOrderId) {
|
|
19203
|
+
this.config.setUserInfo("workOrderId", workOrderId);
|
|
19204
|
+
}
|
|
19171
19205
|
}
|
|
19172
19206
|
this.logger.debug("call");
|
|
19173
19207
|
this.callCenter.callStart();
|