@cross-deck/web 1.9.0 → 1.10.2
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 +59 -0
- package/README.md +5 -3
- 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 +78 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +78 -28
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +78 -28
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +78 -28
- package/dist/react.mjs.map +1 -1
- package/dist/vue.cjs +78 -28
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.mjs +78 -28
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -72,7 +72,7 @@ function typeMapForStatus(status) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/_version.ts
|
|
75
|
-
var SDK_VERSION = "1.
|
|
75
|
+
var SDK_VERSION = "1.10.2";
|
|
76
76
|
var SDK_NAME = "@cross-deck/web";
|
|
77
77
|
|
|
78
78
|
// src/http.ts
|
|
@@ -1636,24 +1636,32 @@ var AutoTracker = class {
|
|
|
1636
1636
|
this.emitSessionStart();
|
|
1637
1637
|
}
|
|
1638
1638
|
const onVisChange = () => {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
} else if (doc2.visibilityState === "visible") {
|
|
1645
|
-
const idleFor = Date.now() - this.session.lastActivityAt;
|
|
1646
|
-
if (idleFor >= SESSION_RESUME_THRESHOLD_MS) {
|
|
1647
|
-
this.pageviewId = null;
|
|
1648
|
-
this.session = this.startNewSession();
|
|
1639
|
+
try {
|
|
1640
|
+
if (!this.session) return;
|
|
1641
|
+
const doc2 = globalThis.document;
|
|
1642
|
+
if (doc2.visibilityState === "hidden") {
|
|
1643
|
+
this.session.hiddenAt = Date.now();
|
|
1649
1644
|
this.persistSession();
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1645
|
+
} else if (doc2.visibilityState === "visible") {
|
|
1646
|
+
const idleFor = Date.now() - this.session.lastActivityAt;
|
|
1647
|
+
if (idleFor >= SESSION_RESUME_THRESHOLD_MS) {
|
|
1648
|
+
this.pageviewId = null;
|
|
1649
|
+
this.session = this.startNewSession();
|
|
1650
|
+
this.persistSession();
|
|
1651
|
+
this.emitSessionStart();
|
|
1652
|
+
} else {
|
|
1653
|
+
this.session.hiddenAt = null;
|
|
1654
|
+
}
|
|
1653
1655
|
}
|
|
1656
|
+
} catch {
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
const onPageHide = () => {
|
|
1660
|
+
try {
|
|
1661
|
+
this.persistSession();
|
|
1662
|
+
} catch {
|
|
1654
1663
|
}
|
|
1655
1664
|
};
|
|
1656
|
-
const onPageHide = () => this.persistSession();
|
|
1657
1665
|
const w = globalThis.window;
|
|
1658
1666
|
const doc = globalThis.document;
|
|
1659
1667
|
doc.addEventListener("visibilitychange", onVisChange);
|
|
@@ -2517,17 +2525,20 @@ var WebVitalsTracker = class {
|
|
|
2517
2525
|
} catch {
|
|
2518
2526
|
}
|
|
2519
2527
|
const flush = () => {
|
|
2520
|
-
|
|
2521
|
-
this.flushed.
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
this.flushed.
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
this.flushed.
|
|
2530
|
-
|
|
2528
|
+
try {
|
|
2529
|
+
if (lcpValue > 0 && !this.flushed.has("lcp")) {
|
|
2530
|
+
this.flushed.add("lcp");
|
|
2531
|
+
this.report("webvitals.lcp", { valueMs: Math.round(lcpValue) });
|
|
2532
|
+
}
|
|
2533
|
+
if (this.cls > 0 && !this.flushed.has("cls")) {
|
|
2534
|
+
this.flushed.add("cls");
|
|
2535
|
+
this.report("webvitals.cls", { value: Math.round(this.cls * 1e3) / 1e3 });
|
|
2536
|
+
}
|
|
2537
|
+
if (this.inp > 0 && !this.flushed.has("inp")) {
|
|
2538
|
+
this.flushed.add("inp");
|
|
2539
|
+
this.report("webvitals.inp", { valueMs: Math.round(this.inp) });
|
|
2540
|
+
}
|
|
2541
|
+
} catch {
|
|
2531
2542
|
}
|
|
2532
2543
|
};
|
|
2533
2544
|
const onHidden = () => {
|
|
@@ -3790,6 +3801,8 @@ function buildFrame(input) {
|
|
|
3790
3801
|
function isInAppFrame(filename) {
|
|
3791
3802
|
if (!filename) return true;
|
|
3792
3803
|
if (/^(?:chrome|moz|safari|webkit)-extension:\/\//.test(filename)) return false;
|
|
3804
|
+
if (/^iabjs:\/\//.test(filename)) return false;
|
|
3805
|
+
if (/^(?:webview|inappbrowser):\/\//i.test(filename)) return false;
|
|
3793
3806
|
if (/\bcdn\.jsdelivr\.net\b/.test(filename)) return false;
|
|
3794
3807
|
if (/\bunpkg\.com\b/.test(filename)) return false;
|
|
3795
3808
|
if (/\bgoogletagmanager\.com\b/.test(filename)) return false;
|
|
@@ -4751,6 +4764,9 @@ var CrossdeckClient = class {
|
|
|
4751
4764
|
if (opts.autoHeartbeat && !localDevMode) {
|
|
4752
4765
|
void this.heartbeat().catch(() => void 0);
|
|
4753
4766
|
}
|
|
4767
|
+
if (!localDevMode) {
|
|
4768
|
+
void this.captureCampaignArrival().catch(() => void 0);
|
|
4769
|
+
}
|
|
4754
4770
|
if (options.disableContractAssertions !== true) {
|
|
4755
4771
|
const debugDefault = defaultDebugModeFlag();
|
|
4756
4772
|
this.verifierCtx = buildVerifierContext({
|
|
@@ -4848,6 +4864,32 @@ var CrossdeckClient = class {
|
|
|
4848
4864
|
}
|
|
4849
4865
|
this.init(options);
|
|
4850
4866
|
}
|
|
4867
|
+
/**
|
|
4868
|
+
* Campaign-arrival connect. If the landing URL carries a Crossdeck tag
|
|
4869
|
+
* (`cd_ref`), post it to the arrival endpoint so the backend binds this
|
|
4870
|
+
* anonymous session to the tagged person and pulls their integration
|
|
4871
|
+
* record (deals, pipeline) onto their journey. Browser-only; fire-and-
|
|
4872
|
+
* forget (never throws); backend-idempotent so a re-fire is harmless.
|
|
4873
|
+
*/
|
|
4874
|
+
async captureCampaignArrival() {
|
|
4875
|
+
const s = this.state;
|
|
4876
|
+
if (!s) return;
|
|
4877
|
+
const loc = globalThis.location;
|
|
4878
|
+
if (!loc || typeof loc.search !== "string" || loc.search.length === 0) return;
|
|
4879
|
+
let ref = null;
|
|
4880
|
+
try {
|
|
4881
|
+
ref = new URLSearchParams(loc.search).get("cd_ref");
|
|
4882
|
+
} catch {
|
|
4883
|
+
return;
|
|
4884
|
+
}
|
|
4885
|
+
if (!ref) return;
|
|
4886
|
+
try {
|
|
4887
|
+
await s.http.request("POST", "/integrations/hubspot/arrival", {
|
|
4888
|
+
body: { anonymousId: s.identity.anonymousId, ref }
|
|
4889
|
+
});
|
|
4890
|
+
} catch {
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4851
4893
|
/**
|
|
4852
4894
|
* Link the anonymous device to a developer-supplied user ID. Cache
|
|
4853
4895
|
* the resolved Crossdeck customer for follow-up calls.
|
|
@@ -5736,9 +5778,17 @@ function installUnloadFlush(onUnload) {
|
|
|
5736
5778
|
const doc = globalThis.document;
|
|
5737
5779
|
if (!w || !doc) return () => void 0;
|
|
5738
5780
|
const onVisChange = () => {
|
|
5739
|
-
|
|
5781
|
+
try {
|
|
5782
|
+
if (doc.visibilityState === "hidden") onUnload();
|
|
5783
|
+
} catch {
|
|
5784
|
+
}
|
|
5785
|
+
};
|
|
5786
|
+
const onTerminal = () => {
|
|
5787
|
+
try {
|
|
5788
|
+
onUnload();
|
|
5789
|
+
} catch {
|
|
5790
|
+
}
|
|
5740
5791
|
};
|
|
5741
|
-
const onTerminal = () => onUnload();
|
|
5742
5792
|
doc.addEventListener("visibilitychange", onVisChange);
|
|
5743
5793
|
w.addEventListener("pagehide", onTerminal);
|
|
5744
5794
|
w.addEventListener("beforeunload", onTerminal);
|