@tap-payments/auth-jsconnect 1.0.95-test → 1.0.96-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 (31) hide show
  1. package/build/@types/app.d.ts +5 -0
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/api/data.d.ts +1 -0
  4. package/build/api/data.js +9 -2
  5. package/build/api/entity.d.ts +3 -1
  6. package/build/api/entity.js +11 -2
  7. package/build/api/index.d.ts +3 -1
  8. package/build/api/lead.d.ts +2 -1
  9. package/build/api/lead.js +14 -2
  10. package/build/constants/api.d.ts +2 -1
  11. package/build/constants/api.js +5 -3
  12. package/build/features/app/bank/bankStore.js +3 -1
  13. package/build/features/app/business/businessStore.d.ts +2 -4
  14. package/build/features/app/business/businessStore.js +61 -17
  15. package/build/features/app/connect/connectStore.d.ts +5 -10
  16. package/build/features/app/connect/connectStore.js +112 -20
  17. package/build/features/app/individual/individualStore.d.ts +1 -0
  18. package/build/features/app/individual/individualStore.js +22 -17
  19. package/build/features/app/password/passwordStore.js +3 -1
  20. package/build/features/app/tax/taxStore.js +3 -1
  21. package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
  22. package/build/features/business/screens/OTP/OTPInput.js +3 -9
  23. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  24. package/build/features/connect/screens/NID/NID.js +1 -1
  25. package/build/features/connect/screens/OTP/OTPInput.js +3 -13
  26. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -1
  27. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
  28. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
  29. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
  30. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
  31. package/package.json +1 -1
@@ -90,6 +90,11 @@ export interface SourceOfIncome {
90
90
  name_ar: string;
91
91
  name_en: string;
92
92
  }
93
+ export interface Occupation {
94
+ id: string;
95
+ name_ar: string;
96
+ name_en: string;
97
+ }
93
98
  export interface MonthlyIncome extends SourceOfIncome {
94
99
  }
