@tap-payments/auth-jsconnect 1.0.22 → 1.0.25

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 (50) hide show
  1. package/build/@types/app.d.ts +16 -9
  2. package/build/api/axios.js +20 -1
  3. package/build/api/lead.d.ts +1 -0
  4. package/build/app/settings.d.ts +4 -2
  5. package/build/app/settings.js +30 -2
  6. package/build/components/Button/Button.js +1 -0
  7. package/build/constants/app.d.ts +1 -0
  8. package/build/constants/app.js +1 -0
  9. package/build/constants/dummy.d.ts +1 -0
  10. package/build/constants/dummy.js +1 -0
  11. package/build/features/app/connect/connectStore.d.ts +1 -2
  12. package/build/features/app/connect/connectStore.js +75 -58
  13. package/build/features/bank/screens/BankDetails/BankName.js +6 -1
  14. package/build/features/business/screens/Activities/Activities.js +6 -2
  15. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  16. package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -2
  17. package/build/features/business/screens/Customers/CustomerLocations.js +3 -3
  18. package/build/features/business/screens/Customers/Customers.js +19 -1
  19. package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +1 -0
  20. package/build/features/business/screens/Customers/ExpectedCustomers.js +3 -3
  21. package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -0
  22. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -3
  23. package/build/features/business/screens/VerifyNumber/VerifyNumber.js +1 -1
  24. package/build/features/connect/Connect.d.ts +2 -4
  25. package/build/features/connect/Connect.js +4 -4
  26. package/build/features/connect/screens/Individual/Email.js +9 -7
  27. package/build/features/connect/screens/Individual/Individual.js +12 -11
  28. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  29. package/build/features/connect/screens/Merchant/Merchant.js +5 -4
  30. package/build/features/connect/screens/Mobile/BusinessCountry.d.ts +0 -5
  31. package/build/features/connect/screens/Mobile/BusinessCountry.js +3 -24
  32. package/build/features/connect/screens/Mobile/Mobile.js +15 -5
  33. package/build/features/connect/screens/NID/DOB.js +12 -2
  34. package/build/features/connect/screens/NID/NID.js +5 -2
  35. package/build/features/connect/screens/NID/validation.js +1 -2
  36. package/build/features/connect/screens/ThankYou/ThankYou.js +6 -1
  37. package/build/features/shared/Button/Button.js +24 -24
  38. package/build/hooks/index.d.ts +1 -0
  39. package/build/hooks/index.js +1 -0
  40. package/build/hooks/useAppConfig.d.ts +3 -5
  41. package/build/hooks/useAppConfig.js +29 -2
  42. package/build/hooks/useErrorListener.d.ts +1 -0
  43. package/build/hooks/useErrorListener.js +19 -0
  44. package/build/utils/index.d.ts +1 -0
  45. package/build/utils/index.js +1 -0
  46. package/build/utils/rsa.d.ts +2 -0
  47. package/build/utils/rsa.js +19 -0
  48. package/build/utils/string.d.ts +1 -0
  49. package/build/utils/string.js +3 -0
  50. package/package.json +4 -1
@@ -29,11 +29,19 @@ import { CUSTOMER_LOCATIONS, EXPECTED_CUSTOMERS, EXPECTED_SALES_RANGE } from '..
29
29
  import RefundPolicy from './RefundPolicy';
30
30
  import TransactionPolicy from './TransactionPolicy';
31
31
  import { ScreenContainer } from '../../../shared/Containers';
32
+ import Collapse from '../../../../components/Collapse';
32
33
  var FormStyled = styled(Form)(function () { return ({
33
34
  display: 'flex',
34
35
  flexDirection: 'column'
35
36
  }); });
