@tap-payments/auth-jsconnect 2.3.12-test → 2.3.16-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.
@@ -10,8 +10,8 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
10
10
  } | {
11
11
  data: any;
12
12
  isRequireOTP: boolean;
13
+ token: string;
13
14
  leadData?: undefined;
14
- token?: undefined;
15
15
  brandData?: undefined;
16
16
  boardId?: undefined;
17
17
  }, string, {}>;
@@ -163,7 +163,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
163
163
  brandData: brandData,
164
164
  boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
165
165
  }];
166
- case 19: return [2, { data: data, isRequireOTP: true }];
166
+ case 19: return [2, { data: data, isRequireOTP: true, token: token }];
167
167
  }
168
168
  });
169
169
  }); });
@@ -21,10 +21,18 @@ export declare const createMobileAuthAsync: import("@reduxjs/toolkit").AsyncThun
21
21
  response: any;
22
22
  formData: MobileFormValues;
23
23
  }, MobileFormValues, {}>;
24
+ export declare const resendMobileAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
25
+ response: any;
26
+ formData: MobileFormValues;
27
+ }, MobileFormValues, {}>;
24
28
  export declare const createNIDAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
25
29
  response: any;
26
30
  formData: NIDFormValues;
27
31
  }, NIDFormValues, {}>;
32
+ export declare const resendNIDAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
33
+ response: any;
34
+ formData: NIDFormValues;
35
+ }, NIDFormValues, {}>;
28
36
  export declare const createCivilIdAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
29
37
  response: any;
30
38
  formData: CivilFormValues;
@@ -42,6 +50,12 @@ export declare const createNIDAuthIdentityAsync: import("@reduxjs/toolkit").Asyn
42
50
  };
43
51
  formData: NIDFormValues;
44
52
  }, NIDFormValues, {}>;
53
+ export declare const resendNIDAuthIdentityOTP: import("@reduxjs/toolkit").AsyncThunk<{
54
+ response: {
55
+ verify_token: any;
56
+ };
57
+ formData: NIDFormValues;
58
+ }, NIDFormValues, {}>;
45
59
  export declare const verifyNIDOtpLeadIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {}>;
46
60
  export declare const verifyPaciOtpLeadIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {}>;
47
61
  export declare const checkEmailAvailabilityAsync: import("@reduxjs/toolkit").AsyncThunk<{
@@ -170,6 +170,33 @@ export var createMobileAuthAsync = createAsyncThunk('connectExpress/createMobile
170
170
  }
171
171
  });
172
172
  }); });
173
+ export var resendMobileAuthOTP = createAsyncThunk('connectExpress/resendMobileAuthOTPExpress', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
174
+ var _a, settings, connectExpress, requestBody, data;
175
+ return __generator(this, function (_b) {
176
+ switch (_b.label) {
177
+ case 0:
178
+ _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
179
+ requestBody = {
180
+ country: settings.data.businessCountry.iso2,
181
+ scope: settings.data.appConfig.scope,
182
+ lang: settings.data.language,
183
+ lead_id: connectExpress.data.leadId,
184
+ user_credentail: {
185
+ phone: params.mobile,
186
+ code: params.countryCode.idd_prefix.toString()
187
+ },
188
+ sign_in: false,
189
+ is_lead: true,
190
+ step_name: CONNECT_EXPRESS_STEP_NAMES.CREATE_AUTH_MOBILE,
191
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
192
+ };
193
+ return [4, API.authService.createExpressAuth(requestBody)];
194
+ case 1:
195
+ data = _b.sent();
196
+ return [2, { response: data, formData: params }];
197
+ }
198
+ });
199
+ }); });
173
200
  export var createNIDAuthAsync = createAsyncThunk('connectExpress/createNIDAuthAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
174
201
  var _a, settings, connectExpress, dob, nid, nidType, countryCode, requestBody, data;
175
202
  var _b, _c;
@@ -210,6 +237,43 @@ export var createNIDAuthAsync = createAsyncThunk('connectExpress/createNIDAuthAs
210
237
  }
211
238
  });
