@nexushub/client 1.1.8 → 1.1.10

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.cjs CHANGED
@@ -1628,7 +1628,6 @@ var VitalsCollector = class {
1628
1628
  tcp_connect: navEntry.connectEnd - navEntry.connectStart,
1629
1629
  request_time: navEntry.responseEnd - navEntry.requestStart,
1630
1630
  dom_load: navEntry.domComplete - navEntry.domInteractive,
1631
- // NEW: raw fields matching Rust NavigationTiming struct
1632
1631
  domain_lookup_start: navEntry.domainLookupStart,
1633
1632
  domain_lookup_end: navEntry.domainLookupEnd,
1634
1633
  connect_start: navEntry.connectStart,
@@ -1641,8 +1640,10 @@ var VitalsCollector = class {
1641
1640
  "resource"
1642
1641
  );
1643
1642
  if (resourceEntries.length > 0) {
1644
- this.metrics.resources = resourceEntries.filter((r) => !r.name.includes("/api/collect")).sort((a, b) => b.duration - a.duration).slice(0, 20).map((r) => ({
1645
- name: r.name,
1643
+ this.metrics.resources = resourceEntries.filter(
1644
+ (r) => !r.name.includes("/api/collect") && !r.name.includes("/analytics") && !r.name.includes("sentry.gnapex.com")
1645
+ ).sort((a, b) => b.duration - a.duration).slice(0, 5).map((r) => ({
1646
+ name: r.name.length > 120 ? r.name.substring(0, 120) + "..." : r.name,
1646
1647
  initiatorType: r.initiatorType,
1647
1648
  duration: Math.round(r.duration),
1648
1649
  transferSize: r.transferSize > 0 ? r.transferSize : void 0,
@@ -1674,7 +1675,7 @@ var VitalsCollector = class {
1674
1675
  var vitalsCollector = new VitalsCollector();
1675
1676
  var initVitals = (_tracker) => {
1676
1677
  if (process.env.NODE_ENV === "development") {
1677
- console.log("[NexusHub] Web Vitals monitoring active");
1678
+ console.log("[GN-Apex] Web Vitals monitoring active");
1678
1679
  }
1679
1680
  };
1680
1681
 
@@ -1827,7 +1828,8 @@ var Tracker = class {
1827
1828
  this.anonymousId = "";
1828
1829
  this.isFlushing = false;
1829
1830
  this.flushPromise = null;
1830
- this.batchSize = 25;
1831
+ // 🛡️ Batch size set to 10 to keep payloads strictly under Actix 32KB limit
1832
+ this.batchSize = 10;
1831
1833
  this.config = config;
1832
1834
  this.endpoint = `${this.config.analyticsUrl}/api/collect`;
1833
1835
  this.circuitBreaker = new CircuitBreaker();
@@ -1839,7 +1841,7 @@ var Tracker = class {
1839
1841
  }
1840
1842
  async initSession() {
1841
1843
  this.visitorId = await getVisitorId(
1842
- this.config.privacy?.fingerprinting ?? false
1844
+ this.config.privacy?.fingerprinting ?? true
1843
1845
  );
1844
1846
  let anonId = safeGetItem("nexus_anon_id");
1845
1847
  if (!anonId) {
@@ -1865,10 +1867,11 @@ var Tracker = class {
1865
1867
  if (typeof window === "undefined") return;
1866
1868
  safeSetItem("nexus_last_active", Date.now().toString());
1867
1869
  const entropy = await getDeviceEntropy(
1868
- this.config.privacy?.fingerprinting ?? false
1870
+ this.config.privacy?.fingerprinting ?? true
1869
1871
  );
1870
- const perfMetrics = vitalsCollector.getMetricsSnapshot();
1871
- const utmParams = extractUtmParams(window.location.href);
1872
+ const isPageView = eventType === "page_view" || eventType === "performance";
1873
+ const perfMetrics = isPageView ? vitalsCollector.getMetricsSnapshot() : void 0;
1874
+ const utmParams = isPageView ? extractUtmParams(window.location.href) : void 0;
1872
1875
  const payload = {
1873
1876
  projectId: this.config.projectId,
1874
1877
  sessionId: this.sessionId,
@@ -1877,10 +1880,9 @@ var Tracker = class {
1877
1880
  messageId: generateUUID(),
1878
1881
  sentAt: (/* @__PURE__ */ new Date()).toISOString(),
1879
1882
  version: SDK_VERSION,
1880
- // Dynamically synced to SDK 1.1.0
1881
1883
  url: window.location.href,
1882
- referrer: document.referrer,
1883
- userAgent: window.navigator.userAgent,
1884
+ referrer: isPageView ? document.referrer : void 0,
1885
+ userAgent: isPageView ? window.navigator.userAgent : void 0,
1884
1886
  screenWidth: window.screen.width,
1885
1887
  screenHeight: window.screen.height,
1886
1888
  language: window.navigator.language,
@@ -1943,6 +1945,10 @@ var Tracker = class {
1943
1945
  } catch {
1944
1946
  response = void 0;
1945
1947
  }
1948
+ if (response && response.status === 413) {
1949
+ await eventStorage.remove(storedEvents.map((e) => e.id));
1950
+ return;
1951
+ }
1946
1952
  if (!response || response.status === 404 || response.status === 405) {
1947
1953
  const results = await Promise.allSettled(
1948
1954
  payloads.map(
@@ -1955,7 +1961,7 @@ var Tracker = class {
1955
1961
  )
1956
1962
  );
1957
1963
  const successIds = results.flatMap(
1958
- (r, i) => r.status === "fulfilled" && r.value.ok ? [storedEvents[i].id] : []
1964
+ (r, i) => r.status === "fulfilled" && (r.value.ok || r.value.status === 413) ? [storedEvents[i].id] : []
1959
1965
  );
1960
1966
  if (successIds.length) await eventStorage.remove(successIds);
1961
1967
  if (successIds.length === storedEvents.length) {
package/dist/index.js CHANGED
@@ -1572,7 +1572,6 @@ var VitalsCollector = class {
1572
1572
  tcp_connect: navEntry.connectEnd - navEntry.connectStart,
1573
1573
  request_time: navEntry.responseEnd - navEntry.requestStart,
1574
1574
  dom_load: navEntry.domComplete - navEntry.domInteractive,
1575
- // NEW: raw fields matching Rust NavigationTiming struct
1576
1575
  domain_lookup_start: navEntry.domainLookupStart,
1577
1576
  domain_lookup_end: navEntry.domainLookupEnd,
1578
1577
  connect_start: navEntry.connectStart,
@@ -1585,8 +1584,10 @@ var VitalsCollector = class {
1585
1584
  "resource"
1586
1585
  );
1587
1586
  if (resourceEntries.length > 0) {
1588
- this.metrics.resources = resourceEntries.filter((r) => !r.name.includes("/api/collect")).sort((a, b) => b.duration - a.duration).slice(0, 20).map((r) => ({
1589
- name: r.name,
1587
+ this.metrics.resources = resourceEntries.filter(
1588
+ (r) => !r.name.includes("/api/collect") && !r.name.includes("/analytics") && !r.name.includes("sentry.gnapex.com")
1589
+ ).sort((a, b) => b.duration - a.duration).slice(0, 5).map((r) => ({
1590
+ name: r.name.length > 120 ? r.name.substring(0, 120) + "..." : r.name,
1590
1591
  initiatorType: r.initiatorType,
1591
1592
  duration: Math.round(r.duration),
1592
1593
  transferSize: r.transferSize > 0 ? r.transferSize : void 0,
@@ -1618,7 +1619,7 @@ var VitalsCollector = class {
1618
1619
  var vitalsCollector = new VitalsCollector();
1619
1620
  var initVitals = (_tracker) => {
1620
1621
  if (process.env.NODE_ENV === "development") {
1621
- console.log("[NexusHub] Web Vitals monitoring active");
1622
+ console.log("[GN-Apex] Web Vitals monitoring active");
1622
1623
  }
1623
1624
  };
1624
1625
 
@@ -1771,7 +1772,8 @@ var Tracker = class {
1771
1772
  this.anonymousId = "";
1772
1773
  this.isFlushing = false;
1773
1774
  this.flushPromise = null;
1774
- this.batchSize = 25;
1775
+ // 🛡️ Batch size set to 10 to keep payloads strictly under Actix 32KB limit
1776
+ this.batchSize = 10;
1775
1777
  this.config = config;
1776
1778
  this.endpoint = `${this.config.analyticsUrl}/api/collect`;
1777
1779
  this.circuitBreaker = new CircuitBreaker();
@@ -1783,7 +1785,7 @@ var Tracker = class {
1783
1785
  }
1784
1786
  async initSession() {
1785
1787
  this.visitorId = await getVisitorId(
1786
- this.config.privacy?.fingerprinting ?? false
1788
+ this.config.privacy?.fingerprinting ?? true
1787
1789
  );
1788
1790
  let anonId = safeGetItem("nexus_anon_id");
1789
1791
  if (!anonId) {
@@ -1809,10 +1811,11 @@ var Tracker = class {
1809
1811
  if (typeof window === "undefined") return;
1810
1812
  safeSetItem("nexus_last_active", Date.now().toString());
1811
1813
  const entropy = await getDeviceEntropy(
1812
- this.config.privacy?.fingerprinting ?? false
1814
+ this.config.privacy?.fingerprinting ?? true
1813
1815
  );
1814
- const perfMetrics = vitalsCollector.getMetricsSnapshot();
1815
- const utmParams = extractUtmParams(window.location.href);
1816
+ const isPageView = eventType === "page_view" || eventType === "performance";
1817
+ const perfMetrics = isPageView ? vitalsCollector.getMetricsSnapshot() : void 0;
1818
+ const utmParams = isPageView ? extractUtmParams(window.location.href) : void 0;
1816
1819
  const payload = {
1817
1820
  projectId: this.config.projectId,
1818
1821
  sessionId: this.sessionId,
@@ -1821,10 +1824,9 @@ var Tracker = class {
1821
1824
  messageId: generateUUID(),
1822
1825
  sentAt: (/* @__PURE__ */ new Date()).toISOString(),
1823
1826
  version: SDK_VERSION,
1824
- // Dynamically synced to SDK 1.1.0
1825
1827
  url: window.location.href,
1826
- referrer: document.referrer,
1827
- userAgent: window.navigator.userAgent,
1828
+ referrer: isPageView ? document.referrer : void 0,
1829
+ userAgent: isPageView ? window.navigator.userAgent : void 0,
1828
1830
  screenWidth: window.screen.width,
1829
1831
  screenHeight: window.screen.height,
1830
1832
  language: window.navigator.language,
@@ -1887,6 +1889,10 @@ var Tracker = class {
1887
1889
  } catch {
1888
1890
  response = void 0;
1889
1891
  }
1892
+ if (response && response.status === 413) {
1893
+ await eventStorage.remove(storedEvents.map((e) => e.id));
1894
+ return;
1895
+ }
1890
1896
  if (!response || response.status === 404 || response.status === 405) {
1891
1897
  const results = await Promise.allSettled(
1892
1898
  payloads.map(
@@ -1899,7 +1905,7 @@ var Tracker = class {
1899
1905
  )
1900
1906
  );
1901
1907
  const successIds = results.flatMap(
1902
- (r, i) => r.status === "fulfilled" && r.value.ok ? [storedEvents[i].id] : []
1908
+ (r, i) => r.status === "fulfilled" && (r.value.ok || r.value.status === 413) ? [storedEvents[i].id] : []
1903
1909
  );
1904
1910
  if (successIds.length) await eventStorage.remove(successIds);
1905
1911
  if (successIds.length === storedEvents.length) {
package/dist/react.cjs CHANGED
@@ -1551,7 +1551,6 @@ var VitalsCollector = class {
1551
1551
  tcp_connect: navEntry.connectEnd - navEntry.connectStart,
1552
1552
  request_time: navEntry.responseEnd - navEntry.requestStart,
1553
1553
  dom_load: navEntry.domComplete - navEntry.domInteractive,
1554
- // NEW: raw fields matching Rust NavigationTiming struct
1555
1554
  domain_lookup_start: navEntry.domainLookupStart,
1556
1555
  domain_lookup_end: navEntry.domainLookupEnd,
1557
1556
  connect_start: navEntry.connectStart,
@@ -1564,8 +1563,10 @@ var VitalsCollector = class {
1564
1563
  "resource"
1565
1564
  );
1566
1565
  if (resourceEntries.length > 0) {
1567
- this.metrics.resources = resourceEntries.filter((r) => !r.name.includes("/api/collect")).sort((a, b) => b.duration - a.duration).slice(0, 20).map((r) => ({
1568
- name: r.name,
1566
+ this.metrics.resources = resourceEntries.filter(
1567
+ (r) => !r.name.includes("/api/collect") && !r.name.includes("/analytics") && !r.name.includes("sentry.gnapex.com")
1568
+ ).sort((a, b) => b.duration - a.duration).slice(0, 5).map((r) => ({
1569
+ name: r.name.length > 120 ? r.name.substring(0, 120) + "..." : r.name,
1569
1570
  initiatorType: r.initiatorType,
1570
1571
  duration: Math.round(r.duration),
1571
1572
  transferSize: r.transferSize > 0 ? r.transferSize : void 0,
@@ -1597,7 +1598,7 @@ var VitalsCollector = class {
1597
1598
  var vitalsCollector = new VitalsCollector();
1598
1599
  var initVitals = (_tracker) => {
1599
1600
  if (process.env.NODE_ENV === "development") {
1600
- console.log("[NexusHub] Web Vitals monitoring active");
1601
+ console.log("[GN-Apex] Web Vitals monitoring active");
1601
1602
  }
1602
1603
  };
1603
1604
 
@@ -1750,7 +1751,8 @@ var Tracker = class {
1750
1751
  this.anonymousId = "";
1751
1752
  this.isFlushing = false;
1752
1753
  this.flushPromise = null;
1753
- this.batchSize = 25;
1754
+ // 🛡️ Batch size set to 10 to keep payloads strictly under Actix 32KB limit
1755
+ this.batchSize = 10;
1754
1756
  this.config = config;
1755
1757
  this.endpoint = `${this.config.analyticsUrl}/api/collect`;
1756
1758
  this.circuitBreaker = new CircuitBreaker();
@@ -1762,7 +1764,7 @@ var Tracker = class {
1762
1764
  }
1763
1765
  async initSession() {
1764
1766
  this.visitorId = await getVisitorId(
1765
- _nullishCoalesce(_optionalChain([this, 'access', _27 => _27.config, 'access', _28 => _28.privacy, 'optionalAccess', _29 => _29.fingerprinting]), () => ( false))
1767
+ _nullishCoalesce(_optionalChain([this, 'access', _27 => _27.config, 'access', _28 => _28.privacy, 'optionalAccess', _29 => _29.fingerprinting]), () => ( true))
1766
1768
  );
1767
1769
  let anonId = safeGetItem("nexus_anon_id");
1768
1770
  if (!anonId) {
@@ -1788,10 +1790,11 @@ var Tracker = class {
1788
1790
  if (typeof window === "undefined") return;
1789
1791
  safeSetItem("nexus_last_active", Date.now().toString());
1790
1792
  const entropy = await getDeviceEntropy(
1791
- _nullishCoalesce(_optionalChain([this, 'access', _30 => _30.config, 'access', _31 => _31.privacy, 'optionalAccess', _32 => _32.fingerprinting]), () => ( false))
1793
+ _nullishCoalesce(_optionalChain([this, 'access', _30 => _30.config, 'access', _31 => _31.privacy, 'optionalAccess', _32 => _32.fingerprinting]), () => ( true))
1792
1794
  );
1793
- const perfMetrics = vitalsCollector.getMetricsSnapshot();
1794
- const utmParams = extractUtmParams(window.location.href);
1795
+ const isPageView = eventType === "page_view" || eventType === "performance";
1796
+ const perfMetrics = isPageView ? vitalsCollector.getMetricsSnapshot() : void 0;
1797
+ const utmParams = isPageView ? extractUtmParams(window.location.href) : void 0;
1795
1798
  const payload = {
1796
1799
  projectId: this.config.projectId,
1797
1800
  sessionId: this.sessionId,
@@ -1800,10 +1803,9 @@ var Tracker = class {
1800
1803
  messageId: generateUUID(),
1801
1804
  sentAt: (/* @__PURE__ */ new Date()).toISOString(),
1802
1805
  version: _chunkOP3LNZPCcjs.SDK_VERSION,
1803
- // Dynamically synced to SDK 1.1.0
1804
1806
  url: window.location.href,
1805
- referrer: document.referrer,
1806
- userAgent: window.navigator.userAgent,
1807
+ referrer: isPageView ? document.referrer : void 0,
1808
+ userAgent: isPageView ? window.navigator.userAgent : void 0,
1807
1809
  screenWidth: window.screen.width,
1808
1810
  screenHeight: window.screen.height,
1809
1811
  language: window.navigator.language,
@@ -1866,6 +1868,10 @@ var Tracker = class {
1866
1868
  } catch (e17) {
1867
1869
  response = void 0;
1868
1870
  }
1871
+ if (response && response.status === 413) {
1872
+ await eventStorage.remove(storedEvents.map((e) => e.id));
1873
+ return;
1874
+ }
1869
1875
  if (!response || response.status === 404 || response.status === 405) {
1870
1876
  const results = await Promise.allSettled(
1871
1877
  payloads.map(
@@ -1878,7 +1884,7 @@ var Tracker = class {
1878
1884
  )
1879
1885
  );
1880
1886
  const successIds = results.flatMap(
1881
- (r, i) => r.status === "fulfilled" && r.value.ok ? [storedEvents[i].id] : []
1887
+ (r, i) => r.status === "fulfilled" && (r.value.ok || r.value.status === 413) ? [storedEvents[i].id] : []
1882
1888
  );
1883
1889
  if (successIds.length) await eventStorage.remove(successIds);
1884
1890
  if (successIds.length === storedEvents.length) {
package/dist/react.js CHANGED
@@ -1551,7 +1551,6 @@ var VitalsCollector = class {
1551
1551
  tcp_connect: navEntry.connectEnd - navEntry.connectStart,
1552
1552
  request_time: navEntry.responseEnd - navEntry.requestStart,
1553
1553
  dom_load: navEntry.domComplete - navEntry.domInteractive,
1554
- // NEW: raw fields matching Rust NavigationTiming struct
1555
1554
  domain_lookup_start: navEntry.domainLookupStart,
1556
1555
  domain_lookup_end: navEntry.domainLookupEnd,
1557
1556
  connect_start: navEntry.connectStart,
@@ -1564,8 +1563,10 @@ var VitalsCollector = class {
1564
1563
  "resource"
1565
1564
  );
1566
1565
  if (resourceEntries.length > 0) {
1567
- this.metrics.resources = resourceEntries.filter((r) => !r.name.includes("/api/collect")).sort((a, b) => b.duration - a.duration).slice(0, 20).map((r) => ({
1568
- name: r.name,
1566
+ this.metrics.resources = resourceEntries.filter(
1567
+ (r) => !r.name.includes("/api/collect") && !r.name.includes("/analytics") && !r.name.includes("sentry.gnapex.com")
1568
+ ).sort((a, b) => b.duration - a.duration).slice(0, 5).map((r) => ({
1569
+ name: r.name.length > 120 ? r.name.substring(0, 120) + "..." : r.name,
1569
1570
  initiatorType: r.initiatorType,
1570
1571
  duration: Math.round(r.duration),
1571
1572
  transferSize: r.transferSize > 0 ? r.transferSize : void 0,
@@ -1597,7 +1598,7 @@ var VitalsCollector = class {
1597
1598
  var vitalsCollector = new VitalsCollector();
1598
1599
  var initVitals = (_tracker) => {
1599
1600
  if (process.env.NODE_ENV === "development") {
1600
- console.log("[NexusHub] Web Vitals monitoring active");
1601
+ console.log("[GN-Apex] Web Vitals monitoring active");
1601
1602
  }
1602
1603
  };
1603
1604
 
@@ -1750,7 +1751,8 @@ var Tracker = class {
1750
1751
  this.anonymousId = "";
1751
1752
  this.isFlushing = false;
1752
1753
  this.flushPromise = null;
1753
- this.batchSize = 25;
1754
+ // 🛡️ Batch size set to 10 to keep payloads strictly under Actix 32KB limit
1755
+ this.batchSize = 10;
1754
1756
  this.config = config;
1755
1757
  this.endpoint = `${this.config.analyticsUrl}/api/collect`;
1756
1758
  this.circuitBreaker = new CircuitBreaker();
@@ -1762,7 +1764,7 @@ var Tracker = class {
1762
1764
  }
1763
1765
  async initSession() {
1764
1766
  this.visitorId = await getVisitorId(
1765
- this.config.privacy?.fingerprinting ?? false
1767
+ this.config.privacy?.fingerprinting ?? true
1766
1768
  );
1767
1769
  let anonId = safeGetItem("nexus_anon_id");
1768
1770
  if (!anonId) {
@@ -1788,10 +1790,11 @@ var Tracker = class {
1788
1790
  if (typeof window === "undefined") return;
1789
1791
  safeSetItem("nexus_last_active", Date.now().toString());
1790
1792
  const entropy = await getDeviceEntropy(
1791
- this.config.privacy?.fingerprinting ?? false
1793
+ this.config.privacy?.fingerprinting ?? true
1792
1794
  );
1793
- const perfMetrics = vitalsCollector.getMetricsSnapshot();
1794
- const utmParams = extractUtmParams(window.location.href);
1795
+ const isPageView = eventType === "page_view" || eventType === "performance";
1796
+ const perfMetrics = isPageView ? vitalsCollector.getMetricsSnapshot() : void 0;
1797
+ const utmParams = isPageView ? extractUtmParams(window.location.href) : void 0;
1795
1798
  const payload = {
1796
1799
  projectId: this.config.projectId,
1797
1800
  sessionId: this.sessionId,
@@ -1800,10 +1803,9 @@ var Tracker = class {
1800
1803
  messageId: generateUUID(),
1801
1804
  sentAt: (/* @__PURE__ */ new Date()).toISOString(),
1802
1805
  version: SDK_VERSION,
1803
- // Dynamically synced to SDK 1.1.0
1804
1806
  url: window.location.href,
1805
- referrer: document.referrer,
1806
- userAgent: window.navigator.userAgent,
1807
+ referrer: isPageView ? document.referrer : void 0,
1808
+ userAgent: isPageView ? window.navigator.userAgent : void 0,
1807
1809
  screenWidth: window.screen.width,
1808
1810
  screenHeight: window.screen.height,
1809
1811
  language: window.navigator.language,
@@ -1866,6 +1868,10 @@ var Tracker = class {
1866
1868
  } catch {
1867
1869
  response = void 0;
1868
1870
  }
1871
+ if (response && response.status === 413) {
1872
+ await eventStorage.remove(storedEvents.map((e) => e.id));
1873
+ return;
1874
+ }
1869
1875
  if (!response || response.status === 404 || response.status === 405) {
1870
1876
  const results = await Promise.allSettled(
1871
1877
  payloads.map(
@@ -1878,7 +1884,7 @@ var Tracker = class {
1878
1884
  )
1879
1885
  );
1880
1886
  const successIds = results.flatMap(
1881
- (r, i) => r.status === "fulfilled" && r.value.ok ? [storedEvents[i].id] : []
1887
+ (r, i) => r.status === "fulfilled" && (r.value.ok || r.value.status === 413) ? [storedEvents[i].id] : []
1882
1888
  );
1883
1889
  if (successIds.length) await eventStorage.remove(successIds);
1884
1890
  if (successIds.length === storedEvents.length) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexushub/client",
3
3
  "private": false,
4
- "version": "1.1.8",
4
+ "version": "1.1.10",
5
5
  "description": "GN-Apex zero-config production runtime SDK",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",