@everymatrix/general-player-register-form 0.0.215 → 0.0.219
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/general-player-register-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.219",
|
|
4
4
|
"main": "dist/general-player-register-form.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "b1dd26e91c542c1d18b2f2d8f1dbb391eb2330ee"
|
|
40
40
|
}
|
|
@@ -6,25 +6,29 @@
|
|
|
6
6
|
import { _, addNewMessages, setLocale, setupI18n } from './i18n';
|
|
7
7
|
import { RegisterFormTranslations } from './translations';
|
|
8
8
|
|
|
9
|
+
// Native bridge
|
|
10
|
+
import { isNative, call as callNative, registerEventListener as registerNativeEventListener } from 'js-native-bridge';
|
|
11
|
+
|
|
9
12
|
import '@everymatrix/general-player-register-form-step1';
|
|
10
13
|
import '@everymatrix/general-player-register-form-step2';
|
|
11
14
|
import '@everymatrix/general-player-register-form-step3';
|
|
12
15
|
|
|
13
16
|
export let endpoint:string = '';
|
|
14
|
-
export let cmsendpoint:
|
|
17
|
+
export let cmsendpoint:string = '';
|
|
15
18
|
export let imagedesktop:string = '';
|
|
16
19
|
export let playerid:string = '';
|
|
17
20
|
export let session:string = '';
|
|
18
21
|
export let trackedanalyticsdata:string = '';
|
|
19
22
|
export let captchakey:string = '';
|
|
20
23
|
export let lang:string = '';
|
|
24
|
+
export let licenseyears:string = '';
|
|
21
25
|
|
|
22
26
|
let isLoading:boolean = false;
|
|
23
27
|
|
|
24
|
-
let showRegisterStepOne:
|
|
25
|
-
let showRegisterStepTwo:
|
|
26
|
-
let showRegisterStepThree:
|
|
27
|
-
let showConfirmation:
|
|
28
|
+
let showRegisterStepOne:boolean = true;
|
|
29
|
+
let showRegisterStepTwo:boolean = false;
|
|
30
|
+
let showRegisterStepThree:boolean = false;
|
|
31
|
+
let showConfirmation:boolean = false;
|
|
28
32
|
let cmsData:any;
|
|
29
33
|
let showError:boolean = false;
|
|
30
34
|
|
|
@@ -33,24 +37,34 @@
|
|
|
33
37
|
let accountCreationMessage:string = '';
|
|
34
38
|
let image:Object = {};
|
|
35
39
|
|
|
36
|
-
let userAgent:
|
|
37
|
-
let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
|
|
40
|
+
let userAgent:string = window.navigator.userAgent;
|
|
41
|
+
let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
|
|
38
42
|
|
|
43
|
+
// @TODO typescript model type for userData
|
|
39
44
|
let userData:any = {};
|
|
40
|
-
let stepTwoVisited:
|
|
41
|
-
let stepThreeVisited:
|
|
42
|
-
let userconsentsexist:
|
|
45
|
+
let stepTwoVisited:boolean = false;
|
|
46
|
+
let stepThreeVisited:boolean = false;
|
|
47
|
+
let userconsentsexist:boolean = false;
|
|
43
48
|
let error:string = '';
|
|
44
49
|
|
|
45
50
|
let scrollSteps:HTMLElement;
|
|
46
51
|
|
|
52
|
+
// Native bridge
|
|
53
|
+
let isOnNative:boolean = false;
|
|
54
|
+
|
|
55
|
+
// @TODO typescript model for loginFields
|
|
56
|
+
let loginFields:any = {
|
|
57
|
+
username: '',
|
|
58
|
+
password: '',
|
|
59
|
+
};
|
|
60
|
+
|
|
47
61
|
// setupI18n({ withLocale: 'en', translations: {}});
|
|
48
62
|
|
|
49
63
|
Object.keys(RegisterFormTranslations).forEach((item:any) => {
|
|
50
64
|
addNewMessages(item, RegisterFormTranslations[item]);
|
|
51
65
|
});
|
|
52
66
|
|
|
53
|
-
const verifyUserConsents = () => {
|
|
67
|
+
const verifyUserConsents = ():void => {
|
|
54
68
|
fetch(`${endpoint}/player/consentRequirements`)
|
|
55
69
|
.then((res:any) => res.json())
|
|
56
70
|
.then(data => {
|
|
@@ -62,15 +76,17 @@
|
|
|
62
76
|
});
|
|
63
77
|
}
|
|
64
78
|
|
|
65
|
-
const getCmsData = () => {
|
|
66
|
-
|
|
79
|
+
const getCmsData = ():void => {
|
|
80
|
+
let url:URL = new URL(`${cmsendpoint}${lang}/login-register-content`);
|
|
81
|
+
|
|
82
|
+
fetch(url.href)
|
|
67
83
|
.then((res: any) => res.json())
|
|
68
84
|
.then((data: any) => {
|
|
69
|
-
cmsData = data.
|
|
85
|
+
cmsData = data.registerData;
|
|
70
86
|
|
|
71
|
-
accountCreationTitle = cmsData.
|
|
72
|
-
accountCreationSubTitle = cmsData.
|
|
73
|
-
accountCreationMessage = cmsData.
|
|
87
|
+
accountCreationTitle = cmsData.title;
|
|
88
|
+
accountCreationSubTitle = cmsData.subtitle;
|
|
89
|
+
accountCreationMessage = cmsData.content;
|
|
74
90
|
|
|
75
91
|
})
|
|
76
92
|
.catch((err: any) => {
|
|
@@ -78,11 +94,12 @@
|
|
|
78
94
|
});
|
|
79
95
|
};
|
|
80
96
|
|
|
81
|
-
const scrollTop = () => {
|
|
97
|
+
const scrollTop = ():void => {
|
|
82
98
|
scrollSteps.scrollIntoView();
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
|
|
101
|
+
// @TODO data typescript
|
|
102
|
+
const createData = (step:string, data:any):void => {
|
|
86
103
|
if (step === 'RegisterStepOne') {
|
|
87
104
|
userData.email = data.userEmail;
|
|
88
105
|
userData.username = data.userValue;
|
|
@@ -114,16 +131,17 @@
|
|
|
114
131
|
// analytics data
|
|
115
132
|
userData.affiliateMarker = trackedanalyticsdata;
|
|
116
133
|
|
|
117
|
-
if(userconsentsexist) {
|
|
134
|
+
if (userconsentsexist) {
|
|
118
135
|
userData.userConsents.additionalProp1 = data.consentOffersSms;
|
|
119
136
|
userData.userConsents.additionalProp2 = data.consentOffersEmail;
|
|
120
137
|
userData.userConsents.additionalProp3 = data.consentTerms;
|
|
121
138
|
}
|
|
139
|
+
|
|
122
140
|
userData.token = data.token;
|
|
123
141
|
}
|
|
124
142
|
}
|
|
125
143
|
|
|
126
|
-
const messageHandler = (e:any) => {
|
|
144
|
+
const messageHandler = (e:any):void => {
|
|
127
145
|
if (e.data) {
|
|
128
146
|
switch(e.data.type) {
|
|
129
147
|
case 'RegisterStepOne':
|
|
@@ -178,8 +196,26 @@
|
|
|
178
196
|
}
|
|
179
197
|
}
|
|
180
198
|
|
|
181
|
-
const
|
|
199
|
+
const handlePostRegister = ():void => {
|
|
200
|
+
if (isOnNative) {
|
|
201
|
+
registerNativeEventListener(
|
|
202
|
+
'BIOMETRICS_ENABLED',
|
|
203
|
+
() => {
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const { username, password } = loginFields;
|
|
208
|
+
|
|
209
|
+
const methodFound = callNative('ENABLE_BIOMETRICS', { username, password });
|
|
210
|
+
|
|
211
|
+
if (!methodFound) {
|
|
212
|
+
// Nothing to do here
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
182
216
|
|
|
217
|
+
// @TODO typescript data model for userData
|
|
218
|
+
const sendData = async (userData:any):Promise<any> => {
|
|
183
219
|
let sendRegistrationData = {
|
|
184
220
|
method: "PUT",
|
|
185
221
|
headers: {
|
|
@@ -196,34 +232,45 @@
|
|
|
196
232
|
if (response.ok) {
|
|
197
233
|
showRegisterStepThree = false;
|
|
198
234
|
showConfirmation = true;
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
loginFields = {
|
|
238
|
+
username: userData.username,
|
|
239
|
+
password: userData.password
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
handlePostRegister();
|
|
199
243
|
} else {
|
|
200
|
-
// Parsing GMCore message 'cuz it's stupid and it doesn't know how to send error messages in 2021 ffs
|
|
244
|
+
// Parsing GMCore message 'cuz it's stupid and it doesn't know how to send error messages in 2021...2022 already ffs
|
|
245
|
+
// I really hope this piece of code won't survive long enough so that the years above will reach 2025 or something ... like, for real, please ... some real errors? plox ...
|
|
201
246
|
error = data.error.substring(data.error.indexOf('errorMessage') + 13, data.error.length);
|
|
202
247
|
showError = true;
|
|
203
248
|
window.postMessage({ type: "ShowRegistrationError", showError, error }, window.location.href);
|
|
204
249
|
}
|
|
205
250
|
}
|
|
206
251
|
|
|
207
|
-
const switchToLogin = () => {
|
|
252
|
+
const switchToLogin = ():void => {
|
|
208
253
|
window.postMessage({ type: "ToLogin" }, window.location.href);
|
|
209
254
|
}
|
|
210
255
|
|
|
211
|
-
const
|
|
256
|
+
const setActiveLanguage = ():void => {
|
|
212
257
|
setLocale(lang);
|
|
213
258
|
}
|
|
214
259
|
|
|
215
260
|
onMount(() => {
|
|
216
|
-
verifyUserConsents();
|
|
217
|
-
getCmsData();
|
|
218
261
|
window.addEventListener('message', messageHandler, false);
|
|
219
262
|
|
|
263
|
+
verifyUserConsents();
|
|
264
|
+
isOnNative = !!isNative(userAgent);
|
|
265
|
+
|
|
220
266
|
return () => {
|
|
221
267
|
window.removeEventListener('message', messageHandler);
|
|
222
268
|
}
|
|
223
269
|
});
|
|
224
270
|
|
|
271
|
+
$: cmsendpoint && getCmsData();
|
|
225
272
|
$: playerid && session;
|
|
226
|
-
$: lang &&
|
|
273
|
+
$: lang && setActiveLanguage();
|
|
227
274
|
</script>
|
|
228
275
|
|
|
229
276
|
{#if isLoading}
|
|
@@ -248,7 +295,7 @@ $: lang && initialLoad();
|
|
|
248
295
|
{/if}
|
|
249
296
|
{#if showRegisterStepTwo}
|
|
250
297
|
<div class="RegisterFormStep2">
|
|
251
|
-
<general-player-register-form-step2 {endpoint} {lang} />
|
|
298
|
+
<general-player-register-form-step2 {endpoint} {lang} {licenseyears} />
|
|
252
299
|
</div>
|
|
253
300
|
{/if}
|
|
254
301
|
{#if showRegisterStepThree}
|
|
@@ -303,7 +350,7 @@ $: lang && initialLoad();
|
|
|
303
350
|
scrollbar-color: #cfcfcf #f1f1f1;
|
|
304
351
|
scrollbar-width: thin;
|
|
305
352
|
&.RegisterFormContainerMobile {
|
|
306
|
-
padding:
|
|
353
|
+
padding: 40px 20px;;
|
|
307
354
|
height: auto;
|
|
308
355
|
overflow-y: initial;
|
|
309
356
|
}
|
|
@@ -325,15 +372,15 @@ $: lang && initialLoad();
|
|
|
325
372
|
|
|
326
373
|
.RegisterSteps {
|
|
327
374
|
display: flex;
|
|
328
|
-
gap:
|
|
329
|
-
padding:
|
|
375
|
+
gap: 10px;
|
|
376
|
+
padding: 20px 0 30px;
|
|
330
377
|
}
|
|
331
378
|
|
|
332
379
|
.RegisterFirstStepDash,
|
|
333
380
|
.RegisterSecondStepDash,
|
|
334
381
|
.RegisterThirdStepDash {
|
|
335
|
-
width:
|
|
336
|
-
height:
|
|
382
|
+
width: 50px;
|
|
383
|
+
height: 2px;
|
|
337
384
|
background-color: #D1D1D1;
|
|
338
385
|
}
|
|
339
386
|
|