@tap-payments/auth-jsconnect 1.0.20 → 1.0.23

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 (52) hide show
  1. package/build/@types/app.d.ts +0 -9
  2. package/build/@types/form.d.ts +3 -0
  3. package/build/@types/redux.d.ts +1 -0
  4. package/build/api/availabilityServices.d.ts +12 -0
  5. package/build/api/availabilityServices.js +13 -0
  6. package/build/api/index.d.ts +6 -1
  7. package/build/api/index.js +3 -1
  8. package/build/app/settings.d.ts +2 -2
  9. package/build/app/settings.js +12 -8
  10. package/build/assets/locales/ar.json +2 -1
  11. package/build/assets/locales/en.json +2 -1
  12. package/build/components/Button/Button.js +1 -1
  13. package/build/constants/api.d.ts +2 -0
  14. package/build/constants/api.js +5 -1
  15. package/build/constants/app.js +3 -3
  16. package/build/features/app/connect/connectStore.d.ts +24 -4
  17. package/build/features/app/connect/connectStore.js +140 -17
  18. package/build/features/bank/screens/BankDetails/BankName.js +6 -1
  19. package/build/features/business/screens/Activities/Activities.js +6 -2
  20. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  21. package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -2
  22. package/build/features/business/screens/Customers/CustomerLocations.js +3 -3
  23. package/build/features/business/screens/Customers/Customers.js +19 -1
  24. package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +1 -0
  25. package/build/features/business/screens/Customers/ExpectedCustomers.js +3 -3
  26. package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -0
  27. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -3
  28. package/build/features/business/screens/VerifyNumber/VerifyNumber.js +1 -1
  29. package/build/features/connect/screens/Individual/Email.d.ts +2 -1
  30. package/build/features/connect/screens/Individual/Email.js +29 -3
  31. package/build/features/connect/screens/Individual/Individual.js +22 -9
  32. package/build/features/connect/screens/Individual/MobileNumber.d.ts +2 -0
  33. package/build/features/connect/screens/Individual/MobileNumber.js +8 -4
  34. package/build/features/connect/screens/Individual/Name.d.ts +2 -1
  35. package/build/features/connect/screens/Individual/Name.js +3 -1
  36. package/build/features/connect/screens/Merchant/BrandName.js +9 -0
  37. package/build/features/connect/screens/Merchant/Merchant.js +8 -2
  38. package/build/features/connect/screens/Merchant/validation.js +1 -1
  39. package/build/features/connect/screens/Mobile/Mobile.js +5 -4
  40. package/build/features/connect/screens/Mobile/MobileNumber.js +6 -6
  41. package/build/features/connect/screens/NID/DOB.js +12 -2
  42. package/build/features/connect/screens/NID/NID.js +6 -3
  43. package/build/features/connect/screens/NID/validation.js +1 -2
  44. package/build/features/connect/screens/OTP/OTP.js +4 -3
  45. package/build/features/connect/screens/OTP/OTPInput.js +7 -3
  46. package/build/features/connect/screens/Password/Password.js +17 -11
  47. package/build/features/connect/screens/Password/PasswordInput.js +1 -1
  48. package/build/features/connect/screens/ThankYou/ThankYou.js +6 -1
  49. package/build/features/shared/Button/Button.js +20 -6
  50. package/build/utils/string.d.ts +1 -0
  51. package/build/utils/string.js +5 -4
  52. package/package.json +3 -1
@@ -107,16 +107,7 @@ export interface SourceOfIncome {
107
107
  nameEn: string;
108
108
  }
109
109
  export interface AppInfo {
110
- identifier: string;
111
110
  name: string;
112
- version: string;
113
- requirer: string;
114
- requirer_version: string;
115
- app_locale: string;
116
- sdk_version: string;
117
- requirer_sim_network_name: string;
118
- requirer_sim_country_iso: string;
119
- universal_id: string;
120
111
  }
