@everymatrix/player-account-controller 1.43.2 → 1.43.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-controller",
3
- "version": "1.43.2",
3
+ "version": "1.43.3",
4
4
  "main": "dist/player-account-controller.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "0477411e57fe6c3eda8ff28059aa540dcada8ae0"
38
+ "gitHead": "4723f5370b2d6fc913a8cf6770f9f492038e54e8"
39
39
  }
@@ -74,14 +74,11 @@
74
74
  let isLoading:boolean = false;
75
75
  let userAgent:string = window.navigator.userAgent;
76
76
  let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
77
- let menuData:any = [];
78
- let notificationsData:any = [];
79
77
  let userId:string = '';
80
78
  let sessionId:string = '';
81
79
  let countrycode:string = '';
82
80
  let playercurrency: string = null;
83
81
  // limits variables
84
- let deviceSegregationValue: string = '';
85
82
  let playerlimits: any = {};
86
83
  let depositlimit:any;
87
84
  let wageringlimit:any;
@@ -89,8 +86,6 @@
89
86
  let timelimit:any;
90
87
  let showsuccessnotification:boolean = false;
91
88
  let showdeletenotification:boolean = false;
92
- let realityCheckData:any;
93
- let storedRealityCheck:string = '';
94
89
  let errorPasswordChanged:string = '';
95
90
  let showErrorPasswordChanged:boolean = false;
96
91
  let selected:string;
@@ -120,29 +115,12 @@
120
115
  '/biometrics'];
121
116
 
122
117
  const initialLoad = ():void => {
123
- setDevice();
124
-
125
118
  userId = playerid;
126
119
  sessionId = session;
127
-
128
- getData(); //For now we will let it here until we move all the datas to other widgets
120
+ getUserProfileInfo();
129
121
  setActivePage();
130
122
  }
131
123
 
132
- const setDevice = ():void => {
133
- let device = getDevice(userAgent);
134
-
135
- if (device){
136
- if (device === 'PC'){
137
- deviceSegregationValue = 'dk';
138
- } else if (device === 'iPad' || device === 'iPhone') {
139
- deviceSegregationValue = 'mtWeb'; // replace with ios when we will have a native ios up for this
140
- } else {
141
- deviceSegregationValue = 'mtWeb';
142
- }
143
- }
144
- }
145
-
146
124
  const setActivePage = ():void => {
147
125
  if(!activepage && !isMobile) { activepage = widgetPath[0]; }
148
126
 
@@ -178,12 +156,7 @@
178
156
 
179
157
  case 'ChangeAccountPage':
180
158
  activepage = e.data.page.path;
181
-
182
- if(activepage == '/profile-info') {
183
- getUserProfileInfo();
184
- getUserProfileConsent();
185
- }
186
-
159
+
187
160
  if(activepage == '/deposit'){
188
161
  //Analytics event
189
162
  if(typeof gtag == 'function'){
@@ -212,65 +185,6 @@
212
185
  }
213
186
  break;
214
187
 
215
- case 'UpdatePlayerInfo':
216
- let profileData = e.data.provisionalArray;
217
- let sentData = {
218
- mobile: {
219
- prefix: profileData.mobilePrefix,
220
- number: profileData.mobileNumber
221
- },
222
- address1: profileData.address,
223
- city: profileData.city,
224
- postalCode: profileData.postalCode,
225
- securityQuestion: profileData.securityQuestion,
226
- securityAnswer: profileData.securityAnswer,
227
- };
228
-
229
- url = new URL(`${endpoint}/v1/player/${userId}/profile`);
230
-
231
- let options = {
232
- method: "POST",
233
- headers: {
234
- 'X-SessionID': sessionId,
235
- 'Content-Type': "application/json",
236
- 'Accept': 'application/json',
237
- },
238
- body: JSON.stringify(sentData)
239
- };
240
-
241
- fetch(url.href, options)
242
- .then((res:any) => {
243
- if (res.status == 200) {
244
- window.postMessage({ type: 'WidgetNotification', data: {
245
- type: 'success',
246
- message: $_('profileUpdateSuccess')
247
- }}, window.location.href);
248
- window.postMessage({ type: 'ConfirmProfileInfoSave' }, window.location.href);
249
- }
250
- });
251
- break;
252
-
253
- case 'UpdatePlayerConsent':
254
- url = new URL(`${endpoint}/v1/player/${userId}/consent`);
255
-
256
- let optionsConsent = {
257
- method: "POST",
258
- headers: {
259
- 'X-SessionID': sessionId,
260
- 'Content-Type': "application/json",
261
- 'Accept': 'application/json',
262
- },
263
- body: JSON.stringify(e.data.consentArray)
264
- };
265
-
266
- fetch(url.href, optionsConsent)
267
- .then((res:any) => {
268
- if (res.status == 200) {
269
- window.postMessage({ type: 'ConfirmProfileInfoSave' }, window.location.href);
270
- }
271
- });
272
- break;
273
-
274
188
  case 'ChangePassword':
275
189
  sendChangePassword(e.data.userCurrentPassword, e.data.userNewPassword);
276
190
  break;
@@ -385,7 +299,8 @@
385
299
  case 'UserSessionID':
386
300
  sessionId = e.data.session;
387
301
  userId = e.data.userid;
388
- getData();
302
+ getUserProfileInfo();
303
+
389
304
  break;
390
305
 
391
306
  case 'PlayerAccountGamingLimitsUpdate':
@@ -492,31 +407,10 @@
492
407
  case 'CancelGamingLimitsChanges':
493
408
  getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
494
409
  break;
495
-
496
- case 'SubmittedRealityCheck':
497
- setRealityCheckValue(e.data.realityCheckUpdatedValue);
498
- break;
499
410
  }
500
411
  }
