@everymatrix/player-account-self-exclusion 0.0.200 → 0.0.201

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-self-exclusion",
3
- "version": "0.0.200",
3
+ "version": "0.0.201",
4
4
  "main": "dist/player-account-self-exclusion",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "1575292cd20d511a1f4ebe038656d86deab2c7e0"
40
+ "gitHead": "71051531499cfea745b53a0f7c0a77a252990ae7"
41
41
  }
@@ -4,9 +4,13 @@
4
4
  import { onMount } from 'svelte';
5
5
  import { getDevice } from 'rvhelper';
6
6
  import moment from 'moment';
7
+ import { _, addNewMessages, setLocale } from './i18n';
8
+ import { PlayerSelfExclusionTranslations } from './translations';
7
9
 
8
10
  import '@vaadin/vaadin-date-picker/vaadin-date-picker.js';
9
11
 
12
+ export let lang:string = 'en';
13
+
10
14
  let userAgent:string = window.navigator.userAgent;
11
15
  let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
12
16
  let calendar:HTMLElement;
@@ -18,6 +22,10 @@
18
22
  let currentDate:Date = new Date();
19
23
  let minDate:string;
20
24
 
25
+ Object.keys(PlayerSelfExclusionTranslations).forEach((item:any) => {
26
+ addNewMessages(item, PlayerSelfExclusionTranslations[item]);
27
+ });
28
+
21
29
  currentDate.setDate(currentDate.getDate() + 7);
22
30
  minDate = moment(currentDate).format('YYYY-MM-DD');
23
31
 
@@ -31,12 +39,15 @@
31
39
  }
32
40
 
33
41
  // Set self exclusion period
34
- const setSelfExclusionPeriod = (date:string) => {
42
+ const setSelfExclusionPeriod = (date?:string) => {
35
43
  if (permanentSelfExclusion == true) {
36
44
  selfExclusionPeriod = 'SelfExclusionPermanent';
37
45
  } else {
38
46
  selfExclusionPeriod = 'SelfExclusionUntilSelectedDate';
39
- selfExclusionExpiryDate = date;
47
+
48
+ if (date.length > 0) {
49
+ selfExclusionExpiryDate = date;
50
+ }
40
51
  }
41
52
  }
42
53
 
@@ -70,7 +81,12 @@
70
81
  }
71
82
  });
72
83
 
84
+ const initialLoad = () => {
85
+ setLocale(lang);
86
+ }
87
+
73
88
  $: calendar && setCalendarEventListener();
89
+ $: lang && initialLoad();
74
90
  </script>
75
91
 
76
92
  <div class="SelfExclusionWrapper {isMobile ? 'SelfExclusionWrapperMobile' : ''}">
@@ -81,37 +97,37 @@
81
97
  <path class="aaa" d="M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z" transform="translate(15 15) rotate(180)"/>
82
98
  </g></g>
83
99
  </svg>
84
- <h2 class="PlayerSelfExclusionTitleMobile">Self-Exclusion</h2>
100
+ <h2 class="PlayerSelfExclusionTitleMobile">{$_('selfExclusion.title')}</h2>
85
101
  </div>
86
102
  {/if}
87
- <h2 class="PlayerSelfExclusionTitle {isMobile ? 'PlayerSelfExclusionTitleNone' : ''}">Self-Exclusion</h2>
103
+ <h2 class="PlayerSelfExclusionTitle {isMobile ? 'PlayerSelfExclusionTitleNone' : ''}">{$_('selfExclusion.title')}</h2>
88
104
 
89
105
 
90
106
  <div class="SelfExclusionDescription {isMobile ? 'SelfExclusionDescriptionMobile' : ''}">
91
- <p class="SelfExclusionDescriptionText">Everymatrix recognizes that gambling can lead to addiction and in our effort to prevent these problems, we offer our users the ability to exclude all forms of betting on our site for a certain of indefinite period of time.</p>
92
- <p class="SelfExclusionDescriptionText">Self-exclusion takes effect from the time it is set for the period you choose. Select a timeframe below then click "Confirm".</p>
93
- <p class="SelfExclusionDescriptionText">During self-exclusion you will not be able to access your Everymatrix account. In the case of permanent self-exclusion, it is only possible to revoke Self-exclusion upon written request and only 6 months post its initial application. Please note that an alternative way to request self-exclusion is to contact Customer Service as follows: E-mail: support@everymatrix.com</p>
94
- <p class="SelfExclusionDescriptionText">E-mail: <a href="mailto:support@everymatrix.com">support@everymatrix.com</a></p>
107
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusion.selfExclusionText1')}</p>
108
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusion.selfExclusionText2')}</p>
109
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusion.selfExclusionText3')} support@everymatrix.com</p>
110
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusion.selfExclusionText4')} <a href="mailto:support@everymatrix.com">support@everymatrix.com</a></p>
95
111
  </div>