95
100
  export interface AppInfo {
@@ -1,4 +1,4 @@
1
- import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, SalesChannel, SourceOfIncome } from './app';
1
+ import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SalesChannel, SourceOfIncome } from './app';
2
2
  export declare type MobileFormValues = {
3
3
  mobile: string | null;
4
4
  countryCode: CountryCode;
@@ -56,6 +56,7 @@ export declare type TaxFormValues = {
56
56
  confirmPolicy: false;
57
57
  };
58
58
  export declare type IndividualExtraFormValues = {
59
+ occupation: Occupation | undefined;
59
60
  sourceIncome: SourceOfIncome | undefined;
60
61
  monthlyIncome: MonthlyIncome | undefined;
61
62
  employerName: string;
@@ -5,5 +5,6 @@ declare const dataService: {
5
5
  getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
6
6
  getSourceOfIncome: () => Promise<import("axios").AxiosResponse<any, any>>;
7
7
  getMonthlyIncome: (countryCode: string) => Promise<import("axios").AxiosResponse<any, any>>;
8
+ getOccupation: () => Promise<any>;
8
9
  };
9
10
  export { dataService };
package/build/api/data.js CHANGED
@@ -1,4 +1,4 @@
1
- import instance from './axios';
1
+ import instance, { httpClient } from './axios';
2
2
  import { ENDPOINT_PATHS } from '../constants';
3
3
  var getChannelsOfServices = function () {
4
4
  return instance.get("".concat(ENDPOINT_PATHS.CHANNEL));
@@ -18,12 +18,19 @@ var getSourceOfIncome = function () {
18
18
  var getMonthlyIncome = function (countryCode) {
19
19
  return instance.get("".concat(ENDPOINT_PATHS.MONTHLY_INCOME, "/").concat(countryCode));
20
20
  };
21
+ var getOccupation = function () {
22
+ return httpClient({
23
+ method: 'get',
24
+ url: "".concat(ENDPOINT_PATHS.OCCUPATION)
25
+ });
26
+ };
21
27
  var dataService = {
22
28
  getChannelsOfServices: getChannelsOfServices,
23
29
  getCustomerBases: getCustomerBases,
24
30
  getExpectedSales: getExpectedSales,
25
31
  getExpectedCustomerSales: getExpectedCustomerSales,
26
32
  getSourceOfIncome: getSourceOfIncome,
27
- getMonthlyIncome: getMonthlyIncome
33
+ getMonthlyIncome: getMonthlyIncome,
34
+ getOccupation: getOccupation
28
35
  };
29
36
  export { dataService };
@@ -12,11 +12,12 @@ export declare type EntityInfoBody = {
12
12
  agree_chargeback?: boolean;
13
13
  agree_refund?: boolean;
14
14
  employer_name?: string;
15
- employer_city?: string | null;
15
+ employer_country?: string | null;
16
16
  source_income?: Array<string | undefined>;
17
17
  actual_income?: string;
18
18
  is_relative_PEP?: boolean | null;
19
19
  is_influencer?: boolean | null;
20
+ occupation?: string;
20
21
  step_name: string;
21
22
  encryption_contract?: Array<string>;
22
23
  };
@@ -38,5 +39,6 @@ declare const entityService: {
38
39
  updateEntityInfo: ({ id, ...data }: EntityInfoBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
39
40
  createBankAccount: (data: EntityBankUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
40
41
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
42
+ updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
41
43
  };
42
44
  export { entityService };
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { ENDPOINT_PATHS } from '../constants';
13
- import instance from './axios';
13
+ import instance, { httpClient } from './axios';
14
14
  var retrieveEntityInfo = function (entity_id, config) {
15
15
  return instance.get("".concat(ENDPOINT_PATHS.ENTITY, "/").concat(entity_id), config);
16
16
  };
@@ -25,10 +25,19 @@ var updateEntityInfo = function (_a, config) {
25
25
  var createBankAccount = function (data, config) {
26
26
  return instance.post("".concat(ENDPOINT_PATHS.BANK), data, config);
27
27
  };
28
+ var updateIndividualInfo = function (_a) {
29
+ var id = _a.id, data = __rest(_a, ["id"]);
30
+ return httpClient({
31
+ method: 'put',
32
+ url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(id, "/info"),
33
+ data: data
34
+ });
35
+ };
28
36
  var entityService = {
29
37
  createEntityInfo: createEntityInfo,
30
38
  updateEntityInfo: updateEntityInfo,
31
39
  createBankAccount: createBankAccount,
32
- retrieveEntityInfo: retrieveEntityInfo
40
+ retrieveEntityInfo: retrieveEntityInfo,
41
+ updateIndividualInfo: updateIndividualInfo
33
42
  };
34
43
  export { entityService };
@@ -27,7 +27,7 @@ declare const API: {
27
27
  retrieveLead: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
28
28
  verifyLeadToken: (data: LeadVerifyBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
29
29
  verifyLeadOTP: (data: LeadOTPVerifyBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
30
- updateLeadIdentity: (data: LeadIdentityUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
30
+ updateLeadIdentity: ({ id, ...data }: LeadIdentityUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
31
31
  retrieveEntityList: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
32
32
  };
33
33
  entityService: {
@@ -35,6 +35,7 @@ declare const API: {
35
35
  updateEntityInfo: ({ id, ...data }: EntityInfoBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
36
36
  createBankAccount: (data: EntityBankUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
37
37
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
38
+ updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
38
39
  };
39
40
  availabilityServices: {
40
41
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -54,6 +55,7 @@ declare const API: {
54
55
  getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
55
56
  getSourceOfIncome: () => Promise<import("axios").AxiosResponse<any, any>>;
56
57
  getMonthlyIncome: (countryCode: string) => Promise<import("axios").AxiosResponse<any, any>>;
58
+ getOccupation: () => Promise<any>;
57
59
  };
58
60
  individualService: {
59
61
  getBrandList: (data: BrandListBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -77,6 +77,7 @@ export declare type CreateLeadBody = {
77
77
  country_code: string;
78
78
  };
79
79
  export declare type LeadIdentityUpdateBody = {
80
+ id: string;
80
81
  country_code: string;
81
82
  identification_id: string;
82
83
  identification_id_type: string;
@@ -90,7 +91,7 @@ declare const leadService: {
90
91
  retrieveLead: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
91
92
  verifyLeadToken: (data: LeadVerifyBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
92
93
  verifyLeadOTP: (data: LeadOTPVerifyBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
93
- updateLeadIdentity: (data: LeadIdentityUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
94
+ updateLeadIdentity: ({ id, ...data }: LeadIdentityUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
94
95
  retrieveEntityList: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
95
96
  };
96
97
  export { leadService };
package/build/api/lead.js CHANGED
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import instance from './axios';
2
13
  import { ENDPOINT_PATHS } from '../constants';
3
14
  var createLead = function (data, config) {
@@ -15,8 +26,9 @@ var verifyLeadToken = function (data, config) {
15
26
  var verifyLeadOTP = function (data, config) {
16
27
  return instance.put("".concat(ENDPOINT_PATHS.LEAD_IDENTITY_VERIFY), data, config);
17
28
  };
18
- var updateLeadIdentity = function (data, config) {
19
- return instance.put("".concat(ENDPOINT_PATHS.LEAD_IDENTITY), data, config);
29
+ var updateLeadIdentity = function (_a, config) {
30
+ var id = _a.id, data = __rest(_a, ["id"]);
31
+ return instance.put("".concat(ENDPOINT_PATHS.LEAD, "/").concat(id, "/identity"), data, config);
20
32
  };
21
33
  var retrieveEntityList = function (leadId) {
22
34
  return instance.get("".concat(ENDPOINT_PATHS.RETRIEVE_ENTITY_LIST, "/").concat(leadId));
@@ -8,7 +8,6 @@ export declare const ENDPOINT_PATHS: {
8
8
  OPERATOR: string;
9
9
  AUTH: string;
10
10
  LEAD: string;
11
- LEAD_IDENTITY: string;
12
11
  LEAD_IDENTITY_VERIFY: string;
13
12
  RETRIEVE_ENTITY_LIST: string;
14
13
  ENTITY: string;
@@ -26,4 +25,6 @@ export declare const ENDPOINT_PATHS: {
26
25
  BANK: string;
27
26
  IBAN_BANK: string;
28
27
  BRAND_LIST: string;
28
+ OCCUPATION: string;
29
+ INDIVIDUAL: string;
29
30
  };
@@ -7,10 +7,10 @@ var IP_PATH = '/ip';
7
7
  var OPERATOR_PATH = '/operator';
8
8
  var AUTH_PATH = '/auth';
9
9
  var LEAD_PATH = '/lead';
10
- var LEAD_IDENTITY_PATH = '/lead/identity';
11
10
  var LEAD_IDENTITY_VERIFY_PATH = 'lead/identity/verify';
12
11
  var RETRIEVE_ENTITY_LIST_PATH = '/lead/entity/list';
13
12
  var ENTITY_PATH = '/entity';
13
+ var INDIVIDUAL_PATH = '/individual';
14
14
  var BANK_PATH = '/entity/bankaccount';
15
15
  var IBAN_PATH = '/iban';
16
16
  var CHECK_EMAIL = '/lead/identity/emailcheck';
@@ -23,6 +23,7 @@ var EXPECTED_CUSTOMERS_PATH = '/v2/expectedCustomers';
23
23
  var SIGNUP_PATH = '/signup';
24
24
  var SOURCE_INCOME_PATH = '/v2/sourceOfIncome';
25
25
  var MONTHLY_INCOME_PATH = '/v2/monthlyIncome';
26
+ var OCCUPATION_PATH = '/v2/occupation';
26
27
  var BRAND_LIST_PATH = '/brand/list';
27
28
  var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/locale.json';
28
29
  export var ENDPOINT_PATHS = {
@@ -35,7 +36,6 @@ export var ENDPOINT_PATHS = {
35
36
  OPERATOR: OPERATOR_PATH,
36
37
  AUTH: AUTH_PATH,
37
38
  LEAD: LEAD_PATH,
38
- LEAD_IDENTITY: LEAD_IDENTITY_PATH,
39
39
  LEAD_IDENTITY_VERIFY: LEAD_IDENTITY_VERIFY_PATH,
40
40
  RETRIEVE_ENTITY_LIST: RETRIEVE_ENTITY_LIST_PATH,
41
41
  ENTITY: ENTITY_PATH,
@@ -52,5 +52,7 @@ export var ENDPOINT_PATHS = {
52
52
  MONTHLY_INCOME: MONTHLY_INCOME_PATH,
53
53
  BANK: BANK_PATH,
54
54
  IBAN_BANK: IBAN_PATH,
55
- BRAND_LIST: BRAND_LIST_PATH
55
+ BRAND_LIST: BRAND_LIST_PATH,
56
+ OCCUPATION: OCCUPATION_PATH,
57
+ INDIVIDUAL: INDIVIDUAL_PATH
56
58
  };
@@ -219,13 +219,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadBankSuccess', functio
219
219
  return [4, API.leadService.updateLead(payload)];
220
220
  case 1:
221
221
  data = (_g.sent()).data;
222
+ if (!!data.errors) return [3, 3];
222
223
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
223
224
  case 2:
224
225
  _g.sent();
225
226
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
226
227
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
227
228
  thunkApi.dispatch(handleNextScreenStep());
228
- return [2, { response: data, formData: params }];
229
+ _g.label = 3;
230
+ case 3: return [2, { response: data, formData: params }];
229
231
  }
230
232
  });
231
233
  }); });
@@ -21,11 +21,9 @@ export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
21
21
  type: string;
22
22
  nid: string;
23
23
  dob: string;
24
- isResend: boolean;
25
24
  };
26
- }, NIDFormValues & {
27
- isResend: boolean;
28
- }, {}>;
25
+ }, NIDFormValues, {}>;
26
+ export declare const resendOTPLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
29
27
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
30
28
  leadId: string;
31
29
  }, {}>;
@@ -159,19 +159,16 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
159
159
  });
160
160
  }); });
161
161
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
162
- var _a, settings, business, identification_id_type, stepName, headers, requestBody, data;
163
- var _b, _c, _d, _e, _f;
164
- return __generator(this, function (_g) {
165
- switch (_g.label) {
162
+ var _a, settings, business, identification_id_type, stepName, requestBody, data;
163
+ var _b, _c, _d;
164
+ return __generator(this, function (_e) {
165
+ switch (_e.label) {
166
166
  case 0:
167
167
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
168
168
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
169
169
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
170
- headers = {
171
- lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
172
- device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
173
- };
174
170
  requestBody = {
171
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
175
172
  identification_id: params.nid,
176
173
  identification_id_type: identification_id_type,
177
174
  date_of_birth: params.dob,
@@ -179,18 +176,46 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
179
176
  step_name: stepName,
180
177
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
181
178
  };
182
- return [4, API.leadService.updateLeadIdentity(requestBody, { headers: headers })];
179
+ return [4, API.leadService.updateLeadIdentity(requestBody)];
183
180
  case 1:
184
- data = (_g.sent()).data;
185
- if (!data.errors && !params.isResend) {
181
+ data = (_e.sent()).data;
182
+ if (!data.errors) {
186
183
  thunkApi.dispatch(updateStepName(stepName));
187
184
  thunkApi.dispatch(handleNextScreenStep());
188
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
185
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
189
186
  }
190
187
  return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
191
188
  }
192
189
  });
193
190
  }); });
191
+ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
+ var _a, settings, business, _b, nid, dob, type, stepName, requestBody, data;
193
+ var _c;
194
+ return __generator(this, function (_d) {
195
+ switch (_d.label) {
196
+ case 0:
197
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
198
+ _b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
199
+ stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
200
+ requestBody = {
201
+ id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
202
+ identification_id: nid,
203
+ identification_id_type: type,
204
+ date_of_birth: dob,
205
+ country_code: settings.data.businessCountry.iso2,
206
+ step_name: stepName,
207
+ encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
208
+ };
209
+ return [4, API.leadService.updateLeadIdentity(requestBody)];
210
+ case 1:
211
+ data = (_d.sent()).data;
212
+ if (!data.errors) {
213
+ thunkApi.dispatch(updateStepName(stepName));
214
+ }
215
+ return [2, data];
216
+ }
217
+ });
218
+ }); });
194
219
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
195
220
  var data;
196
221
  return __generator(this, function (_a) {
@@ -403,13 +428,15 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
403
428
  return [4, API.leadService.updateLead(payload)];
404
429
  case 1:
405
430
  data = (_h.sent()).data;
431
+ if (!!data.errors) return [3, 3];
406
432
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
407
433
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
408
434
  return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data.entity) === null || _g === void 0 ? void 0 : _g.id))];
409
435
  case 2:
410
436
  _h.sent();
411
437
  thunkApi.dispatch(handleNextScreenStep());
412
- return [2, { response: data, formData: params }];
438
+ _h.label = 3;
439
+ case 3: return [2, { response: data, formData: params }];
413
440
  }
414
441
  });
415
442
  }); });
