@everymatrix/player-withdrawal 0.0.200 → 0.0.201
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/dist/player-withdrawal.js +1 -1
- package/dist/player-withdrawal.js.map +1 -1
- package/package.json +2 -2
- package/src/PlayerWithdrawal.svelte +15 -3
- package/src/i18n.js +27 -0
- package/src/translations.js +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/player-withdrawal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.201",
|
|
4
4
|
"main": "dist/player-withdrawal",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "71051531499cfea745b53a0f7c0a77a252990ae7"
|
|
40
40
|
}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
<script lang="typescript">
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import { getDevice } from 'rvhelper';
|
|
5
|
+
import { _, addNewMessages, setLocale } from './i18n';
|
|
6
|
+
import { PlayerWithdrawalTranslations } from './translations';
|
|
5
7
|
|
|
6
8
|
export let endpoint:String = '';
|
|
7
9
|
export let session:String = '';
|
|
8
10
|
export let playerid:String = '';
|
|
11
|
+
export let lang:string = 'en';
|
|
9
12
|
|
|
10
13
|
let userAgent:String = window.navigator.userAgent;
|
|
11
14
|
let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
|
|
@@ -15,6 +18,10 @@
|
|
|
15
18
|
let amount:number = 0;
|
|
16
19
|
let iframeUrl:string = '';
|
|
17
20
|
|
|
21
|
+
Object.keys(PlayerWithdrawalTranslations).forEach((item:any) => {
|
|
22
|
+
addNewMessages(item, PlayerWithdrawalTranslations[item]);
|
|
23
|
+
});
|
|
24
|
+
|
|
18
25
|
const toggleScreen = () => {
|
|
19
26
|
window.postMessage({ type: 'ReturnToMenu' }, window.location.href);
|
|
20
27
|
}
|
|
@@ -88,6 +95,10 @@
|
|
|
88
95
|
});
|
|
89
96
|
}
|
|
90
97
|
|
|
98
|
+
const initialLoad = () => {
|
|
99
|
+
setLocale(lang);
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
onMount(() => {
|
|
92
103
|
window.addEventListener('message', messageHandler, false);
|
|
93
104
|
|
|
@@ -96,6 +107,7 @@
|
|
|
96
107
|
}
|
|
97
108
|
});
|
|
98
109
|
|
|
110
|
+
$: lang && initialLoad();
|
|
99
111
|
$: session && playerid && endpoint && getWithdrawalIframe();
|
|
100
112
|
</script>
|
|
101
113
|
|
|
@@ -107,12 +119,12 @@
|
|
|
107
119
|
<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)"/>
|
|
108
120
|
</g></g>
|
|
109
121
|
</svg>
|
|
110
|
-
<h2 class="WithdrawalTitleMobile">
|
|
122
|
+
<h2 class="WithdrawalTitleMobile">{$_('withdrawal.title')}</h2>
|
|
111
123
|
</div>
|
|
112
124
|
{/if}
|
|
113
|
-
<h2 class="WithdrawalTitle {isMobile ? 'WithdrawalTitleNone' : ''}">
|
|
125
|
+
<h2 class="WithdrawalTitle {isMobile ? 'WithdrawalTitleNone' : ''}">{$_('withdrawal.title')}</h2>
|
|
114
126
|
{#if isLoading}
|
|
115
|
-
<p>
|
|
127
|
+
<p>{$_('withdrawal.loading')}</p>
|
|
116
128
|
{:else}
|
|
117
129
|
<div class="WithdrawalIframeWrapper">
|
|
118
130
|
<iframe src={iframeUrl} title="Withdrawal Iframe"></iframe>
|
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 };
|