@tap-payments/auth-jsconnect 2.0.36 → 2.0.37

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 (26) hide show
  1. package/build/api/auth.d.ts +4 -3
  2. package/build/constants/validation.js +1 -1
  3. package/build/features/app/auth/authStore.d.ts +0 -1
  4. package/build/features/app/auth/authStore.js +25 -24
  5. package/build/features/app/business/businessStore.js +6 -6
  6. package/build/features/app/connect/connectStore.d.ts +2 -1
  7. package/build/features/app/connect/connectStore.js +95 -54
  8. package/build/features/app/entity/entityStore.js +2 -2
  9. package/build/features/app/individual/individualStore.d.ts +1 -0
  10. package/build/features/app/individual/individualStore.js +3 -2
  11. package/build/features/auth/screens/NID/NID.js +3 -3
  12. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  13. package/build/features/business/screens/Success/Success.js +10 -3
  14. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  15. package/build/features/connect/screens/CivilID/CivilID.js +4 -1
  16. package/build/features/connect/screens/Individual/Individual.js +4 -2
  17. package/build/features/connect/screens/Merchant/Merchant.js +1 -1
  18. package/build/features/connect/screens/Mobile/Mobile.js +4 -1
  19. package/build/features/connect/screens/NID/NID.js +4 -1
  20. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  21. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  22. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  23. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  24. package/build/utils/array.d.ts +36 -0
  25. package/build/utils/array.js +32 -0
  26. package/package.json +129 -129
@@ -8,10 +8,10 @@ export declare type EmailCredential = {
8
8
  email: string;
9
9
  };
10
10
  export declare type IDCredential = {
11
- country_code: string;
11
+ country_code?: string;
12
12
  identification_id: string;
13
- identification_id_type: string;
14
- date_of_birth: string;
13
+ identification_id_type?: string;
14
+ date_of_birth?: string;
15
15
  };
16
16
  export declare type CivilID = {
17
17
  identification_id: string;
@@ -26,6 +26,7 @@ export declare type CreateAuthBody = {
26
26
  step_name?: string;
27
27
  encryption_contract: Array<string>;
28
28
  lang?: LanguageMode;
29
+ lead_id?: string;
29
30
  };
30
31
  export declare type VerifyAuthBody = {
31
32
  auth_token: string;
@@ -18,7 +18,7 @@ export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa
18
18
  export var REGEX_ALPHANUMERIC = /^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/? ]*$/g;
19
19
  export var REGEX_BRAND_NAME = /^(([a-zA-Z0-9])+\s)*[a-zA-Z0-9]+$/;
20
20
  export var EMAIL_MAX_LENGTH = 50;
21
- export var LINKEDIN_URL = /^((http|https):\/\/)(www.linkedin.com\/)in(\/)[a-zA-Z0-9-\/]+$/;
21
+ export var LINKEDIN_URL = /[a-zA-Z0-9-\/:._]+$/;
22
22
  export var SOCIAL_USERNAME = /^[A-Za-z-0-9\d._]{3,}$/;
23
23
  export var DIGITS_ONLY = /^\d+$/;
24
24
  export var REGEX_PHONE_APP_NAME = /^[a-zA-Z0-9[._-]*$/;
@@ -20,7 +20,6 @@ export interface AuthData extends ResponseData {
20
20
  device_token?: string;
21
21
  service_name?: string;
22
22
  dob: string;
23
- type: string;
24
23
  countryISOCode: string;
25
24
  }
26
25
  export interface AuthState extends SharedState<AuthData> {
@@ -83,30 +83,30 @@ export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params
83
83
  });
84
84
  }); });
