@tap-payments/auth-jsconnect 2.8.2-test → 2.8.8-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -240,7 +240,7 @@ export var AUTH_SCREENS_NAVIGATION = [
240
240
  },
241
241
  {
242
242
  name: 'AUTH_EMAIL_STEP',
243
- next: ['AUTH_PASSWORD_STEP', 'AUTH_RESET_PASSWORD_MESSAGE_STEP'],
243
+ next: ['AUTH_PASSWORD_STEP', 'AUTH_RESET_PASSWORD_MESSAGE_STEP', 'AUTH_OTP_STEP'],
244
244
  prev: 'AUTH_SWITCH_STEP',
245
245
  order: 1
246
246
  },
@@ -253,7 +253,7 @@ export var AUTH_SCREENS_NAVIGATION = [
253
253
  {
254
254
  name: 'AUTH_OTP_STEP',
255
255
  next: 'AUTH_PREPARING_DATA_STEP',
256
- prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP'],
256
+ prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_EMAIL_STEP'],
257
257
  order: 2
258
258
  },
259
259
  {
@@ -82,6 +82,29 @@ export declare const verifyEmailPassword: import("@reduxjs/toolkit").AsyncThunk<
82
82
  fulfilledMeta?: unknown;
83
83
  rejectedMeta?: unknown;
84
84
  }>;
85
+ export declare const resendEmailAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
86
+ response: any;
87
+ formData: AuthEmailFormValues;
88
+ }, AuthEmailFormValues, {
89
+ state?: unknown;
90
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
91
+ extra?: unknown;
92
+ rejectValue?: unknown;
93
+ serializedErrorType?: unknown;
94
+ pendingMeta?: unknown;
95
+ fulfilledMeta?: unknown;
96
+ rejectedMeta?: unknown;
97
+ }>;
98
+ export declare const verifyEmailOtp: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {
99
+ state?: unknown;
100
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
101
+ extra?: unknown;
102
+ rejectValue?: unknown;
103
+ serializedErrorType?: unknown;
104
+ pendingMeta?: unknown;
105
+ fulfilledMeta?: unknown;
106
+ rejectedMeta?: unknown;
107
+ }>;
85
108
  export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
86
109
  response: any;
87
110
  formData: NIDFormValues;
@@ -217,9 +240,7 @@ export interface authData {
217
240
  otpData: OTPFormValues & {
218
241
  authFor?: AuthForType;
219
242
  };
220
- passwordData: PasswordFormValues & {
221
- authFor?: AuthForType.EMAIL;
222
- };
243
+ passwordData: PasswordFormValues;
223
244
  leadId?: string;
224
245
  isStartFromBusinessCountry?: boolean;
225
246
  flowName: FlowsTypes;
@@ -234,6 +234,8 @@ export var createEmailAuth = createAsyncThunk('auth/createEmailAuth', function (
234
234
  screen = 'AUTH_PASSWORD_STEP';
235
235
  if ((data === null || data === void 0 ? void 0 : data.auth_type) === 7)
236
236
  screen = 'AUTH_RESET_PASSWORD_MESSAGE_STEP';
237
+ if ((data === null || data === void 0 ? void 0 : data.auth_type) === 5)
238
+ screen = 'AUTH_OTP_STEP';
237
239
  thunkApi.dispatch(handleNextScreenStep(screen));
238
240
  (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
239
241
  return [2, { response: data, formData: params }];
@@ -279,6 +281,70 @@ export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', fu
279
281
  }
280
282
  });
281
283
  }); });
