@tap-payments/auth-jsconnect 2.9.13-development → 2.9.15-development

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 (39) hide show
  1. package/build/@types/form.d.ts +4 -0
  2. package/build/assets/locales/ar.json +6 -1
  3. package/build/assets/locales/en.json +6 -1
  4. package/build/components/AnimationFlow/BottomSheet.js +3 -3
  5. package/build/constants/app.d.ts +6 -0
  6. package/build/constants/app.js +36 -6
  7. package/build/features/app/business/businessStore.d.ts +10 -1
  8. package/build/features/app/business/businessStore.js +107 -8
  9. package/build/features/app/connect/connectStore.d.ts +8 -1
  10. package/build/features/app/connect/connectStore.js +127 -30
  11. package/build/features/app/connectExpress/connectExpressStore.d.ts +8 -1
  12. package/build/features/app/connectExpress/connectExpressStore.js +149 -16
  13. package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
  14. package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.js +104 -0
  15. package/build/features/business/screens/MobileOwnership/MobileNumber.d.ts +3 -0
  16. package/build/features/business/screens/MobileOwnership/MobileNumber.js +72 -0
  17. package/build/features/business/screens/MobileOwnership/index.d.ts +2 -0
  18. package/build/features/business/screens/MobileOwnership/index.js +2 -0
  19. package/build/features/business/screens/MobileOwnership/validation.d.ts +8 -0
  20. package/build/features/business/screens/MobileOwnership/validation.js +38 -0
  21. package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
  22. package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.js +105 -0
  23. package/build/features/connect/screens/MobileOwnership/MobileNumber.d.ts +3 -0
  24. package/build/features/connect/screens/MobileOwnership/MobileNumber.js +72 -0
  25. package/build/features/connect/screens/MobileOwnership/index.d.ts +2 -0
  26. package/build/features/connect/screens/MobileOwnership/index.js +2 -0
  27. package/build/features/connect/screens/MobileOwnership/validation.d.ts +8 -0
  28. package/build/features/connect/screens/MobileOwnership/validation.js +38 -0
  29. package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
  30. package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.js +107 -0
  31. package/build/features/connectExpress/screens/MobileOwnership/MobileNumber.d.ts +3 -0
  32. package/build/features/connectExpress/screens/MobileOwnership/MobileNumber.js +72 -0
  33. package/build/features/connectExpress/screens/MobileOwnership/index.d.ts +2 -0
  34. package/build/features/connectExpress/screens/MobileOwnership/index.js +2 -0
  35. package/build/features/connectExpress/screens/MobileOwnership/validation.d.ts +8 -0
  36. package/build/features/connectExpress/screens/MobileOwnership/validation.js +38 -0
  37. package/build/features/featuresScreens.js +15 -0
  38. package/build/features/shared/Dialog/DialogContainer.js +3 -3
  39. package/package.json +1 -1
@@ -160,3 +160,7 @@ export declare type AuthenticationListFormValues = {
160
160
  export declare type AuthMerchantFormValues = {
161
161
  merchantInfo?: AuthMerchantInfo;
162
162
  };
163
+ export declare type MobileOwnershipFormValues = {
164
+ mobile: string;
165
+ countryCode: CountryCode;
166
+ };
@@ -632,5 +632,10 @@
632
632
  "year": "السنة",
633
633
  "yes": "نعم",
634
634
  "your_brand_details": "تفاصيل علامتك التجارية",
635
- "يرجى التحقق من اسم تطبيق ابل": ""
635
+ "يرجى التحقق من اسم تطبيق ابل": "",
636
+ "mobile_ownership_title": "لتفعيل استلام الايداعات، يرجى تحديث رقم هاتفك المحمول المسجل ليتوافق مع هويتك.",
637
+ "current_mobile_number": "رقم الجوال الحالي",
638
+ "new_mobile_number": "رقم الجوال الجديد",
639
+ "update_mobile_number": "تحديث رقم الجوال",
640
+ "update_later": "سأقوم بالتحديث لاحقاً"
636
641
  }