121
112
  export interface OSDetails {
122
113
  name: string;
@@ -7,6 +7,9 @@ export declare type MobileFormValues = {
7
7
  export declare type OTPFormValues = {
8
8
  otp: string;
9
9
  };
10
+ export declare type PasswordFormValues = {
11
+ password: string;
12
+ };
10
13
  export declare type NIDFormValues = {
11
14
  nid: string;
12
15
  dob: string;
@@ -2,6 +2,7 @@ export interface SharedState<T> {
2
2
  error: string | null;
3
3
  loading: boolean;
4
4
  data: T;
5
+ searchActive?: boolean;
5
6
  }
6
7
  export interface ActionState<T> {
7
8
  type: string;
@@ -0,0 +1,12 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ export declare type CheckEmailBody = {
3
+ email: string | null;
4
+ };
5
+ export declare type CheckBrandBody = {
6
+ profile_name: string;
7
+ };
8
+ declare const availabilityServices: {
9
+ checkEmail: (data: CheckEmailBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
10
+ checkBrand: (data: CheckBrandBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
11
+ };
12
+ export default availabilityServices;
@@ -0,0 +1,13 @@
1
+ import instance from './axios';
2
+ import { ENDPOINT_PATHS } from '../constants';
3
+ var checkEmail = function (data, config) {
4
+ return instance.post("".concat(ENDPOINT_PATHS.CHECK_EMAIL), data, config);
5
+ };
6
+ var checkBrand = function (data, config) {
7
+ return instance.post("".concat(ENDPOINT_PATHS.CHECK_BRAND), data, config);
8
+ };
9
+ var availabilityServices = {
10
+ checkEmail: checkEmail,
11
+ checkBrand: checkBrand
12
+ };
13
+ export default availabilityServices;
@@ -1,6 +1,7 @@
1
1
  import { ValidateOperatorBody } from './operator';
2
2
  import { CreateAuthBody, VerifyAuthBody } from './auth';
3
3
  import { UpdateLeadBody } from './lead';
4
+ import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
4
5
  declare const API: {
5
6
  ipService: {
6
7
  getIP: () => Promise<import("axios").AxiosResponse<any, any>>;
@@ -19,6 +20,10 @@ declare const API: {
19
20
  leadService: {
20
21
  updateLead: (data: UpdateLeadBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
21
22
  };
23
+ availabilityServices: {
24
+ checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
25
+ checkBrand: (data: CheckBrandBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
26
+ };
22
27
  };
23
- export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, UpdateLeadBody };
28
+ export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, UpdateLeadBody, CheckEmailBody, CheckBrandBody };
24
29
  export default API;
@@ -3,11 +3,13 @@ import { operatorService } from './operator';
3
3
  import { countryService } from './country';
4
4
  import { authService } from './auth';
5
5
  import { leadService } from './lead';
6
+ import availabilityServices from './availabilityServices';
6
7
  var API = {
7
8
  ipService: ipService,
8
9
  operatorService: operatorService,
9
10
  countryService: countryService,
10
11
  authService: authService,
11
- leadService: leadService
12
+ leadService: leadService,
13
+ availabilityServices: availabilityServices
12
14
  };
13
15
  export default API;
@@ -24,10 +24,10 @@ export declare const settingsSlice: import("@reduxjs/toolkit").Slice<SettingsSta
24
24
  handleLanguage: (state: SettingsState, action: ActionState<LanguageMode>) => void;
25
25
  handleNextScreenStep: (state: SettingsState, action: ActionState<string | undefined>) => void;
26
26
  handleCurrentActiveScreen: (state: SettingsState, action: ActionState<string>) => void;
27
- handlePrevScreenStep: (state: SettingsState) => void;
27
+ handlePrevScreenStep: (state: SettingsState, action: ActionState<string | undefined>) => void;
28
28
  handleActiveFlowScreens: (state: SettingsState, action: ActionState<Array<ScreenStepNavigation>>) => void;
29
29
  }, "settings">;
30
- export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, string>, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, string>, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], string>, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
30
+ export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, string>, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, string>, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], string>, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
31
31
  declare const _default: import("redux").Reducer<SettingsState, import("redux").AnyAction>;
32
32
  export default _default;
33
33
  export declare const settingsSelector: (state: RootState) => SettingsState;
@@ -122,11 +122,21 @@ export var settingsSlice = createSlice({
122
122
  return alert('Active screen not found');
123
123
  state.data.activeScreen = activeScreen;
124
124
  },
125
- handlePrevScreenStep: function (state) {
125
+ handlePrevScreenStep: function (state, action) {
126
126
  var prev = state.data.activeScreen.prev;
127
+ if (isArray(prev)) {
128
+ if (!action.payload)
129
+ return alert('Previous screen is an array, but no payload was provided');
130
+ var prevName_1 = findItem(prev, action.payload);
131
+ var prevScreen_1 = state.data.featureScreensNavigation.find(function (item) { return item.name === prevName_1; });
132
+ if (!prevScreen_1)
133
+ return alert('Previous screen step not found');
134
+ state.data.activeScreen = prevScreen_1;
135
+ return;
136
+ }
127
137
  var prevScreen = state.data.featureScreensNavigation.find(function (item) { return item.name === prev; });
128
138
  if (!prevScreen)
129
- return alert('Prev screen step not found');
139
+ return alert('Previous screen step not found');
130
140
  state.data.activeScreen = prevScreen;
131
141
  },
132
142
  handleActiveFlowScreens: function (state, action) {
@@ -137,16 +147,13 @@ export var settingsSlice = createSlice({
137
147
  extraReducers: function (builder) {
138
148
  builder
139
149
  .addCase(getClientIp.pending, function (state) {
140
- state.loading = true;
141
150
  state.error = null;
142
151
  })
143
152
  .addCase(getClientIp.fulfilled, function (state, action) {
144
- state.loading = false;
145
153
  state.error = null;
146
154
  state.data.deviceInfo.connection.ip = action.payload;
147
155
  })
148
156
  .addCase(getClientIp.rejected, function (state, action) {
149
- state.loading = false;
150
157
  state.error = action.error.message;
151
158
  })
152
159
  .addCase(getBrowserFingerPrint.pending, function (state) {
@@ -174,17 +181,14 @@ export var settingsSlice = createSlice({
174
181
  state.error = action.error.message;
175
182
  })
176
183
  .addCase(getOperator.pending, function (state) {
177
- state.loading = true;
178
184
  state.error = null;
179
185
  })
180
186
  .addCase(getOperator.fulfilled, function (state, action) {
181
187
  if (action.payload === 'valid') {
182
- state.loading = false;
183
188
  state.error = null;
184
189
  }
185
190
  })
186
191
  .addCase(getOperator.rejected, function (state, action) {
187
- state.loading = false;
188
192
  state.error = action.error.message;
189
193
  });
190
194
  }
@@ -208,5 +208,6 @@
208
208
  "fl_required": "رقم رخصة العمل الحر مطلوب",
209
209
  "fl_max_length": "طول رخصة العمل الحر يجب ان يكون{{length}}",
210
210
  "absher_button_label": "المتابعة عن طريق أبشر",
211
- "or": "أو"
211
+ "or": "أو",
212
+ "next": "التالي"
212
213
  }
@@ -222,5 +222,6 @@
222
222
  "fl_required": "Freelance number is required",
223
223
  "fl_max_length": "Freelance number length should be {{length}}",
224
224
  "absher_button_label": "Continue with Absher",
225
- "or": "Or"
225
+ "or": "Or",
226
+ "next": "next"
226
227
  }
@@ -43,7 +43,7 @@ var ButtonStyled = styled(Button)(function (_a) {
43
43
  backgroundColor: theme.palette.primary.main
44
44
  },
45
45
  ':disabled': {
46
- backgroundColor: alpha(theme.palette.primary.main, 0.6),
46
+ backgroundColor: alpha(theme.palette.primary.main, 0.3),
47
47
  color: theme.palette.common.white
48
48
  },
49
49
  '& .MuiButton-endIcon': {
@@ -6,4 +6,6 @@ export declare const ENDPOINT_PATHS: {
6
6
  OPERATOR: string;
7
7
  AUTH: string;
8
8
  LEAD: string;
9
+ CHECK_EMAIL: string;
10
+ CHECK_BRAND: string;
9
11
  };
@@ -5,6 +5,8 @@ var IP_PATH = '/ip';
5
5
  var OPERATOR_PATH = '/operator';
6
6
  var AUTH_PATH = '/auth';
7
7
  var LEAD_PATH = '/lead';
8
+ var CHECK_EMAIL = '/lead/identity/emailcheck';
9
+ var CHECK_BRAND = 'lead/profile/profile_name';
8
10
  export var ENDPOINT_PATHS = {
9
11
  BASE_URL: API_BASE_URL,
10
12
  BUSINESS_COUNTRIES: API_BUSINESS_COUNTRIES,
@@ -12,5 +14,7 @@ export var ENDPOINT_PATHS = {
12
14
  IP: IP_PATH,
13
15
  OPERATOR: OPERATOR_PATH,
14
16
  AUTH: AUTH_PATH,
15
- LEAD: LEAD_PATH
17
+ LEAD: LEAD_PATH,
18
+ CHECK_EMAIL: CHECK_EMAIL,
19
+ CHECK_BRAND: CHECK_BRAND
16
20
  };
@@ -26,19 +26,19 @@ export var CONNECT_SCREENS_NAVIGATION = [
26
26
  {
27
27
  name: 'CONNECT_OTP_STEP',
28
28
  next: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_PASSWORD_STEP'],
29
- prev: 'CONNECT_MOBILE_STEP',
29
+ prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
30
30
  order: 2
31
31
  },
32
32
  {
33
33
  name: 'CONNECT_INDIVIDUAL_STEP',
34
34
  next: 'CONNECT_MERCHANT_INFO_STEP',
35
- prev: 'CONNECT_OTP_STEP',
35
+ prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
36
36
  order: 3
37
37
  },
38
38
  {
39
39
  name: 'CONNECT_PASSWORD_STEP',
40
40
  next: 'CONNECT_MERCHANT_INFO_STEP',
41
- prev: 'CONNECT_OTP_STEP',
41
+ prev: ['CONNECT_MOBILE_STEP', 'CONNECT_NID_STEP'],
42
42
  order: 3
43
43
  },
44
44
  {
@@ -1,25 +1,36 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues } from '../../../@types';
2
+ import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, PasswordFormValues } from '../../../@types';
3
3
  export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  businessCountries: any;
5
5
  countries: any;
6
6
  }, void, {}>;
7
7
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
8
8
  response: any;
9
- formData: MobileFormValues;
10
- }, MobileFormValues, {}>;
9
+ formData: MobileFormValues & {
10
+ isResend: boolean;
11
+ };
12
+ }, MobileFormValues & {
13
+ isResend: boolean;
14
+ }, {}>;
11
15
  export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
12
16
  response: any;
13
17
  formData: {
14
18
  type: string;
15
19
  nid: string;
16
20
  dob: string;
21
+ isResend: boolean;
17
22
  };
18
- }, NIDFormValues, {}>;
23
+ }, NIDFormValues & {
24
+ isResend: boolean;
25
+ }, {}>;
19
26
  export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
20
27
  response: any;
21
28
  formData: OTPFormValues;
22
29
  }, OTPFormValues, {}>;
30
+ export declare const verifyAuthPassword: import("@reduxjs/toolkit").AsyncThunk<{
31
+ response: any;
32
+ formData: PasswordFormValues;
33
+ }, PasswordFormValues, {}>;
23
34
  export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
24
35
  response: any;
25
36
  formData: IndividualFormValues;
@@ -28,6 +39,14 @@ export declare const updateLeadBrand: import("@reduxjs/toolkit").AsyncThunk<{
28
39
  response: any;
29
40
  formData: BrandFormValues;
30
41
  }, BrandFormValues, {}>;
42
+ export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
43
+ response: any;
44
+ formData: string;
45
+ } | undefined, string, {}>;
46
+ export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").AsyncThunk<{
47
+ response: any;
48
+ formData: string;
49
+ } | undefined, string, {}>;
31
50
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
32
51
  response: any;
33
52
  formData: void;
@@ -42,6 +61,7 @@ export interface ConnectData {
42
61
  otpData: OTPFormValues & ResponseData & {
43
62
  isAbsher: boolean;
44
63
  };
64
+ passwordData: PasswordFormValues & ResponseData;
45
65
  individualData: IndividualFormValues & ResponseData;
46
66
  brandData: BrandFormValues & ResponseData;
47
67
  }
@@ -47,11 +47,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
+ import moment from 'moment-hijri';
50
51
  import { handleNextScreenStep } from '../../../app/settings';
51
52
  import API from '../../../api';
52
53
  import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
53
54
  import { defaultCountry } from '../../../constants/dummy';
54
- import { getIndividualName } from '../../../utils';
55
+ import { convertNumbers2English, getIndividualName } from '../../../utils';
55
56
  export var getCountries = createAsyncThunk('getCountries', function () { return __awaiter(void 0, void 0, void 0, function () {
56
57
  var countriesBody, BusinessCountries, list, countries, filterBusinessCountries;
57
58
  return __generator(this, function (_a) {
@@ -93,24 +94,28 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
93
94
  return [4, API.authService.createAuth(requestBody)];
94
95
  case 1:
95
96
  data = (_a.sent()).data;
96
- if (!data.errors)
97
+ if (!data.errors && !params.isResend)
97
98
  thunkApi.dispatch(handleNextScreenStep());
98
99
  return [2, { response: data, formData: params }];
99
100
  }
100
101
  });
101
102
  }); });
102
103
  export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
103
- var _a, settings, connect, identification_id_type, requestBody, data;
104
+ var _a, settings, connect, identification_id_type, birthDate, requestBody, data;
104
105
  return __generator(this, function (_b) {
105
106
  switch (_b.label) {
106
107
  case 0:
107
108
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
108
109
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
110
+ birthDate = params.dob;
111
+ if (identification_id_type === IDENTIFICATION_TYPE.NID) {
112
+ birthDate = convertNumbers2English(moment(birthDate, 'YYYY-MM-DD').format('iYYYY/iMM/iDD')).split('/').join('-');
113
+ }
109
114
  requestBody = {
110
115
  user_credentail: {
111
116
  identification_id: params.nid,
112
117
  identification_id_type: identification_id_type,
113
- date_of_birth: params.dob,
118
+ date_of_birth: birthDate,
114
119
  country_code: connect.data.mobileData.businessCountry.iso2
115
120
  },
116
121
  device_info: settings.data.deviceInfo,
@@ -121,7 +126,7 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
121
126
  return [4, API.authService.createAuth(requestBody)];
122
127
  case 1:
123
128
  data = (_b.sent()).data;
124
- if (!data.errors)
129
+ if (!data.errors && !params.isResend)
125
130
  thunkApi.dispatch(handleNextScreenStep());
126
131
  return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
127
132
  }
@@ -156,16 +161,43 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
156
161
  thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
157
162
  }
158
163
  else {
159
- if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in)
160
- thunkApi.dispatch(handleNextScreenStep('CONNECT_PASSWORD_STEP'));
161
- else
162
- alert('Need to implement this flow');
164
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_PASSWORD_STEP'));
163
165
  }
164
166
  }
165
167
  return [2, { response: data, formData: params }];
166
168
  }
167
169
  });
168
170
  }); });
