@tap-payments/auth-jsconnect 2.3.6 → 2.3.7

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.
Files changed (62) hide show
  1. package/build/features/app/business/businessStore.js +2 -2
  2. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
  3. package/build/features/bank/screens/Verify/OTPInput.js +3 -1
  4. package/build/features/bank/screens/Verify/Verify.js +2 -2
  5. package/build/features/brand/screens/BrandActivities/BrandActivities.js +2 -1
  6. package/build/features/brand/screens/BrandInfo/BrandInfo.js +2 -2
  7. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +2 -1
  8. package/build/features/brand/screens/Verify/OTPInput.js +3 -1
  9. package/build/features/brand/screens/Verify/Verify.js +2 -2
  10. package/build/features/business/screens/Activities/Activities.js +2 -1
  11. package/build/features/business/screens/BusinessType/BusinessType.js +2 -2
  12. package/build/features/business/screens/CivilID/CivilID.js +2 -1
  13. package/build/features/business/screens/Customers/Customers.js +2 -1
  14. package/build/features/business/screens/IDBOD/IDBOD.js +2 -1
  15. package/build/features/business/screens/OTP/OTP.js +2 -2
  16. package/build/features/business/screens/OTP/OTPInput.js +5 -2
  17. package/build/features/business/screens/Verify/OTPInput.js +3 -1
  18. package/build/features/business/screens/Verify/Verify.js +2 -2
  19. package/build/features/connect/screens/BrandSegment/BrandSegment.js +2 -2
  20. package/build/features/connect/screens/CivilID/CivilID.js +2 -1
  21. package/build/features/connect/screens/Individual/Individual.js +2 -2
  22. package/build/features/connect/screens/Merchant/Merchant.js +2 -2
  23. package/build/features/connect/screens/Mobile/Mobile.js +2 -2
  24. package/build/features/connect/screens/NID/NID.js +7 -3
  25. package/build/features/connect/screens/OTP/OTP.js +2 -2
  26. package/build/features/connect/screens/OTP/OTPInput.js +4 -2
  27. package/build/features/connectExpress/screens/CivilID/CivilID.js +2 -1
  28. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +2 -1
  29. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +2 -2
  30. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +2 -2
  31. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +3 -3
  32. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +4 -2
  33. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -1
  34. package/build/features/connectExpress/screens/NID/NID.js +2 -1
  35. package/build/features/connectExpress/screens/NIDMissed/NID.js +2 -1
  36. package/build/features/connectExpress/screens/OTP/OTP.js +3 -3
  37. package/build/features/connectExpress/screens/OTP/OTPInput.js +4 -2
  38. package/build/features/entity/screens/EntityCapital/EntityCapital.js +2 -2
  39. package/build/features/entity/screens/EntityName/EntityName.js +2 -2
  40. package/build/features/entity/screens/Verify/OTPInput.js +3 -1
  41. package/build/features/entity/screens/Verify/Verify.js +2 -2
  42. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +2 -2
  43. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +2 -2
  44. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +2 -1
  45. package/build/features/individual/screens/Verify/OTPInput.js +3 -1
  46. package/build/features/individual/screens/Verify/Verify.js +2 -2
  47. package/build/features/password/screens/CreatePassword/CreatePassword.js +3 -2
  48. package/build/features/password/screens/OTP/OTP.js +2 -2
  49. package/build/features/password/screens/OTP/OTPInput.js +5 -2
  50. package/build/features/password/screens/Verify/OTPInput.js +3 -1
  51. package/build/features/password/screens/Verify/Verify.js +2 -2
  52. package/build/features/signIn/screens/Email/Email.js +2 -1
  53. package/build/features/signIn/screens/Mobile/Mobile.js +2 -1
  54. package/build/features/signIn/screens/OTP/OTP.js +2 -2
  55. package/build/features/signIn/screens/OTP/OTPInput.js +4 -2
  56. package/build/features/signIn/screens/Password/Password.js +2 -1
  57. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -2
  58. package/build/features/tax/screens/Verify/OTPInput.js +3 -1
  59. package/build/features/tax/screens/Verify/Verify.js +2 -2
  60. package/build/utils/object.d.ts +1 -0
  61. package/build/utils/object.js +14 -0
  62. package/package.json +1 -1
