@active-reach/web-sdk 1.45.3 → 1.46.1
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/AegisWebPush-BE9wJcx0.mjs +558 -0
- package/dist/AegisWebPush-BE9wJcx0.mjs.map +1 -0
- package/dist/aegis-push.min.js +1 -1
- package/dist/aegis-push.min.js.map +1 -1
- package/dist/aegis-sw.js +1 -1
- package/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/inapp/AegisInAppManager.d.ts +6 -0
- package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
- package/dist/inapp/renderers/card-template.d.ts +0 -12
- package/dist/inapp/renderers/card-template.d.ts.map +1 -1
- package/dist/inapp/renderers/index.d.ts +1 -0
- package/dist/inapp/renderers/index.d.ts.map +1 -1
- package/dist/inapp/renderers/progress-bar.d.ts.map +1 -1
- package/dist/inapp/renderers/slot-variant.d.ts +55 -0
- package/dist/inapp/renderers/slot-variant.d.ts.map +1 -0
- package/dist/index.js +179 -26
- package/dist/index.js.map +1 -1
- package/dist/push/AegisWebPush.d.ts.map +1 -1
- package/dist/push/AegisWebPush.js +2 -539
- package/dist/push/AegisWebPush.js.map +1 -1
- package/dist/utils/asset-id.d.ts +11 -0
- package/dist/utils/asset-id.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { S as Storage, r as redactUrl, l as logger, A as Aegis } from "./analytics-C-Go3Pm5.mjs";
|
|
2
2
|
import { B, E, N, R, U, m } from "./analytics-C-Go3Pm5.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as assetIdOf } from "./AegisWebPush-BE9wJcx0.mjs";
|
|
4
|
+
import { A } from "./AegisWebPush-BE9wJcx0.mjs";
|
|
4
5
|
function debounce(func, wait) {
|
|
5
6
|
let timeoutId = null;
|
|
6
7
|
return function debounced(...args) {
|
|
@@ -676,6 +677,41 @@ function createFlowAccumulator() {
|
|
|
676
677
|
}
|
|
677
678
|
};
|
|
678
679
|
}
|
|
680
|
+
const SLOT_VARIANT_ATTR = "data-aegis-variant";
|
|
681
|
+
const SLOT_VARIANT_PHONE_ATTR = "data-aegis-variant-phone";
|
|
682
|
+
const PHONE_VARIANT_QUERY = "(max-width:767px)";
|
|
683
|
+
const DATA_EL_ATTR = "data-aegis-el";
|
|
684
|
+
function slotVariant(slot) {
|
|
685
|
+
if (!slot || typeof slot.getAttribute !== "function") return null;
|
|
686
|
+
const v = slot.getAttribute(SLOT_VARIANT_ATTR);
|
|
687
|
+
if (v === "compact") return "compact";
|
|
688
|
+
const phone = slot.getAttribute(SLOT_VARIANT_PHONE_ATTR);
|
|
689
|
+
if (phone === "compact" && isPhone()) return "compact";
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
692
|
+
function isPhone() {
|
|
693
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(PHONE_VARIANT_QUERY).matches === true;
|
|
694
|
+
}
|
|
695
|
+
function markEl(node, role) {
|
|
696
|
+
node.setAttribute(DATA_EL_ATTR, role);
|
|
697
|
+
}
|
|
698
|
+
const PROGRESS_VALUE_ATTR = "data-aegis-progress";
|
|
699
|
+
const PROGRESS_COMPLETE_ATTR = "data-aegis-complete";
|
|
700
|
+
function markProgress(track, pct, complete) {
|
|
701
|
+
track.setAttribute("role", "progressbar");
|
|
702
|
+
track.setAttribute("aria-valuemin", "0");
|
|
703
|
+
track.setAttribute("aria-valuemax", "100");
|
|
704
|
+
if (pct === null || !Number.isFinite(pct)) {
|
|
705
|
+
track.removeAttribute("aria-valuenow");
|
|
706
|
+
track.removeAttribute(PROGRESS_VALUE_ATTR);
|
|
707
|
+
track.removeAttribute(PROGRESS_COMPLETE_ATTR);
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const v = Math.min(100, Math.max(0, pct));
|
|
711
|
+
track.setAttribute("aria-valuenow", String(Math.round(v)));
|
|
712
|
+
track.setAttribute(PROGRESS_VALUE_ATTR, String(Math.round(v * 10) / 10));
|
|
713
|
+
track.setAttribute(PROGRESS_COMPLETE_ATTR, complete ? "true" : "false");
|
|
714
|
+
}
|
|
679
715
|
const WEIGHT = {
|
|
680
716
|
regular: "400",
|
|
681
717
|
medium: "500",
|
|
@@ -1645,7 +1681,7 @@ function buildNpsElement(el2, ctx, fg, accent, muted) {
|
|
|
1645
1681
|
wrap.appendChild(scale);
|
|
1646
1682
|
return wrap;
|
|
1647
1683
|
}
|
|
1648
|
-
function buildProgressElement(el2, ctx, accent, muted) {
|
|
1684
|
+
function buildProgressElement(el2, ctx, accent, muted, compact) {
|
|
1649
1685
|
const { trackEvent, campaign, sanitizeColor } = ctx;
|
|
1650
1686
|
const goal = el2.goal_type || "cart_total";
|
|
1651
1687
|
const moneyGoal = goal === "cart_total";
|
|
@@ -1681,30 +1717,57 @@ function buildProgressElement(el2, ctx, accent, muted) {
|
|
|
1681
1717
|
const c = ctx.getCartState && ctx.getCartState();
|
|
1682
1718
|
return c && typeof c.itemCount === "number" ? c.itemCount : 0;
|
|
1683
1719
|
};
|
|
1720
|
+
const track = `color-mix(in srgb, ${fill} 16%, transparent)`;
|
|
1721
|
+
const subColor = compact ? `var(--aegis-card-muted, ${muted})` : muted;
|
|
1722
|
+
const doneColor = compact ? "var(--aegis-progress-done, #10b981)" : "#10b981";
|
|
1684
1723
|
const wrap = document.createElement("div");
|
|
1685
|
-
wrap
|
|
1686
|
-
|
|
1687
|
-
sub
|
|
1724
|
+
markEl(wrap, "progress");
|
|
1725
|
+
wrap.style.cssText = compact ? "display:flex;flex-direction:column;gap:6px;min-width:0;width:100%;" : "display:flex;flex-direction:column;gap:3px;min-width:0;width:100%;";
|
|
1726
|
+
const sub = document.createElement(compact ? "span" : "div");
|
|
1727
|
+
markEl(sub, "subline");
|
|
1728
|
+
sub.style.cssText = compact ? `color:${subColor};` : `font-size:11.5px;line-height:1.2;color:${muted};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;`;
|
|
1688
1729
|
const shell = document.createElement("div");
|
|
1689
|
-
shell
|
|
1730
|
+
markEl(shell, "progress-track");
|
|
1731
|
+
shell.style.cssText = compact ? `height:6px;border-radius:999px;background:var(--aegis-progress-track, ${track});overflow:hidden;` : `height:3px;border-radius:999px;background:${track};overflow:hidden;`;
|
|
1690
1732
|
const bar = document.createElement("div");
|
|
1691
|
-
bar
|
|
1733
|
+
markEl(bar, "progress-fill");
|
|
1734
|
+
bar.style.cssText = compact ? `height:100%;border-radius:999px;background:var(--aegis-progress-fill, ${fill});width:0%;transition:width .4s cubic-bezier(.4,0,.2,1);` : `height:100%;border-radius:999px;background:${fill};width:0%;transition:width .4s cubic-bezier(.4,0,.2,1);`;
|
|
1692
1735
|
shell.appendChild(bar);
|
|
1693
|
-
|
|
1736
|
+
let titleEl = null;
|
|
1737
|
+
if (compact) {
|
|
1738
|
+
const line = document.createElement("div");
|
|
1739
|
+
markEl(line, "progress-label");
|
|
1740
|
+
line.style.cssText = `font-size:13px;line-height:1.3;color:var(--aegis-card-fg, ${compact.fg});white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;`;
|
|
1741
|
+
if (compact.title) {
|
|
1742
|
+
titleEl = document.createElement("span");
|
|
1743
|
+
markEl(titleEl, "title");
|
|
1744
|
+
titleEl.style.cssText = "font-weight:700;";
|
|
1745
|
+
titleEl.textContent = compact.title;
|
|
1746
|
+
line.appendChild(titleEl);
|
|
1747
|
+
}
|
|
1748
|
+
line.appendChild(sub);
|
|
1749
|
+
wrap.appendChild(line);
|
|
1750
|
+
} else {
|
|
1751
|
+
wrap.appendChild(sub);
|
|
1752
|
+
}
|
|
1694
1753
|
wrap.appendChild(shell);
|
|
1695
1754
|
let firedUnlock = false;
|
|
1696
1755
|
let seenIncomplete = false;
|
|
1697
1756
|
const update = () => {
|
|
1698
|
-
var _a;
|
|
1757
|
+
var _a, _b, _c;
|
|
1699
1758
|
const th = threshold();
|
|
1700
1759
|
const cur = readCur();
|
|
1701
1760
|
if (th <= 0 && el2.threshold_source === "free_delivery_setting") {
|
|
1702
1761
|
wrap.style.display = "none";
|
|
1762
|
+
markProgress(shell, null, false);
|
|
1763
|
+
(_a = compact == null ? void 0 : compact.onMeasured) == null ? void 0 : _a.call(compact, false);
|
|
1703
1764
|
return;
|
|
1704
1765
|
}
|
|
1705
1766
|
wrap.style.display = "flex";
|
|
1767
|
+
(_b = compact == null ? void 0 : compact.onMeasured) == null ? void 0 : _b.call(compact, true);
|
|
1706
1768
|
const { pct, complete } = computeProgress({ threshold: th, current: cur });
|
|
1707
1769
|
bar.style.width = `${pct}%`;
|
|
1770
|
+
markProgress(shell, pct, complete);
|
|
1708
1771
|
const labeled = cardProgressSubLabel({
|
|
1709
1772
|
goalType: goal,
|
|
1710
1773
|
threshold: th,
|
|
@@ -1713,19 +1776,21 @@ function buildProgressElement(el2, ctx, accent, muted) {
|
|
|
1713
1776
|
currencySymbol: moneyGoal ? sym() : "",
|
|
1714
1777
|
showPct: el2.show_pct
|
|
1715
1778
|
});
|
|
1716
|
-
sub.textContent = labeled.text;
|
|
1779
|
+
sub.textContent = titleEl && !complete && labeled.text ? ` · ${labeled.text}` : labeled.text;
|
|
1780
|
+
if (titleEl) titleEl.style.display = complete ? "none" : "";
|
|
1781
|
+
markEl(sub, complete ? "reward" : "subline");
|
|
1717
1782
|
if (complete) {
|
|
1718
|
-
sub.style.color =
|
|
1783
|
+
sub.style.color = doneColor;
|
|
1719
1784
|
sub.style.fontWeight = "700";
|
|
1720
1785
|
if (!firedUnlock) {
|
|
1721
1786
|
firedUnlock = true;
|
|
1722
1787
|
if (seenIncomplete) {
|
|
1723
1788
|
trackEvent(campaign.id, "clicked", { stepId: el2.id || "unlocked" });
|
|
1724
|
-
if (el2.celebrate_on_complete !== false) (
|
|
1789
|
+
if (el2.celebrate_on_complete !== false) (_c = ctx.playReaction) == null ? void 0 : _c.call(ctx, wrap, "celebrate");
|
|
1725
1790
|
}
|
|
1726
1791
|
}
|
|
1727
1792
|
} else {
|
|
1728
|
-
sub.style.color =
|
|
1793
|
+
sub.style.color = subColor;
|
|
1729
1794
|
sub.style.fontWeight = "";
|
|
1730
1795
|
const engaged = goal === "cart_total" || goal === "items_in_cart" ? cartItems() > 0 : cur > 0;
|
|
1731
1796
|
if (engaged) seenIncomplete = true;
|
|
@@ -1782,6 +1847,16 @@ function buildCtaAction(el2, card, meta, inline, sanitizeUrl) {
|
|
|
1782
1847
|
};
|
|
1783
1848
|
}
|
|
1784
1849
|
}
|
|
1850
|
+
function findElement(els, type) {
|
|
1851
|
+
for (const el2 of els) {
|
|
1852
|
+
if (el2.type === type) return el2;
|
|
1853
|
+
if (el2.type === "group" && el2.elements) {
|
|
1854
|
+
const hit = findElement(el2.elements, type);
|
|
1855
|
+
if (hit) return hit;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
return null;
|
|
1859
|
+
}
|
|
1785
1860
|
function renderCardFromTemplate(card, opts) {
|
|
1786
1861
|
const { ctx, action, layout, layoutAccent } = opts;
|
|
1787
1862
|
const inline = action === "cart";
|
|
@@ -1793,7 +1868,11 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1793
1868
|
const brand = `var(--aegis-brand-accent, ${accent})`;
|
|
1794
1869
|
const fg = contrastFg(frame.bg ? sanitizeColor(frame.bg) : "#ffffff");
|
|
1795
1870
|
const muted = fg === "#ffffff" ? "rgba(255,255,255,0.72)" : "#6b7280";
|
|
1871
|
+
const compact = slotVariant(ctx.slotEl) === "compact";
|
|
1872
|
+
const frameBg = frame.bg ? sanitizeColor(frame.bg) : "#ffffff";
|
|
1796
1873
|
const tile = document.createElement("div");
|
|
1874
|
+
markEl(tile, "frame");
|
|
1875
|
+
if (compact) tile.setAttribute("data-aegis-variant", "compact");
|
|
1797
1876
|
tile.setAttribute("data-aegis-reaction-anchor", "");
|
|
1798
1877
|
const cardFont = resolveCardFont(campaignFontFamily(campaign) ?? frame.fontFamily);
|
|
1799
1878
|
const displayFont = fontFamilyCss("display");
|
|
@@ -1823,6 +1902,17 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1823
1902
|
${sizing}
|
|
1824
1903
|
cursor:${card.cta_url || inline ? "pointer" : "default"}; transition:transform 0.15s ease;
|
|
1825
1904
|
`;
|
|
1905
|
+
if (compact) {
|
|
1906
|
+
tile.style.cssText = `
|
|
1907
|
+
box-sizing:border-box; display:flex; flex-direction:${dir}; ${fLayout === "row" ? "align-items:center;" : ""} gap:${tileGap}px; position:relative;
|
|
1908
|
+
color:var(--aegis-card-fg, ${fg});
|
|
1909
|
+
${cardFont}
|
|
1910
|
+
background:var(--aegis-card-bg, ${frameBg});
|
|
1911
|
+
border:0; border-radius:0; padding:0; box-shadow:none;
|
|
1912
|
+
width:100%; min-width:0;
|
|
1913
|
+
cursor:${card.cta_url || inline ? "pointer" : "default"};
|
|
1914
|
+
`;
|
|
1915
|
+
}
|
|
1826
1916
|
const elements = tpl.elements && tpl.elements.length ? tpl.elements : DEFAULT_CARD_TEMPLATE.elements;
|
|
1827
1917
|
let imageWrap = null;
|
|
1828
1918
|
const paintInto = (container, els) => {
|
|
@@ -1863,6 +1953,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1863
1953
|
wrap.appendChild(img);
|
|
1864
1954
|
}
|
|
1865
1955
|
}
|
|
1956
|
+
markEl(wrap, "image");
|
|
1866
1957
|
imageWrap = wrap;
|
|
1867
1958
|
container.appendChild(wrap);
|
|
1868
1959
|
break;
|
|
@@ -1888,6 +1979,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1888
1979
|
case "title": {
|
|
1889
1980
|
if (!card.title) break;
|
|
1890
1981
|
const t = document.createElement("div");
|
|
1982
|
+
markEl(t, "title");
|
|
1891
1983
|
t.textContent = card.title;
|
|
1892
1984
|
const lines = el2.lines && el2.lines > 0 ? el2.lines : 2;
|
|
1893
1985
|
t.style.cssText = `${displayFont}font-size:12.5px;font-weight:600;line-height:1.3;text-align:${el2.align ?? "left"};color:${el2.color ? sanitizeColor(el2.color) : fg};display:-webkit-box;-webkit-line-clamp:${lines};-webkit-box-orient:vertical;overflow:hidden;`;
|
|
@@ -1897,6 +1989,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1897
1989
|
case "subtitle": {
|
|
1898
1990
|
if (!card.body) break;
|
|
1899
1991
|
const s = document.createElement("div");
|
|
1992
|
+
markEl(s, "subtitle");
|
|
1900
1993
|
s.textContent = card.body;
|
|
1901
1994
|
const lines = el2.lines && el2.lines > 0 ? el2.lines : 2;
|
|
1902
1995
|
s.style.cssText = `font-size:11px;color:${el2.color ? sanitizeColor(el2.color) : muted};line-height:1.3;text-align:${el2.align ?? "left"};display:-webkit-box;-webkit-line-clamp:${lines};-webkit-box-orient:vertical;overflow:hidden;`;
|
|
@@ -1921,6 +2014,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1921
2014
|
case "icon": {
|
|
1922
2015
|
const px = ICON_PX[el2.size || "md"] || 30;
|
|
1923
2016
|
const node = document.createElement("div");
|
|
2017
|
+
markEl(node, "icon");
|
|
1924
2018
|
const iconColor = el2.color ? sanitizeColor(el2.color) : fg;
|
|
1925
2019
|
if (el2.bubble) {
|
|
1926
2020
|
const bubbleTint = el2.color ? sanitizeColor(el2.color) : brand;
|
|
@@ -1939,6 +2033,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1939
2033
|
}
|
|
1940
2034
|
case "text": {
|
|
1941
2035
|
const t = document.createElement("div");
|
|
2036
|
+
markEl(t, "text");
|
|
1942
2037
|
const fs = TEXT_PX[el2.size || "md"] || 13;
|
|
1943
2038
|
t.style.cssText = `font-size:${fs}px;font-weight:${WEIGHT[el2.weight ?? "medium"]};text-align:${el2.align ?? "left"};color:${el2.color ? sanitizeColor(el2.color) : fg};line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;`;
|
|
1944
2039
|
t.textContent = interpolateTokens(el2.content ?? "", ctx);
|
|
@@ -1979,6 +2074,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1979
2074
|
}
|
|
1980
2075
|
case "group": {
|
|
1981
2076
|
const g = document.createElement("div");
|
|
2077
|
+
markEl(g, "group");
|
|
1982
2078
|
const gdir = el2.layout === "row" ? "row" : "column";
|
|
1983
2079
|
g.style.cssText = `display:flex;flex-direction:${gdir};${el2.layout === "row" ? "align-items:center;" : ""}gap:${el2.gap ?? 4}px;min-width:0;${el2.layout === "row" ? "" : "flex:1 1 auto;"}`;
|
|
1984
2080
|
paintInto(g, el2.elements || []);
|
|
@@ -1989,6 +2085,7 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1989
2085
|
const label = el2.text || card.cta_text || (inline ? "Add" : "Shop");
|
|
1990
2086
|
const cta = document.createElement("button");
|
|
1991
2087
|
cta.className = "aegis-cta";
|
|
2088
|
+
markEl(cta, "cta");
|
|
1992
2089
|
cta.textContent = label;
|
|
1993
2090
|
const overlayOnImage = !!el2.overlay && !!imageWrap;
|
|
1994
2091
|
if (overlayOnImage) {
|
|
@@ -2011,7 +2108,20 @@ function renderCardFromTemplate(card, opts) {
|
|
|
2011
2108
|
}
|
|
2012
2109
|
}
|
|
2013
2110
|
};
|
|
2014
|
-
|
|
2111
|
+
const compactProgress = compact ? findElement(elements, "progress") : null;
|
|
2112
|
+
if (compactProgress) {
|
|
2113
|
+
tile.style.flexDirection = "column";
|
|
2114
|
+
tile.style.alignItems = "stretch";
|
|
2115
|
+
const onMeasured = (measured) => {
|
|
2116
|
+
tile.hidden = !measured;
|
|
2117
|
+
tile.style.display = measured ? "flex" : "none";
|
|
2118
|
+
};
|
|
2119
|
+
tile.appendChild(
|
|
2120
|
+
buildProgressElement(compactProgress, ctx, brand, muted, { title: card.title, fg, onMeasured })
|
|
2121
|
+
);
|
|
2122
|
+
} else {
|
|
2123
|
+
paintInto(tile, elements);
|
|
2124
|
+
}
|
|
2015
2125
|
const open = (e) => {
|
|
2016
2126
|
var _a;
|
|
2017
2127
|
e.stopPropagation();
|
|
@@ -2318,7 +2428,7 @@ function renderStickyBar(ctx) {
|
|
|
2318
2428
|
}
|
|
2319
2429
|
document.body.appendChild(bar);
|
|
2320
2430
|
}
|
|
2321
|
-
function buildProgressBar(ctx, inline) {
|
|
2431
|
+
function buildProgressBar(ctx, inline, compact = false) {
|
|
2322
2432
|
const { campaign, trackEvent, sanitizeColor, log, addAnimationStyles } = ctx;
|
|
2323
2433
|
const ic = campaign.interactive_config || {};
|
|
2324
2434
|
const goalType = ic.progress_goal_type || "cart_total";
|
|
@@ -2340,6 +2450,8 @@ function buildProgressBar(ctx, inline) {
|
|
|
2340
2450
|
const bar = document.createElement("div");
|
|
2341
2451
|
bar.className = "aegis-in-app-progress-bar";
|
|
2342
2452
|
bar.setAttribute("data-campaign-id", campaign.id);
|
|
2453
|
+
markEl(bar, "frame");
|
|
2454
|
+
if (compact) bar.setAttribute("data-aegis-variant", "compact");
|
|
2343
2455
|
bar.style.cssText = inline ? `
|
|
2344
2456
|
background: ${bg}; color: ${fg};
|
|
2345
2457
|
padding: 10px 14px;
|
|
@@ -2353,22 +2465,34 @@ function buildProgressBar(ctx, inline) {
|
|
|
2353
2465
|
${fontFamilyCss("body")}
|
|
2354
2466
|
animation: aegisSlideInFromBottom 0.3s ease-out;
|
|
2355
2467
|
`;
|
|
2468
|
+
if (compact) {
|
|
2469
|
+
bar.style.cssText = `
|
|
2470
|
+
background: var(--aegis-card-bg, ${bg}); color: var(--aegis-card-fg, ${fg});
|
|
2471
|
+
padding: 0; display: flex; flex-direction: column; gap: 6px;
|
|
2472
|
+
${fontFamilyCss("body")}
|
|
2473
|
+
`;
|
|
2474
|
+
}
|
|
2356
2475
|
const label = document.createElement("div");
|
|
2357
|
-
label
|
|
2476
|
+
markEl(label, "progress-label");
|
|
2477
|
+
label.style.cssText = compact ? "font-size: 13px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;" : "display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px;";
|
|
2358
2478
|
const leading = document.createElement("span");
|
|
2479
|
+
markEl(leading, "title");
|
|
2359
2480
|
leading.textContent = campaign.title;
|
|
2360
2481
|
label.appendChild(leading);
|
|
2361
2482
|
const numeric = document.createElement("span");
|
|
2362
|
-
numeric
|
|
2483
|
+
markEl(numeric, "progress-value");
|
|
2484
|
+
numeric.style.cssText = compact ? "display: none;" : "opacity: 0.7; font-weight: 500;";
|
|
2363
2485
|
label.appendChild(numeric);
|
|
2364
2486
|
bar.appendChild(label);
|
|
2365
2487
|
const shell = document.createElement("div");
|
|
2366
|
-
shell
|
|
2488
|
+
markEl(shell, "progress-track");
|
|
2489
|
+
shell.style.cssText = compact ? `height: 6px; border-radius: 999px; background: var(--aegis-progress-track, ${track}); overflow: hidden;` : `
|
|
2367
2490
|
height: 8px; border-radius: 999px; background: ${track};
|
|
2368
2491
|
overflow: hidden;
|
|
2369
2492
|
`;
|
|
2370
2493
|
const fillEl = document.createElement("div");
|
|
2371
|
-
fillEl
|
|
2494
|
+
markEl(fillEl, "progress-fill");
|
|
2495
|
+
fillEl.style.cssText = compact ? `position: relative; overflow: hidden; height: 100%; border-radius: 999px; background: var(--aegis-progress-fill, ${fill}); width: 0%; transition: width 0.4s cubic-bezier(.4,0,.2,1);` : `
|
|
2372
2496
|
position: relative; overflow: hidden;
|
|
2373
2497
|
height: 100%; border-radius: 999px; background: ${fill};
|
|
2374
2498
|
width: 0%; transition: width 0.4s cubic-bezier(.4,0,.2,1);
|
|
@@ -2385,7 +2509,8 @@ function buildProgressBar(ctx, inline) {
|
|
|
2385
2509
|
shell.appendChild(fillEl);
|
|
2386
2510
|
bar.appendChild(shell);
|
|
2387
2511
|
const footnote = document.createElement("div");
|
|
2388
|
-
footnote
|
|
2512
|
+
markEl(footnote, "subline");
|
|
2513
|
+
footnote.style.cssText = compact ? "display: none;" : "font-size: 11.5px; opacity: 0.65; margin-top: 6px;";
|
|
2389
2514
|
bar.appendChild(footnote);
|
|
2390
2515
|
const readCurrentValue = () => {
|
|
2391
2516
|
var _a, _b, _c;
|
|
@@ -2443,11 +2568,16 @@ function buildProgressBar(ctx, inline) {
|
|
|
2443
2568
|
current: cur
|
|
2444
2569
|
});
|
|
2445
2570
|
fillEl.style.width = `${pct}%`;
|
|
2571
|
+
markProgress(shell, pct, complete);
|
|
2446
2572
|
numeric.textContent = `${cur.toFixed(0)} / ${threshold.toFixed(0)} · ${Math.round(pct)}%`;
|
|
2447
2573
|
shimmer.style.display = complete ? "none" : "";
|
|
2448
2574
|
for (const m2 of milestonesReached) {
|
|
2449
2575
|
if (m2 !== "unlocked") fireMilestone(m2);
|
|
2450
2576
|
}
|
|
2577
|
+
if (compact) {
|
|
2578
|
+
leading.textContent = complete ? rewardText : campaign.title;
|
|
2579
|
+
markEl(leading, complete ? "reward" : "title");
|
|
2580
|
+
}
|
|
2451
2581
|
if (complete) {
|
|
2452
2582
|
footnote.textContent = rewardText;
|
|
2453
2583
|
if (!lastFiredUnlock) {
|
|
@@ -2470,7 +2600,8 @@ function renderProgressBar(ctx) {
|
|
|
2470
2600
|
if (bar) document.body.appendChild(bar);
|
|
2471
2601
|
}
|
|
2472
2602
|
function renderProgressBarInline(ctx, target) {
|
|
2473
|
-
const
|
|
2603
|
+
const slot = target.closest("[data-aegis-slot]") ?? target;
|
|
2604
|
+
const bar = buildProgressBar(ctx, true, slotVariant(slot) === "compact");
|
|
2474
2605
|
if (!bar) return false;
|
|
2475
2606
|
target.appendChild(bar);
|
|
2476
2607
|
return true;
|
|
@@ -7213,6 +7344,11 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7213
7344
|
this.slotTimers = /* @__PURE__ */ new WeakMap();
|
|
7214
7345
|
this.renderedSlots = /* @__PURE__ */ new Set();
|
|
7215
7346
|
this.slotObserver = null;
|
|
7347
|
+
this.phoneVariantMedia = null;
|
|
7348
|
+
this.onPhoneVariantChange = () => {
|
|
7349
|
+
if (this.slotsTornDown || typeof document === "undefined") return;
|
|
7350
|
+
if (document.querySelector(`[data-aegis-slot][${SLOT_VARIANT_PHONE_ATTR}]`)) this.renderIntoSlots();
|
|
7351
|
+
};
|
|
7216
7352
|
this.slotRenderScheduled = false;
|
|
7217
7353
|
this.slotsTornDown = false;
|
|
7218
7354
|
this.campaignsLoaded = false;
|
|
@@ -8098,6 +8234,13 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
8098
8234
|
else setTimeout(run, 0);
|
|
8099
8235
|
});
|
|
8100
8236
|
this.slotObserver.observe(document.body, { childList: true, subtree: true });
|
|
8237
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
8238
|
+
const mq = window.matchMedia(PHONE_VARIANT_QUERY);
|
|
8239
|
+
if (mq && typeof mq.addEventListener === "function") {
|
|
8240
|
+
mq.addEventListener("change", this.onPhoneVariantChange);
|
|
8241
|
+
this.phoneVariantMedia = mq;
|
|
8242
|
+
}
|
|
8243
|
+
}
|
|
8101
8244
|
}
|
|
8102
8245
|
renderIntoSlots() {
|
|
8103
8246
|
if (typeof document === "undefined" || this.slotsTornDown) return;
|
|
@@ -8136,7 +8279,8 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
8136
8279
|
const rotateMs = attrMs > 0 ? attrMs : declaredMs;
|
|
8137
8280
|
const rotating = rotateMs > 0 && list.length > 1;
|
|
8138
8281
|
const shown = rotating ? list : list.slice(0, 1);
|
|
8139
|
-
const
|
|
8282
|
+
const variant = slotVariant(slot);
|
|
8283
|
+
const sig = (variant ? `variant:${variant}|` : "") + (rotating ? "rotate:" : "one:") + shown.map((c) => `${c.id}:${c.assigned_variant_id ?? ""}`).join(",");
|
|
8140
8284
|
if (this.filledSlots.has(slot) && this.slotSignatures.get(slot) === sig) return;
|
|
8141
8285
|
this.clearSlotContent(slot);
|
|
8142
8286
|
this.slotSignatures.set(slot, sig);
|
|
@@ -11005,8 +11149,8 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
11005
11149
|
return res.json().catch(() => ({}));
|
|
11006
11150
|
}
|
|
11007
11151
|
};
|
|
11008
|
-
const
|
|
11009
|
-
const webPush = new
|
|
11152
|
+
const AegisWebPush = typeof window !== "undefined" && window.AegisWebPush || (await import("./push/AegisWebPush.js")).AegisWebPush;
|
|
11153
|
+
const webPush = new AegisWebPush(apiClient, {
|
|
11010
11154
|
vapidPublicKey,
|
|
11011
11155
|
propertyId: this.propertyId,
|
|
11012
11156
|
// Anon id doubles as the device-fingerprint salt so a re-subscribe
|
|
@@ -13114,6 +13258,11 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
13114
13258
|
// journey/template/outlet on the engagement delivery_event.
|
|
13115
13259
|
journey_execution_id: trackedCampaign == null ? void 0 : trackedCampaign.journey_execution_id,
|
|
13116
13260
|
lifecycle_fork_id: trackedCampaign == null ? void 0 : trackedCampaign.lifecycle_fork_id,
|
|
13261
|
+
// Media Gen-2 P0b M1 (1.46.0) — the library asset the payload carried.
|
|
13262
|
+
// The gateway lifts it onto the canonical event and the switchboard
|
|
13263
|
+
// copies it into delivery_events.metadata.asset_id, where the cell's
|
|
13264
|
+
// asset perf writer counts `shown` rows by it. Absent when unknown.
|
|
13265
|
+
asset_id: assetIdOf(trackedCampaign == null ? void 0 : trackedCampaign.asset_id),
|
|
13117
13266
|
// Outlet the customer is ACTIVELY viewing (setLocation) wins — that's
|
|
13118
13267
|
// where the impression/click actually happened; fall back to the served
|
|
13119
13268
|
// campaign's outlet, else brand-tier. The gateway promotes this to the
|
|
@@ -13223,6 +13372,10 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
13223
13372
|
this.slotObserver.disconnect();
|
|
13224
13373
|
this.slotObserver = null;
|
|
13225
13374
|
}
|
|
13375
|
+
if (this.phoneVariantMedia) {
|
|
13376
|
+
this.phoneVariantMedia.removeEventListener("change", this.onPhoneVariantChange);
|
|
13377
|
+
this.phoneVariantMedia = null;
|
|
13378
|
+
}
|
|
13226
13379
|
this.slotRenderScheduled = false;
|
|
13227
13380
|
this.slotsTornDown = true;
|
|
13228
13381
|
this.lifecycleGen += 1;
|
|
@@ -15884,7 +16037,7 @@ const _AegisMessageRuntime = class _AegisMessageRuntime {
|
|
|
15884
16037
|
this.initialized = false;
|
|
15885
16038
|
this.armedInAppTriggers = /* @__PURE__ */ new Set();
|
|
15886
16039
|
{
|
|
15887
|
-
const v = "1.
|
|
16040
|
+
const v = "1.46.1";
|
|
15888
16041
|
try {
|
|
15889
16042
|
globalThis.__AEGIS_SDK_VERSION__ = v;
|
|
15890
16043
|
} catch {
|
|
@@ -16356,7 +16509,7 @@ export {
|
|
|
16356
16509
|
AegisInbox,
|
|
16357
16510
|
AegisLoyaltyManager,
|
|
16358
16511
|
AegisMessageRuntime,
|
|
16359
|
-
AegisWebPush,
|
|
16512
|
+
A as AegisWebPush,
|
|
16360
16513
|
B as BloomFilter,
|
|
16361
16514
|
BootstrapError,
|
|
16362
16515
|
E as EcommerceTracker,
|