@everymatrix/player-account-gaming-limits-wrapper-2 0.1.6 → 0.10.0

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
@@ -14,32 +14,6 @@
14
14
  }
15
15
  </style>
16
16
  <script src='dist/player-account-gaming-limits-wrapper-2.js'></script>
17
- <script>
18
- window.addEventListener("load", function () {
19
- // store tabs variable
20
- var myTabs = document.querySelectorAll("ul.nav-tabs > li");
21
- function myTabClicks(tabClickEvent) {
22
- for (var i = 0; i < myTabs.length; i++) {
23
- myTabs[i].classList.remove("active");
24
- }
25
- var clickedTab = tabClickEvent.currentTarget;
26
- clickedTab.classList.add("active");
27
- tabClickEvent.preventDefault();
28
- var myContentPanes = document.querySelectorAll(".tab-pane");
29
- for (i = 0; i < myContentPanes.length; i++) {
30
- myContentPanes[i].classList.remove("active");
31
- }
32
- var anchorReference = tabClickEvent.target;
33
- var activePaneId = anchorReference.getAttribute("href");
34
- var activePane = document.querySelector(activePaneId);
35
- activePane.classList.add("active");
36
- }
37
- for (i = 0; i < myTabs.length; i++) {
38
- myTabs[i].addEventListener("click", myTabClicks)
39
- }
40
- });
41
-
42
- </script>
43
17
  </head>
44
18
 
45
19
  <body>
@@ -50,95 +24,24 @@
50
24
  .header__name { color: #fff; }
51
25
  .header__name span { margin-right: 10px; font-weight: bold; }
52
26
  .webcomponent { padding: 10px 20px; }
53
- .container--tabs {
54
- margin: 2rem;
55
- }
56
- .container--tabs .nav-tabs {
57
- float: left;
58
- width: 100%;
59
- margin: 0;
60
- list-style-type: none;
61
- border-bottom: 1px solid #ddd;
62
- }
63
- .container--tabs .nav-tabs > li {
64
- float: left;
65
- margin-bottom: -1px;
66
- }
67
- .container--tabs .nav-tabs > li > a {
68
- float: left;
69
- margin-right: 2px;
70
- line-height: 1.42857143;
71
- padding: 10px;
72
- border: 1px solid transparent;
73
- border-radius: 4px 4px 0 0;
74
- }
75
- .container--tabs .nav-tabs > li > a:hover {
76
- border-color: #eee #eee #ddd;
77
- }
78
- .container--tabs .nav-tabs > li.active > a, .container--tabs .nav-tabs > li.active > a:hover, .container--tabs .nav-tabs > li.active > a:focus {
79
- color: #555;
80
- cursor: default;
81
- background-color: #fff;
82
- border: 1px solid #ddd;
83
- border-bottom-color: transparent;
84
- }
85
- .container--tabs .tab-content {
86
- float: left;
87
- width: 100%;
88
- }
89
- .container--tabs .tab-content > .tab-pane {
90
- display: none;
91
- }
92
- .container--tabs .tab-content > .tab-pane.active {
93
- display: block;
94
- padding: 2.5% 3.5%;
95
- background-color: #efefef;
96
- }
97
- .container--tabs .tab-content > .active {
98
- display: block;
99
- }
100
-
101
-
102
-
103
27
  </style>
104
28
 
105
29
  <div class="webcomponent">
106
- <div class="container--tabs">
107
- <section class="row">
108
- <ul class="nav nav-tabs">
109
- <li class="active"><a href="#tab-1">Tab 1</a></li>
110
- <li class=""><a href="#tab-2">Tab 2</a></li>
111
- <li class=""><a href="#tab-3">Tab 3</a></li>
112
- </ul>
113
- <div class="tab-content">
114
- <div id="tab-1" class="tab-pane active">
115
- <span class="glyphicon glyphicon-leaf glyphicon--home--feature two columns text-center"></span>
116
- <span class="col-md-10">
117
- <h3>Feature 1</h3>
118
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
119
- </span>
120
- </div>
121
- <div id="tab-2" class="tab-pane">
122
- <span class="glyphicon glyphicon-fire glyphicon--home--feature two columns text-center"></span>
123
- <span class="col-md-10">
124
- <player-account-gaming-limits-wrapper-2 endpoint="https://betathome-com-stage-api.stage.norway.everymatrix.com/"
125
- session="23752d9b-b55b-49b9-a6c2-7f7ac29fe376" userid="4500790" currency="EUR" includedlimits="deposit:10-99999999"
126
- tablabels="Deposit" historyenabled="false" apiversion="gmcore"
127
- clientstylingurl="https://storage.googleapis.com/css-upload/bahLimit-2.css" lang="en">
128
- </player-account-gaming-limits-wrapper-2>
129
- </span>
130
- </div>
131
- <div id="tab-3" class="tab-pane">
132
- <span class="glyphicon glyphicon-tint glyphicon--home--feature two columns text-center"></span>
133
- <span class="col-md-10">
134
- <h3>Feature 3</h3>
135
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
136
- </span>
137
- </div>
138
- </div>
139
- </section>
140
- </div>
141
-
30
+ <player-account-gaming-limits-wrapper-2
31
+ limitsamount="All(lugas): 10-9999999 | Casino(wager):10-9999999 | All(deposit):10-3100, Sports(wager):10-2500, All(loss):10-5500"
32
+ limitsperiods="All(lugas): M | Casino(wager): M | All(deposit):D-W-M, Sports(wager):M, All(loss):D-W-M"
33
+
34
+ endpoint="https://betathome-de-stage-api.stage.norway.everymatrix.com/"
35
+ session="782396a0-b6da-4933-939f-48ac2f095e71"
36
+ userid="4228353"
37
+ currency="EUR"
38
+ lang="en"
39
+
40
+ tablabels="Deposit limit, Slots limit, Other limits"
41
+ historyenabled="true"
42
+ apiversion="gm16"
43
+ numberofentries="10"
44
+ clientstylingurl="https://storage.googleapis.com/css-upload/bahLimit-2.css"></player-account-gaming-limits-wrapper-2>
142
45
  </div>
143
46
 
144
47
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-gaming-limits-wrapper-2",
3
- "version": "0.1.6",
3
+ "version": "0.10.0",
4
4
  "main": "dist/player-account-gaming-limits-wrapper-2.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -29,9 +29,9 @@
29
29
  "typescript": "^3.9.3"
30
30
  },
