@everymatrix/general-player-register-form 0.0.316 → 0.0.319
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.319",
|
|
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": "303df572e2a23ddc3a1c2f113be36d9db5606323"
|
|
40
40
|
}
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
import '@everymatrix/general-player-register-form-step1';
|
|
13
13
|
import '@everymatrix/general-player-register-form-step2';
|
|
14
14
|
import '@everymatrix/general-player-register-form-step3';
|
|
15
|
+
import '@everymatrix/general-player-sms-verification-form';
|
|
15
16
|
|
|
16
17
|
export let endpoint:string = '';
|
|
17
18
|
export let cmsendpoint:string = '';
|
|
18
19
|
export let env:string = '';
|
|
19
20
|
export let imagedesktop:string = '';
|
|
20
|
-
export let playerid:string = '';
|
|
21
21
|
export let session:string = '';
|
|
22
22
|
export let trackedanalyticsdata:string = '';
|
|
23
23
|
export let captchakey:string = '';
|
|
@@ -25,14 +25,17 @@
|
|
|
25
25
|
export let licenseyears:string = '';
|
|
26
26
|
export let disabledfields:string = '';
|
|
27
27
|
export let dummydata:string = '';
|
|
28
|
+
export let smsverification = 'false';
|
|
28
29
|
|
|
29
30
|
let isLoading:boolean = false;
|
|
30
31
|
|
|
31
32
|
let disabledFieldsList:Array<string> = [];
|
|
32
33
|
|
|
34
|
+
let playerid:string = '';
|
|
33
35
|
let showRegisterStepOne:boolean = true;
|
|
34
36
|
let showRegisterStepTwo:boolean = false;
|
|
35
37
|
let showRegisterStepThree:boolean = false;
|
|
38
|
+
let showSmsVerification: boolean = false;
|
|
36
39
|
let showConfirmation:boolean = false;
|
|
37
40
|
let cmsData:any;
|
|
38
41
|
let showError:boolean = false;
|
|
@@ -54,6 +57,10 @@
|
|
|
54
57
|
let smsoffers:string = 'false';
|
|
55
58
|
let emailmarketing:string = 'false';
|
|
56
59
|
let error:string = '';
|
|
60
|
+
let smsTemplate: string = 'Please use this code {0} to activate your account';
|
|
61
|
+
let smstokenid;
|
|
62
|
+
let smsSendApiFailed = false;
|
|
63
|
+
let number;
|
|
57
64
|
|
|
58
65
|
let scrollSteps:HTMLElement;
|
|
59
66
|
|
|
@@ -164,6 +171,7 @@
|
|
|
164
171
|
userData.mobile = {};
|
|
165
172
|
userData.mobile.prefix = data.mobilePrefixSelected;
|
|
166
173
|
userData.mobile.number = data.mobile;
|
|
174
|
+
number = `${data.mobilePrefixSelected}${data.mobile}`
|
|
167
175
|
}
|
|
168
176
|
|
|
169
177
|
userData.userConsents = {};
|
|
@@ -212,6 +220,11 @@
|
|
|
212
220
|
sendData(userData);
|
|
213
221
|
break;
|
|
214
222
|
|
|
223
|
+
case 'SmsHasBeenValidated':
|
|
224
|
+
showConfirmation = true;
|
|
225
|
+
showSmsVerification = false;
|
|
226
|
+
break;
|
|
227
|
+
|
|
215
228
|
case 'GoBackStepTwo':
|
|
216
229
|
createData('RegisterStepTwo', e.data.registerStepTwoData);
|
|
217
230
|
scrollTop();
|
|
@@ -270,8 +283,12 @@
|
|
|
270
283
|
|
|
271
284
|
if (response.ok) {
|
|
272
285
|
showRegisterStepThree = false;
|
|
273
|
-
|
|
274
|
-
|
|
286
|
+
if(smsverification === 'false') {
|
|
287
|
+
showConfirmation = true;
|
|
288
|
+
} else {
|
|
289
|
+
playerid = data.id;
|
|
290
|
+
sendSmsToken(userData, data.id);
|
|
291
|
+
}
|
|
275
292
|
|
|
276
293
|
loginFields = {
|
|
277
294
|
username: userData.username,
|
|
@@ -288,6 +305,40 @@
|
|
|
288
305
|
}
|
|
289
306
|
}
|
|
290
307
|
|
|
308
|
+
const sendSmsToken = async (userData, playerId) => {
|
|
309
|
+
try {
|
|
310
|
+
const res = await fetch(`${endpoint}/player/sms/token`,{
|
|
311
|
+
method: 'POST',
|
|
312
|
+
headers: {
|
|
313
|
+
'Content-Type': 'application/json',
|
|
314
|
+
accept: 'application/json',
|
|
315
|
+
},
|
|
316
|
+
body: JSON.stringify(
|
|
317
|
+
{
|
|
318
|
+
userId: playerId,
|
|
319
|
+
messageTemplate: smsTemplate,
|
|
320
|
+
destination: `${userData.mobile.prefix}${userData.mobile.number}`,
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
const data = await res.json();
|
|
326
|
+
|
|
327
|
+
if(res.ok) {
|
|
328
|
+
smstokenid = data.id;
|
|
329
|
+
let smsMaxValidations = data.maxValidationAttempts;
|
|
330
|
+
showSmsVerification = true;
|
|
331
|
+
smsSendApiFailed = false;
|
|
332
|
+
} else {
|
|
333
|
+
smsSendApiFailed = true;
|
|
334
|
+
throw new Error("Failed to fetch");
|
|
335
|
+
}
|
|
336
|
+
} catch(err) {
|
|
337
|
+
smsSendApiFailed = true;
|
|
338
|
+
console.error(err);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
291
342
|
const formatDisabledFields = ():void => {
|
|
292
343
|
disabledFieldsList = disabledfields.split(',');
|
|
293
344
|
}
|
|
@@ -349,6 +400,22 @@ $: disabledfields && formatDisabledFields();
|
|
|
349
400
|
<general-player-register-form-step3 {userconsentsexist} {termsconditions} {smsoffers} {emailmarketing} {endpoint} {captchakey} {lang} {disabledfields} {dummydata} />
|
|
350
401
|
</div>
|
|
351
402
|
{/if}
|
|
403
|
+
{#if smsverification && showSmsVerification}
|
|
404
|
+
{#if !smsSendApiFailed}
|
|
405
|
+
<general-player-sms-verification-form
|
|
406
|
+
{endpoint}
|
|
407
|
+
{session}
|
|
408
|
+
{number}
|
|
409
|
+
{playerid}
|
|
410
|
+
tokenid={smstokenid}>
|
|
411
|
+
</general-player-sms-verification-form>
|
|
412
|
+
{:else}
|
|
413
|
+
<p>
|
|
414
|
+
We encountered an issue sending the sms to your number,
|
|
415
|
+
you can verify your number while loging in
|
|
416
|
+
</p>
|
|
417
|
+
{/if}
|
|
418
|
+
{/if}
|
|
352
419
|
{#if showConfirmation}
|
|
353
420
|
<div class="RegisterConfirmation" part="RegisterConfirmation">
|
|
354
421
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 73.95 51"><defs><style>.a{fill:#16ce16;}</style></defs><path class="a" d="M29.325,51,0,21.675l5.95-5.95,23.375,22.95L68,0l5.95,5.95Z"/></svg>
|