@everymatrix/general-registration 1.10.1 → 1.10.3

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.
Files changed (34) hide show
  1. package/dist/cjs/checkbox-input_11.cjs.entry.js +28186 -770
  2. package/dist/cjs/general-registration.cjs.js +2 -2
  3. package/dist/cjs/{index-c04f4a2a.js → index-9a07d1e9.js} +5 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/components/general-registration/general-registration.js +299 -224
  6. package/dist/components/checkbox-input2.js +10 -5
  7. package/dist/components/date-input2.js +6493 -19
  8. package/dist/components/email-input2.js +7 -20
  9. package/dist/components/general-input2.js +11 -9
  10. package/dist/components/general-registration.js +299 -223
  11. package/dist/components/locale.utils.js +2 -1
  12. package/dist/components/number-input2.js +7 -20
  13. package/dist/components/password-input2.js +9 -1
  14. package/dist/components/radio-input2.js +3 -12
  15. package/dist/components/select-input2.js +16 -19
  16. package/dist/components/tel-input2.js +35 -21
  17. package/dist/components/text-input2.js +5 -4
  18. package/dist/components/vaadin-combo-box.js +4423 -0
  19. package/dist/components/virtual-keyboard-controller.js +16466 -0
  20. package/dist/esm/checkbox-input_11.entry.js +28193 -777
  21. package/dist/esm/general-registration.js +2 -2
  22. package/dist/esm/{index-79f297c1.js → index-0505440f.js} +5 -1
  23. package/dist/esm/loader.js +2 -2
  24. package/dist/general-registration/general-registration.esm.js +1 -1
  25. package/dist/general-registration/p-1a88a312.js +1 -0
  26. package/dist/general-registration/p-7c69629f.entry.js +3164 -0
  27. package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work/stencil}/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +8 -0
  28. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-registration/stencil.config.d.ts +2 -0
  29. package/dist/types/components/general-registration/general-registration.d.ts +267 -11
  30. package/package.json +6 -4
  31. package/dist/general-registration/p-0e7175cd.js +0 -1
  32. package/dist/general-registration/p-cadaffbe.entry.js +0 -1
  33. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/general-registration/.stencil/packages/general-registration/stencil.config.d.ts +0 -2
  34. /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work/stencil}/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/locale.utils.d.ts +0 -0
@@ -19,7 +19,8 @@ const TRANSLATIONS = {
19
19
  lengthError: `The length should be between {minLength} and {maxLength}`,
20
20
  requiredError: 'This input is required.',
21
21
  nextButton: 'Next',
22
- backButton: 'Back'
22
+ backButton: 'Back',
23
+ doneButton: 'Done'
23
24
  },
24
25
  ro: {
25
26
  lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
@@ -62,196 +63,192 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
62
63
  "autofill": false
63
64
  },
64
65
  {
65
- "name": "firstName",
66
- "displayName": "Username",
66
+ "name": "lastName",
67
+ "displayName": "Last name",
67
68
  "defaultValue": null,
68
69
  "validate": {
69
70
  "mandatory": true,
70
71
  "minLength": 3,
71
72
  "maxLength": 20
72
73
  },
73
- "autofill": false
74
74
  },
