@everymatrix/casino-header-controller 0.0.93 → 0.0.97

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/documentation.md CHANGED
@@ -127,6 +127,7 @@ Full example below for `not logged in user`:
127
127
  |CloseHamburgerMenu|no extra data received|switches back to the `Casino Header` widget|
128
128
  |PlayerAccountMenuActive|no extra data sent|triggers the displaying of the `Player Account Controller`|
129
129
  |OpenLoginRegisterModal|login|sends a postmessage containing a boolean based on which it opens the login/register modal - either on the login or register tab|
130
+ |LanguageChanged|selectedLanguage|sends a postmessage containing the new language preference|
130
131
 
131
132
  ## API Reference
132
133
  |Parameter|Mandatory|Comment|
package/index.html CHANGED
@@ -21,10 +21,11 @@
21
21
  </style>
22
22
 
23
23
  <div class="webcomponent">
24
- <casino-header-controller session userid
24
+ <casino-header-controller session userid
25
25
  cmsmenuurl="https://widgets.everymatrix.com/apijson/en/menu?device=dk&env=stage&language=en&platform=dk"
26
- cmshamburgermenuurl="https://widgets.everymatrix.com/apijson/en/hamburger-menu?device=dk&env=stage&language=en&platform=dk"></casino-header-controller>
26
+ cmshamburgermenuurl="https://widgets.everymatrix.com/apijson/en/hamburger-menu?device=dk&env=stage&language=en&platform=dk"
27
+ profileurl="https://demo-api.stage.norway.everymatrix.com/v1/player/"></casino-header-controller>
27
28
  </div>
28
-
29
+
29
30
  </body>
30
- </html>
31
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-header-controller",
3
- "version": "0.0.93",
3
+ "version": "0.0.97",
4
4
  "main": "dist/casino-header-controller.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "4bc7902c67d764d4f54c0a26014157260c5f314f"
40
+ "gitHead": "e7af402eef393716b94058dc74dda99a39b649f1"
41
41
  }
@@ -5,6 +5,7 @@
5
5
 
6
6
  import '@everymatrix/casino-slider';
7
7
  import '@everymatrix/casino-hamburger-menu';
8
+ import '@everymatrix/player-account-balance-modal';
8
9
  import everymatrixLogo from './images/everymatrix-logo-white.png';
9
10
  import sliderPlaceholderImage from './images/slider.png';
10
11
 
@@ -12,6 +13,7 @@
12
13
  export let userid:String = '';
13
14
  export let cmsmenuurl:string = '';
14
15
  export let cmshamburgermenuurl:string = '';
16
+ export let profileurl:string = '';
15
17
 
