@tap-payments/auth-jsconnect 2.10.8-beta → 2.10.8-development

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 (188) hide show
  1. package/build/@types/app.d.ts +9 -2
  2. package/build/@types/app.js +8 -0
  3. package/build/@types/form.d.ts +3 -0
  4. package/build/@types/index.d.ts +1 -0
  5. package/build/@types/index.js +1 -0
  6. package/build/@types/terminal.d.ts +116 -0
  7. package/build/@types/terminal.js +1 -0
  8. package/build/api/auth.d.ts +10 -1
  9. package/build/api/index.d.ts +7 -1
  10. package/build/api/index.js +3 -1
  11. package/build/api/terminal.d.ts +28 -0
  12. package/build/api/terminal.js +45 -0
  13. package/build/app/rootReducer.d.ts +1 -0
  14. package/build/app/rootReducer.js +3 -1
  15. package/build/app/settings.d.ts +1 -0
  16. package/build/app/settings.js +7 -3
  17. package/build/app/store.d.ts +2 -0
  18. package/build/assets/currencies/AEDSymbol.d.ts +7 -0
  19. package/build/assets/currencies/AEDSymbol.js +28 -0
  20. package/build/assets/currencies/SARSymbol.d.ts +7 -0
  21. package/build/assets/currencies/SARSymbol.js +28 -0
  22. package/build/assets/currencies/index.d.ts +2 -0
  23. package/build/assets/currencies/index.js +2 -0
  24. package/build/assets/currencies/utils.d.ts +4 -0
  25. package/build/assets/currencies/utils.js +6 -0
  26. package/build/assets/locales/ar.json +43 -6
  27. package/build/assets/locales/en.json +46 -9
  28. package/build/components/DeviceCard/DeviceCard.d.ts +18 -0
  29. package/build/components/DeviceCard/DeviceCard.js +103 -0
  30. package/build/components/DeviceCard/index.d.ts +3 -0
  31. package/build/components/DeviceCard/index.js +2 -0
  32. package/build/components/OTPTimer/OTPTimer.d.ts +2 -1
  33. package/build/components/OTPTimer/OTPTimer.js +4 -4
  34. package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
  35. package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
  36. package/build/components/TextWithCurrency/index.d.ts +2 -0
  37. package/build/components/TextWithCurrency/index.js +2 -0
  38. package/build/components/Tooltip/Tooltip.js +1 -1
  39. package/build/constants/api.d.ts +0 -1
  40. package/build/constants/api.js +0 -2
  41. package/build/constants/app.d.ts +15 -3
  42. package/build/constants/app.js +158 -14
  43. package/build/constants/assets.d.ts +11 -0
  44. package/build/constants/assets.js +17 -3
  45. package/build/constants/flows.d.ts +15 -0
  46. package/build/constants/flows.js +15 -0
  47. package/build/constants/validation.d.ts +1 -0
  48. package/build/constants/validation.js +1 -0
  49. package/build/features/app/auth/authStore.d.ts +24 -5
  50. package/build/features/app/auth/authStore.js +136 -71
  51. package/build/features/app/connectExpress/connectExpressStore.d.ts +14 -3
  52. package/build/features/app/connectExpress/connectExpressStore.js +193 -49
  53. package/build/features/app/individual/individualStore.js +0 -1
  54. package/build/features/app/tax/taxStore.js +1 -1
  55. package/build/features/app/terminal/terminalStore.d.ts +109 -0
  56. package/build/features/app/terminal/terminalStore.js +676 -0
  57. package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
  58. package/build/features/auth/screens/OTP/OTP.js +15 -3
  59. package/build/features/auth/screens/OTP/index.d.ts +1 -2
  60. package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
  61. package/build/features/auth/screens/Passcode/Passcode.js +82 -0
  62. package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
  63. package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
  64. package/build/features/auth/screens/Passcode/index.d.ts +2 -0
  65. package/build/features/auth/screens/Passcode/index.js +2 -0
  66. package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
  67. package/build/features/auth/screens/Passcode/validation.js +4 -0
  68. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
  69. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
  70. package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.d.ts +3 -0
  71. package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js +9 -0
  72. package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.d.ts +2 -0
  73. package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.js +2 -0
  74. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +5 -0
  75. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +49 -0
  76. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +5 -0
  77. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +88 -0
  78. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +3 -0
  79. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +2 -0
  80. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +8 -0
  81. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +4 -0
  82. package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +9 -3
  83. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
  84. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
  85. package/build/features/featuresScreens.d.ts +1 -0
  86. package/build/features/featuresScreens.js +77 -0
  87. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
  88. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
  89. package/build/features/shared/Background/LogoBackground.js +5 -17
  90. package/build/features/shared/Button/Button.js +2 -3
  91. package/build/features/shared/Button/FlowsButtons.js +1 -1
  92. package/build/features/shared/Input/Input.d.ts +1 -1
  93. package/build/features/shared/PushNotification/PushNotification.d.ts +11 -0
  94. package/build/features/shared/PushNotification/PushNotification.js +34 -0
  95. package/build/features/shared/PushNotification/index.d.ts +2 -0
  96. package/build/features/shared/PushNotification/index.js +2 -0
  97. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
  98. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -1
  99. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  100. package/build/features/terminal/Terminal.d.ts +14 -0
  101. package/build/features/terminal/Terminal.js +95 -0
  102. package/build/features/terminal/index.d.ts +1 -0
  103. package/build/features/terminal/index.js +1 -0
  104. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts +3 -0
  105. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +68 -0
  106. package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +2 -0
  107. package/build/features/terminal/screens/LinkNewTerminal/index.js +2 -0
  108. package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +10 -0
  109. package/build/features/terminal/screens/LinkNewTerminal/styles.js +28 -0
  110. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +3 -0
  111. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +51 -0
  112. package/build/features/terminal/screens/LinkedSuccess/index.d.ts +2 -0
  113. package/build/features/terminal/screens/LinkedSuccess/index.js +2 -0
  114. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +3 -0
  115. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +50 -0
  116. package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +2 -0
  117. package/build/features/terminal/screens/LinkedTerminalInfo/index.js +2 -0
  118. package/build/features/terminal/screens/Loading/Loading.d.ts +4 -0
  119. package/build/features/terminal/screens/Loading/Loading.js +10 -0
  120. package/build/features/terminal/screens/Loading/index.d.ts +2 -0
  121. package/build/features/terminal/screens/Loading/index.js +2 -0
  122. package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +3 -0
  123. package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +56 -0
  124. package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +2 -0
  125. package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +2 -0
  126. package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +36 -0
  127. package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +34 -0
  128. package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +5 -0
  129. package/build/features/terminal/screens/OperatorError/OperatorError.js +9 -0
  130. package/build/features/terminal/screens/OperatorError/index.d.ts +2 -0
  131. package/build/features/terminal/screens/OperatorError/index.js +2 -0
  132. package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +3 -0
  133. package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +21 -0
  134. package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +2 -0
  135. package/build/features/terminal/screens/ResetPasswordSuccess/index.js +2 -0
  136. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  137. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +31 -0
  138. package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  139. package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +2 -0
  140. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +9 -0
  141. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +20 -0
  142. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +3 -0
  143. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +144 -0
  144. package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +2 -0
  145. package/build/features/terminal/screens/TerminalDeviceList/index.js +2 -0
  146. package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +9 -0
  147. package/build/features/terminal/screens/TerminalDeviceList/styles.js +13 -0
  148. package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +3 -0
  149. package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +42 -0
  150. package/build/features/terminal/screens/TerminalListPage/index.d.ts +2 -0
  151. package/build/features/terminal/screens/TerminalListPage/index.js +2 -0
  152. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +3 -0
  153. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +53 -0
  154. package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +2 -0
  155. package/build/features/terminal/screens/UnlinkedSuccess/index.js +2 -0
  156. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +3 -0
  157. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +98 -0
  158. package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +2 -0
  159. package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +2 -0
  160. package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +26 -0
  161. package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +30 -0
  162. package/build/features/terminal/screens/Verify/OTPInput.d.ts +7 -0
  163. package/build/features/terminal/screens/Verify/OTPInput.js +51 -0
  164. package/build/features/terminal/screens/Verify/Verify.d.ts +5 -0
  165. package/build/features/terminal/screens/Verify/Verify.js +85 -0
  166. package/build/features/terminal/screens/Verify/index.d.ts +2 -0
  167. package/build/features/terminal/screens/Verify/index.js +2 -0
  168. package/build/features/terminal/screens/Verify/validation.d.ts +8 -0
  169. package/build/features/terminal/screens/Verify/validation.js +4 -0
  170. package/build/features/terminal/screens/shared/Header.d.ts +10 -0
  171. package/build/features/terminal/screens/shared/Header.js +30 -0
  172. package/build/features/terminal/screens/shared/TerminalList.d.ts +11 -0
  173. package/build/features/terminal/screens/shared/TerminalList.js +25 -0
  174. package/build/features/terminal/screens/shared/index.d.ts +5 -0
  175. package/build/features/terminal/screens/shared/index.js +5 -0
  176. package/build/features/terminal/screens/shared/styles.d.ts +196 -0
  177. package/build/features/terminal/screens/shared/styles.js +155 -0
  178. package/build/features/terminal/screens/shared/utils.d.ts +7 -0
  179. package/build/features/terminal/screens/shared/utils.js +24 -0
  180. package/build/hooks/useAppDispatch.d.ts +1 -0
  181. package/build/index.d.ts +3 -2
  182. package/build/index.js +4 -2
  183. package/build/theme/palette.js +12 -0
  184. package/build/theme/typography.js +4 -0
  185. package/build/utils/common.js +4 -4
  186. package/build/utils/string.d.ts +2 -2
  187. package/build/utils/string.js +4 -1
  188. package/package.json +3 -4