75
- // {
76
- // "name": "tel",
77
- // "displayName": "Telephone",
78
- // "defaultValue": null,
79
- // "validate": {
80
- // "mandatory": true
81
- // },
82
- // "autofill": false,
83
- // "inputType": "tel"
84
- // },
85
- // {
86
- // "name": "dateOfBirth",
87
- // "displayName": "Date of Birth",
88
- // "defaultValue": null,
89
- // "validate": {
90
- // "min": "2023-04-01",
91
- // "max": "2023-04-29",
92
- // "mandatory": true,
93
- // },
94
- // "inputType": "datetime"
95
- // },
96
- // {
97
- // "name": "email",
98
- // "displayName": "Email",
99
- // "defaultValue": 'a@a.com',
100
- // "validate": {
101
- // "mandatory": true,
102
- // "custom": [
103
- // {
104
- // "rule": "regex",
105
- // "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
106
- // "errorMessage": "Please enter a valid email address"
107
- // }
108
- // ]
109
- // },
110
- // "inputType": "email"
111
- // },
112
- // {
113
- // "name": "lastName",
114
- // "displayName": "Last name",
115
- // "defaultValue": null,
116
- // "validate": {
117
- // "mandatory": true,
118
- // "minLength": 3,
119
- // "maxLength": 20
120
- // },
121
- // },
122
- // {
123
- // "name": "password",
124
- // "displayName": "Password",
125
- // "defaultValue": null,
126
- // "validate": {
127
- // "mandatory": true,
128
- // "minLength": 3,
129
- // "maxLength": 20,
130
- // "type": "password",
131
- // "custom": [
132
- // {
133
- // "rule": "regex",
134
- // "pattern": "(?=.*\\d+)(?=.*[A-Za-z]+).{8,20}",
135
- // "errorMessage": "Password must contain at least 1 letter and 1 digit, and its minimal length is 8."
136
- // }
137
- // ]
138
- // },
139
- // "inputType": "password"
140
- // },
141
- // {
142
- // "name": "email",
143
- // "defaultValue": null,
144
- // "validate": {
145
- // "mandatory": true,
146
- // "type": "email",
147
- // "custom": [
148
- // {
149
- // "rule": "unique-email",
150
- // "errorMessage": "Please check your email"
151
- // },
152
- // {
153
- // "rule": "regex",
154
- // "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
155
- // "errorMessage": "Please enter a valid email address"
156
- // }
157
- // ]
158
- // }
159
- // },
160
- // {
161
- // "name": "termsAndConditions",
162
- // "displayName": "Terms and Conditions",
163
- // "validate": {
164
- // "mandatory": true,
165
- // "type": "boolean"
166
- // },
167
- // "inputType": "checkbox"
168
- // },
169
- // {
170
- // "name": "pepCheck",
171
- // "validate": {
172
- // "mandatory": true
173
- // },
174
- // "inputType": "checkbox"
175
- // },
176
- // {
177
- // "name": "gender",
178
- // "data": {
179
- // "values": [
180
- // {
181
- // "label": "🍆",
182
- // "value": "m"
183
- // },
184
- // {
185
- // "label": "🍑",
186
- // "value": "f"
187
- // }
188
- // ]
189
- // },
190
- // "validate": {
191
- // "mandatory": true
192
- // },
193
- // "inputType": "radio"
194
- // },
195
- // {
196
- // "name": "dateOfBirth",
197
- // "validate": {
198
- // "mandatory": true,
199
- // "custom": [
200
- // {
201
- // "rule": "regex",
202
- // "pattern": "(?:19\\d{2}|20[01][0-9]|2020)[-/.](?:0[1-9]|1[012])[-/.](?:0[1-9]|[12][0-9]|3[01])",
203
- // "errorMessage": "Invalid date format"
204
- // },
205
- // {
206
- // "rule": "min-18-years",
207
- // "errorMessage": "Not old enough to ride the roller coaster"
208
- // }
209
- // ]
210
- // }
211
- // },
212
- // {
213
- // "name": "city",
214
- // "displayName": "Cities",
215
- // "action": null,
216
- // "data": {
217
- // "values": [
218
- // {
219
- // "label": "Budapest",
220
- // "value": "Budapest"
221
- // },
222
- // {
223
- // "label": "Debrecen",
224
- // "value": "Debrecen"
225
- // },
226
- // {
227
- // "label": "Miskolc",
228
- // "value": "Miskolc"
229
- // },
230
- // {
231
- // "label": "Szeged",
232
- // "value": "Szeged"
233
- // },
234
- // {
235
- // "label": "Zuglo",
236
- // "value": "Zuglo"
237
- // }
238
- // ]
239
- // },
240
- // "validate": {
241
- // "mandatory": true
242
- // },
243
- // "inputType" : "dropdown"
244
- // },
245
- // {
246
- // "name": "city",
247
- // "displayName": "Cities",
248
- // "data": null,
249
- // "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/countries",
250
- // "validate": {
251
- // "mandatory": true
252
- // },
253
- // "inputType" : "dropdown"
254
- // }
75
+ {
76
+ "name": "telephone",
77
+ "displayName": "Telephone",
78
+ "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes",
79
+ "defaultValue": null,
80
+ "validate": {
81
+ "mandatory": true
82
+ },
83
+ "autofill": false,
84
+ "inputType": "tel"
85
+ },
86
+ {
87
+ "name": "dateOfBirth",
88
+ "displayName": "Date of Birth",
89
+ "defaultValue": null,
90
+ "validate": {
91
+ "min": "2022-05-01",
92
+ "max": "2022-05-29",
93
+ "mandatory": true,
94
+ },
95
+ "inputType": "datetime"
96
+ },
97
+ {
98
+ "name": "email",
99
+ "displayName": "Email",
100
+ "defaultValue": 'a@a.com',
101
+ "validate": {
102
+ "mandatory": true,
103
+ "custom": [
104
+ {
105
+ "rule": "regex",
106
+ "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
107
+ "errorMessage": "Please enter a valid email address"
108
+ }
109
+ ]
110
+ },
111
+ "inputType": "email"
112
+ },
113
+ {
114
+ "name": "password",
115
+ "displayName": "Password",
116
+ "defaultValue": null,
117
+ "validate": {
118
+ "mandatory": true,
119
+ "minLength": 3,
120
+ "maxLength": 20,
121
+ "type": "password",
122
+ "custom": [
123
+ {
124
+ "rule": "regex",
125
+ "pattern": "(?=.*\\d+)(?=.*[A-Za-z]+).{8,20}",
126
+ "errorMessage": "Password must contain at least 1 letter and 1 digit, and its minimal length is 8."
127
+ }
128
+ ]
129
+ },
130
+ "inputType": "password"
131
+ },
132
+ {
133
+ "name": "email",
134
+ "displayName": "Email",
135
+ "defaultValue": null,
136
+ "validate": {
137
+ "mandatory": true,
138
+ "type": "email",
139
+ "custom": [
140
+ {
141
+ "rule": "unique-email",
142
+ "errorMessage": "Please check your email"
143
+ },
144
+ {
145
+ "rule": "regex",
146
+ "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
147
+ "errorMessage": "Please enter a valid email address"
148
+ },
149
+ {
150
+ "rule": "duplicate-input",
151
+ "displayName": "pt al doilea input gen: Confirm Email",
152
+ "errorMessage": "Different Email! Pls."
153
+ }
154
+ ]
155
+ }
156
+ },
157
+ {
158
+ "name": "termsAndConditions",
159
+ "displayName": "Terms and Conditions",
160
+ "validate": {
161
+ "mandatory": true,
162
+ "type": "boolean"
163
+ },
164
+ "inputType": "checkbox"
165
+ },
166
+ {
167
+ "name": "pepCheck",
168
+ "validate": {
169
+ "mandatory": true
170
+ },
171
+ "inputType": "checkbox"
172
+ },
173
+ {
174
+ "name": "gender",
175
+ "data": {
176
+ "values": [
177
+ {
178
+ "label": "🍆",
179
+ "value": "m"
180
+ },
181
+ {
182
+ "label": "🍑",
183
+ "value": "f"
184
+ }
185
+ ]
186
+ },
187
+ "validate": {
188
+ "mandatory": true
189
+ },
190
+ "inputType": "radio"
191
+ },
192
+ {
193
+ "name": "dateOfBirth",
194
+ "validate": {
195
+ "mandatory": true,
196
+ "custom": [
197
+ {
198
+ "rule": "regex",
199
+ "pattern": "(?:19\\d{2}|20[01][0-9]|2020)[-/.](?:0[1-9]|1[012])[-/.](?:0[1-9]|[12][0-9]|3[01])",
200
+ "errorMessage": "Invalid date format"
201
+ },
202
+ {
203
+ "rule": "min-18-years",
204
+ "errorMessage": "Not old enough to ride the roller coaster"
205
+ }
206
+ ]
207
+ }
208
+ },
209
+ {
210
+ "name": "city",
211
+ "displayName": "Cities",
212
+ "action": null,
213
+ "data": {
214
+ "values": [
215
+ {
216
+ "label": "Budapest",
217
+ "value": "Budapest"
218
+ },
219
+ {
220
+ "label": "Debrecen",
221
+ "value": "Debrecen"
222
+ },
223
+ {
224
+ "label": "Miskolc",
225
+ "value": "Miskolc"
226
+ },
227
+ {
228
+ "label": "Szeged",
229
+ "value": "Szeged"
230
+ },
231
+ {
232
+ "label": "Zuglo",
233
+ "value": "Zuglo"
234
+ }
235
+ ]
236
+ },
237
+ "validate": {
238
+ "mandatory": true
239
+ },
240
+ "inputType": "dropdown"
241
+ },
242
+ {
243
+ "name": "city",
244
+ "displayName": "Cities",
245
+ "data": null,
246
+ "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/countries",
247
+ "validate": {
248
+ "mandatory": true
249
+ },
250
+ "inputType": "dropdown"
251
+ }
255
252
  ],
