@everymatrix/casino-my-games 1.4.0

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/index.html ADDED
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <meta name='viewport' content='width=device-width,initial-scale=1'>
6
+
7
+ <title>
8
+ casino-my-games
9
+ </title>
10
+ <link rel="stylesheet" href="public/reset.css">
11
+ <script src='dist/casino-my-games.js'></script>
12
+ </head>
13
+
14
+ <body>
15
+
16
+ <casino-my-games
17
+ userid="3997218"
18
+ session="581a62a9-e7f2-4b15-a55e-d7a03e357a2a"
19
+ endpoint="https://demo-api.stage.norway.everymatrix.com/v1"
20
+ datasource="RNG"
21
+ lang="en"
22
+ currency="USD"
23
+ favorites="true"
24
+ clientstyling=""
25
+ clientstylingurl=""
26
+ livecasino="false"
27
+ visiblegames="9"
28
+ gamepagemodalurl="true"
29
+ integratedgameframedesktop="true"
30
+ integratedgameframemobile="true"
31
+ translationurl=""
32
+ mostplayed=""
33
+ lastplayed=""
34
+ filteredcategories=""
35
+ activecategory=""></casino-my-games>
36
+
37
+ </body>
38
+ </html>
package/index.js ADDED
@@ -0,0 +1 @@
1
+ import './dist/casino-my-games.js';
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@everymatrix/casino-my-games",
3
+ "version": "1.4.0",
4
+ "main": "dist/casino-my-games.js",
5
+ "svelte": "src/index.ts",
6
+ "scripts": {
7
+ "start": "sirv public",
8
+ "build": "cross-env NODE_ENV=production rollup -c",
9
+ "dev": "cross-env NODE_ENV=\"development\" rollup -c -w",
10
+ "validate": "svelte-check",
11
+ "test": "echo"
12
+ },
13
+ "devDependencies": {
14
+ "@rollup/plugin-babel": "^5.3.0",
15
+ "@rollup/plugin-commonjs": "^16.0.0",
16
+ "@rollup/plugin-node-resolve": "^10.0.0",
17
+ "@rollup/plugin-typescript": "^6.0.0",
18
+ "@tsconfig/svelte": "^1.0.0",
19
+ "node-sass": "^5.0.0",
20
+ "rollup": "^2.3.4",
21
+ "rollup-plugin-dev-server": "^0.4.3",
22
+ "rollup-plugin-livereload": "^2.0.0",
23
+ "rollup-plugin-svelte": "^7.0.0",
24
+ "rollup-plugin-terser": "^7.0.0",
25
+ "rollup-plugin-uglify": "^6.0.4",
26
+ "svelte-check": "^1.0.0",
27
+ "svelte-preprocess": "^4.0.0",
28
+ "tslib": "^2.0.0",
29
+ "typescript": "^3.9.3"
30
+ },
31
+ "dependencies": {
32
+ "cross-env": "^7.0.3",
33
+ "sirv-cli": "^1.0.0",
34
+ "svelte": "^3.0.0"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "gitHead": "be1fa07132bd9efec772e8532a8bc54c82eb1cb6"
40
+ }
Binary file
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
@@ -0,0 +1,59 @@
1
+ import svelte from 'rollup-plugin-svelte';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import resolve from '@rollup/plugin-node-resolve';
4
+ import serve from 'rollup-plugin-dev-server';
5
+ import livereload from 'rollup-plugin-livereload';
6
+ import { terser } from 'rollup-plugin-terser';
7
+ import sveltePreprocess from 'svelte-preprocess';
8
+ import typescript from '@rollup/plugin-typescript';
9
+ const production = process.env.NODE_ENV === 'production';
10
+ const dev = process.env.NODE_ENV === 'development';
11
+
12
+ export default {
13
+ input: 'src/index.ts',
14
+ output: {
15
+ sourcemap: true,
16
+ format: 'umd',
17
+ name: 'app',
18
+ file: 'dist/casino-my-games.js'
19
+ },
20
+ plugins: [
21
+ svelte({
22
+ preprocess: sveltePreprocess(),
23
+ compilerOptions: {
24
+ // enable run-time checks when not in production
25
+ customElement: true,
26
+ dev: !production
27
+ }
28
+ }),
29
+ commonjs(),
30
+ resolve({
31
+ browser: true,
32
+ dedupe: ['svelte']
33
+ }),
34
+ dev && serve({
35
+ open: true,
36
+ verbose: true,
37
+ allowCrossOrigin: true,
38
+ historyApiFallback: false,
39
+ host: 'localhost',
40
+ port: 5050,
41
+ }),
42
+ dev && livereload({ watch: ['', 'dist'] }),
43
+ typescript({
44
+ sourceMap: !production,
45
+ inlineSources: !production,
46
+ }),
47
+ // If we're building for production (npm run build
48
+ // instead of npm run dev), minify
49
+ production &&
50
+ terser({
51
+ output: {
52
+ comments: "all"
53
+ },
54
+ })
55
+ ],
56
+ watch: {
57
+ clearScreen: false
58
+ }
59
+ };
@@ -0,0 +1,274 @@
1
+ <svelte:options tag={null} />
2
+ <script lang="ts">
3
+ import { isMobile, getDevice } from 'rvhelper';
4
+ import { _, addNewMessages, setupI18n, setLocale } from './i18n';
5
+ import { Translations } from './translations';
6
+ import { onMount } from 'svelte';
7
+
8
+ import '@everymatrix/casino-favorites-section';
9
+ import '@everymatrix/casino-last-played-section';
10
+ import '@everymatrix/casino-most-played-section';
11
+
12
+ export let userid:string = '';
13
+ export let session:string = '';
14
+ export let endpoint:string = '';
15
+ export let datasource:string = '';
16
+ export let lang:string = '';
17
+ export let currency:string = '';
18
+ export let clientstyling:string = '';
19
+ export let clientstylingurl:string = '';
20
+ export let livecasino:string = '';
21
+ export let visiblegames:string = '';
22
+ export let gamepagemodalurl:string = '';
23
+ export let integratedgameframedesktop:string = '';
24
+ export let integratedgameframemobile:string = '';
25
+ export let translationurl:string = '';
26
+ export let favorites:string = 'false';
27
+ export let mostplayed:string = 'false';
28
+ export let lastplayed:string = 'false';
29
+ export let activecategory:string = '';
30
+ export let categorybackground:string = '';
31
+ export let casinomygames:string = 'false';
32
+
33
+ let userAgent:any = window.navigator.userAgent;
34
+
35
+ // CasinoPage loading state
36
+ let isLoading:boolean = false;
37
+ let hasErrors:boolean = false;
38
+ let error:string = '';
39
+
40
+ let customStylingContainer:HTMLElement;
41
+ let gamesType:string = '';
42
+ let mobile:boolean = false;
43
+ let tabsArray:Array<string> = ['', '', ''];
44
+
45
+ setupI18n({ withLocale: 'en', translations: {}});
46
+
47
+ const setTranslationUrl = ():void => {
48
+ let url:string = translationurl;
49
+
50
+ fetch(url).then((res:any) => res.json())
51
+ .then((res) => {
52
+ Object.keys(res).forEach((item:any):void => {
53
+ addNewMessages(item, res[item]);
54
+ });
55
+ }).catch((err:any) => {
56
+ console.log(err);
57
+ });
58
+ }
59
+
60
+ Object.keys(Translations).forEach((item) => {
61
+ addNewMessages(item, Translations[item]);
62
+ });
63
+
64
+ const toggleTab = (type:string):void => {
65
+ if (gamesType === type) return
66
+ gamesType = type;
67
+ }
68
+
69
+ const initialSetup = ():void => {
70
+ gamesType = (favorites === 'true') ? 'Favorites' : (mostplayed === 'true') ? 'MostPlayed' : (lastplayed === 'true') ? 'LastPlayed' : ''
71
+
72
+ tabsArray[0] = (favorites === 'true') ? 'Favorites' : '';
73
+ tabsArray[1] = (mostplayed === 'true') ? 'MostPlayed' : '';
74
+ tabsArray[2] = (lastplayed === 'true') ? 'LastPlayed' : '';
75
+
76
+ isLoading = true;
77
+ setLocale(lang);
78
+ }
79
+
80
+ const setClientStyling = ():void => {
81
+ let sheet = document.createElement('style');
82
+ sheet.innerHTML = clientstyling;
83
+ customStylingContainer.appendChild(sheet);
84
+ }
85
+
86
+ const setClientStylingURL = ():void => {
87
+ let cssFile:HTMLElement = document.createElement('style');
88
+
89
+ fetch(new URL(clientstylingurl))
90
+ .then((res:any) => res.text())
91
+ .then((data:any) => {
92
+ cssFile.innerHTML = data
93
+
94
+ setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
95
+ });
96
+ }
97
+
98
+ onMount(() => {
99
+ mobile = isMobile(userAgent);
100
+ });
101
+
102
+ $: endpoint && datasource && lang && initialSetup();
103
+ $: favorites && mostplayed && lastplayed && initialSetup();
104
+ $: translationurl && setTranslationUrl();
105
+ $: clientstyling && customStylingContainer && setClientStyling();
106
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
107
+ </script>
108
+
109
+ <div bind:this={customStylingContainer}>
110
+ {#if hasErrors}
111
+ <p class="SearchLoading" part="SearchLoading">{$_('casinoPage.500')}</p>
112
+ {:else}
113
+ {#if casinomygames}
114
+
115
+ <div class="CasinoMyGames { mobile ? 'Mobile' : '' }">
116
+ <div class="MyGamesHeader">
117
+ <div class="MyGamesButtonsContainer">
118
+ {#each tabsArray as tab}
119
+ {#if tab == 'Favorites'}
120
+ <button class="MyGamesButton {gamesType == 'Favorites' ? 'Active' : ''} { favorites == 'false' ? 'Off': ''}" on:click={() => toggleTab('Favorites')}>
121
+ {$_('Translations.favorites')}
122
+ </button>
123
+ {/if}
124
+ {#if tab == 'MostPlayed'}
125
+ <button class="MyGamesButton {gamesType == 'MostPlayed' ? 'Active' : ''} {mostplayed == 'false' ? 'Off': ''}" on:click={() => toggleTab('MostPlayed')}>
126
+ {$_('Translations.mostPlayed')}
127
+ </button>
128
+ {/if}
129
+ {#if tab == 'LastPlayed'}
130
+ <button class="MyGamesButton {gamesType == 'LastPlayed' ? 'Active' : ''} {lastplayed == 'false' ? 'Off': ''}" on:click={() => toggleTab('LastPlayed')}>
131
+ {$_('Translations.recentlyPlayed')}
132
+ </button>
133
+ {/if}
134
+ {/each}
135
+ </div>
136
+ </div>
137
+
138
+ <div>
139
+ {#if gamesType == 'Favorites'}
140
+ <casino-favorites-section
141
+ session={session}
142
+ userid={userid}
143
+ endpoint={endpoint}
144
+ datasource={datasource}
145
+ lang={lang}
146
+ currency={currency}
147
+ favorites={favorites}
148
+ categoryid={"FAVORITES"}
149
+ class="CategoryContainer"
150
+ {clientstyling}
151
+ {clientstylingurl}
152
+ {livecasino}
153
+ {visiblegames}
154
+ {gamepagemodalurl}
155
+ {integratedgameframedesktop}
156
+ {integratedgameframemobile}
157
+ {casinomygames} />
158
+ {:else if gamesType == 'MostPlayed'}
159
+ <casino-most-played-section
160
+ endpoint={endpoint}
161
+ datasource={datasource}
162
+ lang={lang}
163
+ currency={currency}
164
+ session={session}
165
+ userid={userid}
166
+ favorites={favorites}
167
+ categoryindex="0"
168
+ class="CategoryContainer"
169
+ {clientstyling}
170
+ {clientstylingurl}
171
+ {livecasino}
172
+ {visiblegames}
173
+ {gamepagemodalurl}
174
+ {integratedgameframedesktop}
175
+ {integratedgameframemobile}
176
+ {casinomygames} />
177
+ {:else if gamesType == 'LastPlayed'}
178
+ <casino-last-played-section
179
+ userid={userid}
180
+ endpoint={endpoint}
181
+ datasource={datasource}
182
+ favorites={favorites}
183
+ lang={lang}
184
+ currency={currency}
185
+ session={session}
186
+ class="CategoryContainer"
187
+ {clientstyling}
188
+ {clientstylingurl}
189
+ {livecasino}
190
+ {visiblegames}
191
+ {gamepagemodalurl}
192
+ {integratedgameframedesktop}
193
+ {integratedgameframemobile}
194
+ {casinomygames} />
195
+ {/if}
196
+ </div>
197
+ </div>
198
+ {/if}
199
+ {/if}
200
+ </div>
201
+
202
+
203
+ <style lang="scss">
204
+
205
+ .CasinoMyGames {
206
+ background-color: var(--emfe-w-color-contrast, #07072A);
207
+ width: 100%;
208
+ margin: 50px 0;
209
+ &.Mobile {
210
+ padding: 25px 10px;
211
+ }
212
+ }
213
+
214
+ .MyGamesHeader {
215
+ display: flex;
216
+ justify-content: space-between;
217
+ margin-bottom: 40px;
218
+ }
219
+
220
+ .MyGamesButton {
221
+ border: none;
222
+ background: none;
223
+ color: var(--emfe-w-color-white, #FFFFFF);
224
+ font-size: 20px;
225
+ font-weight: 500;
226
+ margin-right: 60px;
227
+ transition: linear 100ms;
228
+
229
+ cursor: pointer;
230
+ &:hover {
231
+ border-bottom: 1px solid var(--emfe-w-color-primary, #D0046C);
232
+ line-height: 36px;
233
+ }
234
+ &:focus {
235
+ color: var(--emfe-w-color-primary, #D0046C);
236
+ line-height: 36px;
237
+ }
238
+ &.Active {
239
+ border-bottom: 2px solid #D0046C;
240
+ padding-bottom: 10px;
241
+ color: var(--emfe-w-color-primary, #D0046C);
242
+ }
243
+ &.Active {
244
+ border-bottom: 1px solid var(--emfe-w-color-primary, #D0046C);
245
+ color: var(--emfe-w-color-primary, #D0046C);
246
+ line-height: 36px;
247
+ }
248
+ }
249
+
250
+ .ButtonsContainerNone {
251
+ display: none;
252
+ }
253
+
254
+ .Mobile {
255
+ .CasinoMyGames {
256
+ margin: 30px 0;
257
+ }
258
+ .CasinoMyGames {
259
+ width: 320px;
260
+ max-width: 320px;
261
+ }
262
+ .MyGamesHeader {
263
+ justify-content: flex-start;
264
+ }
265
+ .MyGamesButton {
266
+ font-size: 16px;
267
+ white-space: nowrap;
268
+ margin-right: 10px;
269
+ &.Active {
270
+ padding-bottom: 4px;
271
+ }
272
+ }
273
+ }
274
+ </style>
@@ -0,0 +1,92 @@
1
+ export interface CasinoMyGames {
2
+ count: number,
3
+ items: Array<CategoriesItems>,
4
+ pages: CategoriesPages,
5
+ total: number ,
6
+ }
7
+
8
+ export interface CategoriesItems {
9
+ id: number,
10
+ name: String,
11
+ href: String,
12
+ games: Array<GamesItem>
13
+ };
14
+
15
+ interface GamesItem {
16
+ count: number,
17
+ items: Array<Object>,
18
+ pages: PagesItem,
19
+ total: number
20
+ }
21
+
22
+ interface PagesItem {
23
+ first: String,
24
+ last: String,
25
+ next: String,
26
+ previous: String
27
+ }
28
+
29
+ interface CategoriesPages {
30
+ first: String,
31
+ last: String,
32
+ next: String,
33
+ previous: String,
34
+ }
35
+
36
+ export interface CasinoData {
37
+ count: number,
38
+ items: CasinoItems[],
39
+ pages: CasinoPages,
40
+ total: number
41
+ }
42
+
43
+ export interface CasinoItems {
44
+ name: string,
45
+ games: CasinoGames,
46
+ moreBtn?: boolean
47
+ }
48
+
49
+ interface CasinoGames {
50
+ count: number,
51
+ items: [{href: string}],
52
+ pages: CasinoPages,
53
+ total: number
54
+ }
55
+
56
+ interface CasinoPages {
57
+ first: string,
58
+ last: string,
59
+ next: null,
60
+ previous: null
61
+ }
62
+
63
+ export interface CasinoGameData {
64
+ backgroundImageUrl: string,
65
+ categories: CasinoBaseData,
66
+ defaultThumbnail: string,
67
+ groups: CasinoGroups,
68
+ hasAnonymousFunMode: boolean,
69
+ hasFunMode: boolean,
70
+ href: string,
71
+ id: string,
72
+ isNew: boolean,
73
+ launchURL: string,
74
+ name: string,
75
+ platform: string[],
76
+ popularity: number,
77
+ thumbnail: string,
78
+ vendor: {href: string, name:string},
79
+ cellSize?: string
80
+ }
81
+
82
+ interface CasinoBaseData {
83
+ count: number,
84
+ items: [{href: string}],
85
+ pagination: CasinoPages,
86
+ total: number
87
+ }
88
+
89
+ interface CasinoGroups {
90
+ count: number,
91
+ items: string[]
92
+ }
package/src/i18n.js ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ dictionary,
3
+ locale,
4
+ addMessages,
5
+ _
6
+ } from 'svelte-i18n';
7
+
8
+ function setupI18n({ withLocale: _locale, translations }) {
9
+ locale.subscribe((data) => {
10
+ if (data == null) {
11
+ dictionary.set(translations);
12
+ locale.set(_locale);
13
+ }
14
+ }); // maybe we will need this to make sure that the i18n is set up only once
15
+ /*dictionary.set(translations);
16
+ locale.set(_locale);*/
17
+ }
18
+
19
+ function addNewMessages(lang, dict) {
20
+ addMessages(lang, dict);
21
+ }
22
+
23
+ function setLocale(_locale) {
24
+ locale.set(_locale);
25
+ }
26
+
27
+ export { _, setupI18n, addNewMessages, setLocale };
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ import CasinoMyGames from './CasinoMyGames.svelte';
2
+
3
+ !customElements.get('casino-my-games') && customElements.define('casino-my-games', CasinoMyGames);
4
+ export default CasinoMyGames;
@@ -0,0 +1,107 @@
1
+ export const Translations = {
2
+ en: {
3
+ Translations: {
4
+ favorites: 'Favorites',
5
+ mostPlayed: 'Most Played',
6
+ recentlyPlayed: 'Last Played'
7
+ }
8
+ },
9
+ zh: {
10
+ Translations: {
11
+ favorites: 'Favorites',
12
+ mostPlayed: 'Most Played',
13
+ recentlyPlayed: 'Last Played'
14
+ }
15
+ },
16
+ de: {
17
+ Translations: {
18
+ favorites: 'Favorites',
19
+ mostPlayed: 'Most Played',
20
+ recentlyPlayed: 'Last Played'
21
+ }
22
+ },
23
+ it: {
24
+ Translations: {
25
+ favorites: 'Favorites',
26
+ mostPlayed: 'Most Played',
27
+ recentlyPlayed: 'Last Played'
28
+ }
29
+ },
30
+ fr: {
31
+ Translations: {
32
+ favorites: 'Favorites',
33
+ mostPlayed: 'Most Played',
34
+ recentlyPlayed: 'Last Played'
35
+ }
36
+ },
37
+ es: {
38
+ Translations: {
39
+ favorites: 'Favorites',
40
+ mostPlayed: 'Most Played',
41
+ recentlyPlayed: 'Last Played'
42
+ }
43
+ },
44
+ tr: {
45
+ Translations: {
46
+ favorites: 'Favorites',
47
+ mostPlayed: 'Most Played',
48
+ recentlyPlayed: 'Last Played'
49
+ }
50
+ },
51
+ ru: {
52
+ Translations: {
53
+ favorites: 'Favorites',
54
+ mostPlayed: 'Most Played',
55
+ recentlyPlayed: 'Last Played'
56
+ }
57
+ },
58
+ ro: {
59
+ Translations: {
60
+ favorites: 'Favorites',
61
+ mostPlayed: 'Most Played',
62
+ recentlyPlayed: 'Last Played'
63
+ }
64
+ },
65
+ hr: {
66
+ Translations: {
67
+ favorites: 'Favorites',
68
+ mostPlayed: 'Most Played',
69
+ recentlyPlayed: 'Last Played'
70
+ }
71
+ },
72
+ hu: {
73
+ Translations: {
74
+ favorites: 'Favorites',
75
+ mostPlayed: 'Most Played',
76
+ recentlyPlayed: 'Last Played'
77
+ }
78
+ },
79
+ pl: {
80
+ Translations: {
81
+ favorites: 'Favorites',
82
+ mostPlayed: 'Most Played',
83
+ recentlyPlayed: 'Last Played'
84
+ }
85
+ },
86
+ pt: {
87
+ Translations: {
88
+ favorites: 'Favorites',
89
+ mostPlayed: 'Most Played',
90
+ recentlyPlayed: 'Last Played'
91
+ }
92
+ },
93
+ sl: {
94
+ Translations: {
95
+ favorites: 'Favorites',
96
+ mostPlayed: 'Most Played',
97
+ recentlyPlayed: 'Last Played'
98
+ }
99
+ },
100
+ sr: {
101
+ Translations: {
102
+ favorites: 'Favorites',
103
+ mostPlayed: 'Most Played',
104
+ recentlyPlayed: 'Last Played'
105
+ }
106
+ }
107
+ };