@@ -1,5 +1,16 @@
1
1
  import * as React from 'react';
2
- export interface OTPProps {
3
- }
2
+ export declare const PasscodeLoginStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
+ align?: "left" | "right" | "inherit" | "center" | "justify" | undefined;
4
+ children?: React.ReactNode;
5
+ classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
6
+ gutterBottom?: boolean | undefined;
7
+ noWrap?: boolean | undefined;
8
+ paragraph?: boolean | undefined;
9
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
10
+ variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
11
+ variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
12
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
13
+ ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
14
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
4
15
  declare const _default: React.MemoExoticComponent<() => JSX.Element>;
5
16
  export default _default;
@@ -14,9 +14,9 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box/Box';
17
- import { styled } from '@mui/material/styles';
17
+ import { styled, useTheme } from '@mui/material/styles';
18
18
  import Text from '../../../../components/Text';
19
- import { clearError, authSelector, verifyMobileOtp, resetOTPValue, verifyEmailOtp } from '../../../app/auth/authStore';
19
+ import { clearError, authSelector, verifyMobileOtp, resetOTPValue, verifyEmailOtp, createEmailAuth, createMobileAuth } from '../../../app/auth/authStore';
20
20
  import Button from '../../../shared/Button';
21
21
  import { ScreenContainer } from '../../../shared/Containers';