212
239
  }); });
240
+ export var resendNIDAuthOTP = createAsyncThunk('connectExpress/resendNIDAuthOTPExpress', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
241
+ var _a, settings, connectExpress, dob, nid, nidType, countryCode, requestBody, data;
242
+ return __generator(this, function (_b) {
243
+ switch (_b.label) {
244
+ case 0:
245
+ _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
246
+ dob = params.dob, nid = params.nid;
247
+ nidType = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
248
+ countryCode = settings.data.businessCountry.iso2;
249
+ requestBody = {
250
+ country: countryCode,
251
+ scope: settings.data.appConfig.scope,
252
+ lang: settings.data.language,
253
+ lead_id: connectExpress.data.leadId,
254
+ user_credentail: {
255
+ identification_id: nid,
256
+ identification_id_type: nidType,
257
+ date_of_birth: dob,
258
+ country_code: countryCode
259
+ },
260
+ sign_in: false,
261
+ is_lead: true,
262
+ step_name: CONNECT_EXPRESS_STEP_NAMES.CREATE_AUTH_NID,
263
+ encryption_contract: [
264
+ 'user_credentail.country_code',
265
+ 'user_credentail.identification_id',
266
+ 'user_credentail.identification_id_type',
267
+ 'user_credentail.date_of_birth'
268
+ ]
269
+ };
270
+ return [4, API.authService.createExpressAuth(requestBody)];
271
+ case 1:
272
+ data = _b.sent();
273
+ return [2, { response: data, formData: params }];
274
+ }
275
+ });
276
+ }); });
213
277
  export var createCivilIdAuthAsync = createAsyncThunk('connectExpress/createCivilAuthAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
214
278
  var _a, settings, connectExpress, civilId, countryCode, requestBody, data;
215
279
  var _b, _c;
@@ -387,6 +451,35 @@ export var createNIDAuthIdentityAsync = createAsyncThunk('connectExpress/createN
387
451
  }
388
452
  });
389
453
  }); });
