@everymatrix/player-account-controller 0.0.401 → 0.0.402

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/index.html CHANGED
@@ -31,11 +31,12 @@
31
31
 
32
32
 
33
33
  <div class="webcomponent">
34
+
34
35
  <player-account-controller
35
36
  endpoint="https://ngenge-com-api.stage.norway.everymatrix.com/v1"
36
- cmsendpoint="https://ngenge-stage2.everymatrix.com/apijson"
37
- playerid="3997218"
38
- session="68334ed0-5227-4b89-92ef-284a2f537a23"
37
+ cmsendpoint="https://wt1-stage.everymatrix.com/apijson"
38
+ playerid="4071802"
39
+ session="5602b08e-df62-481c-8754-0e3d692aa0e9"
39
40
  customnotifications="#58586B,#2687F6,#D0046C"
40
41
  lang="en"
41
42
  env="stage"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-controller",
3
- "version": "0.0.401",
3
+ "version": "0.0.402",
4
4
  "main": "dist/player-account-controller.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -29,8 +29,8 @@
29
29
  "typescript": "^3.9.3"
30
30
  },
31
31
  "dependencies": {
32
- "@everymatrix/player-account-menu": "^0.0.401",
33
- "@everymatrix/player-account-notifications": "^0.0.401",
32
+ "@everymatrix/player-account-menu": "^0.0.402",
33
+ "@everymatrix/player-account-notifications": "^0.0.402",
34
34
  "cross-env": "^7.0.3",
35
35
  "sirv-cli": "^1.0.0",
36
36
  "svelte": "^3.0.0"
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "b3bbda8a314a8c6a5f05d45b471a2995556e9fad"
41
+ "gitHead": "c34a1b1831353cf2d35cc737b5b85cbfd12f9e62"
42
42
  }
@@ -22,6 +22,8 @@
22
22
  import '@everymatrix/player-pending-withdrawals';
23
23
  import '@everymatrix/player-transaction-history';
24
24
  import '@everymatrix/player-gaming-history';
25
+ import '@everymatrix/player-account-betting-history';
26
+ import type { OmWidgets } from './PlayerAccountController.types';
25
27
 
26
28
  export let cmsendpoint:string = '';
27
29
  export let env:string = '';
@@ -32,6 +34,9 @@
32
34
  export let endpoint:string = '';
33
35
  export let lang:string = '';
34
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'
35
40
  export let separatelimits:string = 'true';
36
41
  export let userroles:string = '';
37
42
 
@@ -48,6 +53,7 @@
48
53
  let countrycode:string = '';
49
54
  let playercurrency: string = null;
50
55
  // limits variables
56
+ let deviceSegregationValue: string = '';
51
57
  let playerlimits: any = {};
52
58
  let depositlimit:any;
53
59
  let wageringlimit:any;
@@ -60,6 +66,8 @@
60
66
  let errorPasswordChanged:string = '';
61
67
  let showErrorPasswordChanged:boolean = false;
62
68
  let selected:string;
69
+ let isOmInitalized: boolean = false;
70
+ let omWebWidgets: OmWidgets;
63
71
 
64
72
  const widgetTitle = ['Profile Info',
65
73
  'Change password',
@@ -74,7 +82,8 @@
74
82
  'Deposit',
75
83
  'Withdrawal',
76
84
  'Pending Withdrawals',
77
- 'Transaction History'];
85
+ 'Transaction History',
86
+ 'Betting History'];
78
87
  const widgetPath = ['/profile-info',
79
88
  '/change-password',
80
89
  '/reality-check',
@@ -88,8 +97,26 @@
88
97
  '/deposit',
89
98
  '/withdrawal',
90
99
  '/pending-withdrawals',
91
- '/transaction-history'];
100
+ '/transaction-history',
101
+ '/betting-history'];
102
+
92
103
  let switchContent:boolean = false;
104
+ let device = getDevice(userAgent)
105
+
106
+ const setDevice = ():void => {
107
+ let device = getDevice(userAgent)
108
+
109
+ if(device){
110
+ if(device === 'PC'){
111
+ deviceSegregationValue = 'dk';
112
+ } else if(device === 'iPad' || device === 'iPhone') {
113
+ deviceSegregationValue = 'ios';
114
+ } else {
115
+ deviceSegregationValue = 'mtWeb';
116
+ }
117
+ }
118
+
119
+ }
93
120
 
