@tap-payments/auth-jsconnect 2.8.42-test → 2.8.45-beta

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 (140) hide show
  1. package/build/@types/form.d.ts +0 -1
  2. package/build/@types/redux.d.ts +0 -1
  3. package/build/api/axios.js +1 -2
  4. package/build/api/entity.d.ts +2 -2
  5. package/build/api/entity.js +4 -12
  6. package/build/api/index.d.ts +2 -2
  7. package/build/constants/api.d.ts +1 -0
  8. package/build/constants/api.js +2 -0
  9. package/build/constants/app.d.ts +2 -0
  10. package/build/constants/app.js +77 -3
  11. package/build/features/app/bank/bankStore.d.ts +18 -13
  12. package/build/features/app/bank/bankStore.js +161 -173
  13. package/build/features/app/board/boardStore.js +30 -52
  14. package/build/features/app/brand/brandStore.d.ts +33 -16
  15. package/build/features/app/brand/brandStore.js +204 -173
  16. package/build/features/app/business/businessStore.d.ts +5 -0
  17. package/build/features/app/business/businessStore.js +86 -69
  18. package/build/features/app/connectExpress/connectExpressStore.js +10 -18
  19. package/build/features/app/entity/entityStore.d.ts +35 -15
  20. package/build/features/app/entity/entityStore.js +228 -159
  21. package/build/features/app/individual/individualStore.d.ts +37 -21
  22. package/build/features/app/individual/individualStore.js +265 -253
  23. package/build/features/app/password/passwordStore.d.ts +23 -40
  24. package/build/features/app/password/passwordStore.js +233 -226
  25. package/build/features/app/tax/taxStore.d.ts +7 -13
  26. package/build/features/app/tax/taxStore.js +147 -167
  27. package/build/features/auth/Auth.js +5 -1
  28. package/build/features/auth/screens/OperatorError/OperatorError.d.ts +5 -0
  29. package/build/features/auth/screens/OperatorError/OperatorError.js +9 -0
  30. package/build/features/auth/screens/OperatorError/index.d.ts +3 -0
  31. package/build/features/auth/screens/OperatorError/index.js +2 -0
  32. package/build/features/bank/Bank.d.ts +0 -1
  33. package/build/features/bank/Bank.js +3 -4
  34. package/build/features/bank/screens/BankDetails/BankDetails.js +4 -12
  35. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  36. package/build/features/bank/screens/Verify/Verify.js +5 -5
  37. package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -3
  38. package/build/features/brand/Brand.d.ts +0 -1
  39. package/build/features/brand/Brand.js +3 -4
  40. package/build/features/brand/screens/BrandActivities/BrandActivities.js +1 -1
  41. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -6
  42. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -1
  43. package/build/features/brand/screens/BrandActivities/TAC.js +1 -1
  44. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -1
  45. package/build/features/brand/screens/BrandInfo/BrandInfo.js +1 -1
  46. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +1 -1
  47. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  48. package/build/features/brand/screens/Verify/Verify.js +1 -1
  49. package/build/features/business/screens/Activities/Activities.js +1 -1
  50. package/build/features/business/screens/BusinessType/BusinessType.js +1 -1
  51. package/build/features/business/screens/CivilID/CivilID.js +1 -1
  52. package/build/features/business/screens/Customers/Customers.js +1 -1
  53. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -6
  54. package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
  55. package/build/features/business/screens/OTP/OTP.js +1 -1
  56. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  57. package/build/features/business/screens/Verify/Verify.js +1 -1
  58. package/build/features/connect/screens/BrandSegment/BrandSegment.js +1 -1
  59. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +1 -2
  60. package/build/features/connect/screens/CivilID/CivilID.js +1 -1
  61. package/build/features/connect/screens/Individual/Email.js +1 -3
  62. package/build/features/connect/screens/Individual/Individual.js +1 -1
  63. package/build/features/connect/screens/Merchant/BrandList.js +3 -3
  64. package/build/features/connect/screens/Merchant/Merchant.js +1 -1
  65. package/build/features/connect/screens/Merchant/SalesChannels.js +1 -1
  66. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  67. package/build/features/connect/screens/NID/NID.js +1 -1
  68. package/build/features/connectExpress/ConnectExpress.js +22 -20
  69. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +2 -5
  70. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +1 -6
  71. package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +0 -3
  72. package/build/features/connectExpress/screens/AuthenticationList/validation.js +0 -10
  73. package/build/features/connectExpress/screens/CivilID/CivilID.js +1 -1
  74. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +1 -1
  75. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -1
  76. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +1 -1
  77. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +1 -3
  78. package/build/features/connectExpress/screens/Mobile/Mobile.js +1 -1
  79. package/build/features/connectExpress/screens/NID/NID.js +1 -1
  80. package/build/features/connectExpress/screens/NIDMissed/NID.js +1 -1
  81. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  82. package/build/features/entity/Entity.d.ts +0 -1
  83. package/build/features/entity/Entity.js +3 -4
  84. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +4 -8
  85. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +4 -8
  86. package/build/features/entity/screens/EntityCapital/EntityCapital.js +1 -1
  87. package/build/features/entity/screens/EntityName/EntityName.js +1 -1
  88. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  89. package/build/features/entity/screens/Verify/Verify.js +1 -1
  90. package/build/features/featuresScreens.js +5 -5
  91. package/build/features/individual/Individual.d.ts +0 -1
  92. package/build/features/individual/Individual.js +3 -4
  93. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -14
  94. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +2 -5
  95. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
  96. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -4
  97. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -3
  98. package/build/features/individual/screens/IndividualList/Email.js +2 -3
  99. package/build/features/individual/screens/IndividualList/IndividualList.js +5 -11
  100. package/build/features/individual/screens/IndividualList/UserList.js +9 -13
  101. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
  102. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -4
  103. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
  104. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  105. package/build/features/individual/screens/Verify/Verify.js +1 -1
  106. package/build/features/password/Password.d.ts +0 -1
  107. package/build/features/password/Password.js +28 -73
  108. package/build/features/password/screens/CreatePassword/CreatePassword.js +4 -8
  109. package/build/features/password/screens/OTP/OTP.js +1 -1
  110. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  111. package/build/features/password/screens/Verify/Verify.js +5 -5
  112. package/build/features/shared/Button/FlowsButtons.js +3 -4
  113. package/build/features/shared/Containers/FeatureContainer.d.ts +0 -1
  114. package/build/features/shared/Containers/FeatureContainer.js +3 -3
  115. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +1 -5
  116. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -3
  117. package/build/features/tax/Tax.d.ts +0 -1
  118. package/build/features/tax/Tax.js +3 -4
  119. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  120. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -7
  121. package/build/features/tax/screens/Verify/Verify.js +5 -5
  122. package/build/hooks/index.d.ts +0 -1
  123. package/build/hooks/index.js +0 -1
  124. package/build/hooks/useVerifyToken.d.ts +2 -3
  125. package/build/hooks/useVerifyToken.js +2 -2
  126. package/build/utils/common.js +4 -4
  127. package/build/utils/locale.js +1 -2
  128. package/build/utils/string.d.ts +2 -5
  129. package/build/utils/string.js +5 -34
  130. package/package.json +2 -2
  131. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +0 -31
  132. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +0 -90
  133. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +0 -36
  134. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +0 -76
  135. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.d.ts +0 -4
  136. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.js +0 -10
  137. package/build/features/password/screens/PrepareDataLoading/index.d.ts +0 -2
  138. package/build/features/password/screens/PrepareDataLoading/index.js +0 -2
  139. package/build/hooks/useFormDirtyCheck.d.ts +0 -6
  140. package/build/hooks/useFormDirtyCheck.js +0 -29
