@everymatrix/player-account-gaming-limits-wrapper-2 1.17.1 → 1.17.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-gaming-limits-wrapper-2",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "main": "dist/player-account-gaming-limits-wrapper-2.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "f2155458138e80c61c668cc7e75c645d6f16709c"
38
+ "gitHead": "462a557bf7dab099fad999a6d0998f5155877620"
39
39
  }
@@ -2,6 +2,9 @@
2
2
 
3
3
  <script lang="ts">
4
4
  import { onMount } from 'svelte';
5
+ import { getDevice } from 'rvhelper';
6
+ import { _, addNewMessages } from './i18n';
7
+ import { TRANSLATIONS } from './translations';
5
8
 
6
9
  import '@everymatrix/player-account-gaming-limits-page-2-gm16';
7
10
  import '@everymatrix/player-account-gaming-limits-history-2';
@@ -37,6 +40,26 @@
37
40
  let amountsArray:Array<string>;
38
41
  let periodsArray:Array<string>;
39
42
 
43
+ let userAgent:string = window.navigator.userAgent;
44
+ let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
45
+
46
+ const setTranslationUrl = ():void => {
47
+ let url:string = translationurl;
48
+
49
+ fetch(url).then((res:any) => res.json())
50
+ .then((res) => {
51
+ Object.keys(res).forEach((item:any):void => {
52
+ addNewMessages(item, res[item]);
53
+ });
54
+ }).catch((err:any) => {
55
+ console.log(err);
56
+ });
57
+ }
58
+
59
+ Object.keys(TRANSLATIONS).forEach((item:any) => {
60
+ addNewMessages(item, TRANSLATIONS[item]);
61
+ });
62
+
40
63
  const unwrapLimitsConfig = (amounts:string, periods:string):void=> {
41
64
  amountsArray = amounts.replace(/\s/g, '').split('|');
42
65
  periodsArray = periods.replace(/\s/g, '').split('|');
@@ -71,6 +94,10 @@
71
94
  }
72
95
  }
73
96
 