171
+ export var verifyAuthPassword = createAsyncThunk('verifyAuthPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
172
+ var connect, isAbsher, responseBody, payload, data;
173
+ return __generator(this, function (_a) {
174
+ switch (_a.label) {
175
+ case 0:
176
+ connect = thunkApi.getState().connect;
177
+ isAbsher = connect.data.otpData.isAbsher;
178
+ responseBody = (isAbsher ? connect.data.nidData : connect.data.mobileData).responseBody;
179
+ payload = {
180
+ data: params.password,
181
+ auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
182
+ auth_type: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_type,
183
+ device_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.device_token,
184
+ service_name: responseBody === null || responseBody === void 0 ? void 0 : responseBody.service_name,
185
+ new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
186
+ sign_in: true,
187
+ remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
188
+ scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
189
+ step_name: CONNECT_STEP_NAMES.VERIFY_AUTH_PASSWORD,
190
+ encryption_contract: []
191
+ };
192
+ return [4, API.authService.verifyAuth(payload)];
193
+ case 1:
194
+ data = (_a.sent()).data;
195
+ if (!data.errors)
196
+ thunkApi.dispatch(handleNextScreenStep());
197
+ return [2, { response: data, formData: params }];
198
+ }
199
+ });
200
+ }); });
169
201
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
170
202
  var _a, settings, connect, isAbsher, headers, payload, data;
