@betarena/ad-engine 0.0.10 → 0.0.11

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.10",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "description": "Betarena Ad-Engine Component",
6
6
  "main": "dist/index.js",
@@ -45,12 +45,14 @@
45
45
  import { postMod } from './utils/fetch.js';
46
46
  import { detectDeviceType } from './utils/device.js';
47
47
  import { getUserLocation } from './utils/geo.js';
48
+ import { removeNull } from '@betarena/scores-lib/src/functions/func.common.js';
48
49
 
49
50
  import WidgetAdvertSlide from './Widget-AdvertSlide.svelte';
50
51
  import WidgetAdGeneral from './Widget-AdGeneral.svelte';
51
52
 
52
53
  import type { IAdsRequestBody, IAdsResponseBody } from '@betarena/scores-lib/types/ad-engine/index.js';
53
54
  import type { GeoJsResponse } from './types/geojs.js';
55
+ import type { AdsCreativeMain } from '@betarena/scores-lib/types/_AUTO-HASURA_.js';
54
56
 
55
57
  // #endregion ➤ 📦 Package Imports
56
58
 
@@ -206,7 +208,7 @@
206
208
  ;
207
209
 
208
210
  // [🐞]
209
- console.log(response);
211
+ console.log('response', response);
210
212
 
211
213
  const
212
214
  /**
@@ -257,17 +259,25 @@
257
259
  * 📝 `List` of creative data point(s)
258
260
  */
259
261
  creativeAdData
260
- = zoneIdCampaignIds.map
262
+ = removeNull
261
263
  (
262
- x =>
263
- {
264
- if (dataMap.has(x))
265
- return dataMap.get(x);
266
- }
267
- )
264
+ zoneIdCampaignIds.map
265
+ (
266
+ x =>
267
+ {
268
+ if (dataMap.has(x))
269
+ return dataMap.get(x);
270
+ }
271
+ )
272
+ ) as AdsCreativeMain[]
268
273
  ;
269
274
 
270
- for (const adData of creativeAdData ?? [])
275
+ // [🐞]
276
+ // console.log('zoneIdCampaignIds', zoneIdCampaignIds);
277
+ // console.log('dataMap', dataMap);
278
+ // console.log('creativeAdData', creativeAdData);
279
+
280
+ for (const adData of (creativeAdData ?? []))
271
281
  {
272
282
  new WidgetAdGeneral
273
283
  (
@@ -306,16 +316,22 @@
306
316
  * 📝 `List` of creative data point(s)
307
317
  */
308
318
  creativeAdData
309
- = zoneIdCampaignIds.map
319
+ = removeNull
310
320
  (
311
- x =>
312
- {
313
- if (dataMap.has(x))
314
- return dataMap.get(x);
315
- }
316
- )
321
+ zoneIdCampaignIds.map
322
+ (
323
+ x =>
324
+ {
325
+ if (dataMap.has(x))
326
+ return dataMap.get(x);
327
+ }
328
+ )
329
+ ) as AdsCreativeMain[]
317
330
  ;
318
331
 
332
+ // [🐞]
333
+ console.log('creativeAdData', creativeAdData);
334
+
319
335
  for (const adData of creativeAdData)
320
336
  {
321
337
  new WidgetAdvertSlide
@@ -349,14 +365,17 @@
349
365
  * 📝 `List` of creative data point(s)
350
366
  */
351
367
  creativeAdData
352
- = zoneIdCampaignIds.map
368
+ = removeNull
353
369
  (
354
- x =>
355
- {
356
- if (dataMap.has(x))
357
- return dataMap.get(x);
358
- }
359
- )
370
+ zoneIdCampaignIds.map
371
+ (
372
+ x =>
373
+ {
374
+ if (dataMap.has(x))
375
+ return dataMap.get(x);
376
+ }
377
+ )
378
+ ) as AdsCreativeMain[]
360
379
  ;
361
380
 
362
381
  for (const adData of creativeAdData)
@@ -90,8 +90,13 @@
90
90
  ╰──────────────────────────────────────────────────────────────────────────────────╯
91
91
  -->
92
92
 
93
- <p>
94
- General Advert Sample
93
+ <p
94
+ style=
95
+ "
96
+ color: violet;
97
+ "
98
+ >
99
+ General Advert Sample is Triggered
95
100
  </p>
96
101
 
97
102
  <div
@@ -149,8 +149,13 @@
149
149
  ╰──────────────────────────────────────────────────────────────────────────────────╯
150
150
  -->
151
151
 
152
- <p>
153
- Global Advert Sample
152
+ <p
153
+ style=
154
+ "
155
+ color: blueviolet;
156
+ "
157
+ >
158
+ Global Advert Sample is Triggered
154
159
  </p>
155
160
 
156
161
  {#if isAdvertShown && !isBetarenaAdShownForToday}
@@ -4,7 +4,7 @@ export const
4
4
  * 📝 Respective Betarena API endpoint for Ad-Engine Data
5
5
  * @example
6
6
  * - (local) http://localhost:58749
7
- * - (dev) https://betarena-test-e2748dab12f5.herokuapp.com
7
+ * - (dev) http://betarena-test-e2748dab12f5.herokuapp.com
8
8
  */
9
- betarenaEndpoint = 'https://betarena-test-e2748dab12f5.herokuapp.com'
9
+ betarenaEndpoint = 'http://localhost:58749'
10
10
  ;
package/src/lib/store.ts CHANGED
@@ -123,7 +123,7 @@ function createLocalStore
123
123
  if
124
124
  (
125
125
  localStore.isBetarenaAdShownForToday
126
- && localStore.advertDateLastShown?.getDate() != new Date().getDate()
126
+ && new Date(localStore.advertDateLastShown!).getDate() != new Date().getDate()
127
127
  )
128
128
  methods.updateData
129
129
  (