@betarena/ad-engine 0.0.32 → 0.0.34

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.32",
3
+ "version": "0.0.34",
4
4
  "private": false,
5
5
  "description": "Betarena ad-engine widget",
6
6
  "keywords": [
@@ -51,13 +51,13 @@
51
51
 
52
52
  import WidgetAdvertSlide from './Advert-Slide-Child.svelte';
53
53
  import WidgetAdGeneral from './Advert-General-Child.svelte';
54
+ import DevInfoBox from './misc/admin/Dev-Info-Box.svelte';
54
55
 
55
56
  import '../style/app.scss';
56
57
 
57
58
  import type { IAdsRequestBody, IAdsResponseBody } from '@betarena/scores-lib/types/ad-engine/index.js';
58
59
  import type { GeoJsResponse } from './types/geojs.js';
59
60
  import type { AdsCreativeMain } from '@betarena/scores-lib/types/_AUTO-HASURA_.js';
60
- import DevInfoBox from './misc/admin/Dev-Info-Box.svelte';
61
61
 
62
62
  // #endregion ➤ 📦 Package Imports
63
63
 
@@ -118,7 +118,12 @@
118
118
  * @description
119
119
  * 📝 `Map` where, `key=ZoneId` and `value=HTMLElement`
120
120
  */
121
- betarenaAdsInjectMap: Map < number, Element > = new Map()
121
+ betarenaAdsInjectMap: Map < number, Element > = new Map(),
122
+ /**
123
+ * @description
124
+ * 📝 temporary data
125
+ */
126
+ dataMap: Map < number, AdsCreativeMain >
122
127
  ;
123
128
 
124
129
  // #endregion ➤ 📌 VARIABLES
@@ -215,12 +220,9 @@
215
220
  // [🐞]
216
221
  console.log('response', response);
217
222
 
223
+ dataMap = new Map((response as IAdsResponseBody).ads ?? []);
224
+
218
225
  const
219
- /**
220
- * @description
221
- * 📝 `Map`
222
- */
223
- dataMap = new Map((response as IAdsResponseBody).ads ?? []),
224
226
  /**
225
227
  * @description
226
228
  * 📝 `Map`
@@ -240,7 +242,7 @@
240
242
  * @description
241
243
  * 📝 `Map`
242
244
  */
243
- mapZoneToTagIds = new Map ((response as IAdsResponseBody).mapZoneIdToTagIds)
245
+ mapZoneToTagIds = new Map ((response as IAdsResponseBody).mapZoneIdToTagIds)
244
246
  ;
245
247
 
246
248
  // ╭─────
@@ -354,7 +356,7 @@
354
356
 
355
357
  for (const [zoneId, tagIds] of mapZoneToTagIds)
356
358
  {
357
- if (authorId && !tagIds.includes(authorId))
359
+ if (authorArticleTagIds.filter(x => { return tagIds.includes(x) } ).length == 0)
358
360
  continue;
359
361
  ;
360
362
 
@@ -427,7 +429,7 @@
427
429
  (
428
430
  {
429
431
  deviceType,
430
- isoCountryCode: geoLocation?.country_code ?? 'EB',
432
+ isoCountryCode: geoLocation?.country_code ?? 'EN',
431
433
  authorId,
432
434
  tagIds: authorArticleTagIds,
433
435
  zoneIds: [...betarenaAdsInjectMap.keys()]
@@ -473,11 +475,11 @@
473
475
  }
474
476
  />
475
477
 
476
- <svelte:head>
478
+ <!-- <svelte:head>
477
479
  <link rel="preconnect" href="https://fonts.googleapis.com">
478
480
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
479
481
  <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">
480
- </svelte:head>
482
+ </svelte:head> -->
481
483
 
482
484
  <!--
483
485
  ╭──────────────────────────────────────────────────────────────────────────────────╮
@@ -513,6 +515,9 @@
513
515
  <p>
514
516
  [properties] AuthorArticleTagIds :|: [{authorArticleTagIds}]
515
517
  </p>
518
+ <p>
519
+ [data] Adverts Fetched Number :|: {dataMap.size}
520
+ </p>
516
521
  </DevInfoBox>
517
522
 
518
523
  <!--
@@ -39,6 +39,7 @@
39
39
  // ╰────────────────────────────────────────────────────────────────────────╯
40
40
 
41
41
  import { storeAdmin } from '../../store/admin.js';
42
+ import { betarenaAdEngineStore } from '../../_store.js';
42
43
 
43
44
  // #endregion ➤ 📦 Package Imports
44
45
 
@@ -65,6 +66,7 @@
65
66
  ;
66
67
 
67
68
  $: ({ numberOfAdvertsActive } = { ...$storeAdmin });
69
+ $: ({ advertDateLastShown, isBetarenaAdShownForToday } = { ...$betarenaAdEngineStore})
68
70
 
69
71
  // #endregion ➤ 📌 VARIABLES
70
72
 
@@ -131,6 +133,57 @@
131
133
  </p>
132
134
 
133
135
  <slot/>
136
+
137
+ <p>
138
+ [store] advertDateLastShown :|: {advertDateLastShown}
139
+ </p>
140
+
141
+ <p>
142
+ [store] isBetarenaAdShownForToday :|: {isBetarenaAdShownForToday}
143
+ </p>
144
+ </div>
145
+
146
+ <!--
147
+ ╭─────
148
+ │ > [I] Actions
149
+ ╰─────
150
+ -->
151
+ <div
152
+ class=
153
+ "
154
+ grid-box
155
+ "
156
+ >
157
+ <p
158
+ class=
159
+ "
160
+ title
161
+ "
162
+ >
163
+ Actions
164
+ </p>
165
+
166
+ <button
167
+ class=
168
+ "
169
+ btn-dark
170
+ "
171
+ on:click=
172
+ {
173
+ () =>
174
+ {
175
+ betarenaAdEngineStore.updateData
176
+ (
177
+ [
178
+ ['toggleAdShownState', undefined]
179
+ ]
180
+ );
181
+ return;
182
+ }
183
+ }
184
+ >
185
+ Toggle Advert Shown State [{isBetarenaAdShownForToday}]
186
+ </button>
134
187
  </div>
135
188
 
136
189
  </div>
@@ -209,7 +262,7 @@
209
262
  {
210
263
  /* 🛝 layout */
211
264
  display: grid;
212
- grid-template-columns: 1fr 1fr 1fr;
265
+ grid-template-columns: 1fr 1fr;
213
266
  }
214
267
  }
215
268