@@ -659,5 +659,10 @@
659
659
  "website_label": "Website",
660
660
  "year": "Year",
661
661
  "yes": "Yes",
662
- "your_brand_details": "Your brand details"
662
+ "your_brand_details": "Your brand details",
663
+ "mobile_ownership_title": "To enable bank payouts, please update your registered mobile number to match your national ID.",
664
+ "current_mobile_number": "Current mobile number",
665
+ "new_mobile_number": "New mobile number",
666
+ "update_mobile_number": "Update mobile number",
667
+ "update_later": "I'll update later"
663
668
  }
@@ -79,7 +79,8 @@ var CloseIconStyled = styled(Icon)(function (_a) {
79
79
  var theme = _a.theme;
80
80
  return ({
81
81
  width: theme.spacing(3.75),
82
- height: theme.spacing(3.75)
82
+ height: theme.spacing(3.75),
83
+ cursor: 'pointer'
83
84
  });
84
85
  });
85
86
  var CloseBox = styled(Box)(function (_a) {
@@ -89,7 +90,6 @@ var CloseBox = styled(Box)(function (_a) {
89
90
  justifyContent: 'end',
90
91
  marginBlockStart: theme.spacing(2),
91
92
  marginInlineEnd: theme.spacing(2),
92
- cursor: 'pointer',
93
93
  direction: theme.direction,
94
94
  position: 'absolute',
95
95
  right: 0,
@@ -134,6 +134,6 @@ var BottomSheetComponent = function (_a) {
134
134
  return (_jsxs(BottomSheetStyled, __assign({ languageBarHeight: getLanguageBarHeight(), dialogEdgeFormat: dialogEdgeFormat, sibling: hideFooter ? (_jsx(_Fragment, {})) : (open && (_jsx(LanguageFooterStyled, { children: _jsx(CustomFooter, {}) }))), isMaturityExpress: isMaturityExpress, showPoweredBy: !hidePoweredBy, sx: { pointerEvents: pointerEvents }, ref: sheetRef, open: open, snapPoints: function (_a) {
135
135
  var maxHeight = _a.maxHeight;
136
136
  return [getMinHeight(maxHeight), maxHeight * 0.95];
137
- } }, rest, { children: [isMaturityExpress && !hideMerchantLogo && (_jsx(LogoBadge, { src: isMaturityExpress ? logo || ICONS_NAMES.LOGO_ICON : ICONS_NAMES.LOGO_ICON })), onClose && (_jsx(CloseBox, __assign({ id: 'close-container', onClick: handleOnCloseButton }, { children: _jsx(CloseIconStyled, { src: ICONS_NAMES.CLOSE_ICON }) }))), children, isMaturityExpress && !hidePoweredBy && (_jsx(FooterStyled, { children: _jsx(PoweredByFooter, { id: 'bottom-sheet-powered_by_footer', sx: { margin: '0px' }, textSx: { color: 'rgba(63, 66, 77, 0.6)' }, icon: isAr ? ICONS_NAMES.LOGO_WITH_NAME_DARK_AR_ICON : ICONS_NAMES.LOGO_WITH_NAME_DARK_EN_ICON }) }))] })));
137
+ } }, rest, { children: [isMaturityExpress && !hideMerchantLogo && (_jsx(LogoBadge, { src: isMaturityExpress ? logo || ICONS_NAMES.LOGO_ICON : ICONS_NAMES.LOGO_ICON })), onClose && (_jsx(CloseBox, __assign({ id: 'close-container' }, { children: _jsx(CloseIconStyled, { src: ICONS_NAMES.CLOSE_ICON, onClick: handleOnCloseButton }) }))), children, isMaturityExpress && !hidePoweredBy && (_jsx(FooterStyled, { children: _jsx(PoweredByFooter, { id: 'bottom-sheet-powered_by_footer', sx: { margin: '0px' }, textSx: { color: 'rgba(63, 66, 77, 0.6)' }, icon: isAr ? ICONS_NAMES.LOGO_WITH_NAME_DARK_AR_ICON : ICONS_NAMES.LOGO_WITH_NAME_DARK_EN_ICON }) }))] })));
138
138
  };