22
22
  import { useAppDispatch, useAppSelector, useLanguage, useSanitizedTranslation } from '../../../../hooks';
@@ -46,8 +46,13 @@ var FormStyled = styled(Form)(function () { return ({
46
46
  display: 'flex',
47
47
  flexDirection: 'column'
48
48
  }); });
49
+ export var PasscodeLoginStyled = styled(Text)(function (_a) {
50
+ var _b = _a.theme, spacing = _b.spacing, palette = _b.palette, typography = _b.typography;
51
+ return (__assign(__assign({}, typography.caption), { color: palette.primary.main, lineHeight: 1.75, textAlign: 'center', marginTop: spacing(5), cursor: 'pointer' }));
52
+ });
49
53
  var OTP = function () {
50
54
  var _a;
55
+ var spacing = useTheme().spacing;
51
56
  var dispatch = useAppDispatch();
52
57
  var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
53
58
  var t = useTranslation().t;
@@ -112,7 +117,14 @@ var OTP = function () {
112
117
  screen = 'AUTH_EMAIL_STEP';
113
118
  dispatch(handlePrevScreenStep(screen));
114
119
  };
120
+ var onOTPLoginClick = function () {
121
+ if (isEmailAuth)
122
+ dispatch(createEmailAuth({ email: data.emailData.email }));
123
+ else
124
+ dispatch(createMobileAuth({ mobile: data.mobileData.mobile, countryCode: data.mobileData.countryCode }));
125
+ };
115
126
  var disabled = !methods.formState.isValid;
116
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : getTitle(), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: getNumber() }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
127
+ var showLoginWithPasscode = data.passcodeData.allowOTPToPasscodeRedirection;
128
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : getTitle(), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: getNumber() }))] }) }), _jsx(OTPInput, {}), showLoginWithPasscode && _jsx(PasscodeLoginStyled, __assign({ onClick: onOTPLoginClick }, { children: st('login_with_passcode') })), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, (showLoginWithPasscode && { sx: { marginTop: spacing(2.25) } }), { children: t('next') }))] })) })) }));
117
129
  };
118
130
  export default React.memo(OTP);
