sitepong 0.2.0 → 0.2.1

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.
@@ -1,7 +1,7 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { S as SitePongConfig } from '../types-Cms9VXx9.mjs';
2
+ import { S as SitePongConfig } from '../types-CphqOTfm.mjs';
3
3
  export { addBreadcrumb, captureServerException, initServer } from '../server/index.mjs';
4
- import '../types-BEqbz0tw.mjs';
4
+ import '../types-DPINdOQW.mjs';
5
5
 
6
6
  /**
7
7
  * Next.js integration for SitePong
@@ -1,7 +1,7 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { S as SitePongConfig } from '../types-DQSv7JAE.js';
2
+ import { S as SitePongConfig } from '../types-BTA43eyz.js';
3
3
  export { addBreadcrumb, captureServerException, initServer } from '../server/index.js';
4
- import '../types-BEqbz0tw.js';
4
+ import '../types-DPINdOQW.js';
5
5
 
6
6
  /**
7
7
  * Next.js integration for SitePong
@@ -1,9 +1,9 @@
1
1
  import React, { Component, ReactNode, ErrorInfo } from 'react';
2
2
  import { SitePongInitConfig, ErrorContext, addBreadcrumb, DeviceSignals, WebVitals } from '../index.mjs';
3
3
  export { CapturedError, CronCheckinOptions, CronHandle, DEFAULT_SUPERLINK_ENDPOINT, DatabaseQueryEvent, DatabaseTrackerConfig, DeferredDeepLinkHandler, DeviceInfo, EnvironmentAdapter, FraudCheckResult, MetricOptions, MutableRNEnvironmentAdapter, PerformanceConfig, PerformanceSpan, PerformanceTransaction, PlatformName, ProfileData, ProfileFrame, ProfilerConfig, RemoteConfig, RemoteConfigFeatures, RemoteConfigSampling, ResourceTimingBreakdown, SitePongConfig, SuperLinkClient, SuperLinkConfig, SuperLinkDeepLink, SuperLinkEventType, SuperLinkFingerprint, SuperLinkIdentityMetadata, SuperLinkMatchRequest, SuperLinkMatchResponse, SuperLinkMatchType, SuperLinkPlatform, TraceContext, TracePropagator, VisitorIdResult, WebManagerFactories, areFlagsReady, captureError, captureMessage, captureWebDeepLink, clearAnonymousId, clearUser, client, completeFromScan, createTraceContext, cronCheckin, cronStart, cronWrap, dbTrack, dbTrackSync, endSpan, endTransaction, extractIdentityMetadata, extractTrace, flush, flushMetrics, flushProfiles, generateSpanId, generateTraceId, getAllFlags, getAnonymousId, getDbNPlusOnePatterns, getDbQueryCount, getDeepLink, getDeviceSignals, getFlag, getFraudCheck, getLatestProfile, getMatchedDeepLink, getProfiles, getRemoteConfig, getReplaySessionId, getVariant, getVariantPayload, getVisitorId, getWebVitals, group, identify, init, initRN, initSuperLink, isInitialized, isRemoteConfigFeatureEnabled, isReplayRecording, metricDistribution, metricGauge, metricHistogram, metricIncrement, metricStartTimer, metricTime, onDeferredDeepLink, onRemoteConfigChange, parseUniversalLink, profile, propagateTrace, refreshFlags, registerIdentifyHook, registerWebManagerFactories, resetAnalytics, resetDbQueryCount, setAnonymousId, setContext, setCurrentScreen, setEnvironment, setRNGetCurrentScreen, setTags, setUser, startProfileSpan, startReplay, startSpan, startTransaction, stopReplay, superlinkClient, superlinkIdentify, track, trackPageView, waitForFlags, writeClipboardToken } from '../index.mjs';
4
- import { C as CaptureContext, U as User } from '../types-Cms9VXx9.mjs';
5
- import { T as TrackProperties, U as UserTraits, G as GroupTraits } from '../types-BEqbz0tw.mjs';
6
- export { R as ReplayConfig, a as ReplayEvent } from '../types-BEqbz0tw.mjs';
4
+ import { C as CaptureContext, U as User } from '../types-CphqOTfm.mjs';
5
+ import { T as TrackProperties, U as UserTraits, G as GroupTraits } from '../types-DPINdOQW.mjs';
6
+ export { R as ReplayConfig, a as ReplayEvent } from '../types-DPINdOQW.mjs';
7
7
 
8
8
  interface SitePongContextValue {
9
9
  isInitialized: boolean;
@@ -1,9 +1,9 @@
1
1
  import React, { Component, ReactNode, ErrorInfo } from 'react';
2
2
  import { SitePongInitConfig, ErrorContext, addBreadcrumb, DeviceSignals, WebVitals } from '../index.js';
3
3
  export { CapturedError, CronCheckinOptions, CronHandle, DEFAULT_SUPERLINK_ENDPOINT, DatabaseQueryEvent, DatabaseTrackerConfig, DeferredDeepLinkHandler, DeviceInfo, EnvironmentAdapter, FraudCheckResult, MetricOptions, MutableRNEnvironmentAdapter, PerformanceConfig, PerformanceSpan, PerformanceTransaction, PlatformName, ProfileData, ProfileFrame, ProfilerConfig, RemoteConfig, RemoteConfigFeatures, RemoteConfigSampling, ResourceTimingBreakdown, SitePongConfig, SuperLinkClient, SuperLinkConfig, SuperLinkDeepLink, SuperLinkEventType, SuperLinkFingerprint, SuperLinkIdentityMetadata, SuperLinkMatchRequest, SuperLinkMatchResponse, SuperLinkMatchType, SuperLinkPlatform, TraceContext, TracePropagator, VisitorIdResult, WebManagerFactories, areFlagsReady, captureError, captureMessage, captureWebDeepLink, clearAnonymousId, clearUser, client, completeFromScan, createTraceContext, cronCheckin, cronStart, cronWrap, dbTrack, dbTrackSync, endSpan, endTransaction, extractIdentityMetadata, extractTrace, flush, flushMetrics, flushProfiles, generateSpanId, generateTraceId, getAllFlags, getAnonymousId, getDbNPlusOnePatterns, getDbQueryCount, getDeepLink, getDeviceSignals, getFlag, getFraudCheck, getLatestProfile, getMatchedDeepLink, getProfiles, getRemoteConfig, getReplaySessionId, getVariant, getVariantPayload, getVisitorId, getWebVitals, group, identify, init, initRN, initSuperLink, isInitialized, isRemoteConfigFeatureEnabled, isReplayRecording, metricDistribution, metricGauge, metricHistogram, metricIncrement, metricStartTimer, metricTime, onDeferredDeepLink, onRemoteConfigChange, parseUniversalLink, profile, propagateTrace, refreshFlags, registerIdentifyHook, registerWebManagerFactories, resetAnalytics, resetDbQueryCount, setAnonymousId, setContext, setCurrentScreen, setEnvironment, setRNGetCurrentScreen, setTags, setUser, startProfileSpan, startReplay, startSpan, startTransaction, stopReplay, superlinkClient, superlinkIdentify, track, trackPageView, waitForFlags, writeClipboardToken } from '../index.js';
4
- import { C as CaptureContext, U as User } from '../types-DQSv7JAE.js';
5
- import { T as TrackProperties, U as UserTraits, G as GroupTraits } from '../types-BEqbz0tw.js';
6
- export { R as ReplayConfig, a as ReplayEvent } from '../types-BEqbz0tw.js';
4
+ import { C as CaptureContext, U as User } from '../types-BTA43eyz.js';
5
+ import { T as TrackProperties, U as UserTraits, G as GroupTraits } from '../types-DPINdOQW.js';
6
+ export { R as ReplayConfig, a as ReplayEvent } from '../types-DPINdOQW.js';
7
7
 
8
8
  interface SitePongContextValue {
9
9
  isInitialized: boolean;
@@ -524,6 +524,60 @@ function clearSession() {
524
524
  memorySessionTs = null;
525
525
  }
526
526
 
527
+ // src/analytics/utm.ts
528
+ var STORAGE_KEY2 = "sp_utm";
529
+ var UTM_KEYS = [
530
+ ["source", "utm_source"],
531
+ ["medium", "utm_medium"],
532
+ ["campaign", "utm_campaign"],
533
+ ["term", "utm_term"],
534
+ ["content", "utm_content"]
535
+ ];
536
+ function parseFromLocation() {
537
+ if (typeof window === "undefined" || !window.location || !window.location.search) return null;
538
+ let params;
539
+ try {
540
+ params = new URLSearchParams(window.location.search);
541
+ } catch {
542
+ return null;
543
+ }
544
+ const result = {};
545
+ let found = false;
546
+ for (const [key, queryKey] of UTM_KEYS) {
547
+ const value = params.get(queryKey);
548
+ if (value) {
549
+ result[key] = value;
550
+ found = true;
551
+ }
552
+ }
553
+ return found ? result : null;
554
+ }
555
+ function readStored() {
556
+ if (typeof sessionStorage === "undefined") return null;
557
+ try {
558
+ const raw = sessionStorage.getItem(STORAGE_KEY2);
559
+ if (!raw) return null;
560
+ const parsed = JSON.parse(raw);
561
+ return parsed && typeof parsed === "object" ? parsed : null;
562
+ } catch {
563
+ return null;
564
+ }
565
+ }
566
+ function writeStored(utm) {
567
+ if (typeof sessionStorage === "undefined") return;
568
+ try {
569
+ sessionStorage.setItem(STORAGE_KEY2, JSON.stringify(utm));
570
+ } catch {
571
+ }
572
+ }
573
+ function getSessionUtm() {
574
+ const stored = readStored();
575
+ if (stored) return stored;
576
+ const fresh = parseFromLocation();
577
+ if (fresh) writeStored(fresh);
578
+ return fresh;
579
+ }
580
+
527
581
  // src/analytics/autocapture.ts
528
582
  var DEFAULT_BLOCK_SELECTORS = [
529
583
  "[data-sp-no-capture]",
@@ -930,7 +984,9 @@ var AnalyticsManager = class {
930
984
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
931
985
  url: typeof window !== "undefined" && window.location ? window.location.href : void 0,
932
986
  referrer: typeof document !== "undefined" && typeof document.referrer === "string" ? document.referrer : void 0,
933
- userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0
987
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
988
+ utm: getSessionUtm() || void 0,
989
+ appVersion: this.config.appVersion || void 0
934
990
  };
935
991
  }
936
992
  enqueue(event) {
@@ -1628,7 +1684,7 @@ var DEFAULT_REMOTE_CONFIG = {
1628
1684
  };
1629
1685
 
1630
1686
  // src/remote-config/manager.ts
1631
- var STORAGE_KEY2 = "sitepong_remote_config";
1687
+ var STORAGE_KEY3 = "sitepong_remote_config";
1632
1688
  var STORAGE_TS_KEY = "sitepong_remote_config_ts";
1633
1689
  var RemoteConfigManager = class {
1634
1690
  constructor(options) {
@@ -1671,7 +1727,7 @@ var RemoteConfigManager = class {
1671
1727
  const storage = this.options.storage;
1672
1728
  if (!storage) return;
1673
1729
  try {
1674
- const cached = await storage.getItem(STORAGE_KEY2);
1730
+ const cached = await storage.getItem(STORAGE_KEY3);
1675
1731
  const cachedTs = await storage.getItem(STORAGE_TS_KEY);
1676
1732
  if (cached && cachedTs) {
1677
1733
  const age = Date.now() - parseInt(cachedTs, 10);
@@ -1732,7 +1788,7 @@ var RemoteConfigManager = class {
1732
1788
  const storage = this.options.storage;
1733
1789
  if (!storage) return;
1734
1790
  try {
1735
- await storage.setItem(STORAGE_KEY2, JSON.stringify(this.config));
1791
+ await storage.setItem(STORAGE_KEY3, JSON.stringify(this.config));
1736
1792
  await storage.setItem(STORAGE_TS_KEY, String(Date.now()));
1737
1793
  } catch {
1738
1794
  this.log("Failed to cache remote config");
@@ -1988,7 +2044,7 @@ function stripTrailingSlash(url) {
1988
2044
  var superlinkClient = new SuperLinkClient();
1989
2045
 
1990
2046
  // src/superlink/parse.ts
1991
- var UTM_KEYS = [
2047
+ var UTM_KEYS2 = [
1992
2048
  ["source", "utm_source"],
1993
2049
  ["medium", "utm_medium"],
1994
2050
  ["campaign", "utm_campaign"],
@@ -2004,7 +2060,7 @@ function parseUniversalLink(url) {
2004
2060
  }
2005
2061
  const params = parsed.searchParams;
2006
2062
  const utm = {};
2007
- for (const [key, queryKey] of UTM_KEYS) {
2063
+ for (const [key, queryKey] of UTM_KEYS2) {
2008
2064
  const value = params.get(queryKey);
2009
2065
  if (value) utm[key] = value;
2010
2066
  }
@@ -2071,13 +2127,13 @@ function getMatchedDeepLink() {
2071
2127
  }
2072
2128
 
2073
2129
  // src/superlink/web.ts
2074
- var STORAGE_KEY3 = "sp_superlink";
2130
+ var STORAGE_KEY4 = "sp_superlink";
2075
2131
  var captured = null;
2076
2132
  var didCapture = false;
2077
- function readStored() {
2133
+ function readStored2() {
2078
2134
  if (typeof sessionStorage === "undefined") return null;
2079
2135
  try {
2080
- const raw = sessionStorage.getItem(STORAGE_KEY3);
2136
+ const raw = sessionStorage.getItem(STORAGE_KEY4);
2081
2137
  if (!raw) return null;
2082
2138
  const parsed = JSON.parse(raw);
2083
2139
  return parsed && typeof parsed === "object" ? parsed : null;
@@ -2085,10 +2141,10 @@ function readStored() {
2085
2141
  return null;
2086
2142
  }
2087
2143
  }
2088
- function writeStored(link) {
2144
+ function writeStored2(link) {
2089
2145
  if (typeof sessionStorage === "undefined") return;
2090
2146
  try {
2091
- sessionStorage.setItem(STORAGE_KEY3, JSON.stringify(link));
2147
+ sessionStorage.setItem(STORAGE_KEY4, JSON.stringify(link));
2092
2148
  } catch {
2093
2149
  }
2094
2150
  }
@@ -2136,7 +2192,7 @@ function extractIdentityMetadata(url) {
2136
2192
  function captureWebDeepLink() {
2137
2193
  if (didCapture) return captured;
2138
2194
  didCapture = true;
2139
- const stored = readStored();
2195
+ const stored = readStored2();
2140
2196
  if (stored) {
2141
2197
  captured = stored;
2142
2198
  return captured;
@@ -2145,7 +2201,7 @@ function captureWebDeepLink() {
2145
2201
  const link = parseUniversalLink(window.location.href);
2146
2202
  if (link && hasPayload(link)) {
2147
2203
  captured = link;
2148
- writeStored(link);
2204
+ writeStored2(link);
2149
2205
  void superlinkClient.reportEvent({
2150
2206
  type: "opened",
2151
2207
  click_id: link.click_id,