@tap-payments/auth-jsconnect 2.0.56-test → 2.0.57-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.
Files changed (32) hide show
  1. package/build/api/data.d.ts +16 -16
  2. package/build/api/index.d.ts +22 -7
  3. package/build/constants/app.d.ts +1 -0
  4. package/build/constants/app.js +4 -3
  5. package/build/constants/validation.d.ts +1 -1
  6. package/build/constants/validation.js +1 -1
  7. package/build/features/app/business/businessStore.d.ts +11 -1
  8. package/build/features/app/business/businessStore.js +106 -1
  9. package/build/features/app/connect/connectStore.js +47 -27
  10. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  11. package/build/features/business/screens/CivilID/CivilID.js +85 -0
  12. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  13. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  14. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  15. package/build/features/business/screens/CivilID/index.js +2 -0
  16. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  17. package/build/features/business/screens/CivilID/validation.js +4 -0
  18. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  19. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +162 -0
  20. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  21. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  22. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  23. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  24. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  25. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  26. package/build/features/connect/screens/CivilID/validation.js +1 -1
  27. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +9 -16
  28. package/build/utils/common.d.ts +1 -0
  29. package/build/utils/common.js +3 -0
  30. package/build/utils/index.d.ts +1 -0
  31. package/build/utils/index.js +1 -0
  32. package/package.json +1 -1
