@betarena/ad-engine 0.0.40 โ†’ 0.0.42

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.40",
3
+ "version": "0.0.42",
4
4
  "private": false,
5
5
  "description": "Betarena ad-engine widget",
6
6
  "keywords": [
@@ -48,6 +48,7 @@
48
48
  import { detectDeviceType } from './utils/device.js';
49
49
  import { getUserLocation } from './utils/geo.js';
50
50
  import { removeNull } from '@betarena/scores-lib/dist/functions/func.common.js';
51
+ import { storeSession } from './store/session.js';
51
52
 
52
53
  import WidgetAdvertSlide from './Advert-Slide-Child.svelte';
53
54
  import WidgetAdGeneral from './Advert-General-Child.svelte';
@@ -90,7 +91,12 @@
90
91
  * @description
91
92
  * ๐Ÿ“ `List` of **tag ids**
92
93
  */
93
- authorArticleTagIds: number[] = []
94
+ authorArticleTagIds: number[] = [],
95
+ /**
96
+ * @description
97
+ * ๐Ÿ“ Dark theme value
98
+ */
99
+ isDarkTheme: boolean = false
94
100
  ;
95
101
 
96
102
  /**
@@ -103,6 +109,8 @@
103
109
  | 'mobile'
104
110
  ;
105
111
 
112
+ $: $storeSession.isDarkTheme = isDarkTheme;
113
+
106
114
  let
107
115
  /**
108
116
  * @description
@@ -320,7 +328,7 @@
320
328
  {
321
329
  for (const [zoneId, authorIds] of mapZoneToAuthorIds)
322
330
  {
323
- if (!authorId || !authorIds.includes(authorId))
331
+ if (!authorId || (authorIds.length > 0 && !authorIds.includes(authorId)))
324
332
  continue;
325
333
  ;
326
334
 
@@ -384,7 +392,7 @@
384
392
 
385
393
  for (const [zoneId, tagIds] of mapZoneToTagIds)
386
394
  {
387
- if (authorArticleTagIds.filter(x => { return tagIds.includes(x) } ).length == 0)
395
+ if (tagIds.length > 0 && authorArticleTagIds.filter(x => { return tagIds.includes(x) } ).length == 0)
388
396
  continue;
389
397
  ;
390
398
 
@@ -45,6 +45,7 @@
45
45
  import { storeAdmin } from './store/admin.js';
46
46
  import { postMod } from './utils/fetch.js';
47
47
  import { betarenaEndpoint } from './constants/instance.js';
48
+ import { storeSession } from './store/session.js';
48
49
 
49
50
  import iconClose from './assets/icon-close.svg';
50
51
  import iconArrow from './assets/icon-external-link.svg';
@@ -110,6 +111,7 @@
110
111
  ;
111
112
 
112
113
  $: ({ isBetarenaAdShownForToday } = { ...$betarenaAdEngineStore });
114
+ $: ({ isDarkTheme } = { ...$storeSession });
113
115
 
114
116
  // #endregion โžค ๐Ÿ“Œ VARIABLES
115
117
 
@@ -187,6 +189,7 @@
187
189
  id={CNAME}
188
190
  in:fly={{ y: 500, duration: 500 }}
189
191
  out:fly={{ y: 500, duration: 500 }}
192
+ class:dark-theme={isDarkTheme}
190
193
  >
191
194
 
192
195
  <!--
@@ -395,7 +398,7 @@
395
398
  /* ๐ŸŽจ style */
396
399
  overflow: hidden;
397
400
  border-radius: 40px 40px 0px 0px;
398
- background-color: var(--dark-theme-1-4-shade);
401
+ background-color: var(--white);
399
402
 
400
403
  @mixin banner
401
404
  {
@@ -446,7 +449,7 @@
446
449
  &#title
447
450
  {
448
451
  /* ๐ŸŽจ style */
449
- color: var(--white);
452
+ color: var(--dark-theme);
450
453
  }
451
454
  }
452
455
 
@@ -473,4 +476,22 @@
473
476
  }
474
477
  }
475
478
 
479
+ /*
480
+ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
481
+ โ”‚ ๐ŸŒ’ DARK-THEME โ”‚
482
+ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
483
+ */
484
+
485
+ div#globalโฎ•widgetโฎ•betarenaAdEngineโฎ•main.dark-theme
486
+ {
487
+ /* ๐ŸŽจ style */
488
+ background-color: var(--dark-theme-1-4-shade);
489
+
490
+ p
491
+ {
492
+ /* ๐ŸŽจ style */
493
+ color: var(--white) !important;
494
+ }
495
+ }
496
+
476
497
  </style>
@@ -16,7 +16,6 @@
16
16
  // #region โžค ๐Ÿ“ฆ Package Imports
17
17
 
18
18
  import { writable } from 'svelte/store';
19
- import { passByValue } from '@betarena/scores-lib/dist/functions/func.common.js';
20
19
 
21
20
  // #endregion โžค ๐Ÿ“ฆ Package Imports
22
21
 