139
139
  export default React.memo(BottomSheetComponent);
@@ -99,6 +99,8 @@ export declare const CONNECT_STEP_NAMES: {
99
99
  UPDATE_BRAND_SEGMENT_INFO: string;
100
100
  CREATE_AUTH_PASSWORD: string;
101
101
  VERIFY_AUTH_PASSWORD: string;
102
+ CONNECT_MOBILE_OWNERSHIP: string;
103
+ CONNECT_MOBILE_OWNERSHIP_SKIPPED: string;
102
104
  CONNECT_SUCCESS: string;
103
105
  };
104
106
  export declare const AUTH_STEP_NAMES: {
@@ -127,6 +129,8 @@ export declare const CONNECT_EXPRESS_STEP_NAMES: {
127
129
  CREATE_AUTH_PASSWORD: string;
128
130
  VERIFY_AUTH_PASSWORD: string;
129
131
  CONNECT_EXPRESS_SUCCESS: string;
132
+ COLLECT_MOBILE_OWNERSHIP: string;
133
+ COLLECT_MOBILE_OWNERSHIP_SKIPPED: string;
130
134
  };
131
135
  export declare const SignIn_STEP_NAMES: {
132
136
  CREATE_AUTH_MOBILE: string;
@@ -148,6 +152,8 @@ export declare const BUSINESS_STEP_NAMES: {
148
152
  BUSINESS_CR_ACTIVITIES: string;
149
153
  BUSINESS_CUSTOMERS: string;
150
154
  BUSINESS_SUCCESS: string;
155
+ BUSINESS_MOBILE_OWNERSHIP: string;
156
+ BUSINESS_MOBILE_OWNERSHIP_SKIPPED: string;
151
157
  };
152
158
  export declare const BANK_STEP_NAMES: {
153
159
  PHONE_AUTH: string;
@@ -80,7 +80,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
80
80
  },
81
81
  {
82
82
  name: 'CONNECT_INDIVIDUAL_STEP',
83
- next: 'CONNECT_MERCHANT_INFO_STEP',
83
+ next: ['CONNECT_MERCHANT_INFO_STEP', 'CONNECT_MOBILE_OWNERSHIP'],
84
84
  prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP', 'CONNECT_CIVIL_ID_STEP', 'CONNECT_DOB_STEP'],
85
85
  order: 3
86
86
  },
@@ -90,6 +90,12 @@ export var CONNECT_SCREENS_NAVIGATION = [
90
90
  prev: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_NID_STEP', 'CONNECT_MOBILE_STEP', 'CONNECT_CIVIL_ID_STEP'],
91
91
  order: 4
92
92
  },
93
+ {
94
+ name: 'CONNECT_MOBILE_OWNERSHIP',
95
+ next: 'CONNECT_MERCHANT_INFO_STEP',
96
+ prev: 'CONNECT_INDIVIDUAL_STEP',
97
+ order: 4
98
+ },
93
99
  {
94
100
  name: 'CONNECT_BRAND_SEGMENT_INFO_STEP',
95
101
  next: 'CONNECT_THANK_YOU_STEP',
@@ -202,7 +208,8 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
202
208
  next: [
203
209
  'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
204
210
  'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
205
- 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'
211
+ 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
212
+ 'COLLECT_MOBILE_OWNERSHIP'
206
213
  ],
207
214
  prev: 'CONNECT_EXPRESS_NID_MISSED_STEP',
208
215
  order: 4
@@ -221,7 +228,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
221
228
  },
222
229
  {
223
230
  name: 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
224
- next: ['CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
231
+ next: ['CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP', 'COLLECT_MOBILE_OWNERSHIP'],
225
232
  prev: [
226
233
  'CONNECT_EXPRESS_MOBILE_STEP',
227
234
  'CONNECT_EXPRESS_NID_STEP',
@@ -232,6 +239,17 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
232
239
  ],
233
240
  order: 5
234
241
  },
242
+ {
243
+ name: 'COLLECT_MOBILE_OWNERSHIP',
244
+ next: [
245
+ 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
246
+ 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
247
+ 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
248
+ 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
249
+ ],
250
+ prev: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
251
+ order: 6
252
+ },
235
253
  {
236
254
  name: 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
237
255
  next: 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
@@ -484,7 +502,7 @@ export var BUSINESS_SCREENS_NAVIGATION = [
484
502
  },
485
503
  {
486
504
  name: 'BUSINESS_VERIFY_NAFATH_STEP',
487
- next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP'],
505
+ next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP', 'BUSINESS_MOBILE_OWNERSHIP'],
488
506
  prev: 'BUSINESS_IDBOD_STEP',
489
507
  order: 3
490
508
  },
@@ -506,6 +524,12 @@ export var BUSINESS_SCREENS_NAVIGATION = [
506
524
  prev: 'BUSINESS_BUSINESS_TYPE_STEP',
507
525
  order: 2
508
526
  },
527
+ {
528
+ name: 'BUSINESS_MOBILE_OWNERSHIP',
529
+ next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP'],
530
+ prev: 'BUSINESS_IDBOD_STEP',
531
+ order: 3
532
+ },
509
533
  {
510
534
  name: 'BUSINESS_CONFIRM_STEP',
511
535
  next: 'BUSINESS_ACTIVITIES_STEP',
@@ -977,6 +1001,8 @@ export var CONNECT_STEP_NAMES = {
977
1001
  UPDATE_BRAND_SEGMENT_INFO: 'connect_update_brand_segment_info',
978
1002
  CREATE_AUTH_PASSWORD: 'connect_create_auth_password',
979
1003
  VERIFY_AUTH_PASSWORD: 'connect_verify_auth_password',
1004
+ CONNECT_MOBILE_OWNERSHIP: 'collect_owner_phone',
1005
+ CONNECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped',
980
1006
  CONNECT_SUCCESS: 'connect_completed'
981
1007
  };
982
1008
  export var AUTH_STEP_NAMES = {
@@ -1004,7 +1030,9 @@ export var CONNECT_EXPRESS_STEP_NAMES = {
1004
1030
  UPDATE_BRAND_INFO: 'connect_express_update_brand_info',
1005
1031
  CREATE_AUTH_PASSWORD: 'connect_express_create_auth_password',
1006
1032
  VERIFY_AUTH_PASSWORD: 'connect_express_verify_auth_password',
1007
- CONNECT_EXPRESS_SUCCESS: 'connect_express_completed'
1033
+ CONNECT_EXPRESS_SUCCESS: 'connect_express_completed',
1034
+ COLLECT_MOBILE_OWNERSHIP: 'collect_owner_phone',
1035
+ COLLECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
1008
1036
  };
1009
1037
  export var SignIn_STEP_NAMES = {
1010
1038
  CREATE_AUTH_MOBILE: 'signIn_create_auth_mobile',
@@ -1025,7 +1053,9 @@ export var BUSINESS_STEP_NAMES = {
1025
1053
  BUSINESS_INFO_CONFIRM: 'business_info_confirm',
1026
1054
  BUSINESS_CR_ACTIVITIES: 'business_cr_activities',
1027
1055
  BUSINESS_CUSTOMERS: 'business_customers',
1028
- BUSINESS_SUCCESS: 'business_completed'
1056
+ BUSINESS_SUCCESS: 'business_completed',
1057
+ BUSINESS_MOBILE_OWNERSHIP: 'collect_owner_phone',
1058
+ BUSINESS_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
1029
1059
  };
1030
1060
  export var BANK_STEP_NAMES = {
1031
1061
  PHONE_AUTH: 'bank_phone_auth',
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, CivilFormValues, ActionState, AsyncThunkParams, DOBFormValues } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, CivilFormValues, ActionState, AsyncThunkParams, DOBFormValues, MobileFormValues, MobileOwnershipFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  verifyNextStepName: any;
@@ -45,6 +45,13 @@ export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<{
45
45
  response: any;
46
46
  isNextScreenDob: boolean;
47
47
  }, verifyNafathParams, {}>;
48
+ export declare const updateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
49
+ leadResponse: any;
50
+ formData: MobileOwnershipFormValues;
51
+ }, MobileOwnershipFormValues, {}>;
52
+ export declare const skipUpdateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
53
+ leadResponse: any;
54
+ }, void, {}>;
48
55
  interface verifyPACIParams {
49
56
  onSuccess?: () => void;
50
57
  }
@@ -63,6 +70,7 @@ export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
63
70
  dob?: any;
64
71
  termAndConditionChecked?: boolean | undefined;
65
72
  };
73
+ countryCode: import("../../../@types").CountryCode;
66
74
  }, NIDFormValues, {}>;
67
75
  export declare const updateLeadDOB: import("@reduxjs/toolkit").AsyncThunk<{
68
76
  data: any;
@@ -130,6 +138,7 @@ export interface BusinessData {
130
138
  activitiesData: ActivitiesFormValues & ResponseData;
131
139
  customersData: CustomersFormValues & ResponseData;
132
140
  flowName: FlowsTypes;
141
+ mobileData: (MobileFormValues | undefined) & ResponseData;
133
142
  }
134
143
  export interface BusinessState extends SharedState<BusinessData> {
135
144
  customLoading?: boolean;
@@ -58,8 +58,8 @@ var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import API from '../../../api';
60
60
  import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
61
- import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
62
- import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM } from '../../../utils';
61
+ import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE, defaultCountry } from '../../../constants';
62
+ import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix } from '../../../utils';
63
63
  import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
@@ -316,7 +316,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
316
316
  });
