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