@tap-payments/auth-jsconnect 1.0.91-test → 1.0.95-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 (134) hide show
  1. package/README.md +58 -52
  2. package/build/@types/app.d.ts +11 -2
  3. package/build/@types/app.js +9 -0
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/api/auth.d.ts +22 -3
  6. package/build/api/axios.d.ts +2 -0
  7. package/build/api/axios.js +64 -0
  8. package/build/api/country.d.ts +1 -2
  9. package/build/api/country.js +7 -8
  10. package/build/api/firebase.d.ts +1 -1
  11. package/build/api/firebase.js +5 -2
  12. package/build/api/index.d.ts +7 -8
  13. package/build/api/ip.d.ts +1 -1
  14. package/build/api/ip.js +5 -2
  15. package/build/api/lead.d.ts +2 -0
  16. package/build/api/operator.d.ts +1 -1
  17. package/build/api/operator.js +60 -4
  18. package/build/app/rootReducer.d.ts +0 -1
  19. package/build/app/rootReducer.js +1 -3
  20. package/build/app/settings.d.ts +9 -12
  21. package/build/app/settings.js +87 -111
  22. package/build/app/store.d.ts +0 -2
  23. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  24. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  25. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  26. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  27. package/build/components/AnimationFlow/Loader.js +1 -1
  28. package/build/constants/app.d.ts +6 -1
  29. package/build/constants/app.js +16 -12
  30. package/build/features/app/bank/bankStore.d.ts +5 -1
  31. package/build/features/app/bank/bankStore.js +41 -4
  32. package/build/features/app/business/businessStore.d.ts +5 -7
  33. package/build/features/app/business/businessStore.js +44 -46
  34. package/build/features/app/connect/connectStore.d.ts +2 -7
  35. package/build/features/app/connect/connectStore.js +23 -55
  36. package/build/features/app/individual/individualStore.d.ts +6 -7
  37. package/build/features/app/individual/individualStore.js +55 -50
  38. package/build/features/app/password/passwordStore.d.ts +34 -2
  39. package/build/features/app/password/passwordStore.js +218 -8
  40. package/build/features/app/tax/taxStore.d.ts +5 -1
  41. package/build/features/app/tax/taxStore.js +43 -6
  42. package/build/features/bank/Bank.js +8 -7
  43. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  44. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  45. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  46. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  47. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  48. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  49. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  50. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  51. package/build/features/bank/screens/Verify/Verify.js +3 -2
  52. package/build/features/business/Business.js +9 -11
  53. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  54. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  55. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  56. package/build/features/business/screens/Verify/Verify.js +3 -2
  57. package/build/features/connect/Connect.js +7 -9
  58. package/build/features/connect/screens/Merchant/BrandName.js +3 -2
  59. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  60. package/build/features/featuresScreens.d.ts +0 -1
  61. package/build/features/featuresScreens.js +5 -7
  62. package/build/features/individual/Individual.js +9 -11
  63. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
  64. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  65. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  66. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  67. package/build/features/individual/screens/Verify/Verify.js +3 -2
  68. package/build/features/password/Password.js +16 -9
  69. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  70. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  71. package/build/features/password/screens/OTP/OTP.js +78 -0
  72. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  73. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  74. package/build/features/password/screens/OTP/index.d.ts +3 -0
  75. package/build/features/password/screens/OTP/index.js +2 -0
  76. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  77. package/build/features/password/screens/OTP/validation.js +4 -0
  78. package/build/features/password/screens/Success/Success.js +8 -2
  79. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  80. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  81. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  82. package/build/features/password/screens/Verify/Verify.js +3 -2
  83. package/build/features/shared/Background/Background.js +3 -2
  84. package/build/features/shared/Background/LogoBackground.d.ts +1 -4
  85. package/build/features/shared/Background/LogoBackground.js +4 -32
  86. package/build/features/shared/Button/AbsherButton.js +3 -8
  87. package/build/features/shared/Button/EmailProvidersButtons.js +2 -1
  88. package/build/features/shared/Button/FlowsButtons.d.ts +10 -1
  89. package/build/features/shared/Button/FlowsButtons.js +100 -7
  90. package/build/features/shared/Button/MobileButton.js +3 -8
  91. package/build/features/shared/Button/SuccessButton.js +17 -13
  92. package/build/features/shared/Footer/Footer.js +2 -3
  93. package/build/features/shared/OTP/OTP.d.ts +2 -1
  94. package/build/features/shared/OTP/OTP.js +10 -2
  95. package/build/features/tax/Tax.js +7 -6
  96. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  97. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  98. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  99. package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -2
  100. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  101. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  102. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  103. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  104. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  105. package/build/features/tax/screens/Verify/Verify.js +3 -2
  106. package/build/hooks/index.d.ts +1 -0
  107. package/build/hooks/index.js +1 -0
  108. package/build/hooks/useAppConfig.d.ts +1 -4
  109. package/build/hooks/useAppConfig.js +13 -110
  110. package/build/hooks/useAppDispatch.d.ts +0 -1
  111. package/build/hooks/useAppTheme.js +3 -2
  112. package/build/hooks/useErrorListener.d.ts +1 -1
  113. package/build/hooks/useErrorListener.js +4 -6
  114. package/build/hooks/useStepStartedListener.d.ts +1 -0
  115. package/build/hooks/useStepStartedListener.js +10 -0
  116. package/build/index.d.ts +2 -3
  117. package/build/index.js +2 -5
  118. package/build/theme/theme.d.ts +1 -1
  119. package/build/theme/theme.js +1 -2
  120. package/build/utils/array.d.ts +3 -0
  121. package/build/utils/array.js +10 -0
  122. package/build/utils/string.d.ts +2 -0
  123. package/build/utils/string.js +23 -0
  124. package/package.json +127 -127
  125. package/build/features/Landing/Landing.d.ts +0 -7
  126. package/build/features/Landing/Landing.js +0 -55
  127. package/build/features/Landing/index.d.ts +0 -1
  128. package/build/features/Landing/index.js +0 -1
  129. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  130. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  131. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  132. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  133. package/build/features/app/landing/landingStore.d.ts +0 -22
  134. package/build/features/app/landing/landingStore.js +0 -103
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export interface OTPProps {
3
+ loading: boolean;
4
+ setLoading: (flag: boolean) => void;
3
5
  }
