@devskin/browser-sdk 1.0.29 → 1.0.30

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.
@@ -13692,7 +13692,7 @@ class Transport {
13692
13692
  }
13693
13693
  const items = [...this.queue];
13694
13694
  this.queue = [];
13695
- // Group items by type
13695
+ // Group by type
13696
13696
  const grouped = {};
13697
13697
  items.forEach((item) => {
13698
13698
  if (!grouped[item.type]) {
@@ -13700,10 +13700,23 @@ class Transport {
13700
13700
  }
13701
13701
  grouped[item.type].push(item.data);
13702
13702
  });
13703
- // Send each group
13704
- Object.entries(grouped).forEach(([type, data]) => {
13703
+ // Send each type appropriately
13704
+ Object.entries(grouped).forEach(([type, dataArray]) => {
13705
13705
  const endpoint = this.getEndpointForType(type);
13706
- this.sendToBackend(endpoint, { [type + 's']: data }, useBeacon);
13706
+ if (type === 'event' && dataArray.length > 1) {
13707
+ // Events with batch support
13708
+ this.sendToBackend('/v1/rum/events/batch', { events: dataArray }, useBeacon);
13709
+ }
13710
+ else if (type === 'heatmap') {
13711
+ // Heatmap expects array format
13712
+ this.sendToBackend(endpoint, { heatmaps: dataArray }, useBeacon);
13713
+ }
13714
+ else {
13715
+ // Send each item individually (network, performance, error)
13716
+ dataArray.forEach((data) => {
13717
+ this.sendToBackend(endpoint, data, useBeacon);
13718
+ });
13719
+ }
13707
13720
  });
13708
13721
  if (this.config.debug) {
13709
13722
  console.log(`[DevSkin] Flushed ${items.length} items to backend`);