501
412
  }
502
413
 
503
- const getNotificationsDetails = (url:URL):void => {
504
-
505
- url.searchParams.append('userRoles', userroles);
506
- url.searchParams.append('device', deviceSegregationValue)
507
-
508
- fetch(url.href)
509
- .then((res:any) => res.json())
510
- .then((data:any):void => {
511
- if(data.length) {
512
- notificationsData = data[0].children;
513
- window.postMessage({ type: 'NotificationsDetails', notificationsInfo: notificationsData }, window.location.href);
514
- }
515
- }, (err:any):void => {
516
- console.error(err);
517
- });
518
- }
519
-
520
414
  const getUserProfileInfo = ():void => {
521
415
  let url:URL = new URL(`${endpoint}/v1/player/${userId}/profile`);
522
416
  let options = {
@@ -538,24 +432,6 @@
538
432
  });
539
433
  }
540
434
 
541
- const getUserProfileConsent = ():void => {
542
- let url:URL = new URL(`${endpoint}/v1/player/${userId}/consent`);
543
- let options = {
544
- method: "GET",
545
- headers: {
546
- 'X-SessionID': sessionId,
547
- }
548
- };
549
-
550
- fetch(url.href, options)
551
- .then((res:any) => { return res.json(); })
552
- .then((data:any) => {
553
- window.postMessage({ type: 'ProfileConsentData', consent: data }, window.location.href);
554
- }, (err:any) => {
555
- console.error(err);
556
- });
557
- }
558
-
559
435
  const sendChangePassword = async (playerCurrentPassword:string, playerNewPassword:string) => {
560
436
  let url:URL = new URL(`${endpoint}/v1/player/${userId}/password`)
561
437
  let data = {
@@ -587,6 +463,7 @@
587
463
  } else {
588
464
  let dataResponse:any = await response.json();
589
465
  // Parsing GMCore message 'cuz it's stupid and it doesn't know how to send error messages in 2021 ffs
466
+ // 2024 and still counting
590
467
  errorPasswordChanged = dataResponse.error.substring(dataResponse.error.indexOf('errorMessage') + 13, dataResponse.error.length);
591
468
  showErrorPasswordChanged = true;
592
469
  window.postMessage({ type: "ShowPasswordChangedError", showErrorPasswordChanged, errorPasswordChanged }, window.location.href);
@@ -597,54 +474,6 @@
597
474
  }
598
475
  }
599
476
 
600
- const getRealityCheckData = (url:URL):void => {
601
- let options = {
602
- method: 'GET',
603
- headers: {
604
- 'X-SessionID': sessionId,
605
- }
606
- }
607
- fetch(url.href, options)
608
- .then((res:any) => { return res.json(); })
609
- .then((data:any) => {
610
- realityCheckData = data.UserRealityCheckValue;
611
- }, (err:any) => {
612
- console.error(err);
613
- });
614
- }
615
-
616
- const setRealityCheckValue = (updatedData:string):void => {
617
- let url:URL = new URL(`${endpoint}/v1/player/${userId}/realitycheck`);
618
-
619
- if (updatedData) {
620
- storedRealityCheck = updatedData;
621
- }
622
-
623
- let optionsRealityCheck = {
624
- method: "POST",
625
- headers: {
626
- 'X-SessionID': sessionId,
627
- 'Content-Type': "application/json",
628
- 'Accept': 'application/json',
629
- 'realityCheckValue': parseInt(storedRealityCheck, 10)
630
- }
631
- };
632
-
633
- fetch(url.href, optionsRealityCheck)
634
- .then((res:any) => {
635
- if (res.status == 200) {
636
- getRealityCheckData(new URL(`${endpoint}/v1/player/${playerid}/realitycheck`));
637
- window.postMessage({ type: 'RealityCheckValueUpdated' }, window.location.href);
638
- window.postMessage({ type: 'WidgetNotification', data: {
639
- type: 'success',
640
- message: $_('realityCheckSuccess')
641
- }}, window.location.href);
642
- }
643
- }, (err:any) => {
644
- console.error(err);
645
- });
646
- }
647
-
648
477
  const getGamingLimits = (url:URL):void => {
649
478
  if (showsuccessnotification === true) {
650
479
  setTimeout(() => {showsuccessnotification = false; }, 3000);
@@ -703,16 +532,6 @@
703
532
  });