31
31
  "dependencies": {
32
- "@everymatrix/player-account-gaming-limits-history-2": "^0.0.415",
33
- "@everymatrix/player-account-gaming-limits-page-2-gm16": "^0.0.415",
34
- "@everymatrix/player-account-gaming-limits-page-2-gmcore": "^0.0.415",
32
+ "@everymatrix/player-account-gaming-limits-history-2": "^1.3.1",
33
+ "@everymatrix/player-account-gaming-limits-page-2-gm16": "^1.3.1",
34
+ "@everymatrix/player-account-gaming-limits-page-2-gmcore": "^1.3.1",
35
35
  "cross-env": "^7.0.3",
36
36
  "sirv-cli": "^1.0.0",
37
37
  "svelte": "^3.0.0"
@@ -14,74 +14,59 @@
14
14
  export let currency:string = '';
15
15
  export let apiversion:string = '';
16
16
 
17
- export let includedlimits:string = '';
18
17
  export let tablabels:string = '';
19
18
  export let historyenabled:string = "true";
20
19
 
20
+ export let limitsamount:string = '';
21
+ export let limitsperiods:string = '';
22
+ export let numberofentries:string = '';
23
+
21
24
  export let clientstyling:string = '';
22
25
  export let clientstylingurl:string = '';
23
26
 
24
27
  let isLoading:boolean = true;
25
28
  let customStylingContainer:HTMLElement;
26
29
  let limitTabs:Array<any> = [];
27
- let limitMinMax:object = {};
28
- let multiLimit:string = '';
29
30
 
30
31
  let tabLabelArray:Array<string>;
31
32
  let mainContainer:HTMLElement | undefined = undefined;
32
33
  let tabsContainer:HTMLElement | undefined = undefined;
33
34
 
35
+ let amountsArray:Array<string>;
36
+ let periodsArray:Array<string>;
37
+
38
+ const unwrapLimitsConfig = (amounts:string, periods:string):void=> {
39
+ amountsArray = amounts.replace(/\s/g, '').split('|');
40
+ periodsArray = periods.replace(/\s/g, '').split('|');
41
+
42
+ if (amountsArray.length === 0) { throw new Error('Please provide a full limits configuration.') }
43
+ else if (amountsArray.length !== periodsArray.length) { throw new Error('Please make sure that the limit configuration parameters specify the same number of tabs.')};
44
+ }
45
+
34
46
  const determineTabs = ():void => {
35
- let eachLimit;
36
- let limits = includedlimits.split(' | ')
47
+ unwrapLimitsConfig(limitsamount, limitsperiods);
48
+ let limits = limitsamount.split('|');
37
49
 
38
50
  limits.forEach(element => {
39
- if( element.indexOf(', ') >= 0 ){
40
- let multiEachLimit = '';
41
- eachLimit = element.split(', ');
42
- eachLimit.forEach(element => {
43
- if(element.indexOf(':') >= 0){
44
- multiEachLimit = element.slice(0, element.indexOf(':'))
45
- multiLimit += multiEachLimit + ' ';
46
- limitMinMax[multiEachLimit] = element.slice(element.indexOf(':') + 1).trim()
47
- } else {
48
- multiLimit += element + ' '
49
- }
50
- });
51
- limitTabs.push(multiLimit)
52
- } else if(element.indexOf(':') >= 0){
53
- eachLimit = element.slice(0, element.indexOf(':'))
54
- limitTabs.push(eachLimit)
55
- limitMinMax[eachLimit] = element.slice(element.indexOf(':') + 1).trim()
56
- } else {
57
- limitTabs.push(element)
58
- }
51
+ limitTabs.push(element);
59
52
  });
60
53
 
61
54
  tabLabelArray = tablabels.split(',').map(word => word.trim());
62
55
  isLoading = false;
63
-
64
- if(limitMinMax){
65
- window.postMessage({ type: 'SetLimitsMinMax', limitMinMax}, window.location.href);
66
- }
67
56
  }
68
57
 
69
- const selectTab = (index:number = 0):void => {
70
- console.log('mainContainer', mainContainer, mainContainer.children.length, index)
58
+ const selectTab = (index:number):void => {
71
59
  if (mainContainer.children.length > 0) {
72
60
  for (let i:number = 0; i < mainContainer.children.length; i++) {
73
61
  if (index === i) {
74
62
  mainContainer.children[i].classList.remove('hidden');
75
63
  tabsContainer?.children[i].classList.add('selected');
76
- console.log('intra aici in plm', mainContainer.children[i]);
77
64
  } else {
78
65
  mainContainer.children[i].classList.add('hidden');
79
- console.log('intra si aiciiiiciaici in plm', mainContainer.children[i]);
80
66
  tabsContainer?.children[i].classList.remove('selected');
81
67
  }
82
68
  }
83
69
  }
84
- console.log('mainContainer', mainContainer, mainContainer.children.length, index)
85
70
  }
86
71
 
87
72
  const setClientStyling = ():void => {
@@ -99,9 +84,7 @@
99
84
  .then((data:any) => {
100
85
  cssFile.innerHTML = data
101
86
 
102
- if (customStylingContainer) {
103
- setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
104
- }
87
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
105
88
  });
106
89
  }
107
90
 
@@ -112,10 +95,10 @@
112
95
  }
113
96
  });