@@ -16,7 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { settingsSelector } from '../../../../app/settings';
19
- import { getCurrencyByCountryIso2, hasVerifiedValue } from '../../../../utils';
19
+ import { hasVerifiedValue } from '../../../../utils';
20
20
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import Text from '../../../../components/Text';
@@ -52,9 +52,6 @@ var MonthlyIncome = function (props) {
52
52
  return false;
53
53
  return hasVerifiedValue(user === null || user === void 0 ? void 0 : user.data_verification, "monthly_income.".concat(item.id));
54
54
  };
55
- var getCurrency = React.useMemo(function () {
56
- return t(getCurrencyByCountryIso2(countryCode.iso2));
57
- }, [countryCode.iso2]);
58
55
  React.useEffect(function () {
59
56
  if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
60
57
  setIncomeList(monthlyIncomeList);
@@ -84,7 +81,7 @@ var MonthlyIncome = function (props) {
84
81
  var income = monthlyIncomeControl.field.value;
85
82
  var error = (_a = monthlyIncomeControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
86
83
  return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(InputSelect, { label: t('please_enter_actual_income', {
87
- currency: getCurrency
84
+ currency: t(data.currency)
88
85
  }), required: true, readOnly: props.readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error), endAdornment: _jsx(EndAdornmentExpanded, { isVerified: isMonthlyIncomeVerified(income), anchorEl: anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
89
86
  return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIcon, { isVerified: isMonthlyIncomeVerified(item) })] }));
90
87
  } }) }))] })) })));
