@koi-design/callkit 2.3.1 → 2.3.2-beta.2

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.
@@ -3893,7 +3893,7 @@ var WebCall = (() => {
3893
3893
  // package.json
3894
3894
  var package_default = {
3895
3895
  name: "@koi-design/callkit",
3896
- version: "2.3.1",
3896
+ version: "2.3.2-beta.2",
3897
3897
  description: "callkit",
3898
3898
  author: "koi",
3899
3899
  license: "ISC",
@@ -20157,17 +20157,7 @@ self.onmessage = function(e) {
20157
20157
  this.setConnectAuthState("isConnected", false);
20158
20158
  const { enabled } = this.reconnectConfig;
20159
20159
  if (!this.callKit.config.isLogin() || !enabled) {
20160
- if (this.callKit.connect.isCalling()) {
20161
- this.callKit.logger.warn("Disconnect during call, delay reset", {
20162
- caller: "Socket.handleDisconnect",
20163
- type: "INCALL",
20164
- content: {
20165
- connectStatus: this.callKit.connect.connectStatus
20166
- }
20167
- });
20168
- } else {
20169
- this.callKit.reset();
20170
- }
20160
+ this.callKit.reset();
20171
20161
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
20172
20162
  event: "INCALL_NOT_CONNECTED"
20173
20163
  });
@@ -20395,18 +20385,6 @@ self.onmessage = function(e) {
20395
20385
  this.send(SocketSendEvent.END, { agentId: userInfo.agentId, callUuid });
20396
20386
  }
20397
20387
  if (data.event === SocketReceiveEvent.ERROR) {
20398
- if (this.callKit.connect.isCalling()) {
20399
- this.callKit.logger.warn("socket onMessage error during call, ignore", {
20400
- caller: "Socket.onMessage",
20401
- type: "INCALL",
20402
- content: {
20403
- errCode: ErrorCode.SOCKET_CONNECT_ERROR,
20404
- isCalling: this.callKit.connect.isCalling(),
20405
- data: content
20406
- }
20407
- });
20408
- return;
20409
- }
20410
20388
  this.setConnectAuthState("isError", true);
20411
20389
  this.callKit.reset();
20412
20390
  this.callKit.logger.error(data.msg, {
@@ -20422,9 +20400,7 @@ self.onmessage = function(e) {
20422
20400
  }
20423
20401
  if (data.event === SocketReceiveEvent.SESSION_ERROR) {
20424
20402
  this.setConnectAuthState("isError", true);
20425
- if (!this.callKit.connect.isCalling()) {
20426
- this.callKit.reset();
20427
- }
20403
+ this.callKit.reset();
20428
20404
  this.callKit.logger.error(data.msg, {
20429
20405
  caller: `Socket.onMessage:${data.event}`,
20430
20406
  type: "INCALL",
@@ -20464,18 +20440,6 @@ self.onmessage = function(e) {
20464
20440
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
20465
20441
  event: "INCALL_NOT_CONNECTED"
20466
20442
  });
20467
- if (this.callKit.connect.isCalling()) {
20468
- this.callKit.logger.warn("socket send during call, ignore", {
20469
- caller: "Socket.onMessage",
20470
- type: "INCALL",
20471
- content: {
20472
- errCode: ErrorCode.SOCKET_CONNECT_ERROR,
20473
- isCalling: this.callKit.connect.isCalling(),
20474
- data: message
20475
- }
20476
- });
20477
- return;
20478
- }
20479
20443
  this.callKit.reset();
20480
20444
  this.callKit.logger.error("socket not connected", {
20481
20445
  caller: "Socket.send",
@@ -20600,24 +20564,18 @@ self.onmessage = function(e) {
20600
20564
  this.heartbeatManager.destroy();
20601
20565
  }
20602
20566
  attemptReconnect() {
20567
+ if (this.connectAuthState.isReconnecting) {
20568
+ return;
20569
+ }
20570
+ if (this.connectAuthState.isError) {
20571
+ return;
20572
+ }
20603
20573
  if (this.reconnectTimer) {
20604
20574
  clearTimeout(this.reconnectTimer);
20605
20575
  this.reconnectTimer = void 0;
20606
20576
  }
20607
20577
  const { maxAttempts } = this.reconnectConfig;
20608
20578
  if (this.reconnectAttempts >= maxAttempts) {
20609
- if (this.callKit.connect.isCalling()) {
20610
- this.callKit.logger.warn("reconnect during call, ignore", {
20611
- caller: "Socket.attemptReconnect",
20612
- type: "INCALL",
20613
- content: {
20614
- errCode: ErrorCode.SOCKET_RECONNECT_FAILED,
20615
- isCalling: this.callKit.connect.isCalling(),
20616
- reconnectAttempts: this.reconnectAttempts
20617
- }
20618
- });
20619
- return;
20620
- }
20621
20579
  if (this.isUserSetPingTryCount) {
20622
20580
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
20623
20581
  event: "INCALL_PING_TIMEOUT_RECONNECT_FAILED_MAX_ATTEMPTS"
package/dist/index.js CHANGED
@@ -728,7 +728,7 @@ var Call = class {
728
728
  // package.json
729
729
  var package_default = {
730
730
  name: "@koi-design/callkit",
731
- version: "2.3.1",
731
+ version: "2.3.2-beta.2",
732
732
  description: "callkit",
733
733
  author: "koi",
734
734
  license: "ISC",
@@ -16992,17 +16992,7 @@ var Socket = class {
16992
16992
  this.setConnectAuthState("isConnected", false);
16993
16993
  const { enabled } = this.reconnectConfig;
16994
16994
  if (!this.callKit.config.isLogin() || !enabled) {
16995
- if (this.callKit.connect.isCalling()) {
16996
- this.callKit.logger.warn("Disconnect during call, delay reset", {
16997
- caller: "Socket.handleDisconnect",
16998
- type: "INCALL",
16999
- content: {
17000
- connectStatus: this.callKit.connect.connectStatus
17001
- }
17002
- });
17003
- } else {
17004
- this.callKit.reset();
17005
- }
16995
+ this.callKit.reset();
17006
16996
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
17007
16997
  event: "INCALL_NOT_CONNECTED"
17008
16998
  });
@@ -17230,18 +17220,6 @@ var Socket = class {
17230
17220
  this.send(SocketSendEvent.END, { agentId: userInfo.agentId, callUuid });
17231
17221
  }
17232
17222
  if (data.event === SocketReceiveEvent.ERROR) {
17233
- if (this.callKit.connect.isCalling()) {
17234
- this.callKit.logger.warn("socket onMessage error during call, ignore", {
17235
- caller: "Socket.onMessage",
17236
- type: "INCALL",
17237
- content: {
17238
- errCode: ErrorCode.SOCKET_CONNECT_ERROR,
17239
- isCalling: this.callKit.connect.isCalling(),
17240
- data: content
17241
- }
17242
- });
17243
- return;
17244
- }
17245
17223
  this.setConnectAuthState("isError", true);
17246
17224
  this.callKit.reset();
17247
17225
  this.callKit.logger.error(data.msg, {
@@ -17257,9 +17235,7 @@ var Socket = class {
17257
17235
  }
17258
17236
  if (data.event === SocketReceiveEvent.SESSION_ERROR) {
17259
17237
  this.setConnectAuthState("isError", true);
17260
- if (!this.callKit.connect.isCalling()) {
17261
- this.callKit.reset();
17262
- }
17238
+ this.callKit.reset();
17263
17239
  this.callKit.logger.error(data.msg, {
17264
17240
  caller: `Socket.onMessage:${data.event}`,
17265
17241
  type: "INCALL",
@@ -17299,18 +17275,6 @@ var Socket = class {
17299
17275
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
17300
17276
  event: "INCALL_NOT_CONNECTED"
17301
17277
  });
17302
- if (this.callKit.connect.isCalling()) {
17303
- this.callKit.logger.warn("socket send during call, ignore", {
17304
- caller: "Socket.onMessage",
17305
- type: "INCALL",
17306
- content: {
17307
- errCode: ErrorCode.SOCKET_CONNECT_ERROR,
17308
- isCalling: this.callKit.connect.isCalling(),
17309
- data: message
17310
- }
17311
- });
17312
- return;
17313
- }
17314
17278
  this.callKit.reset();
17315
17279
  this.callKit.logger.error("socket not connected", {
17316
17280
  caller: "Socket.send",
@@ -17435,24 +17399,18 @@ var Socket = class {
17435
17399
  this.heartbeatManager.destroy();
17436
17400
  }
17437
17401
  attemptReconnect() {
17402
+ if (this.connectAuthState.isReconnecting) {
17403
+ return;
17404
+ }
17405
+ if (this.connectAuthState.isError) {
17406
+ return;
17407
+ }
17438
17408
  if (this.reconnectTimer) {
17439
17409
  clearTimeout(this.reconnectTimer);
17440
17410
  this.reconnectTimer = void 0;
17441
17411
  }
17442
17412
  const { maxAttempts } = this.reconnectConfig;
17443
17413
  if (this.reconnectAttempts >= maxAttempts) {
17444
- if (this.callKit.connect.isCalling()) {
17445
- this.callKit.logger.warn("reconnect during call, ignore", {
17446
- caller: "Socket.attemptReconnect",
17447
- type: "INCALL",
17448
- content: {
17449
- errCode: ErrorCode.SOCKET_RECONNECT_FAILED,
17450
- isCalling: this.callKit.connect.isCalling(),
17451
- reconnectAttempts: this.reconnectAttempts
17452
- }
17453
- });
17454
- return;
17455
- }
17456
17414
  if (this.isUserSetPingTryCount) {
17457
17415
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
17458
17416
  event: "INCALL_PING_TIMEOUT_RECONNECT_FAILED_MAX_ATTEMPTS"
package/dist/index.mjs CHANGED
@@ -701,7 +701,7 @@ var Call = class {
701
701
  // package.json
702
702
  var package_default = {
703
703
  name: "@koi-design/callkit",
704
- version: "2.3.1",
704
+ version: "2.3.2-beta.2",
705
705
  description: "callkit",
706
706
  author: "koi",
707
707
  license: "ISC",
@@ -16965,17 +16965,7 @@ var Socket = class {
16965
16965
  this.setConnectAuthState("isConnected", false);
16966
16966
  const { enabled } = this.reconnectConfig;
16967
16967
  if (!this.callKit.config.isLogin() || !enabled) {
16968
- if (this.callKit.connect.isCalling()) {
16969
- this.callKit.logger.warn("Disconnect during call, delay reset", {
16970
- caller: "Socket.handleDisconnect",
16971
- type: "INCALL",
16972
- content: {
16973
- connectStatus: this.callKit.connect.connectStatus
16974
- }
16975
- });
16976
- } else {
16977
- this.callKit.reset();
16978
- }
16968
+ this.callKit.reset();
16979
16969
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
16980
16970
  event: "INCALL_NOT_CONNECTED"
16981
16971
  });
@@ -17203,18 +17193,6 @@ var Socket = class {
17203
17193
  this.send(SocketSendEvent.END, { agentId: userInfo.agentId, callUuid });
17204
17194
  }
17205
17195
  if (data.event === SocketReceiveEvent.ERROR) {
17206
- if (this.callKit.connect.isCalling()) {
17207
- this.callKit.logger.warn("socket onMessage error during call, ignore", {
17208
- caller: "Socket.onMessage",
17209
- type: "INCALL",
17210
- content: {
17211
- errCode: ErrorCode.SOCKET_CONNECT_ERROR,
17212
- isCalling: this.callKit.connect.isCalling(),
17213
- data: content
17214
- }
17215
- });
17216
- return;
17217
- }
17218
17196
  this.setConnectAuthState("isError", true);
17219
17197
  this.callKit.reset();
17220
17198
  this.callKit.logger.error(data.msg, {
@@ -17230,9 +17208,7 @@ var Socket = class {
17230
17208
  }
17231
17209
  if (data.event === SocketReceiveEvent.SESSION_ERROR) {
17232
17210
  this.setConnectAuthState("isError", true);
17233
- if (!this.callKit.connect.isCalling()) {
17234
- this.callKit.reset();
17235
- }
17211
+ this.callKit.reset();
17236
17212
  this.callKit.logger.error(data.msg, {
17237
17213
  caller: `Socket.onMessage:${data.event}`,
17238
17214
  type: "INCALL",
@@ -17272,18 +17248,6 @@ var Socket = class {
17272
17248
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
17273
17249
  event: "INCALL_NOT_CONNECTED"
17274
17250
  });
17275
- if (this.callKit.connect.isCalling()) {
17276
- this.callKit.logger.warn("socket send during call, ignore", {
17277
- caller: "Socket.onMessage",
17278
- type: "INCALL",
17279
- content: {
17280
- errCode: ErrorCode.SOCKET_CONNECT_ERROR,
17281
- isCalling: this.callKit.connect.isCalling(),
17282
- data: message
17283
- }
17284
- });
17285
- return;
17286
- }
17287
17251
  this.callKit.reset();
17288
17252
  this.callKit.logger.error("socket not connected", {
17289
17253
  caller: "Socket.send",
@@ -17408,24 +17372,18 @@ var Socket = class {
17408
17372
  this.heartbeatManager.destroy();
17409
17373
  }
17410
17374
  attemptReconnect() {
17375
+ if (this.connectAuthState.isReconnecting) {
17376
+ return;
17377
+ }
17378
+ if (this.connectAuthState.isError) {
17379
+ return;
17380
+ }
17411
17381
  if (this.reconnectTimer) {
17412
17382
  clearTimeout(this.reconnectTimer);
17413
17383
  this.reconnectTimer = void 0;
17414
17384
  }
17415
17385
  const { maxAttempts } = this.reconnectConfig;
17416
17386
  if (this.reconnectAttempts >= maxAttempts) {
17417
- if (this.callKit.connect.isCalling()) {
17418
- this.callKit.logger.warn("reconnect during call, ignore", {
17419
- caller: "Socket.attemptReconnect",
17420
- type: "INCALL",
17421
- content: {
17422
- errCode: ErrorCode.SOCKET_RECONNECT_FAILED,
17423
- isCalling: this.callKit.connect.isCalling(),
17424
- reconnectAttempts: this.reconnectAttempts
17425
- }
17426
- });
17427
- return;
17428
- }
17429
17387
  if (this.isUserSetPingTryCount) {
17430
17388
  this.callKit.trigger(KitEvent.INCALL_CONNECT_EVENT, {
17431
17389
  event: "INCALL_PING_TIMEOUT_RECONNECT_FAILED_MAX_ATTEMPTS"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koi-design/callkit",
3
- "version": "2.3.1",
3
+ "version": "2.3.2-beta.2",
4
4
  "description": "callkit",
5
5
  "author": "koi",
6
6
  "license": "ISC",