4
- declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
6
+ declare const _default: React.MemoExoticComponent<({ loading, setLoading }: OTPProps) => JSX.Element>;
5
7
  export default _default;
@@ -17,6 +17,8 @@ import OTPField from '../../../shared/OTP';
17
17
  import { useController, useFormContext } from 'react-hook-form';
18
18
  import { useTranslation } from 'react-i18next';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
+ import { useAppDispatch } from '../../../../hooks';
21
+ import { resendOTP } from '../../../app/bank/bankStore';
20
22
  var BoxStyled = styled(Box)(function (_a) {
21
23
  var theme = _a.theme;
22
24
  return ({
@@ -26,17 +28,20 @@ var BoxStyled = styled(Box)(function (_a) {
26
28
  });
27
29
  });
28
30
  var OTPInput = function (_a) {
31
+ var loading = _a.loading, setLoading = _a.setLoading;
29
32
  var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
30
33
  var t = useTranslation().t;
31
34
  var otpControl = useController({ name: 'otp', control: control });
35
+ var dispatch = useAppDispatch();
32
36
  var handleOnOTPChange = function (otp) {
33
37
  otpControl.field.onChange(otp);
34
38
  };
35
39
  var handleOnResendOTP = function () {
36
40
  if (otpControl.field.value)
37
41
  setValue('otp', '', { shouldValidate: true });
42
+ dispatch(resendOTP());
38
43
  };
39
44
  var otpValue = otpControl.field.value;
40
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
45
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
41
46
  };
42
47
  export default React.memo(OTPInput);
@@ -57,6 +57,7 @@ var VerifyNumber = function (_a) {
57
57
  });
58
58
  var t = useTranslation().t;
59
59
  var isAr = useLanguage().isAr;
60
+ var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
60
61
  React.useEffect(function () {
61
62
  if (error)
62
63
  dispatch(clearError());
@@ -71,7 +72,7 @@ var VerifyNumber = function (_a) {
71
72
  dispatch(handlePrevScreenStep());
72
73
  };
73
74
  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;
74
- var disabled = !methods.formState.isValid || !!error || !phone;
75
- 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, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
75
+ var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
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, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
76
77
  };
77
78
  export default React.memo(VerifyNumber);
@@ -11,10 +11,10 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
15
15
  import { handleLanguage, settingsSelector } from '../../app/settings';
16
16
  import { FeatureContainer } from '../shared/Containers';
17
- import { businessSelector, getCountries, verifyLeadToken } from '../app/business/businessStore';
17
+ import { businessSelector, verifyLeadToken } from '../app/business/businessStore';
18
18
  import AnimationFlow from '../../components/AnimationFlow';
19
19
  import { store } from '../../app/store';
20
20
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
@@ -28,9 +28,10 @@ var Business = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var customLoading = useAppSelector(businessSelector).customLoading;
32
- var loading = useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props)).loading;
33
- useErrorListener();
31
+ var _b = useAppSelector(businessSelector), customLoading = _b.customLoading, businessError = _b.error;
32
+ useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props));
33
+ useErrorListener(businessError || error);
34
+ useStepStartedListener();
34
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
36
  var verifyToken = function () {
36
37
  var token = getParameterByName('token');
@@ -43,13 +44,10 @@ var Business = memo(function (props) {
43
44
  dispatch(verifyLeadToken(token));
44
45
  };
45
46
  useEffect(function () {
46
- if (!loading)
47
+ if (!settingLoading)
47
48
  verifyToken();
48
- }, [loading]);
49
- useEffect(function () {
50
- dispatch(getCountries());
51
- }, []);
52
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
49
+ }, [settingLoading]);
50
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
53
51
  var Element = _a.element, name = _a.name;