37
+ var ListType;
38
+ (function (ListType) {
39
+ ListType["CustomerLocationsList"] = "CustomerLocationsList";
40
+ ListType["ExpectedCustomersList"] = "ExpectedCustomersList";
41
+ ListType["ExpectedSalesList"] = "ExpectedSalesList";
42
+ })(ListType || (ListType = {}));
36
43
  var Customers = function (_a) {
44
+ var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
37
45
  var dispatch = useAppDispatch();
38
46
  var methods = useForm({
39
47
  resolver: yupResolver(CustomerInfoValidation),
@@ -55,6 +63,16 @@ var Customers = function (_a) {
55
63
  };
56
64
  var t = useTranslation().t;
57
65
  var isAr = useLanguage().isAr;
58
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(CustomerLocations, {}), _jsx(ExpectedCustomers, {}), _jsx(ExpectedSales, {}), _jsx(RefundPolicy, {}), _jsx(TransactionPolicy, {}), _jsx(Box, __assign({ sx: { mt: 2 } }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, isAr: isAr }, { children: t('next') })) }))] })) })) }));
66
+ var handleMenuClick = function (flag) {
67
+ setListActive(flag);
68
+ };
69
+ var isCustomerLocationsListActive = listActive === ListType.CustomerLocationsList;
70
+ var isExpectedCustomersListActive = listActive === ListType.ExpectedCustomersList;
71
+ var isExpectedSalesListActive = listActive === ListType.ExpectedSalesList;
72
+ var whenNotSelectCustomersLocation = !isExpectedCustomersListActive && !isExpectedSalesListActive;
73
+ var whenNotSelectExpectedCustomers = !isCustomerLocationsListActive && !isExpectedSalesListActive;
74
+ var whenNotSelectExpectedSales = !isCustomerLocationsListActive && !isExpectedCustomersListActive;
75
+ var isAnyListSelected = !isExpectedCustomersListActive && !isCustomerLocationsListActive && !isExpectedSalesListActive;
76
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(CustomerLocations, { show: whenNotSelectCustomersLocation, onListOpen: function () { return handleMenuClick(ListType.CustomerLocationsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedCustomers, { show: whenNotSelectExpectedCustomers, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomersList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedSales, { show: whenNotSelectExpectedSales, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: isAnyListSelected }, { children: [_jsx(RefundPolicy, {}), _jsx(TransactionPolicy, {}), _jsx(Box, __assign({ sx: { mt: 2 } }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, isAr: isAr }, { children: t('next') })) }))] }))] })) })) }));
59
77
  };
60
78
  export default React.memo(Customers);
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  interface ExpectedCustomersProps {
3
+ show: boolean;
3
4
  onListOpen?: () => void;
4
5
  onListClose?: () => void;
5
6
  }
@@ -67,8 +67,8 @@ var ExpectedCustomers = function (_a) {
67
67
  };
68
68
  var expectedCustomersValue = expectedCustomersControl.field.value;
69
69
  var expectedCustomersSelected = expectedCustomersValue;
70
- return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.nameAR : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
71
- return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.nameAR : item.name })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIconStyled, {})] }));
72
- } }) }))] }));
70
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.nameAR : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
71
+ return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.nameAR : item.name })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIconStyled, {})] }));
72
+ } }) }))] }) })));
73
73
  };
74
74
  export default ExpectedCustomers;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  interface ExpectedSalesRangeProps {
3
+ show: boolean;
3
4
  onListOpen?: () => void;
4
5
  onListClose?: () => void;
5
6
  }
@@ -68,8 +68,8 @@ var ExpectedSalesRange = function (_a) {
68
68
  };
69
69
  var expectedSalesRangeValue = expectedSalesRangeControl.field.value || expectedSalesRangeList;
70
70
  var expectedSalesRangeSelected = expectedSalesRangeValue;
71
- return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.nameAR : expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedSalesRangeList, onSelectItem: onSelectItem, renderItem: function (item) {
72
- return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) }, { children: isAr ? item.nameAR : item.name })) }), item.id === (expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.id) && _jsx(CheckIconStyled, {})] }));
73
- } }) }))] }));
71
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.nameAR : expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedSalesRangeList, onSelectItem: onSelectItem, renderItem: function (item) {
72
+ return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) }, { children: isAr ? item.nameAR : item.name })) }), item.id === (expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.id) && _jsx(CheckIconStyled, {})] }));
73
+ } }) }))] }) })));
74
74
  };
75
75
  export default ExpectedSalesRange;
@@ -67,7 +67,7 @@ var VerifyNumber = function (_a) {
67
67
  dispatch(handlePrevScreenStep());
68
68
  };