85
85
  export var createAuth = createAsyncThunk('authCreateAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
86
- var _a, auth, settings, _b, type, countryISOCode, nid, dob, identification_id_type, requestBody, data;
87
- return __generator(this, function (_c) {
88
- switch (_c.label) {
86
+ var _a, auth, settings, _b, responseBody, leadId, nid, dob, identification_id_type, requestBody, data;
87
+ var _c;
88
+ return __generator(this, function (_d) {
89
+ switch (_d.label) {
89
90
  case 0:
90
91
  _a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
91
- _b = auth.data, type = _b.type, countryISOCode = _b.countryISOCode;
92
+ _b = auth.data, responseBody = _b.responseBody, leadId = _b.leadId;
92
93
  nid = params.nid, dob = params.dob;
93
- identification_id_type = type
94
- ? type
94
+ identification_id_type = ((_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _c === void 0 ? void 0 : _c.id)
95
+ ? undefined
95
96
  : params.nid.startsWith('1')
96
97
  ? IDENTIFICATION_TYPE.NID
97
98
  : IDENTIFICATION_TYPE.IQAMA;
98
99
  requestBody = {
99
100
  lang: settings.data.language,
101
+ lead_id: leadId,
100
102
  user_credentail: {
101
103
  identification_id: nid,
102
104
  identification_id_type: identification_id_type,
103
- date_of_birth: dob,
104
- country_code: countryISOCode || settings.data.businessCountry.iso2
105
+ date_of_birth: !(responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth) ? dob : undefined
105
106
  },
106
107
  sign_in: false,
107
108
  is_lead: false,
108
109
  encryption_contract: [
109
- 'user_credentail.country_code',
110
110
  'user_credentail.identification_id',
111
111
  'user_credentail.identification_id_type',
112
112
  'user_credentail.date_of_birth'
@@ -114,32 +114,36 @@ export var createAuth = createAsyncThunk('authCreateAuth', function (params, thu
114
114
  };
115
115
  return [4, API.authService.createAuthKitNID(requestBody)];
116
116
  case 1:
117
- data = _c.sent();
117
+ data = _d.sent();
118
118
  thunkApi.dispatch(handleNextScreenStep());
119
119
  return [2, { data: data, formData: params }];
120
120
  }
121
121
  });
122
122
  }); });
123
123
  export var resendOTP = createAsyncThunk('authResendOTP', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
124
- var _a, auth, settings, _b, nid, dob, type, countryISOCode, identification_id_type, requestBody, data;
125
- return __generator(this, function (_c) {
126
- switch (_c.label) {
124
+ var _a, auth, settings, _b, nid, dob, responseBody, leadId, identification_id_type, requestBody, data;
125
+ var _c;
126
+ return __generator(this, function (_d) {
127
+ switch (_d.label) {
127
128
  case 0:
128
129
  _a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
129
- _b = auth.data, nid = _b.nid, dob = _b.dob, type = _b.type, countryISOCode = _b.countryISOCode;
130
- identification_id_type = type ? type : nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
130
+ _b = auth.data, nid = _b.nid, dob = _b.dob, responseBody = _b.responseBody, leadId = _b.leadId;
131
+ identification_id_type = ((_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _c === void 0 ? void 0 : _c.id)
132
+ ? undefined
133
+ : nid.startsWith('1')
134
+ ? IDENTIFICATION_TYPE.NID
135
+ : IDENTIFICATION_TYPE.IQAMA;
131
136
  requestBody = {
132
137
  lang: settings.data.language,
138
+ lead_id: leadId,
133
139
  user_credentail: {
134
140
  identification_id: nid,
135
141
  identification_id_type: identification_id_type,
136
- date_of_birth: dob,
137
- country_code: countryISOCode || settings.data.businessCountry.iso2
142
+ date_of_birth: !(responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth) ? dob : undefined
138
143
  },
139
144
  sign_in: false,
140
145
  is_lead: false,
141
146
  encryption_contract: [
142
- 'user_credentail.country_code',
143
147
  'user_credentail.identification_id',
144
148
  'user_credentail.identification_id_type',
145
149
  'user_credentail.date_of_birth'
@@ -147,7 +151,7 @@ export var resendOTP = createAsyncThunk('authResendOTP', function (_, thunkApi)
147
151
  };
148
152
  return [4, API.authService.createAuthKitNID(requestBody)];
149
153
  case 1:
150
- data = _c.sent();
154
+ data = _d.sent();
151
155
  return [2, data];
152
156
  }
153
157
  });
@@ -164,7 +168,6 @@ var initialState = {
164
168
  nid: '',
165
169
  termAndConditionChecked: false,
166
170
  dob: getEighteenYearsAgo(),
167
- type: '',
168
171
  countryISOCode: ''
169
172
  }
170
173
  };
@@ -197,14 +200,12 @@ export var authSlice = createSlice({
197
200
  state.error = null;
198
201
  })
199
202
  .addCase(retrieveLead.fulfilled, function (state, action) {
200
- var _a, _b, _c;
203
+ var _a;
201
204
  state.customLoading = false;
202
205
  state.error = null;
203
206
  var data = action.payload;
204
207
  state.data.nid = (_a = data === null || data === void 0 ? void 0 : data.identification) === null || _a === void 0 ? void 0 : _a.id;
205
- state.data.dob = data === null || data === void 0 ? void 0 : data.date_of_birth;
206
- state.data.type = (_b = data === null || data === void 0 ? void 0 : data.identification) === null || _b === void 0 ? void 0 : _b.type;
207
- state.data.countryISOCode = ((_c = data === null || data === void 0 ? void 0 : data.identification) === null || _c === void 0 ? void 0 : _c.issued_country_code) || (data === null || data === void 0 ? void 0 : data.country_code);
208
+ state.data.countryISOCode = data === null || data === void 0 ? void 0 : data.country_code;
208
209
  state.data.responseBody = data;
209
210
  })
210
211
  .addCase(retrieveLead.rejected, function (state, action) {
@@ -220,7 +220,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
220
220
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
221
221
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
222
222
  isIdentityAuthStep = data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH;
223
- if (!(isSA(countryIso2) && !isIdentityAuthStep)) return [3, 4];
223
+ if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
224
224
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
225
225
  case 3:
226
226
  _j.sent();
@@ -773,7 +773,7 @@ export var businessSlice = createSlice({
773
773
  var _a;
774
774
  return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return activity.id === value.id; });
775
775
  });
776
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities[0]) ? [activities === null || activities === void 0 ? void 0 : activities[0]] : [];
776
+ var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
777
777
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
778
778
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
779
779
  state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
@@ -1022,7 +1022,7 @@ export var businessSlice = createSlice({
1022
1022
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
1023
1023
  }
1024
1024
  var activities = entity_activities || [];
1025
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
1025
+ var selectedActivity = activities[0];
1026
1026
  if (!!selectedActivity)
1027
1027
  state.data.activitiesData.activities = [selectedActivity];
1028
1028
  state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
@@ -1055,10 +1055,7 @@ export var businessSlice = createSlice({
1055
1055
  state.error = null;
1056
1056
  var _a = action.payload, data = _a.data, formData = _a.formData;
1057
1057
  state.data.activitiesData = formData;
1058
- console.log('updateActivitiesInfo', state.data.activitiesData.responseBody);
1059
- console.log('updateActivitiesInfo', data);
1060
1058
  state.data.activitiesData.responseBody = __assign(__assign({}, data), state.data.activitiesData.responseBody);
1061
- console.log('updateActivitiesInfo', state.data.activitiesData.responseBody);
1062
1059
  })
1063
1060
  .addCase(updateActivitiesInfo.rejected, function (state, action) {
1064
1061
  state.loading = false;
@@ -1109,6 +1106,7 @@ export var businessSlice = createSlice({
1109
1106
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
1110
1107
  var _a, _b;
1111
1108
  state.loading = false;
1109
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateLeadSuccessLoading: false });
1112
1110
  state.error = null;
1113
1111
  var response = (action.payload || {}).response;
1114
1112
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -1120,10 +1118,12 @@ export var businessSlice = createSlice({
1120
1118
  })
1121
1119
  .addCase(updateLeadSuccess.pending, function (state) {
1122
1120
  state.loading = true;
1121
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateLeadSuccessLoading: true });
1123
1122
  state.error = null;
1124
1123
  })
1125
1124
  .addCase(updateLeadSuccess.rejected, function (state, action) {
1126
1125
  state.loading = false;
1126
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateLeadSuccessLoading: false });
1127
1127
  state.error = action.error.message;
1128
1128
  });
1129
1129
  }
@@ -96,8 +96,9 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectState
96
96
  resetIndividualScreen: (state: ConnectState) => void;
97
97
  resetMerchantScreen: (state: ConnectState) => void;
98
98
  setDefaultCountryCode: (state: ConnectState, action: ActionState<CountryCode>) => void;
99
+ resetStore: (state: ConnectState) => void;
99
100
  }, "connect/store">;
100
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMerchantScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>;
101
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMerchantScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>;
101
102
  declare const _default: import("redux").Reducer<ConnectState, import("redux").AnyAction>;
102
103
  export default _default;
103
104
  export declare const connectSelector: (state: RootState) => ConnectState;
@@ -56,6 +56,15 @@ var __rest = (this && this.__rest) || function (s, e) {
56
56
  }
57
57
  return t;
58
58
  };
59
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
60
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
61
+ if (ar || !(i in from)) {
62
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
63
+ ar[i] = from[i];
64
+ }
65
+ }
66
+ return to.concat(ar || Array.prototype.slice.call(from));
67
+ };
59
68
  var _a;
60
69
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
70
  import { handleNextScreenStep } from '../../../app/settings';
@@ -63,7 +72,7 @@ import { FlowsTypes, AuthForType } from '../../../@types';
63
72
  import API from '../../../api';
64
73
  import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_BRAND } from '../../../constants';
65
74
  import { defaultCountry } from '../../../constants';
66
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isTwitter, isWebsite } from '../../../utils';
75
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isTwitter, isWebsite, fixBrandList } from '../../../utils';
67
76
  export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
68
77
  var settings, requestBody, data;
69
78
  var _a, _b;
