@active-reach/web-sdk 1.47.0 → 1.47.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/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/{analytics-C-Go3Pm5.mjs → analytics-CxqFHlNB.mjs} +45 -1
- package/dist/analytics-CxqFHlNB.mjs.map +1 -0
- package/dist/ecommerce/index.d.ts.map +1 -1
- package/dist/ecommerce/types.d.ts +6 -0
- package/dist/ecommerce/types.d.ts.map +1 -1
- package/dist/inapp/AegisInAppManager.d.ts +6 -1
- package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
- package/dist/inapp/actions.d.ts +6 -0
- package/dist/inapp/actions.d.ts.map +1 -1
- package/dist/inapp/item-touch.d.ts +26 -0
- package/dist/inapp/item-touch.d.ts.map +1 -0
- package/dist/index.js +45 -4
- package/dist/index.js.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/analytics-C-Go3Pm5.mjs.map +0 -1
|
@@ -1711,6 +1711,43 @@ class ConsentManager {
|
|
|
1711
1711
|
updateGoogleConsent();
|
|
1712
1712
|
}
|
|
1713
1713
|
}
|
|
1714
|
+
const ITEM_TOUCH_KEY = "aegis_inapp_item_touch";
|
|
1715
|
+
const ITEM_TOUCH_TTL_MS = 30 * 60 * 1e3;
|
|
1716
|
+
function store() {
|
|
1717
|
+
try {
|
|
1718
|
+
return typeof sessionStorage === "undefined" ? null : sessionStorage;
|
|
1719
|
+
} catch {
|
|
1720
|
+
return null;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
function recordInAppItemTouch(touch) {
|
|
1724
|
+
if (!touch.campaign_id || !touch.sku) return;
|
|
1725
|
+
const s = store();
|
|
1726
|
+
if (!s) return;
|
|
1727
|
+
try {
|
|
1728
|
+
const rec = { ...touch, ts: touch.ts ?? Date.now() };
|
|
1729
|
+
s.setItem(ITEM_TOUCH_KEY, JSON.stringify(rec));
|
|
1730
|
+
} catch {
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
function readInAppItemTouch(sku, now = Date.now()) {
|
|
1734
|
+
if (!sku) return null;
|
|
1735
|
+
const s = store();
|
|
1736
|
+
if (!s) return null;
|
|
1737
|
+
try {
|
|
1738
|
+
const raw = s.getItem(ITEM_TOUCH_KEY);
|
|
1739
|
+
if (!raw) return null;
|
|
1740
|
+
const rec = JSON.parse(raw);
|
|
1741
|
+
if (typeof rec.campaign_id !== "string" || typeof rec.sku !== "string" || typeof rec.ts !== "number") {
|
|
1742
|
+
return null;
|
|
1743
|
+
}
|
|
1744
|
+
if (rec.sku !== sku) return null;
|
|
1745
|
+
if (now - rec.ts > ITEM_TOUCH_TTL_MS || now < rec.ts) return null;
|
|
1746
|
+
return rec;
|
|
1747
|
+
} catch {
|
|
1748
|
+
return null;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1714
1751
|
function sumItems(products) {
|
|
1715
1752
|
return products.reduce((sum, p) => sum + (p.quantity ?? 1), 0);
|
|
1716
1753
|
}
|
|
@@ -1833,7 +1870,12 @@ class EcommerceTracker {
|
|
|
1833
1870
|
// -- Cart --
|
|
1834
1871
|
addToCart(product) {
|
|
1835
1872
|
const qty = product.quantity ?? 1;
|
|
1873
|
+
const touch = product.source_campaign_id ? null : readInAppItemTouch(product.sku);
|
|
1874
|
+
const sourceCampaignId = product.source_campaign_id ?? (touch == null ? void 0 : touch.campaign_id);
|
|
1836
1875
|
this.aegis.track("cart_item_added", {
|
|
1876
|
+
source_campaign_id: sourceCampaignId,
|
|
1877
|
+
source_variant_id: sourceCampaignId ? product.source_variant_id ?? (touch == null ? void 0 : touch.variant_id) : void 0,
|
|
1878
|
+
source_surface: sourceCampaignId ? product.source_surface ?? (touch == null ? void 0 : touch.surface) : void 0,
|
|
1837
1879
|
product_id: product.product_id,
|
|
1838
1880
|
sku: product.sku,
|
|
1839
1881
|
name: product.name,
|
|
@@ -3502,8 +3544,10 @@ export {
|
|
|
3502
3544
|
RateLimiter as R,
|
|
3503
3545
|
Storage as S,
|
|
3504
3546
|
UserNamespace as U,
|
|
3547
|
+
recordInAppItemTouch as a,
|
|
3548
|
+
ensureFbc as e,
|
|
3505
3549
|
logger as l,
|
|
3506
3550
|
murmurhash3_x86_32 as m,
|
|
3507
3551
|
redactUrl as r
|
|
3508
3552
|
};
|
|
3509
|
-
//# sourceMappingURL=analytics-
|
|
3553
|
+
//# sourceMappingURL=analytics-CxqFHlNB.mjs.map
|