@everymatrix/pam-forgot-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.
@@ -36,6 +36,10 @@ const TRANSLATIONS = {
36
36
  "enterIEAddressManually": "For IRE, enter the address manually",
37
37
  "postalLookUpNoAddressFound": "No addresses found for this postal code",
38
38
  "searchingForAddresses": "Searching for addresses...",
39
+ "SAIdLengthError": "SA ID must be 13 digits",
40
+ "SAIdInvalidError": "Invalid SA ID",
41
+ "PassportLengthError": "Passport number must be 8 or 9 digits.",
42
+ "PasswordMustContain": "Password must contain:"
39
43
  },
40
44
  "hu": {
41
45
  "dateError": "A választott dátumnak {min} és {max} között kell lennie",
@@ -62,7 +66,11 @@ const TRANSLATIONS = {
62
66
  "InvalidDocumentNumber": "Csak számjegyek engedélyezettek.",
63
67
  "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>",
64
68
  "twofaResendMessage": "Nem kapta meg a megerősítő kódot?",
65
- "twofaResendButton": "Újraküldés"
69
+ "twofaResendButton": "Újraküldés",
70
+ "PassportLengthError": "Az útlevélszámnak 9 számjegyűnek kell lennie",
71
+ "SAIdLengthError": "A dél-afrikai személyi számnak 13 számjegyűnek kell lennie",
72
+ "SAIdInvalidError": "Érvénytelen dél-afrikai személyi szám",
73
+ "PasswordMustContain": "A jelszónak tartalmaznia kell:"
66
74
  },
67
75
  "hr": {
68
76
  "dateError": "Odabrani datum treba biti između {min} i {max}",
@@ -89,7 +97,11 @@ const TRANSLATIONS = {
89
97
  "InvalidDocumentNumber": "Dopušteni su samo numerički znakovi.",
90
98
  "twofaDescription": "<p> Poslali smo verifikacijski kod na: <p> {destination}. </p> </p> <p> Molimo unesite PIN ispod. </p>",
91
99
  "twofaResendMessage": "Niste primili verifikacijski kod?",
92
- "twofaResendButton": "Ponovno pošalji"
100
+ "twofaResendButton": "Ponovno pošalji",
101
+ "PassportLengthError": "Broj putovnice mora imati 9 znamenki",
102
+ "SAIdLengthError": "Južnoafrički osobni broj mora imati 13 znamenki",
103
+ "SAIdInvalidError": "Nevažeći južnoafrički osobni broj",
104
+ "PasswordMustContain": "Lozinka mora sadržavati:"
93
105
  },
94
106
  "tr": {
95
107
  "dateError": "Seçilen tarih {min} ve {max} arasında olmalıdır",
@@ -116,7 +128,11 @@ const TRANSLATIONS = {
116
128
  "InvalidDocumentNumber": "Sadece sayısal karakterlere izin verilir.",
117
129
  "twofaDescription": "<p> Doğrulama kodunu şu adrese gönderdik: <p> {destination}. </p> </p> <p> Lütfen aşağıya PIN kodunu girin. </p>",
118
130
  "twofaResendMessage": "Doğrulama kodunu almadınız mı?",
119
- "twofaResendButton": "Yeniden gönder"
131
+ "twofaResendButton": "Yeniden gönder",
132
+ "PassportLengthError": "Pasaport numarası 9 haneli olmalıdır",
133
+ "SAIdLengthError": "Güney Afrika kimlik numarası 13 haneli olmalıdır",
134
+ "SAIdInvalidError": "Geçersiz Güney Afrika kimlik numarası",
135
+ "PasswordMustContain": "Şifre şunları içermelidir:"
120
136
  },
121
137
  "pt-br": {
122
138
  "dateError": "A data selecionada deve estar entre {min} e {max}",
@@ -143,7 +159,11 @@ const TRANSLATIONS = {
143
159
  "InvalidDocumentNumber": "Apenas caracteres numéricos são permitidos.",
144
160
  "twofaDescription": "<p> Enviamos o código de verificação para: <p> {destination}. </p> </p> <p> Por favor, insira o PIN abaixo. </p>",
145
161
  "twofaResendMessage": "Não recebeu o código de verificação?",
146
- "twofaResendButton": "Reenviar"
162
+ "twofaResendButton": "Reenviar",
163
+ "PassportLengthError": "O número do passaporte deve ter 9 dígitos",
164
+ "SAIdLengthError": "O número de identificação da África do Sul deve ter 13 dígitos",
165
+ "SAIdInvalidError": "Número de identificação da África do Sul inválido",
166
+ "PasswordMustContain": "A senha deve conter:"
147
167
  },
148
168
  "es-mx": {
149
169
  "dateError": "La fecha seleccionada debe ser entre {min} y {max}",
@@ -170,9 +190,40 @@ const TRANSLATIONS = {
170
190
  "InvalidDocumentNumber": "Solo se permiten caracteres numéricos.",
171
191
  "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>",
172
192
  "twofaResendMessage": "¿No recibiste el código de verificación?",
173
- "twofaResendButton": "Reenviar"
193
+ "twofaResendButton": "Reenviar",
194
+ "PassportLengthError": "El número de pasaporte debe tener 9 dígitos",
195
+ "SAIdLengthError": "El número de identificación de Sudáfrica debe tener 13 dígitos",
196
+ "SAIdInvalidError": "Número de identificación de Sudáfrica inválido",
197
+ "PasswordMustContain": "La contraseña debe contener:"
174
198
  }
175
199
  };
200
+ const CONSTANTS = {
201
+ DOCUMENT_NUMBER: "DocumentNumber",
202
+ FIRSTNAME_ON_DOCUMENT: "FirstnameOnDocument",
203
+ LASTNAME_ON_DOCUMENT: "LastnameOnDocument",
204
+ PASSPORT: "Passport",
205
+ SOUTH_AFRICAN_ID: "SouthAfricanID",
206
+ BIRTHDATE: "BirthDate",
207
+ PASSPORT_NUMERIC_REGEX: /^\d{8,9}$/,
208
+ SA_ID_BASIC_REGEX: /^\d{13}$/,
209
+ SOUTH_AFRICAN_ID_LENGTH: 13,
210
+ NON_LETTERS_REGEX: /[^A-Za-z]/g,
211
+ DATE_FORMAT: "yyyy-MM-dd",
212
+ PASSWORD_COMPLEXITY_PASSED: "passed",
213
+ PASSWORD_COMPLEXITY_FAILED: "failed"
214
+ };
215
+ const ERROR_KEYS = {
216
+ PASSPORT_INVALID: 'PassportLengthError',
217
+ SA_ID_LENGTH: 'SAIdLengthError',
218
+ SA_ID_INVALID: 'SAIdInvalidError',
219
+ REQUIRED: 'requiredError',
220
+ LENGTH: 'lengthError',
221
+ DUPLICATE: 'duplicateInputError',
222
+ };
223
+ const STATUS_ICONS = {
224
+ PASSED: '✓',
225
+ FAILED: '✕',
226
+ };
176
227
  const translate = (key, customLang, values) => {
177
228
  const lang = customLang;
178
229
  let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
@@ -199,6 +250,27 @@ const getTranslations = (url) => {
199
250
  });
200
251
  });
201
252
  };
253
+ const validateID = (id) => {
254
+ if (!CONSTANTS.SA_ID_BASIC_REGEX.test(id))
255
+ return false;
256
+ const digits = id.split("").map(n => parseInt(n, 10));
257
+ let oddSum = 0;
258
+ for (let i = 0; i < 12; i += 2) {
259
+ oddSum += digits[i];
260
+ }
261
+ let evenConcat = "";
262
+ for (let i = 1; i < 12; i += 2) {
263
+ evenConcat += digits[i];
264
+ }
265
+ const evenNumber = parseInt(evenConcat, 10) * 2;
266
+ const evenSum = evenNumber
267
+ .toString()
268
+ .split("")
269
+ .reduce((s, n) => s + parseInt(n, 10), 0);
270
+ const total = oddSum + evenSum;
271
+ let checkDigit = (10 - (total % 10)) % 10;
272
+ return checkDigit === digits[12];
273
+ };
202
274
 
203
275
  const tooltipIconSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjUuNSIgc3Ryb2tlPSIjOTc5Nzk3Ii8+CjxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSIyIiBoZWlnaHQ9IjUiIGZpbGw9IiM5Nzk3OTciLz4KPGNpcmNsZSBjeD0iNiIgY3k9IjMiIHI9IjEiIGZpbGw9IiM5Nzk3OTciLz4KPC9zdmc+Cg==';
204
276
 
@@ -5822,6 +5894,21 @@ const DateInput = class {
5822
5894
  sheet.innerHTML = this.clientStyling;
5823
5895
  this.stylingContainer.prepend(sheet);
5824
5896
  };
5897
+ this.handleDocumentIdUpdate = (e) => {
5898
+ if (this.name !== CONSTANTS.BIRTHDATE) {
5899
+ return;
5900
+ }
5901
+ const dateStr = e.detail;
5902
+ this.value = dateStr;
5903
+ this.valueAsDate = parse(this.value || '', CONSTANTS.DATE_FORMAT, new Date());
5904
+ this.touched = true;
5905
+ if (this.datePicker) {
5906
+ this.datePicker.value = this.value;
5907
+ }
5908
+ this.isValid = this.setValidity();
5909
+ this.errorMessage = this.setErrorMessage();
5910
+ this.valueHandler({ name: this.name, value: this.value });
5911
+ };
5825
5912
  this.name = undefined;
5826
5913
  this.displayName = undefined;
5827
5914
  this.placeholder = undefined;
@@ -5834,6 +5921,7 @@ const DateInput = class {
5834
5921
  this.clientStyling = '';
5835
5922
  this.dateFormat = 'yyyy-MM-dd';
5836
5923
  this.emitOnClick = false;
5924
+ this.enableSouthAfricanMode = undefined;
5837
5925
  this.errorMessage = undefined;
5838
5926
  this.isValid = undefined;
5839
5927
  this.limitStylingAppends = false;
@@ -5863,6 +5951,14 @@ const DateInput = class {
5863
5951
  this.valueHandler({ name: this.name, value: this.value });
5864
5952
  }
5865
5953
  }
5954
+ handleCustomRegistrationChange(newValue) {
5955
+ if (newValue) {
5956
+ window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
5957
+ }
5958
+ else {
5959
+ window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
5960
+ }
5961
+ }
5866
5962
  valueHandler(inputValueEvent) {
5867
5963
  this.sendInputValue.emit(inputValueEvent);
5868
5964
  }
@@ -5906,6 +6002,9 @@ const DateInput = class {
5906
6002
  }
5907
6003
  });