@@ -14,9 +14,8 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import Collapse from '@mui/material/Collapse';
17
- import { formatNumberAsCurrency, getCurrencyByCountryIso2, removeAllCharsFromNumber } from '../../../../utils';
17
+ import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
- import { settingsSelector } from '../../../../app/settings';
20
19
  import { ScreenContainer } from '../../../shared/Containers';
21
20
  import Input from '../../../shared/Input';
22
21
  import { individualSelector, clearError } from '../../../app/individual/individualStore';
@@ -25,11 +24,10 @@ var ShareValue = function (_a) {
25
24
  var _b;
26
25
  var show = _a.show, readOnly = _a.readOnly;
27
26
  var t = useTranslation().t;
28
- var settingsData = useAppSelector(settingsSelector).data;
27
+ var data = useAppSelector(individualSelector).data;
29
28
  var control = useFormContext().control;
30
29
  var bckError = useAppSelector(individualSelector).error;
31
30
  var dispatch = useAppDispatch();
32
- var countryCode = settingsData.businessCountry;
33
31
  var handleChange = function (_a) {
34
32
  var target = _a.target;
35
33
  if (bckError)
@@ -37,14 +35,11 @@ var ShareValue = function (_a) {
37
35
  var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
38
36
  shareValueControl.field.onChange(value);
39
37
  };
40
- var getCurrency = React.useMemo(function () {
41
- return t(getCurrencyByCountryIso2(countryCode.iso2));
42
- }, [countryCode.iso2]);
43
38
  var shareValueControl = useController({ control: control, name: 'shareValue' });
44
39
  var shareValue = shareValueControl.field.value;
45
40
  var error = (_b = shareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
46
41
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('share_value_label', {
47
- currency: getCurrency
42
+ currency: t(data.currency)
48
43
  }), onChange: handleChange, value: shareValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: shareValue, error: error }) }) })) })));
49
44
  };
50
45
  export default React.memo(ShareValue);
@@ -1,6 +1,6 @@
1
1
  import * as yup from 'yup';
2
2
  import { IndividualType } from '../../../../@types';
3
- export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean, hasAuthorizedField: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
4
  occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
5
5
  sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
6
6
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
@@ -10,7 +10,6 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
10
10
  isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
11
11
  shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
12
  shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
- isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
14
13
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
14
  occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
16
15
  sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
@@ -21,7 +20,6 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
21
20
  isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
22
21
  shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
22
  shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
24
- isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
25
23
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
26
24
  occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
27
25
  sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
@@ -32,5 +30,4 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
32
30
  isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
33
31
  shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
32
  shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
- isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
36
33
  }>>>;
@@ -1,6 +1,6 @@
1
1
  import * as yup from 'yup';
2
2
  import { getIndividualType } from '../../../../utils';
3
- export var IndividualInfoValidationSchema = function (objects, isKWCountry, hasAuthorizedField) {
3
+ export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
4
4
  var isUserType = getIndividualType(objects).isUser;
5
5
  return yup.object().shape({
6
6
  occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
@@ -11,7 +11,6 @@ export var IndividualInfoValidationSchema = function (objects, isKWCountry, hasA
11
11
  isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
12
12
  isInfluencer: isUserType && isKWCountry ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
13
13
  shareCount: yup.string().optional(),
14
- shareValue: yup.string().optional(),
15
- isAuthorized: hasAuthorizedField ? yup.boolean().required('please_choose_is_authorized') : yup.boolean().optional()
14
+ shareValue: yup.string().optional()
16
15
  });
17
16
  };
@@ -54,7 +54,7 @@ import { useController, useFormContext } from 'react-hook-form';
54
54
  import { styled } from '@mui/material/styles';
55
55
  import CircularProgress from '@mui/material/CircularProgress';
56
56
  import { useAppDispatch } from '../../../../hooks';
57
- import { isValidEmail, removeAllOtherThanCharsNumbersAtAndDot } from '../../../../utils';
57
+ import { isValidEmail } from '../../../../utils';
58
58
  import Collapse from '../../../../components/Collapse';
59
59
  import { ScreenContainer } from '../../../shared/Containers';
60
60
  import Input from '../../../shared/Input';
@@ -103,8 +103,7 @@ var Email = function (_a) {
103
103
  }
104
104
  }, [emailValue, error]);