16
18
  const genericIcon = `<svg version="1.1" fill="#fff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="width: 30px; color: #fff;" x="0px" y="0px"
17
19
  viewBox="0 0 384.971 384.971" style="enable-background:new 0 0 384.971 384.971;" xml:space="preserve">
@@ -25,8 +27,8 @@
25
27
 
26
28
  let mainMenuArray = [];
27
29
  let secondaryMenuArray = [];
28
- let languagesArray = ['EN', 'DE'];
29
- let balanceArray = ['1.650.944,353 €', '6.300,453 Ron'];
30
+ let languagesArray = [{ code: 'EN'}, { code: 'DE'}, { code: 'HR'}, { code: 'HU'}, { code: 'IT'}, { code: 'PL'}, { code: 'PT'}, { code: 'SL'}, { code: 'SR'}];
31
+ let selectedLanguage = '';
30
32
 
31
33
  let mobileView:boolean = false;
32
34
  let userAgent:string = window.navigator.userAgent;
@@ -38,6 +40,12 @@
38
40
  // use for medium devices styling, if necessary
39
41
  // const mediaQuery = window.matchMedia('(min-width: 768px)');
40
42
  let hamburgerMenuActive: boolean = false;
43
+
44
+ let totalBalance:string = '';
45
+ let cashBalance:string = '';
46
+ let bonusBalance:string = '';
47
+ let currency:string = '';
48
+
41
49
  const menuAction = (data) => {
42
50
  switch (data) {
43
51
 
@@ -55,10 +63,8 @@
55
63
 
56
64
  case 'lobby':
57
65
  console.log("lobby");
58
- break;
59
-
60
- case 'balance':
61
- console.log("balance");
66
+ // move this inline if no other logic is added here
67
+ location.reload();
62
68
  break;
63
69
 
64
70
  case 'myaccount':
@@ -71,7 +77,7 @@
71
77
  break;
72
78
 
73
79
  case 'language':
74
- console.log("language");
80
+ window.postMessage({ type: 'LanguageChanged', selectedLanguage }, window.location.href);
75
81
  break;
76
82
 
77
83
  default:
@@ -141,7 +147,7 @@
141
147
  window.addEventListener('message', messageHandler, false);
142
148
  if (isMobile(userAgent)) {
143
149
  mobileView = true;
144
- }
150
+ }
145
151
 
146
152
  return () => {
147
153
  window.removeEventListener('message', messageHandler);
@@ -149,7 +155,7 @@
149
155
  });
150
156
 
151
157
  $: session && setSession();
152
- $: cmsmenuurl && cmshamburgermenuurl && initialLoad();
158
+ $: cmsmenuurl && cmshamburgermenuurl && profileurl && initialLoad();
153
159
  </script>
154
160
 
155
161
  {#if isLoggedIn}
@@ -167,15 +173,7 @@
167
173
 
168
174
  <div class="HeaderTopActions">
169
175
  <div class="HeaderItemsMenu PrimaryMenu">
170
- <select class="Item ItemBalance" on:change={()=>menuAction('balance')}>
171
- {#each balanceArray as val}
172
- {#if val.includes('€')}
173
- <option selected>{val}</option>
174
- {:else}
175
- <option>{val}</option>
176
- {/if}
177
- {/each}
178
- </select>
176
+ <player-account-balance-modal sessionid={sessionID} playerid={playerID} {profileurl} />
179
177
  <div class="Item ItemDeposit" on:click={()=>menuAction('deposit')}>Deposit</div>
180
178
  <div class="Item ItemAccount" on:click={()=>menuAction('myaccount')}>
181
179
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16.429" viewBox="0 0 15 16.429"><defs><style>.a{fill:#fff;}</style></defs><g transform="translate(-8 -4)"><path class="a" d="M15.5,4a3.75,3.75,0,1,0,3.75,3.75A3.761,3.761,0,0,0,15.5,4Zm0,1.429A2.321,2.321,0,1,1,13.179,7.75,2.311,2.311,0,0,1,15.5,5.429Zm0,6.429A7.7,7.7,0,0,0,8,19.714a.714.714,0,0,0,.714.714H22.286A.714.714,0,0,0,23,19.714,7.7,7.7,0,0,0,15.5,11.857Zm0,1.429A6.18,6.18,0,0,1,21.5,19H9.5A6.18,6.18,0,0,1,15.5,13.286Z" transform="translate(0 0)"/></g></svg>
@@ -196,15 +194,7 @@
196
194
  </nav>
197
195
  <div class="HeaderTopActions">
198
196
  <div class="HeaderItemsMenu PrimaryMenu">
199
- <select class="Item ItemBalance" on:change={()=>menuAction('balance')}>
200
- {#each balanceArray as val}
201
- {#if val.includes('€')}
202
- <option selected>{val}</option>
203
- {:else}
204
- <option>{val}</option>
205
- {/if}
206
- {/each}
207
- </select>
197
+ <player-account-balance-modal sessionid={sessionID} playerid={playerID} {profileurl} />
208
198
  <div class="Item ItemDeposit" on:click={()=>menuAction('deposit')}>Deposit</div>
209
199
  <div class="Item ItemAccount" on:click={()=>menuAction('myaccount')}>
210
200
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16.429" viewBox="0 0 15 16.429">
@@ -221,12 +211,12 @@
221
211
  </g>
222
212
  </svg>
223
213
  </div>
224
- <select class="Item ItemLanguage" on:change={()=>menuAction('language')}>
214
+ <select bind:value={selectedLanguage} class="Item ItemLanguage" on:change={()=>menuAction('language')}>
225
215
  {#each languagesArray as lang}
226
- {#if lang === 'EN'}
227
- <option selected>{lang}</option>
216
+ {#if lang.code === 'EN'}
217
+ <option value={lang.code}>{lang.code}</option>
228
218
  {:else}
229
- <option>{lang}</option>
219
+ <option value={lang.code}>{lang.code}</option>
230
220
  {/if}
231
221
  {/each}
232
222
  </select>
@@ -275,12 +265,12 @@
275
265
  <div class="HeaderItemsMenu">
276
266
  <div class="Item ItemLogin" on:click={()=>menuAction('login')}>Login</div>
277
267
  <div class="Item ItemRegister" on:click={()=>menuAction('register')}>Register</div>
278
- <select class="Item ItemLanguage" on:change={()=>menuAction('language')}>
268
+ <select bind:value={selectedLanguage} class="Item ItemLanguage" on:change={()=>menuAction('language')}>
279
269
  {#each languagesArray as lang}
280
- {#if lang === 'EN'}
281
- <option selected>{lang}</option>
270
+ {#if lang.code === 'EN'}
271
+ <option value={lang.code}>{lang.code}</option>
282
272
  {:else}
283
- <option>{lang}</option>
273
+ <option value={lang.code}>{lang.code}</option>
284
274
  {/if}
285
275
  {/each}
286
276
  </select>