256
253
  "actions": [
257
254
  "get-next-step",
@@ -266,57 +263,102 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
266
263
  this.language = 'en';
267
264
  this.emitValue = false;
268
265
  this.listOfInputs = [];
269
- this.isLoading = false;
266
+ this.isLoading = true;
270
267
  this.listOfInputValues = [];
271
268
  this.listOfActions = [];
272
- this.actionsStepIndex = 0;
269
+ this.steps = [];
270
+ this.registrationStepsState = {
271
+ regId: null
272
+ };
273
273
  }
274
- validityStateHandler() {
275
- console.log('bababa', this.isFormValid);
276
- this.buttonReference.disabled = this.isFormValid ? false : true;
274
+ logger() {
275
+ console.log(this.registrationStep);
277
276
  }
278
277
  checkInputsValidityHandler(event) {
279
- console.log('se ajunge aici');
280
278
  // Set isValid state of the input in the list.
281
279
  this.listOfInputs.find(input => input.name == event.detail.name).isValid = event.detail.valid;
282
280
  // Check if any one is invalid.
283
281
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
284
282
  }
285
283
  getInputsValueHandler(event) {
286
- console.log('sendInputValue');
287
- this.listOfInputValues.find(input => input.name == event.detail.name).inputValue = event.detail.value;
284
+ this.listOfInputValues.find(input => input.name == event.detail.name).value = event.detail.value;
288
285
  /*Note to self: -- what about the inputs that received a default value.
289
286
  They will send an undefined because there was no input
290
287
  Handle it somehow!!!!!, one idea can be that value equals defaultValue but dependes on how the api wants stuff*/
291
- }
292
- connectedCallback() {
288
+ this.stepsStateMachine({ event: 'set', type: 'values' });
293
289
  }
294
290
  componentWillLoad() {
295
291
  // const mockCall = Promise.resolve(this.data);
296
292
  // return mockCall.then((data) => {
297
293
  // this.listOfInputs = data.content.fields.map((field) => {
294
+ // this.isLoading = false;
298
295
  // return { ...field, isValid: false };
299
296
  // });
300
297
  // });
301
- // Initial Fetch
302
298
  return this.getRegisterConfig().then((config) => {
303
299
  this.formatConfig(config);
300
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
304
301
  });
305
302
  }
306
303
  nextHandler(e) {
307
304
  e.preventDefault();
308
305
  // Trigger events in subwidgets.
309
306
  this.emitValue = true;
310
- if (this.isFormValid) {
311
- this.setRegisterStep();
307
+ this.setRegisterStep();
308
+ }
309
+ backHandler(e) {
310
+ e.preventDefault();
311
+ this.steps.pop();
312
+ this.registrationStep = this.steps.at(-1);
313
+ this.stepsStateMachine({ event: 'get', type: 'inputs' });
314
+ this.stepsStateMachine({ event: 'get', type: 'values' });
315
+ }
316
+ stepsStateMachine(state) {
317
+ switch (state.event) {
318
+ case 'set':
319
+ if (state.type == 'inputs') {
320
+ this.registrationStepsState[this.registrationStep].fields = this.listOfInputs;
321
+ }
322
+ if (state.type == 'values') {
323
+ this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
324
+ // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
325
+ if (curr.value != null) {
326
+ acc[curr.name] = curr.value;
327
+ }
328
+ return acc;
329
+ }, {});
330
+ }
331
+ localStorage.setItem('registrationStepsState', JSON.stringify(this.registrationStepsState));
332
+ break;
333
+ case 'get':
334
+ const savedUserData = JSON.parse(localStorage.getItem('registrationStepsState'));
335
+ if (!savedUserData)
336
+ return;
337
+ if (state.type == 'inputs') {
338
+ this.listOfInputs = this.registrationStepsState[this.registrationStep].fields;
339
+ }
340
+ if (state.type == 'values') {
341
+ const savedValues = savedUserData[this.registrationStep].registerUserData;
342
+ this.listOfInputValues = Object.keys(savedValues).map(name => {
343
+ return { name, value: savedValues[name] };
344
+ });
345
+ // Give to each field the user input as the default value.
346
+ this.listOfInputValues.forEach(inputValue => {
347
+ const input = this.listOfInputs.find(input => input.name === inputValue.name);
348
+ if (input) {
349
+ input.defaultValue = inputValue.value;
350
+ }
351
+ });
352
+ }
353
+ break;
312
354
  }
313
355
  }
