@everymatrix/general-registration 1.10.3 → 1.10.5
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-input_11.cjs.entry.js +83 -53
- package/dist/cjs/general-registration.cjs.js +2 -2
- package/dist/cjs/{index-9a07d1e9.js → index-ad0df8ea.js} +0 -4
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/general-registration/general-registration.js +16 -33
- package/dist/components/checkbox-input2.js +6 -0
- package/dist/components/date-input2.js +4 -0
- package/dist/components/email-input2.js +10 -3
- package/dist/components/general-registration.js +17 -34
- package/dist/components/locale.utils.js +1 -1
- package/dist/components/number-input2.js +7 -1
- package/dist/components/password-input2.js +10 -3
- package/dist/components/select-input2.js +4 -0
- package/dist/components/tel-input2.js +15 -7
- package/dist/components/text-input2.js +10 -5
- package/dist/esm/checkbox-input_11.entry.js +83 -53
- package/dist/esm/general-registration.js +2 -2
- package/dist/esm/{index-0505440f.js → index-bb9c8eb3.js} +0 -4
- package/dist/esm/loader.js +2 -2
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/{p-1a88a312.js → p-4800d8b4.js} +1 -1
- package/dist/general-registration/{p-7c69629f.entry.js → p-8a77bab6.entry.js} +30 -30
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-ad0df8ea.js');
|
|
6
6
|
|
|
7
7
|
const DEFAULT_LANGUAGE$1 = 'en';
|
|
8
8
|
const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
|
|
9
9
|
const TRANSLATIONS$1 = {
|
|
10
10
|
en: {
|
|
11
11
|
dateError: 'The selected date should be between {min} and {max}',
|
|
12
|
-
numberLengthError: 'The number should be between
|
|
12
|
+
numberLengthError: 'The number should be between {min} and {max}',
|
|
13
13
|
lengthError: `The length should be between {minLength} and {maxLength}`,
|
|
14
14
|
requiredError: 'This input is required.',
|
|
15
15
|
nextButton: 'Next',
|
|
@@ -62,6 +62,12 @@ const CheckboxInput = class {
|
|
|
62
62
|
valueHandler(inputValueEvent) {
|
|
63
63
|
this.sendInputValue.emit(inputValueEvent);
|
|
64
64
|
}
|
|
65
|
+
componentDidLoad() {
|
|
66
|
+
if (this.defaultValue) {
|
|
67
|
+
this.value = this.defaultValue;
|
|
68
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
65
71
|
handleClick() {
|
|
66
72
|
this.value = this.inputReference.checked.toString();
|
|
67
73
|
this.errorMessage = this.setErrorMessage();
|
|
@@ -23056,6 +23062,10 @@ const DateInput = class {
|
|
|
23056
23062
|
}
|
|
23057
23063
|
componentDidLoad() {
|
|
23058
23064
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
23065
|
+
if (this.defaultValue) {
|
|
23066
|
+
this.value = this.defaultValue;
|
|
23067
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
23068
|
+
}
|
|
23059
23069
|
}
|
|
23060
23070
|
handleInput(event) {
|
|
23061
23071
|
this.value = event.target.value;
|
|
@@ -23115,6 +23125,12 @@ const EmailInput = class {
|
|
|
23115
23125
|
connectedCallback() {
|
|
23116
23126
|
this.validationPattern = this.setPattern();
|
|
23117
23127
|
}
|
|
23128
|
+
componentDidLoad() {
|
|
23129
|
+
if (this.defaultValue) {
|
|
23130
|
+
this.value = this.defaultValue;
|
|
23131
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
23132
|
+
}
|
|
23133
|
+
}
|
|
23118
23134
|
handleInput(event) {
|
|
23119
23135
|
this.value = event.target.value;
|
|
23120
23136
|
this.errorMessage = this.setErrorMessage();
|
|
@@ -23126,14 +23142,15 @@ const EmailInput = class {
|
|
|
23126
23142
|
return this.inputReference.validity.valid;
|
|
23127
23143
|
}
|
|
23128
23144
|
setPattern() {
|
|
23129
|
-
var _a;
|
|
23145
|
+
var _a, _b;
|
|
23130
23146
|
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
23131
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
|
|
23147
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
23132
23148
|
}
|
|
23133
23149
|
}
|
|
23134
23150
|
setErrorMessage() {
|
|
23151
|
+
var _a;
|
|
23135
23152
|
if (this.inputReference.validity.patternMismatch) {
|
|
23136
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
|
|
23153
|
+
return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
|
|
23137
23154
|
}
|
|
23138
23155
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
23139
23156
|
return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -23195,7 +23212,7 @@ const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
|
23195
23212
|
const TRANSLATIONS = {
|
|
23196
23213
|
en: {
|
|
23197
23214
|
dateError: 'The selected date should be between {min} and {max}',
|
|
23198
|
-
numberLengthError: 'The number should be between
|
|
23215
|
+
numberLengthError: 'The number should be between {min} and {max}',
|
|
23199
23216
|
lengthError: `The length should be between {minLength} and {maxLength}`,
|
|
23200
23217
|
requiredError: 'This input is required.',
|
|
23201
23218
|
nextButton: 'Next',
|
|
@@ -23459,10 +23476,11 @@ const GeneralRegistration = class {
|
|
|
23459
23476
|
this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
|
|
23460
23477
|
}
|
|
23461
23478
|
getInputsValueHandler(event) {
|
|
23462
|
-
this.listOfInputValues.find(input =>
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
|
|
23479
|
+
this.listOfInputValues.find(input => {
|
|
23480
|
+
if (input.name == event.detail.name) {
|
|
23481
|
+
input.value = event.detail.value;
|
|
23482
|
+
}
|
|
23483
|
+
});
|
|
23466
23484
|
this.stepsStateMachine({ event: 'set', type: 'values' });
|
|
23467
23485
|
}
|
|
23468
23486
|
componentWillLoad() {
|
|
@@ -23499,10 +23517,7 @@ const GeneralRegistration = class {
|
|
|
23499
23517
|
}
|
|
23500
23518
|
if (state.type == 'values') {
|
|
23501
23519
|
this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
|
|
23502
|
-
|
|
23503
|
-
if (curr.value != null) {
|
|
23504
|
-
acc[curr.name] = curr.value;
|
|
23505
|
-
}
|
|
23520
|
+
acc[curr.name] = curr.value;
|
|
23506
23521
|
return acc;
|
|
23507
23522
|
}, {});
|
|
23508
23523
|
}
|
|
@@ -23534,9 +23549,6 @@ const GeneralRegistration = class {
|
|
|
23534
23549
|
getRegisterConfig(registrationID) {
|
|
23535
23550
|
const url = new URL(`${this.endpoint}/v1/player/legislation/registration/config`);
|
|
23536
23551
|
const headers = new Headers();
|
|
23537
|
-
// headers.append('X-Tenant-ID', this.tenantId);
|
|
23538
|
-
// headers.append('X-Client-ID', this.clientId);
|
|
23539
|
-
// headers.append('X-Api-Key', this.apiKey);
|
|
23540
23552
|
headers.append('Content-Type', 'application/json');
|
|
23541
23553
|
headers.append('Accept', 'application/json');
|
|
23542
23554
|
if (registrationID) {
|
|
@@ -23566,19 +23578,19 @@ const GeneralRegistration = class {
|
|
|
23566
23578
|
const registerStep = {
|
|
23567
23579
|
registrationId: this.registrationID,
|
|
23568
23580
|
registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
|
|
23569
|
-
//
|
|
23570
|
-
if (curr.
|
|
23581
|
+
// Special case for "Mobile" as it needs to be split in two values -- API expects it this way.
|
|
23582
|
+
if (curr.name == "Mobile") {
|
|
23583
|
+
acc['MobilePrefix'] = curr.value.split('|')[0];
|
|
23584
|
+
acc[curr.name] = curr.value.split('|')[1];
|
|
23585
|
+
}
|
|
23586
|
+
else {
|
|
23571
23587
|
acc[curr.name] = curr.value;
|
|
23572
23588
|
}
|
|
23573
23589
|
return acc;
|
|
23574
23590
|
}, {}),
|
|
23575
23591
|
step: this.registrationStep,
|
|
23576
23592
|
};
|
|
23577
|
-
console.log(registerStep);
|
|
23578
23593
|
const headers = new Headers();
|
|
23579
|
-
// headers.append('X-Tenant-ID', this.tenantId);
|
|
23580
|
-
// headers.append('X-Client-ID', this.clientId);
|
|
23581
|
-
// headers.append('X-Api-Key', this.apiKey);
|
|
23582
23594
|
headers.append('Content-Type', 'application/json');
|
|
23583
23595
|
headers.append('Accept', 'application/json');
|
|
23584
23596
|
const options = {
|
|
@@ -23586,7 +23598,6 @@ const GeneralRegistration = class {
|
|
|
23586
23598
|
body: JSON.stringify(registerStep),
|
|
23587
23599
|
headers
|
|
23588
23600
|
};
|
|
23589
|
-
console.log(options.body);
|
|
23590
23601
|
fetch(url.href, options)
|
|
23591
23602
|
.then((res) => {
|
|
23592
23603
|
if (res.status >= 300) {
|
|
@@ -23619,22 +23630,11 @@ const GeneralRegistration = class {
|
|
|
23619
23630
|
this.isLoading = true;
|
|
23620
23631
|
const url = new URL(`${this.endpoint}/v1/player/legislation/register`);
|
|
23621
23632
|
const headers = new Headers();
|
|
23622
|
-
// headers.append('X-Tenant-ID', this.tenantId);
|
|
23623
|
-
// headers.append('X-Client-ID', this.clientId);
|
|
23624
|
-
// headers.append('X-Api-Key', this.apiKey);
|
|
23625
23633
|
headers.append('Content-Type', 'application/json');
|
|
23626
23634
|
headers.append('Accept', 'application/json');
|
|
23627
|
-
const registerStep = {
|
|
23628
|
-
registrationId: this.registrationID,
|
|
23629
|
-
registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
|
|
23630
|
-
acc[curr.name] = curr.value;
|
|
23631
|
-
return acc;
|
|
23632
|
-
}, {}),
|
|
23633
|
-
step: this.registrationStep,
|
|
23634
|
-
};
|
|
23635
23635
|
const options = {
|
|
23636
|
-
method: '
|
|
23637
|
-
body: JSON.stringify(
|
|
23636
|
+
method: 'PUT',
|
|
23637
|
+
body: JSON.stringify({ registrationId: this.registrationID }),
|
|
23638
23638
|
headers
|
|
23639
23639
|
};
|
|
23640
23640
|
fetch(url.href, options)
|
|
@@ -23658,9 +23658,10 @@ const GeneralRegistration = class {
|
|
|
23658
23658
|
}
|
|
23659
23659
|
formatConfig(config) {
|
|
23660
23660
|
// Populate the list of inputs and set as invalid in the beginning
|
|
23661
|
-
|
|
23661
|
+
let newListOfInputs = config.content.fields.map((field) => {
|
|
23662
23662
|
return Object.assign(Object.assign({}, field), { isValid: false });
|
|
23663
23663
|
});
|
|
23664
|
+
this.listOfInputs = JSON.parse(JSON.stringify(newListOfInputs));
|
|
23664
23665
|
// Populate the list of inputs values and set as null in the beginning
|
|
23665
23666
|
this.listOfInputValues = config.content.fields.map(field => {
|
|
23666
23667
|
return { name: field.name, value: null };
|
|
@@ -23684,7 +23685,6 @@ const GeneralRegistration = class {
|
|
|
23684
23685
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
23685
23686
|
}
|
|
23686
23687
|
renderInputs() {
|
|
23687
|
-
console.log(this.listOfInputs);
|
|
23688
23688
|
return (this.listOfInputs.map(input => index.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 })));
|
|
23689
23689
|
}
|
|
23690
23690
|
;
|
|
@@ -23728,6 +23728,12 @@ const NumberInput = class {
|
|
|
23728
23728
|
valueHandler(inputValueEvent) {
|
|
23729
23729
|
this.sendInputValue.emit(inputValueEvent);
|
|
23730
23730
|
}
|
|
23731
|
+
componentDidLoad() {
|
|
23732
|
+
if (this.defaultValue) {
|
|
23733
|
+
this.value = this.defaultValue;
|
|
23734
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
23735
|
+
}
|
|
23736
|
+
}
|
|
23731
23737
|
handleInput(event) {
|
|
23732
23738
|
this.value = event.target.value;
|
|
23733
23739
|
this.errorMessage = this.setErrorMessage();
|
|
@@ -23791,6 +23797,12 @@ const PasswordInput = class {
|
|
|
23791
23797
|
connectedCallback() {
|
|
23792
23798
|
this.validationPattern = this.setPattern();
|
|
23793
23799
|
}
|
|
23800
|
+
componentDidLoad() {
|
|
23801
|
+
if (this.defaultValue) {
|
|
23802
|
+
this.value = this.defaultValue;
|
|
23803
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
23804
|
+
}
|
|
23805
|
+
}
|
|
23794
23806
|
handleInput(event) {
|
|
23795
23807
|
this.value = event.target.value;
|
|
23796
23808
|
this.errorMessage = this.setErrorMessage();
|
|
@@ -23802,14 +23814,15 @@ const PasswordInput = class {
|
|
|
23802
23814
|
return this.inputReference.validity.valid;
|
|
23803
23815
|
}
|
|
23804
23816
|
setPattern() {
|
|
23805
|
-
var _a;
|
|
23817
|
+
var _a, _b;
|
|
23806
23818
|
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
23807
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
|
|
23819
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
23808
23820
|
}
|
|
23809
23821
|
}
|
|
23810
23822
|
setErrorMessage() {
|
|
23823
|
+
var _a;
|
|
23811
23824
|
if (this.inputReference.validity.patternMismatch) {
|
|
23812
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
|
|
23825
|
+
return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
|
|
23813
23826
|
}
|
|
23814
23827
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
23815
23828
|
return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -28352,6 +28365,10 @@ const SelectInput = class {
|
|
|
28352
28365
|
}
|
|
28353
28366
|
componentDidLoad() {
|
|
28354
28367
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
28368
|
+
if (this.defaultValue) {
|
|
28369
|
+
this.value = this.defaultValue;
|
|
28370
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
28371
|
+
}
|
|
28355
28372
|
}
|
|
28356
28373
|
getOptions() {
|
|
28357
28374
|
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
@@ -28428,12 +28445,18 @@ const TelInput = class {
|
|
|
28428
28445
|
if (this.action.split(" ")[0] == 'GET') {
|
|
28429
28446
|
return this.getPhoneCodes().then((options) => {
|
|
28430
28447
|
this.phoneCodesOptions = options.phoneCodes.map(code => {
|
|
28431
|
-
return { label: code.Prefix, value: code.
|
|
28448
|
+
return { label: code.Prefix, value: code.Prefix };
|
|
28432
28449
|
});
|
|
28433
28450
|
});
|
|
28434
28451
|
}
|
|
28435
28452
|
}
|
|
28436
28453
|
}
|
|
28454
|
+
componentDidLoad() {
|
|
28455
|
+
if (this.defaultValue) {
|
|
28456
|
+
this.prefixValue = this.defaultValue;
|
|
28457
|
+
this.valueHandler({ name: this.name, value: `${this.prefixValue}|` });
|
|
28458
|
+
}
|
|
28459
|
+
}
|
|
28437
28460
|
getPhoneCodes() {
|
|
28438
28461
|
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
28439
28462
|
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
|
|
@@ -28449,7 +28472,8 @@ const TelInput = class {
|
|
|
28449
28472
|
});
|
|
28450
28473
|
}
|
|
28451
28474
|
handleInput(event) {
|
|
28452
|
-
|
|
28475
|
+
// Kinda hack? Open to suggestions.
|
|
28476
|
+
this.value = `${this.prefixValue}|${event.target.value}`;
|
|
28453
28477
|
this.errorMessage = this.setErrorMessage();
|
|
28454
28478
|
this.isValid = this.setValidity();
|
|
28455
28479
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
@@ -28459,14 +28483,15 @@ const TelInput = class {
|
|
|
28459
28483
|
return this.inputReference.validity.valid;
|
|
28460
28484
|
}
|
|
28461
28485
|
setPattern() {
|
|
28462
|
-
var _a;
|
|
28486
|
+
var _a, _b;
|
|
28463
28487
|
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
28464
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
|
|
28488
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
28465
28489
|
}
|
|
28466
28490
|
}
|
|
28467
28491
|
setErrorMessage() {
|
|
28492
|
+
var _a;
|
|
28468
28493
|
if (this.inputReference.validity.patternMismatch) {
|
|
28469
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
|
|
28494
|
+
return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
|
|
28470
28495
|
}
|
|
28471
28496
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
28472
28497
|
return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -28477,7 +28502,7 @@ const TelInput = class {
|
|
|
28477
28502
|
}
|
|
28478
28503
|
render() {
|
|
28479
28504
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__input--invalid';
|
|
28480
|
-
return index.h("div", { class: 'tel__wrapper' }, index.h("div", { class: 'tel__wrapper--flex' }, index.h("vaadin-combo-box", { items: this.phoneCodesOptions, value: this.defaultValue, readOnly: this.autofilled }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
28505
|
+
return index.h("div", { class: 'tel__wrapper' }, index.h("div", { class: 'tel__wrapper--flex' }, index.h("vaadin-combo-box", { items: this.phoneCodesOptions, value: this.defaultValue, readOnly: this.autofilled, onBlur: (e) => this.prefixValue = e.target.value }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
28481
28506
|
}
|
|
28482
28507
|
static get watchers() { return {
|
|
28483
28508
|
"isValid": ["validityChanged"],
|
|
@@ -28519,10 +28544,14 @@ const TextInput = class {
|
|
|
28519
28544
|
this.sendInputValue.emit(inputValueEvent);
|
|
28520
28545
|
}
|
|
28521
28546
|
connectedCallback() {
|
|
28522
|
-
// @TODO do something with customRules !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
28523
|
-
this.customRules = this.setCustomRules();
|
|
28524
28547
|
this.validationPattern = this.setPattern();
|
|
28525
28548
|
}
|
|
28549
|
+
componentDidLoad() {
|
|
28550
|
+
if (this.defaultValue) {
|
|
28551
|
+
this.value = this.defaultValue;
|
|
28552
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
28553
|
+
}
|
|
28554
|
+
}
|
|
28526
28555
|
handleInput(event) {
|
|
28527
28556
|
this.value = event.target.value;
|
|
28528
28557
|
this.isValid = this.setValidity();
|
|
@@ -28541,14 +28570,15 @@ const TextInput = class {
|
|
|
28541
28570
|
}
|
|
28542
28571
|
}
|
|
28543
28572
|
setPattern() {
|
|
28544
|
-
var _a;
|
|
28573
|
+
var _a, _b;
|
|
28545
28574
|
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
28546
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
|
|
28575
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
28547
28576
|
}
|
|
28548
28577
|
}
|
|
28549
28578
|
setErrorMessage() {
|
|
28579
|
+
var _a;
|
|
28550
28580
|
if (this.inputReference.validity.patternMismatch) {
|
|
28551
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
|
|
28581
|
+
return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
|
|
28552
28582
|
}
|
|
28553
28583
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
28554
28584
|
return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-ad0df8ea.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[
|
|
18
|
+
return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"defaultValue":[1,"default-value"],"autofilled":[4],"options":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -787,10 +787,6 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
787
787
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
788
788
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
789
789
|
}
|
|
790
|
-
if (propType & 2 /* Number */) {
|
|
791
|
-
// force it to be a number
|
|
792
|
-
return parseFloat(propValue);
|
|
793
|
-
}
|
|
794
790
|
if (propType & 1 /* String */) {
|
|
795
791
|
// could have been passed as a number or boolean
|
|
796
792
|
// but we still want it as a string
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-ad0df8ea.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[
|
|
17
|
+
return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"defaultValue":[1,"default-value"],"autofilled":[4],"options":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -238,10 +238,11 @@ export class GeneralRegistration {
|
|
|
238
238
|
this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
|
|
239
239
|
}
|
|
240
240
|
getInputsValueHandler(event) {
|
|
241
|
-
this.listOfInputValues.find(input =>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
this.listOfInputValues.find(input => {
|
|
242
|
+
if (input.name == event.detail.name) {
|
|
243
|
+
input.value = event.detail.value;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
245
246
|
this.stepsStateMachine({ event: 'set', type: 'values' });
|
|
246
247
|
}
|
|
247
248
|
componentWillLoad() {
|
|
@@ -278,10 +279,7 @@ export class GeneralRegistration {
|
|
|
278
279
|
}
|
|
279
280
|
if (state.type == 'values') {
|
|
280
281
|
this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
|
|
281
|
-
|
|
282
|
-
if (curr.value != null) {
|
|
283
|
-
acc[curr.name] = curr.value;
|
|
284
|
-
}
|
|
282
|
+
acc[curr.name] = curr.value;
|
|
285
283
|
return acc;
|
|
286
284
|
}, {});
|
|
287
285
|
}
|
|
@@ -313,9 +311,6 @@ export class GeneralRegistration {
|
|
|
313
311
|
getRegisterConfig(registrationID) {
|
|
314
312
|
const url = new URL(`${this.endpoint}/v1/player/legislation/registration/config`);
|
|
315
313
|
const headers = new Headers();
|
|
316
|
-
// headers.append('X-Tenant-ID', this.tenantId);
|
|
317
|
-
// headers.append('X-Client-ID', this.clientId);
|
|
318
|
-
// headers.append('X-Api-Key', this.apiKey);
|
|
319
314
|
headers.append('Content-Type', 'application/json');
|
|
320
315
|
headers.append('Accept', 'application/json');
|
|
321
316
|
if (registrationID) {
|
|
@@ -345,19 +340,19 @@ export class GeneralRegistration {
|
|
|
345
340
|
const registerStep = {
|
|
346
341
|
registrationId: this.registrationID,
|
|
347
342
|
registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
|
|
348
|
-
//
|
|
349
|
-
if (curr.
|
|
343
|
+
// Special case for "Mobile" as it needs to be split in two values -- API expects it this way.
|
|
344
|
+
if (curr.name == "Mobile") {
|
|
345
|
+
acc['MobilePrefix'] = curr.value.split('|')[0];
|
|
346
|
+
acc[curr.name] = curr.value.split('|')[1];
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
350
349
|
acc[curr.name] = curr.value;
|
|
351
350
|
}
|
|
352
351
|
return acc;
|
|
353
352
|
}, {}),
|
|
354
353
|
step: this.registrationStep,
|
|
355
354
|
};
|
|
356
|
-
console.log(registerStep);
|
|
357
355
|
const headers = new Headers();
|
|
358
|
-
// headers.append('X-Tenant-ID', this.tenantId);
|
|
359
|
-
// headers.append('X-Client-ID', this.clientId);
|
|
360
|
-
// headers.append('X-Api-Key', this.apiKey);
|
|
361
356
|
headers.append('Content-Type', 'application/json');
|
|
362
357
|
headers.append('Accept', 'application/json');
|
|
363
358
|
const options = {
|
|
@@ -365,7 +360,6 @@ export class GeneralRegistration {
|
|
|
365
360
|
body: JSON.stringify(registerStep),
|
|
366
361
|
headers
|
|
367
362
|
};
|
|
368
|
-
console.log(options.body);
|
|
369
363
|
fetch(url.href, options)
|
|
370
364
|
.then((res) => {
|
|
371
365
|
if (res.status >= 300) {
|
|
@@ -398,22 +392,11 @@ export class GeneralRegistration {
|
|
|
398
392
|
this.isLoading = true;
|
|
399
393
|
const url = new URL(`${this.endpoint}/v1/player/legislation/register`);
|
|
400
394
|
const headers = new Headers();
|
|
401
|
-
// headers.append('X-Tenant-ID', this.tenantId);
|
|
402
|
-
// headers.append('X-Client-ID', this.clientId);
|
|
403
|
-
// headers.append('X-Api-Key', this.apiKey);
|
|
404
395
|
headers.append('Content-Type', 'application/json');
|
|
405
396
|
headers.append('Accept', 'application/json');
|
|
406
|
-
const registerStep = {
|
|
407
|
-
registrationId: this.registrationID,
|
|
408
|
-
registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
|
|
409
|
-
acc[curr.name] = curr.value;
|
|
410
|
-
return acc;
|
|
411
|
-
}, {}),
|
|
412
|
-
step: this.registrationStep,
|
|
413
|
-
};
|
|
414
397
|
const options = {
|
|
415
|
-
method: '
|
|
416
|
-
body: JSON.stringify(
|
|
398
|
+
method: 'PUT',
|
|
399
|
+
body: JSON.stringify({ registrationId: this.registrationID }),
|
|
417
400
|
headers
|
|
418
401
|
};
|
|
419
402
|
fetch(url.href, options)
|
|
@@ -437,9 +420,10 @@ export class GeneralRegistration {
|
|
|
437
420
|
}
|
|
438
421
|
formatConfig(config) {
|
|
439
422
|
// Populate the list of inputs and set as invalid in the beginning
|
|
440
|
-
|
|
423
|
+
let newListOfInputs = config.content.fields.map((field) => {
|
|
441
424
|
return Object.assign(Object.assign({}, field), { isValid: false });
|
|
442
425
|
});
|
|
426
|
+
this.listOfInputs = JSON.parse(JSON.stringify(newListOfInputs));
|
|
443
427
|
// Populate the list of inputs values and set as null in the beginning
|
|
444
428
|
this.listOfInputValues = config.content.fields.map(field => {
|
|
445
429
|
return { name: field.name, value: null };
|
|
@@ -463,7 +447,6 @@ export class GeneralRegistration {
|
|
|
463
447
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
464
448
|
}
|
|
465
449
|
renderInputs() {
|
|
466
|
-
console.log(this.listOfInputs);
|
|
467
450
|
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 })));
|
|
468
451
|
}
|
|
469
452
|
;
|
|
@@ -32,6 +32,12 @@ const CheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
32
32
|
valueHandler(inputValueEvent) {
|
|
33
33
|
this.sendInputValue.emit(inputValueEvent);
|
|
34
34
|
}
|
|
35
|
+
componentDidLoad() {
|
|
36
|
+
if (this.defaultValue) {
|
|
37
|
+
this.value = this.defaultValue;
|
|
38
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
35
41
|
handleClick() {
|
|
36
42
|
this.value = this.inputReference.checked.toString();
|
|
37
43
|
this.errorMessage = this.setErrorMessage();
|
|
@@ -6508,6 +6508,10 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
|
|
|
6508
6508
|
}
|
|
6509
6509
|
componentDidLoad() {
|
|
6510
6510
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
6511
|
+
if (this.defaultValue) {
|
|
6512
|
+
this.value = this.defaultValue;
|
|
6513
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
6514
|
+
}
|
|
6511
6515
|
}
|
|
6512
6516
|
handleInput(event) {
|
|
6513
6517
|
this.value = event.target.value;
|
|
@@ -32,6 +32,12 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
32
32
|
connectedCallback() {
|
|
33
33
|
this.validationPattern = this.setPattern();
|
|
34
34
|
}
|
|
35
|
+
componentDidLoad() {
|
|
36
|
+
if (this.defaultValue) {
|
|
37
|
+
this.value = this.defaultValue;
|
|
38
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
35
41
|
handleInput(event) {
|
|
36
42
|
this.value = event.target.value;
|
|
37
43
|
this.errorMessage = this.setErrorMessage();
|
|
@@ -43,14 +49,15 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
43
49
|
return this.inputReference.validity.valid;
|
|
44
50
|
}
|
|
45
51
|
setPattern() {
|
|
46
|
-
var _a;
|
|
52
|
+
var _a, _b;
|
|
47
53
|
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
48
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
|
|
54
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
setErrorMessage() {
|
|
58
|
+
var _a;
|
|
52
59
|
if (this.inputReference.validity.patternMismatch) {
|
|
53
|
-
return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
|
|
60
|
+
return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
|
|
54
61
|
}
|
|
55
62
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
56
63
|
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|