97
+ const toggleScreen = ():void => {
98
+ window.postMessage({type: 'PlayerAccountMenuActive', isMobile}, window.location.href);
99
+ }
100
+
74
101
  const setClientStyling = ():void => {
75
102
  let sheet:HTMLElement = document.createElement('style');
76
103
  sheet.innerHTML = clientstyling;
@@ -108,51 +135,66 @@
108
135
  </svelte:head>
109
136
 
110
137
  <div bind:this={customStylingContainer}>
111
- {#if isLoading}
112
- <!-- Just show nothing, this is loading exposed attributes, not making a fetch. It takes an instant, but prevents nested widgets from rendering with empty attributes -->
113
- {:else}
114
- {#if limitTabs.length > 1}
115
- <div class="TabsContainer" bind:this={tabsContainer}>
116
- {#each limitTabs as limit,i}
117
- <div class="LimitsTab" on:click={() => selectTab(i)}>{tabLabelArray[i] ?? limit}</div>
138
+ <div class="GamingLimitsWrapper {isMobile ? 'GamingLimitsWrapperMobile' : ''}">
139
+ <div class="TitleSection">
140
+ {#if isMobile}
141
+ <div class="MenuReturnButton" part="MenuReturnButton" on:click={() => toggleScreen()}>
142
+ <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><defs><style>.aaa{fill:var(--emfe-w-pam-color-primary, var(--emfe-w-color-pink-500, #D0046C));}</style></defs><g transform="translate(-20 -158)">
143
+ <g transform="translate(20 158)">
144
+ <path class="aaa" d="M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z" transform="translate(15 15) rotate(180)"/>
145
+ </g></g>
146
+ </svg>
147
+ <h2 class="GamingLimitsTitleMobile">{$_('title')}</h2>
148
+ </div>
149
+ {/if}
150
+ <h2 class="GamingLimitsTitle {isMobile ? 'GamingLimitsTitleNone' : ''}">{$_('title')}</h2>
151
+ </div>
152
+ {#if isLoading}
153
+ <!-- Just show nothing, this is loading exposed attributes, not making a fetch. It takes an instant, but prevents nested widgets from rendering with empty attributes -->
154
+ {:else}
155
+ {#if limitTabs.length > 1}
156
+ <div class="TabsContainer" bind:this={tabsContainer}>
157
+ {#each limitTabs as limit,i}
158
+ <div class="LimitsTab" on:click={() => selectTab(i)}>{tabLabelArray[i] ?? limit}</div>
159
+ {/each}
160
+ </div>
161
+ {/if}
162
+
163
+ <div class="PlayerAccountGamingLmitsWrapper2" bind:this={mainContainer}>
164
+ {#each limitTabs as _, i}
165
+ <player-account-gaming-limits-page-2-gm16 class="hidden selected"
166
+ {lang}
167
+ {currency}
168
+ amountsconfig = {amountsArray[i]}
169
+ periodsconfig = {periodsArray[i]}
170
+ {userid}
171
+ {deletelimit}
172
+ {session}
173
+ {endpoint}
174
+ {apiversion}
175
+ {clientstyling}
176
+ {clientstylingurl}
177
+ {translationurl}
178
+ {customcurrencysymbols}
179
+ ></player-account-gaming-limits-page-2-gm16>
118
180
  {/each}
119
181
  </div>
182
+ {#if historyenabled === 'true'}
183
+ <player-account-gaming-limits-history-2
184
+ {lang}
185
+ {userid}
186
+ {session}
187
+ {endpoint}
188
+ {apiversion}
189
+ {numberofentries}
190
+ {clientstyling}
191
+ {clientstylingurl}
192
+ {translationurl}
193
+ {customcurrencysymbols}
194
+ ></player-account-gaming-limits-history-2>
195
+ {/if}
120
196
  {/if}
121
-
122
- <div class="player-account-gaming-limits-wrapper-2" bind:this={mainContainer}>
123
- {#each limitTabs as _, i}
124
- <player-account-gaming-limits-page-2-gm16 class="hidden selected"
125
- {lang}
126
- {currency}
127
- amountsconfig = {amountsArray[i]}
128
- periodsconfig = {periodsArray[i]}
129
- {userid}
130
- {deletelimit}
131
- {session}
132
- {endpoint}
133
- {apiversion}
134
- {clientstyling}
135
- {clientstylingurl}
136
- {translationurl}
137
- {customcurrencysymbols}
138
- ></player-account-gaming-limits-page-2-gm16>
139
- {/each}
140
- </div>
141
- {#if historyenabled === 'true'}
142
- <player-account-gaming-limits-history-2
143
- {lang}
144
- {userid}
145
- {session}
146
- {endpoint}
147
- {apiversion}
148
- {numberofentries}
149
- {clientstyling}
150
- {clientstylingurl}
151
- {translationurl}
152
- {customcurrencysymbols}
153
- ></player-account-gaming-limits-history-2>
154
- {/if}
155
- {/if}
197
+ </div>
156
198
  </div>
157
199
  <style lang="scss">
158
200
  :host {
@@ -171,6 +213,14 @@
171
213
  box-sizing: border-box;
172
214
  }
173
215
 
216
+ .GamingLimitsWrapper{
217
+ padding: 50px 50px 30px 50px;
218
+ }
219
+
220
+ .GamingLimitsWrapper.GamingLimitsWrapperMobile{
221
+ padding: 20px 15px;
222
+ }
223
+
174
224
  .LimitsWrapper {
175
225
  display: flex;
176
226
  flex-direction: column;
@@ -204,9 +254,42 @@
204
254
  display: none;
205
255
  }
206
256
 
207
- .selected {
208
- border-bottom: 0.2rem solid var(--emfe-w-pam-color-primary, var(--emfe-w-color-pink-500, #D0046C));
257
+ h2{
258
+ margin: 20px 0px;
259
+ }
260
+
261
+ .PlayerAccountGamingLmitsWrapper2{
262
+ margin-bottom: 20px;
263
+ }
264
+
265
+ .MenuReturnButton{
266
+ color: var(--emfe-w-pam-color-primary, var(--emfe-w-color-pink-500, #D0046C));
267
+ display: inline-flex;
268
+ align-items: center;
269
+ column-gap: 10px;
270
+ margin-bottom: 10px;
271
+ & svg {
272
+ fill: var(--emfe-w-pam-color-primary, var(--emfe-w-color-pink-500, #D0046C));
273
+ }
274
+ }
275
+
276
+ .GamingLimitsTitle{
277
+ font-size: 26px;
209
278
  color: var(--emfe-w-pam-color-primary, var(--emfe-w-color-pink-500, #D0046C));
279
+ font-weight: 400;
280
+ }
281
+
282
+ .GamingLimitsTitleMobile {
283
+ font-size: 16px;
284
+ }
285
+
286
+ .GamingLimitsTitleNone {
287
+ display: none;
288
+ }
289
+
290
+ .selected {
291
+ border-bottom: 0.2rem solid var(--emfe-w-pam-color-primary, var(--emfe-w-color-primary, #D0046C));
292
+ color: var(--emfe-w-pam-color-primary, var(--emfe-w-color-primary, #D0046C));
210
293
  margin: 0;
211
294
  }
212
295
  </style>
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 };
@@ -0,0 +1,20 @@
1
+ export const TRANSLATIONS = {
2
+ "en": {
3
+ "title": "Limits"
4
+ },
5
+ "zh-hk": {
6
+ "title": "Limits"
7
+ },
8
+ "fr": {
9
+ "title": "Limits"
10
+ },
11
+ "ro": {
12
+ "title": "Limits"
13
+ },
14
+ "es": {
15
+ "title": "Limits"
16
+ },
17
+ "pt": {
18
+ "title": "Limits"
19
+ }
20
+ }