314
356
  getRegisterConfig(registrationID) {
315
- const url = new URL(`${this.endpoint}/api/v1.0/registerCfg/`);
357
+ const url = new URL(`${this.endpoint}/v1/player/legislation/registration/config`);
316
358
  const headers = new Headers();
317
- headers.append('X-Tenant-ID', this.tenantId);
318
- headers.append('X-Client-ID', this.clientId);
319
- headers.append('X-Api-Key', this.apiKey);
359
+ // headers.append('X-Tenant-ID', this.tenantId);
360
+ // headers.append('X-Client-ID', this.clientId);
361
+ // headers.append('X-Api-Key', this.apiKey);
320
362
  headers.append('Content-Type', 'application/json');
321
363
  headers.append('Accept', 'application/json');
322
364
  if (registrationID) {
@@ -341,20 +383,24 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
341
383
  });
342
384
  }
343
385
  setRegisterStep() {
344
- this.emitValue = false;
345
- const url = new URL(`${this.endpoint}/api/v1.0/registerStep/`);
386
+ this.isLoading = true;
387
+ const url = new URL(`${this.endpoint}/v1/player/legislation/registration/step`);
346
388
  const registerStep = {
347
389
  registrationId: this.registrationID,
348
390
  registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
349
- acc[curr.name] = curr.inputValue;
391
+ // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
392
+ if (curr.value != null) {
393
+ acc[curr.name] = curr.value;
394
+ }
350
395
  return acc;
351
396
  }, {}),
