@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/index.d.mts
CHANGED
|
@@ -494,6 +494,14 @@ declare class CrossdeckClient {
|
|
|
494
494
|
* `configure`). `start` will be removed in a future major version.
|
|
495
495
|
*/
|
|
496
496
|
start(options: CrossdeckOptions): void;
|
|
497
|
+
/**
|
|
498
|
+
* Campaign-arrival connect. If the landing URL carries a Crossdeck tag
|
|
499
|
+
* (`cd_ref`), post it to the arrival endpoint so the backend binds this
|
|
500
|
+
* anonymous session to the tagged person and pulls their integration
|
|
501
|
+
* record (deals, pipeline) onto their journey. Browser-only; fire-and-
|
|
502
|
+
* forget (never throws); backend-idempotent so a re-fire is harmless.
|
|
503
|
+
*/
|
|
504
|
+
private captureCampaignArrival;
|
|
497
505
|
/**
|
|
498
506
|
* Link the anonymous device to a developer-supplied user ID. Cache
|
|
499
507
|
* the resolved Crossdeck customer for follow-up calls.
|
|
@@ -961,7 +969,7 @@ declare class MemoryStorage implements KeyValueStorage {
|
|
|
961
969
|
*
|
|
962
970
|
* Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
|
|
963
971
|
*/
|
|
964
|
-
declare const SDK_VERSION = "1.
|
|
972
|
+
declare const SDK_VERSION = "1.10.2";
|
|
965
973
|
declare const SDK_NAME = "@cross-deck/web";
|
|
966
974
|
|
|
967
975
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -494,6 +494,14 @@ declare class CrossdeckClient {
|
|
|
494
494
|
* `configure`). `start` will be removed in a future major version.
|
|
495
495
|
*/
|
|
496
496
|
start(options: CrossdeckOptions): void;
|
|
497
|
+
/**
|
|
498
|
+
* Campaign-arrival connect. If the landing URL carries a Crossdeck tag
|
|
499
|
+
* (`cd_ref`), post it to the arrival endpoint so the backend binds this
|
|
500
|
+
* anonymous session to the tagged person and pulls their integration
|
|
501
|
+
* record (deals, pipeline) onto their journey. Browser-only; fire-and-
|
|
502
|
+
* forget (never throws); backend-idempotent so a re-fire is harmless.
|
|
503
|
+
*/
|
|
504
|
+
private captureCampaignArrival;
|
|
497
505
|
/**
|
|
498
506
|
* Link the anonymous device to a developer-supplied user ID. Cache
|
|
499
507
|
* the resolved Crossdeck customer for follow-up calls.
|
|
@@ -961,7 +969,7 @@ declare class MemoryStorage implements KeyValueStorage {
|
|
|
961
969
|
*
|
|
962
970
|
* Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
|
|
963
971
|
*/
|
|
964
|
-
declare const SDK_VERSION = "1.
|
|
972
|
+
declare const SDK_VERSION = "1.10.2";
|
|
965
973
|
declare const SDK_NAME = "@cross-deck/web";
|
|
966
974
|
|
|
967
975
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -69,7 +69,7 @@ function typeMapForStatus(status) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// src/_version.ts
|
|
72
|
-
var SDK_VERSION = "1.
|
|
72
|
+
var SDK_VERSION = "1.10.2";
|
|
73
73
|
var SDK_NAME = "@cross-deck/web";
|
|
74
74
|
|
|
75
75
|
// src/http.ts
|
|
@@ -1633,24 +1633,32 @@ var AutoTracker = class {
|
|
|
1633
1633
|
this.emitSessionStart();
|
|
1634
1634
|
}
|
|
1635
1635
|
const onVisChange = () => {
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
} else if (doc2.visibilityState === "visible") {
|
|
1642
|
-
const idleFor = Date.now() - this.session.lastActivityAt;
|
|
1643
|
-
if (idleFor >= SESSION_RESUME_THRESHOLD_MS) {
|
|
1644
|
-
this.pageviewId = null;
|
|
1645
|
-
this.session = this.startNewSession();
|
|
1636
|
+
try {
|
|
1637
|
+
if (!this.session) return;
|
|
1638
|
+
const doc2 = globalThis.document;
|
|
1639
|
+
if (doc2.visibilityState === "hidden") {
|
|
1640
|
+
this.session.hiddenAt = Date.now();
|
|
1646
1641
|
this.persistSession();
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1642
|
+
} else if (doc2.visibilityState === "visible") {
|
|
1643
|
+
const idleFor = Date.now() - this.session.lastActivityAt;
|
|
1644
|
+
if (idleFor >= SESSION_RESUME_THRESHOLD_MS) {
|
|
1645
|
+
this.pageviewId = null;
|
|
1646
|
+
this.session = this.startNewSession();
|
|
1647
|
+
this.persistSession();
|
|
1648
|
+
this.emitSessionStart();
|
|
1649
|
+
} else {
|
|
1650
|
+
this.session.hiddenAt = null;
|
|
1651
|
+
}
|
|
1650
1652
|
}
|
|
1653
|
+
} catch {
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
const onPageHide = () => {
|
|
1657
|
+
try {
|
|
1658
|
+
this.persistSession();
|
|
1659
|
+
} catch {
|
|
1651
1660
|
}
|
|
1652
1661
|
};
|
|
1653
|
-
const onPageHide = () => this.persistSession();
|
|
1654
1662
|
const w = globalThis.window;
|
|
1655
1663
|
const doc = globalThis.document;
|
|
1656
1664
|
doc.addEventListener("visibilitychange", onVisChange);
|
|
@@ -2514,17 +2522,20 @@ var WebVitalsTracker = class {
|
|
|
2514
2522
|
} catch {
|
|
2515
2523
|
}
|
|
2516
2524
|
const flush = () => {
|
|
2517
|
-
|
|
2518
|
-
this.flushed.
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
this.flushed.
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
this.flushed.
|
|
2527
|
-
|
|
2525
|
+
try {
|
|
2526
|
+
if (lcpValue > 0 && !this.flushed.has("lcp")) {
|
|
2527
|
+
this.flushed.add("lcp");
|
|
2528
|
+
this.report("webvitals.lcp", { valueMs: Math.round(lcpValue) });
|
|
2529
|
+
}
|
|
2530
|
+
if (this.cls > 0 && !this.flushed.has("cls")) {
|
|
2531
|
+
this.flushed.add("cls");
|
|
2532
|
+
this.report("webvitals.cls", { value: Math.round(this.cls * 1e3) / 1e3 });
|
|
2533
|
+
}
|
|
2534
|
+
if (this.inp > 0 && !this.flushed.has("inp")) {
|
|
2535
|
+
this.flushed.add("inp");
|
|
2536
|
+
this.report("webvitals.inp", { valueMs: Math.round(this.inp) });
|
|
2537
|
+
}
|
|
2538
|
+
} catch {
|
|
2528
2539
|
}
|
|
2529
2540
|
};
|
|
2530
2541
|
const onHidden = () => {
|
|
@@ -3787,6 +3798,8 @@ function buildFrame(input) {
|
|
|
3787
3798
|
function isInAppFrame(filename) {
|
|
3788
3799
|
if (!filename) return true;
|
|
3789
3800
|
if (/^(?:chrome|moz|safari|webkit)-extension:\/\//.test(filename)) return false;
|
|
3801
|
+
if (/^iabjs:\/\//.test(filename)) return false;
|
|
3802
|
+
if (/^(?:webview|inappbrowser):\/\//i.test(filename)) return false;
|
|
3790
3803
|
if (/\bcdn\.jsdelivr\.net\b/.test(filename)) return false;
|
|
3791
3804
|
if (/\bunpkg\.com\b/.test(filename)) return false;
|
|
3792
3805
|
if (/\bgoogletagmanager\.com\b/.test(filename)) return false;
|
|
@@ -4748,6 +4761,9 @@ var CrossdeckClient = class {
|
|
|
4748
4761
|
if (opts.autoHeartbeat && !localDevMode) {
|
|
4749
4762
|
void this.heartbeat().catch(() => void 0);
|
|
4750
4763
|
}
|
|
4764
|
+
if (!localDevMode) {
|
|
4765
|
+
void this.captureCampaignArrival().catch(() => void 0);
|
|
4766
|
+
}
|
|
4751
4767
|
if (options.disableContractAssertions !== true) {
|
|
4752
4768
|
const debugDefault = defaultDebugModeFlag();
|
|
4753
4769
|
this.verifierCtx = buildVerifierContext({
|
|
@@ -4845,6 +4861,32 @@ var CrossdeckClient = class {
|
|
|
4845
4861
|
}
|
|
4846
4862
|
this.init(options);
|
|
4847
4863
|
}
|
|
4864
|
+
/**
|
|
4865
|
+
* Campaign-arrival connect. If the landing URL carries a Crossdeck tag
|
|
4866
|
+
* (`cd_ref`), post it to the arrival endpoint so the backend binds this
|
|
4867
|
+
* anonymous session to the tagged person and pulls their integration
|
|
4868
|
+
* record (deals, pipeline) onto their journey. Browser-only; fire-and-
|
|
4869
|
+
* forget (never throws); backend-idempotent so a re-fire is harmless.
|
|
4870
|
+
*/
|
|
4871
|
+
async captureCampaignArrival() {
|
|
4872
|
+
const s = this.state;
|
|
4873
|
+
if (!s) return;
|
|
4874
|
+
const loc = globalThis.location;
|
|
4875
|
+
if (!loc || typeof loc.search !== "string" || loc.search.length === 0) return;
|
|
4876
|
+
let ref = null;
|
|
4877
|
+
try {
|
|
4878
|
+
ref = new URLSearchParams(loc.search).get("cd_ref");
|
|
4879
|
+
} catch {
|
|
4880
|
+
return;
|
|
4881
|
+
}
|
|
4882
|
+
if (!ref) return;
|
|
4883
|
+
try {
|
|
4884
|
+
await s.http.request("POST", "/integrations/hubspot/arrival", {
|
|
4885
|
+
body: { anonymousId: s.identity.anonymousId, ref }
|
|
4886
|
+
});
|
|
4887
|
+
} catch {
|
|
4888
|
+
}
|
|
4889
|
+
}
|
|
4848
4890
|
/**
|
|
4849
4891
|
* Link the anonymous device to a developer-supplied user ID. Cache
|
|
4850
4892
|
* the resolved Crossdeck customer for follow-up calls.
|
|
@@ -5733,9 +5775,17 @@ function installUnloadFlush(onUnload) {
|
|
|
5733
5775
|
const doc = globalThis.document;
|
|
5734
5776
|
if (!w || !doc) return () => void 0;
|
|
5735
5777
|
const onVisChange = () => {
|
|
5736
|
-
|
|
5778
|
+
try {
|
|
5779
|
+
if (doc.visibilityState === "hidden") onUnload();
|
|
5780
|
+
} catch {
|
|
5781
|
+
}
|
|
5782
|
+
};
|
|
5783
|
+
const onTerminal = () => {
|
|
5784
|
+
try {
|
|
5785
|
+
onUnload();
|
|
5786
|
+
} catch {
|
|
5787
|
+
}
|
|
5737
5788
|
};
|
|
5738
|
-
const onTerminal = () => onUnload();
|
|
5739
5789
|
doc.addEventListener("visibilitychange", onVisChange);
|
|
5740
5790
|
w.addEventListener("pagehide", onTerminal);
|
|
5741
5791
|
w.addEventListener("beforeunload", onTerminal);
|