@tap-payments/auth-jsconnect 2.8.2-test → 2.8.10-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;
@@ -171,14 +171,14 @@ export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', fu
171
171
  });
172
172
  }); });
173
173
  export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
174
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
174
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
175
175
  var _d, _e, _f, _g;
176
176
  return __generator(this, function (_h) {
177
177
  switch (_h.label) {
178
178
  case 0:
179
179
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
180
180
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
181
- _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;
181
+ _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, sign_in = _c.sign_in;
182
182
  if (!auth_token)
183
183
  throw new Error('Auth token is missing');
184
184
  scope = settings.data.appConfig.scope;
@@ -189,7 +189,7 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
189
189
  auth_type: auth_type,
190
190
  device_token: device_token,
191
191
  service_name: service_name,
192
- sign_in: false,
192
+ sign_in: sign_in,
193
193
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_MOBILE,
194
194
  encryption_contract: ['data']
195
195
  };
@@ -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 }];
@@ -241,14 +243,14 @@ export var createEmailAuth = createAsyncThunk('auth/createEmailAuth', function (
241
243
  });
242
244
  }); });
243
245
  export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
244
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
246
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
245
247
  var _d, _e, _f, _g;
246
248
  return __generator(this, function (_h) {
247
249
  switch (_h.label) {
248
250
  case 0:
249
251
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
250
252
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
251
- _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;
253
+ _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, sign_in = _c.sign_in;
252
254
  if (!auth_token)
253
255
  throw new Error('Auth token is missing');
254
256
  scope = settings.data.appConfig.scope;
@@ -259,7 +261,7 @@ export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', fu
259
261
  auth_type: auth_type,
260
262
  device_token: device_token,
261
263
  service_name: service_name,
262
- sign_in: true,
264
+ sign_in: sign_in,
263
265
  is_lead: false,
264
266
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_EMAIL,
265
267
  encryption_contract: ['data']
@@ -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, sign_in, 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, sign_in = _c.sign_in;
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: sign_in,
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;
@@ -357,14 +423,14 @@ export var resendNIDAuthOTP = createAsyncThunk('auth/resendNIDAuthOTP', function
357
423
  });
358
424
  }); });
359
425
  export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
360
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, scope, payload, data;
426
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
361
427
  var _d, _e, _f, _g;
362
428
  return __generator(this, function (_h) {
363
429
  switch (_h.label) {
364
430
  case 0:
365
431
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
366
432
  _b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
367
- _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;
433
+ _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, sign_in = _c.sign_in;
368
434
  if (!auth_token)
369
435
  throw new Error('Auth token is missing');
370
436
  scope = settings.data.appConfig.scope;
@@ -375,7 +441,7 @@ export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params
375
441
  auth_type: auth_type,
376
442
  device_token: device_token,
377
443
  service_name: service_name || 'ABSHER',
378
- sign_in: false,
444
+ sign_in: sign_in,
379
445
  step_name: AUTH_STEP_NAMES.VERIFY_AUTH_NID,
380
446
  encryption_contract: ['data']
381
447
  };
@@ -468,13 +534,14 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
468
534
  });
469
535
  }); });
470
536
  export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
471
- var _a, settings, auth, authConfigData, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
537
+ var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
472
538
  var _c;
473
539
  return __generator(this, function (_d) {
474
540
  switch (_d.label) {
475
541
  case 0:
476
542
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
477
543
  authConfigData = settings.data.appConfig.data;
544
+ authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
478
545
  isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
479
546
  data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
480
547
  authId = data === null || data === void 0 ? void 0 : data.id;
@@ -491,7 +558,7 @@ export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailab
491
558
  _d.sent();
492
559
  return [2, { brandList: brandList, entityList: entityList }];
493
560
  case 3:
494
- if (isExistingUser && !isDataHasIndividualOnly && brandList.length && entityList.length) {
561
+ if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
495
562
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
496
563
  return [2, { brandList: brandList, entityList: entityList }];
497
564
  }
@@ -769,7 +836,6 @@ export var authSlice = createSlice({
769
836
  state.loading = false;
770
837
  state.data.mobileData = action.payload.formData;
771
838
  state.data.otpData.authFor = AuthForType.MOBILE;
772
- state.data.passwordData.authFor = undefined;
773
839
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
774
840
  })
775
841
  .addCase(createMobileAuth.rejected, function (state, action) {
@@ -808,8 +874,7 @@ export var authSlice = createSlice({
808
874
  .addCase(createEmailAuth.fulfilled, function (state, action) {
809
875
  state.loading = false;
810
876
  state.data.emailData = action.payload.formData;
811
- state.data.otpData.authFor = undefined;
812
- state.data.passwordData.authFor = AuthForType.EMAIL;
877
+ state.data.otpData.authFor = AuthForType.EMAIL;
813
878
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
814
879
  })
815
880
  .addCase(createEmailAuth.rejected, function (state, action) {
@@ -829,6 +894,31 @@ export var authSlice = createSlice({
829
894
  .addCase(verifyEmailPassword.rejected, function (state, action) {
830
895
  state.loading = false;
831
896
  state.error = action.error.message;
897
+ })
898
+ .addCase(resendEmailAuthOTP.pending, function (state) {
899
+ state.error = null;
900
+ })
901
+ .addCase(resendEmailAuthOTP.fulfilled, function (state, action) {
902
+ state.data.emailData = action.payload.formData;
903
+ state.data.otpData.authFor = AuthForType.EMAIL;
904
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
905
+ })
906
+ .addCase(resendEmailAuthOTP.rejected, function (state, action) {
907
+ state.error = action.error.message;
908
+ })
909
+ .addCase(verifyEmailOtp.pending, function (state) {
910
+ state.loading = true;
911
+ state.error = null;
912
+ })
913
+ .addCase(verifyEmailOtp.fulfilled, function (state, action) {
914
+ var _a;
915
+ state.loading = false;
916
+ var data = action.payload;
917
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
918
+ })
919
+ .addCase(verifyEmailOtp.rejected, function (state, action) {
920
+ state.loading = false;
921
+ state.error = action.error.message;
832
922
  })
833
923
  .addCase(createNIDAuth.pending, function (state) {
834
924
  state.loading = true;
@@ -838,7 +928,6 @@ export var authSlice = createSlice({
838
928
  state.loading = false;
839
929
  state.data.nidData = action.payload.formData;
840
930
  state.data.otpData.authFor = AuthForType.NATIONAL_ID;
841
- state.data.passwordData.authFor = undefined;
842
931
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
843
932
  })
844
933
  .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;