customer-chat-sdk 1.3.6 → 1.3.7

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.
@@ -29685,13 +29685,9 @@ class CustomerServiceSDK {
29685
29685
  timestamp: Date.now()
29686
29686
  };
29687
29687
  // 处理图标管理器(优化:如果配置没变化,保留图标避免闪烁)
29688
- // 如果 options 未提供,使用之前保存的配置(避免更新 token 时图标闪烁)
29689
- const iconPosition = options?.iconPosition !== undefined
29690
- ? options.iconPosition
29691
- : (this.lastIconConfig?.position || undefined);
29692
- const iconTarget = options?.target !== undefined
29693
- ? options.target
29694
- : (this.lastIconConfig?.target || undefined);
29688
+ // target iconPosition 只从 config 读取
29689
+ const iconPosition = config.iconPosition ?? this.lastIconConfig?.position;
29690
+ const iconTarget = config.target ?? this.lastIconConfig?.target;
29695
29691
  // 检查图标配置是否变化
29696
29692
  const iconConfigChanged = this.isIconConfigChanged(iconPosition, iconTarget);
29697
29693
  if (iconConfigChanged) {
@@ -29704,12 +29700,12 @@ class CustomerServiceSDK {
29704
29700
  }
29705
29701
  }
29706
29702
  this.iconManager = new IconManager(iconPosition, this.debug, iconTarget, {
29707
- sideAttach: options?.sideAttach !== undefined ? options.sideAttach : true,
29708
- sideHideRatio: options?.sideHideRatio !== undefined ? options.sideHideRatio : 0.5,
29709
- magnetic: options?.magnetic !== undefined ? options.magnetic : true,
29710
- magneticDirection: options?.magneticDirection || 'x',
29711
- margin: options?.margin !== undefined ? options.margin : 10,
29712
- autoAttachDelay: options?.autoAttachDelay !== undefined ? options.autoAttachDelay : 3000
29703
+ sideAttach: config.sideAttach ?? true,
29704
+ sideHideRatio: config.sideHideRatio ?? 0.5,
29705
+ magnetic: config.magnetic ?? true,
29706
+ magneticDirection: config.magneticDirection ?? 'x',
29707
+ margin: config.margin ?? 10,
29708
+ autoAttachDelay: config.autoAttachDelay ?? 3000
29713
29709
  });
29714
29710
  await this.iconManager.show();
29715
29711
  // 保存新的配置
@@ -29720,12 +29716,12 @@ class CustomerServiceSDK {
29720
29716
  if (!this.iconManager) {
29721
29717
  // 如果不存在,创建新的
29722
29718
  this.iconManager = new IconManager(iconPosition, this.debug, iconTarget, {
29723
- sideAttach: options?.sideAttach !== undefined ? options.sideAttach : true,
29724
- sideHideRatio: options?.sideHideRatio !== undefined ? options.sideHideRatio : 0.5,
29725
- magnetic: options?.magnetic !== undefined ? options.magnetic : true,
29726
- magneticDirection: options?.magneticDirection || 'x',
29727
- margin: options?.margin !== undefined ? options.margin : 10,
29728
- autoAttachDelay: options?.autoAttachDelay !== undefined ? options.autoAttachDelay : 3000
29719
+ sideAttach: config.sideAttach ?? true,
29720
+ sideHideRatio: config.sideHideRatio ?? 0.5,
29721
+ magnetic: config.magnetic ?? true,
29722
+ magneticDirection: config.magneticDirection ?? 'x',
29723
+ margin: config.margin ?? 10,
29724
+ autoAttachDelay: config.autoAttachDelay ?? 3000
29729
29725
  });
29730
29726
  await this.iconManager.show();
29731
29727
  }
@@ -29681,13 +29681,9 @@ class CustomerServiceSDK {
29681
29681
  timestamp: Date.now()
29682
29682
  };
29683
29683
  // 处理图标管理器(优化:如果配置没变化,保留图标避免闪烁)
29684
- // 如果 options 未提供,使用之前保存的配置(避免更新 token 时图标闪烁)
29685
- const iconPosition = options?.iconPosition !== undefined
29686
- ? options.iconPosition
29687
- : (this.lastIconConfig?.position || undefined);
29688
- const iconTarget = options?.target !== undefined
29689
- ? options.target
29690
- : (this.lastIconConfig?.target || undefined);
29684
+ // target iconPosition 只从 config 读取
29685
+ const iconPosition = config.iconPosition ?? this.lastIconConfig?.position;
29686
+ const iconTarget = config.target ?? this.lastIconConfig?.target;
29691
29687
  // 检查图标配置是否变化
29692
29688
  const iconConfigChanged = this.isIconConfigChanged(iconPosition, iconTarget);
29693
29689
  if (iconConfigChanged) {
@@ -29700,12 +29696,12 @@ class CustomerServiceSDK {
29700
29696
  }
29701
29697
  }
29702
29698
  this.iconManager = new IconManager(iconPosition, this.debug, iconTarget, {
29703
- sideAttach: options?.sideAttach !== undefined ? options.sideAttach : true,
29704
- sideHideRatio: options?.sideHideRatio !== undefined ? options.sideHideRatio : 0.5,
29705
- magnetic: options?.magnetic !== undefined ? options.magnetic : true,
29706
- magneticDirection: options?.magneticDirection || 'x',
29707
- margin: options?.margin !== undefined ? options.margin : 10,
29708
- autoAttachDelay: options?.autoAttachDelay !== undefined ? options.autoAttachDelay : 3000
29699
+ sideAttach: config.sideAttach ?? true,
29700
+ sideHideRatio: config.sideHideRatio ?? 0.5,
29701
+ magnetic: config.magnetic ?? true,
29702
+ magneticDirection: config.magneticDirection ?? 'x',
29703
+ margin: config.margin ?? 10,
29704
+ autoAttachDelay: config.autoAttachDelay ?? 3000
29709
29705
  });
29710
29706
  await this.iconManager.show();
29711
29707
  // 保存新的配置
@@ -29716,12 +29712,12 @@ class CustomerServiceSDK {
29716
29712
  if (!this.iconManager) {
29717
29713
  // 如果不存在,创建新的
29718
29714
  this.iconManager = new IconManager(iconPosition, this.debug, iconTarget, {
29719
- sideAttach: options?.sideAttach !== undefined ? options.sideAttach : true,
29720
- sideHideRatio: options?.sideHideRatio !== undefined ? options.sideHideRatio : 0.5,
29721
- magnetic: options?.magnetic !== undefined ? options.magnetic : true,
29722
- magneticDirection: options?.magneticDirection || 'x',
29723
- margin: options?.margin !== undefined ? options.margin : 10,
29724
- autoAttachDelay: options?.autoAttachDelay !== undefined ? options.autoAttachDelay : 3000
29715
+ sideAttach: config.sideAttach ?? true,
29716
+ sideHideRatio: config.sideHideRatio ?? 0.5,
29717
+ magnetic: config.magnetic ?? true,
29718
+ magneticDirection: config.magneticDirection ?? 'x',
29719
+ margin: config.margin ?? 10,
29720
+ autoAttachDelay: config.autoAttachDelay ?? 3000
29725
29721
  });
29726
29722
  await this.iconManager.show();
29727
29723
  }