@everymatrix/general-registration 1.86.30 → 1.87.1
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_15.cjs.entry.js +310 -86
- package/dist/cjs/general-registration.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/esm/checkbox-group-input_15.entry.js +310 -86
- package/dist/esm/general-registration.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/general-registration/checkbox-group-input_15.entry.js +241 -241
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,10 @@ const TRANSLATIONS$1 = {
|
|
|
31
31
|
"enterIEAddressManually": "For IRE, enter the address manually",
|
|
32
32
|
"postalLookUpNoAddressFound": "No addresses found for this postal code",
|
|
33
33
|
"searchingForAddresses": "Searching for addresses...",
|
|
34
|
+
"SAIdLengthError": "SA ID must be 13 digits",
|
|
35
|
+
"SAIdInvalidError": "Invalid SA ID",
|
|
36
|
+
"PassportLengthError": "Passport number must be 8 or 9 digits.",
|
|
37
|
+
"PasswordMustContain": "Password must contain:"
|
|
34
38
|
},
|
|
35
39
|
"hu": {
|
|
36
40
|
"dateError": "A választott dátumnak {min} és {max} között kell lennie",
|
|
@@ -57,7 +61,11 @@ const TRANSLATIONS$1 = {
|
|
|
57
61
|
"InvalidDocumentNumber": "Csak számjegyek engedélyezettek.",
|
|
58
62
|
"twofaDescription": "<p> A megerősítő kódot elküldtük a következő címre: <p> {destination}. </p> </p> <p> Kérjük, írja be az alábbi PIN-kódot. </p>",
|
|
59
63
|
"twofaResendMessage": "Nem kapta meg a megerősítő kódot?",
|
|
60
|
-
"twofaResendButton": "Újraküldés"
|
|
64
|
+
"twofaResendButton": "Újraküldés",
|
|
65
|
+
"PassportLengthError": "Az útlevélszámnak 9 számjegyűnek kell lennie",
|
|
66
|
+
"SAIdLengthError": "A dél-afrikai személyi számnak 13 számjegyűnek kell lennie",
|
|
67
|
+
"SAIdInvalidError": "Érvénytelen dél-afrikai személyi szám",
|
|
68
|
+
"PasswordMustContain": "A jelszónak tartalmaznia kell:"
|
|
61
69
|
},
|
|
62
70
|
"hr": {
|
|
63
71
|
"dateError": "Odabrani datum treba biti između {min} i {max}",
|
|
@@ -84,7 +92,11 @@ const TRANSLATIONS$1 = {
|
|
|
84
92
|
"InvalidDocumentNumber": "Dopušteni su samo numerički znakovi.",
|
|
85
93
|
"twofaDescription": "<p> Poslali smo verifikacijski kod na: <p> {destination}. </p> </p> <p> Molimo unesite PIN ispod. </p>",
|
|
86
94
|
"twofaResendMessage": "Niste primili verifikacijski kod?",
|
|
87
|
-
"twofaResendButton": "Ponovno pošalji"
|
|
95
|
+
"twofaResendButton": "Ponovno pošalji",
|
|
96
|
+
"PassportLengthError": "Broj putovnice mora imati 9 znamenki",
|
|
97
|
+
"SAIdLengthError": "Južnoafrički osobni broj mora imati 13 znamenki",
|
|
98
|
+
"SAIdInvalidError": "Nevažeći južnoafrički osobni broj",
|
|
99
|
+
"PasswordMustContain": "Lozinka mora sadržavati:"
|
|
88
100
|
},
|
|
89
101
|
"tr": {
|
|
90
102
|
"dateError": "Seçilen tarih {min} ve {max} arasında olmalıdır",
|
|
@@ -111,7 +123,11 @@ const TRANSLATIONS$1 = {
|
|
|
111
123
|
"InvalidDocumentNumber": "Sadece sayısal karakterlere izin verilir.",
|
|
112
124
|
"twofaDescription": "<p> Doğrulama kodunu şu adrese gönderdik: <p> {destination}. </p> </p> <p> Lütfen aşağıya PIN kodunu girin. </p>",
|
|
113
125
|
"twofaResendMessage": "Doğrulama kodunu almadınız mı?",
|
|
114
|
-
"twofaResendButton": "Yeniden gönder"
|
|
126
|
+
"twofaResendButton": "Yeniden gönder",
|
|
127
|
+
"PassportLengthError": "Pasaport numarası 9 haneli olmalıdır",
|
|
128
|
+
"SAIdLengthError": "Güney Afrika kimlik numarası 13 haneli olmalıdır",
|
|
129
|
+
"SAIdInvalidError": "Geçersiz Güney Afrika kimlik numarası",
|
|
130
|
+
"PasswordMustContain": "Şifre şunları içermelidir:"
|
|
115
131
|
},
|
|
116
132
|
"pt-br": {
|
|
117
133
|
"dateError": "A data selecionada deve estar entre {min} e {max}",
|
|
@@ -138,7 +154,11 @@ const TRANSLATIONS$1 = {
|
|
|
138
154
|
"InvalidDocumentNumber": "Apenas caracteres numéricos são permitidos.",
|
|
139
155
|
"twofaDescription": "<p> Enviamos o código de verificação para: <p> {destination}. </p> </p> <p> Por favor, insira o PIN abaixo. </p>",
|
|
140
156
|
"twofaResendMessage": "Não recebeu o código de verificação?",
|
|
141
|
-
"twofaResendButton": "Reenviar"
|
|
157
|
+
"twofaResendButton": "Reenviar",
|
|
158
|
+
"PassportLengthError": "O número do passaporte deve ter 9 dígitos",
|
|
159
|
+
"SAIdLengthError": "O número de identificação da África do Sul deve ter 13 dígitos",
|
|
160
|
+
"SAIdInvalidError": "Número de identificação da África do Sul inválido",
|
|
161
|
+
"PasswordMustContain": "A senha deve conter:"
|
|
142
162
|
},
|
|
143
163
|
"es-mx": {
|
|
144
164
|
"dateError": "La fecha seleccionada debe ser entre {min} y {max}",
|
|
@@ -165,9 +185,40 @@ const TRANSLATIONS$1 = {
|
|
|
165
185
|
"InvalidDocumentNumber": "Solo se permiten caracteres numéricos.",
|
|
166
186
|
"twofaDescription": "<p> Hemos enviado el código de verificación a: <p> {destination}. </p> </p> <p> Por favor, ingrese el PIN a continuación. </p>",
|
|
167
187
|
"twofaResendMessage": "¿No recibiste el código de verificación?",
|
|
168
|
-
"twofaResendButton": "Reenviar"
|
|
188
|
+
"twofaResendButton": "Reenviar",
|
|
189
|
+
"PassportLengthError": "El número de pasaporte debe tener 9 dígitos",
|
|
190
|
+
"SAIdLengthError": "El número de identificación de Sudáfrica debe tener 13 dígitos",
|
|
191
|
+
"SAIdInvalidError": "Número de identificación de Sudáfrica inválido",
|
|
192
|
+
"PasswordMustContain": "La contraseña debe contener:"
|
|
169
193
|
}
|
|
170
194
|
};
|
|
195
|
+
const CONSTANTS = {
|
|
196
|
+
DOCUMENT_NUMBER: "DocumentNumber",
|
|
197
|
+
FIRSTNAME_ON_DOCUMENT: "FirstnameOnDocument",
|
|
198
|
+
LASTNAME_ON_DOCUMENT: "LastnameOnDocument",
|
|
199
|
+
PASSPORT: "Passport",
|
|
200
|
+
SOUTH_AFRICAN_ID: "SouthAfricanID",
|
|
201
|
+
BIRTHDATE: "BirthDate",
|
|
202
|
+
PASSPORT_NUMERIC_REGEX: /^\d{8,9}$/,
|
|
203
|
+
SA_ID_BASIC_REGEX: /^\d{13}$/,
|
|
204
|
+
SOUTH_AFRICAN_ID_LENGTH: 13,
|
|
205
|
+
NON_LETTERS_REGEX: /[^A-Za-z]/g,
|
|
206
|
+
DATE_FORMAT: "yyyy-MM-dd",
|
|
207
|
+
PASSWORD_COMPLEXITY_PASSED: "passed",
|
|
208
|
+
PASSWORD_COMPLEXITY_FAILED: "failed"
|
|
209
|
+
};
|
|
210
|
+
const ERROR_KEYS = {
|
|
211
|
+
PASSPORT_INVALID: 'PassportLengthError',
|
|
212
|
+
SA_ID_LENGTH: 'SAIdLengthError',
|
|
213
|
+
SA_ID_INVALID: 'SAIdInvalidError',
|
|
214
|
+
REQUIRED: 'requiredError',
|
|
215
|
+
LENGTH: 'lengthError',
|
|
216
|
+
DUPLICATE: 'duplicateInputError',
|
|
217
|
+
};
|
|
218
|
+
const STATUS_ICONS = {
|
|
219
|
+
PASSED: '✓',
|
|
220
|
+
FAILED: '✕',
|
|
221
|
+
};
|
|
171
222
|
const translate$1 = (key, customLang, values) => {
|
|
172
223
|
const lang = customLang;
|
|
173
224
|
let translation = TRANSLATIONS$1[lang !== undefined ? lang : DEFAULT_LANGUAGE$1][key];
|
|
@@ -194,6 +245,27 @@ const getTranslations$1 = (url) => {
|
|
|
194
245
|
});
|
|
195
246
|
});
|
|
196
247
|
};
|
|
248
|
+
const validateID = (id) => {
|
|
249
|
+
if (!CONSTANTS.SA_ID_BASIC_REGEX.test(id))
|
|
250
|
+
return false;
|
|
251
|
+
const digits = id.split("").map(n => parseInt(n, 10));
|
|
252
|
+
let oddSum = 0;
|
|
253
|
+
for (let i = 0; i < 12; i += 2) {
|
|
254
|
+
oddSum += digits[i];
|
|
255
|
+
}
|
|
256
|
+
let evenConcat = "";
|
|
257
|
+
for (let i = 1; i < 12; i += 2) {
|
|
258
|
+
evenConcat += digits[i];
|
|
259
|
+
}
|
|
260
|
+
const evenNumber = parseInt(evenConcat, 10) * 2;
|
|
261
|
+
const evenSum = evenNumber
|
|
262
|
+
.toString()
|
|
263
|
+
.split("")
|
|
264
|
+
.reduce((s, n) => s + parseInt(n, 10), 0);
|
|
265
|
+
const total = oddSum + evenSum;
|
|
266
|
+
let checkDigit = (10 - (total % 10)) % 10;
|
|
267
|
+
return checkDigit === digits[12];
|
|
268
|
+
};
|
|
197
269
|
|
|
198
270
|
const tooltipIconSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjUuNSIgc3Ryb2tlPSIjOTc5Nzk3Ii8+CjxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSIyIiBoZWlnaHQ9IjUiIGZpbGw9IiM5Nzk3OTciLz4KPGNpcmNsZSBjeD0iNiIgY3k9IjMiIHI9IjEiIGZpbGw9IiM5Nzk3OTciLz4KPC9zdmc+Cg==';
|
|
199
271
|
|
|
@@ -5817,6 +5889,21 @@ const DateInput = class {
|
|
|
5817
5889
|
sheet.innerHTML = this.clientStyling;
|
|
5818
5890
|
this.stylingContainer.prepend(sheet);
|
|
5819
5891
|
};
|
|
5892
|
+
this.handleDocumentIdUpdate = (e) => {
|
|
5893
|
+
if (this.name !== CONSTANTS.BIRTHDATE) {
|
|
5894
|
+
return;
|
|
5895
|
+
}
|
|
5896
|
+
const dateStr = e.detail;
|
|
5897
|
+
this.value = dateStr;
|
|
5898
|
+
this.valueAsDate = parse(this.value || '', CONSTANTS.DATE_FORMAT, new Date());
|
|
5899
|
+
this.touched = true;
|
|
5900
|
+
if (this.datePicker) {
|
|
5901
|
+
this.datePicker.value = this.value;
|
|
5902
|
+
}
|
|
5903
|
+
this.isValid = this.setValidity();
|
|
5904
|
+
this.errorMessage = this.setErrorMessage();
|
|
5905
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
5906
|
+
};
|
|
5820
5907
|
this.name = undefined;
|
|
5821
5908
|
this.displayName = undefined;
|
|
5822
5909
|
this.placeholder = undefined;
|
|
@@ -5829,6 +5916,7 @@ const DateInput = class {
|
|
|
5829
5916
|
this.clientStyling = '';
|
|
5830
5917
|
this.dateFormat = 'yyyy-MM-dd';
|
|
5831
5918
|
this.emitOnClick = false;
|
|
5919
|
+
this.enableSouthAfricanMode = undefined;
|
|
5832
5920
|
this.errorMessage = undefined;
|
|
5833
5921
|
this.isValid = undefined;
|
|
5834
5922
|
this.limitStylingAppends = false;
|
|
@@ -5858,6 +5946,14 @@ const DateInput = class {
|
|
|
5858
5946
|
this.valueHandler({ name: this.name, value: this.value });
|
|
5859
5947
|
}
|
|
5860
5948
|
}
|
|
5949
|
+
handleCustomRegistrationChange(newValue) {
|
|
5950
|
+
if (newValue) {
|
|
5951
|
+
window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
5952
|
+
}
|
|
5953
|
+
else {
|
|
5954
|
+
window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
5955
|
+
}
|
|
5956
|
+
}
|
|
5861
5957
|
valueHandler(inputValueEvent) {
|
|
5862
5958
|
this.sendInputValue.emit(inputValueEvent);
|
|
5863
5959
|
}
|
|
@@ -5901,6 +5997,9 @@ const DateInput = class {
|
|
|
5901
5997
|
}
|
|
5902
5998
|
});
|
|
5903
5999
|
}
|
|
6000
|
+
if (this.enableSouthAfricanMode) {
|
|
6001
|
+
window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
6002
|
+
}
|
|
5904
6003
|
this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
|
|
5905
6004
|
if (this.defaultValue) {
|
|
5906
6005
|
this.value = this.defaultValue;
|
|
@@ -5908,6 +6007,11 @@ const DateInput = class {
|
|
|
5908
6007
|
}
|
|
5909
6008
|
this.isValid = this.setValidity();
|
|
5910
6009
|
}
|
|
6010
|
+
disconnectedCallback() {
|
|
6011
|
+
if (this.enableSouthAfricanMode) {
|
|
6012
|
+
window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
6013
|
+
}
|
|
6014
|
+
}
|
|
5911
6015
|
handleCalendarIconClick() {
|
|
5912
6016
|
if (this.datePicker.opened && this.emitOnClick) {
|
|
5913
6017
|
window.postMessage({ type: `registration${this.name}Clicked` }, window.location.href);
|
|
@@ -5920,6 +6024,11 @@ const DateInput = class {
|
|
|
5920
6024
|
this.isValid = this.setValidity();
|
|
5921
6025
|
this.errorMessage = this.setErrorMessage();
|
|
5922
6026
|
this.emitValueHandler(true);
|
|
6027
|
+
if (this.enableSouthAfricanMode) {
|
|
6028
|
+
window.dispatchEvent(new CustomEvent('birthDateUpdated', {
|
|
6029
|
+
detail: { birthDate: this.value }
|
|
6030
|
+
}));
|
|
6031
|
+
}
|
|
5923
6032
|
}
|
|
5924
6033
|
setValidity() {
|
|
5925
6034
|
if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate) || !isMatch(this.formattedValue, this.dateFormat)) {
|
|
@@ -5954,14 +6063,15 @@ const DateInput = class {
|
|
|
5954
6063
|
if (this.touched) {
|
|
5955
6064
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
5956
6065
|
}
|
|
5957
|
-
return h$1("div", { key: '
|
|
5958
|
-
h$1("img", { key: '
|
|
6066
|
+
return h$1("div", { key: '9399c1be2edcbe3ed5c0e133cad52b1917e77e96', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h$1("label", { key: '1094491a5fc441c4f704441d376ed965d6946637', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h$1("vaadin-date-picker", { key: '8c922586399999885841ede07e46b715b2f6760f', id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e) }), h$1("small", { key: '67c1b6a0daafee536ab7179d1fe90a2870bb12b1', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
|
|
6067
|
+
h$1("img", { key: '4d02f23affc8ce9f5eb41a44fd2f346960c6d458', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
5959
6068
|
}
|
|
5960
6069
|
get element() { return getElement(this); }
|
|
5961
6070
|
static get watchers() { return {
|
|
5962
6071
|
"clientStyling": ["handleStylingChange"],
|
|
5963
6072
|
"isValid": ["validityChanged"],
|
|
5964
|
-
"emitValue": ["emitValueHandler"]
|
|
6073
|
+
"emitValue": ["emitValueHandler"],
|
|
6074
|
+
"enableSouthAfricanMode": ["handleCustomRegistrationChange"]
|
|
5965
6075
|
}; }
|
|
5966
6076
|
};
|
|
5967
6077
|
DateInput.style = DateInputStyle0;
|
|
@@ -12842,6 +12952,8 @@ const GeneralInput = class {
|
|
|
12842
12952
|
this.postalcodelength = undefined;
|
|
12843
12953
|
this.addresses = [];
|
|
12844
12954
|
this.ignoreCountry = false;
|
|
12955
|
+
this.enableSouthAfricanMode = undefined;
|
|
12956
|
+
this.pinAttemptsExceeded = undefined;
|
|
12845
12957
|
this.mbSource = undefined;
|
|
12846
12958
|
this.limitStylingAppends = false;
|
|
12847
12959
|
}
|
|
@@ -12885,7 +12997,7 @@ const GeneralInput = class {
|
|
|
12885
12997
|
return h$1("postalcode-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, postalcodelength: this.postalcodelength, addresses: this.addresses, ignoreCountry: this.ignoreCountry });
|
|
12886
12998
|
}
|
|
12887
12999
|
else {
|
|
12888
|
-
return h$1("text-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, haspostalcodelookup: this.haspostalcodelookup });
|
|
13000
|
+
return h$1("text-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, haspostalcodelookup: this.haspostalcodelookup, "enable-south-african-mode": this.enableSouthAfricanMode });
|
|
12889
13001
|
}
|
|
12890
13002
|
case 'email':
|
|
12891
13003
|
return h$1("email-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder });
|
|
@@ -12898,9 +13010,9 @@ const GeneralInput = class {
|
|
|
12898
13010
|
case 'togglecheckbox':
|
|
12899
13011
|
return h$1("toggle-checkbox-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, options: this.options, "emit-on-click": this.emitOnClick });
|
|
12900
13012
|
case 'datetime':
|
|
12901
|
-
return h$1("date-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, dateFormat: this.dateFormat, "emit-on-click": this.emitOnClick });
|
|
13013
|
+
return h$1("date-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, dateFormat: this.dateFormat, "emit-on-click": this.emitOnClick, "enable-south-african-mode": this.enableSouthAfricanMode });
|
|
12902
13014
|
case 'password':
|
|
12903
|
-
return h$1("password-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput, hidePasswordComplexity: this.hidePasswordComplexity, "no-validation": this.noValidation, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder });
|
|
13015
|
+
return h$1("password-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput, hidePasswordComplexity: this.hidePasswordComplexity, "no-validation": this.noValidation, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, "enable-south-african-mode": this.enableSouthAfricanMode });
|
|
12904
13016
|
case 'radio':
|
|
12905
13017
|
return h$1("radio-input", { name: this.name, displayName: this.displayName, optionsGroup: this.options, validation: this.validation, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling });
|
|
12906
13018
|
case 'tel':
|
|
@@ -12908,13 +13020,13 @@ const GeneralInput = class {
|
|
|
12908
13020
|
case 'dropdown':
|
|
12909
13021
|
return h$1("select-input", { name: this.name, action: this.action, defaultValue: this.defaultValue, displayName: this.displayName, options: this.options, validation: this.validation, emitValue: this.emitValue, autofilled: this.autofilled, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder });
|
|
12910
13022
|
case 'twofa':
|
|
12911
|
-
return h$1("twofa-input", { name: this.name, displayName: this.displayName, validation: this.validation, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, destination: this.twofaDestination, "resend-interval-seconds": this.twofaResendIntervalSeconds, "mb-source": this.mbSource });
|
|
13023
|
+
return h$1("twofa-input", { name: this.name, displayName: this.displayName, validation: this.validation, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, destination: this.twofaDestination, "resend-interval-seconds": this.twofaResendIntervalSeconds, "enable-south-african-mode": this.enableSouthAfricanMode, "pin-attempts-exceeded": this.pinAttemptsExceeded, "mb-source": this.mbSource });
|
|
12912
13024
|
default:
|
|
12913
13025
|
return h$1("p", null, "The ", this.type, " input type is not valid");
|
|
12914
13026
|
}
|
|
12915
13027
|
}
|
|
12916
13028
|
render() {
|
|
12917
|
-
return (h$1(Host, { key: '
|
|
13029
|
+
return (h$1(Host, { key: '7d036183d9376203451d9805e76b608cfa63570b', class: `general-input--${this.name}`, onClick: this.handleClick }, this.renderInput()));
|
|
12918
13030
|
}
|
|
12919
13031
|
get host() { return getElement(this); }
|
|
12920
13032
|
static get watchers() { return {
|
|
@@ -15180,7 +15292,7 @@ const NumberInput = class {
|
|
|
15180
15292
|
};
|
|
15181
15293
|
NumberInput.style = NumberInputStyle0;
|
|
15182
15294
|
|
|
15183
|
-
const passwordInputCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.password {\n font-family: \"Roboto\";\n font-style: normal;\n}\n.password__wrapper {\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n container-type: inline-size;\n}\n.password__wrapper--autofilled {\n pointer-events: none;\n}\n.password__wrapper--autofilled .password__label {\n color: var(--emw--registration-typography, var(--emw--color-black, #000000));\n}\n.password__wrapper--autofilled .password__input::part(input-field) {\n color: var(--emw--color-black, #000000);\n}\n.password__wrapper--flex {\n display: flex;\n gap: 5px;\n}\n.password__wrapper--relative {\n position: relative;\n}\n.password__label {\n font-family: inherit;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 20px;\n color: var(--emw--registration-typography, var(--emw--color-black, #000000));\n}\n.password__label--required::after {\n content: \"*\";\n font-family: inherit;\n color: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n margin-left: 2px;\n}\n.password__input {\n width: inherit;\n border: none;\n}\n.password__input[focused]::part(input-field) {\n border-color: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n}\n.password__input[invalid]::part(input-field) {\n border: 1px solid var(--emw--color-error, var(--emw--color-red, #ed0909));\n}\n.password__input::part(input-field) {\n border-radius: 4px;\n background-color: var(--emw--color-white, #FFFFFF);\n border: 1px solid var(--emw--color-gray-100, #E6E6E6);\n color: var(--emw--color-black, #000000);\n background-color: var(--emw--color-white, #FFFFFF);\n font-family: inherit;\n font-style: normal;\n font-weight: 300;\n font-size: 16px;\n line-height: 1.5;\n position: relative;\n margin-bottom: unset;\n height: 44px;\n padding: 0;\n width: 100%;\n}\n.password__input::part(reveal-button) {\n position: relative;\n right: 10px;\n}\n.password__input::part(reveal-button)::before {\n color: var(--emw--registration-typography, var(--emw--color-black, #000000));\n}\n.password__input > input {\n padding: 5px 15px;\n}\n.password__input > input:placeholder-shown {\n color: var(--emw--color-gray-150, #828282);\n}\n.password__error-message {\n position: absolute;\n top: calc(100% + 5px);\n left: 0;\n color: var(--emw--color-error, var(--emw--color-red, #ed0909));\n}\n.password__complexity {\n height: 150px;\n position: relative;\n padding: 10px;\n display: flex;\n flex-direction: column;\n gap: 20px;\n justify-content: center;\n margin-top: 20px;\n font-weight: 300;\n background: var(--emw--color-white, #FFFFFF);\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n border: 1px solid #B0B0B0;\n box-sizing: content-box;\n /* works only in this order */\n}\n.password__complexity meter {\n border-color: transparent; /* Needed for Safari */\n}\n.password__complexity meter[value=\"1\"]::-moz-meter-bar {\n background-color: var(--emw--color-valid, #48952a);\n}\n.password__complexity meter[value=\"1\"]::-webkit-meter-optimum-value {\n background-color: var(--emw--color-valid, #48952a);\n}\n.password__complexity meter:not([value=\"1\"])::-moz-meter-bar {\n background-color: var(--emw--color-error, #FD2839);\n}\n.password__complexity meter:not([value=\"1\"])::-webkit-meter-optimum-value {\n background-color: var(--emw--color-error, #FD2839);\n}\n.password__complexity--strength {\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n}\n.password__complexity--strength meter::-moz-meter-bar { /* Firefox Pseudo Class */\n background: #B0B0B0;\n}\n.password__complexity--hidden {\n display: none;\n}\n.password__complexity--text-bold {\n font-weight: 500;\n}\n.password__complexity--checkbox {\n margin-right: 5px;\n}\n.password__complexity:after {\n content: \"\";\n position: absolute;\n width: 25px;\n height: 25px;\n border-top: 1px solid var(--emw--color-gray-150, #828282);\n border-right: 0 solid var(--emw--color-gray-150, #828282);\n border-left: 1px solid var(--emw--color-gray-150, #828282);\n border-bottom: 0 solid var(--emw--color-gray-150, #828282);\n bottom: 92%;\n left: 50%;\n margin-left: -25px;\n transform: rotate(45deg);\n margin-top: -25px;\n background-color: var(--emw--color-white, #FFFFFF);\n}\n@container (max-width: 300px) {\n .password__complexity {\n height: 190px;\n }\n .password__complexity:after {\n width: 14px;\n height: 14px;\n bottom: 96%;\n left: 57%;\n }\n}\n.password__tooltip-icon {\n width: 16px;\n height: auto;\n}\n.password__tooltip {\n position: absolute;\n top: 0;\n left: 20px;\n background-color: var(--emw--color-white, #FFFFFF);\n border: 1px solid var(--emw--color-gray-150, #828282);\n color: #2B2D3F;\n padding: 10px;\n border-radius: 5px;\n opacity: 0;\n transition: opacity 0.3s ease-in-out;\n z-index: 10;\n}\n.password__tooltip.visible {\n opacity: 1;\n}";
|
|
15295
|
+
const passwordInputCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.password {\n font-family: \"Roboto\";\n font-style: normal;\n}\n.password__wrapper {\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n container-type: inline-size;\n}\n.password__wrapper--autofilled {\n pointer-events: none;\n}\n.password__wrapper--autofilled .password__label {\n color: var(--emw--registration-typography, var(--emw--color-black, #000000));\n}\n.password__wrapper--autofilled .password__input::part(input-field) {\n color: var(--emw--color-black, #000000);\n}\n.password__wrapper--flex {\n display: flex;\n gap: 5px;\n}\n.password__wrapper--relative {\n position: relative;\n}\n.password__label {\n font-family: inherit;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 20px;\n color: var(--emw--registration-typography, var(--emw--color-black, #000000));\n}\n.password__label--required::after {\n content: \"*\";\n font-family: inherit;\n color: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n margin-left: 2px;\n}\n.password__input {\n width: inherit;\n border: none;\n}\n.password__input[focused]::part(input-field) {\n border-color: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n}\n.password__input[invalid]::part(input-field) {\n border: 1px solid var(--emw--color-error, var(--emw--color-red, #ed0909));\n}\n.password__input::part(input-field) {\n border-radius: 4px;\n background-color: var(--emw--color-white, #FFFFFF);\n border: 1px solid var(--emw--color-gray-100, #E6E6E6);\n color: var(--emw--color-black, #000000);\n background-color: var(--emw--color-white, #FFFFFF);\n font-family: inherit;\n font-style: normal;\n font-weight: 300;\n font-size: 16px;\n line-height: 1.5;\n position: relative;\n margin-bottom: unset;\n height: 44px;\n padding: 0;\n width: 100%;\n}\n.password__input::part(reveal-button) {\n position: relative;\n right: 10px;\n}\n.password__input::part(reveal-button)::before {\n color: var(--emw--registration-typography, var(--emw--color-black, #000000));\n}\n.password__input > input {\n padding: 5px 15px;\n}\n.password__input > input:placeholder-shown {\n color: var(--emw--color-gray-150, #828282);\n}\n.password__error-message {\n position: absolute;\n top: calc(100% + 5px);\n left: 0;\n color: var(--emw--color-error, var(--emw--color-red, #ed0909));\n}\n.password__complexity {\n height: 150px;\n position: relative;\n padding: 10px;\n display: flex;\n flex-direction: column;\n gap: 20px;\n justify-content: center;\n margin-top: 20px;\n font-weight: 300;\n background: var(--emw--color-white, #FFFFFF);\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n border-radius: 5px;\n border: 1px solid #B0B0B0;\n box-sizing: content-box;\n /* works only in this order */\n}\n.password__complexity meter {\n border-color: transparent; /* Needed for Safari */\n}\n.password__complexity meter[value=\"1\"]::-moz-meter-bar {\n background-color: var(--emw--color-valid, #48952a);\n}\n.password__complexity meter[value=\"1\"]::-webkit-meter-optimum-value {\n background-color: var(--emw--color-valid, #48952a);\n}\n.password__complexity meter:not([value=\"1\"])::-moz-meter-bar {\n background-color: var(--emw--color-error, #FD2839);\n}\n.password__complexity meter:not([value=\"1\"])::-webkit-meter-optimum-value {\n background-color: var(--emw--color-error, #FD2839);\n}\n.password__complexity--strength {\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n}\n.password__complexity--strength meter::-moz-meter-bar { /* Firefox Pseudo Class */\n background: #B0B0B0;\n}\n.password__complexity--hidden {\n display: none;\n}\n.password__complexity--text-bold {\n font-weight: 500;\n}\n.password__complexity--checkbox {\n margin-right: 5px;\n}\n.password__complexity:after {\n content: \"\";\n position: absolute;\n width: 25px;\n height: 25px;\n border-top: 1px solid var(--emw--color-gray-150, #828282);\n border-right: 0 solid var(--emw--color-gray-150, #828282);\n border-left: 1px solid var(--emw--color-gray-150, #828282);\n border-bottom: 0 solid var(--emw--color-gray-150, #828282);\n bottom: 92%;\n left: 50%;\n margin-left: -25px;\n transform: rotate(45deg);\n margin-top: -25px;\n background-color: var(--emw--color-white, #FFFFFF);\n}\n@container (max-width: 300px) {\n .password__complexity {\n height: 190px;\n }\n .password__complexity:after {\n width: 14px;\n height: 14px;\n bottom: 96%;\n left: 57%;\n }\n}\n.password__tooltip-icon {\n width: 16px;\n height: auto;\n}\n.password__tooltip {\n position: absolute;\n top: 0;\n left: 20px;\n background-color: var(--emw--color-white, #FFFFFF);\n border: 1px solid var(--emw--color-gray-150, #828282);\n color: #2B2D3F;\n padding: 10px;\n border-radius: 5px;\n opacity: 0;\n transition: opacity 0.3s ease-in-out;\n z-index: 10;\n}\n.password__tooltip.visible {\n opacity: 1;\n}\n\n.customreg-password__complexity {\n background: var(--emw--color-white, #FFFFFF);\n border-radius: 6px;\n padding: 14px;\n}\n\n.customreg-password__complexity--title {\n font-size: var(--emw--font-size-small, 14px);\n color: var(--emw--color-black, #000000);\n margin-bottom: 12px;\n}\n\n.customreg-password__complexity--rules {\n display: flex;\n flex-direction: column;\n gap: 10px;\n font-size: var(--emw--font-size-small-xs, 12px);\n}\n\n.customreg-password__complexity--rule {\n display: flex;\n align-items: center;\n color: var(--emw--color-black, #000000);\n}\n\n.customreg-password__complexity--icon {\n width: 20px;\n height: 20px;\n min-width: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: bold;\n border-radius: 50%;\n margin-right: 10px;\n}\n\n.customreg-password__complexity--icon.failed {\n background-color: var(--emw--color-error, #FD2839);\n color: var(--emw--color-white, #FFFFFF);\n}\n\n.customreg-password__complexity--icon.passed {\n background-color: var(--emw--color-lottoball-green, #01af15);\n color: var(--emw--color-white, #FFFFFF);\n}\n\n.customreg-password__complexity::after {\n display: none;\n}";
|
|
15184
15296
|
const PasswordInputStyle0 = passwordInputCss;
|
|
15185
15297
|
|
|
15186
15298
|
const PasswordInput = class {
|
|
@@ -15240,6 +15352,7 @@ const PasswordInput = class {
|
|
|
15240
15352
|
this.isDuplicateInput = undefined;
|
|
15241
15353
|
this.hidePasswordComplexity = false;
|
|
15242
15354
|
this.clientStyling = '';
|
|
15355
|
+
this.enableSouthAfricanMode = undefined;
|
|
15243
15356
|
this.isValid = undefined;
|
|
15244
15357
|
this.errorMessage = undefined;
|
|
15245
15358
|
this.limitStylingAppends = false;
|
|
@@ -15418,13 +15531,23 @@ const PasswordInput = class {
|
|
|
15418
15531
|
return (h$1("div", { key: index }, h$1("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h$1("span", null, translate$1(`${complexity.ruleKey}`, this.language) ? translate$1(`${complexity.ruleKey}`, this.language) : complexity.rule)));
|
|
15419
15532
|
}))));
|
|
15420
15533
|
}
|
|
15534
|
+
renderCustomComplexityPopup() {
|
|
15535
|
+
return (h$1("div", { class: `customreg-password__complexity ${!this.showPopup ? 'customreg-password__complexity--hidden' : ''}` }, h$1("p", { class: 'customreg-password__complexity--title' }, translate$1('PasswordMustContain', this.language)), h$1("div", { class: 'customreg-password__complexity--rules' }, this.passwordComplexity.map((complexity, index) => (h$1("div", { class: 'customreg-password__complexity--rule', key: index }, h$1("span", { class: `customreg-password__complexity--icon ${complexity.passed
|
|
15536
|
+
? CONSTANTS.PASSWORD_COMPLEXITY_PASSED : CONSTANTS.PASSWORD_COMPLEXITY_FAILED}` }, complexity.passed ? STATUS_ICONS.PASSED : STATUS_ICONS.FAILED), h$1("span", null, translate$1(complexity.ruleKey, this.language) || complexity.rule)))))));
|
|
15537
|
+
}
|
|
15421
15538
|
render() {
|
|
15422
15539
|
let invalidClass = '';
|
|
15423
15540
|
if (this.touched) {
|
|
15424
15541
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
15425
15542
|
}
|
|
15426
|
-
return h$1("div", { key: '
|
|
15427
|
-
h$1("img", { key: '
|
|
15543
|
+
return h$1("div", { key: 'c2dd473e71853ebb3d0b5b6245af606f75f8b479', class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h$1("div", { key: '4ba641a832be3b8efb1957af5f45eb7b7cc69adc', class: 'password__wrapper--flex' }, h$1("label", { key: 'a4440e8b59a743831fa833d8e1c680c01cfcb93e', class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h$1("div", { key: '2e194f2096a69bc691694be0ac49004a54aa3cde', class: 'password__wrapper--relative' }, this.tooltip &&
|
|
15544
|
+
h$1("img", { key: 'eafce2331ec867fcd8abc253d3605f5214557b8b', class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h$1("vaadin-password-field", { key: '0f1c9cd805fd9794de896c33a85abe12c9473d00', type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus }), !this.noValidation && h$1("small", { key: 'd20a6946d4757da4311f33b2770079cc7f80bcfa', class: 'password__error-message' }, this.errorMessage), this.passwordComplexity &&
|
|
15545
|
+
this.showPopup &&
|
|
15546
|
+
!this.hidePasswordComplexity &&
|
|
15547
|
+
!this.isDuplicateInput &&
|
|
15548
|
+
(this.enableSouthAfricanMode
|
|
15549
|
+
? this.renderCustomComplexityPopup()
|
|
15550
|
+
: this.renderComplexityPopup()));
|
|
15428
15551
|
}
|
|
15429
15552
|
get element() { return getElement(this); }
|
|
15430
15553
|
static get watchers() { return {
|
|
@@ -16294,24 +16417,28 @@ const TextInput = class {
|
|
|
16294
16417
|
this.postalcodelength = 5;
|
|
16295
16418
|
this.touched = false;
|
|
16296
16419
|
this.handleInput = (event) => {
|
|
16297
|
-
|
|
16420
|
+
const input = event.target;
|
|
16421
|
+
const normalizedValue = this.enableSouthAfricanMode &&
|
|
16422
|
+
(this.name === CONSTANTS.FIRSTNAME_ON_DOCUMENT ||
|
|
16423
|
+
this.name === CONSTANTS.LASTNAME_ON_DOCUMENT)
|
|
16424
|
+
? input.value.replace(CONSTANTS.NON_LETTERS_REGEX, '')
|
|
16425
|
+
: input.value;
|
|
16426
|
+
if (normalizedValue !== input.value) {
|
|
16427
|
+
input.value = normalizedValue;
|
|
16428
|
+
}
|
|
16429
|
+
this.value = normalizedValue;
|
|
16298
16430
|
this.touched = true;
|
|
16299
|
-
if (this.debounceTime)
|
|
16431
|
+
if (this.debounceTime)
|
|
16300
16432
|
clearTimeout(this.debounceTime);
|
|
16301
|
-
}
|
|
16302
16433
|
this.debounceTime = setTimeout(() => {
|
|
16303
|
-
this.
|
|
16304
|
-
this.errorMessage = this.setErrorMessage();
|
|
16305
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
16434
|
+
this.updateValidationState();
|
|
16306
16435
|
this.emitValueHandler(true);
|
|
16307
16436
|
}, 500);
|
|
16308
16437
|
};
|
|
16309
16438
|
this.handleBlur = (event) => {
|
|
16310
16439
|
this.value = event.target.value;
|
|
16311
16440
|
this.touched = true;
|
|
16312
|
-
this.
|
|
16313
|
-
this.errorMessage = this.setErrorMessage();
|
|
16314
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
16441
|
+
this.updateValidationState();
|
|
16315
16442
|
};
|
|
16316
16443
|
this.setClientStyling = () => {
|
|
16317
16444
|
let sheet = document.createElement('style');
|
|
@@ -16331,6 +16458,7 @@ const TextInput = class {
|
|
|
16331
16458
|
this.isDuplicateInput = undefined;
|
|
16332
16459
|
this.clientStyling = '';
|
|
16333
16460
|
this.haspostalcodelookup = undefined;
|
|
16461
|
+
this.enableSouthAfricanMode = undefined;
|
|
16334
16462
|
this.isValid = undefined;
|
|
16335
16463
|
this.errorMessage = '';
|
|
16336
16464
|
this.limitStylingAppends = false;
|
|
@@ -16368,15 +16496,13 @@ const TextInput = class {
|
|
|
16368
16496
|
if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
|
|
16369
16497
|
this.duplicateInputValue = event.detail.value;
|
|
16370
16498
|
if (this.touched) {
|
|
16371
|
-
this.
|
|
16372
|
-
this.errorMessage = this.setErrorMessage();
|
|
16499
|
+
this.updateValidationState();
|
|
16373
16500
|
}
|
|
16374
16501
|
}
|
|
16375
|
-
if (this.name === event.detail.name + 'Duplicate'
|
|
16376
|
-
|
|
16377
|
-
|
|
16378
|
-
this.
|
|
16379
|
-
this.errorMessage = this.setErrorMessage();
|
|
16502
|
+
if (this.name === event.detail.name + 'Duplicate' &&
|
|
16503
|
+
this.name.replace('Duplicate', '') === event.detail.name &&
|
|
16504
|
+
this.touched) {
|
|
16505
|
+
this.updateValidationState();
|
|
16380
16506
|
}
|
|
16381
16507
|
}
|
|
16382
16508
|
handleValidationChange(event) {
|
|
@@ -16386,7 +16512,7 @@ const TextInput = class {
|
|
|
16386
16512
|
this.validation = event.detail.validation;
|
|
16387
16513
|
this.validationPattern = this.setPattern();
|
|
16388
16514
|
if (this.touched) {
|
|
16389
|
-
this.isValid = this.
|
|
16515
|
+
this.isValid = this.isValidValue();
|
|
16390
16516
|
this.errorMessage = this.setErrorMessage();
|
|
16391
16517
|
}
|
|
16392
16518
|
}
|
|
@@ -16422,13 +16548,37 @@ const TextInput = class {
|
|
|
16422
16548
|
}
|
|
16423
16549
|
this.value = newValue;
|
|
16424
16550
|
this.touched = true;
|
|
16425
|
-
this.
|
|
16426
|
-
this.valueHandler({ name: this.name, value: newValue });
|
|
16427
|
-
this.validityStateHandler({ valid: true, name: this.name });
|
|
16551
|
+
this.updateValidationState();
|
|
16428
16552
|
}
|
|
16429
16553
|
connectedCallback() {
|
|
16430
16554
|
this.validationPattern = this.setPattern();
|
|
16431
16555
|
}
|
|
16556
|
+
handleExternalDocUpdate(event) {
|
|
16557
|
+
if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
|
|
16558
|
+
return;
|
|
16559
|
+
this.value = event.detail || "";
|
|
16560
|
+
this.touched = true;
|
|
16561
|
+
if (this.inputReference) {
|
|
16562
|
+
this.inputReference.value = this.value;
|
|
16563
|
+
}
|
|
16564
|
+
this.sendInputValue.emit({
|
|
16565
|
+
name: this.name,
|
|
16566
|
+
value: this.value
|
|
16567
|
+
});
|
|
16568
|
+
this.updateValidationState();
|
|
16569
|
+
}
|
|
16570
|
+
handleDocReset() {
|
|
16571
|
+
if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
|
|
16572
|
+
return;
|
|
16573
|
+
this.value = "";
|
|
16574
|
+
this.touched = false;
|
|
16575
|
+
this.isValid = false;
|
|
16576
|
+
this.errorMessage = "";
|
|
16577
|
+
if (this.inputReference) {
|
|
16578
|
+
this.inputReference.value = "";
|
|
16579
|
+
}
|
|
16580
|
+
this.validityStateHandler({ valid: false, name: this.name });
|
|
16581
|
+
}
|
|
16432
16582
|
componentDidRender() {
|
|
16433
16583
|
// start custom styling area
|
|
16434
16584
|
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
@@ -16445,6 +16595,7 @@ const TextInput = class {
|
|
|
16445
16595
|
}
|
|
16446
16596
|
componentDidLoad() {
|
|
16447
16597
|
if (this.defaultValue) {
|
|
16598
|
+
this.value = this.defaultValue;
|
|
16448
16599
|
this.valueHandler({ name: this.name, value: this.value });
|
|
16449
16600
|
if (this.isDuplicateInput) {
|
|
16450
16601
|
this.touched = true;
|
|
@@ -16456,18 +16607,49 @@ const TextInput = class {
|
|
|
16456
16607
|
window.targetInputRefs[this.name] = this.inputReference;
|
|
16457
16608
|
}
|
|
16458
16609
|
}
|
|
16459
|
-
this.isValid = this.
|
|
16610
|
+
this.isValid = this.isValidValue();
|
|
16611
|
+
}
|
|
16612
|
+
validateDocument(valueRaw, docType) {
|
|
16613
|
+
const value = valueRaw.trim();
|
|
16614
|
+
if (docType === CONSTANTS.PASSPORT) {
|
|
16615
|
+
const valid = CONSTANTS.PASSPORT_NUMERIC_REGEX.test(value);
|
|
16616
|
+
return valid
|
|
16617
|
+
? { valid: true }
|
|
16618
|
+
: { valid: false, errorKey: ERROR_KEYS.PASSPORT_INVALID };
|
|
16619
|
+
}
|
|
16620
|
+
if (docType === CONSTANTS.SOUTH_AFRICAN_ID) {
|
|
16621
|
+
if (value.length !== CONSTANTS.SOUTH_AFRICAN_ID_LENGTH) {
|
|
16622
|
+
return { valid: false, errorKey: ERROR_KEYS.SA_ID_LENGTH };
|
|
16623
|
+
}
|
|
16624
|
+
const valid = validateID(value);
|
|
16625
|
+
return valid
|
|
16626
|
+
? { valid: true }
|
|
16627
|
+
: { valid: false, errorKey: ERROR_KEYS.SA_ID_INVALID };
|
|
16628
|
+
}
|
|
16629
|
+
return { valid: true };
|
|
16460
16630
|
}
|
|
16461
|
-
|
|
16631
|
+
updateValidationState() {
|
|
16632
|
+
const nextValid = this.isValidValue();
|
|
16633
|
+
this.isValid = nextValid;
|
|
16634
|
+
if (!this.touched) {
|
|
16635
|
+
this.errorMessage = '';
|
|
16636
|
+
return;
|
|
16637
|
+
}
|
|
16638
|
+
this.errorMessage = nextValid ? '' : this.setErrorMessage();
|
|
16639
|
+
}
|
|
16640
|
+
isValidValue() {
|
|
16462
16641
|
if (!this.inputReference) {
|
|
16463
16642
|
return false;
|
|
16464
16643
|
}
|
|
16465
|
-
if (this.
|
|
16466
|
-
|
|
16644
|
+
if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
|
|
16645
|
+
const docType = window.documentTypeValue;
|
|
16646
|
+
return this.validateDocument(this.value, docType).valid;
|
|
16467
16647
|
}
|
|
16468
|
-
const
|
|
16469
|
-
|
|
16470
|
-
|
|
16648
|
+
const fallbackResult = (this.value.trim() === "" && !this.validation.mandatory) ||
|
|
16649
|
+
(this.inputReference.validity.valid &&
|
|
16650
|
+
(!this.inputReference.value ||
|
|
16651
|
+
this.inputReference.value.match(this.validationPattern) !== null));
|
|
16652
|
+
return fallbackResult;
|
|
16471
16653
|
}
|
|
16472
16654
|
setPattern() {
|
|
16473
16655
|
var _a, _b;
|
|
@@ -16477,14 +16659,25 @@ const TextInput = class {
|
|
|
16477
16659
|
}
|
|
16478
16660
|
setErrorMessage() {
|
|
16479
16661
|
var _a, _b, _c, _d;
|
|
16480
|
-
|
|
16662
|
+
const value = this.value.trim();
|
|
16663
|
+
if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
|
|
16664
|
+
const docType = window.documentTypeValue;
|
|
16665
|
+
const res = this.validateDocument(this.value, docType);
|
|
16666
|
+
return res.valid ? '' : translate$1(res.errorKey, this.language);
|
|
16667
|
+
}
|
|
16668
|
+
if (value === "" && !this.validation.mandatory) {
|
|
16481
16669
|
return "";
|
|
16482
16670
|
}
|
|
16483
16671
|
if (this.inputReference.validity.valueMissing) {
|
|
16484
|
-
return translate$1(
|
|
16672
|
+
return translate$1(ERROR_KEYS.REQUIRED, this.language);
|
|
16485
16673
|
}
|
|
16486
16674
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
16487
|
-
return translate$1(
|
|
16675
|
+
return translate$1(ERROR_KEYS.LENGTH, this.language, {
|
|
16676
|
+
values: {
|
|
16677
|
+
minLength: this.validation.minLength,
|
|
16678
|
+
maxLength: this.validation.maxLength
|
|
16679
|
+
}
|
|
16680
|
+
});
|
|
16488
16681
|
}
|
|
16489
16682
|
if (this.inputReference.value.match(this.validationPattern) == null) {
|
|
16490
16683
|
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
@@ -16496,6 +16689,7 @@ const TextInput = class {
|
|
|
16496
16689
|
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
16497
16690
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
16498
16691
|
}
|
|
16692
|
+
return "";
|
|
16499
16693
|
}
|
|
16500
16694
|
renderTooltip() {
|
|
16501
16695
|
if (this.showTooltip) {
|
|
@@ -16508,8 +16702,8 @@ const TextInput = class {
|
|
|
16508
16702
|
if (this.touched) {
|
|
16509
16703
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
16510
16704
|
}
|
|
16511
|
-
return h$1("div", { key: '
|
|
16512
|
-
h$1("img", { key: '
|
|
16705
|
+
return h$1("div", { key: '5b0bf10acadab5c3362d185cef10c5ed4f3a6a47', class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, h$1("div", { key: '6d79cc845aac8d9b11737d35571680d7701c4b94', class: 'text__wrapper--flex' }, h$1("label", { key: 'de687661fa037d691fe1da1231b651f564bca010', class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h$1("div", { key: '4d9b12a587267eaf6fab4c4f3c38befb8d5c2b99', class: 'text__wrapper--relative' }, this.tooltip &&
|
|
16706
|
+
h$1("img", { key: '7f27a118124cd0407b6c2644137a79eaa0496164', class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h$1("input", { key: '94a614815155465dbfef2a7cc1cb788bb14d1498', name: this.name, id: `${this.name}__input`, value: this.value, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, required: this.validation.mandatory, minlength: this.enableSouthAfricanMode ? '' : this.validation.minLength, maxlength: this.enableSouthAfricanMode ? '' : this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h$1("small", { key: 'b9b3bdcd9cb81b56dc25a208b0c1d7784d06b5e0', class: 'text__error-message' }, this.errorMessage));
|
|
16513
16707
|
}
|
|
16514
16708
|
static get watchers() { return {
|
|
16515
16709
|
"clientStyling": ["handleStylingChange"],
|
|
@@ -16694,20 +16888,24 @@ const TwofaInput = class {
|
|
|
16694
16888
|
this.handleInput = (e, idx) => {
|
|
16695
16889
|
const input = e.target;
|
|
16696
16890
|
const value = input.value;
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
else {
|
|
16701
|
-
input.value = value.charAt(0);
|
|
16702
|
-
}
|
|
16703
|
-
if (!value) {
|
|
16891
|
+
const char = value.slice(-1);
|
|
16892
|
+
input.value = char;
|
|
16893
|
+
if (!char)
|
|
16704
16894
|
return;
|
|
16895
|
+
this.code[idx] = char;
|
|
16896
|
+
// --- Hide pin code --- //
|
|
16897
|
+
if (this.enableSouthAfricanMode) {
|
|
16898
|
+
// show character for 500ms
|
|
16899
|
+
this.revealedIndexes = [idx];
|
|
16900
|
+
if (this.revealTimeout)
|
|
16901
|
+
clearTimeout(this.revealTimeout);
|
|
16902
|
+
this.revealTimeout = setTimeout(() => {
|
|
16903
|
+
this.revealedIndexes = [];
|
|
16904
|
+
}, 500);
|
|
16705
16905
|
}
|
|
16706
|
-
this.code[idx] = input.value;
|
|
16707
16906
|
const nextInput = this.inputRefs[idx + 1];
|
|
16708
|
-
if (nextInput)
|
|
16907
|
+
if (nextInput)
|
|
16709
16908
|
nextInput.focus();
|
|
16710
|
-
}
|
|
16711
16909
|
this.setValidity();
|
|
16712
16910
|
this.setErrorMessage();
|
|
16713
16911
|
};
|
|
@@ -16736,6 +16934,8 @@ const TwofaInput = class {
|
|
|
16736
16934
|
this.destination = '';
|
|
16737
16935
|
this.resendIntervalSeconds = 60;
|
|
16738
16936
|
this.clientStyling = '';
|
|
16937
|
+
this.enableSouthAfricanMode = undefined;
|
|
16938
|
+
this.pinAttemptsExceeded = undefined;
|
|
16739
16939
|
this.clientStylingUrl = '';
|
|
16740
16940
|
this.mbSource = undefined;
|
|
16741
16941
|
this.limitStylingAppends = false;
|
|
@@ -16745,10 +16945,7 @@ const TwofaInput = class {
|
|
|
16745
16945
|
this.errorMessage = '';
|
|
16746
16946
|
this.code = [];
|
|
16747
16947
|
this.resendIntervalSecondsLeft = this.resendIntervalSeconds;
|
|
16748
|
-
|
|
16749
|
-
handleStylingChange(newValue, oldValue) {
|
|
16750
|
-
if (newValue !== oldValue)
|
|
16751
|
-
this.setClientStyling();
|
|
16948
|
+
this.revealedIndexes = [];
|
|
16752
16949
|
}
|
|
16753
16950
|
validityChanged() {
|
|
16754
16951
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
@@ -16777,6 +16974,10 @@ const TwofaInput = class {
|
|
|
16777
16974
|
this.showTooltip = false;
|
|
16778
16975
|
}
|
|
16779
16976
|
}
|
|
16977
|
+
handleStylingChange(newValue, oldValue) {
|
|
16978
|
+
if (newValue !== oldValue)
|
|
16979
|
+
this.setClientStyling();
|
|
16980
|
+
}
|
|
16780
16981
|
connectedCallback() {
|
|
16781
16982
|
this.validationPattern = this.setPattern();
|
|
16782
16983
|
this.code = new Array(this.validation.maxLength).fill('');
|
|
@@ -16811,37 +17012,51 @@ const TwofaInput = class {
|
|
|
16811
17012
|
}
|
|
16812
17013
|
handleKeyDown(e, idx) {
|
|
16813
17014
|
if (e.key === 'Backspace') {
|
|
16814
|
-
this.code
|
|
16815
|
-
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
if (prevInput) {
|
|
16820
|
-
prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
|
|
17015
|
+
const newCode = [...this.code];
|
|
17016
|
+
newCode[idx] = '';
|
|
17017
|
+
this.code = newCode;
|
|
17018
|
+
if (this.enableSouthAfricanMode) {
|
|
17019
|
+
this.revealedIndexes = this.revealedIndexes.filter(i => i !== idx);
|
|
16821
17020
|
}
|
|
17021
|
+
const prevInput = this.inputRefs[idx - 1];
|
|
17022
|
+
prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
|
|
16822
17023
|
}
|
|
16823
17024
|
this.setValidity();
|
|
16824
17025
|
this.setErrorMessage();
|
|
16825
17026
|
}
|
|
16826
17027
|
handlePaste(e) {
|
|
16827
|
-
var _a;
|
|
17028
|
+
var _a, _b;
|
|
16828
17029
|
e.preventDefault();
|
|
16829
|
-
const data = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text').trim();
|
|
16830
|
-
if (!data)
|
|
17030
|
+
const data = (_b = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) === null || _b === void 0 ? void 0 : _b.trim();
|
|
17031
|
+
if (!data)
|
|
16831
17032
|
return;
|
|
17033
|
+
const value = data.slice(0, this.validation.maxLength).split('');
|
|
17034
|
+
this.code = [
|
|
17035
|
+
...value,
|
|
17036
|
+
...new Array(this.validation.maxLength - value.length).fill('')
|
|
17037
|
+
];
|
|
17038
|
+
if (this.enableSouthAfricanMode) {
|
|
17039
|
+
this.revealedIndexes = value.map((_, i) => i);
|
|
17040
|
+
if (this.revealTimeout)
|
|
17041
|
+
clearTimeout(this.revealTimeout);
|
|
17042
|
+
this.revealTimeout = setTimeout(() => {
|
|
17043
|
+
this.revealedIndexes = [];
|
|
17044
|
+
}, 500);
|
|
16832
17045
|
}
|
|
16833
|
-
const value = data.slice(0, this.validation.maxLength).split(''); // Limit to OTP length
|
|
16834
|
-
this.code = [...value, ...new Array(this.validation.maxLength - value.length).fill('')];
|
|
16835
|
-
value.forEach((char, index) => {
|
|
16836
|
-
this.inputRefs[index].value = char;
|
|
16837
|
-
});
|
|
16838
|
-
// Move focus to the last input or trigger submit
|
|
16839
17046
|
const lastInput = this.inputRefs[Math.min(value.length, this.inputRefs.length - 1)];
|
|
16840
|
-
|
|
16841
|
-
lastInput.focus();
|
|
16842
|
-
}
|
|
17047
|
+
lastInput === null || lastInput === void 0 ? void 0 : lastInput.focus();
|
|
16843
17048
|
this.setValidity();
|
|
16844
17049
|
this.setErrorMessage();
|
|
17050
|
+
if (this.enableSouthAfricanMode) {
|
|
17051
|
+
this.valueHandler({
|
|
17052
|
+
name: this.name,
|
|
17053
|
+
value: this.code.join('')
|
|
17054
|
+
});
|
|
17055
|
+
this.validityStateHandler({
|
|
17056
|
+
valid: this.isValid,
|
|
17057
|
+
name: this.name
|
|
17058
|
+
});
|
|
17059
|
+
}
|
|
16845
17060
|
}
|
|
16846
17061
|
setValidity() {
|
|
16847
17062
|
const code = this.code.join('');
|
|
@@ -16874,19 +17089,28 @@ const TwofaInput = class {
|
|
|
16874
17089
|
}
|
|
16875
17090
|
return null;
|
|
16876
17091
|
}
|
|
17092
|
+
getInputDisplayValue(idx) {
|
|
17093
|
+
const current = this.code[idx];
|
|
17094
|
+
if (!current)
|
|
17095
|
+
return "";
|
|
17096
|
+
if (this.enableSouthAfricanMode) {
|
|
17097
|
+
return this.revealedIndexes.includes(idx) ? current : "*";
|
|
17098
|
+
}
|
|
17099
|
+
return current;
|
|
17100
|
+
}
|
|
16877
17101
|
render() {
|
|
16878
|
-
return (h$1("div", { key: '
|
|
16879
|
-
return (h$1("input", { key: idx, ref: el => this.setInputRef(el, idx), id: `otp-input-${idx}`, type: "text", maxLength: 2, value:
|
|
16880
|
-
})), h$1("div", { key: '
|
|
17102
|
+
return (h$1("div", { key: '56a639eb6e240482078fc7aaf688c75ae3de04c8', class: "twofa", ref: el => this.stylingContainer = el }, h$1("div", { key: 'a64039a3ed66556a0dc1bbac7b6fd6d60de23fa3', class: 'twofa__error-message' }, h$1("p", { key: '21adf57c840d51714ab097e9df3cc77e22be611f' }, this.errorMessage)), h$1("div", { key: '6653201178b40bc1eb5d6e7d881f2bbe150901f3', class: "twofa__description", innerHTML: translate$1('twofaDescription', this.language, { values: { destination: this.destination } }) }), h$1("div", { key: 'ca7600034af473838b741d5be4fe72ded9937647', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((_, idx) => {
|
|
17103
|
+
return (h$1("input", { key: idx, ref: el => this.setInputRef(el, idx), id: `otp-input-${idx}`, type: "text", maxLength: 2, value: this.getInputDisplayValue(idx), onInput: (event) => this.handleInput(event, idx), onKeyDown: (event) => this.handleKeyDown(event, idx), onPaste: (event) => this.handlePaste(event) }));
|
|
17104
|
+
})), h$1("div", { key: '0ecd60dd5e6b3f6c3a86176e1937e7aeeffc0e92', class: "twofa__button-wrapper" }, h$1("p", { key: 'fa9608598580bb8628d0e7a208cc69e3ebe83264', class: "twofa__resend-message" }, translate$1('twofaResendMessage', this.language)), h$1("button", { key: 'c70ea6e780eefc8fef0002fdcc10286ae0e66619', class: `twofa__resend-button ${this.pinAttemptsExceeded ? 'twofa__resend-button--disabled' : ''}`, onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable || this.pinAttemptsExceeded }, this.isResendButtonAvailable
|
|
16881
17105
|
? translate$1('twofaResendButton', this.language)
|
|
16882
17106
|
: this.formatTime()))));
|
|
16883
17107
|
}
|
|
16884
17108
|
get host() { return getElement(this); }
|
|
16885
17109
|
static get watchers() { return {
|
|
16886
|
-
"clientStyling": ["handleStylingChange"],
|
|
16887
17110
|
"isValid": ["validityChanged"],
|
|
16888
17111
|
"emitValue": ["emitValueHandler"],
|
|
16889
|
-
"clientStylingUrl": ["handleStylingUrlChange"]
|
|
17112
|
+
"clientStylingUrl": ["handleStylingUrlChange"],
|
|
17113
|
+
"clientStyling": ["handleStylingChange"]
|
|
16890
17114
|
}; }
|
|
16891
17115
|
};
|
|
16892
17116
|
TwofaInput.style = TwofaInputStyle0;
|