69
69
  var loading = false;
70
- 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'), _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(code, " ").concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, type: 'submit', isAr: isAr, loading: loading }, { children: t('next') }))] })) })) }));
70
+ 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'), _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, type: 'submit', isAr: isAr, loading: loading }, { children: t('next') }))] })) })) }));
71
71
  };
72
72
  VerifyNumber.defaultProps = {
73
73
  phone: '564656085',
@@ -1,8 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { AppInfo } from '../../@types';
3
- export interface ConnectLibProps {
4
- appInfo: AppInfo;
5
- publicKey: string;
2
+ import { LibConfig } from '../../@types';
3
+ export interface ConnectLibProps extends LibConfig {
6
4
  }
7
5
  export declare function ConnectLib(props: ConnectLibProps): JSX.Element;
8
6
  export declare function renderConnectLib(config: ConnectLibProps, elementId: string): void;
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React, { memo, useEffect } from 'react';
14
14
  import { FeatureContainer } from '../shared/Containers';
15
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig } from '../../hooks';
15
+ import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
16
16
  import { settingsSelector } from '../../app/settings';
17
17
  import AnimationFlow from '../../components/AnimationFlow';
18
18
  import { store } from '../../app/store';
@@ -23,13 +23,13 @@ import { reactElement } from '../../utils';
23
23
  import { CONNECT_SCREENS_NAVIGATION } from '../../constants';
24
24
  import { connectFeatureScreens } from '../featuresScreens';
25
25
  import CustomFooter from '../shared/Footer';
26
- var Connect = memo(function (_a) {
27
- var appInfo = _a.appInfo, publicKey = _a.publicKey;
26
+ var Connect = memo(function (props) {
28
27
  var open = React.useState(true)[0];
29
28
  var theme = useAppTheme().theme;
30
29
  var dispatch = useAppDispatch();
31
30
  var data = useAppSelector(settingsSelector).data;
32
- useAppConfig({ appInfo: appInfo, navigation: CONNECT_SCREENS_NAVIGATION, publicKey: publicKey });
31
+ useAppConfig(__assign({ navigation: CONNECT_SCREENS_NAVIGATION }, props));
32
+ useErrorListener();
33
33
  var activeScreen = data.activeScreen;
34
34
  useEffect(function () {
35
35
  dispatch(getCountries());
@@ -14,7 +14,6 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { ScreenContainer } from '../../../shared/Containers';
16
16
  import Input from '../../../shared/Input';
17
- import { keepEmailCharacters } from '../../../../utils';
18
17
  import { useController, useFormContext } from 'react-hook-form';
19
18
  import ClearIcon from '../../../shared/ClearIcon';
20
19
  import CheckIcon from '../../../shared/CheckIcon';
@@ -29,17 +28,20 @@ var Email = function (_a) {
29
28
  var t = useTranslation().t;
30
29
  var control = useFormContext().control;
31
30
  var emailControl = useController({ name: 'email', control: control });
31
+ var emailValue = emailControl.field.value;
32
+ var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
32
33
  var checkEmail = debounce(function (value) {
33
34
  dispatch(checkEmailAvailability(value));
34
35
  }, 500);
35
36
  var handleEmailChange = function (event) {
36
- var value = keepEmailCharacters(event.target.value);
37
- emailControl.field.onChange(value);
38
- if (!!value)
39
- checkEmail(value);
37
+ emailControl.field.onChange(event.target.value);
40
38
  };
41
- var emailValue = emailControl.field.value;
42
- var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
39
+ React.useEffect(function () {
40
+ var isValid = emailValue && !error && emailValue.length > 3;
41
+ if (isValid) {
42
+ checkEmail(emailValue);
43
+ }
44
+ }, [emailValue, error]);
43
45
  var clearNumber = function () {
44
46
  emailControl.field.onChange('');
45
47
  };
@@ -34,11 +34,13 @@ var FormStyled = styled(Form)(function () { return ({
34
34
  flexDirection: 'column'
35
35
  }); });
36
36
  var Individual = function (_a) {
37
- var _b, _c, _d;
38
- var _e = React.useState(false), listActive = _e[0], setListActive = _e[1];
39
- var _f = useSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error, searchActive = _f.searchActive;
40
- var _g = React.useState(((_b = data.individualData.countryCode) === null || _b === void 0 ? void 0 : _b.digits) || 9), mobileLength = _g[0], setMobileLength = _g[1];
37
+ var _b, _c, _d, _e;
38
+ var _f = React.useState(false), listActive = _f[0], setListActive = _f[1];
39
+ var _g = useSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error, searchActive = _g.searchActive;
40
+ var _h = React.useState(((_b = data.individualData.countryCode) === null || _b === void 0 ? void 0 : _b.digits) || 9), mobileLength = _h[0], setMobileLength = _h[1];
41
41
  var dispatch = useAppDispatch();
42
+ var t = useTranslation().t;
43
+ var isAr = useLanguage().isAr;
42
44
  var isAbsher = (_c = data.otpData) === null || _c === void 0 ? void 0 : _c.isAbsher;
43
45
  var methods = useForm({
44
46
  resolver: yupResolver(isAbsher ? IndividualMobileValidation(mobileLength) : IndividualValidation()),
@@ -55,17 +57,16 @@ var Individual = function (_a) {
55
57
  if (error)
56
58
  dispatch(clearError());
57
59
  }, [methods.formState.isValid]);
60
+ var handleMenuListClick = function () {
61
+ listActive ? setListActive(false) : setListActive(true);
62
+ };
58
63
  React.useEffect(function () {
59
64
  var _a, _b;
60
- if (((_b = (_a = data.individualData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.is_available) == false)
65
+ if (((_b = (_a = data.individualData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.is_available) === false)
61
66
  methods.setError('email', { message: 'tap_js_email_already_exist' });
62
67
  }, [(_d = data.individualData) === null || _d === void 0 ? void 0 : _d.responseBody]);
63
- var t = useTranslation().t;
64
- var isAr = useLanguage().isAr;
65
- var disabled = !methods.formState.isValid || !!methods.formState.errors.email || !!error || searchActive;
66
- var handleMenuListClick = function () {
67
- listActive ? setListActive(false) : setListActive(true);
68
- };
68
+ var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
69
+ var disabled = emailErrChecks || searchActive || !((_e = data.individualData.responseBody) === null || _e === void 0 ? void 0 : _e.is_available);
69
70
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { setMobileLength: setMobileLength, show: isAbsher, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
70
71
  };
71
72
  export default React.memo(Individual);
@@ -64,6 +64,8 @@ var BrandName = function (_a) {
64
64
  var t = useTranslation().t;
65
65
  var control = useFormContext().control;
66
66
  var brandControl = useController({ control: control, name: 'brandName' });
67
+ var brandNameValue = brandControl.field.value;
68
+ var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
67
69
  var checkBrand = debounce(function (value) {
68
70
  dispatch(checkBrandNameAvailability(value));
69
71
  }, 500);
@@ -71,14 +73,15 @@ var BrandName = function (_a) {
71
73
  var target = _a.target;
72
74
  var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
73
75
  brandControl.field.onChange(value);
74
- if (!!value)
75
- checkBrand(value);
76
76
  };
77
+ React.useEffect(function () {
78
+ var isValid = brandNameValue && !error && brandNameValue.length > 2;
79
+ if (isValid)
80
+ checkBrand(brandNameValue);
81
+ }, [brandNameValue, error]);
77
82
  var clearBrandName = function () {
78
83
  brandControl.field.onChange('');
79
84
  };
80
- var brandNameValue = brandControl.field.value;
81
- var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
82
85
  return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 3 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && brandNameValue ? _jsx(CheckIcon, {}) : brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName }) })] })));
83
86
  };
84
87
  export default React.memo(BrandName);
@@ -27,8 +27,8 @@ import BrandName from './BrandName';
27
27
  import SocialMedia from './SocialMedia';
28
28
  import TAC from './TAC';
29
29
  var Merchant = function (_a) {
30
- var _b;
31
- var _c = useSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error, searchActive = _c.searchActive;
30
+ var _b, _c, _d;
31
+ var _e = useSelector(connectSelector), data = _e.data, loading = _e.loading, error = _e.error, searchActive = _e.searchActive;
32
32
  var methods = useForm({
33
33
  resolver: yupResolver(MerchantValidationSchema),
34
34
  defaultValues: data.brandData,
@@ -49,10 +49,11 @@ var Merchant = function (_a) {
49
49
  }, [methods.formState.isValid]);
50
50
  React.useEffect(function () {
51
51
  var _a, _b;
52
- if (((_b = (_a = data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) == '5')
52
+ if (((_b = (_a = data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5')
53
53
  methods.setError('brandName', { message: 'Profile Name already exists' });
54
54
  }, [(_b = data.brandData) === null || _b === void 0 ? void 0 : _b.responseBody]);
55
- var disabled = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error || searchActive;
55
+ var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
56
+ var disabled = brandErrChecks || searchActive || ((_d = (_c = data.brandData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.response_code) === '5';
56
57
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, {}), _jsx(SocialMedia, {}), _jsx(TAC, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] })) })) }));
57
58
  };
58
59
  export default React.memo(Merchant);
@@ -1,11 +1,6 @@
1
1
  import * as React from 'react';
2
- import { CountryCode } from '../../../../@types';
3
2
  interface BusinessCountryProps {
4
- countries: Array<CountryCode>;
5
3
  show: boolean;
6
- setMobileLength?: (length: number) => void;
7
- onListOpen?: () => void;
8
- onListClose?: () => void;
9
4
  }
10
5
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BusinessCountryProps & React.RefAttributes<unknown>>>;
11
6
  export default _default;
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import * as React from 'react';
25
25
  import Box from '@mui/material/Box';
26
26
  import { styled } from '@mui/material/styles';
@@ -32,7 +32,6 @@ import CheckIcon from '@mui/icons-material/Check';
32
32
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
33
33
  import Icon from '../../../../components/Icon';
34
34
  import Input from '../../../shared/Input';
35
- import SimpleList from '../../../../components/SimpleList';
36
35
  import { useLanguage } from '../../../../hooks';
37
36
  var CountryItemContainer = styled(Box)(function () { return ({
38
37
  display: 'flex'
@@ -62,32 +61,12 @@ var CountryIconStyled = styled(Icon)(function (_a) {
62
61
  });
63
62
  var BusinessCountry = React.forwardRef(function (_a, ref) {
64
63
  var _b, _c;
65
- var countries = _a.countries, rest = __rest(_a, ["countries"]);
66
- var _d = React.useState(countries), businessCountries = _d[0], setBusinessCountries = _d[1];
67
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
64
+ var rest = __rest(_a, []);
68
65
  var t = useTranslation().t;
69
66
  var isAr = useLanguage().isAr;
70
67
  var control = useFormContext().control;
71
68
  var businessCountryControl = useController({ control: control, name: 'businessCountry' });
72
- var onOpenCountrySelect = function (event) {
73
- };
74
- var onCloseCountrySelect = function () {
75
- var _a;
76
- setAnchorEl(null);
77
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
78
- };
79
- var onSelectItem = function (country) {
80
- onCloseCountrySelect();
81
- businessCountryControl.field.onChange(country);
82
- };
83
- React.useEffect(function () {
84
- if (businessCountries.length === 0) {
85
- setBusinessCountries(countries);
86
- }
87
- }, [countries]);
88
69
  var businessCountry = businessCountryControl.field.value;
89
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: [_jsx(Input, { label: t('signup_select_country'), readOnly: true, onClick: !!anchorEl ? onCloseCountrySelect : onOpenCountrySelect, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _c === void 0 ? void 0 : _c.english) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: businessCountries, onSelectItem: onSelectItem, renderItem: function (item) {
90
- return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsx(CountryIconStyled, { src: item.logo, alt: item.iso3 }), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.idd_prefix) && _jsx(CheckIconStyled, {})] }));
91
- } }) }))] })) })));
70
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
92
71
  });