@@ -0,0 +1,138 @@
1
+ // โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
2
+ // โ”‚ ๐Ÿ“Œ High Order Component Overview โ”‚
3
+ // โ”ฃโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ซ
4
+ // โ”‚ โžค Internal Svelte Code Format :|: V.8.0 โ”‚
5
+ // โ”‚ โžค Status :|: ๐Ÿ”’ LOCKED โ”‚
6
+ // โ”‚ โžค Author(s) :|: @migbash โ”‚
7
+ // โ”ฃโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ซ
8
+ // โ”‚ ๐Ÿ“ Description โ”‚
9
+ // โ”ฃโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ซ
10
+ // โ”‚ > Client 'Svelte/Store' โ”‚
11
+ // โ”‚ > Main Betarena Ad-Engine Session ('Ephermal') Store โ”‚
12
+ // โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
13
+
14
+ /* eslint-disable max-len */
15
+
16
+ // #region โžค ๐Ÿ“ฆ Package Imports
17
+
18
+ import { writable } from 'svelte/store';
19
+
20
+ import type { IAdEngineSessionDataProp, IAdEngineSessionStore } from '../types/session.js';
21
+
22
+ // #endregion โžค ๐Ÿ“ฆ Package Imports
23
+
24
+ // #region โžค ๐Ÿ“Œ VARIABLES
25
+
26
+ const
27
+ /**
28
+ * @description
29
+ * ๐Ÿ“ store object instance
30
+ */
31
+ storeObject: IAdEngineSessionStore
32
+ = {
33
+ isDarkTheme: false
34
+ }
35
+ ;
36
+
37
+ // #endregion โžค ๐Ÿ“Œ VARIABLES
38
+
39
+ // #region โžค ๐Ÿ› ๏ธ METHODS
40
+
41
+ /**
42
+ * @author
43
+ * @migbash
44
+ * @summary
45
+ * ๐Ÿ’  STORE
46
+ * @description
47
+ * ๐Ÿ“ SvelteJs store declaration
48
+ * @returns
49
+ * ๐Ÿ“ค SvelteJs store
50
+ */
51
+ function createLocalStore
52
+ (
53
+ )
54
+ {
55
+ const
56
+ // โ•ญโ”€โ”€โ”€โ”€โ”€
57
+ // โ”‚ NOTE: |:| ๐Ÿ“ฃ default 'svelte/store' exports.
58
+ // โ•ฐโ”€โ”€โ”€โ”€โ”€
59
+ {
60
+ subscribe,
61
+ set,
62
+ update
63
+ } = writable
64
+ (
65
+ storeObject
66
+ ),
67
+ /**
68
+ * @description
69
+ * ๐Ÿ“ฃ Complementary 'store' added methods.
70
+ */
71
+ methods
72
+ = {
73
+
74
+ // โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
75
+ // โ”‚ ๐Ÿ“ฃ Main Logic โ”‚
76
+ // โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
77
+
78
+ /**
79
+ * @author
80
+ * @migbash
81
+ * @summary
82
+ * - ๐Ÿ”น HELPER
83
+ * - IMPORTANT
84
+ * @description
85
+ * ๐Ÿ“ฃ Update **target** `list` data of target `properties` to update.
86
+ * @param { [ IAdEngineSessionDataProp, any] [] } data
87
+ * ๐Ÿ’  **[required]** data point to update.
88
+ * @return { void }
89
+ */
90
+ updateData:
91
+ (
92
+ data: [IAdEngineSessionDataProp, any][]
93
+ ): void =>
94
+ {
95
+ // โ•ญโ”€โ”€โ”€โ”€โ”€
96
+ // โ”‚ NOTE: |:| loop over each data property to update
97
+ // โ•ฐโ”€โ”€โ”€โ”€โ”€
98
+ for (const iterator of data)
99
+ {
100
+ const
101
+ /**
102
+ * @description
103
+ */
104
+ dataTarget = iterator[0],
105
+ /**
106
+ * @description
107
+ */
108
+ // eslint-disable-next-line no-unused-vars
109
+ dataPoint = iterator[1]
110
+ ;
111
+
112
+ if (dataTarget == 'darkTheme')
113
+ storeObject.isDarkTheme = !storeObject.isDarkTheme;
114
+ ;
115
+ }
116
+
117
+ set
118
+ (
119
+ storeObject
120
+ );
121
+
122
+ return;
123
+ },
124
+
125
+ }
126
+ ;
127
+
128
+ return {
129
+ subscribe,
130
+ set,
131
+ update,
132
+ ...methods
133
+ };
134
+ }
135
+
136
+ // #endregion โžค ๐Ÿ› ๏ธ METHODS
137
+
138
+ export const storeSession = createLocalStore();
@@ -1,5 +1,3 @@
1
- import { IBetarenaUser } from "@betarena/scores-lib/types/_FIREBASE_.js";
2
-
3
1
  /**
4
2
  * @author
5
3
  * @migbash
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author
3
+ * @migbash
4
+ * @summary
5
+ * ๐Ÿ”น INTERFACE
6
+ */
7
+ export interface IAdEngineSessionStore
8
+ {
9
+ /**
10
+ * @description
11
+ * ๐Ÿ“ Wether theme is dark
12
+ * @example
13
+ * :: false
14
+ * @default
15
+ * :: false
16
+ */
17
+ isDarkTheme: boolean;
18
+ }
19
+
20
+ /**
21
+ * @description
22
+ * ๐Ÿ“ store data proerty (to be updated)
23
+ */
24
+ type IAdEngineSessionDataProp =
25
+ | 'darkTheme'
26
+ ;