@active-reach/web-sdk 1.45.2 → 1.46.0

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/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import { S as Storage, r as redactUrl, l as logger, A as Aegis } from "./analytics-CfEHNTzy.mjs";
2
- import { B, E, N, R, U, m } from "./analytics-CfEHNTzy.mjs";
3
- import { AegisWebPush } from "./push/AegisWebPush.js";
1
+ import { S as Storage, r as redactUrl, l as logger, A as Aegis } from "./analytics-C-Go3Pm5.mjs";
2
+ import { B, E, N, R, U, m } from "./analytics-C-Go3Pm5.mjs";
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,24 @@ 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
+ }
679
698
  const WEIGHT = {
680
699
  regular: "400",
681
700
  medium: "500",
@@ -684,7 +703,10 @@ const WEIGHT = {
684
703
  };
685
704
  const ICON_PX = { sm: 22, md: 30, lg: 40 };
686
705
  const TEXT_PX = { sm: 11.5, md: 13, lg: 15 };
687
- const RAIL_TILE_FLEX = "flex:0 0 clamp(150px, 15vw, 220px); scroll-snap-align:start;";
706
+ const RAIL_TILE_WIDTH = "clamp(150px, 15vw, 220px)";
707
+ const RAIL_TILE_FLEX = `flex:0 0 ${RAIL_TILE_WIDTH}; scroll-snap-align:start;`;
708
+ const SHELL_ROW_KINDS = ["price", "price_plain", "title", "subtitle", "rating", "category", "cta"];
709
+ const RAIL_SHELL_CSS = `[data-aegis-slot-shell]:has(> [data-aegis-shell-tiles]){background:transparent;}[data-aegis-slot-shell][data-aegis-shell-frame='panel']{background:#ffffff;box-shadow:0 4px 12px rgba(0,0,0,0.06);}[data-aegis-shell-frame='panel']>[data-aegis-shell-title]{padding:12px 12px 0;font-size:13px;}[data-aegis-shell-frame='plain']>[data-aegis-shell-title]{margin:0 0 2px;font-size:16px;}[data-aegis-shell-frame='plain']>[data-aegis-shell-body]{margin-bottom:10px;font-size:13px;line-height:1.4;}[data-aegis-shell-title]::before,[data-aegis-shell-body]::before{content:'\\00a0';display:block;width:96px;max-width:60%;border-radius:4px;background:#e2e8f0;}[data-aegis-shell-tiles]{display:flex;gap:8px;overflow:hidden;}[data-aegis-slot-shell='rail'] [data-aegis-shell-tiles]{overflow-x:auto;scroll-snap-type:x proximity;scrollbar-width:none;}[data-aegis-shell-frame='panel']>[data-aegis-shell-tiles]{padding:12px;}[data-aegis-shell-frame='plain']>[data-aegis-shell-tiles]{gap:10px;}[data-aegis-slot-shell='rail'][data-aegis-shell-frame='plain']>[data-aegis-shell-tiles]{padding:10px 8px 18px;margin:-8px -8px -6px;}[data-aegis-slot-shell='grid'] [data-aegis-shell-tiles]{display:grid;grid-template-columns:repeat(var(--aegis-shell-cols,2),minmax(0,1fr));}[data-aegis-shell-tile]{box-sizing:border-box;display:flex;flex-direction:column;gap:6px;min-width:0;padding:8px;border:1px solid #f1f1f3;border-radius:14px;background:#ffffff;}[data-aegis-slot-shell='rail'] [data-aegis-shell-tile]{flex:0 0 ${RAIL_TILE_WIDTH};scroll-snap-align:start;}[data-aegis-shell-img]{width:100%;aspect-ratio:var(--aegis-shell-card-ar,1 / 1);border-radius:10px;background:#f1f5f9;}[data-aegis-shell-row]::before{content:'\\00a0';display:block;border-radius:4px;background:#f1f5f9;}[data-aegis-shell-row='price']{font-size:12px;}[data-aegis-shell-row='price']::before{width:56px;padding:2px 0;border-radius:6px;}[data-aegis-shell-row='price_plain']{font-size:13px;}[data-aegis-shell-row='price_plain']::before{width:56px;}[data-aegis-shell-row='title']{font-size:12.5px;line-height:1.3;}[data-aegis-shell-row='subtitle']{font-size:11px;line-height:1.3;}[data-aegis-shell-row='subtitle']::before{width:80%;}[data-aegis-shell-lines='2']::before{height:2.6em;}[data-aegis-shell-lines='3']::before{height:3.9em;}[data-aegis-shell-lines='4']::before{height:5.2em;}[data-aegis-shell-row='rating']::before{width:40px;height:12px;}[data-aegis-shell-row='category']{font-size:10px;}[data-aegis-shell-row='category']::before{width:48px;padding:2px 0;}[data-aegis-shell-row='cta']{margin-top:auto;font-size:12px;}[data-aegis-shell-row='cta']::before{padding:7px 0;border-radius:999px;}`;
688
710
  function resolveCardFont(ff) {
689
711
  return `${campaignFontVarsCss(ff)}${fontFamilyCss("body")}`;
690
712
  }
@@ -1642,7 +1664,7 @@ function buildNpsElement(el2, ctx, fg, accent, muted) {
1642
1664
  wrap.appendChild(scale);
1643
1665
  return wrap;
1644
1666
  }
1645
- function buildProgressElement(el2, ctx, accent, muted) {
1667
+ function buildProgressElement(el2, ctx, accent, muted, compact) {
1646
1668
  const { trackEvent, campaign, sanitizeColor } = ctx;
1647
1669
  const goal = el2.goal_type || "cart_total";
1648
1670
  const moneyGoal = goal === "cart_total";
@@ -1678,28 +1700,53 @@ function buildProgressElement(el2, ctx, accent, muted) {
1678
1700
  const c = ctx.getCartState && ctx.getCartState();
1679
1701
  return c && typeof c.itemCount === "number" ? c.itemCount : 0;
1680
1702
  };
1703
+ const track = `color-mix(in srgb, ${fill} 16%, transparent)`;
1704
+ const subColor = compact ? `var(--aegis-card-muted, ${muted})` : muted;
1705
+ const doneColor = compact ? "var(--aegis-progress-done, #10b981)" : "#10b981";
1681
1706
  const wrap = document.createElement("div");
1682
- wrap.style.cssText = "display:flex;flex-direction:column;gap:3px;min-width:0;width:100%;";
1683
- const sub = document.createElement("div");
1684
- sub.style.cssText = `font-size:11.5px;line-height:1.2;color:${muted};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;`;
1707
+ markEl(wrap, "progress");
1708
+ 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%;";
1709
+ const sub = document.createElement(compact ? "span" : "div");
1710
+ markEl(sub, "subline");
1711
+ sub.style.cssText = compact ? `color:${subColor};` : `font-size:11.5px;line-height:1.2;color:${muted};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;`;
1685
1712
  const shell = document.createElement("div");
1686
- shell.style.cssText = `height:3px;border-radius:999px;background:color-mix(in srgb, ${fill} 16%, transparent);overflow:hidden;`;
1713
+ markEl(shell, "progress-track");
1714
+ 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;`;
1687
1715
  const bar = document.createElement("div");
1688
- bar.style.cssText = `height:100%;border-radius:999px;background:${fill};width:0%;transition:width .4s cubic-bezier(.4,0,.2,1);`;
1716
+ markEl(bar, "progress-fill");
1717
+ 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);`;
1689
1718
  shell.appendChild(bar);
1690
- wrap.appendChild(sub);
1719
+ let titleEl = null;
1720
+ if (compact) {
1721
+ const line = document.createElement("div");
1722
+ markEl(line, "progress-label");
1723
+ 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;`;
1724
+ if (compact.title) {
1725
+ titleEl = document.createElement("span");
1726
+ markEl(titleEl, "title");
1727
+ titleEl.style.cssText = "font-weight:700;";
1728
+ titleEl.textContent = compact.title;
1729
+ line.appendChild(titleEl);
1730
+ }
1731
+ line.appendChild(sub);
1732
+ wrap.appendChild(line);
1733
+ } else {
1734
+ wrap.appendChild(sub);
1735
+ }
1691
1736
  wrap.appendChild(shell);
1692
1737
  let firedUnlock = false;
1693
1738
  let seenIncomplete = false;
1694
1739
  const update = () => {
1695
- var _a;
1740
+ var _a, _b, _c;
1696
1741
  const th = threshold();
1697
1742
  const cur = readCur();
1698
1743
  if (th <= 0 && el2.threshold_source === "free_delivery_setting") {
1699
1744
  wrap.style.display = "none";
1745
+ (_a = compact == null ? void 0 : compact.onMeasured) == null ? void 0 : _a.call(compact, false);
1700
1746
  return;
1701
1747
  }
1702
1748
  wrap.style.display = "flex";
1749
+ (_b = compact == null ? void 0 : compact.onMeasured) == null ? void 0 : _b.call(compact, true);
1703
1750
  const { pct, complete } = computeProgress({ threshold: th, current: cur });
1704
1751
  bar.style.width = `${pct}%`;
1705
1752
  const labeled = cardProgressSubLabel({
@@ -1710,19 +1757,21 @@ function buildProgressElement(el2, ctx, accent, muted) {
1710
1757
  currencySymbol: moneyGoal ? sym() : "",
1711
1758
  showPct: el2.show_pct
1712
1759
  });
1713
- sub.textContent = labeled.text;
1760
+ sub.textContent = titleEl && !complete && labeled.text ? ` · ${labeled.text}` : labeled.text;
1761
+ if (titleEl) titleEl.style.display = complete ? "none" : "";
1762
+ markEl(sub, complete ? "reward" : "subline");
1714
1763
  if (complete) {
1715
- sub.style.color = "#10b981";
1764
+ sub.style.color = doneColor;
1716
1765
  sub.style.fontWeight = "700";
1717
1766
  if (!firedUnlock) {
1718
1767
  firedUnlock = true;
1719
1768
  if (seenIncomplete) {
1720
1769
  trackEvent(campaign.id, "clicked", { stepId: el2.id || "unlocked" });
1721
- if (el2.celebrate_on_complete !== false) (_a = ctx.playReaction) == null ? void 0 : _a.call(ctx, wrap, "celebrate");
1770
+ if (el2.celebrate_on_complete !== false) (_c = ctx.playReaction) == null ? void 0 : _c.call(ctx, wrap, "celebrate");
1722
1771
  }
1723
1772
  }
1724
1773
  } else {
1725
- sub.style.color = muted;
1774
+ sub.style.color = subColor;
1726
1775
  sub.style.fontWeight = "";
1727
1776
  const engaged = goal === "cart_total" || goal === "items_in_cart" ? cartItems() > 0 : cur > 0;
1728
1777
  if (engaged) seenIncomplete = true;
@@ -1779,6 +1828,16 @@ function buildCtaAction(el2, card, meta, inline, sanitizeUrl) {
1779
1828
  };
1780
1829
  }
1781
1830
  }
1831
+ function findElement(els, type) {
1832
+ for (const el2 of els) {
1833
+ if (el2.type === type) return el2;
1834
+ if (el2.type === "group" && el2.elements) {
1835
+ const hit = findElement(el2.elements, type);
1836
+ if (hit) return hit;
1837
+ }
1838
+ }
1839
+ return null;
1840
+ }
1782
1841
  function renderCardFromTemplate(card, opts) {
1783
1842
  const { ctx, action, layout, layoutAccent } = opts;
1784
1843
  const inline = action === "cart";
@@ -1790,7 +1849,11 @@ function renderCardFromTemplate(card, opts) {
1790
1849
  const brand = `var(--aegis-brand-accent, ${accent})`;
1791
1850
  const fg = contrastFg(frame.bg ? sanitizeColor(frame.bg) : "#ffffff");
1792
1851
  const muted = fg === "#ffffff" ? "rgba(255,255,255,0.72)" : "#6b7280";
1852
+ const compact = slotVariant(ctx.slotEl) === "compact";
1853
+ const frameBg = frame.bg ? sanitizeColor(frame.bg) : "#ffffff";
1793
1854
  const tile = document.createElement("div");
1855
+ markEl(tile, "frame");
1856
+ if (compact) tile.setAttribute("data-aegis-variant", "compact");
1794
1857
  tile.setAttribute("data-aegis-reaction-anchor", "");
1795
1858
  const cardFont = resolveCardFont(campaignFontFamily(campaign) ?? frame.fontFamily);
1796
1859
  const displayFont = fontFamilyCss("display");
@@ -1820,6 +1883,17 @@ function renderCardFromTemplate(card, opts) {
1820
1883
  ${sizing}
1821
1884
  cursor:${card.cta_url || inline ? "pointer" : "default"}; transition:transform 0.15s ease;
1822
1885
  `;
1886
+ if (compact) {
1887
+ tile.style.cssText = `
1888
+ box-sizing:border-box; display:flex; flex-direction:${dir}; ${fLayout === "row" ? "align-items:center;" : ""} gap:${tileGap}px; position:relative;
1889
+ color:var(--aegis-card-fg, ${fg});
1890
+ ${cardFont}
1891
+ background:var(--aegis-card-bg, ${frameBg});
1892
+ border:0; border-radius:0; padding:0; box-shadow:none;
1893
+ width:100%; min-width:0;
1894
+ cursor:${card.cta_url || inline ? "pointer" : "default"};
1895
+ `;
1896
+ }
1823
1897
  const elements = tpl.elements && tpl.elements.length ? tpl.elements : DEFAULT_CARD_TEMPLATE.elements;
1824
1898
  let imageWrap = null;
1825
1899
  const paintInto = (container, els) => {
@@ -1860,6 +1934,7 @@ function renderCardFromTemplate(card, opts) {
1860
1934
  wrap.appendChild(img);
1861
1935
  }
1862
1936
  }
1937
+ markEl(wrap, "image");
1863
1938
  imageWrap = wrap;
1864
1939
  container.appendChild(wrap);
1865
1940
  break;
@@ -1885,6 +1960,7 @@ function renderCardFromTemplate(card, opts) {
1885
1960
  case "title": {
1886
1961
  if (!card.title) break;
1887
1962
  const t = document.createElement("div");
1963
+ markEl(t, "title");
1888
1964
  t.textContent = card.title;
1889
1965
  const lines = el2.lines && el2.lines > 0 ? el2.lines : 2;
1890
1966
  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;`;
@@ -1894,6 +1970,7 @@ function renderCardFromTemplate(card, opts) {
1894
1970
  case "subtitle": {
1895
1971
  if (!card.body) break;
1896
1972
  const s = document.createElement("div");
1973
+ markEl(s, "subtitle");
1897
1974
  s.textContent = card.body;
1898
1975
  const lines = el2.lines && el2.lines > 0 ? el2.lines : 2;
1899
1976
  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;`;
@@ -1918,6 +1995,7 @@ function renderCardFromTemplate(card, opts) {
1918
1995
  case "icon": {
1919
1996
  const px = ICON_PX[el2.size || "md"] || 30;
1920
1997
  const node = document.createElement("div");
1998
+ markEl(node, "icon");
1921
1999
  const iconColor = el2.color ? sanitizeColor(el2.color) : fg;
1922
2000
  if (el2.bubble) {
1923
2001
  const bubbleTint = el2.color ? sanitizeColor(el2.color) : brand;
@@ -1936,6 +2014,7 @@ function renderCardFromTemplate(card, opts) {
1936
2014
  }
1937
2015
  case "text": {
1938
2016
  const t = document.createElement("div");
2017
+ markEl(t, "text");
1939
2018
  const fs = TEXT_PX[el2.size || "md"] || 13;
1940
2019
  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;`;
1941
2020
  t.textContent = interpolateTokens(el2.content ?? "", ctx);
@@ -1976,6 +2055,7 @@ function renderCardFromTemplate(card, opts) {
1976
2055
  }
1977
2056
  case "group": {
1978
2057
  const g = document.createElement("div");
2058
+ markEl(g, "group");
1979
2059
  const gdir = el2.layout === "row" ? "row" : "column";
1980
2060
  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;"}`;
1981
2061
  paintInto(g, el2.elements || []);
@@ -1986,6 +2066,7 @@ function renderCardFromTemplate(card, opts) {
1986
2066
  const label = el2.text || card.cta_text || (inline ? "Add" : "Shop");
1987
2067
  const cta = document.createElement("button");
1988
2068
  cta.className = "aegis-cta";
2069
+ markEl(cta, "cta");
1989
2070
  cta.textContent = label;
1990
2071
  const overlayOnImage = !!el2.overlay && !!imageWrap;
1991
2072
  if (overlayOnImage) {
@@ -2008,7 +2089,20 @@ function renderCardFromTemplate(card, opts) {
2008
2089
  }
2009
2090
  }
2010
2091
  };
2011
- paintInto(tile, elements);
2092
+ const compactProgress = compact ? findElement(elements, "progress") : null;
2093
+ if (compactProgress) {
2094
+ tile.style.flexDirection = "column";
2095
+ tile.style.alignItems = "stretch";
2096
+ const onMeasured = (measured) => {
2097
+ tile.hidden = !measured;
2098
+ tile.style.display = measured ? "flex" : "none";
2099
+ };
2100
+ tile.appendChild(
2101
+ buildProgressElement(compactProgress, ctx, brand, muted, { title: card.title, fg, onMeasured })
2102
+ );
2103
+ } else {
2104
+ paintInto(tile, elements);
2105
+ }
2012
2106
  const open = (e) => {
2013
2107
  var _a;
2014
2108
  e.stopPropagation();
@@ -2315,7 +2409,7 @@ function renderStickyBar(ctx) {
2315
2409
  }
2316
2410
  document.body.appendChild(bar);
2317
2411
  }
2318
- function buildProgressBar(ctx, inline) {
2412
+ function buildProgressBar(ctx, inline, compact = false) {
2319
2413
  const { campaign, trackEvent, sanitizeColor, log, addAnimationStyles } = ctx;
2320
2414
  const ic = campaign.interactive_config || {};
2321
2415
  const goalType = ic.progress_goal_type || "cart_total";
@@ -2337,6 +2431,8 @@ function buildProgressBar(ctx, inline) {
2337
2431
  const bar = document.createElement("div");
2338
2432
  bar.className = "aegis-in-app-progress-bar";
2339
2433
  bar.setAttribute("data-campaign-id", campaign.id);
2434
+ markEl(bar, "frame");
2435
+ if (compact) bar.setAttribute("data-aegis-variant", "compact");
2340
2436
  bar.style.cssText = inline ? `
2341
2437
  background: ${bg}; color: ${fg};
2342
2438
  padding: 10px 14px;
@@ -2350,22 +2446,34 @@ function buildProgressBar(ctx, inline) {
2350
2446
  ${fontFamilyCss("body")}
2351
2447
  animation: aegisSlideInFromBottom 0.3s ease-out;
2352
2448
  `;
2449
+ if (compact) {
2450
+ bar.style.cssText = `
2451
+ background: var(--aegis-card-bg, ${bg}); color: var(--aegis-card-fg, ${fg});
2452
+ padding: 0; display: flex; flex-direction: column; gap: 6px;
2453
+ ${fontFamilyCss("body")}
2454
+ `;
2455
+ }
2353
2456
  const label = document.createElement("div");
2354
- label.style.cssText = "display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px;";
2457
+ markEl(label, "progress-label");
2458
+ 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;";
2355
2459
  const leading = document.createElement("span");
2460
+ markEl(leading, "title");
2356
2461
  leading.textContent = campaign.title;
2357
2462
  label.appendChild(leading);
2358
2463
  const numeric = document.createElement("span");
2359
- numeric.style.cssText = "opacity: 0.7; font-weight: 500;";
2464
+ markEl(numeric, "progress-value");
2465
+ numeric.style.cssText = compact ? "display: none;" : "opacity: 0.7; font-weight: 500;";
2360
2466
  label.appendChild(numeric);
2361
2467
  bar.appendChild(label);
2362
2468
  const shell = document.createElement("div");
2363
- shell.style.cssText = `
2469
+ markEl(shell, "progress-track");
2470
+ shell.style.cssText = compact ? `height: 6px; border-radius: 999px; background: var(--aegis-progress-track, ${track}); overflow: hidden;` : `
2364
2471
  height: 8px; border-radius: 999px; background: ${track};
2365
2472
  overflow: hidden;
2366
2473
  `;
2367
2474
  const fillEl = document.createElement("div");
2368
- fillEl.style.cssText = `
2475
+ markEl(fillEl, "progress-fill");
2476
+ 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);` : `
2369
2477
  position: relative; overflow: hidden;
2370
2478
  height: 100%; border-radius: 999px; background: ${fill};
2371
2479
  width: 0%; transition: width 0.4s cubic-bezier(.4,0,.2,1);
@@ -2382,7 +2490,8 @@ function buildProgressBar(ctx, inline) {
2382
2490
  shell.appendChild(fillEl);
2383
2491
  bar.appendChild(shell);
2384
2492
  const footnote = document.createElement("div");
2385
- footnote.style.cssText = "font-size: 11.5px; opacity: 0.65; margin-top: 6px;";
2493
+ markEl(footnote, "subline");
2494
+ footnote.style.cssText = compact ? "display: none;" : "font-size: 11.5px; opacity: 0.65; margin-top: 6px;";
2386
2495
  bar.appendChild(footnote);
2387
2496
  const readCurrentValue = () => {
2388
2497
  var _a, _b, _c;
@@ -2445,6 +2554,10 @@ function buildProgressBar(ctx, inline) {
2445
2554
  for (const m2 of milestonesReached) {
2446
2555
  if (m2 !== "unlocked") fireMilestone(m2);
2447
2556
  }
2557
+ if (compact) {
2558
+ leading.textContent = complete ? rewardText : campaign.title;
2559
+ markEl(leading, complete ? "reward" : "title");
2560
+ }
2448
2561
  if (complete) {
2449
2562
  footnote.textContent = rewardText;
2450
2563
  if (!lastFiredUnlock) {
@@ -2467,7 +2580,8 @@ function renderProgressBar(ctx) {
2467
2580
  if (bar) document.body.appendChild(bar);
2468
2581
  }
2469
2582
  function renderProgressBarInline(ctx, target) {
2470
- const bar = buildProgressBar(ctx, true);
2583
+ const slot = target.closest("[data-aegis-slot]") ?? target;
2584
+ const bar = buildProgressBar(ctx, true, slotVariant(slot) === "compact");
2471
2585
  if (!bar) return false;
2472
2586
  target.appendChild(bar);
2473
2587
  return true;
@@ -6729,6 +6843,13 @@ const PHONE_MAX_WIDTH_PX = 767;
6729
6843
  const STYLE_ID = "aegis-slot-shell-style";
6730
6844
  const SHELL_SELECTOR = ":scope > [data-aegis-slot-shell]";
6731
6845
  const LAYOUTS = /* @__PURE__ */ new Set(["hero", "rail", "grid", "bar", "card"]);
6846
+ const SHELL_MAX_TILES = 6;
6847
+ const SHELL_MAX_COLUMNS = 4;
6848
+ const SHELL_MAX_ROWS = 6;
6849
+ const SHELL_MAX_LINES = 4;
6850
+ const FRAMES = /* @__PURE__ */ new Set(["panel", "plain"]);
6851
+ const ROW_KINDS = new Set(SHELL_ROW_KINDS);
6852
+ const DEFAULT_ROWS = [{ kind: "price", lines: 1 }, { kind: "title", lines: 2 }];
6732
6853
  function storageKey(ctx) {
6733
6854
  return `${STORAGE_PREFIX}${ctx.propertyId || "-"}:${ctx.surface || "-"}:${ctx.screen || "-"}:${ctx.locationId || "-"}`;
6734
6855
  }
@@ -6801,7 +6922,8 @@ function injectShellCss(doc) {
6801
6922
  if (doc.getElementById(STYLE_ID)) return;
6802
6923
  const style = doc.createElement("style");
6803
6924
  style.id = STYLE_ID;
6804
- style.textContent = `[data-aegis-slot-shell]{position:relative;display:block;box-sizing:border-box;width:100%;overflow:hidden;border-radius:12px;background:#f1f5f9;aspect-ratio:var(--aegis-shell-ar,auto);min-height:var(--aegis-shell-min-h,0px);max-height:var(--aegis-shell-max-h,none);}@media (min-width:${PHONE_MAX_WIDTH_PX + 1}px){[data-aegis-slot-shell]{max-height:var(--aegis-shell-max-h-desktop,var(--aegis-shell-max-h,none));}}@media (max-width:${PHONE_MAX_WIDTH_PX}px){[data-aegis-slot-shell]{aspect-ratio:var(--aegis-shell-ar-phone,var(--aegis-shell-ar,auto));min-height:var(--aegis-shell-min-h-phone,var(--aegis-shell-min-h,0px));}}[data-aegis-slot-shell="hero"]{border-radius:16px;}@media (min-width:${PHONE_MAX_WIDTH_PX + 1}px){[data-aegis-slot-shell="hero"]{border-radius:0;}}[data-aegis-slot-shell] img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;display:block;}@keyframes aegis-shell-pulse{0%,100%{opacity:1}50%{opacity:.6}}@media (prefers-reduced-motion:no-preference){[data-aegis-slot-shell]:not([data-aegis-shell-has-image]){animation:aegis-shell-pulse 1.6s ease-in-out infinite;}}`;
6925
+ style.textContent = `[data-aegis-slot-shell]{position:relative;display:block;box-sizing:border-box;width:100%;overflow:hidden;border-radius:12px;background:#f1f5f9;aspect-ratio:var(--aegis-shell-ar,auto);min-height:var(--aegis-shell-min-h,0px);max-height:var(--aegis-shell-max-h,none);}@media (min-width:${PHONE_MAX_WIDTH_PX + 1}px){[data-aegis-slot-shell]{max-height:var(--aegis-shell-max-h-desktop,var(--aegis-shell-max-h,none));}}@media (max-width:${PHONE_MAX_WIDTH_PX}px){[data-aegis-slot-shell]{aspect-ratio:var(--aegis-shell-ar-phone,var(--aegis-shell-ar,auto));min-height:var(--aegis-shell-min-h-phone,var(--aegis-shell-min-h,0px));}}[data-aegis-slot-shell="hero"]{border-radius:16px;}@media (min-width:${PHONE_MAX_WIDTH_PX + 1}px){[data-aegis-slot-shell="hero"]{border-radius:0;}}[data-aegis-slot-shell] img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;display:block;}@keyframes aegis-shell-pulse{0%,100%{opacity:1}50%{opacity:.6}}@media (prefers-reduced-motion:no-preference){[data-aegis-slot-shell]:not([data-aegis-shell-has-image]){animation:aegis-shell-pulse 1.6s ease-in-out infinite;}}` + // Rail / grid tiles: the card geometry, owned by card-template.ts.
6926
+ RAIL_SHELL_CSS;
6805
6927
  (doc.head || doc.documentElement).appendChild(style);
6806
6928
  }
6807
6929
  function srcsetUrl(url) {
@@ -6818,6 +6940,77 @@ function safeHttpUrl(v) {
6818
6940
  return null;
6819
6941
  }
6820
6942
  }
6943
+ function clampInt(v, lo, hi) {
6944
+ if (typeof v !== "number" || !Number.isFinite(v)) return null;
6945
+ return Math.min(hi, Math.max(lo, Math.round(v)));
6946
+ }
6947
+ function shellDrawsRows(shape) {
6948
+ return (shape.layout === "rail" || shape.layout === "grid") && Array.isArray(shape.card_rows);
6949
+ }
6950
+ function shellFrame(shape) {
6951
+ const f = shape.frame;
6952
+ return typeof f === "string" && FRAMES.has(f) ? f : null;
6953
+ }
6954
+ function shellRows(shape) {
6955
+ const raw = shape.card_rows;
6956
+ if (!Array.isArray(raw)) return DEFAULT_ROWS;
6957
+ const out = [];
6958
+ for (const r of raw) {
6959
+ if (out.length >= SHELL_MAX_ROWS) break;
6960
+ const kind = r && typeof r === "object" ? r.kind : null;
6961
+ if (typeof kind !== "string" || !ROW_KINDS.has(kind)) continue;
6962
+ const multi = kind === "title" || kind === "subtitle";
6963
+ const lines = multi ? clampInt(r.lines, 1, SHELL_MAX_LINES) ?? 1 : 1;
6964
+ out.push({ kind, lines });
6965
+ }
6966
+ return out;
6967
+ }
6968
+ function shellTileCount(shape) {
6969
+ if (shape.layout !== "rail" && shape.layout !== "grid") return 0;
6970
+ return clampInt(shape.card_count, 1, SHELL_MAX_TILES) ?? 0;
6971
+ }
6972
+ function hasText(v) {
6973
+ return typeof v === "string" && v.trim().length > 0;
6974
+ }
6975
+ function shellHasTitle(shape) {
6976
+ return typeof shape.has_title === "boolean" ? shape.has_title : hasText(shape.title);
6977
+ }
6978
+ function appendTiles(doc, el2, shape) {
6979
+ const tiles = shellTileCount(shape);
6980
+ if (tiles === 0) return;
6981
+ const frame = shellFrame(shape);
6982
+ if (frame) {
6983
+ el2.setAttribute("data-aegis-shell-frame", frame);
6984
+ if (shellHasTitle(shape)) {
6985
+ const t = doc.createElement("div");
6986
+ t.setAttribute("data-aegis-shell-title", "");
6987
+ el2.appendChild(t);
6988
+ }
6989
+ if (frame === "plain" && shape.has_body === true) {
6990
+ const b = doc.createElement("div");
6991
+ b.setAttribute("data-aegis-shell-body", "");
6992
+ el2.appendChild(b);
6993
+ }
6994
+ }
6995
+ const rows = shellRows(shape);
6996
+ const strip = doc.createElement("div");
6997
+ strip.setAttribute("data-aegis-shell-tiles", "");
6998
+ for (let i = 0; i < tiles; i += 1) {
6999
+ const tile = doc.createElement("div");
7000
+ tile.setAttribute("data-aegis-shell-tile", "");
7001
+ const img = doc.createElement("div");
7002
+ img.setAttribute("data-aegis-shell-img", "");
7003
+ tile.appendChild(img);
7004
+ for (const r of rows) {
7005
+ const row = doc.createElement("div");
7006
+ row.setAttribute("data-aegis-shell-row", r.kind);
7007
+ if (r.lines > 1) row.setAttribute("data-aegis-shell-lines", String(r.lines));
7008
+ tile.appendChild(row);
7009
+ }
7010
+ strip.appendChild(tile);
7011
+ }
7012
+ el2.appendChild(strip);
7013
+ }
6821
7014
  function buildShell(doc, shape) {
6822
7015
  const el2 = doc.createElement("div");
6823
7016
  el2.setAttribute("data-aegis-slot-shell", shape.layout);
@@ -6829,7 +7022,7 @@ function buildShell(doc, shape) {
6829
7022
  const phone = cssAspect(shape.aspect_phone ?? null);
6830
7023
  el2.style.setProperty("--aegis-shell-ar-phone", phone ?? "auto");
6831
7024
  if (!phone) el2.style.setProperty("--aegis-shell-min-h-phone", cssLength(shape.min_height ?? null) ?? "300px");
6832
- } else {
7025
+ } else if (!shellDrawsRows(shape)) {
6833
7026
  const minH = cssLength(shape.min_height ?? null);
6834
7027
  if (minH) el2.style.setProperty("--aegis-shell-min-h", minH);
6835
7028
  }
@@ -6837,6 +7030,13 @@ function buildShell(doc, shape) {
6837
7030
  if (maxH) {
6838
7031
  el2.style.setProperty(shape.layout === "hero" ? "--aegis-shell-max-h-desktop" : "--aegis-shell-max-h", maxH);
6839
7032
  }
7033
+ if (shape.layout === "rail" || shape.layout === "grid") {
7034
+ const cardAr = cssAspect(shape.card_aspect ?? null);
7035
+ if (cardAr) el2.style.setProperty("--aegis-shell-card-ar", cardAr);
7036
+ const cols = shape.layout === "grid" ? clampInt(shape.columns, 1, SHELL_MAX_COLUMNS) : null;
7037
+ if (cols) el2.style.setProperty("--aegis-shell-cols", String(cols));
7038
+ appendTiles(doc, el2, shape);
7039
+ }
6840
7040
  const img = shape.layout === "hero" ? shape.image : null;
6841
7041
  const src = img ? safeHttpUrl(img.src) : null;
6842
7042
  if (img && src) {
@@ -7124,6 +7324,11 @@ const _AegisInAppManager = class _AegisInAppManager {
7124
7324
  this.slotTimers = /* @__PURE__ */ new WeakMap();
7125
7325
  this.renderedSlots = /* @__PURE__ */ new Set();
7126
7326
  this.slotObserver = null;
7327
+ this.phoneVariantMedia = null;
7328
+ this.onPhoneVariantChange = () => {
7329
+ if (this.slotsTornDown || typeof document === "undefined") return;
7330
+ if (document.querySelector(`[data-aegis-slot][${SLOT_VARIANT_PHONE_ATTR}]`)) this.renderIntoSlots();
7331
+ };
7127
7332
  this.slotRenderScheduled = false;
7128
7333
  this.slotsTornDown = false;
7129
7334
  this.campaignsLoaded = false;
@@ -8009,6 +8214,13 @@ const _AegisInAppManager = class _AegisInAppManager {
8009
8214
  else setTimeout(run, 0);
8010
8215
  });
8011
8216
  this.slotObserver.observe(document.body, { childList: true, subtree: true });
8217
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
8218
+ const mq = window.matchMedia(PHONE_VARIANT_QUERY);
8219
+ if (mq && typeof mq.addEventListener === "function") {
8220
+ mq.addEventListener("change", this.onPhoneVariantChange);
8221
+ this.phoneVariantMedia = mq;
8222
+ }
8223
+ }
8012
8224
  }
8013
8225
  renderIntoSlots() {
8014
8226
  if (typeof document === "undefined" || this.slotsTornDown) return;
@@ -8047,7 +8259,8 @@ const _AegisInAppManager = class _AegisInAppManager {
8047
8259
  const rotateMs = attrMs > 0 ? attrMs : declaredMs;
8048
8260
  const rotating = rotateMs > 0 && list.length > 1;
8049
8261
  const shown = rotating ? list : list.slice(0, 1);
8050
- const sig = (rotating ? "rotate:" : "one:") + shown.map((c) => `${c.id}:${c.assigned_variant_id ?? ""}`).join(",");
8262
+ const variant = slotVariant(slot);
8263
+ const sig = (variant ? `variant:${variant}|` : "") + (rotating ? "rotate:" : "one:") + shown.map((c) => `${c.id}:${c.assigned_variant_id ?? ""}`).join(",");
8051
8264
  if (this.filledSlots.has(slot) && this.slotSignatures.get(slot) === sig) return;
8052
8265
  this.clearSlotContent(slot);
8053
8266
  this.slotSignatures.set(slot, sig);
@@ -8293,7 +8506,7 @@ const _AegisInAppManager = class _AegisInAppManager {
8293
8506
  /**
8294
8507
  * U7 — render server-injected token-bound campaigns.
8295
8508
  *
8296
- * The standalone-page route at `apps/cashier-portal/src/app/s/[slug]/
8509
+ * The standalone-page route at `apps/cashier-portal/src/app/(store)/s/[slug]/
8297
8510
  * [workspace]/[page_key]/page.tsx` (and the `/c/[token]` Aegis-hosted
8298
8511
  * fallback) verify the URL token server-side via the F16 internal
8299
8512
  * endpoint, then embed the resolved campaign payload as JSON inside
@@ -10916,8 +11129,8 @@ const _AegisInAppManager = class _AegisInAppManager {
10916
11129
  return res.json().catch(() => ({}));
10917
11130
  }
10918
11131
  };
10919
- const AegisWebPush2 = typeof window !== "undefined" && window.AegisWebPush || (await import("./push/AegisWebPush.js")).AegisWebPush;
10920
- const webPush = new AegisWebPush2(apiClient, {
11132
+ const AegisWebPush = typeof window !== "undefined" && window.AegisWebPush || (await import("./push/AegisWebPush.js")).AegisWebPush;
11133
+ const webPush = new AegisWebPush(apiClient, {
10921
11134
  vapidPublicKey,
10922
11135
  propertyId: this.propertyId,
10923
11136
  // Anon id doubles as the device-fingerprint salt so a re-subscribe
@@ -13025,6 +13238,11 @@ const _AegisInAppManager = class _AegisInAppManager {
13025
13238
  // journey/template/outlet on the engagement delivery_event.
13026
13239
  journey_execution_id: trackedCampaign == null ? void 0 : trackedCampaign.journey_execution_id,
13027
13240
  lifecycle_fork_id: trackedCampaign == null ? void 0 : trackedCampaign.lifecycle_fork_id,
13241
+ // Media Gen-2 P0b M1 (1.46.0) — the library asset the payload carried.
13242
+ // The gateway lifts it onto the canonical event and the switchboard
13243
+ // copies it into delivery_events.metadata.asset_id, where the cell's
13244
+ // asset perf writer counts `shown` rows by it. Absent when unknown.
13245
+ asset_id: assetIdOf(trackedCampaign == null ? void 0 : trackedCampaign.asset_id),
13028
13246
  // Outlet the customer is ACTIVELY viewing (setLocation) wins — that's
13029
13247
  // where the impression/click actually happened; fall back to the served
13030
13248
  // campaign's outlet, else brand-tier. The gateway promotes this to the
@@ -13134,6 +13352,10 @@ const _AegisInAppManager = class _AegisInAppManager {
13134
13352
  this.slotObserver.disconnect();
13135
13353
  this.slotObserver = null;
13136
13354
  }
13355
+ if (this.phoneVariantMedia) {
13356
+ this.phoneVariantMedia.removeEventListener("change", this.onPhoneVariantChange);
13357
+ this.phoneVariantMedia = null;
13358
+ }
13137
13359
  this.slotRenderScheduled = false;
13138
13360
  this.slotsTornDown = true;
13139
13361
  this.lifecycleGen += 1;
@@ -15795,7 +16017,7 @@ const _AegisMessageRuntime = class _AegisMessageRuntime {
15795
16017
  this.initialized = false;
15796
16018
  this.armedInAppTriggers = /* @__PURE__ */ new Set();
15797
16019
  {
15798
- const v = "1.45.2";
16020
+ const v = "1.46.0";
15799
16021
  try {
15800
16022
  globalThis.__AEGIS_SDK_VERSION__ = v;
15801
16023
  } catch {
@@ -16267,7 +16489,7 @@ export {
16267
16489
  AegisInbox,
16268
16490
  AegisLoyaltyManager,
16269
16491
  AegisMessageRuntime,
16270
- AegisWebPush,
16492
+ A as AegisWebPush,
16271
16493
  B as BloomFilter,
16272
16494
  BootstrapError,
16273
16495
  E as EcommerceTracker,