@everymatrix/general-player-register-form-step3 0.0.129 → 0.0.133
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.
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
let invalidAddress:string = '';
|
|
7
7
|
let invalidPostalCode:string = '';
|
|
8
|
-
let invalidMobile:string= '';
|
|
8
|
+
let invalidMobile:string = '';
|
|
9
|
+
let invalidCity:string = '';
|
|
10
|
+
let invalidNationality:string = '';
|
|
9
11
|
|
|
10
12
|
let address:string = '';
|
|
11
13
|
let postalCode:string = '';
|
|
12
|
-
let
|
|
14
|
+
let city:string = '';
|
|
15
|
+
let countries:Array<Object> = ['RO'];
|
|
13
16
|
let countrySelected:string = countries[0];
|
|
17
|
+
let nationality:string = '';
|
|
14
18
|
let mobile:string = '';
|
|
15
|
-
let mobilePrefixes:Array<Object> = ['+
|
|
19
|
+
let mobilePrefixes:Array<Object> = ['+40'];
|
|
16
20
|
let mobilePrefixSelected:string = mobilePrefixes[0];
|
|
17
21
|
let consentOffers:Boolean = false;
|
|
18
22
|
let consentOffersSms:Boolean = false;
|
|
@@ -21,15 +25,17 @@
|
|
|
21
25
|
|
|
22
26
|
let isValid:Boolean = false;
|
|
23
27
|
|
|
28
|
+
const captchaKey = '6Lc7w8YcAAAAAEMHc_VNN9bqfVnILoUOHSHyZ0yn';
|
|
29
|
+
|
|
24
30
|
const checkIsValid = () => {
|
|
25
|
-
isValid = !(invalidAddress || invalidPostalCode || invalidMobile);
|
|
26
|
-
if (address.length <= 0 || postalCode.length <= 0 || mobile.length <= 0 || consentTerms == false) {
|
|
31
|
+
isValid = !(invalidAddress || invalidPostalCode || invalidCity || invalidNationality || invalidMobile);
|
|
32
|
+
if (address.length <= 0 || postalCode.length <= 0 || city.length <= 0 || nationality.length <= 0 || mobile.length <= 0 || consentTerms == false) {
|
|
27
33
|
isValid = false;
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
const checkAddress = () => {
|
|
32
|
-
if(address) {
|
|
38
|
+
if(address && address.length <= 100) {
|
|
33
39
|
return true;
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -42,7 +48,7 @@
|
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
const checkPostalCode = () => {
|
|
45
|
-
if(postalCode) {
|
|
51
|
+
if(postalCode && postalCode.length <= 20) {
|
|
46
52
|
return true;
|
|
47
53
|
}
|
|
48
54
|
|
|
@@ -54,8 +60,34 @@
|
|
|
54
60
|
checkIsValid();
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
const checkCity = () => {
|
|
64
|
+
if(city && city.length <= 50) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const validateCity = () => {
|
|
72
|
+
invalidCity = !checkCity();
|
|
73
|
+
checkIsValid();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const checkNationality = () => {
|
|
77
|
+
if(nationality) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const validateNationality = () => {
|
|
85
|
+
invalidNationality = !checkNationality();
|
|
86
|
+
checkIsValid();
|
|
87
|
+
}
|
|
88
|
+
|
|
57
89
|
const checkMobile = () => {
|
|
58
|
-
if(mobile) {
|
|
90
|
+
if(mobile && mobile.length >= 5 && mobile.length <= 30) {
|
|
59
91
|
return true;
|
|
60
92
|
}
|
|
61
93
|
|
|
@@ -102,41 +134,64 @@
|
|
|
102
134
|
checkIsValid();
|
|
103
135
|
}
|
|
104
136
|
|
|
137
|
+
const doRecaptcha = () => {
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
grecaptcha.ready(() => {
|
|
140
|
+
grecaptcha.execute(captchaKey, { action: "submit" }).then((token) => {
|
|
141
|
+
resolve(token);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
105
147
|
const goNext = () => {
|
|
106
|
-
let
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
148
|
+
let registerStepThreeData = {};
|
|
149
|
+
|
|
150
|
+
doRecaptcha().then((token) => {
|
|
151
|
+
registerStepThreeData = {
|
|
152
|
+
address,
|
|
153
|
+
postalCode,
|
|
154
|
+
city,
|
|
155
|
+
countrySelected,
|
|
156
|
+
nationality,
|
|
157
|
+
mobilePrefixSelected,
|
|
158
|
+
mobile,
|
|
159
|
+
consentOffersSms,
|
|
160
|
+
consentOffersEmail,
|
|
161
|
+
consentTerms,
|
|
162
|
+
token
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
window.postMessage({ type: 'RegisterStepThree', registerStepThreeData }, window.location.href);
|
|
166
|
+
});
|
|
117
167
|
}
|
|
118
168
|
|
|
119
169
|
const goBack = () => {
|
|
120
|
-
let
|
|
170
|
+
let registerStepThreeData = {
|
|
121
171
|
address,
|
|
122
172
|
postalCode,
|
|
173
|
+
city,
|
|
123
174
|
countrySelected,
|
|
175
|
+
nationality,
|
|
124
176
|
mobilePrefixSelected,
|
|
125
177
|
mobile,
|
|
126
178
|
consentOffersSms,
|
|
127
179
|
consentOffersEmail,
|
|
128
180
|
consentTerms
|
|
129
181
|
}
|
|
130
|
-
|
|
182
|
+
|
|
183
|
+
window.postMessage({ type: 'GoBackStepThree', registerStepThreeData }, window.location.href);
|
|
131
184
|
}
|
|
132
185
|
|
|
133
186
|
const messageHandler = (e:any) => {
|
|
134
187
|
if (e.data) {
|
|
135
188
|
switch(e.data.type) {
|
|
136
|
-
case '
|
|
189
|
+
case 'StepThreeDataBackup':
|
|
137
190
|
address = e.data.userData.address1;
|
|
138
191
|
postalCode = e.data.userData.postalCode;
|
|
192
|
+
city = e.data.userData.city;
|
|
139
193
|
countrySelected = e.data.userData.country;
|
|
194
|
+
nationality = e.data.userData.nationality;
|
|
140
195
|
mobilePrefixSelected = e.data.userData.mobile.prefix;
|
|
141
196
|
mobile = e.data.userData.mobile.number;
|
|
142
197
|
consentOffersSms = e.data.userData.userConsents.additionalProp1;
|
|
@@ -161,6 +216,12 @@
|
|
|
161
216
|
});
|
|
162
217
|
</script>
|
|
163
218
|
|
|
219
|
+
<svelte:head>
|
|
220
|
+
<script src="//www.google.com/recaptcha/api.js?render={captchaKey}" async defer></script>
|
|
221
|
+
</svelte:head>
|
|
222
|
+
|
|
223
|
+
<div class="g-recaptcha" data-sitekey="{captchaKey}" />
|
|
224
|
+
|
|
164
225
|
<div class="RegisterFormHeader">
|
|
165
226
|
<button class="BackButton" on:click={goBack}>
|
|
166
227
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:#d0046c;}</style></defs><path class="a" d="M12,0,9.818,2.182l8.26,8.26H0v3.117H18.078l-8.26,8.26L12,24,24,12Z" transform="translate(24 24) rotate(180)"/></svg>
|
|
@@ -173,17 +234,24 @@
|
|
|
173
234
|
<label for="Address">Address:<span class="FormRequired">*</span></label>
|
|
174
235
|
<input bind:value={address} on:blur={validateAddress} type="text" id="Address" />
|
|
175
236
|
{#if invalidAddress}
|
|
176
|
-
<p class="InvalidInput">Address must be at least 1 character long.</p>
|
|
237
|
+
<p class="InvalidInput">Address must be at least 1 character long and 100 characters maximum.</p>
|
|
177
238
|
{/if}
|
|
178
239
|
</div>
|
|
179
240
|
<div class="PostalCodeContainer {invalidPostalCode ? 'InvalidField' : ''}">
|
|
180
241
|
<label for="PostalCode">Postal Code:<span class="FormRequired">*</span></label>
|
|
181
242
|
<input bind:value={postalCode} on:blur={validatePostalCode} type="text" id="PostalCode" />
|
|
182
243
|
{#if invalidPostalCode}
|
|
183
|
-
<p class="InvalidInput">Postal Code must be at least 1 character long.</p>
|
|
244
|
+
<p class="InvalidInput">Postal Code must be at least 1 character long and 20 characters maximum.</p>
|
|
184
245
|
{/if}
|
|
185
246
|
</div>
|
|
186
247
|
</div>
|
|
248
|
+
<div class="CityContainer {invalidCity ? 'InvalidField' : ''}">
|
|
249
|
+
<label for="City">City:<span class="FormRequired">*</span></label>
|
|
250
|
+
<input bind:value={city} on:blur={validateCity} type="text" id="City" />
|
|
251
|
+
{#if invalidCity}
|
|
252
|
+
<p class="InvalidInput">City must be at least 1 character long and 50 characters maximum.</p>
|
|
253
|
+
{/if}
|
|
254
|
+
</div>
|
|
187
255
|
<div class="CountryContainer">
|
|
188
256
|
<label for="Country">Country:<span class="FormRequired">*</span></label>
|
|
189
257
|
<select bind:value={countrySelected} id="Country">
|
|
@@ -192,6 +260,13 @@
|
|
|
192
260
|
{/each}
|
|
193
261
|
</select>
|
|
194
262
|
</div>
|
|
263
|
+
<div class="NationalityContainer {invalidNationality ? 'InvalidField' : ''}">
|
|
264
|
+
<label for="Nationality">Nationality:<span class="FormRequired">*</span></label>
|
|
265
|
+
<input bind:value={nationality} on:blur={validateNationality} type="text" id="Nationality" />
|
|
266
|
+
{#if invalidNationality}
|
|
267
|
+
<p class="InvalidInput">Nationality must be at least 1 character long.</p>
|
|
268
|
+
{/if}
|
|
269
|
+
</div>
|
|
195
270
|
<div class="MobileContainer {invalidMobile ? 'InvalidField' : ''}">
|
|
196
271
|
<label for="Mobile">Mobile:<span class="FormRequired">*</span></label>
|
|
197
272
|
<div class="MobileWrapper">
|
|
@@ -202,7 +277,7 @@
|
|
|
202
277
|
</select>
|
|
203
278
|
<input bind:value={mobile} on:blur={validateMobile} type="text" id="Mobile" class="MobileInput" />
|
|
204
279
|
{#if invalidMobile}
|
|
205
|
-
<p class="InvalidInput">Mobile must be at least
|
|
280
|
+
<p class="InvalidInput">Mobile must be at least 5 character long and 20 characters maximum.</p>
|
|
206
281
|
{/if}
|
|
207
282
|
</div>
|
|
208
283
|
</div>
|
|
@@ -234,7 +309,7 @@
|
|
|
234
309
|
</div>
|
|
235
310
|
{/if}
|
|
236
311
|
</div>
|
|
237
|
-
<button class="RegisterStepNext" disabled={!isValid} on:click={goNext}>
|
|
312
|
+
<button class="RegisterStepNext" disabled={!isValid} on:click={goNext}>Open Account</button>
|
|
238
313
|
|
|
239
314
|
<style lang="scss">
|
|
240
315
|
//This function does a multiplication
|
|
@@ -273,7 +348,9 @@
|
|
|
273
348
|
|
|
274
349
|
.AddressContainer,
|
|
275
350
|
.PostalCodeContainer,
|
|
351
|
+
.CityContainer,
|
|
276
352
|
.CountryContainer,
|
|
353
|
+
.NationalityContainer,
|
|
277
354
|
.MobileContainer {
|
|
278
355
|
color: #58586B;
|
|
279
356
|
display: flex;
|