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