54
52
  var isActive = activeScreen.name === name;
55
53
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -14,14 +14,15 @@ import React, { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES } from '../../../../constants';
18
- import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
19
  import { businessSelector } from '../../../app/business/businessStore';
20
- import { allAreTruthy, showLastFour } from '../../../../utils';
20
+ import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
24
  import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
+ import { settingsSelector } from '../../../../app/settings';
25
26
  var TitleStyled = styled(Text)(function (_a) {
26
27
  var _b;
27
28
  var theme = _a.theme;
@@ -46,7 +47,6 @@ var SuccessWithFlowButtons = function () {
46
47
  var _a, _b, _c;
47
48
  var t = useTranslation().t;
48
49
  var isAr = useLanguage().isAr;
49
- var dispatch = useAppDispatch();
50
50
  var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
51
51
  var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
52
52
  var data = useAppSelector(businessSelector).data;
@@ -58,6 +58,10 @@ var SuccessWithFlowButtons = function () {
58
58
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
59
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
60
60
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
61
+ var settings = useAppSelector(settingsSelector);
62
+ var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
63
+ var email = (contact || { email: '' }).email;
64
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
61
65
  var reMapFlowData = function (flows) {
62
66
  if (flows === void 0) { flows = []; }
63
67
  var images = ICONS_NAMES;
@@ -79,6 +83,8 @@ var SuccessWithFlowButtons = function () {
79
83
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
80
84
  var hoverSrc = "".concat(name, "_white_icon");
81
85
  return {
86
+ name: name,
87
+ status: status,
82
88
  title: title,
83
89
  href: url,
84
90
  src: images[src],
@@ -96,6 +102,10 @@ var SuccessWithFlowButtons = function () {
96
102
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
97
103
  reMapFlowData(flows);
98
104
  }, [flows, isAr]);
99
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
105
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
106
+ flowName: data.flowName,
107
+ email: email,
108
+ emailUrl: url
109
+ } }) })] }));
100
110
  };
101
111
  export default memo(SuccessWithFlowButtons);
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export interface OTPProps {
3
+ loading: boolean;
4
+ setLoading: (flag: boolean) => void;
3
5
  }
4
- declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
6
+ declare const _default: React.MemoExoticComponent<({ loading, setLoading }: OTPProps) => JSX.Element>;
5
7
  export default _default;
@@ -11,12 +11,14 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
+ import { useAppDispatch } from '../../../../hooks';
14
15
  import Box from '@mui/material/Box/Box';
