@howone/sdk 0.2.4 → 0.2.6

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.js CHANGED
@@ -3421,12 +3421,22 @@ var ErrorTracking = class {
3421
3421
  }, 5e3);
3422
3422
  return false;
3423
3423
  }
3424
+ /**
3425
+ * 判断是否是 504 错误,需要立即发送
3426
+ */
3427
+ isCriticalNetworkError(error, details) {
3428
+ const message = error.message?.toLowerCase() || "";
3429
+ return message.includes("504") || message.includes("gateway timeout");
3430
+ }
3424
3431
  /**
3425
3432
  * 发送统一格式的错误
3426
3433
  */
3427
3434
  sendUnifiedError(error, details = {}) {
3428
3435
  if (window.parent === window) return;
3429
- if (!this.fullyInitialized) return;
3436
+ const isCriticalError = this.isCriticalNetworkError(error, details);
3437
+ if (!isCriticalError && !this.fullyInitialized) {
3438
+ return;
3439
+ }
3430
3440
  try {
3431
3441
  const currentViewInfo = this.viewDetector?.getCurrentViewInfo();
3432
3442
  const payload = {
@@ -5960,7 +5970,7 @@ function createClient(opts) {
5960
5970
  function makeRequestFromBase(base) {
5961
5971
  return new request_default({
5962
5972
  baseURL: base,
5963
- timeout: 6e4,
5973
+ timeout: 3e5,
5964
5974
  interceptors: {
5965
5975
  requestInterceptor: (config) => {
5966
5976
  config.headers = config.headers || {};