@betarena/ad-engine 0.0.34 → 0.0.36
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.js +45 -64
- package/package.json +1 -1
- package/src/lib/Advert-Engine-Widget.svelte +69 -23
package/package.json
CHANGED
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
* @description
|
|
124
124
|
* 📝 temporary data
|
|
125
125
|
*/
|
|
126
|
-
|
|
126
|
+
creativeDataMap: Map < number, AdsCreativeMain > = new Map()
|
|
127
127
|
;
|
|
128
128
|
|
|
129
129
|
// #endregion ➤ 📌 VARIABLES
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
// [🐞]
|
|
221
221
|
console.log('response', response);
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
creativeDataMap = new Map((response as IAdsResponseBody).ads ?? []);
|
|
224
224
|
|
|
225
225
|
const
|
|
226
226
|
/**
|
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
* @description
|
|
233
233
|
* 📝 `Map`
|
|
234
234
|
*/
|
|
235
|
-
|
|
235
|
+
mapCampaignIdToCreativeId = new Map ((response as IAdsResponseBody).mapCampaignIdToCreativeId),
|
|
236
236
|
/**
|
|
237
237
|
* @description
|
|
238
238
|
* 📝 `Map`
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
* @description
|
|
260
260
|
* 📝 **campaign ids** of respective **zone id**
|
|
261
261
|
*/
|
|
262
|
-
|
|
262
|
+
campaignIds
|
|
263
263
|
= (mapZoneIdToCampaignId.get(zoneId) ?? []),
|
|
264
264
|
/**
|
|
265
265
|
* @description
|
|
@@ -268,20 +268,33 @@
|
|
|
268
268
|
creativeAdData
|
|
269
269
|
= removeNull
|
|
270
270
|
(
|
|
271
|
-
|
|
271
|
+
campaignIds.map
|
|
272
272
|
(
|
|
273
273
|
x =>
|
|
274
274
|
{
|
|
275
|
-
if (
|
|
276
|
-
|
|
275
|
+
if (mapCampaignIdToCreativeId.has(x))
|
|
276
|
+
{
|
|
277
|
+
const
|
|
278
|
+
/**
|
|
279
|
+
* @description
|
|
280
|
+
* 📝 **creative ids**
|
|
281
|
+
*/
|
|
282
|
+
creativeIds = mapCampaignIdToCreativeId.get(x)!
|
|
283
|
+
;
|
|
284
|
+
|
|
285
|
+
for (const creativeId of creativeIds)
|
|
286
|
+
{
|
|
287
|
+
if (creativeDataMap.has(creativeId))
|
|
288
|
+
return creativeDataMap.get(creativeId);
|
|
289
|
+
;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
277
292
|
}
|
|
278
293
|
)
|
|
279
294
|
) as AdsCreativeMain[]
|
|
280
295
|
;
|
|
281
296
|
|
|
282
297
|
// [🐞]
|
|
283
|
-
// console.log('zoneIdCampaignIds', zoneIdCampaignIds);
|
|
284
|
-
// console.log('dataMap', dataMap);
|
|
285
298
|
// console.log('creativeAdData', creativeAdData);
|
|
286
299
|
|
|
287
300
|
for (const adData of (creativeAdData ?? []))
|
|
@@ -307,7 +320,7 @@
|
|
|
307
320
|
{
|
|
308
321
|
for (const [zoneId, authorIds] of mapZoneToAuthorIds)
|
|
309
322
|
{
|
|
310
|
-
if (authorId
|
|
323
|
+
if (!authorId || !authorIds.includes(authorId))
|
|
311
324
|
continue;
|
|
312
325
|
;
|
|
313
326
|
|
|
@@ -316,7 +329,7 @@
|
|
|
316
329
|
* @description
|
|
317
330
|
* 📝 **campaign ids** of respective **zone id**
|
|
318
331
|
*/
|
|
319
|
-
|
|
332
|
+
campaignIds
|
|
320
333
|
= (mapZoneIdToCampaignId.get(zoneId) ?? []),
|
|
321
334
|
/**
|
|
322
335
|
* @description
|
|
@@ -325,19 +338,34 @@
|
|
|
325
338
|
creativeAdData
|
|
326
339
|
= removeNull
|
|
327
340
|
(
|
|
328
|
-
|
|
341
|
+
campaignIds.map
|
|
329
342
|
(
|
|
330
343
|
x =>
|
|
331
344
|
{
|
|
332
|
-
if (
|
|
333
|
-
|
|
345
|
+
if (mapCampaignIdToCreativeId.has(x))
|
|
346
|
+
{
|
|
347
|
+
const
|
|
348
|
+
/**
|
|
349
|
+
* @description
|
|
350
|
+
* 📝 **creative ids**
|
|
351
|
+
*/
|
|
352
|
+
creativeIds = mapCampaignIdToCreativeId.get(x)!
|
|
353
|
+
;
|
|
354
|
+
|
|
355
|
+
for (const creativeId of creativeIds)
|
|
356
|
+
{
|
|
357
|
+
if (creativeDataMap.has(creativeId))
|
|
358
|
+
return creativeDataMap.get(creativeId);
|
|
359
|
+
;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
334
362
|
}
|
|
335
363
|
)
|
|
336
364
|
) as AdsCreativeMain[]
|
|
337
365
|
;
|
|
338
366
|
|
|
339
367
|
// [🐞]
|
|
340
|
-
console.log('creativeAdData', creativeAdData);
|
|
368
|
+
// console.log('creativeAdData', creativeAdData);
|
|
341
369
|
|
|
342
370
|
for (const adData of creativeAdData)
|
|
343
371
|
{
|
|
@@ -365,7 +393,7 @@
|
|
|
365
393
|
* @description
|
|
366
394
|
* 📝 **campaign ids** of respective **zone id**
|
|
367
395
|
*/
|
|
368
|
-
|
|
396
|
+
campaignIds
|
|
369
397
|
= (mapZoneIdToCampaignId.get(zoneId) ?? []),
|
|
370
398
|
/**
|
|
371
399
|
* @description
|
|
@@ -374,17 +402,35 @@
|
|
|
374
402
|
creativeAdData
|
|
375
403
|
= removeNull
|
|
376
404
|
(
|
|
377
|
-
|
|
405
|
+
campaignIds.map
|
|
378
406
|
(
|
|
379
407
|
x =>
|
|
380
408
|
{
|
|
381
|
-
if (
|
|
382
|
-
|
|
409
|
+
if (mapCampaignIdToCreativeId.has(x))
|
|
410
|
+
{
|
|
411
|
+
const
|
|
412
|
+
/**
|
|
413
|
+
* @description
|
|
414
|
+
* 📝 **creative ids**
|
|
415
|
+
*/
|
|
416
|
+
creativeIds = mapCampaignIdToCreativeId.get(x)!
|
|
417
|
+
;
|
|
418
|
+
|
|
419
|
+
for (const creativeId of creativeIds)
|
|
420
|
+
{
|
|
421
|
+
if (creativeDataMap.has(creativeId))
|
|
422
|
+
return creativeDataMap.get(creativeId);
|
|
423
|
+
;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
383
426
|
}
|
|
384
427
|
)
|
|
385
428
|
) as AdsCreativeMain[]
|
|
386
429
|
;
|
|
387
430
|
|
|
431
|
+
// [🐞]
|
|
432
|
+
// console.log('creativeAdData', creativeAdData);
|
|
433
|
+
|
|
388
434
|
for (const adData of creativeAdData)
|
|
389
435
|
{
|
|
390
436
|
new WidgetAdvertSlide
|
|
@@ -429,7 +475,7 @@
|
|
|
429
475
|
(
|
|
430
476
|
{
|
|
431
477
|
deviceType,
|
|
432
|
-
isoCountryCode:
|
|
478
|
+
isoCountryCode: 'PT',
|
|
433
479
|
authorId,
|
|
434
480
|
tagIds: authorArticleTagIds,
|
|
435
481
|
zoneIds: [...betarenaAdsInjectMap.keys()]
|
|
@@ -475,11 +521,11 @@
|
|
|
475
521
|
}
|
|
476
522
|
/>
|
|
477
523
|
|
|
478
|
-
|
|
524
|
+
<svelte:head>
|
|
479
525
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
480
526
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
481
527
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
|
|
482
|
-
</svelte:head>
|
|
528
|
+
</svelte:head>
|
|
483
529
|
|
|
484
530
|
<!--
|
|
485
531
|
╭──────────────────────────────────────────────────────────────────────────────────╮
|
|
@@ -516,7 +562,7 @@
|
|
|
516
562
|
[properties] AuthorArticleTagIds :|: [{authorArticleTagIds}]
|
|
517
563
|
</p>
|
|
518
564
|
<p>
|
|
519
|
-
[data] Adverts Fetched Number :|: {
|
|
565
|
+
[data] Adverts Fetched Number :|: {creativeDataMap.size}
|
|
520
566
|
</p>
|
|
521
567
|
</DevInfoBox>
|
|
522
568
|
|