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