454
+ export var resendNIDAuthIdentityOTP = createAsyncThunk('connectExpress/resendNIDAuthIdentityOTPExpress', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
455
+ var _a, settings, connectExpress, dob, nid, nidType, countryCode, requestBody, data;
456
+ var _b;
457
+ return __generator(this, function (_c) {
458
+ switch (_c.label) {
459
+ case 0:
460
+ _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
461
+ dob = params.dob, nid = params.nid;
462
+ nidType = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
463
+ countryCode = settings.data.businessCountry.iso2;
464
+ requestBody = {
465
+ id: (_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.authData.lead_id,
466
+ identification: {
467
+ id: nid,
468
+ issued_country_code: countryCode,
469
+ type: nidType
470
+ },
471
+ country_code: countryCode,
472
+ date_of_birth: dob,
473
+ step_name: CONNECT_EXPRESS_STEP_NAMES.IDENTITY_AUTH,
474
+ encryption_contract: ['identification.issued_country_code', 'identification.id', 'identification.type', 'date_of_birth']
475
+ };
476
+ return [4, API.leadService.updateLead(requestBody)];
477
+ case 1:
478
+ data = _c.sent();
479
+ return [2, { response: { verify_token: data.verify_token }, formData: params }];
480
+ }
481
+ });
482
+ }); });
390
483
  export var verifyNIDOtpLeadIdentityAsync = createAsyncThunk('connectExpress/verifyNIDOtpLeadIdentityAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
391
484
  var _a, settings, connectExpress, _b, responseData, leadId, verify_token, payload, data, needToCollectMoreInfo, creatingAccount;
392
485
  var _c, _d;
@@ -784,6 +877,17 @@ export var connectSlice = createSlice({
784
877
  .addCase(createMobileAuthAsync.rejected, function (state, action) {
785
878
  state.loading = false;
786
879
  state.error = action.error.message;
880
+ })
881
+ .addCase(resendMobileAuthOTP.pending, function (state) {
882
+ state.error = null;
883
+ })
884
+ .addCase(resendMobileAuthOTP.fulfilled, function (state, action) {
885
+ state.data.mobileData = action.payload.formData;
886
+ state.data.otpData.authFor = AuthForType.MOBILE;
887
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: action.payload.response });
888
+ })
889
+ .addCase(resendMobileAuthOTP.rejected, function (state, action) {
890
+ state.error = action.error.message;
787
891
  })
788
892
  .addCase(createNIDAuthAsync.pending, function (state) {
789
893
  state.loading = true;
@@ -798,6 +902,17 @@ export var connectSlice = createSlice({
798
902
  .addCase(createNIDAuthAsync.rejected, function (state, action) {
799
903
  state.loading = false;
800
904
  state.error = action.error.message;
905
+ })
906
+ .addCase(resendNIDAuthOTP.pending, function (state) {
907
+ state.error = null;
908
+ })
909
+ .addCase(resendNIDAuthOTP.fulfilled, function (state, action) {
910
+ state.data.nidData = action.payload.formData;
911
+ state.data.otpData.authFor = AuthForType.NATIONAL_ID;
912
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: action.payload.response });
913
+ })
914
+ .addCase(resendNIDAuthOTP.rejected, function (state, action) {
915
+ state.error = action.error.message;
801
916
  })
802
917
  .addCase(createCivilIdAuthAsync.pending, function (state) {
803
918
  state.loading = true;
@@ -842,6 +957,18 @@ export var connectSlice = createSlice({
842
957
  .addCase(createNIDAuthIdentityAsync.rejected, function (state, action) {
843
958
  state.loading = false;
844
959
  state.error = action.error.message;
960
+ })
961
+ .addCase(resendNIDAuthIdentityOTP.pending, function (state) {
962
+ state.error = null;
963
+ })
964
+ .addCase(resendNIDAuthIdentityOTP.fulfilled, function (state, action) {
965
+ var _a;
966
+ state.data.nidData = action.payload.formData;
967
+ state.data.otpData.authFor = AuthForType.NATIONAL_ID;
968
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload.response) });
969
+ })
970
+ .addCase(resendNIDAuthIdentityOTP.rejected, function (state, action) {
971
+ state.error = action.error.message;
845
972
  })
846
973
  .addCase(verifyMobileOtpAsync.pending, function (state) {
847
974
  state.loading = true;
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { AuthForType } from '../../../../@types';
21
- import { createNIDAuthIdentityAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
21
+ import { resendNIDAuthIdentityOTP, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
@@ -44,7 +44,7 @@ var OTPInput = function (_a) {
44
44
  var handleOnResendAbsherOTP = function () {
45
45
  if (otpControl.field.value)
46
46
  setValue('otp', '', { shouldValidate: true });
47
- dispatch(createNIDAuthIdentityAsync(nidData));
47
+ dispatch(resendNIDAuthIdentityOTP(nidData));
48
48
  };
49
49
  var otpValue = otpControl.field.value;
50
50
  return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isNidAuth ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { AuthForType } from '../../../../@types';
21
- import { createMobileAuthAsync, createNIDAuthAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
21
+ import { resendMobileAuthOTP, resendNIDAuthOTP, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
22
22
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
23
  var BoxStyled = styled(Box)(function (_a) {
24
24
  var theme = _a.theme;
@@ -42,12 +42,12 @@ var OTPInput = function (_a) {
42
42
  var handleOnResendOTP = function () {
43
43
  if (otpControl.field.value)
44
44
  setValue('otp', '', { shouldValidate: true });
45
- dispatch(createMobileAuthAsync(mobileData));
45
+ dispatch(resendMobileAuthOTP(mobileData));
46
46
  };
47
47
  var handleOnResendAbsherOTP = function () {
48
48
  if (otpControl.field.value)
49
49
  setValue('otp', '', { shouldValidate: true });
50
- dispatch(createNIDAuthAsync(nidData));
50
+ dispatch(resendNIDAuthOTP(nidData));
51
51
  };
52
52
  var otpValue = otpControl.field.value;
53
53
  return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isNidAuth ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.12-test",
3
+ "version": "2.3.16-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",