352
397
  step: this.registrationStep,
353
398
  };
399
+ console.log(registerStep);
354
400
  const headers = new Headers();
355
- headers.append('X-Tenant-ID', this.tenantId);
356
- headers.append('X-Client-ID', this.clientId);
357
- headers.append('X-Api-Key', this.apiKey);
401
+ // headers.append('X-Tenant-ID', this.tenantId);
402
+ // headers.append('X-Client-ID', this.clientId);
403
+ // headers.append('X-Api-Key', this.apiKey);
358
404
  headers.append('Content-Type', 'application/json');
359
405
  headers.append('Accept', 'application/json');
360
406
  const options = {
@@ -362,11 +408,13 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
362
408
  body: JSON.stringify(registerStep),
363
409
  headers
364
410
  };
411
+ console.log(options.body);
365
412
  fetch(url.href, options)
366
413
  .then((res) => {
367
414
  if (res.status >= 300) {
368
415
  throw new Error('err');
369
416
  }
417
+ return res.json();
370
418
  })
371
419
  .then((data) => {
372
420
  this.registrationID = data.registrationId;
@@ -374,25 +422,34 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
374
422
  this.setRegister();
375
423
  }
376
424
  else {
377
- this.getRegisterConfig(this.registrationID).then((config) => this.formatConfig(config));
425
+ this.getRegisterConfig(this.registrationID).then((config) => {
426
+ // Format the new step config.
427
+ this.formatConfig(config);
428
+ // Set it in local storage
429
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
430
+ });
378
431
  }
379
432
  })
380
433
  .catch((err) => {
381
434
  console.error(err);
435
+ })
436
+ .finally(() => {
437
+ this.isLoading = false;
382
438
  });
383
439
  }
384
440
  setRegister() {
385
- const url = new URL(`${this.endpoint}/api/v1.0/register/`);
441
+ this.isLoading = true;
442
+ const url = new URL(`${this.endpoint}/v1/player/legislation/register`);
386
443
  const headers = new Headers();
387
- headers.append('X-Tenant-ID', this.tenantId);
388
- headers.append('X-Client-ID', this.clientId);
389
- headers.append('X-Api-Key', this.apiKey);
444
+ // headers.append('X-Tenant-ID', this.tenantId);
445
+ // headers.append('X-Client-ID', this.clientId);
446
+ // headers.append('X-Api-Key', this.apiKey);
390
447
  headers.append('Content-Type', 'application/json');
391
448
  headers.append('Accept', 'application/json');
392
449
  const registerStep = {
393
450
  registrationId: this.registrationID,
394
451
  registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
395
- acc[curr.name] = curr.inputValue;
452
+ acc[curr.name] = curr.value;
396
453
  return acc;
397
454
  }, {}),
