@tap-payments/auth-jsconnect 2.0.22 → 2.0.23

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 (70) hide show
  1. package/build/@types/app.d.ts +5 -0
  2. package/build/@types/app.js +6 -0
  3. package/build/api/auth.d.ts +1 -0
  4. package/build/api/index.d.ts +4 -2
  5. package/build/api/individual.d.ts +21 -0
  6. package/build/api/individual.js +28 -1
  7. package/build/app/rootReducer.d.ts +0 -1
  8. package/build/app/rootReducer.js +0 -2
  9. package/build/app/store.d.ts +0 -2
  10. package/build/assets/locales/ar.json +10 -1
  11. package/build/assets/locales/en.json +10 -1
  12. package/build/constants/app.d.ts +0 -5
  13. package/build/constants/app.js +0 -12
  14. package/build/constants/validation.d.ts +4 -0
  15. package/build/constants/validation.js +4 -0
  16. package/build/features/app/auth/authStore.d.ts +1 -0
  17. package/build/features/app/auth/authStore.js +5 -3
  18. package/build/features/app/bank/bankStore.d.ts +8 -0
  19. package/build/features/app/bank/bankStore.js +32 -15
  20. package/build/features/app/business/businessStore.js +1 -1
  21. package/build/features/app/connect/connectStore.d.ts +4 -2
  22. package/build/features/app/connect/connectStore.js +98 -97
  23. package/build/features/app/individual/individualStore.d.ts +17 -0
  24. package/build/features/app/individual/individualStore.js +141 -66
  25. package/build/features/app/tax/taxStore.js +1 -0
  26. package/build/features/auth/Auth.d.ts +1 -1
  27. package/build/features/auth/Auth.js +4 -3
  28. package/build/features/bank/Bank.js +2 -2
  29. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -5
  30. package/build/features/business/Business.js +2 -2
  31. package/build/features/business/screens/BusinessType/BusinessType.js +13 -6
  32. package/build/features/business/screens/BusinessType/EntityName.js +4 -4
  33. package/build/features/business/screens/Customers/CustomerLocations.js +1 -1
  34. package/build/features/business/screens/Customers/ExpectedCustomers.js +1 -1
  35. package/build/features/connect/Connect.js +2 -2
  36. package/build/features/connect/screens/Individual/Individual.js +19 -16
  37. package/build/features/connect/screens/Merchant/Merchant.js +3 -2
  38. package/build/features/connect/screens/Merchant/SocialMedia.js +4 -2
  39. package/build/features/connect/screens/Merchant/validation.js +71 -59
  40. package/build/features/connect/screens/OTP/OTP.js +5 -4
  41. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  42. package/build/features/entity/Entity.js +5 -5
  43. package/build/features/featuresScreens.d.ts +0 -1
  44. package/build/features/featuresScreens.js +0 -7
  45. package/build/features/individual/Individual.js +2 -2
  46. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  47. package/build/features/individual/screens/Verify/Verify.js +4 -4
  48. package/build/features/password/Password.js +2 -2
  49. package/build/features/signIn/SignIn.js +3 -3
  50. package/build/features/tax/Tax.js +5 -5
  51. package/build/hooks/useAppDispatch.d.ts +0 -1
  52. package/build/index.d.ts +2 -3
  53. package/build/index.js +1 -4
  54. package/build/utils/object.d.ts +1 -0
  55. package/build/utils/object.js +12 -0
  56. package/package.json +1 -1
  57. package/build/features/app/otp/otpStore.d.ts +0 -28
  58. package/build/features/app/otp/otpStore.js +0 -153
  59. package/build/features/otp/OTP.d.ts +0 -7
  60. package/build/features/otp/OTP.js +0 -58
  61. package/build/features/otp/index.d.ts +0 -0
  62. package/build/features/otp/index.js +0 -1
  63. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  64. package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
  65. package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
  66. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  67. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  68. package/build/features/otp/screens/OTPVerify/index.js +0 -2
  69. package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
  70. package/build/features/otp/screens/OTPVerify/validation.js +0 -4
