@betarena/ad-engine 0.0.72 → 0.0.74

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betarena/ad-engine",
3
- "version": "0.0.72",
3
+ "version": "0.0.74",
4
4
  "private": false,
5
5
  "description": "Betarena ad-engine widget",
6
6
  "keywords": [
@@ -103,7 +103,12 @@
103
103
  * @description
104
104
  * 📝 Translation target
105
105
  */
106
- strTranslationTarget = 'en'
106
+ strTranslationTarget = 'en',
107
+ /**
108
+ * @description
109
+ * 📝 Condition for testing
110
+ */
111
+ isStandalone = true
107
112
  ;
108
113
 
109
114
  /**
@@ -347,10 +352,14 @@
347
352
  mapZoneToTagIds = new Map (dataRes0.success.data.mapZoneIdToTagIds)
348
353
  ;
349
354
 
355
+ // ╭──────────────────────────────────────────────────────────────────────────────────╮
356
+ // │ 💠 │ STEP :: ADVERT INJECTION │
357
+ // ╰──────────────────────────────────────────────────────────────────────────────────╯
358
+
350
359
  // ╭─────
351
360
  // │ NOTE:
352
- // │ [1] loop over retrieved/fetched elements identified in 'document',
353
- // │ [2] and inject target 'ADVERTS' in target specific locations.
361
+ // │ |: [1] loop over retrieved/fetched elements identified in 'document',
362
+ // │ |: [2] AND inject target 'ADVERTS' in target specific locations.
354
363
  // ┣─────
355
364
  // ┃ ZONE-ID :: 1,2,3,4
356
365
  // ╰─────
@@ -471,15 +480,16 @@
471
480
  }
472
481
 
473
482
  // ╭─────
474
- // │ CHECK
483
+ // │ CHECK:
475
484
  // │ |: for case of injection of 'GLOBAL' placements for adverts,
476
- // │ |: (a.k.a SLIDER / POPUP ads)
485
+ // │ |: ⦿ (a.k.a SLIDER / POPUP ads)
486
+ // │ |: ⦿ (a.k.a document.body injections)
477
487
  // ╰─────
478
488
  if (authorId || authorArticleTagIds.length > 0)
479
489
  {
480
490
  // ╭─────
481
491
  // │ NOTE:
482
- // │ |: Loop over creative data and inject adverts
492
+ // │ |: loop over creative data AND inject adverts, based on 'authorId'
483
493
  // ╰─────
484
494
  for (const [zoneId, authorIds] of mapZoneToAuthorIds)
485
495
  {
@@ -562,7 +572,7 @@
562
572
 
563
573
  // ╭─────
564
574
  // │ NOTE:
565
- // │ |: Loop over creative data and inject adverts
575
+ // │ |: loop over creative data AND inject adverts, based on 'tagIds'
566
576
  // ╰─────
567
577
  for (const [zoneId, tagIds] of mapZoneToTagIds)
568
578
  {
@@ -644,10 +654,12 @@
644
654
  }
645
655
  }
646
656
  // ╭─────
647
- // │ CHECK
648
- // │ |: otherwise, case where NO (1) 'authorId' OR (2) 'tagIds' are present (a.k.a Global Ads),
649
- // │ |: but data for ADS was still fetched (a.k.a Advert Condition was RETRIVED/HIT)
650
- // │ |: inject SLIDER adverts in 'document.body'
657
+ // │ CHECK:
658
+ // │ |: otherwise, case where NO (1) 'authorId' OR (2) 'tagIds' are present:
659
+ // │ |: ⦿ (a.k.a NO Global Ads Placements)
660
+ // │ |: BUT, data for ADS was still successfully fetched
661
+ // │ |: ⦿ (a.k.a Advert Condition was RETRIEVED/HIT).
662
+ // │ |: Inject STANDARD SLIDER adverts in 'document.body'
651
663
  // ╰─────
652
664
  else
653
665
  {
@@ -794,9 +806,13 @@
794
806
  />
795
807
 
796
808
  <svelte:head>
797
- <link rel="preconnect" href="https://fonts.googleapis.com">
798
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
799
- <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">
809
+
810
+ {#if isStandalone}
811
+ <link rel="preconnect" href="https://fonts.googleapis.com">
812
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
813
+ <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">
814
+ {/if}
815
+
800
816
  </svelte:head>
801
817
 
802
818
  <!--
@@ -42,7 +42,7 @@
42
42
 
43
43
  import iconArrow from './assets/icon-external-link.svg';
44
44
 
45
- import type { AdsCreativeMain } from '@betarena/scores-lib/types/_AUTO-HASURA_.js';
45
+ import type { AdsCreativeMain } from '@betarena/scores-lib/types/v8/_HASURA-0.js';
46
46
 
47
47
  // #endregion ➤ 📦 Package Imports
48
48
 
@@ -105,7 +105,7 @@
105
105
  <iframe
106
106
  width=250
107
107
  height=250
108
- src={adData.data?.media}
108
+ src={adData.data.media}
109
109
  />
110
110
  <!--
111
111
  <video
@@ -115,6 +115,32 @@
115
115
  />
116
116
  -->
117
117
 
118
+ {:else if adData.type == 3 && adData.data?.code}
119
+
120
+ <!--
121
+ sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
122
+ referrerpolicy="no-referrer-when-downgrade"
123
+ -->
124
+
125
+ <iframe
126
+ title="ad"
127
+ width=300
128
+ height=250
129
+ srcdoc='
130
+ <!doctype html>
131
+ <html>
132
+ <head>
133
+ <meta charset="utf-8">
134
+ </head>
135
+ <body
136
+ style="margin:0"
137
+ >
138
+ {adData.data.code}
139
+ </body>
140
+ </html>
141
+ '
142
+ />
143
+
118
144
  {:else if (adData.type == 2)}
119
145
  <img
120
146
  id='banner'
@@ -44,7 +44,7 @@
44
44
  import { betarenaEndpoint } from './constants/instance.js';
45
45
  import { storeAdmin } from './store/admin';
46
46
 
47
- import type { AdsCreativeMain } from '@betarena/scores-lib/types/v8/_HASURA-0';
47
+ import type { AdsCreativeMain } from '@betarena/scores-lib/types/v8/_HASURA-0.js';
48
48
 
49
49
  // #endregion ➤ 📦 Package Imports
50
50
 
@@ -37,9 +37,6 @@ export function logger
37
37
  listMsg: string[]
38
38
  ): void
39
39
  {
40
- // [🐞]
41
- // eslint-disable-next-line no-console
42
- console.log(chalk.hex('#FF7F50')('📦 [ad-engine] :: ─────────────────────────'));
43
40
  for (const message of listMsg)
44
41
  // [🐞]
45
42
  // eslint-disable-next-line no-console