171
203
  var _b, _c, _d;
@@ -235,6 +267,52 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
235
267
  }
236
268
  });
237
269
  }); });
270
+ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (email, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
271
+ var _a, settings, connect, headers, requestBody, data;
272
+ var _b, _c, _d;
273
+ return __generator(this, function (_e) {
274
+ switch (_e.label) {
275
+ case 0:
276
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
277
+ headers = {
278
+ lead_id: (_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id,
279
+ device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
280
+ };
281
+ requestBody = {
282
+ email: email
283
+ };
284
+ return [4, API.availabilityServices.checkEmail(requestBody, { headers: headers })];
285
+ case 1:
286
+ data = (_e.sent()).data;
287
+ if (!data.errors)
288
+ return [2, { response: data, formData: email }];
289
+ return [2];
290
+ }
291
+ });
292
+ }); });
293
+ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailability', function (brandName, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
294
+ var _a, settings, connect, headers, requestBody, data;
295
+ var _b, _c, _d;
296
+ return __generator(this, function (_e) {
297
+ switch (_e.label) {
298
+ case 0:
299
+ _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
300
+ headers = {
301
+ lead_id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
302
+ device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
303
+ };
304
+ requestBody = {
305
+ profile_name: brandName
306
+ };
307
+ return [4, API.availabilityServices.checkBrand(requestBody, { headers: headers })];
308
+ case 1:
309
+ data = (_e.sent()).data;
310
+ if (!data.errors)
311
+ return [2, { response: data, formData: brandName }];
312
+ return [2];
313
+ }
314
+ });
315
+ }); });
238
316
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
239
317
  var _a, settings, connect, headers, payload, data;
