@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,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-95fc1c57.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([["player-kyc-verification.cjs",[[1,"player-kyc-verification",{"kycTitle":[1,"kyc-title"],"description":[1],"userId":[1,"user-id"],"session":[1],"language":[1],"endpoint":[1],"translationUrl":[1,"translation-url"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"verificationType":[32],"isLoading":[32],"stylingAppends":[32],"selectedFiles":[32],"uploadingStatus":[32],"uploadSizeExceeded":[32],"selectedOption":[32],"expandedOnDesktop":[32]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-95fc1c57.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['de', 'en'];
|
|
9
|
+
let TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
loading: 'Loading, please wait ...',
|
|
12
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
13
|
+
verificationComplete: 'Verification complete',
|
|
14
|
+
verificationFailed: 'Verification failed',
|
|
15
|
+
verificationExpired: 'Verification expired',
|
|
16
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
17
|
+
uploading: 'Uploading ... ',
|
|
18
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
19
|
+
failedUpload: 'Upload failed please try again',
|
|
20
|
+
chooseDocument: 'Choose Document',
|
|
21
|
+
},
|
|
22
|
+
de: {
|
|
23
|
+
loading: 'Loading, please wait ...',
|
|
24
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
25
|
+
verificationComplete: 'Verification complete',
|
|
26
|
+
verificationFailed: 'Verification failed',
|
|
27
|
+
verificationExpired: 'Verification expired',
|
|
28
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
29
|
+
uploading: 'Uploading ... ',
|
|
30
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
31
|
+
failedUpload: 'Upload failed please try again',
|
|
32
|
+
chooseDocument: 'Choose Document',
|
|
33
|
+
},
|
|
34
|
+
ro: {
|
|
35
|
+
loading: 'Loading, please wait ...',
|
|
36
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
37
|
+
verificationComplete: 'Verification complete',
|
|
38
|
+
verificationFailed: 'Verification failed',
|
|
39
|
+
verificationExpired: 'Verification expired',
|
|
40
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
41
|
+
uploading: 'Uploading ... ',
|
|
42
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
43
|
+
failedUpload: 'Upload failed please try again',
|
|
44
|
+
chooseDocument: 'Choose Document',
|
|
45
|
+
},
|
|
46
|
+
fr: {
|
|
47
|
+
loading: 'Loading, please wait ...',
|
|
48
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
49
|
+
verificationComplete: 'Verification complete',
|
|
50
|
+
verificationFailed: 'Verification failed',
|
|
51
|
+
verificationExpired: 'Verification expired',
|
|
52
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
53
|
+
uploading: 'Uploading ... ',
|
|
54
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
55
|
+
failedUpload: 'Upload failed please try again',
|
|
56
|
+
chooseDocument: 'Choose Document',
|
|
57
|
+
},
|
|
58
|
+
ar: {
|
|
59
|
+
loading: 'Loading, please wait ...',
|
|
60
|
+
noVerificationRequired: 'There is no verification required for your account at this moment.',
|
|
61
|
+
verificationComplete: 'Verification complete',
|
|
62
|
+
verificationFailed: 'Verification failed',
|
|
63
|
+
verificationExpired: 'Verification expired',
|
|
64
|
+
fileSizeExceeded: 'Maximum file size exceeded. Max file size is: 50mb',
|
|
65
|
+
uploading: 'Uploading ... ',
|
|
66
|
+
successUpload: 'Your document has been uploaded and it will be reviewed shortly',
|
|
67
|
+
failedUpload: 'Upload failed please try again',
|
|
68
|
+
chooseDocument: 'Choose Document',
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const getTranslations = (url) => {
|
|
72
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
73
|
+
return new Promise((resolve) => {
|
|
74
|
+
fetch(url)
|
|
75
|
+
.then((res) => res.json())
|
|
76
|
+
.then((data) => {
|
|
77
|
+
Object.keys(data).forEach((item) => {
|
|
78
|
+
for (let key in data[item]) {
|
|
79
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
resolve(true);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const translate = (key, customLang, values) => {
|
|
87
|
+
const lang = customLang;
|
|
88
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
89
|
+
if (values !== undefined) {
|
|
90
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
91
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
92
|
+
translation = translation.replace(regex, value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return translation;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const playerKycVerificationCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");\n:host {\n font-family: \"Roboto\", sans-serif;\n}\n\n.ModalContainer {\n container-type: inline-size;\n}\n\n.player-kyc-verification-widget {\n padding: 20px;\n align-items: center;\n}\n.player-kyc-verification-widget h2 {\n margin: 4px;\n}\n.player-kyc-verification-widget .widget-description {\n margin: 24px 0px;\n}\n.player-kyc-verification-widget .verification-types {\n width: 100%;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 34px;\n}\n.player-kyc-verification-widget .verification-types .verification-box {\n transition: height 0.3s, border-color 0.3s;\n border: solid 1.4px #b5b5b5;\n border-radius: 2px;\n display: flex;\n flex-direction: column;\n padding: 0px 14px;\n border-width: 2px 2px 8px 2px;\n align-self: start;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box {\n flex-shrink: 0;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header {\n display: flex;\n padding: 14px 0px;\n justify-content: space-between;\n cursor: pointer;\n align-items: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon {\n flex-grow: 1;\n display: flex;\n justify-content: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon svg {\n height: 24px;\n width: 24px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-title {\n flex-grow: 1;\n font-size: 18px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon {\n flex-grow: 10;\n width: 14px;\n height: 14px;\n display: flex;\n justify-content: flex-end;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon svg {\n width: 20px;\n height: 22px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content {\n display: none;\n flex-grow: 1;\n border-top: 0.4px solid #bcbcbc;\n padding: 10px 0px;\n flex-grow: 1;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .upload-status {\n text-align: center;\n padding: 20px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown {\n display: flex;\n flex-direction: column;\n width: 100%;\n align-items: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown svg {\n margin: 16px;\n cursor: pointer;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown .nice-select {\n cursor: pointer;\n width: 100%;\n height: 30px;\n padding: 4px 14px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 2px;\n background-color: #fff;\n color: #333;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n padding-right: 30px;\n background-repeat: no-repeat;\n background-position: right 10px center;\n background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\"><path fill=\"%23333\" d=\"M10 18.4l-6.5-6.5h13z\"/><path fill=\"%23333\" d=\"M10 1.6l6.5 6.5H3.5z\"/></svg>');\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded {\n border-color: green;\n}\n.player-kyc-verification-widget .verification-types .verification-box.failed {\n border-color: #d42323;\n}\n.player-kyc-verification-widget .verification-types .verification-box.success {\n border-color: green;\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content {\n display: flex;\n justify-content: center;\n flex-direction: column;\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content .verification-status {\n margin: 12px 0px 16px;\n font-size: 18px;\n text-align: center;\n color: #9b9b9b;\n}\n\n@container (min-width: 700px) {\n .player-kyc-verification-widget {\n padding: 100px 60px;\n }\n}\n@container (max-width: 700px) {\n .player-kyc-verification-widget h2 {\n margin: 4px;\n text-align: center;\n }\n .player-kyc-verification-widget .verification-types {\n grid-template-columns: 1fr;\n grid-gap: 16px;\n }\n}\n@container (max-width: 1249px) {\n .verification-types {\n grid-template-columns: repeat(2, 1fr);\n }\n}";
|
|
99
|
+
|
|
100
|
+
const PlayerKycVerificationWidget = class {
|
|
101
|
+
constructor(hostRef) {
|
|
102
|
+
index.registerInstance(this, hostRef);
|
|
103
|
+
/**
|
|
104
|
+
* The kyc title
|
|
105
|
+
*/
|
|
106
|
+
this.kycTitle = '';
|
|
107
|
+
/**
|
|
108
|
+
* The description
|
|
109
|
+
*/
|
|
110
|
+
this.description = '';
|
|
111
|
+
/**
|
|
112
|
+
* The userId
|
|
113
|
+
*/
|
|
114
|
+
this.userId = '';
|
|
115
|
+
/**
|
|
116
|
+
* The session
|
|
117
|
+
*/
|
|
118
|
+
this.session = '';
|
|
119
|
+
/**
|
|
120
|
+
* The NorWAy endpoint
|
|
121
|
+
*/
|
|
122
|
+
this.endpoint = '';
|
|
123
|
+
/**
|
|
124
|
+
* The translationurl
|
|
125
|
+
*/
|
|
126
|
+
this.translationUrl = '';
|
|
127
|
+
/**
|
|
128
|
+
* Client custom styling via string
|
|
129
|
+
*/
|
|
130
|
+
this.clientStyling = '';
|
|
131
|
+
/**
|
|
132
|
+
* Client custom styling via url content
|
|
133
|
+
*/
|
|
134
|
+
this.clientStylingUrl = '';
|
|
135
|
+
this.verificationType = [];
|
|
136
|
+
this.isLoading = false;
|
|
137
|
+
this.stylingAppends = false;
|
|
138
|
+
this.selectedFiles = null;
|
|
139
|
+
this.uploadSizeExceeded = false;
|
|
140
|
+
this.expandedOnDesktop = false;
|
|
141
|
+
this.scriptInjected = false;
|
|
142
|
+
this.MAX_UPLOAD_SIZE = 50000000;
|
|
143
|
+
this.setClientStyling = () => {
|
|
144
|
+
let sheet = document.createElement('style');
|
|
145
|
+
sheet.innerHTML = this.clientStyling;
|
|
146
|
+
this.stylingContainer.prepend(sheet);
|
|
147
|
+
};
|
|
148
|
+
this.setClientStylingURL = () => {
|
|
149
|
+
let url = new URL(this.clientStylingUrl);
|
|
150
|
+
let cssFile = document.createElement('style');
|
|
151
|
+
fetch(url.href)
|
|
152
|
+
.then((res) => res.text())
|
|
153
|
+
.then((data) => {
|
|
154
|
+
cssFile.innerHTML = data;
|
|
155
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
156
|
+
})
|
|
157
|
+
.catch((err) => {
|
|
158
|
+
console.log('error ', err);
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
handleNewTranslations() {
|
|
163
|
+
this.isLoading = true;
|
|
164
|
+
getTranslations(this.translationUrl).then(() => {
|
|
165
|
+
this.isLoading = false;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async componentWillLoad() {
|
|
169
|
+
if (this.translationUrl.length > 2) {
|
|
170
|
+
await getTranslations(this.translationUrl);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
componentDidRender() {
|
|
174
|
+
// start custom styling area
|
|
175
|
+
if (!this.stylingAppends && this.stylingContainer) {
|
|
176
|
+
if (this.clientStyling)
|
|
177
|
+
this.setClientStyling();
|
|
178
|
+
if (this.clientStylingUrl)
|
|
179
|
+
this.setClientStylingURL();
|
|
180
|
+
this.stylingAppends = true;
|
|
181
|
+
}
|
|
182
|
+
// end custom styling area
|
|
183
|
+
}
|
|
184
|
+
async componentDidLoad() {
|
|
185
|
+
if (window.innerWidth > 700) {
|
|
186
|
+
this.expandedOnDesktop = true;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
let url = new URL(`${this.endpoint}v2/player/${this.userId}/verification/GetKYCCustomerStatus`);
|
|
190
|
+
const options = {
|
|
191
|
+
method: 'POST',
|
|
192
|
+
headers: {
|
|
193
|
+
'X-SessionId': this.session,
|
|
194
|
+
'Content-Type': 'application/json',
|
|
195
|
+
},
|
|
196
|
+
body: JSON.stringify({})
|
|
197
|
+
};
|
|
198
|
+
fetch(url.href, options)
|
|
199
|
+
.then((res) => {
|
|
200
|
+
if (res.status === 200) {
|
|
201
|
+
return res.json();
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
throw new Error("HTTP status " + res.status);
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
.then((data) => {
|
|
208
|
+
this.verificationType = data.verifications;
|
|
209
|
+
})
|
|
210
|
+
.catch((err) => {
|
|
211
|
+
// Handle any errors
|
|
212
|
+
console.error(err);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.error('Error fetching verification types:', error);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
handleOptionChange(event, verificationTypeId) {
|
|
220
|
+
const target = event.target;
|
|
221
|
+
this.selectedOption = target.value;
|
|
222
|
+
this.verificationType = this.verificationType.map((type) => {
|
|
223
|
+
if (type.type === verificationTypeId) {
|
|
224
|
+
type.optionChosen = target.value;
|
|
225
|
+
}
|
|
226
|
+
return type;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
handleDocumentsStatus(verificationTypeId, documentsStatus, documentCode) {
|
|
230
|
+
this.verificationType = this.verificationType.map((vType) => {
|
|
231
|
+
if (vType.type === verificationTypeId) {
|
|
232
|
+
const document = vType.documents.find((doc) => doc.code === documentCode);
|
|
233
|
+
if (document) {
|
|
234
|
+
document.statusUploaded = documentsStatus;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return vType;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
toggleVerificationType(verificationTypeId, verificationTypeFlowInfoType) {
|
|
241
|
+
this.expandedOnDesktop = false;
|
|
242
|
+
this.verificationType = this.verificationType.map((type) => {
|
|
243
|
+
var _a;
|
|
244
|
+
if (type.type === verificationTypeId && ((_a = type.flowInfo) === null || _a === void 0 ? void 0 : _a.type) == verificationTypeFlowInfoType) {
|
|
245
|
+
type.expanded = !type.expanded;
|
|
246
|
+
}
|
|
247
|
+
return type;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
checkFileSize(file) {
|
|
251
|
+
let size = 0;
|
|
252
|
+
Object.keys(file).forEach(element => {
|
|
253
|
+
size += file[element].size;
|
|
254
|
+
});
|
|
255
|
+
return size <= this.MAX_UPLOAD_SIZE;
|
|
256
|
+
}
|
|
257
|
+
handleFileSelection(files, documentType, verificationTypeId) {
|
|
258
|
+
this.selectedFiles = files;
|
|
259
|
+
if (this.selectedFiles) {
|
|
260
|
+
if (!this.checkFileSize(this.selectedFiles)) {
|
|
261
|
+
console.error(translate('fileSizeExceeded', this.language));
|
|
262
|
+
this.uploadingStatus = translate('fileSizeExceeded', this.language);
|
|
263
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
264
|
+
this.uploadSizeExceeded = true;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const uploadOptions = {
|
|
268
|
+
method: 'POST',
|
|
269
|
+
headers: {
|
|
270
|
+
'Content-Type': 'application/json',
|
|
271
|
+
'X-SessionId': this.session,
|
|
272
|
+
},
|
|
273
|
+
body: JSON.stringify({ DocumentCode: documentType }),
|
|
274
|
+
};
|
|
275
|
+
fetch(`${this.endpoint}v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`, uploadOptions)
|
|
276
|
+
.then(response => {
|
|
277
|
+
if (response.ok) {
|
|
278
|
+
this.uploadingStatus = translate('uploading', this.language);
|
|
279
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
280
|
+
return response.json();
|
|
281
|
+
}
|
|
282
|
+
}).then((data) => {
|
|
283
|
+
const formData = new FormData();
|
|
284
|
+
const files = this.selectedFiles;
|
|
285
|
+
for (let i = 0; i < files.length; i++) {
|
|
286
|
+
formData.append("files", files[i]);
|
|
287
|
+
}
|
|
288
|
+
fetch(data.Url, { method: "POST", body: formData })
|
|
289
|
+
.then(res => {
|
|
290
|
+
if (res.ok) {
|
|
291
|
+
this.uploadingStatus = translate('successUpload', this.language);
|
|
292
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.uploadingStatus = translate('failedUpload', this.language);
|
|
296
|
+
this.handleDocumentsStatus(verificationTypeId, this.uploadingStatus, documentType);
|
|
297
|
+
console.error('File upload error:', res.status);
|
|
298
|
+
}
|
|
299
|
+
})
|
|
300
|
+
.catch(error => {
|
|
301
|
+
console.error('File upload error:', error);
|
|
302
|
+
});
|
|
303
|
+
})
|
|
304
|
+
.catch(error => {
|
|
305
|
+
console.error('File upload error:', error);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
importScript(url) {
|
|
311
|
+
return new Promise((resolve, reject) => {
|
|
312
|
+
fetch(url)
|
|
313
|
+
.then((res) => res.text())
|
|
314
|
+
.then((res) => {
|
|
315
|
+
const scriptFunction = new Function(res);
|
|
316
|
+
scriptFunction();
|
|
317
|
+
if (this.scriptInjected) {
|
|
318
|
+
resolve(true);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
const scriptElement = document.createElement('script');
|
|
322
|
+
scriptElement.src = 'https://test.insic.de/frontend3/static/js/avs-loader.min.js';
|
|
323
|
+
document.head.appendChild(scriptElement);
|
|
324
|
+
this.scriptInjected = true;
|
|
325
|
+
resolve(true);
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
.catch(error => {
|
|
329
|
+
reject(error);
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
renderVerificationTypeBox(verificationType) {
|
|
334
|
+
var _a, _b;
|
|
335
|
+
if (this.expandedOnDesktop) {
|
|
336
|
+
verificationType.expanded = true;
|
|
337
|
+
}
|
|
338
|
+
let expanded = verificationType.expanded;
|
|
339
|
+
let name = verificationType.type.replace(/([A-Z])/g, ' $1');
|
|
340
|
+
let optionChosen = verificationType.optionChosen;
|
|
341
|
+
let status = verificationType.status;
|
|
342
|
+
let documents = verificationType.documents;
|
|
343
|
+
let flowInfo = verificationType.flowInfo;
|
|
344
|
+
//not working yet
|
|
345
|
+
if ((flowInfo === null || flowInfo === void 0 ? void 0 : flowInfo.type) === 'Widget') {
|
|
346
|
+
this.importScript(flowInfo.url)
|
|
347
|
+
.then(() => {
|
|
348
|
+
// Script imported successfully
|
|
349
|
+
console.log('Script imported correctly');
|
|
350
|
+
// Open/show the widget
|
|
351
|
+
// You'll need to check the widget documentation for how to open/show it
|
|
352
|
+
})
|
|
353
|
+
.catch(error => {
|
|
354
|
+
// Handle script import error
|
|
355
|
+
console.error('Error importing script:', error);
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
const isVerified = status === 'Verified';
|
|
359
|
+
const isFailedOrExpired = status === 'Failed' || status === 'Expired';
|
|
360
|
+
return (index.h("div", { class: `verification-box ${expanded ? 'expanded' : ''} ${isFailedOrExpired ? 'failed' : ''} ${isVerified ? 'success' : ''}` }, index.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); } }, index.h("div", { class: "box-icon" }, isVerified ? (index.h("svg", { width: "100", height: "100", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" }, index.h("circle", { cx: "50", cy: "50", r: "40", fill: "#388D79" }), index.h("circle", { cx: "50", cy: "50", r: "34", fill: "none", stroke: "#fff", "stroke-width": "12px" }), index.h("polyline", { points: "30,50 45,63 70,35", fill: "none", stroke: "#fff", "stroke-width": "8px" }))) : (isFailedOrExpired ? (index.h("svg", { width: "100", height: "100", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" }, index.h("circle", { cx: "50", cy: "50", r: "40", fill: "red" }), index.h("line", { x1: "30", y1: "30", x2: "70", y2: "70", stroke: "#fff", "stroke-width": "10px" }), index.h("line", { x1: "30", y1: "70", x2: "70", y2: "30", stroke: "#fff", "stroke-width": "10px" }))) : (index.h("svg", { width: "800px", height: "800px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.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" }), index.h("path", { d: "M9 13H15", stroke: "#000000", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M9 17H12", stroke: "#000000", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M14 2V6C14 7.10457 14.8954 8 16 8H20", stroke: "#000000", "stroke-width": "2", "stroke-linejoin": "round" }))))), index.h("div", { class: "box-title" }, name), index.h("div", { class: "chevron-icon" }, index.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" }, index.h("path", { d: expanded ? 'M6 15l6-6 6 6' : 'M6 9l6 6 6-6' })))), expanded && (flowInfo === null || flowInfo === void 0 ? void 0 : flowInfo.type) != 'Widget' ? (index.h("div", { class: "box box-content" }, index.h(index.Fragment, null, isVerified ? (index.h("div", { class: "verification-status" }, translate('verificationComplete', this.language))) : isFailedOrExpired ? (index.h("div", { class: "verification-status" }, status === 'Failed' ? translate('verificationFailed', this.language) : translate('verificationExpired', this.language))) : (index.h("div", { class: "documents-dropdown" }, index.h("select", { class: "nice-select", onChange: (event) => this.handleOptionChange(event, verificationType.type) }, index.h("option", { value: "", selected: true, disabled: true, hidden: true }, translate('chooseDocument', this.language)), documents.map((document) => (index.h("option", { selected: optionChosen == document.code ? true : false, value: document.code }, document.type.replace(/([A-Z])/g, ' $1'))))), ((_a = documents.find((e) => e.code == optionChosen)) === null || _a === void 0 ? void 0 : _a.statusUploaded) ? (index.h("div", { class: "upload-status" }, (_b = documents.find((e) => e.code == optionChosen)) === null || _b === void 0 ? void 0 : _b.statusUploaded)) : (index.h("div", { class: "upload-button" }, optionChosen ? (index.h("label", null, index.h("input", { type: "file", accept: "*", multiple: true, onChange: ($event) => this.handleFileSelection($event.target.files, this.selectedOption, verificationType.type), style: { display: 'none' } }), index.h("svg", { width: "100", height: "100", xmlns: "http://www.w3.org/2000/svg" }, index.h("circle", { cx: "50", cy: "50", r: "40", fill: "#388D79" }), index.h("line", { x1: "30", y1: "50", x2: "70", y2: "50", stroke: "white", "stroke-width": "6" }), index.h("line", { x1: "50", y1: "30", x2: "50", y2: "70", stroke: "white", "stroke-width": "6" })))) : null))))))) :
|
|
361
|
+
index.h("div", { class: "box box-content" }, index.h("div", { id: "__avs-wrapper" }))));
|
|
362
|
+
}
|
|
363
|
+
render() {
|
|
364
|
+
if (this.isLoading) {
|
|
365
|
+
return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
if (this.verificationType.length === 0) {
|
|
369
|
+
return index.h("div", { style: { padding: '24px', fontSize: '18px' } }, translate('noVerificationRequired', this.language));
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
return (index.h("div", { class: "ModalContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: "player-kyc-verification-widget" }, index.h("h2", null, this.kycTitle), index.h("div", { class: "widget-description" }, this.description), index.h("div", { class: "verification-types" }, this.verificationType.map((verificationType) => verificationType.vendorName === "Manual" || verificationType.vendorName === "Insic" ? this.renderVerificationTypeBox(verificationType) : null)))));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
static get watchers() { return {
|
|
377
|
+
"translationUrl": ["handleNewTranslations"]
|
|
378
|
+
}; }
|
|
379
|
+
};
|
|
380
|
+
PlayerKycVerificationWidget.style = playerKycVerificationCss;
|
|
381
|
+
|
|
382
|
+
exports.player_kyc_verification = PlayerKycVerificationWidget;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-95fc1c57.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('player-kyc-verification.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([["player-kyc-verification.cjs",[[1,"player-kyc-verification",{"kycTitle":[1,"kyc-title"],"description":[1],"userId":[1,"user-id"],"session":[1],"language":[1],"endpoint":[1],"translationUrl":[1,"translation-url"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"verificationType":[32],"isLoading":[32],"stylingAppends":[32],"selectedFiles":[32],"uploadingStatus":[32],"uploadSizeExceeded":[32],"selectedOption":[32],"expandedOnDesktop":[32]}]]]], options);
|
|
19
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");
|
|
2
|
+
:host {
|
|
3
|
+
font-family: "Roboto", sans-serif;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ModalContainer {
|
|
7
|
+
container-type: inline-size;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.player-kyc-verification-widget {
|
|
11
|
+
padding: 20px;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
.player-kyc-verification-widget h2 {
|
|
15
|
+
margin: 4px;
|
|
16
|
+
}
|
|
17
|
+
.player-kyc-verification-widget .widget-description {
|
|
18
|
+
margin: 24px 0px;
|
|
19
|
+
}
|
|
20
|
+
.player-kyc-verification-widget .verification-types {
|
|
21
|
+
width: 100%;
|
|
22
|
+
display: grid;
|
|
23
|
+
grid-template-columns: repeat(3, 1fr);
|
|
24
|
+
grid-gap: 34px;
|
|
25
|
+
}
|
|
26
|
+
.player-kyc-verification-widget .verification-types .verification-box {
|
|
27
|
+
transition: height 0.3s, border-color 0.3s;
|
|
28
|
+
border: solid 1.4px #b5b5b5;
|
|
29
|
+
border-radius: 2px;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
padding: 0px 14px;
|
|
33
|
+
border-width: 2px 2px 8px 2px;
|
|
34
|
+
align-self: start;
|
|
35
|
+
}
|
|
36
|
+
.player-kyc-verification-widget .verification-types .verification-box .box {
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-header {
|
|
40
|
+
display: flex;
|
|
41
|
+
padding: 14px 0px;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
align-items: center;
|
|
45
|
+
}
|
|
46
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon {
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
}
|
|
51
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon svg {
|
|
52
|
+
height: 24px;
|
|
53
|
+
width: 24px;
|
|
54
|
+
}
|
|
55
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-header .box-title {
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
font-size: 18px;
|
|
58
|
+
}
|
|
59
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon {
|
|
60
|
+
flex-grow: 10;
|
|
61
|
+
width: 14px;
|
|
62
|
+
height: 14px;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: flex-end;
|
|
65
|
+
}
|
|
66
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon svg {
|
|
67
|
+
width: 20px;
|
|
68
|
+
height: 22px;
|
|
69
|
+
}
|
|
70
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-content {
|
|
71
|
+
display: none;
|
|
72
|
+
flex-grow: 1;
|
|
73
|
+
border-top: 0.4px solid #bcbcbc;
|
|
74
|
+
padding: 10px 0px;
|
|
75
|
+
flex-grow: 1;
|
|
76
|
+
}
|
|
77
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-content .upload-status {
|
|
78
|
+
text-align: center;
|
|
79
|
+
padding: 20px;
|
|
80
|
+
}
|
|
81
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
width: 100%;
|
|
85
|
+
align-items: center;
|
|
86
|
+
}
|
|
87
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown svg {
|
|
88
|
+
margin: 16px;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown .nice-select {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 30px;
|
|
95
|
+
padding: 4px 14px;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
border: 1px solid #ccc;
|
|
98
|
+
border-radius: 2px;
|
|
99
|
+
background-color: #fff;
|
|
100
|
+
color: #333;
|
|
101
|
+
appearance: none;
|
|
102
|
+
-webkit-appearance: none;
|
|
103
|
+
-moz-appearance: none;
|
|
104
|
+
padding-right: 30px;
|
|
105
|
+
background-repeat: no-repeat;
|
|
106
|
+
background-position: right 10px center;
|
|
107
|
+
background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="%23333" d="M10 18.4l-6.5-6.5h13z"/><path fill="%23333" d="M10 1.6l6.5 6.5H3.5z"/></svg>');
|
|
108
|
+
}
|
|
109
|
+
.player-kyc-verification-widget .verification-types .verification-box.expanded {
|
|
110
|
+
border-color: green;
|
|
111
|
+
}
|
|
112
|
+
.player-kyc-verification-widget .verification-types .verification-box.failed {
|
|
113
|
+
border-color: #d42323;
|
|
114
|
+
}
|
|
115
|
+
.player-kyc-verification-widget .verification-types .verification-box.success {
|
|
116
|
+
border-color: green;
|
|
117
|
+
}
|
|
118
|
+
.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content {
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
}
|
|
123
|
+
.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content .verification-status {
|
|
124
|
+
margin: 12px 0px 16px;
|
|
125
|
+
font-size: 18px;
|
|
126
|
+
text-align: center;
|
|
127
|
+
color: #9b9b9b;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@container (min-width: 700px) {
|
|
131
|
+
.player-kyc-verification-widget {
|
|
132
|
+
padding: 100px 60px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
@container (max-width: 700px) {
|
|
136
|
+
.player-kyc-verification-widget h2 {
|
|
137
|
+
margin: 4px;
|
|
138
|
+
text-align: center;
|
|
139
|
+
}
|
|
140
|
+
.player-kyc-verification-widget .verification-types {
|
|
141
|
+
grid-template-columns: 1fr;
|
|
142
|
+
grid-gap: 16px;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
@container (max-width: 1249px) {
|
|
146
|
+
.verification-types {
|
|
147
|
+
grid-template-columns: repeat(2, 1fr);
|
|
148
|
+
}
|
|
149
|
+
}
|