15
16
  import { styled } from '@mui/material/styles';
16
17
  import OTPField from '../../../shared/OTP';
17
18
  import { useController, useFormContext } from 'react-hook-form';
18
19
  import { useTranslation } from 'react-i18next';
19
20
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
21
+ import { resendOTP } from '../../../app/business/businessStore';
20
22
  var BoxStyled = styled(Box)(function (_a) {
21
23
  var theme = _a.theme;
22
24
  return ({
@@ -26,17 +28,20 @@ var BoxStyled = styled(Box)(function (_a) {
26
28
  });
27
29
  });
28
30
  var OTPInput = function (_a) {
31
+ var loading = _a.loading, setLoading = _a.setLoading;
29
32
  var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
30
33
  var t = useTranslation().t;
31
34
  var otpControl = useController({ name: 'otp', control: control });
35
+ var dispatch = useAppDispatch();
32
36
  var handleOnOTPChange = function (otp) {
33
37
  otpControl.field.onChange(otp);
34
38
  };
35
39
  var handleOnResendOTP = function () {
36
40
  if (otpControl.field.value)
37
41
  setValue('otp', '', { shouldValidate: true });
42
+ dispatch(resendOTP());
38
43
  };
39
44
  var otpValue = otpControl.field.value;
40
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
45
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
41
46
  };
42
47
  export default React.memo(OTPInput);
@@ -57,6 +57,7 @@ var VerifyNumber = function (_a) {
57
57
  });
58
58
  var t = useTranslation().t;
59
59
  var isAr = useLanguage().isAr;
60
+ var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
60
61
  React.useEffect(function () {
61
62
  if (error && methods.formState.isValid)
62
63
  dispatch(clearError());
@@ -71,7 +72,7 @@ var VerifyNumber = function (_a) {
71
72
  dispatch(handlePrevScreenStep());
72
73
  };
73
74
  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;
74
- var disabled = !methods.formState.isValid || !!error || !phone;
75
- 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, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
75
+ var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
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, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
76
77
  };
77
78
  export default React.memo(VerifyNumber);
@@ -10,13 +10,13 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect } from 'react';
13
+ import { memo } from 'react';
14
14
  import { FeatureContainer } from '../shared/Containers';
15
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
15
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
16
16
  import { settingsSelector } from '../../app/settings';
17
17
  import AnimationFlow from '../../components/AnimationFlow';
18
18
  import { store } from '../../app/store';
19
- import { getCountries } from '../app/connect/connectStore';
19
+ import { connectSelector } from '../app/connect/connectStore';
20
20
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
21
21
  import Collapse from '../../components/Collapse';
22
22
  import { reactElement } from '../../utils';
@@ -26,15 +26,13 @@ import CustomFooter from '../shared/Footer';
26
26
  import Background from '../shared/Background';
27
27
  var Connect = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
- var dispatch = useAppDispatch();
30
29
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
30
+ var connectError = useAppSelector(connectSelector).error;
31
31
  useAppConfig(__assign({ navigation: CONNECT_SCREENS_NAVIGATION }, props));
32
- useErrorListener();
32
+ useErrorListener(connectError || error);
33
+ useStepStartedListener();
33
34
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
34
- useEffect(function () {
35
- dispatch(getCountries());
36
- }, []);
37
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
35
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
38
36
  var Element = _a.element, name = _a.name;
39
37
  var isActive = activeScreen.name === name;
40
38
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -63,9 +63,10 @@ import Tooltip from '../../../../components/Tooltip';
63
63
  import Collapse from '../../../../components/Collapse';
64
64
  import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
65
65
  import CheckIcon from '../../../shared/CheckIcon';
66
- import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
66
+ import { checkBrandNameAvailability } from '../../../app/connect/connectStore';
67
67
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
68
68
  import { debounce } from 'lodash-es';
69
+ import { settingsSelector } from '../../../../app/settings';
69
70
  var LabelContainerStyled = styled(Box)(function (_a) {
70
71
  var theme = _a.theme;
71
72
  return ({
@@ -107,7 +108,7 @@ var BrandName = function (_a) {
107
108
  var brandControl = useController({ control: control, name: 'brandName' });
108
109
  var brandNameValue = brandControl.field.value;
109
110
  var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
110
- var data = useAppSelector(connectSelector).data;
111
+ var data = useAppSelector(settingsSelector).data;
111
112
  var checkBrand = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
112
113
  var onSuccess;
113
114
  return __generator(this, function (_a) {
@@ -107,6 +107,6 @@ var Mobile = function (_a) {
107
107
  var disabled = !methods.formState.isValid || !!error;
108
108
  var title = t('join_our_community');
109
109
  var subTitle = t('ide_terms_and_conditions_description');
110
- return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] })) }))] }));
110
+ return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] })) }))] }));
111
111
  };
