@active-reach/web-sdk 1.50.0 → 1.52.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/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/inapp/AegisInAppManager.d.ts +16 -0
- package/dist/inapp/AegisInAppManager.d.ts.map +1 -1
- package/dist/inapp/anon-claim.d.ts.map +1 -1
- package/dist/inapp/brand-accent.d.ts +34 -0
- package/dist/inapp/brand-accent.d.ts.map +1 -0
- package/dist/inapp/index.d.ts +3 -0
- package/dist/inapp/index.d.ts.map +1 -1
- package/dist/inapp/renderers/card-template.d.ts.map +1 -1
- package/dist/inapp/renderers/carousel-cards.d.ts.map +1 -1
- package/dist/inapp/renderers/hero.d.ts +48 -0
- package/dist/inapp/renderers/hero.d.ts.map +1 -1
- package/dist/inapp/renderers/overlay-layout.d.ts +41 -0
- package/dist/inapp/renderers/overlay-layout.d.ts.map +1 -0
- package/dist/inapp/renderers/product-rail-section.d.ts +86 -0
- package/dist/inapp/renderers/product-rail-section.d.ts.map +1 -0
- package/dist/inapp/renderers/product-recommendation.d.ts.map +1 -1
- package/dist/inapp/renderers/progress-bar.d.ts.map +1 -1
- package/dist/inapp/renderers/reviews.d.ts.map +1 -1
- package/dist/inapp/renderers/sticky-bar.d.ts.map +1 -1
- package/dist/inapp/slot-kind.d.ts +28 -0
- package/dist/inapp/slot-kind.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +661 -411
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -148,6 +148,254 @@ function prizeStateOf(resp, retryMessage) {
|
|
|
148
148
|
if (outcome === "credited_win") return { state: "credited_win" };
|
|
149
149
|
return prize.win === false ? { state: "loss" } : { state: "credited_win" };
|
|
150
150
|
}
|
|
151
|
+
const BOTTOM_RESERVE_VAR = "--aegis-bottom-reserve";
|
|
152
|
+
const DESKTOP_MIN_WIDTH_PX = 768;
|
|
153
|
+
function bottomOffset(px) {
|
|
154
|
+
return `calc(var(${BOTTOM_RESERVE_VAR}, 0px) + ${px}px)`;
|
|
155
|
+
}
|
|
156
|
+
const SHEET_STYLE_ID = "aegis-overlay-layout-style";
|
|
157
|
+
function injectOverlayLayoutCss() {
|
|
158
|
+
if (typeof document === "undefined" || !document.head) return;
|
|
159
|
+
if (document.getElementById(SHEET_STYLE_ID)) return;
|
|
160
|
+
const style = document.createElement("style");
|
|
161
|
+
style.id = SHEET_STYLE_ID;
|
|
162
|
+
style.textContent = `@media (min-width:${DESKTOP_MIN_WIDTH_PX}px){.aegis-sheet-overlay{align-items:center !important;padding:24px !important;}.aegis-sheet{border-radius:20px !important;max-height:80vh !important;}.aegis-sheet-grabber{display:none !important;}.aegis-bottom-panel{top:0 !important;bottom:0 !important;display:flex !important;align-items:center !important;justify-content:center !important;padding:24px !important;background:rgba(17,24,39,0.45) !important;}.aegis-bottom-panel > *{width:100%;}}`;
|
|
163
|
+
document.head.appendChild(style);
|
|
164
|
+
}
|
|
165
|
+
function overlayAnchor(c) {
|
|
166
|
+
const ic = c.interactive_config || {};
|
|
167
|
+
switch (c.type) {
|
|
168
|
+
case "sticky_bar":
|
|
169
|
+
return ic.sticky_position === "top" ? "top" : "bottom";
|
|
170
|
+
case "progress_bar":
|
|
171
|
+
case "carousel_cards":
|
|
172
|
+
return "bottom";
|
|
173
|
+
case "banner":
|
|
174
|
+
return ic.banner_position === "bottom" ? "bottom" : "top";
|
|
175
|
+
case "pip": {
|
|
176
|
+
const pos = typeof ic.pip_position === "string" ? ic.pip_position : "bottom-right";
|
|
177
|
+
return pos.startsWith("top") ? "top" : "bottom";
|
|
178
|
+
}
|
|
179
|
+
default:
|
|
180
|
+
return "center";
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const keywords = ["inherit", "system", "serif", "mono"];
|
|
184
|
+
const system_stacks = { "system": "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", "serif": "Georgia, 'Times New Roman', serif", "mono": "ui-monospace, 'SF Mono', Menlo, monospace" };
|
|
185
|
+
const aliases = { "system-ui": "system", "-apple-system": "system", "georgia": "serif", "times new roman": "serif", "sf mono": "mono", "ui-monospace": "mono", "menlo": "mono", "monospace": "mono" };
|
|
186
|
+
const role_weights = { "body": [400, 500], "display": [600, 700] };
|
|
187
|
+
const google = [{ "name": "Urbanist", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "99.04%", "ascent_override": "95.93%", "descent_override": "25.24%", "line_gap_override": "0.00%" } }, { "name": "Inter", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "107.12%", "ascent_override": "90.44%", "descent_override": "22.52%", "line_gap_override": "0.00%" } }, { "name": "Poppins", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "112.16%", "ascent_override": "93.62%", "descent_override": "31.21%", "line_gap_override": "8.92%" } }, { "name": "DM Sans", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "104.53%", "ascent_override": "94.90%", "descent_override": "29.66%", "line_gap_override": "0.00%" } }, { "name": "Nunito", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "101.39%", "ascent_override": "99.71%", "descent_override": "34.82%", "line_gap_override": "0.00%" } }, { "name": "Montserrat", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "112.83%", "ascent_override": "85.79%", "descent_override": "22.25%", "line_gap_override": "0.00%" } }, { "name": "Roboto", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "99.78%", "ascent_override": "92.98%", "descent_override": "24.47%", "line_gap_override": "0.00%" } }, { "name": "Outfit", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "99.82%", "ascent_override": "100.18%", "descent_override": "26.05%", "line_gap_override": "0.00%" } }, { "name": "Playfair Display", "category": "serif", "fallback": { "local": "Times New Roman", "size_adjust": "111.26%", "ascent_override": "97.25%", "descent_override": "22.56%", "line_gap_override": "0.00%" } }, { "name": "Lora", "category": "serif", "fallback": { "local": "Times New Roman", "size_adjust": "115.20%", "ascent_override": "87.33%", "descent_override": "23.78%", "line_gap_override": "0.00%" } }];
|
|
188
|
+
const FONT_ALLOWLIST = {
|
|
189
|
+
keywords,
|
|
190
|
+
system_stacks,
|
|
191
|
+
aliases,
|
|
192
|
+
role_weights,
|
|
193
|
+
google
|
|
194
|
+
};
|
|
195
|
+
const BODY_FONT_STACK = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
|
|
196
|
+
const SERIF_STACK = "Georgia, 'Times New Roman', serif";
|
|
197
|
+
const AEGIS_BODY_FONT_VAR = "--aegis-font-body";
|
|
198
|
+
const AEGIS_DISPLAY_FONT_VAR = "--aegis-font-display";
|
|
199
|
+
const ACS_DISPLAY_FONT_VAR = "--acs-font-display";
|
|
200
|
+
const ACS_BODY_FONT_VAR = "--acs-font-body";
|
|
201
|
+
const GOOGLE_FONTS = FONT_ALLOWLIST.google;
|
|
202
|
+
const KEYWORDS = FONT_ALLOWLIST.keywords;
|
|
203
|
+
const SYSTEM_STACKS = FONT_ALLOWLIST.system_stacks;
|
|
204
|
+
const ALIASES = FONT_ALLOWLIST.aliases;
|
|
205
|
+
const ROLE_WEIGHTS = FONT_ALLOWLIST.role_weights;
|
|
206
|
+
function fontFamilyCss(role) {
|
|
207
|
+
return `font-family:var(${role === "display" ? AEGIS_DISPLAY_FONT_VAR : AEGIS_BODY_FONT_VAR});`;
|
|
208
|
+
}
|
|
209
|
+
function findGoogleFont(value) {
|
|
210
|
+
const v = value.trim().toLowerCase();
|
|
211
|
+
return GOOGLE_FONTS.find((f) => f.name.toLowerCase() === v);
|
|
212
|
+
}
|
|
213
|
+
function normalizeFontValue(value) {
|
|
214
|
+
var _a;
|
|
215
|
+
if (typeof value !== "string") return null;
|
|
216
|
+
const first = value.split(",")[0].trim().replace(/^['"]|['"]$/g, "").trim();
|
|
217
|
+
if (!first) return null;
|
|
218
|
+
const v = first.toLowerCase();
|
|
219
|
+
if (KEYWORDS.includes(v)) return v;
|
|
220
|
+
if (ALIASES[v]) return ALIASES[v];
|
|
221
|
+
return ((_a = findGoogleFont(first)) == null ? void 0 : _a.name) ?? null;
|
|
222
|
+
}
|
|
223
|
+
function fallbackFamily(f) {
|
|
224
|
+
return `${f.name} Aegis Fallback`;
|
|
225
|
+
}
|
|
226
|
+
function fontValueToCss(value, host = "third_party") {
|
|
227
|
+
const canonical = normalizeFontValue(value);
|
|
228
|
+
if (!canonical) return null;
|
|
229
|
+
if (canonical === "inherit") return { css: "initial" };
|
|
230
|
+
if (SYSTEM_STACKS[canonical]) return { css: SYSTEM_STACKS[canonical] };
|
|
231
|
+
const f = findGoogleFont(canonical);
|
|
232
|
+
if (!f) return null;
|
|
233
|
+
const stack = f.category === "serif" ? SERIF_STACK : BODY_FONT_STACK;
|
|
234
|
+
if (host === "acs") return { css: `var(${acsFaceVar(f)}), ${stack}` };
|
|
235
|
+
return { css: `'${f.name}', '${fallbackFamily(f)}', ${stack}`, font: f };
|
|
236
|
+
}
|
|
237
|
+
function acsFaceVar(f) {
|
|
238
|
+
return `--acs-face-${f.name.toLowerCase().replace(/ /g, "-")}`;
|
|
239
|
+
}
|
|
240
|
+
function readRootVar(name) {
|
|
241
|
+
if (typeof document === "undefined" || typeof getComputedStyle !== "function") return "";
|
|
242
|
+
try {
|
|
243
|
+
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
244
|
+
} catch {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function detectFontHost(read2 = readRootVar) {
|
|
249
|
+
return read2(ACS_BODY_FONT_VAR) ? "acs" : "third_party";
|
|
250
|
+
}
|
|
251
|
+
function resolveRootFonts(brand, read2 = readRootVar) {
|
|
252
|
+
const host = detectFontHost(read2);
|
|
253
|
+
if (host === "acs") {
|
|
254
|
+
return {
|
|
255
|
+
host,
|
|
256
|
+
body: `var(${ACS_BODY_FONT_VAR})`,
|
|
257
|
+
display: read2(ACS_DISPLAY_FONT_VAR) ? `var(${ACS_DISPLAY_FONT_VAR})` : `var(${ACS_BODY_FONT_VAR})`,
|
|
258
|
+
load: []
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const load = [];
|
|
262
|
+
const pick = (role) => {
|
|
263
|
+
const served = fontValueToCss(role === "display" ? brand == null ? void 0 : brand.display : brand == null ? void 0 : brand.body);
|
|
264
|
+
if (!served) return null;
|
|
265
|
+
if (served.font) load.push({ font: served.font, role });
|
|
266
|
+
return served.css;
|
|
267
|
+
};
|
|
268
|
+
const body = pick("body");
|
|
269
|
+
const display = pick("display");
|
|
270
|
+
return { host, body, display, load };
|
|
271
|
+
}
|
|
272
|
+
const LINK_ID = "aegis-inapp-fonts";
|
|
273
|
+
const FALLBACK_STYLE_ID = "aegis-inapp-font-fallbacks";
|
|
274
|
+
const PRECONNECT_ORIGINS = ["https://fonts.googleapis.com", "https://fonts.gstatic.com"];
|
|
275
|
+
const requested = /* @__PURE__ */ new Map();
|
|
276
|
+
function googleFontsHref(families) {
|
|
277
|
+
const parts = [...families.keys()].sort((a, b) => a.localeCompare(b)).map((name) => {
|
|
278
|
+
const weights = [...families.get(name) ?? []].sort((a, b) => a - b);
|
|
279
|
+
return `family=${name.replace(/ /g, "+")}:wght@${weights.join(";")}`;
|
|
280
|
+
});
|
|
281
|
+
return `https://fonts.googleapis.com/css2?${parts.join("&")}&display=swap`;
|
|
282
|
+
}
|
|
283
|
+
function fallbackFaceCss(fonts) {
|
|
284
|
+
return fonts.map(
|
|
285
|
+
(f) => `@font-face{font-family:'${fallbackFamily(f)}';src:local('${f.fallback.local}');size-adjust:${f.fallback.size_adjust};ascent-override:${f.fallback.ascent_override};descent-override:${f.fallback.descent_override};line-gap-override:${f.fallback.line_gap_override};}`
|
|
286
|
+
).join("\n");
|
|
287
|
+
}
|
|
288
|
+
function ensurePreconnect() {
|
|
289
|
+
for (const origin of PRECONNECT_ORIGINS) {
|
|
290
|
+
if (document.head.querySelector(`link[rel="preconnect"][href="${origin}"]`)) continue;
|
|
291
|
+
const l = document.createElement("link");
|
|
292
|
+
l.rel = "preconnect";
|
|
293
|
+
l.href = origin;
|
|
294
|
+
if (origin.includes("gstatic")) l.crossOrigin = "anonymous";
|
|
295
|
+
document.head.appendChild(l);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function loadFonts(loads, read2 = readRootVar) {
|
|
299
|
+
if (typeof document === "undefined" || loads.length === 0) return;
|
|
300
|
+
if (detectFontHost(read2) === "acs") return;
|
|
301
|
+
let grew = false;
|
|
302
|
+
for (const { font, role } of loads) {
|
|
303
|
+
const known = findGoogleFont(font.name);
|
|
304
|
+
if (!known) continue;
|
|
305
|
+
const set = requested.get(known.name) ?? /* @__PURE__ */ new Set();
|
|
306
|
+
for (const w of ROLE_WEIGHTS[role]) {
|
|
307
|
+
if (!set.has(w)) {
|
|
308
|
+
set.add(w);
|
|
309
|
+
grew = true;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
requested.set(known.name, set);
|
|
313
|
+
}
|
|
314
|
+
if (!grew) return;
|
|
315
|
+
ensurePreconnect();
|
|
316
|
+
let style = document.getElementById(FALLBACK_STYLE_ID);
|
|
317
|
+
if (!style) {
|
|
318
|
+
style = document.createElement("style");
|
|
319
|
+
style.id = FALLBACK_STYLE_ID;
|
|
320
|
+
document.head.appendChild(style);
|
|
321
|
+
}
|
|
322
|
+
style.textContent = fallbackFaceCss(
|
|
323
|
+
[...requested.keys()].map((n) => findGoogleFont(n)).filter((f) => !!f)
|
|
324
|
+
);
|
|
325
|
+
let link = document.getElementById(LINK_ID);
|
|
326
|
+
if (!link) {
|
|
327
|
+
link = document.createElement("link");
|
|
328
|
+
link.id = LINK_ID;
|
|
329
|
+
link.rel = "stylesheet";
|
|
330
|
+
document.head.appendChild(link);
|
|
331
|
+
}
|
|
332
|
+
link.href = googleFontsHref(requested);
|
|
333
|
+
}
|
|
334
|
+
function applyRootFonts(brand, read2 = readRootVar) {
|
|
335
|
+
const r = resolveRootFonts(brand, read2);
|
|
336
|
+
if (typeof document === "undefined") return r;
|
|
337
|
+
const root = document.documentElement.style;
|
|
338
|
+
if (r.body) root.setProperty(AEGIS_BODY_FONT_VAR, r.body);
|
|
339
|
+
else root.removeProperty(AEGIS_BODY_FONT_VAR);
|
|
340
|
+
if (r.display) root.setProperty(AEGIS_DISPLAY_FONT_VAR, r.display);
|
|
341
|
+
else root.removeProperty(AEGIS_DISPLAY_FONT_VAR);
|
|
342
|
+
loadFonts(r.load, read2);
|
|
343
|
+
return r;
|
|
344
|
+
}
|
|
345
|
+
function campaignFontFamily(campaign) {
|
|
346
|
+
var _a;
|
|
347
|
+
const style = (_a = campaign == null ? void 0 : campaign.interactive_config) == null ? void 0 : _a.style;
|
|
348
|
+
if (style && typeof style === "object") {
|
|
349
|
+
const ff = style.fontFamily;
|
|
350
|
+
if (typeof ff === "string" && ff.trim()) return ff;
|
|
351
|
+
}
|
|
352
|
+
return void 0;
|
|
353
|
+
}
|
|
354
|
+
function campaignFontVarsCss(value, read2 = readRootVar) {
|
|
355
|
+
const served = fontValueToCss(value, detectFontHost(read2));
|
|
356
|
+
if (!served) return "";
|
|
357
|
+
if (served.font) {
|
|
358
|
+
loadFonts(
|
|
359
|
+
[
|
|
360
|
+
{ font: served.font, role: "body" },
|
|
361
|
+
{ font: served.font, role: "display" }
|
|
362
|
+
],
|
|
363
|
+
read2
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
return `${AEGIS_BODY_FONT_VAR}:${served.css};${AEGIS_DISPLAY_FONT_VAR}:${served.css};`;
|
|
367
|
+
}
|
|
368
|
+
const CAMPAIGN_SHEET_ID = "aegis-campaign-fonts";
|
|
369
|
+
const SAFE_ID = /^[A-Za-z0-9_-]{1,128}$/;
|
|
370
|
+
function registerCampaignFonts(campaigns, read2 = readRootVar) {
|
|
371
|
+
const rules = [];
|
|
372
|
+
for (const c of campaigns) {
|
|
373
|
+
const id = typeof c.id === "string" ? c.id : "";
|
|
374
|
+
if (!SAFE_ID.test(id)) continue;
|
|
375
|
+
const decl = campaignFontVarsCss(campaignFontFamily(c), read2);
|
|
376
|
+
if (decl) rules.push(`[data-campaign-id="${id}"]{${decl}}`);
|
|
377
|
+
}
|
|
378
|
+
const css = rules.join("\n");
|
|
379
|
+
if (typeof document === "undefined") return css;
|
|
380
|
+
let sheet = document.getElementById(CAMPAIGN_SHEET_ID);
|
|
381
|
+
if (!css) {
|
|
382
|
+
sheet == null ? void 0 : sheet.remove();
|
|
383
|
+
return css;
|
|
384
|
+
}
|
|
385
|
+
if (!sheet) {
|
|
386
|
+
sheet = document.createElement("style");
|
|
387
|
+
sheet.id = CAMPAIGN_SHEET_ID;
|
|
388
|
+
document.head.appendChild(sheet);
|
|
389
|
+
}
|
|
390
|
+
sheet.textContent = css;
|
|
391
|
+
return css;
|
|
392
|
+
}
|
|
393
|
+
function applyCampaignFonts(campaigns, read2 = readRootVar) {
|
|
394
|
+
var _a;
|
|
395
|
+
const brand = ((_a = campaigns.find((c) => c.brand_typography)) == null ? void 0 : _a.brand_typography) ?? null;
|
|
396
|
+
applyRootFonts(brand, read2);
|
|
397
|
+
registerCampaignFonts(campaigns, read2);
|
|
398
|
+
}
|
|
151
399
|
const CLAIM_BUTTON_LABEL = "Log in or sign up to claim";
|
|
152
400
|
const SIGN_IN_BUTTON_LABEL = "Sign in to play";
|
|
153
401
|
const ANON_CLAIMS_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -214,7 +462,7 @@ function showClaimNotice(answer, onRetry) {
|
|
|
214
462
|
const box = document.createElement("div");
|
|
215
463
|
box.setAttribute("data-aegis-anon-claim-notice", "");
|
|
216
464
|
box.setAttribute("role", "status");
|
|
217
|
-
box.style.cssText =
|
|
465
|
+
box.style.cssText = `position:fixed;left:16px;right:16px;bottom:${bottomOffset(16)};max-width:420px;margin:0 auto;z-index:2147483646;background:#fff;color:#111827;border-radius:12px;padding:14px 16px;box-shadow:0 8px 30px rgba(0,0,0,0.18);font-size:14px;line-height:1.4;${fontFamilyCss("body")}`;
|
|
218
466
|
const text = document.createElement("div");
|
|
219
467
|
text.style.cssText = "font-weight:600;";
|
|
220
468
|
text.textContent = answer.text;
|
|
@@ -428,278 +676,62 @@ const ICONS = {
|
|
|
428
676
|
],
|
|
429
677
|
store: [
|
|
430
678
|
["path", { d: "m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7" }],
|
|
431
|
-
["path", { d: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" }],
|
|
432
|
-
["path", { d: "M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4" }],
|
|
433
|
-
["path", { d: "M2 7h20" }],
|
|
434
|
-
["path", { d: "M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7" }]
|
|
435
|
-
],
|
|
436
|
-
rocket: [
|
|
437
|
-
["path", { d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z" }],
|
|
438
|
-
["path", { d: "m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z" }],
|
|
439
|
-
["path", { d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0" }],
|
|
440
|
-
["path", { d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5" }]
|
|
441
|
-
]
|
|
442
|
-
};
|
|
443
|
-
function escapeAttr(value) {
|
|
444
|
-
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
445
|
-
}
|
|
446
|
-
const SVG_NS$1 = "http://www.w3.org/2000/svg";
|
|
447
|
-
function lucideSvgEl(name, opts = {}) {
|
|
448
|
-
const node = ICONS[name];
|
|
449
|
-
if (!node || typeof document === "undefined") return null;
|
|
450
|
-
const size = opts.size ?? 24;
|
|
451
|
-
const svg = document.createElementNS(SVG_NS$1, "svg");
|
|
452
|
-
svg.setAttribute("width", String(size));
|
|
453
|
-
svg.setAttribute("height", String(size));
|
|
454
|
-
svg.setAttribute("viewBox", "0 0 24 24");
|
|
455
|
-
svg.setAttribute("fill", "none");
|
|
456
|
-
svg.setAttribute("stroke", opts.color ?? "currentColor");
|
|
457
|
-
svg.setAttribute("stroke-width", String(opts.strokeWidth ?? 2));
|
|
458
|
-
svg.setAttribute("stroke-linecap", "round");
|
|
459
|
-
svg.setAttribute("stroke-linejoin", "round");
|
|
460
|
-
if (opts.className) svg.setAttribute("class", opts.className);
|
|
461
|
-
if (opts.ariaLabel) {
|
|
462
|
-
svg.setAttribute("role", "img");
|
|
463
|
-
svg.setAttribute("aria-label", opts.ariaLabel);
|
|
464
|
-
} else {
|
|
465
|
-
svg.setAttribute("aria-hidden", "true");
|
|
466
|
-
}
|
|
467
|
-
for (const [tag, attrs] of node) {
|
|
468
|
-
const child = document.createElementNS(SVG_NS$1, tag);
|
|
469
|
-
for (const [k, v] of Object.entries(attrs)) child.setAttribute(k, String(v));
|
|
470
|
-
svg.appendChild(child);
|
|
471
|
-
}
|
|
472
|
-
return svg;
|
|
473
|
-
}
|
|
474
|
-
function lucideSvg(name, opts = {}) {
|
|
475
|
-
const node = ICONS[name];
|
|
476
|
-
if (!node) return "";
|
|
477
|
-
const size = opts.size ?? 24;
|
|
478
|
-
const color = opts.color ?? "currentColor";
|
|
479
|
-
const strokeWidth = opts.strokeWidth ?? 2;
|
|
480
|
-
const a11y = opts.ariaLabel ? `role="img" aria-label="${escapeAttr(opts.ariaLabel)}"` : 'aria-hidden="true"';
|
|
481
|
-
const cls = opts.className ? ` class="${escapeAttr(opts.className)}"` : "";
|
|
482
|
-
const children = node.map(([tag, attrs]) => {
|
|
483
|
-
const attrStr = Object.entries(attrs).map(([k, v]) => `${k}="${escapeAttr(String(v))}"`).join(" ");
|
|
484
|
-
return `<${tag} ${attrStr}/>`;
|
|
485
|
-
}).join("");
|
|
486
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="${escapeAttr(color)}" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${cls} ${a11y}>${children}</svg>`;
|
|
487
|
-
}
|
|
488
|
-
const keywords = ["inherit", "system", "serif", "mono"];
|
|
489
|
-
const system_stacks = { "system": "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", "serif": "Georgia, 'Times New Roman', serif", "mono": "ui-monospace, 'SF Mono', Menlo, monospace" };
|
|
490
|
-
const aliases = { "system-ui": "system", "-apple-system": "system", "georgia": "serif", "times new roman": "serif", "sf mono": "mono", "ui-monospace": "mono", "menlo": "mono", "monospace": "mono" };
|
|
491
|
-
const role_weights = { "body": [400, 500], "display": [600, 700] };
|
|
492
|
-
const google = [{ "name": "Urbanist", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "99.04%", "ascent_override": "95.93%", "descent_override": "25.24%", "line_gap_override": "0.00%" } }, { "name": "Inter", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "107.12%", "ascent_override": "90.44%", "descent_override": "22.52%", "line_gap_override": "0.00%" } }, { "name": "Poppins", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "112.16%", "ascent_override": "93.62%", "descent_override": "31.21%", "line_gap_override": "8.92%" } }, { "name": "DM Sans", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "104.53%", "ascent_override": "94.90%", "descent_override": "29.66%", "line_gap_override": "0.00%" } }, { "name": "Nunito", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "101.39%", "ascent_override": "99.71%", "descent_override": "34.82%", "line_gap_override": "0.00%" } }, { "name": "Montserrat", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "112.83%", "ascent_override": "85.79%", "descent_override": "22.25%", "line_gap_override": "0.00%" } }, { "name": "Roboto", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "99.78%", "ascent_override": "92.98%", "descent_override": "24.47%", "line_gap_override": "0.00%" } }, { "name": "Outfit", "category": "sans-serif", "fallback": { "local": "Arial", "size_adjust": "99.82%", "ascent_override": "100.18%", "descent_override": "26.05%", "line_gap_override": "0.00%" } }, { "name": "Playfair Display", "category": "serif", "fallback": { "local": "Times New Roman", "size_adjust": "111.26%", "ascent_override": "97.25%", "descent_override": "22.56%", "line_gap_override": "0.00%" } }, { "name": "Lora", "category": "serif", "fallback": { "local": "Times New Roman", "size_adjust": "115.20%", "ascent_override": "87.33%", "descent_override": "23.78%", "line_gap_override": "0.00%" } }];
|
|
493
|
-
const FONT_ALLOWLIST = {
|
|
494
|
-
keywords,
|
|
495
|
-
system_stacks,
|
|
496
|
-
aliases,
|
|
497
|
-
role_weights,
|
|
498
|
-
google
|
|
499
|
-
};
|
|
500
|
-
const BODY_FONT_STACK = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
|
|
501
|
-
const SERIF_STACK = "Georgia, 'Times New Roman', serif";
|
|
502
|
-
const AEGIS_BODY_FONT_VAR = "--aegis-font-body";
|
|
503
|
-
const AEGIS_DISPLAY_FONT_VAR = "--aegis-font-display";
|
|
504
|
-
const ACS_DISPLAY_FONT_VAR = "--acs-font-display";
|
|
505
|
-
const ACS_BODY_FONT_VAR = "--acs-font-body";
|
|
506
|
-
const GOOGLE_FONTS = FONT_ALLOWLIST.google;
|
|
507
|
-
const KEYWORDS = FONT_ALLOWLIST.keywords;
|
|
508
|
-
const SYSTEM_STACKS = FONT_ALLOWLIST.system_stacks;
|
|
509
|
-
const ALIASES = FONT_ALLOWLIST.aliases;
|
|
510
|
-
const ROLE_WEIGHTS = FONT_ALLOWLIST.role_weights;
|
|
511
|
-
function fontFamilyCss(role) {
|
|
512
|
-
return `font-family:var(${role === "display" ? AEGIS_DISPLAY_FONT_VAR : AEGIS_BODY_FONT_VAR});`;
|
|
513
|
-
}
|
|
514
|
-
function findGoogleFont(value) {
|
|
515
|
-
const v = value.trim().toLowerCase();
|
|
516
|
-
return GOOGLE_FONTS.find((f) => f.name.toLowerCase() === v);
|
|
517
|
-
}
|
|
518
|
-
function normalizeFontValue(value) {
|
|
519
|
-
var _a;
|
|
520
|
-
if (typeof value !== "string") return null;
|
|
521
|
-
const first = value.split(",")[0].trim().replace(/^['"]|['"]$/g, "").trim();
|
|
522
|
-
if (!first) return null;
|
|
523
|
-
const v = first.toLowerCase();
|
|
524
|
-
if (KEYWORDS.includes(v)) return v;
|
|
525
|
-
if (ALIASES[v]) return ALIASES[v];
|
|
526
|
-
return ((_a = findGoogleFont(first)) == null ? void 0 : _a.name) ?? null;
|
|
527
|
-
}
|
|
528
|
-
function fallbackFamily(f) {
|
|
529
|
-
return `${f.name} Aegis Fallback`;
|
|
530
|
-
}
|
|
531
|
-
function fontValueToCss(value, host = "third_party") {
|
|
532
|
-
const canonical = normalizeFontValue(value);
|
|
533
|
-
if (!canonical) return null;
|
|
534
|
-
if (canonical === "inherit") return { css: "initial" };
|
|
535
|
-
if (SYSTEM_STACKS[canonical]) return { css: SYSTEM_STACKS[canonical] };
|
|
536
|
-
const f = findGoogleFont(canonical);
|
|
537
|
-
if (!f) return null;
|
|
538
|
-
const stack = f.category === "serif" ? SERIF_STACK : BODY_FONT_STACK;
|
|
539
|
-
if (host === "acs") return { css: `var(${acsFaceVar(f)}), ${stack}` };
|
|
540
|
-
return { css: `'${f.name}', '${fallbackFamily(f)}', ${stack}`, font: f };
|
|
541
|
-
}
|
|
542
|
-
function acsFaceVar(f) {
|
|
543
|
-
return `--acs-face-${f.name.toLowerCase().replace(/ /g, "-")}`;
|
|
544
|
-
}
|
|
545
|
-
function readRootVar(name) {
|
|
546
|
-
if (typeof document === "undefined" || typeof getComputedStyle !== "function") return "";
|
|
547
|
-
try {
|
|
548
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
549
|
-
} catch {
|
|
550
|
-
return "";
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
function detectFontHost(read2 = readRootVar) {
|
|
554
|
-
return read2(ACS_BODY_FONT_VAR) ? "acs" : "third_party";
|
|
555
|
-
}
|
|
556
|
-
function resolveRootFonts(brand, read2 = readRootVar) {
|
|
557
|
-
const host = detectFontHost(read2);
|
|
558
|
-
if (host === "acs") {
|
|
559
|
-
return {
|
|
560
|
-
host,
|
|
561
|
-
body: `var(${ACS_BODY_FONT_VAR})`,
|
|
562
|
-
display: read2(ACS_DISPLAY_FONT_VAR) ? `var(${ACS_DISPLAY_FONT_VAR})` : `var(${ACS_BODY_FONT_VAR})`,
|
|
563
|
-
load: []
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
const load = [];
|
|
567
|
-
const pick = (role) => {
|
|
568
|
-
const served = fontValueToCss(role === "display" ? brand == null ? void 0 : brand.display : brand == null ? void 0 : brand.body);
|
|
569
|
-
if (!served) return null;
|
|
570
|
-
if (served.font) load.push({ font: served.font, role });
|
|
571
|
-
return served.css;
|
|
572
|
-
};
|
|
573
|
-
const body = pick("body");
|
|
574
|
-
const display = pick("display");
|
|
575
|
-
return { host, body, display, load };
|
|
576
|
-
}
|
|
577
|
-
const LINK_ID = "aegis-inapp-fonts";
|
|
578
|
-
const FALLBACK_STYLE_ID = "aegis-inapp-font-fallbacks";
|
|
579
|
-
const PRECONNECT_ORIGINS = ["https://fonts.googleapis.com", "https://fonts.gstatic.com"];
|
|
580
|
-
const requested = /* @__PURE__ */ new Map();
|
|
581
|
-
function googleFontsHref(families) {
|
|
582
|
-
const parts = [...families.keys()].sort((a, b) => a.localeCompare(b)).map((name) => {
|
|
583
|
-
const weights = [...families.get(name) ?? []].sort((a, b) => a - b);
|
|
584
|
-
return `family=${name.replace(/ /g, "+")}:wght@${weights.join(";")}`;
|
|
585
|
-
});
|
|
586
|
-
return `https://fonts.googleapis.com/css2?${parts.join("&")}&display=swap`;
|
|
587
|
-
}
|
|
588
|
-
function fallbackFaceCss(fonts) {
|
|
589
|
-
return fonts.map(
|
|
590
|
-
(f) => `@font-face{font-family:'${fallbackFamily(f)}';src:local('${f.fallback.local}');size-adjust:${f.fallback.size_adjust};ascent-override:${f.fallback.ascent_override};descent-override:${f.fallback.descent_override};line-gap-override:${f.fallback.line_gap_override};}`
|
|
591
|
-
).join("\n");
|
|
592
|
-
}
|
|
593
|
-
function ensurePreconnect() {
|
|
594
|
-
for (const origin of PRECONNECT_ORIGINS) {
|
|
595
|
-
if (document.head.querySelector(`link[rel="preconnect"][href="${origin}"]`)) continue;
|
|
596
|
-
const l = document.createElement("link");
|
|
597
|
-
l.rel = "preconnect";
|
|
598
|
-
l.href = origin;
|
|
599
|
-
if (origin.includes("gstatic")) l.crossOrigin = "anonymous";
|
|
600
|
-
document.head.appendChild(l);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
function loadFonts(loads, read2 = readRootVar) {
|
|
604
|
-
if (typeof document === "undefined" || loads.length === 0) return;
|
|
605
|
-
if (detectFontHost(read2) === "acs") return;
|
|
606
|
-
let grew = false;
|
|
607
|
-
for (const { font, role } of loads) {
|
|
608
|
-
const known = findGoogleFont(font.name);
|
|
609
|
-
if (!known) continue;
|
|
610
|
-
const set = requested.get(known.name) ?? /* @__PURE__ */ new Set();
|
|
611
|
-
for (const w of ROLE_WEIGHTS[role]) {
|
|
612
|
-
if (!set.has(w)) {
|
|
613
|
-
set.add(w);
|
|
614
|
-
grew = true;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
requested.set(known.name, set);
|
|
618
|
-
}
|
|
619
|
-
if (!grew) return;
|
|
620
|
-
ensurePreconnect();
|
|
621
|
-
let style = document.getElementById(FALLBACK_STYLE_ID);
|
|
622
|
-
if (!style) {
|
|
623
|
-
style = document.createElement("style");
|
|
624
|
-
style.id = FALLBACK_STYLE_ID;
|
|
625
|
-
document.head.appendChild(style);
|
|
626
|
-
}
|
|
627
|
-
style.textContent = fallbackFaceCss(
|
|
628
|
-
[...requested.keys()].map((n) => findGoogleFont(n)).filter((f) => !!f)
|
|
629
|
-
);
|
|
630
|
-
let link = document.getElementById(LINK_ID);
|
|
631
|
-
if (!link) {
|
|
632
|
-
link = document.createElement("link");
|
|
633
|
-
link.id = LINK_ID;
|
|
634
|
-
link.rel = "stylesheet";
|
|
635
|
-
document.head.appendChild(link);
|
|
636
|
-
}
|
|
637
|
-
link.href = googleFontsHref(requested);
|
|
638
|
-
}
|
|
639
|
-
function applyRootFonts(brand, read2 = readRootVar) {
|
|
640
|
-
const r = resolveRootFonts(brand, read2);
|
|
641
|
-
if (typeof document === "undefined") return r;
|
|
642
|
-
const root = document.documentElement.style;
|
|
643
|
-
if (r.body) root.setProperty(AEGIS_BODY_FONT_VAR, r.body);
|
|
644
|
-
else root.removeProperty(AEGIS_BODY_FONT_VAR);
|
|
645
|
-
if (r.display) root.setProperty(AEGIS_DISPLAY_FONT_VAR, r.display);
|
|
646
|
-
else root.removeProperty(AEGIS_DISPLAY_FONT_VAR);
|
|
647
|
-
loadFonts(r.load, read2);
|
|
648
|
-
return r;
|
|
649
|
-
}
|
|
650
|
-
function campaignFontFamily(campaign) {
|
|
651
|
-
var _a;
|
|
652
|
-
const style = (_a = campaign == null ? void 0 : campaign.interactive_config) == null ? void 0 : _a.style;
|
|
653
|
-
if (style && typeof style === "object") {
|
|
654
|
-
const ff = style.fontFamily;
|
|
655
|
-
if (typeof ff === "string" && ff.trim()) return ff;
|
|
656
|
-
}
|
|
657
|
-
return void 0;
|
|
658
|
-
}
|
|
659
|
-
function campaignFontVarsCss(value, read2 = readRootVar) {
|
|
660
|
-
const served = fontValueToCss(value, detectFontHost(read2));
|
|
661
|
-
if (!served) return "";
|
|
662
|
-
if (served.font) {
|
|
663
|
-
loadFonts(
|
|
664
|
-
[
|
|
665
|
-
{ font: served.font, role: "body" },
|
|
666
|
-
{ font: served.font, role: "display" }
|
|
667
|
-
],
|
|
668
|
-
read2
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
return `${AEGIS_BODY_FONT_VAR}:${served.css};${AEGIS_DISPLAY_FONT_VAR}:${served.css};`;
|
|
679
|
+
["path", { d: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" }],
|
|
680
|
+
["path", { d: "M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4" }],
|
|
681
|
+
["path", { d: "M2 7h20" }],
|
|
682
|
+
["path", { d: "M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7" }]
|
|
683
|
+
],
|
|
684
|
+
rocket: [
|
|
685
|
+
["path", { d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z" }],
|
|
686
|
+
["path", { d: "m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z" }],
|
|
687
|
+
["path", { d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0" }],
|
|
688
|
+
["path", { d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5" }]
|
|
689
|
+
]
|
|
690
|
+
};
|
|
691
|
+
function escapeAttr(value) {
|
|
692
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
672
693
|
}
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
694
|
+
const SVG_NS$1 = "http://www.w3.org/2000/svg";
|
|
695
|
+
function lucideSvgEl(name, opts = {}) {
|
|
696
|
+
const node = ICONS[name];
|
|
697
|
+
if (!node || typeof document === "undefined") return null;
|
|
698
|
+
const size = opts.size ?? 24;
|
|
699
|
+
const svg = document.createElementNS(SVG_NS$1, "svg");
|
|
700
|
+
svg.setAttribute("width", String(size));
|
|
701
|
+
svg.setAttribute("height", String(size));
|
|
702
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
703
|
+
svg.setAttribute("fill", "none");
|
|
704
|
+
svg.setAttribute("stroke", opts.color ?? "currentColor");
|
|
705
|
+
svg.setAttribute("stroke-width", String(opts.strokeWidth ?? 2));
|
|
706
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
707
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
708
|
+
if (opts.className) svg.setAttribute("class", opts.className);
|
|
709
|
+
if (opts.ariaLabel) {
|
|
710
|
+
svg.setAttribute("role", "img");
|
|
711
|
+
svg.setAttribute("aria-label", opts.ariaLabel);
|
|
712
|
+
} else {
|
|
713
|
+
svg.setAttribute("aria-hidden", "true");
|
|
689
714
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
715
|
+
for (const [tag, attrs] of node) {
|
|
716
|
+
const child = document.createElementNS(SVG_NS$1, tag);
|
|
717
|
+
for (const [k, v] of Object.entries(attrs)) child.setAttribute(k, String(v));
|
|
718
|
+
svg.appendChild(child);
|
|
694
719
|
}
|
|
695
|
-
|
|
696
|
-
return css;
|
|
720
|
+
return svg;
|
|
697
721
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
722
|
+
function lucideSvg(name, opts = {}) {
|
|
723
|
+
const node = ICONS[name];
|
|
724
|
+
if (!node) return "";
|
|
725
|
+
const size = opts.size ?? 24;
|
|
726
|
+
const color = opts.color ?? "currentColor";
|
|
727
|
+
const strokeWidth = opts.strokeWidth ?? 2;
|
|
728
|
+
const a11y = opts.ariaLabel ? `role="img" aria-label="${escapeAttr(opts.ariaLabel)}"` : 'aria-hidden="true"';
|
|
729
|
+
const cls = opts.className ? ` class="${escapeAttr(opts.className)}"` : "";
|
|
730
|
+
const children = node.map(([tag, attrs]) => {
|
|
731
|
+
const attrStr = Object.entries(attrs).map(([k, v]) => `${k}="${escapeAttr(String(v))}"`).join(" ");
|
|
732
|
+
return `<${tag} ${attrStr}/>`;
|
|
733
|
+
}).join("");
|
|
734
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="${escapeAttr(color)}" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${cls} ${a11y}>${children}</svg>`;
|
|
703
735
|
}
|
|
704
736
|
const HERO_IMAGE_SIZES = "100vw";
|
|
705
737
|
function cardImageSizes(kind, widthPx) {
|
|
@@ -1805,8 +1837,9 @@ function buildNpsElement(el2, ctx, fg, accent, muted) {
|
|
|
1805
1837
|
wrap.appendChild(scale);
|
|
1806
1838
|
return wrap;
|
|
1807
1839
|
}
|
|
1808
|
-
function buildProgressElement(el2, ctx, accent, muted, compact) {
|
|
1840
|
+
function buildProgressElement(el2, ctx, accent, muted, compact, onMeasuredDefault) {
|
|
1809
1841
|
const { trackEvent, campaign, sanitizeColor } = ctx;
|
|
1842
|
+
const reportMeasured = compact ? compact.onMeasured : onMeasuredDefault;
|
|
1810
1843
|
const goal = el2.goal_type || "cart_total";
|
|
1811
1844
|
const moneyGoal = goal === "cart_total";
|
|
1812
1845
|
const fill = el2.fill ? sanitizeColor(el2.fill) : accent;
|
|
@@ -1878,17 +1911,17 @@ function buildProgressElement(el2, ctx, accent, muted, compact) {
|
|
|
1878
1911
|
let firedUnlock = false;
|
|
1879
1912
|
let seenIncomplete = false;
|
|
1880
1913
|
const update = () => {
|
|
1881
|
-
var _a
|
|
1914
|
+
var _a;
|
|
1882
1915
|
const th = threshold();
|
|
1883
1916
|
const cur = readCur();
|
|
1884
1917
|
if (th <= 0 && el2.threshold_source === "free_delivery_setting") {
|
|
1885
1918
|
wrap.style.display = "none";
|
|
1886
1919
|
markProgress(shell, null, false);
|
|
1887
|
-
|
|
1920
|
+
reportMeasured == null ? void 0 : reportMeasured(false);
|
|
1888
1921
|
return;
|
|
1889
1922
|
}
|
|
1890
1923
|
wrap.style.display = "flex";
|
|
1891
|
-
|
|
1924
|
+
reportMeasured == null ? void 0 : reportMeasured(true);
|
|
1892
1925
|
const { pct, complete } = computeProgress({ threshold: th, current: cur });
|
|
1893
1926
|
bar.style.width = `${pct}%`;
|
|
1894
1927
|
markProgress(shell, pct, complete);
|
|
@@ -1910,7 +1943,7 @@ function buildProgressElement(el2, ctx, accent, muted, compact) {
|
|
|
1910
1943
|
firedUnlock = true;
|
|
1911
1944
|
if (seenIncomplete) {
|
|
1912
1945
|
trackEvent(campaign.id, "clicked", { stepId: el2.id || "unlocked" });
|
|
1913
|
-
if (el2.celebrate_on_complete !== false) (
|
|
1946
|
+
if (el2.celebrate_on_complete !== false) (_a = ctx.playReaction) == null ? void 0 : _a.call(ctx, wrap, "celebrate");
|
|
1914
1947
|
}
|
|
1915
1948
|
}
|
|
1916
1949
|
} else {
|
|
@@ -2176,7 +2209,12 @@ function renderCardFromTemplate(card, opts) {
|
|
|
2176
2209
|
break;
|
|
2177
2210
|
}
|
|
2178
2211
|
case "progress": {
|
|
2179
|
-
|
|
2212
|
+
const tileDisplay = tile.style.display;
|
|
2213
|
+
const onMeasured = (measured) => {
|
|
2214
|
+
tile.hidden = !measured;
|
|
2215
|
+
tile.style.display = measured ? tileDisplay : "none";
|
|
2216
|
+
};
|
|
2217
|
+
container.appendChild(buildProgressElement(el2, ctx, brand, muted, void 0, onMeasured));
|
|
2180
2218
|
break;
|
|
2181
2219
|
}
|
|
2182
2220
|
case "countdown": {
|
|
@@ -2286,6 +2324,28 @@ function renderCardFromTemplate(card, opts) {
|
|
|
2286
2324
|
}
|
|
2287
2325
|
return tile;
|
|
2288
2326
|
}
|
|
2327
|
+
const BRAND_ACCENT_VAR = "--aegis-brand-accent";
|
|
2328
|
+
const DEFAULT_BRAND_ACCENT = "#4169e1";
|
|
2329
|
+
const CONCRETE = /^(#[0-9a-fA-F]{3,6}|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\))$/;
|
|
2330
|
+
function brandAccentCss(fallback = DEFAULT_BRAND_ACCENT) {
|
|
2331
|
+
return `var(${BRAND_ACCENT_VAR}, ${fallback})`;
|
|
2332
|
+
}
|
|
2333
|
+
function readBrandAccent() {
|
|
2334
|
+
if (typeof document === "undefined" || typeof getComputedStyle !== "function") return null;
|
|
2335
|
+
const els = [document.documentElement, document.body].filter(Boolean);
|
|
2336
|
+
for (const el2 of els) {
|
|
2337
|
+
try {
|
|
2338
|
+
const v = getComputedStyle(el2).getPropertyValue(BRAND_ACCENT_VAR).trim();
|
|
2339
|
+
if (v && CONCRETE.test(v)) return v;
|
|
2340
|
+
} catch {
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
return null;
|
|
2344
|
+
}
|
|
2345
|
+
function resolveAccent(explicit, sanitizeColor, fallback = DEFAULT_BRAND_ACCENT) {
|
|
2346
|
+
if (typeof explicit === "string" && explicit.trim()) return sanitizeColor(explicit.trim());
|
|
2347
|
+
return brandAccentCss(fallback);
|
|
2348
|
+
}
|
|
2289
2349
|
const MAX_CARDS_RENDERED = 10;
|
|
2290
2350
|
function renderCarouselCards(ctx) {
|
|
2291
2351
|
const { campaign, trackEvent, sanitizeColor, log, addAnimationStyles } = ctx;
|
|
@@ -2302,12 +2362,13 @@ function renderCarouselCards(ctx) {
|
|
|
2302
2362
|
addAnimationStyles();
|
|
2303
2363
|
const bg = "#ffffff";
|
|
2304
2364
|
const fg = "#0f172a";
|
|
2305
|
-
const accent =
|
|
2365
|
+
const accent = resolveAccent(campaign.background_color, sanitizeColor);
|
|
2306
2366
|
const overlay = document.createElement("div");
|
|
2307
|
-
|
|
2367
|
+
injectOverlayLayoutCss();
|
|
2368
|
+
overlay.className = "aegis-in-app-carousel-overlay aegis-bottom-panel";
|
|
2308
2369
|
overlay.setAttribute("data-campaign-id", campaign.id);
|
|
2309
2370
|
overlay.style.cssText = `
|
|
2310
|
-
position: fixed; left: 0; right: 0; bottom: 0;
|
|
2371
|
+
position: fixed; left: 0; right: 0; bottom: ${bottomOffset(0)};
|
|
2311
2372
|
z-index: 99999; padding: 12px 12px 20px;
|
|
2312
2373
|
background: rgba(0,0,0,0.12); backdrop-filter: blur(8px);
|
|
2313
2374
|
${fontFamilyCss("body")}
|
|
@@ -2482,14 +2543,12 @@ function renderStickyBar(ctx) {
|
|
|
2482
2543
|
} catch {
|
|
2483
2544
|
}
|
|
2484
2545
|
addAnimationStyles();
|
|
2485
|
-
const bg = sanitizeColor
|
|
2486
|
-
ic.sticky_bg_color || campaign.background_color || "#4169e1"
|
|
2487
|
-
);
|
|
2546
|
+
const bg = resolveAccent(ic.sticky_bg_color || campaign.background_color, sanitizeColor);
|
|
2488
2547
|
const fg = sanitizeColor(campaign.text_color || "#ffffff");
|
|
2489
2548
|
const bar = document.createElement("div");
|
|
2490
2549
|
bar.className = "aegis-in-app-sticky-bar";
|
|
2491
2550
|
bar.setAttribute("data-campaign-id", campaign.id);
|
|
2492
|
-
const positionCss = position === "top" ? "top: 0; left: 0; right: 0; animation: aegisSlideDown 0.3s ease-out;" :
|
|
2551
|
+
const positionCss = position === "top" ? "top: 0; left: 0; right: 0; animation: aegisSlideDown 0.3s ease-out;" : `bottom: ${bottomOffset(0)}; left: 0; right: 0; animation: aegisSlideInFromBottom 0.3s ease-out;`;
|
|
2493
2552
|
bar.style.cssText = `
|
|
2494
2553
|
position: fixed; ${positionCss}
|
|
2495
2554
|
background: ${bg}; color: ${fg};
|
|
@@ -2586,7 +2645,7 @@ function buildProgressBar(ctx, inline, compact = false) {
|
|
|
2586
2645
|
padding: 10px 14px;
|
|
2587
2646
|
${fontFamilyCss("body")}
|
|
2588
2647
|
` : `
|
|
2589
|
-
position: fixed; left: 12px; right: 12px; bottom:
|
|
2648
|
+
position: fixed; left: 12px; right: 12px; bottom: ${bottomOffset(12)};
|
|
2590
2649
|
max-width: 540px; margin: 0 auto;
|
|
2591
2650
|
background: ${bg}; color: ${fg}; border-radius: 12px;
|
|
2592
2651
|
padding: 10px 14px; z-index: 999997;
|
|
@@ -3061,6 +3120,130 @@ function resolveRailHeading(cards, fallback) {
|
|
|
3061
3120
|
return keep;
|
|
3062
3121
|
}
|
|
3063
3122
|
}
|
|
3123
|
+
function isProductCard(card) {
|
|
3124
|
+
if (!card || typeof card !== "object") return false;
|
|
3125
|
+
const meta = card.metadata;
|
|
3126
|
+
if (!meta || typeof meta !== "object") return false;
|
|
3127
|
+
const m2 = meta;
|
|
3128
|
+
return Boolean(m2.product_id || m2.sku);
|
|
3129
|
+
}
|
|
3130
|
+
function isProductRailCards(cards) {
|
|
3131
|
+
return cards.some(isProductCard);
|
|
3132
|
+
}
|
|
3133
|
+
function productRailOrder(cards) {
|
|
3134
|
+
const all = cards.map((card, index) => ({ card, index }));
|
|
3135
|
+
return [...all.filter((e) => isProductCard(e.card)), ...all.filter((e) => !isProductCard(e.card))];
|
|
3136
|
+
}
|
|
3137
|
+
function productRailAccent(ctx) {
|
|
3138
|
+
return resolveAccent(ctx.campaign.background_color, ctx.sanitizeColor);
|
|
3139
|
+
}
|
|
3140
|
+
function clampOpt(v, lo, hi) {
|
|
3141
|
+
if (v === void 0 || v === null || v === "") return void 0;
|
|
3142
|
+
const n = Number(v);
|
|
3143
|
+
if (!Number.isFinite(n)) return void 0;
|
|
3144
|
+
return Math.max(lo, Math.min(hi, n));
|
|
3145
|
+
}
|
|
3146
|
+
function productRailStyle(ctx) {
|
|
3147
|
+
const ic = ctx.campaign.interactive_config || {};
|
|
3148
|
+
const tc = ctx.campaign.text_color;
|
|
3149
|
+
const wRaw = ic.heading_font_weight != null ? String(ic.heading_font_weight) : "";
|
|
3150
|
+
return {
|
|
3151
|
+
fg: typeof tc === "string" && tc.trim() ? ctx.sanitizeColor(tc.trim()) : "#0f172a",
|
|
3152
|
+
weight: ["400", "500", "600", "700", "800"].includes(wRaw) ? wRaw : "700",
|
|
3153
|
+
padX: clampOpt(ic.padding_x, 0, 32) ?? 0,
|
|
3154
|
+
padY: clampOpt(ic.padding_y, 0, 24) ?? 0,
|
|
3155
|
+
radius: clampOpt(ic.border_radius, 0, 24) ?? 0
|
|
3156
|
+
};
|
|
3157
|
+
}
|
|
3158
|
+
function renderProductRailSection(ctx, target, opts) {
|
|
3159
|
+
const { campaign } = ctx;
|
|
3160
|
+
const style = productRailStyle(ctx);
|
|
3161
|
+
const fg = style.fg;
|
|
3162
|
+
const accent = productRailAccent(ctx);
|
|
3163
|
+
const layout = opts.layout || "row";
|
|
3164
|
+
const section = document.createElement("section");
|
|
3165
|
+
section.className = opts.className;
|
|
3166
|
+
section.setAttribute("data-campaign-id", campaign.id);
|
|
3167
|
+
section.setAttribute("data-aegis-rail-chrome", "section");
|
|
3168
|
+
section.style.cssText = `
|
|
3169
|
+
${fontFamilyCss("body")}
|
|
3170
|
+
color: ${fg};
|
|
3171
|
+
${style.padX || style.padY ? `padding: ${style.padY}px ${style.padX}px;` : ""}
|
|
3172
|
+
${style.radius ? `border-radius: ${style.radius}px;` : ""}
|
|
3173
|
+
`;
|
|
3174
|
+
if (opts.heading) {
|
|
3175
|
+
const title = document.createElement("h2");
|
|
3176
|
+
title.textContent = opts.heading;
|
|
3177
|
+
title.setAttribute("data-aegis-rail-heading", "");
|
|
3178
|
+
title.style.cssText = `font-weight: ${style.weight}; font-size: 16px; margin: 0 0 2px; color: ${fg};`;
|
|
3179
|
+
section.appendChild(title);
|
|
3180
|
+
}
|
|
3181
|
+
if (opts.subtitle) {
|
|
3182
|
+
const body = document.createElement("div");
|
|
3183
|
+
body.textContent = opts.subtitle;
|
|
3184
|
+
body.setAttribute("data-aegis-rail-subtitle", "");
|
|
3185
|
+
body.style.cssText = "font-size: 13px; opacity: 0.65; line-height: 1.4; margin-bottom: 10px;";
|
|
3186
|
+
section.appendChild(body);
|
|
3187
|
+
}
|
|
3188
|
+
const strip = document.createElement("div");
|
|
3189
|
+
const isRow = layout !== "grid" && layout !== "list";
|
|
3190
|
+
if (layout === "grid") {
|
|
3191
|
+
strip.style.cssText = "display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;";
|
|
3192
|
+
} else if (layout === "list") {
|
|
3193
|
+
strip.style.cssText = "display: flex; flex-direction: column; gap: 10px;";
|
|
3194
|
+
} else {
|
|
3195
|
+
strip.style.cssText = `
|
|
3196
|
+
display: flex; gap: 10px; overflow-x: auto;
|
|
3197
|
+
scroll-snap-type: x proximity; padding: 2px 2px 12px; scroll-padding: 0 2px;
|
|
3198
|
+
-webkit-overflow-scrolling: touch; scrollbar-width: none;
|
|
3199
|
+
`;
|
|
3200
|
+
strip.style.msOverflowStyle = "none";
|
|
3201
|
+
}
|
|
3202
|
+
const order = opts.productsFirst ? productRailOrder(opts.cards) : opts.cards.map((card, index) => ({ card, index }));
|
|
3203
|
+
order.forEach(({ card: c, index: i }) => {
|
|
3204
|
+
const tile = renderCardFromTemplate(c, {
|
|
3205
|
+
template: opts.template,
|
|
3206
|
+
ctx,
|
|
3207
|
+
action: opts.actionFor(c, i),
|
|
3208
|
+
layout,
|
|
3209
|
+
layoutAccent: accent
|
|
3210
|
+
});
|
|
3211
|
+
tile.setAttribute("data-card-index", String(i));
|
|
3212
|
+
strip.appendChild(tile);
|
|
3213
|
+
});
|
|
3214
|
+
if (isRow && opts.cards.length > 2) {
|
|
3215
|
+
const wrap = document.createElement("div");
|
|
3216
|
+
wrap.style.cssText = "position: relative;";
|
|
3217
|
+
wrap.appendChild(strip);
|
|
3218
|
+
const arrow = document.createElement("button");
|
|
3219
|
+
arrow.type = "button";
|
|
3220
|
+
arrow.setAttribute("aria-label", "Scroll for more");
|
|
3221
|
+
arrow.innerHTML = "›";
|
|
3222
|
+
arrow.style.cssText = `
|
|
3223
|
+
position: absolute; top: 50%; right: 0; transform: translateY(-50%);
|
|
3224
|
+
width: 30px; height: 30px; border-radius: 999px; border: 1px solid color-mix(in srgb, ${fg} 10%, transparent);
|
|
3225
|
+
background: #fff; color: ${fg}; font-size: 18px; line-height: 1; cursor: pointer;
|
|
3226
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.12); display: flex; align-items: center;
|
|
3227
|
+
justify-content: center; z-index: 2;
|
|
3228
|
+
`;
|
|
3229
|
+
arrow.addEventListener("click", (e) => {
|
|
3230
|
+
e.stopPropagation();
|
|
3231
|
+
strip.scrollBy({ left: Math.round(strip.clientWidth * 0.8), behavior: "smooth" });
|
|
3232
|
+
});
|
|
3233
|
+
const syncArrow = () => {
|
|
3234
|
+
const atEnd = strip.scrollLeft + strip.clientWidth >= strip.scrollWidth - 8;
|
|
3235
|
+
arrow.style.display = atEnd ? "none" : "flex";
|
|
3236
|
+
};
|
|
3237
|
+
strip.addEventListener("scroll", syncArrow, { passive: true });
|
|
3238
|
+
setTimeout(syncArrow, 0);
|
|
3239
|
+
wrap.appendChild(arrow);
|
|
3240
|
+
section.appendChild(wrap);
|
|
3241
|
+
} else {
|
|
3242
|
+
section.appendChild(strip);
|
|
3243
|
+
}
|
|
3244
|
+
target.appendChild(section);
|
|
3245
|
+
return { section, strip };
|
|
3246
|
+
}
|
|
3064
3247
|
const MAX_PRODUCTS = 24;
|
|
3065
3248
|
function renderProductRecommendation(ctx) {
|
|
3066
3249
|
const { campaign, trackEvent, sanitizeColor, log, addAnimationStyles } = ctx;
|
|
@@ -3077,7 +3260,7 @@ function renderProductRecommendation(ctx) {
|
|
|
3077
3260
|
addAnimationStyles();
|
|
3078
3261
|
const bg = "#ffffff";
|
|
3079
3262
|
const fg = "#0f172a";
|
|
3080
|
-
const accent =
|
|
3263
|
+
const accent = resolveAccent(campaign.background_color, sanitizeColor);
|
|
3081
3264
|
const overlay = document.createElement("div");
|
|
3082
3265
|
overlay.className = "aegis-in-app-product-rec";
|
|
3083
3266
|
overlay.setAttribute("data-campaign-id", campaign.id);
|
|
@@ -3160,7 +3343,7 @@ function renderProductRecommendation(ctx) {
|
|
|
3160
3343
|
document.body.appendChild(overlay);
|
|
3161
3344
|
}
|
|
3162
3345
|
function renderProductRecommendationInline(ctx, target) {
|
|
3163
|
-
const { campaign,
|
|
3346
|
+
const { campaign, addAnimationStyles, log } = ctx;
|
|
3164
3347
|
const ic = campaign.interactive_config || {};
|
|
3165
3348
|
const rawCards = Array.isArray(ic.cards) ? ic.cards : [];
|
|
3166
3349
|
const cards = rawCards.slice(0, MAX_PRODUCTS);
|
|
@@ -3169,79 +3352,16 @@ function renderProductRecommendationInline(ctx, target) {
|
|
|
3169
3352
|
return false;
|
|
3170
3353
|
}
|
|
3171
3354
|
const rail = resolveRailHeading(cards, campaign.title);
|
|
3172
|
-
const layout = ic.rec_layout || "row";
|
|
3173
|
-
const template = resolveGlobalTemplate(ic);
|
|
3174
|
-
const fg = "#0f172a";
|
|
3175
|
-
const accent = sanitizeColor(campaign.background_color || "#4169e1");
|
|
3176
3355
|
addAnimationStyles();
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
const title = document.createElement("h2");
|
|
3186
|
-
title.textContent = rail.heading;
|
|
3187
|
-
title.style.cssText = "font-weight: 700; font-size: 16px; margin: 0 0 2px;";
|
|
3188
|
-
section.appendChild(title);
|
|
3189
|
-
}
|
|
3190
|
-
if (campaign.body) {
|
|
3191
|
-
const body = document.createElement("div");
|
|
3192
|
-
body.textContent = campaign.body;
|
|
3193
|
-
body.style.cssText = "font-size: 13px; opacity: 0.65; line-height: 1.4; margin-bottom: 10px;";
|
|
3194
|
-
section.appendChild(body);
|
|
3195
|
-
}
|
|
3196
|
-
const grid = document.createElement("div");
|
|
3197
|
-
const isRow = layout === "row" || layout !== "grid" && layout !== "list";
|
|
3198
|
-
if (layout === "grid") {
|
|
3199
|
-
grid.style.cssText = "display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;";
|
|
3200
|
-
} else if (layout === "list") {
|
|
3201
|
-
grid.style.cssText = "display: flex; flex-direction: column; gap: 10px;";
|
|
3202
|
-
} else {
|
|
3203
|
-
grid.style.cssText = `
|
|
3204
|
-
display: flex; gap: 10px; overflow-x: auto;
|
|
3205
|
-
scroll-snap-type: x proximity; padding: 10px 8px 18px; margin: -8px -8px -6px;
|
|
3206
|
-
-webkit-overflow-scrolling: touch; scrollbar-width: none;
|
|
3207
|
-
`;
|
|
3208
|
-
grid.style.msOverflowStyle = "none";
|
|
3209
|
-
}
|
|
3210
|
-
cards.forEach((c) => {
|
|
3211
|
-
grid.appendChild(
|
|
3212
|
-
renderCardFromTemplate(c, { template, ctx, action: "cart", layout, layoutAccent: accent })
|
|
3213
|
-
);
|
|
3356
|
+
renderProductRailSection(ctx, target, {
|
|
3357
|
+
heading: rail.heading,
|
|
3358
|
+
subtitle: campaign.body,
|
|
3359
|
+
cards,
|
|
3360
|
+
layout: ic.rec_layout || "row",
|
|
3361
|
+
template: resolveGlobalTemplate(ic),
|
|
3362
|
+
className: "aegis-in-app-product-rec-inline",
|
|
3363
|
+
actionFor: () => "cart"
|
|
3214
3364
|
});
|
|
3215
|
-
if (isRow && cards.length > 2) {
|
|
3216
|
-
const wrap = document.createElement("div");
|
|
3217
|
-
wrap.style.cssText = "position: relative;";
|
|
3218
|
-
wrap.appendChild(grid);
|
|
3219
|
-
const arrow = document.createElement("button");
|
|
3220
|
-
arrow.setAttribute("aria-label", "Scroll for more");
|
|
3221
|
-
arrow.innerHTML = "›";
|
|
3222
|
-
arrow.style.cssText = `
|
|
3223
|
-
position: absolute; top: 50%; right: 0; transform: translateY(-50%);
|
|
3224
|
-
width: 30px; height: 30px; border-radius: 999px; border: 1px solid ${fg}1a;
|
|
3225
|
-
background: #fff; color: ${fg}; font-size: 18px; line-height: 1; cursor: pointer;
|
|
3226
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.12); display: flex; align-items: center;
|
|
3227
|
-
justify-content: center; z-index: 2;
|
|
3228
|
-
`;
|
|
3229
|
-
arrow.addEventListener("click", (e) => {
|
|
3230
|
-
e.stopPropagation();
|
|
3231
|
-
grid.scrollBy({ left: Math.round(grid.clientWidth * 0.8), behavior: "smooth" });
|
|
3232
|
-
});
|
|
3233
|
-
const syncArrow = () => {
|
|
3234
|
-
const atEnd = grid.scrollLeft + grid.clientWidth >= grid.scrollWidth - 8;
|
|
3235
|
-
arrow.style.display = atEnd ? "none" : "flex";
|
|
3236
|
-
};
|
|
3237
|
-
grid.addEventListener("scroll", syncArrow, { passive: true });
|
|
3238
|
-
setTimeout(syncArrow, 0);
|
|
3239
|
-
wrap.appendChild(arrow);
|
|
3240
|
-
section.appendChild(wrap);
|
|
3241
|
-
} else {
|
|
3242
|
-
section.appendChild(grid);
|
|
3243
|
-
}
|
|
3244
|
-
target.appendChild(section);
|
|
3245
3365
|
return true;
|
|
3246
3366
|
}
|
|
3247
3367
|
const MAX_GROUPS = 12;
|
|
@@ -4702,8 +4822,9 @@ function renderVideoInline(ctx, target) {
|
|
|
4702
4822
|
return true;
|
|
4703
4823
|
}
|
|
4704
4824
|
const HEX = /^#[0-9a-fA-F]{3,8}$/;
|
|
4705
|
-
|
|
4706
|
-
|
|
4825
|
+
const RADIUS_PX = { none: 0, lg: 8, xl: 12, "2xl": 16 };
|
|
4826
|
+
function heroRadiusPx(radius) {
|
|
4827
|
+
return radius !== void 0 && Object.prototype.hasOwnProperty.call(RADIUS_PX, radius) ? RADIUS_PX[radius] : void 0;
|
|
4707
4828
|
}
|
|
4708
4829
|
const ASPECT = { "16:9": "16 / 9", "4:3": "4 / 3", "21:9": "21 / 9" };
|
|
4709
4830
|
const HERO_DESKTOP_RATIO = "8 / 3";
|
|
@@ -4721,7 +4842,7 @@ function _injectHeroResponsiveCss() {
|
|
|
4721
4842
|
if (document.getElementById("aegis-hero-style")) return;
|
|
4722
4843
|
const style = document.createElement("style");
|
|
4723
4844
|
style.id = "aegis-hero-style";
|
|
4724
|
-
style.textContent = `.aegis-hero-root{border-radius:16px;}.aegis-hero-auto{min-height:300px;}@media (max-width:${HERO_PHONE_MAX_WIDTH_PX}px){.aegis-hero-auto.aegis-hero-phone-square{min-height:0;aspect-ratio:${HERO_PHONE_RATIO};}}@media (min-width:${HERO_PHONE_MAX_WIDTH_PX + 1}px){.aegis-hero-root{border-radius:0;min-height:0;max-height:70vh;aspect-ratio:${HERO_DESKTOP_RATIO} !important;}}`;
|
|
4845
|
+
style.textContent = `.aegis-hero-root{border-radius:var(--aegis-hero-radius,16px);}.aegis-hero-auto{min-height:300px;}@media (max-width:${HERO_PHONE_MAX_WIDTH_PX}px){.aegis-hero-auto.aegis-hero-phone-square{min-height:0;aspect-ratio:${HERO_PHONE_RATIO};}}@media (min-width:${HERO_PHONE_MAX_WIDTH_PX + 1}px){.aegis-hero-root{border-radius:0;min-height:0;max-height:70vh;aspect-ratio:${HERO_DESKTOP_RATIO} !important;}}`;
|
|
4725
4846
|
document.head.appendChild(style);
|
|
4726
4847
|
}
|
|
4727
4848
|
function srcsetUrl$1(url) {
|
|
@@ -4752,38 +4873,103 @@ function cardUrl(c) {
|
|
|
4752
4873
|
if (t && t.value) return t.type === "category" ? `?category=${encodeURIComponent(t.value)}` : t.value;
|
|
4753
4874
|
return "";
|
|
4754
4875
|
}
|
|
4876
|
+
function announcementContent(campaign, card) {
|
|
4877
|
+
const ic = campaign.interactive_config || {};
|
|
4878
|
+
const head = card ? cardHeadline(card) : campaign.title || "";
|
|
4879
|
+
const sub = card ? cardSub(card) : campaign.body || "";
|
|
4880
|
+
const text = [head, sub].filter(Boolean).join(" · ");
|
|
4881
|
+
const coupon = typeof ic.coupon_code === "string" ? ic.coupon_code.trim() : "";
|
|
4882
|
+
const ctaUrl = (card ? cardUrl(card) : "") || campaign.action_url || "";
|
|
4883
|
+
const ctaText = (card ? cardCta(card) : "") || campaign.button_text || (ctaUrl ? "Order now" : "");
|
|
4884
|
+
if (!text && !coupon && !ctaText) return null;
|
|
4885
|
+
return { text, coupon, ctaText, ctaUrl };
|
|
4886
|
+
}
|
|
4887
|
+
function _injectAnnouncementCss() {
|
|
4888
|
+
if (typeof document === "undefined" || !document.head) return;
|
|
4889
|
+
if (document.getElementById("aegis-announcement-style")) return;
|
|
4890
|
+
const style = document.createElement("style");
|
|
4891
|
+
style.id = "aegis-announcement-style";
|
|
4892
|
+
style.textContent = `@media (min-width:${HERO_PHONE_MAX_WIDTH_PX + 1}px){.aegis-announcement-bar{flex-wrap:nowrap !important;}.aegis-announcement-text{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.aegis-announcement-coupon,.aegis-announcement-cta{flex:none;}}`;
|
|
4893
|
+
document.head.appendChild(style);
|
|
4894
|
+
}
|
|
4895
|
+
function renderAnnouncementBar(ctx, card, accent) {
|
|
4896
|
+
const { campaign, sanitizeUrl: sanitizeUrl2, trackEvent } = ctx;
|
|
4897
|
+
const content = announcementContent(campaign, card);
|
|
4898
|
+
if (!content) return null;
|
|
4899
|
+
_injectAnnouncementCss();
|
|
4900
|
+
const bar = document.createElement("div");
|
|
4901
|
+
bar.className = "aegis-announcement-bar";
|
|
4902
|
+
bar.setAttribute("data-campaign-id", campaign.id);
|
|
4903
|
+
bar.style.cssText = `display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;column-gap:10px;row-gap:4px;min-height:34px;box-sizing:border-box;background:${accent};color:#fff;padding:7px 16px;font-weight:600;font-size:13px;line-height:1.35;${fontFamilyCss("body")}text-align:left;`;
|
|
4904
|
+
if (content.text) {
|
|
4905
|
+
const t = document.createElement("span");
|
|
4906
|
+
t.className = "aegis-announcement-text";
|
|
4907
|
+
t.setAttribute("data-aegis-announcement-text", "");
|
|
4908
|
+
t.style.cssText = "min-width:0;overflow-wrap:anywhere;";
|
|
4909
|
+
t.textContent = content.text;
|
|
4910
|
+
bar.appendChild(t);
|
|
4911
|
+
}
|
|
4912
|
+
if (content.coupon) {
|
|
4913
|
+
const chip = document.createElement("button");
|
|
4914
|
+
chip.type = "button";
|
|
4915
|
+
chip.className = "aegis-announcement-coupon";
|
|
4916
|
+
chip.setAttribute("data-aegis-announcement-coupon", "");
|
|
4917
|
+
chip.setAttribute("aria-label", `Copy code ${content.coupon}`);
|
|
4918
|
+
chip.style.cssText = "border:1px dashed rgba(255,255,255,0.75);background:rgba(255,255,255,0.14);color:inherit;border-radius:6px;padding:1px 8px;font:inherit;font-family:ui-monospace,monospace;font-size:12px;letter-spacing:0.04em;cursor:pointer;white-space:nowrap;";
|
|
4919
|
+
chip.textContent = content.coupon;
|
|
4920
|
+
chip.addEventListener("click", (e) => {
|
|
4921
|
+
var _a;
|
|
4922
|
+
e.stopPropagation();
|
|
4923
|
+
try {
|
|
4924
|
+
void ((_a = navigator.clipboard) == null ? void 0 : _a.writeText(content.coupon));
|
|
4925
|
+
chip.textContent = "Copied";
|
|
4926
|
+
} catch {
|
|
4927
|
+
}
|
|
4928
|
+
setTimeout(() => {
|
|
4929
|
+
chip.textContent = content.coupon;
|
|
4930
|
+
}, 1500);
|
|
4931
|
+
});
|
|
4932
|
+
bar.appendChild(chip);
|
|
4933
|
+
}
|
|
4934
|
+
const url = content.ctaUrl ? sanitizeUrl2(content.ctaUrl) : "";
|
|
4935
|
+
if (url && content.ctaText) {
|
|
4936
|
+
const a = document.createElement("a");
|
|
4937
|
+
a.className = "aegis-announcement-cta";
|
|
4938
|
+
a.setAttribute("data-aegis-announcement-cta", "");
|
|
4939
|
+
a.href = url;
|
|
4940
|
+
a.style.cssText = "color:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer;white-space:nowrap;font-weight:700;";
|
|
4941
|
+
a.textContent = `${content.ctaText} ›`;
|
|
4942
|
+
a.addEventListener("click", (e) => {
|
|
4943
|
+
e.preventDefault();
|
|
4944
|
+
trackEvent(campaign.id, "clicked");
|
|
4945
|
+
if (ctx.navigate) ctx.navigate(url);
|
|
4946
|
+
else if (typeof window !== "undefined") window.location.assign(url);
|
|
4947
|
+
});
|
|
4948
|
+
bar.appendChild(a);
|
|
4949
|
+
}
|
|
4950
|
+
return bar;
|
|
4951
|
+
}
|
|
4952
|
+
function heroAccent(chrome, backgroundColor) {
|
|
4953
|
+
if (chrome.accent && chrome.accent !== "brand" && HEX.test(chrome.accent)) return chrome.accent;
|
|
4954
|
+
if (backgroundColor && HEX.test(backgroundColor)) return backgroundColor;
|
|
4955
|
+
return brandAccentCss();
|
|
4956
|
+
}
|
|
4755
4957
|
function renderHeroInline(ctx, target) {
|
|
4756
4958
|
const { campaign, sanitizeUrl: sanitizeUrl2, trackEvent } = ctx;
|
|
4757
4959
|
const ic = campaign.interactive_config || {};
|
|
4758
4960
|
const cards = Array.isArray(ic.cards) ? ic.cards : [];
|
|
4759
|
-
if (cards.length === 0) return false;
|
|
4760
4961
|
const chrome = ic.chrome || {};
|
|
4761
|
-
const accent =
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
);
|
|
4765
|
-
const variant = chrome.variant ?? "hero_fullbleed";
|
|
4962
|
+
const accent = heroAccent(chrome, campaign.background_color);
|
|
4963
|
+
const isAnnouncement = campaign.widget_category === "announcement";
|
|
4964
|
+
const variant = chrome.variant ?? (isAnnouncement ? "announcement_bar" : "hero_fullbleed");
|
|
4766
4965
|
if (variant === "announcement_bar") {
|
|
4767
|
-
const
|
|
4768
|
-
|
|
4769
|
-
bar.style.cssText = `display:flex;align-items:center;justify-content:center;gap:10px;background:${accent};color:#fff;padding:8px 14px;font-weight:600;font-size:13px;line-height:1.3;${fontFamilyCss("body")}text-align:center;`;
|
|
4770
|
-
bar.textContent = [cardHeadline(c), cardSub(c)].filter(Boolean).join(" · ");
|
|
4771
|
-
const url = sanitizeUrl2(cardUrl(c));
|
|
4772
|
-
if (url && cardCta(c)) {
|
|
4773
|
-
const a = document.createElement("span");
|
|
4774
|
-
a.style.cssText = "text-decoration:underline;cursor:pointer;white-space:nowrap;";
|
|
4775
|
-
a.textContent = cardCta(c);
|
|
4776
|
-
a.addEventListener("click", () => {
|
|
4777
|
-
var _a;
|
|
4778
|
-
trackEvent(campaign.id, "clicked");
|
|
4779
|
-
(_a = ctx.navigate) == null ? void 0 : _a.call(ctx, url);
|
|
4780
|
-
});
|
|
4781
|
-
bar.appendChild(a);
|
|
4782
|
-
}
|
|
4966
|
+
const bar = renderAnnouncementBar(ctx, cards[0] ?? null, accent);
|
|
4967
|
+
if (!bar) return false;
|
|
4783
4968
|
target.appendChild(bar);
|
|
4784
4969
|
trackEvent(campaign.id, "impression");
|
|
4785
4970
|
return true;
|
|
4786
4971
|
}
|
|
4972
|
+
if (cards.length === 0) return false;
|
|
4787
4973
|
_injectHeroResponsiveCss();
|
|
4788
4974
|
const explicitRatio = chrome.aspect_ratio ? ASPECT[chrome.aspect_ratio] : void 0;
|
|
4789
4975
|
const hasPhoneImage = cards.some(
|
|
@@ -4791,7 +4977,8 @@ function renderHeroInline(ctx, target) {
|
|
|
4791
4977
|
);
|
|
4792
4978
|
const root = document.createElement("div");
|
|
4793
4979
|
root.className = explicitRatio ? "aegis-hero-root" : `aegis-hero-root aegis-hero-auto${hasPhoneImage ? " aegis-hero-phone-square" : ""}`;
|
|
4794
|
-
|
|
4980
|
+
const radiusPx = heroRadiusPx(chrome.radius);
|
|
4981
|
+
root.style.cssText = `position:relative;width:100%;overflow:hidden;box-shadow:0 1px 2px rgba(16,24,40,0.06);${explicitRatio ? `aspect-ratio:${explicitRatio};` : ""}${radiusPx !== void 0 ? `--aegis-hero-radius:${radiusPx}px;` : ""}`;
|
|
4795
4982
|
root.setAttribute("data-campaign-id", campaign.id);
|
|
4796
4983
|
const track = document.createElement("div");
|
|
4797
4984
|
track.style.cssText = "display:flex;height:100%;width:100%;transition:transform 0.5s ease;";
|
|
@@ -7737,12 +7924,17 @@ function renderReviewsInline(ctx, target, creds) {
|
|
|
7737
7924
|
}
|
|
7738
7925
|
function renderReviewsOverlay(ctx, creds) {
|
|
7739
7926
|
if (typeof document === "undefined" || !(creds == null ? void 0 : creds.apiHost) || !(creds == null ? void 0 : creds.writeKey)) return;
|
|
7927
|
+
injectOverlayLayoutCss();
|
|
7740
7928
|
const overlay = document.createElement("div");
|
|
7929
|
+
overlay.className = "aegis-sheet-overlay";
|
|
7741
7930
|
overlay.setAttribute("data-campaign-id", ctx.campaign.id);
|
|
7742
7931
|
overlay.style.cssText = "position:fixed;inset:0;background:rgba(17,24,39,0.5);display:flex;align-items:flex-end;justify-content:center;z-index:99999;";
|
|
7743
7932
|
const sheet = document.createElement("div");
|
|
7933
|
+
sheet.className = "aegis-sheet";
|
|
7744
7934
|
sheet.style.cssText = `background:#fff;color:#111827;max-width:680px;width:100%;max-height:84vh;overflow-y:auto;border-radius:24px 24px 0 0;padding:18px 18px 28px;${fontFamilyCss("body")}box-shadow:0 -16px 40px rgba(0,0,0,0.14);`;
|
|
7745
|
-
|
|
7935
|
+
const grabber = el("div", "width:38px;height:4px;border-radius:999px;background:#e5e7eb;margin:0 auto 14px;");
|
|
7936
|
+
grabber.className = "aegis-sheet-grabber";
|
|
7937
|
+
sheet.appendChild(grabber);
|
|
7746
7938
|
const bar = el("div", "display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;");
|
|
7747
7939
|
bar.appendChild(el("div", "font-weight:800;font-size:17px;", ctx.campaign.title || "Customer reviews"));
|
|
7748
7940
|
const close = el("button", "background:none;border:none;cursor:pointer;padding:4px 8px;color:#6b7280;");
|
|
@@ -8130,6 +8322,21 @@ function pickSlotWinners(campaigns, opts = {}) {
|
|
|
8130
8322
|
});
|
|
8131
8323
|
return out;
|
|
8132
8324
|
}
|
|
8325
|
+
function slotKind(c) {
|
|
8326
|
+
const sub = typeof c.sub_type === "string" ? c.sub_type.trim() : "";
|
|
8327
|
+
if (sub && sub !== "standard") return sub;
|
|
8328
|
+
return typeof c.type === "string" ? c.type : "";
|
|
8329
|
+
}
|
|
8330
|
+
function stepsAsFormFields(ic, title) {
|
|
8331
|
+
const raw = Array.isArray(ic.steps) ? ic.steps : [];
|
|
8332
|
+
const steps = raw.length > 0 ? raw : [{ question: title || "Tell us more", options: [] }];
|
|
8333
|
+
return steps.map((step, i) => {
|
|
8334
|
+
const key = typeof step.key === "string" && step.key ? step.key : `step_${i + 1}`;
|
|
8335
|
+
const label = typeof step.question === "string" && step.question || typeof step.label === "string" && step.label || `Step ${i + 1}`;
|
|
8336
|
+
const options = Array.isArray(step.options) ? step.options.filter((o) => typeof o === "string" && o !== "") : [];
|
|
8337
|
+
return options.length > 0 ? { key, label, type: "select", options, required: step.required === true } : { key, label, type: "text", required: step.required === true };
|
|
8338
|
+
});
|
|
8339
|
+
}
|
|
8133
8340
|
const SECTION_SPOT_SELECTOR_PREFIX = "[data-aegis-section-spot=";
|
|
8134
8341
|
function isSectionSpotSelector(selector) {
|
|
8135
8342
|
return typeof selector === "string" && selector.trim().startsWith(SECTION_SPOT_SELECTOR_PREFIX);
|
|
@@ -10365,16 +10572,17 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
10365
10572
|
return;
|
|
10366
10573
|
}
|
|
10367
10574
|
this._ensureSurveyTemplate(campaign);
|
|
10368
|
-
const
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
} else if (campaign.widget_category === "hero") {
|
|
10575
|
+
const kind = slotKind(campaign);
|
|
10576
|
+
const _isMultiCard = kind === "product_recommendation" || kind === "carousel_cards";
|
|
10577
|
+
if (campaign.widget_category === "hero" || campaign.widget_category === "announcement") {
|
|
10372
10578
|
const heroCtx = this.buildRenderContext(campaign);
|
|
10373
10579
|
const heroSlot = target.closest("[data-aegis-slot]");
|
|
10374
10580
|
heroCtx.shellImage = heroSlot ? this.shellHeroImages.get(heroSlot) ?? null : null;
|
|
10375
10581
|
rendered = renderHeroInline(heroCtx, target);
|
|
10582
|
+
} else if (this._hasComposedTemplate(ic) && !_isMultiCard) {
|
|
10583
|
+
rendered = this.renderComposedCardSlot(campaign, ic, target);
|
|
10376
10584
|
} else
|
|
10377
|
-
switch (
|
|
10585
|
+
switch (kind) {
|
|
10378
10586
|
// P6.full — star_rating / nps_survey / quick_poll slots route through the
|
|
10379
10587
|
// unified composed-card slot engine via `_ensureSurveyTemplate` (the gate
|
|
10380
10588
|
// above), so the bespoke *Slot survey renderers are RETIRED.
|
|
@@ -10413,16 +10621,20 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
10413
10621
|
writeKey: this.writeKey
|
|
10414
10622
|
});
|
|
10415
10623
|
break;
|
|
10624
|
+
case "multi_step_form": {
|
|
10625
|
+
const stepFields = stepsAsFormFields(ic, campaign.title);
|
|
10626
|
+
rendered = this.renderFormSlot(campaign, stepFields, bg, text, target);
|
|
10627
|
+
break;
|
|
10628
|
+
}
|
|
10416
10629
|
case "quiz":
|
|
10417
10630
|
rendered = this.renderQuizSlot(campaign, ic, bg, text, target);
|
|
10418
10631
|
if (!rendered) {
|
|
10419
10632
|
rendered = this.renderGenericCardSlot(campaign, ic, bg, text, target);
|
|
10420
10633
|
}
|
|
10421
10634
|
break;
|
|
10422
|
-
// Remaining
|
|
10423
|
-
//
|
|
10424
|
-
//
|
|
10425
|
-
// here as merchants need them.
|
|
10635
|
+
// Remaining kinds (sticky_bar, pip, banner, modal, ...) render as a
|
|
10636
|
+
// generic card in a slot (the overlay path handles their full UX);
|
|
10637
|
+
// dedicated slot variants get added here as merchants need them.
|
|
10426
10638
|
default:
|
|
10427
10639
|
rendered = this.renderGenericCardSlot(campaign, ic, bg, text, target);
|
|
10428
10640
|
break;
|
|
@@ -10541,7 +10753,9 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
10541
10753
|
template,
|
|
10542
10754
|
ctx,
|
|
10543
10755
|
action: "navigate",
|
|
10544
|
-
|
|
10756
|
+
// The palette accent may be the brand var expression: never pass it
|
|
10757
|
+
// through sanitizeColor (which turns var() into #000000).
|
|
10758
|
+
layoutAccent: campaign.background_color ? this.sanitizeColor(campaign.background_color) : accent
|
|
10545
10759
|
});
|
|
10546
10760
|
target.appendChild(tile);
|
|
10547
10761
|
return true;
|
|
@@ -10581,7 +10795,9 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
10581
10795
|
template,
|
|
10582
10796
|
ctx: this.buildRenderContext(campaign),
|
|
10583
10797
|
action: "navigate",
|
|
10584
|
-
|
|
10798
|
+
// The palette accent may be the brand var expression: never pass it
|
|
10799
|
+
// through sanitizeColor (which turns var() into #000000).
|
|
10800
|
+
layoutAccent: campaign.background_color ? this.sanitizeColor(campaign.background_color) : accent
|
|
10585
10801
|
});
|
|
10586
10802
|
modal.appendChild(tile);
|
|
10587
10803
|
this._addCornerClose(modal, overlay, campaign.id, text);
|
|
@@ -10674,7 +10890,8 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
10674
10890
|
if (buttonText) {
|
|
10675
10891
|
const btn = document.createElement("button");
|
|
10676
10892
|
btn.textContent = buttonText;
|
|
10677
|
-
|
|
10893
|
+
const pal = this._surfacePalette(campaign);
|
|
10894
|
+
btn.style.cssText = `margin-top: 2px; align-self: flex-start; padding: 8px 14px; border-radius: ${st.btnRadius ?? 9}px; border: none; background: ${pal.btnBg}; color: ${pal.btnText}; font-size: 13px; font-weight: 600; cursor: pointer;`;
|
|
10678
10895
|
btn.addEventListener("click", () => {
|
|
10679
10896
|
void this.trackEvent(campaign.id, "clicked");
|
|
10680
10897
|
if (actionUrl) window.open(actionUrl, "_blank", "noopener");
|
|
@@ -11648,16 +11865,31 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
11648
11865
|
* reuses the same shape as the In-App carousel editor authors.
|
|
11649
11866
|
*/
|
|
11650
11867
|
renderCarouselCardsSlot(campaign, ic, bg, text, target) {
|
|
11868
|
+
const cards = Array.isArray(ic.cards) ? ic.cards : [];
|
|
11869
|
+
const layout = ic.rec_layout || "row";
|
|
11870
|
+
if (isProductRailCards(cards)) {
|
|
11871
|
+
const ctx2 = this.buildRenderContext(campaign);
|
|
11872
|
+
const { strip: strip2 } = renderProductRailSection(ctx2, target, {
|
|
11873
|
+
heading: resolveRailHeading(cards, campaign.title).heading,
|
|
11874
|
+
subtitle: campaign.body,
|
|
11875
|
+
cards,
|
|
11876
|
+
layout,
|
|
11877
|
+
template: resolveGlobalTemplate(ic),
|
|
11878
|
+
className: "aegis-in-app-carousel-rail",
|
|
11879
|
+
actionFor: (c) => isProductCard(c) ? "cart" : "navigate",
|
|
11880
|
+
productsFirst: true
|
|
11881
|
+
});
|
|
11882
|
+
this._carouselAutoplay(ic, layout, cards.length, strip2);
|
|
11883
|
+
return true;
|
|
11884
|
+
}
|
|
11651
11885
|
const st = this._slotStyle(campaign);
|
|
11652
11886
|
const card = this._wrapInSlotCard("aegis-in-app-carousel-card", campaign.id, bg, text, st.radius);
|
|
11653
|
-
const cards = Array.isArray(ic.cards) ? ic.cards : [];
|
|
11654
11887
|
if (campaign.title) {
|
|
11655
11888
|
const h = document.createElement("div");
|
|
11656
11889
|
h.style.cssText = `padding: ${st.padY ?? 12}px ${st.padX ?? 12}px 0; font-size: 13px; font-weight: ${st.weight ?? "700"};`;
|
|
11657
11890
|
h.textContent = campaign.title;
|
|
11658
11891
|
card.appendChild(h);
|
|
11659
11892
|
}
|
|
11660
|
-
const layout = ic.rec_layout || "row";
|
|
11661
11893
|
const strip = document.createElement("div");
|
|
11662
11894
|
const pad = `${st.padY ?? 12}px ${st.padX ?? 12}px`;
|
|
11663
11895
|
if (layout === "grid") {
|
|
@@ -11685,8 +11917,19 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
11685
11917
|
});
|
|
11686
11918
|
card.appendChild(strip);
|
|
11687
11919
|
target.appendChild(card);
|
|
11920
|
+
this._carouselAutoplay(ic, layout, cards.length, strip);
|
|
11921
|
+
return true;
|
|
11922
|
+
}
|
|
11923
|
+
/**
|
|
11924
|
+
* Carousel autoplay — only meaningful for the horizontal rail (grid/list show
|
|
11925
|
+
* all at once). Auto-advance one card at a time when the content actually
|
|
11926
|
+
* overflows (mobile: not all cards fit). Pauses on the first user interaction;
|
|
11927
|
+
* loops per `ic.loop`. Self-terminates when the strip detaches (no removal
|
|
11928
|
+
* event fires). Shared by the panel carousel and the product-rail carousel.
|
|
11929
|
+
*/
|
|
11930
|
+
_carouselAutoplay(ic, layout, cardCount, strip) {
|
|
11688
11931
|
const autoplayMs = Number(ic.autoplay_ms) || 0;
|
|
11689
|
-
if (layout === "row" && autoplayMs > 0 &&
|
|
11932
|
+
if (layout === "row" && autoplayMs > 0 && cardCount > 1) {
|
|
11690
11933
|
const loop = ic.loop !== false;
|
|
11691
11934
|
const interval = Math.max(autoplayMs, 600);
|
|
11692
11935
|
let idx = 0;
|
|
@@ -11722,7 +11965,6 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
11722
11965
|
(evt) => strip.addEventListener(evt, stop, { passive: true })
|
|
11723
11966
|
);
|
|
11724
11967
|
}
|
|
11725
|
-
return true;
|
|
11726
11968
|
}
|
|
11727
11969
|
/** Built-in embedded COUNTDOWN — live H:M:S digits that pulse red in the
|
|
11728
11970
|
* final stretch (<60s) to create urgency, plus the CTA. */
|
|
@@ -12173,7 +12415,7 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
12173
12415
|
*/
|
|
12174
12416
|
_slotStyle(campaign) {
|
|
12175
12417
|
const ic = campaign.interactive_config || {};
|
|
12176
|
-
const
|
|
12418
|
+
const clampOpt2 = (v, lo, hi) => {
|
|
12177
12419
|
if (v === void 0 || v === null || v === "") return void 0;
|
|
12178
12420
|
const n = Number(v);
|
|
12179
12421
|
if (!Number.isFinite(n)) return void 0;
|
|
@@ -12184,10 +12426,10 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
12184
12426
|
return {
|
|
12185
12427
|
bg: pal.bg,
|
|
12186
12428
|
text: pal.text,
|
|
12187
|
-
radius:
|
|
12188
|
-
padX:
|
|
12189
|
-
padY:
|
|
12190
|
-
btnRadius:
|
|
12429
|
+
radius: clampOpt2(ic.border_radius, 0, 24) ?? 12,
|
|
12430
|
+
padX: clampOpt2(ic.padding_x, 0, 32),
|
|
12431
|
+
padY: clampOpt2(ic.padding_y, 0, 24),
|
|
12432
|
+
btnRadius: clampOpt2(ic.button_radius, 0, 999),
|
|
12191
12433
|
weight: ["400", "500", "600", "700"].includes(wRaw) ? wRaw : void 0
|
|
12192
12434
|
};
|
|
12193
12435
|
}
|
|
@@ -12276,7 +12518,7 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
12276
12518
|
this.log(`campaign ${campaign.id} not drawn: overlays held by the host`);
|
|
12277
12519
|
return;
|
|
12278
12520
|
}
|
|
12279
|
-
const willShow = { target: "overlay" };
|
|
12521
|
+
const willShow = { target: "overlay", anchor: overlayAnchor(campaign) };
|
|
12280
12522
|
const proceed = this.emit("campaign-will-show", campaign, willShow);
|
|
12281
12523
|
if (!proceed) {
|
|
12282
12524
|
this.log(`campaign ${campaign.id} suppressed by campaign-will-show handler`);
|
|
@@ -13535,7 +13777,10 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
13535
13777
|
* fill when branded, CTA accent when clean. */
|
|
13536
13778
|
_surfacePalette(campaign) {
|
|
13537
13779
|
const ic = campaign.interactive_config || {};
|
|
13538
|
-
const
|
|
13780
|
+
const explicit = campaign.background_color ? this.sanitizeColor(campaign.background_color) : "";
|
|
13781
|
+
const hostBrand = explicit ? "" : readBrandAccent() || "";
|
|
13782
|
+
const brand = explicit || hostBrand || brandAccentCss();
|
|
13783
|
+
const brandInk = explicit || hostBrand ? this._contrastText(explicit || hostBrand) : "#ffffff";
|
|
13539
13784
|
const surface = ic.surface_style;
|
|
13540
13785
|
if (surface === "branded") {
|
|
13541
13786
|
const bg = brand;
|
|
@@ -13547,7 +13792,7 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
13547
13792
|
const text = campaign.text_color ? this.sanitizeColor(campaign.text_color) : "#ffffff";
|
|
13548
13793
|
return { bg, text, btnBg: "#ffffff", btnText: bg, accent: text, branded: false };
|
|
13549
13794
|
}
|
|
13550
|
-
return { bg: "#ffffff", text: "#0f172a", btnBg: brand, btnText:
|
|
13795
|
+
return { bg: "#ffffff", text: "#0f172a", btnBg: brand, btnText: brandInk, accent: brand, branded: false };
|
|
13551
13796
|
}
|
|
13552
13797
|
inAppStyle(campaign) {
|
|
13553
13798
|
const ic = campaign.interactive_config || {};
|
|
@@ -13583,7 +13828,7 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
13583
13828
|
const atBottom = ic.banner_position === "bottom";
|
|
13584
13829
|
banner.style.cssText = `
|
|
13585
13830
|
position: fixed;
|
|
13586
|
-
${atBottom ?
|
|
13831
|
+
${atBottom ? `bottom: ${bottomOffset(0)};` : "top: 0;"}
|
|
13587
13832
|
left: 0;
|
|
13588
13833
|
right: 0;
|
|
13589
13834
|
background: ${st.bg};
|
|
@@ -14255,15 +14500,17 @@ const _AegisInAppManager = class _AegisInAppManager {
|
|
|
14255
14500
|
// Corner → fixed-position CSS for the floating PiP card.
|
|
14256
14501
|
_pipCornerCss(position, gap) {
|
|
14257
14502
|
switch (position) {
|
|
14503
|
+
// Bottom corners sit above the host's dock / launcher / cart pill
|
|
14504
|
+
// (`--aegis-bottom-reserve`, overlay-layout.ts, 1.52.0).
|
|
14258
14505
|
case "bottom-left":
|
|
14259
|
-
return `bottom: ${gap}
|
|
14506
|
+
return `bottom: ${bottomOffset(gap)}; left: ${gap}px;`;
|
|
14260
14507
|
case "top-right":
|
|
14261
14508
|
return `top: ${gap}px; right: ${gap}px;`;
|
|
14262
14509
|
case "top-left":
|
|
14263
14510
|
return `top: ${gap}px; left: ${gap}px;`;
|
|
14264
14511
|
case "bottom-right":
|
|
14265
14512
|
default:
|
|
14266
|
-
return `bottom: ${gap}
|
|
14513
|
+
return `bottom: ${bottomOffset(gap)}; right: ${gap}px;`;
|
|
14267
14514
|
}
|
|
14268
14515
|
}
|
|
14269
14516
|
renderPIP(campaign) {
|
|
@@ -17995,7 +18242,7 @@ const _AegisMessageRuntime = class _AegisMessageRuntime {
|
|
|
17995
18242
|
this.initialized = false;
|
|
17996
18243
|
this.armedInAppTriggers = /* @__PURE__ */ new Set();
|
|
17997
18244
|
{
|
|
17998
|
-
const v = "1.
|
|
18245
|
+
const v = "1.52.0";
|
|
17999
18246
|
try {
|
|
18000
18247
|
globalThis.__AEGIS_SDK_VERSION__ = v;
|
|
18001
18248
|
} catch {
|
|
@@ -18490,6 +18737,8 @@ export {
|
|
|
18490
18737
|
AegisLoyaltyManager,
|
|
18491
18738
|
AegisMessageRuntime,
|
|
18492
18739
|
A as AegisWebPush,
|
|
18740
|
+
BOTTOM_RESERVE_VAR,
|
|
18741
|
+
BRAND_ACCENT_VAR,
|
|
18493
18742
|
B as BloomFilter,
|
|
18494
18743
|
BootstrapError,
|
|
18495
18744
|
DEFAULT_RAIL_TITLES,
|
|
@@ -18517,6 +18766,7 @@ export {
|
|
|
18517
18766
|
m as murmurhash3_x86_32,
|
|
18518
18767
|
onLauncherChange,
|
|
18519
18768
|
openChat,
|
|
18769
|
+
overlayAnchor,
|
|
18520
18770
|
parseAction,
|
|
18521
18771
|
readFirstPartyCookie,
|
|
18522
18772
|
renderPreview,
|