114
97
 
115
- $: userid && session && endpoint && includedlimits && tablabels && lang && determineTabs();
98
+ $: userid && session && endpoint && tablabels && lang && apiversion && determineTabs();
116
99
  $: mainContainer && !isLoading && selectTab(0);
117
- $: clientstylingurl && setClientStylingURL();
118
- $: clientstyling && setClientStyling();
100
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
101
+ $: clientstyling && customStylingContainer && setClientStyling();
119
102
  </script>
120
103
 
121
104
  <svelte:head>
@@ -135,24 +118,12 @@
135
118
  {/if}
136
119
 
137
120
  <div class="player-account-gaming-limits-wrapper-2" bind:this={mainContainer}>
138
- {#each limitTabs as limits}
139
- {#if apiversion == 'gmcore'}
140
- <player-account-gaming-limits-page-2-gm16
141
- {lang}
142
- {currency}
143
- {limits}
144
- {userid}
145
- {session}
146
- {endpoint}
147
- {apiversion}
148
- {clientstyling}
149
- {clientstylingurl}
150
- ></player-account-gaming-limits-page-2-gm16>
151
- {:else}
152
- <player-account-gaming-limits-page-2-gm16
121
+ {#each limitTabs as _, i}
122
+ <player-account-gaming-limits-page-2-gm16 class="hidden selected"
153
123
  {lang}
154
124
  {currency}
155
- {limits}
125
+ amountsconfig = {amountsArray[i]}
126
+ periodsconfig = {periodsArray[i]}
156
127
  {userid}
157
128
  {session}
158
129
  {endpoint}
@@ -160,7 +131,6 @@
160
131
  {clientstyling}
161
132
  {clientstylingurl}
162
133
  ></player-account-gaming-limits-page-2-gm16>
163
- {/if}
164
134
  {/each}
165
135
  </div>
166
136
  {#if historyenabled === 'true'}
@@ -170,6 +140,7 @@
170
140
  {session}
171
141
  {endpoint}
172
142
  {apiversion}
143
+ {numberofentries}
173
144
  {clientstyling}
174
145
  {clientstylingurl}
175
146
  ></player-account-gaming-limits-history-2>