112
112
  export default React.memo(Mobile);
@@ -5,4 +5,3 @@ export declare const passwordFeatureScreens: Array<FeatureScreenStep>;
5
5
  export declare const individualFeatureScreens: Array<FeatureScreenStep>;
6
6
  export declare const bankFeatureScreens: Array<FeatureScreenStep>;
7
7
  export declare const taxFeatureScreens: Array<FeatureScreenStep>;
8
- export declare const landingFeatureScreens: Array<FeatureScreenStep>;
@@ -14,6 +14,7 @@ import SuccessPage from './business/screens/Success';
14
14
  import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButtons';
15
15
  import PasswordVerifyPage from './password/screens/Verify';
16
16
  import CreatePasswordPage from './password/screens/CreatePassword';
17
+ import PasswordOTPPage from './password/screens/OTP';
17
18
  import SuccessPasswordPage from './password/screens/Success';
18
19
  import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
19
20
  import IndividualVerifyPage from './individual/screens/Verify';
@@ -28,7 +29,6 @@ import TaxVerifyPage from './tax/screens/Verify';
28
29
  import TaxDetailsPage from './tax/screens/TaxDetails';
29
30
  import TaxSuccessPage from './tax/screens/Success';
30
31
  import TaxSuccessWithFlowPage from './tax/screens/SuccessWithFlowButtons';
31
- import VerifyAndRedirectPage from './Landing/screens/VerifyAndRedirect';
32
32
  export var connectFeatureScreens = [
33
33
  {
34
34
  name: 'CONNECT_NID_STEP',
@@ -92,6 +92,10 @@ export var passwordFeatureScreens = [
92
92
  name: 'PASSWORD_CREATE_PASSWORD_STEP',
93
93
  element: CreatePasswordPage
94
94
  },
95
+ {
96
+ name: 'PASSWORD_RESET_PASSWORD_OTP_STEP',
97
+ element: PasswordOTPPage
98
+ },
95
99
  {
96
100
  name: 'PASSWORD_SUCCESS_STEP',
97
101
  element: SuccessPasswordPage
@@ -155,9 +159,3 @@ export var taxFeatureScreens = [
155
159
  element: TaxSuccessWithFlowPage
156
160
  }
157
161
  ];
158
- export var landingFeatureScreens = [
159
- {
160
- name: 'LANDING_VERIFY_AND_REDIRECT_STEP',
161
- element: VerifyAndRedirectPage
162
- }
163
- ];
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
15
15
  import { handleLanguage, settingsSelector } from '../../app/settings';
16
16
  import AnimationFlow from '../../components/AnimationFlow';
17
17
  import { store } from '../../app/store';
@@ -21,16 +21,17 @@ import { getParameterByName, reactElement } from '../../utils';
21
21
  import { FeatureContainer } from '../shared/Containers';
22
22
  import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { individualFeatureScreens } from '../featuresScreens';
24
- import { getCountries, individualSelector, verifyLeadToken } from '../app/individual/individualStore';
24
+ import { individualSelector, verifyLeadToken } from '../app/individual/individualStore';
25
25
  import CustomFooter from '../shared/Footer';
26
26
  import Background from '../shared/Background';
27
27
  var Individual = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var customLoading = useAppSelector(individualSelector).customLoading;
32
- var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
33
- useErrorListener();
31
+ var _b = useAppSelector(individualSelector), customLoading = _b.customLoading, individualError = _b.error;
32
+ useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props));
33
+ useErrorListener(individualError || error);
34
+ useStepStartedListener();
34
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
36
  var verifyToken = function () {
36
37
  var token = getParameterByName('token');
@@ -43,13 +44,10 @@ var Individual = memo(function (props) {
43
44
  dispatch(verifyLeadToken(token));
44
45
  };
45
46
  useEffect(function () {
46
- if (!loading)
47
+ if (!settingLoading)
47
48
  verifyToken();
48
- }, [loading]);
49
- useEffect(function () {
50
- dispatch(getCountries());
51
- }, []);
52
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
49
+ }, [settingLoading]);
50
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
53
51
  var Element = _a.element, name = _a.name;