93
72
  export default React.memo(BusinessCountry);
@@ -74,10 +74,9 @@ var ListType;
74
74
  ListType["CountryCodeList"] = "CountryCodeList";
75
75
  })(ListType || (ListType = {}));
76
76
  var Mobile = function (_a) {
77
- var _b, _c;
78
- var _d = useSelector(connectSelector), data = _d.data, loading = _d.loading, error = _d.error;
79
- var _e = React.useState((_c = (_b = data.mobileData) === null || _b === void 0 ? void 0 : _b.countryCode) === null || _c === void 0 ? void 0 : _c.digits), mobileLength = _e[0], setMobileLength = _e[1];
80
- var _f = React.useState(), listType = _f[0], setListType = _f[1];
77
+ var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
78
+ var _c = React.useState(data.mobileData.countryCode.digits), mobileLength = _c[0], setMobileLength = _c[1];
79
+ var _d = React.useState(), listType = _d[0], setListType = _d[1];
81
80
  var dispatch = useAppDispatch();
82
81
  var methods = useForm({
83
82
  resolver: yupResolver(PhoneValidationSchema(mobileLength)),
@@ -90,6 +89,17 @@ var Mobile = function (_a) {
90
89
  var handleMenuListClick = function (flag) {
91
90
  setListType(flag);
92
91
  };
92
+ React.useEffect(function () {
93
+ if (data.mobileData.countryCode.digits) {
94
+ setMobileLength(data.mobileData.countryCode.digits);
95
+ }
96
+ if (data.mobileData.countryCode) {
97
+ methods.setValue('countryCode', data.mobileData.countryCode);
98
+ }
99
+ if (data.mobileData.businessCountry) {
100
+ methods.setValue('businessCountry', data.mobileData.businessCountry);
101
+ }
102
+ }, [data.mobileData]);
93
103
  React.useEffect(function () {
94
104
  if (error)
95
105
  dispatch(clearError());
@@ -105,6 +115,6 @@ var Mobile = function (_a) {
105
115
  var listActive = isBusinessListActive || isCountryListActive;
106
116
  var isLoading = settingsStore.loading || loading;
107
117
  var disabled = !methods.formState.isValid || !!error;
108
- return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BusinessCountry, { show: !isCountryListActive, setMobileLength: setMobileLength, countries: data.businessCountries, onListOpen: function () { return handleMenuListClick(ListType.BusinessList); }, onListClose: function () { return handleMenuListClick(); } }), _jsx(MobileNumber, { show: !isBusinessListActive, setMobileLength: setMobileLength, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } })] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, disabled: disabled, disableBack: true, loading: isLoading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ isAr: isAr, onClick: onAbsherButtonClicked }, { children: t('absher_button_label') }))] }))] })) }))] }));
118
+ return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BusinessCountry, { show: !isCountryListActive }), _jsx(MobileNumber, { show: !isBusinessListActive, setMobileLength: setMobileLength, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } })] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, disabled: disabled, disableBack: true, loading: isLoading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ isAr: isAr, onClick: onAbsherButtonClicked }, { children: t('absher_button_label') }))] }))] })) }))] }));
109
119
  };
