@active-reach/web-sdk 1.43.4 → 1.43.5
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/renderers/hero.d.ts.map +1 -1
- package/dist/index.js +30 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../../src/inapp/renderers/hero.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../../src/inapp/renderers/hero.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAiF7C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAmLjF"}
|
package/dist/index.js
CHANGED
|
@@ -4028,14 +4028,20 @@ function safeColor(c, fallback) {
|
|
|
4028
4028
|
return c && HEX.test(c) ? c : fallback;
|
|
4029
4029
|
}
|
|
4030
4030
|
const ASPECT = { "16:9": "16 / 9", "4:3": "4 / 3", "21:9": "21 / 9" };
|
|
4031
|
+
const HERO_DESKTOP_RATIO = "8 / 3";
|
|
4032
|
+
const HERO_PHONE_RATIO = "1 / 1";
|
|
4033
|
+
const HERO_PHONE_MAX_WIDTH_PX = 767;
|
|
4031
4034
|
function _injectHeroResponsiveCss() {
|
|
4032
4035
|
if (typeof document === "undefined") return;
|
|
4033
4036
|
if (document.getElementById("aegis-hero-style")) return;
|
|
4034
4037
|
const style = document.createElement("style");
|
|
4035
4038
|
style.id = "aegis-hero-style";
|
|
4036
|
-
style.textContent =
|
|
4039
|
+
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;}}`;
|
|
4037
4040
|
document.head.appendChild(style);
|
|
4038
4041
|
}
|
|
4042
|
+
function srcsetUrl(url) {
|
|
4043
|
+
return url.replace(/\s/g, "%20").replace(/,/g, "%2C");
|
|
4044
|
+
}
|
|
4039
4045
|
function cardHeadline(c) {
|
|
4040
4046
|
return c.headline ?? c.title ?? "";
|
|
4041
4047
|
}
|
|
@@ -4084,9 +4090,13 @@ function renderHeroInline(ctx, target) {
|
|
|
4084
4090
|
return true;
|
|
4085
4091
|
}
|
|
4086
4092
|
_injectHeroResponsiveCss();
|
|
4093
|
+
const explicitRatio = chrome.aspect_ratio ? ASPECT[chrome.aspect_ratio] : void 0;
|
|
4094
|
+
const hasPhoneImage = cards.some(
|
|
4095
|
+
(c) => !c.video_url && c.media_type !== "video" && !!c.image_url_mobile && !!sanitizeUrl(c.image_url_mobile)
|
|
4096
|
+
);
|
|
4087
4097
|
const root = document.createElement("div");
|
|
4088
|
-
root.className = "aegis-hero-root"
|
|
4089
|
-
root.style.cssText = `position:relative;width:100%;overflow:hidden;box-shadow:0 1px 2px rgba(16,24,40,0.06);${
|
|
4098
|
+
root.className = explicitRatio ? "aegis-hero-root" : `aegis-hero-root aegis-hero-auto${hasPhoneImage ? " aegis-hero-phone-square" : ""}`;
|
|
4099
|
+
root.style.cssText = `position:relative;width:100%;overflow:hidden;box-shadow:0 1px 2px rgba(16,24,40,0.06);${explicitRatio ? `aspect-ratio:${explicitRatio};` : ""}`;
|
|
4090
4100
|
root.setAttribute("data-campaign-id", campaign.id);
|
|
4091
4101
|
const track = document.createElement("div");
|
|
4092
4102
|
track.style.cssText = "display:flex;height:100%;width:100%;transition:transform 0.5s ease;";
|
|
@@ -4099,7 +4109,7 @@ function renderHeroInline(ctx, target) {
|
|
|
4099
4109
|
slide.style.cssText = "position:relative;flex:0 0 100%;width:100%;height:100%;min-height:inherit;background:#f1f5f9;";
|
|
4100
4110
|
const videoUrl = c.video_url ? sanitizeUrl(c.video_url) ?? "" : "";
|
|
4101
4111
|
const isVideo = !!videoUrl || c.media_type === "video";
|
|
4102
|
-
const mediaUrl = isVideo ? videoUrl || sanitizeUrl(c.media_url ?? "") : sanitizeUrl(c.image_url ?? c.media_url ?? "");
|
|
4112
|
+
const mediaUrl = isVideo ? videoUrl || sanitizeUrl(c.media_url ?? "") : sanitizeUrl(c.image_url ?? c.media_url ?? "") ?? (c.image_url_mobile ? sanitizeUrl(c.image_url_mobile) : null);
|
|
4103
4113
|
if (mediaUrl) {
|
|
4104
4114
|
if (isVideo) {
|
|
4105
4115
|
const v = document.createElement("video");
|
|
@@ -4111,9 +4121,21 @@ function renderHeroInline(ctx, target) {
|
|
|
4111
4121
|
v.style.cssText = "position:absolute;inset:0;width:100%;height:100%;object-fit:cover;";
|
|
4112
4122
|
slide.appendChild(v);
|
|
4113
4123
|
} else {
|
|
4114
|
-
const
|
|
4115
|
-
|
|
4116
|
-
|
|
4124
|
+
const picture = document.createElement("picture");
|
|
4125
|
+
const phoneUrl = c.image_url_mobile ? sanitizeUrl(c.image_url_mobile) : null;
|
|
4126
|
+
if (phoneUrl) {
|
|
4127
|
+
const source = document.createElement("source");
|
|
4128
|
+
source.setAttribute("media", `(max-width:${HERO_PHONE_MAX_WIDTH_PX}px)`);
|
|
4129
|
+
source.setAttribute("srcset", srcsetUrl(phoneUrl));
|
|
4130
|
+
picture.appendChild(source);
|
|
4131
|
+
}
|
|
4132
|
+
const img = document.createElement("img");
|
|
4133
|
+
img.src = mediaUrl;
|
|
4134
|
+
img.alt = "";
|
|
4135
|
+
img.decoding = "async";
|
|
4136
|
+
img.style.cssText = "position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;display:block;";
|
|
4137
|
+
picture.appendChild(img);
|
|
4138
|
+
slide.appendChild(picture);
|
|
4117
4139
|
}
|
|
4118
4140
|
}
|
|
4119
4141
|
if (overlayCss) {
|
|
@@ -15055,7 +15077,7 @@ const _AegisMessageRuntime = class _AegisMessageRuntime {
|
|
|
15055
15077
|
this.initialized = false;
|
|
15056
15078
|
this.armedInAppTriggers = /* @__PURE__ */ new Set();
|
|
15057
15079
|
{
|
|
15058
|
-
const v = "1.43.
|
|
15080
|
+
const v = "1.43.5";
|
|
15059
15081
|
try {
|
|
15060
15082
|
globalThis.__AEGIS_SDK_VERSION__ = v;
|
|
15061
15083
|
} catch {
|