@everymatrix/player-account-self-exclusion-nd 1.37.4

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 ADDED
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <meta name='viewport' content='width=device-width,initial-scale=1'>
6
+
7
+ <title>
8
+ player-account-self-exclusion-nd
9
+ </title>
10
+ <link rel="stylesheet" href="public/reset.css">
11
+ <script src='dist/player-account-self-exclusion-nd.js'></script>
12
+ </head>
13
+
14
+ <body>
15
+
16
+ <div class="webcomponent">
17
+ <player-account-self-exclusion-nd lang="en" supportemail="test@asf.com"></player-account-self-exclusion-nd>
18
+ </div>
19
+
20
+ </body>
21
+ </html>
package/index.js ADDED
@@ -0,0 +1 @@
1
+ import './dist/player-account-self-exclusion-nd.js';
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@everymatrix/player-account-self-exclusion-nd",
3
+ "version": "1.37.4",
4
+ "main": "dist/player-account-self-exclusion-nd",
5
+ "svelte": "src/index.ts",
6
+ "scripts": {
7
+ "start": "sirv public",
8
+ "build": "cross-env NODE_ENV=production rollup -c",
9
+ "dev": "cross-env NODE_ENV=\"development\" rollup -c -w",
10
+ "validate": "svelte-check",
11
+ "test": "echo"
12
+ },
13
+ "devDependencies": {
14
+ "@rollup/plugin-babel": "^5.3.0",
15
+ "@rollup/plugin-commonjs": "^16.0.0",
16
+ "@rollup/plugin-node-resolve": "^10.0.0",
17
+ "@rollup/plugin-typescript": "^6.0.0",
18
+ "@tsconfig/svelte": "^1.0.0",
19
+ "rollup": "^2.3.4",
20
+ "rollup-plugin-dev-server": "^0.4.3",
21
+ "rollup-plugin-livereload": "^2.0.0",
22
+ "rollup-plugin-svelte": "^7.0.0",
23
+ "rollup-plugin-terser": "^7.0.0",
24
+ "rollup-plugin-uglify": "^6.0.4",
25
+ "svelte-check": "^1.0.0",
26
+ "svelte-preprocess": "^5.0.0",
27
+ "tslib": "^2.0.0",
28
+ "typescript": "^3.9.3"
29
+ },
30
+ "dependencies": {
31
+ "cross-env": "^7.0.3",
32
+ "sirv-cli": "^1.0.0",
33
+ "svelte": "^3.0.0"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "gitHead": "863252ebf7c846696d9b388f0d288993dbd5065c"
39
+ }
Binary file
@@ -0,0 +1,48 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, applet, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ }
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after {
42
+ content: '';
43
+ content: none;
44
+ }
45
+ table {
46
+ border-collapse: collapse;
47
+ border-spacing: 0;
48
+ }
@@ -0,0 +1,67 @@
1
+ import svelte from 'rollup-plugin-svelte';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import resolve from '@rollup/plugin-node-resolve';
4
+ import serve from 'rollup-plugin-dev-server';
5
+ import livereload from 'rollup-plugin-livereload';
6
+ import { terser } from 'rollup-plugin-terser';
7
+ import sveltePreprocess from 'svelte-preprocess';
8
+ import typescript from '@rollup/plugin-typescript';
9
+ import uglify from 'rollup-plugin-uglify';
10
+ import image from '@rollup/plugin-image';
11
+
12
+ const production = process.env.NODE_ENV == 'production';
13
+ const dev = process.env.NODE_ENV == 'development';
14
+
15
+ export default {
16
+ input: 'src/index.ts',
17
+ output: {
18
+ sourcemap: true,
19
+ format: 'umd',
20
+ name: 'app',
21
+ file: 'dist/player-account-self-exclusion-nd.js',
22
+ },
23
+ plugins: [
24
+ svelte({
25
+ preprocess: sveltePreprocess(),
26
+ compilerOptions: {
27
+ // @TODO check generate and hydratable
28
+ // generate: 'ssr',
29
+ // hydratable: true,
30
+ // enable run-time checks when not in production
31
+ customElement: true,
32
+ dev: !production
33
+ }
34
+ }),
35
+ image(),
36
+ commonjs(),
37
+ resolve({
38
+ browser: true,
39
+ dedupe: ['svelte']
40
+ }),
41
+ dev && serve({
42
+ open: true,
43
+ verbose: true,
44
+ allowCrossOrigin: true,
45
+ historyApiFallback: false,
46
+ host: 'localhost',
47
+ port: 5050,
48
+ }),
49
+ dev && livereload({ watch: ['', 'dist'] }),
50
+ typescript({
51
+ sourceMap: !production,
52
+ inlineSources: !production,
53
+ }),
54
+ // If we're building for production (npm run build
55
+ // instead of npm run dev), minify
56
+ production &&
57
+ terser({
58
+ output: {
59
+ comments: "all"
60
+ },
61
+ }),
62
+ production && uglify.uglify()
63
+ ],
64
+ watch: {
65
+ clearScreen: false
66
+ }
67
+ };
@@ -0,0 +1,371 @@
1
+ <svelte:options tag={null} />
2
+
3
+ <script lang="ts">
4
+ import { onMount } from 'svelte';
5
+ import { getDevice } from 'rvhelper';
6
+ import moment from 'moment';
7
+ import { _, addNewMessages, setLocale } from './i18n';
8
+ import { TRANSLATIONS } from './translations';
9
+
10
+ import '@vaadin/date-picker/vaadin-date-picker.js';
11
+
12
+ export let lang:string = 'en';
13
+ export let operator:string = 'Everymatrix';
14
+ export let supportemail:string = '';
15
+ export let clientstyling:string = '';
16
+ export let clientstylingurl:string = '';
17
+ export let translationurl:string = '';
18
+
19
+ let customStylingContainer:HTMLElement;
20
+ let userAgent:string = window.navigator.userAgent;
21
+ let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
22
+ let calendar:HTMLElement;
23
+
24
+ let permanentSelfExclusion:boolean = false;
25
+
26
+ let selfExclusionPeriod:string = '';
27
+ let selfExclusionExpiryDate:string = '';
28
+ let currentDate:Date = new Date();
29
+ let minDate:string;
30
+ let maxDate:string;
31
+
32
+ const setTranslationUrl = ():void => {
33
+ let url:string = translationurl;
34
+
35
+ fetch(url).then((res:any) => res.json())
36
+ .then((res) => {
37
+ Object.keys(res).forEach((item:any):void => {
38
+ addNewMessages(item, res[item]);
39
+ });
40
+ }).catch((err:any) => {
41
+ console.log(err);
42
+ });
43
+ }
44
+
45
+ Object.keys(TRANSLATIONS).forEach((item:any) => {
46
+ addNewMessages(item, TRANSLATIONS[item]);
47
+ });
48
+
49
+ minDate = moment(currentDate.setDate(currentDate.getDate())).add(6, 'M').format('YYYY-MM-DD');
50
+ maxDate = moment(currentDate.setDate(currentDate.getDate())).add(5, 'y').format('YYYY-MM-DD');
51
+ selfExclusionExpiryDate = minDate;
52
+
53
+ // Toggle permanent self exclusion
54
+ const togglePermanentSelfExclusion = () => {
55
+ if (permanentSelfExclusion == false) {
56
+ permanentSelfExclusion = true;
57
+ } else {
58
+ permanentSelfExclusion = false;
59
+ }
60
+ }
61
+
62
+ // Set self exclusion period
63
+ const setSelfExclusionPeriod = (date?:string) => {
64
+ if (permanentSelfExclusion == true) {
65
+ selfExclusionPeriod = 'SelfExclusionPermanent';
66
+ } else {
67
+ selfExclusionPeriod = 'SelfExclusionUntilSelectedDate';
68
+
69
+ if (date && date.length > 0) {
70
+ selfExclusionExpiryDate = date;
71
+ }
72
+ }
73
+ }
74
+
75
+ // Send self exclusion period and date
76
+ const saveSelfExclusion = (e):void => {
77
+ e.preventDefault();
78
+ setSelfExclusionPeriod();
79
+
80
+ window.postMessage({
81
+ type: 'SetSelfExclusion',
82
+ selfExclusionPeriod,
83
+ selfExclusionExpiryDate
84
+ }, window.location.href);
85
+ }
86
+
87
+ // Mobile back button
88
+ const toggleScreen = () => {
89
+ window.postMessage({type: 'PlayerAccountMenuActive', isMobile}, window.location.href);
90
+ }
91
+
92
+ const calendarHandler = (e:any) => {
93
+ setSelfExclusionPeriod(e.target.value);
94
+ }
95
+
96
+ const setCalendarEventListener = () => {
97
+ calendar.addEventListener('change', calendarHandler, false);
98
+ }
99
+
100
+ const setClientStyling = ():void => {
101
+ let sheet:HTMLElement = document.createElement('style');
102
+ sheet.innerHTML = clientstyling;
103
+ customStylingContainer.appendChild(sheet);
104
+ }
105
+
106
+ const setClientStylingURL = ():void => {
107
+ let url:URL = new URL(clientstylingurl);
108
+ let cssFile:HTMLElement = document.createElement('style');
109
+
110
+ fetch(url.href)
111
+ .then((res:any) => res.text())
112
+ .then((data:any) => {
113
+ cssFile.innerHTML = data
114
+
115
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
116
+ });
117
+ }
118
+
119
+ onMount(() => {
120
+ return () => {
121
+ calendar.removeEventListener('change', calendarHandler);
122
+ }
123
+ });
124
+
125
+ const initialLoad = () => {
126
+ setLocale(lang);
127
+ }
128
+
129
+ $: calendar && setCalendarEventListener();
130
+ $: lang && initialLoad();
131
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
132
+ $: clientstyling && customStylingContainer && setClientStyling();
133
+ $: translationurl && setTranslationUrl();
134
+ </script>
135
+
136
+ <div bind:this={customStylingContainer}>
137
+ <form class="SelfExclusionWrapper {isMobile ? 'SelfExclusionWrapperMobile' : ''}">
138
+ {#if isMobile}
139
+ <div class="MenuReturnButton" on:click={() => toggleScreen()}>
140
+ <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><defs><style>.aaa{fill:var(--emw--color-primary, #22B04E);}</style></defs><g transform="translate(-20 -158)">
141
+ <g transform="translate(20 158)">
142
+ <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)"/>
143
+ </g></g>
144
+ </svg>
145
+ <h2 class="PlayerSelfExclusionTitleMobile">{$_('titleSelfExclusion')}</h2>
146
+ </div>
147
+ {/if}
148
+ <h2 class="PlayerSelfExclusionTitle {isMobile ? 'PlayerSelfExclusionTitleNone' : ''}">{$_('titleSelfExclusion')}</h2>
149
+
150
+
151
+ <div class="SelfExclusionDescription {isMobile ? 'SelfExclusionDescriptionMobile' : ''}">
152
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusionText1', { values: { operatorname: operator}})}</p>
153
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusionText2')}</p>
154
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusionText3', { values: { operatorname: operator}})}</p>
155
+ <p class="SelfExclusionDescriptionText">{$_('selfExclusionText4')} <a href="mailto:{supportemail}">{supportemail}</a></p>
156
+ </div>
157
+ <div class="SelfExclusionDateWrapper {isMobile ? 'SelfExclusionDateWrapperMobile' : ''}">
158
+ <label for="SelfExclusionDate">{$_('duration')}</label>
159
+ <vaadin-date-picker bind:this={calendar} min={minDate} max={maxDate} value={minDate}></vaadin-date-picker>
160
+ </div>
161
+ <div class="SelfExclusionRadioWrapper {isMobile ? 'SelfExclusionRadioWrapperMobile' : ''}">
162
+ <label class="SelfExclusionRadio">{$_('forever')}
163
+ <input type="Checkbox" on:click={() => togglePermanentSelfExclusion()}>
164
+ <span class="Checkmark" part="Checkmark"></span>
165
+ </label>
166
+ </div>
167
+ <div class="SelfExclusionDescription {isMobile ? 'SelfExclusionDescriptionMobile' : ''}">
168
+ {#if permanentSelfExclusion}
169
+ <p class="SelfExclusionDescriptionText"><strong>{$_('permanentSelfExclusion')}</strong></p>
170
+ {:else}
171
+ <p class="SelfExclusionDescriptionText"><strong>{$_('temporarySelfExclusion', { values: { date: selfExclusionExpiryDate}})}</strong></p>
172
+ {/if}
173
+ </div>
174
+ <div class="SelfExclusionActionButtons {isMobile ? 'SelfExclusionActionButtonsMobile' : ''}">
175
+ <button class="SelfExclusionSave" on:click={(e) => saveSelfExclusion(e)}>{$_('save')}</button>
176
+ </div>
177
+ </form>
178
+ </div>
179
+
180
+ <style lang="scss">
181
+
182
+
183
+
184
+
185
+
186
+ .PlayerSelfExclusionTitle {
187
+ font-size: 26px;
188
+ color: var(--emfe-w-pam-color-primary, var(--emw--color-primary, #22B04E));
189
+ font-weight: 400;
190
+ }
191
+
192
+ .PlayerSelfExclusionTitleMobile {
193
+ font-size: var(--emw--font-size-large, 20px);
194
+ color: var(--emfe-w-pam-color-primary, var(--emw--color-primary, #22B04E));
195
+ }
196
+
197
+ .PlayerSelfExclusionTitleNone {
198
+ display: none;
199
+ }
200
+
201
+ .SelfExclusionWrapper {
202
+ background-color: var(--emfe-w-color-pale, var(--emw--color-gray-50, #F1F1F1));
203
+ color: var(--emfe-w-pam-color-primary, var(--emw--color-primary, #22B04E));
204
+ padding: 50px;
205
+ border-radius: 20px;
206
+ max-width: 760px;
207
+ &.SelfExclusionWrapperMobile {
208
+ padding: 20px 15px;
209
+ max-width: unset;
210
+ }
211
+ }
212
+
213
+ .MenuReturnButton{
214
+ color: var(--emw--color-gray-300, #58586B);
215
+ display: inline-flex;
216
+ align-items: center;
217
+ column-gap: 10px;
218
+ margin-bottom: 10px;
219
+ }
220
+
221
+
222
+ .SelfExclusionTitle {
223
+ font-size: 26px;
224
+ color: var(--emfe-w-pam-color-primary, var(--emw--color-primary, #22B04E));
225
+ font-weight: var(--emw--font-weight-bold, 700);
226
+ &.SelfExclusionTitleMobile {
227
+ font-size: var(--emw--font-size-large, 20px);
228
+ }
229
+ }
230
+
231
+ .SelfExclusionDescription {
232
+ color: var(--emw--color-gray-300, #58586B);
233
+ line-height: 24px;
234
+ &.SelfExclusionDescriptionMobile {
235
+ font-size: var(--emw--font-size-x-small, 12px);
236
+ line-height: 19px;
237
+ }
238
+ .SelfExclusionDescriptionText a {
239
+ color: var(--emfe-w-pam-color-primary, var(--emw--color-primary, #22B04E));
240
+ }
241
+ }
242
+
243
+ .SelfExclusionDateWrapper {
244
+ color: var(--emw--color-gray-300, #58586B);
245
+ display: flex;
246
+ flex-direction: column;
247
+ padding-bottom: 16px;
248
+ position: relative;
249
+ width: 50%;
250
+
251
+ label {
252
+ font-size: var(--emw--font-size-small, 14px);
253
+ font-weight: 300;
254
+ padding-bottom: 5px;
255
+ }
256
+
257
+ input {
258
+ font-family: inherit;
259
+ width: 100%;
260
+ height: 44px;
261
+ border: 1px solid var(--emw--color-gray-100, #E6E6E6);
262
+ border-radius: 5px;
263
+ box-sizing: border-box;
264
+ padding: 5px 15px;
265
+ font-size: var(--emw--size-standard, 16px);
266
+ line-height: 18px;
267
+ }
268
+
269
+ &.SelfExclusionDateWrapperMobile {
270
+ width: 100%;
271
+ }
272
+ }
273
+
274
+ .SelfExclusionRadioWrapper {
275
+ display: block;
276
+ position: relative;
277
+ padding: 4px 0 0 0;
278
+ margin-bottom: 16px;
279
+ font-size: var(--emw--size-standard, 16px);
280
+ user-select: none;
281
+ line-height: 18px;
282
+
283
+ label {
284
+ font-size: var(--emw--size-standard, 16px);
285
+ cursor: pointer;
286
+ padding-left: 35px;
287
+ }
288
+
289
+ input {
290
+ font-family: inherit;
291
+ position: absolute;
292
+ opacity: 0;
293
+ cursor: pointer;
294
+ height: 0;
295
+ width: 0;
296
+ }
297
+
298
+ .Checkmark {
299
+ position: absolute;
300
+ top: 0;
301
+ left: 0;
302
+ height: 25px;
303
+ width: 25px;
304
+ background-color: var(--emw--color-gray-100, #E6E6E6);
305
+ border-radius: 50%;
306
+ }
307
+
308
+ input:checked ~ .Checkmark {
309
+ background-color: var(--emfe-w-pam-color-primary, var(--emw--color-primary, #22B04E));
310
+ }
311
+
312
+ .Checkmark:after {
313
+ content: "";
314
+ position: absolute;
315
+ display: none;
316
+ left: 9px;
317
+ top: 5px;
318
+ width: 5px;
319
+ height: 10px;
320
+ border: solid white;
321
+ border-width: 0 2px 2px 0;
322
+ transform: rotate(45deg);
323
+ }
324
+
325
+ input:checked ~ .Checkmark:after {
326
+ display: block;
327
+ }
328
+
329
+ &.SelfExclusionRadioWrapperMobile {
330
+ label {
331
+ font-family: inherit;
332
+ font-size: var(--emw--font-size-x-small, 12px);
333
+ }
334
+ }
335
+ }
336
+
337
+ .SelfExclusionActionButtons {
338
+ margin-top: 40px;
339
+ width: 50%;
340
+
341
+ .SelfExclusionSave {
342
+ cursor: pointer;
343
+ font-family: var(--emw--button-typography);
344
+ border-radius: 5px;
345
+ width: 100%;
346
+ height: 50px;
347
+ display: flex;
348
+ align-items: center;
349
+ justify-content: center;
350
+ text-transform: uppercase;
351
+ transition-duration: 0.3s;
352
+ box-sizing: border-box;
353
+ background-image: linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));
354
+ border: 2px solid var(--emw--button-border-color, #0E5924);
355
+ border-radius: 50px;
356
+ padding: 30px 0;
357
+ font-size: var(--emw--font-size-large, 20px);
358
+ color: var(--emw--button-text-color, #FFFFFF);
359
+ }
360
+
361
+ &.SelfExclusionActionButtonsMobile {
362
+ width: 100%;
363
+ grid-template-columns: 1fr 1fr;
364
+ .SelfExclusionSave {
365
+ height: 40px;
366
+ font-size: var(--emw--font-size-small, 14px);
367
+ padding: 20px 0;
368
+ }
369
+ }
370
+ }
371
+ </style>
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 };
package/src/index.ts ADDED
@@ -0,0 +1,22 @@
1
+ import PlayerAccountSelfExclusion from './PlayerAccountSelfExclusionNd.svelte';
2
+
3
+ function safeDecorator(fn) {
4
+ // eslint-disable-next-line func-names
5
+ return function(...args) {
6
+ try {
7
+ return fn.apply(this, args);
8
+ } catch (error) {
9
+ if (
10
+ error instanceof DOMException &&
11
+ error.message.includes('has already been used with this registry') || error.message.includes('Cannot define multiple custom elements with the same tag name')
12
+ ) {
13
+ return false;
14
+ }
15
+ throw error;
16
+ }
17
+ };
18
+ }
19
+
20
+ customElements.define = safeDecorator(customElements.define);
21
+ !customElements.get('player-account-self-exclusion-nd') && customElements.define('player-account-self-exclusion-nd', PlayerAccountSelfExclusion);
22
+ export default PlayerAccountSelfExclusion;