@@ -217,7 +226,7 @@ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thu
217
226
  });
218
227
  }); });
219
228
  export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
220
- var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, individual_id, leadBody, leadResponse, _c, isNewUser, brands, err_1, channels, countryCode, contact, name, _d, phone, email, userInfoMissed;
229
+ var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, individual_id, leadBody, leadResponse, _c, isNewUser, channels, brands, err_1, countryCode, contact, name, _d, phone, email, userInfoMissed;
221
230
  var _e, _f, _g, _h;
222
231
  return __generator(this, function (_j) {
223
232
  switch (_j.label) {
@@ -263,24 +272,23 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
263
272
  if ((_f = leadResponse.errors) === null || _f === void 0 ? void 0 : _f.length)
264
273
  throw new Error(leadResponse.errors[0].description);
265
274
  isNewUser = leadResponse.is_new_individual;
266
- if (!!isNewUser) return [3, 11];
267
- _j.label = 6;
275
+ if (!!isNewUser) return [3, 10];
276
+ return [4, API.dataService.getChannelsOfServices({ page: 0 })];
268
277
  case 6:
269
- _j.trys.push([6, 8, , 9]);
270
- return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
278
+ channels = (_j.sent()).list;
279
+ leadResponse.channel_list = channels;
280
+ _j.label = 7;
271
281
  case 7:
272
- brands = (_j.sent()).brands;
273
- leadResponse.brand_list = brands;
274
- return [3, 9];
282
+ _j.trys.push([7, 9, , 10]);
283
+ return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
275
284
  case 8:
285
+ brands = (_j.sent()).brands;
286
+ leadResponse.brand_list = fixBrandList(brands, channels);
287
+ return [3, 10];
288
+ case 9:
276
289
  err_1 = _j.sent();
277
- return [3, 9];
278
- case 9: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
290
+ return [3, 10];
279
291
  case 10:
280
- channels = (_j.sent()).list;
281
- leadResponse.channel_list = channels;
282
- _j.label = 11;
283
- case 11:
284
292
  countryCode = settings.data.businessCountry;
285
293
  contact = leadResponse.contact, name = leadResponse.name;
286
294
  _d = contact || {}, phone = _d.phone, email = _d.email;
@@ -298,7 +306,7 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
298
306
  });
299
307
  }); });
300
308
  export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
301
- var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, individual_id, leadBody, leadResponse, _b, isNewUser, countryCode, contact, name_1, _c, phone, email, userInfoMissed, brands, err_2, channels;
309
+ var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, individual_id, leadBody, leadResponse, _b, isNewUser, countryCode, contact, name_1, _c, phone, email, userInfoMissed, channels, brands, err_2;
302
310
  var _d, _e, _f, _g, _h;
303
311
  return __generator(this, function (_j) {
304
312
  switch (_j.label) {
@@ -311,15 +319,15 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
311
319
  count = 1;
312
320
  _j.label = 1;
313
321
  case 1:
314
- if (!(count <= maxCalls)) return [3, 17];
322
+ if (!(count <= maxCalls)) return [3, 16];
315
323
  if (thunkApi.signal.aborted) {
316
- return [3, 17];
324
+ return [3, 16];
317
325
  }
318
326
  return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
319
327
  case 2:
320
328
  authResponse = _j.sent();
321
329
  isSuccess = ((_d = authResponse.status) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === 'success';
322
- if (!isSuccess) return [3, 14];
330
+ if (!isSuccess) return [3, 13];
323
331
  return [4, ((_e = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _e === void 0 ? void 0 : _e.call(params))];
324
332
  case 3:
325
333
  _j.sent();
@@ -346,24 +354,23 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
346
354
  contact = leadResponse.contact, name_1 = leadResponse.name;
347
355
  _c = contact || {}, phone = _c.phone, email = _c.email;
348
356
  userInfoMissed = (!phone || !email || !name_1) && !isNewUser;
349
- if (!!isNewUser) return [3, 13];
350
- _j.label = 8;
357
+ if (!!isNewUser) return [3, 12];
358
+ return [4, API.dataService.getChannelsOfServices({ page: 0 })];
351
359
  case 8:
352
- _j.trys.push([8, 10, , 11]);
353
- return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
360
+ channels = (_j.sent()).list;
361
+ leadResponse.channel_list = channels;
362
+ _j.label = 9;
354
363
  case 9:
355
- brands = (_j.sent()).brands;
356
- leadResponse.brand_list = brands;
357
- return [3, 11];
364
+ _j.trys.push([9, 11, , 12]);
365
+ return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
358
366
  case 10:
367
+ brands = (_j.sent()).brands;
368
+ leadResponse.brand_list = fixBrandList(brands, channels);
369
+ return [3, 12];
370
+ case 11:
359
371
  err_2 = _j.sent();
360
- return [3, 11];
361
- case 11: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
372
+ return [3, 12];
362
373
  case 12:
363
- channels = (_j.sent()).list;
364
- leadResponse.channel_list = channels;
365
- _j.label = 13;
366
- case 13:
367
374
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
368
375
  countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
369
376
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, {});
@@ -373,14 +380,14 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
373
380
  }
374
381
  thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
375
382
  return [2, { authResponse: authResponse, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
376
- case 14: return [4, sleep(interval * 1000)];
377
- case 15:
383
+ case 13: return [4, sleep(interval * 1000)];
384
+ case 14:
378
385
  _j.sent();
379
- _j.label = 16;
380
- case 16:
386
+ _j.label = 15;
387
+ case 15:
381
388
  count++;
382
389
  return [3, 1];
383
- case 17: throw new Error('paci_verification_failed');
390
+ case 16: throw new Error('paci_verification_failed');
384
391
  }
385
392
  });
386
393
  }); });
@@ -425,13 +432,14 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
425
432
  });
426
433
  }); });
427
434
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
428
- var _a, settings, connect, responseBody, isNewBrand, brandName, salesChannels, selectedBrandItem, getAddress, channel_services, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
435
+ var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
429
436
  var _b, _c, _d, _e, _f;
430
437
  return __generator(this, function (_g) {
431
438
  switch (_g.label) {
432
439
  case 0:
433
440
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
434
441
  responseBody = connect.data.otpData.responseBody;
442
+ leadBrandId = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand_id;
435
443
  isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem;
436
444
  getAddress = function (value, isTwitter, isWeb) {
437
445
  if (isTwitter)
@@ -450,20 +458,33 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
450
458
  })
451
459
  };
452
460
  });
453
- if (!!isNewBrand) return [3, 2];
461
+ if (!!isNewBrand) return [3, 4];
462
+ if (!(leadBrandId !== (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id))) return [3, 2];
463
+ payload_1 = {
464
+ brand: {
465
+ id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || ''
466
+ },
467
+ id: (responseBody === null || responseBody === void 0 ? void 0 : responseBody.lead_id) || '',
468
+ step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_BRAND
469
+ };
470
+ return [4, API.leadService.updateLead(payload_1)];
471
+ case 1:
472
+ _g.sent();
473
+ _g.label = 2;
474
+ case 2:
454
475
  brandReqBody_1 = {
455
476
  id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || '',
456
477
  channel_services: channel_services,
457
478
  step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
458
479
  };
