@tap-payments/auth-jsconnect 2.0.103-test → 2.0.105-test

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.
@@ -13,6 +13,7 @@ export declare const VALID_FILE_FORMATS: string[];
13
13
  export declare const REGEX_FULL_NAME: RegExp;
14
14
  export declare const REGEX_WEBSITE: RegExp;
15
15
  export declare const REGEX_BENEFICIARY_NAME: RegExp;
16
+ export declare const REGEX_ALPHANUMERIC: RegExp;
16
17
  export declare const REGEX_BRAND_NAME: RegExp;
17
18
  export declare const EMAIL_MAX_LENGTH = 50;
18
19
  export declare const LINKEDIN_URL: RegExp;
@@ -13,6 +13,7 @@ export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'applic
13
13
  export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
14
14
  export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
15
15
  export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z()\s])*$/g;
16
+ export var REGEX_ALPHANUMERIC = /^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/? ]*$/g;
16
17
  export var REGEX_BRAND_NAME = /^(([a-zA-Z0-9])+\s)*[a-zA-Z0-9]+$/;
17
18
  export var EMAIL_MAX_LENGTH = 50;
18
19
  export var LINKEDIN_URL = /^((http|https):\/\/)(www.linkedin.com\/)in(\/)[a-zA-Z0-9-]+$/;
@@ -330,9 +330,9 @@ export var bankSlice = createSlice({
330
330
  }
331
331
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
332
332
  state.data.verify.token = token;
333
- state.data.bankData.bankName = (_b = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _b === void 0 ? void 0 : _b.bank_name;
334
- state.data.bankData.beneficiaryName = (_c = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _c === void 0 ? void 0 : _c.beneficiary_name;
335
- state.data.bankData.iban = (_d = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _d === void 0 ? void 0 : _d.iban;
333
+ state.data.bankData.bankName = ((_b = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _b === void 0 ? void 0 : _b.bank_name) || '';
334
+ state.data.bankData.beneficiaryName = ((_c = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _c === void 0 ? void 0 : _c.beneficiary_name) || '';
335
+ state.data.bankData.iban = ((_d = boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) === null || _d === void 0 ? void 0 : _d.iban) || '';
336
336
  })
337
337
  .addCase(verifyLeadToken.rejected, function (state, action) {
338
338
  state.error = action.error.message;
@@ -3,11 +3,10 @@ import * as React from 'react';
3
3
  import Input from '../../../shared/Input';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useController, useFormContext } from 'react-hook-form';
6
- import { styled } from '@mui/material';
7
- import { removeOnlyNumbers } from '../../../../utils';
6
+ import { styled } from '@mui/material/styles';
8
7
  import { ScreenContainer } from '../../../shared/Containers';
9
8
  import { bankSelector } from '../../../app/bank/bankStore';
10
- import { useAppSelector, useLanguage } from '../../../../hooks';
9
+ import { useAppSelector } from '../../../../hooks';
11
10
  import ClearIcon from '../../../shared/ClearIcon';
12
11
  import CheckIcon from '../../../shared/CheckIcon';
13
12
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
@@ -28,25 +27,20 @@ var Beneficiary = function () {
28
27
  var _a, _b;
29
28
  var t = useTranslation().t;
30
29
  var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
31
- var isAr = useLanguage().isAr;
32
30
  var data = useAppSelector(bankSelector).data;
33
31
  var beneficiaryControl = useController({ name: 'beneficiaryName', control: control });
34
32
  var beneficiaryValue = beneficiaryControl.field.value;
35
33
  var hasError = (_a = beneficiaryControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
36
34
  var error = (_b = beneficiaryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
37
- var _d = data.verify.responseBody || {}, bank_account = _d.bank_account, entity = _d.entity;
38
- var legalName = (entity === null || entity === void 0 ? void 0 : entity.legal_name) || {};
35
+ var bank_account = (data.verify.responseBody || {}).bank_account;
39
36
  React.useEffect(function () {
40
37
  var beneficiary_name = (bank_account || {}).beneficiary_name;
41
38
  if (beneficiary_name)
42
39
  setValue('beneficiaryName', beneficiary_name);
43
- else
44
- setValue('beneficiaryName', isAr ? legalName === null || legalName === void 0 ? void 0 : legalName.ar : legalName === null || legalName === void 0 ? void 0 : legalName.en);
45
40
  }, []);
46
41
  var handleBeneficiaryChange = function (_a) {
47
42
  var target = _a.target;
48
- var value = removeOnlyNumbers(target.value);
49
- beneficiaryControl.field.onChange(value);
43
+ beneficiaryControl.field.onChange(target.value);
50
44
  };
51
45
  var clearValue = function () {
52
46
  beneficiaryControl.field.onChange('');
@@ -1,4 +1,4 @@
1
- import { REGEX_BENEFICIARY_NAME, MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
1
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS, REGEX_ALPHANUMERIC } from '../../../../constants';
2
2
  import * as yup from 'yup';
3
3
  export var BankValidation = yup.object().shape({
4
4
  iban: yup
@@ -10,7 +10,7 @@ export var BankValidation = yup.object().shape({
10
10
  bankName: yup.string().optional(),
11
11
  beneficiaryName: yup
12
12
  .string()
13
- .matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
13
+ .matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid')
14
14
  .required('beneficiary_name_required'),
15
15
  bankStatementId: yup.string().optional(),
16
16
  bankStatementFile: yup
@@ -13,3 +13,5 @@ export declare function isPasswordHasLowerLetter(password: string): boolean;
13
13
  export declare function isPasswordHasSpecialLetter(password: string): boolean;
14
14
  export declare const keepLettersAndSpace: (str: string) => string;
15
15
  export declare const isTapDomain: (domain: string) => boolean;
16
+ export declare const removeArabicWords: (str: string) => string;
17
+ export declare const removeAllOtherThanArabicWords: (str: string) => string;
@@ -43,3 +43,9 @@ export var keepLettersAndSpace = function (str) {
43
43
  export var isTapDomain = function (domain) {
44
44
  return domain.includes('tap.company');
45
45
  };
46
+ export var removeArabicWords = function (str) {
47
+ return str.replace(/[\u0600-\u06FF]/g, '').trim();
48
+ };
49
+ export var removeAllOtherThanArabicWords = function (str) {
50
+ return str.replace(/[^ء-ي]/g, '');
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.103-test",
3
+ "version": "2.0.105-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",