317
317
  }); });
318
318
  export var verifyNafath = createAsyncThunk('business/verifyNafathParams', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
319
- var _a, settings, business, responseBody, expiry, interval, maxCalls, count, data, isSuccess, isFailed, isNextScreenDob, screen_1;
319
+ var _a, settings, business, responseBody, expiry, interval, maxCalls, count, data, isSuccess, isFailed, isNextScreenDob, isNextScreenCollectMobileOwnership, screen_1;
320
320
  var _b, _c, _d, _e, _f, _g;
321
321
  return __generator(this, function (_h) {
322
322
  switch (_h.label) {
@@ -352,8 +352,14 @@ export var verifyNafath = createAsyncThunk('business/verifyNafathParams', functi
352
352
  case 4:
353
353
  _h.sent();
354
354
  isNextScreenDob = data.step_name === COLLECT_DOB_INFO_NAFATH;
355
- screen_1 = isNextScreenDob ? 'BUSINESS_DOB_STEP' : 'BUSINESS_BUSINESS_TYPE_STEP';
356
- thunkApi.dispatch(handleNextScreenStep(screen_1));
355
+ isNextScreenCollectMobileOwnership = data.step_name === BUSINESS_STEP_NAMES.BUSINESS_MOBILE_OWNERSHIP;
356
+ if (isSA(business.data.mobileData.countryCode.iso2) && isNextScreenCollectMobileOwnership) {
357
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_MOBILE_OWNERSHIP'));
358
+ }
359
+ else {
360
+ screen_1 = isNextScreenDob ? 'BUSINESS_DOB_STEP' : 'BUSINESS_BUSINESS_TYPE_STEP';
361
+ thunkApi.dispatch(handleNextScreenStep(screen_1));
362
+ }
357
363
  return [2, { response: data, isNextScreenDob: isNextScreenDob }];
358
364
  case 5: return [4, sleep(interval * 1000)];
359
365
  case 6:
@@ -366,6 +372,63 @@ export var verifyNafath = createAsyncThunk('business/verifyNafathParams', functi
366
372
  }
367
373
  });
368
374
  }); });