96
112
  <div class="SelfExclusionDateWrapper {isMobile ? 'SelfExclusionDateWrapperMobile' : ''}">
97
- <label for="SelfExclusionDate">Duration:</label>
113
+ <label for="SelfExclusionDate">{$_('selfExclusion.duration')}</label>
98
114
  <vaadin-date-picker bind:this={calendar} min={minDate}></vaadin-date-picker>
99
115
  </div>
100
116
  <div class="SelfExclusionRadioWrapper {isMobile ? 'SelfExclusionRadioWrapperMobile' : ''}">
101
- <label class="SelfExclusionRadio">Forever
117
+ <label class="SelfExclusionRadio">{$_('selfExclusion.forever')}
102
118
  <input type="Checkbox" on:click={() => togglePermanentSelfExclusion()}>
103
119
  <span class="Checkmark"></span>
104
120
  </label>
105
121
  </div>
106
122
  <div class="SelfExclusionDescription {isMobile ? 'SelfExclusionDescriptionMobile' : ''}">
107
123
  {#if permanentSelfExclusion}
108
- <p class="SelfExclusionDescriptionText"><strong>Your self-exclusion period will be permanent.</strong></p>
124
+ <p class="SelfExclusionDescriptionText"><strong>{$_('selfExclusion.permanentSelfExclusion')}</strong></p>
109
125
  {:else}
110
- <p class="SelfExclusionDescriptionText"><strong>Your self-exclusion period will last until the {selfExclusionExpiryDate} 23:59.</strong></p>
126
+ <p class="SelfExclusionDescriptionText"><strong>{$_('selfExclusion.temporarySelfExclusion', { values: { date: selfExclusionExpiryDate}})}</strong></p>
111
127
  {/if}
112
128
  </div>
113
129
  <div class="SelfExclusionActionButtons {isMobile ? 'SelfExclusionActionButtonsMobile' : ''}">
114
- <button class="SelfExclusionSave" on:click={() => saveSelfExclusion()}>Save</button>
130
+ <button class="SelfExclusionSave" on:click={() => saveSelfExclusion()}>{$_('selfExclusion.save')}</button>
115
131
  </div>
116
132
  </div>
117
133
 
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,30 @@
1
+ export const PlayerSelfExclusionTranslations = {
2
+ en: {
3
+ selfExclusion: {
4
+ title: `Self-Exclusion`,
5
+ selfExclusionText1: `Everymatrix recognizes that gambling can lead to addiction and in our effort to prevent these problems, we offer our users the ability to exclude all forms of betting on our site for a certain of indefinite period of time.`,
6
+ selfExclusionText2: `Self-exclusion takes effect from the time it is set for the period you choose. Select a timeframe below then click "Confirm".`,
7
+ selfExclusionText3: `During self-exclusion you will not be able to access your Everymatrix account. In the case of permanent self-exclusion, it is only possible to revoke Self-exclusion upon written request and only 6 months post its initial application. Please note that an alternative way to request self-exclusion is to contact Customer Service as follows: E-mail:`,
8
+ selfExclusionText4: `E-mail:`,
9
+ duration: `Duration:`,
10
+ forever: `Forever`,
11
+ save: `Save`,
12
+ temporarySelfExclusion: `Your self-exclusion period will last until the {date} 23:59.`,
13
+ permanentSelfExclusion: `Your self-exclusion period will be permanent.`
14
+
15
+ }
16
+ },
17
+ ro: {
18
+ selfExclusion: {
19
+ title: `Self-Exclusion`,
20
+ selfExclusionText1: `Everymatrix recognizes that gambling can lead to addiction and in our effort to prevent these problems, we offer our users the ability to exclude all forms of betting on our site for a certain of indefinite period of time.`,
21
+ selfExclusionText2: `Self-exclusion takes effect from the time it is set for the period you choose. Select a timeframe below then click "Confirm".`,
22
+ selfExclusionText3: `During self-exclusion you will not be able to access your Everymatrix account. In the case of permanent self-exclusion, it is only possible to revoke Self-exclusion upon written request and only 6 months post its initial application. Please note that an alternative way to request self-exclusion is to contact Customer Service as follows: E-mail:`,
23
+ selfExclusionText4: `E-mail:`,
24
+ duration: `Duration:`,
25
+ forever: `Forever`,
26
+ save: `Save`
27
+
28
+ }
29
+ }
30
+ };