459
480
  return [4, API.brandService.updateBrandInfo(brandReqBody_1)];
460
- case 1:
481
+ case 3:
461
482
  brand_1 = _g.sent();
462
483
  thunkApi.dispatch(updateLeadSuccess());
463
484
  thunkApi.dispatch(handleNextScreenStep());
464
485
  (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, params);
465
486
  return [2, { response: brand_1, formData: params }];
466
- case 2:
487
+ case 4:
467
488
  brandNameBody = {
468
489
  name: {
469
490
  en: brandName,
@@ -478,8 +499,12 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
478
499
  encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
479
500
  };
480
501
  return [4, API.leadService.updateLead(payload)];
481
- case 3:
502
+ case 5:
482
503
  lead = _g.sent();
504
+ if (!lead.brand) {
505
+ console.error('Internal server error: brand is not created');
506
+ throw new Error('Internal server error');
507
+ }
483
508
  brandReqBody = {
484
509
  id: ((_d = lead.brand) === null || _d === void 0 ? void 0 : _d.id) || '',
485
510
  channel_services: channel_services,
@@ -487,7 +512,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
487
512
  step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
488
513
  };
489
514
  return [4, API.brandService.updateBrandInfo(brandReqBody)];
490
- case 4:
515
+ case 6:
491
516
  brand = _g.sent();
492
517
  thunkApi.dispatch(updateLeadSuccess());
493
518
  thunkApi.dispatch(handleNextScreenStep());
@@ -635,6 +660,10 @@ export var connectSlice = createSlice({
635
660
  setDefaultCountryCode: function (state, action) {
636
661
  state.data.mobileData.countryCode = action.payload;
637
662
  state.data.individualData.countryCode = action.payload;
663
+ },
664
+ resetStore: function (state) {
665
+ var countryCode = state.data.mobileData.countryCode;
666
+ state.data = __assign(__assign({}, initialState.data), { mobileData: __assign(__assign({}, initialState.data.mobileData), { countryCode: countryCode }), individualData: __assign(__assign({}, initialState.data.individualData), { countryCode: countryCode }) });
638
667
  }
639
668
  },
640
669
  extraReducers: function (builder) {
@@ -725,13 +754,21 @@ export var connectSlice = createSlice({
725
754
  if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
726
755
  state.data.brandData.brandName = brand.name.en;
727
756
  if (!isNewUser) {
757
+ var brandList = [];
758
+ if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
759
+ var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
760
+ brandList = __spreadArray([], brand_list, true);
761
+ if (!isBrandExist && brand)
762
+ brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
763
+ brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
764
+ state.data.brandData.selectedBrandItem = brandList[0];
765
+ }
728
766
  state.data.brandData.responseBody = {
729
- brand_list: (brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) ? brand_list.concat(OTHER_BRAND) : [],
767
+ brand_list: brandList,
730
768
  channel_list: channel_list
731
769
  };
732
- state.data.brandData.selectedBrandItem = (brand_list === null || brand_list === void 0 ? void 0 : brand_list[0]) || {};
733
770
  }
734
- state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, name: name, contact: contact, userInfoMissed: userInfoMissed });
771
+ state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact, userInfoMissed: userInfoMissed });
735
772
  })
736
773
  .addCase(verifyPACI.rejected, function (state, action) {
737
774
  state.loading = false;
@@ -761,13 +798,21 @@ export var connectSlice = createSlice({
761
798
  if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
762
799
  state.data.brandData.brandName = brand.name.en;
763
800
  if (!isNewUser) {
801
+ var brandList = [];
802
+ if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
803
+ var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
804
+ brandList = __spreadArray([], brand_list, true);
805
+ if (!isBrandExist && brand)
806
+ brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: [] })], false);
807
+ brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
808
+ state.data.brandData.selectedBrandItem = brandList[0];
809
+ }
764
810
  state.data.brandData.responseBody = {
765
- brand_list: (brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) ? brand_list.concat(OTHER_BRAND) : [],
811
+ brand_list: brandList,
766
812
  channel_list: channel_list
767
813
  };
768
- state.data.brandData.selectedBrandItem = (brand_list === null || brand_list === void 0 ? void 0 : brand_list[0]) || {};
769
814
  }
770
- state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, name: name, contact: contact, userInfoMissed: userInfoMissed });
815
+ state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact, userInfoMissed: userInfoMissed });
771
816
  })
772
817
  .addCase(verifyAuth.pending, function (state) {
773
818
  state.loading = true;
@@ -831,10 +876,6 @@ export var connectSlice = createSlice({
831
876
  });
832
877
  state.data.brandData.termAndConditionChecked = !!termAndCondition;
833
878
  }
834
- if (brand_list) {
835
- state.data.brandData.responseBody = { brand_list: brand_list.concat(OTHER_BRAND) };
836
- state.data.brandData.selectedBrandItem = brand_list[0];
837
- }
838
879
  if (channel_list) {
839
880
  state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { channel_list: channel_list });
840
881
  }
@@ -911,6 +952,6 @@ export var connectSlice = createSlice({
911
952
  });
912
953
  }
913
954
  });
914
- export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, setDefaultCountryCode = _a.setDefaultCountryCode;
955
+ export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setDefaultCountryCode = _a.setDefaultCountryCode;
915
956
  export default connectSlice.reducer;
916
957
  export var connectSelector = function (state) { return state.connect; };
@@ -391,7 +391,7 @@ export var entitySlice = createSlice({
391
391
  var _a;
392
392
  return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
393
393
  });
394
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities[0]) ? [activities === null || activities === void 0 ? void 0 : activities[0]] : [];
394
+ var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
395
395
  state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
396
396
  state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities });
397
397
  })
@@ -450,7 +450,7 @@ export var entitySlice = createSlice({
450
450
  var _a;
451
451
  return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
452
452
  });
453
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities[0]) ? [activities === null || activities === void 0 ? void 0 : activities[0]] : [];
453
+ var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
454
454
  state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities, operationStartDate: startDate || issuingDate });
455
455
  })
456
456
  .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
@@ -43,6 +43,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
43
43
  name: any;
44
44
  contact: any;
45
45
  countries: CountryCode[];
46
+ countryCode: any;
46
47
  notification: any;
47
48
  flows: {
48
49
  name: string;
@@ -251,6 +251,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
251
251
  name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
252
252
  contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
253
253
  countries: countries,
254
+ countryCode: countryCode,
254
255
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
255
256
  flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
256
257
  },