110
120
  export default React.memo(Mobile);
@@ -10,11 +10,14 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { ScreenContainer } from '../../../shared/Containers';
14
- import DatePicker from '../../../../components/DatePicker';
13
+ import { useSelector } from 'react-redux';
15
14
  import { useTranslation } from 'react-i18next';
16
15
  import { useController, useFormContext } from 'react-hook-form';
16
+ import { useAppDispatch } from '../../../../hooks';
17
+ import { ScreenContainer } from '../../../shared/Containers';
18
+ import DatePicker from '../../../../components/DatePicker';
17
19
  import { alpha, styled } from '@mui/material/styles';
20
+ import { clearError, connectSelector } from '../../../app/connect/connectStore';
18
21
  import Text from '../../../../components/Text';
19
22
  var InputLabelStyled = styled(Text)(function (_a) {
20
23
  var theme = _a.theme;
@@ -25,9 +28,16 @@ var DOB = function (_a) {
25
28
  var onDateClicked = _a.onDateClicked;
26
29
  var t = useTranslation().t;
27
30
  var control = useFormContext().control;
31
+ var dispatch = useAppDispatch();
28
32
  var dobControl = useController({ control: control, name: 'dob' });
33
+ var error = useSelector(connectSelector).error;
29
34
  var handleBirthDateChange = function (data) {
30
35
  dobControl.field.onChange(data);
36
+ handleClearError();
37
+ };
38
+ var handleClearError = function () {
39
+ if (error)
40
+ dispatch(clearError());
31
41
  };
32
42
  var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
33
43
  return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
@@ -43,8 +43,7 @@ var NID = function (_a) {
43
43
  mode: 'onChange'
44
44
  });
45
45
  React.useEffect(function () {
46
- if (error)
47
- dispatch(clearError());
46
+ handleClearError();
48
47
  }, [methods.formState.isValid]);
49
48
  var onSubmit = function (data) {
50
49
  dispatch(createNIDAuth(__assign(__assign({}, data), { isResend: false })));
@@ -55,6 +54,10 @@ var NID = function (_a) {
55
54
  var onBack = function () {
56
55
  dispatch(handlePrevScreenStep());
57
56
  };
57
+ var handleClearError = function () {
58
+ if (error)
59
+ dispatch(clearError());
60
+ };
58
61
  var disabled = !methods.formState.isValid || !!error;
59
62
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Box, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }) }))] })) })) }));
60
63
  };