@@ -1,3 +1,2 @@
1
- import OTP, { OTPProps } from './OTP';
2
- export type { OTPProps };
1
+ import OTP from './OTP';
3
2
  export default OTP;
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ export declare const OTPSignInStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
+ align?: "left" | "right" | "inherit" | "center" | "justify" | undefined;
4
+ children?: React.ReactNode;
5
+ classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
6
+ gutterBottom?: boolean | undefined;
7
+ noWrap?: boolean | undefined;
8
+ paragraph?: boolean | undefined;
9
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
10
+ variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
11
+ variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
12
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
13
+ ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
14
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
15
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
16
+ export default _default;
@@ -0,0 +1,82 @@
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/Box';
15
+ import { yupResolver } from '@hookform/resolvers/yup';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { styled, useTheme } from '@mui/material/styles';
18
+ import Form from '../../../../components/Form';
19
+ import Text from '../../../../components/Text';
20
+ import { deepCopy } from '../../../../utils';
21
+ import Button from '../../../shared/Button';
22
+ import { handlePrevScreenStep } from '../../../../app/settings';
23
+ import { ScreenContainer } from '../../../shared/Containers';
24
+ import { AuthForType } from '../../../../@types';
25
+ import { useAppDispatch, useAppSelector, useLanguage, useSanitizedTranslation } from '../../../../hooks';
26
+ import { clearError, authSelector, verifyPasscode, createEmailAuth, createMobileAuth } from '../../../app/auth/authStore';
27
+ import { validation } from './validation';
28
+ import PasscodeInput from './PasscodeInput';
29
+ var TitleContainerStyled = styled(Box)(function (_a) {
30
+ var theme = _a.theme;
31
+ return ({
32
+ background: theme.palette.common.white,
33
+ border: '1px solid',
34
+ borderColor: theme.palette.divider,
35
+ direction: theme.direction,
36
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
37
+ marginBottom: theme.spacing(5.75)
38
+ });
39
+ });
40
+ var TitleStyled = styled(Text)(function (_a) {
41
+ var theme = _a.theme;
42
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
43
+ });
44
+ var FormStyled = styled(Form)(function () { return ({
45
+ display: 'flex',
46
+ flexDirection: 'column'
47
+ }); });
48
+ export var OTPSignInStyled = styled(Text)(function (_a) {
49
+ var _b = _a.theme, spacing = _b.spacing, palette = _b.palette, typography = _b.typography;
50
+ return (__assign(__assign({}, typography.caption), { color: palette.primary.main, lineHeight: 1.75, textAlign: 'center', marginTop: spacing(11.625), cursor: 'pointer' }));
51
+ });
52
+ var Passcode = function () {
53
+ var spacing = useTheme().spacing;
54
+ var isAr = useLanguage().isAr;
55
+ var dispatch = useAppDispatch();
56
+ var st = useSanitizedTranslation();
57
+ var _a = useAppSelector(authSelector), _b = _a.data, passcodeData = _b.passcodeData, otpData = _b.otpData, emailData = _b.emailData, mobileData = _b.mobileData, loading = _a.loading, error = _a.error;
58
+ var methods = useForm({
59
+ resolver: yupResolver(validation),
60
+ defaultValues: passcodeData,
61
+ mode: 'onChange'
62
+ });
63
+ React.useEffect(function () {
64
+ if (error)
65
+ dispatch(clearError());
66
+ }, [methods.formState.isValid]);
67
+ var startWithEmail = otpData.authFor === AuthForType.EMAIL;
68
+ var onSubmit = function (formData) {
69
+ dispatch(verifyPasscode(deepCopy(formData)));
70
+ };
71
+ var onBack = function () {
72
+ dispatch(handlePrevScreenStep(startWithEmail ? 'AUTH_EMAIL_STEP' : 'AUTH_MOBILE_STEP'));
73
+ };
74
+ var onOTPLoginClick = function () {
75
+ if (startWithEmail)
76
+ dispatch(createEmailAuth({ email: emailData.email, skipPasscode: true }));
77
+ else
78
+ dispatch(createMobileAuth({ mobile: mobileData.mobile, countryCode: mobileData.countryCode, skipPasscode: true }));
79
+ };
80
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(TitleContainerStyled, { children: _jsx(TitleStyled, { children: loading ? st('ide_otp_waiting_title') : st('passcode_title') }) }), _jsx(PasscodeInput, { disableResend: true }), _jsx(OTPSignInStyled, __assign({ onClick: onOTPLoginClick }, { children: st('sign_in_with_otp') })), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, isAr: isAr, loading: loading, error: st(error || ''), sx: { marginTop: spacing(2.5) } }, { children: st('next') }))] })) })) }));
81
+ };
82
+ export default React.memo(Passcode);
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export interface PasscodeInputProps {
3
+ disableResend?: boolean;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ disableResend }: PasscodeInputProps) => JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,42 @@
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 } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box/Box';
15
+ import { styled } from '@mui/material/styles';
16
+ import { useController, useFormContext } from 'react-hook-form';
17
+ import OTPField from '../../../shared/OTP';
18
+ import { DEFAULT_TIMER_VALUE } from '../../../../constants';
19
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
20
+ import { authSelector, clearError } from '../../../app/auth/authStore';
21
+ var BoxStyled = styled(Box)(function (_a) {
22
+ var theme = _a.theme;
23
+ return ({
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ fontFamily: theme.typography.fontFamily
27
+ });
28
+ });
29
+ var PasscodeInput = function (_a) {
30
+ var disableResend = _a.disableResend;
31
+ var dispatch = useAppDispatch();
32
+ var control = useFormContext().control;
33
+ var error = useAppSelector(authSelector).error;
34
+ var _b = useController({ name: 'passcode', control: control }).field, value = _b.value, onChange = _b.onChange;
35
+ var handleOnPasscodeChange = function (passcode) {
36
+ if (error)
37
+ dispatch(clearError());
38
+ onChange(passcode);
39
+ };
40
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, __assign({}, (!disableResend && { timerInSeconds: DEFAULT_TIMER_VALUE }), { value: value, onChange: function (number) { return handleOnPasscodeChange(number.toString()); } })) })));
41
+ };
42
+ export default React.memo(PasscodeInput);
@@ -0,0 +1,2 @@
1
+ import Passcode from './Passcode';
2
+ export default Passcode;
@@ -0,0 +1,2 @@
1
+ import Passcode from './Passcode';
2
+ export default Passcode;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const validation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ passcode: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ passcode: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ passcode: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,4 @@
1
+ import * as yup from 'yup';
2
+ export var validation = yup.object().shape({
3
+ passcode: yup.string().min(6).required('passcode_required')
4
+ });
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box';
17
17
  import { styled } from '@mui/material/styles';
