@everymatrix/general-registration 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.
@@ -35,6 +35,10 @@ const TRANSLATIONS$1 = {
35
35
  "enterIEAddressManually": "For IRE, enter the address manually",
36
36
  "postalLookUpNoAddressFound": "No addresses found for this postal code",
37
37
  "searchingForAddresses": "Searching for addresses...",
38
+ "SAIdLengthError": "SA ID must be 13 digits",
39
+ "SAIdInvalidError": "Invalid SA ID",
40
+ "PassportLengthError": "Passport number must be 8 or 9 digits.",
41
+ "PasswordMustContain": "Password must contain:"
38
42
  },
39
43
  "hu": {
40
44
  "dateError": "A választott dátumnak {min} és {max} között kell lennie",
@@ -61,7 +65,11 @@ const TRANSLATIONS$1 = {
61
65
  "InvalidDocumentNumber": "Csak számjegyek engedélyezettek.",
62
66
  "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>",
63
67
  "twofaResendMessage": "Nem kapta meg a megerősítő kódot?",
64
- "twofaResendButton": "Újraküldés"
68
+ "twofaResendButton": "Újraküldés",
69
+ "PassportLengthError": "Az útlevélszámnak 9 számjegyűnek kell lennie",
70
+ "SAIdLengthError": "A dél-afrikai személyi számnak 13 számjegyűnek kell lennie",
71
+ "SAIdInvalidError": "Érvénytelen dél-afrikai személyi szám",
72
+ "PasswordMustContain": "A jelszónak tartalmaznia kell:"
65
73
  },
66
74
  "hr": {
67
75
  "dateError": "Odabrani datum treba biti između {min} i {max}",
@@ -88,7 +96,11 @@ const TRANSLATIONS$1 = {
88
96
  "InvalidDocumentNumber": "Dopušteni su samo numerički znakovi.",
89
97
  "twofaDescription": "<p> Poslali smo verifikacijski kod na: <p> {destination}. </p> </p> <p> Molimo unesite PIN ispod. </p>",
90
98
  "twofaResendMessage": "Niste primili verifikacijski kod?",
91
- "twofaResendButton": "Ponovno pošalji"
99
+ "twofaResendButton": "Ponovno pošalji",
100
+ "PassportLengthError": "Broj putovnice mora imati 9 znamenki",
101
+ "SAIdLengthError": "Južnoafrički osobni broj mora imati 13 znamenki",
102
+ "SAIdInvalidError": "Nevažeći južnoafrički osobni broj",
103
+ "PasswordMustContain": "Lozinka mora sadržavati:"
92
104
  },
93
105
  "tr": {
94
106
  "dateError": "Seçilen tarih {min} ve {max} arasında olmalıdır",
@@ -115,7 +127,11 @@ const TRANSLATIONS$1 = {
115
127
  "InvalidDocumentNumber": "Sadece sayısal karakterlere izin verilir.",
116
128
  "twofaDescription": "<p> Doğrulama kodunu şu adrese gönderdik: <p> {destination}. </p> </p> <p> Lütfen aşağıya PIN kodunu girin. </p>",
117
129
  "twofaResendMessage": "Doğrulama kodunu almadınız mı?",
118
- "twofaResendButton": "Yeniden gönder"
130
+ "twofaResendButton": "Yeniden gönder",
131
+ "PassportLengthError": "Pasaport numarası 9 haneli olmalıdır",
132
+ "SAIdLengthError": "Güney Afrika kimlik numarası 13 haneli olmalıdır",
133
+ "SAIdInvalidError": "Geçersiz Güney Afrika kimlik numarası",
134
+ "PasswordMustContain": "Şifre şunları içermelidir:"
119
135
  },
120
136
  "pt-br": {
121
137
  "dateError": "A data selecionada deve estar entre {min} e {max}",
@@ -142,7 +158,11 @@ const TRANSLATIONS$1 = {
142
158
  "InvalidDocumentNumber": "Apenas caracteres numéricos são permitidos.",
143
159
  "twofaDescription": "<p> Enviamos o código de verificação para: <p> {destination}. </p> </p> <p> Por favor, insira o PIN abaixo. </p>",
144
160
  "twofaResendMessage": "Não recebeu o código de verificação?",
145
- "twofaResendButton": "Reenviar"
161
+ "twofaResendButton": "Reenviar",
162
+ "PassportLengthError": "O número do passaporte deve ter 9 dígitos",
163
+ "SAIdLengthError": "O número de identificação da África do Sul deve ter 13 dígitos",
164
+ "SAIdInvalidError": "Número de identificação da África do Sul inválido",
165
+ "PasswordMustContain": "A senha deve conter:"
146
166
  },
147
167
  "es-mx": {
148
168
  "dateError": "La fecha seleccionada debe ser entre {min} y {max}",
@@ -169,9 +189,40 @@ const TRANSLATIONS$1 = {
169
189
  "InvalidDocumentNumber": "Solo se permiten caracteres numéricos.",
170
190
  "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>",
171
191
  "twofaResendMessage": "¿No recibiste el código de verificación?",
172
- "twofaResendButton": "Reenviar"
192
+ "twofaResendButton": "Reenviar",
193
+ "PassportLengthError": "El número de pasaporte debe tener 9 dígitos",
194
+ "SAIdLengthError": "El número de identificación de Sudáfrica debe tener 13 dígitos",
195
+ "SAIdInvalidError": "Número de identificación de Sudáfrica inválido",
196
+ "PasswordMustContain": "La contraseña debe contener:"
173
197
  }
174
198
  };
199
+ const CONSTANTS = {
200
+ DOCUMENT_NUMBER: "DocumentNumber",
201
+ FIRSTNAME_ON_DOCUMENT: "FirstnameOnDocument",
202
+ LASTNAME_ON_DOCUMENT: "LastnameOnDocument",
203
+ PASSPORT: "Passport",
204
+ SOUTH_AFRICAN_ID: "SouthAfricanID",
205
+ BIRTHDATE: "BirthDate",
206
+ PASSPORT_NUMERIC_REGEX: /^\d{8,9}$/,
207
+ SA_ID_BASIC_REGEX: /^\d{13}$/,
208
+ SOUTH_AFRICAN_ID_LENGTH: 13,
209
+ NON_LETTERS_REGEX: /[^A-Za-z]/g,
210
+ DATE_FORMAT: "yyyy-MM-dd",
211
+ PASSWORD_COMPLEXITY_PASSED: "passed",
212
+ PASSWORD_COMPLEXITY_FAILED: "failed"
213
+ };
214
+ const ERROR_KEYS = {
215
+ PASSPORT_INVALID: 'PassportLengthError',
216
+ SA_ID_LENGTH: 'SAIdLengthError',
217
+ SA_ID_INVALID: 'SAIdInvalidError',
218
+ REQUIRED: 'requiredError',
219
+ LENGTH: 'lengthError',
220
+ DUPLICATE: 'duplicateInputError',
221
+ };
222
+ const STATUS_ICONS = {
223
+ PASSED: '✓',
224
+ FAILED: '✕',
225
+ };
175
226
  const translate$1 = (key, customLang, values) => {
176
227
  const lang = customLang;
177
228
  let translation = TRANSLATIONS$1[lang !== undefined ? lang : DEFAULT_LANGUAGE$1][key];
@@ -198,6 +249,27 @@ const getTranslations$1 = (url) => {
198
249
  });
199
250
  });
200
251
  };
252
+ const validateID = (id) => {
253
+ if (!CONSTANTS.SA_ID_BASIC_REGEX.test(id))
254
+ return false;
255
+ const digits = id.split("").map(n => parseInt(n, 10));
256
+ let oddSum = 0;
257
+ for (let i = 0; i < 12; i += 2) {
258
+ oddSum += digits[i];
259
+ }
260
+ let evenConcat = "";
261
+ for (let i = 1; i < 12; i += 2) {
262
+ evenConcat += digits[i];
263
+ }
264
+ const evenNumber = parseInt(evenConcat, 10) * 2;
265
+ const evenSum = evenNumber
266
+ .toString()
267
+ .split("")
268
+ .reduce((s, n) => s + parseInt(n, 10), 0);
269
+ const total = oddSum + evenSum;
270
+ let checkDigit = (10 - (total % 10)) % 10;
271
+ return checkDigit === digits[12];
272
+ };
201
273
 
202
274
  const tooltipIconSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjUuNSIgc3Ryb2tlPSIjOTc5Nzk3Ii8+CjxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSIyIiBoZWlnaHQ9IjUiIGZpbGw9IiM5Nzk3OTciLz4KPGNpcmNsZSBjeD0iNiIgY3k9IjMiIHI9IjEiIGZpbGw9IiM5Nzk3OTciLz4KPC9zdmc+Cg==';
203
275
 
@@ -5821,6 +5893,21 @@ const DateInput = class {
5821
5893
  sheet.innerHTML = this.clientStyling;
5822
5894
  this.stylingContainer.prepend(sheet);
5823
5895
  };
5896
+ this.handleDocumentIdUpdate = (e) => {
5897
+ if (this.name !== CONSTANTS.BIRTHDATE) {
5898
+ return;
5899
+ }
5900
+ const dateStr = e.detail;
5901
+ this.value = dateStr;
5902
+ this.valueAsDate = parse(this.value || '', CONSTANTS.DATE_FORMAT, new Date());
5903
+ this.touched = true;
5904
+ if (this.datePicker) {
5905
+ this.datePicker.value = this.value;
5906
+ }
5907
+ this.isValid = this.setValidity();
5908
+ this.errorMessage = this.setErrorMessage();
5909
+ this.valueHandler({ name: this.name, value: this.value });
5910
+ };
5824
5911
  this.name = undefined;
5825
5912
  this.displayName = undefined;
5826
5913
  this.placeholder = undefined;
@@ -5833,6 +5920,7 @@ const DateInput = class {
5833
5920
  this.clientStyling = '';
5834
5921
  this.dateFormat = 'yyyy-MM-dd';
5835
5922
  this.emitOnClick = false;
5923
+ this.enableSouthAfricanMode = undefined;
5836
5924
  this.errorMessage = undefined;
5837
5925
  this.isValid = undefined;
5838
5926
  this.limitStylingAppends = false;
@@ -5862,6 +5950,14 @@ const DateInput = class {
5862
5950
  this.valueHandler({ name: this.name, value: this.value });
5863
5951
  }
5864
5952
  }
5953
+ handleCustomRegistrationChange(newValue) {
5954
+ if (newValue) {
5955
+ window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
5956
+ }
5957
+ else {
5958
+ window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
5959
+ }
5960
+ }
5865
5961
  valueHandler(inputValueEvent) {
5866
5962
  this.sendInputValue.emit(inputValueEvent);
5867
5963
  }
@@ -5905,6 +6001,9 @@ const DateInput = class {
5905
6001
  }
5906
6002
  });
