@betarena/ad-engine 0.0.22 → 0.0.24

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.
@@ -1,10 +1,13 @@
1
1
  export const
2
2
  /**
3
3
  * @description
4
- * 📝 Respective Betarena API endpoint for Ad-Engine Data
4
+ * 📝 respective Betarena API endpoint for Ad-Engine Data
5
5
  * @example
6
- * - (local) http://localhost:58749
7
- * - (dev) http://betarena-test-e2748dab12f5.herokuapp.com
6
+ * dev|:|local
7
+ * "http://localhost:58749"
8
+ * "http://192.168.1.236:58749"
9
+ * ➤ dev|:|live|:|staging
10
+ * "https://betarena-test-e2748dab12f5.herokuapp.com"
8
11
  */
9
12
  betarenaEndpoint = 'https://betarena-test-e2748dab12f5.herokuapp.com'
10
13
  ;
@@ -0,0 +1,199 @@
1
+ <!--
2
+ ╭──────────────────────────────────────────────────────────────────────────────────╮
3
+ │ 📌 High Order Component Overview │
4
+ ┣──────────────────────────────────────────────────────────────────────────────────┫
5
+ │ ➤ Internal Svelte Code Format :|: V.8.0 │
6
+ │ ➤ Status :|: 🔒 LOCKED │
7
+ │ ➤ Author(s) :|: @migbash │
8
+ ┣──────────────────────────────────────────────────────────────────────────────────┫
9
+ │ 📝 Description │
10
+ ┣──────────────────────────────────────────────────────────────────────────────────┫
11
+ │ Admin Dev Info │
12
+ ╰──────────────────────────────────────────────────────────────────────────────────╯
13
+ -->
14
+
15
+ <!--
16
+ ╭──────────────────────────────────────────────────────────────────────────────────╮
17
+ │ 🟦 Svelte Component JS/TS │
18
+ ┣──────────────────────────────────────────────────────────────────────────────────┫
19
+ │ ➤ HINT: │ Access snippets for '<script> [..] </script>' those found in │
20
+ │ │ '.vscode/snippets.code-snippets' via intellisense using 'doc' │
21
+ ╰──────────────────────────────────────────────────────────────────────────────────╯
22
+ -->
23
+
24
+ <script lang="ts">
25
+
26
+ // #region ➤ 📦 Package Imports
27
+
28
+ // ╭────────────────────────────────────────────────────────────────────────╮
29
+ // │ NOTE: │
30
+ // │ Please add inside 'this' region the 'imports' that are required │
31
+ // │ by 'this' .svelte file is ran. │
32
+ // │ IMPORTANT │
33
+ // │ Please, structure the imports as follows: │
34
+ // │ 1. svelte/sveltekit imports │
35
+ // │ 2. project-internal files and logic │
36
+ // │ 3. component import(s) │
37
+ // │ 4. assets import(s) │
38
+ // │ 5. type(s) imports(s) │
39
+ // ╰────────────────────────────────────────────────────────────────────────╯
40
+
41
+ import { storeAdmin } from '../../store/admin.js';
42
+
43
+ // #endregion ➤ 📦 Package Imports
44
+
45
+ // #region ➤ 📌 VARIABLES
46
+
47
+ // ╭────────────────────────────────────────────────────────────────────────╮
48
+ // │ NOTE: │
49
+ // │ Please add inside 'this' region the 'variables' that are to be │
50
+ // │ and are expected to be used by 'this' .svelte file / component. │
51
+ // │ IMPORTANT │
52
+ // │ Please, structure the imports as follows: │
53
+ // │ 1. export const / let [..] │
54
+ // │ 2. const [..] │
55
+ // │ 3. let [..] │
56
+ // │ 4. $: [..] │
57
+ // ╰────────────────────────────────────────────────────────────────────────╯
58
+
59
+ const
60
+ /**
61
+ * @description
62
+ * 📣 `this` component **main** `id` and `data-testid` prefix.
63
+ */ // eslint-disable-next-line no-unused-vars
64
+ CNAME = 'developer-admin-infobox'
65
+ ;
66
+
67
+ $: ({ numberOfAdvertsActive } = { ...$storeAdmin });
68
+
69
+ // #endregion ➤ 📌 VARIABLES
70
+
71
+ </script>
72
+
73
+ <!--
74
+ ╭──────────────────────────────────────────────────────────────────────────────────╮
75
+ │ 💠 Svelte Component HTML │
76
+ ┣──────────────────────────────────────────────────────────────────────────────────┫
77
+ │ ➤ HINT: │ Use 'Ctrl + Space' to autocomplete global class=styles, dynamically │
78
+ │ │ imported from './static/app.css' │
79
+ │ ➤ HINT: │ access custom Betarena Scores VScode Snippets by typing emmet-like │
80
+ │ │ abbrev. │
81
+ ╰──────────────────────────────────────────────────────────────────────────────────╯
82
+ -->
83
+
84
+ <div
85
+ id={CNAME}
86
+ >
87
+
88
+ <!--
89
+ ╭─────
90
+ │ > [I] Adverts Information
91
+ ╰─────
92
+ -->
93
+ <div
94
+ class=
95
+ "
96
+ grid-box
97
+ "
98
+ >
99
+ <p
100
+ class=
101
+ "
102
+ title
103
+ "
104
+ >
105
+ Adverts
106
+ </p>
107
+
108
+ <p>
109
+ Number of Adverts Loaded :|: {numberOfAdvertsActive}
110
+ </p>
111
+ </div>
112
+
113
+ <!--
114
+ ╭─────
115
+ │ > [I] General Information
116
+ ╰─────
117
+ -->
118
+ <div
119
+ class=
120
+ "
121
+ grid-box
122
+ "
123
+ >
124
+ <p
125
+ class=
126
+ "
127
+ title
128
+ "
129
+ >
130
+ General
131
+ </p>
132
+
133
+ <slot/>
134
+ </div>
135
+
136
+ </div>
137
+
138
+ <!--
139
+ ╭──────────────────────────────────────────────────────────────────────────────────╮
140
+ │ 🌊 Svelte Component CSS/SCSS │
141
+ ┣──────────────────────────────────────────────────────────────────────────────────┫
142
+ │ ➤ HINT: │ auto-fill/auto-complete iniside <style> for var() │
143
+ │ │ values by typing/CTRL+SPACE │
144
+ │ ➤ HINT: │ access custom Betarena Scores CSS VScode Snippets by typing 'style...' │
145
+ ╰──────────────────────────────────────────────────────────────────────────────────╯
146
+ -->
147
+
148
+ <style lang="scss">
149
+
150
+ /*
151
+ ╭──────────────────────────────────────────────────────────────────────────────╮
152
+ │ 📲 MOBILE-FIRST │
153
+ ╰──────────────────────────────────────────────────────────────────────────────╯
154
+ */
155
+
156
+ div#developer-admin-infobox
157
+ {
158
+ /* 🎨 style */
159
+ width: 100%;
160
+ background: blue;
161
+ padding: 20px;
162
+ overflow: hidden;
163
+ /* 🛝 layout */
164
+ display: grid;
165
+ align-content: space-between;
166
+ /* 🛝 layout */
167
+ display: grid;
168
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
169
+
170
+ div.grid-box
171
+ {
172
+ /* 🎨 style */
173
+ padding: 15px;
174
+
175
+ :global
176
+ {
177
+ p
178
+ {
179
+ /* 🎨 style */
180
+ color: white;
181
+ }
182
+ }
183
+
184
+ p
185
+ {
186
+ /* 🎨 style */
187
+ color: white;
188
+
189
+ &.title
190
+ {
191
+ /* 🎨 style */
192
+ font-size: 24px;
193
+ font-weight: bold;
194
+ }
195
+ }
196
+ }
197
+ }
198
+
199
+ </style>
@@ -0,0 +1,132 @@
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 Scores Platform Admin Session ('Ephermal') Store │
12
+ // ╰──────────────────────────────────────────────────────────────────────────────────╯
13
+
14
+ /* eslint-disable max-len */
15
+
16
+ // #region ➤ 📦 Package Imports
17
+
18
+ import { writable } from 'svelte/store';
19
+ import { passByValue } from '@betarena/scores-lib/dist/functions/func.common.js';
20
+
21
+ // #endregion ➤ 📦 Package Imports
22
+
23
+ // #region ➤ 📌 VARIABLES
24
+
25
+ const
26
+ /**
27
+ * @description
28
+ * 📝 store object instance
29
+ */
30
+ storeObject: IAdminControl
31
+ = {
32
+ admin: false,
33
+ numberOfAdvertsActive: 0
34
+ }
35
+ ;
36
+
37
+ // #endregion ➤ 📌 VARIABLES
38
+
39
+ // #region ➤ 🛠️ METHODS
40
+
41
+ /**
42
+ * @summary
43
+ * @author
44
+ * @description
45
+ * @returns
46
+ */
47
+ function createLocalStore
48
+ (
49
+ )
50
+ {
51
+ const
52
+ // ╭─────
53
+ // │ NOTE: |:| 📣 default 'svelte/store' exports.
54
+ // ╰─────
55
+ {
56
+ subscribe,
57
+ set,
58
+ update
59
+ } = writable
60
+ (
61
+ storeObject
62
+ ),
63
+ /**
64
+ * @description
65
+ * 📣 Complementary 'store' added methods.
66
+ */
67
+ methods
68
+ = {
69
+
70
+ // ╭──────────────────────────────────────────────────────────────────────────────────╮
71
+ // │ 📣 Main Logic │
72
+ // ╰──────────────────────────────────────────────────────────────────────────────────╯
73
+
74
+ /**
75
+ * @author
76
+ * @migbash
77
+ * @summary
78
+ * - 🔹 HELPER
79
+ * - IMPORTANT
80
+ * @description
81
+ * 📣 Update **target** `list` data of target `properties` to update.
82
+ * @param { [IAdminDataProp, any][] } data
83
+ * 💠 **[required]** Target data to update.
84
+ * @return { void }
85
+ */
86
+ updateData:
87
+ (
88
+ data: [IAdminDataProp, any][]
89
+ ): void =>
90
+ {
91
+ for (const iterator of data)
92
+ {
93
+ const
94
+ /**
95
+ * @description
96
+ */
97
+ dataTarget = iterator[0],
98
+ /**
99
+ * @description
100
+ */
101
+ dataPoint = iterator[1]
102
+ ;
103
+
104
+ if (dataTarget == 'admin')
105
+ storeObject.admin = dataPoint;
106
+ else if (dataTarget == 'numberOfAdvertsActive')
107
+ storeObject.numberOfAdvertsActive += 1;
108
+ ;
109
+ }
110
+
111
+ set
112
+ (
113
+ storeObject
114
+ );
115
+
116
+ return;
117
+ },
118
+
119
+ }
120
+ ;
121
+
122
+ return {
123
+ subscribe,
124
+ set,
125
+ update,
126
+ ...methods
127
+ };
128
+ }
129
+
130
+ // #endregion ➤ 🛠️ METHODS
131
+
132
+ export const storeAdmin = createLocalStore();
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @description
3
+ * 📝 platform admin control
4
+ */
5
+ interface IAdminControl
6
+ {
7
+ /**
8
+ * @description
9
+ * 📝 track platform state
10
+ * @example
11
+ * :: false
12
+ * @default
13
+ * :: false
14
+ */
15
+ admin: boolean;
16
+ /**
17
+ * @description
18
+ * 📝 number of adverts being shown, on current page
19
+ * @example
20
+ * :: 0
21
+ * @default
22
+ * :: 0
23
+ */
24
+ numberOfAdvertsActive: number;
25
+ }
26
+
27
+ /**
28
+ * @description
29
+ * 📝 store data proerty (to be updated)
30
+ */
31
+ type IAdminDataProp =
32
+ | 'admin'
33
+ | 'numberOfAdvertsActive'
34
+ ;
@@ -34,4 +34,4 @@ export function detectDeviceType
34
34
  else
35
35
  return 'desktop';
36
36
  ;
37
- }
37
+ }