@@ -543,10 +570,8 @@ export var businessSlice = createSlice({
543
570
  state.loading = false;
544
571
  state.error = action.error.message;
545
572
  })
546
- .addCase(updateLeadIdentity.pending, function (state, action) {
547
- var _a;
548
- if (!((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend))
549
- state.loading = true;
573
+ .addCase(updateLeadIdentity.pending, function (state) {
574
+ state.loading = true;
550
575
  state.error = null;
551
576
  })
552
577
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
@@ -567,6 +592,25 @@ export var businessSlice = createSlice({
567
592
  .addCase(updateLeadIdentity.rejected, function (state, action) {
568
593
  state.loading = false;
569
594
  state.error = action.error.message;
595
+ })
596
+ .addCase(resendOTPLeadIdentity.pending, function (state) {
597
+ state.error = null;
598
+ })
599
+ .addCase(resendOTPLeadIdentity.fulfilled, function (state, action) {
600
+ var _a;
601
+ state.error = null;
602
+ var data = action.payload;
603
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
604
+ if (description) {
605
+ state.error = description;
606
+ return;
607
+ }
608
+ state.data.nidData.responseBody = data;
609
+ state.data.otpData.otp = '';
610
+ state.data.otpData.isNID = true;
611
+ })
612
+ .addCase(resendOTPLeadIdentity.rejected, function (state, action) {
613
+ state.error = action.error.message;
570
614
  })
571
615
  .addCase(retrieveEntityList.pending, function (state) {
572
616
  state.error = null;
@@ -3,23 +3,18 @@ import { ResponseData, MobileFormValues, NIDFormValues, OTPFormValues, Individua
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  response: any;
6
- formData: MobileFormValues & {
7
- isResend: boolean;
8
- };
9
- }, MobileFormValues & {
10
- isResend: boolean;
11
- }, {}>;
6
+ formData: MobileFormValues;
7
+ }, MobileFormValues, {}>;
8
+ export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
12
9
  export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
13
10
  response: any;
14
11
  formData: {
15
12
  type: string;
16
13
  nid: string;
17
14
  dob: string;
18
- isResend: boolean;
19
15
  };
20
- }, NIDFormValues & {
21
- isResend: boolean;
22
- }, {}>;
16
+ }, NIDFormValues, {}>;
17
+ export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
23
18
  export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
24
19
  response: any;
25
20
  formData: OTPFormValues;
@@ -82,7 +82,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
82
82
  return [4, API.authService.createAuth(requestBody)];
83
83
  case 1:
84
84
  data = (_c.sent()).data;
85
- if (!data.errors && !params.isResend) {
85
+ if (!data.errors) {
86
86
  thunkApi.dispatch(handleNextScreenStep());
87
87
  (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
88
88
  }
@@ -90,13 +90,37 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
90
90
  }
91
91
  });
92
92
  }); });
