@tap-payments/auth-jsconnect 2.9.12-development → 2.9.12-sandbox

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 (43) 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/components/Input/Input.js +1 -1
  6. package/build/components/Tooltip/Tooltip.js +1 -1
  7. package/build/constants/app.d.ts +7 -0
  8. package/build/constants/app.js +38 -7
  9. package/build/features/app/business/businessStore.d.ts +10 -1
  10. package/build/features/app/business/businessStore.js +113 -9
  11. package/build/features/app/connect/connectStore.d.ts +8 -1
  12. package/build/features/app/connect/connectStore.js +127 -30
  13. package/build/features/app/connectExpress/connectExpressStore.d.ts +8 -1
  14. package/build/features/app/connectExpress/connectExpressStore.js +136 -3
  15. package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
  16. package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.js +105 -0
  17. package/build/features/business/screens/MobileOwnership/MobileNumber.d.ts +3 -0
  18. package/build/features/business/screens/MobileOwnership/MobileNumber.js +72 -0
  19. package/build/features/business/screens/MobileOwnership/index.d.ts +2 -0
  20. package/build/features/business/screens/MobileOwnership/index.js +2 -0
  21. package/build/features/business/screens/MobileOwnership/validation.d.ts +8 -0
  22. package/build/features/business/screens/MobileOwnership/validation.js +38 -0
  23. package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
  24. package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.js +106 -0
  25. package/build/features/connect/screens/MobileOwnership/MobileNumber.d.ts +3 -0
  26. package/build/features/connect/screens/MobileOwnership/MobileNumber.js +72 -0
  27. package/build/features/connect/screens/MobileOwnership/index.d.ts +2 -0
  28. package/build/features/connect/screens/MobileOwnership/index.js +2 -0
  29. package/build/features/connect/screens/MobileOwnership/validation.d.ts +8 -0
  30. package/build/features/connect/screens/MobileOwnership/validation.js +38 -0
  31. package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.d.ts +3 -0
  32. package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.js +108 -0
  33. package/build/features/connectExpress/screens/MobileOwnership/MobileNumber.d.ts +3 -0
  34. package/build/features/connectExpress/screens/MobileOwnership/MobileNumber.js +72 -0
  35. package/build/features/connectExpress/screens/MobileOwnership/index.d.ts +2 -0
  36. package/build/features/connectExpress/screens/MobileOwnership/index.js +2 -0
  37. package/build/features/connectExpress/screens/MobileOwnership/validation.d.ts +8 -0
  38. package/build/features/connectExpress/screens/MobileOwnership/validation.js +38 -0
  39. package/build/features/featuresScreens.js +15 -0
  40. package/build/features/shared/Button/FlowsButtons.js +1 -1
  41. package/build/features/shared/Dialog/DialogContainer.js +3 -3
  42. package/build/utils/common.js +3 -3
  43. package/package.json +2 -2
@@ -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);
@@ -57,7 +57,7 @@ var InputStyled = styled(Input)(function (_a) {
57
57
  height: '100%',
58
58
  width: '100%'
59
59
  },
60
- input: __assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default, padding: theme.spacing(1.5, 2.5, 1.5), '&::placeholder': {
60
+ input: __assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: "".concat(theme.palette.background.default, " !important"), padding: theme.spacing(1.5, 2.5, 1.5), '&::placeholder': {
61
61
  color: alpha(theme.palette.text.primary, 0.8),
62
62
  fontWeight: theme.typography.fontWeightLight
63
63
  } })
@@ -33,7 +33,7 @@ var StyledTooltip = styled(function (_a) {
33
33
  var _b;
34
34
  var theme = _a.theme;
35
35
  return (_b = {},
36
- _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) }),
36
+ _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)), zIndex: 2147483647 }),
37
37
  _b);
38
38
  });
39
39
  var TextStyled = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -1,5 +1,6 @@
1
1
  import { ScreenStepNavigation, BusinessType } from '../@types';
2
2
  export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company";
