@everymatrix/general-registration 1.69.0 → 1.69.2
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/dist/cjs/checkbox-group-input_13.cjs.entry.js +44 -16
- package/dist/collection/components/general-registration/general-registration.js +44 -16
- package/dist/esm/checkbox-group-input_13.entry.js +44 -16
- package/dist/general-registration/checkbox-group-input_13.entry.js +1 -1
- package/dist/types/components/general-registration/general-registration.d.ts +2 -0
- package/package.json +1 -1
|
@@ -12681,6 +12681,8 @@ const GeneralRegistration = class {
|
|
|
12681
12681
|
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
12682
12682
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
12683
12683
|
this.setupConditionalValidationMap();
|
|
12684
|
+
}, (err) => {
|
|
12685
|
+
console.error(err);
|
|
12684
12686
|
});
|
|
12685
12687
|
}
|
|
12686
12688
|
/**
|
|
@@ -12882,6 +12884,15 @@ const GeneralRegistration = class {
|
|
|
12882
12884
|
break;
|
|
12883
12885
|
}
|
|
12884
12886
|
}
|
|
12887
|
+
triggerNotification(errMsg, errType = 'WidgetNotification') {
|
|
12888
|
+
window.postMessage({
|
|
12889
|
+
type: errType,
|
|
12890
|
+
data: {
|
|
12891
|
+
type: 'error',
|
|
12892
|
+
message: errMsg
|
|
12893
|
+
}
|
|
12894
|
+
}, window.location.href);
|
|
12895
|
+
}
|
|
12885
12896
|
getRegisterConfig(registrationID) {
|
|
12886
12897
|
const url = new URL('/v1/player/legislation/registration/config/', this.endpoint);
|
|
12887
12898
|
const headers = new Headers();
|
|
@@ -12897,14 +12908,26 @@ const GeneralRegistration = class {
|
|
|
12897
12908
|
return new Promise((resolve, reject) => {
|
|
12898
12909
|
this.isLoading = true;
|
|
12899
12910
|
fetch(url.href, options)
|
|
12900
|
-
.then((res) =>
|
|
12911
|
+
.then((res) => {
|
|
12912
|
+
if (!res.ok) {
|
|
12913
|
+
this.registerErrors = true;
|
|
12914
|
+
return res.json().then(error => {
|
|
12915
|
+
this.errorCode = error.thirdPartyResponse.errorCode;
|
|
12916
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
12917
|
+
this.triggerNotification(this.errorMessage);
|
|
12918
|
+
});
|
|
12919
|
+
}
|
|
12920
|
+
return res.json();
|
|
12921
|
+
})
|
|
12901
12922
|
.then((config) => {
|
|
12902
12923
|
this.isLoading = false;
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12924
|
+
if (!config) {
|
|
12925
|
+
return reject('Get register config is empty or has an error.');
|
|
12926
|
+
}
|
|
12927
|
+
return resolve(config);
|
|
12928
|
+
}, (err) => {
|
|
12929
|
+
console.error('Get register config is empty or has an error: ', err);
|
|
12930
|
+
return reject(err);
|
|
12908
12931
|
}).finally(() => {
|
|
12909
12932
|
this.isLoading = false;
|
|
12910
12933
|
});
|
|
@@ -12918,7 +12941,7 @@ const GeneralRegistration = class {
|
|
|
12918
12941
|
registerUserDto: this.listOfInputValues
|
|
12919
12942
|
.filter(input => !input.isDuplicate)
|
|
12920
12943
|
.reduce((acc, curr) => {
|
|
12921
|
-
// Because the API is very robust, some values need to be split as separate entities.
|
|
12944
|
+
// Because the API is very robust, some values need to be split as separate entities.
|
|
12922
12945
|
if (curr.name === 'TypeOfPublicArea') {
|
|
12923
12946
|
acc[curr.name] = curr.value.toLowerCase();
|
|
12924
12947
|
}
|
|
@@ -12929,7 +12952,7 @@ const GeneralRegistration = class {
|
|
|
12929
12952
|
acc[curr.name] = curr.value.phone;
|
|
12930
12953
|
}
|
|
12931
12954
|
else if (curr.type === 'checkboxgroup') {
|
|
12932
|
-
// Skip adding the parent of the checkboxgroup as a key.
|
|
12955
|
+
// Skip adding the parent of the checkboxgroup as a key.
|
|
12933
12956
|
if (curr.value !== null) {
|
|
12934
12957
|
Object.entries(curr.value).forEach(([key, value]) => {
|
|
12935
12958
|
acc[key] = value ? 'true' : 'false';
|
|
@@ -12972,6 +12995,7 @@ const GeneralRegistration = class {
|
|
|
12972
12995
|
else {
|
|
12973
12996
|
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
12974
12997
|
}
|
|
12998
|
+
this.triggerNotification(this.errorMessage);
|
|
12975
12999
|
});
|
|
12976
13000
|
}
|
|
12977
13001
|
// handles sending suctom events and the requested data for each registration step
|
|
@@ -13038,6 +13062,9 @@ const GeneralRegistration = class {
|
|
|
13038
13062
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
13039
13063
|
// Setup conditionalValidationMap
|
|
13040
13064
|
this.setupConditionalValidationMap();
|
|
13065
|
+
}, (err) => {
|
|
13066
|
+
// Only send the error to user because this.getRegisterConfig already has proper error logging
|
|
13067
|
+
this.triggerNotification(err);
|
|
13041
13068
|
});
|
|
13042
13069
|
}
|
|
13043
13070
|
}
|
|
@@ -13079,12 +13106,7 @@ const GeneralRegistration = class {
|
|
|
13079
13106
|
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
13080
13107
|
}
|
|
13081
13108
|
window.postMessage({ type: 'registrationFailed', errorMessage: error === null || error === void 0 ? void 0 : error.thirdPartyResponse.message }, window.location.href);
|
|
13082
|
-
|
|
13083
|
-
type: 'WidgetNotification', data: {
|
|
13084
|
-
type: 'error',
|
|
13085
|
-
message: this.errorMessage
|
|
13086
|
-
}
|
|
13087
|
-
}, window.location.href);
|
|
13109
|
+
this.triggerNotification(this.errorMessage);
|
|
13088
13110
|
dispatchCustomEvent('register_fail', { error: this.errorMessage });
|
|
13089
13111
|
});
|
|
13090
13112
|
}
|
|
@@ -13189,7 +13211,7 @@ const GeneralRegistration = class {
|
|
|
13189
13211
|
else {
|
|
13190
13212
|
this.isConsentReady = false;
|
|
13191
13213
|
}
|
|
13192
|
-
// The translations for fields happens here.
|
|
13214
|
+
// The translations for fields happens here.
|
|
13193
13215
|
if (this.translationUrl) {
|
|
13194
13216
|
getTranslations(this.translationUrl).then(() => {
|
|
13195
13217
|
this.listOfInputs.forEach(field => {
|
|
@@ -13272,6 +13294,9 @@ const GeneralRegistration = class {
|
|
|
13272
13294
|
getInvalidStatus(listOfInputs) {
|
|
13273
13295
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
13274
13296
|
}
|
|
13297
|
+
renderErrorMessage(errorMsg) {
|
|
13298
|
+
return (index.h("p", { class: "registration registration__error-message" }, errorMsg));
|
|
13299
|
+
}
|
|
13275
13300
|
renderForm() {
|
|
13276
13301
|
return this.forms.map((form, index$1) => {
|
|
13277
13302
|
return index.h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index$1 + 1}` ? 'hidden' : ''}`, ref: el => this.form = el, onClick: this.handleInitialClick }, form[this.registrationStep] && form[this.registrationStep].map((input) => {
|
|
@@ -13294,9 +13319,12 @@ const GeneralRegistration = class {
|
|
|
13294
13319
|
&& index.h("svg", { class: "spinner", viewBox: "0 0 50 50" }, index.h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })), !this.isLoadingPOST && index.h("div", { class: `registration__buttons-wrapper ${this.autofilled ? 'registration__buttons-wrapper--autofilled' : ''}` }, index.h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), index.h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language)))));
|
|
13295
13320
|
}
|
|
13296
13321
|
render() {
|
|
13297
|
-
if (this.isLoading) {
|
|
13322
|
+
if (this.isLoading && !this.registerErrors) {
|
|
13298
13323
|
return index.h("p", null, "Please wait, loading ...");
|
|
13299
13324
|
}
|
|
13325
|
+
else if (!this.isLoading && this.registerErrors) {
|
|
13326
|
+
return this.renderErrorMessage(this.errorMessage);
|
|
13327
|
+
}
|
|
13300
13328
|
return (index.h("div", { class: `registration registration__${this.registrationStep}` }, this.renderForm(), !this.buttonInsideForm && this.renderButtons()));
|
|
13301
13329
|
}
|
|
13302
13330
|
get host() { return index.getElement(this); }
|
|
@@ -120,6 +120,8 @@ export class GeneralRegistration {
|
|
|
120
120
|
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
121
121
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
122
122
|
this.setupConditionalValidationMap();
|
|
123
|
+
}, (err) => {
|
|
124
|
+
console.error(err);
|
|
123
125
|
});
|
|
124
126
|
}
|
|
125
127
|
/**
|
|
@@ -321,6 +323,15 @@ export class GeneralRegistration {
|
|
|
321
323
|
break;
|
|
322
324
|
}
|
|
323
325
|
}
|
|
326
|
+
triggerNotification(errMsg, errType = 'WidgetNotification') {
|
|
327
|
+
window.postMessage({
|
|
328
|
+
type: errType,
|
|
329
|
+
data: {
|
|
330
|
+
type: 'error',
|
|
331
|
+
message: errMsg
|
|
332
|
+
}
|
|
333
|
+
}, window.location.href);
|
|
334
|
+
}
|
|
324
335
|
getRegisterConfig(registrationID) {
|
|
325
336
|
const url = new URL('/v1/player/legislation/registration/config/', this.endpoint);
|
|
326
337
|
const headers = new Headers();
|
|
@@ -336,14 +347,26 @@ export class GeneralRegistration {
|
|
|
336
347
|
return new Promise((resolve, reject) => {
|
|
337
348
|
this.isLoading = true;
|
|
338
349
|
fetch(url.href, options)
|
|
339
|
-
.then((res) =>
|
|
350
|
+
.then((res) => {
|
|
351
|
+
if (!res.ok) {
|
|
352
|
+
this.registerErrors = true;
|
|
353
|
+
return res.json().then(error => {
|
|
354
|
+
this.errorCode = error.thirdPartyResponse.errorCode;
|
|
355
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
356
|
+
this.triggerNotification(this.errorMessage);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
return res.json();
|
|
360
|
+
})
|
|
340
361
|
.then((config) => {
|
|
341
362
|
this.isLoading = false;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
363
|
+
if (!config) {
|
|
364
|
+
return reject('Get register config is empty or has an error.');
|
|
365
|
+
}
|
|
366
|
+
return resolve(config);
|
|
367
|
+
}, (err) => {
|
|
368
|
+
console.error('Get register config is empty or has an error: ', err);
|
|
369
|
+
return reject(err);
|
|
347
370
|
}).finally(() => {
|
|
348
371
|
this.isLoading = false;
|
|
349
372
|
});
|
|
@@ -357,7 +380,7 @@ export class GeneralRegistration {
|
|
|
357
380
|
registerUserDto: this.listOfInputValues
|
|
358
381
|
.filter(input => !input.isDuplicate)
|
|
359
382
|
.reduce((acc, curr) => {
|
|
360
|
-
// Because the API is very robust, some values need to be split as separate entities.
|
|
383
|
+
// Because the API is very robust, some values need to be split as separate entities.
|
|
361
384
|
if (curr.name === 'TypeOfPublicArea') {
|
|
362
385
|
acc[curr.name] = curr.value.toLowerCase();
|
|
363
386
|
}
|
|
@@ -368,7 +391,7 @@ export class GeneralRegistration {
|
|
|
368
391
|
acc[curr.name] = curr.value.phone;
|
|
369
392
|
}
|
|
370
393
|
else if (curr.type === 'checkboxgroup') {
|
|
371
|
-
// Skip adding the parent of the checkboxgroup as a key.
|
|
394
|
+
// Skip adding the parent of the checkboxgroup as a key.
|
|
372
395
|
if (curr.value !== null) {
|
|
373
396
|
Object.entries(curr.value).forEach(([key, value]) => {
|
|
374
397
|
acc[key] = value ? 'true' : 'false';
|
|
@@ -411,6 +434,7 @@ export class GeneralRegistration {
|
|
|
411
434
|
else {
|
|
412
435
|
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
413
436
|
}
|
|
437
|
+
this.triggerNotification(this.errorMessage);
|
|
414
438
|
});
|
|
415
439
|
}
|
|
416
440
|
// handles sending suctom events and the requested data for each registration step
|
|
@@ -477,6 +501,9 @@ export class GeneralRegistration {
|
|
|
477
501
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
478
502
|
// Setup conditionalValidationMap
|
|
479
503
|
this.setupConditionalValidationMap();
|
|
504
|
+
}, (err) => {
|
|
505
|
+
// Only send the error to user because this.getRegisterConfig already has proper error logging
|
|
506
|
+
this.triggerNotification(err);
|
|
480
507
|
});
|
|
481
508
|
}
|
|
482
509
|
}
|
|
@@ -518,12 +545,7 @@ export class GeneralRegistration {
|
|
|
518
545
|
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
519
546
|
}
|
|
520
547
|
window.postMessage({ type: 'registrationFailed', errorMessage: error === null || error === void 0 ? void 0 : error.thirdPartyResponse.message }, window.location.href);
|
|
521
|
-
|
|
522
|
-
type: 'WidgetNotification', data: {
|
|
523
|
-
type: 'error',
|
|
524
|
-
message: this.errorMessage
|
|
525
|
-
}
|
|
526
|
-
}, window.location.href);
|
|
548
|
+
this.triggerNotification(this.errorMessage);
|
|
527
549
|
dispatchCustomEvent('register_fail', { error: this.errorMessage });
|
|
528
550
|
});
|
|
529
551
|
}
|
|
@@ -629,7 +651,7 @@ export class GeneralRegistration {
|
|
|
629
651
|
else {
|
|
630
652
|
this.isConsentReady = false;
|
|
631
653
|
}
|
|
632
|
-
// The translations for fields happens here.
|
|
654
|
+
// The translations for fields happens here.
|
|
633
655
|
if (this.translationUrl) {
|
|
634
656
|
getTranslations(this.translationUrl).then(() => {
|
|
635
657
|
this.listOfInputs.forEach(field => {
|
|
@@ -712,6 +734,9 @@ export class GeneralRegistration {
|
|
|
712
734
|
getInvalidStatus(listOfInputs) {
|
|
713
735
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
714
736
|
}
|
|
737
|
+
renderErrorMessage(errorMsg) {
|
|
738
|
+
return (h("p", { class: "registration registration__error-message" }, errorMsg));
|
|
739
|
+
}
|
|
715
740
|
renderForm() {
|
|
716
741
|
return this.forms.map((form, index) => {
|
|
717
742
|
return h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index + 1}` ? 'hidden' : ''}`, ref: el => this.form = el, onClick: this.handleInitialClick }, form[this.registrationStep] && form[this.registrationStep].map((input) => {
|
|
@@ -734,9 +759,12 @@ export class GeneralRegistration {
|
|
|
734
759
|
&& h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })), !this.isLoadingPOST && h("div", { class: `registration__buttons-wrapper ${this.autofilled ? 'registration__buttons-wrapper--autofilled' : ''}` }, h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language)))));
|
|
735
760
|
}
|
|
736
761
|
render() {
|
|
737
|
-
if (this.isLoading) {
|
|
762
|
+
if (this.isLoading && !this.registerErrors) {
|
|
738
763
|
return h("p", null, "Please wait, loading ...");
|
|
739
764
|
}
|
|
765
|
+
else if (!this.isLoading && this.registerErrors) {
|
|
766
|
+
return this.renderErrorMessage(this.errorMessage);
|
|
767
|
+
}
|
|
740
768
|
return (h("div", { class: `registration registration__${this.registrationStep}` }, this.renderForm(), !this.buttonInsideForm && this.renderButtons()));
|
|
741
769
|
}
|
|
742
770
|
static get is() { return "general-registration"; }
|
|
@@ -12677,6 +12677,8 @@ const GeneralRegistration = class {
|
|
|
12677
12677
|
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
12678
12678
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
12679
12679
|
this.setupConditionalValidationMap();
|
|
12680
|
+
}, (err) => {
|
|
12681
|
+
console.error(err);
|
|
12680
12682
|
});
|
|
12681
12683
|
}
|
|
12682
12684
|
/**
|
|
@@ -12878,6 +12880,15 @@ const GeneralRegistration = class {
|
|
|
12878
12880
|
break;
|
|
12879
12881
|
}
|
|
12880
12882
|
}
|
|
12883
|
+
triggerNotification(errMsg, errType = 'WidgetNotification') {
|
|
12884
|
+
window.postMessage({
|
|
12885
|
+
type: errType,
|
|
12886
|
+
data: {
|
|
12887
|
+
type: 'error',
|
|
12888
|
+
message: errMsg
|
|
12889
|
+
}
|
|
12890
|
+
}, window.location.href);
|
|
12891
|
+
}
|
|
12881
12892
|
getRegisterConfig(registrationID) {
|
|
12882
12893
|
const url = new URL('/v1/player/legislation/registration/config/', this.endpoint);
|
|
12883
12894
|
const headers = new Headers();
|
|
@@ -12893,14 +12904,26 @@ const GeneralRegistration = class {
|
|
|
12893
12904
|
return new Promise((resolve, reject) => {
|
|
12894
12905
|
this.isLoading = true;
|
|
12895
12906
|
fetch(url.href, options)
|
|
12896
|
-
.then((res) =>
|
|
12907
|
+
.then((res) => {
|
|
12908
|
+
if (!res.ok) {
|
|
12909
|
+
this.registerErrors = true;
|
|
12910
|
+
return res.json().then(error => {
|
|
12911
|
+
this.errorCode = error.thirdPartyResponse.errorCode;
|
|
12912
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
12913
|
+
this.triggerNotification(this.errorMessage);
|
|
12914
|
+
});
|
|
12915
|
+
}
|
|
12916
|
+
return res.json();
|
|
12917
|
+
})
|
|
12897
12918
|
.then((config) => {
|
|
12898
12919
|
this.isLoading = false;
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12920
|
+
if (!config) {
|
|
12921
|
+
return reject('Get register config is empty or has an error.');
|
|
12922
|
+
}
|
|
12923
|
+
return resolve(config);
|
|
12924
|
+
}, (err) => {
|
|
12925
|
+
console.error('Get register config is empty or has an error: ', err);
|
|
12926
|
+
return reject(err);
|
|
12904
12927
|
}).finally(() => {
|
|
12905
12928
|
this.isLoading = false;
|
|
12906
12929
|
});
|
|
@@ -12914,7 +12937,7 @@ const GeneralRegistration = class {
|
|
|
12914
12937
|
registerUserDto: this.listOfInputValues
|
|
12915
12938
|
.filter(input => !input.isDuplicate)
|
|
12916
12939
|
.reduce((acc, curr) => {
|
|
12917
|
-
// Because the API is very robust, some values need to be split as separate entities.
|
|
12940
|
+
// Because the API is very robust, some values need to be split as separate entities.
|
|
12918
12941
|
if (curr.name === 'TypeOfPublicArea') {
|
|
12919
12942
|
acc[curr.name] = curr.value.toLowerCase();
|
|
12920
12943
|
}
|
|
@@ -12925,7 +12948,7 @@ const GeneralRegistration = class {
|
|
|
12925
12948
|
acc[curr.name] = curr.value.phone;
|
|
12926
12949
|
}
|
|
12927
12950
|
else if (curr.type === 'checkboxgroup') {
|
|
12928
|
-
// Skip adding the parent of the checkboxgroup as a key.
|
|
12951
|
+
// Skip adding the parent of the checkboxgroup as a key.
|
|
12929
12952
|
if (curr.value !== null) {
|
|
12930
12953
|
Object.entries(curr.value).forEach(([key, value]) => {
|
|
12931
12954
|
acc[key] = value ? 'true' : 'false';
|
|
@@ -12968,6 +12991,7 @@ const GeneralRegistration = class {
|
|
|
12968
12991
|
else {
|
|
12969
12992
|
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
12970
12993
|
}
|
|
12994
|
+
this.triggerNotification(this.errorMessage);
|
|
12971
12995
|
});
|
|
12972
12996
|
}
|
|
12973
12997
|
// handles sending suctom events and the requested data for each registration step
|
|
@@ -13034,6 +13058,9 @@ const GeneralRegistration = class {
|
|
|
13034
13058
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
13035
13059
|
// Setup conditionalValidationMap
|
|
13036
13060
|
this.setupConditionalValidationMap();
|
|
13061
|
+
}, (err) => {
|
|
13062
|
+
// Only send the error to user because this.getRegisterConfig already has proper error logging
|
|
13063
|
+
this.triggerNotification(err);
|
|
13037
13064
|
});
|
|
13038
13065
|
}
|
|
13039
13066
|
}
|
|
@@ -13075,12 +13102,7 @@ const GeneralRegistration = class {
|
|
|
13075
13102
|
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
13076
13103
|
}
|
|
13077
13104
|
window.postMessage({ type: 'registrationFailed', errorMessage: error === null || error === void 0 ? void 0 : error.thirdPartyResponse.message }, window.location.href);
|
|
13078
|
-
|
|
13079
|
-
type: 'WidgetNotification', data: {
|
|
13080
|
-
type: 'error',
|
|
13081
|
-
message: this.errorMessage
|
|
13082
|
-
}
|
|
13083
|
-
}, window.location.href);
|
|
13105
|
+
this.triggerNotification(this.errorMessage);
|
|
13084
13106
|
dispatchCustomEvent('register_fail', { error: this.errorMessage });
|
|
13085
13107
|
});
|
|
13086
13108
|
}
|
|
@@ -13185,7 +13207,7 @@ const GeneralRegistration = class {
|
|
|
13185
13207
|
else {
|
|
13186
13208
|
this.isConsentReady = false;
|
|
13187
13209
|
}
|
|
13188
|
-
// The translations for fields happens here.
|
|
13210
|
+
// The translations for fields happens here.
|
|
13189
13211
|
if (this.translationUrl) {
|
|
13190
13212
|
getTranslations(this.translationUrl).then(() => {
|
|
13191
13213
|
this.listOfInputs.forEach(field => {
|
|
@@ -13268,6 +13290,9 @@ const GeneralRegistration = class {
|
|
|
13268
13290
|
getInvalidStatus(listOfInputs) {
|
|
13269
13291
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
13270
13292
|
}
|
|
13293
|
+
renderErrorMessage(errorMsg) {
|
|
13294
|
+
return (h$1("p", { class: "registration registration__error-message" }, errorMsg));
|
|
13295
|
+
}
|
|
13271
13296
|
renderForm() {
|
|
13272
13297
|
return this.forms.map((form, index) => {
|
|
13273
13298
|
return h$1("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index + 1}` ? 'hidden' : ''}`, ref: el => this.form = el, onClick: this.handleInitialClick }, form[this.registrationStep] && form[this.registrationStep].map((input) => {
|
|
@@ -13290,9 +13315,12 @@ const GeneralRegistration = class {
|
|
|
13290
13315
|
&& h$1("svg", { class: "spinner", viewBox: "0 0 50 50" }, h$1("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })), !this.isLoadingPOST && h$1("div", { class: `registration__buttons-wrapper ${this.autofilled ? 'registration__buttons-wrapper--autofilled' : ''}` }, h$1("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), h$1("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language)))));
|
|
13291
13316
|
}
|
|
13292
13317
|
render() {
|
|
13293
|
-
if (this.isLoading) {
|
|
13318
|
+
if (this.isLoading && !this.registerErrors) {
|
|
13294
13319
|
return h$1("p", null, "Please wait, loading ...");
|
|
13295
13320
|
}
|
|
13321
|
+
else if (!this.isLoading && this.registerErrors) {
|
|
13322
|
+
return this.renderErrorMessage(this.errorMessage);
|
|
13323
|
+
}
|
|
13296
13324
|
return (h$1("div", { class: `registration registration__${this.registrationStep}` }, this.renderForm(), !this.buttonInsideForm && this.renderButtons()));
|
|
13297
13325
|
}
|
|
13298
13326
|
get host() { return getElement(this); }
|