5907
6003
  }
6004
+ if (this.enableSouthAfricanMode) {
6005
+ window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
6006
+ }
5908
6007
  this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
5909
6008
  if (this.defaultValue) {
5910
6009
  this.value = this.defaultValue;
@@ -5912,6 +6011,11 @@ const DateInput = class {
5912
6011
  }
5913
6012
  this.isValid = this.setValidity();
5914
6013
  }
6014
+ disconnectedCallback() {
6015
+ if (this.enableSouthAfricanMode) {
6016
+ window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
6017
+ }
6018
+ }
5915
6019
  handleCalendarIconClick() {
5916
6020
  if (this.datePicker.opened && this.emitOnClick) {
5917
6021
  window.postMessage({ type: `registration${this.name}Clicked` }, window.location.href);
@@ -5924,6 +6028,11 @@ const DateInput = class {
5924
6028
  this.isValid = this.setValidity();
5925
6029
  this.errorMessage = this.setErrorMessage();
5926
6030
  this.emitValueHandler(true);
6031
+ if (this.enableSouthAfricanMode) {
6032
+ window.dispatchEvent(new CustomEvent('birthDateUpdated', {
6033
+ detail: { birthDate: this.value }
6034
+ }));
6035
+ }
5927
6036
  }
5928
6037
  setValidity() {
5929
6038
  if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate) || !isMatch(this.formattedValue, this.dateFormat)) {
@@ -5958,14 +6067,15 @@ const DateInput = class {
5958
6067
  if (this.touched) {
5959
6068
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
5960
6069
  }
5961
- 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 &&
5962
- index.h("img", { key: 'f38abc61046c33c56a9efc3907dbd184b8e8352e', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
6070
+ 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 &&
6071
+ index.h("img", { key: '4d02f23affc8ce9f5eb41a44fd2f346960c6d458', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
5963
6072
  }
5964
6073
  get element() { return index.getElement(this); }
5965
6074
  static get watchers() { return {
5966
6075
  "clientStyling": ["handleStylingChange"],
5967
6076
  "isValid": ["validityChanged"],
5968
- "emitValue": ["emitValueHandler"]
6077
+ "emitValue": ["emitValueHandler"],
6078
+ "enableSouthAfricanMode": ["handleCustomRegistrationChange"]
5969
6079
  }; }
5970
6080
  };
5971
6081
  DateInput.style = DateInputStyle0;
@@ -12846,6 +12956,8 @@ const GeneralInput = class {
12846
12956
  this.postalcodelength = undefined;
12847
12957
  this.addresses = [];
12848
12958
  this.ignoreCountry = false;
12959
+ this.enableSouthAfricanMode = undefined;
12960
+ this.pinAttemptsExceeded = undefined;
12849
12961
  this.mbSource = undefined;
12850
12962
  this.limitStylingAppends = false;
12851
12963
  }
@@ -12889,7 +13001,7 @@ const GeneralInput = class {
12889
13001
  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 });
12890
13002
  }
12891
13003
  else {
12892
- 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 });
13004
+ 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 });
12893
13005
  }
