@tap-payments/auth-jsconnect 2.0.8 → 2.0.9

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 (72) hide show
  1. package/build/@types/form.d.ts +3 -0
  2. package/build/@types/redux.d.ts +0 -1
  3. package/build/api/entity.d.ts +1 -0
  4. package/build/api/entity.js +8 -1
  5. package/build/api/index.d.ts +1 -0
  6. package/build/app/rootReducer.d.ts +1 -0
  7. package/build/app/rootReducer.js +3 -1
  8. package/build/app/store.d.ts +2 -0
  9. package/build/assets/locales/ar.json +2 -1
  10. package/build/assets/locales/en.json +2 -1
  11. package/build/components/FileInput/DragAndDrop.js +1 -1
  12. package/build/constants/app.d.ts +9 -0
  13. package/build/constants/app.js +34 -0
  14. package/build/constants/validation.d.ts +1 -0
  15. package/build/constants/validation.js +1 -0
  16. package/build/features/app/bank/bankStore.d.ts +1 -0
  17. package/build/features/app/business/businessStore.d.ts +5 -3
  18. package/build/features/app/business/businessStore.js +34 -21
  19. package/build/features/app/connect/connectStore.d.ts +2 -1
  20. package/build/features/app/connect/connectStore.js +69 -38
  21. package/build/features/app/individual/individualStore.d.ts +1 -0
  22. package/build/features/app/individual/individualStore.js +1 -1
  23. package/build/features/app/password/passwordStore.d.ts +1 -0
  24. package/build/features/app/signIn/signInStore.d.ts +33 -0
  25. package/build/features/app/signIn/signInStore.js +389 -0
  26. package/build/features/app/tax/taxStore.d.ts +1 -0
  27. package/build/features/connect/screens/Merchant/validation.js +1 -1
  28. package/build/features/featuresScreens.d.ts +1 -0
  29. package/build/features/featuresScreens.js +22 -0
  30. package/build/features/shared/UploadFile/UploadFile.js +8 -7
  31. package/build/features/signIn/SignIn.d.ts +7 -0
  32. package/build/features/signIn/SignIn.js +49 -0
  33. package/build/features/signIn/index.d.ts +1 -0
  34. package/build/features/signIn/index.js +1 -0
  35. package/build/features/signIn/screens/Email/Email.d.ts +5 -0
  36. package/build/features/signIn/screens/Email/Email.js +95 -0
  37. package/build/features/signIn/screens/Email/EmailField.d.ts +5 -0
  38. package/build/features/signIn/screens/Email/EmailField.js +55 -0
  39. package/build/features/signIn/screens/Email/index.d.ts +3 -0
  40. package/build/features/signIn/screens/Email/index.js +2 -0
  41. package/build/features/signIn/screens/Email/validation.d.ts +8 -0
  42. package/build/features/signIn/screens/Email/validation.js +5 -0
  43. package/build/features/signIn/screens/Mobile/Mobile.d.ts +5 -0
  44. package/build/features/signIn/screens/Mobile/Mobile.js +106 -0
  45. package/build/features/signIn/screens/Mobile/MobileNumber.d.ts +11 -0
  46. package/build/features/signIn/screens/Mobile/MobileNumber.js +151 -0
  47. package/build/features/signIn/screens/Mobile/index.d.ts +3 -0
  48. package/build/features/signIn/screens/Mobile/index.js +2 -0
  49. package/build/features/signIn/screens/Mobile/validation.d.ts +8 -0
  50. package/build/features/signIn/screens/Mobile/validation.js +28 -0
  51. package/build/features/signIn/screens/OTP/OTP.d.ts +5 -0
  52. package/build/features/signIn/screens/OTP/OTP.js +80 -0
  53. package/build/features/signIn/screens/OTP/OTPInput.d.ts +5 -0
  54. package/build/features/signIn/screens/OTP/OTPInput.js +53 -0
  55. package/build/features/signIn/screens/OTP/index.d.ts +3 -0
  56. package/build/features/signIn/screens/OTP/index.js +2 -0
  57. package/build/features/signIn/screens/OTP/validation.d.ts +8 -0
  58. package/build/features/signIn/screens/OTP/validation.js +4 -0
  59. package/build/features/signIn/screens/Password/Password.d.ts +5 -0
  60. package/build/features/signIn/screens/Password/Password.js +54 -0
  61. package/build/features/signIn/screens/Password/PasswordInput.d.ts +5 -0
  62. package/build/features/signIn/screens/Password/PasswordInput.js +28 -0
  63. package/build/features/signIn/screens/Password/index.d.ts +3 -0
  64. package/build/features/signIn/screens/Password/index.js +2 -0
  65. package/build/features/signIn/screens/Password/validation.d.ts +8 -0
  66. package/build/features/signIn/screens/Password/validation.js +4 -0
  67. package/build/hooks/useAppDispatch.d.ts +1 -0
  68. package/build/index.d.ts +3 -2
  69. package/build/index.js +5 -2
  70. package/build/utils/string.d.ts +1 -0
  71. package/build/utils/string.js +4 -0
  72. package/package.json +128 -128