@@ -1,29 +1,29 @@
1
- export interface GetOccupationBody {
1
+ declare type GetOccupationBody = {
2
2
  page: number;
3
- }
4
- export interface GetMonthlyIncomeBody {
3
+ };
4
+ declare type GetMonthlyIncomeBody = {
5
5
  page: number;
6
6
  country_code: Array<string>;
7
- }
8
- export interface DataElementBody {
7
+ };
8
+ export declare type DataElementBody = {
9
9
  en: string;
10
10
  ar: string;
11
- }
12
- export interface GetCustomerBasesBody {
11
+ };
12
+ declare type GetCustomerBasesBody = {
13
13
  page: number;
14
- }
15
- export interface GetExpectedSalesBody {
14
+ };
15
+ declare type GetExpectedSalesBody = {
16
16
  page: number;
17
- }
18
- export interface GetExpectedCustomerSalesBody {
17
+ };
18
+ declare type GetExpectedCustomerSalesBody = {
19
19
  page: number;
20
- }
21
- export interface GetSourceOfIncomeBody {
20
+ };
21
+ declare type GetSourceOfIncomeBody = {
22
22
  page: number;
23
- }
24
- export interface GetChannelsOfServicesBody {
23
+ };
24
+ declare type GetChannelsOfServicesBody = {
25
25
  page: number;
26
- }
26
+ };
27
27
  declare const dataService: {
28
28
  getChannelsOfServices: (data: GetChannelsOfServicesBody) => Promise<any>;
29
29
  getCustomerBases: (data: GetCustomerBasesBody) => Promise<any>;
@@ -54,13 +54,28 @@ declare const API: {
54
54
  createAccount: (data: CreateAccountBody) => Promise<any>;
55
55
  };
56
56
  dataService: {
57
- getChannelsOfServices: (data: import("./data").GetChannelsOfServicesBody) => Promise<any>;
58
- getCustomerBases: (data: import("./data").GetCustomerBasesBody) => Promise<any>;
59
- getExpectedSales: (data: import("./data").GetExpectedSalesBody) => Promise<any>;
60
- getExpectedCustomerSales: (data: import("./data").GetExpectedCustomerSalesBody) => Promise<any>;
61
- getSourceOfIncome: (data: import("./data").GetSourceOfIncomeBody) => Promise<any>;
62
- getMonthlyIncome: (data: import("./data").GetMonthlyIncomeBody) => Promise<any>;
63
- getOccupation: (data: import("./data").GetOccupationBody) => Promise<any>;
57
+ getChannelsOfServices: (data: {
58
+ page: number;
59
+ }) => Promise<any>;
60
+ getCustomerBases: (data: {
61
+ page: number;
62
+ }) => Promise<any>;
63
+ getExpectedSales: (data: {
64
+ page: number;
65
+ }) => Promise<any>;
66
+ getExpectedCustomerSales: (data: {
67
+ page: number;
68
+ }) => Promise<any>;
69
+ getSourceOfIncome: (data: {
70
+ page: number;
71
+ }) => Promise<any>;
72
+ getMonthlyIncome: (data: {
73
+ page: number;
74
+ country_code: string[];
75
+ }) => Promise<any>;
76
+ getOccupation: (data: {
77
+ page: number;
78
+ }) => Promise<any>;
64
79
  };
65
80
  individualService: {
66
81
  retrieveIndividualInfo: (id: string) => Promise<any>;
@@ -98,6 +98,7 @@ export declare const BUSINESS_STEP_NAMES: {
98
98
  BUSINESS_INFO: string;
99
99
  PHONE_AUTH: string;
100
100
  IDENTITY_AUTH: string;
101
+ CREATE_AUTH_CIVIL_ID: string;
101
102
  IDENTITY_VERIFY_AUTH: string;
102
103
  BUSINESS_CR_INFO: string;
103
104
  BUSINESS_INFO_CONFIRM: string;
@@ -30,7 +30,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
30
30
  {
31
31
  name: 'CONNECT_MOBILE_STEP',
32
32
  next: 'CONNECT_OTP_STEP',
33
- prev: ['CONNECT_NID_STEP', 'CONNECT_ID_STEP', 'CONNECT_CIVIL_ID_STEP'],
33
+ prev: ['CONNECT_NID_STEP', 'CONNECT_CIVIL_ID_STEP'],
34
34
  order: 1
35
35
  },
36
36
  {
@@ -48,13 +48,13 @@ export var CONNECT_SCREENS_NAVIGATION = [
48
48
  {
49
49
  name: 'CONNECT_INDIVIDUAL_STEP',
50
50
  next: 'CONNECT_MERCHANT_INFO_STEP',
51
- prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP', 'CONNECT_ID_STEP'],
51
+ prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP', 'CONNECT_CIVIL_ID_STEP'],
52
52
  order: 3
53
53
  },
54
54
  {
55
55
  name: 'CONNECT_MERCHANT_INFO_STEP',
56
56
  next: 'CONNECT_THANK_YOU_STEP',
57
- prev: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_NID_STEP', 'CONNECT_MOBILE_STEP', 'CONNECT_ID_STEP'],
57
+ prev: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_NID_STEP', 'CONNECT_MOBILE_STEP', 'CONNECT_CIVIL_ID_STEP'],
58
58
  order: 4
59
59
  },
60
60
  {
@@ -415,6 +415,7 @@ export var BUSINESS_STEP_NAMES = {
415
415
  BUSINESS_INFO: 'business_info',
416
416
  PHONE_AUTH: 'business_phone_auth',
417
417
  IDENTITY_AUTH: 'business_identity_auth',
418
+ CREATE_AUTH_CIVIL_ID: 'business_create_auth_civil_id',
418
419
  IDENTITY_VERIFY_AUTH: 'business_identity_auth_verify',
419
420
  BUSINESS_CR_INFO: 'business_cr_info',
420
421
  BUSINESS_INFO_CONFIRM: 'business_info_confirm',
@@ -1,5 +1,5 @@
1
1
  export declare const ID_NUMBER_LENGTH = 10;
2
- export declare const CIVIL_ID_NUMBER_LENGTH = 15;
2
+ export declare const CIVIL_ID_NUMBER_LENGTH = 12;
3
3
  export declare const DEFAULT_TIMER_VALUE = 59;
4
4
  export declare const VAT_ID_LENGTH = 15;
5
5
  export declare const MAX_IBAN_VALUE = 34;
@@ -1,5 +1,5 @@
1
1
  export var ID_NUMBER_LENGTH = 10;
2
- export var CIVIL_ID_NUMBER_LENGTH = 15;
2
+ export var CIVIL_ID_NUMBER_LENGTH = 12;
3
3
  export var DEFAULT_TIMER_VALUE = 59;
4
4
  export var VAT_ID_LENGTH = 15;
5
5
  export var MAX_IBAN_VALUE = 34;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, SalesChannel } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, SalesChannel, CivilFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
@@ -18,6 +18,16 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
18
18
  };
19
19
  brandInfo: any;
20
20
  }, OTPFormValues, {}>;
21
+ interface verifyPACIParams {
22
+ onSuccess?: () => void | Promise<void>;
23
+ }
24
+ export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
25
+ response: any;
26
+ }, verifyPACIParams, {}>;
27
+ export declare const createCivilIdAuth: import("@reduxjs/toolkit").AsyncThunk<{
28
+ response: any;
29
+ formData: CivilFormValues;
30
+ }, CivilFormValues, {}>;
21
31
  export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
22
32
  data: any;
23
33
  formData: {
@@ -60,7 +60,7 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getEighteenYearsAgo, hasKey } from '../../../utils';
63
+ import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
@@ -249,6 +249,76 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
249
249
  }
250
250
  });