105
105
  var handleEmailChange = function (event) {
106
- var value = removeAllOtherThanCharsNumbersAtAndDot(event.target.value);
107
- emailControl.field.onChange(value);
106
+ emailControl.field.onChange(event.target.value);
108
107
  };
109
108
  var clearEmail = function () {
110
109
  emailControl.field.onChange('');
@@ -16,12 +16,11 @@ import Box from '@mui/material/Box';
16
16
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
17
17
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
18
  import Text from '../../../../components/Text';
19
+ import Button from '../../../../components/Button';
19
20
  import Collapse from '../../../../components/Collapse';
20
21
  import Warning from '../../../../components/Warning';
21
- import Button from '../../../../components/Button';
22
- import Loader from '../../../../components/Loader';
23
22
  import { ScreenContainer } from '../../../shared/Containers';
24
- import { individualSelector, retrieveBoardStatus } from '../../../app/individual/individualStore';
23
+ import { individualSelector } from '../../../app/individual/individualStore';
25
24
  import UserList from './UserList';
26
25
  var BoxStyled = styled(Box)(function (_a) {
27
26
  var theme = _a.theme;
@@ -50,17 +49,12 @@ export var SubTitleStyled = styled(Text)(function (_a) {
50
49
  var IndividualList = function () {
51
50
  var dispatch = useAppDispatch();
52
51
  var t = useTranslation().t;
53
- var _a = useAppSelector(individualSelector), error = _a.error, data = _a.data, loading = _a.loading;
52
+ var error = useAppSelector(individualSelector).error;
54
53
  var settingsData = useAppSelector(settingsSelector).data;
55
- var flows = (data.verify.responseBody || {}).flows;
56
54
  var onBack = function () {
57
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
58
- dispatch(handlePrevScreenStep());
59
- return;
60
- }
61
- dispatch(retrieveBoardStatus());
55
+ dispatch(handlePrevScreenStep());
62
56
  };
63
57
  var hideBack = settingsData.appConfig.mode === 'content';
64
- return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), !hideBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') })))] }));
58
+ return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), !hideBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: t('back') })))] }));
65
59
  };
66
60
  export default IndividualList;
@@ -25,7 +25,7 @@ import { useTranslation } from 'react-i18next';
25
25
  import { yupResolver } from '@hookform/resolvers/yup';
26
26
  import { alpha, styled, useTheme } from '@mui/material/styles';
27
27
  import Box from '@mui/material/Box';