5908
6004
  }
6005
+ if (this.enableSouthAfricanMode) {
6006
+ window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
6007
+ }
5909
6008
  this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
5910
6009
  if (this.defaultValue) {
5911
6010
  this.value = this.defaultValue;
@@ -5913,6 +6012,11 @@ const DateInput = class {
5913
6012
  }
5914
6013
  this.isValid = this.setValidity();
5915
6014
  }
6015
+ disconnectedCallback() {
6016
+ if (this.enableSouthAfricanMode) {
6017
+ window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
6018
+ }
6019
+ }
5916
6020
  handleCalendarIconClick() {
5917
6021
  if (this.datePicker.opened && this.emitOnClick) {
5918
6022
  window.postMessage({ type: `registration${this.name}Clicked` }, window.location.href);
@@ -5925,6 +6029,11 @@ const DateInput = class {
5925
6029
  this.isValid = this.setValidity();
5926
6030
  this.errorMessage = this.setErrorMessage();
5927
6031
  this.emitValueHandler(true);
6032
+ if (this.enableSouthAfricanMode) {
6033
+ window.dispatchEvent(new CustomEvent('birthDateUpdated', {
6034
+ detail: { birthDate: this.value }
6035
+ }));
6036
+ }
5928
6037
  }
5929
6038
  setValidity() {
5930
6039
  if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate) || !isMatch(this.formattedValue, this.dateFormat)) {
@@ -5959,14 +6068,15 @@ const DateInput = class {
5959
6068
  if (this.touched) {
5960
6069
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
5961
6070
  }
5962
- return index.h("div", { key: 'd9757eb7eea257167da12612f51f6665d6ac058e', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("label", { key: '8339c9f27e74f2e1a98d11efea7eb05a9681e83e', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("vaadin-date-picker", { key: '513692d0858a9f409e02bd515700e3e9e0eaa1fb', 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) }), index.h("small", { key: '19be9854df1adc1c6581e00a3593bcf16d7e2146', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
5963
- index.h("img", { key: 'f38abc61046c33c56a9efc3907dbd184b8e8352e', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
6071
+ return index.h("div", { key: '9399c1be2edcbe3ed5c0e133cad52b1917e77e96', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("label", { key: '1094491a5fc441c4f704441d376ed965d6946637', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.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) }), index.h("small", { key: '67c1b6a0daafee536ab7179d1fe90a2870bb12b1', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
6072
+ index.h("img", { key: '4d02f23affc8ce9f5eb41a44fd2f346960c6d458', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
5964
6073
  }
5965
6074
  get element() { return index.getElement(this); }
5966
6075
  static get watchers() { return {
5967
6076
  "clientStyling": ["handleStylingChange"],
5968
6077
  "isValid": ["validityChanged"],
5969
- "emitValue": ["emitValueHandler"]
6078
+ "emitValue": ["emitValueHandler"],
6079
+ "enableSouthAfricanMode": ["handleCustomRegistrationChange"]
5970
6080
  }; }
5971
6081
  };
5972
6082
  DateInput.style = DateInputStyle0;
@@ -12847,6 +12957,8 @@ const GeneralInput = class {
12847
12957
  this.postalcodelength = undefined;
12848
12958
  this.addresses = [];
12849
12959
  this.ignoreCountry = false;
12960
+ this.enableSouthAfricanMode = undefined;
12961
+ this.pinAttemptsExceeded = undefined;
12850
12962
  this.mbSource = undefined;
12851
12963
  this.limitStylingAppends = false;
12852
12964
  }
@@ -12890,7 +13002,7 @@ const GeneralInput = class {
12890
13002
  return index.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 });
12891
13003
  }
12892
13004
  else {
12893
- return index.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 });
13005
+ return index.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 });
12894
13006
  }
12895
13007
  case 'email':
12896
13008
  return index.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 });
@@ -12903,9 +13015,9 @@ const GeneralInput = class {
12903
13015
  case 'togglecheckbox':
12904
13016
  return index.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 });
12905
13017
  case 'datetime':
12906
- return index.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 });
13018
+ return index.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 });
12907
13019
  case 'password':
