@everymatrix/player-account-controller 1.36.1 → 1.37.1

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,923 +0,0 @@
1
- <svelte:options tag={null} />
2
-
3
- <script lang="ts">
4
- import { onMount, tick } from 'svelte';
5
- import { getDevice } from 'rvhelper';
6
- import { _, addNewMessages, setLocale, setupI18n } from './i18n';
7
- import { TRANSLATIONS } from './translations';
8
-
9
- import '@everymatrix/player-account-menu';
10
- import '@everymatrix/player-account-notifications';
11
- import '@everymatrix/player-account-timeout';
12
- import '@everymatrix/player-account-self-exclusion';
13
- import '@everymatrix/player-account-closure';
14
- import '@everymatrix/player-account-gaming-limits';
15
- import '@everymatrix/player-active-bonuses';
16
- import '@everymatrix/player-profile-info';
17
- import '@everymatrix/player-change-password';
18
- import '@everymatrix/player-reality-check';
19
- import '@everymatrix/player-bonus-history';
20
- import '@everymatrix/player-deposit';
21
- import '@everymatrix/player-withdrawal';
22
- import '@everymatrix/player-pending-withdrawals';
23
- import '@everymatrix/player-transaction-history';
24
- import '@everymatrix/player-gaming-history';
25
- import '@everymatrix/player-account-betting-history';
26
- import '@everymatrix/player-account-gaming-limits-wrapper-2';
27
- import '@everymatrix/player-account-biometrics';
28
-
29
- export let cmsendpoint:string = '';
30
- export let env:string = '';
31
- export let customnotifications:string = '';
32
- export let playerid:string = '';
33
- export let session:string = '';
34
- export let endpoint:string = '';
35
- export let lang:string = '';
36
- export let operator:string = 'Everymatrix';
37
- export let supportemail:string = '';
38
- export let separatelimits:string = 'true';
39
- export let hasdefaultamount:string = 'false';
40
- export let userroles:string = '';
41
- export let simplepasswordvalidation:string = 'false';
42
- export let tablabels:string = '';
43
- export let historyenabled:string = '';
44
- export let deletelimit:string = '';
45
- export let limitsamount:string = '';
46
- export let limitsperiods:string = '';
47
- export let numberofentries:string = '';
48
- export let customcurrencysymbols:string = '';
49
- export let currency:string = '';
50
- export let apiversion:string = '';
51
- export let clientstyling:string = '';
52
- export let clientstylingurl:string = '';
53
- export let translationurl:string = '';
54
- export let custominputtextswitch:string = 'false'; // used by playzonbet for switching input field texts and validation for register and player profile widgets: security question, answer, error messages and validation
55
- export let gmversion:string = '';
56
- export let producttype:string = '';
57
- export let successurl:string = '';
58
- export let failurl:string = '';
59
- export let cancelurl:string = '';
60
- export let sportsurl:string = '';
61
- export let casinourl:string = '';
62
- export let contacturl:string = '';
63
- export let homeurl:string = '';
64
- export let depositurl:string = '';
65
- export let showcashierbonus:string = '';
66
- export let biometricsenabled:string = 'false';
67
- export let activepage:string = '';
68
-
69
-
70
- setupI18n({ withLocale: 'en', translations: {}});
71
-
72
- let customStylingContainer:HTMLElement;
73
- let isLoading:boolean = false;
74
- let userAgent:string = window.navigator.userAgent;
75
- let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
76
- let menuData:any = [];
77
- let notificationsData:any = [];
78
- let userId:string = '';
79
- let sessionId:string = '';
80
- let countrycode:string = '';
81
- let playercurrency: string = null;
82
- // limits variables
83
- let deviceSegregationValue: string = '';
84
- let playerlimits: any = {};
85
- let depositlimit:any;
86
- let wageringlimit:any;
87
- let losslimit:any;
88
- let timelimit:any;
89
- let showsuccessnotification:boolean = false;
90
- let showdeletenotification:boolean = false;
91
- let realityCheckData:any;
92
- let storedRealityCheck:string = '';
93
- let errorPasswordChanged:string = '';
94
- let showErrorPasswordChanged:boolean = false;
95
- let selected:string;
96
- let ChangePasswordEvent: CustomEvent;
97
-
98
- const widgetPath = ['/profile-info',
99
- '/change-password',
100
- '/reality-check',
101
- '/timeout',
102
- '/account-closure',
103
- '/gaming-limits',
104
- '/self-exclusion',
105
- '/active-bonuses',
106
- '/bonus-history',
107
- '/gaming-history',
108
- '/deposit',
109
- '/withdrawal',
110
- '/pending-withdrawals',
111
- '/transaction-history',
112
- '/betting-history',
113
- '/limits',
114
- '/account-verification',
115
- '/cashier-deposit',
116
- '/cashier-withdrawal',
117
- '/transactions-history',
118
- '/biometrics'];
119
-
120
- const setDevice = ():void => {
121
- let device = getDevice(userAgent);
122
-
123
- if (device){
124
- if (device === 'PC'){
125
- deviceSegregationValue = 'dk';
126
- } else if (device === 'iPad' || device === 'iPhone') {
127
- deviceSegregationValue = 'mtWeb'; // replace with ios when we will have a native ios up for this
128
- } else {
129
- deviceSegregationValue = 'mtWeb';
130
- }
131
- }
132
- }
133
-
134
- const setTranslationUrl = ():void => {
135
- let url:string = translationurl;
136
-
137
- fetch(url).then((res:any) => res.json())
138
- .then((res) => {
139
- Object.keys(res).forEach((item:any):void => {
140
- addNewMessages(item, res[item]);
141
- });
142
- }).catch((err:any) => {
143
- console.log(err);
144
- });
145
- }
146
-
147
- Object.keys(TRANSLATIONS).forEach((item:any) => {
148
- addNewMessages(item, TRANSLATIONS[item]);
149
- });
150
-
151
- const messageHandler = (e:any):void => {
152
- let url:URL;
153
- if (e.data) {
154
- switch(e.data.type) {
155
- case 'AccountMenuDetails':
156
- // @TODO open after launch event is triggered from CMS menu
157
- // @TODO what is dis?
158
- break;
159
-
160
- case 'ChangeAccountPage':
161
- activepage = e.data.page.path;
162
-
163
- if(activepage == '/profile-info') {
164
- getUserProfileInfo();
165
- getUserProfileConsent();
166
- }
167
-
168
- if(activepage == '/deposit'){
169
- //Analytics event
170
- if(typeof gtag == 'function'){
171
- gtag('event', 'GoToDeposit', {
172
- 'context': 'PlayerAccountController'
173
- });
174
- }
175
- }
176
-
177
- if(activepage == '/withdrawal'){
178
- //Analytics event
179
- if(typeof gtag == 'function'){
180
- gtag('event', 'GoToWithdrawal', {
181
- 'context': 'PlayerAccountController'
182
- });
183
- }
184
- }
185
- break;
186
-
187
- case 'PlayerAccountMenuActive':
188
- case 'GoToPreviousRoute':
189
- if (e.data.isMobile) {
190
- activepage = '';
191
- initialLoad();
192
- }
193
- break;
194
-
195
- case 'UpdatePlayerInfo':
196
- let profileData = e.data.provisionalArray;
197
- let sentData = {
198
- mobile: {
199
- prefix: profileData.mobilePrefix,
200
- number: profileData.mobileNumber
201
- },
202
- address1: profileData.address,
203
- city: profileData.city,
204
- postalCode: profileData.postalCode,
205
- securityQuestion: profileData.securityQuestion,
206
- securityAnswer: profileData.securityAnswer,
207
- };
208
-
209
- url = new URL(`${endpoint}/v1/player/${userId}/profile`);
210
-
211
- let options = {
212
- method: "POST",
213
- headers: {
214
- 'X-SessionID': sessionId,
215
- 'Content-Type': "application/json",
216
- 'Accept': 'application/json',
217
- },
218
- body: JSON.stringify(sentData)
219
- };
220
-
221
- fetch(url.href, options)
222
- .then((res:any) => {
223
- if (res.status == 200) {
224
- window.postMessage({ type: 'WidgetNotification', data: {
225
- type: 'success',
226
- message: $_('profileUpdateSuccess')
227
- }}, window.location.href);
228
- window.postMessage({ type: 'ConfirmProfileInfoSave' }, window.location.href);
229
- }
230
- });
231
- break;
232
-
233
- case 'UpdatePlayerConsent':
234
- url = new URL(`${endpoint}/v1/player/${userId}/consent`);
235
-
236
- let optionsConsent = {
237
- method: "POST",
238
- headers: {
239
- 'X-SessionID': sessionId,
240
- 'Content-Type': "application/json",
241
- 'Accept': 'application/json',
242
- },
243
- body: JSON.stringify(e.data.consentArray)
244
- };
245
-
246
- fetch(url.href, optionsConsent)
247
- .then((res:any) => {
248
- if (res.status == 200) {
249
- window.postMessage({ type: 'ConfirmProfileInfoSave' }, window.location.href);
250
- }
251
- });
252
- break;
253
-
254
- case 'ChangePassword':
255
- sendChangePassword(e.data.userCurrentPassword, e.data.userNewPassword);
256
- break;
257
-
258
- case 'SetPlayerAccountTimeout':
259
- url = new URL(`/v2/player/${userId}/limits${gmversion === 'gm16' ? '/session' : ''}`, endpoint);
260
-
261
- let timeoutValue = e.data.timeoutSelected;
262
-
263
- let dataTimeout = {
264
- coolOff: {
265
- period: timeoutValue
266
- }
267
- };
268
- let setTimeout = {
269
- method: "PUT",
270
- headers: {
271
- 'X-SessionID': sessionId,
272
- 'Content-Type': "application/json",
273
- 'Accept': 'application/json',
274
- },
275
- body: JSON.stringify(dataTimeout)
276
- };
277
-
278
- fetch(url.href, setTimeout)
279
- .then((res:any) => {
280
- if (res.status == 200) {
281
- window.postMessage({ type: 'WidgetNotification', data: {
282
- type: 'success',
283
- message: $_('timeoutSuccess')
284
- }}, window.location.href);
285
- window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
286
- } else {
287
- throw new Error('Failed to fetch')
288
- }
289
- }).catch((err) => console.error(err))
290
- break;
291
-
292
- case 'SetSelfExclusion':
293
- url = new URL(`/v2/player/${userId}/limits${gmversion === 'gm16' ? '/session' : ''}`, endpoint);
294
-
295
- let selfExclusionPeriod = e.data.selfExclusionPeriod;
296
- let selfExclusionExpiryDate = e.data.selfExclusionExpiryDate;
297
-
298
- let dataSelfExclusion = {
299
- selfExclusion: {
300
- period: selfExclusionPeriod,
301
- expiryDate: selfExclusionExpiryDate,
302
- selfExclusionReason: 'UserRequest',
303
- }
304
- };
305
- let setSelfExclusion = {
306
- method: "PUT",
307
- headers: {
308
- 'X-SessionID': sessionId,
309
- 'Content-Type': "application/json",
310
- 'Accept': 'application/json',
311
- },
312
- body: JSON.stringify(dataSelfExclusion)
313
- };
314
-
315
- fetch(url.href, setSelfExclusion)
316
- .then((res:any):void => {
317
- if (res.status == 200) {
318
- window.postMessage({ type: 'WidgetNotification', data: {
319
- type: 'success',
320
- message: $_('selfExclusionSuccess')
321
- }}, window.location.href);
322
- window.postMessage({ type: 'LogoutSuccessfull'}, window.location.href);
323
- } else {
324
- // ERROR
325
- }
326
- });
327
- break;
328
-
329
- case 'AccountClosure':
330
- url = new URL(`/v2/player/${userId}/limits${gmversion === 'gm16' ? '/session' : ''}`, endpoint)
331
-
332
- let accountClosureData = 'UserRequest';
333
- let accountClosureSelection = {
334
- selfExclusion: {
335
- period: "SelfExclusionPermanent",
336
- sendNotificationEmail: true,
337
- selfExclusionReason: accountClosureData
338
- }
339
- };
340
-
341
- let optionsAccountClosure = {
342
- method: "PUT",
343
- headers: {
344
- 'X-SessionID': sessionId,
345
- 'Content-Type': "application/json",
346
- 'Accept': 'application/json',
347
- },
348
- body: JSON.stringify(accountClosureSelection)
349
- };
350
-
351
- fetch(url.href, optionsAccountClosure)
352
- .then((res:any):void => {
353
- if (res.status == 200) {
354
- window.postMessage({ type: 'WidgetNotification', data: {
355
- type: 'success',
356
- message: $_('accountClosureSuccess')
357
- }}, window.location.href);
358
- window.postMessage({ type: 'LogoutSuccessfull'}, window.location.href);
359
- } else {
360
- // ERROR
361
- }
362
- });
363
- break;
364
-
365
- case 'UserSessionID':
366
- sessionId = e.data.session;
367
- userId = e.data.userid;
368
-
369
- getData();
370
- break;
371
-
372
- case 'PlayerAccountGamingLimitsUpdate':
373
- url = new URL(`/v2/player/${userId}/limits`, endpoint);
374
-
375
- let limitsData = e.data.payload;
376
- let optionsEditLimits = {
377
- method: "PUT",
378
- headers: {
379
- 'X-SessionID': sessionId,
380
- 'Content-Type': "application/json",
381
- 'Accept': 'application/json',
382
- },
383
- body: JSON.stringify(limitsData)
384
- };
385
-
386
- fetch(url.href, optionsEditLimits)
387
- .then((res:any):void => {
388
- if (res.status == 200) {
389
- showsuccessnotification = true;
390
-
391
- window.postMessage({ type: 'WidgetNotification', data: {
392
- type: 'success',
393
- message: $_('limitsUpdateSuccess')
394
- }}, window.location.href);
395
- getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
396
- } else {
397
- // ERROR
398
- }
399
- });
400
- break;
401
-
402
- case 'PlayerAccountGamingLimitDelete':
403
- let limitsDeleteData:any = e.data.limit ? e.data.limit : {};
404
- let deletedPeriodLimit:any;
405
-
406
- if (Array.isArray(limitsDeleteData)) {
407
- deletedPeriodLimit = limitsDeleteData.map((item) => item.period);
408
- } else {
409
- deletedPeriodLimit = limitsDeleteData.period;
410
- }
411
- let limitsCategoryTitle = e.data.name;
412
- let limitName:string = '';
413
-
414
- switch (limitsCategoryTitle) {
415
- case 'depositLimits':
416
- limitName = 'deposit';
417
- break;
418
-
419
- case 'cumulativeSessionLimits':
420
- limitName = 'cumulativeSession';
421
- break;
422
-
423
- case 'wageringLimit':
424
- limitName = 'wagering';
425
- break;
426
-
427
- case 'lossLimit':
428
- limitName = 'loss';
429
- break;
430
- }
431
-
432
- let deleteOptions = {
433
- method: "DELETE",
434
- headers: {
435
- 'X-SessionID': sessionId,
436
- },
437
- body: JSON.stringify(limitsDeleteData)
438
- };
439
-
440
- url = new URL(`/v2/player/${userId}/limits/${limitName}`, endpoint)
441
-
442
- //if single limit send string
443
- if (Array.isArray(deletedPeriodLimit)) {
444
- deletedPeriodLimit.forEach((item) => {
445
- url.searchParams.append('periods', item);
446
- });
447
- } else {
448
- url.searchParams.append('periods', deletedPeriodLimit);
449
- }
450
-
451
- fetch(url.href, deleteOptions)
452
- .then((res:any):void => {
453
- if (res.status == 200) {
454
- showdeletenotification = true;
455
- window.postMessage({ type: 'WidgetNotification', data: {
456
- type: 'success',
457
- message: $_('limitsDeleteSuccess')
458
- }}, window.location.href);
459
- } else {
460
- // ERROR
461
- }
462
- }).then((res:any):void => {
463
- getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
464
- });
465
-
466
-
467
- break;
468
-
469
- case 'GamingLimitsConfirmChanges':
470
- getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
471
- break;
472
-
473
- case 'CancelGamingLimitsChanges':
474
- getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
475
- break;
476
-
477
- case 'SubmittedRealityCheck':
478
- setRealityCheckValue(e.data.realityCheckUpdatedValue);
479
- break;
480
- }
481
- }
482
- }
483
-
484
- async function getAccountMenuDetails(url:URL) {
485
- url.searchParams.append('device', deviceSegregationValue)
486
- const response = await fetch(url.href);
487
- const dataMenuItems = await response.json();
488
- return dataMenuItems;
489
- }
490
-
491
- const getNotificationsDetails = (url:URL):void => {
492
-
493
- url.searchParams.append('userRoles', userroles);
494
- url.searchParams.append('device', deviceSegregationValue)
495
-
496
- fetch(url.href)
497
- .then((res:any) => res.json())
498
- .then((data:any):void => {
499
- if(data.length) {
500
- notificationsData = data[0].children;
501
- window.postMessage({ type: 'NotificationsDetails', notificationsInfo: notificationsData }, window.location.href);
502
- }
503
- }, (err:any):void => {
504
- console.error(err);
505
- });
506
- }
507
-
508
- const getUserProfileInfo = ():void => {
509
- let url:URL = new URL(`${endpoint}/v1/player/${userId}/profile`);
510
- let options = {
511
- method: "GET",
512
- headers: {
513
- 'X-SessionID': sessionId,
514
- }
515
- };
516
-
517
- fetch(url.href, options)
518
- .then((res:any) => { return res.json(); })
519
- .then((data:any) => {
520
- countrycode = data.country;
521
- playercurrency = data.currency;
522
-
523
- window.postMessage({ type: 'ProfileDetailsData', profileDetails: data }, window.location.href);
524
- }, (err:any) => {
525
- console.error(err);
526
- });
527
- }
528
-
529
- const getUserProfileConsent = ():void => {
530
- let url:URL = new URL(`${endpoint}/v1/player/${userId}/consent`);
531
- let options = {
532
- method: "GET",
533
- headers: {
534
- 'X-SessionID': sessionId,
535
- }
536
- };
537
-
538
- fetch(url.href, options)
539
- .then((res:any) => { return res.json(); })
540
- .then((data:any) => {
541
- window.postMessage({ type: 'ProfileConsentData', consent: data }, window.location.href);
542
- }, (err:any) => {
543
- console.error(err);
544
- });
545
- }
546
-
547
- const sendChangePassword = async (playerCurrentPassword:string, playerNewPassword:string) => {
548
- let url:URL = new URL(`${endpoint}/v1/player/${userId}/password`)
549
- let data = {
550
- currentPassword: playerCurrentPassword,
551
- newPassword: playerNewPassword
552
- };
553
- let optionsChangePassword = {
554
- method: "POST",
555
- headers: {
556
- 'X-SessionID': sessionId,
557
- 'Content-Type': "application/json",
558
- 'Accept': 'application/json',
559
- },
560
- body: JSON.stringify(data)
561
- };
562
-
563
- let response:any = await fetch(url.href, optionsChangePassword);
564
-
565
- if (response.ok) {
566
- window.postMessage({ type: 'PasswordChangedSuccessfully' }, window.location.href);
567
- window.postMessage({ type: 'WidgetNotification', data: {
568
- type: 'success',
569
- message: $_('passwordChangedSuccess')
570
- }}, window.location.href);
571
-
572
- ChangePasswordEvent = new CustomEvent('ChangePassword', { detail: { userPassword: data.newPassword }});
573
- window.dispatchEvent(ChangePasswordEvent);
574
-
575
- } else {
576
- let dataResponse:any = await response.json();
577
- // Parsing GMCore message 'cuz it's stupid and it doesn't know how to send error messages in 2021 ffs
578
- errorPasswordChanged = dataResponse.error.substring(dataResponse.error.indexOf('errorMessage') + 13, dataResponse.error.length);
579
- showErrorPasswordChanged = true;
580
- window.postMessage({ type: "ShowPasswordChangedError", showErrorPasswordChanged, errorPasswordChanged }, window.location.href);
581
- window.postMessage({ type: 'WidgetNotification', data: {
582
- type: 'error',
583
- message: errorPasswordChanged
584
- }}, window.location.href);
585
- }
586
- }
587
-
588
- const getRealityCheckData = (url:URL):void => {
589
- let options = {
590
- method: 'GET',
591
- headers: {
592
- 'X-SessionID': sessionId,
593
- }
594
- }
595
- fetch(url.href, options)
596
- .then((res:any) => { return res.json(); })
597
- .then((data:any) => {
598
- realityCheckData = data.UserRealityCheckValue;
599
- }, (err:any) => {
600
- console.error(err);
601
- });
602
- }
603
-
604
- const setRealityCheckValue = (updatedData:string):void => {
605
- let url:URL = new URL(`${endpoint}/v1/player/${userId}/realitycheck`);
606
-
607
- if (updatedData) {
608
- storedRealityCheck = updatedData;
609
- }
610
-
611
- let optionsRealityCheck = {
612
- method: "POST",
613
- headers: {
614
- 'X-SessionID': sessionId,
615
- 'Content-Type': "application/json",
616
- 'Accept': 'application/json',
617
- 'realityCheckValue': parseInt(storedRealityCheck, 10)
618
- }
619
- };
620
-
621
- fetch(url.href, optionsRealityCheck)
622
- .then((res:any) => {
623
- if (res.status == 200) {
624
- getRealityCheckData(new URL(`${endpoint}/v1/player/${playerid}/realitycheck`));
625
- window.postMessage({ type: 'RealityCheckValueUpdated' }, window.location.href);
626
- window.postMessage({ type: 'WidgetNotification', data: {
627
- type: 'success',
628
- message: $_('realityCheckSuccess')
629
- }}, window.location.href);
630
- }
631
- }, (err:any) => {
632
- console.error(err);
633
- });
634
- }
635
-
636
- const getGamingLimits = (url:URL):void => {
637
- if (showsuccessnotification === true) {
638
- setTimeout(() => {showsuccessnotification = false; }, 3000);
639
- } else if(showdeletenotification === true) {
640
- setTimeout(() => {showdeletenotification = false; }, 3000);
641
- }
642
-
643
- let options = {
644
- method: "GET",
645
- headers: {
646
- 'X-SessionID': sessionId,
647
- }
648
- };
649
-
650
- fetch(url.href, options)
651
- .then((res:any) => res.json())
652
- .then((data:any):void => {
653
- playerlimits = data;
654
- // add name property for info boxes
655
- if (Object.keys(playerlimits).length !== 0) {
656
- depositlimit = playerlimits.depositLimits ?? [];
657
- wageringlimit = playerlimits.wageringLimits ?? [];
658
- losslimit = playerlimits.lossLimits ?? [];
659
-
660
- if (playerlimits.hasOwnProperty('cumulativeSessionLimits')) {
661
- timelimit = playerlimits.timeLimit;
662
- timelimit = playerlimits.cumulativeSessionLimits.map((item) => {
663
- item.amount = item.minutes;
664
- return item;
665
- });
666
- } else {
667
- timelimit = [];
668
- }
669
-
670
- window.postMessage({ type: 'PlayerLimitsData', limits: {
671
- playercurrency,
672
- depositlimit,
673
- wageringlimit,
674
- losslimit,
675
- timelimit,
676
- showsuccessnotification,
677
- showdeletenotification,
678
- lang,
679
- }}, window.location.href);
680
-
681
- } else {
682
- depositlimit = [];
683
- wageringlimit = [];
684
- losslimit = [];
685
- timelimit = [];
686
- }
687
-
688
- tick();
689
- }, (err:any) => {
690
- console.error(err);
691
- });
692
- }
693
-
694
- const findPageId = ():void => {
695
- menuData.forEach(element => {
696
- if (element.path.includes(activepage)) {
697
- selected = element.id;
698
- }
699
- })
700
- }
701
-
702
- const getData = ():void => {
703
- getAccountMenuDetails(new URL(`${cmsendpoint}/${lang}/profile-menu?env=${env}`))
704
- .then((data:any):void => {
705
- menuData = data;
706
- findPageId();
707
- window.postMessage({ type: 'AccountMenuDetails', accountMenuInfo: menuData }, window.location.href);
708
- });
709
-
710
- getNotificationsDetails(new URL(`${cmsendpoint}/${lang}/support-information?env=${env}`));
711
- getUserProfileInfo();
712
- getUserProfileConsent();
713
- getRealityCheckData(new URL(`${endpoint}/v1/player/${playerid}/realitycheck`));
714
- }
715
-
716
- const setActiveLanguage = ():void => {
717
- setLocale(lang);
718
- }
719
-
720
- const sendLimitsData = (e:any):void => {
721
- getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
722
- }
723
-
724
- const initialLoad = ():void => {
725
- setDevice()
726
- userId = playerid;
727
- sessionId = session;
728
- getData();
729
- }
730
-
731
- const setClientStyling = ():void => {
732
- let sheet = document.createElement('style');
733
- sheet.innerHTML = clientstyling;
734
- customStylingContainer.appendChild(sheet);
735
- }
736
-
737
- const setClientStylingURL = ():void => {
738
- let url:URL = new URL(clientstylingurl);
739
- let cssFile:HTMLElement = document.createElement('style');
740
-
741
- fetch(url.href)
742
- .then((res:any) => res.text())
743
- .then((data:any) => {
744
- cssFile.innerHTML = data
745
-
746
- setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
747
- });
748
- }
749
-
750
- onMount(() => {
751
- window.addEventListener('message', messageHandler, false);
752
-
753
- return () => {
754
- window.removeEventListener('message', messageHandler);
755
- }
756
- });
757
-
758
- $: lang && setActiveLanguage();
759
- $: cmsendpoint && endpoint && customnotifications && playerid && session && lang && env && userroles && initialLoad();
760
- $: depositlimit && wageringlimit && losslimit && timelimit;
761
- $: clientstyling && customStylingContainer && setClientStyling();
762
- $: clientstylingurl && customStylingContainer && setClientStylingURL();
763
- $: translationurl && setTranslationUrl();
764
- </script>
765
-
766
- <svelte:head>
767
- <script type="module" src="https://unpkg.com/@everymatrix/user-deposit-withdrawal"></script>
768
- <script type="module" src="https://unpkg.com/@everymatrix/player-kyc-verification"></script>
769
- <script type="module" src="https://unpkg.com/@everymatrix/user-transaction-history"></script>
770
- </svelte:head>
771
-
772
- <div bind:this={customStylingContainer}>
773
-
774
- {#if isLoading}
775
- <div class="ModalLoader"></div>
776
- {:else}
777
- <section class="PlayerAccountPage {isMobile ? 'PlayerAccountMobilePage' : ''}">
778
- {#if isMobile}
779
- {#if !activepage}
780
- <nav class="PlayerAccountMobile">
781
- <player-account-menu {endpoint} {session} {playerid} {lang} {userroles} {clientstyling} {clientstylingurl}></player-account-menu>
782
- <player-account-notifications customnotif={customnotifications} {clientstyling} {clientstylingurl}></player-account-notifications>
783
- </nav>
784
- {:else}
785
- {#if activepage === widgetPath[0]}
786
- <player-profile-info {endpoint} {lang} {countrycode} {clientstyling} {clientstylingurl} {custominputtextswitch}></player-profile-info>
787
- {:else if activepage === widgetPath[1]}
788
- <player-change-password {simplepasswordvalidation} {lang} {clientstyling} {clientstylingurl}></player-change-password>
789
- {:else if activepage === widgetPath[2]}
790
- <player-reality-check realitycheck={realityCheckData} {endpoint} {playerid} {session} {lang} {clientstyling} {clientstylingurl}></player-reality-check>
791
- {:else if activepage === widgetPath[3]}
792
- <player-account-timeout {lang} {operator} {supportemail} {clientstyling} {clientstylingurl}></player-account-timeout>
793
- {:else if activepage === widgetPath[4]}
794
- <player-account-closure {lang} {clientstyling} {clientstylingurl}></player-account-closure>
795
- {:else if activepage === widgetPath[5]}
796
- <player-account-gaming-limits use:sendLimitsData {playercurrency} {separatelimits} {clientstyling} {clientstylingurl}></player-account-gaming-limits>
797
- {:else if activepage === widgetPath[6]}
798
- <player-account-self-exclusion {lang} {operator} {supportemail} {clientstyling} {clientstylingurl}></player-account-self-exclusion>
799
- {:else if activepage === widgetPath[7]}
800
- <player-active-bonuses {endpoint} {session} {playerid} {lang} {playercurrency} {clientstyling} {clientstylingurl}></player-active-bonuses>
801
- {:else if activepage === widgetPath[8]}
802
- <player-bonus-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-bonus-history>
803
- {:else if activepage === widgetPath[9]}
804
- <player-gaming-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl} {gmversion}></player-gaming-history>
805
- {:else if activepage === widgetPath[10]}
806
- <player-deposit {endpoint} {session} {playerid} {lang} {hasdefaultamount} {clientstyling} {clientstylingurl} {playercurrency}></player-deposit>
807
- {:else if activepage === widgetPath[11]}
808
- <player-withdrawal {endpoint} {session} {playerid} {lang} {hasdefaultamount} {clientstyling} {clientstylingurl} {playercurrency}></player-withdrawal>
809
- {:else if activepage === widgetPath[12]}
810
- <player-pending-withdrawals {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-pending-withdrawals>
811
- {:else if activepage === widgetPath[13]}
812
- <player-transaction-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-transaction-history>
813
- {:else if activepage === widgetPath[14]}
814
- <player-account-betting-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-account-betting-history>
815
- {:else if activepage === widgetPath[15]}
816
- <player-account-gaming-limits-wrapper-2 {endpoint} userid={playerid} {session} {lang} {tablabels} {historyenabled} {deletelimit} {limitsamount} {limitsperiods} {numberofentries} {customcurrencysymbols} {currency} {apiversion} {translationurl} {clientstyling} {clientstylingurl}></player-account-gaming-limits-wrapper-2>
817
- {:else if activepage === widgetPath[16]}
818
- <player-kyc-verification {endpoint} {session} user-id={playerid} language={lang} translation-url={translationurl} client-styling={clientstyling} client-styling-url={clientstylingurl}></player-kyc-verification>
819
- {:else if activepage === widgetPath[17] }
820
- <user-deposit-withdrawal {endpoint} type="deposit" channel="Mobile" language={lang} {currency} show-bonus-selection-input={showcashierbonus} product-type={producttype} user-id={playerid} {session} success-url={'https://' + window.location.hostname + '/' + lang + successurl} cancel-url={'https://' + window.location.hostname + '/' + lang + cancelurl} fail-url={'https://' + window.location.hostname + '/' + lang + failurl} sports-url={'https://' + window.location.hostname + '/' + lang + sportsurl} casino-url={'https://' + window.location.hostname + '/' + lang + casinourl} contact-url={'https://' + window.location.hostname + '/' + lang + contacturl} home-url={'https://' + window.location.hostname + '/' + lang + homeurl} deposit-url={'https://' + window.location.hostname + '/' + lang + depositurl} ></user-deposit-withdrawal>
821
- {:else if activepage === widgetPath[18] }
822
- <user-deposit-withdrawal {endpoint} type="withdraw" channel="Mobile" language={lang} {currency} show-bonus-selection-input={showcashierbonus} product-type={producttype} user-id={playerid} {session} success-url={'https://' + window.location.hostname + '/' + lang + successurl} cancel-url={'https://' + window.location.hostname + '/' + lang + cancelurl} fail-url={'https://' + window.location.hostname + '/' + lang + failurl} sports-url={'https://' + window.location.hostname + '/' + lang + sportsurl} casino-url={'https://' + window.location.hostname + '/' + lang + casinourl} contact-url={'https://' + window.location.hostname + '/' + lang + contacturl} home-url={'https://' + window.location.hostname + '/' + lang + homeurl} deposit-url={'https://' + window.location.hostname + '/' + lang + depositurl}></user-deposit-withdrawal>
823
- {:else if activepage === widgetPath[19] }
824
- <user-transaction-history endpoint={endpoint} user-id={playerid} session={session} mobile={isMobile} translation-url={translationurl} language={lang}></user-transaction-history>
825
- {:else if activepage === widgetPath[20] }
826
- <player-account-biometrics {biometricsenabled} {lang} {clientstyling} {clientstylingurl} {translationurl}></player-account-biometrics>
827
- {/if}
828
- {/if}
829
- {:else}
830
- <nav>
831
- <player-account-menu {endpoint} {session} {playerid} {lang} selecteditem={selected} {userroles} {clientstyling} {clientstylingurl}></player-account-menu>
832
- </nav>
833
- <main>
834
- {#if activepage === widgetPath[0]}
835
- <player-profile-info {endpoint} {lang} {countrycode} {clientstyling} {clientstylingurl} {custominputtextswitch}></player-profile-info>
836
- {:else if activepage === widgetPath[1]}
837
- <player-change-password {simplepasswordvalidation}{lang} {clientstyling} {clientstylingurl}></player-change-password>
838
- {:else if activepage === widgetPath[2]}
839
- <player-reality-check realitycheck={realityCheckData} {endpoint} {playerid} {session} {lang} {clientstyling} {clientstylingurl}></player-reality-check>
840
- {:else if activepage === widgetPath[3]}
841
- <player-account-timeout {lang} {operator} {supportemail} {clientstyling} {clientstylingurl}></player-account-timeout>
842
- {:else if activepage === widgetPath[4]}
843
- <player-account-closure {lang} {clientstyling} {clientstylingurl}></player-account-closure>
844
- {:else if activepage == widgetPath[5]}
845
- <player-account-gaming-limits use:sendLimitsData {playercurrency} {separatelimits} {clientstyling} {clientstylingurl}></player-account-gaming-limits>
846
- {:else if activepage === widgetPath[6]}
847
- <player-account-self-exclusion {lang} {operator} {supportemail} {clientstyling} {clientstylingurl}></player-account-self-exclusion>
848
- {:else if activepage === widgetPath[7]}
849
- <player-active-bonuses {endpoint} {session} {playerid} {lang} {playercurrency} {clientstyling} {clientstylingurl}></player-active-bonuses>
850
- {:else if activepage === widgetPath[8]}
851
- <player-bonus-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-bonus-history>
852
- {:else if activepage === widgetPath[9]}
853
- <player-gaming-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl} {gmversion}></player-gaming-history>
854
- {:else if activepage === widgetPath[10]}
855
- <player-deposit {endpoint} {session} {playerid} {lang} {hasdefaultamount} {clientstyling} {clientstylingurl} {playercurrency}></player-deposit>
856
- {:else if activepage === widgetPath[11]}
857
- <player-withdrawal {endpoint} {session} {playerid} {lang} {hasdefaultamount} {clientstyling} {clientstylingurl} {playercurrency}></player-withdrawal>
858
- {:else if activepage === widgetPath[12]}
859
- <player-pending-withdrawals {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-pending-withdrawals>
860
- {:else if activepage === widgetPath[13]}
861
- <player-transaction-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-transaction-history>
862
- {:else if activepage === widgetPath[14]}
863
- <player-account-betting-history {endpoint} {session} {playerid} {lang} {clientstyling} {clientstylingurl}></player-account-betting-history>
864
- {:else if activepage === widgetPath[15]}
865
- <player-account-gaming-limits-wrapper-2 {endpoint} userid={playerid} {session} {tablabels} {lang} {historyenabled} {deletelimit} {limitsamount} {limitsperiods} {numberofentries} {customcurrencysymbols} {currency} {apiversion} {translationurl} {clientstyling} {clientstylingurl}></player-account-gaming-limits-wrapper-2>
866
- {:else if activepage === widgetPath[16]}
867
- <player-kyc-verification {endpoint} {session} user-id={playerid} language={lang} translation-url={translationurl} client-styling={clientstyling} client-styling-url={clientstylingurl}></player-kyc-verification>
868
- {:else if activepage === widgetPath[17] }
869
- <user-deposit-withdrawal endpoint={endpoint} type="deposit" channel="Desktop" language={lang} {currency} show-bonus-selection-input={showcashierbonus} product-type={producttype} user-id={playerid} {session} success-url={'https://' + window.location.hostname + '/' + lang + successurl} cancel-url={'https://' + window.location.hostname + '/' + lang + cancelurl} fail-url={'https://' + window.location.hostname + '/' + lang + failurl} sports-url={'https://' + window.location.hostname + '/' + lang + sportsurl} casino-url={'https://' + window.location.hostname + '/' + lang + casinourl} contact-url={'https://' + window.location.hostname + '/' + lang + contacturl} home-url={'https://' + window.location.hostname + '/' + lang + homeurl} deposit-url={'https://' + window.location.hostname + '/' + lang + depositurl}></user-deposit-withdrawal>
870
- {:else if activepage === widgetPath[18] }
871
- <user-deposit-withdrawal endpoint={endpoint} type="withdraw" channel="Desktop" language={lang} {currency} show-bonus-selection-input={showcashierbonus} product-type={producttype} user-id={playerid} {session} success-url={'https://' + window.location.hostname + '/' + lang + successurl} cancel-url={'https://' + window.location.hostname + '/' + lang + cancelurl} fail-url={'https://' + window.location.hostname + '/' + lang + failurl} sports-url={'https://' + window.location.hostname + '/' + lang + sportsurl} casino-url={'https://' + window.location.hostname + '/' + lang + casinourl} contact-url={'https://' + window.location.hostname + '/' + lang + contacturl} home-url={'https://' + window.location.hostname + '/' + lang + homeurl} deposit-url={'https://' + window.location.hostname + '/' + lang + depositurl}></user-deposit-withdrawal>
872
- {:else if activepage === widgetPath[19] }
873
- <user-transaction-history endpoint={endpoint} user-id={playerid} session={session} mobile={isMobile} translation-url={translationurl} language={lang}></user-transaction-history>
874
- {/if}
875
- </main>
876
- <aside>
877
- <player-account-notifications customnotif={customnotifications} {clientstyling} {clientstylingurl}></player-account-notifications>
878
- </aside>
879
- {/if}
880
- </section>
881
- {/if}
882
- </div>
883
-
884
- <style lang="scss">
885
-
886
-
887
-
888
- *, *::before, *::after, body {
889
- margin: 0;
890
- padding: 0;
891
- box-sizing: border-box;
892
- }
893
-
894
- .PlayerAccountPage {
895
- display: grid;
896
- width: 100%;
897
- grid-template-areas: "nav main aside";
898
- grid-template-rows: auto;
899
- grid-template-columns: 250px 1fr 230px;
900
- background: var(--emfe-w-pam-color-bg, var(--emfe-w-color-gray-50, #F9F8F8));
901
- padding-right: 30px;
902
- &.PlayerAccountMobilePage {
903
- display: block;
904
- background: var(--emfe-w-pam-color-bg, var(--emfe-w-color-gray-50, #F9F8F8));
905
- padding-right: 0px;
906
- }
907
- }
908
- .PlayerAccountPage > nav {
909
- grid-area: nav;
910
- color:red;
911
- background: var(--emfe-w-pam-color-nav-desktop-bg, var(--emfe-w-color-gray-300, #58586B));
912
- &.PlayerAccountMobile {
913
- background: var(--emfe-w-pam-color-nav-mobile-bg, var(--emfe-w-color-background, #07072A));
914
- color: var(--emfe-w-pam-typography-color-nav-bg, var(--emfe-w-color-contrast, #FFFFFF));
915
- }
916
- }
917
- .PlayerAccountPage > main {
918
- grid-area: main;
919
- }
920
- .PlayerAccountPage > aside {
921
- grid-area: aside;
922
- }
923
- </style>