@everymatrix/casino-categories-slider 1.44.0 → 1.45.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 DELETED
@@ -1,40 +0,0 @@
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-categories-slider
9
- </title>
10
- <link rel="stylesheet" href="public/reset.css">
11
- <script src='dist/casino-categories-slider.js'></script>
12
- </head>
13
-
14
- <body>
15
- <style>
16
- html,body { margin: 0; padding: 0; height: 100%; font-family: "Helvetica Neue", "Helvetica", sans-serif; }
17
- .header { display: flex; justify-content: center; align-items: center; padding: 10px 20px; margin-bottom: 20px; background: #42a3e2; box-shadow: 3px 4px 5px 0px rgba(0,0,0, .2); }
18
- .header__logo svg { height: 50px; width: 50px; margin-right: 5px; }
19
- .header__name { color: #fff; }
20
- .header__name span { margin-right: 10px; font-weight: bold; }
21
- .webcomponent { padding: 10px 20px; }
22
- </style>
23
- <header class="header">
24
- <div class="header__logo">
25
- <svg xmlns="http://www.w3.org/2000/svg" width="161" height="132" viewBox="0 0 161 132"><defs><linearGradient x1="0%" y1="50%" y2="50%" id="a"><stop stop-color="#2A3B8F" offset="0%"/><stop stop-color="#29ABE2" offset="100%"/></linearGradient><linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="c"><stop stop-color="#B4D44E" offset="0%"/><stop stop-color="#E7F716" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path fill="#166DA5" d="M160.6 65.9l-17.4 29.3-24.4-29.7 24.4-28.9z"/><path fill="#8FDB69" d="M141.3 100.2l-26.5-31.7-15.9 26.6 24.7 36.1z"/><path fill="#166DA5" d="M141 31.4l-26.2 31.8-15.9-26.6L123.6.9z"/><path fill="url(#a)" opacity=".95" d="M61.1 31.4H141L123.4.7H78.7z M114.8 63.3H159l-15.9-26.8H98.8"/><path fill="url(#c)" opacity=".95" d="M141.3 100.3H61l17.6 30.5h45z M114.8 68.4H159l-15.9 26.8H98.8"/><path fill="#010101" d="M78.6 130.8L41 65.8 79.1.8H37.9L.4 65.8l37.5 65z"/></g></svg>
26
- </div>
27
- <h1 class="header__name">
28
- <span>WEBCOMPONENT:</span> casino-categories-slider
29
- </h1>
30
- </header>
31
-
32
- <div class="webcomponent">
33
- <casino-categories-slider endpoint="https://demo-api.stage.norway.everymatrix.com/v1" datasource="RNG" lang="en"
34
- showsubgroups="true" filteredcategories="collection,vendor">
35
- </casino-categories-slider>
36
- </casino-categories-slider>
37
- </div>
38
-
39
- </body>
40
- </html>
package/index.js DELETED
@@ -1 +0,0 @@
1
- import './dist/casino-categories-slider.js';
Binary file
package/public/reset.css DELETED
@@ -1,48 +0,0 @@
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
- }
package/rollup.config.js DELETED
@@ -1,67 +0,0 @@
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
- import uglify from 'rollup-plugin-uglify';
10
- import image from '@rollup/plugin-image';
11
-
12
- const production = process.env.NODE_ENV == 'production';
13
- const dev = process.env.NODE_ENV == 'development';
14
-
15
- export default {
16
- input: 'src/index.ts',
17
- output: {
18
- sourcemap: true,
19
- format: 'umd',
20
- name: 'app',
21
- file: 'dist/casino-categories-slider.js',
22
- },
23
- plugins: [
24
- svelte({
25
- preprocess: sveltePreprocess(),
26
- compilerOptions: {
27
- // @TODO check generate and hydratable
28
- // generate: 'ssr',
29
- // hydratable: true,
30
- // enable run-time checks when not in production
31
- customElement: true,
32
- dev: !production
33
- }
34
- }),
35
- image(),
36
- commonjs(),
37
- resolve({
38
- browser: true,
39
- dedupe: ['svelte']
40
- }),
41
- dev && serve({
42
- open: true,
43
- verbose: true,
44
- allowCrossOrigin: true,
45
- historyApiFallback: false,
46
- host: 'localhost',
47
- port: 5050,
48
- }),
49
- dev && livereload({ watch: ['', 'dist'] }),
50
- typescript({
51
- sourceMap: !production,
52
- inlineSources: !production,
53
- }),
54
- // If we're building for production (npm run build
55
- // instead of npm run dev), minify
56
- production &&
57
- terser({
58
- output: {
59
- comments: "all"
60
- },
61
- }),
62
- production && uglify.uglify()
63
- ],
64
- watch: {
65
- clearScreen: false
66
- }
67
- };
@@ -1,256 +0,0 @@
1
- <svelte:options tag={null} />
2
-
3
- <script lang="ts">
4
- import { onMount, tick } from "svelte";
5
- import { getDevice, checkSession } from 'rvhelper';
6
- import { _, addNewMessages } from './i18n';
7
- import { TRANSLATIONS } from './translations';
8
- import type { CategoriesData, CategoriesItems } from './CasinoCategoriesSlider.types';
9
- import '@everymatrix/casino-slider';
10
-
11
- export let endpoint:string = '';
12
- export let datasource:string = '';
13
- export let lang:string = ''; // Language
14
- export let userid:string = '';
15
- export let session:string = ''; // Value for sessionID
16
- export let mostplayed:string = ''; // True - add MostPlayed category in slider
17
- export let lastplayed:string = 'false'; // True - add LastPlayed category in slider
18
- export let favorites:string = ''; // True - add Favorites category in slider
19
- export let clientstyling:string = '';
20
- export let clientstylingurl:string = '';
21
- export let activecategory:string = '';
22
- export let actionevent:string = '';
23
- export let sessioncheck:string = '';
24
- export let location:string = "secondaryMenu";
25
- export let showsubgroups:string = 'false';
26
- export let filteredcategories:string = '';
27
- export let translationurl:string = '';
28
- export let categoriesicon:string = '';
29
- export let lobbyiconimage:string = '';
30
- export let mygamesiconimage:string = '';
31
-
32
- let identity:string = 'CasinoSliderData'
33
-
34
- // Player logged-in/logged-out status & session
35
-
36
- let myGamesTranslation:string;
37
- let lobbyTranslation:string;
38
-
39
- let isLoading:boolean = true;
40
- let error:string;
41
-
42
- let categories:Array<CategoriesItems> = [];
43
- let hasErrors:boolean = false;
44
- let userAgent = window.navigator.userAgent;
45
- let customStylingContainer:HTMLElement;
46
-
47
- let numberOfFavoredGames:number;
48
- let myGamesAdded:boolean = false;
49
- let isLoadingMostPlayed:boolean = false;
50
- let isLoadingLastPlayed:boolean = false;
51
- let confirmCategoryParse:boolean = false;
52
-
53
- $: numberOfFavoredGames = 0;
54
-
55
- const setTranslationUrl = ():void => {
56
- let url:string = translationurl;
57
-
58
- fetch(url).then((res:any) => res.json())
59
- .then((res) => {
60
- Object.keys(res).forEach((item:any):void => {
61
- addNewMessages(item, res[item]);
62
- });
63
- }).catch((err:any) => {
64
- console.log(err);
65
- });
66
- }
67
-
68
- Object.keys(TRANSLATIONS).forEach((item) => {
69
- addNewMessages(item, TRANSLATIONS[item]);
70
- });
71
-
72
- const addMyGamesCategory = ():void => {
73
- if (myGamesAdded == false && (favorites == 'true' || mostplayed == 'true' || lastplayed == 'true') ) {
74
- categories.splice(1, 0, {
75
- // @ts-ignore
76
- id: 'MYGAMES',
77
- name: myGamesTranslation,
78
- href: '',
79
- games: [],
80
- });
81
- }
82
-
83
- tick();
84
- myGamesAdded = true;
85
- confirmCategoryParse = true;
86
- sendSliderData();
87
- };
88
-
89
- const checkAttrs = ():boolean => {
90
- if (!endpoint) {
91
- error = "Endpoint is missing! Please provide a valid endpointURL.";
92
- hasErrors = true;
93
- isLoading = false;
94
-
95
- console.error(error);
96
- }
97
-
98
- if (!datasource) {
99
- error = "Datasource is missing! Please provide a valid datasource.";
100
- hasErrors = true;
101
- isLoading = false;
102
-
103
- console.error(error);
104
- }
105
-
106
- if (!lang || lang.length < 2) {
107
- error = "Language is missing! Please provide a valid language (alpha2code)";
108
- hasErrors = true;
109
- isLoading = false;
110
-
111
- console.error(error);
112
- }
113
-
114
- return hasErrors;
115
- }
116
-
117
- const initialLoad = ():void => {
118
- myGamesTranslation = $_('myGamesName');
119
- lobbyTranslation = $_('lobbyName');
120
-
121
- if (!checkAttrs()) {
122
- let url:any = new URL(`${endpoint}/v1/casino/groups/${datasource}`);
123
-
124
- url.searchParams.append('datasource', datasource);
125
- url.searchParams.append('language', lang);
126
- url.searchParams.append('platform', getDevice(userAgent));
127
-
128
- fetch(url)
129
- .then((res:any) => res.json())
130
- .then((data:CategoriesData) => {
131
- //create an array of filtered categories
132
- let arrayFilteredCategories = filteredcategories.split(',');
133
- // filter type added to type
134
- let arr = data.items.filter((item:any) => {
135
- let filtered = false;
136
- if( item.games.total > 0) {
137
- filtered = true;
138
- //exclude filtered categories
139
- if( filteredcategories ){
140
- for (let element of arrayFilteredCategories){
141
- if( item.flags == element ) filtered = false;
142
- }
143
- }
144
- };
145
- return filtered;
146
- });
147
-
148
- categories = [];
149
- categories = categories.concat(arr);
150
-
151
- // @TODO Translation for lobby
152
- categories.unshift({
153
- // @ts-ignore
154
- id: 'LOBBY',
155
- name: lobbyTranslation,
156
- href: '',
157
- games: [],
158
- });
159
-
160
- isLoading = false;
161
-
162
- window.postMessage({ type: 'CategoriesLoadedForSlider' }, window.location.href);
163
- }, (err:any) => {
164
- hasErrors = true;
165
- console.error('There was an error while fetching the categories', err);
166
- }).catch((err:any) => {
167
- hasErrors = true;
168
- console.error('There was an error while fetching the categories', err);
169
- });
170
- }
171
- }
172
-
173
-
174
- const setActiveCategory = ():void => {
175
- let checkIfSubcategory = activecategory.split('$');
176
- activecategory = (checkIfSubcategory.length > 2) ? activecategory.split('$').slice(0, 2).join('$') : activecategory;
177
- }
178
-
179
- const setClientStyling = ():void => {
180
- let sheet = document.createElement('style');
181
- sheet.innerHTML = clientstyling;
182
- customStylingContainer.appendChild(sheet);
183
- }
184
-
185
- const setClientStylingURL = ():void => {
186
- let cssFile:HTMLElement = document.createElement('style');
187
-
188
- let url = new URL(clientstylingurl);
189
-
190
- fetch(url.href)
191
- .then((res:any) => res.text())
192
- .then((data:any) => {
193
- cssFile.innerHTML = data
194
-
195
- setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
196
- });
197
- }
198
-
199
- const sendSliderData = ():void => {
200
- window.postMessage({ type: 'SliderData', identity, data: categories }, window.location.href);
201
- }
202
-
203
- $: endpoint && datasource && lang && initialLoad();
204
- $: endpoint && session && (mostplayed || lastplayed || favorites) && !isLoading && addMyGamesCategory();
205
- $: !isLoading && activecategory && (session ? confirmCategoryParse : true) && setActiveCategory();
206
- $: clientstyling && customStylingContainer && setClientStyling();
207
- $: translationurl && setTranslationUrl();
208
- $: clientstylingurl && customStylingContainer && setClientStylingURL();
209
-
210
- </script>
211
-
212
- <div bind:this={customStylingContainer}>
213
- {#if isLoading || isLoadingMostPlayed || isLoadingLastPlayed}
214
- <div class="CasinoCategoriesLoading"></div>
215
- {:else}
216
- {#if hasErrors}
217
- <p class="SearchLoading">500 Error - Internal Server Error.</p>
218
- {:else}
219
- <div class="CasinoCategoriesContainer" part="CasinoCategoriesContainer">
220
- <casino-slider
221
- {lang}
222
- {datasource}
223
- {endpoint}
224
- {identity}
225
- favoritesnumber={numberOfFavoredGames}
226
- use:sendSliderData
227
- {showsubgroups}
228
- {clientstyling}
229
- {clientstylingurl}
230
- activeindex={activecategory}
231
- {actionevent}
232
- {location}
233
- {categoriesicon}
234
- {lobbyiconimage}
235
- {mygamesiconimage}/>
236
- </div>
237
- {/if}
238
- {/if}
239
- </div>
240
-
241
- <style>
242
-
243
-
244
- .CasinoCategoriesLoading {
245
- height: 52px;
246
- }
247
-
248
- p {
249
- color: var( --emfe-w-categories-typography, var(--emfe-w-color-white) #FFFFFF);
250
- text-align: center;
251
- }
252
-
253
- .CasinoCategoriesContainer {
254
- background: var( --emfe-w-categories-color-primary, var(--emfe-w-color-primary, #D0046C));
255
- }
256
- </style>
@@ -1,34 +0,0 @@
1
- export interface CategoriesData {
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
- }
package/src/i18n.js DELETED
@@ -1,27 +0,0 @@
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 DELETED
@@ -1,4 +0,0 @@
1
- import CasinoCategoriesSlider from './CasinoCategoriesSlider.svelte';
2
-
3
- !customElements.get('casino-categories-slider') && customElements.define('casino-categories-slider', CasinoCategoriesSlider);
4
- export default CasinoCategoriesSlider;
@@ -1,70 +0,0 @@
1
- export const TRANSLATIONS = {
2
- "en": {
3
- "lobbyName": "Lobby",
4
- "myGamesName": "My games"
5
- },
6
- "de": {
7
- "lobbyName": "Lobby",
8
- "myGamesName": "My games"
9
- },
10
- "es": {
11
- "lobbyName": "Sala",
12
- "myGamesName": "Mis juegos"
13
- },
14
- "zh-hk": {
15
- "lobbyName": "Lobby",
16
- "myGamesName": "My games"
17
- },
18
- "it": {
19
- "lobbyName": "Lobby",
20
- "myGamesName": "My games"
21
- },
22
- "fr": {
23
- "lobbyName": "Lobby",
24
- "myGamesName": "My games"
25
- },
26
- "tr": {
27
- "lobbyName": "Lobi",
28
- "myGamesName": "Oyunlarım"
29
- },
30
- "ru": {
31
- "lobbyName": "Lobby",
32
- "myGamesName": "My games"
33
- },
34
- "ro": {
35
- "lobbyName": "Lobby",
36
- "myGamesName": "My games"
37
- },
38
- "hr": {
39
- "lobbyName": "Moj casino",
40
- "myGamesName": "Moje igre"
41
- },
42
- "hu": {
43
- "lobbyName": "Lobby",
44
- "myGamesName": "My games"
45
- },
46
- "pl": {
47
- "lobbyName": "Lobby",
48
- "myGamesName": "My games"
49
- },
50
- "pt": {
51
- "lobbyName": "Lobby",
52
- "myGamesName": "My games"
53
- },
54
- "sl": {
55
- "lobbyName": "Lobby",
56
- "myGamesName": "My games"
57
- },
58
- "sr": {
59
- "lobbyName": "Lobby",
60
- "myGamesName": "My games"
61
- },
62
- "pt-br": {
63
- "lobbyName": "Lobby",
64
- "myGamesName": "Meus jogos"
65
- },
66
- "es-mx": {
67
- "lobbyName": "Lobby",
68
- "myGamesName": "Mis juegos"
69
- }
70
- }
@@ -1,13 +0,0 @@
1
- import { html } from 'lit-element';
2
-
3
- import CasinoCategoriesSlider from '../src/CasinoCategoriesSlider';
4
-
5
- // This default export determines where your story goes in the story list
6
- export default {
7
- title: 'CasinoCategoriesSlider',
8
- };
9
-
10
- // 👇 We create a “template” of how args map to rendering
11
- const CasinoCategoriesSlider = ({ aProperty }) => html`<casino-categories-slider></casino-categories-slider>`;
12
-
13
- export const FirstStory = CasinoCategoriesSlider.bind({});
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "@tsconfig/svelte/tsconfig.json",
3
-
4
- "include": ["src/**/*"],
5
- "exclude": ["node_modules/*", "__sapper__/*", "public/*"]
6
- }