@everymatrix/temporary-consents 1.32.4 → 1.33.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 +201 -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 +57 -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 +225 -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 +197 -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-0d997674.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/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 +2 -3
- package/LICENSE +0 -21
|
@@ -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;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
+
const SUPPORTED_LANGUAGES = ['en', 'hr'];
|
|
5
|
+
let TRANSLATIONS = {
|
|
6
|
+
en: {
|
|
7
|
+
title: 'Participation conditions',
|
|
8
|
+
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.',
|
|
9
|
+
declineButton: 'Decline and log out',
|
|
10
|
+
acceptButton: 'Accept',
|
|
11
|
+
loading: 'Please wait, loading...'
|
|
12
|
+
},
|
|
13
|
+
hr: {
|
|
14
|
+
title: 'Uvjeti sudjelovanja',
|
|
15
|
+
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.',
|
|
16
|
+
declineButton: 'Odbijte i odjavite se',
|
|
17
|
+
acceptButton: 'Prihvatiti',
|
|
18
|
+
loading: 'Molimo pričekajte, učitavanje...'
|
|
19
|
+
},
|
|
20
|
+
'es-mx': {
|
|
21
|
+
'title': 'Condiciones de participación',
|
|
22
|
+
'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.',
|
|
23
|
+
'declineButton': 'Declinar y salir',
|
|
24
|
+
'acceptButton': 'Aceptar',
|
|
25
|
+
'Loading': 'Espere por favor, Cargando...'
|
|
26
|
+
},
|
|
27
|
+
'pt-br': {
|
|
28
|
+
'title': 'Condições de participação',
|
|
29
|
+
'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.',
|
|
30
|
+
'declineButton': 'Recusar e sair',
|
|
31
|
+
'acceptButton': 'Aceitar',
|
|
32
|
+
'Loading': 'Espere, por favor, Carregando...'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const getTranslations = (url) => {
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
fetch(url)
|
|
38
|
+
.then((res) => res.json())
|
|
39
|
+
.then((data) => {
|
|
40
|
+
Object.keys(data).forEach((item) => {
|
|
41
|
+
for (let key in data[item]) {
|
|
42
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
resolve(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const translate = (key, customLang, values) => {
|
|
50
|
+
const lang = customLang;
|
|
51
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
52
|
+
if (values !== undefined) {
|
|
53
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
54
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
55
|
+
translation = translation.replace(regex, value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return translation;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
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}";
|
|
62
|
+
|
|
63
|
+
const TemporaryConsents$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
64
|
+
constructor() {
|
|
65
|
+
super();
|
|
66
|
+
this.__registerHost();
|
|
67
|
+
this.__attachShadow();
|
|
68
|
+
/**
|
|
69
|
+
* Client custom styling via inline styles
|
|
70
|
+
*/
|
|
71
|
+
this.clientStyling = '';
|
|
72
|
+
/**
|
|
73
|
+
* Client custom styling via url
|
|
74
|
+
*/
|
|
75
|
+
this.clientStylingUrl = '';
|
|
76
|
+
/**
|
|
77
|
+
* Translation via url
|
|
78
|
+
*/
|
|
79
|
+
this.translationUrl = '';
|
|
80
|
+
this.stylingAppends = false;
|
|
81
|
+
this.isLoading = false;
|
|
82
|
+
this.setClientStyling = () => {
|
|
83
|
+
let sheet = document.createElement('style');
|
|
84
|
+
sheet.innerHTML = this.clientStyling;
|
|
85
|
+
this.stylingContainer.prepend(sheet);
|
|
86
|
+
};
|
|
87
|
+
this.setClientStylingURL = () => {
|
|
88
|
+
let url = new URL(this.clientStylingUrl);
|
|
89
|
+
let cssFile = document.createElement('style');
|
|
90
|
+
fetch(url.href)
|
|
91
|
+
.then((res) => res.text())
|
|
92
|
+
.then((data) => {
|
|
93
|
+
cssFile.innerHTML = data;
|
|
94
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
95
|
+
})
|
|
96
|
+
.catch((err) => {
|
|
97
|
+
console.log('error ', err);
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
componentWillLoad() {
|
|
102
|
+
const promises = [];
|
|
103
|
+
if (this.endpoint && this.userId) {
|
|
104
|
+
const consentsPromise = this.getConsents().then((consents) => {
|
|
105
|
+
this.temporaryAccountConsent = consents.consents.some((consent) => consent.tagCode == 'temporaryaccountconsent');
|
|
106
|
+
});
|
|
107
|
+
promises.push(consentsPromise);
|
|
108
|
+
}
|
|
109
|
+
if (this.translationUrl) {
|
|
110
|
+
const translationPromise = getTranslations(this.translationUrl);
|
|
111
|
+
promises.push(translationPromise);
|
|
112
|
+
}
|
|
113
|
+
return Promise.all(promises);
|
|
114
|
+
}
|
|
115
|
+
componentDidRender() {
|
|
116
|
+
// start custom styling area
|
|
117
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
118
|
+
if (this.clientStyling)
|
|
119
|
+
this.setClientStyling();
|
|
120
|
+
if (this.clientStylingUrl)
|
|
121
|
+
this.setClientStylingURL();
|
|
122
|
+
this.stylingAppends = true;
|
|
123
|
+
}
|
|
124
|
+
// end custom styling area
|
|
125
|
+
}
|
|
126
|
+
getConsents() {
|
|
127
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
128
|
+
const headers = new Headers();
|
|
129
|
+
headers.append('X-SessionId', this.sessionId);
|
|
130
|
+
headers.append('Accept', 'application/json');
|
|
131
|
+
const options = {
|
|
132
|
+
method: 'GET',
|
|
133
|
+
headers
|
|
134
|
+
};
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
this.isLoading = true;
|
|
137
|
+
fetch(url.href, options)
|
|
138
|
+
.then((res) => res.json())
|
|
139
|
+
.then((consents) => {
|
|
140
|
+
resolve(consents);
|
|
141
|
+
}).catch((err) => {
|
|
142
|
+
console.error(err);
|
|
143
|
+
reject(err);
|
|
144
|
+
}).finally(() => {
|
|
145
|
+
this.isLoading = false;
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
setConsents() {
|
|
150
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
151
|
+
const headers = new Headers();
|
|
152
|
+
headers.append('X-SessionId', this.sessionId);
|
|
153
|
+
headers.append('Accept', 'application/json');
|
|
154
|
+
headers.append('Content-Type', 'application/json');
|
|
155
|
+
const body = {
|
|
156
|
+
consents: [{
|
|
157
|
+
tagCode: 'temporaryaccountconsent',
|
|
158
|
+
note: '',
|
|
159
|
+
status: 1
|
|
160
|
+
}]
|
|
161
|
+
};
|
|
162
|
+
const options = {
|
|
163
|
+
method: 'POST',
|
|
164
|
+
headers,
|
|
165
|
+
body: JSON.stringify(body)
|
|
166
|
+
};
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
|
+
this.isLoading = true;
|
|
169
|
+
fetch(url.href, options)
|
|
170
|
+
.then((res) => res.json())
|
|
171
|
+
.then((res) => {
|
|
172
|
+
resolve(res);
|
|
173
|
+
}).catch((err) => {
|
|
174
|
+
console.error(err);
|
|
175
|
+
reject(err);
|
|
176
|
+
}).finally(() => {
|
|
177
|
+
this.isLoading = false;
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
handleDecline() {
|
|
182
|
+
window.postMessage({ type: 'TemporaryConsentsDeclined' }, window.location.href);
|
|
183
|
+
}
|
|
184
|
+
handleAccept() {
|
|
185
|
+
this.setConsents();
|
|
186
|
+
window.postMessage({ type: 'TemporaryConsentsAccepted' }, window.location.href);
|
|
187
|
+
}
|
|
188
|
+
render() {
|
|
189
|
+
if (this.temporaryAccountConsent) {
|
|
190
|
+
if (this.isLoading) {
|
|
191
|
+
return h("p", null, translate('loading', this.lang));
|
|
192
|
+
}
|
|
193
|
+
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))));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
static get style() { return temporaryConsentsCss; }
|
|
197
|
+
}, [1, "temporary-consents", {
|
|
198
|
+
"endpoint": [513],
|
|
199
|
+
"userId": [513, "user-id"],
|
|
200
|
+
"sessionId": [513, "session-id"],
|
|
201
|
+
"daysUntilLockout": [513, "days-until-lockout"],
|
|
202
|
+
"lang": [513],
|
|
203
|
+
"clientStyling": [513, "client-styling"],
|
|
204
|
+
"clientStylingUrl": [513, "client-styling-url"],
|
|
205
|
+
"translationUrl": [513, "translation-url"],
|
|
206
|
+
"stylingAppends": [32]
|
|
207
|
+
}]);
|
|
208
|
+
function defineCustomElement$1() {
|
|
209
|
+
if (typeof customElements === "undefined") {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const components = ["temporary-consents"];
|
|
213
|
+
components.forEach(tagName => { switch (tagName) {
|
|
214
|
+
case "temporary-consents":
|
|
215
|
+
if (!customElements.get(tagName)) {
|
|
216
|
+
customElements.define(tagName, TemporaryConsents$1);
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
} });
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const TemporaryConsents = TemporaryConsents$1;
|
|
223
|
+
const defineCustomElement = defineCustomElement$1;
|
|
224
|
+
|
|
225
|
+
export { TemporaryConsents, defineCustomElement };
|