@tap-payments/auth-jsconnect 2.1.43-test → 2.1.45-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/build/@types/form.d.ts +8 -5
  2. package/build/api/account.d.ts +5 -0
  3. package/build/api/account.js +9 -1
  4. package/build/api/auth.d.ts +8 -4
  5. package/build/api/auth.js +18 -2
  6. package/build/api/index.d.ts +6 -2
  7. package/build/api/lead.d.ts +1 -0
  8. package/build/api/lead.js +10 -1
  9. package/build/assets/locales/ar.json +2 -0
  10. package/build/assets/locales/en.json +2 -0
  11. package/build/components/Lottie/Lottie.d.ts +320 -0
  12. package/build/components/Lottie/Lottie.js +3 -1
  13. package/build/components/Lottie/files/account_creating.json +732 -0
  14. package/build/constants/api.d.ts +3 -0
  15. package/build/constants/api.js +8 -2
  16. package/build/constants/app.d.ts +5 -2
  17. package/build/constants/app.js +60 -4
  18. package/build/features/app/auth/authStore.d.ts +3 -3
  19. package/build/features/app/business/businessStore.d.ts +1 -0
  20. package/build/features/app/connect/connectStore.d.ts +1 -0
  21. package/build/features/app/connect/connectStore.js +6 -5
  22. package/build/features/app/connectExpress/connectExpressStore.d.ts +61 -6
  23. package/build/features/app/connectExpress/connectExpressStore.js +614 -66
  24. package/build/features/connect/screens/Merchant/Merchant.js +11 -8
  25. package/build/features/connect/screens/Merchant/Segments.js +3 -3
  26. package/build/features/connect/screens/Merchant/TeamSize.js +2 -2
  27. package/build/features/connectExpress/ConnectExpress.js +1 -1
  28. package/build/features/connectExpress/screens/CivilID/CivilID.js +3 -3
  29. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.d.ts +5 -0
  30. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +53 -0
  31. package/build/features/connectExpress/screens/CivilIDMissed/IDNumber.d.ts +7 -0
  32. package/build/features/connectExpress/screens/CivilIDMissed/IDNumber.js +55 -0
  33. package/build/features/connectExpress/screens/CivilIDMissed/index.d.ts +3 -0
  34. package/build/features/connectExpress/screens/CivilIDMissed/index.js +2 -0
  35. package/build/features/connectExpress/screens/CivilIDMissed/validation.d.ts +8 -0
  36. package/build/features/connectExpress/screens/CivilIDMissed/validation.js +4 -0
  37. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.d.ts +8 -0
  38. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +142 -0
  39. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.d.ts +5 -0
  40. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +77 -0
  41. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.d.ts +8 -0
  42. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +144 -0
  43. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.d.ts +7 -0
  44. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +52 -0
  45. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +34 -0
  46. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.js +94 -0
  47. package/build/features/connectExpress/screens/CollectBusinessInfo/index.d.ts +3 -0
  48. package/build/features/connectExpress/screens/CollectBusinessInfo/index.js +2 -0
  49. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +27 -0
  50. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +79 -0
  51. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.d.ts +5 -0
  52. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +89 -0
  53. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.d.ts +8 -0
  54. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +113 -0
  55. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.d.ts +10 -0
  56. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +149 -0
  57. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.d.ts +6 -0
  58. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.js +45 -0
  59. package/build/features/connectExpress/screens/CollectIndividualInfo/index.d.ts +3 -0
  60. package/build/features/connectExpress/screens/CollectIndividualInfo/index.js +2 -0
  61. package/build/features/connectExpress/screens/CollectIndividualInfo/validation.d.ts +14 -0
  62. package/build/features/connectExpress/screens/CollectIndividualInfo/validation.js +31 -0
  63. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.d.ts +5 -0
  64. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +61 -0
  65. package/build/features/connectExpress/screens/CreateAccountLoader/index.d.ts +2 -0
  66. package/build/features/connectExpress/screens/CreateAccountLoader/index.js +2 -0
  67. package/build/features/connectExpress/screens/IdentityOTP/OTP.d.ts +5 -0
  68. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +87 -0
  69. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +5 -0
  70. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +52 -0
  71. package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +3 -0
  72. package/build/features/connectExpress/screens/IdentityOTP/index.js +2 -0
  73. package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +8 -0
  74. package/build/features/connectExpress/screens/IdentityOTP/validation.js +4 -0
  75. package/build/features/connectExpress/screens/IdentityVerifyPACI/VerifyPACI.d.ts +5 -0
  76. package/build/features/connectExpress/screens/IdentityVerifyPACI/VerifyPACI.js +34 -0
  77. package/build/features/connectExpress/screens/IdentityVerifyPACI/index.d.ts +3 -0
  78. package/build/features/connectExpress/screens/IdentityVerifyPACI/index.js +2 -0
  79. package/build/features/connectExpress/screens/Mobile/Mobile.js +0 -3
  80. package/build/features/connectExpress/screens/NID/NID.js +7 -6
  81. package/build/features/connectExpress/screens/NIDMissed/DOB.d.ts +6 -0
  82. package/build/features/connectExpress/screens/NIDMissed/DOB.js +47 -0
  83. package/build/features/connectExpress/screens/NIDMissed/IDNumber.d.ts +6 -0
  84. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +60 -0
  85. package/build/features/connectExpress/screens/NIDMissed/NID.d.ts +5 -0
  86. package/build/features/connectExpress/screens/NIDMissed/NID.js +59 -0
  87. package/build/features/connectExpress/screens/NIDMissed/index.d.ts +3 -0
  88. package/build/features/connectExpress/screens/NIDMissed/index.js +2 -0
  89. package/build/features/connectExpress/screens/NIDMissed/validation.d.ts +11 -0
  90. package/build/features/connectExpress/screens/NIDMissed/validation.js +9 -0
  91. package/build/features/connectExpress/screens/OTP/OTP.js +10 -6
  92. package/build/features/connectExpress/screens/OTP/OTPInput.js +7 -6
  93. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  94. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +119 -0
  95. package/build/features/connectExpress/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  96. package/build/features/connectExpress/screens/SuccessWithFlowButtons/index.js +2 -0
  97. package/build/features/connectExpress/screens/VerifyPACI/VerifyPACI.js +7 -68
  98. package/build/features/featuresScreens.js +40 -0
  99. package/build/features/shared/FlowButtons/FlowButtons.d.ts +4 -0
  100. package/build/features/shared/FlowButtons/FlowButtons.js +6 -0
  101. package/build/features/shared/FlowButtons/index.d.ts +2 -0
  102. package/build/features/shared/FlowButtons/index.js +2 -0
  103. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface VerifyPACIProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<() => JSX.Element | null>;