3
+ export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company";
3
4
  export declare const CONNECT_PROD_URL = "https://connect.tap.company";
4
5
  export declare const CLIENT_ORIGIN: string;
5
6
  export declare const TAP_WEBSITE = "https://www.tap.company/";
@@ -99,6 +100,8 @@ export declare const CONNECT_STEP_NAMES: {
99
100
  UPDATE_BRAND_SEGMENT_INFO: string;
100
101
  CREATE_AUTH_PASSWORD: string;
101
102
  VERIFY_AUTH_PASSWORD: string;
103
+ CONNECT_MOBILE_OWNERSHIP: string;
104
+ CONNECT_MOBILE_OWNERSHIP_SKIPPED: string;
102
105
  CONNECT_SUCCESS: string;
103
106
  };
104
107
  export declare const AUTH_STEP_NAMES: {
@@ -127,6 +130,8 @@ export declare const CONNECT_EXPRESS_STEP_NAMES: {
127
130
  CREATE_AUTH_PASSWORD: string;
128
131
  VERIFY_AUTH_PASSWORD: string;
129
132
  CONNECT_EXPRESS_SUCCESS: string;
133
+ COLLECT_MOBILE_OWNERSHIP: string;
134
+ COLLECT_MOBILE_OWNERSHIP_SKIPPED: string;
130
135
  };
131
136
  export declare const SignIn_STEP_NAMES: {
132
137
  CREATE_AUTH_MOBILE: string;
@@ -148,6 +153,8 @@ export declare const BUSINESS_STEP_NAMES: {
148
153
  BUSINESS_CR_ACTIVITIES: string;
149
154
  BUSINESS_CUSTOMERS: string;
150
155
  BUSINESS_SUCCESS: string;
156
+ BUSINESS_MOBILE_OWNERSHIP: string;
157
+ BUSINESS_MOBILE_OWNERSHIP_SKIPPED: string;
151
158
  };
152
159
  export declare const BANK_STEP_NAMES: {
153
160
  PHONE_AUTH: string;
@@ -1,6 +1,7 @@
1
1
  import { BusinessType } from '../@types';
2
2
  import { CONNECT_FLOWS } from './flows';
3
3
  export var CONNECT_DEV_URL = 'https://connect.dev.tap.company';
4
+ export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company';
4
5
  export var CONNECT_PROD_URL = 'https://connect.tap.company';
5
6
  export var CLIENT_ORIGIN = window.location.origin;
6
7
  export var TAP_WEBSITE = 'https://www.tap.company/';
@@ -80,7 +81,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
80
81
  },
81
82
  {
82
83
  name: 'CONNECT_INDIVIDUAL_STEP',
83
- next: 'CONNECT_MERCHANT_INFO_STEP',
84
+ next: ['CONNECT_MERCHANT_INFO_STEP', 'CONNECT_MOBILE_OWNERSHIP'],
84
85
  prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP', 'CONNECT_CIVIL_ID_STEP', 'CONNECT_DOB_STEP'],
85
86
  order: 3
86
87
  },
@@ -90,6 +91,12 @@ export var CONNECT_SCREENS_NAVIGATION = [
90
91
  prev: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_NID_STEP', 'CONNECT_MOBILE_STEP', 'CONNECT_CIVIL_ID_STEP'],
91
92
  order: 4
92
93
  },
94
+ {
95
+ name: 'CONNECT_MOBILE_OWNERSHIP',
96
+ next: 'CONNECT_MERCHANT_INFO_STEP',
97
+ prev: 'CONNECT_INDIVIDUAL_STEP',
98
+ order: 4
99
+ },
93
100
  {
94
101
  name: 'CONNECT_BRAND_SEGMENT_INFO_STEP',
95
102
  next: 'CONNECT_THANK_YOU_STEP',
@@ -202,7 +209,8 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
202
209
  next: [
203
210
  'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
204
211
  'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
205
- 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'
212
+ 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
213
+ 'COLLECT_MOBILE_OWNERSHIP'
206
214
  ],
207
215
  prev: 'CONNECT_EXPRESS_NID_MISSED_STEP',
208
216
  order: 4
@@ -221,7 +229,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
221
229
  },
222
230
  {
223
231
  name: 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
224
- next: ['CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
232
+ next: ['CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP', 'COLLECT_MOBILE_OWNERSHIP'],
225
233
  prev: [
226
234
  'CONNECT_EXPRESS_MOBILE_STEP',
227
235
  'CONNECT_EXPRESS_NID_STEP',
@@ -232,6 +240,17 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
232
240
  ],
233
241
  order: 5
234
242
  },
243
+ {
244
+ name: 'COLLECT_MOBILE_OWNERSHIP',
245
+ next: [
246
+ 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
247
+ 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
248
+ 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
249
+ 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
250
+ ],
251
+ prev: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
252
+ order: 6
253
+ },
235
254
  {
236
255
  name: 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
237
256
  next: 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
@@ -484,13 +503,13 @@ export var BUSINESS_SCREENS_NAVIGATION = [
484
503
  },
485
504
  {
486
505
  name: 'BUSINESS_VERIFY_NAFATH_STEP',
487
- next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP'],
506
+ next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP', 'BUSINESS_MOBILE_OWNERSHIP'],
488
507
  prev: 'BUSINESS_IDBOD_STEP',
489
508
  order: 3
490
509
  },
491
510
  {
492
511
  name: 'BUSINESS_DOB_STEP',
493
- next: 'BUSINESS_BUSINESS_TYPE_STEP',
512
+ next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_MOBILE_OWNERSHIP'],
494
513
  prev: 'BUSINESS_IDBOD_STEP',
495
514
  order: 2
496
515
  },
@@ -506,6 +525,12 @@ export var BUSINESS_SCREENS_NAVIGATION = [
506
525
  prev: 'BUSINESS_BUSINESS_TYPE_STEP',
507
526
  order: 2
508
527
  },
528
+ {
529
+ name: 'BUSINESS_MOBILE_OWNERSHIP',
530
+ next: ['BUSINESS_BUSINESS_TYPE_STEP', 'BUSINESS_DOB_STEP'],
531
+ prev: 'BUSINESS_IDBOD_STEP',
532
+ order: 3
533
+ },
509
534
  {
510
535
  name: 'BUSINESS_CONFIRM_STEP',
511
536
  next: 'BUSINESS_ACTIVITIES_STEP',
@@ -977,6 +1002,8 @@ export var CONNECT_STEP_NAMES = {
977
1002
  UPDATE_BRAND_SEGMENT_INFO: 'connect_update_brand_segment_info',
978
1003
  CREATE_AUTH_PASSWORD: 'connect_create_auth_password',
979
1004
  VERIFY_AUTH_PASSWORD: 'connect_verify_auth_password',
1005
+ CONNECT_MOBILE_OWNERSHIP: 'collect_owner_phone',
1006
+ CONNECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped',
980
1007
  CONNECT_SUCCESS: 'connect_completed'
981
1008
  };
982
1009
  export var AUTH_STEP_NAMES = {
@@ -1004,7 +1031,9 @@ export var CONNECT_EXPRESS_STEP_NAMES = {
1004
1031
  UPDATE_BRAND_INFO: 'connect_express_update_brand_info',
1005
1032
  CREATE_AUTH_PASSWORD: 'connect_express_create_auth_password',
1006
1033
  VERIFY_AUTH_PASSWORD: 'connect_express_verify_auth_password',
1007
- CONNECT_EXPRESS_SUCCESS: 'connect_express_completed'
1034
+ CONNECT_EXPRESS_SUCCESS: 'connect_express_completed',
1035
+ COLLECT_MOBILE_OWNERSHIP: 'collect_owner_phone',
1036
+ COLLECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
1008
1037
  };
1009
1038
  export var SignIn_STEP_NAMES = {
1010
1039
  CREATE_AUTH_MOBILE: 'signIn_create_auth_mobile',
@@ -1025,7 +1054,9 @@ export var BUSINESS_STEP_NAMES = {
1025
1054
  BUSINESS_INFO_CONFIRM: 'business_info_confirm',
1026
1055
  BUSINESS_CR_ACTIVITIES: 'business_cr_activities',
1027
1056
  BUSINESS_CUSTOMERS: 'business_customers',
1028
- BUSINESS_SUCCESS: 'business_completed'
1057
+ BUSINESS_SUCCESS: 'business_completed',
1058
+ BUSINESS_MOBILE_OWNERSHIP: 'collect_owner_phone',
1059
+ BUSINESS_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
1029
1060
  };
1030
1061
  export var BANK_STEP_NAMES = {
1031
1062
  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 (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
  }); });
@@ -511,7 +577,12 @@ export var updateLeadDOB = createAsyncThunk('business/updateLeadDOB', function (
511
577
  _g.sent();
512
578
  _g.label = 4;
513
579
  case 4:
514
- thunkApi.dispatch(handleNextScreenStep());
580
+ if (data.step_name === BUSINESS_STEP_NAMES.BUSINESS_MOBILE_OWNERSHIP) {
581
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_MOBILE_OWNERSHIP'));
582
+ }
583
+ else {
584
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
585
+ }
515
586
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
516
587
  return [2, { data: data, formData: params }];
517
588
  }
@@ -871,6 +942,10 @@ var initialState = {
871
942
  verify: {
872
943
  token: ''
873
944
  },
945
+ mobileData: {
946
+ countryCode: defaultCountry,
947
+ mobile: ''
948
+ },
874
949
  otpData: {
875
950
  otp: '',
876
951
  isNID: false
@@ -1083,7 +1158,7 @@ export var businessSlice = createSlice({
1083
1158
  var _a;
1084
1159
  state.loading = false;
1085
1160
  state.error = null;
1086
- var _b = action.payload, data = _b.data, formData = _b.formData;
1161
+ var _b = action.payload, data = _b.data, formData = _b.formData, countryCode = _b.countryCode;
1087
1162
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1088
1163
  if (description) {
1089
1164
  state.error = description;
@@ -1093,10 +1168,39 @@ export var businessSlice = createSlice({
1093
1168
  state.data.nidData.responseBody = data;
1094
1169
  state.data.otpData.otp = '';
1095
1170
  state.data.otpData.isNID = true;
1171
+ state.data.mobileData.countryCode = countryCode;
1172
+ state.data.mobileData.mobile = data.contact.phone.number;
1096
1173
  })
1097
1174
  .addCase(updateLeadIdentity.rejected, function (state, action) {
1098
1175
  state.loading = false;
1099
1176
  state.error = action.error.message;
1177
+ })
1178
+ .addCase(updateLeadMobile.pending, function (state) {
1179
+ state.loading = true;
1180
+ state.error = null;
1181
+ })
1182
+ .addCase(updateLeadMobile.fulfilled, function (state, action) {
1183
+ state.loading = false;
1184
+ state.error = null;
1185
+ state.data.mobileData.mobile = action.payload.leadResponse.contact.phone.number;
1186
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), action.payload.leadResponse);
1187
+ })
1188
+ .addCase(updateLeadMobile.rejected, function (state, action) {
1189
+ state.loading = false;
1190
+ state.error = action.error.message;
1191
+ })
1192
+ .addCase(skipUpdateLeadMobile.pending, function (state) {
1193
+ state.loading = true;
1194
+ state.error = null;
1195
+ })
1196
+ .addCase(skipUpdateLeadMobile.fulfilled, function (state, action) {
1197
+ state.loading = false;
1198
+ state.error = null;
1199
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), action.payload.leadResponse);
1200
+ })
1201
+ .addCase(skipUpdateLeadMobile.rejected, function (state, action) {
1202
+ state.loading = false;
1203
+ state.error = action.error.message;
1100
1204
  })
1101
1205
  .addCase(verifyNafath.pending, function (state) {
1102
1206
  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;