@everymatrix/player-account-gaming-limits-wrapper-2 1.0.3 → 1.0.4

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
@@ -28,19 +28,19 @@
28
28
 
29
29
  <div class="webcomponent">
30
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
+
31
34
  endpoint="https://betathome-de-stage-api.stage.norway.everymatrix.com/"
32
- session="6e810eb4-8538-4573-8b7d-3748beb7a590"
33
- userid="4516479"
35
+ session="97fac551-b53b-407d-92d3-682124dbfcaa"
36
+ userid="4227950"
34
37
  currency="EUR"
35
38
  lang="en"
36
- includedlimits="lugas:10-99999999 | wager:10-99999999 | deposit:10-99999999, stake:10-99999999, loss:10-99999999"
37
- products="wager:Casino, deposit:Casino, stake:Sports, loss:All"
38
- periods="lugas: M, deposit: D-W-M, loss: D-W-M, wager: M, stake: N"
39
+
39
40
  tablabels="Deposit limit, Slots limit, Other limits"
40
41
  historyenabled="true"
41
42
  apiversion="gm16"
42
43
  clientstylingurl="https://storage.googleapis.com/css-upload/bahLimit-2.css"></player-account-gaming-limits-wrapper-2>
43
-
44
44
  </div>
45
45
 
46
46
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-gaming-limits-wrapper-2",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "main": "dist/player-account-gaming-limits-wrapper-2.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -13,78 +13,45 @@
13
13
  export let endpoint:string = '';
14
14
  export let currency:string = '';
15
15
  export let apiversion:string = '';
16
- export let includedlimits:string = '';
17
- export let products:string = '';
18
- export let periods:string = '';
16
+
19
17
  export let tablabels:string = '';
20
18
  export let historyenabled:string = "true";
19
+
20
+ export let limitsamount:string = '';
21
+ export let limitsperiods:string = '';
22
+
21
23
  export let clientstyling:string = '';
22
24
  export let clientstylingurl:string = '';
23
25
 
24
26
  let isLoading:boolean = true;
25
27
  let customStylingContainer:HTMLElement;
26
28
  let limitTabs:Array<any> = [];
27
- let limitMinMax:object = {};
28
- let multiLimit:string = '';
29
29
 
30
30
  let tabLabelArray:Array<string>;
31
31
  let mainContainer:HTMLElement | undefined = undefined;
32
32
  let tabsContainer:HTMLElement | undefined = undefined;
33
33
 
34
+ let amountsArray:Array<string>;
35
+ let periodsArray:Array<string>;
36
+
37
+ const unwrapLimitsConfig = (amounts:string, periods:string):void=> {
38
+ amountsArray = amounts.replace(/\s/g, '').split('|');
39
+ periodsArray = periods.replace(/\s/g, '').split('|');
40
+
41
+ if (amountsArray.length === 0) { throw new Error('Please provide a full limits configuration.') }
42
+ else if (amountsArray.length !== periodsArray.length) { throw new Error('Please make sure that the limit configuration parameters specify the same number of tabs.')};
43
+ }
44
+
34
45
  const determineTabs = ():void => {
35
- let eachLimit;
36
- let limits = includedlimits.split(' | ')
37
-
38
- let productUnwrap = products.split(',').map(wordPair => wordPair.trim().split(':').map(word => word.trim()));
39
- const productObject = productUnwrap.reduce((obj, valuePair) => {
40
- obj[valuePair[0]] = valuePair[1];
41
- return obj;
42
- }, {});
43
-
44
- let periodUnwrap:Array<any> = periods.split(',').map(limitPeriodPair => limitPeriodPair.trim().split(':'));
45
- for (let limitPeriodPair of periodUnwrap) {
46
- limitPeriodPair[1] = limitPeriodPair[1].trim().replace('D', 'Daily').replace('W', 'Weekly').replace('M', 'Monthly').replace('N', 'None').split('-');
47
- }
48
- const periodObject = periodUnwrap.reduce((obj, valuePair) => {
49
- obj[valuePair[0]] = valuePair[1];
50
- return obj;
51
- }, {});
46
+ unwrapLimitsConfig(limitsamount, limitsperiods);
47
+ let limits = limitsamount.split('|');
52
48
 
53
49
  limits.forEach(element => {
54
- if( element.indexOf(', ') >= 0 ){
55
- let multiEachLimit = '';
56
- eachLimit = element.split(', ');
57
- eachLimit.forEach(element => {
58
- if(element.indexOf(':') >= 0){
59
- multiEachLimit = element.slice(0, element.indexOf(':'))
60
- multiLimit += multiEachLimit + ' ';
61
- limitMinMax[multiEachLimit] = element.slice(element.indexOf(':') + 1).trim()
62
- } else {
63
- multiLimit += element + ' '
64
- }
65
- });
66
- limitTabs.push(multiLimit)
67
- } else if(element.indexOf(':') >= 0){
68
- eachLimit = element.slice(0, element.indexOf(':'))
69
- limitTabs.push(eachLimit)
70
- limitMinMax[eachLimit] = element.slice(element.indexOf(':') + 1).trim()
71
- } else {
72
- limitTabs.push(element)
73
- }
50
+ limitTabs.push(element);
74
51
  });
75
52
 
76
53
  tabLabelArray = tablabels.split(',').map(word => word.trim());
77
54
  isLoading = false;
78
-
79
- if(limitMinMax){
80
- window.postMessage({ type: 'SetLimitsMinMax', limitMinMax}, window.location.href);
81
- }
82
- if(productObject){
83
- window.postMessage({ type: 'SetLimitsProducts', productObject}, window.location.href);
84
- }
85
- if(periodObject){
86
- window.postMessage({ type: 'SetLimitsPeriods', periodObject}, window.location.href);
87
- }
88
55
  }
89
56
 
90
57
  const selectTab = (index:number):void => {
@@ -129,7 +96,7 @@
129
96
  }
130
97
  });
131
98
 
132
- $: userid && session && endpoint && includedlimits && tablabels && lang && determineTabs();
99
+ $: userid && session && endpoint && tablabels && lang && apiversion && determineTabs();
133
100
  $: mainContainer && !isLoading && selectTab(0);
134
101
  $: clientstylingurl && setClientStylingURL();
135
102
  $: clientstyling && setClientStyling();
@@ -152,24 +119,12 @@
152
119
  {/if}
153
120
 
154
121
  <div class="player-account-gaming-limits-wrapper-2" bind:this={mainContainer}>
155
- {#each limitTabs as limits}
156
- {#if apiversion == 'gmcore'}
157
- <player-account-gaming-limits-page-2-gm16 class="hidden selected"
158
- {lang}
159
- {currency}
160
- {limits}
161
- {userid}
162
- {session}
163
- {endpoint}
164
- {apiversion}
165
- {clientstyling}
166
- {clientstylingurl}
167
- ></player-account-gaming-limits-page-2-gm16>
168
- {:else}
122
+ {#each limitTabs as _, i}
169
123
  <player-account-gaming-limits-page-2-gm16 class="hidden selected"
170
124
  {lang}
171
125
  {currency}
172
- {limits}
126
+ amountsconfig = {amountsArray[i]}
127
+ periodsconfig = {periodsArray[i]}
173
128
  {userid}
174
129
  {session}
175
130
  {endpoint}
@@ -177,7 +132,6 @@
177
132
  {clientstyling}
178
133
  {clientstylingurl}
179
134
  ></player-account-gaming-limits-page-2-gm16>
180
- {/if}
181
135
  {/each}
182
136
  </div>
183
137
  {#if historyenabled === 'true'}