@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
|
@@ -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(--
|
|
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(--
|
|
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>
|
package/src/lib/store/admin.ts
CHANGED
|
@@ -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();
|
|
@@ -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
|
+
;
|