240
318
  var _b, _c, _d;
@@ -253,11 +331,6 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
253
331
  return [4, API.leadService.updateLead(payload, { headers: headers })];
254
332
  case 1:
255
333
  data = (_e.sent()).data;
256
- if (!data.errors) {
257
- console.log('success');
258
- alert('Account created successfully, please check your email');
259
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
260
- }
261
334
  return [2, { response: data, formData: params }];
262
335
  }
263
336
  });
@@ -265,6 +338,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
265
338
  var initialState = {
266
339
  error: null,
267
340
  loading: false,
341
+ searchActive: false,
268
342
  data: {
269
343
  countries: [],
270
344
  businessCountries: [],
@@ -282,6 +356,9 @@ var initialState = {
282
356
  otp: '',
283
357
  isAbsher: false
284
358
  },
359
+ passwordData: {
360
+ password: ''
361
+ },
285
362
  individualData: {
286
363
  name: '',
287
364
  email: '',
@@ -313,18 +390,15 @@ export var connectSlice = createSlice({
313
390
  extraReducers: function (builder) {
314
391
  builder
315
392
  .addCase(getCountries.fulfilled, function (state, action) {
316
- state.loading = false;
317
393
  state.error = null;
318
394
  var _a = action.payload, businessCountries = _a.businessCountries, countries = _a.countries;
319
395
  state.data.businessCountries = businessCountries;
320
396
  state.data.countries = countries;
321
397
  })
322
398
  .addCase(getCountries.pending, function (state) {
323
- state.loading = true;
324
399
  state.error = null;
325
400
  })
326
401
  .addCase(getCountries.rejected, function (state, action) {
327
- state.loading = false;
328
402
  state.error = action.error.message;
329
403
  })
330
404
  .addCase(createMobileAuth.fulfilled, function (state, action) {
@@ -391,6 +465,27 @@ export var connectSlice = createSlice({
391
465
  .addCase(verifyAuth.rejected, function (state, action) {
392
466
  state.loading = false;
393
467
  state.error = action.error.message;
468
+ })
469
+ .addCase(verifyAuthPassword.fulfilled, function (state, action) {
470
+ var _a;
471
+ state.loading = false;
472
+ state.error = null;
473
+ var _b = action.payload, formData = _b.formData, response = _b.response;
474
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
475
+ if (description) {
476
+ state.error = description;
477
+ return;
478
+ }
479
+ state.data.passwordData.password = formData.password;
480
+ state.data.passwordData.responseBody = response;
481
+ })
482
+ .addCase(verifyAuthPassword.pending, function (state) {
483
+ state.loading = true;
484
+ state.error = null;
485
+ })
486
+ .addCase(verifyAuthPassword.rejected, function (state, action) {
487
+ state.loading = false;
488
+ state.error = action.error.message;
394
489
  })
395
490
  .addCase(updateLeadIndividual.fulfilled, function (state, action) {
396
491
  var _a;
@@ -433,6 +528,34 @@ export var connectSlice = createSlice({
433
528
  .addCase(updateLeadBrand.rejected, function (state, action) {
434
529
  state.loading = false;
435
530
  state.error = action.error.message;
531
+ })
532
+ .addCase(checkEmailAvailability.fulfilled, function (state, action) {
533
+ var _a;
534
+ state.searchActive = false;
535
+ state.error = null;
536
+ state.data.individualData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
537
+ })
538
+ .addCase(checkEmailAvailability.pending, function (state) {
539
+ state.searchActive = true;
540
+ state.error = null;
541
+ })
542
+ .addCase(checkEmailAvailability.rejected, function (state, action) {
543
+ state.searchActive = false;
544
+ state.error = action.error.message;
545
+ })
546
+ .addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
547
+ var _a;
548
+ state.searchActive = false;
549
+ state.error = null;
550
+ state.data.brandData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
551
+ })
552
+ .addCase(checkBrandNameAvailability.pending, function (state) {
553
+ state.searchActive = true;
554
+ state.error = null;
555
+ })
556
+ .addCase(checkBrandNameAvailability.rejected, function (state, action) {
557
+ state.searchActive = false;
558
+ state.error = action.error.message;
436
559
  })
437
560
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
438
561
  var _a;
@@ -12,6 +12,11 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
12
12
  marginBlockEnd: theme.spacing(3)
13
13
  });
14
14
  });
15
+ var InputStyled = styled(Input)(function () { return ({
16
+ '& .MuiInputBase-input': {
17
+ cursor: 'default'
18
+ }
19
+ }); });
15
20
  var BankName = function () {
16
21
  var _a;
17
22
  var t = useTranslation().t;
@@ -22,6 +27,6 @@ var BankName = function () {
22
27
  var clearValue = function () {
23
28
  bankNameControl.field.onChange('');
24
29
  };
25
- return (_jsx(FeatureStyled, { children: _jsx(Input, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), value: bankNameValue, required: true, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
30
+ return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), value: bankNameValue, required: true, readOnly: true, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
26
31
  };
27
32
  export default BankName;
@@ -31,7 +31,8 @@ var FormStyled = styled(Form)(function () { return ({
31
31
  flexDirection: 'column'
32
32
  }); });
33
33
  var Activities = function () {
34
- var _a = React.useState(false), collapse = _a[0], setCollapse = _a[1];
34
+ var _a = React.useState(false), anchorEl = _a[0], setAnchorEl = _a[1];
35
+ var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
35
36
  var dispatch = useAppDispatch();
36
37
  var isAr = useLanguage().isAr;
37
38
  var t = useTranslation().t;
@@ -55,6 +56,9 @@ var Activities = function () {
55
56
  var onBack = function () {
56
57
  dispatch(handlePrevScreenStep());
57
58
  };
58
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!ACTIVITIES && _jsx(ActivitiesList, {}), _jsx(SalesChannels, {})] })), _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
59
+ var handleMenuClick = function () {
60
+ anchorEl ? setAnchorEl(false) : setAnchorEl(true);
61
+ };
62
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!ACTIVITIES && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
59
63
  };
60
64
  export default Activities;
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
20
20
  export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
21
21
  children?: React.ReactNode;
22
22
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
23
- color?: "inherit" | "disabled" | "error" | "success" | "primary" | "secondary" | "action" | "info" | "warning" | undefined;
23
+ color?: "inherit" | "disabled" | "error" | "primary" | "secondary" | "action" | "info" | "success" | "warning" | undefined;
24
24
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
25
25
  htmlColor?: string | undefined;
26
26
  inheritViewBox?: boolean | undefined;