704
533
  }
705
534
 
706
- const getData = ():void => {
707
- //@TODO move this to the player-account-notifications as we did for the menu widget
708
- getNotificationsDetails(new URL(`${cmsendpoint}/${lang}/support-information?env=${env}`));
709
- //@TODO move this to the player-info as we did for the menu widget
710
- getUserProfileInfo();
711
- getUserProfileConsent();
712
- //@TODO move this to the player-reality-check as we did for the menu widget
713
- getRealityCheckData(new URL(`${endpoint}/v1/player/${playerid}/realitycheck`));
714
- }
715
-
716
535
  const sendLimitsData = (e:any):void => {
717
536
  getGamingLimits(new URL(`/v2/player/${userId}/limits`, endpoint));
718
537
  }
@@ -769,15 +588,15 @@
769
588
  {#if !activeMenuItem}
770
589
  <nav class="PlayerAccountMobile">
771
590
  <player-account-menu {endpoint} {session} {playerid} {cmsendpoint} {lang} {env} {translationurl} {userroles} {clientstyling} {clientstylingurl}></player-account-menu>
772
- <player-account-notifications customnotif={customnotifications} {translationurl} {clientstyling} {clientstylingurl}></player-account-notifications>
591
+ <player-account-notifications {lang} {cmsendpoint} {env} {userroles} {customnotifications} {clientstyling} {clientstylingurl}></player-account-notifications>
773
592
  </nav>
774
593
  {:else}
775
594
  {#if activeMenuItem === widgetPath[0]}
776
- <player-profile-info {endpoint} {lang} {countrycode} {translationurl} {clientstyling} {clientstylingurl} {custominputtextswitch}></player-profile-info>
595
+ <player-profile-info userid={userId} sessionid={sessionId} {endpoint} {lang} {translationurl} {clientstyling} {clientstylingurl} {custominputtextswitch}></player-profile-info>
777
596
  {:else if activeMenuItem === widgetPath[1]}
778
597
  <player-change-password {simplepasswordvalidation} {translationurl} {lang} {clientstyling} {clientstylingurl}></player-change-password>
779
598
  {:else if activeMenuItem === widgetPath[2]}
780
- <player-reality-check realitycheck={realityCheckData} {endpoint} {translationurl} {playerid} {session} {lang} {clientstyling} {clientstylingurl}></player-reality-check>
599
+ <player-reality-check {endpoint} {translationurl} {playerid} {session} {lang} {clientstyling} {clientstylingurl}></player-reality-check>
781
600
  {:else if activeMenuItem === widgetPath[3]}
782
601
  <player-account-timeout {lang} {operator} {supportemail} {translationurl} {clientstyling} {clientstylingurl}></player-account-timeout>
783
602
  {:else if activeMenuItem === widgetPath[4]}
@@ -822,11 +641,11 @@
822
641
  </nav>
823
642
  <main>
824
643
  {#if activeMenuItem === widgetPath[0]}
825
- <player-profile-info {endpoint} {lang} {countrycode} {translationurl} {clientstyling} {clientstylingurl} {custominputtextswitch}></player-profile-info>
644
+ <player-profile-info userid={userId} sessionid={sessionId} {endpoint} {lang} {translationurl} {clientstyling} {clientstylingurl} {custominputtextswitch}></player-profile-info>
826
645
  {:else if activeMenuItem === widgetPath[1]}
827
646
  <player-change-password {simplepasswordvalidation}{lang} {translationurl} {clientstyling} {clientstylingurl}></player-change-password>
828
647
  {:else if activeMenuItem === widgetPath[2]}
829
- <player-reality-check realitycheck={realityCheckData} {endpoint} {translationurl} {playerid} {session} {lang} {clientstyling} {clientstylingurl}></player-reality-check>
648
+ <player-reality-check {endpoint} {translationurl} {playerid} {session} {lang} {clientstyling} {clientstylingurl}></player-reality-check>
830
649
  {:else if activeMenuItem === widgetPath[3]}
831
650
  <player-account-timeout {lang} {operator} {supportemail} {translationurl} {clientstyling} {clientstylingurl}></player-account-timeout>
832
651
  {:else if activeMenuItem === widgetPath[4]}
@@ -864,7 +683,7 @@
864
683
  {/if}
865
684
  </main>
866
685
  <aside>
867
- <player-account-notifications customnotif={customnotifications} {translationurl} {clientstyling} {clientstylingurl}></player-account-notifications>
686
+ <player-account-notifications {lang} {cmsendpoint} {env} {userroles} {customnotifications} {clientstyling} {clientstylingurl}></player-account-notifications>
868
687
  </aside>
869
688
  {/if}
870
689
  </section>