@koi-design/callkit 1.0.24-beta.44 → 1.0.24-beta.45

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 CHANGED
@@ -228,6 +228,7 @@ declare class Logger {
228
228
  prefix: string;
229
229
  level: LoggerLevel;
230
230
  logData: Record<LogDataType, any[]>;
231
+ sendSdkLogData: any[];
231
232
  private callKit;
232
233
  constructor(callKit: CallKit, level?: LoggerLevel);
233
234
  static formatStrLog(logObj: any): string;
@@ -3877,6 +3877,7 @@ var WebCall = (() => {
3877
3877
  reconnect: [],
3878
3878
  all: []
3879
3879
  };
3880
+ sendSdkLogData = [];
3880
3881
  callKit;
3881
3882
  constructor(callKit, level) {
3882
3883
  this.callKit = callKit;
@@ -3889,6 +3890,7 @@ var WebCall = (() => {
3889
3890
  reconnect: [],
3890
3891
  all: []
3891
3892
  };
3893
+ this.sendSdkLogData = [];
3892
3894
  }
3893
3895
  static formatStrLog(logObj) {
3894
3896
  const {
@@ -4049,16 +4051,29 @@ var WebCall = (() => {
4049
4051
  */
4050
4052
  async sdkLog(data) {
4051
4053
  const strLog = Logger.formatStrLog(data);
4052
- return this.post({
4053
- // headers: {
4054
- // 'Content-Type': 'application/json'
4055
- // },
4056
- url: "/agent/user/sdkLog",
4057
- method: "post",
4058
- data: {
4059
- content: strLog
4060
- }
4061
- });
4054
+ const allData = this.callKit.logger.sendSdkLogData.join(",");
4055
+ const encoder = new TextEncoder();
4056
+ const size = encoder.encode(allData).length;
4057
+ if (size < 8192) {
4058
+ this.callKit.logger.sendSdkLogData.push(strLog);
4059
+ } else {
4060
+ let logsToSend = this.callKit.logger.sendSdkLogData.slice();
4061
+ logsToSend = JSON.stringify(logsToSend);
4062
+ this.callKit.logger.sendSdkLogData = [strLog];
4063
+ return this.post({
4064
+ // headers: {
4065
+ // 'Content-Type': 'application/json'
4066
+ // },
4067
+ url: "/agent/user/sdkLog",
4068
+ method: "post",
4069
+ headers: {
4070
+ "Content-Type": "application/json"
4071
+ },
4072
+ data: {
4073
+ content: logsToSend
4074
+ }
4075
+ });
4076
+ }
4062
4077
  }
4063
4078
  /**
4064
4079
  *