@@ -1,153 +0,0 @@
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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- var _a;
49
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
52
- import { handleNextScreenStep } from '../../../app/settings';
53
- import { OTP_STEP_NAMES } from '../../../constants';
54
- export var resendOTP = createAsyncThunk('otpResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var otp, payload, data;
56
- return __generator(this, function (_a) {
57
- switch (_a.label) {
58
- case 0:
59
- otp = thunkApi.getState().otp;
60
- payload = {
61
- service_name: 'tap_email',
62
- verify_token: otp.data.verify.token
63
- };
64
- return [4, API.leadService.verifyLeadToken(payload)];
65
- case 1:
66
- data = (_a.sent()).data;
67
- return [2, { data: data }];
68
- }
69
- });
70
- }); });
71
- export var verifyOtpLeadOTP = createAsyncThunk('verifyOtpLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
72
- var otp, responseBody, payload;
73
- var _a;
74
- return __generator(this, function (_b) {
75
- otp = thunkApi.getState().otp;
76
- responseBody = otp.data.verify.responseBody;
77
- payload = {
78
- data: params.otp,
79
- service_name: (_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _a === void 0 ? void 0 : _a.service_name,
80
- verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
81
- step_name: OTP_STEP_NAMES.PHONE_AUTH,
82
- encryption_contract: ['data']
83
- };
84
- thunkApi.dispatch(handleNextScreenStep());
85
- return [2, { formData: params }];
86
- });
87
- }); });
88
- var initialState = {
89
- error: null,
90
- loading: false,
91
- customLoading: false,
92
- data: {
93
- flowName: FlowsTypes.OTP,
94
- verify: {
95
- token: ''
96
- },
97
- otpData: {
98
- otp: ''
99
- }
100
- }
101
- };
102
- export var otpSlice = createSlice({
103
- name: 'otp/store',
104
- initialState: initialState,
105
- reducers: {
106
- clearError: function (state) {
107
- state.error = null;
108
- },
109
- stopLoader: function (state) {
110
- state.loading = false;
111
- },
112
- resetOTPScreen: function (state) {
113
- state.data.otpData.otp = '';
114
- }
115
- },
116
- extraReducers: function (builder) {
117
- builder
118
- .addCase(resendOTP.pending, function (state) {
119
- state.error = null;
120
- })
121
- .addCase(resendOTP.fulfilled, function (state, action) {
122
- var _a;
123
- state.error = null;
124
- var data = action.payload.data;
125
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
126
- if (description) {
127
- state.error = description;
128
- return;
129
- }
130
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
131
- })
132
- .addCase(resendOTP.rejected, function (state, action) {
133
- state.error = action.error.message;
134
- })
135
- .addCase(verifyOtpLeadOTP.pending, function (state) {
136
- state.loading = true;
137
- state.error = null;
138
- })
139
- .addCase(verifyOtpLeadOTP.fulfilled, function (state, action) {
140
- state.loading = false;
141
- state.error = null;
142
- var formData = action.payload.formData;
143
- state.data.otpData = formData;
144
- })
145
- .addCase(verifyOtpLeadOTP.rejected, function (state, action) {
146
- state.loading = false;
147
- state.error = action.error.message;
148
- });
149
- }
150
- });
151
- export var clearError = (_a = otpSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
152
- export default otpSlice.reducer;
153
- export var otpSelector = function (state) { return state.otp; };
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import { LibConfig } from '../../@types';
3
- export interface OTPLibProps extends LibConfig {
4
- }
5
- export declare function OTPLib(props: OTPLibProps): JSX.Element;
6
- export declare function renderOTPLib(config: OTPLibProps, elementId: string): void;
7
- export declare function unmountOTPLib(elementId: string): void;
@@ -1,58 +0,0 @@
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 { memo } from 'react';
14
- import { styled } from '@mui/material/styles';
15
- import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
16
- import { settingsSelector } from '../../app/settings';
17
- import { store } from '../../app/store';
18
- import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
- import Collapse from '../../components/Collapse';
20
- import { reactElement } from '../../utils';
21
- import { FeatureContainer } from '../shared/Containers';
22
- import { OTP_SCREENS_NAVIGATION } from '../../constants';
23
- import { otpSelector } from '../app/otp/otpStore';
24
- import { otpFeatureScreens } from '../featuresScreens';
25
- var Container = styled(FeatureContainer)(function (_a) {
26
- var theme = _a.theme;
27
- return ({
28
- borderRadius: theme.spacing(1.5),
29
- backgroundColor: 'inherit',
30
- color: theme.palette.text.primary,
31
- maxHeight: "calc(100% - ".concat(theme.spacing(10), ") !important"),
32
- width: theme.spacing(46.875),
33
- maxWidth: theme.spacing(46.875)
34
- });
35
- });
36
- var OTP = memo(function (props) {
37
- var theme = useAppTheme().theme;
38
- var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error;
39
- var otpError = useAppSelector(otpSelector).error;
40
- useAppConfig(__assign({ navigation: OTP_SCREENS_NAVIGATION }, props));
41
- useErrorListener(otpError || error);
42
- useStepStartedListener();
43
- var activeScreen = data.activeScreen;
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Container, { children: otpFeatureScreens.map(function (_a, index) {
45
- var Element = _a.element, name = _a.name;
46
- var isActive = activeScreen.name === name;
47
- return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
48
- }) }) })));
49
- });
50
- export function OTPLib(props) {
51
- return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(OTP, __assign({}, props)) })));
52
- }
53
- export function renderOTPLib(config, elementId) {
54
- reactElement(elementId).render(_jsx(OTPLib, __assign({}, config)));
55
- }
56
- export function unmountOTPLib(elementId) {
57
- elementId && reactElement(elementId).unmount();
58
- }
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- export interface OTPProps {
3
- loading: boolean;
4
- }
5
- declare const _default: React.MemoExoticComponent<({ loading }: OTPProps) => JSX.Element>;
6
- export default _default;
@@ -1,47 +0,0 @@
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 OTPField from '../../../shared/OTP';
17
- import { useController, useFormContext } from 'react-hook-form';
18
- import { useTranslation } from 'react-i18next';
19
- import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { useAppDispatch } from '../../../../hooks';
21
- import { resendOTP } from '../../../app/otp/otpStore';
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 loading = _a.loading;
32
- var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
33
- var t = useTranslation().t;
34
- var otpControl = useController({ name: 'otp', control: control });
35
- var dispatch = useAppDispatch();
36
- var handleOnOTPChange = function (otp) {
37
- otpControl.field.onChange(otp);
38
- };
39
- var handleOnResendOTP = function () {
40
- if (otpControl.field.value)
41
- setValue('otp', '', { shouldValidate: true });
42
- dispatch(resendOTP());
43
- };
44
- var otpValue = otpControl.field.value;
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()); } }) })));
46
- };
47
- export default React.memo(OTPInput);
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export interface OTPProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
5
- export default _default;
@@ -1,49 +0,0 @@
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 { useAppDispatch } from '../../../../hooks';
15
- import { useTranslation } from 'react-i18next';
16
- import { useForm, FormProvider } from 'react-hook-form';
17
- import { yupResolver } from '@hookform/resolvers/yup';
18
- import { styled } from '@mui/material/styles';
19
- import { useLanguage, useAppSelector } from '../../../../hooks';
20
- import Form from '../../../../components/Form';
21
- import { ScreenContainer } from '../../../shared/Containers';
22
- import { otpSelector, clearError, resetOTPScreen } from '../../../app/otp/otpStore';
23
- import { OTPValidation } from './validation';
24
- import OTPInput from './OTPInput';
25
- var FormStyled = styled(Form)(function () { return ({
26
- display: 'flex',
27
- flexDirection: 'column'
28
- }); });
29
- var Verify = function (_a) {
30
- var dispatch = useAppDispatch();
31
- var _b = useAppSelector(otpSelector), data = _b.data, loading = _b.loading, error = _b.error;
32
- var methods = useForm({
33
- resolver: yupResolver(OTPValidation),
34
- defaultValues: data.otpData,
35
- mode: 'onChange'
36
- });
37
- var t = useTranslation().t;
38
- var isAr = useLanguage().isAr;
39
- React.useEffect(function () {
40
- if (methods.formState.isValid)
41
- dispatch(clearError());
42
- return function () {
43
- dispatch(resetOTPScreen());
44
- };
45
- }, [methods.formState.isValid]);
46
- var disabled = !methods.formState.isValid || !!error;
47
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsx(FormStyled, { children: _jsx(OTPInput, { loading: false }) }) })) }));
48
- };
49
- export default React.memo(Verify);
@@ -1,2 +0,0 @@
1
- import OTP from './Verify';
2
- export default OTP;
@@ -1,2 +0,0 @@
1
- import OTP from './Verify';
2
- export default OTP;
@@ -1,8 +0,0 @@
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
- }>>>;
@@ -1,4 +0,0 @@
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
- });