@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
@@ -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 { resendNIDAuthIdentityOTP, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
21
+ import { resendNIDAuthIdentityOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
@@ -33,10 +33,12 @@ var OTPInput = function (_a) {
33
33
  var t = useTranslation().t;
34
34
  var dispatch = useAppDispatch();
35
35
  var otpControl = useController({ name: 'otp', control: control });
36
- var data = useAppSelector(connectExpressSelector).data;
36
+ var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
37
37
  var nidData = data.nidData;
38
38
  var isNidAuth = 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 handleOnResendOTP = function () {
@@ -30,6 +30,7 @@ import MobileNumber from './MobileNumber';
30
30
  import { PhoneValidationSchema } from './validation';
31
31
  import { ICONS_NAMES } from '../../../../constants';
32
32
  import TAC from './TAC';
33
+ import { deepCopy } from '../../../../utils';
33
34
  var FormStyled = styled(Form)(function () { return ({
34
35
  display: 'flex',
35
36
  flexDirection: 'column'
@@ -91,7 +92,7 @@ var Mobile = function (_a) {
91
92
  dispatch(resetStore());
92
93
  }, []);
93
94
  var onSubmit = function (formData) {
94
- dispatch(createMobileAuthAsync(formData));
95
+ dispatch(createMobileAuthAsync(deepCopy(formData)));
95
96
  };
96
97
  var onBack = function () {
97
98
  var screen = isKuwait ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP';
@@ -29,6 +29,7 @@ import Text from '../../../../components/Text';
29
29
  import IDNumber from './IDNumber';
30
30
  import DOB from './DOB';
31
31
  import TAC from './TAC';
32
+ import { deepCopy } from '../../../../utils';
32
33
  var FormStyled = styled(Form)(function () { return ({
33
34
  display: 'flex',
34
35
  flexDirection: 'column'
@@ -77,7 +78,7 @@ var NID = function (_a) {
77
78
  React.useEffect(function () {
78
79
  }, []);
79
80
  var onSubmit = function (data) {
80
- dispatch(createNIDAuthAsync(data));
81
+ dispatch(createNIDAuthAsync(deepCopy(data)));
81
82
  };
82
83
  var handleCollapseOpenClose = function (flag) {
83
84
  setCollapse(flag);
@@ -25,6 +25,7 @@ import { ScreenContainer } from '../../../shared/Containers';
25
25
  import Collapse from '../../../../components/Collapse';
26
26
  import IDNumber from './IDNumber';
27
27
  import DOB from './DOB';
28
+ import { deepCopy } from '../../../../utils';
28
29
  var FormStyled = styled(Form)(function () { return ({
29
30
  display: 'flex',
30
31
  flexDirection: 'column'
@@ -45,7 +46,7 @@ var NID = function (_a) {
45
46
  dispatch(clearError());
46
47
  }, [methods.formState.isValid]);
47
48
  var onSubmit = function (data) {
48
- dispatch(createNIDAuthIdentityAsync(data));
49
+ dispatch(createNIDAuthIdentityAsync(deepCopy(data)));
49
50
  };
50
51
  var handleCollapseOpenClose = function (flag) {
51
52
  setCollapse(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 } 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(verifyNIDOtpAsync(formData));
73
+ dispatch(verifyNIDOtpAsync(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
  var screen = isNidAuth ? 'CONNECT_EXPRESS_NID_STEP' : 'CONNECT_EXPRESS_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 { resendMobileAuthOTP, resendNIDAuthOTP, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
21
+ import { resendMobileAuthOTP, resendNIDAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
@@ -33,10 +33,12 @@ var OTPInput = function (_a) {
33
33
  var t = useTranslation().t;
34
34
  var dispatch = useAppDispatch();
35
35
  var otpControl = useController({ name: 'otp', control: control });
36
- var data = useAppSelector(connectExpressSelector).data;
36
+ var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
37
37
  var mobileData = data.mobileData, nidData = data.nidData, responseData = data.responseData;
38
38
  var isNidAuth = 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 handleOnResendOTP = function () {
@@ -16,7 +16,7 @@ import { useTranslation } from 'react-i18next';
16
16
  import { styled } from '@mui/material/styles';
17
17
  import Collapse from '@mui/material/Collapse';
18
18
  import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
19
- import { removeAllCharsFromNumber } from '../../../../utils';
19
+ import { deepCopy, removeAllCharsFromNumber } from '../../../../utils';
20
20
  import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
21
21
  import { yupResolver } from '@hookform/resolvers/yup';
22
22
  import { handlePrevScreenStep } from '../../../../app/settings';
@@ -68,7 +68,7 @@ var EntityCapital = function (_a) {
68
68
  var isCapitalShareCountVerified = dataVerified['capital.shares.count'] && ((_d = (_c = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _c === void 0 ? void 0 : _c.count) === null || _d === void 0 ? void 0 : _d.toString()) === ((_e = watch('capitalShareCount')) === null || _e === void 0 ? void 0 : _e.toString());
69
69
  var isCapitalShareValueVerified = dataVerified['capital.shares.value'] && ((_g = (_f = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.toString()) === removeAllCharsFromNumber(watch('capitalShareValue'));
70
70
  var onSubmit = function (data) {
71
- dispatch(updateEntityCapital(getFelids(data)));
71
+ dispatch(updateEntityCapital(deepCopy(getFelids(data))));
72
72
  };
73
73
  var onBack = function () {
74
74
  dispatch(handlePrevScreenStep());
@@ -17,7 +17,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
- import { convertToEnglishDateFormat, getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
20
+ import { convertToEnglishDateFormat, deepCopy, getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
21
21
  import { BusinessType, DocumentPurpose } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
@@ -107,7 +107,7 @@ var EntityName = function (_a) {
107
107
  var isExpiryDateVerified = dataVerified['license.expiry_date'] && expDateRes === watch('expiryDate');
108
108
  var isArticleIdVerified = dataVerified['AOA_file_id'];
109
109
  var onSubmit = function (data) {
110
- dispatch(updateEntityName(getFelids(data)));
110
+ dispatch(updateEntityName(deepCopy(getFelids(data))));
111
111
  };
112
112
  var handleIssueDateOpenClose = function (flag) {
113
113
  setIssueAnchorEl(flag);
@@ -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 { entitySelector, resendOTP } from '../../../app/entity/entityStore';
22
+ import { clearError, entitySelector, resendOTP } from '../../../app/entity/entityStore';
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(entitySelector).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(verifyEntityLeadOTP(formData));
73
+ dispatch(verifyEntityLeadOTP(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') }))] })) })) }));
@@ -19,7 +19,7 @@ import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
20
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
21
21
  import { DocumentPurpose, IndividualType } from '../../../../@types';
22
- import { getIndividualType, isSA } from '../../../../utils';
22
+ import { deepCopy, getIndividualType, isSA } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
25
25
  import Text from '../../../../components/Text';
@@ -106,7 +106,7 @@ var AdditionalIndividualInfo = function (_a) {
106
106
  var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
107
107
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
108
108
  var onSubmit = function (data) {
109
- dispatch(updateIndividualInfo(getFelids(data)));
109
+ dispatch(updateIndividualInfo(deepCopy(getFelids(data))));
110
110
  };
111
111
  var onBack = function () {
112
112
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
@@ -18,7 +18,7 @@ import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } fro
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
20
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
21
- import { convertToEnglishDateFormat, getUserName } from '../../../../utils';
21
+ import { convertToEnglishDateFormat, deepCopy, getUserName } from '../../../../utils';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
24
24
  import Text from '../../../../components/Text';
@@ -136,7 +136,7 @@ var IndividualPersonalInfo = function (_a) {
136
136
  var isBirthCityVerified = dataVerified['birth.city'] && ((_h = birth === null || birth === void 0 ? void 0 : birth.city) === null || _h === void 0 ? void 0 : _h.cityId) === ((_j = watch('placeOfBirthCity')) === null || _j === void 0 ? void 0 : _j.id);
137
137
  var isNationalityVerified = dataVerified['nationality'] && nationalityRes === ((_k = watch('nationality')) === null || _k === void 0 ? void 0 : _k.iso2);
138
138
  var onSubmit = function (data) {
139
- dispatch(updateIndividualPersonalInfo(getFelids(data)));
139
+ dispatch(updateIndividualPersonalInfo(deepCopy(getFelids(data))));
140
140
  };
141
141
  React.useEffect(function () {
142
142
  if (error)
@@ -25,6 +25,7 @@ import { individualSelector, clearError, updatePhoneInfo } from '../../../app/in
25
25
  import Button from '../../../shared/Button';
26
26
  import { IndividualPhoneInfoValidationSchema } from './validation';
27
27
  import MobileNumber from './MobileNumber';
28
+ import { deepCopy } from '../../../../utils';
28
29
  var FormStyled = styled(Form)(function () { return ({
29
30
  display: 'flex',
30
31
  flexDirection: 'column'
@@ -51,7 +52,7 @@ var PhoneInfo = function (_a) {
51
52
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
52
53
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
53
54
  var onSubmit = function (formData) {
54
- dispatch(updatePhoneInfo(getFelids(formData)));
55
+ dispatch(updatePhoneInfo(deepCopy(getFelids(formData))));
55
56
  };
56
57
  React.useEffect(function () {
57
58
  if (error && methods.formState.isValid)
@@ -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 { individualSelector, resendOTP } from '../../../app/individual/individualStore';
22
+ import { clearError, individualSelector, resendOTP } from '../../../app/individual/individualStore';
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(individualSelector).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(verifyLeadOTP(formData));
73
+ dispatch(verifyLeadOTP(deepCopy(formData)));
74
74
  };
75
75
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
76
76
  var dataLoading = loading || cityLoading;
@@ -27,6 +27,7 @@ import { PasswordValidation } from './validation';
27
27
  import Password from './Password';
28
28
  import { createPassword, passwordSelector, storePasswordScreen } from '../../../app/password/passwordStore';
29
29
  import { useSelector } from 'react-redux';
30
+ import { deepCopy } from '../../../../utils';
30
31
  var InputsContainerStyled = styled(Box)(function (_a) {
31
32
  var theme = _a.theme;
32
33
  return ({
@@ -52,11 +53,11 @@ var CreatePassword = function (_a) {
52
53
  useSetFromDefaultValues(methods, data.passwordData);
53
54
  var onSubmit = function (data) {
54
55
  if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
55
- dispatch(storePasswordScreen(data));
56
+ dispatch(storePasswordScreen(deepCopy(data)));
56
57
  dispatch(handleNextScreenStep('PASSWORD_RESET_PASSWORD_OTP_STEP'));
57
58
  return;
58
59
  }
59
- dispatch(createPassword(data));
60
+ dispatch(createPassword(deepCopy(data)));
60
61
  };
61
62
  var onBack = function () {
62
63
  dispatch(handleCurrentActiveScreen('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
@@ -35,7 +35,7 @@ import Text from '../../../../components/Text';
35
35
  import { ScreenContainer } from '../../../shared/Containers';
36
36
  import { passwordSelector, clearError, resetOTPScreen, resetPassword } from '../../../app/password/passwordStore';
37
37
  import Button from '../../../shared/Button';
38
- import { maskPhone } from '../../../../utils';
38
+ import { deepCopy, maskPhone } from '../../../../utils';
39
39
  import { OTPValidation } from './validation';
40
40
  import OTPInput from './OTPInput';
41
41
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -78,7 +78,7 @@ var OTP = function (_a) {
78
78
  };
79
79
  }, [methods.formState.isValid]);
80
80
  var onSubmit = function (formData) {
81
- dispatch(resetPassword(formData));
81
+ dispatch(resetPassword(deepCopy(formData)));
82
82
  };
83
83
  var onBack = function () {
84
84
  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 { useAppDispatch } from '../../../../hooks';
21
- import { resendOperationOTP } from '../../../../features/app/password/passwordStore';
20
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
+ import { clearError, passwordSelector, resendOperationOTP } from '../../../../features/app/password/passwordStore';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
24
24
  return ({
@@ -32,7 +32,10 @@ var OTPInput = function (_a) {
32
32
  var t = useTranslation().t;
33
33
  var dispatch = useAppDispatch();
34
34
  var otpControl = useController({ name: 'otp', control: control });
35
+ var error = useAppSelector(passwordSelector).error;
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 { passwordSelector, resendOTP } from '../../../app/password/passwordStore';
22
+ import { clearError, passwordSelector, resendOTP } from '../../../app/password/passwordStore';
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(passwordSelector).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(verifyPasswordLeadOTP(formData));
73
+ dispatch(verifyPasswordLeadOTP(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 || resendLoading, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
@@ -21,6 +21,7 @@ import { clearError, signInSelector, createEmailAuth } from '../../../app/signIn
21
21
  import Form from '../../../../components/Form';
22
22
  import Button, { MobileButton } from '../../../shared/Button';
23
23
  import { ScreenContainer } from '../../../shared/Containers';
24
+ import { deepCopy } from '../../../../utils';
24
25
  import Collapse from '../../../../components/Collapse';
25
26
  import Box from '@mui/material/Box';
26
27
  import Divider from '@mui/material/Divider';
@@ -81,7 +82,7 @@ var Email = function (_a) {
81
82
  handleClearError();
82
83
  }, [methods.formState.isValid]);
83
84
  var onSubmit = function (data) {
84
- dispatch(createEmailAuth(data));
85
+ dispatch(createEmailAuth(deepCopy(data)));
85
86
  };
86
87
  var handleClearError = function () {
87
88
  if (error)
@@ -24,6 +24,7 @@ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings
24
24
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
25
  import { clearError, createMobileAuth, signInSelector } from '../../../app/signIn/signInStore';
26
26
  import { useLanguage } from '../../../../hooks';
27
+ import { deepCopy } from '../../../../utils';
27
28
  import Divider from '@mui/material/Divider';
28
29
  import Text from '../../../../components/Text';
29
30
  import MobileNumber from './MobileNumber';
@@ -98,7 +99,7 @@ var Mobile = function (_a) {
98
99
  dispatch(clearError());
99
100
  }, [methods.formState.isValid]);
100
101
  var onSubmit = function (data) {
101
- dispatch(createMobileAuth(data));
102
+ dispatch(createMobileAuth(deepCopy(data)));
102
103
  };
103
104
  var onBack = function () {
104
105
  dispatch(handlePrevScreenStep());
@@ -35,7 +35,7 @@ import { useLanguage } from '../../../../hooks';
35
35
  import { useForm, FormProvider } from 'react-hook-form';
36
36
  import { yupResolver } from '@hookform/resolvers/yup';
37
37
  import Form from '../../../../components/Form';
38
- import { maskPhone, maskEmail } from '../../../../utils';
38
+ import { maskPhone, maskEmail, deepCopy } from '../../../../utils';
39
39
  import { OTPValidation } from './validation';
40
40
  import OTPInput from './OTPInput';
41
41
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -79,7 +79,7 @@ var OTP = function () {
79
79
  };
80
80
  }, [methods.formState.isValid]);
81
81
  var onSubmit = function (formData) {
82
- dispatch(verifyAuthOTP(formData));
82
+ dispatch(verifyAuthOTP(deepCopy(formData)));
83
83
  };
84
84
  var onBack = function () {
85
85
  dispatch(handlePrevScreenStep(isEmail ? 'SIGIN_EMAIL_STEP' : 'SIGIN_MOBILE_STEP'));
@@ -17,7 +17,7 @@ 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 { signInSelector, resendOTPMobile, resendOTPEmail } from '../../../app/signIn/signInStore';
20
+ import { signInSelector, resendOTPMobile, resendOTPEmail, clearError } from '../../../app/signIn/signInStore';
21
21
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
@@ -32,9 +32,11 @@ var OTPInput = function (_a) {
32
32
  var t = useTranslation().t;
33
33
  var dispatch = useAppDispatch();
34
34
  var otpControl = useController({ name: 'otp', control: control });
35
- var data = useAppSelector(signInSelector).data;
35
+ var _c = useAppSelector(signInSelector), data = _c.data, error = _c.error;
36
36
  var isEmail = !!data.auth.email;
37
37
  var handleOnOTPChange = function (otp) {
38
+ if (error)
39
+ dispatch(clearError());
38
40
  otpControl.field.onChange(otp);
39
41
  };
40
42
  var handleOnResendOTP = function () {
@@ -34,6 +34,7 @@ import Form from '../../../../components/Form';
34
34
  import { useLanguage } from '../../../../hooks';
35
35
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
36
36
  import Button from '../../../shared/Button';
37
+ import { deepCopy } from '../../../../utils';
37
38
  import { signInSelector, verifyAuthPassword } from '../../../app/signIn/signInStore';
38
39
  import PasswordInput from './PasswordInput';
39
40
  import { PasswordValidation } from './validation';
@@ -57,7 +58,7 @@ var Password = function (_a) {
57
58
  });
58
59
  useSetFromDefaultValues(methods, defaultValues);
59
60
  var onSubmit = function (data) {
60
- dispatch(verifyAuthPassword(data));
61
+ dispatch(verifyAuthPassword(deepCopy(data)));
61
62
  };
62
63
  var onBack = function () {
63
64
  dispatch(handlePrevScreenStep(isEmail ? 'SIGIN_EMAIL_STEP' : 'SIGIN_MOBILE_STEP'));
@@ -19,7 +19,7 @@ import Form from '../../../../components/Form';
19
19
  import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { DocumentPurpose } from '../../../../@types';
22
- import { getFileDetailsFromDocument, isSA } from '../../../../utils';
22
+ import { deepCopy, getFileDetailsFromDocument, isSA } from '../../../../utils';
23
23
  import { ScreenContainer } from '../../../shared/Containers';
24
24
  import Button from '../../../shared/Button';
25
25
  import { retrieveBoardStatus, taxSelector, updateTaxInfo } from '../../../app/tax/taxStore';
@@ -61,7 +61,7 @@ var TaxDetails = function () {
61
61
  var isAr = useLanguage().isAr;
62
62
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
63
63
  var onSubmit = function (data) {
64
- dispatch(updateTaxInfo(getFelids(data)));
64
+ dispatch(updateTaxInfo(deepCopy(getFelids(data))));
65
65
  };
66
66
  var onBack = function () {
67
67
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
@@ -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 { resendOTP, taxSelector } from '../../../app/tax/taxStore';
22
+ import { clearError, resendOTP, taxSelector } from '../../../app/tax/taxStore';
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(taxSelector).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';
@@ -67,7 +67,7 @@ var VerifyNumber = function (_a) {
67
67
  };
68
68
  }, [methods.formState.isValid]);
69
69
  var onSubmit = function (formData) {
70
- dispatch(verifyTaxLeadOTP(formData));
70
+ dispatch(verifyTaxLeadOTP(deepCopy(formData)));
71
71
  };
72
72
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
73
73
  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') }))] })) })) }));
@@ -7,3 +7,4 @@ export declare const hasKeyValue: (obj: any, path: string, value: string | numbe
7
7
  export declare const hasNoneEditableValue: (obj: any, path: string) => boolean;
8
8
  export declare const hasEditableValue: (obj: any, path: string) => boolean;
9
9
  export declare const hasVerifiedValue: (obj: any, path: string) => boolean;
10
+ export declare function deepCopy(obj: any): any;
@@ -50,3 +50,17 @@ export var hasVerifiedValue = function (obj, path) {
50
50
  var value = VerificationStatus.VERIFIED;
51
51
  return hasKeyValue(obj, path, value);
52
52
  };
53
+ export function deepCopy(obj) {
54
+ if (typeof obj !== 'object') {
55
+ return obj;
56
+ }
57
+ if (Array.isArray(obj)) {
58
+ return obj.map(function (item) { return deepCopy(item); });
59
+ }
60
+ var newObj = {};
61
+ for (var key in obj) {
62
+ var value = obj[key];
63
+ newObj[key] = deepCopy(value);
64
+ }
65
+ return newObj;
66
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",