@cross-deck/web 1.11.1 → 1.12.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/CHANGELOG.md +17 -0
- package/README.md +14 -1
- package/dist/crossdeck.umd.min.js +2 -2
- package/dist/crossdeck.umd.min.js.map +1 -1
- package/dist/error-codes.json +1 -1
- package/dist/index.cjs +147 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +147 -16
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +79 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +79 -5
- package/dist/react.mjs.map +1 -1
- package/dist/vue.cjs +79 -5
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.mjs +79 -5
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/vue.cjs
CHANGED
|
@@ -97,7 +97,7 @@ function typeMapForStatus(status) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// src/_version.ts
|
|
100
|
-
var SDK_VERSION = "1.
|
|
100
|
+
var SDK_VERSION = "1.12.1";
|
|
101
101
|
var SDK_NAME = "@cross-deck/web";
|
|
102
102
|
|
|
103
103
|
// src/http.ts
|
|
@@ -1587,6 +1587,7 @@ var AutoTracker = class {
|
|
|
1587
1587
|
this.pageviewId = null;
|
|
1588
1588
|
this.storage = opts?.storage ?? null;
|
|
1589
1589
|
this.sessionKey = opts?.storageKey ?? SESSION_STORAGE_KEY;
|
|
1590
|
+
this.cookieStorage = opts?.cookieStorage ?? null;
|
|
1590
1591
|
}
|
|
1591
1592
|
install() {
|
|
1592
1593
|
if (!isBrowserSafe()) return;
|
|
@@ -1738,9 +1739,74 @@ var AutoTracker = class {
|
|
|
1738
1739
|
lastActivityAt: now,
|
|
1739
1740
|
hiddenAt: null,
|
|
1740
1741
|
endedSent: false,
|
|
1741
|
-
acquisition:
|
|
1742
|
+
acquisition: this.resolveAcquisition()
|
|
1742
1743
|
};
|
|
1743
1744
|
}
|
|
1745
|
+
/**
|
|
1746
|
+
* Session acquisition, with FIRST-TOUCH survival across sessions.
|
|
1747
|
+
*
|
|
1748
|
+
* WHY: `captureAcquisition()` reads the CURRENT page. That is correct for a
|
|
1749
|
+
* fresh arrival, but a session boundary (30-min idle, or a return visit next
|
|
1750
|
+
* week) starts a new session — and a visitor returning directly has no utm_*
|
|
1751
|
+
* and no click id, so the acquisition that actually WON them was silently
|
|
1752
|
+
* replaced with empty. Someone who arrives from LinkedIn on Monday, returns
|
|
1753
|
+
* direct on Tuesday and signs up on Wednesday converted with no source at all.
|
|
1754
|
+
*
|
|
1755
|
+
* That is exactly the question the product exists to answer — "where did this
|
|
1756
|
+
* PAYING CUSTOMER come from" — so origin has to outlive the session that
|
|
1757
|
+
* captured it. We persist the first touch that carried a real signal and,
|
|
1758
|
+
* whenever a later session arrives with nothing, fall back to it.
|
|
1759
|
+
*
|
|
1760
|
+
* Deliberately NOT last-touch-wins: a real new campaign click overwrites
|
|
1761
|
+
* nothing, it simply records a newer touch for that session while the stored
|
|
1762
|
+
* first touch stays put. Write-once by design.
|
|
1763
|
+
*/
|
|
1764
|
+
resolveAcquisition() {
|
|
1765
|
+
const current = captureAcquisition();
|
|
1766
|
+
if (!this.storage && !this.cookieStorage) return current;
|
|
1767
|
+
const key = `${this.sessionKey}_origin_first`;
|
|
1768
|
+
const readFirstTouch = () => {
|
|
1769
|
+
try {
|
|
1770
|
+
const v = this.storage?.getItem(key);
|
|
1771
|
+
if (v) return v;
|
|
1772
|
+
} catch {
|
|
1773
|
+
}
|
|
1774
|
+
try {
|
|
1775
|
+
return this.cookieStorage?.getItem(key) ?? null;
|
|
1776
|
+
} catch {
|
|
1777
|
+
return null;
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
const writeFirstTouch = (v) => {
|
|
1781
|
+
try {
|
|
1782
|
+
this.storage?.setItem(key, v);
|
|
1783
|
+
} catch {
|
|
1784
|
+
}
|
|
1785
|
+
try {
|
|
1786
|
+
this.cookieStorage?.setItem(key, v);
|
|
1787
|
+
} catch {
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
const hasSignal = (a) => Boolean(a.utm_source || a.utm_medium || a.utm_campaign || a.utm_content || a.utm_term || a.gclid || a.fbclid || a.msclkid || a.ttclid || a.li_fat_id || a.twclid);
|
|
1791
|
+
try {
|
|
1792
|
+
if (hasSignal(current)) {
|
|
1793
|
+
if (readFirstTouch() === null) writeFirstTouch(JSON.stringify(current));
|
|
1794
|
+
return current;
|
|
1795
|
+
}
|
|
1796
|
+
const raw = readFirstTouch();
|
|
1797
|
+
if (raw) {
|
|
1798
|
+
const stored = JSON.parse(raw);
|
|
1799
|
+
return {
|
|
1800
|
+
...EMPTY_ACQUISITION,
|
|
1801
|
+
...stored,
|
|
1802
|
+
// Referrer always describes THIS visit, never the remembered one.
|
|
1803
|
+
referrer: current.referrer
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
} catch {
|
|
1807
|
+
}
|
|
1808
|
+
return current;
|
|
1809
|
+
}
|
|
1744
1810
|
/**
|
|
1745
1811
|
* Read the persisted session continuity record. Returns null on no
|
|
1746
1812
|
* storage, no record, malformed JSON, or a record missing its required
|
|
@@ -2736,7 +2802,7 @@ var BreadcrumbBuffer = class {
|
|
|
2736
2802
|
|
|
2737
2803
|
// src/_diagnostic-telemetry.ts
|
|
2738
2804
|
var DIAGNOSTIC_TELEMETRY_ENDPOINT = "https://api.cross-deck.com/v1/events";
|
|
2739
|
-
var DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY = "
|
|
2805
|
+
var DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY = "cd_pub_live_eea2f84dbb834a45b7";
|
|
2740
2806
|
function isDiagnosticTelemetryEnabled() {
|
|
2741
2807
|
return !DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY.startsWith(
|
|
2742
2808
|
"cd_pub_RELIABILITY_PLACEHOLDER"
|
|
@@ -4787,7 +4853,15 @@ var CrossdeckClient = class {
|
|
|
4787
4853
|
// a visit survives full-page navigations (multi-page sites
|
|
4788
4854
|
// re-install the SDK on every page) and honours the same consent
|
|
4789
4855
|
// posture — MemoryStorage when identity persistence is off.
|
|
4790
|
-
|
|
4856
|
+
// cookieStorage is the SAME registrable-domain cookie identity uses.
|
|
4857
|
+
// First-touch origin rides it so the campaign that won a visitor on the
|
|
4858
|
+
// marketing site is still known when they land on the app subdomain —
|
|
4859
|
+
// localStorage alone is per-origin and would lose it at exactly that hop.
|
|
4860
|
+
{
|
|
4861
|
+
storage: effectiveStorage,
|
|
4862
|
+
storageKey: opts.storagePrefix + "session",
|
|
4863
|
+
cookieStorage: cookieStore ?? void 0
|
|
4864
|
+
}
|
|
4791
4865
|
);
|
|
4792
4866
|
this.state.autoTracker = tracker;
|
|
4793
4867
|
tracker.install();
|
|
@@ -5633,7 +5707,7 @@ var CrossdeckClient = class {
|
|
|
5633
5707
|
}
|
|
5634
5708
|
}
|
|
5635
5709
|
this.state.autoTracker?.uninstall();
|
|
5636
|
-
this.state.identity.reset();
|
|
5710
|
+
if (this.state.developerUserId) this.state.identity.reset();
|
|
5637
5711
|
bridgeReadCost({ actor: void 0 });
|
|
5638
5712
|
this.state.entitlements.clearAll();
|
|
5639
5713
|
this.state.events.reset();
|