@everymatrix/pam-change-password 1.87.0 → 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_16.cjs.entry.js +310 -86
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pam-change-password.cjs.js +1 -1
- package/dist/esm/checkbox-group-input_16.entry.js +310 -86
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pam-change-password.js +1 -1
- package/dist/pam-change-password/checkbox-group-input_16.entry.js +240 -240
- package/dist/pam-change-password/pam-change-password.esm.js +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,10 @@ const TRANSLATIONS = {
|
|
|
32
32
|
"enterIEAddressManually": "For IRE, enter the address manually",
|
|
33
33
|
"postalLookUpNoAddressFound": "No addresses found for this postal code",
|
|
34
34
|
"searchingForAddresses": "Searching for addresses...",
|
|
35
|
+
"SAIdLengthError": "SA ID must be 13 digits",
|
|
36
|
+
"SAIdInvalidError": "Invalid SA ID",
|
|
37
|
+
"PassportLengthError": "Passport number must be 8 or 9 digits.",
|
|
38
|
+
"PasswordMustContain": "Password must contain:"
|
|
35
39
|
},
|
|
36
40
|
"hu": {
|
|
37
41
|
"dateError": "A választott dátumnak {min} és {max} között kell lennie",
|
|
@@ -58,7 +62,11 @@ const TRANSLATIONS = {
|
|
|
58
62
|
"InvalidDocumentNumber": "Csak számjegyek engedélyezettek.",
|
|
59
63
|
"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>",
|
|
60
64
|
"twofaResendMessage": "Nem kapta meg a megerősítő kódot?",
|
|
61
|
-
"twofaResendButton": "Újraküldés"
|
|
65
|
+
"twofaResendButton": "Újraküldés",
|
|
66
|
+
"PassportLengthError": "Az útlevélszámnak 9 számjegyűnek kell lennie",
|
|
67
|
+
"SAIdLengthError": "A dél-afrikai személyi számnak 13 számjegyűnek kell lennie",
|
|
68
|
+
"SAIdInvalidError": "Érvénytelen dél-afrikai személyi szám",
|
|
69
|
+
"PasswordMustContain": "A jelszónak tartalmaznia kell:"
|
|
62
70
|
},
|
|
63
71
|
"hr": {
|
|
64
72
|
"dateError": "Odabrani datum treba biti između {min} i {max}",
|
|
@@ -85,7 +93,11 @@ const TRANSLATIONS = {
|
|
|
85
93
|
"InvalidDocumentNumber": "Dopušteni su samo numerički znakovi.",
|
|
86
94
|
"twofaDescription": "<p> Poslali smo verifikacijski kod na: <p> {destination}. </p> </p> <p> Molimo unesite PIN ispod. </p>",
|
|
87
95
|
"twofaResendMessage": "Niste primili verifikacijski kod?",
|
|
88
|
-
"twofaResendButton": "Ponovno pošalji"
|
|
96
|
+
"twofaResendButton": "Ponovno pošalji",
|
|
97
|
+
"PassportLengthError": "Broj putovnice mora imati 9 znamenki",
|
|
98
|
+
"SAIdLengthError": "Južnoafrički osobni broj mora imati 13 znamenki",
|
|
99
|
+
"SAIdInvalidError": "Nevažeći južnoafrički osobni broj",
|
|
100
|
+
"PasswordMustContain": "Lozinka mora sadržavati:"
|
|
89
101
|
},
|
|
90
102
|
"tr": {
|
|
91
103
|
"dateError": "Seçilen tarih {min} ve {max} arasında olmalıdır",
|
|
@@ -112,7 +124,11 @@ const TRANSLATIONS = {
|
|
|
112
124
|
"InvalidDocumentNumber": "Sadece sayısal karakterlere izin verilir.",
|
|
113
125
|
"twofaDescription": "<p> Doğrulama kodunu şu adrese gönderdik: <p> {destination}. </p> </p> <p> Lütfen aşağıya PIN kodunu girin. </p>",
|
|
114
126
|
"twofaResendMessage": "Doğrulama kodunu almadınız mı?",
|
|
115
|
-
"twofaResendButton": "Yeniden gönder"
|
|
127
|
+
"twofaResendButton": "Yeniden gönder",
|
|
128
|
+
"PassportLengthError": "Pasaport numarası 9 haneli olmalıdır",
|
|
129
|
+
"SAIdLengthError": "Güney Afrika kimlik numarası 13 haneli olmalıdır",
|
|
130
|
+
"SAIdInvalidError": "Geçersiz Güney Afrika kimlik numarası",
|
|
131
|
+
"PasswordMustContain": "Şifre şunları içermelidir:"
|
|
116
132
|
},
|
|
117
133
|
"pt-br": {
|
|
118
134
|
"dateError": "A data selecionada deve estar entre {min} e {max}",
|
|
@@ -139,7 +155,11 @@ const TRANSLATIONS = {
|
|
|
139
155
|
"InvalidDocumentNumber": "Apenas caracteres numéricos são permitidos.",
|
|
140
156
|
"twofaDescription": "<p> Enviamos o código de verificação para: <p> {destination}. </p> </p> <p> Por favor, insira o PIN abaixo. </p>",
|
|
141
157
|
"twofaResendMessage": "Não recebeu o código de verificação?",
|
|
142
|
-
"twofaResendButton": "Reenviar"
|
|
158
|
+
"twofaResendButton": "Reenviar",
|
|
159
|
+
"PassportLengthError": "O número do passaporte deve ter 9 dígitos",
|
|
160
|
+
"SAIdLengthError": "O número de identificação da África do Sul deve ter 13 dígitos",
|
|
161
|
+
"SAIdInvalidError": "Número de identificação da África do Sul inválido",
|
|
162
|
+
"PasswordMustContain": "A senha deve conter:"
|
|
143
163
|
},
|
|
144
164
|
"es-mx": {
|
|
145
165
|
"dateError": "La fecha seleccionada debe ser entre {min} y {max}",
|
|
@@ -166,9 +186,40 @@ const TRANSLATIONS = {
|
|
|
166
186
|
"InvalidDocumentNumber": "Solo se permiten caracteres numéricos.",
|
|
167
187
|
"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>",
|
|
168
188
|
"twofaResendMessage": "¿No recibiste el código de verificación?",
|
|
169
|
-
"twofaResendButton": "Reenviar"
|
|
189
|
+
"twofaResendButton": "Reenviar",
|
|
190
|
+
"PassportLengthError": "El número de pasaporte debe tener 9 dígitos",
|
|
191
|
+
"SAIdLengthError": "El número de identificación de Sudáfrica debe tener 13 dígitos",
|
|
192
|
+
"SAIdInvalidError": "Número de identificación de Sudáfrica inválido",
|
|
193
|
+
"PasswordMustContain": "La contraseña debe contener:"
|
|
170
194
|
}
|
|
171
195
|
};
|
|
196
|
+
const CONSTANTS = {
|
|
197
|
+
DOCUMENT_NUMBER: "DocumentNumber",
|
|
198
|
+
FIRSTNAME_ON_DOCUMENT: "FirstnameOnDocument",
|
|
199
|
+
LASTNAME_ON_DOCUMENT: "LastnameOnDocument",
|
|
200
|
+
PASSPORT: "Passport",
|
|
201
|
+
SOUTH_AFRICAN_ID: "SouthAfricanID",
|
|
202
|
+
BIRTHDATE: "BirthDate",
|
|
203
|
+
PASSPORT_NUMERIC_REGEX: /^\d{8,9}$/,
|
|
204
|
+
SA_ID_BASIC_REGEX: /^\d{13}$/,
|
|
205
|
+
SOUTH_AFRICAN_ID_LENGTH: 13,
|
|
206
|
+
NON_LETTERS_REGEX: /[^A-Za-z]/g,
|
|
207
|
+
DATE_FORMAT: "yyyy-MM-dd",
|
|
208
|
+
PASSWORD_COMPLEXITY_PASSED: "passed",
|
|
209
|
+
PASSWORD_COMPLEXITY_FAILED: "failed"
|
|
210
|
+
};
|
|
211
|
+
const ERROR_KEYS = {
|
|
212
|
+
PASSPORT_INVALID: 'PassportLengthError',
|
|
213
|
+
SA_ID_LENGTH: 'SAIdLengthError',
|
|
214
|
+
SA_ID_INVALID: 'SAIdInvalidError',
|
|
215
|
+
REQUIRED: 'requiredError',
|
|
216
|
+
LENGTH: 'lengthError',
|
|
217
|
+
DUPLICATE: 'duplicateInputError',
|
|
218
|
+
};
|
|
219
|
+
const STATUS_ICONS = {
|
|
220
|
+
PASSED: '✓',
|
|
221
|
+
FAILED: '✕',
|
|
222
|
+
};
|
|
172
223
|
const translate = (key, customLang, values) => {
|
|
173
224
|
const lang = customLang;
|
|
174
225
|
let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
|
|
@@ -195,6 +246,27 @@ const getTranslations = (url) => {
|
|
|
195
246
|
});
|
|
196
247
|
});
|
|
197
248
|
};
|
|
249
|
+
const validateID = (id) => {
|
|
250
|
+
if (!CONSTANTS.SA_ID_BASIC_REGEX.test(id))
|
|
251
|
+
return false;
|
|
252
|
+
const digits = id.split("").map(n => parseInt(n, 10));
|
|
253
|
+
let oddSum = 0;
|
|
254
|
+
for (let i = 0; i < 12; i += 2) {
|
|
255
|
+
oddSum += digits[i];
|
|
256
|
+
}
|
|
257
|
+
let evenConcat = "";
|
|
258
|
+
for (let i = 1; i < 12; i += 2) {
|
|
259
|
+
evenConcat += digits[i];
|
|
260
|
+
}
|
|
261
|
+
const evenNumber = parseInt(evenConcat, 10) * 2;
|
|
262
|
+
const evenSum = evenNumber
|
|
263
|
+
.toString()
|
|
264
|
+
.split("")
|
|
265
|
+
.reduce((s, n) => s + parseInt(n, 10), 0);
|
|
266
|
+
const total = oddSum + evenSum;
|
|
267
|
+
let checkDigit = (10 - (total % 10)) % 10;
|
|
268
|
+
return checkDigit === digits[12];
|
|
269
|
+
};
|
|
198
270
|
|
|
199
271
|
const tooltipIconSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjUuNSIgc3Ryb2tlPSIjOTc5Nzk3Ii8+CjxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSIyIiBoZWlnaHQ9IjUiIGZpbGw9IiM5Nzk3OTciLz4KPGNpcmNsZSBjeD0iNiIgY3k9IjMiIHI9IjEiIGZpbGw9IiM5Nzk3OTciLz4KPC9zdmc+Cg==';
|
|
200
272
|
|
|
@@ -5818,6 +5890,21 @@ const DateInput = class {
|
|
|
5818
5890
|
sheet.innerHTML = this.clientStyling;
|
|
5819
5891
|
this.stylingContainer.prepend(sheet);
|
|
5820
5892
|
};
|
|
5893
|
+
this.handleDocumentIdUpdate = (e) => {
|
|
5894
|
+
if (this.name !== CONSTANTS.BIRTHDATE) {
|
|
5895
|
+
return;
|
|
5896
|
+
}
|
|
5897
|
+
const dateStr = e.detail;
|
|
5898
|
+
this.value = dateStr;
|
|
5899
|
+
this.valueAsDate = parse(this.value || '', CONSTANTS.DATE_FORMAT, new Date());
|
|
5900
|
+
this.touched = true;
|
|
5901
|
+
if (this.datePicker) {
|
|
5902
|
+
this.datePicker.value = this.value;
|
|
5903
|
+
}
|
|
5904
|
+
this.isValid = this.setValidity();
|
|
5905
|
+
this.errorMessage = this.setErrorMessage();
|
|
5906
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
5907
|
+
};
|
|
5821
5908
|
this.name = undefined;
|
|
5822
5909
|
this.displayName = undefined;
|
|
5823
5910
|
this.placeholder = undefined;
|
|
@@ -5830,6 +5917,7 @@ const DateInput = class {
|
|
|
5830
5917
|
this.clientStyling = '';
|
|
5831
5918
|
this.dateFormat = 'yyyy-MM-dd';
|
|
5832
5919
|
this.emitOnClick = false;
|
|
5920
|
+
this.enableSouthAfricanMode = undefined;
|
|
5833
5921
|
this.errorMessage = undefined;
|
|
5834
5922
|
this.isValid = undefined;
|
|
5835
5923
|
this.limitStylingAppends = false;
|
|
@@ -5859,6 +5947,14 @@ const DateInput = class {
|
|
|
5859
5947
|
this.valueHandler({ name: this.name, value: this.value });
|
|
5860
5948
|
}
|
|
5861
5949
|
}
|
|
5950
|
+
handleCustomRegistrationChange(newValue) {
|
|
5951
|
+
if (newValue) {
|
|
5952
|
+
window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
5953
|
+
}
|
|
5954
|
+
else {
|
|
5955
|
+
window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5862
5958
|
valueHandler(inputValueEvent) {
|
|
5863
5959
|
this.sendInputValue.emit(inputValueEvent);
|
|
5864
5960
|
}
|
|
@@ -5902,6 +5998,9 @@ const DateInput = class {
|
|
|
5902
5998
|
}
|
|
5903
5999
|
});
|
|
5904
6000
|
}
|
|
6001
|
+
if (this.enableSouthAfricanMode) {
|
|
6002
|
+
window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
6003
|
+
}
|
|
5905
6004
|
this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
|
|
5906
6005
|
if (this.defaultValue) {
|
|
5907
6006
|
this.value = this.defaultValue;
|
|
@@ -5909,6 +6008,11 @@ const DateInput = class {
|
|
|
5909
6008
|
}
|
|
5910
6009
|
this.isValid = this.setValidity();
|
|
5911
6010
|
}
|
|
6011
|
+
disconnectedCallback() {
|
|
6012
|
+
if (this.enableSouthAfricanMode) {
|
|
6013
|
+
window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
6014
|
+
}
|
|
6015
|
+
}
|
|
5912
6016
|
handleCalendarIconClick() {
|
|
5913
6017
|
if (this.datePicker.opened && this.emitOnClick) {
|
|
5914
6018
|
window.postMessage({ type: `registration${this.name}Clicked` }, window.location.href);
|
|
@@ -5921,6 +6025,11 @@ const DateInput = class {
|
|
|
5921
6025
|
this.isValid = this.setValidity();
|
|
5922
6026
|
this.errorMessage = this.setErrorMessage();
|
|
5923
6027
|
this.emitValueHandler(true);
|
|
6028
|
+
if (this.enableSouthAfricanMode) {
|
|
6029
|
+
window.dispatchEvent(new CustomEvent('birthDateUpdated', {
|
|
6030
|
+
detail: { birthDate: this.value }
|
|
6031
|
+
}));
|
|
6032
|
+
}
|
|
5924
6033
|
}
|
|
5925
6034
|
setValidity() {
|
|
5926
6035
|
if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate) || !isMatch(this.formattedValue, this.dateFormat)) {
|
|
@@ -5955,14 +6064,15 @@ const DateInput = class {
|
|
|
5955
6064
|
if (this.touched) {
|
|
5956
6065
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
5957
6066
|
}
|
|
5958
|
-
return h("div", { key: '
|
|
5959
|
-
h("img", { key: '
|
|
6067
|
+
return h("div", { key: '9399c1be2edcbe3ed5c0e133cad52b1917e77e96', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("label", { key: '1094491a5fc441c4f704441d376ed965d6946637', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("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("small", { key: '67c1b6a0daafee536ab7179d1fe90a2870bb12b1', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
|
|
6068
|
+
h("img", { key: '4d02f23affc8ce9f5eb41a44fd2f346960c6d458', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
5960
6069
|
}
|
|
5961
6070
|
get element() { return getElement(this); }
|
|
5962
6071
|
static get watchers() { return {
|
|
5963
6072
|
"clientStyling": ["handleStylingChange"],
|
|
5964
6073
|
"isValid": ["validityChanged"],
|
|
5965
|
-
"emitValue": ["emitValueHandler"]
|
|
6074
|
+
"emitValue": ["emitValueHandler"],
|
|
6075
|
+
"enableSouthAfricanMode": ["handleCustomRegistrationChange"]
|
|
5966
6076
|
}; }
|
|
5967
6077
|
};
|
|
5968
6078
|
DateInput.style = DateInputStyle0;
|
|
@@ -12843,6 +12953,8 @@ const GeneralInput = class {
|
|
|
12843
12953
|
this.postalcodelength = undefined;
|
|
12844
12954
|
this.addresses = [];
|
|
12845
12955
|
this.ignoreCountry = false;
|
|
12956
|
+
this.enableSouthAfricanMode = undefined;
|
|
12957
|
+
this.pinAttemptsExceeded = undefined;
|
|
12846
12958
|
this.mbSource = undefined;
|
|
12847
12959
|
this.limitStylingAppends = false;
|
|
12848
12960
|
}
|
|
@@ -12886,7 +12998,7 @@ const GeneralInput = class {
|
|
|
12886
12998
|
return h("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 });
|
|
12887
12999
|
}
|
|
12888
13000
|
else {
|
|
12889
|
-
return h("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 });
|
|
13001
|
+
return h("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 });
|
|
12890
13002
|
}
|
|
12891
13003
|
case 'email':
|
|
12892
13004
|
return h("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 });
|
|
@@ -12899,9 +13011,9 @@ const GeneralInput = class {
|
|
|
12899
13011
|
case 'togglecheckbox':
|
|
12900
13012
|
return h("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 });
|
|
12901
13013
|
case 'datetime':
|
|
12902
|
-
return h("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 });
|
|
13014
|
+
return h("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 });
|
|
12903
13015
|
case 'password':
|
|
12904
|
-
return h("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 });
|
|
13016
|
+
return h("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 });
|
|
12905
13017
|
case 'radio':
|
|
12906
13018
|
return h("radio-input", { name: this.name, displayName: this.displayName, optionsGroup: this.options, validation: this.validation, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling });
|
|
12907
13019
|
case 'tel':
|
|
@@ -12909,13 +13021,13 @@ const GeneralInput = class {
|
|
|
12909
13021
|
case 'dropdown':
|
|
12910
13022
|
return h("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 });
|
|
12911
13023
|
case 'twofa':
|
|
12912
|
-
return h("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 });
|
|
13024
|
+
return h("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 });
|
|
12913
13025
|
default:
|
|
12914
13026
|
return h("p", null, "The ", this.type, " input type is not valid");
|
|
12915
13027
|
}
|
|
12916
13028
|
}
|
|
12917
13029
|
render() {
|
|
12918
|
-
return (h(Host, { key: '
|
|
13030
|
+
return (h(Host, { key: '7d036183d9376203451d9805e76b608cfa63570b', class: `general-input--${this.name}`, onClick: this.handleClick }, this.renderInput()));
|
|
12919
13031
|
}
|
|
12920
13032
|
get host() { return getElement(this); }
|
|
12921
13033
|
static get watchers() { return {
|
|
@@ -13063,7 +13175,7 @@ const NumberInput = class {
|
|
|
13063
13175
|
};
|
|
13064
13176
|
NumberInput.style = NumberInputStyle0;
|
|
13065
13177
|
|
|
13066
|
-
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}";
|
|
13178
|
+
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}";
|
|
13067
13179
|
const PasswordInputStyle0 = passwordInputCss;
|
|
13068
13180
|
|
|
13069
13181
|
const PasswordInput = class {
|
|
@@ -13123,6 +13235,7 @@ const PasswordInput = class {
|
|
|
13123
13235
|
this.isDuplicateInput = undefined;
|
|
13124
13236
|
this.hidePasswordComplexity = false;
|
|
13125
13237
|
this.clientStyling = '';
|
|
13238
|
+
this.enableSouthAfricanMode = undefined;
|
|
13126
13239
|
this.isValid = undefined;
|
|
13127
13240
|
this.errorMessage = undefined;
|
|
13128
13241
|
this.limitStylingAppends = false;
|
|
@@ -13301,13 +13414,23 @@ const PasswordInput = class {
|
|
|
13301
13414
|
return (h("div", { key: index }, h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h("span", null, translate(`${complexity.ruleKey}`, this.language) ? translate(`${complexity.ruleKey}`, this.language) : complexity.rule)));
|
|
13302
13415
|
}))));
|
|
13303
13416
|
}
|
|
13417
|
+
renderCustomComplexityPopup() {
|
|
13418
|
+
return (h("div", { class: `customreg-password__complexity ${!this.showPopup ? 'customreg-password__complexity--hidden' : ''}` }, h("p", { class: 'customreg-password__complexity--title' }, translate('PasswordMustContain', this.language)), h("div", { class: 'customreg-password__complexity--rules' }, this.passwordComplexity.map((complexity, index) => (h("div", { class: 'customreg-password__complexity--rule', key: index }, h("span", { class: `customreg-password__complexity--icon ${complexity.passed
|
|
13419
|
+
? CONSTANTS.PASSWORD_COMPLEXITY_PASSED : CONSTANTS.PASSWORD_COMPLEXITY_FAILED}` }, complexity.passed ? STATUS_ICONS.PASSED : STATUS_ICONS.FAILED), h("span", null, translate(complexity.ruleKey, this.language) || complexity.rule)))))));
|
|
13420
|
+
}
|
|
13304
13421
|
render() {
|
|
13305
13422
|
let invalidClass = '';
|
|
13306
13423
|
if (this.touched) {
|
|
13307
13424
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
13308
13425
|
}
|
|
13309
|
-
return h("div", { key: '
|
|
13310
|
-
h("img", { key: '
|
|
13426
|
+
return h("div", { key: 'c2dd473e71853ebb3d0b5b6245af606f75f8b479', class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '4ba641a832be3b8efb1957af5f45eb7b7cc69adc', class: 'password__wrapper--flex' }, h("label", { key: 'a4440e8b59a743831fa833d8e1c680c01cfcb93e', class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: '2e194f2096a69bc691694be0ac49004a54aa3cde', class: 'password__wrapper--relative' }, this.tooltip &&
|
|
13427
|
+
h("img", { key: 'eafce2331ec867fcd8abc253d3605f5214557b8b', class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("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("small", { key: 'd20a6946d4757da4311f33b2770079cc7f80bcfa', class: 'password__error-message' }, this.errorMessage), this.passwordComplexity &&
|
|
13428
|
+
this.showPopup &&
|
|
13429
|
+
!this.hidePasswordComplexity &&
|
|
13430
|
+
!this.isDuplicateInput &&
|
|
13431
|
+
(this.enableSouthAfricanMode
|
|
13432
|
+
? this.renderCustomComplexityPopup()
|
|
13433
|
+
: this.renderComplexityPopup()));
|
|
13311
13434
|
}
|
|
13312
13435
|
get element() { return getElement(this); }
|
|
13313
13436
|
static get watchers() { return {
|
|
@@ -14177,24 +14300,28 @@ const TextInput = class {
|
|
|
14177
14300
|
this.postalcodelength = 5;
|
|
14178
14301
|
this.touched = false;
|
|
14179
14302
|
this.handleInput = (event) => {
|
|
14180
|
-
|
|
14303
|
+
const input = event.target;
|
|
14304
|
+
const normalizedValue = this.enableSouthAfricanMode &&
|
|
14305
|
+
(this.name === CONSTANTS.FIRSTNAME_ON_DOCUMENT ||
|
|
14306
|
+
this.name === CONSTANTS.LASTNAME_ON_DOCUMENT)
|
|
14307
|
+
? input.value.replace(CONSTANTS.NON_LETTERS_REGEX, '')
|
|
14308
|
+
: input.value;
|
|
14309
|
+
if (normalizedValue !== input.value) {
|
|
14310
|
+
input.value = normalizedValue;
|
|
14311
|
+
}
|
|
14312
|
+
this.value = normalizedValue;
|
|
14181
14313
|
this.touched = true;
|
|
14182
|
-
if (this.debounceTime)
|
|
14314
|
+
if (this.debounceTime)
|
|
14183
14315
|
clearTimeout(this.debounceTime);
|
|
14184
|
-
}
|
|
14185
14316
|
this.debounceTime = setTimeout(() => {
|
|
14186
|
-
this.
|
|
14187
|
-
this.errorMessage = this.setErrorMessage();
|
|
14188
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14317
|
+
this.updateValidationState();
|
|
14189
14318
|
this.emitValueHandler(true);
|
|
14190
14319
|
}, 500);
|
|
14191
14320
|
};
|
|
14192
14321
|
this.handleBlur = (event) => {
|
|
14193
14322
|
this.value = event.target.value;
|
|
14194
14323
|
this.touched = true;
|
|
14195
|
-
this.
|
|
14196
|
-
this.errorMessage = this.setErrorMessage();
|
|
14197
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14324
|
+
this.updateValidationState();
|
|
14198
14325
|
};
|
|
14199
14326
|
this.setClientStyling = () => {
|
|
14200
14327
|
let sheet = document.createElement('style');
|
|
@@ -14214,6 +14341,7 @@ const TextInput = class {
|
|
|
14214
14341
|
this.isDuplicateInput = undefined;
|
|
14215
14342
|
this.clientStyling = '';
|
|
14216
14343
|
this.haspostalcodelookup = undefined;
|
|
14344
|
+
this.enableSouthAfricanMode = undefined;
|
|
14217
14345
|
this.isValid = undefined;
|
|
14218
14346
|
this.errorMessage = '';
|
|
14219
14347
|
this.limitStylingAppends = false;
|
|
@@ -14251,15 +14379,13 @@ const TextInput = class {
|
|
|
14251
14379
|
if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
|
|
14252
14380
|
this.duplicateInputValue = event.detail.value;
|
|
14253
14381
|
if (this.touched) {
|
|
14254
|
-
this.
|
|
14255
|
-
this.errorMessage = this.setErrorMessage();
|
|
14382
|
+
this.updateValidationState();
|
|
14256
14383
|
}
|
|
14257
14384
|
}
|
|
14258
|
-
if (this.name === event.detail.name + 'Duplicate'
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
this.
|
|
14262
|
-
this.errorMessage = this.setErrorMessage();
|
|
14385
|
+
if (this.name === event.detail.name + 'Duplicate' &&
|
|
14386
|
+
this.name.replace('Duplicate', '') === event.detail.name &&
|
|
14387
|
+
this.touched) {
|
|
14388
|
+
this.updateValidationState();
|
|
14263
14389
|
}
|
|
14264
14390
|
}
|
|
14265
14391
|
handleValidationChange(event) {
|
|
@@ -14269,7 +14395,7 @@ const TextInput = class {
|
|
|
14269
14395
|
this.validation = event.detail.validation;
|
|
14270
14396
|
this.validationPattern = this.setPattern();
|
|
14271
14397
|
if (this.touched) {
|
|
14272
|
-
this.isValid = this.
|
|
14398
|
+
this.isValid = this.isValidValue();
|
|
14273
14399
|
this.errorMessage = this.setErrorMessage();
|
|
14274
14400
|
}
|
|
14275
14401
|
}
|
|
@@ -14305,13 +14431,37 @@ const TextInput = class {
|
|
|
14305
14431
|
}
|
|
14306
14432
|
this.value = newValue;
|
|
14307
14433
|
this.touched = true;
|
|
14308
|
-
this.
|
|
14309
|
-
this.valueHandler({ name: this.name, value: newValue });
|
|
14310
|
-
this.validityStateHandler({ valid: true, name: this.name });
|
|
14434
|
+
this.updateValidationState();
|
|
14311
14435
|
}
|
|
14312
14436
|
connectedCallback() {
|
|
14313
14437
|
this.validationPattern = this.setPattern();
|
|
14314
14438
|
}
|
|
14439
|
+
handleExternalDocUpdate(event) {
|
|
14440
|
+
if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
|
|
14441
|
+
return;
|
|
14442
|
+
this.value = event.detail || "";
|
|
14443
|
+
this.touched = true;
|
|
14444
|
+
if (this.inputReference) {
|
|
14445
|
+
this.inputReference.value = this.value;
|
|
14446
|
+
}
|
|
14447
|
+
this.sendInputValue.emit({
|
|
14448
|
+
name: this.name,
|
|
14449
|
+
value: this.value
|
|
14450
|
+
});
|
|
14451
|
+
this.updateValidationState();
|
|
14452
|
+
}
|
|
14453
|
+
handleDocReset() {
|
|
14454
|
+
if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
|
|
14455
|
+
return;
|
|
14456
|
+
this.value = "";
|
|
14457
|
+
this.touched = false;
|
|
14458
|
+
this.isValid = false;
|
|
14459
|
+
this.errorMessage = "";
|
|
14460
|
+
if (this.inputReference) {
|
|
14461
|
+
this.inputReference.value = "";
|
|
14462
|
+
}
|
|
14463
|
+
this.validityStateHandler({ valid: false, name: this.name });
|
|
14464
|
+
}
|
|
14315
14465
|
componentDidRender() {
|
|
14316
14466
|
// start custom styling area
|
|
14317
14467
|
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
@@ -14328,6 +14478,7 @@ const TextInput = class {
|
|
|
14328
14478
|
}
|
|
14329
14479
|
componentDidLoad() {
|
|
14330
14480
|
if (this.defaultValue) {
|
|
14481
|
+
this.value = this.defaultValue;
|
|
14331
14482
|
this.valueHandler({ name: this.name, value: this.value });
|
|
14332
14483
|
if (this.isDuplicateInput) {
|
|
14333
14484
|
this.touched = true;
|
|
@@ -14339,18 +14490,49 @@ const TextInput = class {
|
|
|
14339
14490
|
window.targetInputRefs[this.name] = this.inputReference;
|
|
14340
14491
|
}
|
|
14341
14492
|
}
|
|
14342
|
-
this.isValid = this.
|
|
14493
|
+
this.isValid = this.isValidValue();
|
|
14343
14494
|
}
|
|
14344
|
-
|
|
14495
|
+
validateDocument(valueRaw, docType) {
|
|
14496
|
+
const value = valueRaw.trim();
|
|
14497
|
+
if (docType === CONSTANTS.PASSPORT) {
|
|
14498
|
+
const valid = CONSTANTS.PASSPORT_NUMERIC_REGEX.test(value);
|
|
14499
|
+
return valid
|
|
14500
|
+
? { valid: true }
|
|
14501
|
+
: { valid: false, errorKey: ERROR_KEYS.PASSPORT_INVALID };
|
|
14502
|
+
}
|
|
14503
|
+
if (docType === CONSTANTS.SOUTH_AFRICAN_ID) {
|
|
14504
|
+
if (value.length !== CONSTANTS.SOUTH_AFRICAN_ID_LENGTH) {
|
|
14505
|
+
return { valid: false, errorKey: ERROR_KEYS.SA_ID_LENGTH };
|
|
14506
|
+
}
|
|
14507
|
+
const valid = validateID(value);
|
|
14508
|
+
return valid
|
|
14509
|
+
? { valid: true }
|
|
14510
|
+
: { valid: false, errorKey: ERROR_KEYS.SA_ID_INVALID };
|
|
14511
|
+
}
|
|
14512
|
+
return { valid: true };
|
|
14513
|
+
}
|
|
14514
|
+
updateValidationState() {
|
|
14515
|
+
const nextValid = this.isValidValue();
|
|
14516
|
+
this.isValid = nextValid;
|
|
14517
|
+
if (!this.touched) {
|
|
14518
|
+
this.errorMessage = '';
|
|
14519
|
+
return;
|
|
14520
|
+
}
|
|
14521
|
+
this.errorMessage = nextValid ? '' : this.setErrorMessage();
|
|
14522
|
+
}
|
|
14523
|
+
isValidValue() {
|
|
14345
14524
|
if (!this.inputReference) {
|
|
14346
14525
|
return false;
|
|
14347
14526
|
}
|
|
14348
|
-
if (this.
|
|
14349
|
-
|
|
14527
|
+
if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
|
|
14528
|
+
const docType = window.documentTypeValue;
|
|
14529
|
+
return this.validateDocument(this.value, docType).valid;
|
|
14350
14530
|
}
|
|
14351
|
-
const
|
|
14352
|
-
|
|
14353
|
-
|
|
14531
|
+
const fallbackResult = (this.value.trim() === "" && !this.validation.mandatory) ||
|
|
14532
|
+
(this.inputReference.validity.valid &&
|
|
14533
|
+
(!this.inputReference.value ||
|
|
14534
|
+
this.inputReference.value.match(this.validationPattern) !== null));
|
|
14535
|
+
return fallbackResult;
|
|
14354
14536
|
}
|
|
14355
14537
|
setPattern() {
|
|
14356
14538
|
var _a, _b;
|
|
@@ -14360,14 +14542,25 @@ const TextInput = class {
|
|
|
14360
14542
|
}
|
|
14361
14543
|
setErrorMessage() {
|
|
14362
14544
|
var _a, _b, _c, _d;
|
|
14363
|
-
|
|
14545
|
+
const value = this.value.trim();
|
|
14546
|
+
if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
|
|
14547
|
+
const docType = window.documentTypeValue;
|
|
14548
|
+
const res = this.validateDocument(this.value, docType);
|
|
14549
|
+
return res.valid ? '' : translate(res.errorKey, this.language);
|
|
14550
|
+
}
|
|
14551
|
+
if (value === "" && !this.validation.mandatory) {
|
|
14364
14552
|
return "";
|
|
14365
14553
|
}
|
|
14366
14554
|
if (this.inputReference.validity.valueMissing) {
|
|
14367
|
-
return translate(
|
|
14555
|
+
return translate(ERROR_KEYS.REQUIRED, this.language);
|
|
14368
14556
|
}
|
|
14369
14557
|
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
14370
|
-
return translate(
|
|
14558
|
+
return translate(ERROR_KEYS.LENGTH, this.language, {
|
|
14559
|
+
values: {
|
|
14560
|
+
minLength: this.validation.minLength,
|
|
14561
|
+
maxLength: this.validation.maxLength
|
|
14562
|
+
}
|
|
14563
|
+
});
|
|
14371
14564
|
}
|
|
14372
14565
|
if (this.inputReference.value.match(this.validationPattern) == null) {
|
|
14373
14566
|
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
@@ -14379,6 +14572,7 @@ const TextInput = class {
|
|
|
14379
14572
|
const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
|
|
14380
14573
|
return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
|
|
14381
14574
|
}
|
|
14575
|
+
return "";
|
|
14382
14576
|
}
|
|
14383
14577
|
renderTooltip() {
|
|
14384
14578
|
if (this.showTooltip) {
|
|
@@ -14391,8 +14585,8 @@ const TextInput = class {
|
|
|
14391
14585
|
if (this.touched) {
|
|
14392
14586
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
14393
14587
|
}
|
|
14394
|
-
return h("div", { key: '
|
|
14395
|
-
h("img", { key: '
|
|
14588
|
+
return h("div", { key: '5b0bf10acadab5c3362d185cef10c5ed4f3a6a47', class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, h("div", { key: '6d79cc845aac8d9b11737d35571680d7701c4b94', class: 'text__wrapper--flex' }, h("label", { key: 'de687661fa037d691fe1da1231b651f564bca010', class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: '4d9b12a587267eaf6fab4c4f3c38befb8d5c2b99', class: 'text__wrapper--relative' }, this.tooltip &&
|
|
14589
|
+
h("img", { key: '7f27a118124cd0407b6c2644137a79eaa0496164', class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("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("small", { key: 'b9b3bdcd9cb81b56dc25a208b0c1d7784d06b5e0', class: 'text__error-message' }, this.errorMessage));
|
|
14396
14590
|
}
|
|
14397
14591
|
static get watchers() { return {
|
|
14398
14592
|
"clientStyling": ["handleStylingChange"],
|
|
@@ -14577,20 +14771,24 @@ const TwofaInput = class {
|
|
|
14577
14771
|
this.handleInput = (e, idx) => {
|
|
14578
14772
|
const input = e.target;
|
|
14579
14773
|
const value = input.value;
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
else {
|
|
14584
|
-
input.value = value.charAt(0);
|
|
14585
|
-
}
|
|
14586
|
-
if (!value) {
|
|
14774
|
+
const char = value.slice(-1);
|
|
14775
|
+
input.value = char;
|
|
14776
|
+
if (!char)
|
|
14587
14777
|
return;
|
|
14778
|
+
this.code[idx] = char;
|
|
14779
|
+
// --- Hide pin code --- //
|
|
14780
|
+
if (this.enableSouthAfricanMode) {
|
|
14781
|
+
// show character for 500ms
|
|
14782
|
+
this.revealedIndexes = [idx];
|
|
14783
|
+
if (this.revealTimeout)
|
|
14784
|
+
clearTimeout(this.revealTimeout);
|
|
14785
|
+
this.revealTimeout = setTimeout(() => {
|
|
14786
|
+
this.revealedIndexes = [];
|
|
14787
|
+
}, 500);
|
|
14588
14788
|
}
|
|
14589
|
-
this.code[idx] = input.value;
|
|
14590
14789
|
const nextInput = this.inputRefs[idx + 1];
|
|
14591
|
-
if (nextInput)
|
|
14790
|
+
if (nextInput)
|
|
14592
14791
|
nextInput.focus();
|
|
14593
|
-
}
|
|
14594
14792
|
this.setValidity();
|
|
14595
14793
|
this.setErrorMessage();
|
|
14596
14794
|
};
|
|
@@ -14619,6 +14817,8 @@ const TwofaInput = class {
|
|
|
14619
14817
|
this.destination = '';
|
|
14620
14818
|
this.resendIntervalSeconds = 60;
|
|
14621
14819
|
this.clientStyling = '';
|
|
14820
|
+
this.enableSouthAfricanMode = undefined;
|
|
14821
|
+
this.pinAttemptsExceeded = undefined;
|
|
14622
14822
|
this.clientStylingUrl = '';
|
|
14623
14823
|
this.mbSource = undefined;
|
|
14624
14824
|
this.limitStylingAppends = false;
|
|
@@ -14628,10 +14828,7 @@ const TwofaInput = class {
|
|
|
14628
14828
|
this.errorMessage = '';
|
|
14629
14829
|
this.code = [];
|
|
14630
14830
|
this.resendIntervalSecondsLeft = this.resendIntervalSeconds;
|
|
14631
|
-
|
|
14632
|
-
handleStylingChange(newValue, oldValue) {
|
|
14633
|
-
if (newValue !== oldValue)
|
|
14634
|
-
this.setClientStyling();
|
|
14831
|
+
this.revealedIndexes = [];
|
|
14635
14832
|
}
|
|
14636
14833
|
validityChanged() {
|
|
14637
14834
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
@@ -14660,6 +14857,10 @@ const TwofaInput = class {
|
|
|
14660
14857
|
this.showTooltip = false;
|
|
14661
14858
|
}
|
|
14662
14859
|
}
|
|
14860
|
+
handleStylingChange(newValue, oldValue) {
|
|
14861
|
+
if (newValue !== oldValue)
|
|
14862
|
+
this.setClientStyling();
|
|
14863
|
+
}
|
|
14663
14864
|
connectedCallback() {
|
|
14664
14865
|
this.validationPattern = this.setPattern();
|
|
14665
14866
|
this.code = new Array(this.validation.maxLength).fill('');
|
|
@@ -14694,37 +14895,51 @@ const TwofaInput = class {
|
|
|
14694
14895
|
}
|
|
14695
14896
|
handleKeyDown(e, idx) {
|
|
14696
14897
|
if (e.key === 'Backspace') {
|
|
14697
|
-
this.code
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
if (prevInput) {
|
|
14703
|
-
prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
|
|
14898
|
+
const newCode = [...this.code];
|
|
14899
|
+
newCode[idx] = '';
|
|
14900
|
+
this.code = newCode;
|
|
14901
|
+
if (this.enableSouthAfricanMode) {
|
|
14902
|
+
this.revealedIndexes = this.revealedIndexes.filter(i => i !== idx);
|
|
14704
14903
|
}
|
|
14904
|
+
const prevInput = this.inputRefs[idx - 1];
|
|
14905
|
+
prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
|
|
14705
14906
|
}
|
|
14706
14907
|
this.setValidity();
|
|
14707
14908
|
this.setErrorMessage();
|
|
14708
14909
|
}
|
|
14709
14910
|
handlePaste(e) {
|
|
14710
|
-
var _a;
|
|
14911
|
+
var _a, _b;
|
|
14711
14912
|
e.preventDefault();
|
|
14712
|
-
const data = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text').trim();
|
|
14713
|
-
if (!data)
|
|
14913
|
+
const data = (_b = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) === null || _b === void 0 ? void 0 : _b.trim();
|
|
14914
|
+
if (!data)
|
|
14714
14915
|
return;
|
|
14916
|
+
const value = data.slice(0, this.validation.maxLength).split('');
|
|
14917
|
+
this.code = [
|
|
14918
|
+
...value,
|
|
14919
|
+
...new Array(this.validation.maxLength - value.length).fill('')
|
|
14920
|
+
];
|
|
14921
|
+
if (this.enableSouthAfricanMode) {
|
|
14922
|
+
this.revealedIndexes = value.map((_, i) => i);
|
|
14923
|
+
if (this.revealTimeout)
|
|
14924
|
+
clearTimeout(this.revealTimeout);
|
|
14925
|
+
this.revealTimeout = setTimeout(() => {
|
|
14926
|
+
this.revealedIndexes = [];
|
|
14927
|
+
}, 500);
|
|
14715
14928
|
}
|
|
14716
|
-
const value = data.slice(0, this.validation.maxLength).split(''); // Limit to OTP length
|
|
14717
|
-
this.code = [...value, ...new Array(this.validation.maxLength - value.length).fill('')];
|
|
14718
|
-
value.forEach((char, index) => {
|
|
14719
|
-
this.inputRefs[index].value = char;
|
|
14720
|
-
});
|
|
14721
|
-
// Move focus to the last input or trigger submit
|
|
14722
14929
|
const lastInput = this.inputRefs[Math.min(value.length, this.inputRefs.length - 1)];
|
|
14723
|
-
|
|
14724
|
-
lastInput.focus();
|
|
14725
|
-
}
|
|
14930
|
+
lastInput === null || lastInput === void 0 ? void 0 : lastInput.focus();
|
|
14726
14931
|
this.setValidity();
|
|
14727
14932
|
this.setErrorMessage();
|
|
14933
|
+
if (this.enableSouthAfricanMode) {
|
|
14934
|
+
this.valueHandler({
|
|
14935
|
+
name: this.name,
|
|
14936
|
+
value: this.code.join('')
|
|
14937
|
+
});
|
|
14938
|
+
this.validityStateHandler({
|
|
14939
|
+
valid: this.isValid,
|
|
14940
|
+
name: this.name
|
|
14941
|
+
});
|
|
14942
|
+
}
|
|
14728
14943
|
}
|
|
14729
14944
|
setValidity() {
|
|
14730
14945
|
const code = this.code.join('');
|
|
@@ -14757,19 +14972,28 @@ const TwofaInput = class {
|
|
|
14757
14972
|
}
|
|
14758
14973
|
return null;
|
|
14759
14974
|
}
|
|
14975
|
+
getInputDisplayValue(idx) {
|
|
14976
|
+
const current = this.code[idx];
|
|
14977
|
+
if (!current)
|
|
14978
|
+
return "";
|
|
14979
|
+
if (this.enableSouthAfricanMode) {
|
|
14980
|
+
return this.revealedIndexes.includes(idx) ? current : "*";
|
|
14981
|
+
}
|
|
14982
|
+
return current;
|
|
14983
|
+
}
|
|
14760
14984
|
render() {
|
|
14761
|
-
return (h("div", { key: '
|
|
14762
|
-
return (h("input", { key: idx, ref: el => this.setInputRef(el, idx), id: `otp-input-${idx}`, type: "text", maxLength: 2, value:
|
|
14763
|
-
})), h("div", { key: '
|
|
14985
|
+
return (h("div", { key: '56a639eb6e240482078fc7aaf688c75ae3de04c8', class: "twofa", ref: el => this.stylingContainer = el }, h("div", { key: 'a64039a3ed66556a0dc1bbac7b6fd6d60de23fa3', class: 'twofa__error-message' }, h("p", { key: '21adf57c840d51714ab097e9df3cc77e22be611f' }, this.errorMessage)), h("div", { key: '6653201178b40bc1eb5d6e7d881f2bbe150901f3', class: "twofa__description", innerHTML: translate('twofaDescription', this.language, { values: { destination: this.destination } }) }), h("div", { key: 'ca7600034af473838b741d5be4fe72ded9937647', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((_, idx) => {
|
|
14986
|
+
return (h("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) }));
|
|
14987
|
+
})), h("div", { key: '0ecd60dd5e6b3f6c3a86176e1937e7aeeffc0e92', class: "twofa__button-wrapper" }, h("p", { key: 'fa9608598580bb8628d0e7a208cc69e3ebe83264', class: "twofa__resend-message" }, translate('twofaResendMessage', this.language)), h("button", { key: 'c70ea6e780eefc8fef0002fdcc10286ae0e66619', class: `twofa__resend-button ${this.pinAttemptsExceeded ? 'twofa__resend-button--disabled' : ''}`, onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable || this.pinAttemptsExceeded }, this.isResendButtonAvailable
|
|
14764
14988
|
? translate('twofaResendButton', this.language)
|
|
14765
14989
|
: this.formatTime()))));
|
|
14766
14990
|
}
|
|
14767
14991
|
get host() { return getElement(this); }
|
|
14768
14992
|
static get watchers() { return {
|
|
14769
|
-
"clientStyling": ["handleStylingChange"],
|
|
14770
14993
|
"isValid": ["validityChanged"],
|
|
14771
14994
|
"emitValue": ["emitValueHandler"],
|
|
14772
|
-
"clientStylingUrl": ["handleStylingUrlChange"]
|
|
14995
|
+
"clientStylingUrl": ["handleStylingUrlChange"],
|
|
14996
|
+
"clientStyling": ["handleStylingChange"]
|
|
14773
14997
|
}; }
|
|
14774
14998
|
};
|
|
14775
14999
|
TwofaInput.style = TwofaInputStyle0;
|