@@ -4,7 +4,6 @@ export var NIDValidationSchema = yup.object().shape({
4
4
  nid: yup
5
5
  .string()
6
6
  .matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
7
- .min(8, 'signup_invalid_national_id_format')
8
- .max(10, 'signup_invalid_national_id_format')
7
+ .min(10, 'signup_invalid_national_id')
9
8
  .required('signup_invalid_national_id')
10
9
  });
@@ -7,8 +7,13 @@ import { updateLeadSuccess } from '../../../app/connect/connectStore';
7
7
  var ThankYou = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var onSuccess = function () {
10
+ React.useEffect(function () {
11
11
  dispatch(updateLeadSuccess());
12
+ }, []);
13
+ var onSuccess = function () {
14
+ console.log('success');
15
+ alert('Account created successfully, please check your email');
16
+ alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
12
17
  };
13
18
  return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
14
19
  };
@@ -27,16 +27,17 @@ import Icon from '../../../components/Icon';
27
27
  import { styled } from '@mui/material/styles';
28
28
  import Loader from '../../../components/Loader';
29
29
  import { ICONS_NAMES } from '../../../constants';
30
- import ButtonGroup from '@mui/material/ButtonGroup';
31
30
  import Warning from '../../../components/Warning';
32
31
  import Collapse from '../../../components/Collapse';