12908
- return index.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 });
13020
+ return index.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 });
12909
13021
  case 'radio':
12910
13022
  return index.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 });
12911
13023
  case 'tel':
@@ -12913,13 +13025,13 @@ const GeneralInput = class {
12913
13025
  case 'dropdown':
12914
13026
  return index.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 });
12915
13027
  case 'twofa':
12916
- return index.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 });
13028
+ return index.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 });
12917
13029
  default:
12918
13030
  return index.h("p", null, "The ", this.type, " input type is not valid");
12919
13031
  }
12920
13032
  }
12921
13033
  render() {
12922
- return (index.h(index.Host, { key: '134ef4b9ef8814a9b77c5db5b5085b0fe4e79c92', class: `general-input--${this.name}`, onClick: this.handleClick }, this.renderInput()));
13034
+ return (index.h(index.Host, { key: '7d036183d9376203451d9805e76b608cfa63570b', class: `general-input--${this.name}`, onClick: this.handleClick }, this.renderInput()));
12923
13035
  }
12924
13036
  get host() { return index.getElement(this); }
12925
13037
  static get watchers() { return {
@@ -13067,7 +13179,7 @@ const NumberInput = class {
13067
13179
  };
13068
13180
  NumberInput.style = NumberInputStyle0;
13069
13181
 
13070
- 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}";
13182
+ 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}";
13071
13183
  const PasswordInputStyle0 = passwordInputCss;