375
+ export var updateLeadMobile = createAsyncThunk('connect/updateLeadMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
376
+ var _a, settings, business, lead_id, payload, leadResponse, isNextScreenDob, screen;
377
+ var _b, _c;
378
+ return __generator(this, function (_d) {
379
+ switch (_d.label) {
380
+ case 0:
381
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
382
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
383
+ payload = {
384
+ id: lead_id || '',
385
+ contact: {
386
+ phone: {
387
+ country_code: params.countryCode.idd_prefix.toString(),
388
+ number: params.mobile
389
+ }
390
+ },
391
+ step_name: BUSINESS_STEP_NAMES.BUSINESS_MOBILE_OWNERSHIP,
392
+ encryption_contract: ['contact.phone.country_code', 'contact.phone.number']
393
+ };
394
+ return [4, API.leadService.updateLead(payload)];
395
+ case 1:
396
+ leadResponse = _d.sent();
397
+ if (leadResponse.step_name === BUSINESS_STEP_NAMES.BUSINESS_MOBILE_OWNERSHIP) {
398
+ throw new Error("The new mobile number doesn't match the national ID, please update the mobile to the correct one");
399
+ }
400
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, params);
401
+ isNextScreenDob = leadResponse.step_name === COLLECT_DOB_INFO_NAFATH;
402
+ screen = isNextScreenDob ? 'BUSINESS_DOB_STEP' : 'BUSINESS_BUSINESS_TYPE_STEP';
403
+ thunkApi.dispatch(handleNextScreenStep(screen));
404
+ return [2, { leadResponse: leadResponse, formData: params }];
405
+ }
406
+ });
407
+ }); });
408
+ export var skipUpdateLeadMobile = createAsyncThunk('connect/skipUpdateLeadMobile', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
409
+ var _a, settings, business, lead_id, payload, leadResponse, isNextScreenDob, screen;
410
+ var _b, _c;
411
+ return __generator(this, function (_d) {
412
+ switch (_d.label) {
413
+ case 0:
414
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
415
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
416
+ payload = {
417
+ id: lead_id || '',
418
+ step_name: BUSINESS_STEP_NAMES.BUSINESS_MOBILE_OWNERSHIP_SKIPPED,
419
+ encryption_contract: []
420
+ };
421
+ return [4, API.leadService.updateLead(payload)];
422
+ case 1:
423
+ leadResponse = _d.sent();
424
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, {});
425
+ isNextScreenDob = leadResponse.step_name === COLLECT_DOB_INFO_NAFATH;
426
+ screen = isNextScreenDob ? 'BUSINESS_DOB_STEP' : 'BUSINESS_BUSINESS_TYPE_STEP';
427
+ thunkApi.dispatch(handleNextScreenStep(screen));
428
+ return [2, { leadResponse: leadResponse }];
429
+ }
430
+ });
431
+ }); });
369
432
  export var verifyPACI = createAsyncThunk('businessVerifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
370
433
  var _a, settings, business, responseBody, _b, business_id, entity, expiry, interval, maxCalls, count, data, isSuccess;
371
434
  var _c, _d, _e, _f;
@@ -440,7 +503,7 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
440
503
  });