93
- export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
- var _a, settings, connect, identification_id_type, requestBody, data;
95
- var _b, _c;
96
- return __generator(this, function (_d) {
97
- switch (_d.label) {
93
+ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
+ var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
95
+ return __generator(this, function (_c) {
96
+ switch (_c.label) {
98
97
  case 0:
99
98
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
99
+ _b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
100
+ requestBody = {
101
+ lang: settings.data.language,
102
+ user_credentail: {
103
+ phone: mobile || '',
104
+ code: countryCode.idd_prefix.toString()
105
+ },
106
+ sign_in: false,
107
+ step_name: CONNECT_STEP_NAMES.CREATE_AUTH_MOBILE,
108
+ encryption_contract: ['user_credentail.phone', 'user_credentail.code']
109
+ };
110
+ return [4, API.authService.createAuth(requestBody)];
111
+ case 1:
112
+ data = (_c.sent()).data;
113
+ return [2, data];
114
+ }
115
+ });
116
+ }); });
117
+ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
118
+ var settings, identification_id_type, requestBody, data;
119
+ var _a, _b;
120
+ return __generator(this, function (_c) {
121
+ switch (_c.label) {
122
+ case 0:
123
+ settings = thunkApi.getState().settings;
100
124
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
101
125
  requestBody = {
102
126
  lang: settings.data.language,
@@ -117,15 +141,46 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
117
141
  };
118
142
  return [4, API.authService.createAuth(requestBody)];
119
143
  case 1:
120
- data = (_d.sent()).data;
121
- if (!data.errors && !params.isResend) {
144
+ data = (_c.sent()).data;
145
+ if (!data.errors) {
122
146
  thunkApi.dispatch(handleNextScreenStep());
123
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
147
+ (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
124
148
  }
125
149
  return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
126
150
  }
127
151
  });
128
152
  }); });
