@everymatrix/player-account-gaming-limits-popup 0.0.161 → 0.0.165

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-gaming-limits-popup",
3
- "version": "0.0.161",
3
+ "version": "0.0.165",
4
4
  "main": "dist/player-account-gaming-limits-popup.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "d734e5f1b488eaca6400399db42f53fefb48bdb0"
39
+ "gitHead": "69466f3f09b715237d9a3b1a78a8d2479dabe391"
40
40
  }
@@ -1,10 +1,18 @@
1
1
  <svelte:options tag={null} />
2
2
  <script lang="typescript">
3
-
4
- export let showpopup:string = '';
5
- export let infocontent:string = '';
6
- export let infoname:string = '';
3
+ import { onMount } from 'svelte';
7
4
  import { getDevice } from 'rvhelper';
5
+ import { _, addNewMessages } from './i18n';
6
+ import { PlayerGamingLimitsPopupTranslations } from './translations';
7
+
8
+ export let showpopup:any = '';
9
+ export let iteminfoamount:string = '';
10
+ export let lang:string = 'en';
11
+ export let playercurrency:string = 'USD';
12
+
13
+ Object.keys(PlayerGamingLimitsPopupTranslations).forEach((item) => {
14
+ addNewMessages(item, PlayerGamingLimitsPopupTranslations[item]);
15
+ });
8
16
 
9
17
  let showPopup:boolean = false;
10
18
 
@@ -13,28 +21,49 @@
13
21
 
14
22
  const closeInfoPopup = () => {
15
23
  showPopup = false;
16
- window.postMessage({ type: 'ClosePlayerAccountGamingLimitsPopup', showPopup: showPopup }, window.location.href);
24
+ window.postMessage({ type: 'ClosePlayerAccountGamingLimitsPopup' }, window.location.href);
25
+ }
26
+
27
+ const messageHandler = (e:any) => {
28
+ if (e.data && e.data.type == 'ClosePlayerAccountGamingLimitsPopup') {
29
+ showPopup = false;
30
+ }
17
31
  }
18
32
 
19
33
  const initialLoad = () => {
34
+ if(iteminfoamount < 0) {
35
+ iteminfoamount = '0';
36
+ }
20
37
  showPopup = showpopup;
21
38
  }
22
39
 
40
+ onMount(() => {
41
+ window.addEventListener('message', messageHandler, false);
42
+
43
+ return () => {
44
+ window.removeEventListener('message', messageHandler);
45
+ }
46
+ });
47
+
23
48
  $: showpopup && initialLoad();
24
49
  </script>
25
50
 
26
51
  {#if showPopup}
27
52
  <section class={isMobile ? 'InfoCardPopupMobileModal' : ''}>
28
- <div class="InfoCardPopupWrapper {isMobile ? 'InfoCardPopupMobileWrapper' : ''}">
53
+ <div class="InfoCardPopupWrapper {isMobile ? 'InfoCardPopupMobileWrapper' : ''} {iteminfoamount ? 'InfoCardPopupLimitChanged' : ''}">
29
54
  <div class="InfoCardPopupHeader">
30
55
  <div class="InfoCardPopupIcon">i</div>
31
- <div class="InfoCardPopupTitle">{infoname}</div>
56
+ <div class="InfoCardPopupTitle">{$_('popupText.name')}</div>
32
57
  <div class="InfoCardPopupCloseButton" on:click|preventDefault={closeInfoPopup}>
33
58
  <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
34
59
  </div>
35
60
  </div>
36
61
  <div class="InfoCardPopupContentArea">
37
- <p class="InfoCardPopupContent">{infocontent}</p>
62
+ {#if iteminfoamount}
63
+ <p class="InfoCardPopupContent">{$_('popupText.amountChanged', { values: { amount: iteminfoamount, currency: playercurrency}})}</p>
64
+ {:else}
65
+ <p class="InfoCardPopupContent">{$_('popupText.defaultText')}</p>
66
+ {/if}
38
67
  </div>
39
68
  </div>
40
69
  </section>
@@ -60,6 +89,9 @@
60
89
  content: '';
61
90
  }
62
91
  }
92
+ .InfoCardPopupLimitChanged {
93
+ background: #FFFFF8;
94
+ }
63
95
  .InfoCardPopupWrapper {
64
96
  width: ttp(12.5);
65
97
  padding: ttp(1.25);
@@ -69,8 +101,8 @@
69
101
  border-radius: 0.3125;
70
102
  display: block;
71
103
  position: absolute;
72
- top: ttp(1.5625);
73
- left: - ttp(6.25);
104
+ top: 32px;
105
+ left: -84px;
74
106
  z-index: 9;
75
107
  &:before {
76
108
  content: "";
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 };
@@ -0,0 +1,16 @@
1
+ export const PlayerGamingLimitsPopupTranslations = {
2
+ en: {
3
+ popupText: {
4
+ name: `Info`,
5
+ amountChanged: `Your limit has been changed or increased: {amount} {currency}. You will have to wait for the expiration date for your new limit to take effect:`,
6
+ defaultText: `Nulla ornare pulvinar dui. Nullam viverra, lacus vel consectetur euismod, ante lorem aliquam nisi, non faucibus nulla lacus sed sapien. Sed imperdiet tristique tincidunt.`
7
+ }
8
+ },
9
+ ro: {
10
+ popupText: {
11
+ name: `Info`,
12
+ amountChanged: `Your limit has been changed or increased: {amount} {currency}. You will have to wait for the expiration date for your new limit to take effect:`,
13
+ defaultText: `Nulla ornare pulvinar dui. Nullam viverra, lacus vel consectetur euismod, ante lorem aliquam nisi, non faucibus nulla lacus sed sapien. Sed imperdiet tristique tincidunt.`
14
+ }
15
+ }
16
+ };