@action-x/ad-sdk 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -23
- package/dist/index.d.ts +7 -0
- package/dist/index.js +367 -329
- package/dist/index.umd.js +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23,8 +23,8 @@ class q {
|
|
|
23
23
|
this.events[e] && this.events[e].forEach((i) => {
|
|
24
24
|
try {
|
|
25
25
|
i(...t);
|
|
26
|
-
} catch (
|
|
27
|
-
console.error(`[EventEmitter] Error in event handler for "${e}":`,
|
|
26
|
+
} catch (n) {
|
|
27
|
+
console.error(`[EventEmitter] Error in event handler for "${e}":`, n);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -42,8 +42,8 @@ class q {
|
|
|
42
42
|
return ((t = this.events[e]) == null ? void 0 : t.length) || 0;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function m(
|
|
46
|
-
return
|
|
45
|
+
function m(o) {
|
|
46
|
+
return o.replace(/<[^>]+>/g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").replace(/\s{2,}/g, " ").trim();
|
|
47
47
|
}
|
|
48
48
|
class v {
|
|
49
49
|
static getClickUrl(e) {
|
|
@@ -64,29 +64,29 @@ class v {
|
|
|
64
64
|
*/
|
|
65
65
|
static renderActionCard(e, t = {}) {
|
|
66
66
|
var f;
|
|
67
|
-
const { variant: i = "horizontal", includeWrapper:
|
|
67
|
+
const { variant: i = "horizontal", includeWrapper: n = !0 } = t, s = e.adapted, r = this.getClickUrl(e), a = this.getImpressionUrl(e), c = (f = s.image) != null && f.url ? `<div class="ax-ad-image-wrap">
|
|
68
68
|
<img
|
|
69
|
-
src="${
|
|
70
|
-
alt="${
|
|
69
|
+
src="${s.image.url}"
|
|
70
|
+
alt="${s.title}"
|
|
71
71
|
class="ax-ad-image"
|
|
72
72
|
loading="lazy"
|
|
73
73
|
/>
|
|
74
|
-
</div>` : "",
|
|
74
|
+
</div>` : "", d = (s.brand || "").trim(), l = d && d.toLowerCase() !== "unknown" ? `<span class="ax-ad-brand">${s.brand}</span>` : "", u = `
|
|
75
75
|
${c}
|
|
76
76
|
<div class="ax-ad-content">
|
|
77
77
|
${l}
|
|
78
|
-
<h3 class="ax-ad-title">${
|
|
79
|
-
${
|
|
78
|
+
<h3 class="ax-ad-title">${s.title}</h3>
|
|
79
|
+
${s.body ? `<p class="ax-ad-body">${m(s.body)}</p>` : ""}
|
|
80
80
|
</div>
|
|
81
|
-
`, h =
|
|
82
|
-
href="${
|
|
81
|
+
`, h = n ? `<a
|
|
82
|
+
href="${r}"
|
|
83
83
|
class="ax-ad-card ax-ad-card-${i} ax-ad-card-link"
|
|
84
84
|
target="_blank"
|
|
85
85
|
rel="sponsored noopener noreferrer"
|
|
86
86
|
data-ad-id="${e.original.id}"
|
|
87
87
|
data-impression-url="${a}"
|
|
88
|
-
>` : "", p =
|
|
89
|
-
return h +
|
|
88
|
+
>` : "", p = n ? "</a>" : "";
|
|
89
|
+
return h + u + p;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* Render Suffix ad as HTML string
|
|
@@ -95,7 +95,7 @@ class v {
|
|
|
95
95
|
* @returns HTML string
|
|
96
96
|
*/
|
|
97
97
|
static renderSuffixAd(e) {
|
|
98
|
-
const t = e.adapted, i = this.getClickUrl(e),
|
|
98
|
+
const t = e.adapted, i = this.getClickUrl(e), n = this.getImpressionUrl(e);
|
|
99
99
|
return `
|
|
100
100
|
<div class="ax-ad-suffix" data-ad-id="${e.original.id}">
|
|
101
101
|
<div class="ax-ad-suffix-content">
|
|
@@ -107,7 +107,7 @@ class v {
|
|
|
107
107
|
target="_blank"
|
|
108
108
|
rel="sponsored noopener noreferrer"
|
|
109
109
|
data-ad-id="${e.original.id}"
|
|
110
|
-
data-impression-url="${
|
|
110
|
+
data-impression-url="${n}"
|
|
111
111
|
>
|
|
112
112
|
${this.getCtaText(e)}
|
|
113
113
|
</a>
|
|
@@ -122,8 +122,8 @@ class v {
|
|
|
122
122
|
* @returns HTML string
|
|
123
123
|
*/
|
|
124
124
|
static renderSponsoredSource(e) {
|
|
125
|
-
var
|
|
126
|
-
const t = e.adapted, i = this.getClickUrl(e),
|
|
125
|
+
var s;
|
|
126
|
+
const t = e.adapted, i = this.getClickUrl(e), n = this.getImpressionUrl(e);
|
|
127
127
|
return `
|
|
128
128
|
<div class="ax-ad-source" data-ad-id="${e.original.id}">
|
|
129
129
|
<a
|
|
@@ -132,9 +132,9 @@ class v {
|
|
|
132
132
|
target="_blank"
|
|
133
133
|
rel="sponsored noopener noreferrer"
|
|
134
134
|
data-ad-id="${e.original.id}"
|
|
135
|
-
data-impression-url="${
|
|
135
|
+
data-impression-url="${n}"
|
|
136
136
|
>
|
|
137
|
-
${(
|
|
137
|
+
${(s = t.image) != null && s.url ? `<img src="${t.image.url}" alt="" class="ax-ad-source-icon" />` : ""}
|
|
138
138
|
<div class="ax-ad-source-info">
|
|
139
139
|
<span class="ax-ad-source-name">${t.title}</span>
|
|
140
140
|
${t.body ? `<span class="ax-ad-source-desc">${m(t.body)}</span>` : ""}
|
|
@@ -151,7 +151,7 @@ class v {
|
|
|
151
151
|
* @returns HTML string
|
|
152
152
|
*/
|
|
153
153
|
static renderLeadGenAd(e) {
|
|
154
|
-
const t = e.adapted, i = this.getClickUrl(e),
|
|
154
|
+
const t = e.adapted, i = this.getClickUrl(e), n = this.getImpressionUrl(e);
|
|
155
155
|
return `
|
|
156
156
|
<div class="ax-ad-leadgen" data-ad-id="${e.original.id}">
|
|
157
157
|
<div class="ax-ad-leadgen-content">
|
|
@@ -163,7 +163,7 @@ class v {
|
|
|
163
163
|
target="_blank"
|
|
164
164
|
rel="sponsored noopener noreferrer"
|
|
165
165
|
data-ad-id="${e.original.id}"
|
|
166
|
-
data-impression-url="${
|
|
166
|
+
data-impression-url="${n}"
|
|
167
167
|
>
|
|
168
168
|
${this.getCtaText(e)}
|
|
169
169
|
</a>
|
|
@@ -184,19 +184,19 @@ class v {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
const L = "ad_session_id";
|
|
187
|
-
function
|
|
187
|
+
function K() {
|
|
188
188
|
if (typeof window < "u") {
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
return
|
|
189
|
+
const o = window.__AD_CONFIG__;
|
|
190
|
+
if (o != null && o.apiKey)
|
|
191
|
+
return o.apiKey;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
var
|
|
196
|
-
return typeof window < "u" ? !!((
|
|
194
|
+
function R() {
|
|
195
|
+
var o;
|
|
196
|
+
return typeof window < "u" ? !!((o = window.__AD_CONFIG__) != null && o.debug) : !1;
|
|
197
197
|
}
|
|
198
|
-
function U(
|
|
199
|
-
if (
|
|
198
|
+
function U(o) {
|
|
199
|
+
if (o) return o;
|
|
200
200
|
if (typeof window < "u") {
|
|
201
201
|
const e = window.__AD_CONFIG__;
|
|
202
202
|
if (e != null && e.apiBaseUrl)
|
|
@@ -204,7 +204,7 @@ function U(r) {
|
|
|
204
204
|
}
|
|
205
205
|
return "/api/v1";
|
|
206
206
|
}
|
|
207
|
-
class
|
|
207
|
+
class V {
|
|
208
208
|
constructor(e = {}) {
|
|
209
209
|
this.memoryCache = /* @__PURE__ */ new Map(), this.sessionKey = e.sessionKey || L, this.storage = e.storage || "sessionStorage", (typeof window > "u" || typeof window.sessionStorage > "u") && (this.storage = "memory");
|
|
210
210
|
}
|
|
@@ -240,8 +240,8 @@ class P {
|
|
|
240
240
|
this.storage === "sessionStorage" ? sessionStorage.removeItem(this.sessionKey) : this.memoryCache.delete(this.sessionKey);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
const N = new
|
|
244
|
-
class
|
|
243
|
+
const N = new V(), w = () => N.getSessionId();
|
|
244
|
+
class x {
|
|
245
245
|
constructor(e = {}) {
|
|
246
246
|
this.explicitBaseUrl = e.baseUrl, this.timeout = e.timeout || 1e4, this.retryAttempts = e.retryAttempts ?? 2, this.retryDelay = e.retryDelay || 1e3, this.debug = e.debug || !1;
|
|
247
247
|
}
|
|
@@ -270,31 +270,31 @@ class A {
|
|
|
270
270
|
* 自动添加 X-API-Key header
|
|
271
271
|
*/
|
|
272
272
|
async sendRequest(e, t, i) {
|
|
273
|
-
let
|
|
274
|
-
for (let
|
|
275
|
-
const
|
|
273
|
+
let n = null;
|
|
274
|
+
for (let s = 0; s <= this.retryAttempts; s++) {
|
|
275
|
+
const r = this.debug || R();
|
|
276
276
|
try {
|
|
277
|
-
|
|
278
|
-
const a = new AbortController(), c = setTimeout(() => a.abort(), this.timeout),
|
|
277
|
+
r && (console.log(`[Analytics] Request URL (${i}):`, e), console.log(`[Analytics] Sending ${i} event (attempt ${s + 1}):`, t));
|
|
278
|
+
const a = new AbortController(), c = setTimeout(() => a.abort(), this.timeout), d = {
|
|
279
279
|
"Content-Type": "application/json"
|
|
280
|
-
}, l =
|
|
281
|
-
l && (
|
|
282
|
-
const
|
|
280
|
+
}, l = K();
|
|
281
|
+
l && (d["X-API-Key"] = l, r && console.log(`[Analytics] Adding X-API-Key header for ${i} event`));
|
|
282
|
+
const u = await fetch(e, {
|
|
283
283
|
method: "POST",
|
|
284
|
-
headers:
|
|
284
|
+
headers: d,
|
|
285
285
|
body: JSON.stringify(t),
|
|
286
286
|
keepalive: !0,
|
|
287
287
|
signal: a.signal
|
|
288
288
|
});
|
|
289
|
-
if (clearTimeout(c), !
|
|
290
|
-
throw new Error(`HTTP ${
|
|
291
|
-
const h = await
|
|
292
|
-
return
|
|
289
|
+
if (clearTimeout(c), !u.ok)
|
|
290
|
+
throw new Error(`HTTP ${u.status}: ${u.statusText}`);
|
|
291
|
+
const h = await u.json();
|
|
292
|
+
return r && console.log(`[Analytics] ${i} event tracked successfully:`, h), h;
|
|
293
293
|
} catch (a) {
|
|
294
|
-
|
|
294
|
+
n = a, r && console.warn(`[Analytics] ${i} tracking failed (attempt ${s + 1}):`, a), s < this.retryAttempts && await this.delay(this.retryDelay * (s + 1));
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
return console.error(`[Analytics] ${i} tracking failed after ${this.retryAttempts + 1} attempts:`,
|
|
297
|
+
return console.error(`[Analytics] ${i} tracking failed after ${this.retryAttempts + 1} attempts:`, n), null;
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
300
|
* 延迟辅助方法
|
|
@@ -303,32 +303,32 @@ class A {
|
|
|
303
303
|
return new Promise((t) => setTimeout(t, e));
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
const
|
|
307
|
-
function
|
|
308
|
-
return `vt_${
|
|
306
|
+
const P = new x(), T = (o, e) => e != null && e.baseUrl ? new x({ baseUrl: e.baseUrl }).trackImpression(o) : P.trackImpression(o), O = (o, e) => e != null && e.baseUrl ? new x({ baseUrl: e.baseUrl }).trackClick(o) : P.trackClick(o);
|
|
307
|
+
function J(o, e) {
|
|
308
|
+
return `vt_${o}_${e}`;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
311
|
-
return Promise.all(
|
|
310
|
+
async function X(o) {
|
|
311
|
+
return Promise.all(o.map((e) => T(e)));
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
314
|
-
return Promise.all(
|
|
313
|
+
async function Z(o) {
|
|
314
|
+
return Promise.all(o.map((e) => O(e)));
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
const e = new
|
|
316
|
+
function Y(o) {
|
|
317
|
+
const e = new x(o);
|
|
318
318
|
return {
|
|
319
319
|
trackImpression: (t) => e.trackImpression(t),
|
|
320
320
|
trackClick: (t) => e.trackClick(t)
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
const e = new
|
|
323
|
+
function ee(o = {}) {
|
|
324
|
+
const e = new V(o);
|
|
325
325
|
return {
|
|
326
326
|
getSessionId: () => e.getSessionId(),
|
|
327
327
|
regenerateSessionId: () => e.regenerateSessionId(),
|
|
328
328
|
clearSessionId: () => e.clearSessionId()
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
const
|
|
331
|
+
const $ = class $ {
|
|
332
332
|
static isDebugEnabled() {
|
|
333
333
|
var e;
|
|
334
334
|
return typeof window < "u" ? !!((e = window.__AD_CONFIG__) != null && e.debug) : !1;
|
|
@@ -344,31 +344,31 @@ const C = class C {
|
|
|
344
344
|
*/
|
|
345
345
|
static renderActionCard(e, t, i = {}) {
|
|
346
346
|
t.innerHTML = v.renderActionCard(e, i);
|
|
347
|
-
const
|
|
348
|
-
return
|
|
349
|
-
|
|
347
|
+
const n = t.querySelector(".ax-ad-card-link");
|
|
348
|
+
return n && n.addEventListener("click", (s) => {
|
|
349
|
+
s.preventDefault(), this.handleClick(e, i);
|
|
350
350
|
}), this.trackImpression(e, t, i), t;
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
353
|
* Render Suffix ad into container
|
|
354
354
|
*/
|
|
355
355
|
static renderSuffixAd(e, t, i = {}) {
|
|
356
|
-
const
|
|
357
|
-
t.innerHTML = this.generateSuffixAdHTML(e,
|
|
358
|
-
const
|
|
359
|
-
return
|
|
360
|
-
|
|
356
|
+
const n = i.variant || "block";
|
|
357
|
+
t.innerHTML = this.generateSuffixAdHTML(e, n);
|
|
358
|
+
const s = t.querySelector(".ax-ad-suffix-link");
|
|
359
|
+
return s && s.addEventListener("click", (r) => {
|
|
360
|
+
r.preventDefault(), this.handleClick(e, i);
|
|
361
361
|
}), this.trackImpression(e, t, i), t;
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
364
364
|
* Render Sponsored Source ad into container
|
|
365
365
|
*/
|
|
366
366
|
static renderSponsoredSource(e, t, i = {}) {
|
|
367
|
-
const
|
|
368
|
-
t.innerHTML = this.generateSponsoredSourceHTML(e,
|
|
369
|
-
const
|
|
370
|
-
return
|
|
371
|
-
|
|
367
|
+
const n = i.variant || "card";
|
|
368
|
+
t.innerHTML = this.generateSponsoredSourceHTML(e, n);
|
|
369
|
+
const s = t.querySelector(".ax-ad-source-link");
|
|
370
|
+
return s && s.addEventListener("click", (r) => {
|
|
371
|
+
r.preventDefault(), this.handleClick(e, i);
|
|
372
372
|
}), this.trackImpression(e, t, i), t;
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
@@ -376,72 +376,72 @@ const C = class C {
|
|
|
376
376
|
*/
|
|
377
377
|
static renderLeadGenAd(e, t, i = {}) {
|
|
378
378
|
t.innerHTML = v.renderLeadGenAd(e);
|
|
379
|
-
const
|
|
380
|
-
return
|
|
381
|
-
|
|
379
|
+
const n = t.querySelector(".ax-ad-leadgen-cta");
|
|
380
|
+
return n && n.addEventListener("click", (s) => {
|
|
381
|
+
s.preventDefault(), this.handleClick(e, i);
|
|
382
382
|
}), this.trackImpression(e, t, i), t;
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
385
385
|
* Render multiple ads into container
|
|
386
386
|
*/
|
|
387
|
-
static renderAds(e, t, i = this.renderActionCard.bind(this),
|
|
387
|
+
static renderAds(e, t, i = this.renderActionCard.bind(this), n) {
|
|
388
388
|
t.innerHTML = "";
|
|
389
|
-
const
|
|
390
|
-
return
|
|
389
|
+
const s = document.createElement("div");
|
|
390
|
+
return s.className = "ax-ads-container", e.forEach((r) => {
|
|
391
391
|
const a = document.createElement("div");
|
|
392
|
-
a.className = "ax-ad-wrapper", i.call(this,
|
|
393
|
-
}), t.appendChild(
|
|
392
|
+
a.className = "ax-ad-wrapper", i.call(this, r, a, n), s.appendChild(a);
|
|
393
|
+
}), t.appendChild(s), t;
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
396
396
|
* Handle ad click
|
|
397
397
|
* Directly opens click_url in a new window.
|
|
398
398
|
*/
|
|
399
399
|
static handleClick(e, t) {
|
|
400
|
-
const { onClick: i } = t,
|
|
401
|
-
if (!
|
|
400
|
+
const { onClick: i } = t, n = this.getClickUrl(e);
|
|
401
|
+
if (!n) {
|
|
402
402
|
console.warn("[DOMRenderer] Missing click url for ad:", e.original.id);
|
|
403
403
|
return;
|
|
404
404
|
}
|
|
405
|
-
i && i(e), this.isDebugEnabled() && console.log("[DOMRenderer] Redirect URL:",
|
|
405
|
+
i && i(e), this.isDebugEnabled() && console.log("[DOMRenderer] Redirect URL:", n), window.open(n, "_blank", "noopener,noreferrer");
|
|
406
406
|
}
|
|
407
407
|
/**
|
|
408
408
|
* Track ad impression using IntersectionObserver (50% visible + 1000ms delay)
|
|
409
409
|
* Falls back to immediate tracking if IntersectionObserver is unavailable.
|
|
410
410
|
*/
|
|
411
411
|
static trackImpression(e, t, i) {
|
|
412
|
-
const { analytics:
|
|
413
|
-
if (this.trackedImpressionKeys.has(
|
|
412
|
+
const { analytics: n, onImpression: s } = i, r = n ? `${n.requestId}:${n.slotId}:${e.original.id}:${this.getViewToken(e) || ""}` : `no-analytics:${e.original.id}:${this.getViewToken(e) || ""}`;
|
|
413
|
+
if (this.trackedImpressionKeys.has(r))
|
|
414
414
|
return;
|
|
415
415
|
let a = !1;
|
|
416
416
|
const c = () => {
|
|
417
|
-
a || this.trackedImpressionKeys.has(
|
|
418
|
-
},
|
|
419
|
-
|
|
420
|
-
requestId:
|
|
417
|
+
a || this.trackedImpressionKeys.has(r) || (a = !0, this.trackedImpressionKeys.add(r), d());
|
|
418
|
+
}, d = () => {
|
|
419
|
+
n ? T({
|
|
420
|
+
requestId: n.requestId,
|
|
421
421
|
adId: e.original.id,
|
|
422
|
-
slotId:
|
|
423
|
-
position:
|
|
424
|
-
totalAds:
|
|
422
|
+
slotId: n.slotId,
|
|
423
|
+
position: n.position,
|
|
424
|
+
totalAds: n.totalAds,
|
|
425
425
|
sessionId: w(),
|
|
426
426
|
adTitle: e.adapted.title,
|
|
427
427
|
format: e.original.type,
|
|
428
428
|
source: "internal",
|
|
429
429
|
viewToken: this.getViewToken(e),
|
|
430
|
-
userId:
|
|
431
|
-
}, { baseUrl:
|
|
432
|
-
|
|
430
|
+
userId: n.userId
|
|
431
|
+
}, { baseUrl: n.apiBaseUrl }).then(() => {
|
|
432
|
+
s && s(e);
|
|
433
433
|
}).catch((l) => {
|
|
434
434
|
console.error("[DOMRenderer] Analytics impression tracking failed:", l);
|
|
435
|
-
}) :
|
|
435
|
+
}) : s && s(e);
|
|
436
436
|
};
|
|
437
437
|
if (typeof IntersectionObserver < "u") {
|
|
438
|
-
let l = !1,
|
|
438
|
+
let l = !1, u = null;
|
|
439
439
|
const h = new IntersectionObserver(
|
|
440
440
|
(f) => {
|
|
441
441
|
f.forEach((k) => {
|
|
442
|
-
l = k.isIntersecting && k.intersectionRatio >= 0.5, l ?
|
|
443
|
-
|
|
444
|
-
}, 1e3)) :
|
|
442
|
+
l = k.isIntersecting && k.intersectionRatio >= 0.5, l ? u || (u = setTimeout(() => {
|
|
443
|
+
u = null, l && (c(), h.disconnect());
|
|
444
|
+
}, 1e3)) : u && (clearTimeout(u), u = null);
|
|
445
445
|
});
|
|
446
446
|
},
|
|
447
447
|
{ threshold: 0.5 }
|
|
@@ -454,7 +454,7 @@ const C = class C {
|
|
|
454
454
|
* Generate HTML for Suffix Ad variants
|
|
455
455
|
*/
|
|
456
456
|
static generateSuffixAdHTML(e, t) {
|
|
457
|
-
const i = e.adapted.title || "",
|
|
457
|
+
const i = e.adapted.title || "", n = m(e.adapted.body || "");
|
|
458
458
|
return t === "inline" ? `
|
|
459
459
|
<span class="ax-ad-suffix-link ax-ad-variant-inline" data-ad-id="${e.original.id}">
|
|
460
460
|
${i}
|
|
@@ -477,7 +477,7 @@ const C = class C {
|
|
|
477
477
|
</svg>
|
|
478
478
|
</div>
|
|
479
479
|
</div>
|
|
480
|
-
${
|
|
480
|
+
${n ? `<p class="ax-ad-suffix-body">${n}</p>` : ""}
|
|
481
481
|
</div>
|
|
482
482
|
`;
|
|
483
483
|
}
|
|
@@ -485,11 +485,11 @@ const C = class C {
|
|
|
485
485
|
* Generate HTML for Sponsored Source Ad variants
|
|
486
486
|
*/
|
|
487
487
|
static generateSponsoredSourceHTML(e, t) {
|
|
488
|
-
var
|
|
489
|
-
const i = e.adapted.title || "",
|
|
488
|
+
var r;
|
|
489
|
+
const i = e.adapted.title || "", n = m(e.adapted.body || ""), s = ((r = e.adapted.image) == null ? void 0 : r.url) || "";
|
|
490
490
|
return t === "list-item" ? `
|
|
491
491
|
<div class="ax-ad-source ax-ad-variant-list-item" data-ad-id="${e.original.id}">
|
|
492
|
-
${
|
|
492
|
+
${s ? `<img src="${s}" alt="${i}" loading="lazy" />` : ""}
|
|
493
493
|
<div class="ax-ad-source-info">
|
|
494
494
|
<span class="ax-ad-source-name">${i}</span>
|
|
495
495
|
<span class="ax-ad-sponsored-badge" style="font-size:9px">Ad</span>
|
|
@@ -501,20 +501,20 @@ const C = class C {
|
|
|
501
501
|
` : t === "minimal" ? `
|
|
502
502
|
<div data-ad-id="${e.original.id}" style="display:inline-flex">
|
|
503
503
|
<a class="ax-ad-source-link ax-ad-variant-minimal">
|
|
504
|
-
${
|
|
504
|
+
${s ? `<img src="${s}" alt="${i}" loading="lazy" style="width:16px;height:16px;border-radius:2px;object-fit:cover" />` : ""}
|
|
505
505
|
<span>${i}</span>
|
|
506
506
|
<span class="ax-ad-sponsored-badge" style="font-size:9px">Ad</span>
|
|
507
507
|
</a>
|
|
508
508
|
</div>
|
|
509
509
|
` : `
|
|
510
510
|
<div class="ax-ad-source ax-ad-variant-card" data-ad-id="${e.original.id}">
|
|
511
|
-
${
|
|
511
|
+
${s ? `<img src="${s}" alt="${i}" loading="lazy" style="width:48px;height:48px;border-radius:6px;object-fit:cover;flex-shrink:0" />` : ""}
|
|
512
512
|
<div class="ax-ad-source-info">
|
|
513
513
|
<div style="display:flex;align-items:center;gap:8px;margin-bottom:4px">
|
|
514
514
|
<span class="ax-ad-source-name">${i}</span>
|
|
515
515
|
<span class="ax-ad-sponsored-badge">Sponsored</span>
|
|
516
516
|
</div>
|
|
517
|
-
${
|
|
517
|
+
${n ? `<p class="ax-ad-source-desc">${n}</p>` : ""}
|
|
518
518
|
</div>
|
|
519
519
|
<svg width="16" height="16" fill="none" stroke="#d1d5db" viewBox="0 0 24 24" style="flex-shrink:0">
|
|
520
520
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
|
|
@@ -523,9 +523,9 @@ const C = class C {
|
|
|
523
523
|
`;
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
|
-
|
|
527
|
-
let y =
|
|
528
|
-
class
|
|
526
|
+
$.trackedImpressionKeys = /* @__PURE__ */ new Set();
|
|
527
|
+
let y = $;
|
|
528
|
+
class I {
|
|
529
529
|
constructor() {
|
|
530
530
|
this.cachedStaticInfo = null, this.cacheTimestamp = 0, this.CACHE_TTL = 36e5;
|
|
531
531
|
}
|
|
@@ -540,13 +540,13 @@ class T {
|
|
|
540
540
|
name: "Unknown App",
|
|
541
541
|
publisher: { id: "unknown" }
|
|
542
542
|
};
|
|
543
|
-
const e = this.inferBundle(), t = this.inferAppName(), i = this.inferAppVersion(),
|
|
543
|
+
const e = this.inferBundle(), t = this.inferAppName(), i = this.inferAppVersion(), n = this.inferPublisherId();
|
|
544
544
|
return {
|
|
545
545
|
bundle: e,
|
|
546
546
|
ver: i,
|
|
547
547
|
name: t,
|
|
548
548
|
publisher: {
|
|
549
|
-
id:
|
|
549
|
+
id: n,
|
|
550
550
|
domain: window.location.hostname
|
|
551
551
|
}
|
|
552
552
|
};
|
|
@@ -564,14 +564,14 @@ class T {
|
|
|
564
564
|
* 自动推断应用名称
|
|
565
565
|
*/
|
|
566
566
|
inferAppName() {
|
|
567
|
-
var
|
|
567
|
+
var n, s;
|
|
568
568
|
if (typeof document > "u") return "Unknown App";
|
|
569
569
|
const e = document.title;
|
|
570
570
|
if (e && e !== "Loading..." && e.length < 100)
|
|
571
571
|
return e;
|
|
572
|
-
const t = (
|
|
572
|
+
const t = (n = document.querySelector('meta[property="og:title"]')) == null ? void 0 : n.getAttribute("content");
|
|
573
573
|
if (t) return t;
|
|
574
|
-
const i = (
|
|
574
|
+
const i = (s = document.querySelector('meta[name="application-name"]')) == null ? void 0 : s.getAttribute("content");
|
|
575
575
|
return i || "Unknown App";
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
@@ -591,8 +591,8 @@ class T {
|
|
|
591
591
|
if (i) {
|
|
592
592
|
if (t.includes("manifest"))
|
|
593
593
|
return "1.0.0";
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
594
|
+
const n = i.getAttribute("content");
|
|
595
|
+
if (n) return n;
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
return "1.0.0";
|
|
@@ -601,18 +601,18 @@ class T {
|
|
|
601
601
|
* 自动推断publisher ID
|
|
602
602
|
*/
|
|
603
603
|
inferPublisherId() {
|
|
604
|
-
var i,
|
|
604
|
+
var i, n;
|
|
605
605
|
if (typeof document > "u") return "unknown";
|
|
606
606
|
const e = (i = document.querySelector('meta[name="publisher-id"]')) == null ? void 0 : i.getAttribute("content");
|
|
607
607
|
if (e) return e;
|
|
608
|
-
const t = (
|
|
608
|
+
const t = (n = window.location) == null ? void 0 : n.hostname;
|
|
609
609
|
return t ? t.replace(/\./g, "_") : "unknown";
|
|
610
610
|
}
|
|
611
611
|
/**
|
|
612
612
|
* Get singleton instance
|
|
613
613
|
*/
|
|
614
614
|
static getInstance() {
|
|
615
|
-
return this.instance || (this.instance = new
|
|
615
|
+
return this.instance || (this.instance = new I()), this.instance;
|
|
616
616
|
}
|
|
617
617
|
/**
|
|
618
618
|
* Collect all available client information
|
|
@@ -734,11 +734,11 @@ class T {
|
|
|
734
734
|
const i = e.match(/Android (\d+)\.(\d+)/);
|
|
735
735
|
if (i)
|
|
736
736
|
return `${i[1]}.${i[2]}`;
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
739
|
-
return
|
|
740
|
-
const
|
|
741
|
-
return
|
|
737
|
+
const n = e.match(/Windows NT (\d+\.\d+)/);
|
|
738
|
+
if (n)
|
|
739
|
+
return n[1];
|
|
740
|
+
const s = e.match(/Mac OS X (\d+[._]\d+)/);
|
|
741
|
+
return s ? s[1].replace("_", ".") : "Unknown";
|
|
742
742
|
}
|
|
743
743
|
/**
|
|
744
744
|
* Detect Device Type (OpenRTB standard)
|
|
@@ -763,13 +763,13 @@ class T {
|
|
|
763
763
|
const i = e.match(/Samsung-.*(SM-\w+)/);
|
|
764
764
|
if (i) return i[1];
|
|
765
765
|
if (/Pixel/.test(e)) return "Google Pixel";
|
|
766
|
-
const
|
|
767
|
-
if (
|
|
768
|
-
const
|
|
769
|
-
if (
|
|
766
|
+
const n = e.match(/(BARC-|HUAWEI-)?([A-Z]{2}\-\w{4})/);
|
|
767
|
+
if (n) return n[2];
|
|
768
|
+
const s = e.match(/(MI|Redmi|POCO)\s([\w\s]+)/);
|
|
769
|
+
if (s) return s[1] + " " + s[2];
|
|
770
770
|
if (/OnePlus/.test(e)) {
|
|
771
|
-
const
|
|
772
|
-
return
|
|
771
|
+
const r = e.match(/OnePlus\s([A-Z\d]+)/);
|
|
772
|
+
return r ? "OnePlus " + r[1] : "OnePlus";
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
@@ -882,9 +882,9 @@ class T {
|
|
|
882
882
|
if (t && i[t])
|
|
883
883
|
return i[t];
|
|
884
884
|
if (e) {
|
|
885
|
-
const
|
|
886
|
-
if (
|
|
887
|
-
return
|
|
885
|
+
const n = e.split("-")[1];
|
|
886
|
+
if (n)
|
|
887
|
+
return n.toUpperCase();
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
890
|
/**
|
|
@@ -915,105 +915,141 @@ class T {
|
|
|
915
915
|
this.cachedStaticInfo = null, this.cacheTimestamp = 0;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
const
|
|
919
|
-
function b(
|
|
920
|
-
return
|
|
918
|
+
const C = () => I.getInstance();
|
|
919
|
+
function b(o) {
|
|
920
|
+
return C().collect(o);
|
|
921
921
|
}
|
|
922
|
-
function
|
|
922
|
+
function te() {
|
|
923
923
|
return b().device;
|
|
924
924
|
}
|
|
925
925
|
function H() {
|
|
926
926
|
return b().user;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function ie() {
|
|
929
929
|
return b().app;
|
|
930
930
|
}
|
|
931
|
-
function
|
|
931
|
+
function ne() {
|
|
932
932
|
return b().geo;
|
|
933
933
|
}
|
|
934
934
|
function D() {
|
|
935
935
|
return H().id;
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
|
|
937
|
+
function se() {
|
|
938
|
+
C().clearCache();
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
const e = b(
|
|
940
|
+
function re(o) {
|
|
941
|
+
const e = b(o);
|
|
942
942
|
return JSON.stringify(e, null, 2);
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function oe() {
|
|
945
945
|
var t;
|
|
946
|
-
const
|
|
946
|
+
const o = b();
|
|
947
947
|
return [
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
((t =
|
|
948
|
+
o.device.os,
|
|
949
|
+
o.device.osv,
|
|
950
|
+
o.app.name,
|
|
951
|
+
o.user.id.slice(0, 8) + "...",
|
|
952
|
+
((t = o.geo) == null ? void 0 : t.country) || "Unknown"
|
|
953
953
|
].join(" / ");
|
|
954
954
|
}
|
|
955
|
-
function
|
|
956
|
-
|
|
957
|
-
|
|
955
|
+
function B() {
|
|
956
|
+
if (typeof crypto > "u" || !crypto.subtle)
|
|
957
|
+
throw new Error("Web Crypto API not supported");
|
|
958
|
+
}
|
|
959
|
+
async function G(o, e) {
|
|
960
|
+
B();
|
|
961
|
+
const t = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(e)), i = await crypto.subtle.importKey("raw", t, "AES-GCM", !1, ["encrypt"]), n = crypto.getRandomValues(new Uint8Array(12)), s = await crypto.subtle.encrypt(
|
|
962
|
+
{ name: "AES-GCM", iv: n },
|
|
963
|
+
i,
|
|
964
|
+
new TextEncoder().encode(o)
|
|
965
|
+
), r = new Uint8Array(n.length + s.byteLength);
|
|
966
|
+
return r.set(n), r.set(new Uint8Array(s), n.length), btoa(String.fromCharCode(...r));
|
|
967
|
+
}
|
|
968
|
+
async function F(o, e) {
|
|
969
|
+
B();
|
|
970
|
+
const t = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(e)), i = await crypto.subtle.importKey("raw", t, "AES-GCM", !1, ["decrypt"]), n = Uint8Array.from(atob(o), (c) => c.charCodeAt(0)), s = n.slice(0, 12), r = n.slice(12), a = await crypto.subtle.decrypt(
|
|
971
|
+
{ name: "AES-GCM", iv: s },
|
|
972
|
+
i,
|
|
973
|
+
r
|
|
974
|
+
);
|
|
975
|
+
return new TextDecoder().decode(a);
|
|
976
|
+
}
|
|
977
|
+
function z() {
|
|
978
|
+
var o;
|
|
979
|
+
return typeof window < "u" ? !!((o = window.__AD_CONFIG__) != null && o.debug) : !1;
|
|
958
980
|
}
|
|
959
|
-
function
|
|
981
|
+
function ae(o) {
|
|
960
982
|
var e, t;
|
|
961
983
|
return {
|
|
962
|
-
id:
|
|
963
|
-
type:
|
|
964
|
-
score:
|
|
984
|
+
id: o.original.id,
|
|
985
|
+
type: o.original.type,
|
|
986
|
+
score: o.original.score,
|
|
965
987
|
source: "internal",
|
|
966
988
|
// Default source
|
|
967
989
|
content: {
|
|
968
|
-
title:
|
|
969
|
-
body:
|
|
970
|
-
image: (e =
|
|
971
|
-
cta_text:
|
|
972
|
-
price: (t =
|
|
973
|
-
rating:
|
|
974
|
-
brand:
|
|
990
|
+
title: o.adapted.title,
|
|
991
|
+
body: o.adapted.body,
|
|
992
|
+
image: (e = o.adapted.image) == null ? void 0 : e.url,
|
|
993
|
+
cta_text: o.adapted.ctaText,
|
|
994
|
+
price: (t = o.adapted.price) == null ? void 0 : t.display,
|
|
995
|
+
rating: o.adapted.rating,
|
|
996
|
+
brand: o.adapted.brand
|
|
975
997
|
},
|
|
976
998
|
tracking: {
|
|
977
|
-
click_url:
|
|
978
|
-
impression_url:
|
|
999
|
+
click_url: o.tracking.clickUrl || o.tracking.click_url || "",
|
|
1000
|
+
impression_url: o.tracking.impressionUrl || o.tracking.impression_url || ""
|
|
979
1001
|
},
|
|
980
1002
|
metadata: {
|
|
981
|
-
viewToken:
|
|
982
|
-
styling:
|
|
1003
|
+
viewToken: o.tracking.viewToken || o.tracking.view_token,
|
|
1004
|
+
styling: o.adapted.styling
|
|
983
1005
|
}
|
|
984
1006
|
};
|
|
985
1007
|
}
|
|
986
|
-
async function
|
|
987
|
-
const t = e.apiBaseUrl || "/api/v1", s =
|
|
988
|
-
...
|
|
1008
|
+
async function j(o, e = {}) {
|
|
1009
|
+
const t = e.apiBaseUrl || "/api/v1", i = z(), s = C().collect(), r = {
|
|
1010
|
+
...o,
|
|
989
1011
|
clientInfo: s
|
|
990
|
-
|
|
991
|
-
}, o = {
|
|
1012
|
+
}, a = {
|
|
992
1013
|
"Content-Type": "application/json"
|
|
993
1014
|
};
|
|
994
|
-
e.apiKey && (
|
|
995
|
-
|
|
1015
|
+
e.apiKey && (a["X-API-Key"] = e.apiKey);
|
|
1016
|
+
let c;
|
|
1017
|
+
if (e.apiKey && !i)
|
|
1018
|
+
try {
|
|
1019
|
+
c = { encryptedPayload: await G(JSON.stringify(r), e.apiKey) };
|
|
1020
|
+
} catch (h) {
|
|
1021
|
+
i && console.warn("[fetchAds] Encryption failed, using plaintext:", h), c = r;
|
|
1022
|
+
}
|
|
1023
|
+
else
|
|
1024
|
+
c = r;
|
|
1025
|
+
i && (console.log("[fetchAds] Request URL:", `${t}/ads/request`), console.log("[fetchAds] Request body:", c));
|
|
1026
|
+
const d = await fetch(`${t}/ads/request`, {
|
|
996
1027
|
method: "POST",
|
|
997
|
-
headers:
|
|
998
|
-
body: JSON.stringify(
|
|
1028
|
+
headers: a,
|
|
1029
|
+
body: JSON.stringify(c)
|
|
999
1030
|
});
|
|
1000
|
-
if (!
|
|
1001
|
-
throw new Error(`Ad request failed: ${
|
|
1002
|
-
const
|
|
1003
|
-
if (
|
|
1004
|
-
throw new Error(
|
|
1005
|
-
|
|
1031
|
+
if (!d.ok)
|
|
1032
|
+
throw new Error(`Ad request failed: ${d.status} ${d.statusText}`);
|
|
1033
|
+
const l = await d.json();
|
|
1034
|
+
if (!l.success)
|
|
1035
|
+
throw new Error(l.error || "Ad request failed");
|
|
1036
|
+
let u = l.data;
|
|
1037
|
+
if (l.data.encryptedPayload && e.apiKey) {
|
|
1038
|
+
const h = await F(l.data.encryptedPayload, e.apiKey);
|
|
1039
|
+
u = JSON.parse(h);
|
|
1040
|
+
}
|
|
1041
|
+
return i && console.log("[fetchAds] Response:", u), u;
|
|
1006
1042
|
}
|
|
1007
|
-
const
|
|
1043
|
+
const W = { width: 400, height: 200 }, S = {
|
|
1008
1044
|
variant: "horizontal",
|
|
1009
1045
|
count: 1,
|
|
1010
1046
|
preferences: {}
|
|
1011
1047
|
};
|
|
1012
|
-
function
|
|
1048
|
+
function M(o = {}) {
|
|
1013
1049
|
const e = {
|
|
1014
|
-
variant:
|
|
1015
|
-
count:
|
|
1016
|
-
preferences: { ...
|
|
1050
|
+
variant: o.variant ?? S.variant,
|
|
1051
|
+
count: o.count ?? S.count,
|
|
1052
|
+
preferences: { ...S.preferences, ...o.preferences }
|
|
1017
1053
|
};
|
|
1018
1054
|
return [
|
|
1019
1055
|
{
|
|
@@ -1021,7 +1057,7 @@ function _(r = {}) {
|
|
|
1021
1057
|
slotName: "Action Card",
|
|
1022
1058
|
format: "action_card",
|
|
1023
1059
|
variant: e.variant,
|
|
1024
|
-
size:
|
|
1060
|
+
size: W,
|
|
1025
1061
|
count: e.count,
|
|
1026
1062
|
preferences: e.preferences,
|
|
1027
1063
|
placement: { position: "below_fold", context: "post_response" }
|
|
@@ -1030,7 +1066,7 @@ function _(r = {}) {
|
|
|
1030
1066
|
}
|
|
1031
1067
|
const g = class g {
|
|
1032
1068
|
constructor(e) {
|
|
1033
|
-
this.slots = {}, this.isLoading = !1, this.currentRequestId = null, this.adsAnalyticsMap = /* @__PURE__ */ new Map(), this.config = e, this.enabled = e.enabled !== !1, this.eventBus = new q(), this.slots_config =
|
|
1069
|
+
this.slots = {}, this.isLoading = !1, this.currentRequestId = null, this.adsAnalyticsMap = /* @__PURE__ */ new Map(), this.config = e, this.enabled = e.enabled !== !1, this.eventBus = new q(), this.slots_config = M(e.cardOption), typeof window < "u" && (window.__AD_CONFIG__ = {
|
|
1034
1070
|
...window.__AD_CONFIG__ || {},
|
|
1035
1071
|
apiKey: e.apiKey,
|
|
1036
1072
|
apiBaseUrl: e.apiBaseUrl,
|
|
@@ -1044,17 +1080,17 @@ const g = class g {
|
|
|
1044
1080
|
async requestAds(e) {
|
|
1045
1081
|
const t = "conversationContext" in e ? e : { conversationContext: e };
|
|
1046
1082
|
this.currentUserId = this.resolveUserId(t.userContext);
|
|
1047
|
-
const i = this.buildRequestKey(t),
|
|
1048
|
-
if (
|
|
1049
|
-
return this.config.debug && console.log("[AdManager] Reusing in-flight request for identical context"),
|
|
1083
|
+
const i = this.buildRequestKey(t), n = g.inFlightRequests.get(i);
|
|
1084
|
+
if (n)
|
|
1085
|
+
return this.config.debug && console.log("[AdManager] Reusing in-flight request for identical context"), n;
|
|
1050
1086
|
if (!this.enabled)
|
|
1051
1087
|
throw this.config.debug && console.warn("[AdManager] Ads are disabled, skipping request"), new Error("Ads are disabled");
|
|
1052
1088
|
if (this.isLoading)
|
|
1053
1089
|
throw this.config.debug && console.warn("[AdManager] Request already in progress"), new Error("Request already in progress");
|
|
1054
1090
|
this.isLoading = !0, this.eventBus.emit("adsLoading"), this.config.debug && console.log("[AdManager] Starting ad request...");
|
|
1055
|
-
const
|
|
1091
|
+
const s = (async () => {
|
|
1056
1092
|
try {
|
|
1057
|
-
const
|
|
1093
|
+
const r = await j(
|
|
1058
1094
|
{
|
|
1059
1095
|
conversationContext: t.conversationContext,
|
|
1060
1096
|
userContext: t.userContext ? {
|
|
@@ -1069,11 +1105,11 @@ const g = class g {
|
|
|
1069
1105
|
apiKey: this.config.apiKey
|
|
1070
1106
|
}
|
|
1071
1107
|
);
|
|
1072
|
-
this.currentRequestId =
|
|
1073
|
-
c.ads.forEach((
|
|
1074
|
-
const
|
|
1075
|
-
this.adsAnalyticsMap.set(
|
|
1076
|
-
requestId:
|
|
1108
|
+
this.currentRequestId = r.requestId, this.adsAnalyticsMap.clear(), r.slots.forEach((c) => {
|
|
1109
|
+
c.ads.forEach((d, l) => {
|
|
1110
|
+
const u = d.original.id;
|
|
1111
|
+
this.adsAnalyticsMap.set(u, {
|
|
1112
|
+
requestId: r.requestId,
|
|
1077
1113
|
slotId: c.slotId,
|
|
1078
1114
|
position: l,
|
|
1079
1115
|
totalAds: c.ads.length,
|
|
@@ -1083,20 +1119,20 @@ const g = class g {
|
|
|
1083
1119
|
});
|
|
1084
1120
|
});
|
|
1085
1121
|
const a = {};
|
|
1086
|
-
return
|
|
1122
|
+
return r.slots.forEach((c) => {
|
|
1087
1123
|
a[c.slotId] = c;
|
|
1088
1124
|
}), this.slots = a, this.eventBus.emit("adsUpdated", this.slots), this.config.debug && console.log("[AdManager] Ads received:", {
|
|
1089
1125
|
slotCount: Object.keys(this.slots).length,
|
|
1090
1126
|
slots: Object.keys(this.slots)
|
|
1091
|
-
}),
|
|
1092
|
-
} catch (
|
|
1093
|
-
const a =
|
|
1127
|
+
}), r;
|
|
1128
|
+
} catch (r) {
|
|
1129
|
+
const a = r;
|
|
1094
1130
|
throw this.eventBus.emit("adsError", a), a;
|
|
1095
1131
|
} finally {
|
|
1096
1132
|
this.isLoading = !1, g.inFlightRequests.delete(i);
|
|
1097
1133
|
}
|
|
1098
1134
|
})();
|
|
1099
|
-
return g.inFlightRequests.set(i,
|
|
1135
|
+
return g.inFlightRequests.set(i, s), s;
|
|
1100
1136
|
}
|
|
1101
1137
|
buildRequestKey(e) {
|
|
1102
1138
|
return JSON.stringify({
|
|
@@ -1117,24 +1153,24 @@ const g = class g {
|
|
|
1117
1153
|
}
|
|
1118
1154
|
}
|
|
1119
1155
|
render(e, t, i = {}) {
|
|
1120
|
-
const
|
|
1121
|
-
if (!
|
|
1156
|
+
const n = typeof e != "string", s = n ? g.DEFAULT_SLOT_ID : e, r = n ? e : t, a = (n ? t : i) || {};
|
|
1157
|
+
if (!r)
|
|
1122
1158
|
return this.config.debug && console.warn("[AdManager] Render container is required"), null;
|
|
1123
|
-
const c = this.slots[
|
|
1159
|
+
const c = this.slots[s];
|
|
1124
1160
|
if (!c || !c.ads || c.ads.length === 0)
|
|
1125
|
-
return this.config.debug && console.warn("[AdManager] No ads in slot:",
|
|
1126
|
-
const
|
|
1161
|
+
return this.config.debug && console.warn("[AdManager] No ads in slot:", s), null;
|
|
1162
|
+
const d = a.adIndex ?? 0, l = c.ads[d];
|
|
1127
1163
|
if (!l)
|
|
1128
|
-
return this.config.debug && console.warn(`[AdManager] Ad at index ${
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1164
|
+
return this.config.debug && console.warn(`[AdManager] Ad at index ${d} not found in slot:`, s), null;
|
|
1165
|
+
const u = this.adsAnalyticsMap.get(l.original.id), h = this.slots_config.find((k) => k.slotId === s), p = (h == null ? void 0 : h.format) || "action_card";
|
|
1166
|
+
r.innerHTML = "";
|
|
1131
1167
|
const f = {
|
|
1132
|
-
analytics:
|
|
1168
|
+
analytics: u,
|
|
1133
1169
|
variant: a.variant,
|
|
1134
1170
|
onClick: a.onClick,
|
|
1135
1171
|
onImpression: a.onImpression
|
|
1136
1172
|
};
|
|
1137
|
-
return p === "suffix" ? y.renderSuffixAd(l,
|
|
1173
|
+
return p === "suffix" ? y.renderSuffixAd(l, r, f) : p === "source" ? y.renderSponsoredSource(l, r, f) : p === "lead_gen" ? y.renderLeadGenAd(l, r, f) : y.renderActionCard(l, r, f);
|
|
1138
1174
|
}
|
|
1139
1175
|
/**
|
|
1140
1176
|
* Get ad slots data
|
|
@@ -1173,7 +1209,7 @@ const g = class g {
|
|
|
1173
1209
|
* Update configuration
|
|
1174
1210
|
*/
|
|
1175
1211
|
updateConfig(e) {
|
|
1176
|
-
this.config = { ...this.config, ...e }, e.cardOption !== void 0 && (this.slots_config =
|
|
1212
|
+
this.config = { ...this.config, ...e }, e.cardOption !== void 0 && (this.slots_config = M(this.config.cardOption)), this.config.debug && console.log("[AdManager] Config updated:", e);
|
|
1177
1213
|
}
|
|
1178
1214
|
/**
|
|
1179
1215
|
* Clear all slot data
|
|
@@ -1217,29 +1253,29 @@ const g = class g {
|
|
|
1217
1253
|
getAdsAnalytics(e) {
|
|
1218
1254
|
const t = /* @__PURE__ */ new Map();
|
|
1219
1255
|
return e.forEach((i) => {
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1256
|
+
const n = this.adsAnalyticsMap.get(i);
|
|
1257
|
+
n && t.set(i, n);
|
|
1222
1258
|
}), t;
|
|
1223
1259
|
}
|
|
1224
1260
|
/**
|
|
1225
1261
|
* Track ad click using Analytics API
|
|
1226
1262
|
*/
|
|
1227
1263
|
async trackAdClick(e, t, i) {
|
|
1228
|
-
const
|
|
1229
|
-
if (!
|
|
1264
|
+
const n = this.adsAnalyticsMap.get(e);
|
|
1265
|
+
if (!n || !this.currentRequestId)
|
|
1230
1266
|
return this.config.debug && console.warn("[AdManager] No analytics info for ad:", e), null;
|
|
1231
|
-
const
|
|
1267
|
+
const s = w(), r = await O({
|
|
1232
1268
|
requestId: this.currentRequestId,
|
|
1233
1269
|
adId: e,
|
|
1234
1270
|
destinationUrl: t,
|
|
1235
|
-
sessionId:
|
|
1236
|
-
slotId:
|
|
1271
|
+
sessionId: s,
|
|
1272
|
+
slotId: n.slotId,
|
|
1237
1273
|
adTitle: i == null ? void 0 : i.title,
|
|
1238
1274
|
format: i == null ? void 0 : i.format,
|
|
1239
1275
|
source: i == null ? void 0 : i.source,
|
|
1240
|
-
userId:
|
|
1241
|
-
}, { baseUrl:
|
|
1242
|
-
return
|
|
1276
|
+
userId: n.userId ?? this.currentUserId
|
|
1277
|
+
}, { baseUrl: n.apiBaseUrl });
|
|
1278
|
+
return r && (this.eventBus.emit("adClicked", e, n.slotId), this.config.debug && console.log("[AdManager] Click tracked via Analytics API:", r.eventId)), r;
|
|
1243
1279
|
}
|
|
1244
1280
|
/**
|
|
1245
1281
|
* Track ad impression using Analytics API
|
|
@@ -1248,20 +1284,20 @@ const g = class g {
|
|
|
1248
1284
|
const i = this.adsAnalyticsMap.get(e);
|
|
1249
1285
|
if (!i || !this.currentRequestId)
|
|
1250
1286
|
return this.config.debug && console.warn("[AdManager] No analytics info for ad:", e), null;
|
|
1251
|
-
const
|
|
1287
|
+
const n = w(), s = await T({
|
|
1252
1288
|
requestId: this.currentRequestId,
|
|
1253
1289
|
adId: e,
|
|
1254
1290
|
slotId: i.slotId,
|
|
1255
1291
|
position: i.position,
|
|
1256
1292
|
totalAds: i.totalAds,
|
|
1257
|
-
sessionId:
|
|
1293
|
+
sessionId: n,
|
|
1258
1294
|
adTitle: t == null ? void 0 : t.title,
|
|
1259
1295
|
format: t == null ? void 0 : t.format,
|
|
1260
1296
|
source: t == null ? void 0 : t.source,
|
|
1261
1297
|
viewToken: t == null ? void 0 : t.viewToken,
|
|
1262
1298
|
userId: i.userId ?? this.currentUserId
|
|
1263
1299
|
}, { baseUrl: i.apiBaseUrl });
|
|
1264
|
-
return
|
|
1300
|
+
return s && (this.eventBus.emit("adImpression", e, i.slotId), this.config.debug && console.log("[AdManager] Impression tracked via Analytics API:", s.eventId)), s;
|
|
1265
1301
|
}
|
|
1266
1302
|
/**
|
|
1267
1303
|
* Destroy the manager and clean up
|
|
@@ -1271,24 +1307,24 @@ const g = class g {
|
|
|
1271
1307
|
}
|
|
1272
1308
|
};
|
|
1273
1309
|
g.DEFAULT_SLOT_ID = "action_card", g.inFlightRequests = /* @__PURE__ */ new Map();
|
|
1274
|
-
let
|
|
1310
|
+
let _ = g;
|
|
1275
1311
|
function E() {
|
|
1276
1312
|
if (typeof window < "u") {
|
|
1277
|
-
const
|
|
1278
|
-
if (
|
|
1279
|
-
return
|
|
1313
|
+
const o = window.__AD_CONFIG__;
|
|
1314
|
+
if (o != null && o.apiKey)
|
|
1315
|
+
return o.apiKey;
|
|
1280
1316
|
}
|
|
1281
1317
|
}
|
|
1282
|
-
class
|
|
1318
|
+
class Q {
|
|
1283
1319
|
constructor(e = {}, t = "/api/v1") {
|
|
1284
|
-
var i,
|
|
1320
|
+
var i, n;
|
|
1285
1321
|
this.observers = /* @__PURE__ */ new Map(), this.metrics = /* @__PURE__ */ new Map(), this.timers = /* @__PURE__ */ new Map(), this.batchTimers = /* @__PURE__ */ new Map(), this.eventQueue = /* @__PURE__ */ new Map(), this.isTracking = /* @__PURE__ */ new Map(), this.config = {
|
|
1286
1322
|
minVisiblePercentage: e.minVisiblePercentage ?? 50,
|
|
1287
1323
|
minViewableDuration: e.minViewableDuration ?? 1e3,
|
|
1288
1324
|
maxTrackingDuration: e.maxTrackingDuration ?? 6e4,
|
|
1289
1325
|
batchConfig: {
|
|
1290
1326
|
maxBatchSize: ((i = e.batchConfig) == null ? void 0 : i.maxBatchSize) ?? 5,
|
|
1291
|
-
maxBatchWaitMs: ((
|
|
1327
|
+
maxBatchWaitMs: ((n = e.batchConfig) == null ? void 0 : n.maxBatchWaitMs) ?? 1e4
|
|
1292
1328
|
},
|
|
1293
1329
|
debug: e.debug ?? !1
|
|
1294
1330
|
}, this.baseUrl = t;
|
|
@@ -1296,13 +1332,13 @@ class z {
|
|
|
1296
1332
|
/**
|
|
1297
1333
|
* Start tracking viewability for an ad element
|
|
1298
1334
|
*/
|
|
1299
|
-
startTracking(e, t, i,
|
|
1335
|
+
startTracking(e, t, i, n, s) {
|
|
1300
1336
|
if (this.isTracking.get(e)) {
|
|
1301
1337
|
this.log(`[ViewabilityTracker] Already tracking ${e}, skipping`);
|
|
1302
1338
|
return;
|
|
1303
1339
|
}
|
|
1304
1340
|
this.log(`[ViewabilityTracker] Starting tracking for ${e}`);
|
|
1305
|
-
const
|
|
1341
|
+
const r = {
|
|
1306
1342
|
visiblePercentage: 0,
|
|
1307
1343
|
maxVisiblePercentage: 0,
|
|
1308
1344
|
totalVisibleTimeMs: 0,
|
|
@@ -1312,16 +1348,16 @@ class z {
|
|
|
1312
1348
|
enteredViewportAt: null,
|
|
1313
1349
|
enterCount: 0
|
|
1314
1350
|
};
|
|
1315
|
-
this.metrics.set(e,
|
|
1351
|
+
this.metrics.set(e, r), this.isTracking.set(e, !0), this.eventQueue.set(e, []);
|
|
1316
1352
|
const a = new IntersectionObserver(
|
|
1317
|
-
(
|
|
1353
|
+
(d) => this.handleIntersection(e, d[0], i, n, s),
|
|
1318
1354
|
{
|
|
1319
1355
|
threshold: this.createThresholds()
|
|
1320
1356
|
}
|
|
1321
1357
|
);
|
|
1322
|
-
a.observe(t), this.observers.set(e, a), this.startMonitoring(e, i,
|
|
1358
|
+
a.observe(t), this.observers.set(e, a), this.startMonitoring(e, i, n, s);
|
|
1323
1359
|
const c = setTimeout(() => {
|
|
1324
|
-
this.endTracking(e, i,
|
|
1360
|
+
this.endTracking(e, i, n, s);
|
|
1325
1361
|
}, this.config.maxTrackingDuration);
|
|
1326
1362
|
this.timers.set(e, c);
|
|
1327
1363
|
}
|
|
@@ -1341,59 +1377,59 @@ class z {
|
|
|
1341
1377
|
* Handle IntersectionObserver callback
|
|
1342
1378
|
* Event-driven: Only process when state actually changes
|
|
1343
1379
|
*/
|
|
1344
|
-
handleIntersection(e, t, i,
|
|
1345
|
-
const
|
|
1346
|
-
if (!
|
|
1347
|
-
const a =
|
|
1348
|
-
|
|
1349
|
-
const
|
|
1350
|
-
if (l && !
|
|
1380
|
+
handleIntersection(e, t, i, n, s) {
|
|
1381
|
+
const r = this.metrics.get(e);
|
|
1382
|
+
if (!r || !this.isTracking.get(e)) return;
|
|
1383
|
+
const a = r.isViewable, c = Math.round(t.intersectionRatio * 100);
|
|
1384
|
+
r.visiblePercentage = c, r.maxVisiblePercentage = Math.max(r.maxVisiblePercentage, c);
|
|
1385
|
+
const d = Date.now(), l = c >= this.config.minVisiblePercentage;
|
|
1386
|
+
if (l && !r.enteredViewportAt && (r.enteredViewportAt = d, r.enterCount++, this.log(`[ViewabilityTracker] ${e} entered viewport at ${d}`), this.queueEvent(e, {
|
|
1351
1387
|
adId: e,
|
|
1352
1388
|
sessionId: i,
|
|
1353
|
-
requestId:
|
|
1354
|
-
viewToken:
|
|
1389
|
+
requestId: n,
|
|
1390
|
+
viewToken: s,
|
|
1355
1391
|
eventType: "enter_viewport",
|
|
1356
1392
|
visiblePercentage: c,
|
|
1357
|
-
maxVisiblePercentage:
|
|
1358
|
-
totalVisibleTimeMs:
|
|
1393
|
+
maxVisiblePercentage: r.maxVisiblePercentage,
|
|
1394
|
+
totalVisibleTimeMs: r.totalVisibleTimeMs,
|
|
1359
1395
|
isViewable: !1,
|
|
1360
|
-
timestamp:
|
|
1361
|
-
})), !l &&
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1396
|
+
timestamp: d
|
|
1397
|
+
})), !l && r.enteredViewportAt) {
|
|
1398
|
+
const u = d - r.enteredViewportAt;
|
|
1399
|
+
r.totalVisibleTimeMs += u, r.enteredViewportAt = null, r.currentVisibleTimeMs = 0, this.log(`[ViewabilityTracker] ${e} exited viewport, total visible: ${r.totalVisibleTimeMs}ms`), this.queueEvent(e, {
|
|
1364
1400
|
adId: e,
|
|
1365
1401
|
sessionId: i,
|
|
1366
|
-
requestId:
|
|
1367
|
-
viewToken:
|
|
1402
|
+
requestId: n,
|
|
1403
|
+
viewToken: s,
|
|
1368
1404
|
eventType: "exit_viewport",
|
|
1369
1405
|
visiblePercentage: c,
|
|
1370
|
-
maxVisiblePercentage:
|
|
1371
|
-
totalVisibleTimeMs:
|
|
1372
|
-
isViewable:
|
|
1373
|
-
timestamp:
|
|
1406
|
+
maxVisiblePercentage: r.maxVisiblePercentage,
|
|
1407
|
+
totalVisibleTimeMs: r.totalVisibleTimeMs,
|
|
1408
|
+
isViewable: r.isViewable,
|
|
1409
|
+
timestamp: d
|
|
1374
1410
|
});
|
|
1375
1411
|
}
|
|
1376
|
-
|
|
1412
|
+
r.isViewable !== a && r.isViewable && this.log(`[ViewabilityTracker] ${e} became VIEWABLE!`), this.metrics.set(e, r);
|
|
1377
1413
|
}
|
|
1378
1414
|
/**
|
|
1379
1415
|
* Start monitoring loop for tracking duration
|
|
1380
1416
|
* Runs every 100ms to track continuous visible time
|
|
1381
1417
|
*/
|
|
1382
|
-
startMonitoring(e, t, i,
|
|
1383
|
-
const
|
|
1418
|
+
startMonitoring(e, t, i, n) {
|
|
1419
|
+
const r = setInterval(() => {
|
|
1384
1420
|
const a = this.metrics.get(e);
|
|
1385
1421
|
if (!a || !this.isTracking.get(e)) {
|
|
1386
|
-
clearInterval(
|
|
1422
|
+
clearInterval(r);
|
|
1387
1423
|
return;
|
|
1388
1424
|
}
|
|
1389
|
-
const c = Date.now(),
|
|
1425
|
+
const c = Date.now(), d = a.isViewable;
|
|
1390
1426
|
if (a.enteredViewportAt) {
|
|
1391
1427
|
const l = c - a.enteredViewportAt;
|
|
1392
|
-
a.currentVisibleTimeMs = l, l >= this.config.minViewableDuration && a.visiblePercentage >= this.config.minVisiblePercentage && (a.isViewable = !0,
|
|
1428
|
+
a.currentVisibleTimeMs = l, l >= this.config.minViewableDuration && a.visiblePercentage >= this.config.minVisiblePercentage && (a.isViewable = !0, d || (a.viewableAt = a.enteredViewportAt, this.log(`[ViewabilityTracker] ${e} BECAME VIEWABLE at ${a.viewableAt}`), this.queueEvent(e, {
|
|
1393
1429
|
adId: e,
|
|
1394
1430
|
sessionId: t,
|
|
1395
1431
|
requestId: i,
|
|
1396
|
-
viewToken:
|
|
1432
|
+
viewToken: n,
|
|
1397
1433
|
eventType: "become_viewable",
|
|
1398
1434
|
visiblePercentage: a.visiblePercentage,
|
|
1399
1435
|
maxVisiblePercentage: a.maxVisiblePercentage,
|
|
@@ -1404,29 +1440,29 @@ class z {
|
|
|
1404
1440
|
}
|
|
1405
1441
|
a.enteredViewportAt && (a.totalVisibleTimeMs += 100), this.metrics.set(e, a);
|
|
1406
1442
|
}, 100);
|
|
1407
|
-
this.timers.set(`${e}_monitoring`,
|
|
1443
|
+
this.timers.set(`${e}_monitoring`, r);
|
|
1408
1444
|
}
|
|
1409
1445
|
/**
|
|
1410
1446
|
* Queue an event to be sent (batched)
|
|
1411
1447
|
*/
|
|
1412
1448
|
queueEvent(e, t) {
|
|
1413
|
-
var
|
|
1449
|
+
var s, r;
|
|
1414
1450
|
const i = this.eventQueue.get(e);
|
|
1415
1451
|
if (!i) {
|
|
1416
1452
|
this.log(`[ViewabilityTracker] No queue found for ${e}, skipping event`);
|
|
1417
1453
|
return;
|
|
1418
1454
|
}
|
|
1419
1455
|
i.push(t), this.log(`[ViewabilityTracker] Queued ${t.eventType} for ${e} (queue size: ${i.length})`);
|
|
1420
|
-
const
|
|
1421
|
-
if (i.length >=
|
|
1456
|
+
const n = ((s = this.config.batchConfig) == null ? void 0 : s.maxBatchSize) ?? 5;
|
|
1457
|
+
if (i.length >= n)
|
|
1422
1458
|
this.flushQueue(e);
|
|
1423
1459
|
else {
|
|
1424
1460
|
const a = this.batchTimers.get(e);
|
|
1425
1461
|
a && clearTimeout(a);
|
|
1426
|
-
const c = ((
|
|
1462
|
+
const c = ((r = this.config.batchConfig) == null ? void 0 : r.maxBatchWaitMs) ?? 1e4, d = setTimeout(() => {
|
|
1427
1463
|
this.flushQueue(e);
|
|
1428
1464
|
}, c);
|
|
1429
|
-
this.batchTimers.set(e,
|
|
1465
|
+
this.batchTimers.set(e, d);
|
|
1430
1466
|
}
|
|
1431
1467
|
}
|
|
1432
1468
|
/**
|
|
@@ -1438,37 +1474,37 @@ class z {
|
|
|
1438
1474
|
const i = [...t];
|
|
1439
1475
|
t.length = 0, this.log(`[ViewabilityTracker] Flushing ${i.length} events for ${e}`);
|
|
1440
1476
|
try {
|
|
1441
|
-
const
|
|
1477
|
+
const n = {
|
|
1442
1478
|
"Content-Type": "application/json"
|
|
1443
|
-
},
|
|
1444
|
-
|
|
1479
|
+
}, s = E();
|
|
1480
|
+
s && (n["x-api-key"] = s), await fetch(`${this.baseUrl}/ads/viewability/batch`, {
|
|
1445
1481
|
method: "POST",
|
|
1446
|
-
headers:
|
|
1482
|
+
headers: n,
|
|
1447
1483
|
body: JSON.stringify({ events: i })
|
|
1448
1484
|
}), this.log(`[ViewabilityTracker] Successfully sent ${i.length} events for ${e}`);
|
|
1449
|
-
} catch (
|
|
1450
|
-
this.log(`[ViewabilityTracker] Failed to send events for ${e}:`,
|
|
1485
|
+
} catch (n) {
|
|
1486
|
+
this.log(`[ViewabilityTracker] Failed to send events for ${e}:`, n), t.unshift(...i);
|
|
1451
1487
|
}
|
|
1452
1488
|
}
|
|
1453
1489
|
/**
|
|
1454
1490
|
* End tracking and send final metrics
|
|
1455
1491
|
*/
|
|
1456
|
-
endTracking(e, t, i,
|
|
1457
|
-
const
|
|
1458
|
-
if (!
|
|
1492
|
+
endTracking(e, t, i, n) {
|
|
1493
|
+
const s = this.metrics.get(e);
|
|
1494
|
+
if (!s) return;
|
|
1459
1495
|
this.log(`[ViewabilityTracker] Ending tracking for ${e}`), this.flushQueue(e);
|
|
1460
|
-
const
|
|
1496
|
+
const r = Date.now();
|
|
1461
1497
|
this.queueEvent(e, {
|
|
1462
1498
|
adId: e,
|
|
1463
1499
|
sessionId: t,
|
|
1464
1500
|
requestId: i,
|
|
1465
|
-
viewToken:
|
|
1501
|
+
viewToken: n,
|
|
1466
1502
|
eventType: "end_tracking",
|
|
1467
|
-
visiblePercentage:
|
|
1468
|
-
maxVisiblePercentage:
|
|
1469
|
-
totalVisibleTimeMs:
|
|
1470
|
-
isViewable:
|
|
1471
|
-
timestamp:
|
|
1503
|
+
visiblePercentage: s.visiblePercentage,
|
|
1504
|
+
maxVisiblePercentage: s.maxVisiblePercentage,
|
|
1505
|
+
totalVisibleTimeMs: s.totalVisibleTimeMs,
|
|
1506
|
+
isViewable: s.isViewable,
|
|
1507
|
+
timestamp: r
|
|
1472
1508
|
}), this.flushQueue(e), this.cleanup(e);
|
|
1473
1509
|
}
|
|
1474
1510
|
/**
|
|
@@ -1479,10 +1515,10 @@ class z {
|
|
|
1479
1515
|
t && (t.disconnect(), this.observers.delete(e));
|
|
1480
1516
|
const i = this.timers.get(e);
|
|
1481
1517
|
i && (clearTimeout(i), this.timers.delete(e));
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1518
|
+
const n = this.timers.get(`${e}_monitoring`);
|
|
1519
|
+
n && (clearInterval(n), this.timers.delete(`${e}_monitoring`));
|
|
1520
|
+
const s = this.batchTimers.get(e);
|
|
1521
|
+
s && (clearTimeout(s), this.batchTimers.delete(e)), this.flushQueue(e), this.isTracking.delete(e), this.metrics.delete(e), this.eventQueue.delete(e);
|
|
1486
1522
|
}
|
|
1487
1523
|
/**
|
|
1488
1524
|
* Create thresholds for IntersectionObserver
|
|
@@ -1514,8 +1550,8 @@ class z {
|
|
|
1514
1550
|
if (t && t.length > 0) {
|
|
1515
1551
|
const i = {
|
|
1516
1552
|
"Content-Type": "application/json"
|
|
1517
|
-
},
|
|
1518
|
-
|
|
1553
|
+
}, n = E();
|
|
1554
|
+
n && (i["x-api-key"] = n), fetch(`${this.baseUrl}/ads/viewability/batch`, {
|
|
1519
1555
|
method: "POST",
|
|
1520
1556
|
headers: i,
|
|
1521
1557
|
keepalive: !0,
|
|
@@ -1526,39 +1562,41 @@ class z {
|
|
|
1526
1562
|
});
|
|
1527
1563
|
}
|
|
1528
1564
|
}
|
|
1529
|
-
let
|
|
1530
|
-
function
|
|
1531
|
-
return
|
|
1565
|
+
let A = null;
|
|
1566
|
+
function ce(o, e) {
|
|
1567
|
+
return A || (A = new Q(o, e), A.setupBeforeUnload()), A;
|
|
1532
1568
|
}
|
|
1533
|
-
const
|
|
1569
|
+
const le = "0.1.0";
|
|
1534
1570
|
export {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1571
|
+
_ as AdManager,
|
|
1572
|
+
x as AnalyticsSender,
|
|
1573
|
+
I as ClientInfoCollector,
|
|
1538
1574
|
y as DOMRenderer,
|
|
1539
1575
|
v as HTMLRenderer,
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
F as
|
|
1548
|
-
|
|
1549
|
-
|
|
1576
|
+
le as SDK_VERSION,
|
|
1577
|
+
V as SessionManager,
|
|
1578
|
+
Q as ViewabilityTracker,
|
|
1579
|
+
ae as adaptAdToKoahAd,
|
|
1580
|
+
se as clearClientInfoCache,
|
|
1581
|
+
Y as createAnalytics,
|
|
1582
|
+
ee as createSession,
|
|
1583
|
+
F as decryptAES,
|
|
1584
|
+
G as encryptAES,
|
|
1585
|
+
j as fetchAds,
|
|
1586
|
+
J as generateViewToken,
|
|
1587
|
+
ie as getAppInfo,
|
|
1550
1588
|
b as getClientInfo,
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1589
|
+
C as getClientInfoCollector,
|
|
1590
|
+
re as getClientInfoJSON,
|
|
1591
|
+
oe as getClientInfoSummary,
|
|
1592
|
+
te as getDeviceInfo,
|
|
1593
|
+
ne as getGeoInfo,
|
|
1556
1594
|
w as getSessionId,
|
|
1557
1595
|
D as getUserId,
|
|
1558
1596
|
H as getUserInfo,
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1597
|
+
ce as getViewabilityTracker,
|
|
1598
|
+
O as trackAdClick,
|
|
1599
|
+
T as trackAdImpression,
|
|
1600
|
+
Z as trackClicksBatch,
|
|
1601
|
+
X as trackImpressionsBatch
|
|
1564
1602
|
};
|