@everymatrix/general-player-register-form 0.0.118 → 0.0.122
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.122",
|
|
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": "974bc1c7b1767d96828ec1b85d35e27a622c9a63"
|
|
40
40
|
}
|
|
@@ -1,33 +1,184 @@
|
|
|
1
1
|
<svelte:options tag={null} />
|
|
2
2
|
|
|
3
3
|
<script lang="typescript">
|
|
4
|
+
import { getDevice } from 'rvhelper';
|
|
5
|
+
import { onMount } from "svelte";
|
|
6
|
+
|
|
7
|
+
import '@everymatrix/general-player-register-form-step1';
|
|
8
|
+
import '@everymatrix/general-player-register-form-step2';
|
|
9
|
+
import '@everymatrix/general-player-register-form-step3';
|
|
10
|
+
|
|
4
11
|
let isLoading:boolean = false;
|
|
12
|
+
|
|
13
|
+
let showRegisterStep1:Boolean = true;
|
|
14
|
+
let showRegisterStep2:Boolean = false;
|
|
15
|
+
let showRegisterStep3:Boolean = false;
|
|
16
|
+
let showConfirmation:Boolean = false;
|
|
17
|
+
|
|
18
|
+
let profileUrl = 'https://demo-api.stage.norway.everymatrix.com/v1/player/';
|
|
19
|
+
let userAgent:String = window.navigator.userAgent;
|
|
20
|
+
let isMobile = (getDevice(userAgent) === 'PC') ? false : true;
|
|
21
|
+
|
|
22
|
+
let userData:any = {};
|
|
23
|
+
let step2Visited:Boolean = false;
|
|
24
|
+
let step3Visited:Boolean = false;
|
|
25
|
+
|
|
26
|
+
export let playerid;
|
|
27
|
+
export let session;
|
|
28
|
+
|
|
29
|
+
const createData = (step:string, data:any) => {
|
|
30
|
+
if (step === 'Step1') {
|
|
31
|
+
userData.email = data.userEmail;
|
|
32
|
+
userData.username = data.userValue;
|
|
33
|
+
userData.password = data.userPassword;
|
|
34
|
+
userData.securityQuestion = data.securityQuestion;
|
|
35
|
+
userData.securityAnswer = data.securityAnswer;
|
|
36
|
+
}
|
|
37
|
+
if (step === 'Step2') {
|
|
38
|
+
userData.gender = data.userGenderSelected;
|
|
39
|
+
userData.firstname = data.userFirstName;
|
|
40
|
+
userData.lastname = data.userLastName;
|
|
41
|
+
userData.birth = {};
|
|
42
|
+
userData.birth.day = data.birthDaySelected;
|
|
43
|
+
userData.birth.month = data.birthMonthSelected;
|
|
44
|
+
userData.birth.year = data.birthYearSelected;
|
|
45
|
+
userData.currency = data.currencySelected;
|
|
46
|
+
}
|
|
47
|
+
if (step === 'Step3') {
|
|
48
|
+
userData.address1 = data.address;
|
|
49
|
+
userData.postalCode = data.postalCode;
|
|
50
|
+
userData.country = data.countrySelected;
|
|
51
|
+
userData.mobile = {};
|
|
52
|
+
userData.mobile.prefix = data.mobilePrefixSelected;
|
|
53
|
+
userData.mobile.number = data.mobile;
|
|
54
|
+
userData.userConsents = {};
|
|
55
|
+
userData.userConsents.additionalProp1 = data.consentOffersSms;
|
|
56
|
+
userData.userConsents.additionalProp2 = data.consentOffersEmail;
|
|
57
|
+
userData.userConsents.additionalProp3 = data.consentTerms;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const messageHandler = (e:any) => {
|
|
62
|
+
if (e.data) {
|
|
63
|
+
switch(e.data.type) {
|
|
64
|
+
case 'Step1':
|
|
65
|
+
createData('Step1', e.data.Step1Data);
|
|
66
|
+
showRegisterStep1 = false;
|
|
67
|
+
showRegisterStep2 = true;
|
|
68
|
+
if (step2Visited == false) {
|
|
69
|
+
step2Visited = true;
|
|
70
|
+
} else {
|
|
71
|
+
window.postMessage({ type: 'Step2DataBackup', userData }, window.location.href);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
|
|
75
|
+
case 'Step2':
|
|
76
|
+
createData('Step2', e.data.Step2Data);
|
|
77
|
+
showRegisterStep2 = false;
|
|
78
|
+
showRegisterStep3 = true;
|
|
79
|
+
if (step3Visited == false) {
|
|
80
|
+
step3Visited = true;
|
|
81
|
+
} else {
|
|
82
|
+
window.postMessage({ type: 'Step3DataBackup', userData }, window.location.href);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
|
|
86
|
+
case 'Step3':
|
|
87
|
+
createData('Step3', e.data.Step3Data);
|
|
88
|
+
showRegisterStep3 = false;
|
|
89
|
+
getData(userData);
|
|
90
|
+
break;
|
|
91
|
+
|
|
92
|
+
case 'GoBackStep2':
|
|
93
|
+
createData('Step2', e.data.Step2Data);
|
|
94
|
+
showRegisterStep1 = true;
|
|
95
|
+
showRegisterStep2 = false;
|
|
96
|
+
window.postMessage({ type: 'Step1DataBackup', userData }, window.location.href);
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
case 'GoBackStep3':
|
|
100
|
+
createData('Step3', e.data.Step3Data);
|
|
101
|
+
showRegisterStep2 = true;
|
|
102
|
+
showRegisterStep3 = false;
|
|
103
|
+
window.postMessage({ type: 'Step2DataBackup', userData }, window.location.href);
|
|
104
|
+
break;
|
|
105
|
+
|
|
106
|
+
default:
|
|
107
|
+
// do nothing
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const getData = (userData:any) => {
|
|
114
|
+
let sendRegistrationData = {
|
|
115
|
+
method: "PUT",
|
|
116
|
+
headers: {
|
|
117
|
+
'g-recaptcha-response': "",
|
|
118
|
+
'Content-Type': "application/json",
|
|
119
|
+
'Accept': 'application/json',
|
|
120
|
+
},
|
|
121
|
+
body: JSON.stringify(userData)
|
|
122
|
+
};
|
|
123
|
+
fetch(`${profileUrl}/register`, sendRegistrationData)
|
|
124
|
+
.then((res:any) => {
|
|
125
|
+
if (res.status == 200) {
|
|
126
|
+
showConfirmation = true;
|
|
127
|
+
} else {
|
|
128
|
+
console.error('Error on registration');
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
onMount(() => {
|
|
135
|
+
window.addEventListener('message', messageHandler, false);
|
|
136
|
+
|
|
137
|
+
return () => {
|
|
138
|
+
window.removeEventListener('message', messageHandler);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
$: playerid && session;
|
|
5
143
|
</script>
|
|
6
144
|
|
|
7
145
|
{#if isLoading}
|
|
8
146
|
<div class="ModalLoader"></div>
|
|
9
147
|
{:else}
|
|
10
|
-
<
|
|
148
|
+
<div class="RegisterFormWrapper">
|
|
149
|
+
{#if !isMobile}
|
|
150
|
+
<div class="RegisterFormImage"></div>
|
|
151
|
+
{/if}
|
|
152
|
+
<div class="RegisterFormContainer {isMobile ? 'RegisterFormContainerMobile' : ''}">
|
|
153
|
+
{#if showRegisterStep1}
|
|
154
|
+
<div class="RegisterFormStep1">
|
|
155
|
+
<general-player-register-form-step1 />
|
|
156
|
+
</div>
|
|
157
|
+
{/if}
|
|
158
|
+
{#if showRegisterStep2}
|
|
159
|
+
<div class="RegisterFormStep2">
|
|
160
|
+
<general-player-register-form-step2 />
|
|
161
|
+
</div>
|
|
162
|
+
{/if}
|
|
163
|
+
{#if showRegisterStep3}
|
|
164
|
+
<div class="RegisterFormStep3">
|
|
165
|
+
<general-player-register-form-step3 />
|
|
166
|
+
</div>
|
|
167
|
+
{/if}
|
|
168
|
+
{#if showConfirmation}
|
|
169
|
+
<div class="RegisterConfirmation">
|
|
170
|
+
<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>
|
|
171
|
+
<h2 class="RegisterConfirmationTitle">Success!</h2>
|
|
172
|
+
<p class="RegisterConfirmationSubtitle">The process has been completed successfully.<br/>Please follow the instructions in the email we just sent you.</p>
|
|
173
|
+
<p class="RegisterConfirmationNote">In case you don't receive the email with the instructions on how to recover your password within the next 1-2 minutes, you can get in touch with us via phone, email or Live Chat.</p>
|
|
174
|
+
<p class="RegisterConfirmationNote">Some free email providers (hotmail or yahoo) might place the email in the Junk or Trash folder, so you might need to check there to retrieve it</p>
|
|
175
|
+
</div>
|
|
176
|
+
{/if}
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
11
179
|
{/if}
|
|
12
180
|
|
|
13
181
|
<style lang="scss">
|
|
14
|
-
*,
|
|
15
|
-
*::before,
|
|
16
|
-
*::after {
|
|
17
|
-
margin: 0;
|
|
18
|
-
padding: 0;
|
|
19
|
-
list-style: none;
|
|
20
|
-
text-decoration: none;
|
|
21
|
-
outline: none;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
font-family: "Helvetica Neue", "Helvetica", sans-serif;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.general-player-register-form {
|
|
27
|
-
background: #000;
|
|
28
|
-
color: #fff;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
182
|
//This function does a multiplication
|
|
32
183
|
// in order to work with px the
|
|
33
184
|
// same way as working with em
|
|
@@ -35,4 +186,62 @@
|
|
|
35
186
|
$multiplicator: 16px;
|
|
36
187
|
@return $value * $multiplicator;
|
|
37
188
|
}
|
|
189
|
+
|
|
190
|
+
.RegisterFormWrapper {
|
|
191
|
+
background: #F9F8F8;
|
|
192
|
+
display: inline-flex;
|
|
193
|
+
width: 100%;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.RegisterFormImage,
|
|
197
|
+
.RegisterFormContainer {
|
|
198
|
+
flex: 1 1 100%;
|
|
199
|
+
padding: ttp(3.125);
|
|
200
|
+
&.RegisterFormContainerMobile {
|
|
201
|
+
padding: ttp(0.625);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.RegisterStepNext {
|
|
206
|
+
color: #fff;
|
|
207
|
+
background: #D0046C;
|
|
208
|
+
border: 1px solid #D0046C;
|
|
209
|
+
border-radius: 5px;
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: ttp(3.75);
|
|
212
|
+
padding: 0;
|
|
213
|
+
text-transform: uppercase;
|
|
214
|
+
font-size: ttp(1.125);
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
margin-top: ttp(1.5);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.RegisterConfirmation {
|
|
220
|
+
display: flex;
|
|
221
|
+
flex-direction: column;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
text-align: center;
|
|
225
|
+
svg {
|
|
226
|
+
width: ttp(4.625);
|
|
227
|
+
}
|
|
228
|
+
.RegisterConfirmationTitle {
|
|
229
|
+
color: #16CE16;
|
|
230
|
+
font-size: ttp(1.5);
|
|
231
|
+
font-weight: 400;
|
|
232
|
+
text-transform: uppercase;
|
|
233
|
+
margin-bottom: 0;
|
|
234
|
+
}
|
|
235
|
+
.RegisterConfirmationSubtitle {
|
|
236
|
+
color: #58586B;
|
|
237
|
+
font-size: ttp(1);
|
|
238
|
+
line-height: ttp(1.2);
|
|
239
|
+
margin-bottom: ttp(1.5);
|
|
240
|
+
}
|
|
241
|
+
.RegisterConfirmationNote {
|
|
242
|
+
color: #000000;
|
|
243
|
+
font-size: ttp(1.1);
|
|
244
|
+
line-height: ttp(1.4);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
38
247
|
</style>
|