441
504
  }); });
442
505
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
443
- var _a, settings, business, identification_id_type, stepName, lead_id, countryIso2, dob, requestBody, data, business_id, entity, screen;
506
+ var _a, settings, business, identification_id_type, stepName, lead_id, countryIso2, dob, requestBody, data, business_id, entity, screen, countryCode;
444
507
  var _b, _c;
445
508
  return __generator(this, function (_d) {
446
509
  switch (_d.label) {
@@ -479,7 +542,10 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
479
542
  case 3:
480
543
  thunkApi.dispatch(handleNextScreenStep(screen));
481
544
  (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
482
- return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
545
+ countryCode = settings.data.businessCountry;
546
+ if (data.contact.phone.country_code)
547
+ countryCode = findCountryByIddPrefix(settings.data.countries, data.contact.phone.country_code);
548
+ return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }), countryCode: countryCode }];
483
549
  }
484
550
  });
485
551
  }); });
@@ -871,6 +937,10 @@ var initialState = {
871
937
  verify: {
872
938
  token: ''
873
939
  },
940
+ mobileData: {
941
+ countryCode: defaultCountry,
942
+ mobile: ''
943
+ },
874
944
  otpData: {
875
945
  otp: '',
876
946
  isNID: false
@@ -1083,7 +1153,7 @@ export var businessSlice = createSlice({
1083
1153
  var _a;
1084
1154
  state.loading = false;
1085
1155
  state.error = null;
1086
- var _b = action.payload, data = _b.data, formData = _b.formData;
1156
+ var _b = action.payload, data = _b.data, formData = _b.formData, countryCode = _b.countryCode;
1087
1157
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1088
1158
  if (description) {
1089
1159
  state.error = description;
@@ -1093,10 +1163,39 @@ export var businessSlice = createSlice({
1093
1163
  state.data.nidData.responseBody = data;
1094
1164
  state.data.otpData.otp = '';
1095
1165
  state.data.otpData.isNID = true;
1166
+ state.data.mobileData.countryCode = countryCode;
1167
+ state.data.mobileData.mobile = data.contact.phone.number;
1096
1168
  })
1097
1169
  .addCase(updateLeadIdentity.rejected, function (state, action) {
1098
1170
  state.loading = false;
1099
1171
  state.error = action.error.message;
1172
+ })
1173
+ .addCase(updateLeadMobile.pending, function (state) {
1174
+ state.loading = true;
1175
+ state.error = null;
1176
+ })
1177
+ .addCase(updateLeadMobile.fulfilled, function (state, action) {
1178
+ state.loading = false;
1179
+ state.error = null;
1180
+ state.data.mobileData.mobile = action.payload.leadResponse.contact.phone.number;
1181
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), action.payload.leadResponse);
1182
+ })
1183
+ .addCase(updateLeadMobile.rejected, function (state, action) {
1184
+ state.loading = false;
1185
+ state.error = action.error.message;
1186
+ })
1187
+ .addCase(skipUpdateLeadMobile.pending, function (state) {
1188
+ state.loading = true;
1189
+ state.error = null;
1190
+ })
1191
+ .addCase(skipUpdateLeadMobile.fulfilled, function (state, action) {
1192
+ state.loading = false;
1193
+ state.error = null;
1194
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), action.payload.leadResponse);
1195
+ })
1196
+ .addCase(skipUpdateLeadMobile.rejected, function (state, action) {
1197
+ state.loading = false;
1198
+ state.error = action.error.message;
1100
1199
  })
1101
1200
  .addCase(verifyNafath.pending, function (state) {
1102
1201
  state.loading = true;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, AuthForType, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, BrandFormValues, BrandSegmentFormValues, DOBFormValues } from '../../../@types';
2
+ import { ActionState, AuthForType, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, BrandFormValues, BrandSegmentFormValues, DOBFormValues, MobileOwnershipFormValues } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const updateBusinessCountry: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
5
5
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
@@ -75,6 +75,13 @@ export declare const updateLeadBrandSegment: import("@reduxjs/toolkit").AsyncThu
75
75
  response: any;
76
76
  formData: Pick<BrandSegmentFormValues, "teamSize">;
77
77
  }, Pick<BrandSegmentFormValues, "teamSize">, {}>;
78
+ export declare const updateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
79
+ leadResponse: any;
80
+ formData: MobileOwnershipFormValues;
81
+ }, MobileOwnershipFormValues, {}>;
82
+ export declare const skipUpdateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
83
+ leadResponse: any;
84
+ }, void, {}>;
78
85
  export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
79
86
  response: any;
80
87
  formData: string;