@active-reach/web-sdk 1.45.1 → 1.45.3
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/README.md +2 -0
- package/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/{analytics-CfEHNTzy.mjs → analytics-C-Go3Pm5.mjs} +1 -1
- package/dist/{analytics-CfEHNTzy.mjs.map → analytics-C-Go3Pm5.mjs.map} +1 -1
- package/dist/inapp/AegisInAppManager.d.ts +9 -1
- package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
- package/dist/inapp/image-srcset.d.ts +37 -0
- package/dist/inapp/image-srcset.d.ts.map +1 -0
- package/dist/inapp/renderers/card-template.d.ts +23 -0
- package/dist/inapp/renderers/card-template.d.ts.map +1 -1
- package/dist/inapp/renderers/hero.d.ts.map +1 -1
- package/dist/inapp/renderers/types.d.ts +4 -0
- package/dist/inapp/renderers/types.d.ts.map +1 -1
- package/dist/inapp/slot-shells.d.ts +55 -0
- package/dist/inapp/slot-shells.d.ts.map +1 -1
- package/dist/index.js +188 -10
- package/dist/index.js.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Storage, r as redactUrl, l as logger, A as Aegis } from "./analytics-
|
|
2
|
-
import { B, E, N, R, U, m } from "./analytics-
|
|
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
3
|
import { AegisWebPush } from "./push/AegisWebPush.js";
|
|
4
4
|
function debounce(func, wait) {
|
|
5
5
|
let timeoutId = null;
|
|
@@ -576,6 +576,36 @@ function applyCampaignFonts(campaigns, read = readRootVar) {
|
|
|
576
576
|
applyRootFonts(brand, read);
|
|
577
577
|
registerCampaignFonts(campaigns, read);
|
|
578
578
|
}
|
|
579
|
+
const HERO_IMAGE_SIZES = "100vw";
|
|
580
|
+
function cardImageSizes(kind, widthPx) {
|
|
581
|
+
if (typeof widthPx === "number" && widthPx > 0 && Number.isFinite(widthPx)) return `${Math.round(widthPx)}px`;
|
|
582
|
+
if (kind === "full") return "(max-width:767px) 100vw, 720px";
|
|
583
|
+
if (kind === "grid") return "(max-width:767px) 50vw, 360px";
|
|
584
|
+
return "(max-width:767px) 150px, 220px";
|
|
585
|
+
}
|
|
586
|
+
const SIZES = /^[a-z0-9\s(),:.%-]{1,200}$/i;
|
|
587
|
+
function safeSizes(v) {
|
|
588
|
+
return typeof v === "string" && SIZES.test(v) ? v : null;
|
|
589
|
+
}
|
|
590
|
+
const CANDIDATE = /^https?:\/\/\S+ [1-9]\d{0,4}w$/;
|
|
591
|
+
const MAX_CANDIDATES = 8;
|
|
592
|
+
function safeSrcset(v) {
|
|
593
|
+
if (typeof v !== "string" || !v || v.length > 4e3) return null;
|
|
594
|
+
const parts = v.split(", ");
|
|
595
|
+
if (parts.length > MAX_CANDIDATES) return null;
|
|
596
|
+
return parts.every((p) => CANDIDATE.test(p)) ? v : null;
|
|
597
|
+
}
|
|
598
|
+
function srcsetFor(campaign, ...urls) {
|
|
599
|
+
const map = campaign == null ? void 0 : campaign.image_srcsets;
|
|
600
|
+
if (!map || typeof map !== "object") return null;
|
|
601
|
+
for (const u of urls) {
|
|
602
|
+
if (u && Object.prototype.hasOwnProperty.call(map, u)) {
|
|
603
|
+
const s = safeSrcset(map[u]);
|
|
604
|
+
if (s) return s;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
579
609
|
function npsBandFromScore(score) {
|
|
580
610
|
if (score <= 6) return "detractor";
|
|
581
611
|
if (score <= 8) return "passive";
|
|
@@ -654,7 +684,10 @@ const WEIGHT = {
|
|
|
654
684
|
};
|
|
655
685
|
const ICON_PX = { sm: 22, md: 30, lg: 40 };
|
|
656
686
|
const TEXT_PX = { sm: 11.5, md: 13, lg: 15 };
|
|
657
|
-
const
|
|
687
|
+
const RAIL_TILE_WIDTH = "clamp(150px, 15vw, 220px)";
|
|
688
|
+
const RAIL_TILE_FLEX = `flex:0 0 ${RAIL_TILE_WIDTH}; scroll-snap-align:start;`;
|
|
689
|
+
const SHELL_ROW_KINDS = ["price", "price_plain", "title", "subtitle", "rating", "category", "cta"];
|
|
690
|
+
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;}`;
|
|
658
691
|
function resolveCardFont(ff) {
|
|
659
692
|
return `${campaignFontVarsCss(ff)}${fontFamilyCss("body")}`;
|
|
660
693
|
}
|
|
@@ -1769,6 +1802,10 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1769
1802
|
const dir = fLayout === "row" ? "row" : "column";
|
|
1770
1803
|
const tileGap = frame.gap != null ? frame.gap : 6;
|
|
1771
1804
|
const sizing = fLayout ? frame.width != null ? `width:${typeof frame.width === "number" ? `${frame.width}px` : frame.width};` : "flex:1 1 auto; width:100%;" : layout === "grid" || layout === "list" ? "" : RAIL_TILE_FLEX;
|
|
1805
|
+
const imageSizes = cardImageSizes(
|
|
1806
|
+
fLayout ? frame.width != null ? "rail" : "full" : layout === "list" ? "full" : layout === "grid" ? "grid" : "rail",
|
|
1807
|
+
typeof frame.width === "number" ? frame.width : null
|
|
1808
|
+
);
|
|
1772
1809
|
tile.style.cssText = `
|
|
1773
1810
|
box-sizing:border-box; display:flex; flex-direction:${dir}; ${fLayout === "row" ? "align-items:center;" : ""} gap:${tileGap}px; position:relative;
|
|
1774
1811
|
color:${fg};
|
|
@@ -1814,6 +1851,11 @@ function renderCardFromTemplate(card, opts) {
|
|
|
1814
1851
|
img.setAttribute("decoding", "async");
|
|
1815
1852
|
img.setAttribute("width", String(size.width));
|
|
1816
1853
|
img.setAttribute("height", String(size.height));
|
|
1854
|
+
const set = srcsetFor(campaign, card.image_url, safe);
|
|
1855
|
+
if (set) {
|
|
1856
|
+
img.setAttribute("sizes", imageSizes);
|
|
1857
|
+
img.setAttribute("srcset", set);
|
|
1858
|
+
}
|
|
1817
1859
|
img.src = safe;
|
|
1818
1860
|
img.alt = "";
|
|
1819
1861
|
img.style.cssText = "width:100%;height:100%;object-fit:cover;display:block;";
|
|
@@ -4267,6 +4309,16 @@ function _injectHeroResponsiveCss() {
|
|
|
4267
4309
|
function srcsetUrl$1(url) {
|
|
4268
4310
|
return url.replace(/\s/g, "%20").replace(/,/g, "%2C");
|
|
4269
4311
|
}
|
|
4312
|
+
function sameUrl(a, b) {
|
|
4313
|
+
try {
|
|
4314
|
+
return new URL(a).href === new URL(b).href;
|
|
4315
|
+
} catch {
|
|
4316
|
+
return a === b;
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
function adoptableShell(shell, src) {
|
|
4320
|
+
return shell && sameUrl(shell.src, src) ? shell : null;
|
|
4321
|
+
}
|
|
4270
4322
|
function cardHeadline(c) {
|
|
4271
4323
|
return c.headline ?? c.title ?? "";
|
|
4272
4324
|
}
|
|
@@ -4350,10 +4402,14 @@ function renderHeroInline(ctx, target) {
|
|
|
4350
4402
|
} else {
|
|
4351
4403
|
const picture = document.createElement("picture");
|
|
4352
4404
|
const phoneUrl = c.image_url_mobile ? sanitizeUrl(c.image_url_mobile) : null;
|
|
4405
|
+
const shell = i === 0 ? adoptableShell(ctx.shellImage, mediaUrl) : null;
|
|
4353
4406
|
if (phoneUrl) {
|
|
4354
4407
|
const source = document.createElement("source");
|
|
4355
4408
|
source.setAttribute("media", `(max-width:${HERO_PHONE_MAX_WIDTH_PX}px)`);
|
|
4356
|
-
|
|
4409
|
+
const payloadPhoneSet = srcsetFor(campaign, c.image_url_mobile, phoneUrl);
|
|
4410
|
+
const phoneSet = payloadPhoneSet ?? (shell == null ? void 0 : shell.phoneSrcset) ?? null;
|
|
4411
|
+
source.setAttribute("srcset", phoneSet ?? srcsetUrl$1(phoneUrl));
|
|
4412
|
+
if (phoneSet) source.setAttribute("sizes", payloadPhoneSet ? HERO_IMAGE_SIZES : (shell == null ? void 0 : shell.phoneSizes) ?? HERO_IMAGE_SIZES);
|
|
4357
4413
|
if (phoneSize) {
|
|
4358
4414
|
source.setAttribute("width", String(phoneSize.width));
|
|
4359
4415
|
source.setAttribute("height", String(phoneSize.height));
|
|
@@ -4369,6 +4425,12 @@ function renderHeroInline(ctx, target) {
|
|
|
4369
4425
|
}
|
|
4370
4426
|
img.setAttribute("width", String(HERO_DESKTOP_SIZE.width));
|
|
4371
4427
|
img.setAttribute("height", String(HERO_DESKTOP_SIZE.height));
|
|
4428
|
+
const payloadSet = srcsetFor(campaign, c.image_url || c.media_url || c.image_url_mobile, mediaUrl);
|
|
4429
|
+
const set = payloadSet ?? (shell == null ? void 0 : shell.srcset) ?? null;
|
|
4430
|
+
if (set) {
|
|
4431
|
+
img.setAttribute("sizes", payloadSet ? HERO_IMAGE_SIZES : (shell == null ? void 0 : shell.sizes) ?? HERO_IMAGE_SIZES);
|
|
4432
|
+
img.setAttribute("srcset", set);
|
|
4433
|
+
}
|
|
4372
4434
|
img.src = mediaUrl;
|
|
4373
4435
|
img.alt = "";
|
|
4374
4436
|
img.setAttribute("decoding", "async");
|
|
@@ -6670,6 +6732,13 @@ const PHONE_MAX_WIDTH_PX = 767;
|
|
|
6670
6732
|
const STYLE_ID = "aegis-slot-shell-style";
|
|
6671
6733
|
const SHELL_SELECTOR = ":scope > [data-aegis-slot-shell]";
|
|
6672
6734
|
const LAYOUTS = /* @__PURE__ */ new Set(["hero", "rail", "grid", "bar", "card"]);
|
|
6735
|
+
const SHELL_MAX_TILES = 6;
|
|
6736
|
+
const SHELL_MAX_COLUMNS = 4;
|
|
6737
|
+
const SHELL_MAX_ROWS = 6;
|
|
6738
|
+
const SHELL_MAX_LINES = 4;
|
|
6739
|
+
const FRAMES = /* @__PURE__ */ new Set(["panel", "plain"]);
|
|
6740
|
+
const ROW_KINDS = new Set(SHELL_ROW_KINDS);
|
|
6741
|
+
const DEFAULT_ROWS = [{ kind: "price", lines: 1 }, { kind: "title", lines: 2 }];
|
|
6673
6742
|
function storageKey(ctx) {
|
|
6674
6743
|
return `${STORAGE_PREFIX}${ctx.propertyId || "-"}:${ctx.surface || "-"}:${ctx.screen || "-"}:${ctx.locationId || "-"}`;
|
|
6675
6744
|
}
|
|
@@ -6742,7 +6811,8 @@ function injectShellCss(doc) {
|
|
|
6742
6811
|
if (doc.getElementById(STYLE_ID)) return;
|
|
6743
6812
|
const style = doc.createElement("style");
|
|
6744
6813
|
style.id = STYLE_ID;
|
|
6745
|
-
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;}}
|
|
6814
|
+
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.
|
|
6815
|
+
RAIL_SHELL_CSS;
|
|
6746
6816
|
(doc.head || doc.documentElement).appendChild(style);
|
|
6747
6817
|
}
|
|
6748
6818
|
function srcsetUrl(url) {
|
|
@@ -6759,6 +6829,77 @@ function safeHttpUrl(v) {
|
|
|
6759
6829
|
return null;
|
|
6760
6830
|
}
|
|
6761
6831
|
}
|
|
6832
|
+
function clampInt(v, lo, hi) {
|
|
6833
|
+
if (typeof v !== "number" || !Number.isFinite(v)) return null;
|
|
6834
|
+
return Math.min(hi, Math.max(lo, Math.round(v)));
|
|
6835
|
+
}
|
|
6836
|
+
function shellDrawsRows(shape) {
|
|
6837
|
+
return (shape.layout === "rail" || shape.layout === "grid") && Array.isArray(shape.card_rows);
|
|
6838
|
+
}
|
|
6839
|
+
function shellFrame(shape) {
|
|
6840
|
+
const f = shape.frame;
|
|
6841
|
+
return typeof f === "string" && FRAMES.has(f) ? f : null;
|
|
6842
|
+
}
|
|
6843
|
+
function shellRows(shape) {
|
|
6844
|
+
const raw = shape.card_rows;
|
|
6845
|
+
if (!Array.isArray(raw)) return DEFAULT_ROWS;
|
|
6846
|
+
const out = [];
|
|
6847
|
+
for (const r of raw) {
|
|
6848
|
+
if (out.length >= SHELL_MAX_ROWS) break;
|
|
6849
|
+
const kind = r && typeof r === "object" ? r.kind : null;
|
|
6850
|
+
if (typeof kind !== "string" || !ROW_KINDS.has(kind)) continue;
|
|
6851
|
+
const multi = kind === "title" || kind === "subtitle";
|
|
6852
|
+
const lines = multi ? clampInt(r.lines, 1, SHELL_MAX_LINES) ?? 1 : 1;
|
|
6853
|
+
out.push({ kind, lines });
|
|
6854
|
+
}
|
|
6855
|
+
return out;
|
|
6856
|
+
}
|
|
6857
|
+
function shellTileCount(shape) {
|
|
6858
|
+
if (shape.layout !== "rail" && shape.layout !== "grid") return 0;
|
|
6859
|
+
return clampInt(shape.card_count, 1, SHELL_MAX_TILES) ?? 0;
|
|
6860
|
+
}
|
|
6861
|
+
function hasText(v) {
|
|
6862
|
+
return typeof v === "string" && v.trim().length > 0;
|
|
6863
|
+
}
|
|
6864
|
+
function shellHasTitle(shape) {
|
|
6865
|
+
return typeof shape.has_title === "boolean" ? shape.has_title : hasText(shape.title);
|
|
6866
|
+
}
|
|
6867
|
+
function appendTiles(doc, el2, shape) {
|
|
6868
|
+
const tiles = shellTileCount(shape);
|
|
6869
|
+
if (tiles === 0) return;
|
|
6870
|
+
const frame = shellFrame(shape);
|
|
6871
|
+
if (frame) {
|
|
6872
|
+
el2.setAttribute("data-aegis-shell-frame", frame);
|
|
6873
|
+
if (shellHasTitle(shape)) {
|
|
6874
|
+
const t = doc.createElement("div");
|
|
6875
|
+
t.setAttribute("data-aegis-shell-title", "");
|
|
6876
|
+
el2.appendChild(t);
|
|
6877
|
+
}
|
|
6878
|
+
if (frame === "plain" && shape.has_body === true) {
|
|
6879
|
+
const b = doc.createElement("div");
|
|
6880
|
+
b.setAttribute("data-aegis-shell-body", "");
|
|
6881
|
+
el2.appendChild(b);
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6884
|
+
const rows = shellRows(shape);
|
|
6885
|
+
const strip = doc.createElement("div");
|
|
6886
|
+
strip.setAttribute("data-aegis-shell-tiles", "");
|
|
6887
|
+
for (let i = 0; i < tiles; i += 1) {
|
|
6888
|
+
const tile = doc.createElement("div");
|
|
6889
|
+
tile.setAttribute("data-aegis-shell-tile", "");
|
|
6890
|
+
const img = doc.createElement("div");
|
|
6891
|
+
img.setAttribute("data-aegis-shell-img", "");
|
|
6892
|
+
tile.appendChild(img);
|
|
6893
|
+
for (const r of rows) {
|
|
6894
|
+
const row = doc.createElement("div");
|
|
6895
|
+
row.setAttribute("data-aegis-shell-row", r.kind);
|
|
6896
|
+
if (r.lines > 1) row.setAttribute("data-aegis-shell-lines", String(r.lines));
|
|
6897
|
+
tile.appendChild(row);
|
|
6898
|
+
}
|
|
6899
|
+
strip.appendChild(tile);
|
|
6900
|
+
}
|
|
6901
|
+
el2.appendChild(strip);
|
|
6902
|
+
}
|
|
6762
6903
|
function buildShell(doc, shape) {
|
|
6763
6904
|
const el2 = doc.createElement("div");
|
|
6764
6905
|
el2.setAttribute("data-aegis-slot-shell", shape.layout);
|
|
@@ -6770,7 +6911,7 @@ function buildShell(doc, shape) {
|
|
|
6770
6911
|
const phone = cssAspect(shape.aspect_phone ?? null);
|
|
6771
6912
|
el2.style.setProperty("--aegis-shell-ar-phone", phone ?? "auto");
|
|
6772
6913
|
if (!phone) el2.style.setProperty("--aegis-shell-min-h-phone", cssLength(shape.min_height ?? null) ?? "300px");
|
|
6773
|
-
} else {
|
|
6914
|
+
} else if (!shellDrawsRows(shape)) {
|
|
6774
6915
|
const minH = cssLength(shape.min_height ?? null);
|
|
6775
6916
|
if (minH) el2.style.setProperty("--aegis-shell-min-h", minH);
|
|
6776
6917
|
}
|
|
@@ -6778,6 +6919,13 @@ function buildShell(doc, shape) {
|
|
|
6778
6919
|
if (maxH) {
|
|
6779
6920
|
el2.style.setProperty(shape.layout === "hero" ? "--aegis-shell-max-h-desktop" : "--aegis-shell-max-h", maxH);
|
|
6780
6921
|
}
|
|
6922
|
+
if (shape.layout === "rail" || shape.layout === "grid") {
|
|
6923
|
+
const cardAr = cssAspect(shape.card_aspect ?? null);
|
|
6924
|
+
if (cardAr) el2.style.setProperty("--aegis-shell-card-ar", cardAr);
|
|
6925
|
+
const cols = shape.layout === "grid" ? clampInt(shape.columns, 1, SHELL_MAX_COLUMNS) : null;
|
|
6926
|
+
if (cols) el2.style.setProperty("--aegis-shell-cols", String(cols));
|
|
6927
|
+
appendTiles(doc, el2, shape);
|
|
6928
|
+
}
|
|
6781
6929
|
const img = shape.layout === "hero" ? shape.image : null;
|
|
6782
6930
|
const src = img ? safeHttpUrl(img.src) : null;
|
|
6783
6931
|
if (img && src) {
|
|
@@ -6786,7 +6934,9 @@ function buildShell(doc, shape) {
|
|
|
6786
6934
|
if (phoneSrc) {
|
|
6787
6935
|
const source = doc.createElement("source");
|
|
6788
6936
|
source.setAttribute("media", `(max-width:${PHONE_MAX_WIDTH_PX}px)`);
|
|
6789
|
-
|
|
6937
|
+
const phoneSet = safeSrcset(img.srcset_phone);
|
|
6938
|
+
source.setAttribute("srcset", phoneSet ?? srcsetUrl(phoneSrc));
|
|
6939
|
+
if (phoneSet) source.setAttribute("sizes", HERO_IMAGE_SIZES);
|
|
6790
6940
|
picture.appendChild(source);
|
|
6791
6941
|
}
|
|
6792
6942
|
const im = doc.createElement("img");
|
|
@@ -6797,6 +6947,11 @@ function buildShell(doc, shape) {
|
|
|
6797
6947
|
im.setAttribute("width", String(img.width));
|
|
6798
6948
|
im.setAttribute("height", String(img.height));
|
|
6799
6949
|
}
|
|
6950
|
+
const set = safeSrcset(img.srcset);
|
|
6951
|
+
if (set) {
|
|
6952
|
+
im.setAttribute("sizes", HERO_IMAGE_SIZES);
|
|
6953
|
+
im.setAttribute("srcset", set);
|
|
6954
|
+
}
|
|
6800
6955
|
im.src = src;
|
|
6801
6956
|
picture.appendChild(im);
|
|
6802
6957
|
el2.appendChild(picture);
|
|
@@ -6804,6 +6959,23 @@ function buildShell(doc, shape) {
|
|
|
6804
6959
|
}
|
|
6805
6960
|
return el2;
|
|
6806
6961
|
}
|
|
6962
|
+
function readShellHeroImage(slot) {
|
|
6963
|
+
const shell = slot.querySelector(SHELL_SELECTOR);
|
|
6964
|
+
const img = shell == null ? void 0 : shell.querySelector("picture img");
|
|
6965
|
+
const src = img == null ? void 0 : img.getAttribute("src");
|
|
6966
|
+
if (!img || !src) return null;
|
|
6967
|
+
const srcset = safeSrcset(img.getAttribute("srcset"));
|
|
6968
|
+
const source = shell == null ? void 0 : shell.querySelector("picture source");
|
|
6969
|
+
const phoneSrcset = source ? safeSrcset(source.getAttribute("srcset")) : null;
|
|
6970
|
+
if (!srcset && !phoneSrcset) return null;
|
|
6971
|
+
return {
|
|
6972
|
+
src,
|
|
6973
|
+
srcset,
|
|
6974
|
+
sizes: safeSizes(img.getAttribute("sizes")) ?? HERO_IMAGE_SIZES,
|
|
6975
|
+
phoneSrcset,
|
|
6976
|
+
phoneSizes: (source && safeSizes(source.getAttribute("sizes"))) ?? HERO_IMAGE_SIZES
|
|
6977
|
+
};
|
|
6978
|
+
}
|
|
6807
6979
|
function removeSlotShell(slot) {
|
|
6808
6980
|
slot.querySelectorAll(SHELL_SELECTOR).forEach((n) => n.remove());
|
|
6809
6981
|
}
|
|
@@ -7037,6 +7209,7 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7037
7209
|
this._lastDispatch = null;
|
|
7038
7210
|
this.filledSlots = /* @__PURE__ */ new WeakSet();
|
|
7039
7211
|
this.slotSignatures = /* @__PURE__ */ new WeakMap();
|
|
7212
|
+
this.shellHeroImages = /* @__PURE__ */ new WeakMap();
|
|
7040
7213
|
this.slotTimers = /* @__PURE__ */ new WeakMap();
|
|
7041
7214
|
this.renderedSlots = /* @__PURE__ */ new Set();
|
|
7042
7215
|
this.slotObserver = null;
|
|
@@ -7969,6 +8142,8 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
7969
8142
|
this.slotSignatures.set(slot, sig);
|
|
7970
8143
|
this.renderedSlots.add(slot);
|
|
7971
8144
|
slot.querySelectorAll(":scope > [data-aegis-slot-default]").forEach((d) => d.remove());
|
|
8145
|
+
const shellImg = readShellHeroImage(slot);
|
|
8146
|
+
if (shellImg) this.shellHeroImages.set(slot, shellImg);
|
|
7972
8147
|
removeSlotShell(slot);
|
|
7973
8148
|
const flush = slot.hasAttribute("data-aegis-slot-flush");
|
|
7974
8149
|
if (rotating) {
|
|
@@ -8207,7 +8382,7 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
8207
8382
|
/**
|
|
8208
8383
|
* U7 — render server-injected token-bound campaigns.
|
|
8209
8384
|
*
|
|
8210
|
-
* The standalone-page route at `apps/cashier-portal/src/app/s/[slug]/
|
|
8385
|
+
* The standalone-page route at `apps/cashier-portal/src/app/(store)/s/[slug]/
|
|
8211
8386
|
* [workspace]/[page_key]/page.tsx` (and the `/c/[token]` Aegis-hosted
|
|
8212
8387
|
* fallback) verify the URL token server-side via the F16 internal
|
|
8213
8388
|
* endpoint, then embed the resolved campaign payload as JSON inside
|
|
@@ -8308,7 +8483,10 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
8308
8483
|
if (this._hasComposedTemplate(ic) && !_isMultiCard) {
|
|
8309
8484
|
rendered = this.renderComposedCardSlot(campaign, ic, target);
|
|
8310
8485
|
} else if (campaign.widget_category === "hero") {
|
|
8311
|
-
|
|
8486
|
+
const heroCtx = this.buildRenderContext(campaign);
|
|
8487
|
+
const heroSlot = target.closest("[data-aegis-slot]");
|
|
8488
|
+
heroCtx.shellImage = heroSlot ? this.shellHeroImages.get(heroSlot) ?? null : null;
|
|
8489
|
+
rendered = renderHeroInline(heroCtx, target);
|
|
8312
8490
|
} else
|
|
8313
8491
|
switch (campaign.sub_type) {
|
|
8314
8492
|
// P6.full — star_rating / nps_survey / quick_poll slots route through the
|
|
@@ -15706,7 +15884,7 @@ const _AegisMessageRuntime = class _AegisMessageRuntime {
|
|
|
15706
15884
|
this.initialized = false;
|
|
15707
15885
|
this.armedInAppTriggers = /* @__PURE__ */ new Set();
|
|
15708
15886
|
{
|
|
15709
|
-
const v = "1.45.
|
|
15887
|
+
const v = "1.45.3";
|
|
15710
15888
|
try {
|
|
15711
15889
|
globalThis.__AEGIS_SDK_VERSION__ = v;
|
|
15712
15890
|
} catch {
|