251
251
  }); });
252
+ export var verifyPACI = createAsyncThunk('verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
253
+ var _a, settings, connect, responseBody, expiry, interval, maxCalls, response, count, data, isSuccess;
254
+ var _b, _c;
255
+ return __generator(this, function (_d) {
256
+ switch (_d.label) {
257
+ case 0:
258
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
259
+ responseBody = connect.data.civilIdData.responseBody;
260
+ expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
261
+ interval = 5;
262
+ maxCalls = Math.floor(expiry / interval);
263
+ response = null;
264
+ if (thunkApi.signal.aborted) {
265
+ return [2, { response: null }];
266
+ }
267
+ count = 1;
268
+ _d.label = 1;
269
+ case 1:
270
+ if (!(count <= maxCalls)) return [3, 7];
271
+ return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
272
+ case 2:
273
+ data = _d.sent();
274
+ response = data;
275
+ if (count === 1) {
276
+ }
277
+ isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
278
+ if (!isSuccess) return [3, 4];
279
+ return [4, ((_c = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _c === void 0 ? void 0 : _c.call(params))];
280
+ case 3:
281
+ _d.sent();
282
+ _d.label = 4;
283
+ case 4: return [4, sleep(interval * 1000)];
284
+ case 5:
285
+ _d.sent();
286
+ _d.label = 6;
287
+ case 6:
288
+ count++;
289
+ return [3, 1];
290
+ case 7: return [2, { response: response }];
291
+ }
292
+ });
293
+ }); });
294
+ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
295
+ var settings, requestBody, data;
296
+ var _a, _b;
297
+ return __generator(this, function (_c) {
298
+ switch (_c.label) {
299
+ case 0:
300
+ settings = thunkApi.getState().settings;
301
+ requestBody = {
302
+ lang: settings.data.language,
303
+ user_credentail: {
304
+ identification_id: params.civilId,
305
+ country_code: 'KW'
306
+ },
307
+ sign_in: false,
308
+ step_name: BUSINESS_STEP_NAMES.CREATE_AUTH_CIVIL_ID,
309
+ encryption_contract: ['user_credentail.identification_id']
310
+ };
311
+ return [4, API.authService.createAuth(requestBody)];
312
+ case 1:
313
+ data = (_c.sent()).data;
314
+ if (!data.errors) {
315
+ thunkApi.dispatch(handleNextScreenStep());
316
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
317
+ }
318
+ return [2, { response: data, formData: params }];
319
+ }
320
+ });
321
+ }); });
252
322
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
253
323
  var _a, settings, business, identification_id_type, stepName, requestBody, data;
254
324
  var _b, _c, _d;