28
- import { getUserName, isKWOrSA, isValidEmail } from '../../../../utils';
28
+ import { getUserName, isValidEmail } from '../../../../utils';
29
29
  import { useLanguage, useAppSelector, useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
30
30
  import { IndividualType } from '../../../../@types';
31
31
  import Collapse from '../../../../components/Collapse';
@@ -35,10 +35,9 @@ import Text from '../../../../components/Text';
35
35
  import CheckIcon from '../../../shared/CheckIcon';
36
36
  import { ScreenContainer } from '../../../shared/Containers';
37
37
  import { addDetailsAsync, individualSelector, requestDetailsByEmail, resetIndividualData } from '../../../app/individual/individualStore';
38
- import IndividualActionButtons from '../../../shared/Button/IndividualActionButtons';
38
+ import IndividualActionButtons from '../../../../features/shared/Button/IndividualActionButtons';
39
39
  import { IndividualCollectInfoValidationSchema } from './validation';
40
40
  import CollectPhoneEmail from './CollectPhoneEmail';
41
- import { settingsSelector } from '../../../../app/settings';
42
41
  var ScreenContainerStyled = styled(ScreenContainer)(function (_a) {
43
42
  var theme = _a.theme;
44
43
  return ({
@@ -85,12 +84,11 @@ var UserList = function (_a) {
85
84
  var dispatch = useAppDispatch();
86
85
  var _j = React.useState(false), emailChecking = _j[0], setEmailChecking = _j[1];
87
86
  var theme = useTheme();
88
- var _k = useAppSelector(individualSelector), data = _k.data, addOrRequestDetailLoading = _k.addOrRequestDetailLoading, error = _k.error;
89
- var settingsData = useAppSelector(settingsSelector).data;
87
+ var _k = useAppSelector(individualSelector), data = _k.data, loading = _k.loading, error = _k.error;
90
88
  var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
91
89
  var is_available = (responseBody || {}).is_available;
92
90
  var verify = data.verify;
93
- var _m = verify.responseBody || {}, userList = _m.userList, recipient = _m.recipient, userRes = _m.user;
91
+ var _m = verify.responseBody || {}, userList = _m.userList, notification = _m.notification;
94
92
  var methods = useForm({
95
93
  resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
96
94
  defaultValues: {
@@ -159,10 +157,8 @@ var UserList = function (_a) {
159
157
  return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
160
158
  };
161
159
  var isSameUserRequestedBefore = function (user) {
162
- var _a;
163
- if (!(userRes === null || userRes === void 0 ? void 0 : userRes.is_authorized) && !isKWOrSA(settingsData.businessCountry.iso2))
164
- return false;
165
- return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes(recipient === null || recipient === void 0 ? void 0 : recipient.id);
160
+ var _a, _b;
161
+ return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes((_b = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _b === void 0 ? void 0 : _b.id);
166
162
  };
167
163
  var getUserStatus = function (user) {
168
164
  return user === null || user === void 0 ? void 0 : user.individual_data_state;
@@ -192,11 +188,11 @@ var UserList = function (_a) {
192
188
  return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
193
189
  return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
194
190
  cursor: emailChecking ? 'default' : 'pointer'
195
- }, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [_jsx("span", { children: getName(user) || '' }), _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(IndividualActionButtons, { isAr: isAr, addDetails: {
191
+ }, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsx(TextStyled, { children: _jsx("span", { children: getName(user) || '' }) }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(IndividualActionButtons, { isAr: isAr, addDetails: {
196
192
  status: getUserStatus(user),
197
193
  title: t('add_details'),
198
194
  onClick: onAddDetails,
199
- loading: isActiveUser(user) && !!addOrRequestDetailLoading && type === IndividualRequestType.ADD
195
+ loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
200
196
  }, requestEmail: {
201
197
  children: getCollectForm(user),
202
198
  title: t('request_details_by_email'),
@@ -204,7 +200,7 @@ var UserList = function (_a) {
204
200
  disabled: showCollectForm ? disabled : false,
205
201
  onClick: onRequestEmail,
206
202
  show: !isSameUserRequestedBefore(user),
207
- loading: isActiveUser(user) && !!addOrRequestDetailLoading && type === IndividualRequestType.REQUEST_EMAIL
203
+ loading: isActiveUser(user) && loading && type === IndividualRequestType.REQUEST_EMAIL
208
204
  } }) }))] }), index));
209
205
  }) }));
210
206
  };
@@ -15,10 +15,9 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { styled } from '@mui/material/styles';
17
17
  import Collapse from '../../../../components/Collapse';
18
- import { removeAllOtherThanCharsNumbersAtAndDot } from '../../../../utils';
19
18
  import { ScreenContainer } from '../../../shared/Containers';
20
19
  import Input from '../../../shared/Input';
21
- import { EndAdornment } from '../../../shared/EndAdornment';
20
+ import { EndAdornment } from '../../../../features/shared/EndAdornment';
22
21
  var InputStyled = styled(Input)(function () { return ({
23
22
  input: {
24
23
  textTransform: 'lowercase'
@@ -33,8 +32,7 @@ var Email = function (_a) {
33
32
  var emailValue = emailControl.field.value;
34
33
  var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
35
34
  var handleEmailChange = function (event) {
36
- var value = removeAllOtherThanCharsNumbersAtAndDot(event.target.value);
37
- emailControl.field.onChange(value);
35
+ emailControl.field.onChange(event.target.value);
38
36
  };
39
37
  var clearNumber = function () {
40
38
  emailControl.field.onChange('');
@@ -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, deepCopy, getUserName, isKWOrSA, isOtherThanKWOrSA } from '../../../../utils';
21
+ import { convertToEnglishDateFormat, deepCopy, getUserName, isOtherThanKWOrSA } 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,6 @@ var IndividualPersonalInfo = function (_a) {
136
136
  var isBirthCountryVerified = dataVerified['birth.country'] && (birth === null || birth === void 0 ? void 0 : birth.country) === ((_g = watch('placeOfBirthCountry')) === null || _g === void 0 ? void 0 : _g.iso2);
137
137
  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);
138
138
  var isNationalityVerified = dataVerified['nationality'] && nationalityRes === ((_k = watch('nationality')) === null || _k === void 0 ? void 0 : _k.iso2);
139
- var isKWOrSaCountry = React.useMemo(function () { return isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
140
139
  var onSubmit = function (data) {
141
140
  dispatch(updateIndividualPersonalInfo(deepCopy(getFelids(data))));
142
141
  };
@@ -147,7 +146,7 @@ var IndividualPersonalInfo = function (_a) {
147
146
  var onBack = function () {
148
147
  if (error)
149
148
  dispatch(clearError());
150
- if (is_authorized || !isKWOrSaCountry) {
149
+ if (is_authorized) {
151
150
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
152
151
  return;
153
152
  }
@@ -174,7 +173,7 @@ var IndividualPersonalInfo = function (_a) {
174
173
  var isBirthCountryListActive = listActive === ListType.BirthCountryList;
175
174
  var isBirthCityListActive = listActive === ListType.BirthCityList;
176
175
  var isNationalityListActive = listActive === ListType.NationalityList;
177
- var disableBack = settingsData.appConfig.mode === 'content' && !(is_authorized || !isKWOrSaCountry);
176
+ var disableBack = settingsData.appConfig.mode === 'content' && !is_authorized;
178
177
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || (noneEditable['name.en'] && noneEditable['name.ar']), isVerified: isNameVerified }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isPhoneNumberVerified }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'], isVerified: isEmailVerified }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] || noneEditable['gender'], isVerified: isGenderVerified }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'], isVerified: isIDVerified }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isIssuedCountryVerified }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'], isVerified: isExpiryDateVerified }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'], isVerified: isDOBVerified }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCountryVerified }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
179
178
  !isDateFieldActive &&
180
179
  !isIssuedCountryListActive &&
@@ -58,7 +58,7 @@ var PhoneInfo = function (_a) {
58
58
  if (error && methods.formState.isValid)
59
59
  dispatch(clearError());
60
60
  }, [methods.formState.isValid]);
61
- var disabled = !methods.formState.isValid;
61
+ var disabled = !methods.formState.isValid || !!error;
62
62
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, sx: { mb: 7.5 }, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
63
63
  };
64
64
  export default React.memo(PhoneInfo);
@@ -21,10 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(individualSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals, recipient = _b.recipient;
24
+ var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
25
25
  var onClose = function () {
26
26
  dispatch(onCloseCompleteIndividual());
27
27
  };
28
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
29
29
  };
30
30
  export default memo(SuccessWithFlowButtons);
@@ -72,7 +72,7 @@ var VerifyNumber = function (_a) {
72
72
  var onSubmit = function (formData) {
73
73
  dispatch(verifyLeadOTP(deepCopy(formData)));
74
74
  };
75
- var disabled = !methods.formState.isValid || !phone || resendLoading;
75
+ var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
76
76
  var dataLoading = loading || cityLoading;
77
77
  var showMobileNumber = !loading && !cityLoading && phone;
78
78
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [dataLoading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), showMobileNumber && _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') }))] })) })) }));
@@ -2,7 +2,6 @@ import { LibConfig } from '../../@types';
2
2
  export interface PasswordLibProps extends LibConfig {
3
3
  verifyToken?: string;
4
4
  configToken?: string;
5
- loaderColor?: string;
6
5
  }
7
6
  export declare function PasswordElement(props: PasswordLibProps): import("react/jsx-runtime").JSX.Element;
8
7
  export declare function renderPasswordLib(config: PasswordLibProps, elementId: string): {
@@ -9,42 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
12
  var __rest = (this && this.__rest) || function (s, e) {
49
13
  var t = {};
50
14
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -57,10 +21,10 @@ var __rest = (this && this.__rest) || function (s, e) {
57
21
  return t;
58
22
  };
59
23
  import { jsx as _jsx } from "react/jsx-runtime";
60
- import { memo } from 'react';
24
+ import { memo, useEffect } from 'react';
61
25
  import { createRoot } from 'react-dom/client';
62
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useVerifyToken } from '../../hooks';
63
- import { settingsSelector } from '../../app/settings';
26
+ import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
27
+ import { handleLanguage, settingsSelector } from '../../app/settings';
64
28
  import AnimationFlow from '../../components/AnimationFlow';
65
29
  import { store } from '../../app/store';
66
30
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
@@ -72,7 +36,7 @@ import { passwordFeatureScreens } from '../featuresScreens';
72
36
  import { passwordSelector, verifyLeadToken, verifyOperationToken } from '../app/password/passwordStore';
73
37
  import Background from '../shared/Background';
74
38
  var Password = memo(function (_a) {
75
- var configToken = _a.configToken, loaderColor = _a.loaderColor, verifyToken = _a.verifyToken, props = __rest(_a, ["configToken", "loaderColor", "verifyToken"]);
39
+ var configToken = _a.configToken, verifyToken = _a.verifyToken, props = __rest(_a, ["configToken", "verifyToken"]);
76
40
  var theme = useAppTheme().theme;
77
41
  var dispatch = useAppDispatch();
78
42
  var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
@@ -80,40 +44,31 @@ var Password = memo(function (_a) {
80
44
  useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION, disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }, props));
81
45
  useErrorListener(passwordError || error);
82
46
  useStepStartedListener();
83
- var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress, featureScreensNavigation = data.featureScreensNavigation;
84
- var handleVerifyToken = function (_a) {
85
- var token = _a.token, isInternally = _a.isInternally;
86
- return function () { return __awaiter(void 0, void 0, void 0, function () {
87
- var operationType, boardId, boardInfoId, userId, userType;
88
- return __generator(this, function (_a) {
89
- operationType = getParameterByName('operation_type');
90
- boardId = getParameterByName('board_id') || '';
91
- boardInfoId = getParameterByName('board_info_id') || '';
92
- userId = getParameterByName('user_id') || '';
93
- userType = getParameterByName('user_type') || '';
94
- sendPageView({
95
- title: 'Password'
96
- });
97
- if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
98
- dispatch(verifyOperationToken({ token: token, boardId: boardId, boardInfoId: boardInfoId, userId: userId, userType: userType }));
99
- return [2];
100
- }
101
- dispatch(verifyLeadToken({ token: token, isInternally: isInternally }));
102
- return [2];
103
- });
104
- }); };
47
+ var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
48
+ var handleVerifyToken = function () {
49
+ var token = verifyToken !== null && verifyToken !== void 0 ? verifyToken : getParameterByName('token');
50
+ var lang = getParameterByName('lang');
51
+ var operationType = getParameterByName('operation_type');
52
+ var boardId = getParameterByName('board_id') || '';
53
+ var boardInfoId = getParameterByName('board_info_id') || '';
54
+ if (lang)
55
+ dispatch(handleLanguage(lang));
56
+ if (!token)
57
+ throw new Error('Auth token is not found!');
58
+ sendPageView({
59
+ title: 'Password'
60
+ });
61
+ if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
62
+ dispatch(verifyOperationToken({ token: token, boardId: boardId, boardInfoId: boardInfoId }));
63
+ return;
64
+ }
65
+ dispatch(verifyLeadToken(token));
105
66
  };
106
- useVerifyToken({
107
- verify: handleVerifyToken,
108
- loadingScreenName: 'PASSWORD_LOADING_DATA_STEP',
109
- navigation: featureScreensNavigation,
110
- open: open,
111
- mode: props.mode,
112
- internalToken: verifyToken,
113
- settingLoading: settingLoading
114
- });
115
- var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
116
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: initialLoading, error: error, open: open, breakpoint: 'sm', loaderColor: loaderColor, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined, dialogEdgeFormat: data.appConfig.dialogEdgeFormat }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: passwordFeatureScreens.map(function (_a, index) {
67
+ useEffect(function () {
68
+ if (!settingLoading && open)
69
+ handleVerifyToken();
70
+ }, [settingLoading]);
71
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined, dialogEdgeFormat: data.appConfig.dialogEdgeFormat }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: isMaturityExpress }, { children: passwordFeatureScreens.map(function (_a, index) {
117
72
  var Element = _a.element, name = _a.name;
118
73
  var isActive = activeScreen.name === name;
119
74
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -17,7 +17,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import Box from '@mui/material/Box';
18
18
  import { styled } from '@mui/material/styles';
19
19
  import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
20
- import { handleNextScreenStep, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
+ import { handleCurrentActiveScreen, handleNextScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import Form from '../../../../components/Form';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import { PASSWORD_OPERATION_TYPE } from '../../../../constants';
@@ -25,7 +25,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
25
  import Button from '../../../shared/Button';
26
26
  import { PasswordValidation } from './validation';
27
27
  import Password from './Password';
28
- import { createPassword, passwordSelector, retrieveBoardStatus, storePasswordScreen } from '../../../app/password/passwordStore';
28
+ import { createPassword, passwordSelector, storePasswordScreen } from '../../../app/password/passwordStore';
29
29
  import { useSelector } from 'react-redux';
30
30
  import { deepCopy } from '../../../../utils';
31
31
  var InputsContainerStyled = styled(Box)(function (_a) {
@@ -61,13 +61,9 @@ var CreatePassword = function (_a) {
61
61
  dispatch(createPassword(deepCopy(data)));
62
62
  };
63
63
  var onBack = function () {
64
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
65
- dispatch(handlePrevScreenStep());
66
- return;
67
- }
68
- dispatch(retrieveBoardStatus());
64
+ dispatch(handleCurrentActiveScreen('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
69
65
  };
70
- var disableBack = settingsData.appConfig.mode === 'content';
66
+ var disableBack = settingsData.appConfig.mode === 'content' ? true : !(flows === null || flows === void 0 ? void 0 : flows.length);
71
67
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(Password, {}) }), _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
72
68
  };
73
69
  export default React.memo(CreatePassword);
@@ -83,7 +83,7 @@ var OTP = function (_a) {
83
83
  var onBack = function () {
84
84
  dispatch(handlePrevScreenStep());
85
85
  };
86
- var disabled = !methods.formState.isValid;
86
+ var disabled = !methods.formState.isValid || !!error;
87
87
  var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.auth_info) === null || _c === void 0 ? void 0 : _c.phone;
88
88
  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 && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
89
89
  };
@@ -21,10 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(passwordSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals, recipient = _b.recipient;
24
+ var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
25
25
  var onClose = function () {
26
26
  dispatch(onCloseCompletePassword());
27
27
  };
28
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
29
29
  };
30
30
  export default memo(SuccessWithFlowButtons);
@@ -46,9 +46,9 @@ var FormStyled = styled(Form)(function () { return ({
46
46
  flexDirection: 'column'
47
47
  }); });
48
48
  var VerifyNumber = function (_a) {
49
- var _b, _c;
49
+ var _b, _c, _d;
50
50
  var dispatch = useAppDispatch();
51
- var _d = useAppSelector(passwordSelector), data = _d.data, loading = _d.loading, error = _d.error;
51
+ var _e = useAppSelector(passwordSelector), data = _e.data, loading = _e.loading, error = _e.error;
52
52
  var otp = data.otpData.otp;
53
53
  var methods = useForm({
54
54
  resolver: yupResolver(OTPValidation),
@@ -60,8 +60,8 @@ var VerifyNumber = function (_a) {
60
60
  useSetFromDefaultValues(methods, data.otpData);
61
61
  var t = useTranslation().t;
62
62
  var isAr = useLanguage().isAr;
63
- var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
64
- var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
63
+ var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
64
+ var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
65
65
  React.useEffect(function () {
66
66
  if (error && methods.formState.isValid && phone)
67
67
  dispatch(clearError());
@@ -72,7 +72,7 @@ var VerifyNumber = function (_a) {
72
72
  var onSubmit = function (formData) {
73
73
  dispatch(verifyPasswordLeadOTP(deepCopy(formData)));
74
74
  };
75
- var disabled = !methods.formState.isValid || !phone || resendLoading;
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') }))] })) })) }));
77
77
  };
78
78
  export default React.memo(VerifyNumber);