@@ -433,7 +434,7 @@ export var individualSlice = createSlice({
433
434
  state.data.otpData = formData;
434
435
  state.data.otpData.responseBody = data;
435
436
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
436
- var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
437
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user, countryCode = _c.countryCode;
437
438
  var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
438
439
  var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
439
440
  var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
@@ -444,7 +445,7 @@ export var individualSlice = createSlice({
444
445
  (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
445
446
  if (!!selectedMonthlyIncome)
446
447
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
447
- var code = user === null || user === void 0 ? void 0 : user.employer_country;
448
+ var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
448
449
  if (!!code) {
449
450
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
450
451
  state.data.individualData.employerLocation = employerLocation;
@@ -38,9 +38,9 @@ var NID = function (_a) {
38
38
  var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
39
39
  var settingsStore = useAppSelector(settingsSelector);
40
40
  var nid = data.nid, dob = data.dob, termAndConditionChecked = data.termAndConditionChecked, responseBody = data.responseBody;
41
- var defaultDob = responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth;
41
+ var isDobAvailable = responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth;
42
42
  var methods = useForm({
43
- resolver: yupResolver(!defaultDob ? NIDDOBValidationSchema : NIDValidationSchema),
43
+ resolver: yupResolver(!isDobAvailable ? NIDDOBValidationSchema : NIDValidationSchema),
44
44
  defaultValues: {
45
45
  nid: nid,
46
46
  dob: dob,
@@ -63,6 +63,6 @@ var NID = function (_a) {
63
63
  dispatch(clearError());
64
64
  };
65
65
  var disabled = !methods.formState.isValid || !!error;
66
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, {}) })), _jsx(DOB, { show: !defaultDob, onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, {}), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
66
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, {}) })), _jsx(DOB, { show: !isDobAvailable, onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, {}), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
67
67
  };
68
68
  export default React.memo(NID);
@@ -62,7 +62,7 @@ var SuccessWithFlowButtons = function () {
62
62
  var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
63
  var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
64
  var identification = user.identification;
65
- var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
66
66
  var settings = useAppSelector(settingsSelector);
67
67
  var _h = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _h.contact, board_id = _h.board_id, board_info_id = _h.board_info_id;
68
68
  var email = (contact || { email: '' }).email;
@@ -78,10 +78,10 @@ var SuccessWithFlowButtons = function () {
78
78
  var title = t("".concat(name, "_flow_").concat(type), {
79
79
  individual_name: username.toLowerCase() + maskedId,
80
80
  business_type: brandName,
81
- license_number: t('masking_symbols') + showLastFour(licenseNumber),
81
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
82
82
  bank_name: bankName,
83
- iban: t('masking_symbols') + iban,
84
- tax_id: t('masking_symbols') + showLastFour(taxID)
83
+ iban: iban ? t('masking_symbols') + iban : '',
84
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
85
85
  });
86
86
  var isCompleted = status === 'completed' && name !== 'password';
87
87
  var isIndividual = name === 'individual';
@@ -7,10 +7,17 @@ import { businessSelector, updateLeadSuccess } from '../../../app/business/busin
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var _b = useAppSelector(businessSelector), loading = _b.loading, error = _b.error;
11
- var onSuccess = function () {
10
+ var _b = useAppSelector(businessSelector), error = _b.error, data = _b.data;
11
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
12
+ var verify = data.verify;
13
+ var responseBody = verify.responseBody;
14
+ var updateLeadSuccessLoading = (responseBody || {}).updateLeadSuccessLoading;
15
+ React.useEffect(function () {
12
16
  dispatch(updateLeadSuccess());
17
+ }, []);
18
+ var onSuccess = function () {
19
+ setClicked(true);
13
20
  };
14
- return (_jsx(SuccessScreen, { title: t('business_completed_title'), description: t('business_completed_description'), onSuccess: onSuccess, successTitle: t('business_completed_button'), loading: loading, error: error || '' }));
21
+ return (_jsx(SuccessScreen, { title: t('business_completed_title'), description: t('business_completed_description'), onSuccess: onSuccess, successTitle: t('business_completed_button'), loading: clicked && updateLeadSuccessLoading, error: error || '' }));
15
22
  };
16
23
  export default React.memo(Success);
@@ -61,7 +61,7 @@ var SuccessWithFlowButtons = function () {
61
61
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
62
62
  var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
63
  var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
- var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
64
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
65
  var settings = useAppSelector(settingsSelector);
66
66
  var _h = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _h.contact, board_id = _h.board_id, board_info_id = _h.board_info_id;
67
67
  var email = (contact || { email: '' }).email;
@@ -77,10 +77,10 @@ var SuccessWithFlowButtons = function () {
77
77
  var title = t("".concat(name, "_flow_").concat(type), {
78
78
  individual_name: username.toLowerCase() + maskedId,
79
79
  business_type: brandName,
80
- license_number: t('masking_symbols') + showLastFour(licenseNumber),
80
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
81
81
  bank_name: bankName,
82
- iban: t('masking_symbols') + iban,
83
- tax_id: t('masking_symbols') + showLastFour(taxID)
82
+ iban: iban ? t('masking_symbols') + iban : '',
83
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
84
84
  });
85
85
  var isCompleted = status === 'completed' && name !== 'password';
86
86
  var isIndividual = name === 'individual';
@@ -29,7 +29,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
29
29
  import { civilIDValidationSchema } from './validation';
30
30
  import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
31
31
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
32
- import { clearError, connectSelector, createCivilIdAuth, resetMobileScreen } from '../../../app/connect/connectStore';
32
+ import { clearError, connectSelector, createCivilIdAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
33
33
  import Form from '../../../../components/Form';
34
34
  import Button, { MobileButton } from '../../../shared/Button';
35
35
  import { ScreenContainer } from '../../../shared/Containers';
@@ -93,6 +93,9 @@ var CivilID = function (_a) {
93
93
  var onBack = function () {
94
94
  dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
95
95
  };
96
+ React.useEffect(function () {
97
+ dispatch(resetStore());
98
+ }, []);
96
99
  var disabled = !methods.formState.isValid || !!error;
97
100
  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') }))] }))] })) })) }));
98
101
  };
@@ -43,7 +43,9 @@ import Collapse from '../../../../components/Collapse';
43
43
  import { isKW } from '../../../../utils';
44
44
  var FormStyled = styled(Form)(function () { return ({
45
45
  display: 'flex',
46
- flexDirection: 'column'
46
+ flexDirection: 'column',
47
+ minHeight: '240px',
48
+ justifyContent: 'space-between'
47
49
  }); });
48
50
  var Individual = function (_a) {
49
51
  var _b = React.useState(false), listActive = _b[0], setListActive = _b[1];
@@ -72,7 +74,7 @@ var Individual = function (_a) {
72
74
  var _a;
73
75
  dispatch(resetIndividualScreen());
74
76
  var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
75
- var screen = isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : startWithNID ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP';
77
+ var screen = startWithNID ? (isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP') : 'CONNECT_MOBILE_STEP';
76
78
  dispatch(handlePrevScreenStep(screen));
77
79
  };
78
80
  React.useEffect(function () {
@@ -65,7 +65,7 @@ var Merchant = function (_a) {
65
65
  return;
66
66
  }
67
67
  var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
68
- var screen = isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : startWithNID ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP';
68
+ var screen = startWithNID ? (isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP') : 'CONNECT_MOBILE_STEP';
69
69
  dispatch(handlePrevScreenStep(screen));
70
70
  };
71
71
  React.useEffect(function () {
@@ -33,7 +33,7 @@ import Button, { AbsherButton, MobileButton } from '../../../shared/Button';
33
33
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
34
34
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
35
35
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
36
- import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen } from '../../../app/connect/connectStore';
36
+ import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen, resetStore } from '../../../app/connect/connectStore';
37
37
  import { useLanguage } from '../../../../hooks';
38
38
  import Divider from '@mui/material/Divider';
39
39
  import { isKW } from '../../../../utils';
@@ -119,6 +119,9 @@ var Mobile = function (_a) {
119
119
  var onBack = function () {
120
120
  dispatch(handlePrevScreenStep(isKWCountry ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP'));
121
121
  };
122
+ React.useEffect(function () {
123
+ dispatch(resetStore());
124
+ }, []);
122
125
  var isBusinessListActive = listType === ListType.BusinessList;
123
126
  var isCountryListActive = listType === ListType.CountryCodeList;
124
127
  var listActive = isBusinessListActive || isCountryListActive;
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { NIDValidationSchema } from './validation';
19
19
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
- import { clearError, connectSelector, createNIDAuth, resetMobileScreen } from '../../../app/connect/connectStore';
21
+ import { clearError, connectSelector, createNIDAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button, { MobileButton } from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -85,6 +85,9 @@ var NID = function (_a) {
85
85
  var onBack = function () {
86
86
  dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
87
87
  };
88
+ React.useEffect(function () {
89
+ dispatch(resetStore());
90
+ }, []);
88
91
  var disabled = !methods.formState.isValid || !!error;
89
92
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_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') }))] }))] }))] })) })) }));
90
93
  };
@@ -59,7 +59,7 @@ var SuccessWithFlowButtons = function () {
59
59
  var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
60
60
  var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
61
61
  var identification = (user || {}).identification;
62
- var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
62
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
63
63
  var settings = useAppSelector(settingsSelector);
64
64
  var _g = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _g.contact, board_id = _g.board_id, board_info_id = _g.board_info_id;
65
65
  var email = (contact || { email: '' }).email;
@@ -75,10 +75,10 @@ var SuccessWithFlowButtons = function () {
75
75
  var title = t("".concat(name, "_flow_").concat(type), {
76
76
  individual_name: username.toLowerCase() + maskedId,
77
77
  business_type: brandName,
78
- license_number: t('masking_symbols') + showLastFour(licenseNumber),
78
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
79
79
  bank_name: bankName,
80
- iban: t('masking_symbols') + iban,
81
- tax_id: t('masking_symbols') + showLastFour(taxID)
80
+ iban: iban ? t('masking_symbols') + iban : '',
81
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
82
82
  });
83
83
  var isCompleted = status === 'completed' && name !== 'password';
84
84
  var isIndividual = name === 'individual';
@@ -62,7 +62,7 @@ var SuccessWithFlowButtons = function () {
62
62
  var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
63
  var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
64
  var identification = (user || {}).identification;
65
- var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
66
66
  var settings = useAppSelector(settingsSelector);
67
67
  var _h = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _h.contact, board_id = _h.board_id, board_info_id = _h.board_info_id;
68
68
  var email = (contact || { email: '' }).email;
@@ -78,10 +78,10 @@ var SuccessWithFlowButtons = function () {
78
78
  var title = t("".concat(name, "_flow_").concat(type), {
79
79
  individual_name: username.toLowerCase() + maskedId,
80
80
  business_type: brandName,
81
- license_number: t('masking_symbols') + showLastFour(licenseNumber),
81
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
82
82
  bank_name: bankName,
83
- iban: t('masking_symbols') + iban,
84
- tax_id: t('masking_symbols') + showLastFour(taxID)
83
+ iban: iban ? t('masking_symbols') + iban : '',
84
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
85
85
  });
86
86
  var isCompleted = status === 'completed' && name !== 'password';
87
87
  var isIndividual = name === 'individual';
@@ -62,7 +62,7 @@ var SuccessWithFlowButtons = function () {
62
62
  var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
63
  var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
64
  var identification = user.identification;
65
- var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
66
66
  var settings = useAppSelector(settingsSelector);
67
67
  var _h = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _h.contact, board_id = _h.board_id, board_info_id = _h.board_info_id;
68
68
  var email = (contact || { email: '' }).email;
@@ -78,10 +78,10 @@ var SuccessWithFlowButtons = function () {
78
78
  var title = t("".concat(name, "_flow_").concat(type), {
79
79
  individual_name: username.toLowerCase() + maskedId,
80
80
  business_type: brandName,
81
- license_number: t('masking_symbols') + showLastFour(licenseNumber),
81
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
82
82
  bank_name: bankName,
83
- iban: t('masking_symbols') + iban,
84
- tax_id: t('masking_symbols') + showLastFour(taxID)
83
+ iban: iban ? t('masking_symbols') + iban : '',
84
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
85
85
  });
86
86
  var isCompleted = status === 'completed' && name !== 'password';
87
87
  var isIndividual = name === 'individual';
@@ -62,7 +62,7 @@ var SuccessWithFlowButtons = function () {
62
62
  var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
63
  var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
64
  var identification = user.identification;
65
- var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
66
66
  var settings = useAppSelector(settingsSelector);
67
67
  var _h = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _h.contact, board_id = _h.board_id, board_info_id = _h.board_info_id;
68
68
  var email = (contact || { email: '' }).email;
@@ -78,10 +78,10 @@ var SuccessWithFlowButtons = function () {
78
78
  var title = t("".concat(name, "_flow_").concat(type), {
79
79
  individual_name: username.toLowerCase() + maskedId,
80
80
  business_type: brandName,
81
- license_number: t('masking_symbols') + showLastFour(licenseNumber),
81
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
82
82
  bank_name: bankName,
83
- iban: t('masking_symbols') + iban,
84
- tax_id: t('masking_symbols') + showLastFour(taxID)
83
+ iban: iban ? t('masking_symbols') + iban : '',
84
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
85
85
  });
86
86
  var isCompleted = status === 'completed' && name !== 'password';
87
87
  var isIndividual = name === 'individual';
@@ -23,3 +23,39 @@ export declare const mapSalesChannel: (salesChannel: Array<SaleChannel>) => {
23
23
  } | undefined;
24
24
  logo?: string | undefined;
25
25
  }[];
26
+ export declare const mapBrandSalesChannel: (salesChannel: Array<SaleChannel>, brandSalesChannel: Array<SaleChannel>) => ({
27
+ sub: ({
28
+ id: string;
29
+ code: string;
30
+ name?: {
31
+ ar: string;
32
+ en: string;
33
+ } | undefined;
34
+ address?: string | undefined;
35
+ logo?: string | undefined;
36
+ } | undefined)[] | undefined;
37
+ id: string;
38
+ code: string;
39
+ name?: {
40
+ ar: string;
41
+ en: string;
42
+ } | undefined;
43
+ address?: string | undefined;
44
+ logo?: string | undefined;
45
+ } | {
46
+ sub?: import("../@types").SubSaleChannel[] | undefined;
47
+ id: string;
48
+ code: string;
49
+ name?: {
50
+ ar: string;
51
+ en: string;
52
+ } | undefined;
53
+ address?: string | undefined;
54
+ logo?: string | undefined;
55
+ } | undefined)[];
56
+ export declare const removeDuplicationById: (items: Array<any>) => any[];
57
+ export declare const fixBrandList: (items: Array<{
58
+ channel_services: Array<SaleChannel>;
59
+ }>, salesChannel: Array<SaleChannel>) => {
60
+ channel_services: any[];
61
+ }[];
@@ -89,3 +89,35 @@ export var mapSalesChannel = function (salesChannel) {
89
89
  }));
90
90
  });
91
91
  };
92
+ export var mapBrandSalesChannel = function (salesChannel, brandSalesChannel) {
93
+ var findSalesChannel = function (id) { return salesChannel.find(function (item) { return item.id === id; }); };
94
+ var mapped = brandSalesChannel
95
+ .map(function (item) {
96
+ var _a;
97
+ var originalSalasChannel = findSalesChannel(item.id);
98
+ if (!originalSalasChannel)
99
+ return undefined;
100
+ var hasSub = item.sub && item.sub.length > 0;
101
+ if (hasSub)
102
+ return __assign(__assign({}, item), { sub: (_a = originalSalasChannel.sub) === null || _a === void 0 ? void 0 : _a.map(function (subItem) {
103
+ var _a;
104
+ var brandSubItem = (_a = item.sub) === null || _a === void 0 ? void 0 : _a.find(function (brandSub) { return brandSub.id === subItem.id; });
105
+ if (!brandSubItem)
106
+ return undefined;
107
+ return __assign(__assign({}, subItem), brandSubItem);
108
+ }).filter(Boolean) });
109
+ return __assign({}, item);
110
+ })
111
+ .filter(Boolean);
112
+ return mapped;
113
+ };
114
+ export var removeDuplicationById = function (items) {
115
+ return items.filter(function (item, index) {
116
+ return items.findIndex(function (i) { return i.id === item.id; }) === index;
117
+ });
118
+ };
119
+ export var fixBrandList = function (items, salesChannel) {
120
+ return items.map(function (item) {
121
+ return __assign(__assign({}, item), { channel_services: removeDuplicationById(mapBrandSalesChannel(salesChannel, item.channel_services || [])) });
122
+ });
123
+ };
package/package.json CHANGED
@@ -1,129 +1,129 @@
1
- {
2
- "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.36",
4
- "description": "connect library, auth",
5
- "private": false,
6
- "main": "build/index.js",
7
- "module": "build/index.js",
8
- "types": "build/index.d.ts",
9
- "files": [
10
- "build",
11
- "README.md"
12
- ],
13
- "scripts": {
14
- "husky:setup": "npx husky install",
15
- "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
- "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
- "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
- "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
19
- "start": "cross-env NODE_ENV=development webpack serve",
20
- "build": "rm -rf build && cross-env NODE_ENV=production webpack",
21
- "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
- "tsc:alias": "tsc-alias -p tsconfig.json",
23
- "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public"
25
- },
26
- "keywords": [],
27
- "author": {
28
- "name": "Ahmed Elsharkawy",
29
- "email": "a.elsharkawy@tap.company"
30
- },
31
- "license": "ISC",
32
- "devDependencies": {
33
- "@babel/core": "^7.18.6",
34
- "@babel/preset-env": "^7.18.6",
35
- "@babel/preset-react": "^7.18.6",
36
- "@babel/preset-typescript": "^7.18.6",
37
- "@types/lodash-es": "^4.17.6",
38
- "@types/react": "^18.0.15",
39
- "@types/react-calendar": "~3.5.1",
40
- "@types/react-dom": "^18.0.6",
41
- "@typescript-eslint/eslint-plugin": "^5.30.5",
42
- "@typescript-eslint/parser": "^5.30.5",
43
- "babel-loader": "^8.2.5",
44
- "copyfiles": "^2.4.1",
45
- "cross-env": "^7.0.3",
46
- "css-loader": "^6.7.1",
47
- "css-minimizer-webpack-plugin": "^4.0.0",
48
- "eslint": "^8.19.0",
49
- "eslint-config-airbnb": "^19.0.4",
50
- "eslint-config-prettier": "^8.5.0",
51
- "eslint-plugin-import": "^2.26.0",
52
- "eslint-plugin-jsx-a11y": "^6.6.0",
53
- "eslint-plugin-node": "^11.1.0",
54
- "eslint-plugin-prettier": "^4.2.1",
55
- "eslint-plugin-react": "^7.30.1",
56
- "eslint-plugin-react-hooks": "^4.6.0",
57
- "file-loader": "^6.2.0",
58
- "fork-ts-checker-webpack-plugin": "^7.2.12",
59
- "html-loader": "^3.1.2",
60
- "html-webpack-plugin": "^5.5.0",
61
- "husky": "^8.0.1",
62
- "lint-staged": "^13.0.3",
63
- "mini-css-extract-plugin": "^2.6.1",
64
- "prettier": "^2.7.1",
65
- "sass": "^1.53.0",
66
- "sass-loader": "^13.0.2",
67
- "style-loader": "^3.3.1",
68
- "terser-webpack-plugin": "^5.3.3",
69
- "tsc-alias": "^1.6.11",
70
- "typescript": "^4.7.4",
71
- "webpack": "^5.73.0",
72
- "webpack-cli": "^4.10.0",
73
- "webpack-dev-server": "^4.9.3",
74
- "webpack-merge": "^5.8.0"
75
- },
76
- "dependencies": {
77
- "@emotion/react": "^11.9.3",
78
- "@emotion/styled": "^11.9.3",
79
- "@fingerprintjs/fingerprintjs": "~3.3.4",
80
- "@hookform/resolvers": "^2.9.6",
81
- "@mui/icons-material": "^5.8.4",
82
- "@mui/material": "^5.8.7",
83
- "@reduxjs/toolkit": "^1.8.3",
84
- "axios": "^0.27.2",
85
- "device-detector-js": "^3.0.3",
86
- "i18next": "^21.8.14",
87
- "i18next-browser-languagedetector": "^6.1.4",
88
- "i18next-http-backend": "^1.4.1",
89
- "jsencrypt": "^2.3.1",
90
- "lodash-es": "^4.17.21",
91
- "lottie-web": "^5.9.6",
92
- "moment": "^2.29.4",
93
- "react": "^18.2.0",
94
- "react-calendar": "~3.7.0",
95
- "react-device-detect": "^2.2.2",
96
- "react-dom": "^18.2.0",
97
- "react-dropzone": "^14.2.2",
98
- "react-hook-form": "^7.33.1",
99
- "react-i18next": "^11.18.1",
100
- "react-multi-date-picker": "^3.3.4",
101
- "react-otp-input": "^2.4.0",
102
- "react-redux": "^8.0.2",
103
- "react-spring-bottom-sheet": "^3.4.1",
104
- "yup": "^0.32.11"
105
- },
106
- "peerDependencies": {
107
- "react": "^18.2.0",
108
- "react-dom": "^18.2.0"
109
- },
110
- "lint-staged": {
111
- "src/**/*.{ts,tsx,json,js,jsx}": [
112
- "yarn run prettier:fix",
113
- "yarn run lint",
114
- "git add ."
115
- ]
116
- },
117
- "browserslist": {
118
- "production": [
119
- ">0.2%",
120
- "not dead",
121
- "not op_mini all"
122
- ],
123
- "development": [
124
- "last 1 chrome version",
125
- "last 1 firefox version",
126
- "last 1 safari version"
127
- ]
128
- }
129
- }
1
+ {
2
+ "name": "@tap-payments/auth-jsconnect",
3
+ "version": "2.0.37",
4
+ "description": "connect library, auth",
5
+ "private": false,
6
+ "main": "build/index.js",
7
+ "module": "build/index.js",
8
+ "types": "build/index.d.ts",
9
+ "files": [
10
+ "build",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "husky:setup": "npx husky install",
15
+ "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
+ "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
+ "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
+ "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
19
+ "start": "cross-env NODE_ENV=development webpack serve",
20
+ "build": "rm -rf build && cross-env NODE_ENV=production webpack",
21
+ "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
+ "tsc:alias": "tsc-alias -p tsconfig.json",
23
+ "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
+ "push": "npm publish --access public"
25
+ },
26
+ "keywords": [],
27
+ "author": {
28
+ "name": "Ahmed Elsharkawy",
29
+ "email": "a.elsharkawy@tap.company"
30
+ },
31
+ "license": "ISC",
32
+ "devDependencies": {
33
+ "@babel/core": "^7.18.6",
34
+ "@babel/preset-env": "^7.18.6",
35
+ "@babel/preset-react": "^7.18.6",
36
+ "@babel/preset-typescript": "^7.18.6",
37
+ "@types/lodash-es": "^4.17.6",
38
+ "@types/react": "^18.0.15",
39
+ "@types/react-calendar": "~3.5.1",
40
+ "@types/react-dom": "^18.0.6",
41
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
42
+ "@typescript-eslint/parser": "^5.30.5",
43
+ "babel-loader": "^8.2.5",
44
+ "copyfiles": "^2.4.1",
45
+ "cross-env": "^7.0.3",
46
+ "css-loader": "^6.7.1",
47
+ "css-minimizer-webpack-plugin": "^4.0.0",
48
+ "eslint": "^8.19.0",
49
+ "eslint-config-airbnb": "^19.0.4",
50
+ "eslint-config-prettier": "^8.5.0",
51
+ "eslint-plugin-import": "^2.26.0",
52
+ "eslint-plugin-jsx-a11y": "^6.6.0",
53
+ "eslint-plugin-node": "^11.1.0",
54
+ "eslint-plugin-prettier": "^4.2.1",
55
+ "eslint-plugin-react": "^7.30.1",
56
+ "eslint-plugin-react-hooks": "^4.6.0",
57
+ "file-loader": "^6.2.0",
58
+ "fork-ts-checker-webpack-plugin": "^7.2.12",
59
+ "html-loader": "^3.1.2",
60
+ "html-webpack-plugin": "^5.5.0",
61
+ "husky": "^8.0.1",
62
+ "lint-staged": "^13.0.3",
63
+ "mini-css-extract-plugin": "^2.6.1",
64
+ "prettier": "^2.7.1",
65
+ "sass": "^1.53.0",
66
+ "sass-loader": "^13.0.2",
67
+ "style-loader": "^3.3.1",
68
+ "terser-webpack-plugin": "^5.3.3",
69
+ "tsc-alias": "^1.6.11",
70
+ "typescript": "^4.7.4",
71
+ "webpack": "^5.73.0",
72
+ "webpack-cli": "^4.10.0",
73
+ "webpack-dev-server": "^4.9.3",
74
+ "webpack-merge": "^5.8.0"
75
+ },
76
+ "dependencies": {
77
+ "@emotion/react": "^11.9.3",
78
+ "@emotion/styled": "^11.9.3",
79
+ "@fingerprintjs/fingerprintjs": "~3.3.4",
80
+ "@hookform/resolvers": "^2.9.6",
81
+ "@mui/icons-material": "^5.8.4",
82
+ "@mui/material": "^5.8.7",
83
+ "@reduxjs/toolkit": "^1.8.3",
84
+ "axios": "^0.27.2",
85
+ "device-detector-js": "^3.0.3",
86
+ "i18next": "^21.8.14",
87
+ "i18next-browser-languagedetector": "^6.1.4",
88
+ "i18next-http-backend": "^1.4.1",
89
+ "jsencrypt": "^2.3.1",
90
+ "lodash-es": "^4.17.21",
91
+ "lottie-web": "^5.9.6",
92
+ "moment": "^2.29.4",
93
+ "react": "^18.2.0",
94
+ "react-calendar": "~3.7.0",
95
+ "react-device-detect": "^2.2.2",
96
+ "react-dom": "^18.2.0",
97
+ "react-dropzone": "^14.2.2",
98
+ "react-hook-form": "^7.33.1",
99
+ "react-i18next": "^11.18.1",
100
+ "react-multi-date-picker": "^3.3.4",
101
+ "react-otp-input": "^2.4.0",
102
+ "react-redux": "^8.0.2",
103
+ "react-spring-bottom-sheet": "^3.4.1",
104
+ "yup": "^0.32.11"
105
+ },
106
+ "peerDependencies": {
107
+ "react": "^18.2.0",
108
+ "react-dom": "^18.2.0"
109
+ },
110
+ "lint-staged": {
111
+ "src/**/*.{ts,tsx,json,js,jsx}": [
112
+ "yarn run prettier:fix",
113
+ "yarn run lint",
114
+ "git add ."
115
+ ]
116
+ },
117
+ "browserslist": {
118
+ "production": [
119
+ ">0.2%",
120
+ "not dead",
121
+ "not op_mini all"
122
+ ],
123
+ "development": [
124
+ "last 1 chrome version",
125
+ "last 1 firefox version",
126
+ "last 1 safari version"
127
+ ]
128
+ }
129
+ }