284
+ export var resendEmailAuthOTP = createAsyncThunk('auth/resendEmailAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
285
+ var _a, settings, auth, requestBody, data;
286
+ return __generator(this, function (_b) {
287
+ switch (_b.label) {
288
+ case 0:
289
+ _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
290
+ requestBody = {
291
+ country: settings.data.businessCountry.iso2,
292
+ scope: settings.data.appConfig.scope,
293
+ lang: settings.data.language,
294
+ lead_id: auth.data.leadId,
295
+ user_credentail: {
296
+ email: params.email || ''
297
+ },
298
+ sign_in: true,
299
+ is_lead: false,
300
+ step_name: AUTH_STEP_NAMES.CREATE_AUTH_EMAIL,
301
+ encryption_contract: ['user_credentail.email']
302
+ };
303
+ return [4, API.authService.createAuth(requestBody)];
304
+ case 1:
305
+ data = _b.sent();
306
+ return [2, { response: data, formData: params }];
307
+ }
308
+ });
309
+ }); });
310
+ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
311
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
312
+ var _d, _e, _f, _g;
313
+ return __generator(this, function (_h) {
314
+ switch (_h.label) {
315
+ case 0:
316
+ _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
317
+ _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
318
+ _c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type;
319
+ if (!auth_token)
320
+ throw new Error('Auth token is missing');
321
+ scope = settings.data.appConfig.scope;
322
+ payload = {
323
+ auth_token: auth_token,
324
+ lead_id: leadId,
325
+ data: params.otp,
326
+ auth_type: auth_type,
327
+ device_token: device_token,
328
+ service_name: service_name,
329
+ sign_in: false,
330
+ step_name: AUTH_STEP_NAMES.VERIFY_AUTH_MOBILE,
331
+ encryption_contract: ['data']
332
+ };
333
+ return [4, API.authService.verifyAuth(payload)];
334
+ case 1:
335
+ data = (_h.sent()).data;
336
+ if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
337
+ throw new Error(data.errors[0].description);
338
+ if (scope === 'merchant') {
339
+ openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
340
+ return [2, data];
341
+ }
342
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
343
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_PREPARING_DATA_STEP')); });
344
+ return [2, data];
345
+ }
346
+ });
347
+ }); });
282
348
  export var createNIDAuth = createAsyncThunk('auth/createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
283
349
  var _a, settings, auth, dob, nid, nidType, countryCode, requestBody, data;
284
350
  var _b, _c;
@@ -769,7 +835,6 @@ export var authSlice = createSlice({
769
835
  state.loading = false;
770
836
  state.data.mobileData = action.payload.formData;
771
837
  state.data.otpData.authFor = AuthForType.MOBILE;
772
- state.data.passwordData.authFor = undefined;
773
838
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
774
839
  })
775
840
  .addCase(createMobileAuth.rejected, function (state, action) {
@@ -808,8 +873,7 @@ export var authSlice = createSlice({
808
873
  .addCase(createEmailAuth.fulfilled, function (state, action) {
809
874
  state.loading = false;
810
875
  state.data.emailData = action.payload.formData;
811
- state.data.otpData.authFor = undefined;
812
- state.data.passwordData.authFor = AuthForType.EMAIL;
876
+ state.data.otpData.authFor = AuthForType.EMAIL;
813
877
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
814
878
  })
815
879
  .addCase(createEmailAuth.rejected, function (state, action) {
@@ -829,6 +893,31 @@ export var authSlice = createSlice({
829
893
  .addCase(verifyEmailPassword.rejected, function (state, action) {
830
894
  state.loading = false;
831
895
  state.error = action.error.message;
896
+ })
897
+ .addCase(resendEmailAuthOTP.pending, function (state) {
898
+ state.error = null;
899
+ })
900
+ .addCase(resendEmailAuthOTP.fulfilled, function (state, action) {
901
+ state.data.emailData = action.payload.formData;
902
+ state.data.otpData.authFor = AuthForType.EMAIL;
903
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
904
+ })
905
+ .addCase(resendEmailAuthOTP.rejected, function (state, action) {
906
+ state.error = action.error.message;
907
+ })
908
+ .addCase(verifyEmailOtp.pending, function (state) {
909
+ state.loading = true;
910
+ state.error = null;
911
+ })
912
+ .addCase(verifyEmailOtp.fulfilled, function (state, action) {
913
+ var _a;
914
+ state.loading = false;
915
+ var data = action.payload;
916
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
917
+ })
918
+ .addCase(verifyEmailOtp.rejected, function (state, action) {
919
+ state.loading = false;
920
+ state.error = action.error.message;
832
921
  })
833
922
  .addCase(createNIDAuth.pending, function (state) {
834
923
  state.loading = true;
@@ -838,7 +927,6 @@ export var authSlice = createSlice({
838
927
  state.loading = false;
839
928
  state.data.nidData = action.payload.formData;
840
929
  state.data.otpData.authFor = AuthForType.NATIONAL_ID;
841
- state.data.passwordData.authFor = undefined;
842
930
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
843
931
  })
844
932
  .addCase(createNIDAuth.rejected, function (state, action) {
@@ -7,19 +7,7 @@ interface VerifyLeadTokenProps {
7
7
  }
8
8
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  data: any;
10
- individualData: any;
11
- boardResponse: {
12
- user: any;
13
- brand: any;
14
- bank_account: any;
15
- entity: any;
16
- merchant: any;
17
- name: any;
18
- contact: any;
19
- business: any;
20
- individuals: any;
21
- notification: any;
22
- };
10
+ bankData: any;
23
11
  token: string;
24
12
  }, VerifyLeadTokenProps, {
25
13
  state?: unknown;
@@ -45,6 +33,7 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
45
33
  }>;
46
34
  export declare const verifyBankLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
47
35
  data: any;
36
+ bankData: any;
48
37
  formData: OTPFormValues;
49
38
  }, OTPFormValues, {
50
39
  state?: unknown;
@@ -57,6 +46,7 @@ export declare const verifyBankLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
57
46
  rejectedMeta?: unknown;
58
47
  }>;
59
48
  export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<{
49
+ data: any;
60
50
  flows: any;
61
51
  }, void, {
62
52
  state?: unknown;
@@ -68,9 +58,12 @@ export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<
68
58
  fulfilledMeta?: unknown;
69
59
  rejectedMeta?: unknown;
70
60
  }>;
71
- export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
72
- data: any;
73
- }, string, {
61
+ type RetrieveBoardProps = {
62
+ boardId: string;
63
+ individualId: string;
64
+ individualType: string;
65
+ };
66
+ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<any, RetrieveBoardProps, {
74
67
  state?: unknown;
75
68
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
76
69
  extra?: unknown;
@@ -110,8 +103,11 @@ export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
110
103
  rejectedMeta?: unknown;
111
104
  }>;
112
105
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
113
- response: any;
114
- formData: void;
106
+ data: any;
107
+ flows?: undefined;
108
+ } | {
109
+ data: any;
110
+ flows: any;
115
111
  } | undefined, void, {
116
112
  state?: unknown;
117
113
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;