153
+ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
154
+ var _a, settings, connect, _b, nid, dob, type, requestBody, data;
155
+ return __generator(this, function (_c) {
156
+ switch (_c.label) {
157
+ case 0:
158
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
159
+ _b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
160
+ requestBody = {
161
+ lang: settings.data.language,
162
+ user_credentail: {
163
+ identification_id: nid,
164
+ identification_id_type: type,
165
+ date_of_birth: dob,
166
+ country_code: settings.data.businessCountry.iso2
167
+ },
168
+ sign_in: false,
169
+ step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
170
+ encryption_contract: [
171
+ 'user_credentail.country_code',
172
+ 'user_credentail.identification_id',
173
+ 'user_credentail.identification_id_type',
174
+ 'user_credentail.date_of_birth'
175
+ ]
176
+ };
177
+ return [4, API.authService.createAuth(requestBody)];
178
+ case 1:
179
+ data = (_c.sent()).data;
180
+ return [2, data];
181
+ }
182
+ });
183
+ }); });
129
184
  export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
130
185
  var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, payload, data, params_1, params_2;
131
186
  var _c, _d;
@@ -279,7 +334,14 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
279
334
  id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
280
335
  terms_conditions_accepted: params.termAndConditionChecked,
281
336
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
282
- encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'brand.website']
337
+ encryption_contract: [
338
+ 'brand.name.en',
339
+ 'brand.name.ar',
340
+ 'brand.name.zh',
341
+ 'brand.website',
342
+ 'brand.social[0]',
343
+ 'brand.social[1]'
344
+ ]
283
345
  };
284
346
  return [4, API.leadService.updateLead(payload)];
285
347
  case 1:
@@ -437,7 +499,6 @@ export var connectSlice = createSlice({
437
499
  .addCase(createMobileAuth.fulfilled, function (state, action) {
438
500
  var _a;
439
501
  state.loading = false;
440
- state.customLoading = false;
441
502
  state.error = null;
442
503
  var _b = action.payload, formData = _b.formData, response = _b.response;
443
504
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -449,16 +510,30 @@ export var connectSlice = createSlice({
449
510
  state.data.mobileData.responseBody = response;
450
511
  state.data.otpData.isAbsher = false;
451
512
  })
452
- .addCase(createMobileAuth.pending, function (state, action) {
453
- if (action.meta.arg.isResend)
454
- state.customLoading = true;
455
- if (!action.meta.arg.isResend)
456
- state.loading = true;
513
+ .addCase(createMobileAuth.pending, function (state) {
514
+ state.loading = true;
457
515
  state.error = null;
458
516
  })
459
517
  .addCase(createMobileAuth.rejected, function (state, action) {
460
518
  state.loading = false;
461
- state.customLoading = false;
519
+ state.error = action.error.message;
520
+ })
521
+ .addCase(resendOTPMobile.fulfilled, function (state, action) {
522
+ var _a;
523
+ state.error = null;
524
+ var response = action.payload;
525
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
526
+ if (description) {
527
+ state.error = description;
528
+ return;
529
+ }
530
+ state.data.mobileData.responseBody = response;
531
+ state.data.otpData.isAbsher = false;
532
+ })
533
+ .addCase(resendOTPMobile.pending, function (state) {
534
+ state.error = null;
535
+ })
536
+ .addCase(resendOTPMobile.rejected, function (state, action) {
462
537
  state.error = action.error.message;
463
538
  })
464
539
  .addCase(createNIDAuth.fulfilled, function (state, action) {
@@ -475,14 +550,31 @@ export var connectSlice = createSlice({
475
550
  state.data.nidData.responseBody = response;
476
551
  state.data.otpData.isAbsher = true;
477
552
  })
478
- .addCase(createNIDAuth.pending, function (state, action) {
479
- var _a;
480
- state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
553
+ .addCase(createNIDAuth.pending, function (state) {
554
+ state.loading = true;
481
555
  state.error = null;
482
556
  })
483
557
  .addCase(createNIDAuth.rejected, function (state, action) {
484
558
  state.loading = false;
485
559
  state.error = action.error.message;
560
+ })
561
+ .addCase(resendOTPNID.fulfilled, function (state, action) {
562
+ var _a;
563
+ state.error = null;
564
+ var response = action.payload;
565
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
566
+ if (description) {
567
+ state.error = description;
568
+ return;
569
+ }
570
+ state.data.nidData.responseBody = response;
571
+ state.data.otpData.isAbsher = true;
572
+ })
573
+ .addCase(resendOTPNID.pending, function (state) {
574
+ state.error = null;
575
+ })
576
+ .addCase(resendOTPNID.rejected, function (state, action) {
577
+ state.error = action.error.message;
486
578
  })
487
579
  .addCase(verifyAuth.fulfilled, function (state, action) {
488
580
  var _a;
@@ -12,6 +12,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  sourceIncome: any;
13
13
  monthlyIncome: any;
14
14
  countryCode: string;
15
+ occupation: any;
15
16
  countries: import("../../../@types").CountryCode[];
16
17
  }, string, {}>;
17
18
  export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
@@ -107,22 +107,23 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
107
107
  });
108
108
  }); });
109
109
  export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
110
- var settings, _a, sourceIncome, monthlyIncome, countries;
110
+ var _a, sourceIncome, monthlyIncome, occupation, settings, countries;
111
111
  return __generator(this, function (_b) {
112
112
  switch (_b.label) {
113
- case 0:
114
- settings = thunkApi.getState().settings;
115
- return [4, Promise.all([
116
- API.dataService.getSourceOfIncome(),
117
- API.dataService.getMonthlyIncome(countryCode)
118
- ])];
113
+ case 0: return [4, Promise.all([
114
+ API.dataService.getSourceOfIncome(),
115
+ API.dataService.getMonthlyIncome(countryCode),
116
+ API.dataService.getOccupation()
117
+ ])];
119
118
  case 1:
120
- _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
119
+ _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
120
+ settings = thunkApi.getState().settings;
121
121
  countries = settings.data.countries;
122
122
  return [2, {
123
123
  sourceIncome: sourceIncome,
124
124
  monthlyIncome: monthlyIncome,
125
125
  countryCode: countryCode,
126
+ occupation: occupation,
126
127
  countries: countries
127
128
  }];
128
129
  }
@@ -157,7 +158,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
157
158
  return [4, API.leadService.verifyLeadOTP(payload)];
158
159
  case 1:
159
160
  data = (_g.sent()).data;
160
- if (!!data.errors) return [3, 5];
161
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 5];
161
162
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
162
163
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
163
164
  hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
@@ -184,20 +185,21 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
184
185
  case 0:
185
186
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
186
187
  requestBody = {
187
- id: (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
188
+ id: (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.individual_id,
189
+ occupation: (_c = params.occupation) === null || _c === void 0 ? void 0 : _c.id,
188
190
  employer_name: params.employerName,
189
- employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
191
+ employer_country: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
190
192
  source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.id],
191
193
  actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
192
194
  is_relative_PEP: params.isPEP,
193
195
  is_influencer: params.isInfluencer,
194
- encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
196
+ encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
195
197
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
196
198
  };
197
- return [4, API.entityService.updateEntityInfo(requestBody)];
199
+ return [4, API.entityService.updateIndividualInfo(requestBody)];
198
200
  case 1:
199
201
  data = (_j.sent()).data;
200
- if (!data.errors) {
202
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
201
203
  thunkApi.dispatch(handleNextScreenStep());
202
204
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
203
205
  }
@@ -224,13 +226,15 @@ export var updateLeadSuccess = createAsyncThunk('individualUpdateLeadSuccess', f
224
226
  return [4, API.leadService.updateLead(payload)];
225
227
  case 1:
226
228
  data = (_g.sent()).data;
229
+ if (!!data.errors) return [3, 3];
227
230
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
228
231
  case 2:
229
232
  _g.sent();
230
233
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
231
234
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
232
235
  thunkApi.dispatch(handleNextScreenStep());
233
- return [2, { response: data, formData: params }];
236
+ _g.label = 3;
237
+ case 3: return [2, { response: data, formData: params }];
234
238
  }
235
239
  });
236
240
  }); });
@@ -246,6 +250,7 @@ var initialState = {
246
250
  otp: ''
247
251
  },
248
252
  individualData: {
253
+ occupation: undefined,
249
254
  sourceIncome: undefined,
250
255
  monthlyIncome: undefined,
251
256
  employerName: '',
@@ -337,9 +342,9 @@ export var individualSlice = createSlice({
337
342
  .addCase(retrieveDataList.fulfilled, function (state, action) {
338
343
  state.loading = false;
339
344
  state.error = null;
340
- var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries;
345
+ var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries, occupation = _a.occupation;
341
346
  var data = state.data.individualData.responseBody;
342
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
347
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
343
348
  var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
344
349
  if (!!selectedSourceIncome)
345
350
  state.data.individualData.sourceIncome = selectedSourceIncome;
@@ -192,13 +192,15 @@ export var updateLeadSuccess = createAsyncThunk('passwordUpdateLeadSuccess', fun
192
192
  return [4, API.leadService.updateLead(payload)];
193
193
  case 1:
194
194
  data = (_g.sent()).data;
195
+ if (!!data.errors) return [3, 3];
195
196
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
196
197
  case 2:
197
198
  _g.sent();
198
199
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
199
200
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
200
201
  thunkApi.dispatch(handleNextScreenStep());
201
- return [2, { response: data, formData: params }];
202
+ _g.label = 3;
203
+ case 3: return [2, { response: data, formData: params }];
202
204
  }
203
205
  });
204
206
  }); });
