@everymatrix/player-kyc-verification 1.16.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-95fc1c57.js +1279 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/player-kyc-verification.cjs.entry.js +382 -0
- package/dist/cjs/player-kyc-verification.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/player-kyc-verification/player-kyc-verification.css +149 -0
- package/dist/collection/components/player-kyc-verification/player-kyc-verification.js +496 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +90 -0
- package/dist/collection/utils/utils.js +30 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/player-kyc-verification.d.ts +11 -0
- package/dist/components/player-kyc-verification.js +414 -0
- package/dist/esm/index-abf8c718.js +1253 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/player-kyc-verification.entry.js +378 -0
- package/dist/esm/player-kyc-verification.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/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/player-kyc-verification/index.esm.js +0 -0
- package/dist/player-kyc-verification/p-1f2596d0.js +1 -0
- package/dist/player-kyc-verification/p-decdf7f7.entry.js +1 -0
- package/dist/player-kyc-verification/player-kyc-verification.esm.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/player-kyc-verification/.stencil/packages/player-kyc-verification/stencil.config.d.ts +2 -0
- package/dist/types/components/player-kyc-verification/player-kyc-verification.d.ts +63 -0
- package/dist/types/components.d.ts +109 -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 +2 -0
- package/dist/types/utils/utils.d.ts +14 -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,496 @@
|
|
|
1
|
+
import { Component, h, State, Prop, Fragment, Watch } from '@stencil/core';
|
|
2
|
+
import { getTranslations, translate } from '../../utils/locale.utils';
|
|
3
|
+
export class PlayerKycVerificationWidget {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* The kyc title
|
|
7
|
+
*/
|
|
8
|
+
this.kycTitle = '';
|
|
9
|
+
/**
|
|
10
|
+
* The description
|
|
11
|
+
*/
|
|
12
|
+
this.description = '';
|
|
13
|
+
/**
|
|
14
|
+
* The userId
|
|
15
|
+
*/
|
|
16
|
+
this.userId = '';
|
|
17
|
+
/**
|
|
18
|
+
* The session
|
|
19
|
+
*/
|
|
20
|
+
this.session = '';
|
|
21
|
+
/**
|
|
22
|
+
* The NorWAy endpoint
|
|
23
|
+
*/
|
|
24
|
+
this.endpoint = '';
|
|
25
|
+
/**
|
|
26
|
+
* The translationurl
|
|
27
|
+
*/
|
|
28
|
+
this.translationUrl = '';
|
|
29
|
+
/**
|
|
30
|
+
* Client custom styling via string
|
|
31
|
+
*/
|
|
32
|
+
this.clientStyling = '';
|
|
33
|
+
/**
|
|
34
|
+
* Client custom styling via url content
|
|
35
|
+
*/
|
|
36
|
+
this.clientStylingUrl = '';
|
|
37
|
+
this.verificationType = [];
|
|
38
|
+
this.isLoading = false;
|
|
39
|
+
this.stylingAppends = false;
|
|
40
|
+
this.selectedFiles = null;
|
|
41
|
+
this.uploadSizeExceeded = false;
|
|
42
|
+
this.expandedOnDesktop = false;
|
|
43
|
+
this.scriptInjected = false;
|
|
44
|
+
this.MAX_UPLOAD_SIZE = 50000000;
|
|
45
|
+
this.setClientStyling = () => {
|
|
46
|
+
let sheet = document.createElement('style');
|
|
47
|
+
sheet.innerHTML = this.clientStyling;
|
|
48
|
+
this.stylingContainer.prepend(sheet);
|
|
49
|
+
};
|
|
50
|
+
this.setClientStylingURL = () => {
|
|
51
|
+
let url = new URL(this.clientStylingUrl);
|
|
52
|
+
let cssFile = document.createElement('style');
|
|
53
|
+
fetch(url.href)
|
|
54
|
+
.then((res) => res.text())
|
|
55
|
+
.then((data) => {
|
|
56
|
+
cssFile.innerHTML = data;
|
|
57
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
console.log('error ', err);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
handleNewTranslations() {
|
|
65
|
+
this.isLoading = true;
|
|
66
|
+
getTranslations(this.translationUrl).then(() => {
|
|
67
|
+
this.isLoading = false;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async componentWillLoad() {
|
|
71
|
+
if (this.translationUrl.length > 2) {
|
|
72
|
+
await getTranslations(this.translationUrl);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
componentDidRender() {
|
|
76
|
+
// start custom styling area
|
|
77
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
78
|
+
if (this.clientStyling)
|
|
79
|
+
this.setClientStyling();
|
|
80
|
+
if (this.clientStylingUrl)
|
|
81
|
+
this.setClientStylingURL();
|
|
82
|
+
this.stylingAppends = true;
|
|
83
|
+
}
|
|
84
|
+
// end custom styling area
|
|
85
|
+
}
|
|
86
|
+
async componentDidLoad() {
|
|
87
|
+
if (window.innerWidth > 700) {
|
|
88
|
+
this.expandedOnDesktop = true;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
let url = new URL(`${this.endpoint}v2/player/${this.userId}/verification/GetKYCCustomerStatus`);
|
|
92
|
+
const options = {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
headers: {
|
|
95
|
+
'X-SessionId': this.session,
|
|
96
|
+
'Content-Type': 'application/json',
|
|
97
|
+
},
|
|
98
|
+
body: JSON.stringify({})
|
|
99
|
+
};
|
|
100
|
+
fetch(url.href, options)
|
|
101
|
+
.then((res) => {
|
|
102
|
+
if (res.status === 200) {
|
|
103
|
+
return res.json();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
throw new Error("HTTP status " + res.status);
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
.then((data) => {
|
|
110
|
+
this.verificationType = data.verifications;
|
|
111
|
+
})
|
|
112
|
+
.catch((err) => {
|
|
113
|
+
// Handle any errors
|
|
114
|
+
console.error(err);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error('Error fetching verification types:', error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
handleOptionChange(event, verificationTypeId) {
|
|
122
|
+
const target = event.target;
|
|
123
|
+
this.selectedOption = target.value;
|
|
124
|
+
this.verificationType = this.verificationType.map((type) => {
|
|
125
|
+
if (type.type === verificationTypeId) {
|
|
126
|
+
type.optionChosen = target.value;
|
|
127
|
+
}
|
|
128
|
+
return type;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
handleDocumentsStatus(verificationTypeId, documentsStatus, documentCode) {
|
|
132
|
+
this.verificationType = this.verificationType.map((vType) => {
|
|
133
|
+
if (vType.type === verificationTypeId) {
|
|
134
|
+
const document = vType.documents.find((doc) => doc.code === documentCode);
|
|
135
|
+
if (document) {
|
|
136
|
+
document.statusUploaded = documentsStatus;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return vType;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
toggleVerificationType(verificationTypeId, verificationTypeFlowInfoType) {
|
|
143
|
+
this.expandedOnDesktop = false;
|
|
144
|
+
this.verificationType = this.verificationType.map((type) => {
|
|
145
|
+
var _a;
|
|
146
|
+
if (type.type === verificationTypeId && ((_a = type.flowInfo) === null || _a === void 0 ? void 0 : _a.type) == verificationTypeFlowInfoType) {
|
|
147
|
+
type.expanded = !type.expanded;
|
|
148
|
+
}
|
|
149
|
+
return type;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
checkFileSize(file) {
|
|
153
|
+
let size = 0;
|
|
154
|
+
Object.keys(file).forEach(element => {
|
|
155
|
+
size += file[element].size;
|
|
156
|
+
});
|
|
157
|
+
return size <= this.MAX_UPLOAD_SIZE;
|
|
158
|
+
}
|
|
159
|
+
handleFileSelection(files, documentType, verificationTypeId) {
|
|
160
|
+
this.selectedFiles = files;
|
|
161
|
+
if (this.selectedFiles) {
|
|
162
|
+
if (!this.checkFileSize(this.selectedFiles)) {
|
|
163
|
+
console.error(translate('fileSizeExceeded', this.language));
|
|
164
|
+
this.uploadingStatus = translate('fileSizeExceeded', this.language);
|
|
165
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
166
|
+
this.uploadSizeExceeded = true;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const uploadOptions = {
|
|
170
|
+
method: 'POST',
|
|
171
|
+
headers: {
|
|
172
|
+
'Content-Type': 'application/json',
|
|
173
|
+
'X-SessionId': this.session,
|
|
174
|
+
},
|
|
175
|
+
body: JSON.stringify({ DocumentCode: documentType }),
|
|
176
|
+
};
|
|
177
|
+
fetch(`${this.endpoint}v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`, uploadOptions)
|
|
178
|
+
.then(response => {
|
|
179
|
+
if (response.ok) {
|
|
180
|
+
this.uploadingStatus = translate('uploading', this.language);
|
|
181
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
182
|
+
return response.json();
|
|
183
|
+
}
|
|
184
|
+
}).then((data) => {
|
|
185
|
+
const formData = new FormData();
|
|
186
|
+
const files = this.selectedFiles;
|
|
187
|
+
for (let i = 0; i < files.length; i++) {
|
|
188
|
+
formData.append("files", files[i]);
|
|
189
|
+
}
|
|
190
|
+
fetch(data.Url, { method: "POST", body: formData })
|
|
191
|
+
.then(res => {
|
|
192
|
+
if (res.ok) {
|
|
193
|
+
this.uploadingStatus = translate('successUpload', this.language);
|
|
194
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
this.uploadingStatus = translate('failedUpload', this.language);
|
|
198
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
199
|
+
console.error('File upload error:', res.status);
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
.catch(error => {
|
|
203
|
+
console.error('File upload error:', error);
|
|
204
|
+
});
|
|
205
|
+
})
|
|
206
|
+
.catch(error => {
|
|
207
|
+
console.error('File upload error:', error);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
importScript(url) {
|
|
213
|
+
return new Promise((resolve, reject) => {
|
|
214
|
+
fetch(url)
|
|
215
|
+
.then((res) => res.text())
|
|
216
|
+
.then((res) => {
|
|
217
|
+
const scriptFunction = new Function(res);
|
|
218
|
+
scriptFunction();
|
|
219
|
+
if (this.scriptInjected) {
|
|
220
|
+
resolve(true);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const scriptElement = document.createElement('script');
|
|
224
|
+
scriptElement.src = 'https://test.insic.de/frontend3/static/js/avs-loader.min.js';
|
|
225
|
+
document.head.appendChild(scriptElement);
|
|
226
|
+
this.scriptInjected = true;
|
|
227
|
+
resolve(true);
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
.catch(error => {
|
|
231
|
+
reject(error);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
renderVerificationTypeBox(verificationType) {
|
|
236
|
+
var _a, _b;
|
|
237
|
+
if (this.expandedOnDesktop) {
|
|
238
|
+
verificationType.expanded = true;
|
|
239
|
+
}
|
|
240
|
+
let expanded = verificationType.expanded;
|
|
241
|
+
let name = verificationType.type.replace(/([A-Z])/g, ' $1');
|
|
242
|
+
let optionChosen = verificationType.optionChosen;
|
|
243
|
+
let status = verificationType.status;
|
|
244
|
+
let documents = verificationType.documents;
|
|
245
|
+
let flowInfo = verificationType.flowInfo;
|
|
246
|
+
//not working yet
|
|
247
|
+
if ((flowInfo === null || flowInfo === void 0 ? void 0 : flowInfo.type) === 'Widget') {
|
|
248
|
+
this.importScript(flowInfo.url)
|
|
249
|
+
.then(() => {
|
|
250
|
+
// Script imported successfully
|
|
251
|
+
console.log('Script imported correctly');
|
|
252
|
+
// Open/show the widget
|
|
253
|
+
// You'll need to check the widget documentation for how to open/show it
|
|
254
|
+
})
|
|
255
|
+
.catch(error => {
|
|
256
|
+
// Handle script import error
|
|
257
|
+
console.error('Error importing script:', error);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const isVerified = status === 'Verified';
|
|
261
|
+
const isFailedOrExpired = status === 'Failed' || status === 'Expired';
|
|
262
|
+
return (h("div", { class: `verification-box ${expanded ? 'expanded' : ''} ${isFailedOrExpired ? 'failed' : ''} ${isVerified ? 'success' : ''}` },
|
|
263
|
+
h("div", { class: `box box-header ${expanded ? 'expanded' : ''}`, onClick: () => { var _a; return this.toggleVerificationType(verificationType.type, (_a = verificationType.flowInfo) === null || _a === void 0 ? void 0 : _a.type); } },
|
|
264
|
+
h("div", { class: "box-icon" }, isVerified ? (h("svg", { width: "100", height: "100", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" },
|
|
265
|
+
h("circle", { cx: "50", cy: "50", r: "40", fill: "#388D79" }),
|
|
266
|
+
h("circle", { cx: "50", cy: "50", r: "34", fill: "none", stroke: "#fff", "stroke-width": "12px" }),
|
|
267
|
+
h("polyline", { points: "30,50 45,63 70,35", fill: "none", stroke: "#fff", "stroke-width": "8px" }))) : (isFailedOrExpired ? (h("svg", { width: "100", height: "100", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" },
|
|
268
|
+
h("circle", { cx: "50", cy: "50", r: "40", fill: "red" }),
|
|
269
|
+
h("line", { x1: "30", y1: "30", x2: "70", y2: "70", stroke: "#fff", "stroke-width": "10px" }),
|
|
270
|
+
h("line", { x1: "30", y1: "70", x2: "70", y2: "30", stroke: "#fff", "stroke-width": "10px" }))) : (h("svg", { width: "800px", height: "800px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
271
|
+
h("path", { d: "M4 4V20C4 21.1046 4.89543 22 6 22L18 22C19.1046 22 20 21.1046 20 20V8.34162C20 7.8034 19.7831 7.28789 19.3982 6.91161L14.9579 2.56999C14.5842 2.20459 14.0824 2 13.5597 2L6 2C4.89543 2 4 2.89543 4 4Z", stroke: "#000000", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }),
|
|
272
|
+
h("path", { d: "M9 13H15", stroke: "#000000", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }),
|
|
273
|
+
h("path", { d: "M9 17H12", stroke: "#000000", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }),
|
|
274
|
+
h("path", { d: "M14 2V6C14 7.10457 14.8954 8 16 8H20", stroke: "#000000", "stroke-width": "2", "stroke-linejoin": "round" }))))),
|
|
275
|
+
h("div", { class: "box-title" }, name),
|
|
276
|
+
h("div", { class: "chevron-icon" },
|
|
277
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" },
|
|
278
|
+
h("path", { d: expanded ? 'M6 15l6-6 6 6' : 'M6 9l6 6 6-6' })))),
|
|
279
|
+
expanded && (flowInfo === null || flowInfo === void 0 ? void 0 : flowInfo.type) != 'Widget' ? (h("div", { class: "box box-content" },
|
|
280
|
+
h(Fragment, null, isVerified ? (h("div", { class: "verification-status" }, translate('verificationComplete', this.language))) : isFailedOrExpired ? (h("div", { class: "verification-status" }, status === 'Failed' ? translate('verificationFailed', this.language) : translate('verificationExpired', this.language))) : (h("div", { class: "documents-dropdown" },
|
|
281
|
+
h("select", { class: "nice-select", onChange: (event) => this.handleOptionChange(event, verificationType.type) },
|
|
282
|
+
h("option", { value: "", selected: true, disabled: true, hidden: true }, translate('chooseDocument', this.language)),
|
|
283
|
+
documents.map((document) => (h("option", { selected: optionChosen == document.code ? true : false, value: document.code }, document.type.replace(/([A-Z])/g, ' $1'))))),
|
|
284
|
+
((_a = documents.find((e) => e.code == optionChosen)) === null || _a === void 0 ? void 0 : _a.statusUploaded) ? (h("div", { class: "upload-status" }, (_b = documents.find((e) => e.code == optionChosen)) === null || _b === void 0 ? void 0 : _b.statusUploaded)) : (h("div", { class: "upload-button" }, optionChosen ? (h("label", null,
|
|
285
|
+
h("input", { type: "file", accept: "*", multiple: true, onChange: ($event) => this.handleFileSelection($event.target.files, this.selectedOption, verificationType.type), style: { display: 'none' } }),
|
|
286
|
+
h("svg", { width: "100", height: "100", xmlns: "http://www.w3.org/2000/svg" },
|
|
287
|
+
h("circle", { cx: "50", cy: "50", r: "40", fill: "#388D79" }),
|
|
288
|
+
h("line", { x1: "30", y1: "50", x2: "70", y2: "50", stroke: "white", "stroke-width": "6" }),
|
|
289
|
+
h("line", { x1: "50", y1: "30", x2: "50", y2: "70", stroke: "white", "stroke-width": "6" })))) : null))))))) :
|
|
290
|
+
h("div", { class: "box box-content" },
|
|
291
|
+
h("div", { id: "__avs-wrapper" }))));
|
|
292
|
+
}
|
|
293
|
+
render() {
|
|
294
|
+
if (this.isLoading) {
|
|
295
|
+
return (h("div", null,
|
|
296
|
+
h("p", null, translate('loading', this.language))));
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
if (this.verificationType.length === 0) {
|
|
300
|
+
return h("div", { style: { padding: '24px', fontSize: '18px' } }, translate('noVerificationRequired', this.language));
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
return (h("div", { class: "ModalContainer", ref: el => this.stylingContainer = el },
|
|
304
|
+
h("div", { class: "player-kyc-verification-widget" },
|
|
305
|
+
h("h2", null, this.kycTitle),
|
|
306
|
+
h("div", { class: "widget-description" }, this.description),
|
|
307
|
+
h("div", { class: "verification-types" }, this.verificationType.map((verificationType) => verificationType.vendorName === "Manual" || verificationType.vendorName === "Insic" ? this.renderVerificationTypeBox(verificationType) : null)))));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
static get is() { return "player-kyc-verification"; }
|
|
312
|
+
static get encapsulation() { return "shadow"; }
|
|
313
|
+
static get originalStyleUrls() { return {
|
|
314
|
+
"$": ["player-kyc-verification.scss"]
|
|
315
|
+
}; }
|
|
316
|
+
static get styleUrls() { return {
|
|
317
|
+
"$": ["player-kyc-verification.css"]
|
|
318
|
+
}; }
|
|
319
|
+
static get properties() { return {
|
|
320
|
+
"kycTitle": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"mutable": false,
|
|
323
|
+
"complexType": {
|
|
324
|
+
"original": "string",
|
|
325
|
+
"resolved": "string",
|
|
326
|
+
"references": {}
|
|
327
|
+
},
|
|
328
|
+
"required": false,
|
|
329
|
+
"optional": false,
|
|
330
|
+
"docs": {
|
|
331
|
+
"tags": [],
|
|
332
|
+
"text": "The kyc title"
|
|
333
|
+
},
|
|
334
|
+
"attribute": "kyc-title",
|
|
335
|
+
"reflect": false,
|
|
336
|
+
"defaultValue": "''"
|
|
337
|
+
},
|
|
338
|
+
"description": {
|
|
339
|
+
"type": "string",
|
|
340
|
+
"mutable": false,
|
|
341
|
+
"complexType": {
|
|
342
|
+
"original": "string",
|
|
343
|
+
"resolved": "string",
|
|
344
|
+
"references": {}
|
|
345
|
+
},
|
|
346
|
+
"required": false,
|
|
347
|
+
"optional": false,
|
|
348
|
+
"docs": {
|
|
349
|
+
"tags": [],
|
|
350
|
+
"text": "The description"
|
|
351
|
+
},
|
|
352
|
+
"attribute": "description",
|
|
353
|
+
"reflect": false,
|
|
354
|
+
"defaultValue": "''"
|
|
355
|
+
},
|
|
356
|
+
"userId": {
|
|
357
|
+
"type": "string",
|
|
358
|
+
"mutable": false,
|
|
359
|
+
"complexType": {
|
|
360
|
+
"original": "string",
|
|
361
|
+
"resolved": "string",
|
|
362
|
+
"references": {}
|
|
363
|
+
},
|
|
364
|
+
"required": false,
|
|
365
|
+
"optional": false,
|
|
366
|
+
"docs": {
|
|
367
|
+
"tags": [],
|
|
368
|
+
"text": "The userId"
|
|
369
|
+
},
|
|
370
|
+
"attribute": "user-id",
|
|
371
|
+
"reflect": false,
|
|
372
|
+
"defaultValue": "''"
|
|
373
|
+
},
|
|
374
|
+
"session": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"mutable": false,
|
|
377
|
+
"complexType": {
|
|
378
|
+
"original": "string",
|
|
379
|
+
"resolved": "string",
|
|
380
|
+
"references": {}
|
|
381
|
+
},
|
|
382
|
+
"required": false,
|
|
383
|
+
"optional": false,
|
|
384
|
+
"docs": {
|
|
385
|
+
"tags": [],
|
|
386
|
+
"text": "The session"
|
|
387
|
+
},
|
|
388
|
+
"attribute": "session",
|
|
389
|
+
"reflect": false,
|
|
390
|
+
"defaultValue": "''"
|
|
391
|
+
},
|
|
392
|
+
"language": {
|
|
393
|
+
"type": "string",
|
|
394
|
+
"mutable": false,
|
|
395
|
+
"complexType": {
|
|
396
|
+
"original": "string",
|
|
397
|
+
"resolved": "string",
|
|
398
|
+
"references": {}
|
|
399
|
+
},
|
|
400
|
+
"required": false,
|
|
401
|
+
"optional": false,
|
|
402
|
+
"docs": {
|
|
403
|
+
"tags": [],
|
|
404
|
+
"text": "The language"
|
|
405
|
+
},
|
|
406
|
+
"attribute": "language",
|
|
407
|
+
"reflect": false
|
|
408
|
+
},
|
|
409
|
+
"endpoint": {
|
|
410
|
+
"type": "string",
|
|
411
|
+
"mutable": false,
|
|
412
|
+
"complexType": {
|
|
413
|
+
"original": "string",
|
|
414
|
+
"resolved": "string",
|
|
415
|
+
"references": {}
|
|
416
|
+
},
|
|
417
|
+
"required": false,
|
|
418
|
+
"optional": false,
|
|
419
|
+
"docs": {
|
|
420
|
+
"tags": [],
|
|
421
|
+
"text": "The NorWAy endpoint"
|
|
422
|
+
},
|
|
423
|
+
"attribute": "endpoint",
|
|
424
|
+
"reflect": false,
|
|
425
|
+
"defaultValue": "''"
|
|
426
|
+
},
|
|
427
|
+
"translationUrl": {
|
|
428
|
+
"type": "string",
|
|
429
|
+
"mutable": false,
|
|
430
|
+
"complexType": {
|
|
431
|
+
"original": "string",
|
|
432
|
+
"resolved": "string",
|
|
433
|
+
"references": {}
|
|
434
|
+
},
|
|
435
|
+
"required": false,
|
|
436
|
+
"optional": false,
|
|
437
|
+
"docs": {
|
|
438
|
+
"tags": [],
|
|
439
|
+
"text": "The translationurl"
|
|
440
|
+
},
|
|
441
|
+
"attribute": "translation-url",
|
|
442
|
+
"reflect": false,
|
|
443
|
+
"defaultValue": "''"
|
|
444
|
+
},
|
|
445
|
+
"clientStyling": {
|
|
446
|
+
"type": "string",
|
|
447
|
+
"mutable": false,
|
|
448
|
+
"complexType": {
|
|
449
|
+
"original": "string",
|
|
450
|
+
"resolved": "string",
|
|
451
|
+
"references": {}
|
|
452
|
+
},
|
|
453
|
+
"required": false,
|
|
454
|
+
"optional": false,
|
|
455
|
+
"docs": {
|
|
456
|
+
"tags": [],
|
|
457
|
+
"text": "Client custom styling via string"
|
|
458
|
+
},
|
|
459
|
+
"attribute": "client-styling",
|
|
460
|
+
"reflect": false,
|
|
461
|
+
"defaultValue": "''"
|
|
462
|
+
},
|
|
463
|
+
"clientStylingUrl": {
|
|
464
|
+
"type": "string",
|
|
465
|
+
"mutable": false,
|
|
466
|
+
"complexType": {
|
|
467
|
+
"original": "string",
|
|
468
|
+
"resolved": "string",
|
|
469
|
+
"references": {}
|
|
470
|
+
},
|
|
471
|
+
"required": false,
|
|
472
|
+
"optional": false,
|
|
473
|
+
"docs": {
|
|
474
|
+
"tags": [],
|
|
475
|
+
"text": "Client custom styling via url content"
|
|
476
|
+
},
|
|
477
|
+
"attribute": "client-styling-url",
|
|
478
|
+
"reflect": false,
|
|
479
|
+
"defaultValue": "''"
|
|
480
|
+
}
|
|
481
|
+
}; }
|
|
482
|
+
static get states() { return {
|
|
483
|
+
"verificationType": {},
|
|
484
|
+
"isLoading": {},
|
|
485
|
+
"stylingAppends": {},
|
|
486
|
+
"selectedFiles": {},
|
|
487
|
+
"uploadingStatus": {},
|
|
488
|
+
"uploadSizeExceeded": {},
|
|
489
|
+
"selectedOption": {},
|
|
490
|
+
"expandedOnDesktop": {}
|
|
491
|
+
}; }
|
|
492
|
+
static get watchers() { return [{
|
|
493
|
+
"propName": "translationUrl",
|
|
494
|
+
"methodName": "handleNewTranslations"
|
|
495
|
+
}]; }
|
|
496
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['de', 'en'];
|
|
3
|
+
let TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
loading: 'Loading, please wait ...',
|
|
6
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
7
|
+
verificationComplete: 'Verification complete',
|
|
8
|
+
verificationFailed: 'Verification failed',
|
|
9
|
+
verificationExpired: 'Verification expired',
|
|
10
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
11
|
+
uploading: 'Uploading ... ',
|
|
12
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
13
|
+
failedUpload: 'Upload failed please try again',
|
|
14
|
+
chooseDocument: 'Choose Document',
|
|
15
|
+
},
|
|
16
|
+
de: {
|
|
17
|
+
loading: 'Loading, please wait ...',
|
|
18
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
19
|
+
verificationComplete: 'Verification complete',
|
|
20
|
+
verificationFailed: 'Verification failed',
|
|
21
|
+
verificationExpired: 'Verification expired',
|
|
22
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
23
|
+
uploading: 'Uploading ... ',
|
|
24
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
25
|
+
failedUpload: 'Upload failed please try again',
|
|
26
|
+
chooseDocument: 'Choose Document',
|
|
27
|
+
},
|
|
28
|
+
ro: {
|
|
29
|
+
loading: 'Loading, please wait ...',
|
|
30
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
31
|
+
verificationComplete: 'Verification complete',
|
|
32
|
+
verificationFailed: 'Verification failed',
|
|
33
|
+
verificationExpired: 'Verification expired',
|
|
34
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
35
|
+
uploading: 'Uploading ... ',
|
|
36
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
37
|
+
failedUpload: 'Upload failed please try again',
|
|
38
|
+
chooseDocument: 'Choose Document',
|
|
39
|
+
},
|
|
40
|
+
fr: {
|
|
41
|
+
loading: 'Loading, please wait ...',
|
|
42
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
43
|
+
verificationComplete: 'Verification complete',
|
|
44
|
+
verificationFailed: 'Verification failed',
|
|
45
|
+
verificationExpired: 'Verification expired',
|
|
46
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
47
|
+
uploading: 'Uploading ... ',
|
|
48
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
49
|
+
failedUpload: 'Upload failed please try again',
|
|
50
|
+
chooseDocument: 'Choose Document',
|
|
51
|
+
},
|
|
52
|
+
ar: {
|
|
53
|
+
loading: 'Loading, please wait ...',
|
|
54
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
55
|
+
verificationComplete: 'Verification complete',
|
|
56
|
+
verificationFailed: 'Verification failed',
|
|
57
|
+
verificationExpired: 'Verification expired',
|
|
58
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
59
|
+
uploading: 'Uploading ... ',
|
|
60
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
61
|
+
failedUpload: 'Upload failed please try again',
|
|
62
|
+
chooseDocument: 'Choose Document',
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export const getTranslations = (url) => {
|
|
66
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
fetch(url)
|
|
69
|
+
.then((res) => res.json())
|
|
70
|
+
.then((data) => {
|
|
71
|
+
Object.keys(data).forEach((item) => {
|
|
72
|
+
for (let key in data[item]) {
|
|
73
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
resolve(true);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
export const translate = (key, customLang, values) => {
|
|
81
|
+
const lang = customLang;
|
|
82
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
83
|
+
if (values !== undefined) {
|
|
84
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
85
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
86
|
+
translation = translation.replace(regex, value);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return translation;
|
|
90
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isMobile
|
|
3
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
4
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
5
|
+
* @returns {Boolean} true or false
|
|
6
|
+
*/
|
|
7
|
+
export const isMobile = (userAgent) => {
|
|
8
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
9
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
10
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
11
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @name getDevice
|
|
15
|
+
* @description A method that returns the type of the device
|
|
16
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
17
|
+
* @returns {String} Android/iPhone/iPad/PC
|
|
18
|
+
*/
|
|
19
|
+
export const getDevice = (userAgent) => {
|
|
20
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
21
|
+
return 'Android';
|
|
22
|
+
}
|
|
23
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
24
|
+
return 'iPhone';
|
|
25
|
+
}
|
|
26
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
27
|
+
return 'iPad';
|
|
28
|
+
}
|
|
29
|
+
return 'PC';
|
|
30
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* PlayerKycVerification 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 PlayerKycVerification extends Components.PlayerKycVerification, HTMLElement {}
|
|
4
|
+
export const PlayerKycVerification: {
|
|
5
|
+
prototype: PlayerKycVerification;
|
|
6
|
+
new (): PlayerKycVerification;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|