13072
13184
 
13073
13185
  const PasswordInput = class {
@@ -13127,6 +13239,7 @@ const PasswordInput = class {
13127
13239
  this.isDuplicateInput = undefined;
13128
13240
  this.hidePasswordComplexity = false;
13129
13241
  this.clientStyling = '';
13242
+ this.enableSouthAfricanMode = undefined;
13130
13243
  this.isValid = undefined;
13131
13244
  this.errorMessage = undefined;
13132
13245
  this.limitStylingAppends = false;
@@ -13305,13 +13418,23 @@ const PasswordInput = class {
13305
13418
  return (index.h("div", { key: index$1 }, index.h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), index.h("span", null, translate(`${complexity.ruleKey}`, this.language) ? translate(`${complexity.ruleKey}`, this.language) : complexity.rule)));
13306
13419
  }))));
13307
13420
  }
13421
+ renderCustomComplexityPopup() {
13422
+ return (index.h("div", { class: `customreg-password__complexity ${!this.showPopup ? 'customreg-password__complexity--hidden' : ''}` }, index.h("p", { class: 'customreg-password__complexity--title' }, translate('PasswordMustContain', this.language)), index.h("div", { class: 'customreg-password__complexity--rules' }, this.passwordComplexity.map((complexity, index$1) => (index.h("div", { class: 'customreg-password__complexity--rule', key: index$1 }, index.h("span", { class: `customreg-password__complexity--icon ${complexity.passed
13423
+ ? CONSTANTS.PASSWORD_COMPLEXITY_PASSED : CONSTANTS.PASSWORD_COMPLEXITY_FAILED}` }, complexity.passed ? STATUS_ICONS.PASSED : STATUS_ICONS.FAILED), index.h("span", null, translate(complexity.ruleKey, this.language) || complexity.rule)))))));
13424
+ }
13308
13425
  render() {
13309
13426
  let invalidClass = '';
13310
13427
  if (this.touched) {
13311
13428
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
13312
13429
  }
13313
- return index.h("div", { key: 'db7a6a87af3de451485c603a2f28f25806838d20', class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '146ace196e1343f778232c0e2ff07556c0a09e1e', class: 'password__wrapper--flex' }, index.h("label", { key: '0d0cb672dfc7a43535a299b45752f43a87f73760', class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '1eac72dfdadd0f50bd2db6b0fc44320dd2f287bf', class: 'password__wrapper--relative' }, this.tooltip &&
13314
- index.h("img", { key: 'bb327b9a403c1fc5628c4ba2da8d1a2b62888db5', class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("vaadin-password-field", { key: '7962f122d1bfb0ac0a5176a743e1224dccba4910', 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 && index.h("small", { key: 'efadfea8911ba72161aef495d1fb5857f14a319b', class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && this.showPopup && !this.hidePasswordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
13430
+ return index.h("div", { key: 'c2dd473e71853ebb3d0b5b6245af606f75f8b479', class: `password__wrapper ${this.autofilled ? 'password__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '4ba641a832be3b8efb1957af5f45eb7b7cc69adc', class: 'password__wrapper--flex' }, index.h("label", { key: 'a4440e8b59a743831fa833d8e1c680c01cfcb93e', class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '2e194f2096a69bc691694be0ac49004a54aa3cde', class: 'password__wrapper--relative' }, this.tooltip &&
13431
+ index.h("img", { key: 'eafce2331ec867fcd8abc253d3605f5214557b8b', class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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 && index.h("small", { key: 'd20a6946d4757da4311f33b2770079cc7f80bcfa', class: 'password__error-message' }, this.errorMessage), this.passwordComplexity &&
13432
+ this.showPopup &&
13433
+ !this.hidePasswordComplexity &&
13434
+ !this.isDuplicateInput &&
13435
+ (this.enableSouthAfricanMode
13436
+ ? this.renderCustomComplexityPopup()
13437
+ : this.renderComplexityPopup()));
13315
13438
  }
13316
13439
  get element() { return index.getElement(this); }
13317
13440
  static get watchers() { return {
@@ -14181,24 +14304,28 @@ const TextInput = class {
14181
14304
  this.postalcodelength = 5;
14182
14305
  this.touched = false;
14183
14306
  this.handleInput = (event) => {
14184
- this.value = event.target.value;
14307
+ const input = event.target;
14308
+ const normalizedValue = this.enableSouthAfricanMode &&
14309
+ (this.name === CONSTANTS.FIRSTNAME_ON_DOCUMENT ||
14310
+ this.name === CONSTANTS.LASTNAME_ON_DOCUMENT)
14311
+ ? input.value.replace(CONSTANTS.NON_LETTERS_REGEX, '')
14312
+ : input.value;
14313
+ if (normalizedValue !== input.value) {
14314
+ input.value = normalizedValue;
14315
+ }
14316
+ this.value = normalizedValue;
14185
14317
  this.touched = true;
14186
- if (this.debounceTime) {
14318
+ if (this.debounceTime)
14187
14319
  clearTimeout(this.debounceTime);
14188
- }
14189
14320
  this.debounceTime = setTimeout(() => {
14190
- this.isValid = this.setValidity();
14191
- this.errorMessage = this.setErrorMessage();
14192
- this.validityStateHandler({ valid: this.isValid, name: this.name });
14321
+ this.updateValidationState();
14193
14322
  this.emitValueHandler(true);
14194
14323
  }, 500);
14195
14324
  };
14196
14325
  this.handleBlur = (event) => {
14197
14326
  this.value = event.target.value;
14198
14327
  this.touched = true;
14199
- this.isValid = this.setValidity();
14200
- this.errorMessage = this.setErrorMessage();
14201
- this.validityStateHandler({ valid: this.isValid, name: this.name });
14328
+ this.updateValidationState();
14202
14329
  };
14203
14330
  this.setClientStyling = () => {
14204
14331
  let sheet = document.createElement('style');
@@ -14218,6 +14345,7 @@ const TextInput = class {
14218
14345
  this.isDuplicateInput = undefined;
14219
14346
  this.clientStyling = '';
14220
14347
  this.haspostalcodelookup = undefined;
14348
+ this.enableSouthAfricanMode = undefined;
14221
14349
  this.isValid = undefined;
14222
14350
  this.errorMessage = '';
14223
14351
  this.limitStylingAppends = false;
@@ -14255,15 +14383,13 @@ const TextInput = class {
14255
14383
  if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
14256
14384
  this.duplicateInputValue = event.detail.value;
14257
14385
  if (this.touched) {
14258
- this.isValid = this.setValidity();
14259
- this.errorMessage = this.setErrorMessage();
14386
+ this.updateValidationState();
14260
14387
  }
14261
14388
  }
14262
- if (this.name === event.detail.name + 'Duplicate'
14263
- && this.name.replace('Duplicate', '') === event.detail.name
14264
- && this.touched === true) {
14265
- this.isValid = this.setValidity();
14266
- this.errorMessage = this.setErrorMessage();
14389
+ if (this.name === event.detail.name + 'Duplicate' &&
14390
+ this.name.replace('Duplicate', '') === event.detail.name &&
14391
+ this.touched) {
14392
+ this.updateValidationState();
14267
14393
  }
14268
14394
  }
14269
14395
  handleValidationChange(event) {
@@ -14273,7 +14399,7 @@ const TextInput = class {
14273
14399
  this.validation = event.detail.validation;
14274
14400
  this.validationPattern = this.setPattern();
14275
14401
  if (this.touched) {
14276
- this.isValid = this.setValidity();
14402
+ this.isValid = this.isValidValue();
14277
14403
  this.errorMessage = this.setErrorMessage();
14278
14404
  }
14279
14405
  }
@@ -14309,13 +14435,37 @@ const TextInput = class {
14309
14435
  }
14310
14436
  this.value = newValue;
14311
14437
  this.touched = true;
14312
- this.isValid = true;
14313
- this.valueHandler({ name: this.name, value: newValue });
14314
- this.validityStateHandler({ valid: true, name: this.name });
14438
+ this.updateValidationState();
14315
14439
  }
14316
14440
  connectedCallback() {
14317
14441
  this.validationPattern = this.setPattern();
14318
14442
  }
14443
+ handleExternalDocUpdate(event) {
14444
+ if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
14445
+ return;
14446
+ this.value = event.detail || "";
14447
+ this.touched = true;
14448
+ if (this.inputReference) {
14449
+ this.inputReference.value = this.value;
14450
+ }
14451
+ this.sendInputValue.emit({
14452
+ name: this.name,
14453
+ value: this.value
14454
+ });
14455
+ this.updateValidationState();
14456
+ }
14457
+ handleDocReset() {
14458
+ if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
14459
+ return;
14460
+ this.value = "";
14461
+ this.touched = false;
14462
+ this.isValid = false;
14463
+ this.errorMessage = "";
14464
+ if (this.inputReference) {
14465
+ this.inputReference.value = "";
14466
+ }
14467
+ this.validityStateHandler({ valid: false, name: this.name });
14468
+ }
14319
14469
  componentDidRender() {
14320
14470
  // start custom styling area
14321
14471
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -14332,6 +14482,7 @@ const TextInput = class {
14332
14482
  }
14333
14483
  componentDidLoad() {
14334
14484
  if (this.defaultValue) {
14485
+ this.value = this.defaultValue;
14335
14486
  this.valueHandler({ name: this.name, value: this.value });
14336
14487
  if (this.isDuplicateInput) {
14337
14488
  this.touched = true;
@@ -14343,18 +14494,49 @@ const TextInput = class {
14343
14494
  window.targetInputRefs[this.name] = this.inputReference;
14344
14495
  }
14345
14496
  }
14346
- this.isValid = this.setValidity();
14497
+ this.isValid = this.isValidValue();
14347
14498
  }
14348
- setValidity() {
14499
+ validateDocument(valueRaw, docType) {
14500
+ const value = valueRaw.trim();
14501
+ if (docType === CONSTANTS.PASSPORT) {
14502
+ const valid = CONSTANTS.PASSPORT_NUMERIC_REGEX.test(value);
14503
+ return valid
14504
+ ? { valid: true }
14505
+ : { valid: false, errorKey: ERROR_KEYS.PASSPORT_INVALID };
14506
+ }
14507
+ if (docType === CONSTANTS.SOUTH_AFRICAN_ID) {
14508
+ if (value.length !== CONSTANTS.SOUTH_AFRICAN_ID_LENGTH) {
14509
+ return { valid: false, errorKey: ERROR_KEYS.SA_ID_LENGTH };
14510
+ }
14511
+ const valid = validateID(value);
14512
+ return valid
14513
+ ? { valid: true }
14514
+ : { valid: false, errorKey: ERROR_KEYS.SA_ID_INVALID };
14515
+ }
14516
+ return { valid: true };
14517
+ }
14518
+ updateValidationState() {
14519
+ const nextValid = this.isValidValue();
14520
+ this.isValid = nextValid;
14521
+ if (!this.touched) {
14522
+ this.errorMessage = '';
14523
+ return;
14524
+ }
14525
+ this.errorMessage = nextValid ? '' : this.setErrorMessage();
14526
+ }
14527
+ isValidValue() {
14349
14528
  if (!this.inputReference) {
14350
14529
  return false;
14351
14530
  }
14352
- if (this.value.trim() === "" && !this.validation.mandatory) {
14353
- return true;
14531
+ if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
14532
+ const docType = window.documentTypeValue;
14533
+ return this.validateDocument(this.value, docType).valid;
14354
14534
  }
14355
- const inputIsValid = this.inputReference.validity.valid;
14356
- const inputMatchValidation = !this.inputReference.value || this.inputReference.value.match(this.validationPattern) !== null;
14357
- return inputIsValid && inputMatchValidation;
14535
+ const fallbackResult = (this.value.trim() === "" && !this.validation.mandatory) ||
14536
+ (this.inputReference.validity.valid &&
14537
+ (!this.inputReference.value ||
14538
+ this.inputReference.value.match(this.validationPattern) !== null));
14539
+ return fallbackResult;
14358
14540
  }
14359
14541
  setPattern() {
14360
14542
  var _a, _b;
@@ -14364,14 +14546,25 @@ const TextInput = class {
14364
14546
  }
14365
14547
  setErrorMessage() {
14366
14548
  var _a, _b, _c, _d;
14367
- if (this.value.trim() === "" && !this.validation.mandatory) {
14549
+ const value = this.value.trim();
14550
+ if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
14551
+ const docType = window.documentTypeValue;
14552
+ const res = this.validateDocument(this.value, docType);
14553
+ return res.valid ? '' : translate(res.errorKey, this.language);
14554
+ }
14555
+ if (value === "" && !this.validation.mandatory) {
14368
14556
  return "";
14369
14557
  }
14370
14558
  if (this.inputReference.validity.valueMissing) {
14371
- return translate('requiredError', this.language);
14559
+ return translate(ERROR_KEYS.REQUIRED, this.language);
14372
14560
  }
14373
14561
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
14374
- return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
14562
+ return translate(ERROR_KEYS.LENGTH, this.language, {
14563
+ values: {
14564
+ minLength: this.validation.minLength,
14565
+ maxLength: this.validation.maxLength
14566
+ }
14567
+ });
14375
14568
  }
14376
14569
  if (this.inputReference.value.match(this.validationPattern) == null) {
14377
14570
  const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
@@ -14383,6 +14576,7 @@ const TextInput = class {
14383
14576
  const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
14384
14577
  return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
14385
14578
  }
14579
+ return "";
14386
14580
  }
14387
14581
  renderTooltip() {
14388
14582
  if (this.showTooltip) {
@@ -14395,8 +14589,8 @@ const TextInput = class {
14395
14589
  if (this.touched) {
14396
14590
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
14397
14591
  }
14398
- return index.h("div", { key: '46152e946f6a45c2bb07ee07c43bcf356f3cfa29', class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, index.h("div", { key: 'f584f23ee97b9a1d23862ec746366d5f00c56552', class: 'text__wrapper--flex' }, index.h("label", { key: 'ed9fe368bd00151d8b3e43daf148632cfe7d32ff', class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '01cd5f7321d78422049c45b1816801eca74d2b4d', class: 'text__wrapper--relative' }, this.tooltip &&
14399
- index.h("img", { key: '403689aa01575770be4296aaef0c7846e496d6a7', class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("input", { key: '5ec8443fd428ea00b9add243ea74e61fbd5b283a', 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.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { key: 'd1eb4cf6ac28fff4664a56e27c9f2a21d72b0d61', class: 'text__error-message' }, this.errorMessage));
14592
+ return index.h("div", { key: '5b0bf10acadab5c3362d185cef10c5ed4f3a6a47', class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, index.h("div", { key: '6d79cc845aac8d9b11737d35571680d7701c4b94', class: 'text__wrapper--flex' }, index.h("label", { key: 'de687661fa037d691fe1da1231b651f564bca010', class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '4d9b12a587267eaf6fab4c4f3c38befb8d5c2b99', class: 'text__wrapper--relative' }, this.tooltip &&
14593
+ index.h("img", { key: '7f27a118124cd0407b6c2644137a79eaa0496164', class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.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 }), index.h("small", { key: 'b9b3bdcd9cb81b56dc25a208b0c1d7784d06b5e0', class: 'text__error-message' }, this.errorMessage));
14400
14594
  }
14401
14595
  static get watchers() { return {
14402
14596
  "clientStyling": ["handleStylingChange"],
@@ -14581,20 +14775,24 @@ const TwofaInput = class {
14581
14775
  this.handleInput = (e, idx) => {
14582
14776
  const input = e.target;
14583
14777
  const value = input.value;
14584
- if (value.length > 1) {
14585
- input.value = value.charAt(1);
14586
- }
14587
- else {
14588
- input.value = value.charAt(0);
14589
- }
14590
- if (!value) {
14778
+ const char = value.slice(-1);
14779
+ input.value = char;
14780
+ if (!char)
14591
14781
  return;
14782
+ this.code[idx] = char;
14783
+ // --- Hide pin code --- //
14784
+ if (this.enableSouthAfricanMode) {
14785
+ // show character for 500ms
14786
+ this.revealedIndexes = [idx];
14787
+ if (this.revealTimeout)
14788
+ clearTimeout(this.revealTimeout);
14789
+ this.revealTimeout = setTimeout(() => {
14790
+ this.revealedIndexes = [];
14791
+ }, 500);
14592
14792
  }
14593
- this.code[idx] = input.value;
14594
14793
  const nextInput = this.inputRefs[idx + 1];
14595
- if (nextInput) {
14794
+ if (nextInput)
14596
14795
  nextInput.focus();
14597
- }
14598
14796
  this.setValidity();
14599
14797
  this.setErrorMessage();
14600
14798
  };
@@ -14623,6 +14821,8 @@ const TwofaInput = class {
14623
14821
  this.destination = '';
14624
14822
  this.resendIntervalSeconds = 60;
14625
14823
  this.clientStyling = '';
14824
+ this.enableSouthAfricanMode = undefined;
14825
+ this.pinAttemptsExceeded = undefined;
14626
14826
  this.clientStylingUrl = '';
14627
14827
  this.mbSource = undefined;
14628
14828
  this.limitStylingAppends = false;
@@ -14632,10 +14832,7 @@ const TwofaInput = class {
14632
14832
  this.errorMessage = '';
14633
14833
  this.code = [];
14634
14834
  this.resendIntervalSecondsLeft = this.resendIntervalSeconds;
14635
- }
14636
- handleStylingChange(newValue, oldValue) {
14637
- if (newValue !== oldValue)
14638
- this.setClientStyling();
14835
+ this.revealedIndexes = [];
14639
14836
  }
14640
14837
  validityChanged() {
14641
14838
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -14664,6 +14861,10 @@ const TwofaInput = class {
14664
14861
  this.showTooltip = false;
14665
14862
  }
14666
14863
  }
14864
+ handleStylingChange(newValue, oldValue) {
14865
+ if (newValue !== oldValue)
14866
+ this.setClientStyling();
14867
+ }
14667
14868
  connectedCallback() {
14668
14869
  this.validationPattern = this.setPattern();
14669
14870
  this.code = new Array(this.validation.maxLength).fill('');
@@ -14698,37 +14899,51 @@ const TwofaInput = class {
14698
14899
  }
14699
14900
  handleKeyDown(e, idx) {
14700
14901
  if (e.key === 'Backspace') {
14701
- this.code[idx] = '';
14702
- if (this.inputRefs[idx]) {
14703
- this.inputRefs[idx].value = '';
14704
- } // Clear input field
14705
- const prevInput = this.inputRefs[idx - 1];
14706
- if (prevInput) {
14707
- prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
14902
+ const newCode = [...this.code];
14903
+ newCode[idx] = '';
14904
+ this.code = newCode;
14905
+ if (this.enableSouthAfricanMode) {
14906
+ this.revealedIndexes = this.revealedIndexes.filter(i => i !== idx);
14708
14907
  }
14908
+ const prevInput = this.inputRefs[idx - 1];
14909
+ prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
14709
14910
  }
14710
14911
  this.setValidity();
14711
14912
  this.setErrorMessage();
14712
14913
  }
14713
14914
  handlePaste(e) {
14714
- var _a;
14915
+ var _a, _b;
14715
14916
  e.preventDefault();
14716
- const data = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text').trim();
14717
- if (!data) {
14917
+ const data = (_b = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) === null || _b === void 0 ? void 0 : _b.trim();
14918
+ if (!data)
14718
14919
  return;
14920
+ const value = data.slice(0, this.validation.maxLength).split('');
14921
+ this.code = [
14922
+ ...value,
14923
+ ...new Array(this.validation.maxLength - value.length).fill('')
14924
+ ];
14925
+ if (this.enableSouthAfricanMode) {
14926
+ this.revealedIndexes = value.map((_, i) => i);
14927
+ if (this.revealTimeout)
14928
+ clearTimeout(this.revealTimeout);
14929
+ this.revealTimeout = setTimeout(() => {
14930
+ this.revealedIndexes = [];
14931
+ }, 500);
14719
14932
  }
14720
- const value = data.slice(0, this.validation.maxLength).split(''); // Limit to OTP length
14721
- this.code = [...value, ...new Array(this.validation.maxLength - value.length).fill('')];
14722
- value.forEach((char, index) => {
14723
- this.inputRefs[index].value = char;
14724
- });
14725
- // Move focus to the last input or trigger submit
14726
14933
  const lastInput = this.inputRefs[Math.min(value.length, this.inputRefs.length - 1)];
14727
- if (lastInput) {
14728
- lastInput.focus();
14729
- }
14934
+ lastInput === null || lastInput === void 0 ? void 0 : lastInput.focus();
14730
14935
  this.setValidity();
14731
14936
  this.setErrorMessage();
14937
+ if (this.enableSouthAfricanMode) {
14938
+ this.valueHandler({
14939
+ name: this.name,
14940
+ value: this.code.join('')
14941
+ });
14942
+ this.validityStateHandler({
14943
+ valid: this.isValid,
14944
+ name: this.name
14945
+ });
14946
+ }
14732
14947
  }
14733
14948
  setValidity() {
14734
14949
  const code = this.code.join('');
@@ -14761,19 +14976,28 @@ const TwofaInput = class {
14761
14976
  }
14762
14977
  return null;
14763
14978
  }
14979
+ getInputDisplayValue(idx) {
14980
+ const current = this.code[idx];
14981
+ if (!current)
14982
+ return "";
14983
+ if (this.enableSouthAfricanMode) {
14984
+ return this.revealedIndexes.includes(idx) ? current : "*";
14985
+ }
14986
+ return current;
14987
+ }
14764
14988
  render() {
14765
- return (index.h("div", { key: '45f0c8c7d88898a5474bff460ce962e8bb1e8634', class: "twofa", ref: el => this.stylingContainer = el }, index.h("div", { key: 'b40e81587ad9c7b67c112c8867104e761db7e3bc', class: 'twofa__error-message' }, index.h("p", { key: '760c694f6f71f040e85f81a67d3d41524c23130f' }, this.errorMessage)), index.h("div", { key: '2b437a5108e3989d2ddf596dc4a97d2071448154', class: "twofa__description", innerHTML: translate('twofaDescription', this.language, { values: { destination: this.destination } }) }), index.h("div", { key: '84df3ebbe4077ba8462c08cc7956349ec4a55b79', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((char, idx) => {
14766
- return (index.h("input", { key: idx, ref: el => this.setInputRef(el, idx), id: `otp-input-${idx}`, type: "text", maxLength: 2, value: char, onInput: (event) => this.handleInput(event, idx), onKeyDown: (event) => this.handleKeyDown(event, idx), onPaste: (event) => this.handlePaste(event) }));
14767
- })), index.h("div", { key: 'abdf6e2a3ff7ef6436b59206c40ada5305543db3', class: "twofa__button-wrapper" }, index.h("p", { key: 'e0859c58e48741eb379fbcaf23519bb90404489b', class: "twofa__resend-message" }, translate('twofaResendMessage', this.language)), index.h("button", { key: '89aa3a93a9b97029fd315450892cef5edd5d5294', class: "twofa__resend-button", onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable }, this.isResendButtonAvailable
14989
+ return (index.h("div", { key: '56a639eb6e240482078fc7aaf688c75ae3de04c8', class: "twofa", ref: el => this.stylingContainer = el }, index.h("div", { key: 'a64039a3ed66556a0dc1bbac7b6fd6d60de23fa3', class: 'twofa__error-message' }, index.h("p", { key: '21adf57c840d51714ab097e9df3cc77e22be611f' }, this.errorMessage)), index.h("div", { key: '6653201178b40bc1eb5d6e7d881f2bbe150901f3', class: "twofa__description", innerHTML: translate('twofaDescription', this.language, { values: { destination: this.destination } }) }), index.h("div", { key: 'ca7600034af473838b741d5be4fe72ded9937647', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((_, idx) => {
14990
+ return (index.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) }));
14991
+ })), index.h("div", { key: '0ecd60dd5e6b3f6c3a86176e1937e7aeeffc0e92', class: "twofa__button-wrapper" }, index.h("p", { key: 'fa9608598580bb8628d0e7a208cc69e3ebe83264', class: "twofa__resend-message" }, translate('twofaResendMessage', this.language)), index.h("button", { key: 'c70ea6e780eefc8fef0002fdcc10286ae0e66619', class: `twofa__resend-button ${this.pinAttemptsExceeded ? 'twofa__resend-button--disabled' : ''}`, onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable || this.pinAttemptsExceeded }, this.isResendButtonAvailable
14768
14992
  ? translate('twofaResendButton', this.language)
14769
14993
  : this.formatTime()))));
14770
14994
  }
14771
14995
  get host() { return index.getElement(this); }
14772
14996
  static get watchers() { return {
14773
- "clientStyling": ["handleStylingChange"],
14774
14997
  "isValid": ["validityChanged"],
14775
14998
  "emitValue": ["emitValueHandler"],
14776
- "clientStylingUrl": ["handleStylingUrlChange"]
14999
+ "clientStylingUrl": ["handleStylingUrlChange"],
15000
+ "clientStyling": ["handleStylingChange"]
14777
15001
  }; }
14778
15002
  };
14779
15003
  TwofaInput.style = TwofaInputStyle0;