@@ -753,6 +823,41 @@ export var businessSlice = createSlice({
753
823
  .addCase(verifyLeadOTP.rejected, function (state, action) {
754
824
  state.loading = false;
755
825
  state.error = action.error.message;
826
+ })
827
+ .addCase(createCivilIdAuth.pending, function (state, action) {
828
+ state.loading = true;
829
+ state.error = null;
830
+ })
831
+ .addCase(createCivilIdAuth.fulfilled, function (state, action) {
832
+ var _a;
833
+ state.loading = false;
834
+ state.error = null;
835
+ var _b = action.payload, formData = _b.formData, response = _b.response;
836
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
837
+ if (description) {
838
+ state.error = description;
839
+ return;
840
+ }
841
+ })
842
+ .addCase(createCivilIdAuth.rejected, function (state, action) {
843
+ state.loading = false;
844
+ state.error = action.error.message;
845
+ })
846
+ .addCase(verifyPACI.pending, function (state) {
847
+ state.loading = true;
848
+ state.error = null;
849
+ })
850
+ .addCase(verifyPACI.fulfilled, function (state, action) {
851
+ state.loading = false;
852
+ state.error = null;
853
+ state.data.otpData.responseBody = action.payload.response;
854
+ })
855
+ .addCase(verifyPACI.rejected, function (state, action) {
856
+ state.loading = false;
857
+ var error = action.error.message;
858
+ if (error !== 'Aborted') {
859
+ state.error = error;
860
+ }
756
861
  })
757
862
  .addCase(updateLeadIdentity.pending, function (state) {
758
863
  state.loading = true;
@@ -61,7 +61,7 @@ import { FlowsTypes } from '../../../@types';
61
61
  import API from '../../../api';
62
62
  import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep } from '../../../utils';
65
65
  export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var settings, requestBody, data;
67
67
  var _a, _b;
@@ -105,7 +105,7 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
105
105
  },
106
106
  sign_in: false,
107
107
  step_name: CONNECT_STEP_NAMES.CREATE_AUTH_CIVIL_ID,
108
- encryption_contract: ['user_credentail.civil_id']
108
+ encryption_contract: ['user_credentail.identification_id']
109
109
  };
110
110
  return [4, API.authService.createAuth(requestBody)];
111
111
  case 1:
@@ -266,46 +266,63 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
266
266
  });
267
267
  }); });
268
268
  export var verifyPACI = createAsyncThunk('verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
269
- var _a, settings, connect, responseBody, data, params_3, params_4;
269
+ var _a, settings, connect, responseBody, expiry, interval, maxCalls, response, count, data, isSuccess, leadBody, leadBody;
270
270
  var _b, _c, _d, _e;
271
271
  return __generator(this, function (_f) {
272
272
  switch (_f.label) {
273
273
  case 0:
274
274
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
275
275
  responseBody = connect.data.civilIdData.responseBody;
276
- return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
276
+ expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
277
+ interval = 5;
278
+ maxCalls = Math.floor(expiry / interval);
279
+ response = null;
280
+ if (thunkApi.signal.aborted) {
281
+ return [2, { response: null }];
282
+ }
283
+ count = 1;
284
+ _f.label = 1;
277
285
  case 1:
286
+ if (!(count <= maxCalls)) return [3, 7];
287
+ return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
288
+ case 2:
278
289
  data = _f.sent();
279
- if (!(((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success')) return [3, 6];
290
+ response = data;
291
+ if (count === 1) {
292
+ thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id));
293
+ thunkApi.dispatch(retrieveChannels());
294
+ }
295
+ isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
296
+ if (!isSuccess) return [3, 4];
280
297
  return [4, ((_c = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _c === void 0 ? void 0 : _c.call(params))];
281
- case 2:
282
- _f.sent();
283
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
284
- if (!(responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user)) return [3, 3];
285
- params_3 = {
286
- leadId: data === null || data === void 0 ? void 0 : data.lead_id,
287
- stepName: 'CONNECT_INDIVIDUAL_STEP'
288
- };
289
- thunkApi.dispatch(retrieveLead(params_3));
290
- return [3, 6];
291
- case 3: return [4, thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id))];
292
- case 4:
293
- _f.sent();
294
- return [4, thunkApi.dispatch(retrieveChannels())];
295
- case 5:
298
+ case 3:
296
299
  _f.sent();
297
- if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
298
- params_4 = {
300
+ if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
301
+ leadBody = {
302
+ leadId: data === null || data === void 0 ? void 0 : data.lead_id,
303
+ stepName: 'CONNECT_INDIVIDUAL_STEP'
304
+ };
305
+ thunkApi.dispatch(retrieveLead(leadBody));
306
+ }
307
+ else if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
308
+ leadBody = {
299
309
  individualId: data === null || data === void 0 ? void 0 : data.individual_id,
300
310
  stepName: 'CONNECT_MERCHANT_INFO_STEP'
301
311
  };
302
- thunkApi.dispatch(createLead(params_4));
312
+ thunkApi.dispatch(createLead(leadBody));
303
313
  }
304
- else {
314
+ else
305
315
  thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
306
- }
316
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
317
+ return [3, 7];
318
+ case 4: return [4, sleep(interval * 1000)];
319
+ case 5:
320
+ _f.sent();
307
321
  _f.label = 6;
308
- case 6: return [2, { response: data }];
322
+ case 6:
323
+ count++;
324
+ return [3, 1];
325
+ case 7: return [2, { response: response }];
309
326
  }
310
327
  });
311
328
  }); });
