@cross-deck/web 1.9.1 → 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 +52 -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.cjs
CHANGED
|
@@ -98,7 +98,7 @@ function typeMapForStatus(status) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// src/_version.ts
|
|
101
|
-
var SDK_VERSION = "1.
|
|
101
|
+
var SDK_VERSION = "1.10.2";
|
|
102
102
|
var SDK_NAME = "@cross-deck/web";
|
|
103
103
|
|
|
104
104
|
// src/http.ts
|
|
@@ -1662,24 +1662,32 @@ var AutoTracker = class {
|
|
|
1662
1662
|
this.emitSessionStart();
|
|
1663
1663
|
}
|
|
1664
1664
|
const onVisChange = () => {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
} else if (doc2.visibilityState === "visible") {
|
|
1671
|
-
const idleFor = Date.now() - this.session.lastActivityAt;
|
|
1672
|
-
if (idleFor >= SESSION_RESUME_THRESHOLD_MS) {
|
|
1673
|
-
this.pageviewId = null;
|
|
1674
|
-
this.session = this.startNewSession();
|
|
1665
|
+
try {
|
|
1666
|
+
if (!this.session) return;
|
|
1667
|
+
const doc2 = globalThis.document;
|
|
1668
|
+
if (doc2.visibilityState === "hidden") {
|
|
1669
|
+
this.session.hiddenAt = Date.now();
|
|
1675
1670
|
this.persistSession();
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1671
|
+
} else if (doc2.visibilityState === "visible") {
|
|
1672
|
+
const idleFor = Date.now() - this.session.lastActivityAt;
|
|
1673
|
+
if (idleFor >= SESSION_RESUME_THRESHOLD_MS) {
|
|
1674
|
+
this.pageviewId = null;
|
|
1675
|
+
this.session = this.startNewSession();
|
|
1676
|
+
this.persistSession();
|
|
1677
|
+
this.emitSessionStart();
|
|
1678
|
+
} else {
|
|
1679
|
+
this.session.hiddenAt = null;
|
|
1680
|
+
}
|
|
1679
1681
|
}
|
|
1682
|
+
} catch {
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
const onPageHide = () => {
|
|
1686
|
+
try {
|
|
1687
|
+
this.persistSession();
|
|
1688
|
+
} catch {
|
|
1680
1689
|
}
|
|
1681
1690
|
};
|
|
1682
|
-
const onPageHide = () => this.persistSession();
|
|
1683
1691
|
const w = globalThis.window;
|
|
1684
1692
|
const doc = globalThis.document;
|
|
1685
1693
|
doc.addEventListener("visibilitychange", onVisChange);
|
|
@@ -2543,17 +2551,20 @@ var WebVitalsTracker = class {
|
|
|
2543
2551
|
} catch {
|
|
2544
2552
|
}
|
|
2545
2553
|
const flush = () => {
|
|
2546
|
-
|
|
2547
|
-
this.flushed.
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
this.flushed.
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
this.flushed.
|
|
2556
|
-
|
|
2554
|
+
try {
|
|
2555
|
+
if (lcpValue > 0 && !this.flushed.has("lcp")) {
|
|
2556
|
+
this.flushed.add("lcp");
|
|
2557
|
+
this.report("webvitals.lcp", { valueMs: Math.round(lcpValue) });
|
|
2558
|
+
}
|
|
2559
|
+
if (this.cls > 0 && !this.flushed.has("cls")) {
|
|
2560
|
+
this.flushed.add("cls");
|
|
2561
|
+
this.report("webvitals.cls", { value: Math.round(this.cls * 1e3) / 1e3 });
|
|
2562
|
+
}
|
|
2563
|
+
if (this.inp > 0 && !this.flushed.has("inp")) {
|
|
2564
|
+
this.flushed.add("inp");
|
|
2565
|
+
this.report("webvitals.inp", { valueMs: Math.round(this.inp) });
|
|
2566
|
+
}
|
|
2567
|
+
} catch {
|
|
2557
2568
|
}
|
|
2558
2569
|
};
|
|
2559
2570
|
const onHidden = () => {
|
|
@@ -3816,6 +3827,8 @@ function buildFrame(input) {
|
|
|
3816
3827
|
function isInAppFrame(filename) {
|
|
3817
3828
|
if (!filename) return true;
|
|
3818
3829
|
if (/^(?:chrome|moz|safari|webkit)-extension:\/\//.test(filename)) return false;
|
|
3830
|
+
if (/^iabjs:\/\//.test(filename)) return false;
|
|
3831
|
+
if (/^(?:webview|inappbrowser):\/\//i.test(filename)) return false;
|
|
3819
3832
|
if (/\bcdn\.jsdelivr\.net\b/.test(filename)) return false;
|
|
3820
3833
|
if (/\bunpkg\.com\b/.test(filename)) return false;
|
|
3821
3834
|
if (/\bgoogletagmanager\.com\b/.test(filename)) return false;
|
|
@@ -4777,6 +4790,9 @@ var CrossdeckClient = class {
|
|
|
4777
4790
|
if (opts.autoHeartbeat && !localDevMode) {
|
|
4778
4791
|
void this.heartbeat().catch(() => void 0);
|
|
4779
4792
|
}
|
|
4793
|
+
if (!localDevMode) {
|
|
4794
|
+
void this.captureCampaignArrival().catch(() => void 0);
|
|
4795
|
+
}
|
|
4780
4796
|
if (options.disableContractAssertions !== true) {
|
|
4781
4797
|
const debugDefault = defaultDebugModeFlag();
|
|
4782
4798
|
this.verifierCtx = buildVerifierContext({
|
|
@@ -4874,6 +4890,32 @@ var CrossdeckClient = class {
|
|
|
4874
4890
|
}
|
|
4875
4891
|
this.init(options);
|
|
4876
4892
|
}
|
|
4893
|
+
/**
|
|
4894
|
+
* Campaign-arrival connect. If the landing URL carries a Crossdeck tag
|
|
4895
|
+
* (`cd_ref`), post it to the arrival endpoint so the backend binds this
|
|
4896
|
+
* anonymous session to the tagged person and pulls their integration
|
|
4897
|
+
* record (deals, pipeline) onto their journey. Browser-only; fire-and-
|
|
4898
|
+
* forget (never throws); backend-idempotent so a re-fire is harmless.
|
|
4899
|
+
*/
|
|
4900
|
+
async captureCampaignArrival() {
|
|
4901
|
+
const s = this.state;
|
|
4902
|
+
if (!s) return;
|
|
4903
|
+
const loc = globalThis.location;
|
|
4904
|
+
if (!loc || typeof loc.search !== "string" || loc.search.length === 0) return;
|
|
4905
|
+
let ref = null;
|
|
4906
|
+
try {
|
|
4907
|
+
ref = new URLSearchParams(loc.search).get("cd_ref");
|
|
4908
|
+
} catch {
|
|
4909
|
+
return;
|
|
4910
|
+
}
|
|
4911
|
+
if (!ref) return;
|
|
4912
|
+
try {
|
|
4913
|
+
await s.http.request("POST", "/integrations/hubspot/arrival", {
|
|
4914
|
+
body: { anonymousId: s.identity.anonymousId, ref }
|
|
4915
|
+
});
|
|
4916
|
+
} catch {
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4877
4919
|
/**
|
|
4878
4920
|
* Link the anonymous device to a developer-supplied user ID. Cache
|
|
4879
4921
|
* the resolved Crossdeck customer for follow-up calls.
|
|
@@ -5762,9 +5804,17 @@ function installUnloadFlush(onUnload) {
|
|
|
5762
5804
|
const doc = globalThis.document;
|
|
5763
5805
|
if (!w || !doc) return () => void 0;
|
|
5764
5806
|
const onVisChange = () => {
|
|
5765
|
-
|
|
5807
|
+
try {
|
|
5808
|
+
if (doc.visibilityState === "hidden") onUnload();
|
|
5809
|
+
} catch {
|
|
5810
|
+
}
|
|
5811
|
+
};
|
|
5812
|
+
const onTerminal = () => {
|
|
5813
|
+
try {
|
|
5814
|
+
onUnload();
|
|
5815
|
+
} catch {
|
|
5816
|
+
}
|
|
5766
5817
|
};
|
|
5767
|
-
const onTerminal = () => onUnload();
|
|
5768
5818
|
doc.addEventListener("visibilitychange", onVisChange);
|
|
5769
5819
|
w.addEventListener("pagehide", onTerminal);
|
|
5770
5820
|
w.addEventListener("beforeunload", onTerminal);
|