@everymatrix/user-funds-acknowledgment 0.0.1 → 0.0.3
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/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{user-funds-acknowledgment-93b40125.js → user-funds-acknowledgment-45da5541.js} +101 -16
- package/dist/cjs/user-funds-acknowledgment.cjs.entry.js +1 -1
- package/dist/cjs/user-funds-acknowledgment.cjs.js +1 -1
- package/dist/collection/components/user-funds-acknowledgment/user-funds-acknowledgment.css +2 -2
- package/dist/collection/components/user-funds-acknowledgment/user-funds-acknowledgment.js +154 -16
- package/dist/collection/utils/types.js +0 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{user-funds-acknowledgment-e5293ada.js → user-funds-acknowledgment-c9676919.js} +101 -16
- package/dist/esm/user-funds-acknowledgment.entry.js +1 -1
- package/dist/esm/user-funds-acknowledgment.js +1 -1
- package/dist/types/components/user-funds-acknowledgment/user-funds-acknowledgment.d.ts +8 -1
- package/dist/types/components.d.ts +6 -0
- package/dist/types/utils/types.d.ts +23 -0
- package/dist/user-funds-acknowledgment/index.esm.js +1 -1
- package/dist/user-funds-acknowledgment/user-funds-acknowledgment-c9676919.js +1 -0
- package/dist/user-funds-acknowledgment/user-funds-acknowledgment.entry.js +1 -1
- package/dist/user-funds-acknowledgment/user-funds-acknowledgment.esm.js +1 -1
- package/package.json +1 -1
- package/dist/user-funds-acknowledgment/user-funds-acknowledgment-e5293ada.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const userFundsAcknowledgment = require('./user-funds-acknowledgment-
|
|
5
|
+
const userFundsAcknowledgment = require('./user-funds-acknowledgment-45da5541.js');
|
|
6
6
|
require('./index-e7d6647a.js');
|
|
7
7
|
|
|
8
8
|
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["user-funds-acknowledgment.cjs",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
11
|
+
return index.bootstrapLazy([["user-funds-acknowledgment.cjs",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"userid":[1],"gmversion":[513],"totalcalculationmode":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"errorAmountMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
package/dist/cjs/{user-funds-acknowledgment-93b40125.js → user-funds-acknowledgment-45da5541.js}
RENAMED
|
@@ -282,7 +282,7 @@ const translate = (key, customLang, values) => {
|
|
|
282
282
|
return translation;
|
|
283
283
|
};
|
|
284
284
|
|
|
285
|
-
const userFundsAcknowledgmentCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserProtectionFundsTitle{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserProtectionFundsContainer{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:center;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid #
|
|
285
|
+
const userFundsAcknowledgmentCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserProtectionFundsTitle{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserProtectionFundsContainer{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:center;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid var(--emw--color-disabled, #58586B);color:var(--emw--color-disabled, #58586B);cursor:unset}.ButtonsWrapper{display:flex;flex-direction:column;margin-top:10px;gap:40px}.ButtonsWrapper button:only-child{margin-left:auto}.UserProtectionError{color:var(--emw--color-error, #FD2839);text-align:center;height:22px}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:var(--emw--button-text-color, #000000)}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";
|
|
286
286
|
const UserFundsAcknowledgmentStyle0 = userFundsAcknowledgmentCss;
|
|
287
287
|
|
|
288
288
|
const UserFundsAcknowledgment = class {
|
|
@@ -290,6 +290,89 @@ const UserFundsAcknowledgment = class {
|
|
|
290
290
|
index.registerInstance(this, hostRef);
|
|
291
291
|
this.abortController = null;
|
|
292
292
|
this.TIMEOUT_MS = 10000; // 10 seconds
|
|
293
|
+
this.currency = '';
|
|
294
|
+
this.getPlayerAccountBalanceDataCore = () => {
|
|
295
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userid}/account`);
|
|
296
|
+
fetch(url, { method: 'GET', headers: { 'X-SessionID': this.session } })
|
|
297
|
+
.then(res => {
|
|
298
|
+
if (!res.ok) {
|
|
299
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${res.status}`;
|
|
300
|
+
throw new Error(`Failed to fetch balance data: ${res.status}`);
|
|
301
|
+
}
|
|
302
|
+
return res.json();
|
|
303
|
+
})
|
|
304
|
+
.then((data) => {
|
|
305
|
+
var _a, _b;
|
|
306
|
+
if (!data.items || !Array.isArray(data.items)) {
|
|
307
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${data.status}`;
|
|
308
|
+
throw new Error('Unexpected data format: items array missing');
|
|
309
|
+
}
|
|
310
|
+
const casinoItem = data.items.find(b => b.displayName === 'Casino');
|
|
311
|
+
if (!(casinoItem === null || casinoItem === void 0 ? void 0 : casinoItem.currency)) {
|
|
312
|
+
throw new Error('No Casino item found in balance items');
|
|
313
|
+
}
|
|
314
|
+
this.currency = casinoItem.currency;
|
|
315
|
+
this.totalCashAmount = (_b = (_a = data.totalAmount) === null || _a === void 0 ? void 0 : _a[this.currency]) !== null && _b !== void 0 ? _b : 0;
|
|
316
|
+
})
|
|
317
|
+
.catch(err => {
|
|
318
|
+
if (!this.errorAmountMessage) {
|
|
319
|
+
this.errorAmountMessage = translate('serverNotResponding', this.language);
|
|
320
|
+
}
|
|
321
|
+
console.error('Balance error:', err);
|
|
322
|
+
})
|
|
323
|
+
.finally(() => {
|
|
324
|
+
this.isLoading = false;
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
this.getPlayerAccountBalanceData16 = () => {
|
|
328
|
+
const url = new URL(`${this.endpoint}/v2/player/${this.userid}/balance`);
|
|
329
|
+
const headers = new Headers();
|
|
330
|
+
headers.append('X-SessionID', this.session);
|
|
331
|
+
fetch(url, { method: 'GET', headers })
|
|
332
|
+
.then(res => {
|
|
333
|
+
if (!res.ok) {
|
|
334
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${res.status}`;
|
|
335
|
+
throw new Error(`Failed to fetch balance data: ${res.status}`);
|
|
336
|
+
}
|
|
337
|
+
return res.json();
|
|
338
|
+
})
|
|
339
|
+
.then((data) => {
|
|
340
|
+
var _a, _b;
|
|
341
|
+
if (!data.items || !Array.isArray(data.items)) {
|
|
342
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${data.status}`;
|
|
343
|
+
throw new Error('Unexpected data format: items array missing');
|
|
344
|
+
}
|
|
345
|
+
const firstRealOrdinary = data.items.find(item => item.type === 'Real' && item.walletAccountType === 'Ordinary');
|
|
346
|
+
if (!(firstRealOrdinary === null || firstRealOrdinary === void 0 ? void 0 : firstRealOrdinary.currency)) {
|
|
347
|
+
throw new Error('No Real/Ordinary wallet found in balance items');
|
|
348
|
+
}
|
|
349
|
+
this.currency = firstRealOrdinary.currency;
|
|
350
|
+
// Resolve calculation mode fallback
|
|
351
|
+
if (!data[this.totalcalculationmode]) {
|
|
352
|
+
this.totalcalculationmode = 'totalCashAmount';
|
|
353
|
+
}
|
|
354
|
+
this.totalCashAmount = (_b = (_a = data[this.totalcalculationmode]) === null || _a === void 0 ? void 0 : _a[this.currency]) !== null && _b !== void 0 ? _b : 0;
|
|
355
|
+
})
|
|
356
|
+
.catch(err => {
|
|
357
|
+
if (!this.errorAmountMessage) {
|
|
358
|
+
this.errorAmountMessage = translate('serverNotResponding', this.language);
|
|
359
|
+
}
|
|
360
|
+
console.error('Balance fetch error', err);
|
|
361
|
+
})
|
|
362
|
+
.finally(() => {
|
|
363
|
+
this.isLoading = false;
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
this.userLegislationConsentHandler = () => {
|
|
367
|
+
if (this.checkboxInput) {
|
|
368
|
+
this.isConsentChecked = this.checkboxInput.checked;
|
|
369
|
+
}
|
|
370
|
+
// In case of a network error, permit the user to retry consents submission
|
|
371
|
+
if (this.isConsentChecked) {
|
|
372
|
+
this.consentsSubmitted = false;
|
|
373
|
+
this.errorMessage = '';
|
|
374
|
+
}
|
|
375
|
+
};
|
|
293
376
|
/**
|
|
294
377
|
* Returns the formatted balance
|
|
295
378
|
* @param balance -> the balance value to be formatted
|
|
@@ -410,7 +493,6 @@ const UserFundsAcknowledgment = class {
|
|
|
410
493
|
// 202 Accepted has no body, skip res.json()
|
|
411
494
|
if (res.status === 202) {
|
|
412
495
|
this.errorMessage = '';
|
|
413
|
-
localStorage.removeItem("totalCashAmount");
|
|
414
496
|
window.postMessage({ type: 'ProtectionFundsAccepted' }, window.location.href);
|
|
415
497
|
return;
|
|
416
498
|
}
|
|
@@ -449,10 +531,14 @@ const UserFundsAcknowledgment = class {
|
|
|
449
531
|
this.customdisplayformat = '';
|
|
450
532
|
this.alwaysshowdecimals = 'true';
|
|
451
533
|
this.playercurrency = 'EUR';
|
|
452
|
-
this.
|
|
534
|
+
this.userid = undefined;
|
|
535
|
+
this.gmversion = 'gm16';
|
|
536
|
+
this.totalcalculationmode = 'totalCashAmount';
|
|
537
|
+
this.isLoading = true;
|
|
453
538
|
this.isConsentChecked = false;
|
|
454
539
|
this.totalCashAmount = 0;
|
|
455
540
|
this.errorMessage = '';
|
|
541
|
+
this.errorAmountMessage = '';
|
|
456
542
|
this.consentsSubmitted = false;
|
|
457
543
|
}
|
|
458
544
|
handleNewTranslations() {
|
|
@@ -477,7 +563,6 @@ const UserFundsAcknowledgment = class {
|
|
|
477
563
|
if (this.translationUrl.length > 2) {
|
|
478
564
|
await getTranslations(this.translationUrl);
|
|
479
565
|
}
|
|
480
|
-
this.totalCashAmount = parseFloat(localStorage.getItem('totalCashAmount')) || 0;
|
|
481
566
|
}
|
|
482
567
|
componentDidLoad() {
|
|
483
568
|
if (this.stylingContainer) {
|
|
@@ -488,27 +573,27 @@ const UserFundsAcknowledgment = class {
|
|
|
488
573
|
if (this.clientStylingUrl)
|
|
489
574
|
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
490
575
|
}
|
|
576
|
+
switch (this.gmversion) {
|
|
577
|
+
case 'gmcore':
|
|
578
|
+
this.getPlayerAccountBalanceDataCore();
|
|
579
|
+
break;
|
|
580
|
+
case 'gm16':
|
|
581
|
+
this.getPlayerAccountBalanceData16();
|
|
582
|
+
break;
|
|
583
|
+
default:
|
|
584
|
+
throw Error(`Invalid apiversion attribute: ${this.gmversion}`);
|
|
585
|
+
}
|
|
491
586
|
}
|
|
492
587
|
disconnectedCallback() {
|
|
493
588
|
var _a;
|
|
494
589
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort('Component unmounted');
|
|
495
590
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
496
591
|
}
|
|
497
|
-
userLegislationConsentHandler() {
|
|
498
|
-
if (this.checkboxInput) {
|
|
499
|
-
this.isConsentChecked = this.checkboxInput.checked;
|
|
500
|
-
}
|
|
501
|
-
// In case of a network error, permit the user to retry consents submission
|
|
502
|
-
if (this.isConsentChecked) {
|
|
503
|
-
this.consentsSubmitted = false;
|
|
504
|
-
this.errorMessage = '';
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
592
|
consentsArea() {
|
|
508
|
-
return (index.h("div", { class: "UserProtectionFundsCheckboxArea" }, index.h("label", { class: "UserProtectionFundsCheckboxContent", htmlFor: "userProtectionFunds" }, index.h("input", { ref: el => this.checkboxInput = el, id: "userProtectionFunds", type: "checkbox", onInput:
|
|
593
|
+
return (index.h("div", { class: "UserProtectionFundsCheckboxArea" }, index.h("label", { class: "UserProtectionFundsCheckboxContent", htmlFor: "userProtectionFunds" }, index.h("input", { ref: el => this.checkboxInput = el, id: "userProtectionFunds", type: "checkbox", onInput: this.userLegislationConsentHandler }), index.h("span", { innerHTML: `${translate('protectionCheckboxLabel', this.language)}` }))));
|
|
509
594
|
}
|
|
510
595
|
render() {
|
|
511
|
-
return (index.h("div", { key: '
|
|
596
|
+
return (index.h("div", { key: '4b83615d1b42c72de845e1ca293a162bd9e958ce', class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (index.h("div", null, index.h("slot", { name: 'spinner' }), index.h("svg", { class: "spinner", viewBox: "0 0 50 50" }, index.h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })))) : (index.h("div", { class: "UserProtectionFundsContainer" }, index.h("div", { class: "UserProtectionFundsTitle" }, index.h("h2", null, translate('protectionTitle', this.language))), index.h("div", { class: "UserProtectionFundsWrapper" }, index.h("p", { innerHTML: `${translate('protectionContent', this.language)}` })), index.h("div", { class: "UserProtectionFundsBalance" }, index.h("p", null, translate('balanceArea', this.language), " ", index.h("span", null, this.formatBalance(this.totalCashAmount)))), index.h("div", { class: "UserProtectionFundsButtonsWrapper" }, index.h("div", null, this.consentsArea()), index.h("div", null, index.h("button", { class: "UserProtectionFundsSubmitButton", disabled: !this.isConsentChecked || this.errorMessage != '' || this.consentsSubmitted, onClick: this.handleSubmit }, translate('submitButtonText', this.language))), index.h("div", { class: "UserProtectionError" }, index.h("p", null, this.errorMessage != '' && this.errorMessage), index.h("p", null, this.errorAmountMessage != '' && this.errorAmountMessage)))))));
|
|
512
597
|
}
|
|
513
598
|
static get watchers() { return {
|
|
514
599
|
"translationUrl": ["handleNewTranslations"],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const userFundsAcknowledgment = require('./user-funds-acknowledgment-
|
|
5
|
+
const userFundsAcknowledgment = require('./user-funds-acknowledgment-45da5541.js');
|
|
6
6
|
require('./index-e7d6647a.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["user-funds-acknowledgment.cjs",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["user-funds-acknowledgment.cjs",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"userid":[1],"gmversion":[513],"totalcalculationmode":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"errorAmountMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -5,6 +5,89 @@ export class UserFundsAcknowledgment {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.abortController = null;
|
|
7
7
|
this.TIMEOUT_MS = 10000; // 10 seconds
|
|
8
|
+
this.currency = '';
|
|
9
|
+
this.getPlayerAccountBalanceDataCore = () => {
|
|
10
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userid}/account`);
|
|
11
|
+
fetch(url, { method: 'GET', headers: { 'X-SessionID': this.session } })
|
|
12
|
+
.then(res => {
|
|
13
|
+
if (!res.ok) {
|
|
14
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${res.status}`;
|
|
15
|
+
throw new Error(`Failed to fetch balance data: ${res.status}`);
|
|
16
|
+
}
|
|
17
|
+
return res.json();
|
|
18
|
+
})
|
|
19
|
+
.then((data) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
if (!data.items || !Array.isArray(data.items)) {
|
|
22
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${data.status}`;
|
|
23
|
+
throw new Error('Unexpected data format: items array missing');
|
|
24
|
+
}
|
|
25
|
+
const casinoItem = data.items.find(b => b.displayName === 'Casino');
|
|
26
|
+
if (!(casinoItem === null || casinoItem === void 0 ? void 0 : casinoItem.currency)) {
|
|
27
|
+
throw new Error('No Casino item found in balance items');
|
|
28
|
+
}
|
|
29
|
+
this.currency = casinoItem.currency;
|
|
30
|
+
this.totalCashAmount = (_b = (_a = data.totalAmount) === null || _a === void 0 ? void 0 : _a[this.currency]) !== null && _b !== void 0 ? _b : 0;
|
|
31
|
+
})
|
|
32
|
+
.catch(err => {
|
|
33
|
+
if (!this.errorAmountMessage) {
|
|
34
|
+
this.errorAmountMessage = translate('serverNotResponding', this.language);
|
|
35
|
+
}
|
|
36
|
+
console.error('Balance error:', err);
|
|
37
|
+
})
|
|
38
|
+
.finally(() => {
|
|
39
|
+
this.isLoading = false;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
this.getPlayerAccountBalanceData16 = () => {
|
|
43
|
+
const url = new URL(`${this.endpoint}/v2/player/${this.userid}/balance`);
|
|
44
|
+
const headers = new Headers();
|
|
45
|
+
headers.append('X-SessionID', this.session);
|
|
46
|
+
fetch(url, { method: 'GET', headers })
|
|
47
|
+
.then(res => {
|
|
48
|
+
if (!res.ok) {
|
|
49
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${res.status}`;
|
|
50
|
+
throw new Error(`Failed to fetch balance data: ${res.status}`);
|
|
51
|
+
}
|
|
52
|
+
return res.json();
|
|
53
|
+
})
|
|
54
|
+
.then((data) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if (!data.items || !Array.isArray(data.items)) {
|
|
57
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${data.status}`;
|
|
58
|
+
throw new Error('Unexpected data format: items array missing');
|
|
59
|
+
}
|
|
60
|
+
const firstRealOrdinary = data.items.find(item => item.type === 'Real' && item.walletAccountType === 'Ordinary');
|
|
61
|
+
if (!(firstRealOrdinary === null || firstRealOrdinary === void 0 ? void 0 : firstRealOrdinary.currency)) {
|
|
62
|
+
throw new Error('No Real/Ordinary wallet found in balance items');
|
|
63
|
+
}
|
|
64
|
+
this.currency = firstRealOrdinary.currency;
|
|
65
|
+
// Resolve calculation mode fallback
|
|
66
|
+
if (!data[this.totalcalculationmode]) {
|
|
67
|
+
this.totalcalculationmode = 'totalCashAmount';
|
|
68
|
+
}
|
|
69
|
+
this.totalCashAmount = (_b = (_a = data[this.totalcalculationmode]) === null || _a === void 0 ? void 0 : _a[this.currency]) !== null && _b !== void 0 ? _b : 0;
|
|
70
|
+
})
|
|
71
|
+
.catch(err => {
|
|
72
|
+
if (!this.errorAmountMessage) {
|
|
73
|
+
this.errorAmountMessage = translate('serverNotResponding', this.language);
|
|
74
|
+
}
|
|
75
|
+
console.error('Balance fetch error', err);
|
|
76
|
+
})
|
|
77
|
+
.finally(() => {
|
|
78
|
+
this.isLoading = false;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
this.userLegislationConsentHandler = () => {
|
|
82
|
+
if (this.checkboxInput) {
|
|
83
|
+
this.isConsentChecked = this.checkboxInput.checked;
|
|
84
|
+
}
|
|
85
|
+
// In case of a network error, permit the user to retry consents submission
|
|
86
|
+
if (this.isConsentChecked) {
|
|
87
|
+
this.consentsSubmitted = false;
|
|
88
|
+
this.errorMessage = '';
|
|
89
|
+
}
|
|
90
|
+
};
|
|
8
91
|
/**
|
|
9
92
|
* Returns the formatted balance
|
|
10
93
|
* @param balance -> the balance value to be formatted
|
|
@@ -125,7 +208,6 @@ export class UserFundsAcknowledgment {
|
|
|
125
208
|
// 202 Accepted has no body, skip res.json()
|
|
126
209
|
if (res.status === 202) {
|
|
127
210
|
this.errorMessage = '';
|
|
128
|
-
localStorage.removeItem("totalCashAmount");
|
|
129
211
|
window.postMessage({ type: 'ProtectionFundsAccepted' }, window.location.href);
|
|
130
212
|
return;
|
|
131
213
|
}
|
|
@@ -148,7 +230,6 @@ export class UserFundsAcknowledgment {
|
|
|
148
230
|
clearTimeout(timeoutId); // clear timer
|
|
149
231
|
this.abortController = null;
|
|
150
232
|
});
|
|
151
|
-
;
|
|
152
233
|
};
|
|
153
234
|
this.session = undefined;
|
|
154
235
|
this.operatorid = undefined;
|
|
@@ -165,10 +246,14 @@ export class UserFundsAcknowledgment {
|
|
|
165
246
|
this.customdisplayformat = '';
|
|
166
247
|
this.alwaysshowdecimals = 'true';
|
|
167
248
|
this.playercurrency = 'EUR';
|
|
168
|
-
this.
|
|
249
|
+
this.userid = undefined;
|
|
250
|
+
this.gmversion = 'gm16';
|
|
251
|
+
this.totalcalculationmode = 'totalCashAmount';
|
|
252
|
+
this.isLoading = true;
|
|
169
253
|
this.isConsentChecked = false;
|
|
170
254
|
this.totalCashAmount = 0;
|
|
171
255
|
this.errorMessage = '';
|
|
256
|
+
this.errorAmountMessage = '';
|
|
172
257
|
this.consentsSubmitted = false;
|
|
173
258
|
}
|
|
174
259
|
handleNewTranslations() {
|
|
@@ -193,7 +278,6 @@ export class UserFundsAcknowledgment {
|
|
|
193
278
|
if (this.translationUrl.length > 2) {
|
|
194
279
|
await getTranslations(this.translationUrl);
|
|
195
280
|
}
|
|
196
|
-
this.totalCashAmount = parseFloat(localStorage.getItem('totalCashAmount')) || 0;
|
|
197
281
|
}
|
|
198
282
|
componentDidLoad() {
|
|
199
283
|
if (this.stylingContainer) {
|
|
@@ -204,27 +288,27 @@ export class UserFundsAcknowledgment {
|
|
|
204
288
|
if (this.clientStylingUrl)
|
|
205
289
|
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
206
290
|
}
|
|
291
|
+
switch (this.gmversion) {
|
|
292
|
+
case 'gmcore':
|
|
293
|
+
this.getPlayerAccountBalanceDataCore();
|
|
294
|
+
break;
|
|
295
|
+
case 'gm16':
|
|
296
|
+
this.getPlayerAccountBalanceData16();
|
|
297
|
+
break;
|
|
298
|
+
default:
|
|
299
|
+
throw Error(`Invalid apiversion attribute: ${this.gmversion}`);
|
|
300
|
+
}
|
|
207
301
|
}
|
|
208
302
|
disconnectedCallback() {
|
|
209
303
|
var _a;
|
|
210
304
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort('Component unmounted');
|
|
211
305
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
212
306
|
}
|
|
213
|
-
userLegislationConsentHandler() {
|
|
214
|
-
if (this.checkboxInput) {
|
|
215
|
-
this.isConsentChecked = this.checkboxInput.checked;
|
|
216
|
-
}
|
|
217
|
-
// In case of a network error, permit the user to retry consents submission
|
|
218
|
-
if (this.isConsentChecked) {
|
|
219
|
-
this.consentsSubmitted = false;
|
|
220
|
-
this.errorMessage = '';
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
307
|
consentsArea() {
|
|
224
|
-
return (h("div", { class: "UserProtectionFundsCheckboxArea" }, h("label", { class: "UserProtectionFundsCheckboxContent", htmlFor: "userProtectionFunds" }, h("input", { ref: el => this.checkboxInput = el, id: "userProtectionFunds", type: "checkbox", onInput:
|
|
308
|
+
return (h("div", { class: "UserProtectionFundsCheckboxArea" }, h("label", { class: "UserProtectionFundsCheckboxContent", htmlFor: "userProtectionFunds" }, h("input", { ref: el => this.checkboxInput = el, id: "userProtectionFunds", type: "checkbox", onInput: this.userLegislationConsentHandler }), h("span", { innerHTML: `${translate('protectionCheckboxLabel', this.language)}` }))));
|
|
225
309
|
}
|
|
226
310
|
render() {
|
|
227
|
-
return (h("div", { key: '
|
|
311
|
+
return (h("div", { key: '4b83615d1b42c72de845e1ca293a162bd9e958ce', class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("div", null, h("slot", { name: 'spinner' }), h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })))) : (h("div", { class: "UserProtectionFundsContainer" }, h("div", { class: "UserProtectionFundsTitle" }, h("h2", null, translate('protectionTitle', this.language))), h("div", { class: "UserProtectionFundsWrapper" }, h("p", { innerHTML: `${translate('protectionContent', this.language)}` })), h("div", { class: "UserProtectionFundsBalance" }, h("p", null, translate('balanceArea', this.language), " ", h("span", null, this.formatBalance(this.totalCashAmount)))), h("div", { class: "UserProtectionFundsButtonsWrapper" }, h("div", null, this.consentsArea()), h("div", null, h("button", { class: "UserProtectionFundsSubmitButton", disabled: !this.isConsentChecked || this.errorMessage != '' || this.consentsSubmitted, onClick: this.handleSubmit }, translate('submitButtonText', this.language))), h("div", { class: "UserProtectionError" }, h("p", null, this.errorMessage != '' && this.errorMessage), h("p", null, this.errorAmountMessage != '' && this.errorAmountMessage)))))));
|
|
228
312
|
}
|
|
229
313
|
static get is() { return "user-funds-acknowledgment"; }
|
|
230
314
|
static get encapsulation() { return "shadow"; }
|
|
@@ -503,6 +587,59 @@ export class UserFundsAcknowledgment {
|
|
|
503
587
|
"attribute": "playercurrency",
|
|
504
588
|
"reflect": true,
|
|
505
589
|
"defaultValue": "'EUR'"
|
|
590
|
+
},
|
|
591
|
+
"userid": {
|
|
592
|
+
"type": "string",
|
|
593
|
+
"mutable": false,
|
|
594
|
+
"complexType": {
|
|
595
|
+
"original": "string",
|
|
596
|
+
"resolved": "string",
|
|
597
|
+
"references": {}
|
|
598
|
+
},
|
|
599
|
+
"required": true,
|
|
600
|
+
"optional": false,
|
|
601
|
+
"docs": {
|
|
602
|
+
"tags": [],
|
|
603
|
+
"text": ""
|
|
604
|
+
},
|
|
605
|
+
"attribute": "userid",
|
|
606
|
+
"reflect": false
|
|
607
|
+
},
|
|
608
|
+
"gmversion": {
|
|
609
|
+
"type": "string",
|
|
610
|
+
"mutable": false,
|
|
611
|
+
"complexType": {
|
|
612
|
+
"original": "string",
|
|
613
|
+
"resolved": "string",
|
|
614
|
+
"references": {}
|
|
615
|
+
},
|
|
616
|
+
"required": false,
|
|
617
|
+
"optional": false,
|
|
618
|
+
"docs": {
|
|
619
|
+
"tags": [],
|
|
620
|
+
"text": ""
|
|
621
|
+
},
|
|
622
|
+
"attribute": "gmversion",
|
|
623
|
+
"reflect": true,
|
|
624
|
+
"defaultValue": "'gm16'"
|
|
625
|
+
},
|
|
626
|
+
"totalcalculationmode": {
|
|
627
|
+
"type": "string",
|
|
628
|
+
"mutable": false,
|
|
629
|
+
"complexType": {
|
|
630
|
+
"original": "string",
|
|
631
|
+
"resolved": "string",
|
|
632
|
+
"references": {}
|
|
633
|
+
},
|
|
634
|
+
"required": false,
|
|
635
|
+
"optional": false,
|
|
636
|
+
"docs": {
|
|
637
|
+
"tags": [],
|
|
638
|
+
"text": ""
|
|
639
|
+
},
|
|
640
|
+
"attribute": "totalcalculationmode",
|
|
641
|
+
"reflect": true,
|
|
642
|
+
"defaultValue": "'totalCashAmount'"
|
|
506
643
|
}
|
|
507
644
|
};
|
|
508
645
|
}
|
|
@@ -512,6 +649,7 @@ export class UserFundsAcknowledgment {
|
|
|
512
649
|
"isConsentChecked": {},
|
|
513
650
|
"totalCashAmount": {},
|
|
514
651
|
"errorMessage": {},
|
|
652
|
+
"errorAmountMessage": {},
|
|
515
653
|
"consentsSubmitted": {}
|
|
516
654
|
};
|
|
517
655
|
}
|
|
File without changes
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { U as UserFundsAcknowledgment } from './user-funds-acknowledgment-
|
|
1
|
+
export { U as UserFundsAcknowledgment } from './user-funds-acknowledgment-c9676919.js';
|
|
2
2
|
import './index-eb00caf2.js';
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["user-funds-acknowledgment",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["user-funds-acknowledgment",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"userid":[1],"gmversion":[513],"totalcalculationmode":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"errorAmountMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
package/dist/esm/{user-funds-acknowledgment-e5293ada.js → user-funds-acknowledgment-c9676919.js}
RENAMED
|
@@ -280,7 +280,7 @@ const translate = (key, customLang, values) => {
|
|
|
280
280
|
return translation;
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
const userFundsAcknowledgmentCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserProtectionFundsTitle{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserProtectionFundsContainer{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:center;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid #
|
|
283
|
+
const userFundsAcknowledgmentCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserProtectionFundsTitle{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserProtectionFundsContainer{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:center;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid var(--emw--color-disabled, #58586B);color:var(--emw--color-disabled, #58586B);cursor:unset}.ButtonsWrapper{display:flex;flex-direction:column;margin-top:10px;gap:40px}.ButtonsWrapper button:only-child{margin-left:auto}.UserProtectionError{color:var(--emw--color-error, #FD2839);text-align:center;height:22px}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:var(--emw--button-text-color, #000000)}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";
|
|
284
284
|
const UserFundsAcknowledgmentStyle0 = userFundsAcknowledgmentCss;
|
|
285
285
|
|
|
286
286
|
const UserFundsAcknowledgment = class {
|
|
@@ -288,6 +288,89 @@ const UserFundsAcknowledgment = class {
|
|
|
288
288
|
registerInstance(this, hostRef);
|
|
289
289
|
this.abortController = null;
|
|
290
290
|
this.TIMEOUT_MS = 10000; // 10 seconds
|
|
291
|
+
this.currency = '';
|
|
292
|
+
this.getPlayerAccountBalanceDataCore = () => {
|
|
293
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userid}/account`);
|
|
294
|
+
fetch(url, { method: 'GET', headers: { 'X-SessionID': this.session } })
|
|
295
|
+
.then(res => {
|
|
296
|
+
if (!res.ok) {
|
|
297
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${res.status}`;
|
|
298
|
+
throw new Error(`Failed to fetch balance data: ${res.status}`);
|
|
299
|
+
}
|
|
300
|
+
return res.json();
|
|
301
|
+
})
|
|
302
|
+
.then((data) => {
|
|
303
|
+
var _a, _b;
|
|
304
|
+
if (!data.items || !Array.isArray(data.items)) {
|
|
305
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${data.status}`;
|
|
306
|
+
throw new Error('Unexpected data format: items array missing');
|
|
307
|
+
}
|
|
308
|
+
const casinoItem = data.items.find(b => b.displayName === 'Casino');
|
|
309
|
+
if (!(casinoItem === null || casinoItem === void 0 ? void 0 : casinoItem.currency)) {
|
|
310
|
+
throw new Error('No Casino item found in balance items');
|
|
311
|
+
}
|
|
312
|
+
this.currency = casinoItem.currency;
|
|
313
|
+
this.totalCashAmount = (_b = (_a = data.totalAmount) === null || _a === void 0 ? void 0 : _a[this.currency]) !== null && _b !== void 0 ? _b : 0;
|
|
314
|
+
})
|
|
315
|
+
.catch(err => {
|
|
316
|
+
if (!this.errorAmountMessage) {
|
|
317
|
+
this.errorAmountMessage = translate('serverNotResponding', this.language);
|
|
318
|
+
}
|
|
319
|
+
console.error('Balance error:', err);
|
|
320
|
+
})
|
|
321
|
+
.finally(() => {
|
|
322
|
+
this.isLoading = false;
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
this.getPlayerAccountBalanceData16 = () => {
|
|
326
|
+
const url = new URL(`${this.endpoint}/v2/player/${this.userid}/balance`);
|
|
327
|
+
const headers = new Headers();
|
|
328
|
+
headers.append('X-SessionID', this.session);
|
|
329
|
+
fetch(url, { method: 'GET', headers })
|
|
330
|
+
.then(res => {
|
|
331
|
+
if (!res.ok) {
|
|
332
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${res.status}`;
|
|
333
|
+
throw new Error(`Failed to fetch balance data: ${res.status}`);
|
|
334
|
+
}
|
|
335
|
+
return res.json();
|
|
336
|
+
})
|
|
337
|
+
.then((data) => {
|
|
338
|
+
var _a, _b;
|
|
339
|
+
if (!data.items || !Array.isArray(data.items)) {
|
|
340
|
+
this.errorAmountMessage = `${translate('apiCallError', this.language)} ${data.status}`;
|
|
341
|
+
throw new Error('Unexpected data format: items array missing');
|
|
342
|
+
}
|
|
343
|
+
const firstRealOrdinary = data.items.find(item => item.type === 'Real' && item.walletAccountType === 'Ordinary');
|
|
344
|
+
if (!(firstRealOrdinary === null || firstRealOrdinary === void 0 ? void 0 : firstRealOrdinary.currency)) {
|
|
345
|
+
throw new Error('No Real/Ordinary wallet found in balance items');
|
|
346
|
+
}
|
|
347
|
+
this.currency = firstRealOrdinary.currency;
|
|
348
|
+
// Resolve calculation mode fallback
|
|
349
|
+
if (!data[this.totalcalculationmode]) {
|
|
350
|
+
this.totalcalculationmode = 'totalCashAmount';
|
|
351
|
+
}
|
|
352
|
+
this.totalCashAmount = (_b = (_a = data[this.totalcalculationmode]) === null || _a === void 0 ? void 0 : _a[this.currency]) !== null && _b !== void 0 ? _b : 0;
|
|
353
|
+
})
|
|
354
|
+
.catch(err => {
|
|
355
|
+
if (!this.errorAmountMessage) {
|
|
356
|
+
this.errorAmountMessage = translate('serverNotResponding', this.language);
|
|
357
|
+
}
|
|
358
|
+
console.error('Balance fetch error', err);
|
|
359
|
+
})
|
|
360
|
+
.finally(() => {
|
|
361
|
+
this.isLoading = false;
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
this.userLegislationConsentHandler = () => {
|
|
365
|
+
if (this.checkboxInput) {
|
|
366
|
+
this.isConsentChecked = this.checkboxInput.checked;
|
|
367
|
+
}
|
|
368
|
+
// In case of a network error, permit the user to retry consents submission
|
|
369
|
+
if (this.isConsentChecked) {
|
|
370
|
+
this.consentsSubmitted = false;
|
|
371
|
+
this.errorMessage = '';
|
|
372
|
+
}
|
|
373
|
+
};
|
|
291
374
|
/**
|
|
292
375
|
* Returns the formatted balance
|
|
293
376
|
* @param balance -> the balance value to be formatted
|
|
@@ -408,7 +491,6 @@ const UserFundsAcknowledgment = class {
|
|
|
408
491
|
// 202 Accepted has no body, skip res.json()
|
|
409
492
|
if (res.status === 202) {
|
|
410
493
|
this.errorMessage = '';
|
|
411
|
-
localStorage.removeItem("totalCashAmount");
|
|
412
494
|
window.postMessage({ type: 'ProtectionFundsAccepted' }, window.location.href);
|
|
413
495
|
return;
|
|
414
496
|
}
|
|
@@ -447,10 +529,14 @@ const UserFundsAcknowledgment = class {
|
|
|
447
529
|
this.customdisplayformat = '';
|
|
448
530
|
this.alwaysshowdecimals = 'true';
|
|
449
531
|
this.playercurrency = 'EUR';
|
|
450
|
-
this.
|
|
532
|
+
this.userid = undefined;
|
|
533
|
+
this.gmversion = 'gm16';
|
|
534
|
+
this.totalcalculationmode = 'totalCashAmount';
|
|
535
|
+
this.isLoading = true;
|
|
451
536
|
this.isConsentChecked = false;
|
|
452
537
|
this.totalCashAmount = 0;
|
|
453
538
|
this.errorMessage = '';
|
|
539
|
+
this.errorAmountMessage = '';
|
|
454
540
|
this.consentsSubmitted = false;
|
|
455
541
|
}
|
|
456
542
|
handleNewTranslations() {
|
|
@@ -475,7 +561,6 @@ const UserFundsAcknowledgment = class {
|
|
|
475
561
|
if (this.translationUrl.length > 2) {
|
|
476
562
|
await getTranslations(this.translationUrl);
|
|
477
563
|
}
|
|
478
|
-
this.totalCashAmount = parseFloat(localStorage.getItem('totalCashAmount')) || 0;
|
|
479
564
|
}
|
|
480
565
|
componentDidLoad() {
|
|
481
566
|
if (this.stylingContainer) {
|
|
@@ -486,27 +571,27 @@ const UserFundsAcknowledgment = class {
|
|
|
486
571
|
if (this.clientStylingUrl)
|
|
487
572
|
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
488
573
|
}
|
|
574
|
+
switch (this.gmversion) {
|
|
575
|
+
case 'gmcore':
|
|
576
|
+
this.getPlayerAccountBalanceDataCore();
|
|
577
|
+
break;
|
|
578
|
+
case 'gm16':
|
|
579
|
+
this.getPlayerAccountBalanceData16();
|
|
580
|
+
break;
|
|
581
|
+
default:
|
|
582
|
+
throw Error(`Invalid apiversion attribute: ${this.gmversion}`);
|
|
583
|
+
}
|
|
489
584
|
}
|
|
490
585
|
disconnectedCallback() {
|
|
491
586
|
var _a;
|
|
492
587
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort('Component unmounted');
|
|
493
588
|
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
494
589
|
}
|
|
495
|
-
userLegislationConsentHandler() {
|
|
496
|
-
if (this.checkboxInput) {
|
|
497
|
-
this.isConsentChecked = this.checkboxInput.checked;
|
|
498
|
-
}
|
|
499
|
-
// In case of a network error, permit the user to retry consents submission
|
|
500
|
-
if (this.isConsentChecked) {
|
|
501
|
-
this.consentsSubmitted = false;
|
|
502
|
-
this.errorMessage = '';
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
590
|
consentsArea() {
|
|
506
|
-
return (h("div", { class: "UserProtectionFundsCheckboxArea" }, h("label", { class: "UserProtectionFundsCheckboxContent", htmlFor: "userProtectionFunds" }, h("input", { ref: el => this.checkboxInput = el, id: "userProtectionFunds", type: "checkbox", onInput:
|
|
591
|
+
return (h("div", { class: "UserProtectionFundsCheckboxArea" }, h("label", { class: "UserProtectionFundsCheckboxContent", htmlFor: "userProtectionFunds" }, h("input", { ref: el => this.checkboxInput = el, id: "userProtectionFunds", type: "checkbox", onInput: this.userLegislationConsentHandler }), h("span", { innerHTML: `${translate('protectionCheckboxLabel', this.language)}` }))));
|
|
507
592
|
}
|
|
508
593
|
render() {
|
|
509
|
-
return (h("div", { key: '
|
|
594
|
+
return (h("div", { key: '4b83615d1b42c72de845e1ca293a162bd9e958ce', class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("div", null, h("slot", { name: 'spinner' }), h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })))) : (h("div", { class: "UserProtectionFundsContainer" }, h("div", { class: "UserProtectionFundsTitle" }, h("h2", null, translate('protectionTitle', this.language))), h("div", { class: "UserProtectionFundsWrapper" }, h("p", { innerHTML: `${translate('protectionContent', this.language)}` })), h("div", { class: "UserProtectionFundsBalance" }, h("p", null, translate('balanceArea', this.language), " ", h("span", null, this.formatBalance(this.totalCashAmount)))), h("div", { class: "UserProtectionFundsButtonsWrapper" }, h("div", null, this.consentsArea()), h("div", null, h("button", { class: "UserProtectionFundsSubmitButton", disabled: !this.isConsentChecked || this.errorMessage != '' || this.consentsSubmitted, onClick: this.handleSubmit }, translate('submitButtonText', this.language))), h("div", { class: "UserProtectionError" }, h("p", null, this.errorMessage != '' && this.errorMessage), h("p", null, this.errorAmountMessage != '' && this.errorAmountMessage)))))));
|
|
510
595
|
}
|
|
511
596
|
static get watchers() { return {
|
|
512
597
|
"translationUrl": ["handleNewTranslations"],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { U as user_funds_acknowledgment } from './user-funds-acknowledgment-
|
|
1
|
+
export { U as user_funds_acknowledgment } from './user-funds-acknowledgment-c9676919.js';
|
|
2
2
|
import './index-eb00caf2.js';
|
|
@@ -16,5 +16,5 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["user-funds-acknowledgment",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
19
|
+
return bootstrapLazy([["user-funds-acknowledgment",[[1,"user-funds-acknowledgment",{"session":[513],"operatorid":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endpoint":[513],"language":[1537],"translationUrl":[513,"translation-url"],"currencylocale":[513],"currencydisplay":[513],"maximumfractiondigits":[513],"minimumfractiondigits":[513],"customdisplayformat":[513],"alwaysshowdecimals":[513],"playercurrency":[513],"userid":[1],"gmversion":[513],"totalcalculationmode":[513],"isLoading":[32],"isConsentChecked":[32],"totalCashAmount":[32],"errorMessage":[32],"errorAmountMessage":[32],"consentsSubmitted":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
20
20
|
});
|
|
@@ -41,24 +41,31 @@ export declare class UserFundsAcknowledgment {
|
|
|
41
41
|
customdisplayformat: string;
|
|
42
42
|
alwaysshowdecimals: string;
|
|
43
43
|
playercurrency: string;
|
|
44
|
+
userid: string;
|
|
45
|
+
gmversion: string;
|
|
46
|
+
totalcalculationmode: string;
|
|
44
47
|
private isLoading;
|
|
45
48
|
private isConsentChecked;
|
|
46
49
|
private totalCashAmount;
|
|
47
50
|
private errorMessage;
|
|
51
|
+
private errorAmountMessage;
|
|
48
52
|
private consentsSubmitted;
|
|
49
53
|
private stylingContainer;
|
|
50
54
|
private stylingSubscription;
|
|
51
55
|
private checkboxInput;
|
|
52
56
|
private abortController;
|
|
53
57
|
private readonly TIMEOUT_MS;
|
|
58
|
+
private currency;
|
|
54
59
|
handleNewTranslations(): void;
|
|
55
60
|
handleClientStylingChange(newValue: any, oldValue: any): void;
|
|
56
61
|
handleClientStylingUrlChange(newValue: any, oldValue: any): void;
|
|
57
62
|
handleMbSourceChange(newValue: any, oldValue: any): void;
|
|
58
63
|
componentWillLoad(): Promise<void>;
|
|
59
64
|
componentDidLoad(): void;
|
|
65
|
+
getPlayerAccountBalanceDataCore: () => void;
|
|
66
|
+
getPlayerAccountBalanceData16: () => void;
|
|
60
67
|
disconnectedCallback(): void;
|
|
61
|
-
userLegislationConsentHandler()
|
|
68
|
+
userLegislationConsentHandler: () => void;
|
|
62
69
|
/**
|
|
63
70
|
* Returns the formatted balance
|
|
64
71
|
* @param balance -> the balance value to be formatted
|
|
@@ -29,6 +29,7 @@ export namespace Components {
|
|
|
29
29
|
* The endpoint required for the submit call
|
|
30
30
|
*/
|
|
31
31
|
"endpoint": string;
|
|
32
|
+
"gmversion": string;
|
|
32
33
|
/**
|
|
33
34
|
* Language
|
|
34
35
|
*/
|
|
@@ -42,10 +43,12 @@ export namespace Components {
|
|
|
42
43
|
* The session required for the submit call
|
|
43
44
|
*/
|
|
44
45
|
"session": string;
|
|
46
|
+
"totalcalculationmode": string;
|
|
45
47
|
/**
|
|
46
48
|
* Translation url
|
|
47
49
|
*/
|
|
48
50
|
"translationUrl": string;
|
|
51
|
+
"userid": string;
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
declare global {
|
|
@@ -83,6 +86,7 @@ declare namespace LocalJSX {
|
|
|
83
86
|
* The endpoint required for the submit call
|
|
84
87
|
*/
|
|
85
88
|
"endpoint": string;
|
|
89
|
+
"gmversion"?: string;
|
|
86
90
|
/**
|
|
87
91
|
* Language
|
|
88
92
|
*/
|
|
@@ -96,10 +100,12 @@ declare namespace LocalJSX {
|
|
|
96
100
|
* The session required for the submit call
|
|
97
101
|
*/
|
|
98
102
|
"session"?: string;
|
|
103
|
+
"totalcalculationmode"?: string;
|
|
99
104
|
/**
|
|
100
105
|
* Translation url
|
|
101
106
|
*/
|
|
102
107
|
"translationUrl"?: string;
|
|
108
|
+
"userid": string;
|
|
103
109
|
}
|
|
104
110
|
interface IntrinsicElements {
|
|
105
111
|
"user-funds-acknowledgment": UserFundsAcknowledgment;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface BalanceItem {
|
|
2
|
+
type: string;
|
|
3
|
+
walletAccountType: string;
|
|
4
|
+
currency: string;
|
|
5
|
+
}
|
|
6
|
+
interface PlayerBalance16Data {
|
|
7
|
+
items: BalanceItem[];
|
|
8
|
+
totalCashAmount: {
|
|
9
|
+
[key: string]: number;
|
|
10
|
+
};
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
interface PlayerBalanceCoreItem {
|
|
14
|
+
displayName: string;
|
|
15
|
+
currency: string;
|
|
16
|
+
}
|
|
17
|
+
interface PlayerBalanceCoreData {
|
|
18
|
+
status: any;
|
|
19
|
+
items: PlayerBalanceCoreItem[];
|
|
20
|
+
totalAmount: {
|
|
21
|
+
[key: string]: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{U as UserFundsAcknowledgment}from"./user-funds-acknowledgment-
|
|
1
|
+
export{U as UserFundsAcknowledgment}from"./user-funds-acknowledgment-c9676919.js";import"./index-eb00caf2.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as t}from"./index-eb00caf2.js";const n="__WIDGET_GLOBAL_STYLE_CACHE__";function i(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function o(e,t){if(!e||!t)return;const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function s(e,t,i,o=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!o)return i=function(e,t){const n=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(n.innerHTML=t,e.appendChild(n))}))}(e,t),i;window[n]||(window[n]={}),i=function(e,t){return window.emMessageBus.subscribe(t,(i=>{if(!e)return;const o=e.getRootNode(),s=window[n];let r=s[t]&&s[t].sheet;r?s[t].refCount=s[t].refCount+1:(r=new CSSStyleSheet,r.replaceSync(i),s[t]={sheet:r,refCount:1});const a=o.adoptedStyleSheets||[];a.includes(r)||(o.adoptedStyleSheets=[...a,r])}))}(e,t);const s=i.unsubscribe.bind(i);return i.unsubscribe=()=>{if(window[n][t]){const e=window[n][t];e.refCount>1?e.refCount=e.refCount-1:delete window[n][t]}s()},i}const r={en:{protectionTitle:"Protection of Customer Funds",protectionContent:'<p>We hold customer funds separate from company funds.<sup class="note"><a href="https://www.gamblingcommission.gov.uk/guidance/customer-funds-segregation-disclosure-to-customers-and-reporting/example-statements-that-might-be-used-in-terms-and-conditions-for-each-of#ref-2" target="_blank">12</a></sup> These funds ar <b>not protected</b> in the event of insolvency: <b>not protected segregation.</b></p><p>For more information, please see the <a href="https://www.gamblingcommission.gov.uk/guidance/customer-funds-segregation-disclosure-to-customers-and-reporting/the-customer-funds-insolvency-ratings-system" target="_blank">customer funds insolvency ratings system</a>.</p>',balanceArea:"Your current balance:",protectionCheckboxLabel:"I understand that my funds are <b>not protected</b> if the operator becomes insolvent.",userNoticeText:"Before you can proceed you must consent to the following",submitButtonText:"Confirm",serverNotResponding:"Server might not be responding",apiCallError:"Request failed with status "},"en-us":{protectionTitle:"Terms and Conditions",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Email marketing",privacyPolicyTitle:"Privacy Policy",userNoticeText:"Before you can proceed you must consent to the following",submitButtonText:"Submit",rejectButtonText:"Reject",rejectText:"Rejecting new consents will result in the inability to continue the login process and you will be logged out.",consentUpdateSuccess:"Consent update successful!",serverNotResponding:"Server might not be responding"},ro:{protectionTitle:"Termeni și Condiții",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing prin Email",privacyPolicyTitle:"Politica de Confidențialitate",userNoticeText:"Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele",submitButtonText:"Trimite",rejectButtonText:"Respinge",rejectText:"Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.",consentUpdateSuccess:"Actualizare consimțământ reușită!",serverNotResponding:"Serverul s-ar putea să nu răspundă"},hr:{protectionTitle:"Opći uvjeti i odredbe",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"E-mail makretinški sadržaj",privacyPolicyTitle:"Politika Privatnosti",userNoticeText:"Prije nego što možete nastaviti, morate pristati na sljedeće",submitButtonText:"Pošalji",rejectButtonText:"Odbij",rejectText:"Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.",consentUpdateSuccess:"Ažuriranje pristanka uspješno!",serverNotResponding:"Poslužitelj možda ne odgovara"},fr:{protectionTitle:"Termes et Conditions",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing par Email",privacyPolicyTitle:"Politique de Confidentialité",userNoticeText:"Avant de continuer, vous devez consentir aux éléments suivants",submitButtonText:"Soumettre",rejectButtonText:"Rejeter",rejectText:"Le rejet des nouveaux consentements entraînera l'impossibilité de continuer le processus de connexion et vous serez déconnecté.",consentUpdateSuccess:"Mise à jour du consentement réussie!",serverNotResponding:"Le serveur ne répond peut-être pas"},cs:{protectionTitle:"Podmínky a ujednání",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Emailový marketing",privacyPolicyTitle:"Zásady ochrany osobních údajů",userNoticeText:"Než budete moci pokračovat, musíte souhlasit s následujícím",submitButtonText:"Odeslat",rejectButtonText:"Odmítnout",rejectText:"Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.",consentUpdateSuccess:"Aktualizace souhlasu proběhla úspěšně!",serverNotResponding:"Server možná neodpovídá"},de:{protectionTitle:"Allgemeine Geschäftsbedingungen",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"E-Mail-Marketing",privacyPolicyTitle:"Datenschutzrichtlinie",userNoticeText:"Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen",submitButtonText:"Absenden",rejectButtonText:"Ablehnen",rejectText:"Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.",consentUpdateSuccess:"Zustimmung erfolgreich aktualisiert!",serverNotResponding:"Der Server antwortet möglicherweise nicht"},es:{protectionTitle:"Términos y Condiciones",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidad",userNoticeText:"Antes de continuar, debe dar su consentimiento a lo siguiente",submitButtonText:"Enviar",rejectButtonText:"Rechazar",rejectText:"Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.",consentUpdateSuccess:"¡Actualización del consentimiento exitosa!",serverNotResponding:"El servidor podría no estar respondiendo"},pt:{protectionTitle:"Termos e Condições",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidade",userNoticeText:"Antes de continuar, você deve consentir com o seguinte",submitButtonText:"Enviar",rejectButtonText:"Rejeitar",rejectText:"Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.",consentUpdateSuccess:"Atualização de consentimento bem-sucedida!",serverNotResponding:"O servidor pode não estar respondendo"},"es-mx":{protectionTitle:"Términos y Condiciones",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidad",userNoticeText:"Antes de continuar, debe dar su consentimiento a lo siguiente",submitButtonText:"Enviar",rejectButtonText:"Rechazar",rejectText:"Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.",consentUpdateSuccess:"¡Actualización del consentimiento exitosa!",serverNotResponding:"El servidor podría no estar respondiendo"},"pt-br":{protectionTitle:"Termos e Condições",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidade",userNoticeText:"Antes de continuar, você deve consentir com o seguinte",submitButtonText:"Enviar",rejectButtonText:"Rejeitar",rejectText:"Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.",consentUpdateSuccess:"Atualização de consentimento bem-sucedida!",serverNotResponding:"O servidor pode não estar respondendo"}},a=e=>new Promise((t=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{r[t]||(r[t]={});for(let n in e[t])r[t][n]=e[t][n]})),t(!0)}))})),c=(e,t,n)=>{let i=r[void 0!==t&&t in r?t:"en"][e];if(void 0!==n)for(const[e,t]of Object.entries(n.values)){const n=new RegExp(`{${e}}`,"g");i=i.replace(n,t)}return i},d=class{constructor(t){e(this,t),this.abortController=null,this.TIMEOUT_MS=1e4,this.currency="",this.getPlayerAccountBalanceDataCore=()=>{const e=new URL(`${this.endpoint}/v1/player/${this.userid}/account`);fetch(e,{method:"GET",headers:{"X-SessionID":this.session}}).then((e=>{if(!e.ok)throw this.errorAmountMessage=`${c("apiCallError",this.language)} ${e.status}`,new Error(`Failed to fetch balance data: ${e.status}`);return e.json()})).then((e=>{var t,n;if(!e.items||!Array.isArray(e.items))throw this.errorAmountMessage=`${c("apiCallError",this.language)} ${e.status}`,new Error("Unexpected data format: items array missing");const i=e.items.find((e=>"Casino"===e.displayName));if(!(null==i?void 0:i.currency))throw new Error("No Casino item found in balance items");this.currency=i.currency,this.totalCashAmount=null!==(n=null===(t=e.totalAmount)||void 0===t?void 0:t[this.currency])&&void 0!==n?n:0})).catch((e=>{this.errorAmountMessage||(this.errorAmountMessage=c("serverNotResponding",this.language)),console.error("Balance error:",e)})).finally((()=>{this.isLoading=!1}))},this.getPlayerAccountBalanceData16=()=>{const e=new URL(`${this.endpoint}/v2/player/${this.userid}/balance`),t=new Headers;t.append("X-SessionID",this.session),fetch(e,{method:"GET",headers:t}).then((e=>{if(!e.ok)throw this.errorAmountMessage=`${c("apiCallError",this.language)} ${e.status}`,new Error(`Failed to fetch balance data: ${e.status}`);return e.json()})).then((e=>{var t,n;if(!e.items||!Array.isArray(e.items))throw this.errorAmountMessage=`${c("apiCallError",this.language)} ${e.status}`,new Error("Unexpected data format: items array missing");const i=e.items.find((e=>"Real"===e.type&&"Ordinary"===e.walletAccountType));if(!(null==i?void 0:i.currency))throw new Error("No Real/Ordinary wallet found in balance items");this.currency=i.currency,e[this.totalcalculationmode]||(this.totalcalculationmode="totalCashAmount"),this.totalCashAmount=null!==(n=null===(t=e[this.totalcalculationmode])||void 0===t?void 0:t[this.currency])&&void 0!==n?n:0})).catch((e=>{this.errorAmountMessage||(this.errorAmountMessage=c("serverNotResponding",this.language)),console.error("Balance fetch error",e)})).finally((()=>{this.isLoading=!1}))},this.userLegislationConsentHandler=()=>{this.checkboxInput&&(this.isConsentChecked=this.checkboxInput.checked),this.isConsentChecked&&(this.consentsSubmitted=!1,this.errorMessage="")},this.formatBalance=e=>{if(this.customdisplayformat)return this.formatFromCustom(e);const t=this.currencylocale||this.language,n={style:"currency",currency:this.playercurrency,useGrouping:!0,currencyDisplay:this.currencydisplay,maximumFractionDigits:""===this.maximumfractiondigits||isNaN(Number(this.maximumfractiondigits))?2:Number(this.maximumfractiondigits),minimumFractionDigits:""===this.minimumfractiondigits||isNaN(Number(this.minimumfractiondigits))?0:Number(this.minimumfractiondigits)};return new Intl.NumberFormat(t,n).format(e)},this.formatFromCustom=e=>{const t=[];let n="";for(const i of this.customdisplayformat)switch(i){default:n+=i;break;case"{":n&&t.push(n),n="";break;case"}":const[o,s]=n.split("|");if(n="","currency"===o.toLowerCase())n=this.playercurrency;else if("amount"===o.toLowerCase()){let t=",",i=".",o=2;s&&(" "!==s[0]&&(t=s[0])," "!==s[1]&&(i=s[1])," "!==s[2]&&!isNaN(Number(s[2]))&&(o=Number(s[2])));let[r,a]=String(Math.floor(e*10**o)/10**o).split(".");n+=r[0];for(let e=1;e<r.length;++e)n+=(r.length-e)%3==0?t+r[e]:r[e];let c=a||"";const d="true"===this.alwaysshowdecimals,l=Number(this.maximumfractiondigits);if(d)c=c.padEnd(l||2,"0").substring(0,l);else if(!c)break;n+=i+c}n&&t.push(n),n=""}return t.push(n),t.join("")},this.handleSubmit=()=>{var e;this.consentsSubmitted=!0,null===(e=this.abortController)||void 0===e||e.abort(),this.abortController=new AbortController;const t=setTimeout((()=>{var e;null===(e=this.abortController)||void 0===e||e.abort("Request timed out")}),this.TIMEOUT_MS),n=`${this.endpoint}/api/pam/v1/actions/customer-funds-protection`,i=new Headers;return i.append("Content-Type","application/json"),i.append("X-SessionId",`${this.session}`),i.append("X-Tenant-ID",`${this.operatorid}`),fetch(n,{method:"POST",headers:i,body:JSON.stringify({accepted:!0}),signal:this.abortController.signal}).then((e=>{if(!e.ok)throw this.errorMessage=`${c("apiCallError",this.language)} ${e.status}`,new Error(`Request failed with status ${e.status}`);return 202===e.status?(this.errorMessage="",void window.postMessage({type:"ProtectionFundsAccepted"},window.location.href)):e.json()})).catch((e=>{var t;"AbortError"!==e.name?(console.error("Customer funds protection request failed:",e.message),this.errorMessage=c("serverNotResponding",this.language)):"Request timed out"===(null===(t=this.abortController)||void 0===t?void 0:t.signal.reason)&&(this.errorMessage=c("serverNotResponding",this.language))})).finally((()=>{clearTimeout(t),this.abortController=null}))},this.session=void 0,this.operatorid=void 0,this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.endpoint=void 0,this.language="en",this.translationUrl="",this.currencylocale="en",this.currencydisplay="symbol",this.maximumfractiondigits="2",this.minimumfractiondigits="0",this.customdisplayformat="",this.alwaysshowdecimals="true",this.playercurrency="EUR",this.userid=void 0,this.gmversion="gm16",this.totalcalculationmode="totalCashAmount",this.isLoading=!0,this.isConsentChecked=!1,this.totalCashAmount=0,this.errorMessage="",this.errorAmountMessage="",this.consentsSubmitted=!1}handleNewTranslations(){a(this.translationUrl)}handleClientStylingChange(e,t){e!=t&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&s(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}async componentWillLoad(){this.translationUrl.length>2&&await a(this.translationUrl)}componentDidLoad(){switch(this.stylingContainer&&(this.mbSource&&s(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl)),this.gmversion){case"gmcore":this.getPlayerAccountBalanceDataCore();break;case"gm16":this.getPlayerAccountBalanceData16();break;default:throw Error(`Invalid apiversion attribute: ${this.gmversion}`)}}disconnectedCallback(){var e;null===(e=this.abortController)||void 0===e||e.abort("Component unmounted"),this.stylingSubscription&&this.stylingSubscription.unsubscribe()}consentsArea(){return t("div",{class:"UserProtectionFundsCheckboxArea"},t("label",{class:"UserProtectionFundsCheckboxContent",htmlFor:"userProtectionFunds"},t("input",{ref:e=>this.checkboxInput=e,id:"userProtectionFunds",type:"checkbox",onInput:this.userLegislationConsentHandler}),t("span",{innerHTML:`${c("protectionCheckboxLabel",this.language)}`})))}render(){return t("div",{key:"4b83615d1b42c72de845e1ca293a162bd9e958ce",class:"QueryReferenceContainer",ref:e=>this.stylingContainer=e},this.isLoading?t("div",null,t("slot",{name:"spinner"}),t("svg",{class:"spinner",viewBox:"0 0 50 50"},t("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"}))):t("div",{class:"UserProtectionFundsContainer"},t("div",{class:"UserProtectionFundsTitle"},t("h2",null,c("protectionTitle",this.language))),t("div",{class:"UserProtectionFundsWrapper"},t("p",{innerHTML:`${c("protectionContent",this.language)}`})),t("div",{class:"UserProtectionFundsBalance"},t("p",null,c("balanceArea",this.language)," ",t("span",null,this.formatBalance(this.totalCashAmount)))),t("div",{class:"UserProtectionFundsButtonsWrapper"},t("div",null,this.consentsArea()),t("div",null,t("button",{class:"UserProtectionFundsSubmitButton",disabled:!this.isConsentChecked||""!=this.errorMessage||this.consentsSubmitted,onClick:this.handleSubmit},c("submitButtonText",this.language))),t("div",{class:"UserProtectionError"},t("p",null,""!=this.errorMessage&&this.errorMessage),t("p",null,""!=this.errorAmountMessage&&this.errorAmountMessage)))))}static get watchers(){return{translationUrl:["handleNewTranslations"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};d.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserProtectionFundsTitle{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserProtectionFundsContainer{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:center;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid var(--emw--color-disabled, #58586B);color:var(--emw--color-disabled, #58586B);cursor:unset}.ButtonsWrapper{display:flex;flex-direction:column;margin-top:10px;gap:40px}.ButtonsWrapper button:only-child{margin-left:auto}.UserProtectionError{color:var(--emw--color-error, #FD2839);text-align:center;height:22px}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:var(--emw--button-text-color, #000000)}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";export{d as U}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{U as user_funds_acknowledgment}from"./user-funds-acknowledgment-
|
|
1
|
+
export{U as user_funds_acknowledgment}from"./user-funds-acknowledgment-c9676919.js";import"./index-eb00caf2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as n,b as e}from"./index-eb00caf2.js";export{s as setNonce}from"./index-eb00caf2.js";import{g as t}from"./app-globals-0f993ce5.js";(()=>{const e=import.meta.url,t={};return""!==e&&(t.resourcesUrl=new URL(".",e).href),n(t)})().then((async n=>(await t(),e([["user-funds-acknowledgment",[[1,"user-funds-acknowledgment",{session:[513],operatorid:[513],mbSource:[513,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],endpoint:[513],language:[1537],translationUrl:[513,"translation-url"],currencylocale:[513],currencydisplay:[513],maximumfractiondigits:[513],minimumfractiondigits:[513],customdisplayformat:[513],alwaysshowdecimals:[513],playercurrency:[513],isLoading:[32],isConsentChecked:[32],totalCashAmount:[32],errorMessage:[32],consentsSubmitted:[32]},null,{translationUrl:["handleNewTranslations"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}]]]],n))));
|
|
1
|
+
import{p as n,b as e}from"./index-eb00caf2.js";export{s as setNonce}from"./index-eb00caf2.js";import{g as t}from"./app-globals-0f993ce5.js";(()=>{const e=import.meta.url,t={};return""!==e&&(t.resourcesUrl=new URL(".",e).href),n(t)})().then((async n=>(await t(),e([["user-funds-acknowledgment",[[1,"user-funds-acknowledgment",{session:[513],operatorid:[513],mbSource:[513,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],endpoint:[513],language:[1537],translationUrl:[513,"translation-url"],currencylocale:[513],currencydisplay:[513],maximumfractiondigits:[513],minimumfractiondigits:[513],customdisplayformat:[513],alwaysshowdecimals:[513],playercurrency:[513],userid:[1],gmversion:[513],totalcalculationmode:[513],isLoading:[32],isConsentChecked:[32],totalCashAmount:[32],errorMessage:[32],errorAmountMessage:[32],consentsSubmitted:[32]},null,{translationUrl:["handleNewTranslations"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}]]]],n))));
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as t}from"./index-eb00caf2.js";const n="__WIDGET_GLOBAL_STYLE_CACHE__";function o(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function i(e,t){if(!e||!t)return;const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function s(e,t,o,i=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!i)return o=function(e,t){const n=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(n.innerHTML=t,e.appendChild(n))}))}(e,t),o;window[n]||(window[n]={}),o=function(e,t){return window.emMessageBus.subscribe(t,(o=>{if(!e)return;const i=e.getRootNode(),s=window[n];let r=s[t]&&s[t].sheet;r?s[t].refCount=s[t].refCount+1:(r=new CSSStyleSheet,r.replaceSync(o),s[t]={sheet:r,refCount:1});const a=i.adoptedStyleSheets||[];a.includes(r)||(i.adoptedStyleSheets=[...a,r])}))}(e,t);const s=o.unsubscribe.bind(o);return o.unsubscribe=()=>{if(window[n][t]){const e=window[n][t];e.refCount>1?e.refCount=e.refCount-1:delete window[n][t]}s()},o}const r={en:{protectionTitle:"Protection of Customer Funds",protectionContent:'<p>We hold customer funds separate from company funds.<sup class="note"><a href="https://www.gamblingcommission.gov.uk/guidance/customer-funds-segregation-disclosure-to-customers-and-reporting/example-statements-that-might-be-used-in-terms-and-conditions-for-each-of#ref-2" target="_blank">12</a></sup> These funds ar <b>not protected</b> in the event of insolvency: <b>not protected segregation.</b></p><p>For more information, please see the <a href="https://www.gamblingcommission.gov.uk/guidance/customer-funds-segregation-disclosure-to-customers-and-reporting/the-customer-funds-insolvency-ratings-system" target="_blank">customer funds insolvency ratings system</a>.</p>',balanceArea:"Your current balance:",protectionCheckboxLabel:"I understand that my funds are <b>not protected</b> if the operator becomes insolvent.",userNoticeText:"Before you can proceed you must consent to the following",submitButtonText:"Confirm",serverNotResponding:"Server might not be responding",apiCallError:"Request failed with status "},"en-us":{protectionTitle:"Terms and Conditions",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Email marketing",privacyPolicyTitle:"Privacy Policy",userNoticeText:"Before you can proceed you must consent to the following",submitButtonText:"Submit",rejectButtonText:"Reject",rejectText:"Rejecting new consents will result in the inability to continue the login process and you will be logged out.",consentUpdateSuccess:"Consent update successful!",serverNotResponding:"Server might not be responding"},ro:{protectionTitle:"Termeni și Condiții",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing prin Email",privacyPolicyTitle:"Politica de Confidențialitate",userNoticeText:"Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele",submitButtonText:"Trimite",rejectButtonText:"Respinge",rejectText:"Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.",consentUpdateSuccess:"Actualizare consimțământ reușită!",serverNotResponding:"Serverul s-ar putea să nu răspundă"},hr:{protectionTitle:"Opći uvjeti i odredbe",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"E-mail makretinški sadržaj",privacyPolicyTitle:"Politika Privatnosti",userNoticeText:"Prije nego što možete nastaviti, morate pristati na sljedeće",submitButtonText:"Pošalji",rejectButtonText:"Odbij",rejectText:"Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.",consentUpdateSuccess:"Ažuriranje pristanka uspješno!",serverNotResponding:"Poslužitelj možda ne odgovara"},fr:{protectionTitle:"Termes et Conditions",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing par Email",privacyPolicyTitle:"Politique de Confidentialité",userNoticeText:"Avant de continuer, vous devez consentir aux éléments suivants",submitButtonText:"Soumettre",rejectButtonText:"Rejeter",rejectText:"Le rejet des nouveaux consentements entraînera l'impossibilité de continuer le processus de connexion et vous serez déconnecté.",consentUpdateSuccess:"Mise à jour du consentement réussie!",serverNotResponding:"Le serveur ne répond peut-être pas"},cs:{protectionTitle:"Podmínky a ujednání",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Emailový marketing",privacyPolicyTitle:"Zásady ochrany osobních údajů",userNoticeText:"Než budete moci pokračovat, musíte souhlasit s následujícím",submitButtonText:"Odeslat",rejectButtonText:"Odmítnout",rejectText:"Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.",consentUpdateSuccess:"Aktualizace souhlasu proběhla úspěšně!",serverNotResponding:"Server možná neodpovídá"},de:{protectionTitle:"Allgemeine Geschäftsbedingungen",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"E-Mail-Marketing",privacyPolicyTitle:"Datenschutzrichtlinie",userNoticeText:"Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen",submitButtonText:"Absenden",rejectButtonText:"Ablehnen",rejectText:"Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.",consentUpdateSuccess:"Zustimmung erfolgreich aktualisiert!",serverNotResponding:"Der Server antwortet möglicherweise nicht"},es:{protectionTitle:"Términos y Condiciones",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidad",userNoticeText:"Antes de continuar, debe dar su consentimiento a lo siguiente",submitButtonText:"Enviar",rejectButtonText:"Rechazar",rejectText:"Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.",consentUpdateSuccess:"¡Actualización del consentimiento exitosa!",serverNotResponding:"El servidor podría no estar respondiendo"},pt:{protectionTitle:"Termos e Condições",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidade",userNoticeText:"Antes de continuar, você deve consentir com o seguinte",submitButtonText:"Enviar",rejectButtonText:"Rejeitar",rejectText:"Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.",consentUpdateSuccess:"Atualização de consentimento bem-sucedida!",serverNotResponding:"O servidor pode não estar respondendo"},"es-mx":{protectionTitle:"Términos y Condiciones",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidad",userNoticeText:"Antes de continuar, debe dar su consentimiento a lo siguiente",submitButtonText:"Enviar",rejectButtonText:"Rechazar",rejectText:"Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.",consentUpdateSuccess:"¡Actualización del consentimiento exitosa!",serverNotResponding:"El servidor podría no estar respondiendo"},"pt-br":{protectionTitle:"Termos e Condições",protectionContent:"We hold customer funds separate from company funds.",balanceArea:"Marketing por Email",privacyPolicyTitle:"Política de Privacidade",userNoticeText:"Antes de continuar, você deve consentir com o seguinte",submitButtonText:"Enviar",rejectButtonText:"Rejeitar",rejectText:"Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.",consentUpdateSuccess:"Atualização de consentimento bem-sucedida!",serverNotResponding:"O servidor pode não estar respondendo"}},a=e=>new Promise((t=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{r[t]||(r[t]={});for(let n in e[t])r[t][n]=e[t][n]})),t(!0)}))})),c=(e,t,n)=>{let o=r[void 0!==t&&t in r?t:"en"][e];if(void 0!==n)for(const[e,t]of Object.entries(n.values)){const n=new RegExp(`{${e}}`,"g");o=o.replace(n,t)}return o},d=class{constructor(t){e(this,t),this.abortController=null,this.TIMEOUT_MS=1e4,this.formatBalance=e=>{if(this.customdisplayformat)return this.formatFromCustom(e);const t=this.currencylocale||this.language,n={style:"currency",currency:this.playercurrency,useGrouping:!0,currencyDisplay:this.currencydisplay,maximumFractionDigits:""===this.maximumfractiondigits||isNaN(Number(this.maximumfractiondigits))?2:Number(this.maximumfractiondigits),minimumFractionDigits:""===this.minimumfractiondigits||isNaN(Number(this.minimumfractiondigits))?0:Number(this.minimumfractiondigits)};return new Intl.NumberFormat(t,n).format(e)},this.formatFromCustom=e=>{const t=[];let n="";for(const o of this.customdisplayformat)switch(o){default:n+=o;break;case"{":n&&t.push(n),n="";break;case"}":const[i,s]=n.split("|");if(n="","currency"===i.toLowerCase())n=this.playercurrency;else if("amount"===i.toLowerCase()){let t=",",o=".",i=2;s&&(" "!==s[0]&&(t=s[0])," "!==s[1]&&(o=s[1])," "!==s[2]&&!isNaN(Number(s[2]))&&(i=Number(s[2])));let[r,a]=String(Math.floor(e*10**i)/10**i).split(".");n+=r[0];for(let e=1;e<r.length;++e)n+=(r.length-e)%3==0?t+r[e]:r[e];let c=a||"";const d="true"===this.alwaysshowdecimals,u=Number(this.maximumfractiondigits);if(d)c=c.padEnd(u||2,"0").substring(0,u);else if(!c)break;n+=o+c}n&&t.push(n),n=""}return t.push(n),t.join("")},this.handleSubmit=()=>{var e;this.consentsSubmitted=!0,null===(e=this.abortController)||void 0===e||e.abort(),this.abortController=new AbortController;const t=setTimeout((()=>{var e;null===(e=this.abortController)||void 0===e||e.abort("Request timed out")}),this.TIMEOUT_MS),n=`${this.endpoint}/api/pam/v1/actions/customer-funds-protection`,o=new Headers;return o.append("Content-Type","application/json"),o.append("X-SessionId",`${this.session}`),o.append("X-Tenant-ID",`${this.operatorid}`),fetch(n,{method:"POST",headers:o,body:JSON.stringify({accepted:!0}),signal:this.abortController.signal}).then((e=>{if(!e.ok)throw this.errorMessage=`${c("apiCallError",this.language)} ${e.status}`,new Error(`Request failed with status ${e.status}`);return 202===e.status?(this.errorMessage="",localStorage.removeItem("totalCashAmount"),void window.postMessage({type:"ProtectionFundsAccepted"},window.location.href)):e.json()})).catch((e=>{var t;"AbortError"!==e.name?(console.error("Customer funds protection request failed:",e.message),this.errorMessage=c("serverNotResponding",this.language)):"Request timed out"===(null===(t=this.abortController)||void 0===t?void 0:t.signal.reason)&&(this.errorMessage=c("serverNotResponding",this.language))})).finally((()=>{clearTimeout(t),this.abortController=null}))},this.session=void 0,this.operatorid=void 0,this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.endpoint=void 0,this.language="en",this.translationUrl="",this.currencylocale="en",this.currencydisplay="symbol",this.maximumfractiondigits="2",this.minimumfractiondigits="0",this.customdisplayformat="",this.alwaysshowdecimals="true",this.playercurrency="EUR",this.isLoading=!1,this.isConsentChecked=!1,this.totalCashAmount=0,this.errorMessage="",this.consentsSubmitted=!1}handleNewTranslations(){a(this.translationUrl)}handleClientStylingChange(e,t){e!=t&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&i(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&s(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}async componentWillLoad(){this.translationUrl.length>2&&await a(this.translationUrl),this.totalCashAmount=parseFloat(localStorage.getItem("totalCashAmount"))||0}componentDidLoad(){this.stylingContainer&&(this.mbSource&&s(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&i(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){var e;null===(e=this.abortController)||void 0===e||e.abort("Component unmounted"),this.stylingSubscription&&this.stylingSubscription.unsubscribe()}userLegislationConsentHandler(){this.checkboxInput&&(this.isConsentChecked=this.checkboxInput.checked),this.isConsentChecked&&(this.consentsSubmitted=!1,this.errorMessage="")}consentsArea(){return t("div",{class:"UserProtectionFundsCheckboxArea"},t("label",{class:"UserProtectionFundsCheckboxContent",htmlFor:"userProtectionFunds"},t("input",{ref:e=>this.checkboxInput=e,id:"userProtectionFunds",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),t("span",{innerHTML:`${c("protectionCheckboxLabel",this.language)}`})))}render(){return t("div",{key:"e6361dbe3338fd1bbf9b54eb41b3fddf0f8829c7",class:"QueryReferenceContainer",ref:e=>this.stylingContainer=e},this.isLoading?t("div",null,t("slot",{name:"spinner"}),t("svg",{class:"spinner",viewBox:"0 0 50 50"},t("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"}))):t("div",{class:"UserProtectionFundsContainer"},t("div",{class:"UserProtectionFundsTitle"},t("h2",null,c("protectionTitle",this.language))),t("div",{class:"UserProtectionFundsWrapper"},t("p",{innerHTML:`${c("protectionContent",this.language)}`})),t("div",{class:"UserProtectionFundsBalance"},t("p",null,c("balanceArea",this.language)," ",t("span",null,this.formatBalance(this.totalCashAmount)))),t("div",{class:"UserProtectionFundsButtonsWrapper"},t("div",null,this.consentsArea()),t("div",null,t("button",{class:"UserProtectionFundsSubmitButton",disabled:!this.isConsentChecked||""!=this.errorMessage||this.consentsSubmitted,onClick:this.handleSubmit},c("submitButtonText",this.language))),t("div",{class:"UserProtectionError"},""!=this.errorMessage&&this.errorMessage))))}static get watchers(){return{translationUrl:["handleNewTranslations"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};d.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserProtectionFundsTitle{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserProtectionFundsContainer{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:center;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc;cursor:unset}.ButtonsWrapper{display:flex;flex-direction:column;margin-top:10px;gap:40px}.ButtonsWrapper button:only-child{margin-left:auto}.UserProtectionError{color:var(--emw--color-error, #FD2839);text-align:center;height:22px}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:var(--emw--button-text-color, #000000)}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";export{d as U}
|