@tap-payments/auth-jsconnect 2.0.8 → 2.0.10

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 (76) hide show
  1. package/build/@types/app.d.ts +2 -1
  2. package/build/@types/form.d.ts +3 -0
  3. package/build/@types/redux.d.ts +0 -1
  4. package/build/api/axios.d.ts +1 -0
  5. package/build/api/axios.js +3 -0
  6. package/build/api/entity.d.ts +1 -0
  7. package/build/api/entity.js +8 -1
  8. package/build/api/index.d.ts +3 -2
  9. package/build/api/index.js +2 -2
  10. package/build/app/rootReducer.d.ts +1 -0
  11. package/build/app/rootReducer.js +3 -1
  12. package/build/app/store.d.ts +2 -0
  13. package/build/assets/locales/ar.json +2 -1
  14. package/build/assets/locales/en.json +2 -1
  15. package/build/components/FileInput/DragAndDrop.js +1 -1
  16. package/build/constants/app.d.ts +9 -0
  17. package/build/constants/app.js +34 -0
  18. package/build/constants/validation.d.ts +1 -0
  19. package/build/constants/validation.js +1 -0
  20. package/build/features/app/bank/bankStore.d.ts +1 -0
  21. package/build/features/app/business/businessStore.d.ts +5 -3
  22. package/build/features/app/business/businessStore.js +34 -21
  23. package/build/features/app/connect/connectStore.d.ts +2 -1
  24. package/build/features/app/connect/connectStore.js +69 -38
  25. package/build/features/app/individual/individualStore.d.ts +1 -0
  26. package/build/features/app/individual/individualStore.js +1 -1
  27. package/build/features/app/password/passwordStore.d.ts +1 -0
  28. package/build/features/app/signIn/signInStore.d.ts +33 -0
  29. package/build/features/app/signIn/signInStore.js +390 -0
  30. package/build/features/app/tax/taxStore.d.ts +1 -0
  31. package/build/features/connect/screens/Merchant/validation.js +1 -1
  32. package/build/features/featuresScreens.d.ts +1 -0
  33. package/build/features/featuresScreens.js +22 -0
  34. package/build/features/shared/UploadFile/UploadFile.js +8 -7
  35. package/build/features/signIn/SignIn.d.ts +7 -0
  36. package/build/features/signIn/SignIn.js +49 -0
  37. package/build/features/signIn/index.d.ts +1 -0
  38. package/build/features/signIn/index.js +1 -0
  39. package/build/features/signIn/screens/Email/Email.d.ts +5 -0
  40. package/build/features/signIn/screens/Email/Email.js +95 -0
  41. package/build/features/signIn/screens/Email/EmailField.d.ts +5 -0
  42. package/build/features/signIn/screens/Email/EmailField.js +55 -0
  43. package/build/features/signIn/screens/Email/index.d.ts +3 -0
  44. package/build/features/signIn/screens/Email/index.js +2 -0
  45. package/build/features/signIn/screens/Email/validation.d.ts +8 -0
  46. package/build/features/signIn/screens/Email/validation.js +5 -0
  47. package/build/features/signIn/screens/Mobile/Mobile.d.ts +5 -0
  48. package/build/features/signIn/screens/Mobile/Mobile.js +106 -0
  49. package/build/features/signIn/screens/Mobile/MobileNumber.d.ts +11 -0
  50. package/build/features/signIn/screens/Mobile/MobileNumber.js +151 -0
  51. package/build/features/signIn/screens/Mobile/index.d.ts +3 -0
  52. package/build/features/signIn/screens/Mobile/index.js +2 -0
  53. package/build/features/signIn/screens/Mobile/validation.d.ts +8 -0
  54. package/build/features/signIn/screens/Mobile/validation.js +28 -0
  55. package/build/features/signIn/screens/OTP/OTP.d.ts +5 -0
  56. package/build/features/signIn/screens/OTP/OTP.js +80 -0
  57. package/build/features/signIn/screens/OTP/OTPInput.d.ts +5 -0
  58. package/build/features/signIn/screens/OTP/OTPInput.js +53 -0
  59. package/build/features/signIn/screens/OTP/index.d.ts +3 -0
  60. package/build/features/signIn/screens/OTP/index.js +2 -0
  61. package/build/features/signIn/screens/OTP/validation.d.ts +8 -0
  62. package/build/features/signIn/screens/OTP/validation.js +4 -0
  63. package/build/features/signIn/screens/Password/Password.d.ts +5 -0
  64. package/build/features/signIn/screens/Password/Password.js +54 -0
  65. package/build/features/signIn/screens/Password/PasswordInput.d.ts +5 -0
  66. package/build/features/signIn/screens/Password/PasswordInput.js +28 -0
  67. package/build/features/signIn/screens/Password/index.d.ts +3 -0
  68. package/build/features/signIn/screens/Password/index.js +2 -0
  69. package/build/features/signIn/screens/Password/validation.d.ts +8 -0
  70. package/build/features/signIn/screens/Password/validation.js +4 -0
  71. package/build/hooks/useAppDispatch.d.ts +1 -0
  72. package/build/index.d.ts +3 -2
  73. package/build/index.js +5 -2
  74. package/build/utils/string.d.ts +1 -0
  75. package/build/utils/string.js +4 -0
  76. package/package.json +1 -1