94
121
  Object.keys(PlayerAccountControllerTranslations).forEach((item:any) => {
95
122
  addNewMessages(item, PlayerAccountControllerTranslations[item]);
@@ -97,7 +124,6 @@
97
124
 
98
125
  const messageHandler = (e:any):void => {
99
126
  let url:URL;
100
-
101
127
  if (e.data) {
102
128
  switch(e.data.type) {
103
129
  case 'AccountMenuDetails':
@@ -121,6 +147,7 @@
121
147
  pagePath = e.data.pagePath;
122
148
 
123
149
  let accountDetailsURL:URL = new URL(`${cmsendpoint}/${lang}/profile-menu?env=${env}`);
150
+ accountDetailsURL.searchParams.append('device', deviceSegregationValue)
124
151
 
125
152
  getAccountMenuDetails(accountDetailsURL).then((menuData:any):void => {
126
153
  let aux:Array<any> = menuData.filter((item) => {
@@ -444,6 +471,7 @@
444
471
  }
445
472
 
446
473
  async function getAccountMenuDetails(url:URL) {
474
+ url.searchParams.append('device', deviceSegregationValue)
447
475
  const response = await fetch(url.href);
448
476
  const dataMenuItems = await response.json();
449
477
  return dataMenuItems;
@@ -452,18 +480,7 @@
452
480
  const getNotificationsDetails = (url:URL):void => {
453
481
 
454
482
  url.searchParams.append('userRoles', userroles);
455
-
456
- let device = getDevice(userAgent)
457
-
458
- if(device){
459
- if(device === 'PC'){
460
- url.searchParams.append('device', 'dk')
461
- } else if(device === 'iPad' || device === 'iPhone') {
462
- url.searchParams.append('device', 'ios')
463
- } else {
464
- url.searchParams.append('device', 'mtWeb')
465
- }
466
- }
483
+ url.searchParams.append('device', deviceSegregationValue)
467
484
 
468
485
  fetch(url.href)
469
486
  .then((res:any) => res.json())
@@ -680,6 +697,7 @@
680
697
  }
681
698
 
682
699
  const initialLoad = ():void => {
700
+ setDevice()
683
701
  userId = playerid;
684
702
  sessionId = session;
685
703
  if (!isMobile) {
@@ -688,6 +706,47 @@
688
706
  getData();
689
707
  }
690
708
 
709
+ const initOMWidgets = () => {
710
+ //@ts-ignore
711
+ import('https://static.everymatrix.com/omfe-widgets/s/widgets/0.158.13/widgets.min.js').then(() => {
712
+ const omWidgetsConfig = {
713
+ operatorId: operatorid,
714
+ publicPath: 'https://static.everymatrix.com/omfe-widgets/s/widgets/0.158.13/',
715
+ webApiWampy: {
716
+ 'url': webapiendpoint,
717
+ 'realm': realm
718
+ },
719
+ icons: 'https://static.everymatrix.com/omfe-widgets/s/assets/1.10.3/om2/icons/',
720
+ reconnectDetails: {
721
+ active: true, // if reconnect details should be active
722
+ minInterval: 1000, // the min period until a reconnect attempt
723
+ maxInterval: 10000, // the max period until a reconnect
724
+ intervalIncrement: 1000, // the incremental period added for each failed reconnect attempt
725
+ },
726
+ oddsInfo:{
727
+ oddsFormat:'DECIMAL'
728
+ },
729
+ auth: {
730
+ type: 'EmSession',
731
+ sessionId: 'AuthenticationNotLoaded' // show loading until token is passed
732
+ },
733
+ };
734
+ omWebWidgets = (window as any).omWebWidgets
735
+ omWebWidgets.init(omWidgetsConfig);
736
+ }).catch(error => {
737
+ console.error(error);
738
+ }).finally(() => {
739
+ isOmInitalized = true;
740
+ })
741
+ }
742
+
743
+ const updateOMSession = (session: string) => {
744
+ omWebWidgets.updateAuthMethod({
745
+ type: 'EmSession',
746
+ sessionId: session
747
+ })
748
+ }
749
+
691
750
  onMount(() => {
692
751
  window.addEventListener('message', messageHandler, false);
693
752
 
@@ -699,6 +758,7 @@
699
758
  $: lang && switchContent && pagePath && setActiveLanguage();
700
759
  $: cmsendpoint && endpoint && customnotifications && playerid && session && lang && env && userroles && initialLoad();
701
760
  $: depositlimit && wageringlimit && losslimit && timelimit;
761
+
702
762
  </script>
703
763
 
704
764
  {#if isLoading}
@@ -738,8 +798,10 @@
738
798
  <player-withdrawal {endpoint} {session} {playerid} {lang}></player-withdrawal>
739
799
  {:else if switchContent && pagePath === widgetPath[12]}
740
800
  <player-pending-withdrawals {endpoint} {session} {playerid} {lang}></player-pending-withdrawals>
741
- {:else if switchContent} <!-- TODO: Fix pagePath comming twich on last item -->
801
+ {:else if switchContent && pagePath === widgetPath[13]}
742
802
  <player-transaction-history {endpoint} {session} {playerid} {lang}></player-transaction-history>
803
+ {:else if switchContent && pagePath === widgetPath[14]}
804
+ <player-account-betting-history {endpoint} {session} {playerid} {lang} ></player-account-betting-history>
743
805
  {/if}
744
806
  {/if}
745
807
  {:else}
@@ -773,8 +835,10 @@
773
835
  <player-withdrawal {endpoint} {session} {playerid} {lang}></player-withdrawal>
774
836
  {:else if switchContent && pagePath === widgetPath[12]}
775
837
  <player-pending-withdrawals {endpoint} {session} {playerid} {lang}></player-pending-withdrawals>
776
- {:else if switchContent} <!-- TODO: Fix pagePath comming twich on last item -->
838
+ {:else if switchContent && pagePath === widgetPath[13]}
777
839
  <player-transaction-history {endpoint} {session} {playerid} {lang}></player-transaction-history>
840
+ {:else if switchContent && pagePath === widgetPath[14]}
841
+ <player-account-betting-history {endpoint} {session} {playerid} {lang} ></player-account-betting-history>
778
842
  {/if}
779
843
  </main>
780
844
  <aside>
@@ -0,0 +1,5 @@
1
+ export type OmWidgets = {
2
+ init: Function;
3
+ updateAuthMethod: Function;
4
+ getWebWidgetsConfig: Function;
5
+ };