32
+ import Box from '@mui/material/Box';
33
+ import Text from '../../../components/Text';
33
34
  var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
34
35
  var theme = _a.theme, isAr = _a.isAr;
35
36
  return ({
36
37
  width: theme.spacing(3),
37
38
  height: theme.spacing(3),
38
39
  transform: isAr ? 'scaleX(-1)' : 'scaleX(1)',
39
- marginInlineEnd: theme.spacing(-0.75)
40
+ marginInlineEnd: theme.spacing(0.5)
40
41
  });
41
42
  });
42
43
  var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -45,39 +46,38 @@ var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return
45
46
  width: theme.spacing(3),
46
47
  height: theme.spacing(3),
47
48
  transform: isAr ? 'scaleX(1)' : 'scaleX(-1)',
48
- marginInlineStart: theme.spacing(0.5)
49
+ marginInlineStart: theme.spacing(-1)
49
50
  });
50
51
  });
51
- var ButtonBoxStyled = styled(ButtonGroup, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
52
- var theme = _a.theme, isAr = _a.isAr;
52
+ var ButtonBoxStyled = styled(Box)(function (_a) {
53
+ var theme = _a.theme;
53
54
  return ({
54
- width: '100%',
55
55
  margin: theme.spacing(0, 2.5, 2.5, 2.5),
56
- paddingInlineEnd: theme.spacing(5),
57
- '& .MuiButtonGroup-grouped:not(:first-of-type)': {
58
- borderTopRightRadius: theme.spacing(4.1),
59
- borderBottomRightRadius: theme.spacing(4.1),
60
- borderTopLeftRadius: 0,
61
- borderBottomLeftRadius: 0
62
- },
63
- '& .MuiButtonGroup-grouped:not(:last-of-type)': {
64
- borderTopRightRadius: 0,
65
- borderBottomRightRadius: 0,
66
- borderTopLeftRadius: theme.spacing(4.1),
67
- borderBottomLeftRadius: theme.spacing(4.1)
68
- }
56
+ marginBlockStart: theme.spacing(5),
57
+ display: 'flex'
69
58
  });
70
59
  });
71
- var ButtonStyled = styled(Button)(function (_a) {
72
- var theme = _a.theme;
60
+ var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'isBack'; } })(function (_a) {
61
+ var theme = _a.theme, isBack = _a.isBack;
62
+ return ({
63
+ paddingInlineStart: theme.spacing(2.5),
64
+ marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0)
65
+ });
66
+ });
67
+ var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
68
+ var theme = _a.theme, isAr = _a.isAr;
73
69
  return ({
74
- paddingInlineStart: theme.spacing(0.75)
70
+ paddingInlineStart: theme.spacing(2.5),
71
+ width: '10%',
72
+ zIndex: 1,
73
+ borderRadius: isAr ? theme.spacing(0, 4.75, 4.75, 0) : theme.spacing(4.75, 0, 0, 4.75)
75
74
  });