@@ -207,24 +207,30 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
207
207
  return [4, API.authService.verifyAuth(payload)];
208
208
  case 1:
209
209
  data = (_e.sent()).data;
210
- if (!data.errors) {
211
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
212
- if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
213
- params_1 = {
214
- leadId: data === null || data === void 0 ? void 0 : data.lead_id,
215
- stepName: 'CONNECT_INDIVIDUAL_STEP'
216
- };
217
- thunkApi.dispatch(retrieveLead(params_1));
218
- }
219
- else {
220
- params_2 = {
221
- individualId: data === null || data === void 0 ? void 0 : data.individual_id,
222
- stepName: 'CONNECT_MERCHANT_INFO_STEP'
223
- };
224
- thunkApi.dispatch(createLead(params_2));
225
- }
210
+ if (!!data.errors) return [3, 4];
211
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
212
+ if (!(responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user)) return [3, 2];
213
+ params_1 = {
214
+ leadId: data === null || data === void 0 ? void 0 : data.lead_id,
215
+ stepName: 'CONNECT_INDIVIDUAL_STEP'
216
+ };
217
+ thunkApi.dispatch(retrieveLead(params_1));
218
+ return [3, 4];
219
+ case 2: return [4, thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id))];
220
+ case 3:
221
+ _e.sent();
222
+ if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
223
+ params_2 = {
224
+ individualId: data === null || data === void 0 ? void 0 : data.individual_id,
225
+ stepName: 'CONNECT_MERCHANT_INFO_STEP'
226
+ };
227
+ thunkApi.dispatch(createLead(params_2));
226
228
  }
227
- return [2, { response: data, formData: params }];
229
+ else {
230
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
231
+ }
232
+ _e.label = 4;
233
+ case 4: return [2, { response: data, formData: params }];
228
234
  }
229
235
  });
230
236
  }); });
@@ -241,9 +247,9 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
241
247
  });
242
248
  }); });
243
249
  export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
244
- var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
245
- return __generator(this, function (_b) {
246
- switch (_b.label) {
250
+ var settings, businessCountry, payload, data;
251
+ return __generator(this, function (_a) {
252
+ switch (_a.label) {
247
253
  case 0:
248
254
  settings = thunkApi.getState().settings;
249
255
  businessCountry = settings.data.businessCountry;
@@ -251,19 +257,28 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
251
257
  individual_id: params.individualId,
252
258
  country_code: businessCountry.iso2
253
259
  };
254
- brandPayload = {
255
- individual_id: params.individualId
256
- };
257
- return [4, Promise.all([
258
- API.individualService.getBrandList(brandPayload),
259
- API.leadService.createLead(payload)
260
- ])];
260
+ return [4, API.leadService.createLead(payload)];
261
261
  case 1:
262
- _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
262
+ data = (_a.sent()).data;
263
263
  if (!data.errors) {
264
264
  thunkApi.dispatch(handleNextScreenStep(params.stepName));
265
265
  }
266
- return [2, { response: data, brandResponse: brandResponse, formData: params }];
266
+ return [2, { response: data, formData: params }];
267
+ }
268
+ });
269
+ }); });
270
+ export var retrieveBrandList = createAsyncThunk('retrieveBrandList', function (individualId) { return __awaiter(void 0, void 0, void 0, function () {
271
+ var brandPayload, data;
272
+ return __generator(this, function (_a) {
273
+ switch (_a.label) {
274
+ case 0:
275
+ brandPayload = {
276
+ individual_id: individualId
277
+ };
278
+ return [4, API.individualService.getBrandList(brandPayload)];
279
+ case 1:
280
+ data = (_a.sent()).data;
281
+ return [2, data];
267
282
  }
268
283
  });
269
284
  }); });
