@betarena/ad-engine 0.0.71 → 0.0.73

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.71",
3
+ "version": "0.0.73",
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
  /**
@@ -794,9 +799,13 @@
794
799
  />
795
800
 
796
801
  <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">
802
+
803
+ {#if isStandalone}
804
+ <link rel="preconnect" href="https://fonts.googleapis.com">
805
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
806
+ <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">
807
+ {/if}
808
+
800
809
  </svelte:head>
801
810
 
802
811
  <!--
@@ -38,7 +38,7 @@
38
38
  // │ 5. type(s) imports(s) │
39
39
  // ╰────────────────────────────────────────────────────────────────────────╯
40
40
 
41
- import { onMount } from 'svelte';
41
+ import { onDestroy, onMount } from 'svelte';
42
42
  import { fly } from 'svelte/transition';
43
43
 
44
44
  import { ServiceAdEngine } from '@betarena/scores-lib/dist/classes/_service.adengine.js';
@@ -49,7 +49,7 @@
49
49
 
50
50
  import iconClose from './assets/icon-close.svg';
51
51
  import iconArrow from './assets/icon-external-link.svg';
52
-
52
+ import { logger } from './utils/debug.js';
53
53
 
54
54
  import type { AdsCreativeMain } from '@betarena/scores-lib/types/v8/_HASURA-0.js';
55
55
 
@@ -125,6 +125,14 @@
125
125
  // │ as soon as 'this' .svelte file is ran. │
126
126
  // ╰────────────────────────────────────────────────────────────────────────╯
127
127
 
128
+ let
129
+ /**
130
+ * @description
131
+ * 📝 timeout for advert show
132
+ */
133
+ intTimeoutForAdvertShow: ReturnType<typeof setTimeout> | null = null
134
+ ;
135
+
128
136
  onMount
129
137
  (
130
138
  () =>
@@ -134,7 +142,7 @@
134
142
  // ╭─────
135
143
  // │ NOTE: |:| Advert timeour start
136
144
  // ╰─────
137
- setTimeout
145
+ intTimeoutForAdvertShow = setTimeout
138
146
  (
139
147
  () =>
140
148
  {
@@ -175,6 +183,33 @@
175
183
  }
176
184
  );
177
185
 
186
+ onDestroy
187
+ (
188
+ () =>
189
+ {
190
+ // [🐞]
191
+ logger
192
+ (
193
+ [
194
+ 'Betarena Ad-Engine ⏰ onMount ⏰ cleanup (x2)'
195
+ ],
196
+ );
197
+
198
+ if (intTimeoutForAdvertShow)
199
+ clearTimeout(intTimeoutForAdvertShow);
200
+ ;
201
+
202
+ document.getElementById(CNAME)?.remove();
203
+
204
+ document.body.classList.remove
205
+ (
206
+ 'disable-scroll'
207
+ );
208
+
209
+ return;
210
+ }
211
+ );
212
+
178
213
  // #endregion ➤ 🔄 LIFECYCLE [SVELTE]
179
214
 
180
215
  </script>
@@ -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