18
- import { getCurrencyByCountryIso2, isExist } from '../../../../utils';
18
+ import { isExist } from '../../../../utils';
19
19
  import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
20
20
  import { settingsSelector } from '../../../../app/settings';
21
21
  import SimpleList from '../../../../components/SimpleList';
@@ -29,6 +29,7 @@ import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
29
29
  import CheckIcon from '../../../shared/CheckIcon';
30
30
  import { InputLabelStyled, NameContainer } from './CustomerBase';
31
31
  import { MandatoryStyled } from './ActivitiesList';
32
+ import TextWithCurrency from '../../../../components/TextWithCurrency';
32
33
  var InputStyled = styled(InputSelect)(function (_a) {
33
34
  var theme = _a.theme;
34
35
  return ({
@@ -71,7 +72,6 @@ var ExpectedSalesRange = function (_a) {
71
72
  var brandActivities = data.brandActivities;
72
73
  var expectedSales = (brandActivities.responseBody || {}).expectedSales;
73
74
  var expectedSalesRangeValue = expectedSaleControl.field.value;
74
- var countryCode = settingsData.businessCountry;
75
75
  var handleOpenMainMenu = function (event) {
76
76
  if (readOnly)
77
77
  return;
@@ -95,9 +95,6 @@ var ExpectedSalesRange = function (_a) {
95
95
  var handleCloseSubMenu = function () {
96
96
  setSubIndex('');
97
97
  };
98
- var getCurrency = React.useMemo(function () {
99
- return t(getCurrencyByCountryIso2(countryCode.iso2));
100
- }, [countryCode.iso2]);
101
98
  React.useEffect(function () {
102
99
  if ((expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.length) > 0) {
103
100
  setExpectedSalesRangeList(expectedSales);
@@ -126,9 +123,7 @@ var ExpectedSalesRange = function (_a) {
126
123
  if (item)
127
124
  setSubIndex(item.id);
128
125
  }, [anchorEl, expectedSalesRangeValue]);
129
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('expected_sales_monthly', {
130
- currency: getCurrency
131
- }), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(InputStyled, { readOnly: readOnly, value: isAr ? (_b = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) !== null && _c !== void 0 ? _c : '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
126
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [_jsx(TextWithCurrency, { text: t('expected_sale_per_month'), countryCode: settingsData.businessCountry.iso2 }), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(InputStyled, { readOnly: readOnly, value: isAr ? (_b = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) !== null && _c !== void 0 ? _c : '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
132
127
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
133
128
  if (isOnlyOneItem)
134
129
  onSelectItem(item);
@@ -22,12 +22,13 @@ import Collapse from '../../../../components/Collapse';
22
22
  import ExpandIcon from '../../../../components/ExpandIcon';
23
23
  import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
24
24
  import { businessSelector, clearError } from '../../../app/business/businessStore';
25
- import { getCurrencyByCountryIso2, isExist } from '../../../../utils';
25
+ import { isExist } from '../../../../utils';
26
26
  import { ScreenContainer } from '../../../shared/Containers';
27
27
  import Search from '../../../shared/Search';
28
28
  import InputSelect from '../../../shared/InputSelect';
29
29
  import CheckIcon from '../../../shared/CheckIcon';
30
30
  import { InputLabelStyled, NameContainer } from './CustomerLocations';
31
+ import TextWithCurrency from '../../../../components/TextWithCurrency';
31
32
  var InputStyled = styled(InputSelect)(function (_a) {
32
33
  var theme = _a.theme;
33
34
  return ({
@@ -69,7 +70,6 @@ var ExpectedSalesRange = function (_a) {
69
70
  var activitiesData = data.activitiesData;
70
71
  var expectedSales = (activitiesData.responseBody || {}).expectedSales;
71
72
  var expectedSalesRangeValue = expectedSaleControl.field.value;
72
- var countryCode = settingsData.businessCountry;
73
73
  var handleOpenMainMenu = function (event) {
74
74
  if (readOnly)
75
75
  return;
@@ -121,12 +121,7 @@ var ExpectedSalesRange = function (_a) {
121
121
  if (item)
122
122
  setSubIndex(item.id);
123
123
  }, [anchorEl, expectedSalesRangeValue]);
124
- var getCurrency = React.useMemo(function () {
125
- return t(getCurrencyByCountryIso2(countryCode.iso2));
126
- }, [countryCode.iso2]);
127
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
128
- currency: getCurrency
129
- }) }), _jsx(InputStyled, { readOnly: readOnly, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
124
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: _jsx(TextWithCurrency, { text: t('expected_sale_per_month'), countryCode: settingsData.businessCountry.iso2 }) }), _jsx(InputStyled, { readOnly: readOnly, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
130
125
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
131
126
  if (isOnlyOneItem)
132
127
  onSelectItem(item);
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const GenericPrepareDataLoading: () => JSX.Element;
3
+ export default GenericPrepareDataLoading;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useAppSelector } from '../../../../hooks';
3
+ import DataLoading from '../../../shared/DataLoading';
4
+ import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
5
+ var GenericPrepareDataLoading = function () {
6
+ var error = useAppSelector(connectExpressSelector).error;
7
+ return _jsx(DataLoading, { error: error });
8
+ };
9
+ export default GenericPrepareDataLoading;
@@ -0,0 +1,2 @@
1
+ import GenericPrepareDataLoading from './GenericPrepareDataLoading';
2
+ export default GenericPrepareDataLoading;
@@ -0,0 +1,2 @@
1
+ import GenericPrepareDataLoading from './GenericPrepareDataLoading';
2
+ export default GenericPrepareDataLoading;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface OTPProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,49 @@
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 } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
16
+ import Box from '@mui/material/Box/Box';
17
+ import { styled } from '@mui/material/styles';
18
+ import OTPField from '../../../shared/OTP';
19
+ import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
+ import { connectExpressSelector, clearError, resendLeadMobileAuthOTP } from '../../../app/connectExpress/connectExpressStore';
21
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
+ var BoxStyled = styled(Box)(function (_a) {
23
+ var theme = _a.theme;
24
+ return ({
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ fontFamily: theme.typography.fontFamily
28
+ });
29
+ });
30
+ var OTPInput = function (_a) {
31
+ var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
32
+ var t = useTranslation().t;
33
+ var dispatch = useAppDispatch();
34
+ var otpControl = useController({ name: 'otp', control: control });
35
+ var error = useAppSelector(connectExpressSelector).error;
36
+ var handleOnOTPChange = function (otp) {
37
+ if (error)
38
+ dispatch(clearError());
39
+ otpControl.field.onChange(otp);
40
+ };
41
+ var handleOnResendOTP = function () {
42
+ if (otpControl.field.value)
43
+ setValue('otp', '', { shouldValidate: true });
44
+ dispatch(resendLeadMobileAuthOTP());
45
+ };
46
+ var otpValue = otpControl.field.value;
47
+ 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()); } }) })));
48
+ };
49
+ export default React.memo(OTPInput);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface VerifyMobileAuthOTPProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,88 @@
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 Box from '@mui/material/Box/Box';
14
+ import { styled } from '@mui/material/styles';
15
+ import * as React from 'react';
16
+ import { useTranslation } from 'react-i18next';
17
+ import Text from '../../../../components/Text';
18
+ import { clearError, connectExpressSelector, verifyAuthMobileOtpAsync, resetVerifyAuthOTPValue } from '../../../app/connectExpress/connectExpressStore';
19
+ import Button from '../../../shared/Button';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
22
+ import { handlePrevScreenStep } from '../../../../app/settings';
23
+ import { useLanguage } from '../../../../hooks';
24
+ import { useForm, FormProvider } from 'react-hook-form';
25
+ import { yupResolver } from '@hookform/resolvers/yup';
26
+ import Form from '../../../../components/Form';
27
+ import { maskPhone, deepCopy } from '../../../../utils';
28
+ import { AuthForScreen } from '../../../../@types';
29
+ import { OTPValidation } from './validation';
30
+ import OTPInput from './OTPInput';
31
+ var OTPTitleContainerStyled = styled(Box)(function (_a) {
32
+ var theme = _a.theme;
33
+ return ({
34
+ background: theme.palette.common.white,
35
+ border: '1px solid',
36
+ borderColor: theme.palette.divider,
37
+ direction: theme.direction,
38
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
39
+ marginBottom: theme.spacing(5.75)
40
+ });
41
+ });
42
+ var OTPTitleStyled = styled(Text)(function (_a) {
43
+ var theme = _a.theme;
44
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
45
+ });
46
+ var FormStyled = styled(Form)(function () { return ({
47
+ display: 'flex',
48
+ flexDirection: 'column'
49
+ }); });
50
+ var VerifyMobileAuthOTP = function () {
51
+ var _a, _b, _c, _d, _e, _f;
52
+ var dispatch = useAppDispatch();
53
+ var _g = useAppSelector(connectExpressSelector), data = _g.data, loading = _g.loading, error = _g.error;
54
+ var t = useTranslation().t;
55
+ var st = useSanitizedTranslation();
56
+ var isAr = useLanguage().isAr;
57
+ var methods = useForm({
58
+ resolver: yupResolver(OTPValidation),
59
+ defaultValues: data.verifyAuthOtpData,
60
+ mode: 'onChange'
61
+ });
62
+ React.useEffect(function () {
63
+ if (error)
64
+ dispatch(clearError());
65
+ }, [methods.formState.isValid]);
66
+ React.useEffect(function () {
67
+ return function () {
68
+ dispatch(resetVerifyAuthOTPValue());
69
+ };
70
+ }, []);
71
+ var onSubmit = function (formData) {
72
+ dispatch(verifyAuthMobileOtpAsync(deepCopy(formData)));
73
+ };
74
+ var onBack = function () {
75
+ var authFor = data.verifyAuthOtpData.authFor;
76
+ var step_name = 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP';
77
+ if (authFor === AuthForScreen.DOB)
78
+ step_name = 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP';
79
+ else if (authFor === AuthForScreen.MOBILE_OWNERSHIP)
80
+ step_name = 'COLLECT_MOBILE_OWNERSHIP';
81
+ dispatch(handlePrevScreenStep(step_name));
82
+ };
83
+ var disabled = !methods.formState.isValid;
84
+ var phone = ((_c = (_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.verifyAuthMobile) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to) ? (_f = (_e = (_d = data.responseData) === null || _d === void 0 ? void 0 : _d.verifyAuthMobile) === null || _e === void 0 ? void 0 : _e.verification_by) === null || _f === void 0 ? void 0 : _f.sent_to : '';
85
+ var title = 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 ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
87
+ };
88
+ export default React.memo(VerifyMobileAuthOTP);
@@ -0,0 +1,3 @@
1
+ import VerifyMobileAuthOTP, { VerifyMobileAuthOTPProps } from './VerifyMobileAuthOTP';
2
+ export type { VerifyMobileAuthOTPProps };
3
+ export default VerifyMobileAuthOTP;
@@ -0,0 +1,2 @@
1
+ import VerifyMobileAuthOTP from './VerifyMobileAuthOTP';
2
+ export default VerifyMobileAuthOTP;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,4 @@
1
+ import * as yup from 'yup';
2
+ export var OTPValidation = yup.object().shape({
3
+ otp: yup.string().min(6, 'otp_min_length').required('otp_required')
4
+ });
@@ -4,14 +4,16 @@ import { connectExpressSelector, verifyNafathAsync } from '../../../app/connectE
4
4
  import NafathVerification from '../../../shared/NafathVerification';
5
5
  import { handlePrevScreenStep } from '../../../../app/settings';
6
6
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
7
+ import GenericPrepareDataLoading from '../GenericPrepareDataLoading';
7
8
  var VerifyNafath = function () {
8
9
  var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
9
10
  var _b = React.useState(false), failed = _b[0], setFailed = _b[1];
10
11
  var _c = React.useState(false), isReady = _c[0], setIsReady = _c[1];
12
+ var _d = React.useState(false), showLoadingScreen = _d[0], setShowLoadingScreen = _d[1];
11
13
  var dispatch = useAppDispatch();
12
14
  var data = useAppSelector(connectExpressSelector).data;
13
15
  var authData = (data.responseData || {}).authData;
14
- var _d = authData || {}, expiry = _d.expiry, app_url_android = _d.app_url_android, app_url_ios = _d.app_url_ios, random = _d.random;
16
+ var _e = authData || {}, expiry = _e.expiry, app_url_android = _e.app_url_android, app_url_ios = _e.app_url_ios, random = _e.random;
15
17
  React.useEffect(function () {
16
18
  if (authData && !isReady) {
17
19
  setIsReady(true);
@@ -20,7 +22,11 @@ var VerifyNafath = function () {
20
22
  React.useEffect(function () {
21
23
  if (!isReady)
22
24
  return;
23
- var promise = dispatch(verifyNafathAsync({ onSuccess: function () { return setSuccess(true); }, onFailure: function () { return setFailed(true); } }));
25
+ var promise = dispatch(verifyNafathAsync({
26
+ onSuccess: function () { return setSuccess(true); },
27
+ onFailure: function () { return setFailed(true); },
28
+ showLoadingScreenAfterNafathSuccess: function () { return setShowLoadingScreen(true); }
29
+ }));
24
30
  return function () {
25
31
  promise === null || promise === void 0 ? void 0 : promise.abort();
26
32
  };
@@ -30,6 +36,6 @@ var VerifyNafath = function () {
30
36
  }, []);
31
37
  if (!isReady)
32
38
  return null;
33
- return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, failed: failed, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
39
+ return showLoadingScreen ? (_jsx(GenericPrepareDataLoading, {})) : (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, failed: failed, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
34
40
  };
35
41
  export default React.memo(VerifyNafath);
@@ -15,11 +15,12 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
17
  import { settingsSelector } from '../../../../app/settings';
18
- import { formatNumberAsCurrency, getCurrencyByCountryIso2, removeAllCharsFromNumber } from '../../../../utils';
18
+ import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
19
19
  import { ScreenContainer } from '../../../shared/Containers';
20
20
  import Input from '../../../shared/Input';
21
21
  import { clearError } from '../../../app/entity/entityStore';
22
22
  import { EndAdornment } from '../../../shared/EndAdornment';
23
+ import TextWithCurrency from '../../../../components/TextWithCurrency';
23
24
  var CapitalPaid = function (_a) {
24
25
  var _b;
25
26
  var readOnly = _a.readOnly, isVerified = _a.isVerified;
@@ -34,14 +35,9 @@ var CapitalPaid = function (_a) {
34
35
  var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
35
36
  capitalPaidControl.field.onChange(value);
36
37
  };
37
- var getCurrency = React.useMemo(function () {
38
- return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
39
- }, [settingsData.businessCountry.iso2]);
40
38
  var capitalPaidControl = useController({ control: control, name: 'capitalPaid' });
41
39
  var capitalPaidValue = capitalPaidControl.field.value;
42
40
  var error = (_b = capitalPaidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
43
- return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('capital_paid_label', {
44
- currency: getCurrency
45
- }), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
41
+ return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: _jsx(TextWithCurrency, { text: t('capital_paid_input_label'), countryCode: settingsData.businessCountry.iso2 }), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
46
42
  };
47
43
  export default React.memo(CapitalPaid);