@@ -334,7 +349,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
334
349
  payload = {
335
350
  brand: brand,
336
351
  id: (isExistingUser ? (_l = brandData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id : (_m = otpData.responseBody) === null || _m === void 0 ? void 0 : _m.lead_id) || '',
337
- terms_conditions_accepted: params.termAndConditionChecked,
352
+ terms_conditions_accepted: isExistingUser && !isOther ? undefined : params.termAndConditionChecked,
338
353
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
339
354
  encryption_contract: [
340
355
  'brand.name.en',
@@ -590,6 +605,7 @@ export var connectSlice = createSlice({
590
605
  }
591
606
  state.data.otpData.responseBody = response;
592
607
  state.data.otpData.otp = formData.otp;
608
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), response);
593
609
  })
594
610
  .addCase(verifyAuth.pending, function (state) {
595
611
  state.loading = true;
@@ -629,30 +645,45 @@ export var connectSlice = createSlice({
629
645
  state.error = action.error.message;
630
646
  })
631
647
  .addCase(createLead.fulfilled, function (state, action) {
632
- var _a, _b;
648
+ var _a;
633
649
  state.loading = false;
634
650
  state.error = null;
635
- var _c = action.payload, response = _c.response, brandResponse = _c.brandResponse;
651
+ var response = action.payload.response;
636
652
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
637
- var brandError = (((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
638
653
  if (description) {
639
654
  state.error = description;
640
655
  return;
641
656
  }
657
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), response);
658
+ })
659
+ .addCase(createLead.pending, function (state) {
660
+ state.loading = true;
661
+ state.error = null;
662
+ })
663
+ .addCase(createLead.rejected, function (state, action) {
664
+ state.loading = false;
665
+ state.error = action.error.message;
666
+ })
667
+ .addCase(retrieveBrandList.fulfilled, function (state, action) {
668
+ var _a;
669
+ state.loading = false;
670
+ state.error = null;
671
+ var response = action.payload;
672
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
642
673
  var brandList = undefined;
643
- if (!brandError) {
644
- brandList = Array.isArray(brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands) ? __spreadArray(__spreadArray([], brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands, true), [OTHER_BRAND], false) : [];
674
+ if (!description) {
675
+ brandList = Array.isArray(response === null || response === void 0 ? void 0 : response.brands) ? __spreadArray(__spreadArray([], response === null || response === void 0 ? void 0 : response.brands, true), [OTHER_BRAND], false) : [];
645
676
  var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
646
677
  if (!!brand)
647
678
  state.data.brandData.selectedBrandItem = brand;
648
679
  }
649
- state.data.brandData.responseBody = __assign({ brands: brandList || [] }, response);
680
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { brands: brandList || [] });
650
681
  })
651
- .addCase(createLead.pending, function (state) {
682
+ .addCase(retrieveBrandList.pending, function (state) {
652
683
  state.loading = true;
653
684
  state.error = null;
654
685
  })
655
- .addCase(createLead.rejected, function (state, action) {
686
+ .addCase(retrieveBrandList.rejected, function (state, action) {
656
687
  state.loading = false;
657
688
  state.error = action.error.message;
658
689
  })
@@ -48,6 +48,7 @@ export interface IndividualData {
48
48
  flowName: FlowsTypes;
49
49
  }
50
50
  export interface IndividualState extends SharedState<IndividualData> {
51
+ customLoading?: boolean;
51
52
  }
52
53
  export declare const individualSlice: import("@reduxjs/toolkit").Slice<IndividualState, {
53
54
  clearError: (state: IndividualState) => void;
@@ -386,7 +386,7 @@ export var individualSlice = createSlice({
386
386
  var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode;
387
387
  var info = (data || {}).info;
388
388
  var _b = state.data.individualData.responseBody || {}, sourceIncomeList = _b.sourceIncomeList, monthlyIncomeList = _b.monthlyIncomeList, occupationList = _b.occupationList;
389
- var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b, _c, _d; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_d = (_c = (_b = info === null || info === void 0 ? void 0 : info.source_income) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.name_en) === null || _d === void 0 ? void 0 : _d.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
389
+ var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b, _c; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_c = (_b = info === null || info === void 0 ? void 0 : info.source_income) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
390
390
  if (!!selectedSourceIncome)
391
391
  state.data.individualData.sourceIncome = selectedSourceIncome;
392
392
  var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { var _a, _b; return ((_a = income === null || income === void 0 ? void 0 : income.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = info === null || info === void 0 ? void 0 : info.actual_income) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
@@ -62,6 +62,7 @@ export interface PasswordData {
62
62
  flowName: FlowsTypes;
63
63
  }
64
64
  export interface PasswordState extends SharedState<PasswordData> {
65
+ customLoading?: boolean;
65
66
  }
66
67
  export declare const passwordSlice: import("@reduxjs/toolkit").Slice<PasswordState, {
67
68
  clearError: (state: PasswordState) => void;
@@ -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,390 @@
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
+ import { getAxiosHeaders } from '../../../api';
54
+ var redirection = function (type) {
55
+ if (type === 1)
56
+ return handleNextScreenStep('SIGIN_PASSWORD_STEP');
57
+ return handleNextScreenStep('SIGIN_OTP_STEP');
58
+ };
59
+ export var createMobileAuth = createAsyncThunk('signIn/createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
60
+ var settings, requestBody, data;
61
+ var _a, _b, _c, _d;
62
+ return __generator(this, function (_e) {
63
+ switch (_e.label) {
64
+ case 0:
65
+ settings = thunkApi.getState().settings;
66
+ requestBody = {
67
+ lang: settings.data.language,
68
+ user_credentail: {
69
+ phone: params.mobile || '',
70
+ code: (_b = (_a = params.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) === null || _b === void 0 ? void 0 : _b.toString()
71
+ },
72
+ sign_in: true,
73
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_MOBILE,
74
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
75
+ };
76
+ return [4, API.authService.createAuth(requestBody)];
77
+ case 1:
78
+ data = (_e.sent()).data;
79
+ if (!data.errors) {
80
+ thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
81
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
82
+ }
83
+ return [2, { data: data, formData: params }];
84
+ }
85
+ });
86
+ }); });
87
+ export var resendOTPMobile = createAsyncThunk('signIn/resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
88
+ var _a, settings, signIn, authData, requestBody, data;
89
+ var _b, _c;
90
+ return __generator(this, function (_d) {
91
+ switch (_d.label) {
92
+ case 0:
93
+ _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
94
+ authData = signIn.data.auth;
95
+ requestBody = {
96
+ lang: settings.data.language,
97
+ user_credentail: {
98
+ phone: authData.mobile || '',
99
+ code: ((_c = (_b = authData.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString()) || ''
100
+ },
101
+ sign_in: true,
102
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_MOBILE,
103
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
104
+ };
105
+ return [4, API.authService.createAuth(requestBody)];
106
+ case 1:
107
+ data = (_d.sent()).data;
108
+ return [2, data];
109
+ }
110
+ });
111
+ }); });
112
+ export var createEmailAuth = createAsyncThunk('signIn/createEmailAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var settings, requestBody, data;
114
+ var _a, _b;
115
+ return __generator(this, function (_c) {
116
+ switch (_c.label) {
117
+ case 0:
118
+ settings = thunkApi.getState().settings;
119
+ requestBody = {
120
+ lang: settings.data.language,
121
+ user_credentail: {
122
+ email: params.email || ''
123
+ },
124
+ sign_in: true,
125
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_EMAIL,
126
+ encryption_contract: ['user_credentail.email']
127
+ };
128
+ return [4, API.authService.createAuth(requestBody)];
129
+ case 1:
130
+ data = (_c.sent()).data;
131
+ if (!data.errors) {
132
+ thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
133
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
134
+ }
135
+ return [2, { data: data, formData: params }];
136
+ }
137
+ });
138
+ }); });
139
+ export var resendOTPEmail = createAsyncThunk('signIn/resendOTPEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
140
+ var _a, settings, signIn, authData, requestBody, data;
141
+ return __generator(this, function (_b) {
142
+ switch (_b.label) {
143
+ case 0:
144
+ _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
145
+ authData = signIn.data.auth;
146
+ requestBody = {
147
+ lang: settings.data.language,
148
+ user_credentail: {
149
+ email: authData.email || ''
150
+ },
151
+ sign_in: true,
152
+ step_name: SignIn_STEP_NAMES.CREATE_AUTH_EMAIL,
153
+ encryption_contract: ['user_credentail.email']
154
+ };
155
+ return [4, API.authService.createAuth(requestBody)];
156
+ case 1:
157
+ data = (_b.sent()).data;
158
+ return [2, data];
159
+ }
160
+ });
161
+ }); });
162
+ export var verifyAuthOTP = createAsyncThunk('signIn/verifyAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
163
+ var _a, signIn, settings, mobile, responseBody, requestBody, data;
164
+ var _b, _c, _d, _e;
165
+ return __generator(this, function (_f) {
166
+ switch (_f.label) {
167
+ case 0:
168
+ _a = thunkApi.getState(), signIn = _a.signIn, settings = _a.settings;
169
+ mobile = signIn.data.auth.mobile;
170
+ responseBody = signIn.data.passwordData.responseBody;
171
+ requestBody = {
172
+ data: params.otp,
173
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
174
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
175
+ device_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.device_token,
176
+ service_name: responseBody === null || responseBody === void 0 ? void 0 : responseBody.service_name,
177
+ new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
178
+ sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
179
+ remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
180
+ scopes: (responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes) || settings.data.appConfig.scope,
181
+ step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL_OTP,
182
+ encryption_contract: ['data']
183
+ };
184
+ return [4, API.authService.verifyAuth(requestBody)];
185
+ case 1:
186
+ data = (_f.sent()).data;
187
+ if (!data.errors) {
188
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
189
+ thunkApi.dispatch(handleOpen(false));
190
+ (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, data, getAxiosHeaders());
191
+ }
192
+ return [2, { data: data, formData: params }];
193
+ }
194
+ });
195
+ }); });
196
+ export var verifyAuthPassword = createAsyncThunk('signIn/verifyAuthPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
197
+ var _a, signIn, settings, _b, responseBody, mobile, requestBody, data;
198
+ var _c, _d, _e, _f;
199
+ return __generator(this, function (_g) {
200
+ switch (_g.label) {
201
+ case 0:
202
+ _a = thunkApi.getState(), signIn = _a.signIn, settings = _a.settings;
203
+ _b = signIn.data.auth, responseBody = _b.responseBody, mobile = _b.mobile;
204
+ requestBody = {
205
+ data: params.password,
206
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
207
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
208
+ device_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.device_token,
209
+ service_name: responseBody === null || responseBody === void 0 ? void 0 : responseBody.service_name,
210
+ new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
211
+ sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
212
+ remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
213
+ scopes: (responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes) || settings.data.appConfig.scope,
214
+ step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL,
215
+ encryption_contract: ['data']
216
+ };
217
+ return [4, API.authService.verifyAuth(requestBody)];
218
+ case 1:
219
+ data = (_g.sent()).data;
220
+ if (!data.errors) {
221
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.password });
222
+ if ((data === null || data === void 0 ? void 0 : data.status) === 'pending') {
223
+ thunkApi.dispatch(handleNextScreenStep('SIGIN_OTP_STEP'));
224
+ }
225
+ else {
226
+ thunkApi.dispatch(handleOpen(false));
227
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, data, getAxiosHeaders());
228
+ }
229
+ }
230
+ return [2, data];
231
+ }
232
+ });
233
+ }); });
234
+ var initialState = {
235
+ error: null,
236
+ loading: false,
237
+ data: {
238
+ auth: {
239
+ countryCode: defaultCountry,
240
+ mobile: null,
241
+ email: null
242
+ },
243
+ otpData: {
244
+ otp: ''
245
+ },
246
+ passwordData: {
247
+ password: ''
248
+ }
249
+ }
250
+ };
251
+ export var signInSlice = createSlice({
252
+ name: 'signIsn/store',
253
+ initialState: initialState,
254
+ reducers: {
255
+ clearError: function (state) {
256
+ state.error = null;
257
+ },
258
+ stopLoader: function (state) {
259
+ state.loading = false;
260
+ },
261
+ resetOTPScreen: function (state) {
262
+ state.data.otpData.otp = '';
263
+ }
264
+ },
265
+ extraReducers: function (builder) {
266
+ builder
267
+ .addCase(createMobileAuth.pending, function (state) {
268
+ state.loading = true;
269
+ state.error = null;
270
+ })
271
+ .addCase(createMobileAuth.fulfilled, function (state, action) {
272
+ var _a;
273
+ state.loading = false;
274
+ state.error = null;
275
+ var _b = action.payload, data = _b.data, formData = _b.formData;
276
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
277
+ if (description) {
278
+ state.error = description;
279
+ return;
280
+ }
281
+ state.data.auth = __assign(__assign({}, formData), { email: null, responseBody: data });
282
+ })
283
+ .addCase(createMobileAuth.rejected, function (state, action) {
284
+ state.loading = false;
285
+ state.error = action.error.message;
286
+ })
287
+ .addCase(resendOTPMobile.pending, function (state) {
288
+ state.loading = true;
289
+ state.error = null;
290
+ })
291
+ .addCase(resendOTPMobile.fulfilled, function (state, action) {
292
+ var _a;
293
+ state.loading = false;
294
+ state.error = null;
295
+ var data = action.payload;
296
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
297
+ if (description) {
298
+ state.error = description;
299
+ return;
300
+ }
301
+ state.data.auth.responseBody = data;
302
+ })
303
+ .addCase(resendOTPMobile.rejected, function (state, action) {
304
+ state.loading = false;
305
+ state.error = action.error.message;
306
+ })
307
+ .addCase(createEmailAuth.pending, function (state) {
308
+ state.loading = true;
309
+ state.error = null;
310
+ })
311
+ .addCase(createEmailAuth.fulfilled, function (state, action) {
312
+ var _a;
313
+ state.loading = false;
314
+ state.error = null;
315
+ var _b = action.payload, data = _b.data, formData = _b.formData;
316
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
317
+ if (description) {
318
+ state.error = description;
319
+ return;
320
+ }
321
+ state.data.auth = __assign(__assign(__assign({}, state.data.auth), formData), { mobile: null, responseBody: data });
322
+ })
323
+ .addCase(createEmailAuth.rejected, function (state, action) {
324
+ state.loading = false;
325
+ state.error = action.error.message;
326
+ })
327
+ .addCase(resendOTPEmail.pending, function (state) {
328
+ state.loading = true;
329
+ state.error = null;
330
+ })
331
+ .addCase(resendOTPEmail.fulfilled, function (state, action) {
332
+ var _a;
333
+ state.loading = false;
334
+ state.error = null;
335
+ var data = action.payload;
336
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
337
+ if (description) {
338
+ state.error = description;
339
+ return;
340
+ }
341
+ state.data.auth.responseBody = data;
342
+ })
343
+ .addCase(resendOTPEmail.rejected, function (state, action) {
344
+ state.loading = false;
345
+ state.error = action.error.message;
346
+ })
347
+ .addCase(verifyAuthOTP.pending, function (state) {
348
+ state.loading = true;
349
+ state.error = null;
350
+ })
351
+ .addCase(verifyAuthOTP.fulfilled, function (state, action) {
352
+ var _a;
353
+ state.loading = false;
354
+ state.error = null;
355
+ var data = action.payload.data;
356
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
357
+ if (description) {
358
+ state.error = description;
359
+ return;
360
+ }
361
+ })
362
+ .addCase(verifyAuthOTP.rejected, function (state, action) {
363
+ state.loading = false;
364
+ state.error = action.error.message;
365
+ })
366
+ .addCase(verifyAuthPassword.pending, function (state) {
367
+ state.loading = true;
368
+ state.error = null;
369
+ })
370
+ .addCase(verifyAuthPassword.fulfilled, function (state, action) {
371
+ var _a;
372
+ state.loading = false;
373
+ state.error = null;
374
+ var data = action.payload;
375
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
376
+ if (description) {
377
+ state.error = description;
378
+ return;
379
+ }
380
+ state.data.passwordData.responseBody = data;
381
+ })
382
+ .addCase(verifyAuthPassword.rejected, function (state, action) {
383
+ state.loading = false;
384
+ state.error = action.error.message;
385
+ });
386
+ }
387
+ });
388
+ export var clearError = (_a = signInSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
389
+ export default signInSlice.reducer;
390
+ 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>;