@everymatrix/player-account-balance-modal-nd 1.37.4
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/CHANGELOG.md +9 -0
- package/README.md +30 -0
- package/dist/player-account-balance-modal-nd.js +2 -0
- package/dist/player-account-balance-modal-nd.js.map +1 -0
- package/index.html +21 -0
- package/index.js +1 -0
- package/package.json +40 -0
- package/public/favicon.png +0 -0
- package/public/reset.css +48 -0
- package/rollup.config.js +67 -0
- package/src/PlayerAccountBalanceModal.svelte +731 -0
- package/src/i18n.js +27 -0
- package/src/index.ts +4 -0
- package/src/translations.js +121 -0
- package/stories/PlayerAccountBalanceModal.stories.js +13 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
import { _, addNewMessages, setLocale, setupI18n } from './i18n';
|
|
5
|
+
import { TRANSLATIONS } from './translations';
|
|
6
|
+
import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
7
|
+
import * as currencyFormatter from 'currency.js'
|
|
8
|
+
|
|
9
|
+
export let userid:string = '';
|
|
10
|
+
export let session:string = '';
|
|
11
|
+
export let endpoint:string = '';
|
|
12
|
+
export let lang:string = 'en';
|
|
13
|
+
export let clientstyling:string = '';
|
|
14
|
+
export let clientstylingurl:string = '';
|
|
15
|
+
export let translationurl:string = '';
|
|
16
|
+
export let customlocaleidentifier: string = '';
|
|
17
|
+
export let gmversion:string = '';
|
|
18
|
+
export let displaybalanceoption:string = 'All';
|
|
19
|
+
export let currencyseparator:string = '';
|
|
20
|
+
export let currencydecimal:string = '';
|
|
21
|
+
export let currencyprecision:string = '';
|
|
22
|
+
|
|
23
|
+
let showBalance:boolean = false;
|
|
24
|
+
let modalOpened: boolean = false;
|
|
25
|
+
let totalBalance:string = '';
|
|
26
|
+
let currency = '';
|
|
27
|
+
let customStylingContainer:HTMLElement;
|
|
28
|
+
let balanceItems:Array<any> = [];
|
|
29
|
+
let balanceSumUpdate:string = '0';
|
|
30
|
+
|
|
31
|
+
// let eventSource: EventSourcePolyfill;
|
|
32
|
+
let lastBalanceStream: EventSourcePolyfill;
|
|
33
|
+
let isLoading: boolean = false;
|
|
34
|
+
const amounts = {
|
|
35
|
+
Casino: {
|
|
36
|
+
Real: 0,
|
|
37
|
+
Bonus: 0
|
|
38
|
+
},
|
|
39
|
+
Sports: {
|
|
40
|
+
Real: 0,
|
|
41
|
+
Bonus: 0
|
|
42
|
+
}
|
|
43
|
+
};
|
|
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:any):void => {
|
|
61
|
+
addNewMessages(item, TRANSLATIONS[item]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const menuAction = (data):void => {
|
|
65
|
+
switch (data) {
|
|
66
|
+
case 'balance':
|
|
67
|
+
window.postMessage({ type: 'BalanceModalStatus', status: 'open' }, window.location.href);
|
|
68
|
+
showBalance = true;
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
modalOpened = true
|
|
71
|
+
}, 150);
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
case 'closebalance':
|
|
75
|
+
modalOpened = false;
|
|
76
|
+
window.postMessage({ type: 'BalanceModalStatus', status: 'close' }, window.location.href);
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
showBalance = false;
|
|
79
|
+
}, 150);
|
|
80
|
+
break;
|
|
81
|
+
|
|
82
|
+
default:
|
|
83
|
+
// do nothing
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const getPlayerAccountBalanceDataCore = async (url:URL):Promise<void> => {
|
|
89
|
+
try {
|
|
90
|
+
isLoading = true;
|
|
91
|
+
|
|
92
|
+
const res = await fetch(url, {
|
|
93
|
+
method: 'GET',
|
|
94
|
+
headers: { 'X-SessionID': session }
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const data = await res.json();
|
|
98
|
+
|
|
99
|
+
if(res.ok) {
|
|
100
|
+
isLoading = false;
|
|
101
|
+
|
|
102
|
+
window.postMessage({ type: 'BalancedFetched' }, window.location.href);
|
|
103
|
+
|
|
104
|
+
// Set data
|
|
105
|
+
balanceItems = data.items
|
|
106
|
+
currency = Object.keys(data.totalAmount)[0];
|
|
107
|
+
totalBalance = formatBalance(data.totalAmount[currency]);
|
|
108
|
+
|
|
109
|
+
} else {
|
|
110
|
+
isLoading = false;
|
|
111
|
+
throw new Error('Failed to fetch balance data !');
|
|
112
|
+
}
|
|
113
|
+
} catch(err) {
|
|
114
|
+
isLoading = false;
|
|
115
|
+
console.log('Balance error: ', err);
|
|
116
|
+
} finally { isLoading = false; }
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const getPlayerAccountBalanceData16 = async (url:URL):Promise<void> => {
|
|
120
|
+
try {
|
|
121
|
+
isLoading = true;
|
|
122
|
+
|
|
123
|
+
if (displaybalanceoption == 'Casino') {
|
|
124
|
+
url.searchParams.append('productType', 'Casino');
|
|
125
|
+
}
|
|
126
|
+
if (displaybalanceoption == 'Sports') {
|
|
127
|
+
url.searchParams.append('productType', 'Sports');
|
|
128
|
+
}
|
|
129
|
+
if (displaybalanceoption === 'All') {
|
|
130
|
+
url.searchParams.append('productType', 'Casino');
|
|
131
|
+
url.searchParams.append('productType', 'Sports');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const res = await fetch(url, {
|
|
135
|
+
method: 'GET',
|
|
136
|
+
headers: { 'X-SessionID': session }
|
|
137
|
+
});
|
|
138
|
+
const data = await res.json();
|
|
139
|
+
|
|
140
|
+
if(res.ok) {
|
|
141
|
+
isLoading = false;
|
|
142
|
+
|
|
143
|
+
for (const balance of data.items) {
|
|
144
|
+
const { type, amount, productType } = balance;
|
|
145
|
+
if (displaybalanceoption === 'Casino') {
|
|
146
|
+
amounts.Casino[type] = amount;
|
|
147
|
+
} else if (displaybalanceoption === 'Sports') {
|
|
148
|
+
amounts.Sports[type] = amount;
|
|
149
|
+
} else if (displaybalanceoption === 'All') {
|
|
150
|
+
if ( productType && type ) {
|
|
151
|
+
amounts[productType][type] = amount;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
currency = Object.keys(data.totalAmount)[0];
|
|
156
|
+
totalBalance = formatBalance(data.totalAmount[currency]);
|
|
157
|
+
|
|
158
|
+
} else {
|
|
159
|
+
isLoading = false;
|
|
160
|
+
throw new Error('Failed to fetch balance data !');
|
|
161
|
+
}
|
|
162
|
+
} catch(err) {
|
|
163
|
+
isLoading = false;
|
|
164
|
+
console.log('Balance error: ', err);
|
|
165
|
+
} finally { isLoading = false; }
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
const subscribeToBalanceUpdates = (src: string, sessionId): void => {
|
|
170
|
+
let stream = new EventSourcePolyfill(
|
|
171
|
+
src, {
|
|
172
|
+
headers: {
|
|
173
|
+
'accept': 'text/event-stream',
|
|
174
|
+
'X-SessionId': sessionId
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
if (lastBalanceStream) {
|
|
179
|
+
lastBalanceStream.close();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
lastBalanceStream = stream;
|
|
183
|
+
|
|
184
|
+
stream.addEventListener("message", (e: any) => {
|
|
185
|
+
balanceSumUpdate = '0';
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
let { balanceChange, currency } = JSON.parse(e.data);
|
|
189
|
+
if(gmversion === 'gmcore'){
|
|
190
|
+
balanceItems = balanceItems.map(element => {
|
|
191
|
+
if (balanceChange && balanceChange[element.id]) {
|
|
192
|
+
element = updateBalance(element, balanceChange[element.id].afterAmount);
|
|
193
|
+
}
|
|
194
|
+
balanceSumUpdate = (parseFloat(element?.balanceAmount) + parseFloat(balanceSumUpdate)).toString();
|
|
195
|
+
return element;
|
|
196
|
+
});
|
|
197
|
+
totalBalance = formatBalance(Number(balanceSumUpdate));
|
|
198
|
+
|
|
199
|
+
} else if(gmversion === 'gm16'){
|
|
200
|
+
for (let key in balanceChange){
|
|
201
|
+
amounts.Casino[key] = balanceChange[key].afterAmount;
|
|
202
|
+
}
|
|
203
|
+
totalBalance = formatBalance(amounts.Casino.Bonus + amounts.Casino.Real);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
currency = currency;
|
|
207
|
+
} catch(err) {
|
|
208
|
+
console.log('Balance stream failed: ', err);
|
|
209
|
+
subscribeToBalanceUpdates(`${endpoint}/v1/player/${userid}/balance/updates`, session);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function updateBalance(item, afterAmount) {
|
|
215
|
+
return { ...item, balanceAmount: afterAmount };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const balanceModalOpenDeposit = (): void => {
|
|
219
|
+
menuAction('closebalance');
|
|
220
|
+
window.postMessage({ type: 'GoToDeposit' }, window.location.href);
|
|
221
|
+
|
|
222
|
+
//Analytics event
|
|
223
|
+
if(typeof gtag == 'function'){
|
|
224
|
+
gtag('event', 'GoToDeposit', {
|
|
225
|
+
'context': 'PlayerAccountBalanceModal'
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const initialLoad = (): void => {
|
|
231
|
+
setLocale(lang);
|
|
232
|
+
|
|
233
|
+
switch (gmversion) {
|
|
234
|
+
case 'gmcore':
|
|
235
|
+
getPlayerAccountBalanceDataCore(new URL(`${endpoint}/v1/player/${userid}/account`));
|
|
236
|
+
break;
|
|
237
|
+
|
|
238
|
+
case 'gm16':
|
|
239
|
+
getPlayerAccountBalanceData16(new URL(`${endpoint}/v1/player/${userid}/balance`));
|
|
240
|
+
break;
|
|
241
|
+
|
|
242
|
+
default:
|
|
243
|
+
throw Error(`Invalid apiversion attribute: ${gmversion}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const setLocaleIdentifier = (): string => {
|
|
248
|
+
|
|
249
|
+
let localeIdentifier: string;
|
|
250
|
+
// Check if a custom locale identifier is present for the main language of the website.
|
|
251
|
+
if (customlocaleidentifier.includes(lang)) {
|
|
252
|
+
localeIdentifier = customlocaleidentifier;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return localeIdentifier;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const formatBalance = (balance: number): string => {
|
|
259
|
+
let formattedBalance: string;
|
|
260
|
+
|
|
261
|
+
if (customlocaleidentifier) {
|
|
262
|
+
formattedBalance = new Intl.NumberFormat(setLocaleIdentifier(), { useGrouping: true }).format(balance);
|
|
263
|
+
} else {
|
|
264
|
+
if (currencyseparator && currencydecimal) {
|
|
265
|
+
formattedBalance = currencyFormatter.default(balance, { separator: currencyseparator, decimal: currencydecimal, symbol: '', precision: parseInt(currencyprecision ? currencyprecision : '2', 10) }).format();
|
|
266
|
+
} else {
|
|
267
|
+
formattedBalance = currencyFormatter.default(balance, { separator: '.', decimal: ',', symbol: '', precision: parseInt(currencyprecision ? currencyprecision : '2', 10) }).format();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return formattedBalance;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const messageHandler = (e: any) => {
|
|
275
|
+
if (e.data) {
|
|
276
|
+
switch (e.data.type) {
|
|
277
|
+
case 'LogoutSuccessfull':
|
|
278
|
+
lastBalanceStream.close();
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const setClientStyling = ():void => {
|
|
285
|
+
let sheet = document.createElement('style');
|
|
286
|
+
sheet.innerHTML = clientstyling;
|
|
287
|
+
customStylingContainer.appendChild(sheet);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const setClientStylingURL = ():void => {
|
|
291
|
+
let url:URL = new URL(clientstylingurl);
|
|
292
|
+
let cssFile:HTMLElement = document.createElement('style');
|
|
293
|
+
|
|
294
|
+
fetch(url.href)
|
|
295
|
+
.then((res:any) => res.text())
|
|
296
|
+
.then((data:any) => {
|
|
297
|
+
cssFile.innerHTML = data
|
|
298
|
+
|
|
299
|
+
setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
onMount(() => {
|
|
304
|
+
window.addEventListener('message', messageHandler, false);
|
|
305
|
+
|
|
306
|
+
return () => {
|
|
307
|
+
window.removeEventListener('message', messageHandler);
|
|
308
|
+
if(lastBalanceStream) lastBalanceStream.close();
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
$: lang && setLocaleIdentifier();
|
|
313
|
+
$: endpoint &&
|
|
314
|
+
userid &&
|
|
315
|
+
session &&
|
|
316
|
+
lang &&
|
|
317
|
+
gmversion &&
|
|
318
|
+
displaybalanceoption &&
|
|
319
|
+
initialLoad();
|
|
320
|
+
|
|
321
|
+
$: endpoint &&
|
|
322
|
+
userid &&
|
|
323
|
+
session &&
|
|
324
|
+
subscribeToBalanceUpdates(`${endpoint}/v1/player/${userid}/balance/updates`, session)
|
|
325
|
+
;
|
|
326
|
+
$: clientstyling && customStylingContainer && setClientStyling();
|
|
327
|
+
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
328
|
+
$: translationurl && setTranslationUrl();
|
|
329
|
+
</script>
|
|
330
|
+
|
|
331
|
+
<div bind:this={customStylingContainer}>
|
|
332
|
+
<div class="ShowBalance">
|
|
333
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
334
|
+
<div class="BalanceValue" on:click={()=>menuAction('balance')}>
|
|
335
|
+
<p>{totalBalance} {currency}</p>
|
|
336
|
+
<span class=" {modalOpened ? 'TriangleActive' : 'TriangleInactive'}">
|
|
337
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="6.835" viewBox="0 0 14 6.835">
|
|
338
|
+
<path id="arrow" d="M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z" transform="translate(-274.511 -441.088)" fill="#d1d1d1"/>
|
|
339
|
+
</svg>
|
|
340
|
+
</span>
|
|
341
|
+
</div>
|
|
342
|
+
{#if showBalance}
|
|
343
|
+
<div class="BalanceModalWrapper {modalOpened ? 'Open' : ''}">
|
|
344
|
+
<div class="BalanceModalClose {modalOpened ? 'Open' : ''}" on:click={()=>menuAction('closebalance')} />
|
|
345
|
+
<div class="BalanceModal {modalOpened ? 'Open' : ''}">
|
|
346
|
+
<div class="ModalContent {modalOpened ? 'Open' : ''}">
|
|
347
|
+
<div class="BalanceModalHeader">
|
|
348
|
+
<p class="BalanceModalTitle">{$_('balanceTitle')}</p>
|
|
349
|
+
</div>
|
|
350
|
+
<div class="BalanceModalBody">
|
|
351
|
+
<div class="BalanceModalRow">
|
|
352
|
+
<p class="BalanceModalText">{$_('totalBalance')}</p>
|
|
353
|
+
<p class="BalanceModalValue">
|
|
354
|
+
<span class="BalanceModalAmount">
|
|
355
|
+
{totalBalance}
|
|
356
|
+
</span>
|
|
357
|
+
<span class="BalanceModalCurrency">
|
|
358
|
+
{currency}
|
|
359
|
+
</span>
|
|
360
|
+
</p>
|
|
361
|
+
</div>
|
|
362
|
+
{#if gmversion == 'gm16'}
|
|
363
|
+
{#if displaybalanceoption === 'Casino' || displaybalanceoption === 'Sports' }
|
|
364
|
+
<div class="BalanceModalRow">
|
|
365
|
+
<p class="BalanceModalText">{$_('cashBalance')}</p>
|
|
366
|
+
<p class="BalanceModalValue">
|
|
367
|
+
<span class="BalanceModalAmount">
|
|
368
|
+
{amounts[displaybalanceoption ? displaybalanceoption : 'Casino'].Real}
|
|
369
|
+
</span>
|
|
370
|
+
<span class="BalanceModalCurrency">
|
|
371
|
+
{currency}
|
|
372
|
+
</span>
|
|
373
|
+
</p>
|
|
374
|
+
</div>
|
|
375
|
+
<div class="BalanceModalRow">
|
|
376
|
+
<p class="BalanceModalText">{$_('bonusBalance')}</p>
|
|
377
|
+
<p class="BalanceModalValue">
|
|
378
|
+
<span class="BalanceModalAmount">
|
|
379
|
+
{amounts[displaybalanceoption ? displaybalanceoption : 'Casino'].Bonus}
|
|
380
|
+
</span>
|
|
381
|
+
<span class="BalanceModalCurrency">
|
|
382
|
+
{currency}
|
|
383
|
+
</span>
|
|
384
|
+
</p>
|
|
385
|
+
</div>
|
|
386
|
+
{:else if displaybalanceoption === 'All'}
|
|
387
|
+
<div class="BalanceModalRowBoth">
|
|
388
|
+
<div class="BalanceModalRowLine">
|
|
389
|
+
<p class="BalanceModalText">{$_('cashBalance')} Casino </p>
|
|
390
|
+
<p class="BalanceModalValue">
|
|
391
|
+
<span class="BalanceModalAmount">
|
|
392
|
+
{formatBalance(amounts.Casino.Real)}
|
|
393
|
+
</span>
|
|
394
|
+
<span class="BalanceModalCurrency">
|
|
395
|
+
{currency}
|
|
396
|
+
</span>
|
|
397
|
+
</p>
|
|
398
|
+
</div>
|
|
399
|
+
<div class="BalanceModalRowLine">
|
|
400
|
+
<p class="BalanceModalText">{$_('cashBalance')} Sports </p>
|
|
401
|
+
<p class="BalanceModalValue">
|
|
402
|
+
<span class="BalanceModalAmount">
|
|
403
|
+
{formatBalance(amounts.Sports.Real)}
|
|
404
|
+
</span>
|
|
405
|
+
<span class="BalanceModalCurrency">
|
|
406
|
+
{currency}
|
|
407
|
+
</span>
|
|
408
|
+
</p>
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
<div class="BalanceModalRowBoth">
|
|
412
|
+
<div class="BalanceModalRowLine">
|
|
413
|
+
<p class="BalanceModalText">{$_('bonusBalance')} Casino </p>
|
|
414
|
+
<p class="BalanceModalValue">
|
|
415
|
+
<span class="BalanceModalAmount">
|
|
416
|
+
{formatBalance(amounts.Casino.Bonus)}
|
|
417
|
+
</span>
|
|
418
|
+
<span class="BalanceModalCurrency">
|
|
419
|
+
{currency}
|
|
420
|
+
</span>
|
|
421
|
+
</p>
|
|
422
|
+
</div>
|
|
423
|
+
<div class="BalanceModalRowLine">
|
|
424
|
+
<p class="BalanceModalText">{$_('bonusBalance')} Sports </p>
|
|
425
|
+
<p class="BalanceModalValue">
|
|
426
|
+
<span class="BalanceModalAmount">
|
|
427
|
+
{formatBalance(amounts.Sports.Bonus)}
|
|
428
|
+
</span>
|
|
429
|
+
<span class="BalanceModalCurrency">
|
|
430
|
+
{currency}
|
|
431
|
+
</span>
|
|
432
|
+
</p>
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
{/if}
|
|
436
|
+
{:else}
|
|
437
|
+
<div class="BalanceModalRow">
|
|
438
|
+
<p class="BalanceModalText">{$_('cashBalance')}</p>
|
|
439
|
+
<p class="BalanceModalValue">
|
|
440
|
+
<span class="BalanceModalAmount">
|
|
441
|
+
{formatBalance(balanceItems[0]?.balanceAmount)}
|
|
442
|
+
</span>
|
|
443
|
+
<span class="BalanceModalCurrency">
|
|
444
|
+
{currency}
|
|
445
|
+
</span>
|
|
446
|
+
</p>
|
|
447
|
+
</div>
|
|
448
|
+
<div class="BalanceModalRow">
|
|
449
|
+
<p class="BalanceModalText">{$_('bonusBalance')}</p>
|
|
450
|
+
<p class="BalanceModalValue">
|
|
451
|
+
<span class="BalanceModalAmount">
|
|
452
|
+
{formatBalance(balanceItems[1]?.balanceAmount)}
|
|
453
|
+
</span>
|
|
454
|
+
<span class="BalanceModalCurrency">
|
|
455
|
+
{currency}
|
|
456
|
+
</span>
|
|
457
|
+
</p>
|
|
458
|
+
</div>
|
|
459
|
+
{/if}
|
|
460
|
+
</div>
|
|
461
|
+
<div class="BalanceModalFooter">
|
|
462
|
+
<button
|
|
463
|
+
class="BalanceModalAction"
|
|
464
|
+
on:click={()=>balanceModalOpenDeposit()}>
|
|
465
|
+
{$_('depositButton')}
|
|
466
|
+
</button>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
</div>
|
|
471
|
+
{/if}
|
|
472
|
+
</div>
|
|
473
|
+
{#if showBalance}
|
|
474
|
+
<div
|
|
475
|
+
class="ShowBalanceModalOverlay { modalOpened ? 'Open' : ''}"
|
|
476
|
+
on:click={()=>menuAction('closebalance')}
|
|
477
|
+
/>
|
|
478
|
+
{/if}
|
|
479
|
+
</div>
|
|
480
|
+
|
|
481
|
+
<style lang="scss">
|
|
482
|
+
*,
|
|
483
|
+
*::before,
|
|
484
|
+
*::after {
|
|
485
|
+
font-family: inherit
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
:host {
|
|
489
|
+
font-family: inherit;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
input,
|
|
493
|
+
textarea,
|
|
494
|
+
button {font-family: inherit}
|
|
495
|
+
|
|
496
|
+
p {
|
|
497
|
+
padding: 0;
|
|
498
|
+
margin: 0;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@keyframes growWidthPercent {
|
|
502
|
+
from {
|
|
503
|
+
height: 0;
|
|
504
|
+
}
|
|
505
|
+
to {
|
|
506
|
+
height: 100%;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.ShowBalance {
|
|
511
|
+
position: relative;
|
|
512
|
+
.BalanceValue {
|
|
513
|
+
font-size: 14px;
|
|
514
|
+
cursor: pointer;
|
|
515
|
+
svg {
|
|
516
|
+
width: 16px;
|
|
517
|
+
fill: black;
|
|
518
|
+
}
|
|
519
|
+
display: flex;
|
|
520
|
+
flex-wrap: nowrap;
|
|
521
|
+
white-space: nowrap;
|
|
522
|
+
|
|
523
|
+
span {
|
|
524
|
+
padding-left: 5px;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.TriangleActive, .TriangleInactive {
|
|
528
|
+
display: block;
|
|
529
|
+
margin: 0 3px;
|
|
530
|
+
transition: all .2s;
|
|
531
|
+
&:hover {
|
|
532
|
+
transform: scale(1.2);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
svg {
|
|
536
|
+
margin: 2px 0px;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.TriangleActive {
|
|
541
|
+
transform: scale(1.1) rotateX(180deg) translateY(3px);
|
|
542
|
+
|
|
543
|
+
&:hover {
|
|
544
|
+
transform: scale(1.1) rotateX(180deg) translateY(3px);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
@media only screen and (max-width: 360px) {
|
|
549
|
+
font-size: 12px;
|
|
550
|
+
svg {
|
|
551
|
+
width: 12px;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.BalanceModalWrapper {
|
|
558
|
+
background: linear-gradient(90deg, rgba(42, 79, 55, 1) 0%, rgba(0, 61, 92, 1) 100%);
|
|
559
|
+
position: absolute;
|
|
560
|
+
top: 40px;
|
|
561
|
+
padding: 10px;
|
|
562
|
+
transform: translateX(-45%);
|
|
563
|
+
box-shadow: 0px 30px 30px var(--emw-header-color-primary, var(--emw-color-primary, #D0046C));
|
|
564
|
+
border-radius: 5px;
|
|
565
|
+
z-index: 17;
|
|
566
|
+
box-shadow: 0px 5px 20px 0px #191919;
|
|
567
|
+
transition: all .2s ease-in;
|
|
568
|
+
opacity: 0;
|
|
569
|
+
&:before {
|
|
570
|
+
content: "";
|
|
571
|
+
background: linear-gradient(90deg, rgba(42, 79, 55, 1) 0%, rgba(0, 61, 92, 1) 100%);
|
|
572
|
+
clip-path: polygon(50% 0, 0% 100%, 100% 100%);
|
|
573
|
+
position: absolute;
|
|
574
|
+
top: -8px;
|
|
575
|
+
left: 50%;
|
|
576
|
+
width: 25px;
|
|
577
|
+
height: 10px;
|
|
578
|
+
z-index: 1;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
&.Open {
|
|
582
|
+
opacity: 1;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.BalanceModalClose {
|
|
587
|
+
position: absolute;
|
|
588
|
+
top: 5px;
|
|
589
|
+
right: 5px;
|
|
590
|
+
width: 20px;
|
|
591
|
+
height: 20px;
|
|
592
|
+
z-index: 1;
|
|
593
|
+
cursor: pointer;
|
|
594
|
+
transition: all .3s ease;
|
|
595
|
+
&:before {
|
|
596
|
+
content: "";
|
|
597
|
+
background: var(--emw-color-secondary, var(--emw-color-secondary, white));
|
|
598
|
+
position: absolute;
|
|
599
|
+
top: 8px;
|
|
600
|
+
left: 0;
|
|
601
|
+
width: 20px;
|
|
602
|
+
height: 2px;
|
|
603
|
+
transform: rotate(45deg);
|
|
604
|
+
}
|
|
605
|
+
&:after {
|
|
606
|
+
content: "";
|
|
607
|
+
background: var(--emw-color-secondary, var(--emw-color-secondary, white));
|
|
608
|
+
position: absolute;
|
|
609
|
+
top: 8px;
|
|
610
|
+
left: 0;
|
|
611
|
+
width: 20px;
|
|
612
|
+
height: 2px;
|
|
613
|
+
transform: rotate(-45deg);
|
|
614
|
+
}
|
|
615
|
+
opacity: 0;
|
|
616
|
+
&:hover {
|
|
617
|
+
transform: scale(1.1);
|
|
618
|
+
}
|
|
619
|
+
&.Open {
|
|
620
|
+
opacity: 1;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.BalanceModal {
|
|
625
|
+
transition: all .2s ease-in;
|
|
626
|
+
width: 270px;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.BalanceModalHeader {
|
|
630
|
+
display: flex;
|
|
631
|
+
align-items: center;
|
|
632
|
+
justify-content: center;
|
|
633
|
+
padding: 20px 0;
|
|
634
|
+
.BalanceModalTitle {
|
|
635
|
+
font-size: 16px;
|
|
636
|
+
font-weight: bold;
|
|
637
|
+
color: var(--emw-header-contrast, var(--emw-color-contrast, white));
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.BalanceModalRowBoth{
|
|
642
|
+
display: flex;
|
|
643
|
+
flex-direction: column;
|
|
644
|
+
gap: 5px;
|
|
645
|
+
padding: 20px 0;
|
|
646
|
+
border-bottom: 1px solid var(--emw-color-gray-100, #E6E6E6);
|
|
647
|
+
&:last-child {
|
|
648
|
+
border-bottom: none;
|
|
649
|
+
}
|
|
650
|
+
.BalanceModalRowLine{
|
|
651
|
+
display: flex;
|
|
652
|
+
width: 100%;
|
|
653
|
+
justify-content: space-between;
|
|
654
|
+
}
|
|
655
|
+
.BalanceModalText {
|
|
656
|
+
color: var(--emw-header-contrast, var(--emw-color-contrast, white));
|
|
657
|
+
font-size: 14px;
|
|
658
|
+
text-transform: capitalize;
|
|
659
|
+
}
|
|
660
|
+
.BalanceModalValue {
|
|
661
|
+
font-size: 14px;
|
|
662
|
+
font-weight: bold;
|
|
663
|
+
color: var(--emw-header-contrast, var(--emw-color-contrast, white));
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.BalanceModalRow {
|
|
668
|
+
display: flex;
|
|
669
|
+
justify-content: space-between;
|
|
670
|
+
align-items: center;
|
|
671
|
+
padding: 20px 0;
|
|
672
|
+
border-bottom: 1px solid var(--emw-color-gray-100, #E6E6E6);
|
|
673
|
+
&:last-child {
|
|
674
|
+
border-bottom: none;
|
|
675
|
+
}
|
|
676
|
+
.BalanceModalText {
|
|
677
|
+
color: var(--emw-header-contrast, var(--emw-color-contrast, white));
|
|
678
|
+
font-size: 14px;
|
|
679
|
+
text-transform: capitalize;
|
|
680
|
+
}
|
|
681
|
+
.BalanceModalValue {
|
|
682
|
+
font-size: 14px;
|
|
683
|
+
font-weight: bold;
|
|
684
|
+
color: var(--emw-header-contrast, var(--emw-color-contrast, white));
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
.BalanceModalFooter {
|
|
689
|
+
display: flex;
|
|
690
|
+
align-items: center;
|
|
691
|
+
padding: 20px 0 10px;
|
|
692
|
+
.BalanceModalAction {
|
|
693
|
+
background: var(--emw-color-primary);
|
|
694
|
+
font-size: 12px;
|
|
695
|
+
color: white;
|
|
696
|
+
text-transform: uppercase;
|
|
697
|
+
width: 100%;
|
|
698
|
+
border-radius: 30px;
|
|
699
|
+
border: none;
|
|
700
|
+
padding: 10px 0;
|
|
701
|
+
cursor: pointer;
|
|
702
|
+
transition: all .2s ease-in;
|
|
703
|
+
box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, .2);
|
|
704
|
+
&:hover{
|
|
705
|
+
background: rgba(255,255,255,.1);
|
|
706
|
+
color: var(--emw-color-primary);
|
|
707
|
+
box-shadow: 0px 0px 0px 2px inset var(--emw-color-primary);
|
|
708
|
+
font-size: 14px;
|
|
709
|
+
}
|
|
710
|
+
&:active {
|
|
711
|
+
background: rgba(255,255,255,.5);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.ShowBalanceModalOverlay {
|
|
717
|
+
background-color: rgba(0,0,0,0.7);
|
|
718
|
+
position: fixed;
|
|
719
|
+
top: 0;
|
|
720
|
+
bottom: 0;
|
|
721
|
+
left: 0;
|
|
722
|
+
right: 0;
|
|
723
|
+
z-index: 16;
|
|
724
|
+
opacity: 0;
|
|
725
|
+
transition: all .2s linear;
|
|
726
|
+
|
|
727
|
+
&.Open {
|
|
728
|
+
opacity: 1;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
</style>
|