@@ -0,0 +1,33 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { MobileFormValues, SharedState, EmailFormValues, ResponseData, OTPFormValues, PasswordFormValues } from '../../../@types';
3
+ export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
4
+ data: any;
5
+ formData: MobileFormValues;
6
+ }, MobileFormValues, {}>;
7
+ export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
8
+ export declare const createEmailAuth: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ formData: EmailFormValues;
11
+ }, EmailFormValues, {}>;
12
+ export declare const resendOTPEmail: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
13
+ export declare const verifyAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
14
+ data: any;
15
+ formData: OTPFormValues;
16
+ }, OTPFormValues, {}>;
17
+ export declare const verifyAuthPassword: import("@reduxjs/toolkit").AsyncThunk<any, PasswordFormValues, {}>;
18
+ export interface SignInData {
19
+ auth: Partial<MobileFormValues & EmailFormValues> & ResponseData;
20
+ otpData: OTPFormValues & ResponseData;
21
+ passwordData: PasswordFormValues & ResponseData;
22
+ }
23
+ export interface SignInState extends SharedState<SignInData> {
24
+ }
25
+ export declare const signInSlice: import("@reduxjs/toolkit").Slice<SignInState, {
26
+ clearError: (state: SignInState) => void;
27
+ stopLoader: (state: SignInState) => void;
28
+ resetOTPScreen: (state: SignInState) => void;
29
+ }, "signIsn/store">;
30
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
31
+ declare const _default: import("redux").Reducer<SignInState, import("redux").AnyAction>;
32
+ export default _default;
33
+ export declare const signInSelector: (state: RootState) => SignInState;
@@ -0,0 +1,389 @@
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 { defaultCountry, SignIn_STEP_NAMES } from '../../../constants';
52
+ import { handleNextScreenStep, handleOpen } from '../../../app/settings';
53
+ var redirection = function (type) {
54
+ if (type === 1)
55
+ return handleNextScreenStep('SIGIN_PASSWORD_STEP');
56
+ return handleNextScreenStep('SIGIN_OTP_STEP');
57
+ };
58
+ export var createMobileAuth = createAsyncThunk('signIn/createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
59
+ var settings, requestBody, data;
60
+ var _a, _b, _c, _d;
61
+ return __generator(this, function (_e) {
62
+ switch (_e.label) {
63
+ case 0:
64
+ settings = thunkApi.getState().settings;
65
+ requestBody = {
66
+ lang: settings.data.language,
67
+ user_credentail: {
68
+ phone: params.mobile || '',
69
+ code: (_b = (_a = params.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) === null || _b === void 0 ? void 0 : _b.toString()
70
+ },
71
+ sign_in: true,
72
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_MOBILE,
73
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
74
+ };
75
+ return [4, API.authService.createAuth(requestBody)];
76
+ case 1:
77
+ data = (_e.sent()).data;
78
+ if (!data.errors) {
79
+ thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
80
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
81
+ }
82
+ return [2, { data: data, formData: params }];
83
+ }
84
+ });
85
+ }); });
86
+ export var resendOTPMobile = createAsyncThunk('signIn/resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
87
+ var _a, settings, signIn, authData, requestBody, data;
88
+ var _b, _c;
89
+ return __generator(this, function (_d) {
90
+ switch (_d.label) {
91
+ case 0:
92
+ _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
93
+ authData = signIn.data.auth;
94
+ requestBody = {
95
+ lang: settings.data.language,
96
+ user_credentail: {
97
+ phone: authData.mobile || '',
98
+ code: ((_c = (_b = authData.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString()) || ''
99
+ },
100
+ sign_in: true,
101
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_MOBILE,
102
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
103
+ };
104
+ return [4, API.authService.createAuth(requestBody)];
105
+ case 1:
106
+ data = (_d.sent()).data;
107
+ return [2, data];
108
+ }
109
+ });
110
+ }); });
111
+ export var createEmailAuth = createAsyncThunk('signIn/createEmailAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
112
+ var settings, requestBody, data;
113
+ var _a, _b;
114
+ return __generator(this, function (_c) {
115
+ switch (_c.label) {
116
+ case 0:
117
+ settings = thunkApi.getState().settings;
118
+ requestBody = {
119
+ lang: settings.data.language,
120
+ user_credentail: {
121
+ email: params.email || ''
122
+ },
123
+ sign_in: true,
124
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_EMAIL,
125
+ encryption_contract: ['user_credentail.email']
126
+ };
127
+ return [4, API.authService.createAuth(requestBody)];
128
+ case 1:
129
+ data = (_c.sent()).data;
130
+ if (!data.errors) {
131
+ thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
132
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
133
+ }
134
+ return [2, { data: data, formData: params }];
135
+ }
136
+ });
137
+ }); });
138
+ export var resendOTPEmail = createAsyncThunk('signIn/resendOTPEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
139
+ var _a, settings, signIn, authData, requestBody, data;
140
+ return __generator(this, function (_b) {
141
+ switch (_b.label) {
142
+ case 0:
143
+ _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
144
+ authData = signIn.data.auth;
145
+ requestBody = {
146
+ lang: settings.data.language,
147
+ user_credentail: {
148
+ email: authData.email || ''
149
+ },
150
+ sign_in: true,
151
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_EMAIL,
152
+ encryption_contract: ['user_credentail.email']
153
+ };
154
+ return [4, API.authService.createAuth(requestBody)];
155
+ case 1:
156
+ data = (_b.sent()).data;
157
+ return [2, data];
158
+ }
159
+ });
160
+ }); });
161
+ export var verifyAuthOTP = createAsyncThunk('signIn/verifyAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
162
+ var _a, signIn, settings, mobile, responseBody, requestBody, data;
163
+ var _b, _c, _d, _e;
164
+ return __generator(this, function (_f) {
165
+ switch (_f.label) {
166
+ case 0:
167
+ _a = thunkApi.getState(), signIn = _a.signIn, settings = _a.settings;
168
+ mobile = signIn.data.auth.mobile;
169
+ responseBody = signIn.data.passwordData.responseBody;
170
+ requestBody = {
171
+ data: params.otp,
172
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
173
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
174
+ device_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.device_token,
175
+ service_name: responseBody === null || responseBody === void 0 ? void 0 : responseBody.service_name,
176
+ new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
177
+ sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
178
+ remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
179
+ scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
180
+ step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL_OTP,
181
+ encryption_contract: ['data']
182
+ };
183
+ return [4, API.authService.verifyAuth(requestBody)];
184
+ case 1:
185
+ data = (_f.sent()).data;
186
+ if (!data.errors) {
187
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
188
+ thunkApi.dispatch(handleOpen(false));
189
+ (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, data);
190
+ }
191
+ return [2, { data: data, formData: params }];
192
+ }
193
+ });
194
+ }); });
195
+ export var verifyAuthPassword = createAsyncThunk('signIn/verifyAuthPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
196
+ var _a, signIn, settings, _b, responseBody, mobile, requestBody, data;
197
+ var _c, _d, _e, _f;
198
+ return __generator(this, function (_g) {
199
+ switch (_g.label) {
200
+ case 0:
201
+ _a = thunkApi.getState(), signIn = _a.signIn, settings = _a.settings;
202
+ _b = signIn.data.auth, responseBody = _b.responseBody, mobile = _b.mobile;
203
+ requestBody = {
204
+ data: params.password,
205
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
206
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
207
+ device_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.device_token,
208
+ service_name: responseBody === null || responseBody === void 0 ? void 0 : responseBody.service_name,
209
+ new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
210
+ sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
211
+ remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
212
+ scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
213
+ step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL,
214
+ encryption_contract: ['data']
215
+ };
216
+ return [4, API.authService.verifyAuth(requestBody)];
217
+ case 1:
218
+ data = (_g.sent()).data;
219
+ if (!data.errors) {
220
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.password });
221
+ if ((data === null || data === void 0 ? void 0 : data.status) === 'pending') {
222
+ thunkApi.dispatch(handleNextScreenStep('SIGIN_OTP_STEP'));
223
+ }
224
+ else {
225
+ thunkApi.dispatch(handleOpen(false));
226
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, data);
227
+ }
228
+ }
229
+ return [2, data];
230
+ }
231
+ });
232
+ }); });
233
+ var initialState = {
234
+ error: null,
235
+ loading: false,
236
+ data: {
237
+ auth: {
238
+ countryCode: defaultCountry,
239
+ mobile: null,
240
+ email: null
241
+ },
242
+ otpData: {
243
+ otp: ''
244
+ },
245
+ passwordData: {
246
+ password: ''
247
+ }
248
+ }
249
+ };
250
+ export var signInSlice = createSlice({
251
+ name: 'signIsn/store',
252
+ initialState: initialState,
253
+ reducers: {
254
+ clearError: function (state) {
255
+ state.error = null;
256
+ },
257
+ stopLoader: function (state) {
258
+ state.loading = false;
259
+ },
260
+ resetOTPScreen: function (state) {
261
+ state.data.otpData.otp = '';
262
+ }
263
+ },
264
+ extraReducers: function (builder) {
265
+ builder
266
+ .addCase(createMobileAuth.pending, function (state) {
267
+ state.loading = true;
268
+ state.error = null;
269
+ })
270
+ .addCase(createMobileAuth.fulfilled, function (state, action) {
271
+ var _a;
272
+ state.loading = false;
273
+ state.error = null;
274
+ var _b = action.payload, data = _b.data, formData = _b.formData;
275
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
276
+ if (description) {
277
+ state.error = description;
278
+ return;
279
+ }
280
+ state.data.auth = __assign(__assign({}, formData), { email: null, responseBody: data });
281
+ })
282
+ .addCase(createMobileAuth.rejected, function (state, action) {
283
+ state.loading = false;
284
+ state.error = action.error.message;
285
+ })
286
+ .addCase(resendOTPMobile.pending, function (state) {
287
+ state.loading = true;
288
+ state.error = null;
289
+ })
290
+ .addCase(resendOTPMobile.fulfilled, function (state, action) {
291
+ var _a;
292
+ state.loading = false;
293
+ state.error = null;
294
+ var data = action.payload;
295
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
296
+ if (description) {
297
+ state.error = description;
298
+ return;
299
+ }
300
+ state.data.auth.responseBody = data;
301
+ })
302
+ .addCase(resendOTPMobile.rejected, function (state, action) {
303
+ state.loading = false;
304
+ state.error = action.error.message;
305
+ })
306
+ .addCase(createEmailAuth.pending, function (state) {
307
+ state.loading = true;
308
+ state.error = null;
309
+ })
310
+ .addCase(createEmailAuth.fulfilled, function (state, action) {
311
+ var _a;
312
+ state.loading = false;
313
+ state.error = null;
314
+ var _b = action.payload, data = _b.data, formData = _b.formData;
315
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
316
+ if (description) {
317
+ state.error = description;
318
+ return;
319
+ }
320
+ state.data.auth = __assign(__assign(__assign({}, state.data.auth), formData), { mobile: null, responseBody: data });
321
+ })
322
+ .addCase(createEmailAuth.rejected, function (state, action) {
323
+ state.loading = false;
324
+ state.error = action.error.message;
325
+ })
326
+ .addCase(resendOTPEmail.pending, function (state) {
327
+ state.loading = true;
328
+ state.error = null;
329
+ })
330
+ .addCase(resendOTPEmail.fulfilled, function (state, action) {
331
+ var _a;
332
+ state.loading = false;
333
+ state.error = null;
334
+ var data = action.payload;
335
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
336
+ if (description) {
337
+ state.error = description;
338
+ return;
339
+ }
340
+ state.data.auth.responseBody = data;
341
+ })
342
+ .addCase(resendOTPEmail.rejected, function (state, action) {
343
+ state.loading = false;
344
+ state.error = action.error.message;
345
+ })
346
+ .addCase(verifyAuthOTP.pending, function (state) {
347
+ state.loading = true;
348
+ state.error = null;
349
+ })
350
+ .addCase(verifyAuthOTP.fulfilled, function (state, action) {
351
+ var _a;
352
+ state.loading = false;
353
+ state.error = null;
354
+ var data = action.payload.data;
355
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
356
+ if (description) {
357
+ state.error = description;
358
+ return;
359
+ }
360
+ })
361
+ .addCase(verifyAuthOTP.rejected, function (state, action) {
362
+ state.loading = false;
363
+ state.error = action.error.message;
364
+ })
365
+ .addCase(verifyAuthPassword.pending, function (state) {
366
+ state.loading = true;
367
+ state.error = null;
368
+ })
369
+ .addCase(verifyAuthPassword.fulfilled, function (state, action) {
370
+ var _a;
371
+ state.loading = false;
372
+ state.error = null;
373
+ var data = action.payload;
374
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
375
+ if (description) {
376
+ state.error = description;
377
+ return;
378
+ }
379
+ state.data.passwordData.responseBody = data;
380
+ })
381
+ .addCase(verifyAuthPassword.rejected, function (state, action) {
382
+ state.loading = false;
383
+ state.error = action.error.message;
384
+ });
385
+ }
386
+ });
387
+ export var clearError = (_a = signInSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
388
+ export default signInSlice.reducer;
389
+ export var signInSelector = function (state) { return state.signIn; };
@@ -33,6 +33,7 @@ export interface TaxData {
33
33
  flowName: FlowsTypes;
34
34
  }
35
35
  export interface TaxState extends SharedState<TaxData> {
36
+ customLoading?: boolean;
36
37
  }
37
38
  export declare const taxSlice: import("@reduxjs/toolkit").Slice<TaxState, {
38
39
  clearError: (state: TaxState) => void;
@@ -17,7 +17,7 @@ export var MerchantValidationSchema = function (userType) {
17
17
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
18
18
  if (length === 0)
19
19
  return true;
20
- return !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME))
20
+ return !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)) || (value === null || value === void 0 ? void 0 : value.length) < 3
21
21
  ? this.createError({ message: 'enter_brand_name_english_chars_numbers_space' })