12894
13006
  case 'email':
12895
13007
  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 });
@@ -12902,9 +13014,9 @@ const GeneralInput = class {
12902
13014
  case 'togglecheckbox':
12903
13015
  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 });
12904
13016
  case 'datetime':
12905
- 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 });
13017
+ 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 });
12906
13018
  case 'password':
12907
- 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 });
13019
+ 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 });
12908
13020
  case 'radio':
12909
13021
  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 });
12910
13022
  case 'tel':
@@ -12912,13 +13024,13 @@ const GeneralInput = class {
12912
13024
  case 'dropdown':
12913
13025
  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 });
12914
13026
  case 'twofa':
12915
- 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 });
13027
+ 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 });
12916
13028
  default:
12917
13029
  return index.h("p", null, "The ", this.type, " input type is not valid");
12918
13030
  }
12919
13031
  }
12920
13032
  render() {
12921
- return (index.h(index.Host, { key: '134ef4b9ef8814a9b77c5db5b5085b0fe4e79c92', class: `general-input--${this.name}`, onClick: this.handleClick }, this.renderInput()));
13033
+ return (index.h(index.Host, { key: '7d036183d9376203451d9805e76b608cfa63570b', class: `general-input--${this.name}`, onClick: this.handleClick }, this.renderInput()));
12922
13034
  }