@@ -1182,7 +1182,7 @@ export var businessSlice = createSlice({
1182
1182
  state.error = action.error.message;
1183
1183
  })
1184
1184
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
1185
- var _a, _b;
1185
+ var _a, _b, _c, _d, _e, _f;
1186
1186
  state.loading = false;
1187
1187
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateLeadSuccessLoading: false });
1188
1188
  state.error = null;
@@ -1192,7 +1192,7 @@ export var businessSlice = createSlice({
1192
1192
  state.error = description;
1193
1193
  return;
1194
1194
  }
1195
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), response), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name });
1195
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), response), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name, merchant: ((_c = state.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.merchant) || ((_f = (_e = (_d = state.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.business) === null || _e === void 0 ? void 0 : _e.entity) === null || _f === void 0 ? void 0 : _f.merchant) });
1196
1196
  })
1197
1197
  .addCase(updateLeadSuccess.pending, function (state) {
1198
1198
  state.loading = true;
@@ -29,7 +29,7 @@ import Form from '../../../../components/Form';
29
29
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
30
30
  import ConfirmPolicy from './ConfirmPolicy';
31
31
  import BankStatement from './BankStatement';
32
- import { getFileDetailsFromDocument, isKW, isStringHasOneAsterisk } from '../../../../utils';
32
+ import { deepCopy, getFileDetailsFromDocument, isKW, isStringHasOneAsterisk } from '../../../../utils';
33
33
  var FormStyled = styled(Form)(function () { return ({
34
34
  display: 'flex',
35
35
  flexDirection: 'column',
@@ -103,7 +103,7 @@ var BankDetails = function () {
103
103
  var isBankNameVerified = dataVerified['bank_name'] && bank_name === methods.watch('bankName');
104
104
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
105
105
  var onSubmit = function (data) {
106
- dispatch(createBankAccount(getFelids(data)));
106
+ dispatch(createBankAccount(deepCopy(getFelids(data))));
107
107
  };
108
108
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, { readOnly: readOnly['beneficiaryName'] || noneEditable['beneficiary_name'], isVerified: isBeneficiaryNameVerified }), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking, readOnly: readOnly['iban'] || noneEditable['iban'], isVerified: isIBANVerified }), _jsx(BankName, { readOnly: readOnly['bankName'] || noneEditable['bank_name'], isVerified: isBankNameVerified }), _jsx(BankStatement, { isVerified: dataVerified['document'], required: isKWCountry && isFL && !bankHasDocument, defaultFiles: defaultBankFiles, readOnly: readOnly['bankStatementId'] || noneEditable['bank_statement_file_id'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_acknowledged'] }), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
109
109
  };
@@ -19,7 +19,7 @@ import { useTranslation } from 'react-i18next';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
21
  import { isTokenExpired } from '../../../../utils';
22
- import { resendOTP, bankSelector } from '../../../app/bank/bankStore';
22
+ import { resendOTP, bankSelector, clearError } from '../../../app/bank/bankStore';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
25
25
  return ({
@@ -36,6 +36,8 @@ var OTPInput = function (_a) {
36
36
  var dispatch = useAppDispatch();
37
37
  var error = useAppSelector(bankSelector).error;
38
38
  var handleOnOTPChange = function (otp) {
39
+ if (error)
40
+ dispatch(clearError());
39
41
  otpControl.field.onChange(otp);
40
42
  };
41
43
  var handleOnResendOTP = function () {
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { useLanguage, useAppSelector } from '../../../../hooks';
21
- import { maskPhone } from '../../../../utils';
21
+ import { deepCopy, maskPhone } from '../../../../utils';
22
22
  import Form from '../../../../components/Form';
23
23
  import Text from '../../../../components/Text';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -66,7 +66,7 @@ var VerifyNumber = function (_a) {
66
66
  };
67
67
  }, [methods.formState.isValid]);
68
68
  var onSubmit = function (formData) {
69
- dispatch(verifyBankLeadOTP(formData));
69
+ dispatch(verifyBankLeadOTP(deepCopy(formData)));
70
70
  };
71
71
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
72
72
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
@@ -21,6 +21,7 @@ import { BrandActivitiesValidationSchema } from './validation';
21
21
  import Button from '../../../shared/Button';
22
22
  import { brandSelector, updateBrandActivities } from '../../../app/brand/brandStore';
23
23
  import { handlePrevScreenStep } from '../../../../app/settings';
24
+ import { deepCopy } from '../../../../utils';
24
25
  import { useTranslation } from 'react-i18next';
25
26
  import ActivitiesList from './ActivitiesList';
26
27
  import CustomerBase from './CustomerBase';
@@ -94,7 +95,7 @@ var BrandActivities = function (_a) {
94
95
  var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_c = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _c === void 0 ? void 0 : _c.id) === ((_d = methods.watch('expectedSale')) === null || _d === void 0 ? void 0 : _d.id);
95
96
  var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_e = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _e === void 0 ? void 0 : _e.id) === ((_f = methods.watch('expectedCustomer')) === null || _f === void 0 ? void 0 : _f.id);
96
97
  var onSubmit = function (data) {
97
- dispatch(updateBrandActivities(getFelids(data)));
98
+ dispatch(updateBrandActivities(deepCopy(getFelids(data))));
98
99
  };
99
100
  var onBack = function () {
100
101
  dispatch(handlePrevScreenStep());
@@ -18,7 +18,7 @@ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, u
18
18
  import { handlePrevScreenStep } from '../../../../app/settings';
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import Form from '../../../../components/Form';
21
- import { mapSalesChannel } from '../../../../utils';
21
+ import { deepCopy, mapSalesChannel } from '../../../../utils';
22
22
  import Button from '../../../shared/Button';
23
23
  import { clearError, brandSelector, updateBrand, retrieveBoardStatus } from '../../../app/brand/brandStore';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -58,7 +58,7 @@ var BrandInfo = function (_a) {
58
58
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
59
59
  var isBrandNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && ((name === null || name === void 0 ? void 0 : name.en) === watch('brandName') || (name === null || name === void 0 ? void 0 : name.ar) === watch('brandName'));
60
60
  var onSubmit = function (data) {
61
- dispatch(updateBrand(getFelids(data)));
61
+ dispatch(updateBrand(deepCopy(getFelids(data))));
62
62
  };
63
63
  var onBack = function () {
64
64
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
@@ -19,6 +19,7 @@ import { handlePrevScreenStep } from '../../../../app/settings';
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import Collapse from '../../../../components/Collapse';
21
21
  import Form from '../../../../components/Form';
22
+ import { deepCopy } from '../../../../utils';
22
23
  import { ScreenContainer } from '../../../shared/Containers';
23
24
  import { clearError, brandSelector, updateSegmentBrand } from '../../../app/brand/brandStore';
24
25
  import Button from '../../../shared/Button';
@@ -80,7 +81,7 @@ var BrandInfo = function (_a) {
80
81
  var isSegmentTechVerified = dataVerified['segment.tech_type'] && ((_f = resSegment === null || resSegment === void 0 ? void 0 : resSegment.tech_type) === null || _f === void 0 ? void 0 : _f.id) === ((_g = watch('segmentTech')) === null || _g === void 0 ? void 0 : _g.id);
81
82
  var isTeamSizeVerified = dataVerified['segment.teams'] && ((_h = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _h === void 0 ? void 0 : _h.id) === ((_j = watch('teamSize')) === null || _j === void 0 ? void 0 : _j.id);
82
83
  var onSubmit = function (data) {
83
- dispatch(updateSegmentBrand(getFelids(data)));
84
+ dispatch(updateSegmentBrand(deepCopy(getFelids(data))));
84
85
  };
85
86
  var onBack = function () {
86
87
  dispatch(handlePrevScreenStep());
@@ -18,7 +18,7 @@ import { useController, useFormContext } from 'react-hook-form';
18
18
  import { useTranslation } from 'react-i18next';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
- import { brandSelector, resendOTP } from '../../../app/brand/brandStore';
21
+ import { brandSelector, clearError, resendOTP } from '../../../app/brand/brandStore';
22
22
  import { isTokenExpired } from '../../../../utils';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
@@ -36,6 +36,8 @@ var OTPInput = function (_a) {
36
36
  var dispatch = useAppDispatch();
37
37
  var error = useAppSelector(brandSelector).error;
38
38
  var handleOnOTPChange = function (otp) {
39
+ if (error)
40
+ dispatch(clearError());
39
41
  otpControl.field.onChange(otp);
40
42
  };
41
43
  var handleOnResendOTP = function () {
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { useLanguage, useAppSelector } from '../../../../hooks';
21
- import { maskPhone } from '../../../../utils';
21
+ import { deepCopy, maskPhone } from '../../../../utils';
22
22
  import Form from '../../../../components/Form';
23
23
  import Text from '../../../../components/Text';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -70,7 +70,7 @@ var VerifyNumber = function (_a) {
70
70
  };
71
71
  }, [methods.formState.isValid]);
72
72
  var onSubmit = function (formData) {
73
- dispatch(verifyBrandLeadOTP(formData));
73
+ dispatch(verifyBrandLeadOTP(deepCopy(formData)));
74
74
  };
75
75
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
76
76
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
@@ -20,6 +20,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import { useTranslation } from 'react-i18next';
21
21
  import { handlePrevScreenStep } from '../../../../app/settings';
22
22
  import Button from '../../../shared/Button';
23
+ import { deepCopy } from '../../../../utils';
23
24
  import { ScreenContainer } from '../../../shared/Containers';
24
25
  import Collapse from '../../../../components/Collapse';
25
26
  import OperationStartDate from './OperationStartDate';
@@ -48,7 +49,7 @@ var Activities = function () {
48
49
  });
49
50
  useSetFromDefaultValues(methods, data.activitiesData, true);
50
51
  var onSubmit = function (data) {
51
- dispatch(updateActivitiesInfo(__assign({}, data)));
52
+ dispatch(updateActivitiesInfo(deepCopy(data)));
52
53
  };
53
54
  var handleCollapseOpenClose = function (flag) {
54
55
  setCollapse(flag);
@@ -23,7 +23,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
23
  import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
24
24
  import { BusinessType as Type } from '../../../../@types';
25
25
  import Button from '../../../shared/Button';
26
- import { isKW, isOtherLicense, isSA } from '../../../../utils';
26
+ import { deepCopy, isKW, isOtherLicense, isSA } from '../../../../utils';
27
27
  import { KWLicenseValidationSchema, LicenseValidationSchema } from './validation';
28
28
  import LicenseList from './LicenseList';
29
29
  import LicenseCertificate from './LicenseCertificate';
@@ -77,7 +77,7 @@ var BusinessType = function (_a) {
77
77
  certificateId: data.certificateId,
78
78
  articleId: data.articleId
79
79
  };
80
- dispatch(updateLeadBusinessType(dataValues));
80
+ dispatch(updateLeadBusinessType(deepCopy(dataValues)));
81
81
  };
82
82
  var onBack = function () {
83
83
  dispatch(handlePrevScreenStep());
@@ -33,6 +33,7 @@ import { clearError, businessSelector, createCivilIdAuth } from '../../../app/bu
33
33
  import Form from '../../../../components/Form';
34
34
  import Button from '../../../shared/Button';
35
35
  import { ScreenContainer } from '../../../shared/Containers';
36
+ import { deepCopy } from '../../../../utils';
36
37
  import IDNumber from './IDNumber';
37
38
  var FormStyled = styled(Form)(function () { return ({
38
39
  display: 'flex',
@@ -55,7 +56,7 @@ var CivilID = function (_a) {
55
56
  handleClearError();
56
57
  }, [methods.formState.isValid]);
57
58
  var onSubmit = function (data) {
58
- dispatch(createCivilIdAuth(data));
59
+ dispatch(createCivilIdAuth(deepCopy(data)));
59
60
  };
60
61
  var handleClearError = function () {
61
62
  if (error)
@@ -30,6 +30,7 @@ import TransactionPolicy from './TransactionPolicy';
30
30
  import { ScreenContainer } from '../../../shared/Containers';
31
31
  import Collapse from '../../../../components/Collapse';
32
32
  import { businessSelector, clearError, updateCustomersInfo } from '../../../app/business/businessStore';
33
+ import { deepCopy } from '../../../../utils';
33
34
  var FormStyled = styled(Form)(function () { return ({
34
35
  display: 'flex',
35
36
  flexDirection: 'column'
@@ -74,7 +75,7 @@ var Customers = function (_a) {
74
75
  }
75
76
  }, [terms]);
76
77
  var onSubmit = function (data) {
77
- dispatch(updateCustomersInfo(data));
78
+ dispatch(updateCustomersInfo(deepCopy(data)));
78
79
  };
79
80
  var onBack = function () {
80
81
  dispatch(handlePrevScreenStep());
@@ -32,6 +32,7 @@ import Button from '../../../shared/Button';
32
32
  import { ScreenContainer } from '../../../shared/Containers';
33
33
  import { businessSelector, clearError, updateLeadIdentity } from '../../../app/business/businessStore';
34
34
  import Collapse from '../../../../components/Collapse';
35
+ import { deepCopy } from '../../../../utils';
35
36
  import { NIDValidationSchema } from './validation';
36
37
  import ID from './ID';
37
38
  import DOB from './DOB';
@@ -57,7 +58,7 @@ var IDBOD = function (_a) {
57
58
  dispatch(clearError());
58
59
  }, [methods.formState.isValid]);
59
60
  var onSubmit = function (data) {
60
- dispatch(updateLeadIdentity(data));
61
+ dispatch(updateLeadIdentity(deepCopy(data)));
61
62
  };
62
63
  var handleCollapseOpenClose = function (flag) {
63
64
  setCollapse(flag);
@@ -35,7 +35,7 @@ import Text from '../../../../components/Text';
35
35
  import { ScreenContainer } from '../../../shared/Containers';
36
36
  import { businessSelector, clearError, resetOTPScreen, verifyLeadOTP } from '../../../app/business/businessStore';
37
37
  import Button from '../../../shared/Button';
38
- import { maskID } from '../../../../utils';
38
+ import { deepCopy, maskID } from '../../../../utils';
39
39
  import { OTPValidation } from './validation';
40
40
  import OTPInput from './OTPInput';
41
41
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -77,7 +77,7 @@ var OTP = function (_a) {
77
77
  };
78
78
  }, [methods.formState.isValid]);
79
79
  var onSubmit = function (formData) {
80
- dispatch(verifyLeadOTP(formData));
80
+ dispatch(verifyLeadOTP(deepCopy(formData)));
81
81
  };
82
82
  var onBack = function () {
83
83
  dispatch(handlePrevScreenStep());
@@ -17,8 +17,8 @@ import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { resendOTPLeadIdentity } from '../../../app/business/businessStore';
21
- import { useAppDispatch } from '../../../../hooks';
20
+ import { businessSelector, clearError, resendOTPLeadIdentity } from '../../../app/business/businessStore';
21
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
24
24
  return ({
@@ -31,8 +31,11 @@ var OTPInput = function (_a) {
31
31
  var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
32
32
  var t = useTranslation().t;
33
33
  var dispatch = useAppDispatch();
34
+ var error = useAppSelector(businessSelector).error;
34
35
  var otpControl = useController({ name: 'otp', control: control });
35
36
  var handleOnOTPChange = function (otp) {
37
+ if (error)
38
+ dispatch(clearError());
36
39
  otpControl.field.onChange(otp);
37
40
  };
38
41
  var handleOnResendOTP = function () {
@@ -19,7 +19,7 @@ import { useController, useFormContext } from 'react-hook-form';
19
19
  import { useTranslation } from 'react-i18next';
20
20
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
21
21
  import { isTokenExpired } from '../../../../utils';
22
- import { businessSelector, resendOTP } from '../../../app/business/businessStore';
22
+ import { businessSelector, clearError, resendOTP } from '../../../app/business/businessStore';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
25
25
  return ({
@@ -36,6 +36,8 @@ var OTPInput = function (_a) {
36
36
  var dispatch = useAppDispatch();
37
37
  var error = useAppSelector(businessSelector).error;
38
38
  var handleOnOTPChange = function (otp) {
39
+ if (error)
40
+ dispatch(clearError());
39
41
  otpControl.field.onChange(otp);
40
42
  };
41
43
  var handleOnResendOTP = function () {
@@ -19,7 +19,7 @@ import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { handlePrevScreenStep } from '../../../../app/settings';
21
21
  import { useLanguage } from '../../../../hooks';
22
- import { maskPhone } from '../../../../utils';
22
+ import { deepCopy, maskPhone } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Text from '../../../../components/Text';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
@@ -67,7 +67,7 @@ var VerifyNumber = function (_a) {
67
67
  };
68
68
  }, [methods.formState.isValid]);
69
69
  var onSubmit = function (formData) {
70
- dispatch(verifyLeadOTP(formData));
70
+ dispatch(verifyLeadOTP(deepCopy(formData)));
71
71
  };
72
72
  var onBack = function () {
73
73
  dispatch(handlePrevScreenStep());
@@ -17,7 +17,7 @@ import Collapse from '@mui/material/Collapse';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import { handlePrevScreenStep } from '../../../../app/settings';
20
- import { sendCustomEventToGTM } from '../../../../utils';
20
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
21
21
  import Form from '../../../../components/Form';
22
22
  import { ScreenContainer } from '../../../shared/Containers';
23
23
  import Button from '../../../shared/Button';
@@ -62,7 +62,7 @@ var BrandSegment = function (_a) {
62
62
  var isAr = useLanguage().isAr;
63
63
  var dispatch = useAppDispatch();
64
64
  var onSubmit = function (formData) {
65
- dispatch(updateLeadBrandSegment(formData));
65
+ dispatch(updateLeadBrandSegment(deepCopy(formData)));
66
66
  };
67
67
  var onBack = function () {
68
68
  dispatch(handlePrevScreenStep());
@@ -18,6 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { civilIDValidationSchema } from './validation';
19
19
  import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
+ import { deepCopy } from '../../../../utils';
21
22
  import { clearError, connectSelector, createCivilIdAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
22
23
  import Form from '../../../../components/Form';
23
24
  import Button, { MobileButton } from '../../../shared/Button';
@@ -75,7 +76,7 @@ var CivilID = function (_a) {
75
76
  handleClearError();
76
77
  }, [methods.formState.isValid]);
77
78
  var onSubmit = function (data) {
78
- dispatch(createCivilIdAuth(data));
79
+ dispatch(createCivilIdAuth(deepCopy(data)));
79
80
  dispatch(resetMobileScreen(settingsStore.data.businessCountry));
80
81
  };
81
82
  var handleClearError = function () {
@@ -40,7 +40,7 @@ import MobileNumber from './MobileNumber';
40
40
  import { countriesCode } from '../../../../constants';
41
41
  import { AuthForType } from '../../../../@types';
42
42
  import Collapse from '../../../../components/Collapse';
43
- import { isKW, sendCustomEventToGTM } from '../../../../utils';
43
+ import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
44
44
  var FormStyled = styled(Form)(function () { return ({
45
45
  display: 'flex',
46
46
  flexDirection: 'column',
@@ -79,7 +79,7 @@ var Individual = function (_a) {
79
79
  methods.setValue('countryCode', defaultValues.countryCode);
80
80
  }, [defaultValues.countryCode]);
81
81
  var onSubmit = function (formData) {
82
- dispatch(updateLeadIndividual(formData));
82
+ dispatch(updateLeadIndividual(deepCopy(formData)));
83
83
  };
84
84
  var onBack = function () {
85
85
  var _a;
@@ -17,7 +17,7 @@ import Collapse from '@mui/material/Collapse';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import { handlePrevScreenStep } from '../../../../app/settings';
20
- import { sendCustomEventToGTM } from '../../../../utils';
20
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
21
21
  import Form from '../../../../components/Form';
22
22
  import { ScreenContainer } from '../../../shared/Containers';
23
23
  import Button from '../../../shared/Button';
@@ -63,7 +63,7 @@ var Merchant = function (_a) {
63
63
  var dispatch = useAppDispatch();
64
64
  var brandListItem = methods.getValues('selectedBrandItem');
65
65
  var onSubmit = function (formData) {
66
- dispatch(updateLeadBrand(__assign(__assign({}, formData), { isNewBrand: isRequiredNewBrand })));
66
+ dispatch(updateLeadBrand(deepCopy(__assign(__assign({}, formData), { isNewBrand: isRequiredNewBrand }))));
67
67
  };
68
68
  var onBack = function () {
69
69
  dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
@@ -25,7 +25,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
25
  import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen, resetStore } from '../../../app/connect/connectStore';
26
26
  import { useLanguage } from '../../../../hooks';
27
27
  import Divider from '@mui/material/Divider';
28
- import { isKW, sendCustomEventToGTM } from '../../../../utils';
28
+ import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
29
29
  import Text from '../../../../components/Text';
30
30
  import MIDTitle from './Title';
31
31
  import MobileNumber from './MobileNumber';
@@ -103,7 +103,7 @@ var Mobile = function (_a) {
103
103
  dispatch(clearError());
104
104
  }, [methods.formState.isValid]);
105
105
  var onSubmit = function (formData) {
106
- dispatch(createMobileAuth(formData));
106
+ dispatch(createMobileAuth(deepCopy(formData)));
107
107
  dispatch(resetNIDScreen());
108
108
  dispatch(resetCivilScreen());
109
109
  };
@@ -22,7 +22,7 @@ import { clearError, connectSelector, createNIDAuth, resetMobileScreen, resetSto
22
22
  import Form from '../../../../components/Form';
23
23
  import Button, { MobileButton } from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
- import { sendCustomEventToGTM } from '../../../../utils';
25
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
26
26
  import Collapse from '../../../../components/Collapse';
27
27
  import Box from '@mui/material/Box';
28
28
  import Divider from '@mui/material/Divider';
@@ -63,17 +63,21 @@ var NID = function (_a) {
63
63
  var dispatch = useAppDispatch();
64
64
  var t = useTranslation().t;
65
65
  var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
66
+ var _d = data.nidData, dob = _d.dob, nid = _d.nid;
66
67
  var settingsStore = useAppSelector(settingsSelector);
67
68
  var methods = useForm({
68
69
  resolver: yupResolver(NIDValidationSchema),
69
- defaultValues: data.nidData,
70
+ defaultValues: {
71
+ dob: dob,
72
+ nid: nid
73
+ },
70
74
  mode: 'onChange'
71
75
  });
72
76
  React.useEffect(function () {
73
77
  handleClearError();
74
78
  }, [methods.formState.isValid]);
75
79
  var onSubmit = function (data) {
76
- dispatch(createNIDAuth(data));
80
+ dispatch(createNIDAuth(deepCopy(data)));
77
81
  dispatch(resetMobileScreen(settingsStore.data.businessCountry));
78
82
  };
79
83
  var handleCollapseOpenClose = function (flag) {
@@ -25,7 +25,7 @@ import { AuthForType } from '../../../../@types';
25
25
  import { useForm, FormProvider } from 'react-hook-form';
26
26
  import { yupResolver } from '@hookform/resolvers/yup';
27
27
  import Form from '../../../../components/Form';
28
- import { maskPhone, maskID, sendCustomEventToGTM } from '../../../../utils';
28
+ import { maskPhone, maskID, sendCustomEventToGTM, deepCopy } from '../../../../utils';
29
29
  import { OTPValidation } from './validation';
30
30
  import OTPInput from './OTPInput';
31
31
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -78,7 +78,7 @@ var OTP = function () {
78
78
  };
79
79
  }, [methods.formState.isValid]);
80
80
  var onSubmit = function (formData) {
81
- dispatch(verifyAuth(formData));
81
+ dispatch(verifyAuth(deepCopy(formData)));
82
82
  };
83
83
  var onBack = function () {
84
84
  dispatch(handlePrevScreenStep(startWithNID ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { AuthForType } from '../../../../@types';
21
- import { connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
21
+ import { clearError, connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
23
  import { sendCustomEventToGTM } from '../../../../utils';
24
24
  var BoxStyled = styled(Box)(function (_a) {
@@ -34,9 +34,11 @@ var OTPInput = function (_a) {
34
34
  var t = useTranslation().t;
35
35
  var dispatch = useAppDispatch();
36
36
  var otpControl = useController({ name: 'otp', control: control });
37
- var data = useAppSelector(connectSelector).data;
37
+ var _c = useAppSelector(connectSelector), data = _c.data, error = _c.error;
38
38
  var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
39
39
  var handleOnOTPChange = function (otp) {
40
+ if (error)
41
+ dispatch(clearError());
40
42
  otpControl.field.onChange(otp);
41
43
  };
42
44
  var sendEventAskAnotherOTP = function () {
@@ -27,6 +27,7 @@ import Box from '@mui/material/Box';
27
27
  import Divider from '@mui/material/Divider';
28
28
  import Text from '../../../../components/Text';
29
29
  import IDNumber from './IDNumber';
30
+ import { deepCopy } from '../../../../utils';
30
31
  var FormStyled = styled(Form)(function () { return ({
31
32
  display: 'flex',
32
33
  flexDirection: 'column'
@@ -73,7 +74,7 @@ var CivilID = function (_a) {
73
74
  dispatch(resetStore());
74
75
  }, []);
75
76
  var onSubmit = function (data) {
76
- dispatch(createCivilIdAuthAsync(data));
77
+ dispatch(createCivilIdAuthAsync(deepCopy(data)));
77
78
  };
78
79
  var onBack = function () {
79
80
  dispatch(handlePrevScreenStep());
@@ -22,6 +22,7 @@ import { clearError, connectExpressSelector, createCivilIDAuthIdentityAsync } fr
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
+ import { deepCopy } from '../../../../utils';
25
26
  import IDNumber from './IDNumber';
26
27
  var FormStyled = styled(Form)(function () { return ({
27
28
  display: 'flex',
@@ -42,7 +43,7 @@ var CivilID = function (_a) {
42
43
  dispatch(clearError());
43
44
  }, [methods.formState.isValid]);
44
45
  var onSubmit = function (data) {
45
- dispatch(createCivilIDAuthIdentityAsync(data));
46
+ dispatch(createCivilIDAuthIdentityAsync(deepCopy(data)));
46
47
  };
47
48
  var onBack = function () {
48
49
  dispatch(handlePrevScreenStep());
@@ -15,7 +15,7 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
18
- import { isSA } from '../../../../utils';
18
+ import { deepCopy, isSA } from '../../../../utils';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
@@ -67,7 +67,7 @@ var CollectBusinessInfo = function (_a) {
67
67
  licenseNumber: data.licenseNumber,
68
68
  termAndConditionChecked: data.termAndConditionChecked
69
69
  };
70
- dispatch(updateLeadBusinessDataAsync(getFelids(dataValues)));
70
+ dispatch(updateLeadBusinessDataAsync(deepCopy(getFelids(dataValues))));
71
71
  };
72
72
  var onBack = function () {
73
73
  dispatch(handlePrevScreenStep());
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
19
19
  import { AuthForType } from '../../../../@types';
20
20
  import { useLanguage } from '../../../../hooks';
21
- import { isKW } from '../../../../utils';
21
+ import { deepCopy, isKW } from '../../../../utils';
22
22
  import { countriesCode } from '../../../../constants';
23
23
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
24
24
  import Form from '../../../../components/Form';
@@ -64,7 +64,7 @@ var CollectIndividualInfo = function (_a) {
64
64
  methods.setValue('countryCode', countryCode);
65
65
  }, [countryCode]);
66
66
  var onSubmit = function (formData) {
67
- dispatch(updateLeadIndividualAsync(getFelids(formData)));
67
+ dispatch(updateLeadIndividualAsync(deepCopy(getFelids(formData))));
68
68
  };
69
69
  var onBack = function () {
70
70
  var _a;
@@ -25,7 +25,7 @@ import { AuthForType } from '../../../../@types';
25
25
  import { useForm, FormProvider } from 'react-hook-form';
26
26
  import { yupResolver } from '@hookform/resolvers/yup';
27
27
  import Form from '../../../../components/Form';
28
- import { maskPhone, maskID } from '../../../../utils';
28
+ import { maskPhone, maskID, deepCopy } from '../../../../utils';
29
29
  import { OTPValidation } from './validation';
30
30
  import OTPInput from './OTPInput';
31
31
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -70,10 +70,10 @@ var OTP = function () {
70
70
  }, []);
71
71
  var onSubmit = function (formData) {
72
72
  if (isNidAuth) {
73
- dispatch(verifyNIDOtpLeadIdentityAsync(formData));
73
+ dispatch(verifyNIDOtpLeadIdentityAsync(deepCopy(formData)));
74
74
  return;
75
75
  }
76
- dispatch(verifyMobileOtpAsync(formData));
76
+ dispatch(verifyMobileOtpAsync(deepCopy(formData)));
77
77
  };
78
78
  var onBack = function () {
79
79
  dispatch(handlePrevScreenStep());