@@ -676,7 +693,10 @@ export var connectSlice = createSlice({
676
693
  })
677
694
  .addCase(verifyPACI.rejected, function (state, action) {
678
695
  state.loading = false;
679
- state.error = action.error.message;
696
+ var error = action.error.message;
697
+ if (error !== 'Aborted') {
698
+ state.error = error;
699
+ }
680
700
  })
681
701
  .addCase(createNIDAuth.fulfilled, function (state, action) {
682
702
  var _a;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface CivilIDProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CivilIDProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,85 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { alpha, styled } from '@mui/material/styles';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { civilIDValidationSchema } from './validation';
19
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
+ import { settingsSelector, handlePrevScreenStep } from '../../../../app/settings';
21
+ import { clearError, businessSelector, createCivilIdAuth } from '../../../app/business/businessStore';
22
+ import Form from '../../../../components/Form';
23
+ import Button, { MobileButton } from '../../../shared/Button';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Collapse from '../../../../components/Collapse';
26
+ import Box from '@mui/material/Box';
27
+ import Divider from '@mui/material/Divider';
28
+ import Text from '../../../../components/Text';
29
+ import IDNumber from './IDNumber';
30
+ var FormStyled = styled(Form)(function () { return ({
31
+ display: 'flex',
32
+ flexDirection: 'column'
33
+ }); });
34
+ var TextStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return ({
37
+ color: alpha(theme.palette.primary.dark, 0.4)
38
+ });
39
+ });
40
+ var DividerStyled = styled(Divider)(function (_a) {
41
+ var theme = _a.theme;
42
+ return ({
43
+ width: '45%',
44
+ borderColor: alpha(theme.palette.primary.dark, 0.4),
45
+ marginBlockEnd: theme.spacing(0.62)
46
+ });
47
+ });
48
+ var OrBoxStyled = styled(Box)(function (_a) {
49
+ var theme = _a.theme;
50
+ return ({
51
+ display: 'flex',
52
+ justifyContent: 'space-between',
53
+ marginBlockEnd: theme.spacing(1.62),
54
+ marginBlockStart: theme.spacing(-1.25),
55
+ marginInline: theme.spacing(2.5)
56
+ });
57
+ });
58
+ var CivilID = function (_a) {
59
+ var isAr = useLanguage().isAr;
60
+ var dispatch = useAppDispatch();
61
+ var t = useTranslation().t;
62
+ var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
63
+ var settingsStore = useAppSelector(settingsSelector);
64
+ var methods = useForm({
65
+ resolver: yupResolver(civilIDValidationSchema),
66
+ defaultValues: {},
67
+ mode: 'onChange'
68
+ });
69
+ React.useEffect(function () {
70
+ handleClearError();
71
+ }, [methods.formState.isValid]);
72
+ var onSubmit = function (data) {
73
+ dispatch(createCivilIdAuth(data));
74
+ };
75
+ var handleClearError = function () {
76
+ if (error)
77
+ dispatch(clearError());
78
+ };
79
+ var onBack = function () {
80
+ dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
81
+ };
82
+ var disabled = !methods.formState.isValid || !!error;
83
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { sx: { mb: methods.formState.isValid ? 7.5 : 0, transition: 'mb 0.3s' } }), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] })) })) }));
84
+ };
85
+ export default React.memo(CivilID);
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ interface IDNumberProps {
4
+ sx: SxProps<Theme> | undefined;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
7
+ export default _default;
@@ -0,0 +1,59 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useController, useFormContext } from 'react-hook-form';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import Text from '../../../../components/Text';
19
+ import Input from '../../../shared/Input';
20
+ import ClearIcon from '../../../shared/ClearIcon';
21
+ import CheckIcon from '../../../shared/CheckIcon';
22
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
+ import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
24
+ import { CIVIL_ID_NUMBER_LENGTH } from '../../../../constants';
25
+ var LabelContainerStyled = styled(Box)(function (_a) {
26
+ var theme = _a.theme;
27
+ return ({
28
+ display: 'flex',
29
+ justifyContent: 'space-between',
30
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
31
+ });
32
+ });
33
+ var InputLabelStyled = styled(Text)(function (_a) {
34
+ var theme = _a.theme;
35
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
36
+ });
37
+ var IDNumber = React.forwardRef(function (_a, ref) {
38
+ var _b;
39
+ var sx = _a.sx;
40
+ var t = useTranslation().t;
41
+ var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
42
+ var civilIdControl = useController({ control: control, name: 'civilId' });
43
+ React.useEffect(function () {
44
+ if (civilIdControl.field.value)
45
+ setValue('civilId', civilIdControl.field.value, { shouldValidate: true });
46
+ }, []);
47
+ var handleIdChange = function (_a) {
48
+ var target = _a.target;
49
+ var value = removeAllOtherThanCharsAndNumber(target.value);
50
+ civilIdControl.field.onChange(value);
51
+ };
52
+ var clearIdNumber = function () {
53
+ civilIdControl.field.onChange('');
54
+ };
55
+ var idValue = civilIdControl.field.value;
56
+ var error = (_b = civilIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
57
+ return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: !error && idValue ? _jsx(CheckIcon, {}) : idValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
58
+ });
59
+ export default React.memo(IDNumber);
@@ -0,0 +1,3 @@
1
+ import CivilID, { CivilIDProps } from './CivilID';
2
+ export type { CivilIDProps };
3
+ export default CivilID;
@@ -0,0 +1,2 @@
1
+ import CivilID from './CivilID';
2
+ export default CivilID;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const civilIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,4 @@
1
+ import * as yup from 'yup';
2
+ export var civilIDValidationSchema = yup.object().shape({
3
+ civilId: yup.string().min(12, 'invalid_civil_id').required('invalid_civil_id')
4
+ });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface VerifyPACIProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,162 @@
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
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import Box from '@mui/material/Box/Box';
50
+ import { styled } from '@mui/material/styles';
51
+ import * as React from 'react';
52
+ import { useTranslation } from 'react-i18next';
53
+ import Text from '../../../../components/Text';
54
+ import { connectSelector, verifyPACI as verifyPACIFun } from '../../../app/connect/connectStore';
55
+ import { handlePrevScreenStep } from '../../../../app/settings';
56
+ import { ScreenContainer } from '../../../shared/Containers';
57
+ import { MobileButton } from '../../../shared/Button';
58
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
59
+ import Icon from '../../../../components/Icon';
60
+ import { mobileOS, sleep } from '../../../../utils';
61
+ import VerifyPACILoading from './VerifyPACILoading';
62
+ import VerifyPACISuccess from './VerifyPACISuccess';
63
+ var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
64
+ var theme = _a.theme;
65
+ return ({
66
+ direction: theme.direction,
67
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
68
+ display: 'flex',
69
+ flexDirection: 'column',
70
+ alignItems: 'center',
71
+ marginBottom: theme.spacing(2.5)
72
+ });
73
+ });
74
+ var VerifyPACITitleStyled = styled(Text)(function (_a) {
75
+ var theme = _a.theme;
76
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
77
+ });
78
+ var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
79
+ var theme = _a.theme;
80
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line', textAlign: 'center' }));
81
+ });
82
+ var Container = styled(Box)(function (_a) {
83
+ var theme = _a.theme;
84
+ return ({
85
+ position: 'relative',
86
+ display: 'flex',
87
+ justifyContent: 'center',
88
+ alignItems: 'center',
89
+ maxHeight: '300px'
90
+ });
91
+ });
92
+ var IconStyled = styled(Icon)(function (_a) {
93
+ var theme = _a.theme;
94
+ return ({
95
+ position: 'absolute',
96
+ top: '50%',
97
+ left: '50%',
98
+ transform: 'translate(-50%, -50%)',
99
+ width: 64,
100
+ height: 64
101
+ });
102
+ });
103
+ var BackButton = styled('button')(function (_a) {
104
+ var theme = _a.theme;
105
+ return ({
106
+ cursor: 'pointer',
107
+ height: 44,
108
+ appearance: 'none',
109
+ background: 'none',
110
+ border: 'none',
111
+ color: theme.palette.primary.main,
112
+ fontSize: theme.typography.body1.fontSize,
113
+ fontWeight: theme.typography.fontWeightMedium,
114
+ textTransform: 'capitalize',
115
+ '&:hover': {
116
+ backgroundColor: 'transparent'
117
+ }
118
+ });
119
+ });
120
+ var VerifyPACI = function () {
121
+ var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
122
+ var dispatch = useAppDispatch();
123
+ var data = useAppSelector(connectSelector).data;
124
+ var responseBody = data.civilIdData.responseBody;
125
+ var t = useTranslation().t;
126
+ var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
127
+ return __generator(this, function (_a) {
128
+ switch (_a.label) {
129
+ case 0:
130
+ setSuccess(true);
131
+ return [4, sleep(2000)];
132
+ case 1:
133
+ _a.sent();
134
+ return [2];
135
+ }
136
+ });
137
+ }); };
138
+ React.useEffect(function () {
139
+ var promise = null;
140
+ if (responseBody)
141
+ promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
142
+ return function () {
143
+ promise === null || promise === void 0 ? void 0 : promise.abort();
144
+ };
145
+ }, [responseBody]);
146
+ var onRedirect = React.useCallback(function () {
147
+ if (os === 'Android') {
148
+ window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
149
+ }
150
+ if (os === 'iOS') {
151
+ window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
152
+ }
153
+ }, [responseBody]);
154
+ var onBack = React.useCallback(function () {
155
+ dispatch(handlePrevScreenStep());
156
+ }, []);
157
+ var os = React.useMemo(function () { return mobileOS(); }, []);
158
+ var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
159
+ var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
160
+ return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, {}) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
161
+ };
162
+ export default React.memo(VerifyPACI);
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface VerifyPACILoadingProps {
3
+ }
4
+ declare const _default: React.NamedExoticComponent<VerifyPACILoadingProps>;
5
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
5
+ import { ICONS_NAMES } from '../../../../constants';
6
+ import Icon from '../../../../components/Icon';
7
+ var IconStyled = styled(Icon)(function (_a) {
8
+ var theme = _a.theme;
9
+ return ({
10
+ position: 'absolute',
11
+ top: '50%',
12
+ left: '50%',
13
+ transform: 'translate(-50%, -50%)',
14
+ width: 64,
15
+ height: 64
16
+ });
17
+ });
18
+ var VerifyPACILoading = function () {
19
+ return (_jsxs(_Fragment, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }));
20
+ };
21
+ VerifyPACILoading.defaultProps = {};
22
+ export default memo(VerifyPACILoading);
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface VerifyPACISuccessProps {
3
+ }
4
+ declare const _default: React.NamedExoticComponent<VerifyPACISuccessProps>;
5
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
4
+ var VerifyPACISuccess = function () {
5
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { loop: false, file: LottieAnimationFiles.success, width: '90%' }) }));
6
+ };
7
+ VerifyPACISuccess.defaultProps = {};
8
+ export default memo(VerifyPACISuccess);
@@ -0,0 +1,3 @@
1
+ import VerifyPACI, { VerifyPACIProps } from './VerifyPACI';
2
+ export type { VerifyPACIProps };
3
+ export default VerifyPACI;
@@ -0,0 +1,2 @@
1
+ import VerifyPACI from './VerifyPACI';
2
+ export default VerifyPACI;
@@ -1,4 +1,4 @@
1
1
  import * as yup from 'yup';
