@everymatrix/player-account-controller 0.0.158 → 0.0.162

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
@@ -33,11 +33,12 @@
33
33
  <player-account-controller
34
34
  endpoint="https://demo-api.stage.norway.everymatrix.com/v1"
35
35
  cmsendpoint="https://wp-one-widgets.everymatrix.com/wp-json/wpone-rest/v1"
36
- playerid="3930083"
37
- session="6be650ae-87f4-4e6d-a550-402b903b3cb0"
36
+ playerid="3685503"
37
+ session="9e488b70-5512-4a88-8043-1fd4795aacb0"
38
38
  accountpath="/menu-locations/profile-menu"
39
39
  notificationpath="/support_information"
40
40
  customnotifications="#58586B,#2687F6,#D0046C"
41
+ lang="en"
41
42
  ></player-account-controller>
42
43
  <!--<player-account-controller cmsendpoint="https://wp-one-widgets.everymatrix.com/wp-json/wpone-rest/v1"
43
44
  accountpath="/menu-locations/profile-menu"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-controller",
3
- "version": "0.0.158",
3
+ "version": "0.0.162",
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.158",
33
- "@everymatrix/player-account-notifications": "^0.0.158",
32
+ "@everymatrix/player-account-menu": "^0.0.162",
33
+ "@everymatrix/player-account-notifications": "^0.0.162",
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": "c60ed9a00ba6c1e6b9c8bdbafc4af5fd921f9267"
41
+ "gitHead": "f0ae2ffa2c984a3f90ab2eea42992f92e6acf725"
42
42
  }
@@ -3,6 +3,7 @@
3
3
  <script lang="typescript">
4
4
  import { onMount, tick } from 'svelte';
5
5
  import { getDevice } from 'rvhelper';
6
+ import { _, addNewMessages, setLocale, setupI18n } from './i18n';
6
7
 
7
8
  import '@everymatrix/player-account-menu';
8
9
  import '@everymatrix/player-account-notifications';
@@ -26,6 +27,9 @@
26
27
  export let playerid:string = '';
27
28
  export let session:string = '';
28
29
  export let endpoint:string = '';
30
+ export let lang:string = 'en';
31
+
32
+ setupI18n({ withLocale: 'en', translations: {}});
29
33
 
30
34
  let isLoading:boolean = false;
31
35
  let userAgent:string = window.navigator.userAgent;
@@ -42,7 +46,7 @@
42
46
  let losslimit:any;
43
47
  let timelimit:any;
44
48
  let showsuccessnotification:boolean = false;
45
- let showresetnotification:boolean = false;
49
+ let showdeletenotification:boolean = false;
46
50
 
47
51
  const widgetTitle = ['Profile Info', 'Change password', 'Reality Check', 'Timeout', 'Account Closure', 'Gaming Limits', 'Self Exclusion', 'Active Bonuses', 'Bonus History'];
48
52
  const accountMenuEndpointURL:string = cmsendpoint + accountpath;
@@ -266,6 +270,7 @@
266
270
  }
267
271
  let limitsCategoryTitle = e.data.name;
268
272
  let limitName:string = '';
273
+
269
274
  switch (limitsCategoryTitle) {
270
275
  case 'depositLimits':
271
276
  limitName = 'deposit';
@@ -306,8 +311,7 @@
306
311
  fetch(url, deleteOptions)
307
312
  .then((res:any) => {
308
313
  if (res.status == 200) {
309
- showresetnotification = true;
310
-
314
+ showdeletenotification = true;
311
315
  getGamingLimits(`${endpoint}/player/${playerid}/limits`);
312
316
  } else {
313
317
  // ERROR
@@ -375,8 +379,8 @@
375
379
  const getGamingLimits = (url:string) => {
376
380
  if (showsuccessnotification === true) {
377
381
  setTimeout(() => {showsuccessnotification = false; }, 3000);
378
- } else if(showresetnotification === true) {
379
- setTimeout(() => {showresetnotification = false; }, 3000);
382
+ } else if(showdeletenotification === true) {
383
+ setTimeout(() => {showdeletenotification = false; }, 3000);
380
384
  }
381
385
 
382
386
  let options = {
@@ -444,6 +448,7 @@
444
448
  }
445
449
 
446
450
  const initialLoad = () => {
451
+ setLocale(lang);
447
452
  userId = playerid;
448
453
  sessionId = session;
449
454
  pageName = widgetTitle[0];
@@ -463,7 +468,7 @@
463
468
  }
464
469
  });
465
470
 
466
- $: cmsendpoint && endpoint && accountpath && notificationpath && customnotifications && playerid && session && initialLoad();
471
+ $: cmsendpoint && endpoint && accountpath && notificationpath && customnotifications && playerid && session && lang && initialLoad();
467
472
  </script>
468
473
 
469
474
  {#if isLoading}
@@ -488,7 +493,7 @@
488
493
  {:else if switchContent && pageName === widgetTitle[4]}
489
494
  <player-account-closure></player-account-closure>
490
495
  {:else if switchContent && pageName === widgetTitle[5]}
491
- <player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {showresetnotification}></player-account-gaming-limits>
496
+ <player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {showdeletenotification}></player-account-gaming-limits>
492
497
  {:else if switchContent && pageName === widgetTitle[6]}
493
498
  <player-account-self-exclusion></player-account-self-exclusion>
494
499
  {:else if switchContent && pageName === widgetTitle[7]}
@@ -513,7 +518,7 @@
513
518
  {:else if switchContent && pageName === widgetTitle[4]}
514
519
  <player-account-closure></player-account-closure>
515
520
  {:else if switchContent && pageName === widgetTitle[5]}
516
- <player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {showresetnotification}></player-account-gaming-limits>
521
+ <player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {showdeletenotification}></player-account-gaming-limits>
517
522
  {:else if switchContent && pageName === widgetTitle[6]}
518
523
  <player-account-self-exclusion></player-account-self-exclusion>
519
524
  {:else if switchContent && pageName === widgetTitle[7]}
package/src/i18n.js ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ dictionary,
3
+ locale,
4
+ addMessages,
5
+ _
6
+ } from 'svelte-i18n';
7
+
8
+ function setupI18n({ withLocale: _locale, translations }) {
9
+ locale.subscribe((data) => {
10
+ if (data == null) {
11
+ dictionary.set(translations);
12
+ locale.set(_locale);
13
+ }
14
+ }); // maybe we will need this to make sure that the i18n is set up only once
15
+ /*dictionary.set(translations);
16
+ locale.set(_locale);*/
17
+ }
18
+
19
+ function addNewMessages(lang, dict) {
20
+ addMessages(lang, dict);
21
+ }
22
+
23
+ function setLocale(_locale) {
24
+ locale.set(_locale);
25
+ }
26
+
27
+ export { _, setupI18n, addNewMessages, setLocale };