@everymatrix/player-account-self-exclusion 0.0.162 → 0.0.166
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.
|
|
3
|
+
"version": "0.0.166",
|
|
4
4
|
"main": "dist/player-account-self-exclusion",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "cc5cea8f5d4ed68bf0b052d98cc82ce69e97fc45"
|
|
40
40
|
}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
<svelte:options tag={null} />
|
|
2
|
-
<script lang="typescript">
|
|
3
2
|
|
|
3
|
+
<script lang="typescript">
|
|
4
|
+
import { onMount } from 'svelte';
|
|
4
5
|
import { getDevice } from 'rvhelper';
|
|
6
|
+
import moment from 'moment';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
|
|
8
|
+
import '@vaadin/vaadin-date-picker/vaadin-date-picker.js';
|
|
8
9
|
|
|
9
|
-
let
|
|
10
|
+
let userAgent:string = window.navigator.userAgent;
|
|
11
|
+
let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
|
|
12
|
+
let calendar:HTMLElement;
|
|
13
|
+
|
|
14
|
+
let permanentSelfExclusion:boolean = false;
|
|
10
15
|
|
|
11
16
|
let selfExclusionPeriod:string = '';
|
|
12
17
|
let selfExclusionExpiryDate:string = '';
|
|
18
|
+
let currentDate:Date = new Date();
|
|
19
|
+
let minDate:string;
|
|
20
|
+
|
|
21
|
+
currentDate.setDate(currentDate.getDate() + 7);
|
|
22
|
+
minDate = moment(currentDate).format('YYYY-MM-DD');
|
|
13
23
|
|
|
14
24
|
// Toggle permanent self exclusion
|
|
15
25
|
const togglePermanentSelfExclusion = () => {
|
|
@@ -21,34 +31,51 @@
|
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
// Set self exclusion period
|
|
24
|
-
const setSelfExclusionPeriod = () => {
|
|
34
|
+
const setSelfExclusionPeriod = (date?:string) => {
|
|
25
35
|
if (permanentSelfExclusion == true) {
|
|
26
36
|
selfExclusionPeriod = 'SelfExclusionPermanent';
|
|
27
37
|
} else {
|
|
28
38
|
selfExclusionPeriod = 'SelfExclusionPeriod';
|
|
29
|
-
selfExclusionExpiryDate =
|
|
39
|
+
selfExclusionExpiryDate = date;
|
|
30
40
|
}
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
// Send self exclusion period and date
|
|
34
44
|
const saveSelfExclusion = () => {
|
|
35
45
|
setSelfExclusionPeriod();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
|
|
47
|
+
window.postMessage({
|
|
48
|
+
type: 'SetSelfExclusion',
|
|
49
|
+
selfExclusionPeriod,
|
|
50
|
+
selfExclusionExpiryDate
|
|
51
|
+
}, window.location.href);
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
// Mobile back button
|
|
42
55
|
const toggleScreen = () => {
|
|
43
56
|
window.postMessage({ type: 'ReturnToMenu' }, window.location.href);
|
|
44
57
|
}
|
|
58
|
+
|
|
59
|
+
const calendarHandler = (e:any) => {
|
|
60
|
+
setSelfExclusionPeriod(e.target.value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const setCalendarEventListener = () => {
|
|
64
|
+
calendar.addEventListener('change', calendarHandler, false);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
onMount(() => {
|
|
68
|
+
return () => {
|
|
69
|
+
calendar.removeEventListener('change', calendarHandler);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
$: calendar && setCalendarEventListener();
|
|
45
74
|
</script>
|
|
46
75
|
|
|
47
76
|
<div class="SelfExclusionWrapper {isMobile ? 'SelfExclusionWrapperMobile' : ''}">
|
|
48
77
|
{#if isMobile}
|
|
49
|
-
<div class="MenuReturnButton" on:click={() => toggleScreen()}>
|
|
50
|
-
|
|
51
|
-
</div>
|
|
78
|
+
<div class="MenuReturnButton" on:click={() => toggleScreen()}></div>
|
|
52
79
|
{/if}
|
|
53
80
|
<h2 class="SelfExclusionTitle {isMobile ? 'SelfExclusionTitleMobile' : ''}">Self-Exclusion</h2>
|
|
54
81
|
<div class="SelfExclusionDescription {isMobile ? 'SelfExclusionDescriptionMobile' : ''}">
|
|
@@ -59,7 +86,7 @@
|
|
|
59
86
|
</div>
|
|
60
87
|
<div class="SelfExclusionDateWrapper {isMobile ? 'SelfExclusionDateWrapperMobile' : ''}">
|
|
61
88
|
<label for="SelfExclusionDate">Duration:</label>
|
|
62
|
-
<
|
|
89
|
+
<vaadin-date-picker bind:this={calendar} min={minDate}></vaadin-date-picker>
|
|
63
90
|
</div>
|
|
64
91
|
<div class="SelfExclusionRadioWrapper {isMobile ? 'SelfExclusionRadioWrapperMobile' : ''}">
|
|
65
92
|
<label class="SelfExclusionRadio">Forever
|