@everymatrix/player-profile-info 1.44.0 → 1.45.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,992 +0,0 @@
1
- <svelte:options tag={null} />
2
-
3
- <script lang="ts">
4
- import { getDevice } from 'rvhelper';
5
- import { _, addNewMessages, setLocale } from './i18n';
6
- import { TRANSLATIONS } from './translations';
7
-
8
- export let userid:string;
9
- export let sessionid:string;
10
- export let endpoint:string;
11
- export let lang:string = 'en';
12
- export let clientstyling:string;
13
- export let clientstylingurl:string;
14
- export let translationurl:string;
15
- export let custominputtextswitch:string = 'false';
16
-
17
- let customStylingContainer:HTMLElement;
18
- let isLoading:boolean = true;
19
- let noPlayerData:boolean = true;
20
- const isMobile:boolean = (getDevice(window.navigator.userAgent) === 'PC') ? false : true;
21
-
22
- let prefixesArray:Array<Record<string, string>> = null;
23
- let countriesArray:Array<Record<string, string>> = null;
24
- let profileInfo:Record<string, any> = null;
25
- let profileConsent:Array<Record<string, string>> = null;
26
-
27
- let initialConsentValues:string;
28
- let initialEditableValues:string;
29
- const updatedEditableValues:Record<string, any> = {};
30
- const readOnlyValues:Record<string, string> = {};
31
- const defaultValues:any = {
32
- address1: "i.e.: Glanmire Rd.",
33
- birth: '01/01/1990',
34
- city: "i.e.: Cork",
35
- currency: "EUR",
36
- iban: "",
37
- email: "email@here.com",
38
- firstname: "Joe",
39
- userTitles: "M",
40
- lastname: "Johnson",
41
- mobile: {prefix: "+00", number: "00000000"},
42
- postalCode: "i.e.: 465531",
43
- securityAnswer: "i.e.: Jerry",
44
- securityQuestion: "i.e.: Pet name?",
45
- title: "",
46
- username: "Username"
47
- };
48
-
49
- let hasProfileInfoChanged:boolean = false;
50
- let hasProfileConsentChanged:boolean = false;
51
- let isValid:boolean = true;
52
- let isCityValid:boolean = true;
53
- let isPostalCodeValid:boolean = true;
54
- let isAddressValid:boolean = true;
55
- let isSecurityQuestionValid:boolean = true;
56
- let isSecurityAnswerValid:boolean = true;
57
- let isMobileValid:boolean = true;
58
- let showConfirmSave:boolean = false;
59
-
60
- const regexValidators:any = {
61
- document: /^(?=.*[a-zA-Z0-9])[a-zA-Z0-9\s]+$/
62
- }
63
-
64
- const mediaQuery = window.matchMedia('(min-width: 768px)');
65
-
66
- const safeStringify = (obj:Record<string, any>):string => {
67
- try { return JSON.stringify(obj); } catch { return null; }
68
- }
69
-
70
- const initPlayerInfoFields = ():void => {
71
- readOnlyValues.username = profileInfo.username;
72
- readOnlyValues.mobile = profileInfo.mobile;
73
- readOnlyValues.email = profileInfo.email;
74
- readOnlyValues.firstname = profileInfo.firstname;
75
- readOnlyValues.lastname = profileInfo.lastname;
76
- readOnlyValues.language = profileInfo.language;
77
- readOnlyValues.birth = profileInfo.birth?.day + '/' + profileInfo.birth?.month + '/' + profileInfo.birth?.year;
78
- readOnlyValues.currency = profileInfo.currency;
79
- readOnlyValues.iban = profileInfo.iban;
80
- readOnlyValues.userTitles = profileInfo.title;
81
- readOnlyValues.countryCode = profileInfo.country;
82
- readOnlyValues.countryName = countriesArray.find((country:any) => country.Alpha2Code === profileInfo.country)?.Name || 'I.E. Ireland';
83
-
84
- updatedEditableValues.address1 = profileInfo.address1;
85
- updatedEditableValues.city = profileInfo.city;
86
- updatedEditableValues.mobile = {};
87
- updatedEditableValues.mobile.prefix = profileInfo.mobile?.prefix;
88
- updatedEditableValues.mobile.number = profileInfo.mobile?.number;
89
- updatedEditableValues.postalCode = profileInfo.postalCode;
90
- updatedEditableValues.securityAnswer = profileInfo.securityAnswer;
91
- updatedEditableValues.securityQuestion = profileInfo.securityQuestion;
92
-
93
- if (Array.isArray(profileConsent)) {
94
- profileConsent.forEach((item) => {
95
- if (item.tagCode === 'emailmarketing') {
96
- updatedEditableValues.acceptNewsEmail = item.status === 'Accepted';
97
- } else if (item.tagCode === 'sms') {
98
- updatedEditableValues.acceptSMSOffers = item.status === 'Accepted';
99
- }
100
- });
101
- }
102
-
103
- initialEditableValues = safeStringify(updatedEditableValues);
104
- initialConsentValues = safeStringify(new Object({
105
- acceptNewsEmail: updatedEditableValues.acceptNewsEmail,
106
- acceptSMSOffers: updatedEditableValues.acceptSMSOffers
107
- }));
108
-
109
- noPlayerData = false;
110
- isLoading = false;
111
- }
112
-
113
- const getUserProfileInfo = ():void => {
114
- const url:URL = new URL(`${endpoint}/v1/player/${userid}/profile`);
115
- const headers:HeadersInit = new Headers();
116
-
117
- headers.append('X-SessionID', sessionid);
118
-
119
- const options:RequestInit = {
120
- method: "GET",
121
- headers: headers
122
- };
123
-
124
- fetch(url.href, options)
125
- .then((res:any) => { return res.json(); })
126
- .then((data:any) => {
127
- profileInfo = data;
128
- }, (err:any) => {
129
- console.error(err);
130
- });
131
- }
132
-
133
- const getUserProfileConsent = ():void => {
134
- const url:URL = new URL(`${endpoint}/v1/player/${userid}/consent`);
135
- const headers:HeadersInit = new Headers();
136
-
137
- headers.append('X-SessionID', sessionid);
138
-
139
- const options = {
140
- method: "GET",
141
- headers: headers
142
- };
143
-
144
- fetch(url.href, options)
145
- .then((res:any) => { return res.json(); })
146
- .then((data:any) => {
147
- profileConsent = data.items;
148
- }, (err:any) => {
149
- console.error(err);
150
- });
151
- }
152
-
153
- const getCountriesList = ():void => {
154
- fetch(`${endpoint}/v1/player/countries`)
155
- .then((res:any) => {
156
- if (res.status >= 300) {
157
- return new Error('Error while fetching the countries');
158
- }
159
- return res.json();
160
- })
161
- .then((countryList:any) => {
162
- fetch(`${endpoint}/v1/player/operatorSupportedCountries`).then((res:any) => {
163
- if (res.status >= 300) {
164
- return new Error('Error while fetching the supported countries');
165
- }
166
- return res.json();
167
- })
168
- .then((supportedCountries:any) => {
169
- countriesArray = countryList.countries.filter((item:any) => {
170
- return supportedCountries.countries.indexOf(item.Alpha2Code) >= 0;
171
- });
172
- });
173
- });
174
- }
175
-
176
- const getPhoneCodes = ():void => {
177
- fetch(`${endpoint}/v1/player/phonecodes`)
178
- .then((res:any) => res.json())
179
- .then(data => {
180
- prefixesArray = data.phoneCodes;
181
- });
182
- }
183
-
184
- const validateAllFields = ():void => {
185
- isValid = false;
186
- if (isSecurityQuestionValid && isSecurityAnswerValid && isCityValid && isAddressValid && isPostalCodeValid && isMobileValid) {
187
- isValid = true;
188
- }
189
- }
190
-
191
- const checkForChanges = ():void => {
192
- hasProfileInfoChanged = safeStringify(updatedEditableValues) !== initialConsentValues;
193
- }
194
-
195
- const checkForConsentChanges = ():void => {
196
- const c = new Object({
197
- acceptNewsEmail: updatedEditableValues.acceptNewsEmail,
198
- acceptSMSOffers: updatedEditableValues.acceptSMSOffers
199
- });
200
- hasProfileConsentChanged = safeStringify(c) !== initialConsentValues;
201
- }
202
-
203
- const validateAndCheckForChanges = (key:string):void => {
204
- switch (key) {
205
- case 'mobileNumber':
206
- isMobileValid = false;
207
- if(updatedEditableValues.mobile.number && updatedEditableValues.mobile.number.length >= 5 && updatedEditableValues.mobile.number.length <= 12) {
208
- isMobileValid = true;
209
- }
210
- break;
211
-
212
- case 'city':
213
- isCityValid = false;
214
- if (updatedEditableValues.city && updatedEditableValues.city.length <= 50) {
215
- isCityValid = true;
216
- }
217
- break;
218
-
219
- case 'postalCode':
220
- isPostalCodeValid = false;
221
- if (updatedEditableValues.postalCode && updatedEditableValues.postalCode.length <= 20) {
222
- isPostalCodeValid = true;
223
- }
224
- break;
225
-
226
- case 'address':
227
- isAddressValid = false;
228
- if(updatedEditableValues.address1 && updatedEditableValues.address1.length <= 100) {
229
- isAddressValid = true;
230
- }
231
- break;
232
-
233
- case 'securityQuestion':
234
- isSecurityQuestionValid = false;
235
- if (updatedEditableValues.securityQuestion)
236
- switch(custominputtextswitch) {
237
- case 'true':
238
- if (regexValidators.document.test(updatedEditableValues.securityQuestion) && updatedEditableValues.securityQuestion.length <= 50) {
239
- isSecurityQuestionValid = true;
240
- }
241
- break;
242
-
243
- case 'false':
244
- if (updatedEditableValues.securityQuestion && updatedEditableValues.securityQuestion.length <= 120) {
245
- isSecurityQuestionValid = true;
246
- }
247
- break;
248
- }
249
- break;
250
-
251
- case 'securityAnswer':
252
- isSecurityAnswerValid = false;
253
- if (updatedEditableValues.securityAnswer)
254
- switch(custominputtextswitch) {
255
- case 'true':
256
- if (regexValidators.document.test(updatedEditableValues.securityAnswer) && updatedEditableValues.securityAnswer.length <= 50) {
257
- isSecurityAnswerValid = true;
258
- }
259
- break;
260
-
261
- case 'false':
262
- if (updatedEditableValues.securityAnswer && updatedEditableValues.securityAnswer.length <= 120) {
263
- isSecurityAnswerValid = true;
264
- }
265
- break;
266
- }
267
- break;
268
-
269
- case 'acceptSMSOffers':
270
- checkForConsentChanges();
271
- break;
272
-
273
- case 'acceptNewsEmail':
274
- checkForConsentChanges();
275
- break;
276
-
277
- }
278
- checkForChanges();
279
- validateAllFields();
280
- }
281
-
282
- const showSuccessMessage = ():void => {
283
- showConfirmSave = true;
284
- setTimeout(() => {showConfirmSave = false;}, 3000);
285
- window.postMessage({ type: 'WidgetNotification', data: {type: 'success', message: $_('profileUpdateSuccess')}}, window.location.href);
286
- }
287
-
288
- const showErrorMessage = ():void => {
289
- window.postMessage({ type: 'WidgetNotification', data: {type: 'error', message: $_('userProfileUpdateError')}}, window.location.href);
290
- }
291
-
292
- const updatePlayerInfoAndConsent = (e:any):void => {
293
- e.preventDefault();
294
-
295
- if (hasProfileInfoChanged && !hasProfileConsentChanged && isValid) {
296
- updateProfileInfo().then((success:boolean) => {
297
- if (success) {
298
- getUserProfileInfo();
299
- showSuccessMessage();
300
- }
301
- });
302
- return;
303
- }
304
- if (hasProfileInfoChanged && hasProfileConsentChanged && isValid) {
305
- updateProfileInfo();
306
- updateProfileConsent();
307
-
308
- Promise.all([updateProfileInfo(), updateProfileConsent()]).then((success:Array<boolean>) => {
309
- if (success[0] && success[1]) {
310
- getUserProfileInfo();
311
- getUserProfileConsent();
312
- showSuccessMessage();
313
- hasProfileInfoChanged = false;
314
- hasProfileConsentChanged = false;
315
- } else {
316
- showErrorMessage();
317
- }
318
- });
319
- return;
320
- }
321
- }
322
-
323
- const updateProfileInfo = async ():Promise<boolean> => {
324
-
325
- const url:URL = new URL(`${endpoint}/v1/player/${userid}/profile`);
326
- const headers:HeadersInit = new Headers();
327
-
328
- headers.append('X-SessionID', sessionid);
329
- headers.append('Content-Type', 'application/json');
330
- headers.append('Accept', 'application/json');
331
-
332
- const body = safeStringify(updatedEditableValues);
333
- if (body === null) {
334
- return false;
335
- }
336
-
337
- let options:RequestInit = {
338
- method: "POST",
339
- headers: headers,
340
- body: body
341
- };
342
-
343
- return await fetch(url.href, options).then((res:any) => res.status == 200, (err) => {console.error(err); return false});
344
- }
345
-
346
- const updateProfileConsent = async ():Promise<boolean> => {
347
- const updatedProfileConsent = [
348
- {tagCode: 'sms', status: (updatedEditableValues.acceptSMSOffers ? 'Accepted' : 'Denied')},
349
- {tagCode: 'emailmarketing', status: (updatedEditableValues.acceptNewsEmail ? 'Accepted' : 'Denied')}
350
- ];
351
-
352
- const url:URL = new URL(`${endpoint}/v1/player/${userid}/consent`);
353
- const headers:HeadersInit = new Headers();
354
-
355
- headers.append('X-SessionID', sessionid);
356
- headers.append('Content-Type', 'application/json');
357
- headers.append('Accept', 'application/json');
358
-
359
- const body = safeStringify({items: updatedProfileConsent});
360
- if (body === null) {
361
- return false;
362
- }
363
-
364
- const options:RequestInit = {
365
- method: "POST",
366
- headers: headers,
367
- body: body
368
- };
369
-
370
- return await fetch(url.href, options).then((res:any) => res.status == 200, (err) => {console.error(err); return false});
371
- }
372
-
373
- const toggleScreen = ():void => {
374
- window.postMessage({type: 'PlayerAccountMenuActive', isMobile}, window.location.href);
375
- }
376
-
377
- const setActiveLanguage = ():void => {
378
- setLocale(lang);
379
- }
380
-
381
- const setClientStyling = ():void => {
382
- let sheet:HTMLElement = document.createElement('style');
383
- sheet.innerHTML = clientstyling;
384
- customStylingContainer.appendChild(sheet);
385
- }
386
-
387
- const setClientStylingURL = ():void => {
388
- let url:URL = new URL(clientstylingurl);
389
- let cssFile:HTMLElement = document.createElement('style');
390
-
391
- fetch(url.href)
392
- .then((res:any) => res.text())
393
- .then((data:any) => {
394
- cssFile.innerHTML = data
395
-
396
- setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
397
- });
398
- }
399
-
400
- const setTranslationUrl = ():void => {
401
- const url:string = translationurl;
402
-
403
- fetch(url).then((res:any) => res.json())
404
- .then((res) => {
405
- Object.keys(res).forEach((item:any):void => {
406
- addNewMessages(item, res[item]);
407
- });
408
- }).catch((err:any) => {
409
- console.log(err);
410
- });
411
- }
412
-
413
- Object.keys(TRANSLATIONS).forEach((item:any) => {
414
- addNewMessages(item, TRANSLATIONS[item]);
415
- });
416
-
417
- $: endpoint && userid && sessionid && getUserProfileInfo();
418
- $: endpoint && userid && sessionid && getUserProfileConsent();
419
- $: endpoint && getCountriesList();
420
- $: endpoint && getPhoneCodes();
421
- $: profileInfo && profileConsent && countriesArray && initPlayerInfoFields();
422
- $: lang && setActiveLanguage();
423
- $: clientstylingurl && customStylingContainer && setClientStylingURL();
424
- $: clientstyling && customStylingContainer && setClientStyling();
425
- $: translationurl && setTranslationUrl();
426
- </script>
427
-
428
- <div bind:this={customStylingContainer}>
429
- {#if isLoading}
430
- <div class="ModalLoader"></div>
431
- {:else}
432
- <form class="PlayerInfoWrapper {isMobile ? 'PlayerInfoWrapperMobile' : ''} {mediaQuery.matches && isMobile ? 'PlayerInfoWrapperTablet' : ''}">
433
-
434
- {#if isMobile}
435
- <div class="MenuReturnButton" on:click={toggleScreen} on:keyup={null}>
436
- <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><defs><style>.aaa{fill:var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));}</style></defs><g transform="translate(-20 -158)">
437
- <g transform="translate(20 158)">
438
- <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)"/>
439
- </g></g>
440
- </svg>
441
- <h2 class="MyAccountCategoryTitleMobile">{$_('titleProfileInfo')}</h2>
442
- </div>
443
- {/if}
444
-
445
- <h2 class="MyAccountCategoryTitle {isMobile ? 'MyAccountCategoryTitleNone' : ''}">{$_('titleProfileInfo')}</h2>
446
-
447
- <div class="PlayerNotificationsHeader">
448
- <h3>{$_('personalDetails')}</h3>
449
- </div>
450
- <section class="PlayerDetailsContent">
451
- <div class="PlayerInfoBox">
452
- <p>{$_('userName')}</p>
453
- <input type="text" class="FieldDisabled" value={readOnlyValues.username} readonly />
454
- </div>
455
- <div class="PlayerInfoBox {isMobileValid ? '' : 'InvalidField'}">
456
- <p>{$_('userPhone')}</p>
457
- <div class="PlayerPhoneNumber">
458
- <select bind:value={updatedEditableValues.mobile.prefix} on:change={checkForChanges}>
459
- {#each prefixesArray as pref}
460
- {#if pref.Prefix === updatedEditableValues.mobile.prefix}
461
- <option selected>{pref.Prefix}</option>
462
- {:else}
463
- <option>{pref.Prefix}</option>
464
- {/if}
465
- {/each}
466
- </select>
467
- <input type="text" bind:value={updatedEditableValues.mobile.number} on:keyup={() => validateAndCheckForChanges('mobileNumber')} on:input={updatedEditableValues.mobile.number = updatedEditableValues.mobile.number.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1')} placeholder={defaultValues.mobile.number}/>
468
- </div>
469
- {#if !isMobileValid}
470
- <p class="InvalidInput">{$_('userPhoneError')}</p>
471
- {/if}
472
- </div>
473
- <div class="PlayerInfoBox {isSecurityQuestionValid ? '' : 'InvalidField'}">
474
- <label for="SecurityQuestion">{custominputtextswitch == 'true' ? $_('profileSecurityQuestion2') : $_('profileSecurityQuestion')}:<span class="FormRequired">*</span></label>
475
- <input id="SecurityQuestion" type="text" bind:value={updatedEditableValues.securityQuestion} on:keyup={() => validateAndCheckForChanges('securityQuestion')} placeholder={defaultValues.securityQuestion} />
476
- {#if !isSecurityQuestionValid}
477
- <p class="InvalidInput">{custominputtextswitch == 'true' ? $_('profileSecurityQuestionError2') : $_('profileSecurityQuestionError')}</p>
478
- {/if}
479
- </div>
480
- <div class="PlayerInfoBox {isSecurityAnswerValid ? '' : 'InvalidField'}">
481
- <label for="SecurityAnswer">{custominputtextswitch == 'true' ? $_('profileSecurityAnswer2') : $_('profileSecurityAnswer')}:<span class="FormRequired">*</span></label>
482
- <input id="SecurityAnswer" type="text" bind:value={updatedEditableValues.securityAnswer} on:keyup={() => validateAndCheckForChanges('securityAnswer')} placeholder={defaultValues.securityAnswer} />
483
- {#if !isSecurityAnswerValid}
484
- <p class="InvalidInput">{custominputtextswitch == 'true' ? $_('profileSecurityAnswerError2') : $_('profileSecurityAnswerError')}</p>
485
- {/if}
486
- </div>
487
- <div class="PlayerInfoBox">
488
- <label for="UserEmail">{$_('userEmail')}</label>
489
- <input id="UserEmail" type="email" class="FieldDisabled" value={readOnlyValues.email} readonly />
490
- </div>
491
- <div class="PlayerInfoBox">
492
- <label for="DateOfBirth">{$_('dateOfBirth')}</label>
493
- <input id="DateOfBirth" type="text" class="FieldDisabled" value={readOnlyValues.birth} readonly />
494
- </div>
495
- <div class="PlayerInfoBox">
496
- <label for="FirstName">{$_('firstName')}</label>
497
- <input id="FirstName" type="text" class="FieldDisabled" value={readOnlyValues.firstname} readonly />
498
- </div>
499
- <div class="PlayerInfoBox">
500
- <label for="LastName">{$_('lastName')}</label>
501
- <input id="LastName" type="text" class="FieldDisabled" value={readOnlyValues.lastname} readonly />
502
- </div>
503
- <div class="PlayerInfoBox">
504
- <label for="UserTitle">{$_('userTitle')}</label>
505
- <input id="UserTitle" type="text" class="FieldDisabled" value={readOnlyValues.userTitles} readonly />
506
- </div>
507
- <div class="PlayerInfoBox">
508
- <label for="Currrency">{$_('currency')}</label>
509
- <input id="Currency" type="text" class="FieldDisabled" value={readOnlyValues.currency} readonly />
510
- </div>
511
- {#if readOnlyValues.iban}
512
- <div class="PlayerInfoBox">
513
- <label for="Iban">{$_('iban')}</label>
514
- <input id="Iban" type="text" class="FieldDisabled" value={readOnlyValues.iban} readonly />
515
- </div>
516
- {/if}
517
- </section>
518
-
519
- <div class="PlayerLocationHeader">
520
- <h3>{$_('locationDetails')}</h3>
521
- </div>
522
- <section class="PlayerLocationContent">
523
- <div class="PlayerInfoBox">
524
- <label for="UserCountry">{$_('userCountry')}</label>
525
- <input id="UserCountry" type="text" class="PlayerCountry FieldDisabled" value={readOnlyValues.countryName} placeholder={readOnlyValues.countryCode} readonly />
526
- </div>
527
- <div class="PlayerInfoBox {isCityValid ? '' : 'InvalidField'}">
528
- <label for="UserCity">{$_('userCity')}</label>
529
- <input id="UserCity" type="text" bind:value={updatedEditableValues.city} on:keyup={() => validateAndCheckForChanges('city')} placeholder={defaultValues.city}/>
530
- {#if !isCityValid}
531
- <p class="InvalidInput">{$_('userCityError')}</p>
532
- {/if}
533
- </div>
534
- <div class="PlayerInfoBox {isAddressValid ? '' : 'InvalidField'}">
535
- <label for="UserAdress">{$_('userAddress')}</label>
536
- <input id="UserAdress" type="text" bind:value={updatedEditableValues.address1} on:keyup={() => validateAndCheckForChanges('address')} placeholder={defaultValues.adress}/>
537
- {#if !isAddressValid}
538
- <p class="InvalidInput">{$_('userAddressError')}</p>
539
- {/if}
540
- </div>
541
- <div class="PlayerInfoBox {isPostalCodeValid ? '' : 'InvalidField'}">
542
- <label for="UserPostalCode">{$_('userPostalCode')}</label>
543
- <input id="UserPostalCode" type="text" bind:value={updatedEditableValues.postalCode} on:keyup={() => validateAndCheckForChanges('postalCode')} placeholder={defaultValues.postalCode}/>
544
- {#if !isPostalCodeValid}
545
- <p class="InvalidInput">{$_('userPostalCodeError')}</p>
546
- {/if}
547
- </div>
548
- </section>
549
-
550
- {#if updatedEditableValues.acceptSMSOffers !== undefined || updatedEditableValues.acceptNewsEmail !== undefined}
551
- <div class="PlayerNotificationsHeader">
552
- <h3>{$_('userNotifications')}</h3>
553
- </div>
554
- <section class="PlayerNotificationsCheckboxArea">
555
- {#if updatedEditableValues.acceptSMSOffers !== undefined}
556
- <div class="PlayerNotificationBox">
557
- <label for="SMSNotification">
558
- <input bind:checked={updatedEditableValues.acceptSMSOffers} on:change={() => validateAndCheckForChanges('acceptSMSOffers')} type="checkbox" id="SMSNotification" name="Enable SMS notifications" />
559
- <span class="Checkmark"></span>
560
- <span>{$_('userSMSNotification')}</span>
561
- </label>
562
- </div>
563
- {/if}
564
- {#if updatedEditableValues.acceptNewsEmail !== undefined}
565
- <div class="PlayerNotificationBox">
566
- <label for="EmailNotification">
567
- <input bind:checked={updatedEditableValues.acceptNewsEmail} on:change={() => validateAndCheckForChanges('acceptNewsEmail')} type="checkbox" id="EmailNotification" name="Enable Emails" />
568
- <span class="Checkmark"></span>
569
- <span>{$_('userEmailNotification')}</span>
570
- </label>
571
- </div>
572
- {/if}
573
- </section>
574
- {/if}
575
- <section class="PlayerDetailsButtonsArea {isMobile ? 'PlayerDetailsButtonsAreaMobile' : ''}" >
576
- <button class="PlayerDetailsSaveButton {hasProfileInfoChanged && isValid ? '' : 'PlayerButtonDisabled'}" on:click={updatePlayerInfoAndConsent}>{$_('userProfileSaveChanges')}</button>
577
- </section>
578
- {#if showConfirmSave}
579
- <section class="PlayerDetailsConfirmSave">
580
- <p class="PlayerDetailsConfirmSaveText">{$_('userProfileConfirmationMessage')}</p>
581
- </section>
582
- {/if}
583
- </form>
584
- {/if}
585
- </div>
586
-
587
- <style lang="scss">
588
-
589
- button {
590
- font-family: var(--emw--button-typography);
591
- }
592
-
593
- input, select, option {
594
- font-family: inherit;
595
- }
596
-
597
-
598
- .MyAccountCategoryTitle {
599
- font-size: var(--emw--font-size-x-large, 26px);
600
- color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
601
- font-weight: var(--emw--font-weight-semibold, 500);
602
- }
603
-
604
- .MyAccountCategoryTitleMobile {
605
- font-size: var(--emw--size-standard, 16px);
606
- color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
607
- }
608
-
609
- .MyAccountCategoryTitleNone {
610
- display: none;
611
- }
612
-
613
- .PlayerInfoWrapper {
614
- color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));
615
- background: var(--emw-color-pale, var(--emw--color-gray-50, #F1F1F1));
616
- padding: 50px;
617
- height: 100%;
618
- border-radius: 20px;
619
- }
620
-
621
- .PlayerNotificationsHeader, .PlayerDetailsHeader, .PlayerLocationHeader {
622
- h3 {
623
- font-size: var(--emw--size-standard, 16px);
624
- color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
625
- text-transform: capitalize;
626
- font-weight: var(--emw--font-weight-semibold, 500);
627
- }
628
- }
629
-
630
- .PlayerDetailsContent {
631
- display: grid;
632
- grid-column-gap: 50px;
633
- grid-row-gap: 24px;
634
- grid-template-rows: auto;
635
- grid-template-columns: 1fr 1fr;
636
- padding-bottom: 30px;
637
- }
638
-
639
- .MenuReturnButton{
640
- color: var(--emw-color-gray-300, #58586B);
641
- display: inline-flex;
642
- align-items: center;
643
- column-gap: 10px;
644
- margin-bottom: 10px;
645
- }
646
-
647
- .PlayerInfoBox {
648
- display: flex;
649
- flex-direction: column;
650
- label {
651
- font-size: var(--emw--size-small, 14px);
652
- font-weight: var(--emw--font-weight-semibold, 500);
653
- margin-bottom: 10px;
654
- }
655
- input {
656
- font-size: var(--emw--size-small, 14px);
657
- font-weight: var(--emw--font-weight-light, 300);
658
- color: var(--emw--pam-contrast, var(--emw-color-contrast, #07072A));
659
- padding: 10px;
660
- line-height: 16px;
661
- background: var(--emw-color-white, #FFFFFF);
662
- outline: none;
663
- transition-duration: 0.3s;
664
- border: 1px solid var(--emw--color-gray-100, #353535);
665
- border-radius: 10px;
666
-
667
- &:focus, :focus-within, :focus-visible, :visited {
668
- border: 1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
669
- box-shadow: 0 0 0 1pt var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
670
- }
671
- }
672
-
673
- &.InvalidField {
674
- input {
675
- border: 1px solid var(--emw-color-error, var(--emw-color-red, #FD2839));
676
- background: var(--emw-color-pale, #FBECF4);
677
- color: var(--emw-color-error, var(--emw-color-red, #FD2839));
678
- }
679
- }
680
-
681
- .InvalidInput {
682
- color: var(--emw-color-error, var(--emw-color-red, #FD2839));
683
- font-size: 10px;
684
- line-height: 10px;
685
- }
686
-
687
-
688
- .FieldDisabled {
689
- opacity: 0.5;
690
- }
691
- .PlayerPhoneNumber {
692
- display: grid;
693
- grid-template-columns: 2fr 4fr;
694
- column-gap: 10px;
695
- position: relative;
696
- }
697
- select {
698
- font-size: var(--emw--size-small, 14px);
699
- font-weight: var(--emw--font-weight-light, 300);
700
- padding: 10px;
701
- color: var(--emw--pam-contrast, var(--emw-color-contrast, #07072A));
702
- border: 1px solid var(--emw--color-gray-100, #353535);
703
- border-radius: 10px;
704
- outline: none;
705
- transition-duration: 0.3s;
706
- -webkit-appearance: none;
707
- -moz-appearance: none;
708
- appearance: none;
709
- background: url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='%23000000' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat var(--emw-color-white, #FFFFFF);
710
- background-position: calc(100% - 0.75rem) center;
711
- &:focus, :focus-within, :focus-visible, :visited {
712
- border: 1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
713
- box-shadow: 0 0 0 1pt var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
714
- }
715
- }
716
- /* Chrome, Safari, Edge, Opera */
717
- input::-webkit-outer-spin-button,
718
- input::-webkit-inner-spin-button {
719
- -webkit-appearance: none;
720
- margin: 0;
721
- }
722
-
723
- /* Firefox */
724
- input[type=number] {
725
- -moz-appearance: textfield;
726
- appearance: textfield;
727
- }
728
- }
729
-
730
- .PlayerLocationContent {
731
- display: grid;
732
- grid-column-gap: 50px;
733
- grid-row-gap: 24px;
734
- grid-template-rows: auto;
735
- grid-template-columns: 1fr 1fr;
736
- padding-bottom: 30px;
737
- }
738
-
739
- .PlayerNotificationBox {
740
- &:first-child {
741
- margin-bottom: 10px;
742
- }
743
- label {
744
- display: inline-flex;
745
- position: relative;
746
- align-items: center;
747
- span {
748
- font-size: var(--emw--size-small, 14px);
749
- font-weight: var(--emw--font-weight-light, 300);
750
- }
751
- input {
752
- height: 20px;
753
- width: 20px;
754
- -webkit-appearance: none;
755
- -moz-appearance: none;
756
- -o-appearance: none;
757
- appearance: none;
758
- border-radius: 50px;
759
- outline: none;
760
- transition-duration: 0.3s;
761
- background-color: var(--emw-color-gray-100, #E6E6E6);
762
- cursor: pointer;
763
- margin-right: 10px;
764
- }
765
- input:checked {
766
- background-color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
767
- }
768
- .Checkmark {
769
- left: 10px;
770
- top: 7px;
771
- width: 4px;
772
- height: 8px;
773
- border: solid var(--emw-color-white, #FFFFFF);
774
- border-width: 0 2px 2px 0;
775
- -webkit-transform: rotate(45deg);
776
- -ms-transform: rotate(45deg);
777
- transform: rotate(45deg);
778
- position: absolute;
779
- }
780
- }
781
- }
782
-
783
- .PlayerDetailsButtonsArea {
784
- grid-column-gap: 10px;
785
- grid-template-rows: auto;
786
- grid-template-columns: 1fr;
787
- margin-top: 20px;
788
- width: 50%;
789
-
790
- .PlayerDetailsSaveButton, .PlayerDetailsCancelButton {
791
- cursor: pointer;
792
- border-radius: 5px;
793
- display: flex;
794
- align-items: center;
795
- justify-content: center;
796
- font-size: var(--emw--size-standard, 16px);
797
- color: var(--emw--pam-contrast, var(--emw-color-contrast, #07072A));
798
- text-transform: uppercase;
799
- transition-duration: 0.3s;
800
- box-sizing: border-box;
801
- max-width: 400px;
802
- min-width: 200px;
803
- }
804
- .PlayerDetailsSaveButton {
805
- 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%));
806
- border: 2px solid var(--emw--button-border-color, #0E5924);
807
- color: var(--emw--button-text-color, #FFFFFF);
808
- border-radius: var(--emw--button-border-radius, 50px);
809
- max-width: 400px;
810
- min-width: 200px;
811
- padding: 13px 0;
812
- width: 100%;
813
-
814
- &:active {
815
- background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
816
- }
817
- &.PlayerButtonDisabled {
818
- opacity: 0.3;
819
- cursor: not-allowed;
820
- }
821
- }
822
-
823
- .PlayerDetailsCancelButton {
824
- background: transparent;
825
- border: 1px solid var(--emw-color-gray-300, #58586B);
826
- &:active {
827
- background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
828
- }
829
- &.PlayerButtonDisabled {
830
- background: transparent;
831
- border: 1px solid var(--emw-color-gray-300, #58586B);
832
- cursor: not-allowed;
833
- opacity: 0.6;
834
- }
835
- }
836
- &.PlayerDetailsButtonsAreaMobile {
837
- width: 100%;
838
- grid-template-columns: 1fr 1fr;
839
- .PlayerDetailsSaveButton, .PlayerDetailsCancelButton {
840
- height: 40px;
841
- font-size: var(--emw--size-x-small, 12px);
842
- }
843
- }
844
- }
845
-
846
- .PlayerNotificationsCheckboxArea {
847
- padding-bottom: 30px;
848
- }
849
-
850
- .PlayerInfoWrapperMobile {
851
- padding: 20px 15px;
852
- background: var(--emw-color-gray-50, #F9F8F8);
853
- max-width: unset;
854
- border-radius: 0;
855
- .PlayerDetailsContent {
856
- grid-template-columns: 1fr;
857
- }
858
- .PlayerNotificationsHeader, .PlayerDetailsHeader, .PlayerLocationHeader {
859
- h3 {
860
- color: ar(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));
861
- font-size: var(--emw--size-small, 14px);
862
- font-weight: var(--emw--font-weight-semibold, 500);
863
- }
864
- }
865
- .PlayerInfoBox {
866
- label {
867
- color: var(--emw-color-gray-300, #58586B);
868
- font-size: var(--emw--size-x-small, 12px);
869
- font-weight: var(-emw--font-weight-normal, 400);
870
- }
871
- input {
872
- color: var(--emw-color-gray-300, #58586B);
873
- font-size: var(--emw--size-x-small, 12px);
874
- font-weight: var(--emw--font-weight-light, 300);
875
- }
876
- select {
877
- color: var(--emw-color-gray-300, #58586B);
878
- }
879
- }
880
- .PlayerLocationContent {
881
- grid-template-columns: 1fr;
882
- }
883
- .PlayerNotificationsCheckboxArea {
884
- .PlayerNotificationBox {
885
- label {
886
- color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));
887
- font-size: var(--emw--size-x-small, 12px);
888
- font-weight: var(--emw--font-weight-light, 300);
889
- }
890
- }
891
- }
892
- .PlayerDetailsButtonsArea {
893
- grid-column-gap: 10px;
894
- }
895
- .PlayerDetailsSaveButton, .PlayerDetailsCancelButton {
896
- font-size: var(--emw--size-x-small, 12px);
897
- height: 40px;
898
- color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));
899
- &.PlayerButtonDisabled {
900
- color: var(--emw-color-gray-300, #58586B);
901
- }
902
- }
903
- .PlayerDetailsCancelButton {
904
- color: var(--emw-color-gray-300, #58586B);
905
- }
906
- }
907
-
908
- .PlayerInfoWrapperTablet {
909
- padding: 40px 25% 40px 25%;
910
- .PlayerDetailsContent {
911
- grid-row-gap: 20px;
912
- }
913
- .MenuReturnButton {
914
- margin-bottom: 30px;
915
- span {
916
- font-size: var(--emw--font-size-large, 20px);
917
- }
918
- }
919
- .PlayerDetailsHeader, .PlayerLocationHeader, .PlayerNotificationsHeader {
920
- h3 {
921
- font-size: 24px;
922
- }
923
- }
924
- .PlayerInfoBox {
925
- label {
926
- font-size: var(--emw--font-size-large, 20px);
927
- }
928
- input {
929
- height: 30px;
930
- font-size: var(--emw--font-size-large, 20px);
931
- line-height: 30px;
932
- }
933
- select {
934
- font-size: var(--emw--font-size-large, 20px);
935
- }
936
- .TogglePasswordVisibility {
937
- width: 30px;
938
- top: 26px;
939
- }
940
- .InvalidInput {
941
- font-size: var(--emw--size-standard, 16px);
942
- bottom: - 50px;
943
- }
944
- &:last-child {
945
- .InvalidInput {
946
- font-size: var(--emw--size-standard, 16px);
947
- bottom: -50px;
948
- }
949
- }
950
- }
951
- .PlayerDetailsButtonsArea {
952
- font-family: var(--emw--button-typography);
953
- grid-column-gap: 40px;
954
- .PlayerDetailsSaveButton, .PlayerDetailsCancelButton {
955
- font-size: var(--emw--font-size-large, 20px);
956
- height: 56px;
957
- }
958
- .PlayerDetailsSaveButton {
959
- color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));
960
- &.PlayerButtonDisabled {
961
- color: var(--emw-color-gray-300, #58586B);
962
- }
963
- }
964
- }
965
- .PlayerNotificationBox {
966
- label {
967
- span {
968
- font-size: var(--emw--font-size-large, 20px);
969
- }
970
- input {
971
- height: 26px;
972
- width: 26px;
973
- }
974
- .Checkmark {
975
- left: 50px;
976
- top: 9px;
977
- }
978
- }
979
- }
980
- }
981
- .PlayerDetailsConfirmSave {
982
- background: var(--emw-color-valid, var(--emw-color-green, #48952a));
983
- color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));
984
- padding: 16px;
985
- border-radius: 5px;
986
- margin-top: 16px;
987
- .PlayerDetailsConfirmSaveText {
988
- padding: 0;
989
- margin: 0;
990
- }
991
- }
992
- </style>