sitepong 0.1.13 → 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.
- package/dist/cdn/sitepong.min.js +6 -6
- package/dist/cdn/sitepong.min.js.map +1 -1
- package/dist/entries/node.d.mts +2 -2
- package/dist/entries/node.d.ts +2 -2
- package/dist/entries/rn.js +513 -11
- package/dist/entries/rn.js.map +1 -1
- package/dist/entries/web.d.mts +2 -2
- package/dist/entries/web.d.ts +2 -2
- package/dist/entries/web.js +694 -137
- package/dist/entries/web.js.map +1 -1
- package/dist/entries/web.mjs +681 -137
- package/dist/entries/web.mjs.map +1 -1
- package/dist/index.d.mts +351 -23
- package/dist/index.d.ts +351 -23
- package/dist/index.js +367 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +354 -6
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.d.mts +2 -2
- package/dist/nextjs/index.d.ts +2 -2
- package/dist/react/index.d.mts +4 -4
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +367 -7
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +354 -7
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/{types-DQSv7JAE.d.ts → types-BTA43eyz.d.ts} +1 -1
- package/dist/{types-Cms9VXx9.d.mts → types-CphqOTfm.d.mts} +1 -1
- package/dist/{types-BEqbz0tw.d.mts → types-DPINdOQW.d.mts} +2 -0
- package/dist/{types-BEqbz0tw.d.ts → types-DPINdOQW.d.ts} +2 -0
- package/package.json +162 -160
package/dist/nextjs/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
|
-
import { S as SitePongConfig } from '../types-
|
|
2
|
+
import { S as SitePongConfig } from '../types-CphqOTfm.mjs';
|
|
3
3
|
export { addBreadcrumb, captureServerException, initServer } from '../server/index.mjs';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-DPINdOQW.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Next.js integration for SitePong
|
package/dist/nextjs/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
|
-
import { S as SitePongConfig } from '../types-
|
|
2
|
+
import { S as SitePongConfig } from '../types-BTA43eyz.js';
|
|
3
3
|
export { addBreadcrumb, captureServerException, initServer } from '../server/index.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-DPINdOQW.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Next.js integration for SitePong
|
package/dist/react/index.d.mts
CHANGED
|
@@ -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
|
-
export { CapturedError, CronCheckinOptions, CronHandle, DatabaseQueryEvent, DatabaseTrackerConfig, DeviceInfo, EnvironmentAdapter, FraudCheckResult, MetricOptions, MutableRNEnvironmentAdapter, PerformanceConfig, PerformanceSpan, PerformanceTransaction, PlatformName, ProfileData, ProfileFrame, ProfilerConfig, RemoteConfig, RemoteConfigFeatures, RemoteConfigSampling, SitePongConfig, TraceContext, TracePropagator, VisitorIdResult, WebManagerFactories, areFlagsReady, captureError, captureMessage, clearAnonymousId, clearUser, client, createTraceContext, cronCheckin, cronStart, cronWrap, dbTrack, dbTrackSync, endSpan, endTransaction, extractTrace, flush, flushMetrics, flushProfiles, generateSpanId, generateTraceId, getAllFlags, getAnonymousId, getDbNPlusOnePatterns, getDbQueryCount, getDeviceSignals, getFlag, getFraudCheck, getLatestProfile, getProfiles, getRemoteConfig, getReplaySessionId, getVariant, getVariantPayload, getVisitorId, getWebVitals, group, identify, init, initRN, isInitialized, isRemoteConfigFeatureEnabled, isReplayRecording, metricDistribution, metricGauge, metricHistogram, metricIncrement, metricStartTimer, metricTime, onRemoteConfigChange, profile, propagateTrace, refreshFlags, registerIdentifyHook, registerWebManagerFactories, resetAnalytics, resetDbQueryCount, setAnonymousId, setContext, setCurrentScreen, setEnvironment, setRNGetCurrentScreen, setTags, setUser, startProfileSpan, startReplay, startSpan, startTransaction, stopReplay, track, trackPageView, waitForFlags } from '../index.mjs';
|
|
4
|
-
import { C as CaptureContext, U as User } from '../types-
|
|
5
|
-
import { T as TrackProperties, U as UserTraits, G as GroupTraits } from '../types-
|
|
6
|
-
export { R as ReplayConfig, a as ReplayEvent } from '../types-
|
|
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-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;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -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
|
-
export { CapturedError, CronCheckinOptions, CronHandle, DatabaseQueryEvent, DatabaseTrackerConfig, DeviceInfo, EnvironmentAdapter, FraudCheckResult, MetricOptions, MutableRNEnvironmentAdapter, PerformanceConfig, PerformanceSpan, PerformanceTransaction, PlatformName, ProfileData, ProfileFrame, ProfilerConfig, RemoteConfig, RemoteConfigFeatures, RemoteConfigSampling, SitePongConfig, TraceContext, TracePropagator, VisitorIdResult, WebManagerFactories, areFlagsReady, captureError, captureMessage, clearAnonymousId, clearUser, client, createTraceContext, cronCheckin, cronStart, cronWrap, dbTrack, dbTrackSync, endSpan, endTransaction, extractTrace, flush, flushMetrics, flushProfiles, generateSpanId, generateTraceId, getAllFlags, getAnonymousId, getDbNPlusOnePatterns, getDbQueryCount, getDeviceSignals, getFlag, getFraudCheck, getLatestProfile, getProfiles, getRemoteConfig, getReplaySessionId, getVariant, getVariantPayload, getVisitorId, getWebVitals, group, identify, init, initRN, isInitialized, isRemoteConfigFeatureEnabled, isReplayRecording, metricDistribution, metricGauge, metricHistogram, metricIncrement, metricStartTimer, metricTime, onRemoteConfigChange, profile, propagateTrace, refreshFlags, registerIdentifyHook, registerWebManagerFactories, resetAnalytics, resetDbQueryCount, setAnonymousId, setContext, setCurrentScreen, setEnvironment, setRNGetCurrentScreen, setTags, setUser, startProfileSpan, startReplay, startSpan, startTransaction, stopReplay, track, trackPageView, waitForFlags } from '../index.js';
|
|
4
|
-
import { C as CaptureContext, U as User } from '../types-
|
|
5
|
-
import { T as TrackProperties, U as UserTraits, G as GroupTraits } from '../types-
|
|
6
|
-
export { R as ReplayConfig, a as ReplayEvent } from '../types-
|
|
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-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;
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
|
+
require('web-vitals');
|
|
4
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
|
|
6
7
|
// src/react/provider.tsx
|
|
@@ -523,6 +524,60 @@ function clearSession() {
|
|
|
523
524
|
memorySessionTs = null;
|
|
524
525
|
}
|
|
525
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
|
+
|
|
526
581
|
// src/analytics/autocapture.ts
|
|
527
582
|
var DEFAULT_BLOCK_SELECTORS = [
|
|
528
583
|
"[data-sp-no-capture]",
|
|
@@ -929,7 +984,9 @@ var AnalyticsManager = class {
|
|
|
929
984
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
930
985
|
url: typeof window !== "undefined" && window.location ? window.location.href : void 0,
|
|
931
986
|
referrer: typeof document !== "undefined" && typeof document.referrer === "string" ? document.referrer : void 0,
|
|
932
|
-
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
|
|
933
990
|
};
|
|
934
991
|
}
|
|
935
992
|
enqueue(event) {
|
|
@@ -1627,7 +1684,7 @@ var DEFAULT_REMOTE_CONFIG = {
|
|
|
1627
1684
|
};
|
|
1628
1685
|
|
|
1629
1686
|
// src/remote-config/manager.ts
|
|
1630
|
-
var
|
|
1687
|
+
var STORAGE_KEY3 = "sitepong_remote_config";
|
|
1631
1688
|
var STORAGE_TS_KEY = "sitepong_remote_config_ts";
|
|
1632
1689
|
var RemoteConfigManager = class {
|
|
1633
1690
|
constructor(options) {
|
|
@@ -1670,7 +1727,7 @@ var RemoteConfigManager = class {
|
|
|
1670
1727
|
const storage = this.options.storage;
|
|
1671
1728
|
if (!storage) return;
|
|
1672
1729
|
try {
|
|
1673
|
-
const cached = await storage.getItem(
|
|
1730
|
+
const cached = await storage.getItem(STORAGE_KEY3);
|
|
1674
1731
|
const cachedTs = await storage.getItem(STORAGE_TS_KEY);
|
|
1675
1732
|
if (cached && cachedTs) {
|
|
1676
1733
|
const age = Date.now() - parseInt(cachedTs, 10);
|
|
@@ -1731,7 +1788,7 @@ var RemoteConfigManager = class {
|
|
|
1731
1788
|
const storage = this.options.storage;
|
|
1732
1789
|
if (!storage) return;
|
|
1733
1790
|
try {
|
|
1734
|
-
await storage.setItem(
|
|
1791
|
+
await storage.setItem(STORAGE_KEY3, JSON.stringify(this.config));
|
|
1735
1792
|
await storage.setItem(STORAGE_TS_KEY, String(Date.now()));
|
|
1736
1793
|
} catch {
|
|
1737
1794
|
this.log("Failed to cache remote config");
|
|
@@ -1910,6 +1967,292 @@ var TracePropagator = class {
|
|
|
1910
1967
|
}
|
|
1911
1968
|
};
|
|
1912
1969
|
|
|
1970
|
+
// src/superlink/client.ts
|
|
1971
|
+
var DEFAULT_SUPERLINK_ENDPOINT = "https://pongl.ink";
|
|
1972
|
+
var SuperLinkClient = class {
|
|
1973
|
+
constructor(config = {}) {
|
|
1974
|
+
this.config = {
|
|
1975
|
+
endpoint: stripTrailingSlash(config.endpoint || DEFAULT_SUPERLINK_ENDPOINT),
|
|
1976
|
+
appId: config.appId,
|
|
1977
|
+
installId: config.installId,
|
|
1978
|
+
debug: config.debug ?? false
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
/** Replace config in place (used by init() so module-level helpers see updates). */
|
|
1982
|
+
configure(config) {
|
|
1983
|
+
if (config.endpoint) this.config.endpoint = stripTrailingSlash(config.endpoint);
|
|
1984
|
+
if (config.appId !== void 0) this.config.appId = config.appId;
|
|
1985
|
+
if (config.installId !== void 0) this.config.installId = config.installId;
|
|
1986
|
+
if (config.debug !== void 0) this.config.debug = config.debug;
|
|
1987
|
+
}
|
|
1988
|
+
log(...args) {
|
|
1989
|
+
if (this.config.debug) console.warn("[SuperLink]", ...args);
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* POST /match — ask the redirect engine to resolve a deferred deep link from
|
|
1993
|
+
* a click token (Android referrer / iOS clipboard) and/or a device
|
|
1994
|
+
* fingerprint. Returns `{ matched: false }` on any error.
|
|
1995
|
+
*/
|
|
1996
|
+
async match(body) {
|
|
1997
|
+
const payload = {
|
|
1998
|
+
...body,
|
|
1999
|
+
install_id: body.install_id ?? this.config.installId
|
|
2000
|
+
};
|
|
2001
|
+
try {
|
|
2002
|
+
const res = await fetch(`${this.config.endpoint}/match`, {
|
|
2003
|
+
method: "POST",
|
|
2004
|
+
headers: { "Content-Type": "application/json" },
|
|
2005
|
+
body: JSON.stringify(payload)
|
|
2006
|
+
});
|
|
2007
|
+
if (!res.ok) {
|
|
2008
|
+
this.log("match failed", res.status);
|
|
2009
|
+
return { matched: false };
|
|
2010
|
+
}
|
|
2011
|
+
const data = await res.json();
|
|
2012
|
+
return data ?? { matched: false };
|
|
2013
|
+
} catch (err) {
|
|
2014
|
+
this.log("match error", err);
|
|
2015
|
+
return { matched: false };
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* POST /events — report a lifecycle event (opened / converted) back to the
|
|
2020
|
+
* redirect engine, which fans out to analytics + webhooks. Best-effort.
|
|
2021
|
+
*/
|
|
2022
|
+
async reportEvent(input) {
|
|
2023
|
+
try {
|
|
2024
|
+
const res = await fetch(`${this.config.endpoint}/events`, {
|
|
2025
|
+
method: "POST",
|
|
2026
|
+
headers: { "Content-Type": "application/json" },
|
|
2027
|
+
body: JSON.stringify({
|
|
2028
|
+
app_id: this.config.appId,
|
|
2029
|
+
install_id: this.config.installId,
|
|
2030
|
+
...input
|
|
2031
|
+
})
|
|
2032
|
+
});
|
|
2033
|
+
if (!res.ok) this.log("event failed", input.type, res.status);
|
|
2034
|
+
return res.ok;
|
|
2035
|
+
} catch (err) {
|
|
2036
|
+
this.log("event error", err);
|
|
2037
|
+
return false;
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
};
|
|
2041
|
+
function stripTrailingSlash(url) {
|
|
2042
|
+
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
2043
|
+
}
|
|
2044
|
+
var superlinkClient = new SuperLinkClient();
|
|
2045
|
+
|
|
2046
|
+
// src/superlink/parse.ts
|
|
2047
|
+
var UTM_KEYS2 = [
|
|
2048
|
+
["source", "utm_source"],
|
|
2049
|
+
["medium", "utm_medium"],
|
|
2050
|
+
["campaign", "utm_campaign"],
|
|
2051
|
+
["term", "utm_term"],
|
|
2052
|
+
["content", "utm_content"]
|
|
2053
|
+
];
|
|
2054
|
+
function parseUniversalLink(url) {
|
|
2055
|
+
let parsed;
|
|
2056
|
+
try {
|
|
2057
|
+
parsed = new URL(url);
|
|
2058
|
+
} catch {
|
|
2059
|
+
return null;
|
|
2060
|
+
}
|
|
2061
|
+
const params = parsed.searchParams;
|
|
2062
|
+
const utm = {};
|
|
2063
|
+
for (const [key, queryKey] of UTM_KEYS2) {
|
|
2064
|
+
const value = params.get(queryKey);
|
|
2065
|
+
if (value) utm[key] = value;
|
|
2066
|
+
}
|
|
2067
|
+
const referral = {};
|
|
2068
|
+
const deep_link_data = {};
|
|
2069
|
+
params.forEach((value, key) => {
|
|
2070
|
+
if (key.startsWith("r_")) {
|
|
2071
|
+
referral[key.slice(2)] = value;
|
|
2072
|
+
} else if (key.startsWith("~")) {
|
|
2073
|
+
deep_link_data[key.slice(1)] = value;
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
const explicitPath = params.get("$deep_link_path") ?? params.get("dlp");
|
|
2077
|
+
const deep_link_path = explicitPath ?? (parsed.pathname && parsed.pathname !== "/" ? parsed.pathname : null);
|
|
2078
|
+
return {
|
|
2079
|
+
deep_link_path,
|
|
2080
|
+
deep_link_data,
|
|
2081
|
+
utm,
|
|
2082
|
+
referral,
|
|
2083
|
+
click_id: params.get("click_id"),
|
|
2084
|
+
match_type: "none",
|
|
2085
|
+
confidence: 1
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
// src/superlink/deferred.ts
|
|
2090
|
+
var handlers = /* @__PURE__ */ new Set();
|
|
2091
|
+
var lastMatched = null;
|
|
2092
|
+
function toDeepLink(res) {
|
|
2093
|
+
return {
|
|
2094
|
+
deep_link_path: res.deep_link_path ?? null,
|
|
2095
|
+
deep_link_data: res.deep_link_data ?? {},
|
|
2096
|
+
utm: res.utm ?? {},
|
|
2097
|
+
referral: res.referral ?? {},
|
|
2098
|
+
click_id: res.click_id ?? null,
|
|
2099
|
+
match_type: res.match_type ?? "fingerprint",
|
|
2100
|
+
confidence: res.confidence ?? (res.match_type && res.match_type !== "none" ? 1 : 0)
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
function emitDeferredDeepLink(link) {
|
|
2104
|
+
lastMatched = link;
|
|
2105
|
+
for (const handler of handlers) {
|
|
2106
|
+
try {
|
|
2107
|
+
handler(link);
|
|
2108
|
+
} catch (err) {
|
|
2109
|
+
if (superlinkClient.config.debug) console.warn("[SuperLink] handler threw", err);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
function onDeferredDeepLink(handler) {
|
|
2114
|
+
handlers.add(handler);
|
|
2115
|
+
if (lastMatched) {
|
|
2116
|
+
try {
|
|
2117
|
+
handler(lastMatched);
|
|
2118
|
+
} catch {
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
return () => {
|
|
2122
|
+
handlers.delete(handler);
|
|
2123
|
+
};
|
|
2124
|
+
}
|
|
2125
|
+
function getMatchedDeepLink() {
|
|
2126
|
+
return lastMatched;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
// src/superlink/web.ts
|
|
2130
|
+
var STORAGE_KEY4 = "sp_superlink";
|
|
2131
|
+
var captured = null;
|
|
2132
|
+
var didCapture = false;
|
|
2133
|
+
function readStored2() {
|
|
2134
|
+
if (typeof sessionStorage === "undefined") return null;
|
|
2135
|
+
try {
|
|
2136
|
+
const raw = sessionStorage.getItem(STORAGE_KEY4);
|
|
2137
|
+
if (!raw) return null;
|
|
2138
|
+
const parsed = JSON.parse(raw);
|
|
2139
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
2140
|
+
} catch {
|
|
2141
|
+
return null;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
function writeStored2(link) {
|
|
2145
|
+
if (typeof sessionStorage === "undefined") return;
|
|
2146
|
+
try {
|
|
2147
|
+
sessionStorage.setItem(STORAGE_KEY4, JSON.stringify(link));
|
|
2148
|
+
} catch {
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
function hasPayload(link) {
|
|
2152
|
+
return Boolean(
|
|
2153
|
+
link.deep_link_path || link.click_id || Object.keys(link.deep_link_data).length > 0 || Object.keys(link.referral).length > 0 || Object.keys(link.utm).length > 0
|
|
2154
|
+
);
|
|
2155
|
+
}
|
|
2156
|
+
function writeClipboardToken(clickId) {
|
|
2157
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
2158
|
+
const url = `${superlinkClient.config.endpoint}/c/${clickId}`;
|
|
2159
|
+
navigator.clipboard.writeText(url).catch(() => {
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
function extractIdentityMetadata(url) {
|
|
2163
|
+
const href = url ?? (typeof window !== "undefined" && window.location ? window.location.href : null);
|
|
2164
|
+
if (!href) return void 0;
|
|
2165
|
+
let loc;
|
|
2166
|
+
try {
|
|
2167
|
+
loc = new URL(href);
|
|
2168
|
+
} catch {
|
|
2169
|
+
return void 0;
|
|
2170
|
+
}
|
|
2171
|
+
const email = loc.searchParams.get("email");
|
|
2172
|
+
const phone = loc.searchParams.get("phone");
|
|
2173
|
+
const userId = loc.searchParams.get("user_id");
|
|
2174
|
+
const id = loc.searchParams.get("id");
|
|
2175
|
+
const customRaw = loc.searchParams.get("custom");
|
|
2176
|
+
const identity = {};
|
|
2177
|
+
if (email) identity.email = email;
|
|
2178
|
+
if (phone) identity.phone = phone;
|
|
2179
|
+
if (userId) identity.user_id = userId;
|
|
2180
|
+
if (id) identity.id = id;
|
|
2181
|
+
if (customRaw) {
|
|
2182
|
+
try {
|
|
2183
|
+
const custom = JSON.parse(decodeURIComponent(customRaw));
|
|
2184
|
+
if (typeof custom === "object" && custom !== null) {
|
|
2185
|
+
identity.custom = custom;
|
|
2186
|
+
}
|
|
2187
|
+
} catch {
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return Object.keys(identity).length > 0 ? identity : void 0;
|
|
2191
|
+
}
|
|
2192
|
+
function captureWebDeepLink() {
|
|
2193
|
+
if (didCapture) return captured;
|
|
2194
|
+
didCapture = true;
|
|
2195
|
+
const stored = readStored2();
|
|
2196
|
+
if (stored) {
|
|
2197
|
+
captured = stored;
|
|
2198
|
+
return captured;
|
|
2199
|
+
}
|
|
2200
|
+
if (typeof window === "undefined" || !window.location) return null;
|
|
2201
|
+
const link = parseUniversalLink(window.location.href);
|
|
2202
|
+
if (link && hasPayload(link)) {
|
|
2203
|
+
captured = link;
|
|
2204
|
+
writeStored2(link);
|
|
2205
|
+
void superlinkClient.reportEvent({
|
|
2206
|
+
type: "opened",
|
|
2207
|
+
click_id: link.click_id,
|
|
2208
|
+
platform: "desktop",
|
|
2209
|
+
properties: { surface: "web" }
|
|
2210
|
+
});
|
|
2211
|
+
}
|
|
2212
|
+
return captured;
|
|
2213
|
+
}
|
|
2214
|
+
function getDeepLink() {
|
|
2215
|
+
if (!didCapture) return captureWebDeepLink();
|
|
2216
|
+
return captured;
|
|
2217
|
+
}
|
|
2218
|
+
function webFingerprint() {
|
|
2219
|
+
const fp = { platform: "desktop" };
|
|
2220
|
+
if (typeof navigator !== "undefined") {
|
|
2221
|
+
if (navigator.userAgent) fp.user_agent = navigator.userAgent;
|
|
2222
|
+
const lang = navigator.language || navigator.languages && navigator.languages[0];
|
|
2223
|
+
if (lang) fp.language = lang;
|
|
2224
|
+
}
|
|
2225
|
+
return fp;
|
|
2226
|
+
}
|
|
2227
|
+
async function identify(identity) {
|
|
2228
|
+
if (!identity || Object.keys(identity).length === 0) return null;
|
|
2229
|
+
const res = await superlinkClient.match({
|
|
2230
|
+
identity,
|
|
2231
|
+
fingerprint: webFingerprint()
|
|
2232
|
+
});
|
|
2233
|
+
if (!res.matched) return null;
|
|
2234
|
+
const link = toDeepLink(res);
|
|
2235
|
+
emitDeferredDeepLink(link);
|
|
2236
|
+
return link;
|
|
2237
|
+
}
|
|
2238
|
+
async function completeFromScan(scanned) {
|
|
2239
|
+
if (!scanned) return null;
|
|
2240
|
+
const res = await superlinkClient.match({
|
|
2241
|
+
qr_token: scanned,
|
|
2242
|
+
fingerprint: webFingerprint()
|
|
2243
|
+
});
|
|
2244
|
+
if (!res.matched) return null;
|
|
2245
|
+
const link = toDeepLink(res);
|
|
2246
|
+
emitDeferredDeepLink(link);
|
|
2247
|
+
return link;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
// src/superlink/index.ts
|
|
2251
|
+
function initSuperLink(config = {}) {
|
|
2252
|
+
superlinkClient.configure(config);
|
|
2253
|
+
captureWebDeepLink();
|
|
2254
|
+
}
|
|
2255
|
+
|
|
1913
2256
|
// src/index.ts
|
|
1914
2257
|
function installFallbackEnvironment() {
|
|
1915
2258
|
if (getEnvironment()) return;
|
|
@@ -2119,6 +2462,10 @@ var SitePongClient = class {
|
|
|
2119
2462
|
webVitals: config.performance.webVitals,
|
|
2120
2463
|
navigationTiming: config.performance.navigationTiming,
|
|
2121
2464
|
resourceTiming: config.performance.resourceTiming,
|
|
2465
|
+
capturePageLoadTimings: config.performance.capturePageLoadTimings,
|
|
2466
|
+
capturePageRenderTimings: config.performance.capturePageRenderTimings,
|
|
2467
|
+
excludedResourceUrls: config.performance.excludedResourceUrls,
|
|
2468
|
+
resourceNameSanitizer: config.performance.resourceNameSanitizer,
|
|
2122
2469
|
sampleRate: config.performance.sampleRate,
|
|
2123
2470
|
flushInterval: config.performance.flushInterval,
|
|
2124
2471
|
performanceEndpoint: config.performance.performanceEndpoint,
|
|
@@ -2827,7 +3174,7 @@ var areFlagsReady = sitepong.areFlagsReady.bind(sitepong);
|
|
|
2827
3174
|
var refreshFlags = sitepong.refreshFlags.bind(sitepong);
|
|
2828
3175
|
var track = sitepong.track.bind(sitepong);
|
|
2829
3176
|
var trackPageView = sitepong.trackPageView.bind(sitepong);
|
|
2830
|
-
var
|
|
3177
|
+
var identify2 = sitepong.identify.bind(sitepong);
|
|
2831
3178
|
var group = sitepong.group.bind(sitepong);
|
|
2832
3179
|
var resetAnalytics = sitepong.resetAnalytics.bind(sitepong);
|
|
2833
3180
|
var getVisitorId = sitepong.getVisitorId.bind(sitepong);
|
|
@@ -3039,7 +3386,7 @@ function useTrackPageView() {
|
|
|
3039
3386
|
function useIdentify() {
|
|
3040
3387
|
return react.useCallback(
|
|
3041
3388
|
(userId, traits) => {
|
|
3042
|
-
|
|
3389
|
+
identify2(userId, traits);
|
|
3043
3390
|
},
|
|
3044
3391
|
[]
|
|
3045
3392
|
);
|
|
@@ -3235,17 +3582,21 @@ function useReplay() {
|
|
|
3235
3582
|
return { recording, start, stop };
|
|
3236
3583
|
}
|
|
3237
3584
|
|
|
3585
|
+
exports.DEFAULT_SUPERLINK_ENDPOINT = DEFAULT_SUPERLINK_ENDPOINT;
|
|
3238
3586
|
exports.SitePongContext = SitePongContext;
|
|
3239
3587
|
exports.SitePongErrorBoundary = SitePongErrorBoundary;
|
|
3240
3588
|
exports.SitePongProvider = SitePongProvider;
|
|
3589
|
+
exports.SuperLinkClient = SuperLinkClient;
|
|
3241
3590
|
exports.TracePropagator = TracePropagator;
|
|
3242
3591
|
exports.addBreadcrumb = addBreadcrumb;
|
|
3243
3592
|
exports.areFlagsReady = areFlagsReady;
|
|
3244
3593
|
exports.captureError = captureError;
|
|
3245
3594
|
exports.captureMessage = captureMessage;
|
|
3595
|
+
exports.captureWebDeepLink = captureWebDeepLink;
|
|
3246
3596
|
exports.clearAnonymousId = clearAnonymousId;
|
|
3247
3597
|
exports.clearUser = clearUser;
|
|
3248
3598
|
exports.client = sitepong;
|
|
3599
|
+
exports.completeFromScan = completeFromScan;
|
|
3249
3600
|
exports.createTraceContext = createTraceContext;
|
|
3250
3601
|
exports.cronCheckin = cronCheckin;
|
|
3251
3602
|
exports.cronStart = cronStart;
|
|
@@ -3254,6 +3605,7 @@ exports.dbTrack = dbTrack;
|
|
|
3254
3605
|
exports.dbTrackSync = dbTrackSync;
|
|
3255
3606
|
exports.endSpan = endSpan;
|
|
3256
3607
|
exports.endTransaction = endTransaction;
|
|
3608
|
+
exports.extractIdentityMetadata = extractIdentityMetadata;
|
|
3257
3609
|
exports.extractTrace = extractTrace;
|
|
3258
3610
|
exports.flush = flush;
|
|
3259
3611
|
exports.flushMetrics = flushMetrics;
|
|
@@ -3264,10 +3616,12 @@ exports.getAllFlags = getAllFlags;
|
|
|
3264
3616
|
exports.getAnonymousId = getAnonymousId;
|
|
3265
3617
|
exports.getDbNPlusOnePatterns = getDbNPlusOnePatterns;
|
|
3266
3618
|
exports.getDbQueryCount = getDbQueryCount;
|
|
3619
|
+
exports.getDeepLink = getDeepLink;
|
|
3267
3620
|
exports.getDeviceSignals = getDeviceSignals;
|
|
3268
3621
|
exports.getFlag = getFlag;
|
|
3269
3622
|
exports.getFraudCheck = getFraudCheck;
|
|
3270
3623
|
exports.getLatestProfile = getLatestProfile;
|
|
3624
|
+
exports.getMatchedDeepLink = getMatchedDeepLink;
|
|
3271
3625
|
exports.getProfiles = getProfiles;
|
|
3272
3626
|
exports.getRemoteConfig = getRemoteConfig;
|
|
3273
3627
|
exports.getReplaySessionId = getReplaySessionId;
|
|
@@ -3276,9 +3630,10 @@ exports.getVariantPayload = getVariantPayload2;
|
|
|
3276
3630
|
exports.getVisitorId = getVisitorId;
|
|
3277
3631
|
exports.getWebVitals = getWebVitals;
|
|
3278
3632
|
exports.group = group;
|
|
3279
|
-
exports.identify =
|
|
3633
|
+
exports.identify = identify2;
|
|
3280
3634
|
exports.init = init;
|
|
3281
3635
|
exports.initRN = initRN;
|
|
3636
|
+
exports.initSuperLink = initSuperLink;
|
|
3282
3637
|
exports.isInitialized = isInitialized;
|
|
3283
3638
|
exports.isRemoteConfigFeatureEnabled = isRemoteConfigFeatureEnabled;
|
|
3284
3639
|
exports.isReplayRecording = isReplayRecording;
|
|
@@ -3288,7 +3643,9 @@ exports.metricHistogram = metricHistogram;
|
|
|
3288
3643
|
exports.metricIncrement = metricIncrement;
|
|
3289
3644
|
exports.metricStartTimer = metricStartTimer;
|
|
3290
3645
|
exports.metricTime = metricTime;
|
|
3646
|
+
exports.onDeferredDeepLink = onDeferredDeepLink;
|
|
3291
3647
|
exports.onRemoteConfigChange = onRemoteConfigChange;
|
|
3648
|
+
exports.parseUniversalLink = parseUniversalLink;
|
|
3292
3649
|
exports.profile = profile;
|
|
3293
3650
|
exports.propagateTrace = propagateTrace;
|
|
3294
3651
|
exports.refreshFlags = refreshFlags;
|
|
@@ -3308,6 +3665,8 @@ exports.startReplay = startReplay;
|
|
|
3308
3665
|
exports.startSpan = startSpan;
|
|
3309
3666
|
exports.startTransaction = startTransaction;
|
|
3310
3667
|
exports.stopReplay = stopReplay;
|
|
3668
|
+
exports.superlinkClient = superlinkClient;
|
|
3669
|
+
exports.superlinkIdentify = identify;
|
|
3311
3670
|
exports.track = track;
|
|
3312
3671
|
exports.trackPageView = trackPageView;
|
|
3313
3672
|
exports.useAddBreadcrumb = useAddBreadcrumb;
|
|
@@ -3330,5 +3689,6 @@ exports.useTrackPageView = useTrackPageView;
|
|
|
3330
3689
|
exports.useVisitorId = useVisitorId;
|
|
3331
3690
|
exports.useWebVitals = useWebVitals;
|
|
3332
3691
|
exports.waitForFlags = waitForFlags;
|
|
3692
|
+
exports.writeClipboardToken = writeClipboardToken;
|
|
3333
3693
|
//# sourceMappingURL=index.js.map
|
|
3334
3694
|
//# sourceMappingURL=index.js.map
|