@everymatrix/general-player-sms-verification-form 0.0.353 → 0.0.356
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-sms-verification-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.356",
|
|
4
4
|
"main": "index.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": "9da657647b6a922a9bb6688be682fbcba497df90"
|
|
40
40
|
}
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
let smsCode: number;
|
|
15
15
|
let isSmsValid: boolean = true;
|
|
16
|
-
let
|
|
17
|
-
let
|
|
16
|
+
let smsSendApiFailed:boolean = false;
|
|
17
|
+
let secondsLeft:number = 60;
|
|
18
|
+
let timer:any;
|
|
18
19
|
|
|
19
20
|
setupI18n({ withLocale: 'en', translations: {}});
|
|
20
21
|
|
|
@@ -74,9 +75,10 @@
|
|
|
74
75
|
if(res.ok) {
|
|
75
76
|
tokenid = data.id;
|
|
76
77
|
smsSendApiFailed = false;
|
|
77
|
-
|
|
78
|
+
timer = setInterval(() => {
|
|
79
|
+
timerCountdown();
|
|
80
|
+
}, 1000);
|
|
78
81
|
} else {
|
|
79
|
-
resend = false;
|
|
80
82
|
smsSendApiFailed = true;
|
|
81
83
|
throw new Error("Failed to fetch");
|
|
82
84
|
}
|
|
@@ -86,6 +88,16 @@
|
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
const timerCountdown = () => {
|
|
92
|
+
if (secondsLeft > 0 ) {
|
|
93
|
+
secondsLeft--;
|
|
94
|
+
} else {
|
|
95
|
+
clearInterval(timer);
|
|
96
|
+
timer = false;
|
|
97
|
+
secondsLeft = 60;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
89
101
|
$: tokenid && playerid && endpoint;
|
|
90
102
|
</script>
|
|
91
103
|
|
|
@@ -110,6 +122,9 @@
|
|
|
110
122
|
{/if}
|
|
111
123
|
</div>
|
|
112
124
|
|
|
125
|
+
{#if timer}
|
|
126
|
+
<p class="SmsVerificationResendMessage" part="SmsVerificationResendMessage">{$_('smsVerification.resendMessage')}</p>
|
|
127
|
+
{/if}
|
|
113
128
|
|
|
114
129
|
<button
|
|
115
130
|
class="Button SmsVerificationValidate"
|
|
@@ -117,15 +132,13 @@
|
|
|
117
132
|
on:click={activateUser}>
|
|
118
133
|
{$_('smsVerification.activate')}
|
|
119
134
|
</button>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
</button>
|
|
128
|
-
{/if}
|
|
135
|
+
<button
|
|
136
|
+
class="Button SmsVerificationResend"
|
|
137
|
+
part="SmsVerificationResend"
|
|
138
|
+
on:click={resendCode}
|
|
139
|
+
disabled={timer}>
|
|
140
|
+
{$_('smsVerification.resend')} {#if timer}<span class="SmsVerificationResendTimer">(0:{secondsLeft < 10 ? '0' : ''}{secondsLeft})</span>{/if}
|
|
141
|
+
</button>
|
|
129
142
|
</div>
|
|
130
143
|
|
|
131
144
|
|
|
@@ -217,5 +230,9 @@
|
|
|
217
230
|
border: 1px solid var(--emfe-w-color-gray-100, #E6E6E6);
|
|
218
231
|
cursor: not-allowed;
|
|
219
232
|
}
|
|
233
|
+
&.SmsVerificationResend {
|
|
234
|
+
background: var(--emfe-w-color-gray-50, #F9F8F8);
|
|
235
|
+
color: var(--emfe-w-color-black, #000000);
|
|
236
|
+
}
|
|
220
237
|
}
|
|
221
238
|
</style>
|
package/src/translations.js
CHANGED
|
@@ -4,7 +4,8 @@ export const SmsVerificationTranslations = {
|
|
|
4
4
|
title: 'Please enter the verification code you received on your number',
|
|
5
5
|
errorTitle: 'Your code was invalid, you can resend the code and try again',
|
|
6
6
|
code: 'Sms code',
|
|
7
|
-
smsCodeError: 'Invalid sms code, you
|
|
7
|
+
smsCodeError: 'Invalid sms code, you can resend the code',
|
|
8
|
+
resendMessage: 'A new verification code has been sent to your phone number.',
|
|
8
9
|
activate: 'Activate Account',
|
|
9
10
|
resend: 'Resend'
|
|
10
11
|
}
|
|
@@ -14,7 +15,8 @@ export const SmsVerificationTranslations = {
|
|
|
14
15
|
title: 'Please enter the verification code you received on your number',
|
|
15
16
|
errorTitle: 'Your code was invalid, you can resend the code and try again',
|
|
16
17
|
code: 'Sms code',
|
|
17
|
-
smsCodeError: 'Invalid sms code, you
|
|
18
|
+
smsCodeError: 'Invalid sms code, you can resend the code',
|
|
19
|
+
resendMessage: 'A new verification code has been sent to your phone number.',
|
|
18
20
|
activate: 'Activate Account',
|
|
19
21
|
resend: 'Resend'
|
|
20
22
|
}
|
|
@@ -24,7 +26,8 @@ export const SmsVerificationTranslations = {
|
|
|
24
26
|
title: 'Please enter the verification code you received on your number',
|
|
25
27
|
errorTitle: 'Your code was invalid, you can resend the code and try again',
|
|
26
28
|
code: 'Sms code',
|
|
27
|
-
smsCodeError: 'Invalid sms code, you
|
|
29
|
+
smsCodeError: 'Invalid sms code, you can resend the code',
|
|
30
|
+
resendMessage: 'A new verification code has been sent to your phone number.',
|
|
28
31
|
activate: 'Activate Account',
|
|
29
32
|
resend: 'Resend'
|
|
30
33
|
}
|
|
@@ -34,7 +37,8 @@ export const SmsVerificationTranslations = {
|
|
|
34
37
|
title: 'Please enter the verification code you received on your number',
|
|
35
38
|
errorTitle: 'Your code was invalid, you can resend the code and try again',
|
|
36
39
|
code: 'Sms code',
|
|
37
|
-
smsCodeError: 'Invalid sms code, you
|
|
40
|
+
smsCodeError: 'Invalid sms code, you can resend the code',
|
|
41
|
+
resendMessage: 'A new verification code has been sent to your phone number.',
|
|
38
42
|
activate: 'Activate Account',
|
|
39
43
|
resend: 'Resend'
|
|
40
44
|
}
|
|
@@ -44,7 +48,8 @@ export const SmsVerificationTranslations = {
|
|
|
44
48
|
title: 'Please enter the verification code you received on your number',
|
|
45
49
|
errorTitle: 'Your code was invalid, you can resend the code and try again',
|
|
46
50
|
code: 'Sms code',
|
|
47
|
-
smsCodeError: 'Invalid sms code, you
|
|
51
|
+
smsCodeError: 'Invalid sms code, you can resend the code',
|
|
52
|
+
resendMessage: 'A new verification code has been sent to your phone number.',
|
|
48
53
|
activate: 'Activate Account',
|
|
49
54
|
resend: 'Resend'
|
|
50
55
|
}
|
|
@@ -54,7 +59,8 @@ export const SmsVerificationTranslations = {
|
|
|
54
59
|
title: 'Please enter the verification code you received on your number',
|
|
55
60
|
errorTitle: 'Your code was invalid, you can resend the code and try again',
|
|
56
61
|
code: 'Sms code',
|
|
57
|
-
smsCodeError: 'Invalid sms code, you
|
|
62
|
+
smsCodeError: 'Invalid sms code, you can resend the code',
|
|
63
|
+
resendMessage: 'A new verification code has been sent to your phone number.',
|
|
58
64
|
activate: 'Activate Account',
|
|
59
65
|
resend: 'Resend'
|
|
60
66
|
}
|