@everymatrix/temporary-consents 1.12.1
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-51051de1.js +1163 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/temporary-consents.cjs.entry.js +180 -0
- package/dist/cjs/temporary-consents.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/temporary-consents/temporary-consents.css +58 -0
- package/dist/collection/components/temporary-consents/temporary-consents.js +296 -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 +36 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/temporary-consents.d.ts +11 -0
- package/dist/components/temporary-consents.js +204 -0
- package/dist/esm/index-0f95c245.js +1138 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/temporary-consents.entry.js +176 -0
- package/dist/esm/temporary-consents.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/temporary-consents/index.esm.js +0 -0
- package/dist/temporary-consents/p-c2ffe442.entry.js +1 -0
- package/dist/temporary-consents/p-c8fa79f6.js +1 -0
- package/dist/temporary-consents/temporary-consents.esm.js +1 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/temporary-consents/.stencil/packages/temporary-consents/stencil.config.d.ts +2 -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 +1565 -0
- package/dist/types/utils/locale.utils.d.ts +6 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-51051de1.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
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);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-51051de1.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['en'];
|
|
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
|
+
};
|
|
18
|
+
const getTranslations = (url) => {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
fetch(url)
|
|
21
|
+
.then((res) => res.json())
|
|
22
|
+
.then((data) => {
|
|
23
|
+
Object.keys(data).forEach((item) => {
|
|
24
|
+
for (let key in data[item]) {
|
|
25
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
resolve(true);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const translate = (key, customLang, values) => {
|
|
33
|
+
const lang = customLang;
|
|
34
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
35
|
+
if (values !== undefined) {
|
|
36
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
37
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
38
|
+
translation = translation.replace(regex, value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return translation;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
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}";
|
|
45
|
+
|
|
46
|
+
const TemporaryConsents = class {
|
|
47
|
+
constructor(hostRef) {
|
|
48
|
+
index.registerInstance(this, hostRef);
|
|
49
|
+
/**
|
|
50
|
+
* Client custom styling via inline styles
|
|
51
|
+
*/
|
|
52
|
+
this.clientStyling = '';
|
|
53
|
+
/**
|
|
54
|
+
* Client custom styling via url
|
|
55
|
+
*/
|
|
56
|
+
this.clientStylingUrl = '';
|
|
57
|
+
/**
|
|
58
|
+
* Translation via url
|
|
59
|
+
*/
|
|
60
|
+
this.translationUrl = '';
|
|
61
|
+
this.stylingAppends = false;
|
|
62
|
+
this.isLoading = false;
|
|
63
|
+
this.setClientStyling = () => {
|
|
64
|
+
let sheet = document.createElement('style');
|
|
65
|
+
sheet.innerHTML = this.clientStyling;
|
|
66
|
+
this.stylingContainer.prepend(sheet);
|
|
67
|
+
};
|
|
68
|
+
this.setClientStylingURL = () => {
|
|
69
|
+
let url = new URL(this.clientStylingUrl);
|
|
70
|
+
let cssFile = document.createElement('style');
|
|
71
|
+
fetch(url.href)
|
|
72
|
+
.then((res) => res.text())
|
|
73
|
+
.then((data) => {
|
|
74
|
+
cssFile.innerHTML = data;
|
|
75
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
76
|
+
})
|
|
77
|
+
.catch((err) => {
|
|
78
|
+
console.log('error ', err);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
componentWillLoad() {
|
|
83
|
+
const promises = [];
|
|
84
|
+
if (this.endpoint && this.userId) {
|
|
85
|
+
const consentsPromise = this.getConsents().then((consents) => {
|
|
86
|
+
this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
|
|
87
|
+
});
|
|
88
|
+
promises.push(consentsPromise);
|
|
89
|
+
}
|
|
90
|
+
if (this.translationUrl) {
|
|
91
|
+
const translationPromise = getTranslations(this.translationUrl);
|
|
92
|
+
promises.push(translationPromise);
|
|
93
|
+
}
|
|
94
|
+
return Promise.all(promises);
|
|
95
|
+
}
|
|
96
|
+
componentDidRender() {
|
|
97
|
+
// start custom styling area
|
|
98
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
99
|
+
if (this.clientStyling)
|
|
100
|
+
this.setClientStyling();
|
|
101
|
+
if (this.clientStylingUrl)
|
|
102
|
+
this.setClientStylingURL();
|
|
103
|
+
this.stylingAppends = true;
|
|
104
|
+
}
|
|
105
|
+
// end custom styling area
|
|
106
|
+
}
|
|
107
|
+
getConsents() {
|
|
108
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
109
|
+
const headers = new Headers();
|
|
110
|
+
headers.append('X-SessionId', this.sessionId);
|
|
111
|
+
headers.append('Accept', 'application/json');
|
|
112
|
+
const options = {
|
|
113
|
+
method: 'GET',
|
|
114
|
+
headers
|
|
115
|
+
};
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
this.isLoading = true;
|
|
118
|
+
fetch(url.href, options)
|
|
119
|
+
.then((res) => res.json())
|
|
120
|
+
.then((consents) => {
|
|
121
|
+
resolve(consents);
|
|
122
|
+
}).catch((err) => {
|
|
123
|
+
console.error(err);
|
|
124
|
+
reject(err);
|
|
125
|
+
}).finally(() => {
|
|
126
|
+
this.isLoading = false;
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
setConsents() {
|
|
131
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
132
|
+
const headers = new Headers();
|
|
133
|
+
headers.append('X-SessionId', this.sessionId);
|
|
134
|
+
headers.append('Accept', 'application/json');
|
|
135
|
+
headers.append('Content-Type', 'application/json');
|
|
136
|
+
const body = {
|
|
137
|
+
consents: [{
|
|
138
|
+
tagCode: 'temporaryaccountconsent',
|
|
139
|
+
note: '',
|
|
140
|
+
status: 1
|
|
141
|
+
}]
|
|
142
|
+
};
|
|
143
|
+
const options = {
|
|
144
|
+
method: 'POST',
|
|
145
|
+
headers,
|
|
146
|
+
body: JSON.stringify(body)
|
|
147
|
+
};
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
this.isLoading = true;
|
|
150
|
+
fetch(url.href, options)
|
|
151
|
+
.then((res) => res.json())
|
|
152
|
+
.then((res) => {
|
|
153
|
+
resolve(res);
|
|
154
|
+
}).catch((err) => {
|
|
155
|
+
console.error(err);
|
|
156
|
+
reject(err);
|
|
157
|
+
}).finally(() => {
|
|
158
|
+
this.isLoading = false;
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
handleDecline() {
|
|
163
|
+
window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
|
|
164
|
+
}
|
|
165
|
+
handleAccept() {
|
|
166
|
+
this.setConsents();
|
|
167
|
+
window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
|
|
168
|
+
}
|
|
169
|
+
render() {
|
|
170
|
+
if (this.temporaryAccountConsent) {
|
|
171
|
+
if (this.isLoading) {
|
|
172
|
+
return index.h("p", null, translate('loading', this.lang));
|
|
173
|
+
}
|
|
174
|
+
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))));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
TemporaryConsents.style = temporaryConsentsCss;
|
|
179
|
+
|
|
180
|
+
exports.temporary_consents = TemporaryConsents;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-51051de1.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
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));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
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);
|
|
19
|
+
});
|
|
@@ -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,296 @@
|
|
|
1
|
+
import { Component, h, Prop, State } from '@stencil/core';
|
|
2
|
+
import { getTranslations, translate } from '../../utils/locale.utils';
|
|
3
|
+
export class TemporaryConsents {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Client custom styling via inline styles
|
|
7
|
+
*/
|
|
8
|
+
this.clientStyling = '';
|
|
9
|
+
/**
|
|
10
|
+
* Client custom styling via url
|
|
11
|
+
*/
|
|
12
|
+
this.clientStylingUrl = '';
|
|
13
|
+
/**
|
|
14
|
+
* Translation via url
|
|
15
|
+
*/
|
|
16
|
+
this.translationUrl = '';
|
|
17
|
+
this.stylingAppends = false;
|
|
18
|
+
this.isLoading = false;
|
|
19
|
+
this.setClientStyling = () => {
|
|
20
|
+
let sheet = document.createElement('style');
|
|
21
|
+
sheet.innerHTML = this.clientStyling;
|
|
22
|
+
this.stylingContainer.prepend(sheet);
|
|
23
|
+
};
|
|
24
|
+
this.setClientStylingURL = () => {
|
|
25
|
+
let url = new URL(this.clientStylingUrl);
|
|
26
|
+
let cssFile = document.createElement('style');
|
|
27
|
+
fetch(url.href)
|
|
28
|
+
.then((res) => res.text())
|
|
29
|
+
.then((data) => {
|
|
30
|
+
cssFile.innerHTML = data;
|
|
31
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
32
|
+
})
|
|
33
|
+
.catch((err) => {
|
|
34
|
+
console.log('error ', err);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
componentWillLoad() {
|
|
39
|
+
const promises = [];
|
|
40
|
+
if (this.endpoint && this.userId) {
|
|
41
|
+
const consentsPromise = this.getConsents().then((consents) => {
|
|
42
|
+
this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
|
|
43
|
+
});
|
|
44
|
+
promises.push(consentsPromise);
|
|
45
|
+
}
|
|
46
|
+
if (this.translationUrl) {
|
|
47
|
+
const translationPromise = getTranslations(this.translationUrl);
|
|
48
|
+
promises.push(translationPromise);
|
|
49
|
+
}
|
|
50
|
+
return Promise.all(promises);
|
|
51
|
+
}
|
|
52
|
+
componentDidRender() {
|
|
53
|
+
// start custom styling area
|
|
54
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
55
|
+
if (this.clientStyling)
|
|
56
|
+
this.setClientStyling();
|
|
57
|
+
if (this.clientStylingUrl)
|
|
58
|
+
this.setClientStylingURL();
|
|
59
|
+
this.stylingAppends = true;
|
|
60
|
+
}
|
|
61
|
+
// end custom styling area
|
|
62
|
+
}
|
|
63
|
+
getConsents() {
|
|
64
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
65
|
+
const headers = new Headers();
|
|
66
|
+
headers.append('X-SessionId', this.sessionId);
|
|
67
|
+
headers.append('Accept', 'application/json');
|
|
68
|
+
const options = {
|
|
69
|
+
method: 'GET',
|
|
70
|
+
headers
|
|
71
|
+
};
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
this.isLoading = true;
|
|
74
|
+
fetch(url.href, options)
|
|
75
|
+
.then((res) => res.json())
|
|
76
|
+
.then((consents) => {
|
|
77
|
+
resolve(consents);
|
|
78
|
+
}).catch((err) => {
|
|
79
|
+
console.error(err);
|
|
80
|
+
reject(err);
|
|
81
|
+
}).finally(() => {
|
|
82
|
+
this.isLoading = false;
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
setConsents() {
|
|
87
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
88
|
+
const headers = new Headers();
|
|
89
|
+
headers.append('X-SessionId', this.sessionId);
|
|
90
|
+
headers.append('Accept', 'application/json');
|
|
91
|
+
headers.append('Content-Type', 'application/json');
|
|
92
|
+
const body = {
|
|
93
|
+
consents: [{
|
|
94
|
+
tagCode: 'temporaryaccountconsent',
|
|
95
|
+
note: '',
|
|
96
|
+
status: 1
|
|
97
|
+
}]
|
|
98
|
+
};
|
|
99
|
+
const options = {
|
|
100
|
+
method: 'POST',
|
|
101
|
+
headers,
|
|
102
|
+
body: JSON.stringify(body)
|
|
103
|
+
};
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
this.isLoading = true;
|
|
106
|
+
fetch(url.href, options)
|
|
107
|
+
.then((res) => res.json())
|
|
108
|
+
.then((res) => {
|
|
109
|
+
resolve(res);
|
|
110
|
+
}).catch((err) => {
|
|
111
|
+
console.error(err);
|
|
112
|
+
reject(err);
|
|
113
|
+
}).finally(() => {
|
|
114
|
+
this.isLoading = false;
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
handleDecline() {
|
|
119
|
+
window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
|
|
120
|
+
}
|
|
121
|
+
handleAccept() {
|
|
122
|
+
this.setConsents();
|
|
123
|
+
window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
|
|
124
|
+
}
|
|
125
|
+
render() {
|
|
126
|
+
if (this.temporaryAccountConsent) {
|
|
127
|
+
if (this.isLoading) {
|
|
128
|
+
return h("p", null, translate('loading', this.lang));
|
|
129
|
+
}
|
|
130
|
+
return h("div", { class: 'TemporaryConsents', ref: el => this.stylingContainer = el },
|
|
131
|
+
h("h2", { class: 'TemporaryConsentsTitle' },
|
|
132
|
+
" ",
|
|
133
|
+
translate('title', this.lang),
|
|
134
|
+
" "),
|
|
135
|
+
h("p", { class: 'TemporaryConsentsText' },
|
|
136
|
+
" ",
|
|
137
|
+
translate('description', this.lang, { values: { daysUntilLockout: this.daysUntilLockout } }),
|
|
138
|
+
" "),
|
|
139
|
+
h("div", { class: 'TemporaryConsentsButtonsWrapper' },
|
|
140
|
+
h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonDecline', onClick: () => this.handleDecline() }, translate('declineButton', this.lang)),
|
|
141
|
+
h("button", { class: 'TemporaryConsentsButton TemporaryConsentsButtonAccept', onClick: this.handleAccept }, translate('acceptButton', this.lang))));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
static get is() { return "temporary-consents"; }
|
|
145
|
+
static get encapsulation() { return "shadow"; }
|
|
146
|
+
static get originalStyleUrls() { return {
|
|
147
|
+
"$": ["temporary-consents.scss"]
|
|
148
|
+
}; }
|
|
149
|
+
static get styleUrls() { return {
|
|
150
|
+
"$": ["temporary-consents.css"]
|
|
151
|
+
}; }
|
|
152
|
+
static get properties() { return {
|
|
153
|
+
"endpoint": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "string",
|
|
158
|
+
"resolved": "string",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": true,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": "The NWA endpoint"
|
|
166
|
+
},
|
|
167
|
+
"attribute": "endpoint",
|
|
168
|
+
"reflect": true
|
|
169
|
+
},
|
|
170
|
+
"userId": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"mutable": false,
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "string",
|
|
175
|
+
"resolved": "string",
|
|
176
|
+
"references": {}
|
|
177
|
+
},
|
|
178
|
+
"required": true,
|
|
179
|
+
"optional": false,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": "The NWA user id"
|
|
183
|
+
},
|
|
184
|
+
"attribute": "user-id",
|
|
185
|
+
"reflect": true
|
|
186
|
+
},
|
|
187
|
+
"sessionId": {
|
|
188
|
+
"type": "string",
|
|
189
|
+
"mutable": false,
|
|
190
|
+
"complexType": {
|
|
191
|
+
"original": "string",
|
|
192
|
+
"resolved": "string",
|
|
193
|
+
"references": {}
|
|
194
|
+
},
|
|
195
|
+
"required": true,
|
|
196
|
+
"optional": false,
|
|
197
|
+
"docs": {
|
|
198
|
+
"tags": [],
|
|
199
|
+
"text": "The NWA session for the logged in user"
|
|
200
|
+
},
|
|
201
|
+
"attribute": "session-id",
|
|
202
|
+
"reflect": true
|
|
203
|
+
},
|
|
204
|
+
"daysUntilLockout": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"mutable": false,
|
|
207
|
+
"complexType": {
|
|
208
|
+
"original": "string",
|
|
209
|
+
"resolved": "string",
|
|
210
|
+
"references": {}
|
|
211
|
+
},
|
|
212
|
+
"required": false,
|
|
213
|
+
"optional": false,
|
|
214
|
+
"docs": {
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": "The language of the integrator"
|
|
217
|
+
},
|
|
218
|
+
"attribute": "days-until-lockout",
|
|
219
|
+
"reflect": true
|
|
220
|
+
},
|
|
221
|
+
"lang": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": false,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "The language of the integrator"
|
|
234
|
+
},
|
|
235
|
+
"attribute": "lang",
|
|
236
|
+
"reflect": true
|
|
237
|
+
},
|
|
238
|
+
"clientStyling": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "string",
|
|
243
|
+
"resolved": "string",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Client custom styling via inline styles"
|
|
251
|
+
},
|
|
252
|
+
"attribute": "client-styling",
|
|
253
|
+
"reflect": true,
|
|
254
|
+
"defaultValue": "''"
|
|
255
|
+
},
|
|
256
|
+
"clientStylingUrl": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "Client custom styling via url"
|
|
269
|
+
},
|
|
270
|
+
"attribute": "client-styling-url",
|
|
271
|
+
"reflect": true,
|
|
272
|
+
"defaultValue": "''"
|
|
273
|
+
},
|
|
274
|
+
"translationUrl": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"mutable": false,
|
|
277
|
+
"complexType": {
|
|
278
|
+
"original": "string",
|
|
279
|
+
"resolved": "string",
|
|
280
|
+
"references": {}
|
|
281
|
+
},
|
|
282
|
+
"required": false,
|
|
283
|
+
"optional": false,
|
|
284
|
+
"docs": {
|
|
285
|
+
"tags": [],
|
|
286
|
+
"text": "Translation via url"
|
|
287
|
+
},
|
|
288
|
+
"attribute": "translation-url",
|
|
289
|
+
"reflect": true,
|
|
290
|
+
"defaultValue": "''"
|
|
291
|
+
}
|
|
292
|
+
}; }
|
|
293
|
+
static get states() { return {
|
|
294
|
+
"stylingAppends": {}
|
|
295
|
+
}; }
|
|
296
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['en'];
|
|
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
|
+
};
|
|
12
|
+
export const getTranslations = (url) => {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
fetch(url)
|
|
15
|
+
.then((res) => res.json())
|
|
16
|
+
.then((data) => {
|
|
17
|
+
Object.keys(data).forEach((item) => {
|
|
18
|
+
for (let key in data[item]) {
|
|
19
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
resolve(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export const translate = (key, customLang, values) => {
|
|
27
|
+
const lang = customLang;
|
|
28
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
29
|
+
if (values !== undefined) {
|
|
30
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
31
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
32
|
+
translation = translation.replace(regex, value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return translation;
|
|
36
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* TemporaryConsents custom elements */
|
|
2
|
+
|
|
3
|
+
import type { Components, JSX } from "../types/components";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used to manually set the base path where assets can be found.
|
|
7
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
8
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
9
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
10
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
11
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
12
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
13
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setAssetPath: (path: string) => void;
|
|
16
|
+
|
|
17
|
+
export interface SetPlatformOptions {
|
|
18
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
19
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
23
|
+
|
|
24
|
+
export type { Components, JSX };
|
|
25
|
+
|
|
26
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface TemporaryConsents extends Components.TemporaryConsents, HTMLElement {}
|
|
4
|
+
export const TemporaryConsents: {
|
|
5
|
+
prototype: TemporaryConsents;
|
|
6
|
+
new (): TemporaryConsents;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|