22
22
  : true;
23
23
  }
@@ -5,3 +5,4 @@ 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 signInFeatureScreens: Array<FeatureScreenStep>;
@@ -34,6 +34,10 @@ import TaxDetailsPage from './tax/screens/TaxDetails';
34
34
  import TaxSuccessPage from './tax/screens/Success';
35
35
  import TaxSuccessWithFlowPage from './tax/screens/SuccessWithFlowButtons';
36
36
  import TaxResetPasswordSuccessPage from './tax/screens/ResetPasswordSuccess';
37
+ import SignInMobilePage from './signIn/screens/Mobile';
38
+ import SignInEmailPage from './signIn/screens/Email';
39
+ import SignInOTPPage from './signIn/screens/OTP';
40
+ import SignInPasswordPage from './signIn/screens/Password';
37
41
  export var connectFeatureScreens = [
38
42
  {
39
43
  name: 'CONNECT_NID_STEP',
@@ -169,3 +173,21 @@ export var taxFeatureScreens = [
169
173
  },
170
174
  { name: 'TAX_RESET_PASSWORD_SUCCESS', element: TaxResetPasswordSuccessPage }
171
175
  ];
176
+ export var signInFeatureScreens = [
177
+ {
178
+ name: 'SIGIN_MOBILE_STEP',
179
+ element: SignInMobilePage
180
+ },
181
+ {
182
+ name: 'SIGIN_EMAIL_STEP',
183
+ element: SignInEmailPage
184
+ },
185
+ {
186
+ name: 'SIGIN_OTP_STEP',
187
+ element: SignInOTPPage
188
+ },
189
+ {
190
+ name: 'SIGIN_PASSWORD_STEP',
191
+ element: SignInPasswordPage
192
+ }
193
+ ];
@@ -19,8 +19,7 @@ import Mandatory from '../../shared/Mandatory';
19
19
  import { DragAndDrop, UploadInput } from '../../../components/FileInput';
20
20
  import Collapse from '../../../components/Collapse';
21
21
  import Warning from '../../../components/Warning';
22
- import Icon from '../../../components/Icon';
23
- import { ICONS_NAMES } from '../../../constants';
22
+ import ClearIcon from '@mui/icons-material/Clear';
24
23
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
25
24
  var theme = _a.theme;
26
25
  return ({
@@ -43,12 +42,14 @@ var UploadBoxStyled = styled(Box)(function (_a) {
43
42
  var theme = _a.theme;
44
43
  return (__assign(__assign({}, theme.typography.caption), { background: theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, padding: theme.spacing(0.75, 1.75, 0), cursor: 'pointer', width: '15%', display: 'flex', justifyContent: 'center' }));
45
44
  });
46
- var IconStyled = styled(Icon)(function (_a) {
45
+ var ClearIconStyled = styled(ClearIcon)(function (_a) {
47
46
  var theme = _a.theme;
48
47
  return ({
49
- marginBlockStart: theme.spacing(0),
50
- width: theme.spacing(3.5),
51
- height: theme.spacing(3.5)
48
+ marginBlockStart: theme.spacing(0.25),
49
+ width: theme.spacing(3),
50
+ height: theme.spacing(3),
51
+ cursor: 'pointer',
52
+ color: theme.palette.common.white
52
53
  });
53
54
  });
54
55
  export var InputContainerStyled = styled(Box)(function (_a) {
@@ -71,6 +72,6 @@ var UploadFile = function (_a) {
71
72
  onReset === null || onReset === void 0 ? void 0 : onReset();
72
73
  }
73
74
  };
74
- return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(DragAndDrop, { title: dragTitle, onSuccess: handleFileChange }), _jsx(UploadInput, { title: uploadTitle, onChange: handleFileChange })] }) })), _jsx(Collapse, __assign({ in: !!fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(BoxStyled, { children: fileName }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(IconStyled, { src: ICONS_NAMES.DELETE_ICON }) }))] }) })), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: error })) }))] }));
75
+ return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(DragAndDrop, { title: dragTitle, onSuccess: handleFileChange }), _jsx(UploadInput, { title: uploadTitle, onChange: handleFileChange })] }) })), _jsx(Collapse, __assign({ in: !!fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(BoxStyled, { children: fileName }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) })), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: error })) }))] }));
75
76
  };
