@thealteroffice/react-native-adgeist 0.0.36-beta → 0.0.37-beta
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/Adgeist.podspec +7 -4
- package/ios/AdgeistImpl.swift +11 -130
- package/ios/Frameworks/AdgeistKit.xcframework/Info.plist +44 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/AdgeistKit +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Headers/AdgeistKit.h +11 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Info.plist +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios.abi.json +2429 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios.private.swiftinterface +66 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios.swiftinterface +66 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/Modules/module.modulemap +6 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/PrivacyInfo.xcprivacy +46 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/ad_view.html +57 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64/AdgeistKit.framework/adcard-beta.js +556 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/AdgeistKit +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Headers/AdgeistKit.h +11 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Info.plist +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios-simulator.abi.json +2429 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +66 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +66 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +2429 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +66 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/AdgeistKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +66 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/Modules/module.modulemap +6 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/PrivacyInfo.xcprivacy +46 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/ad_view.html +57 -0
- package/ios/Frameworks/AdgeistKit.xcframework/ios-arm64_x86_64-simulator/AdgeistKit.framework/adcard-beta.js +556 -0
- package/ios/NativeHTML5AdManager.mm +34 -9
- package/ios/NativeHTML5AdView.swift +48 -107
- package/lib/module/constants.js +1 -1
- package/lib/typescript/src/constants.d.ts +1 -1
- package/package.json +9 -2
- package/src/constants.ts +1 -1
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
/*! Adgeist Ad Card SDK v1.1.7 | Copyright (c) 2026 The Alter Office. */
|
|
2
|
+
!(function (t, e) {
|
|
3
|
+
"object" == typeof exports && "undefined" != typeof module
|
|
4
|
+
? e(exports)
|
|
5
|
+
: "function" == typeof define && define.amd
|
|
6
|
+
? define(["exports"], e)
|
|
7
|
+
: e(
|
|
8
|
+
((t =
|
|
9
|
+
"undefined" != typeof globalThis
|
|
10
|
+
? globalThis
|
|
11
|
+
: t || self).AdgeistAdCardNativeSDK = {}),
|
|
12
|
+
);
|
|
13
|
+
})(this, function (t) {
|
|
14
|
+
"use strict";
|
|
15
|
+
let e = { reportError: () => {}, renderStatusStatements: () => [] };
|
|
16
|
+
const n = () => e;
|
|
17
|
+
function i(t, e) {
|
|
18
|
+
const n = parseInt(String(t ?? e), 10);
|
|
19
|
+
return Number.isFinite(n) && n > 0 ? n : e;
|
|
20
|
+
}
|
|
21
|
+
function o(t) {
|
|
22
|
+
if (null == t || "" === t) return !1;
|
|
23
|
+
const e = parseInt(String(t), 10);
|
|
24
|
+
return Number.isFinite(e) && e > 0;
|
|
25
|
+
}
|
|
26
|
+
const s = {
|
|
27
|
+
"&": "&",
|
|
28
|
+
"<": "<",
|
|
29
|
+
">": ">",
|
|
30
|
+
'"': """,
|
|
31
|
+
"'": "'",
|
|
32
|
+
};
|
|
33
|
+
function a(t) {
|
|
34
|
+
return null == t ? "" : String(t).replace(/[&<>"']/g, (t) => s[t]);
|
|
35
|
+
}
|
|
36
|
+
function d(t) {
|
|
37
|
+
try {
|
|
38
|
+
const e = new URL(t);
|
|
39
|
+
if (!["http:", "https:"].includes(e.protocol))
|
|
40
|
+
throw new Error("Invalid protocol");
|
|
41
|
+
return e.toString();
|
|
42
|
+
} catch (e) {
|
|
43
|
+
return (n().reportError(e, "boundary"), "about:blank");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const r =
|
|
47
|
+
"window.addEventListener('message', function(e) {\n if(!e || !e.data || typeof e.data !== 'object') return;\n if(e.data.type === 'adgeist_mute' && e.data.mute) v.muted = true;\n });\n function notify() {\n if(!v.muted) {\n window.parent.postMessage({\n type: 'adgeist_mute_event',\n adElementId: adElementId,\n muted: false\n }, '*');\n }\n }\n v.addEventListener('volumechange', notify);\n v.addEventListener('play', notify);";
|
|
48
|
+
function l(t) {
|
|
49
|
+
const e = (function (t) {
|
|
50
|
+
if (null == t) return "";
|
|
51
|
+
const e = String.fromCharCode(8232),
|
|
52
|
+
n = String.fromCharCode(8233);
|
|
53
|
+
return String(t)
|
|
54
|
+
.replace(/\\/g, "\\\\")
|
|
55
|
+
.replace(/'/g, "\\'")
|
|
56
|
+
.replace(/\n/g, "\\n")
|
|
57
|
+
.replace(/\r/g, "\\r")
|
|
58
|
+
.split(e)
|
|
59
|
+
.join("\\u2028")
|
|
60
|
+
.split(n)
|
|
61
|
+
.join("\\u2029")
|
|
62
|
+
.replace(/<\//g, "<\\/");
|
|
63
|
+
})(t.adElementId);
|
|
64
|
+
return t.withMuteButton
|
|
65
|
+
? `<script>\n (function() {\n var adElementId = '${e}';\n var v = document.getElementById('adgeist-video');\n var muteBtn = document.getElementById('adgeist-mute-btn');\n var iconMuted = document.getElementById('icon-muted');\n var iconUnmuted = document.getElementById('icon-unmuted');\n\n // Audio coordination: mute this ad when another ad plays\n if (v) {\n ${r}\n }\n\n // Mute button init \u2014 works in both iframe (srcdoc) and direct DOM context\n function initMute() {\n if (!v || !muteBtn || !iconMuted || !iconUnmuted) {\n setTimeout(initMute, 100);\n return;\n }\n function updateIcon() {\n if (v.muted) {\n iconMuted.style.display = 'block';\n iconUnmuted.style.display = 'none';\n } else {\n iconMuted.style.display = 'none';\n iconUnmuted.style.display = 'block';\n }\n }\n updateIcon();\n muteBtn.addEventListener('click', function(e) {\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n v.muted = !v.muted;\n updateIcon();\n if (!v.muted) {\n // Injected into a sandboxed iframe \u2014 no access to the parent SDK's\n // logger/telemetry, so this cannot be reported. Autoplay rejection\n // is an expected browser-policy outcome anyway.\n v.play().catch(function() {});\n }\n });\n v.addEventListener('volumechange', updateIcon);\n }\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', initMute);\n } else {\n initMute();\n }\n })();\n <\/script>`
|
|
66
|
+
: `<script>\n (function() {\n var adElementId = '${e}';\n var v = document.getElementById('adgeist-video');\n if(!v) return;\n ${r}\n })();\n <\/script>`;
|
|
67
|
+
}
|
|
68
|
+
function c(t, e = []) {
|
|
69
|
+
const i = [...n().renderStatusStatements(), ...e];
|
|
70
|
+
return 0 === i.length ? "" : `${t}="${i.join(" ")}"`;
|
|
71
|
+
}
|
|
72
|
+
function h(t) {
|
|
73
|
+
return t ? (/^https?:\/\//i.test(t) ? t : "https://" + t) : "";
|
|
74
|
+
}
|
|
75
|
+
function p(t) {
|
|
76
|
+
return a(d(h(t || "")));
|
|
77
|
+
}
|
|
78
|
+
function u(t) {
|
|
79
|
+
return t ? a(d(t)) : "";
|
|
80
|
+
}
|
|
81
|
+
const g =
|
|
82
|
+
"\n html, body {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n font-family: system-ui, -apple-system,\n sans-serif;\n }\n body {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n",
|
|
83
|
+
m = "banner-card-styles",
|
|
84
|
+
f =
|
|
85
|
+
"\n .banner-adgeist-card {\n container-type: size;\n container-name: banner-ad;\n width: 100%;\n height: 100%;\n overflow: hidden;\n outline: 1px solid #e0e0e0;\n background-color: #d5d4d4ff;\n box-shadow: 0 2px 8px rgba(0,0,0,0.1);\n position: relative;\n display: flex;\n flex-grow: 1;\n align-items: center;\n justify-content: center;\n }\n\n .adgeist-media {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .adgeist-media img,\n .adgeist-media video {\n width: 100%;\n height: 100%;\n object-fit: contain;\n display: block;\n }\n ",
|
|
86
|
+
x = "Banner Image";
|
|
87
|
+
function y(t) {
|
|
88
|
+
const e = t.media[0];
|
|
89
|
+
if (!e?.src)
|
|
90
|
+
return (t.logger.error("BannerAdCard: missing media source"), "");
|
|
91
|
+
const n =
|
|
92
|
+
"video" === e?.type
|
|
93
|
+
? `\n <video\n id="adgeist-video"\n class="media"\n poster="${u(e?.thumbnailUrl)}"\n autoplay muted loop\n playsinline\n webkit-playsinline\n width="${a(e?.width || "100%")}"\n height="${a(e?.height || "100%")}"\n style="object-fit: contain;"\n ${c("onloadeddata")}\n preload="auto"\n aria-label="${a(t.altText)}"\n >\n <source src="${u(e?.src)}" type="video/mp4">\n </video>\n `
|
|
94
|
+
: `\n <img\n class="media"\n src="${u(e?.src)}"\n fallback="${u(e?.thumbnailUrl)}"\n alt="${a(t.altText)}"\n aria-label="${a(t.altText)}"\n loading="eager"\n width="${a(e?.width)}"\n height="${a(e?.height)}"\n type="${a(e?.mimeType || "image/*")}"\n ${c("onload")}\n />\n `;
|
|
95
|
+
return `\n <style id="${m}">${g}${t.sizingCss}${f}</style>\n <a href="${p(t.ctaUrl)}" target="_blank" rel="noopener noreferrer" id="adgeist-card" class="banner-adgeist-card">\n \n\n <div class="adgeist-media adgeist-ad">\n ${n}\n </div>\n </a> `;
|
|
96
|
+
}
|
|
97
|
+
const w = (t, e, n, i) => {
|
|
98
|
+
const o = t * (0.6 * e * (n ? 1.1 : 1));
|
|
99
|
+
return Math.max(1, Math.ceil(o / i)) * (1.4 * e);
|
|
100
|
+
};
|
|
101
|
+
function v(t, e) {
|
|
102
|
+
let n = t / 1.91;
|
|
103
|
+
const i = e - n;
|
|
104
|
+
if (i >= 40) {
|
|
105
|
+
const o = 0.35 * e;
|
|
106
|
+
return (
|
|
107
|
+
i < o && (n = e - o),
|
|
108
|
+
{
|
|
109
|
+
type: "stacked",
|
|
110
|
+
imageHeight: n,
|
|
111
|
+
imageWidth: t,
|
|
112
|
+
contentHeight: i,
|
|
113
|
+
flexDirection: "column",
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
let o = e,
|
|
118
|
+
s = 1.91 * o;
|
|
119
|
+
if (e < 70) {
|
|
120
|
+
const e = 0.2 * t;
|
|
121
|
+
s = Math.min(s, e);
|
|
122
|
+
}
|
|
123
|
+
let a = t - 110;
|
|
124
|
+
const d = 0.45 * t;
|
|
125
|
+
return (
|
|
126
|
+
t - s < d && (a = t - d),
|
|
127
|
+
s > a && ((s = Math.max(0, a)), (o = e)),
|
|
128
|
+
{
|
|
129
|
+
type: "side",
|
|
130
|
+
imageHeight: o,
|
|
131
|
+
imageWidth: s,
|
|
132
|
+
contentHeight: e,
|
|
133
|
+
flexDirection: "row",
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function b(t, e, n = w) {
|
|
138
|
+
const { width: i, height: o, title: s, description: a } = t,
|
|
139
|
+
d = "stacked" === e.type,
|
|
140
|
+
r = d ? o - e.imageHeight : o,
|
|
141
|
+
l = d ? i : i - e.imageWidth;
|
|
142
|
+
let c = o < 150 ? 16 : o < 350 ? 20 : 32,
|
|
143
|
+
h = 4;
|
|
144
|
+
const p = i < 200 ? 16 : 32;
|
|
145
|
+
o < 60 && ((c = 8), (h = 2));
|
|
146
|
+
const u = !d && l > 480,
|
|
147
|
+
g = !u && o < 90;
|
|
148
|
+
let m = Math.max(10, l - p);
|
|
149
|
+
g
|
|
150
|
+
? (m -= 100)
|
|
151
|
+
: u
|
|
152
|
+
? (m = (l - p - 16) / 2)
|
|
153
|
+
: o < 90 && !d && (m = (l - p - 32) / 2);
|
|
154
|
+
const f = r - c,
|
|
155
|
+
x = (t, e, i) => {
|
|
156
|
+
let o = 0,
|
|
157
|
+
d = 0,
|
|
158
|
+
r = 0;
|
|
159
|
+
if (
|
|
160
|
+
(t && (d = n(s.length, 16, !0, m)),
|
|
161
|
+
e && (r = n(a.length, 14, !1, m)),
|
|
162
|
+
u)
|
|
163
|
+
) {
|
|
164
|
+
const n = t ? d + h : 0,
|
|
165
|
+
i = e ? r : 0;
|
|
166
|
+
o = Math.max(n, i);
|
|
167
|
+
} else
|
|
168
|
+
(t && (o += d),
|
|
169
|
+
e && (o += r),
|
|
170
|
+
t && e && (o += h),
|
|
171
|
+
i && !g && (o += 56));
|
|
172
|
+
let l = 1;
|
|
173
|
+
o > 0 && (l = Math.sqrt(f / o));
|
|
174
|
+
const c = m / 7 / 16,
|
|
175
|
+
p = Math.min(2.5, c);
|
|
176
|
+
l = Math.max(0.1, Math.min(p, l));
|
|
177
|
+
let x = l,
|
|
178
|
+
y = !1,
|
|
179
|
+
w = 10;
|
|
180
|
+
for (; w >= 0; ) {
|
|
181
|
+
const o = Math.max(14, 16 * x),
|
|
182
|
+
d = Math.max(12, 14 * x);
|
|
183
|
+
let r = 0,
|
|
184
|
+
l = 0;
|
|
185
|
+
if (
|
|
186
|
+
(t && (r = n(s.length, o, !0, m)),
|
|
187
|
+
e && (l = n(a.length, d, !1, m)),
|
|
188
|
+
u)
|
|
189
|
+
)
|
|
190
|
+
(t ? r + h : 0) <= f && (e ? l : 0) <= f && (y = !0);
|
|
191
|
+
else {
|
|
192
|
+
let n = 0;
|
|
193
|
+
(t && (n += r),
|
|
194
|
+
e && (n += l),
|
|
195
|
+
t && e && (n += h),
|
|
196
|
+
i && !g && (n += 1.2 * Math.max(12, 14 * x) + 12 + 16),
|
|
197
|
+
n <= f && (y = !0));
|
|
198
|
+
}
|
|
199
|
+
if (y) break;
|
|
200
|
+
((x *= 0.9), w--);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
fits: y,
|
|
204
|
+
scale: x,
|
|
205
|
+
showTitle: t,
|
|
206
|
+
showDescription: e,
|
|
207
|
+
showCta: i,
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
y = [
|
|
211
|
+
{ title: !0, description: !0, cta: !0 },
|
|
212
|
+
{ title: !0, description: !0, cta: !1 },
|
|
213
|
+
{ title: !0, description: !1, cta: !1 },
|
|
214
|
+
{ title: !0, description: !1, cta: !0 },
|
|
215
|
+
];
|
|
216
|
+
let v = null;
|
|
217
|
+
for (const w of y) {
|
|
218
|
+
if (w.cta && g && r < 40) continue;
|
|
219
|
+
const t = x(w.title, w.description, w.cta);
|
|
220
|
+
if (!t.fits) continue;
|
|
221
|
+
const e = w.description && !w.cta ? 0.35 : 0.75;
|
|
222
|
+
if (t.scale >= e) {
|
|
223
|
+
v = t;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
(!v || t.scale > v.scale) && (v = t);
|
|
227
|
+
}
|
|
228
|
+
return (
|
|
229
|
+
v || (v = x(!0, !1, !1)),
|
|
230
|
+
{
|
|
231
|
+
...e,
|
|
232
|
+
fontSizeScale: v.scale,
|
|
233
|
+
isHorizontalContent: g,
|
|
234
|
+
isSplitContent: u,
|
|
235
|
+
paddingY: c / 2,
|
|
236
|
+
fontSizes: {
|
|
237
|
+
title: Math.max(14, 16 * v.scale),
|
|
238
|
+
body: Math.max(12, 14 * v.scale),
|
|
239
|
+
},
|
|
240
|
+
visible: {
|
|
241
|
+
title: v.showTitle,
|
|
242
|
+
description: v.showDescription,
|
|
243
|
+
cta: v.showCta,
|
|
244
|
+
},
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
function $(t, e) {
|
|
249
|
+
const { title: n, description: i } = t,
|
|
250
|
+
{
|
|
251
|
+
fontSizes: o,
|
|
252
|
+
visible: s,
|
|
253
|
+
type: d,
|
|
254
|
+
isHorizontalContent: r,
|
|
255
|
+
isSplitContent: l,
|
|
256
|
+
paddingY: c,
|
|
257
|
+
} = e,
|
|
258
|
+
h = "stacked" === d,
|
|
259
|
+
p = s.title
|
|
260
|
+
? `font-size:${o.title}px;line-height:1.2;margin-bottom:4px;font-weight:700;`
|
|
261
|
+
: "display:none;",
|
|
262
|
+
u = s.description
|
|
263
|
+
? `font-size:${o.body}px;line-height:1.35;margin-bottom:4px;opacity:0.8;`
|
|
264
|
+
: "display:none;",
|
|
265
|
+
g = s.cta
|
|
266
|
+
? `font-size:${Math.max(12, 14 * e.fontSizeScale)}px;`
|
|
267
|
+
: "display:none;";
|
|
268
|
+
if (l)
|
|
269
|
+
return `\n <div class="adgeist-content-container" style="flex:1;display:flex;flex-direction:row;align-items:center;padding:${c}px 16px;overflow:visible;justify-content:center;">\n <div style="display:flex;flex-direction:column;justify-content:center;flex:1;padding-right:16px;text-align:left;height:100%;overflow:visible;">\n <div class="adgeist-title-text" style="${p}">${a(n)}</div>\n </div>\n <div style="display:flex;flex-direction:column;justify-content:center;flex:2;text-align:left;height:100%;overflow:visible;">\n <div class="adgeist-description-text" style="${u}">${a(i)}</div>\n </div>\n </div>\n `;
|
|
270
|
+
const m = r ? "margin-left:16px;" : "margin-top:16px;";
|
|
271
|
+
return `\n <div class="adgeist-content-container" style="flex:1;display:flex;flex-direction:${r ? "row" : "column"};${r ? "align-items:center;justify-content:space-between;text-align:left;" : h ? "align-items:center;justify-content:space-around;" : "align-items:center;justify-content:center;"}padding:${c}px 16px;overflow:visible;">\n <div style="display:flex;flex-direction:column;${r ? "width:100%;justify-content:center;" : h ? "justify-content:center;width:100%;" : "width:100%;"}${h ? "align-items:center;text-align:center;" : "align-items:flex-start;text-align:left;"}overflow:visible;">\n <div class="adgeist-title-text" style="${p}">${a(n)}</div>\n <div class="adgeist-description-text" style="${u}">${a(i)}</div>\n </div>\n <div class="cta-button" style="${g}${m}flex-shrink:0;">Open</div>\n </div>\n `;
|
|
272
|
+
}
|
|
273
|
+
const E =
|
|
274
|
+
"\n .adgeist-title-text {\n margin: 0;\n color: #000;\n word-break: break-word;\n }\n .adgeist-description-text {\n margin: 0;\n color: #4B5563;\n word-break: break-word;\n }\n .cta-button {\n background: #85C896;\n color: rgba(29, 29, 29, 1);\n border-radius: 9999px;\n padding: 6px 16px;\n font-weight: 500;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n white-space: nowrap;\n box-shadow:\n inset 0 0 2px -2px #ACFFB1,\n inset 8px 3px 15px 0 #6FC974,\n inset -4px -4px 13px -5px rgba(51,51,51,0.74),\n inset 4px 0 4px 0 rgba(38,100,42,0.68);\n transition: transform .2s;\n }\n .cta-button:hover { transform: scale(1.01); }\n",
|
|
275
|
+
C = "adcard-v2-styles",
|
|
276
|
+
S = `\n .card-container {\n position: relative;\n container-type: size;\n container-name: adgeist-card;\n overflow: hidden;\n outline: 1px solid #E0E0E0;\n background-color: #FFFFFF;\n box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1);\n box-sizing: border-box;\n }\n .adgeist-name-text {\n margin: 0;\n color: #9CA3AF;\n }\n${E}`;
|
|
277
|
+
function k(t) {
|
|
278
|
+
const e = t.media[0];
|
|
279
|
+
if (!e?.src)
|
|
280
|
+
return (
|
|
281
|
+
t.logger.error("DisplayAdCard: missing primary media source"),
|
|
282
|
+
""
|
|
283
|
+
);
|
|
284
|
+
const n = t.hooks ? t.hooks.layoutConfig() : v(t.width, t.height),
|
|
285
|
+
i = t.hooks ? t.hooks.layoutDetails(n) : b(t, n),
|
|
286
|
+
o = t.hooks ? t.hooks.content(i) : $(t, i),
|
|
287
|
+
s =
|
|
288
|
+
"video" === e.type
|
|
289
|
+
? `<video\n id="adgeist-video"\n poster="${u(e.thumbnailUrl)}"\n autoplay muted loop\n playsinline\n webkit-playsinline\n style="width: 100%; height: 100%; object-fit: contain;"\n ${c("onloadeddata")}\n preload="auto"\n aria-label="${a(t.altText)}"\n >\n <source src="${u(e.src)}" type="video/mp4">\n </video>`
|
|
290
|
+
: `<img\n src="${u(e.src)}"\n fallback="${u(e.thumbnailUrl)}"\n alt="${a(t.altText)}"\n aria-label="${a(t.altText)}"\n style="width:100%;height:100%;object-fit:contain;"\n ${c("onload")}\n />`,
|
|
291
|
+
d =
|
|
292
|
+
"stacked" === i.type
|
|
293
|
+
? `width:100%;height:${((i.imageHeight / t.height) * 100).toFixed(2)}%;`
|
|
294
|
+
: `width:${((i.imageWidth / t.width) * 100).toFixed(2)}%;height:100%;`;
|
|
295
|
+
return `\n <style id="${C}">${g}${t.sizingCss}${S}</style>\n <a href="${p(t.ctaUrl)}"\n id="adgeist-card"\n target="_blank"\n rel="noopener noreferrer"\n style="text-decoration:none;color:inherit;display:block;"\n >\n <div class="card-container adgeist-ad"\n style="width:100%;height:100%;display:flex;flex-direction:${i.flexDirection};"\n >\n \n\n <div class="image-container" style="${d}flex-shrink:0;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#d5d4d4ff;">\n ${s}\n </div>\n\n ${o}\n </div>\n </a>\n `;
|
|
296
|
+
}
|
|
297
|
+
const T = "#66CC99",
|
|
298
|
+
I = `xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="100%" height="100%" fill="none" stroke="${T}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="display:block;filter:drop-shadow(0 0 2px rgba(102,204,153,0.9));" role="img"`,
|
|
299
|
+
M = `<path d="M11.4 7.7 8.3 10.1H5.8v3.8h2.5l3.1 2.4z" fill="${T}"/>`,
|
|
300
|
+
H = `<svg ${I} aria-label="Muted"><title>Muted</title><circle cx="12" cy="12" r="10"/>${M}<path d="M4.9 4.9 19.1 19.1"/></svg>`,
|
|
301
|
+
A = `<svg ${I} aria-label="Unmuted"><title>Unmuted</title><circle cx="12" cy="12" r="10"/>${M}<path d="M14.2 9.8a3.1 3.1 0 0 1 0 4.4"/><path d="M16.4 7.6a6.2 6.2 0 0 1 0 8.8"/></svg>`;
|
|
302
|
+
function z(t) {
|
|
303
|
+
const e = t || document,
|
|
304
|
+
i = e.querySelector("#adgeist-video"),
|
|
305
|
+
o = e.querySelector("#adgeist-mute-btn"),
|
|
306
|
+
s = e.querySelector("#icon-muted"),
|
|
307
|
+
a = e.querySelector("#icon-unmuted");
|
|
308
|
+
if (!(i && o && s && a)) return (setTimeout(() => z(t), 100), void 0);
|
|
309
|
+
function d() {
|
|
310
|
+
i &&
|
|
311
|
+
s &&
|
|
312
|
+
a &&
|
|
313
|
+
(i.muted
|
|
314
|
+
? ((s.style.display = "block"), (a.style.display = "none"))
|
|
315
|
+
: ((s.style.display = "none"), (a.style.display = "block")));
|
|
316
|
+
}
|
|
317
|
+
(d(),
|
|
318
|
+
o.addEventListener("click", function (t) {
|
|
319
|
+
i &&
|
|
320
|
+
(t.preventDefault(),
|
|
321
|
+
t.stopPropagation(),
|
|
322
|
+
t.stopImmediatePropagation(),
|
|
323
|
+
(i.muted = !i.muted),
|
|
324
|
+
d(),
|
|
325
|
+
i.muted ||
|
|
326
|
+
i.play().catch((t) => {
|
|
327
|
+
n().reportError(t);
|
|
328
|
+
}));
|
|
329
|
+
}),
|
|
330
|
+
i.addEventListener("volumechange", function () {
|
|
331
|
+
i && d();
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
334
|
+
const j = `\n .companion-ad-container {\n display:flex;\n position: relative;\n flex-direction: column;\n outline: 1px solid #E0E0E0;\n background-color: #FFFFFF;\n width: 100%;\n overflow: hidden;\n text-decoration: none;\n color: inherit;\n }\n${E}`;
|
|
335
|
+
function D(t) {
|
|
336
|
+
const e =
|
|
337
|
+
t.media.find((t) => t.mimeType?.startsWith("video")) || t.media[0],
|
|
338
|
+
n = t.media.find((t) => t.mimeType?.startsWith("image")) || t.media[1],
|
|
339
|
+
i = u(e?.src),
|
|
340
|
+
o = u(e?.thumbnailUrl),
|
|
341
|
+
s = u(n?.src);
|
|
342
|
+
return `\n <style id="companion-card-styles">${g}${t.sizingCss}${j}</style>\n <a href="${p(t.ctaUrl)}" target="_blank" rel="noopener noreferrer" id="adgeist-card" style="text-decoration:none;color:inherit;display:block;">\n <div class="companion-ad-container adgeist-ad">\n ${(99, "")}\n\n <div style="position:relative; width:100%; aspect-ratio:16/9;">\n <div\n role="button"\n id="adgeist-mute-btn"\n style="position:absolute; top:1px; left:1px; z-index:20; width:20px; height:20px; display:flex; justify-content:center; align-items:center; cursor:pointer;"\n onclick="event.preventDefault(); event.stopPropagation();">\n <div id="icon-muted" style="display:block; width:100%; height:100%;">${H}</div>\n <div id="icon-unmuted" style="display:none; width:100%; height:100%;">${A}</div>\n </div>\n\n <video\n id="adgeist-video"\n poster="${o}"\n autoplay loop\n muted\n playsinline\n webkit-playsinline\n style="width: 100%; height: 100%; display: block; object-fit: cover;"\n ${c("onloadeddata", ["if(window.CompanionAdCard) { window.CompanionAdCard.initMuteButton(this.closest('.companion-ad-container')); }"])}\n controlsList="nodownload"\n disablePictureInPicture\n preload="auto"\n aria-label="${a(t.altText)}"\n >\n <source src="${i}" type="video/mp4">\n </video>\n </div>\n\n <img\n src="${s}"\n aria-label="${a(t.altText)}"\n alt="${a(t.altText)}"\n style="width: 100%; aspect-ratio: 16/3; display: block; background-color: #d5d4d4ff;"\n ${c("onload")}\n />\n\n <div class='companion-meta' style='display:flex; flex-direction: row; height: 100%; box-sizing: border-box; overflow: hidden; padding:8px 12px; font-size:12px; color:#666; text-align:center; align-items:center; gap: 8px;'>\n <div class='adgeist-name-text' style='display:flex;flex-direction:column;flex:1; min-width:0; text-align:start; justify-content:center;'>\n <span class="adgeist-title-text" style="font-size: 14px; margin-bottom: 2px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${a(t.title)}</span>\n <span class="adgeist-description-text" style="font-size: 12px; line-height: 1.3; overflow: hidden;">${a(t.description)}</span>\n </div>\n <div class="cta-button" style="flex-shrink:0;">Open</div>\n </div>\n </div>\n </a>\n ${t.audioScript()}`;
|
|
343
|
+
}
|
|
344
|
+
function B(t) {
|
|
345
|
+
const {
|
|
346
|
+
isResponsive: e,
|
|
347
|
+
width: n,
|
|
348
|
+
height: i,
|
|
349
|
+
hasExplicitWidth: o,
|
|
350
|
+
hasExplicitHeight: s,
|
|
351
|
+
spec: a,
|
|
352
|
+
} = t,
|
|
353
|
+
d = `calc((${s ? `${i}px` : "100vh"} - 56px) * 16 / 12)`,
|
|
354
|
+
r = o ? `, ${n}px` : "";
|
|
355
|
+
return `#adgeist-card { box-sizing: border-box; ${e ? `width: min(100%, ${a.maxWidth}px, ${d}${r}); height: auto; min-width: ${a.minWidth}px;` : `width: min(${n}px, ${d}); height: auto; flex: none;`} }`;
|
|
356
|
+
}
|
|
357
|
+
function U(t) {
|
|
358
|
+
const { isResponsive: e, width: n, height: i, spec: o } = t;
|
|
359
|
+
return `#adgeist-card { box-sizing: border-box; ${e ? `width: 100%; height: 100%; min-width: ${o.minWidth}px; min-height: ${o.minHeight}px; max-width: ${o.maxWidth}px; max-height: ${o.maxHeight}px;` : `width: ${n}px; height: ${i}px; flex: none;`} }`;
|
|
360
|
+
}
|
|
361
|
+
const L = { minWidth: 0, minHeight: 0, maxWidth: 1200, maxHeight: 900 };
|
|
362
|
+
class R {
|
|
363
|
+
constructor(t = {}) {
|
|
364
|
+
((this.logger = {
|
|
365
|
+
log: console.log,
|
|
366
|
+
error: (t, e) => n().reportError(e ?? t, "logger"),
|
|
367
|
+
}),
|
|
368
|
+
(this.adElementId = t.adElementId || ""),
|
|
369
|
+
(this.title = t.title || "Headline 25 characters"),
|
|
370
|
+
(this.description =
|
|
371
|
+
t.description ||
|
|
372
|
+
"Body text with 50 characters of describing the advertisement."),
|
|
373
|
+
(this.name = t.name || "-"),
|
|
374
|
+
(this.ctaUrl = t.ctaUrl || "https://www.example.com"),
|
|
375
|
+
(this.type = t.type || "image"),
|
|
376
|
+
(this.isResponsive = t.isResponsive ?? !1),
|
|
377
|
+
(this.responsiveType = t.responsiveType || "Square"),
|
|
378
|
+
(this.width = i(t.width, 300)),
|
|
379
|
+
(this.height = i(t.height, 300)),
|
|
380
|
+
(this.hasExplicitWidth = o(t.width)),
|
|
381
|
+
(this.hasExplicitHeight = o(t.height)),
|
|
382
|
+
(this.spec = t.spec || L),
|
|
383
|
+
(this.adspaceType = t.adspaceType || "banner"),
|
|
384
|
+
(this.media = t.media || []),
|
|
385
|
+
(this.altText = t.altText || ""));
|
|
386
|
+
}
|
|
387
|
+
renderHtml() {
|
|
388
|
+
return "banner" === this.adspaceType
|
|
389
|
+
? y(
|
|
390
|
+
this.toContext({
|
|
391
|
+
...this.standardRendering(),
|
|
392
|
+
altText: this.altText || x,
|
|
393
|
+
}),
|
|
394
|
+
)
|
|
395
|
+
: "display" === this.adspaceType
|
|
396
|
+
? k(this.toContext(this.standardRendering()))
|
|
397
|
+
: "companion" === this.adspaceType
|
|
398
|
+
? D(this.toContext(this.companionRendering()))
|
|
399
|
+
: "";
|
|
400
|
+
}
|
|
401
|
+
standardRendering() {
|
|
402
|
+
return {
|
|
403
|
+
sizingCss: U(this.sizingInput()),
|
|
404
|
+
audioScript: () => l({ adElementId: this.adElementId }),
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
companionRendering() {
|
|
408
|
+
return {
|
|
409
|
+
sizingCss: B(this.sizingInput()),
|
|
410
|
+
audioScript: () =>
|
|
411
|
+
l({ adElementId: this.adElementId, withMuteButton: !0 }),
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
mount(t) {
|
|
415
|
+
if (!t) throw new Error("AdCard: mount target element not found");
|
|
416
|
+
const e = document.createElement("iframe");
|
|
417
|
+
(e.setAttribute("frameborder", "0"),
|
|
418
|
+
e.setAttribute("scrolling", "no"),
|
|
419
|
+
(e.style.border = "none"),
|
|
420
|
+
(e.style.display = "block"),
|
|
421
|
+
(e.style.width = this.hasExplicitWidth ? `${this.width}px` : "100%"),
|
|
422
|
+
(e.style.height = this.hasExplicitHeight ? `${this.height}px` : "100%"),
|
|
423
|
+
(t.innerHTML = ""),
|
|
424
|
+
t.appendChild(e));
|
|
425
|
+
const n = this.renderHtml();
|
|
426
|
+
n && (e.srcdoc = n);
|
|
427
|
+
}
|
|
428
|
+
sizingInput() {
|
|
429
|
+
return {
|
|
430
|
+
isResponsive: this.isResponsive,
|
|
431
|
+
width: this.width,
|
|
432
|
+
height: this.height,
|
|
433
|
+
hasExplicitWidth: this.hasExplicitWidth,
|
|
434
|
+
hasExplicitHeight: this.hasExplicitHeight,
|
|
435
|
+
spec: this.spec,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
getSizingCss() {
|
|
439
|
+
return U(this.sizingInput());
|
|
440
|
+
}
|
|
441
|
+
getAudioScript() {
|
|
442
|
+
return l({ adElementId: this.adElementId });
|
|
443
|
+
}
|
|
444
|
+
toContext(t) {
|
|
445
|
+
return {
|
|
446
|
+
adElementId: this.adElementId,
|
|
447
|
+
title: this.title,
|
|
448
|
+
description: this.description,
|
|
449
|
+
name: this.name,
|
|
450
|
+
ctaUrl: this.ctaUrl,
|
|
451
|
+
type: this.type,
|
|
452
|
+
isResponsive: this.isResponsive,
|
|
453
|
+
responsiveType: this.responsiveType,
|
|
454
|
+
width: this.width,
|
|
455
|
+
height: this.height,
|
|
456
|
+
hasExplicitWidth: this.hasExplicitWidth,
|
|
457
|
+
hasExplicitHeight: this.hasExplicitHeight,
|
|
458
|
+
spec: this.spec,
|
|
459
|
+
adspaceType: this.adspaceType,
|
|
460
|
+
media: this.media,
|
|
461
|
+
altText: this.altText,
|
|
462
|
+
logger: this.logger,
|
|
463
|
+
sizingCss: this.getSizingCss(),
|
|
464
|
+
audioScript: () => this.getAudioScript(),
|
|
465
|
+
...t,
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
class F extends R {
|
|
470
|
+
constructor(t = {}) {
|
|
471
|
+
(super(t),
|
|
472
|
+
(this.ctaUrl = t.ctaUrl || "#"),
|
|
473
|
+
(this.altText = t.altText || x));
|
|
474
|
+
}
|
|
475
|
+
renderBannerHtml() {
|
|
476
|
+
return y(this.toContext());
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
class W extends R {
|
|
480
|
+
constructor(t = {}) {
|
|
481
|
+
super(t);
|
|
482
|
+
}
|
|
483
|
+
estimateTextHeight(t, e, n, i) {
|
|
484
|
+
return w(t, e, n, i);
|
|
485
|
+
}
|
|
486
|
+
getLayoutConfig() {
|
|
487
|
+
return v(this.width, this.height);
|
|
488
|
+
}
|
|
489
|
+
calculateLayoutDetails(t) {
|
|
490
|
+
return b(
|
|
491
|
+
{
|
|
492
|
+
width: this.width,
|
|
493
|
+
height: this.height,
|
|
494
|
+
title: this.title,
|
|
495
|
+
description: this.description,
|
|
496
|
+
},
|
|
497
|
+
t,
|
|
498
|
+
(t, e, n, i) => this.estimateTextHeight(t, e, n, i),
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
renderContentHtml(t) {
|
|
502
|
+
return $({ title: this.title, description: this.description }, t);
|
|
503
|
+
}
|
|
504
|
+
renderDisplayHtml() {
|
|
505
|
+
return k({
|
|
506
|
+
...this.toContext(),
|
|
507
|
+
hooks: {
|
|
508
|
+
layoutConfig: () => this.getLayoutConfig(),
|
|
509
|
+
layoutDetails: (t) => this.calculateLayoutDetails(t),
|
|
510
|
+
content: (t) => this.renderContentHtml(t),
|
|
511
|
+
},
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
class _ extends R {
|
|
516
|
+
constructor(t = {}) {
|
|
517
|
+
super(t);
|
|
518
|
+
}
|
|
519
|
+
getSizingCss() {
|
|
520
|
+
return B(this.sizingInput());
|
|
521
|
+
}
|
|
522
|
+
getAudioScript() {
|
|
523
|
+
return l({ adElementId: this.adElementId, withMuteButton: !0 });
|
|
524
|
+
}
|
|
525
|
+
static initMuteButton(t) {
|
|
526
|
+
z(t);
|
|
527
|
+
}
|
|
528
|
+
renderCompanionHtml() {
|
|
529
|
+
return D(this.toContext());
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
(void (e = {
|
|
533
|
+
reportError: () => {},
|
|
534
|
+
renderStatusStatements: () => [
|
|
535
|
+
"if(window.Android) { window.Android.postMessage(JSON.stringify({type:'RENDER_STATUS',message:'Success'})) }",
|
|
536
|
+
"if(window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.postMessage) { window.webkit.messageHandlers.postMessage.postMessage(JSON.stringify({type:'RENDER_STATUS',message:'Success'})) }",
|
|
537
|
+
],
|
|
538
|
+
}),
|
|
539
|
+
"undefined" != typeof window &&
|
|
540
|
+
((window.AdCard = R),
|
|
541
|
+
(window.BannerAdCard = F),
|
|
542
|
+
(window.DisplayAdCard = W),
|
|
543
|
+
(window.CompanionAdCard = _),
|
|
544
|
+
(window.ensureHttpProtocol = h),
|
|
545
|
+
(window.DISPLAY_CSS = S),
|
|
546
|
+
(window.BANNER_CSS = f)),
|
|
547
|
+
(t.AdCard = R),
|
|
548
|
+
(t.BANNER_CSS = f),
|
|
549
|
+
(t.BANNER_STYLES_ID = m),
|
|
550
|
+
(t.BannerAdCard = F),
|
|
551
|
+
(t.CompanionAdCard = _),
|
|
552
|
+
(t.DISPLAY_CSS = S),
|
|
553
|
+
(t.DISPLAY_STYLE_ID = C),
|
|
554
|
+
(t.DisplayAdCard = W),
|
|
555
|
+
(t.ensureHttpProtocol = h));
|
|
556
|
+
});
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
//! Project version number for AdgeistKit.
|
|
4
|
+
FOUNDATION_EXPORT double AdgeistKitVersionNumber;
|
|
5
|
+
|
|
6
|
+
//! Project version string for AdgeistKit.
|
|
7
|
+
FOUNDATION_EXPORT const unsigned char AdgeistKitVersionString[];
|
|
8
|
+
|
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <AdgeistKit/PublicHeader.h>
|
|
10
|
+
|
|
11
|
+
|