@everymatrix/temporary-consents 1.0.69
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/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-73481e72.js +1148 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/temporary-consents.cjs.entry.js +198 -0
- package/dist/cjs/temporary-consents.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/temporary-consents/index.js +1 -0
- package/dist/collection/components/temporary-consents/temporary-consents.css +58 -0
- package/dist/collection/components/temporary-consents/temporary-consents.js +289 -0
- package/dist/collection/components/temporary-consents/temporary-consents.type.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +57 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-6b1e7208.js +1122 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/temporary-consents.entry.js +194 -0
- package/dist/esm/temporary-consents.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +17 -0
- package/dist/temporary-consents/index.esm.js +0 -0
- package/dist/temporary-consents/p-14388d71.entry.js +1 -0
- package/dist/temporary-consents/p-e0f94cfb.js +2 -0
- package/dist/temporary-consents/p-e1255160.js +1 -0
- package/dist/temporary-consents/temporary-consents.esm.js +1 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/temporary-consents/.stencil/packages/stencil/temporary-consents/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/temporary-consents/.stencil/packages/stencil/temporary-consents/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/temporary-consents/index.d.ts +1 -0
- package/dist/types/components/temporary-consents/temporary-consents.d.ts +48 -0
- package/dist/types/components/temporary-consents/temporary-consents.type.d.ts +6 -0
- package/dist/types/components.d.ts +101 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +6 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-73481e72.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
const defineCustomElements = async (win, options) => {
|
|
9
|
+
if (typeof window === 'undefined') return undefined;
|
|
10
|
+
await appGlobals.globalScripts();
|
|
11
|
+
return index.bootstrapLazy([["temporary-consents.cjs",[[1,"temporary-consents",{"endpoint":[513],"userId":[513,"user-id"],"sessionId":[513,"session-id"],"daysUntilLockout":[513,"days-until-lockout"],"lang":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"stylingAppends":[32]}]]]], options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.setNonce = index.setNonce;
|
|
15
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-73481e72.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['en', 'hr'];
|
|
9
|
+
let TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
title: 'Participation conditions',
|
|
12
|
+
description: 'Important: Full verification is required in order to be able to use our entire offer. If verification is not completed, it is not possible to withdraw and the betting account will be locked in {daysUntilLockout} days.',
|
|
13
|
+
declineButton: 'Decline and log out',
|
|
14
|
+
acceptButton: 'Accept',
|
|
15
|
+
loading: 'Please wait, loading...'
|
|
16
|
+
},
|
|
17
|
+
hr: {
|
|
18
|
+
title: 'Uvjeti sudjelovanja',
|
|
19
|
+
description: 'Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.',
|
|
20
|
+
declineButton: 'Odbijte i odjavite se',
|
|
21
|
+
acceptButton: 'Prihvatiti',
|
|
22
|
+
loading: 'Molimo pričekajte, učitavanje...'
|
|
23
|
+
},
|
|
24
|
+
'es-mx': {
|
|
25
|
+
'title': 'Condiciones de participación',
|
|
26
|
+
'description': 'Importante: Una verificación completa es requerida para poder utilizar nuestra oferta. Si no se verifica, no será posible hacer retiros y la cuenta para realizar apuestas será bloqueada.',
|
|
27
|
+
'declineButton': 'Declinar y salir',
|
|
28
|
+
'acceptButton': 'Aceptar',
|
|
29
|
+
'Loading': 'Espere por favor, Cargando...'
|
|
30
|
+
},
|
|
31
|
+
'pt-br': {
|
|
32
|
+
'title': 'Condições de participação',
|
|
33
|
+
'description': 'Importante: É necessária uma verificação completa para poder utilizar a nossa oferta. Se não for verificado, os saques não serão possíveis e a conta de apostas será bloqueada.',
|
|
34
|
+
'declineButton': 'Recusar e sair',
|
|
35
|
+
'acceptButton': 'Aceitar',
|
|
36
|
+
'Loading': 'Espere, por favor, Carregando...'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getTranslations = (url) => {
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
fetch(url)
|
|
42
|
+
.then((res) => res.json())
|
|
43
|
+
.then((data) => {
|
|
44
|
+
Object.keys(data).forEach((item) => {
|
|
45
|
+
for (let key in data[item]) {
|
|
46
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
resolve(true);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const translate = (key, customLang, values) => {
|
|
54
|
+
const lang = customLang;
|
|
55
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
56
|
+
if (values !== undefined) {
|
|
57
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
58
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
59
|
+
translation = translation.replace(regex, value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return translation;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const temporaryConsentsCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0}:host{display:block}.TemporaryConsents{max-width:500px;display:flex;gap:35px;flex-direction:column;box-shadow:0px 1px 5px 1px rgba(0, 0, 0, 0.1);padding:20px;font-family:sans-serif}.TemporaryConsentsTitle{text-align:left;font-family:inherit;color:#000;font-weight:400;font-size:18px;display:block;border-bottom:1px solid #000;padding-bottom:10px}.TemporaryConsentsText{font-family:inherit;font-weight:300;font-size:16px}.TemporaryConsentsButtonsWrapper{display:flex;justify-content:space-evenly;gap:50px}.TemporaryConsentsButton{font-family:inherit;font-weight:300;font-size:14px;border:none;padding:10px;min-width:150px;border-radius:4px}.TemporaryConsentsButtonDecline{background-color:transparent;border:1px solid #000}.TemporaryConsentsButtonAccept{color:white;background-color:#000}";
|
|
66
|
+
const TemporaryConsentsStyle0 = temporaryConsentsCss;
|
|
67
|
+
|
|
68
|
+
const TemporaryConsents = class {
|
|
69
|
+
constructor(hostRef) {
|
|
70
|
+
index.registerInstance(this, hostRef);
|
|
71
|
+
this.isLoading = false;
|
|
72
|
+
this.setClientStyling = () => {
|
|
73
|
+
let sheet = document.createElement('style');
|
|
74
|
+
sheet.innerHTML = this.clientStyling;
|
|
75
|
+
this.stylingContainer.prepend(sheet);
|
|
76
|
+
};
|
|
77
|
+
this.setClientStylingURL = () => {
|
|
78
|
+
let url = new URL(this.clientStylingUrl);
|
|
79
|
+
let cssFile = document.createElement('style');
|
|
80
|
+
fetch(url.href)
|
|
81
|
+
.then((res) => res.text())
|
|
82
|
+
.then((data) => {
|
|
83
|
+
cssFile.innerHTML = data;
|
|
84
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
85
|
+
})
|
|
86
|
+
.catch((err) => {
|
|
87
|
+
console.log('error ', err);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
this.endpoint = undefined;
|
|
91
|
+
this.userId = undefined;
|
|
92
|
+
this.sessionId = undefined;
|
|
93
|
+
this.daysUntilLockout = undefined;
|
|
94
|
+
this.lang = undefined;
|
|
95
|
+
this.clientStyling = '';
|
|
96
|
+
this.clientStylingUrl = '';
|
|
97
|
+
this.translationUrl = '';
|
|
98
|
+
this.stylingAppends = false;
|
|
99
|
+
}
|
|
100
|
+
componentWillLoad() {
|
|
101
|
+
const promises = [];
|
|
102
|
+
if (this.endpoint && this.userId) {
|
|
103
|
+
const consentsPromise = this.getConsents().then((consents) => {
|
|
104
|
+
this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
|
|
105
|
+
});
|
|
106
|
+
promises.push(consentsPromise);
|
|
107
|
+
}
|
|
108
|
+
if (this.translationUrl) {
|
|
109
|
+
const translationPromise = getTranslations(this.translationUrl);
|
|
110
|
+
promises.push(translationPromise);
|
|
111
|
+
}
|
|
112
|
+
return Promise.all(promises);
|
|
113
|
+
}
|
|
114
|
+
componentDidRender() {
|
|
115
|
+
// start custom styling area
|
|
116
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
117
|
+
if (this.clientStyling)
|
|
118
|
+
this.setClientStyling();
|
|
119
|
+
if (this.clientStylingUrl)
|
|
120
|
+
this.setClientStylingURL();
|
|
121
|
+
this.stylingAppends = true;
|
|
122
|
+
}
|
|
123
|
+
// end custom styling area
|
|
124
|
+
}
|
|
125
|
+
getConsents() {
|
|
126
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
127
|
+
const headers = new Headers();
|
|
128
|
+
headers.append('X-SessionId', this.sessionId);
|
|
129
|
+
headers.append('Accept', 'application/json');
|
|
130
|
+
const options = {
|
|
131
|
+
method: 'GET',
|
|
132
|
+
headers
|
|
133
|
+
};
|
|
134
|
+
return new Promise((resolve, reject) => {
|
|
135
|
+
this.isLoading = true;
|
|
136
|
+
fetch(url.href, options)
|
|
137
|
+
.then((res) => res.json())
|
|
138
|
+
.then((consents) => {
|
|
139
|
+
resolve(consents);
|
|
140
|
+
}).catch((err) => {
|
|
141
|
+
console.error(err);
|
|
142
|
+
reject(err);
|
|
143
|
+
}).finally(() => {
|
|
144
|
+
this.isLoading = false;
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
setConsents() {
|
|
149
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
150
|
+
const headers = new Headers();
|
|
151
|
+
headers.append('X-SessionId', this.sessionId);
|
|
152
|
+
headers.append('Accept', 'application/json');
|
|
153
|
+
headers.append('Content-Type', 'application/json');
|
|
154
|
+
const body = {
|
|
155
|
+
consents: [{
|
|
156
|
+
tagCode: 'temporaryaccountconsent',
|
|
157
|
+
note: '',
|
|
158
|
+
status: 1
|
|
159
|
+
}]
|
|
160
|
+
};
|
|
161
|
+
const options = {
|
|
162
|
+
method: 'POST',
|
|
163
|
+
headers,
|
|
164
|
+
body: JSON.stringify(body)
|
|
165
|
+
};
|
|
166
|
+
return new Promise((resolve, reject) => {
|
|
167
|
+
this.isLoading = true;
|
|
168
|
+
fetch(url.href, options)
|
|
169
|
+
.then((res) => res.json())
|
|
170
|
+
.then((res) => {
|
|
171
|
+
resolve(res);
|
|
172
|
+
}).catch((err) => {
|
|
173
|
+
console.error(err);
|
|
174
|
+
reject(err);
|
|
175
|
+
}).finally(() => {
|
|
176
|
+
this.isLoading = false;
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
handleDecline() {
|
|
181
|
+
window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
|
|
182
|
+
}
|
|
183
|
+
handleAccept() {
|
|
184
|
+
this.setConsents();
|
|
185
|
+
window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
|
|
186
|
+
}
|
|
187
|
+
render() {
|
|
188
|
+
if (this.temporaryAccountConsent) {
|
|
189
|
+
if (this.isLoading) {
|
|
190
|
+
return index.h("p", null, translate('loading', this.lang));
|
|
191
|
+
}
|
|
192
|
+
return index.h("div", { class: 'TemporaryConsents', ref: el => this.stylingContainer = el }, index.h("h2", { class: 'TemporaryConsentsTitle' }, " ", translate('title', this.lang), " "), index.h("p", { class: 'TemporaryConsentsText' }, " ", translate('description', this.lang, { values: { daysUntilLockout: this.daysUntilLockout } }), " "), index.h("div", { class: 'TemporaryConsentsButtonsWrapper' }, index.h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonDecline', onClick: () => this.handleDecline() }, translate('declineButton', this.lang)), index.h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonAccept', onClick: this.handleAccept }, translate('acceptButton', this.lang))));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
TemporaryConsents.style = TemporaryConsentsStyle0;
|
|
197
|
+
|
|
198
|
+
exports.temporary_consents = TemporaryConsents;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-73481e72.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Stencil Client Patch Browser v4.20.0 | MIT Licensed | https://stenciljs.com
|
|
10
|
+
*/
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('temporary-consents.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["temporary-consents.cjs",[[1,"temporary-consents",{"endpoint":[513],"userId":[513,"user-id"],"sessionId":[513,"session-id"],"daysUntilLockout":[513,"days-until-lockout"],"lang":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"stylingAppends":[32]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TemporaryConsents } from './temporary-consents';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::after,
|
|
3
|
+
*::before {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.TemporaryConsents {
|
|
14
|
+
max-width: 500px;
|
|
15
|
+
display: flex;
|
|
16
|
+
gap: 35px;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.1);
|
|
19
|
+
padding: 20px;
|
|
20
|
+
font-family: sans-serif;
|
|
21
|
+
}
|
|
22
|
+
.TemporaryConsentsTitle {
|
|
23
|
+
text-align: left;
|
|
24
|
+
font-family: inherit;
|
|
25
|
+
color: #000;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
display: block;
|
|
29
|
+
border-bottom: 1px solid #000;
|
|
30
|
+
padding-bottom: 10px;
|
|
31
|
+
}
|
|
32
|
+
.TemporaryConsentsText {
|
|
33
|
+
font-family: inherit;
|
|
34
|
+
font-weight: 300;
|
|
35
|
+
font-size: 16px;
|
|
36
|
+
}
|
|
37
|
+
.TemporaryConsentsButtonsWrapper {
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: space-evenly;
|
|
40
|
+
gap: 50px;
|
|
41
|
+
}
|
|
42
|
+
.TemporaryConsentsButton {
|
|
43
|
+
font-family: inherit;
|
|
44
|
+
font-weight: 300;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
border: none;
|
|
47
|
+
padding: 10px;
|
|
48
|
+
min-width: 150px;
|
|
49
|
+
border-radius: 4px;
|
|
50
|
+
}
|
|
51
|
+
.TemporaryConsentsButtonDecline {
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
border: 1px solid #000;
|
|
54
|
+
}
|
|
55
|
+
.TemporaryConsentsButtonAccept {
|
|
56
|
+
color: white;
|
|
57
|
+
background-color: #000;
|
|
58
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { getTranslations, translate } from "../../utils/locale.utils";
|
|
3
|
+
export class TemporaryConsents {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.isLoading = false;
|
|
6
|
+
this.setClientStyling = () => {
|
|
7
|
+
let sheet = document.createElement('style');
|
|
8
|
+
sheet.innerHTML = this.clientStyling;
|
|
9
|
+
this.stylingContainer.prepend(sheet);
|
|
10
|
+
};
|
|
11
|
+
this.setClientStylingURL = () => {
|
|
12
|
+
let url = new URL(this.clientStylingUrl);
|
|
13
|
+
let cssFile = document.createElement('style');
|
|
14
|
+
fetch(url.href)
|
|
15
|
+
.then((res) => res.text())
|
|
16
|
+
.then((data) => {
|
|
17
|
+
cssFile.innerHTML = data;
|
|
18
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
19
|
+
})
|
|
20
|
+
.catch((err) => {
|
|
21
|
+
console.log('error ', err);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
this.endpoint = undefined;
|
|
25
|
+
this.userId = undefined;
|
|
26
|
+
this.sessionId = undefined;
|
|
27
|
+
this.daysUntilLockout = undefined;
|
|
28
|
+
this.lang = undefined;
|
|
29
|
+
this.clientStyling = '';
|
|
30
|
+
this.clientStylingUrl = '';
|
|
31
|
+
this.translationUrl = '';
|
|
32
|
+
this.stylingAppends = false;
|
|
33
|
+
}
|
|
34
|
+
componentWillLoad() {
|
|
35
|
+
const promises = [];
|
|
36
|
+
if (this.endpoint && this.userId) {
|
|
37
|
+
const consentsPromise = this.getConsents().then((consents) => {
|
|
38
|
+
this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
|
|
39
|
+
});
|
|
40
|
+
promises.push(consentsPromise);
|
|
41
|
+
}
|
|
42
|
+
if (this.translationUrl) {
|
|
43
|
+
const translationPromise = getTranslations(this.translationUrl);
|
|
44
|
+
promises.push(translationPromise);
|
|
45
|
+
}
|
|
46
|
+
return Promise.all(promises);
|
|
47
|
+
}
|
|
48
|
+
componentDidRender() {
|
|
49
|
+
// start custom styling area
|
|
50
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
51
|
+
if (this.clientStyling)
|
|
52
|
+
this.setClientStyling();
|
|
53
|
+
if (this.clientStylingUrl)
|
|
54
|
+
this.setClientStylingURL();
|
|
55
|
+
this.stylingAppends = true;
|
|
56
|
+
}
|
|
57
|
+
// end custom styling area
|
|
58
|
+
}
|
|
59
|
+
getConsents() {
|
|
60
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
61
|
+
const headers = new Headers();
|
|
62
|
+
headers.append('X-SessionId', this.sessionId);
|
|
63
|
+
headers.append('Accept', 'application/json');
|
|
64
|
+
const options = {
|
|
65
|
+
method: 'GET',
|
|
66
|
+
headers
|
|
67
|
+
};
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
this.isLoading = true;
|
|
70
|
+
fetch(url.href, options)
|
|
71
|
+
.then((res) => res.json())
|
|
72
|
+
.then((consents) => {
|
|
73
|
+
resolve(consents);
|
|
74
|
+
}).catch((err) => {
|
|
75
|
+
console.error(err);
|
|
76
|
+
reject(err);
|
|
77
|
+
}).finally(() => {
|
|
78
|
+
this.isLoading = false;
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
setConsents() {
|
|
83
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
84
|
+
const headers = new Headers();
|
|
85
|
+
headers.append('X-SessionId', this.sessionId);
|
|
86
|
+
headers.append('Accept', 'application/json');
|
|
87
|
+
headers.append('Content-Type', 'application/json');
|
|
88
|
+
const body = {
|
|
89
|
+
consents: [{
|
|
90
|
+
tagCode: 'temporaryaccountconsent',
|
|
91
|
+
note: '',
|
|
92
|
+
status: 1
|
|
93
|
+
}]
|
|
94
|
+
};
|
|
95
|
+
const options = {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers,
|
|
98
|
+
body: JSON.stringify(body)
|
|
99
|
+
};
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
this.isLoading = true;
|
|
102
|
+
fetch(url.href, options)
|
|
103
|
+
.then((res) => res.json())
|
|
104
|
+
.then((res) => {
|
|
105
|
+
resolve(res);
|
|
106
|
+
}).catch((err) => {
|
|
107
|
+
console.error(err);
|
|
108
|
+
reject(err);
|
|
109
|
+
}).finally(() => {
|
|
110
|
+
this.isLoading = false;
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
handleDecline() {
|
|
115
|
+
window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
|
|
116
|
+
}
|
|
117
|
+
handleAccept() {
|
|
118
|
+
this.setConsents();
|
|
119
|
+
window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
|
|
120
|
+
}
|
|
121
|
+
render() {
|
|
122
|
+
if (this.temporaryAccountConsent) {
|
|
123
|
+
if (this.isLoading) {
|
|
124
|
+
return h("p", null, translate('loading', this.lang));
|
|
125
|
+
}
|
|
126
|
+
return h("div", { class: 'TemporaryConsents', ref: el => this.stylingContainer = el }, h("h2", { class: 'TemporaryConsentsTitle' }, " ", translate('title', this.lang), " "), h("p", { class: 'TemporaryConsentsText' }, " ", translate('description', this.lang, { values: { daysUntilLockout: this.daysUntilLockout } }), " "), h("div", { class: 'TemporaryConsentsButtonsWrapper' }, h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonDecline', onClick: () => this.handleDecline() }, translate('declineButton', this.lang)), h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonAccept', onClick: this.handleAccept }, translate('acceptButton', this.lang))));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
static get is() { return "temporary-consents"; }
|
|
130
|
+
static get encapsulation() { return "shadow"; }
|
|
131
|
+
static get originalStyleUrls() {
|
|
132
|
+
return {
|
|
133
|
+
"$": ["temporary-consents.scss"]
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
static get styleUrls() {
|
|
137
|
+
return {
|
|
138
|
+
"$": ["temporary-consents.css"]
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
static get properties() {
|
|
142
|
+
return {
|
|
143
|
+
"endpoint": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "string",
|
|
148
|
+
"resolved": "string",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": true,
|
|
152
|
+
"optional": false,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": "The NWA endpoint"
|
|
156
|
+
},
|
|
157
|
+
"attribute": "endpoint",
|
|
158
|
+
"reflect": true
|
|
159
|
+
},
|
|
160
|
+
"userId": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"mutable": false,
|
|
163
|
+
"complexType": {
|
|
164
|
+
"original": "string",
|
|
165
|
+
"resolved": "string",
|
|
166
|
+
"references": {}
|
|
167
|
+
},
|
|
168
|
+
"required": true,
|
|
169
|
+
"optional": false,
|
|
170
|
+
"docs": {
|
|
171
|
+
"tags": [],
|
|
172
|
+
"text": "The NWA user id"
|
|
173
|
+
},
|
|
174
|
+
"attribute": "user-id",
|
|
175
|
+
"reflect": true
|
|
176
|
+
},
|
|
177
|
+
"sessionId": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"mutable": false,
|
|
180
|
+
"complexType": {
|
|
181
|
+
"original": "string",
|
|
182
|
+
"resolved": "string",
|
|
183
|
+
"references": {}
|
|
184
|
+
},
|
|
185
|
+
"required": true,
|
|
186
|
+
"optional": false,
|
|
187
|
+
"docs": {
|
|
188
|
+
"tags": [],
|
|
189
|
+
"text": "The NWA session for the logged in user"
|
|
190
|
+
},
|
|
191
|
+
"attribute": "session-id",
|
|
192
|
+
"reflect": true
|
|
193
|
+
},
|
|
194
|
+
"daysUntilLockout": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"mutable": false,
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "string",
|
|
199
|
+
"resolved": "string",
|
|
200
|
+
"references": {}
|
|
201
|
+
},
|
|
202
|
+
"required": false,
|
|
203
|
+
"optional": false,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "The language of the integrator"
|
|
207
|
+
},
|
|
208
|
+
"attribute": "days-until-lockout",
|
|
209
|
+
"reflect": true
|
|
210
|
+
},
|
|
211
|
+
"lang": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"mutable": false,
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "string",
|
|
216
|
+
"resolved": "string",
|
|
217
|
+
"references": {}
|
|
218
|
+
},
|
|
219
|
+
"required": false,
|
|
220
|
+
"optional": false,
|
|
221
|
+
"docs": {
|
|
222
|
+
"tags": [],
|
|
223
|
+
"text": "The language of the integrator"
|
|
224
|
+
},
|
|
225
|
+
"attribute": "lang",
|
|
226
|
+
"reflect": true
|
|
227
|
+
},
|
|
228
|
+
"clientStyling": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"mutable": false,
|
|
231
|
+
"complexType": {
|
|
232
|
+
"original": "string",
|
|
233
|
+
"resolved": "string",
|
|
234
|
+
"references": {}
|
|
235
|
+
},
|
|
236
|
+
"required": false,
|
|
237
|
+
"optional": false,
|
|
238
|
+
"docs": {
|
|
239
|
+
"tags": [],
|
|
240
|
+
"text": "Client custom styling via inline styles"
|
|
241
|
+
},
|
|
242
|
+
"attribute": "client-styling",
|
|
243
|
+
"reflect": true,
|
|
244
|
+
"defaultValue": "''"
|
|
245
|
+
},
|
|
246
|
+
"clientStylingUrl": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"mutable": false,
|
|
249
|
+
"complexType": {
|
|
250
|
+
"original": "string",
|
|
251
|
+
"resolved": "string",
|
|
252
|
+
"references": {}
|
|
253
|
+
},
|
|
254
|
+
"required": false,
|
|
255
|
+
"optional": false,
|
|
256
|
+
"docs": {
|
|
257
|
+
"tags": [],
|
|
258
|
+
"text": "Client custom styling via url"
|
|
259
|
+
},
|
|
260
|
+
"attribute": "client-styling-url",
|
|
261
|
+
"reflect": true,
|
|
262
|
+
"defaultValue": "''"
|
|
263
|
+
},
|
|
264
|
+
"translationUrl": {
|
|
265
|
+
"type": "string",
|
|
266
|
+
"mutable": false,
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "string",
|
|
269
|
+
"resolved": "string",
|
|
270
|
+
"references": {}
|
|
271
|
+
},
|
|
272
|
+
"required": false,
|
|
273
|
+
"optional": false,
|
|
274
|
+
"docs": {
|
|
275
|
+
"tags": [],
|
|
276
|
+
"text": "Translation via url"
|
|
277
|
+
},
|
|
278
|
+
"attribute": "translation-url",
|
|
279
|
+
"reflect": true,
|
|
280
|
+
"defaultValue": "''"
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
static get states() {
|
|
285
|
+
return {
|
|
286
|
+
"stylingAppends": {}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['en', 'hr'];
|
|
3
|
+
let TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
title: 'Participation conditions',
|
|
6
|
+
description: 'Important: Full verification is required in order to be able to use our entire offer. If verification is not completed, it is not possible to withdraw and the betting account will be locked in {daysUntilLockout} days.',
|
|
7
|
+
declineButton: 'Decline and log out',
|
|
8
|
+
acceptButton: 'Accept',
|
|
9
|
+
loading: 'Please wait, loading...'
|
|
10
|
+
},
|
|
11
|
+
hr: {
|
|
12
|
+
title: 'Uvjeti sudjelovanja',
|
|
13
|
+
description: 'Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.',
|
|
14
|
+
declineButton: 'Odbijte i odjavite se',
|
|
15
|
+
acceptButton: 'Prihvatiti',
|
|
16
|
+
loading: 'Molimo pričekajte, učitavanje...'
|
|
17
|
+
},
|
|
18
|
+
'es-mx': {
|
|
19
|
+
'title': 'Condiciones de participación',
|
|
20
|
+
'description': 'Importante: Una verificación completa es requerida para poder utilizar nuestra oferta. Si no se verifica, no será posible hacer retiros y la cuenta para realizar apuestas será bloqueada.',
|
|
21
|
+
'declineButton': 'Declinar y salir',
|
|
22
|
+
'acceptButton': 'Aceptar',
|
|
23
|
+
'Loading': 'Espere por favor, Cargando...'
|
|
24
|
+
},
|
|
25
|
+
'pt-br': {
|
|
26
|
+
'title': 'Condições de participação',
|
|
27
|
+
'description': 'Importante: É necessária uma verificação completa para poder utilizar a nossa oferta. Se não for verificado, os saques não serão possíveis e a conta de apostas será bloqueada.',
|
|
28
|
+
'declineButton': 'Recusar e sair',
|
|
29
|
+
'acceptButton': 'Aceitar',
|
|
30
|
+
'Loading': 'Espere, por favor, Carregando...'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const getTranslations = (url) => {
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
fetch(url)
|
|
36
|
+
.then((res) => res.json())
|
|
37
|
+
.then((data) => {
|
|
38
|
+
Object.keys(data).forEach((item) => {
|
|
39
|
+
for (let key in data[item]) {
|
|
40
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
resolve(true);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export const translate = (key, customLang, values) => {
|
|
48
|
+
const lang = customLang;
|
|
49
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
50
|
+
if (values !== undefined) {
|
|
51
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
52
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
53
|
+
translation = translation.replace(regex, value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return translation;
|
|
57
|
+
};
|