5
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { connectExpressSelector, verifyPACIAsync } from '../../../app/connectExpress/connectExpressStore';
4
+ import PaciVerification from '../../../shared/PaciVerification';
5
+ import { handlePrevScreenStep } from '../../../../app/settings';
6
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
7
+ var VerifyPACI = function () {
8
+ var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
9
+ var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
10
+ var dispatch = useAppDispatch();
11
+ var data = useAppSelector(connectExpressSelector).data;
12
+ var authData = (data.responseData || {}).authData;
13
+ var _c = authData || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios;
14
+ React.useEffect(function () {
15
+ if (authData && !isReady) {
16
+ setIsReady(true);
17
+ }
18
+ }, [authData]);
19
+ React.useEffect(function () {
20
+ if (!isReady)
21
+ return;
22
+ var promise = dispatch(verifyPACIAsync({ onSuccess: function () { return setSuccess(true); } }));
23
+ return function () {
24
+ promise === null || promise === void 0 ? void 0 : promise.abort();
25
+ };
26
+ }, [isReady]);
27
+ var onBack = React.useCallback(function () {
28
+ dispatch(handlePrevScreenStep());
29
+ }, []);
30
+ if (!isReady)
31
+ return null;
32
+ return (_jsx(PaciVerification, { expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
33
+ };
34
+ export default React.memo(VerifyPACI);
@@ -0,0 +1,3 @@
1
+ import VerifyPACI, { VerifyPACIProps } from './VerifyPACI';
2
+ export type { VerifyPACIProps };
3
+ export default VerifyPACI;
@@ -0,0 +1,2 @@
1
+ import VerifyPACI from './VerifyPACI';
2
+ export default VerifyPACI;
@@ -87,9 +87,6 @@ var Mobile = function (_a) {
87
87
  React.useEffect(function () {
88
88
  dispatch(resetStore());
89
89
  }, []);
90
- React.useEffect(function () {
91
- dispatch(resetStore());
92
- }, []);
93
90
  var onSubmit = function (formData) {
94
91
  dispatch(createMobileAuthAsync(formData));
95
92
  };
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { NIDValidationSchema } from './validation';
19
19
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
20
  import { handlePrevScreenStep } from '../../../../app/settings';
21
- import { clearError, connectExpressSelector, createNIDAuthAsync, resetStore } from '../../../app/connectExpress/connectExpressStore';
21
+ import { clearError, connectExpressSelector, createNIDAuthAsync } from '../../../app/connectExpress/connectExpressStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button, { MobileButton } from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -57,11 +57,12 @@ var OrBoxStyled = styled(Box)(function (_a) {
57
57
  });
58
58
  });