54
52
  var isActive = activeScreen.name === name;
55
53
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box';
17
17
  import { useTranslation } from 'react-i18next';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
- import { handleCurrentActiveScreen } from '../../../../app/settings';
19
+ import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import Button from '../../../shared/Button';
@@ -41,6 +41,8 @@ var AdditionalIndividualInfo = function (_a) {
41
41
  var isAr = useLanguage().isAr;
42
42
  var dispatch = useAppDispatch();
43
43
  var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
44
+ var settingsData = useAppSelector(settingsSelector).data;
45
+ var countries = settingsData.countries;
44
46
  var methods = useForm({
45
47
  resolver: yupResolver(IndividualInfoValidationSchema),
46
48
  defaultValues: data.individualData,
@@ -73,7 +75,7 @@ var AdditionalIndividualInfo = function (_a) {
73
75
  var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
74
76
  var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
75
77
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
76
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive, countries: data.countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
78
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
77
79
  };
78
80
  export default React.memo(AdditionalIndividualInfo);
79
81
  AdditionalIndividualInfo.defaultProps = {};
@@ -14,14 +14,15 @@ import React, { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES } from '../../../../constants';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { allAreTruthy, showLastFour } from '../../../../utils';
19
+ import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
20
20
  import { individualSelector } from '../../../app/individual/individualStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
24
  import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
+ import { settingsSelector } from '../../../../app/settings';
25
26
  var TitleStyled = styled(Text)(function (_a) {
26
27
  var _b;
27
28
  var theme = _a.theme;
@@ -57,10 +58,13 @@ var SuccessWithFlowButtons = function () {
57
58
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
58
59
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
60
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
61
+ var settings = useAppSelector(settingsSelector);
62
+ var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
63
+ var email = (contact || { email: '' }).email;
64
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
60
65
  var reMapFlowData = function (flows) {
61
66
  if (flows === void 0) { flows = []; }
62
67
  var images = ICONS_NAMES;
63
- var statuses = [];
64
68
  var mappedFlows = flows.map(function (_a) {
65
69
  var name = _a.name, url = _a.url, status = _a.status;
66
70
  var type = status === 'initiated' ? 'pending' : 'completed';
@@ -79,6 +83,8 @@ var SuccessWithFlowButtons = function () {
79
83
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
80
84
  var hoverSrc = "".concat(name, "_white_icon");
81
85
  return {
86
+ name: name,
87
+ status: status,
82
88
  title: title,
83
89
  href: url,
84
90
  src: images[src],
@@ -96,6 +102,10 @@ var SuccessWithFlowButtons = function () {
96
102
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
97
103
  reMapFlowData(flows);
98
104
  }, [flows, isAr]);
99
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
105
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
106
+ flowName: data.flowName,
107
+ email: email,
108
+ emailUrl: url
109
+ } }) })] }));
100
110
  };
101
111
  export default memo(SuccessWithFlowButtons);
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export interface OTPProps {
3
+ loading: boolean;
4
+ setLoading: (flag: boolean) => void;
3
5
  }
4
- declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
6
+ declare const _default: React.MemoExoticComponent<({ loading, setLoading }: OTPProps) => JSX.Element>;
5
7
  export default _default;
@@ -11,12 +11,14 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
+ import { useAppDispatch } from '../../../../hooks';
14
15
  import Box from '@mui/material/Box/Box';
15
16
  import { styled } from '@mui/material/styles';
16
17
  import OTPField from '../../../shared/OTP';
17
18
  import { useController, useFormContext } from 'react-hook-form';
18
19
  import { useTranslation } from 'react-i18next';