398
455
  step: this.registrationStep,
@@ -407,12 +464,18 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
407
464
  if (res.status >= 300) {
408
465
  throw new Error('err');
409
466
  }
467
+ return res.json();
410
468
  })
411
469
  .then((data) => {
412
- console.log(data);
470
+ if (data.userId) {
471
+ alert(`User registered - the user ID is ${data.userId}`);
472
+ }
413
473
  })
414
474
  .catch((err) => {
415
- console.log(err);
475
+ console.error(err);
476
+ })
477
+ .finally(() => {
478
+ this.isLoading = false;
416
479
  });
417
480
  }
418
481
  formatConfig(config) {
@@ -422,31 +485,42 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
422
485
  });
423
486
  // Populate the list of inputs values and set as null in the beginning
424
487
  this.listOfInputValues = config.content.fields.map(field => {
425
- return { name: field.name, inputValue: null };
488
+ return { name: field.name, value: null };
426
489
  });
427
490
  // Set the list of actions
428
491
  this.listOfActions = config.content.actions.map(action => action);
492
+ this.isLastStep = this.listOfActions.some(action => action == '/register');
429
493
  this.registrationID = config.content.registrationID;
430
494
  this.registrationStep = config.content.step;
495
+ this.steps.push(this.registrationStep);
496
+ // Add the step to the registrationStepsData
497
+ this.registrationStepsState.regId = this.registrationID;
498
+ if (!this.registrationStepsState[this.registrationStep]) {
499
+ this.registrationStepsState[this.registrationStep] = {
500
+ fields: [],
501
+ registerUserData: {}
502
+ };
503
+ }
431
504
  }
432
505
  getInvalidStatus(listOfInputs) {
433
506
  return listOfInputs.filter(input => input.isValid == false).length > 0;
434
507
  }
435
508
  renderInputs() {
436
- /*let aux = this.listOfInputs;
437
- this.listOfInputs = [];
438
- this.listOfInputs = aux;*/
439
- return (this.listOfInputs.map(input => h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.data.values : [], defaultValue: input.defaultValue, emitValue: this.emitValue, language: this.language })));
509
+ console.log(this.listOfInputs);
510
+ return (this.listOfInputs.map(input => h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.data.values : [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language })));
440
511
  }
441
512
  ;
442
513
  renderButtons() {
443
- return (h("div", { class: 'registration__buttons-wrapper' }, h("button", { class: 'registration__button', type: 'submit', form: 'RegistrationForm', onClick: (e) => this.nextHandler(e), ref: (el) => this.buttonReference = el }, translate('nextButton', this.language)), h("button", { class: 'registration__button' }, translate('backButton', this.language))));
514
+ return (h("div", { class: 'registration__buttons-wrapper' }, h("button", { class: `registration__button ${this.isLastStep ? 'registration__button--done' : ''}`, type: 'submit', form: 'RegistrationForm', onClick: (e) => this.nextHandler(e) }, this.isLastStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), this.registrationStep !== 'Step1' && h("button", { class: 'registration__button', onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
444
515
  }
445
516
  render() {
517
+ if (this.isLoading) {
518
+ return h("p", null, "Please wait, loading ...");
519
+ }
446
520
  return (h("div", { class: 'registration' }, h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), this.renderButtons()));
447
521
  }
448
522
  static get watchers() { return {
449
- "isFormValid": ["validityStateHandler"]
523
+ "registrationStep": ["logger"]
450
524
  }; }
451
525
  static get style() { return generalRegistrationCss; }
452
526
  }, [1, "general-registration", {
@@ -458,7 +532,9 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
458
532
  "errorMessage": [32],
459
533
  "emitValue": [32],
460
534
  "isFormValid": [32],
461
- "listOfInputs": [32]
535
+ "listOfInputs": [32],
536
+ "isLoading": [32],
537
+ "registrationStep": [32]
462
538
  }, [[0, "sendValidityState", "checkInputsValidityHandler"], [0, "sendInputValue", "getInputsValueHandler"]]]);
463
539
  function defineCustomElement$1() {
464
540
  if (typeof customElements === "undefined") {