59
59
  var NID = function (_a) {
60
- var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
60
+ var _b, _c, _d;
61
+ var _e = React.useState(false), collapse = _e[0], setCollapse = _e[1];
61
62
  var isAr = useLanguage().isAr;
62
63
  var dispatch = useAppDispatch();
63
64
  var t = useTranslation().t;
64
- var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
65
+ var _f = useAppSelector(connectExpressSelector), data = _f.data, loading = _f.loading, error = _f.error;
65
66
  var methods = useForm({
66
67
  resolver: yupResolver(NIDValidationSchema),
67
68
  defaultValues: data.nidData,
@@ -72,7 +73,6 @@ var NID = function (_a) {
72
73
  dispatch(clearError());
73
74
  }, [methods.formState.isValid]);
74
75
  React.useEffect(function () {
75
- dispatch(resetStore());
76
76
  }, []);
77
77
  var onSubmit = function (data) {
78
78
  dispatch(createNIDAuthAsync(data));
@@ -81,9 +81,10 @@ var NID = function (_a) {
81
81
  setCollapse(flag);
82
82
  };
83
83
  var onBack = function () {
84
- dispatch(handlePrevScreenStep('CONNECT_EXPRESS_MOBILE_STEP'));
84
+ dispatch(handlePrevScreenStep());
85
85
  };
86
86
  var disabled = !methods.formState.isValid || !!error;
87
- 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 }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
87
+ var isLeadIdentityIdAvailable = (_d = (_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id;
88
+ 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 }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid && !isLeadIdentityIdAvailable }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
88
89
  };
89
90
  export default React.memo(NID);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface DOBProps {
3
+ onDateClicked?: (flag: boolean) => void;
4
+ }
5
+ declare const DOB: ({ onDateClicked }: DOBProps) => JSX.Element;
6
+ export default DOB;
@@ -0,0 +1,47 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useTranslation } from 'react-i18next';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
16
+ import { ScreenContainer } from '../../../shared/Containers';
17
+ import DatePicker from '../../../../components/DatePicker';
18
+ import { alpha, styled } from '@mui/material/styles';
19
+ import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
20
+ import Text from '../../../../components/Text';
21
+ var InputLabelStyled = styled(Text)(function (_a) {
22
+ var theme = _a.theme;
23
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
24
+ });
25
+ var DOB = function (_a) {
26
+ var _b;
27
+ var onDateClicked = _a.onDateClicked;
28
+ var t = useTranslation().t;
29
+ var control = useFormContext().control;
30
+ var dispatch = useAppDispatch();
31
+ var dobControl = useController({ control: control, name: 'dob' });
32
+ var error = useAppSelector(connectExpressSelector).error;
33
+ var handleBirthDateChange = function (data) {
34
+ dobControl.field.onChange(data);
35
+ handleClearError();
36
+ };
37
+ var handleClearError = function () {
38
+ if (error)
39
+ dispatch(clearError());
40
+ };
41
+ var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
42
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
43
+ var spacing = _a.spacing;
44
+ return spacing(2.5, 2.5, 1.5, 2.5);
45
+ } } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }));
46
+ };
47
+ export default DOB;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface IDNumberProps {
3
+ show: boolean;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
6
+ export default _default;
@@ -0,0 +1,60 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useController, useFormContext } from 'react-hook-form';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import { useAppSelector } from '../../../../hooks';
19
+ import Text from '../../../../components/Text';
20
+ import Input from '../../../shared/Input';
21
+ import ClearIcon from '../../../shared/ClearIcon';
22
+ import CheckIcon from '../../../shared/CheckIcon';
23
+ import Collapse from '../../../../components/Collapse';
24
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
+ import { removeAllCharsFromNumber } from '../../../../utils';
26
+ import { ID_NUMBER_LENGTH } from '../../../../constants';
27
+ import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
28
+ var LabelContainerStyled = styled(Box)(function (_a) {
29
+ var theme = _a.theme;
30
+ return ({
31
+ display: 'flex',
32
+ justifyContent: 'space-between',
33
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
34
+ });
35
+ });
36
+ var InputLabelStyled = styled(Text)(function (_a) {
37
+ var theme = _a.theme;
38
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
39
+ });
40
+ var IDNumber = React.forwardRef(function (_a, ref) {
41
+ var _b, _c, _d, _e;
42
+ var show = _a.show;
43
+ var t = useTranslation().t;
44
+ var control = useFormContext().control;
45
+ var nidControl = useController({ control: control, name: 'nid' });
46
+ var data = useAppSelector(connectExpressSelector).data;
47
+ var isIDAvailable = (_d = (_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id;
48
+ var handleIdChange = function (_a) {
49
+ var target = _a.target;
50
+ var value = removeAllCharsFromNumber(target.value);
51
+ nidControl.field.onChange(value);
52
+ };
53
+ var clearIdNumber = function () {
54
+ nidControl.field.onChange('');
55
+ };
56
+ var nidValue = nidControl.field.value;
57
+ var error = (_e = nidControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
58
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', disabled: isIDAvailable, inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
59
+ });
60
+ export default React.memo(IDNumber);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface NIDProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: NIDProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,59 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { styled } from '@mui/material/styles';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { NIDValidationSchema } from './validation';
19
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
+ import { handlePrevScreenStep } from '../../../../app/settings';
21
+ import { clearError, connectExpressSelector, createNIDAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
22
+ import Form from '../../../../components/Form';
23
+ import Button from '../../../shared/Button';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Collapse from '../../../../components/Collapse';
26
+ import IDNumber from './IDNumber';
27
+ import DOB from './DOB';
28
+ var FormStyled = styled(Form)(function () { return ({
29
+ display: 'flex',
30
+ flexDirection: 'column'
31
+ }); });
32
+ var NID = function (_a) {
33
+ var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
34
+ var isAr = useLanguage().isAr;
35
+ var dispatch = useAppDispatch();
36
+ var t = useTranslation().t;
37
+ var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
38
+ var methods = useForm({
39
+ resolver: yupResolver(NIDValidationSchema),
40
+ defaultValues: data.nidData,
41
+ mode: 'onChange'
42
+ });
43
+ React.useEffect(function () {
44
+ if (error)
45
+ dispatch(clearError());
46
+ }, [methods.formState.isValid]);
47
+ var onSubmit = function (data) {
48
+ dispatch(createNIDAuthIdentityAsync(data));
49
+ };
50
+ var handleCollapseOpenClose = function (flag) {
51
+ setCollapse(flag);
52
+ };
53
+ var onBack = function () {
54
+ dispatch(handlePrevScreenStep());
55
+ };
56
+ var disabled = !methods.formState.isValid || !!error;
57
+ 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(Button, __assign({ loading: loading, isAr: isAr, onBackClicked: onBack, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
58
+ };
59
+ export default React.memo(NID);
@@ -0,0 +1,3 @@
1
+ import NID, { NIDProps } from './NID';
2
+ export type { NIDProps };
3
+ export default NID;
@@ -0,0 +1,2 @@
1
+ import NID from './NID';
2
+ export default NID;
@@ -0,0 +1,11 @@
1
+ import * as yup from 'yup';
2
+ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
6
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
7
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
9
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
+ }>>>;
@@ -0,0 +1,9 @@
1
+ import * as yup from 'yup';
2
+ export var NIDValidationSchema = yup.object().shape({
3
+ dob: yup.string().min(5).required('enter_valid_birth_date'),
4
+ nid: yup
5
+ .string()
6
+ .matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
7
+ .min(10, 'signup_invalid_national_id')
8
+ .required('signup_invalid_national_id')
9
+ });
@@ -15,7 +15,7 @@ import { styled } from '@mui/material/styles';
15
15
  import * as React from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import Text from '../../../../components/Text';
18
- import { clearError, connectExpressSelector, verifyOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
18
+ import { clearError, connectExpressSelector, verifyMobileOtpAsync, verifyNIDOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
19
19
  import Button from '../../../shared/Button';
20
20
  import { ScreenContainer } from '../../../shared/Containers';
21
21
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
@@ -58,7 +58,7 @@ var OTP = function () {
58
58
  defaultValues: data.otpData,
59
59
  mode: 'onChange'
60
60
  });
61
- var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
61
+ var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
62
62
  React.useEffect(function () {
63
63
  if (error)
64
64
  dispatch(clearError());
@@ -69,16 +69,20 @@ var OTP = function () {
69
69
  };
70
70
  }, []);
71
71
  var onSubmit = function (formData) {
72
- dispatch(verifyOtpAsync(formData));
72
+ if (isNidAuth) {
73
+ dispatch(verifyNIDOtpAsync(formData));
74
+ return;
75
+ }
76
+ dispatch(verifyMobileOtpAsync(formData));
73
77
  };
74
78
  var onBack = function () {
75
- var screen = startWithNID ? 'CONNECT_EXPRESS_NID_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
79
+ var screen = isNidAuth ? 'CONNECT_EXPRESS_NID_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
76
80
  dispatch(handlePrevScreenStep(screen));
77
81
  };
78
82
  var disabled = !methods.formState.isValid || !!error;
79
83
  var phone = ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + (data.mobileData.mobile || '');
80
84
  var idNumber = data.nidData.nid;
81
- var title = startWithNID ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
82
- 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') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: startWithNID ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
85
+ var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
86
+ 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') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isNidAuth ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
83
87
  };
84
88
  export default React.memo(OTP);
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { AuthForType } from '../../../../@types';
21
- import { connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
21
+ import { createMobileAuthAsync, createNIDAuthAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
@@ -33,22 +33,23 @@ var OTPInput = function (_a) {
33
33
  var t = useTranslation().t;
34
34
  var dispatch = useAppDispatch();
35
35
  var otpControl = useController({ name: 'otp', control: control });
36
- var data = useAppSelector(connectSelector).data;
37
- var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
36
+ var data = useAppSelector(connectExpressSelector).data;
37
+ var mobileData = data.mobileData, nidData = data.nidData, responseData = data.responseData;
38
+ var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
38
39
  var handleOnOTPChange = function (otp) {
39
40
  otpControl.field.onChange(otp);
40
41
  };
41
42
  var handleOnResendOTP = function () {
42
43
  if (otpControl.field.value)
43
44
  setValue('otp', '', { shouldValidate: true });
44
- dispatch(resendOTPMobile());
45
+ dispatch(createMobileAuthAsync(mobileData));
45
46
  };
46
47
  var handleOnResendAbsherOTP = function () {
47
48
  if (otpControl.field.value)
48
49
  setValue('otp', '', { shouldValidate: true });
49
- dispatch(resendOTPNID());
50
+ dispatch(createNIDAuthAsync(nidData));
50
51
  };
51
52
  var otpValue = otpControl.field.value;
52
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: startWithNID ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
53
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isNidAuth ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
53
54
  };
54
55
  export default React.memo(OTPInput);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,119 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo, useEffect, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { styled } from '@mui/material/styles';
16
+ import { FlowsButtons } from '../../../shared/Button';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenString, shortenBrand } from '../../../../utils';
20
+ import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../../components/Text';
23
+ import Container from '../../../shared/Containers/ScreenContainer';
24
+ import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
+ import { settingsSelector } from '../../../../app/settings';
26
+ var TitleStyled = styled(Text)(function (_a) {
27
+ var _b;
28
+ var theme = _a.theme;
29
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
30
+ });
31
+ var ContainerStyled = styled(Container)(function (_a) {
32
+ var theme = _a.theme;
33
+ return ({
34
+ justifyContent: 'space-between',
35
+ minHeight: theme.spacing(30),
36
+ alignItems: 'center'
37
+ });
38
+ });
39
+ var ButtonGroupStyled = styled(Box)(function (_a) {
40
+ var theme = _a.theme;
41
+ return ({
42
+ width: '100%',
43
+ paddingTop: theme.spacing(3)
44
+ });
45
+ });
46
+ var SuccessWithFlowButtons = function () {
47
+ var _a, _b, _c;
48
+ var _d = useState([]), buttons = _d[0], setButtons = _d[1];
49
+ var t = useTranslation().t;
50
+ var isAr = useLanguage().isAr;
51
+ var data = useAppSelector(connectExpressSelector).data;
52
+ var settings = useAppSelector(settingsSelector);
53
+ var _e = data.responseData, boardData = _e.boardData, leadData = _e.leadData, boardInfo = _e.boardInfo;
54
+ var _f = leadData || {}, brand = _f.brand, entity = _f.entity;
55
+ var _g = boardData || {}, business = _g.business, merchant = _g.merchant, bank = _g.bank_account, user = _g.user;
56
+ var flows = (boardInfo || {}).info;
57
+ var _h = user || {}, names = _h.names, identification = _h.identification;
58
+ var primary_contact = (business || {}).primary_contact;
59
+ var _j = entity || {}, license = _j.license, vat_id = _j.vat_id, legal_name = _j.legal_name;
60
+ var username = isAr ? concatenateObjectValues(names.ar || names.en, ['first', 'last']) : concatenateObjectValues(names.en, ['first', 'last']);
61
+ var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
62
+ var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
63
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
64
+ var taxID = vat_id || '';
65
+ var brandName = (isAr ? (_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.en) || '';
66
+ var entityLegalName = shortenString(isAr ? legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar : legal_name === null || legal_name === void 0 ? void 0 : legal_name.en, 20) || '';
67
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
68
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
69
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_c = identification === null || identification === void 0 ? void 0 : identification.id) === null || _c === void 0 ? void 0 : _c.slice(-2)) : '';
70
+ var boardInfoId = boardInfo === null || boardInfo === void 0 ? void 0 : boardInfo.id;
71
+ var boardId = boardData === null || boardData === void 0 ? void 0 : boardData.id;
72
+ var email = (primary_contact || {}).email;
73
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, boardId, boardInfoId);
74
+ var reMapFlowData = function (flows) {
75
+ if (flows === void 0) { flows = []; }
76
+ var images = ICONS_NAMES;
77
+ var mappedFlows = flows
78
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
79
+ .map(function (_a) {
80
+ var name = _a.name, url = _a.url, status = _a.status;
81
+ var type = status === 'completed' ? 'completed' : 'pending';
82
+ var title = t("".concat(name, "_flow_").concat(type), {
83
+ individual_name: username.toLowerCase() + maskedId,
84
+ brand: brandName,
85
+ business_type: entityLegalName,
86
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
87
+ bank_name: bankName,
88
+ iban: iban ? t('masking_symbols') + iban : '',
89
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
90
+ });
91
+ var isCompleted = status === 'completed' && name !== 'password';
92
+ var isIndividual = name === 'individual';
93
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
94
+ var hoverSrc = "".concat(name, "_white_icon");
95
+ return {
96
+ name: name,
97
+ status: status,
98
+ title: title,
99
+ href: url,
100
+ src: images[src],
101
+ hoverSrc: images[hoverSrc],
102
+ isCompleted: isCompleted,
103
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
104
+ };
105
+ });
106
+ setButtons(mappedFlows);
107
+ };
108
+ useEffect(function () {
109
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
110
+ reMapFlowData(flows);
111
+ }, [flows, isAr]);
112
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
113
+ flowName: data.flowName,
114
+ email: email || '',
115
+ emailUrl: url,
116
+ brandName: shortenBrand(brandName)
117
+ } }) })] }));
118
+ };
119
+ export default memo(SuccessWithFlowButtons);
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;