2
2
  export var civilIDValidationSchema = yup.object().shape({
3
- civilId: yup.string().min(10, 'invalid_civil_id').max(20, 'invalid_civil_id').required('invalid_civil_id')
3
+ civilId: yup.string().min(12, 'invalid_civil_id').required('invalid_civil_id')
4
4
  });
@@ -57,7 +57,7 @@ import { ScreenContainer } from '../../../shared/Containers';
57
57
  import { MobileButton } from '../../../shared/Button';
58
58
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
59
59
  import Icon from '../../../../components/Icon';
60
- import { mobileOS } from '../../../../utils';
60
+ import { mobileOS, sleep } from '../../../../utils';
61
61
  import VerifyPACILoading from './VerifyPACILoading';
62
62
  import VerifyPACISuccess from './VerifyPACISuccess';
63
63
  var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
@@ -126,12 +126,9 @@ var VerifyPACI = function () {
126
126
  var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
127
127
  return __generator(this, function (_a) {
128
128
  switch (_a.label) {
129
- case 0: return [4, new Promise(function (resolve) {
130
- setSuccess(true);
131
- setTimeout(function () {
132
- resolve('success');
133
- }, 1000);
134
- })];
129
+ case 0:
130
+ setSuccess(true);
131
+ return [4, sleep(2000)];
135
132
  case 1:
136
133
  _a.sent();
137
134
  return [2];
@@ -139,16 +136,12 @@ var VerifyPACI = function () {
139
136
  });
140
137
  }); };
141
138
  React.useEffect(function () {
139
+ var promise = null;
142
140
  if (responseBody)
143
- dispatch(verifyPACIFun({ onSuccess: onSuccess }));
144
- var interval = setInterval(function () {
145
- if (responseBody)
146
- dispatch(verifyPACIFun({ onSuccess: onSuccess }));
147
- }, 10000);
148
- setTimeout(function () {
149
- clearInterval(interval);
150
- }, ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120) * 1000);
151
- return function () { return clearInterval(interval); };
141
+ promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
142
+ return function () {
143
+ promise === null || promise === void 0 ? void 0 : promise.abort();
144
+ };
152
145
  }, [responseBody]);
153
146
  var onRedirect = React.useCallback(function () {
154
147
  if (os === 'Android') {
@@ -0,0 +1 @@
1
+ export declare const sleep: (milliseconds: number) => Promise<unknown>;
@@ -0,0 +1,3 @@
1
+ export var sleep = function (milliseconds) {
2
+ return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
3
+ };
@@ -7,3 +7,4 @@ export * from './validation';
7
7
  export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
+ export * from './common';
@@ -7,3 +7,4 @@ export * from './validation';
7
7
  export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
+ export * from './common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.56-test",
3
+ "version": "2.0.57-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",