@@ -191,13 +191,15 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
191
191
  return [4, API.leadService.updateLead(payload)];
192
192
  case 1:
193
193
  data = (_g.sent()).data;
194
+ if (!!data.errors) return [3, 3];
194
195
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
195
196
  case 2:
196
197
  _g.sent();
197
198
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
198
199
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
199
200
  thunkApi.dispatch(handleNextScreenStep());
200
- return [2, { response: data, formData: params }];
201
+ _g.label = 3;
202
+ case 3: return [2, { response: data, formData: params }];
201
203
  }
202
204
  });
203
205
  }); });
@@ -44,7 +44,7 @@ var IDBOD = function (_a) {
44
44
  dispatch(clearError());
45
45
  }, [methods.formState.isValid]);
46
46
  var onSubmit = function (data) {
47
- dispatch(updateLeadIdentity(__assign(__assign({}, data), { isResend: false })));
47
+ dispatch(updateLeadIdentity(data));
48
48
  };
49
49
  var handleCollapseOpenClose = function (flag) {
50
50
  setCollapse(flag);
@@ -17,8 +17,8 @@ import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { businessSelector, updateLeadIdentity } from '../../../app/business/businessStore';
21
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
20
+ import { resendOTPLeadIdentity } from '../../../app/business/businessStore';
21
+ import { useAppDispatch } from '../../../../hooks';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
24
24
  return ({
@@ -32,19 +32,13 @@ var OTPInput = function (_a) {
32
32
  var t = useTranslation().t;
33
33
  var dispatch = useAppDispatch();
34
34
  var otpControl = useController({ name: 'otp', control: control });
35
- var data = useAppSelector(businessSelector).data;
36
- var nidData = data.nidData;
37
35
  var handleOnOTPChange = function (otp) {
38
36
  otpControl.field.onChange(otp);
39
37
  };
40
38
  var handleOnResendOTP = function () {
41
39
  if (otpControl.field.value)
42
40
  setValue('otp', '', { shouldValidate: true });
43
- var params = {
44
- nid: nidData.nid,
45
- dob: nidData.dob
46
- };
47
- dispatch(updateLeadIdentity(__assign(__assign({}, params), { isResend: true })));
41
+ dispatch(resendOTPLeadIdentity());
48
42
  };
49
43
  var otpValue = otpControl.field.value;
50
44
  return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
@@ -96,7 +96,7 @@ var Mobile = function (_a) {
96
96
  dispatch(clearError());
97
97
  }, [methods.formState.isValid]);
98
98
  var onSubmit = function (formData) {
99
- dispatch(createMobileAuth(__assign(__assign({}, formData), { isResend: false })));
99
+ dispatch(createMobileAuth(formData));
100
100
  };
101
101
  var onBack = function () {
102
102
  dispatch(handlePrevScreenStep());
@@ -72,7 +72,7 @@ var NID = function (_a) {
72
72
  handleClearError();
73
73
  }, [methods.formState.isValid]);
74
74
  var onSubmit = function (data) {
75
- dispatch(createNIDAuth(__assign(__assign({}, data), { isResend: false })));
75
+ dispatch(createNIDAuth(data));
76
76
  };
77
77
  var handleCollapseOpenClose = function (flag) {
78
78
  setCollapse(flag);
@@ -17,7 +17,7 @@ import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { connectSelector, createMobileAuth, createNIDAuth } from '../../../app/connect/connectStore';
20
+ import { connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
21
21
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
@@ -33,8 +33,6 @@ var OTPInput = function (_a) {
33
33
  var dispatch = useAppDispatch();
34
34
  var otpControl = useController({ name: 'otp', control: control });
35
35
  var data = useAppSelector(connectSelector).data;
36
- var mobileData = data.mobileData;
37
- var nidData = data.nidData;
38
36
  var isAbsher = data.otpData.isAbsher;
39
37
  var handleOnOTPChange = function (otp) {
40
38
  otpControl.field.onChange(otp);
@@ -42,20 +40,12 @@ var OTPInput = function (_a) {
42
40
  var handleOnResendOTP = function () {
43
41
  if (otpControl.field.value)
44
42
  setValue('otp', '', { shouldValidate: true });
45
- var params = {
46
- countryCode: mobileData.countryCode,
47
- mobile: mobileData.mobile
48
- };
49
- dispatch(createMobileAuth(__assign(__assign({}, params), { isResend: true })));
43
+ dispatch(resendOTPMobile());
50
44
  };
51
45
  var handleOnResendAbsherOTP = function () {
52
46
  if (otpControl.field.value)
53
47
  setValue('otp', '', { shouldValidate: true });
54
- var params = {
55
- nid: nidData.nid,
56
- dob: nidData.dob
57
- };
58
- dispatch(createNIDAuth(__assign(__assign({}, params), { isResend: true })));
48
+ dispatch(resendOTPNID());
59
49
  };
60
50
  var otpValue = otpControl.field.value;
61
51
  return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isAbsher ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
@@ -30,11 +30,13 @@ import EmployerName from './EmployerName';
30
30
  import EmployerLocation from './EmployerLocation';
31
31
  import SourceOfIncome from './SourceOfIncome';
32
32
  import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
33
+ import Occupation from './Occupation';
33
34
  var ListType;
34
35
  (function (ListType) {
35
36
  ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
36
37
  ListType["EmployerLocationList"] = "EmployerLocationList";
37
38
  ListType["MonthlyIncomeList"] = "MonthlyIncomeList";
39
+ ListType["OccupationList"] = "OccupationList";
38
40
  })(ListType || (ListType = {}));
39
41
  var AdditionalIndividualInfo = function (_a) {
40
42
  var t = useTranslation().t;
@@ -75,7 +77,11 @@ var AdditionalIndividualInfo = function (_a) {
75
77
  var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
76
78
  var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
77
79
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
78
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
80
+ var isOccupationListActive = listActive === ListType.OccupationList;
81
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive &&
82
+ employerFieldsActive &&
83
+ !isMonthlyIncomeListActive &&
84
+ !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
79
85
  };
80
86
  export default React.memo(AdditionalIndividualInfo);
81
87
  AdditionalIndividualInfo.defaultProps = {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { Occupation as OccupationType } from '../../../../@types';
3
+ interface OccupationProps {
4
+ show: boolean;
5
+ onSelectOccupation?: (occupation: OccupationType) => void;
6
+ onListOpen?: () => void;
7
+ onListClose?: () => void;
8
+ }
9
+ declare const Occupation: ({ ...rest }: OccupationProps) => JSX.Element;
10
+ export default Occupation;
@@ -0,0 +1,89 @@
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 __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import Box from '@mui/material/Box';
26
+ import { styled } from '@mui/material/styles';
27
+ import { useTranslation } from 'react-i18next';
28
+ import { useController, useFormContext } from 'react-hook-form';
29
+ import { useAppSelector, useLanguage } from '../../../../hooks';
30
+ import { individualSelector } from '../../../app/individual/individualStore';
31
+ import Text from '../../../../components/Text';
32
+ import Collapse from '../../../../components/Collapse';
33
+ import CheckIcon from '@mui/icons-material/Check';
34
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
35
+ import Input from '../../../shared/Input';
36
+ import ExpandIcon from '../../../../components/ExpandIcon';
37
+ import SimpleList from '../../../../components/SimpleList';
38
+ var Container = styled(Box)(function () { return ({
39
+ display: 'flex'
40
+ }); });
41
+ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
42
+ var theme = _a.theme, isSelected = _a.isSelected;
43
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
44
+ });
45
+ var CheckIconStyled = styled(CheckIcon)(function (_a) {
46
+ var theme = _a.theme;
47
+ return ({
48
+ color: theme.palette.success.main,
49
+ display: 'flex',
50
+ alignItems: 'flex-end'
51
+ });
52
+ });
53
+ var Occupation = function (_a) {
54
+ var _b, _c;
55
+ var rest = __rest(_a, []);
56
+ var _d = React.useState([]), occupationList = _d[0], setOccupationList = _d[1];
57
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
58
+ var t = useTranslation().t;
59
+ var isAr = useLanguage().isAr;
60
+ var data = useAppSelector(individualSelector).data;
61
+ var control = useFormContext().control;
62
+ var occupationsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.occupationList) || [];
63
+ var occupationControl = useController({ control: control, name: 'occupation' });
64
+ React.useEffect(function () {
65
+ if ((occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.length) > 0) {
66
+ setOccupationList(occupationsList);
67
+ }
68
+ }, [occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.occupation]);
69
+ var onOpenList = function (event) {
70
+ var _a;
71
+ setAnchorEl(event.currentTarget);
72
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
73
+ };
74
+ var onCloseList = function () {
75
+ var _a;
76
+ setAnchorEl(null);
77
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
78
+ };
79
+ var onSelectItem = function (occupation) {
80
+ onCloseList();
81
+ occupationControl.field.onChange(occupation);
82
+ };
83
+ var occupation = occupationControl.field.value;
84
+ var error = (_c = occupationControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
85
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('occupation_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.name_ar : occupation === null || occupation === void 0 ? void 0 : occupation.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name_en', list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
86
+ return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) }, { children: isAr ? item.name_ar : item === null || item === void 0 ? void 0 : item.name_en })) }), item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
87
+ } }) }))] })) })));
88
+ };
89
+ export default Occupation;
@@ -2,18 +2,21 @@ import * as yup from 'yup';
2
2
  import { ObjectShape } from 'yup/lib/object';
3
3
  import { CountryCode } from '../../../../@types';
4
4
  export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<ObjectShape, {
5
+ occupation: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
5
6
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
6
7
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
7
8
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
8
9
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
9
10
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
10
11
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<ObjectShape, {
12
+ occupation: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
11
13
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
12
14
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
13
15
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
14
16
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
15
17
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
16
18
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<ObjectShape, {
19
+ occupation: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
17
20
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
18
21
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
19
22
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
@@ -1,5 +1,6 @@
1
1
  import * as yup from 'yup';
2
2
  export var IndividualInfoValidationSchema = yup.object().shape({
3
+ occupation: yup.object().required('alert_choose_occupation'),
3
4
  sourceIncome: yup.object().required('choose_any_source_of_income'),
4
5
  monthlyIncome: yup.object().optional(),
5
6
  employerLocation: yup.object().when('sourceIncome', function (sourceIncome) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.95-test",
3
+ "version": "1.0.96-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",