@everymatrix/casino-providers 0.0.367 → 0.0.369

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,186 +1,186 @@
1
- <svelte:options tag={null} />
2
- <script lang="ts">
3
- import { Translations } from './translations';
4
- import { _, addNewMessages, setLocale } from './i18n';
5
-
6
- export let endpoint:string = '';
7
- export let datasource:string = '';
8
- export let lang:string = 'en';
9
- export let clientstyling:string = '';
10
- export let clientstylingurl:string = '';
11
-
12
- let providers:Array<any> = [];
13
- let topProviders:Array<any> = [];
14
- let otherProviders:Array<any> = [];
15
- let isLoading:boolean = false;
16
- let customStylingContainer:HTMLElement;
17
- let displayNone:boolean = false;
18
-
19
- Object.keys(Translations).forEach((item:any):void => {
20
- addNewMessages(item, Translations[item]);
21
- });
22
-
23
- const getProviders = ():void => {
24
- isLoading = true;
25
-
26
- const url:URL = new URL(`${endpoint}/casino/vendors`);
27
-
28
- url.searchParams.append("datasource", datasource);
29
- url.searchParams.append("language", lang);
30
- url.searchParams.append("fields" , "id,name,displayName,subVendors,isTopVendor,logo,games");
31
-
32
- fetch(url)
33
- .then(res => res.json())
34
- .then(data => {
35
- isLoading = false;
36
- providers = data.items.map((item => item));
37
-
38
- topProviders = providers.filter(provider => provider.isTopVendor === true);
39
- otherProviders = providers.filter(provider => provider.isTopVendor === false);
40
-
41
- let allSubVendors:Array<any> = [];
42
- allSubVendors = providers.flatMap(item => item.subVendors);
43
-
44
- otherProviders.push(...allSubVendors.filter(subVendor => subVendor.games.count > 0));
45
- });
46
- }
47
-
48
- const openGameProviderPage = (providerId:string, providerName:string, providerLogo:string):void => {
49
- window.postMessage({ type: 'OpenGameProvider', providerId, providerName, providerLogo});
50
- };
51
-
52
- const setActiveLanguage = ():void => {
53
- setLocale(lang);
54
- }
55
-
56
- const setClientStyling = ():void => {
57
- let sheet = document.createElement('style');
58
- sheet.innerHTML = clientstyling;
59
- customStylingContainer.appendChild(sheet);
60
- }
61
-
62
- const setClientStylingURL = ():void => {
63
- displayNone = true;
64
-
65
- let url:URL = new URL(clientstylingurl);
66
- let cssFile:HTMLElement = document.createElement('style');
67
-
68
- fetch(url.href)
69
- .then((res:any) => res.text())
70
- .then((data:any) => {
71
- cssFile.innerHTML = data;
72
-
73
- if (customStylingContainer) {
74
- setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
75
- setTimeout(() => { displayNone = false; }, 500);
76
- }
77
- });
78
- }
79
-
80
- $: endpoint && lang && datasource && getProviders();
81
- $: lang && setActiveLanguage();
82
- $: clientstyling && setClientStyling();
83
- $: clientstylingurl && setClientStylingURL();
84
- </script>
85
-
86
- <div bind:this={customStylingContainer}>
87
- <div class="CasinoProviders">
88
- {#if isLoading === true}
89
- <p class="Message"> {$_('Translations.loading')} </p>
90
- {:else}
91
- <h4 class="ProviderTitle">{$_('Translations.popularProviders')}</h4>
92
- {#each topProviders as provider}
93
- <div class="Provider" on:click={() => openGameProviderPage(provider.id, provider.name, provider.logo)}>
94
- <img src={provider.logo} alt="{provider.name}" class="ProviderImage" >
95
- <div class="ProviderTextContainer">
96
- <p>{provider.name}</p>
97
- <p>{provider.games.count} {$_('Translations.games')}</p>
98
- </div>
99
- </div>
100
- {/each}
101
- <h4 class="ProviderTitle">{$_('Translations.otherProviders')}</h4>
102
- {#each otherProviders as provider}
103
- <div class="Provider" on:click={() => openGameProviderPage(provider.id, provider.name, provider.logo)}>
104
- <img src={provider.logo} alt="{provider.name}" class="ProviderImage" >
105
- <div class="ProviderTextContainer">
106
- <p>{provider.name}</p>
107
- <p>{provider.games.count} {$_('Translations.games')}</p>
108
- </div>
109
- </div>
110
- {/each}
111
- {/if}
112
- </div>
113
- </div>
114
-
115
- <style lang="scss">
116
- :host {
117
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
118
- }
119
-
120
- $color-grey: #828282;
121
-
122
- *,
123
- *::before,
124
- *::after {
125
- margin: 0;
126
- padding: 0;
127
- box-sizing: border-box;
128
- }
129
-
130
- .CasinoProviders {
131
- display: flex;
132
- flex-direction: column;
133
- gap: 1rem;
134
- padding: 10px 60px;
135
- }
136
-
137
- .ProviderTitle {
138
- font-weight: 500;
139
- position: relative;
140
- right: 30px;
141
- margin: 10px 0;
142
- }
143
-
144
- .Provider{
145
- border-radius: 7px;
146
- display: flex;
147
- align-items: center;
148
- gap: 16px;
149
- max-width: 300px;
150
-
151
- &TextContainer {
152
- display: flex;
153
- flex-direction: column;
154
- justify-content: center;
155
- gap: 10px;
156
- font-size: 15px;
157
- & p:first-child {
158
- font-weight: 600;
159
- }
160
- & p:last-child {
161
- color: $color-grey;
162
- font-weight: 300;
163
- }
164
- }
165
-
166
- &Image {
167
- border-radius: 4px;
168
- object-fit:contain;
169
- height: 64px;
170
- width: 64px;
171
- font-weight: 100;
172
- border: .5px solid #e4e2e2;
173
- overflow: hidden;
174
- object-fit: contain;
175
- }
176
-
177
- }
178
-
179
- .Message {
180
- font-weight: 600;
181
- position: absolute;
182
- top: 50%;
183
- left: 50%;
184
- transform: translate(-50%, -50%);
185
- }
186
- </style>
1
+ <svelte:options tag={null} />
2
+ <script lang="ts">
3
+ import { Translations } from './translations';
4
+ import { _, addNewMessages, setLocale } from './i18n';
5
+
6
+ export let endpoint:string = '';
7
+ export let datasource:string = '';
8
+ export let lang:string = 'en';
9
+ export let clientstyling:string = '';
10
+ export let clientstylingurl:string = '';
11
+
12
+ let providers:Array<any> = [];
13
+ let topProviders:Array<any> = [];
14
+ let otherProviders:Array<any> = [];
15
+ let isLoading:boolean = false;
16
+ let customStylingContainer:HTMLElement;
17
+ let displayNone:boolean = false;
18
+
19
+ Object.keys(Translations).forEach((item:any):void => {
20
+ addNewMessages(item, Translations[item]);
21
+ });
22
+
23
+ const getProviders = ():void => {
24
+ isLoading = true;
25
+
26
+ const url:URL = new URL(`${endpoint}/casino/vendors`);
27
+
28
+ url.searchParams.append("datasource", datasource);
29
+ url.searchParams.append("language", lang);
30
+ url.searchParams.append("fields" , "id,name,displayName,subVendors,isTopVendor,logo,games");
31
+
32
+ fetch(url)
33
+ .then(res => res.json())
34
+ .then(data => {
35
+ isLoading = false;
36
+ providers = data.items.map((item => item));
37
+
38
+ topProviders = providers.filter(provider => provider.isTopVendor === true);
39
+ otherProviders = providers.filter(provider => provider.isTopVendor === false);
40
+
41
+ let allSubVendors:Array<any> = [];
42
+ allSubVendors = providers.flatMap(item => item.subVendors);
43
+
44
+ otherProviders.push(...allSubVendors.filter(subVendor => subVendor.games.count > 0));
45
+ });
46
+ }
47
+
48
+ const openGameProviderPage = (providerId:string, providerName:string, providerLogo:string):void => {
49
+ window.postMessage({ type: 'OpenGameProvider', providerId, providerName, providerLogo});
50
+ };
51
+
52
+ const setActiveLanguage = ():void => {
53
+ setLocale(lang);
54
+ }
55
+
56
+ const setClientStyling = ():void => {
57
+ let sheet = document.createElement('style');
58
+ sheet.innerHTML = clientstyling;
59
+ customStylingContainer.appendChild(sheet);
60
+ }
61
+
62
+ const setClientStylingURL = ():void => {
63
+ displayNone = true;
64
+
65
+ let url:URL = new URL(clientstylingurl);
66
+ let cssFile:HTMLElement = document.createElement('style');
67
+
68
+ fetch(url.href)
69
+ .then((res:any) => res.text())
70
+ .then((data:any) => {
71
+ cssFile.innerHTML = data;
72
+
73
+ if (customStylingContainer) {
74
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
75
+ setTimeout(() => { displayNone = false; }, 500);
76
+ }
77
+ });
78
+ }
79
+
80
+ $: endpoint && lang && datasource && getProviders();
81
+ $: lang && setActiveLanguage();
82
+ $: clientstyling && setClientStyling();
83
+ $: clientstylingurl && setClientStylingURL();
84
+ </script>
85
+
86
+ <div bind:this={customStylingContainer}>
87
+ <div class="CasinoProviders">
88
+ {#if isLoading === true}
89
+ <p class="Message"> {$_('Translations.loading')} </p>
90
+ {:else}
91
+ <h4 class="ProviderTitle">{$_('Translations.popularProviders')}</h4>
92
+ {#each topProviders as provider}
93
+ <div class="Provider" on:click={() => openGameProviderPage(provider.id, provider.name, provider.logo)}>
94
+ <img src={provider.logo} alt="{provider.name}" class="ProviderImage" >
95
+ <div class="ProviderTextContainer">
96
+ <p>{provider.name}</p>
97
+ <p>{provider.games.count} {$_('Translations.games')}</p>
98
+ </div>
99
+ </div>
100
+ {/each}
101
+ <h4 class="ProviderTitle">{$_('Translations.otherProviders')}</h4>
102
+ {#each otherProviders as provider}
103
+ <div class="Provider" on:click={() => openGameProviderPage(provider.id, provider.name, provider.logo)}>
104
+ <img src={provider.logo} alt="{provider.name}" class="ProviderImage" >
105
+ <div class="ProviderTextContainer">
106
+ <p>{provider.name}</p>
107
+ <p>{provider.games.count} {$_('Translations.games')}</p>
108
+ </div>
109
+ </div>
110
+ {/each}
111
+ {/if}
112
+ </div>
113
+ </div>
114
+
115
+ <style lang="scss">
116
+ :host {
117
+ font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
118
+ }
119
+
120
+ $color-grey: #828282;
121
+
122
+ *,
123
+ *::before,
124
+ *::after {
125
+ margin: 0;
126
+ padding: 0;
127
+ box-sizing: border-box;
128
+ }
129
+
130
+ .CasinoProviders {
131
+ display: flex;
132
+ flex-direction: column;
133
+ gap: 1rem;
134
+ padding: 10px 60px;
135
+ }
136
+
137
+ .ProviderTitle {
138
+ font-weight: 500;
139
+ position: relative;
140
+ right: 30px;
141
+ margin: 10px 0;
142
+ }
143
+
144
+ .Provider{
145
+ border-radius: 7px;
146
+ display: flex;
147
+ align-items: center;
148
+ gap: 16px;
149
+ max-width: 300px;
150
+
151
+ &TextContainer {
152
+ display: flex;
153
+ flex-direction: column;
154
+ justify-content: center;
155
+ gap: 10px;
156
+ font-size: 15px;
157
+ & p:first-child {
158
+ font-weight: 600;
159
+ }
160
+ & p:last-child {
161
+ color: $color-grey;
162
+ font-weight: 300;
163
+ }
164
+ }
165
+
166
+ &Image {
167
+ border-radius: 4px;
168
+ object-fit:contain;
169
+ height: 64px;
170
+ width: 64px;
171
+ font-weight: 100;
172
+ border: .5px solid #e4e2e2;
173
+ overflow: hidden;
174
+ object-fit: contain;
175
+ }
176
+
177
+ }
178
+
179
+ .Message {
180
+ font-weight: 600;
181
+ position: absolute;
182
+ top: 50%;
183
+ left: 50%;
184
+ transform: translate(-50%, -50%);
185
+ }
186
+ </style>
package/src/i18n.js CHANGED
@@ -1,27 +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 };
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 CHANGED
@@ -1,4 +1,4 @@
1
- import CasinoProviders from './CasinoProviders.svelte';
2
-
3
- !customElements.get('casino-providers') && customElements.define('casino-providers', CasinoProviders);
4
- export default CasinoProviders;
1
+ import CasinoProviders from './CasinoProviders.svelte';
2
+
3
+ !customElements.get('casino-providers') && customElements.define('casino-providers', CasinoProviders);
4
+ export default CasinoProviders;
@@ -1,122 +1,122 @@
1
- export const Translations = {
2
- en: {
3
- Translations: {
4
- popularProviders: "Popular Suppliers",
5
- otherProviders: "Other Suppliers",
6
- loading: "Loading, please wait...",
7
- games: "games",
8
- },
9
- },
10
- zh: {
11
- Translations: {
12
- popularProviders: "热门供应商",
13
- otherProviders: "其他供应商",
14
- loading: "加载请稍候...",
15
- games: "游戏",
16
- },
17
- },
18
- de: {
19
- Translations: {
20
- popularProviders: "Beliebte Anbieter",
21
- otherProviders: "Weitere Anbieter",
22
- loading: "Es lädt, bitte warten...",
23
- games: "Spiele",
24
- },
25
- },
26
- it: {
27
- Translations: {
28
- popularProviders: "Popular Suppliers",
29
- otherProviders: "Other Suppliers",
30
- loading: "Loading, please wait",
31
- games: "games",
32
- },
33
- },
34
- fr: {
35
- Translations: {
36
- popularProviders: "Fournisseurs populaires",
37
- otherProviders: "Autres fournisseurs",
38
- loading: "Chargement, veuillez patienter...",
39
- games: "jeux",
40
- },
41
- },
42
- es: {
43
- Translations: {
44
- popularProviders: "Popular Suppliers",
45
- otherProviders: "Other Suppliers",
46
- loading: "Loading, please wait",
47
- games: "games",
48
- },
49
- },
50
- tr: {
51
- Translations: {
52
- popularProviders: "Popular Suppliers",
53
- otherProviders: "Other Suppliers",
54
- loading: "Loading, please wait",
55
- games: "games",
56
- },
57
- },
58
- ru: {
59
- Translations: {
60
- popularProviders: "Popular Suppliers",
61
- otherProviders: "Other Suppliers",
62
- loading: "Loading, please wait",
63
- games: "games",
64
- },
65
- },
66
- ro: {
67
- Translations: {
68
- popularProviders: "Furnizori de top",
69
- otherProviders: "Alti furnizori",
70
- loading: "Se incarca, te rugam asteapta…",
71
- games: "jocuri",
72
- },
73
- },
74
- hr: {
75
- Translations: {
76
- popularProviders: "Popular Suppliers",
77
- otherProviders: "Other Suppliers",
78
- loading: "Loading, please wait",
79
- games: "games",
80
- },
81
- },
82
- hu: {
83
- Translations: {
84
- popularProviders: "Popular Suppliers",
85
- otherProviders: "Other Suppliers",
86
- loading: "Loading, please wait",
87
- games: "games",
88
- },
89
- },
90
- pl: {
91
- Translations: {
92
- popularProviders: "Popular Suppliers",
93
- otherProviders: "Other Suppliers",
94
- loading: "Loading, please wait",
95
- games: "games",
96
- },
97
- },
98
- pt: {
99
- Translations: {
100
- popularProviders: "Popular Suppliers",
101
- otherProviders: "Other Suppliers",
102
- loading: "Loading, please wait",
103
- games: "games",
104
- },
105
- },
106
- sl: {
107
- Translations: {
108
- popularProviders: "Popular Suppliers",
109
- otherProviders: "Other Suppliers",
110
- loading: "Loading, please wait",
111
- games: "games",
112
- },
113
- },
114
- sr: {
115
- Translations: {
116
- popularProviders: "Popular Suppliers",
117
- otherProviders: "Other Suppliers",
118
- loading: "Loading, please wait",
119
- games: "games",
120
- },
121
- },
122
- };
1
+ export const Translations = {
2
+ en: {
3
+ Translations: {
4
+ popularProviders: "Popular Suppliers",
5
+ otherProviders: "Other Suppliers",
6
+ loading: "Loading, please wait...",
7
+ games: "games",
8
+ },
9
+ },
10
+ zh: {
11
+ Translations: {
12
+ popularProviders: "热门供应商",
13
+ otherProviders: "其他供应商",
14
+ loading: "加载请稍候...",
15
+ games: "游戏",
16
+ },
17
+ },
18
+ de: {
19
+ Translations: {
20
+ popularProviders: "Beliebte Anbieter",
21
+ otherProviders: "Weitere Anbieter",
22
+ loading: "Es lädt, bitte warten...",
23
+ games: "Spiele",
24
+ },
25
+ },
26
+ it: {
27
+ Translations: {
28
+ popularProviders: "Popular Suppliers",
29
+ otherProviders: "Other Suppliers",
30
+ loading: "Loading, please wait",
31
+ games: "games",
32
+ },
33
+ },
34
+ fr: {
35
+ Translations: {
36
+ popularProviders: "Fournisseurs populaires",
37
+ otherProviders: "Autres fournisseurs",
38
+ loading: "Chargement, veuillez patienter...",
39
+ games: "jeux",
40
+ },
41
+ },
42
+ es: {
43
+ Translations: {
44
+ popularProviders: "Popular Suppliers",
45
+ otherProviders: "Other Suppliers",
46
+ loading: "Loading, please wait",
47
+ games: "games",
48
+ },
49
+ },
50
+ tr: {
51
+ Translations: {
52
+ popularProviders: "Popular Suppliers",
53
+ otherProviders: "Other Suppliers",
54
+ loading: "Loading, please wait",
55
+ games: "games",
56
+ },
57
+ },
58
+ ru: {
59
+ Translations: {
60
+ popularProviders: "Popular Suppliers",
61
+ otherProviders: "Other Suppliers",
62
+ loading: "Loading, please wait",
63
+ games: "games",
64
+ },
65
+ },
66
+ ro: {
67
+ Translations: {
68
+ popularProviders: "Furnizori de top",
69
+ otherProviders: "Alti furnizori",
70
+ loading: "Se incarca, te rugam asteapta…",
71
+ games: "jocuri",
72
+ },
73
+ },
74
+ hr: {
75
+ Translations: {
76
+ popularProviders: "Popular Suppliers",
77
+ otherProviders: "Other Suppliers",
78
+ loading: "Loading, please wait",
79
+ games: "games",
80
+ },
81
+ },
82
+ hu: {
83
+ Translations: {
84
+ popularProviders: "Popular Suppliers",
85
+ otherProviders: "Other Suppliers",
86
+ loading: "Loading, please wait",
87
+ games: "games",
88
+ },
89
+ },
90
+ pl: {
91
+ Translations: {
92
+ popularProviders: "Popular Suppliers",
93
+ otherProviders: "Other Suppliers",
94
+ loading: "Loading, please wait",
95
+ games: "games",
96
+ },
97
+ },
98
+ pt: {
99
+ Translations: {
100
+ popularProviders: "Popular Suppliers",
101
+ otherProviders: "Other Suppliers",
102
+ loading: "Loading, please wait",
103
+ games: "games",
104
+ },
105
+ },
106
+ sl: {
107
+ Translations: {
108
+ popularProviders: "Popular Suppliers",
109
+ otherProviders: "Other Suppliers",
110
+ loading: "Loading, please wait",
111
+ games: "games",
112
+ },
113
+ },
114
+ sr: {
115
+ Translations: {
116
+ popularProviders: "Popular Suppliers",
117
+ otherProviders: "Other Suppliers",
118
+ loading: "Loading, please wait",
119
+ games: "games",
120
+ },
121
+ },
122
+ };