76
75
  });
77
76
  export default function CustomButton(_a) {
78
77
  var children = _a.children, disabled = _a.disabled, isAr = _a.isAr, loading = _a.loading, disableBack = _a.disableBack, onBackClicked = _a.onBackClicked, error = _a.error, props = __rest(_a, ["children", "disabled", "isAr", "loading", "disableBack", "onBackClicked", "error"]);
79
- return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, __assign({ sx: { mt: 5 }, isAr: isAr, disableElevation: true, disableRipple: true, disableFocusRipple: true }, { children: [!disableBack && !loading && (_jsx(ButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, sx: { width: '10%' }, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled || loading, type: 'submit', endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }), startIcon: _jsx(Loader, { style: {
78
+ var isBackEnabled = !disableBack && !loading;
79
+ return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled || loading, type: 'submit', isBack: isBackEnabled, endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }), startIcon: _jsx(Loader, { style: {
80
80
  visibility: disableBack && !loading ? 'hidden' : loading ? 'visible' : 'hidden',
81
81
  display: !disableBack && !loading ? 'none' : 'block'
82
- }, innerColor: 'white', outerColor: 'white', size: 30, toggleAnimation: !!loading }) }, props, { children: children }))] }))] }));
82
+ }, innerColor: 'white', outerColor: 'white', size: 30, toggleAnimation: !!loading }) }, props, { children: _jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '20px' } }, { children: [" ", children] })) }))] })] }));
83
83
  }
@@ -7,3 +7,4 @@ export * from './useEventListener';
7
7
  export * from './useLanguage';
8
8
  export * from './useContainerDimensions';
9
9
  export * from './useAppConfig';
10
+ export * from './useErrorListener';
@@ -7,3 +7,4 @@ export * from './useEventListener';
7
7
  export * from './useLanguage';
8
8
  export * from './useContainerDimensions';
9
9
  export * from './useAppConfig';
10
+ export * from './useErrorListener';
@@ -1,10 +1,8 @@
1
- import { AppInfo, ScreenStepNavigation } from '../@types';
2
- interface AppConfigProps {
3
- appInfo: AppInfo;
1
+ import { LibConfig, ScreenStepNavigation } from '../@types';
2
+ interface AppConfigProps extends LibConfig {
4
3
  navigation: ScreenStepNavigation[];
5
- publicKey?: string;
6
4
  }
7
- export declare const useAppConfig: ({ appInfo, navigation, publicKey }: AppConfigProps) => {
5
+ export declare const useAppConfig: ({ appInfo, navigation, publicKey, ...rest }: AppConfigProps) => {
8
6
  loading: boolean;
9
7
  error: string | null;
10
8
  };