19
20
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
21
+ import { resendOTP } from '../../../app/individual/individualStore';
20
22
  var BoxStyled = styled(Box)(function (_a) {
21
23
  var theme = _a.theme;
22
24
  return ({
@@ -26,17 +28,20 @@ var BoxStyled = styled(Box)(function (_a) {
26
28
  });
27
29
  });
28
30
  var OTPInput = function (_a) {
31
+ var loading = _a.loading, setLoading = _a.setLoading;
29
32
  var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
30
33
  var t = useTranslation().t;
31
34
  var otpControl = useController({ name: 'otp', control: control });
35
+ var dispatch = useAppDispatch();
32
36
  var handleOnOTPChange = function (otp) {
33
37
  otpControl.field.onChange(otp);
34
38
  };
35
39
  var handleOnResendOTP = function () {
36
40
  if (otpControl.field.value)
37
41
  setValue('otp', '', { shouldValidate: true });
42
+ dispatch(resendOTP());
38
43
  };
39
44
  var otpValue = otpControl.field.value;
40
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
45
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
41
46
  };
42
47
  export default React.memo(OTPInput);
@@ -57,6 +57,7 @@ var VerifyNumber = function (_a) {
57
57
  });
58
58
  var t = useTranslation().t;
59
59
  var isAr = useLanguage().isAr;
60
+ var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
60
61
  React.useEffect(function () {
61
62
  if (error)
62
63
  dispatch(clearError());
@@ -71,7 +72,7 @@ var VerifyNumber = function (_a) {
71
72
  dispatch(handlePrevScreenStep());
72
73
  };
73
74
  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;
74
- var disabled = !methods.formState.isValid || !!error || !phone;
75
- 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, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
75
+ var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
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, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
76
77
  };
77
78
  export default React.memo(VerifyNumber);
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
15
15
  import { handleLanguage, settingsSelector } from '../../app/settings';
16
16
  import AnimationFlow from '../../components/AnimationFlow';
17
17
  import { store } from '../../app/store';
@@ -19,34 +19,41 @@ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
19
  import Collapse from '../../components/Collapse';
20
20
  import { FeatureContainer } from '../shared/Containers';
21
21
  import { getParameterByName, reactElement } from '../../utils';
22
- import { PASSWORD_SCREENS_NAVIGATION } from '../../constants';
22
+ import { PASSWORD_OPERATION_TYPE, PASSWORD_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { passwordFeatureScreens } from '../featuresScreens';
24
- import { passwordSelector, verifyLeadToken } from '../app/password/passwordStore';
24
+ import { passwordSelector, verifyLeadToken, verifyOperationToken } from '../app/password/passwordStore';
25
25
  import CustomFooter from '../shared/Footer';
26
26
  import Background from '../shared/Background';
27
27
  var Password = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var customLoading = useAppSelector(passwordSelector).customLoading;
32
- var loading = useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props)).loading;
33
- useErrorListener();
31
+ var _b = useAppSelector(passwordSelector), customLoading = _b.customLoading, passwordError = _b.error;
32
+ useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props));
33
+ useErrorListener(passwordError || error);
34
+ useStepStartedListener();
34
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
36
  var verifyToken = function () {
36
37
  var token = getParameterByName('token');
37
38
  var lang = getParameterByName('lang');
39
+ var operationType = getParameterByName('operation_type');
40
+ var leadId = getParameterByName('lead_id') || '';
38
41
  if (!token)
39
42
  throw new Error('Auth token is not found!');
40
43
  if (!lang)
41
44
  throw new Error('Language is not found!');
42
45
  dispatch(handleLanguage(lang));
46
+ if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
47
+ dispatch(verifyOperationToken({ token: token, leadId: leadId }));
48
+ return;
49
+ }
43
50
  dispatch(verifyLeadToken(token));
44
51
  };
45
52
  useEffect(function () {
46
- if (!loading)
53
+ if (!settingLoading)
47
54
  verifyToken();
48
- }, [loading]);
49
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
55
+ }, [settingLoading]);
56
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
50
57
  var Element = _a.element, name = _a.name;
51
58
  var isActive = activeScreen.name === name;
52
59
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));