@koi-design/callkit 1.0.24-beta.1 → 1.0.24-beta.3
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 +16 -5
- package/dist/index.global.js +42 -13
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +42 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare class Call {
|
|
|
29
29
|
* @param referTo - The referral target. If a `Session`, a REFER w/Replaces is sent.
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
callRefer(referTo: string): Promise<void>;
|
|
32
|
+
callRefer(referTo: string, options?: any): Promise<void>;
|
|
33
33
|
/**
|
|
34
34
|
* Hang up
|
|
35
35
|
* @param isUnprompted Whether to actively hang up
|
|
@@ -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;
|
|
@@ -387,7 +393,7 @@ declare class Connect {
|
|
|
387
393
|
setMute(mute: boolean): Promise<void>;
|
|
388
394
|
mute(): Promise<void>;
|
|
389
395
|
unmute(): Promise<void>;
|
|
390
|
-
refer(referTo: string): Promise<void>;
|
|
396
|
+
refer(referTo: string, options?: any): Promise<void>;
|
|
391
397
|
}
|
|
392
398
|
|
|
393
399
|
declare class User {
|
|
@@ -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,8 +444,8 @@ declare class CallKit {
|
|
|
433
444
|
[key: string]: any;
|
|
434
445
|
}): Promise<void>;
|
|
435
446
|
logout(): Promise<void>;
|
|
436
|
-
call(extno?: string | number): Promise<void>;
|
|
437
|
-
refer(uri: string): Promise<void>;
|
|
447
|
+
call(extno?: string | number, options?: CallOptions): Promise<void>;
|
|
448
|
+
refer(uri: string, options?: any): Promise<void>;
|
|
438
449
|
register(): Promise<void>;
|
|
439
450
|
unregister(): Promise<void>;
|
|
440
451
|
hangup(): 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
|
}
|
|
@@ -3608,11 +3622,11 @@ var WebCall = (() => {
|
|
|
3608
3622
|
* @param referTo - The referral target. If a `Session`, a REFER w/Replaces is sent.
|
|
3609
3623
|
* @returns
|
|
3610
3624
|
*/
|
|
3611
|
-
async callRefer(referTo) {
|
|
3625
|
+
async callRefer(referTo, options) {
|
|
3612
3626
|
if (!this.callKit.config.check())
|
|
3613
3627
|
return;
|
|
3614
3628
|
this.callKit.logger.debug("callRefer");
|
|
3615
|
-
this.callKit.connect.refer(referTo);
|
|
3629
|
+
this.callKit.connect.refer(referTo, options);
|
|
3616
3630
|
}
|
|
3617
3631
|
/**
|
|
3618
3632
|
* Hang up
|
|
@@ -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: "",
|
|
@@ -18721,10 +18739,10 @@ var WebCall = (() => {
|
|
|
18721
18739
|
}
|
|
18722
18740
|
await this.setMute(false);
|
|
18723
18741
|
}
|
|
18724
|
-
async refer(referTo) {
|
|
18742
|
+
async refer(referTo, options) {
|
|
18725
18743
|
this.callKit.logger.debug("connect refer");
|
|
18726
18744
|
const target = UserAgent.makeURI(referTo);
|
|
18727
|
-
this.currentSession.refer(target);
|
|
18745
|
+
this.currentSession.refer(target, options);
|
|
18728
18746
|
}
|
|
18729
18747
|
};
|
|
18730
18748
|
|
|
@@ -19159,24 +19177,35 @@ var WebCall = (() => {
|
|
|
19159
19177
|
this.config.reset();
|
|
19160
19178
|
this.trigger(KitEvent.KIT_LOGIN_CHANGE, false);
|
|
19161
19179
|
}
|
|
19162
|
-
async call(extno
|
|
19180
|
+
async call(extno = "", options = {
|
|
19181
|
+
sourceType: CallSourceType.phoneNum,
|
|
19182
|
+
workOrderId: ""
|
|
19183
|
+
}) {
|
|
19163
19184
|
if (!this.config.check())
|
|
19164
19185
|
return;
|
|
19165
19186
|
if (!this.connect.isRegistered()) {
|
|
19166
19187
|
this.logger.warn("Currently not registered");
|
|
19167
19188
|
return;
|
|
19168
19189
|
}
|
|
19169
|
-
|
|
19170
|
-
|
|
19190
|
+
const { sourceType, workOrderId } = options;
|
|
19191
|
+
this.config.setUserInfo("sourceType", sourceType);
|
|
19192
|
+
if (sourceType === CallSourceType.phoneNum) {
|
|
19193
|
+
if (extno) {
|
|
19194
|
+
this.config.setUserInfo("extno", extno);
|
|
19195
|
+
}
|
|
19196
|
+
} else if (sourceType === CallSourceType.workOrderId) {
|
|
19197
|
+
if (workOrderId) {
|
|
19198
|
+
this.config.setUserInfo("workOrderId", workOrderId);
|
|
19199
|
+
}
|
|
19171
19200
|
}
|
|
19172
19201
|
this.logger.debug("call");
|
|
19173
19202
|
this.callCenter.callStart();
|
|
19174
19203
|
}
|
|
19175
|
-
async refer(uri) {
|
|
19204
|
+
async refer(uri, options) {
|
|
19176
19205
|
if (!this.config.check())
|
|
19177
19206
|
return;
|
|
19178
19207
|
this.logger.debug("refer");
|
|
19179
|
-
this.callCenter.callRefer(uri);
|
|
19208
|
+
this.callCenter.callRefer(uri, options);
|
|
19180
19209
|
}
|
|
19181
19210
|
async register() {
|
|
19182
19211
|
if (!this.config.check())
|