@everymatrix/player-account-controller 1.0.16 → 1.0.69

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