12923
13035
  get host() { return index.getElement(this); }
12924
13036
  static get watchers() { return {
@@ -15184,7 +15296,7 @@ const NumberInput = class {
15184
15296
  };
15185
15297
  NumberInput.style = NumberInputStyle0;
15186
15298
 
15187
- 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}";
15299
+ 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}";
15188
15300
  const PasswordInputStyle0 = passwordInputCss;
15189
15301
 
15190
15302
  const PasswordInput = class {
@@ -15244,6 +15356,7 @@ const PasswordInput = class {
15244
15356
  this.isDuplicateInput = undefined;
15245
15357
  this.hidePasswordComplexity = false;
15246
15358
  this.clientStyling = '';
15359
+ this.enableSouthAfricanMode = undefined;
15247
15360
  this.isValid = undefined;
15248
15361
  this.errorMessage = undefined;
15249
15362
  this.limitStylingAppends = false;
@@ -15422,13 +15535,23 @@ const PasswordInput = class {
15422
15535
  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$1(`${complexity.ruleKey}`, this.language) ? translate$1(`${complexity.ruleKey}`, this.language) : complexity.rule)));
15423
15536
  }))));
15424
15537
  }
15538
+ renderCustomComplexityPopup() {
15539
+ return (index.h("div", { class: `customreg-password__complexity ${!this.showPopup ? 'customreg-password__complexity--hidden' : ''}` }, index.h("p", { class: 'customreg-password__complexity--title' }, translate$1('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
15540
+ ? CONSTANTS.PASSWORD_COMPLEXITY_PASSED : CONSTANTS.PASSWORD_COMPLEXITY_FAILED}` }, complexity.passed ? STATUS_ICONS.PASSED : STATUS_ICONS.FAILED), index.h("span", null, translate$1(complexity.ruleKey, this.language) || complexity.rule)))))));
15541
+ }
15425
15542
  render() {
15426
15543
  let invalidClass = '';
15427
15544
  if (this.touched) {
15428
15545
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
15429
15546
  }
15430
- 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 &&
15431
- 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());
15547
+ 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 &&
15548
+ 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 &&
15549
+ this.showPopup &&
15550
+ !this.hidePasswordComplexity &&
15551
+ !this.isDuplicateInput &&
15552
+ (this.enableSouthAfricanMode
15553
+ ? this.renderCustomComplexityPopup()
15554
+ : this.renderComplexityPopup()));
15432
15555
  }
15433
15556
  get element() { return index.getElement(this); }
15434
15557
  static get watchers() { return {
@@ -16298,24 +16421,28 @@ const TextInput = class {
16298
16421
  this.postalcodelength = 5;
16299
16422
  this.touched = false;
16300
16423
  this.handleInput = (event) => {
16301
- this.value = event.target.value;
16424
+ const input = event.target;
16425
+ const normalizedValue = this.enableSouthAfricanMode &&
16426
+ (this.name === CONSTANTS.FIRSTNAME_ON_DOCUMENT ||
16427
+ this.name === CONSTANTS.LASTNAME_ON_DOCUMENT)
16428
+ ? input.value.replace(CONSTANTS.NON_LETTERS_REGEX, '')
16429
+ : input.value;
16430
+ if (normalizedValue !== input.value) {
16431
+ input.value = normalizedValue;
16432
+ }
16433
+ this.value = normalizedValue;
16302
16434
  this.touched = true;
16303
- if (this.debounceTime) {
16435
+ if (this.debounceTime)
16304
16436
  clearTimeout(this.debounceTime);
16305
- }
16306
16437
  this.debounceTime = setTimeout(() => {
16307
- this.isValid = this.setValidity();
16308
- this.errorMessage = this.setErrorMessage();
16309
- this.validityStateHandler({ valid: this.isValid, name: this.name });
16438
+ this.updateValidationState();
16310
16439
  this.emitValueHandler(true);
16311
16440
  }, 500);
16312
16441
  };
16313
16442
  this.handleBlur = (event) => {
16314
16443
  this.value = event.target.value;
16315
16444
  this.touched = true;
16316
- this.isValid = this.setValidity();
16317
- this.errorMessage = this.setErrorMessage();
16318
- this.validityStateHandler({ valid: this.isValid, name: this.name });
16445
+ this.updateValidationState();
16319
16446
  };
16320
16447
  this.setClientStyling = () => {
16321
16448
  let sheet = document.createElement('style');
@@ -16335,6 +16462,7 @@ const TextInput = class {
16335
16462
  this.isDuplicateInput = undefined;
16336
16463
  this.clientStyling = '';
16337
16464
  this.haspostalcodelookup = undefined;
16465
+ this.enableSouthAfricanMode = undefined;
16338
16466
  this.isValid = undefined;
16339
16467
  this.errorMessage = '';
16340
16468
  this.limitStylingAppends = false;
@@ -16372,15 +16500,13 @@ const TextInput = class {
16372
16500
  if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
16373
16501
  this.duplicateInputValue = event.detail.value;
16374
16502
  if (this.touched) {
16375
- this.isValid = this.setValidity();
16376
- this.errorMessage = this.setErrorMessage();
16503
+ this.updateValidationState();
16377
16504
  }
16378
16505
  }
16379
- if (this.name === event.detail.name + 'Duplicate'
16380
- && this.name.replace('Duplicate', '') === event.detail.name
16381
- && this.touched === true) {
16382
- this.isValid = this.setValidity();
16383
- this.errorMessage = this.setErrorMessage();
16506
+ if (this.name === event.detail.name + 'Duplicate' &&
16507
+ this.name.replace('Duplicate', '') === event.detail.name &&
16508
+ this.touched) {
16509
+ this.updateValidationState();
16384
16510
  }
16385
16511
  }
16386
16512
  handleValidationChange(event) {
@@ -16390,7 +16516,7 @@ const TextInput = class {
16390
16516
  this.validation = event.detail.validation;
16391
16517
  this.validationPattern = this.setPattern();
16392
16518
  if (this.touched) {
16393
- this.isValid = this.setValidity();
16519
+ this.isValid = this.isValidValue();
16394
16520
  this.errorMessage = this.setErrorMessage();
16395
16521
  }
16396
16522
  }
@@ -16426,13 +16552,37 @@ const TextInput = class {
16426
16552
  }
16427
16553
  this.value = newValue;
16428
16554
  this.touched = true;
16429
- this.isValid = true;
16430
- this.valueHandler({ name: this.name, value: newValue });
16431
- this.validityStateHandler({ valid: true, name: this.name });
16555
+ this.updateValidationState();
16432
16556
  }
16433
16557
  connectedCallback() {
16434
16558
  this.validationPattern = this.setPattern();
16435
16559
  }
16560
+ handleExternalDocUpdate(event) {
16561
+ if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
16562
+ return;
16563
+ this.value = event.detail || "";
16564
+ this.touched = true;
16565
+ if (this.inputReference) {
16566
+ this.inputReference.value = this.value;
16567
+ }
16568
+ this.sendInputValue.emit({
16569
+ name: this.name,
16570
+ value: this.value
16571
+ });
16572
+ this.updateValidationState();
16573
+ }
16574
+ handleDocReset() {
16575
+ if (this.name !== CONSTANTS.DOCUMENT_NUMBER)
16576
+ return;
16577
+ this.value = "";
16578
+ this.touched = false;
16579
+ this.isValid = false;
16580
+ this.errorMessage = "";
16581
+ if (this.inputReference) {
16582
+ this.inputReference.value = "";
16583
+ }
16584
+ this.validityStateHandler({ valid: false, name: this.name });
16585
+ }
16436
16586
  componentDidRender() {
16437
16587
  // start custom styling area
16438
16588
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -16449,6 +16599,7 @@ const TextInput = class {
16449
16599
  }
16450
16600
  componentDidLoad() {
16451
16601
  if (this.defaultValue) {
16602
+ this.value = this.defaultValue;
16452
16603
  this.valueHandler({ name: this.name, value: this.value });
16453
16604
  if (this.isDuplicateInput) {
16454
16605
  this.touched = true;
@@ -16460,18 +16611,49 @@ const TextInput = class {
16460
16611
  window.targetInputRefs[this.name] = this.inputReference;
16461
16612
  }
16462
16613
  }
16463
- this.isValid = this.setValidity();
16614
+ this.isValid = this.isValidValue();
16615
+ }
16616
+ validateDocument(valueRaw, docType) {
16617
+ const value = valueRaw.trim();
16618
+ if (docType === CONSTANTS.PASSPORT) {
16619
+ const valid = CONSTANTS.PASSPORT_NUMERIC_REGEX.test(value);
16620
+ return valid
16621
+ ? { valid: true }
16622
+ : { valid: false, errorKey: ERROR_KEYS.PASSPORT_INVALID };
16623
+ }
16624
+ if (docType === CONSTANTS.SOUTH_AFRICAN_ID) {
16625
+ if (value.length !== CONSTANTS.SOUTH_AFRICAN_ID_LENGTH) {
16626
+ return { valid: false, errorKey: ERROR_KEYS.SA_ID_LENGTH };
16627
+ }
16628
+ const valid = validateID(value);
16629
+ return valid
16630
+ ? { valid: true }
16631
+ : { valid: false, errorKey: ERROR_KEYS.SA_ID_INVALID };
16632
+ }
16633
+ return { valid: true };
16464
16634
  }
16465
- setValidity() {
16635
+ updateValidationState() {
16636
+ const nextValid = this.isValidValue();
16637
+ this.isValid = nextValid;
16638
+ if (!this.touched) {
16639
+ this.errorMessage = '';
16640
+ return;
16641
+ }
16642
+ this.errorMessage = nextValid ? '' : this.setErrorMessage();
16643
+ }
16644
+ isValidValue() {
16466
16645
  if (!this.inputReference) {
16467
16646
  return false;
16468
16647
  }
16469
- if (this.value.trim() === "" && !this.validation.mandatory) {
16470
- return true;
16648
+ if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
16649
+ const docType = window.documentTypeValue;
16650
+ return this.validateDocument(this.value, docType).valid;
16471
16651
  }
16472
- const inputIsValid = this.inputReference.validity.valid;
16473
- const inputMatchValidation = !this.inputReference.value || this.inputReference.value.match(this.validationPattern) !== null;
16474
- return inputIsValid && inputMatchValidation;
16652
+ const fallbackResult = (this.value.trim() === "" && !this.validation.mandatory) ||
16653
+ (this.inputReference.validity.valid &&
16654
+ (!this.inputReference.value ||
16655
+ this.inputReference.value.match(this.validationPattern) !== null));
16656
+ return fallbackResult;
16475
16657
  }
16476
16658
  setPattern() {
16477
16659
  var _a, _b;
@@ -16481,14 +16663,25 @@ const TextInput = class {
16481
16663
  }
16482
16664
  setErrorMessage() {
16483
16665
  var _a, _b, _c, _d;
16484
- if (this.value.trim() === "" && !this.validation.mandatory) {
16666
+ const value = this.value.trim();
16667
+ if (this.enableSouthAfricanMode && this.name === CONSTANTS.DOCUMENT_NUMBER) {
16668
+ const docType = window.documentTypeValue;
16669
+ const res = this.validateDocument(this.value, docType);
16670
+ return res.valid ? '' : translate$1(res.errorKey, this.language);
16671
+ }
16672
+ if (value === "" && !this.validation.mandatory) {
16485
16673
  return "";
16486
16674
  }
16487
16675
  if (this.inputReference.validity.valueMissing) {
16488
- return translate$1('requiredError', this.language);
16676
+ return translate$1(ERROR_KEYS.REQUIRED, this.language);
16489
16677
  }
16490
16678
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
16491
- return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
16679
+ return translate$1(ERROR_KEYS.LENGTH, this.language, {
16680
+ values: {
16681
+ minLength: this.validation.minLength,
16682
+ maxLength: this.validation.maxLength
16683
+ }
16684
+ });
16492
16685
  }
16493
16686
  if (this.inputReference.value.match(this.validationPattern) == null) {
16494
16687
  const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
@@ -16500,6 +16693,7 @@ const TextInput = class {
16500
16693
  const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
16501
16694
  return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
16502
16695
  }
16696
+ return "";
16503
16697
  }
16504
16698
  renderTooltip() {
16505
16699
  if (this.showTooltip) {
@@ -16512,8 +16706,8 @@ const TextInput = class {
16512
16706
  if (this.touched) {
16513
16707
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
16514
16708
  }
16515
- 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 &&
16516
- 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));
16709
+ 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 &&
16710
+ 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));
16517
16711
  }
16518
16712
  static get watchers() { return {
16519
16713
  "clientStyling": ["handleStylingChange"],
@@ -16698,20 +16892,24 @@ const TwofaInput = class {
16698
16892
  this.handleInput = (e, idx) => {
16699
16893
  const input = e.target;
16700
16894
  const value = input.value;
16701
- if (value.length > 1) {
16702
- input.value = value.charAt(1);
16703
- }
16704
- else {
16705
- input.value = value.charAt(0);
16706
- }
16707
- if (!value) {
16895
+ const char = value.slice(-1);
16896
+ input.value = char;
16897
+ if (!char)
16708
16898
  return;
16899
+ this.code[idx] = char;
16900
+ // --- Hide pin code --- //
16901
+ if (this.enableSouthAfricanMode) {
16902
+ // show character for 500ms
16903
+ this.revealedIndexes = [idx];
16904
+ if (this.revealTimeout)
16905
+ clearTimeout(this.revealTimeout);
16906
+ this.revealTimeout = setTimeout(() => {
16907
+ this.revealedIndexes = [];
16908
+ }, 500);
16709
16909
  }
16710
- this.code[idx] = input.value;
16711
16910
  const nextInput = this.inputRefs[idx + 1];
16712
- if (nextInput) {
16911
+ if (nextInput)
16713
16912
  nextInput.focus();
16714
- }
16715
16913
  this.setValidity();
16716
16914
  this.setErrorMessage();
16717
16915
  };
@@ -16740,6 +16938,8 @@ const TwofaInput = class {
16740
16938
  this.destination = '';
16741
16939
  this.resendIntervalSeconds = 60;
16742
16940
  this.clientStyling = '';
16941
+ this.enableSouthAfricanMode = undefined;
16942
+ this.pinAttemptsExceeded = undefined;
16743
16943
  this.clientStylingUrl = '';
16744
16944
  this.mbSource = undefined;
16745
16945
  this.limitStylingAppends = false;
@@ -16749,10 +16949,7 @@ const TwofaInput = class {
16749
16949
  this.errorMessage = '';
16750
16950
  this.code = [];
16751
16951
  this.resendIntervalSecondsLeft = this.resendIntervalSeconds;
16752
- }
16753
- handleStylingChange(newValue, oldValue) {
16754
- if (newValue !== oldValue)
16755
- this.setClientStyling();
16952
+ this.revealedIndexes = [];
16756
16953
  }
16757
16954
  validityChanged() {
16758
16955
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -16781,6 +16978,10 @@ const TwofaInput = class {
16781
16978
  this.showTooltip = false;
16782
16979
  }
16783
16980
  }
16981
+ handleStylingChange(newValue, oldValue) {
16982
+ if (newValue !== oldValue)
16983
+ this.setClientStyling();
16984
+ }
16784
16985
  connectedCallback() {
16785
16986
  this.validationPattern = this.setPattern();
16786
16987
  this.code = new Array(this.validation.maxLength).fill('');
@@ -16815,37 +17016,51 @@ const TwofaInput = class {
16815
17016
  }
16816
17017
  handleKeyDown(e, idx) {
16817
17018
  if (e.key === 'Backspace') {
16818
- this.code[idx] = '';
16819
- if (this.inputRefs[idx]) {
16820
- this.inputRefs[idx].value = '';
16821
- } // Clear input field
16822
- const prevInput = this.inputRefs[idx - 1];
16823
- if (prevInput) {
16824
- prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
17019
+ const newCode = [...this.code];
17020
+ newCode[idx] = '';
17021
+ this.code = newCode;
17022
+ if (this.enableSouthAfricanMode) {
17023
+ this.revealedIndexes = this.revealedIndexes.filter(i => i !== idx);
16825
17024
  }
17025
+ const prevInput = this.inputRefs[idx - 1];
17026
+ prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
16826
17027
  }
16827
17028
  this.setValidity();
16828
17029
  this.setErrorMessage();
16829
17030
  }
16830
17031
  handlePaste(e) {
16831
- var _a;
17032
+ var _a, _b;
16832
17033
  e.preventDefault();
16833
- const data = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text').trim();
16834
- if (!data) {
17034
+ const data = (_b = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) === null || _b === void 0 ? void 0 : _b.trim();
17035
+ if (!data)
16835
17036
  return;
17037
+ const value = data.slice(0, this.validation.maxLength).split('');
17038
+ this.code = [
17039
+ ...value,
17040
+ ...new Array(this.validation.maxLength - value.length).fill('')
17041
+ ];
17042
+ if (this.enableSouthAfricanMode) {
17043
+ this.revealedIndexes = value.map((_, i) => i);
17044
+ if (this.revealTimeout)
17045
+ clearTimeout(this.revealTimeout);
17046
+ this.revealTimeout = setTimeout(() => {
17047
+ this.revealedIndexes = [];
17048
+ }, 500);
16836
17049
  }
16837
- const value = data.slice(0, this.validation.maxLength).split(''); // Limit to OTP length
16838
- this.code = [...value, ...new Array(this.validation.maxLength - value.length).fill('')];
16839
- value.forEach((char, index) => {
16840
- this.inputRefs[index].value = char;
16841
- });
16842
- // Move focus to the last input or trigger submit
16843
17050
  const lastInput = this.inputRefs[Math.min(value.length, this.inputRefs.length - 1)];
16844
- if (lastInput) {
16845
- lastInput.focus();
16846
- }
17051
+ lastInput === null || lastInput === void 0 ? void 0 : lastInput.focus();
16847
17052
  this.setValidity();
16848
17053
  this.setErrorMessage();
17054
+ if (this.enableSouthAfricanMode) {
17055
+ this.valueHandler({
17056
+ name: this.name,
17057
+ value: this.code.join('')
17058
+ });
17059
+ this.validityStateHandler({
17060
+ valid: this.isValid,
17061
+ name: this.name
17062
+ });
17063
+ }
16849
17064
  }
16850
17065
  setValidity() {
16851
17066
  const code = this.code.join('');
@@ -16878,19 +17093,28 @@ const TwofaInput = class {
16878
17093
  }
16879
17094
  return null;
16880
17095
  }
17096
+ getInputDisplayValue(idx) {
17097
+ const current = this.code[idx];
17098
+ if (!current)
17099
+ return "";
17100
+ if (this.enableSouthAfricanMode) {
17101
+ return this.revealedIndexes.includes(idx) ? current : "*";
17102
+ }
17103
+ return current;
17104
+ }
16881
17105
  render() {
16882
- 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$1('twofaDescription', this.language, { values: { destination: this.destination } }) }), index.h("div", { key: '84df3ebbe4077ba8462c08cc7956349ec4a55b79', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((char, idx) => {
16883
- 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) }));
16884
- })), index.h("div", { key: 'abdf6e2a3ff7ef6436b59206c40ada5305543db3', class: "twofa__button-wrapper" }, index.h("p", { key: 'e0859c58e48741eb379fbcaf23519bb90404489b', class: "twofa__resend-message" }, translate$1('twofaResendMessage', this.language)), index.h("button", { key: '89aa3a93a9b97029fd315450892cef5edd5d5294', class: "twofa__resend-button", onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable }, this.isResendButtonAvailable
17106
+ 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$1('twofaDescription', this.language, { values: { destination: this.destination } }) }), index.h("div", { key: 'ca7600034af473838b741d5be4fe72ded9937647', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((_, idx) => {
17107
+ 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) }));
17108
+ })), index.h("div", { key: '0ecd60dd5e6b3f6c3a86176e1937e7aeeffc0e92', class: "twofa__button-wrapper" }, index.h("p", { key: 'fa9608598580bb8628d0e7a208cc69e3ebe83264', class: "twofa__resend-message" }, translate$1('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
16885
17109
  ? translate$1('twofaResendButton', this.language)
16886
17110
  : this.formatTime()))));
16887
17111
  }
16888
17112
  get host() { return index.getElement(this); }
16889
17113
  static get watchers() { return {
16890
- "clientStyling": ["handleStylingChange"],
16891
17114
  "isValid": ["validityChanged"],
16892
17115
  "emitValue": ["emitValueHandler"],
16893
- "clientStylingUrl": ["handleStylingUrlChange"]
17116
+ "clientStylingUrl": ["handleStylingUrlChange"],
17117
+ "clientStyling": ["handleStylingChange"]
16894
17118
  }; }
16895
17119
  };
16896
17120
  TwofaInput.style = TwofaInputStyle0;