76
77
  export default UploadFile;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { LibConfig } from '../../@types';
3
+ export interface SignInLibProps extends LibConfig {
4
+ }
5
+ export declare function SignInLib(props: SignInLibProps): JSX.Element;
6
+ export declare function renderSignInLib(config: SignInLibProps, elementId: string): void;
7
+ export declare function unmountSignInLib(elementId: string): void;
@@ -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 { memo } from 'react';
14
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
15
+ import { settingsSelector } from '../../app/settings';
16
+ import AnimationFlow from '../../components/AnimationFlow';
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 { SigIn_SCREENS_NAVIGATION } from '../../constants';
23
+ import { signInFeatureScreens } from '../featuresScreens';
24
+ import CustomFooter from '../shared/Footer';
25
+ import { signInSelector } from '../app/signIn/signInStore';
26
+ import Background from '../shared/Background';
27
+ var SignIn = memo(function (props) {
28
+ var theme = useAppTheme().theme;
29
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, loading = _a.loading;
30
+ var signInError = useAppSelector(signInSelector).error;
31
+ useAppConfig(__assign({ navigation: SigIn_SCREENS_NAVIGATION }, props));
32
+ useErrorListener(signInError || error);
33
+ useStepStartedListener();
34
+ var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: loading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, open: open, error: error, loading: loading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: signInFeatureScreens.map(function (_a, index) {
36
+ var Element = _a.element, name = _a.name;
37
+ var isActive = activeScreen.name === name;
38
+ return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
39
+ }) }) })) })) })));
40
+ });
41
+ export function SignInLib(props) {
42
+ return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(SignIn, __assign({}, props)) })));
43
+ }
44
+ export function renderSignInLib(config, elementId) {
45
+ reactElement(elementId).render(_jsx(SignInLib, __assign({}, config)));
46
+ }
47
+ export function unmountSignInLib(elementId) {
48
+ reactElement(elementId).unmount();
49
+ }
@@ -0,0 +1 @@
1
+ export * from './SignIn';
@@ -0,0 +1 @@
1
+ export * from './SignIn';
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface EmailProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: EmailProps) => JSX.Element>;
5
+ export default _default;