@tap-payments/auth-jsconnect 1.0.57 → 1.0.59

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 (33) hide show
  1. package/build/@types/form.d.ts +2 -2
  2. package/build/api/entity.d.ts +20 -0
  3. package/build/api/entity.js +5 -1
  4. package/build/api/index.d.ts +3 -2
  5. package/build/app/settings.js +1 -1
  6. package/build/assets/locales/ar.json +3 -0
  7. package/build/assets/locales/en.json +3 -0
  8. package/build/constants/api.d.ts +1 -0
  9. package/build/constants/api.js +3 -1
  10. package/build/constants/app.js +5 -11
  11. package/build/constants/assets.d.ts +3 -0
  12. package/build/constants/assets.js +4 -1
  13. package/build/features/app/bank/bankStore.d.ts +5 -3
  14. package/build/features/app/bank/bankStore.js +81 -16
  15. package/build/features/app/individual/individualStore.d.ts +4 -0
  16. package/build/features/app/individual/individualStore.js +80 -18
  17. package/build/features/bank/screens/BankDetails/BankDetails.js +7 -9
  18. package/build/features/bank/screens/BankDetails/Beneficiary.js +9 -1
  19. package/build/features/bank/screens/Success/Success.js +6 -0
  20. package/build/features/connect/screens/ThankYou/ThankYou.js +1 -4
  21. package/build/features/featuresScreens.js +0 -5
  22. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -15
  23. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +10 -1
  24. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +1 -1
  25. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -2
  26. package/build/features/individual/screens/Success/Success.js +6 -0
  27. package/build/features/shared/Button/EmailProvidersButtons.d.ts +13 -0
  28. package/build/features/shared/Button/EmailProvidersButtons.js +92 -0
  29. package/build/features/shared/Button/index.d.ts +2 -1
  30. package/build/features/shared/Button/index.js +2 -1
  31. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -2
  32. package/build/features/shared/SuccessScreen/SuccessScreen.js +4 -4
  33. package/package.json +1 -1
@@ -54,10 +54,10 @@ export declare type TaxFormValues = {
54
54
  vatId: string;
55
55
  };
56
56
  export declare type IndividualExtraFormValues = {
57
- sourceIncome: SourceOfIncome;
57
+ sourceIncome: SourceOfIncome | undefined;
58
58
  monthlyIncome: string;
59
59
  employerName: string;
60
- employerLocation: CountryCode;
60
+ employerLocation: CountryCode | undefined;
61
61
  isPEP: boolean | null;
62
62
  isInfluencer: boolean | null;
63
63
  };
@@ -10,14 +10,34 @@ export declare type EntityInfoCreateBody = {
10
10
  vat_id?: string;
11
11
  agree_chargeback?: boolean;
12
12
  agree_refund?: boolean;
13
+ employer_name?: string;
14
+ employer_city?: string | null;
15
+ source_income?: Array<string | undefined>;
16
+ actual_income?: string;
17
+ is_relative_PEP?: boolean | null;
18
+ is_influencer?: boolean | null;
13
19
  step_name: string;
14
20
  encryption_contract?: Array<string>;
15
21
  };
22
+ export declare type EntityBankUpdateBody = {
23
+ wallet_id?: string;
24
+ entity_id: string;
25
+ bank_account: {
26
+ bank_name: string;
27
+ beneficiary_name: string;
28
+ bank_statement_file_id?: string;
29
+ iban: string;
30
+ swift_code?: string;
31
+ account_number?: string;
32
+ };
33
+ step_name: string;
34
+ };
16
35
  export interface EntityInfoUpdateBody extends EntityInfoCreateBody {
17
36
  id: string;
18
37
  }
19
38
  declare const entityService: {
20
39
  createEntityInfo: (data: EntityInfoCreateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
21
40
  updateEntityInfo: (data: EntityInfoUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
41
+ createBankAccount: (data: EntityBankUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
22
42
  };
23
43
  export { entityService };
@@ -6,8 +6,12 @@ var createEntityInfo = function (data, config) {
6
6
  var updateEntityInfo = function (data, config) {
7
7
  return instance.put("".concat(ENDPOINT_PATHS.ENTITY), data, config);
8
8
  };
9
+ var createBankAccount = function (data, config) {
10
+ return instance.post("".concat(ENDPOINT_PATHS.BANK), data, config);
11
+ };
9
12
  var entityService = {
10
13
  createEntityInfo: createEntityInfo,
11
- updateEntityInfo: updateEntityInfo
14
+ updateEntityInfo: updateEntityInfo,
15
+ createBankAccount: createBankAccount
12
16
  };
13
17
  export { entityService };
@@ -3,7 +3,7 @@ import { ValidateOperatorBody } from './operator';
3
3
  import { CreateAuthBody, VerifyAuthBody } from './auth';
4
4
  import { UpdateLeadBody, LeadVerifyBody, CreateLeadBody, LeadOTPVerifyBody, LeadIdentityUpdateBody } from './lead';
5
5
  import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
6
- import { EntityInfoUpdateBody, EntityInfoCreateBody } from './entity';
6
+ import { EntityInfoUpdateBody, EntityInfoCreateBody, EntityBankUpdateBody } from './entity';
7
7
  import { CreateAccountBody } from './account';
8
8
  declare const API: {
9
9
  ipService: {
@@ -32,6 +32,7 @@ declare const API: {
32
32
  entityService: {
33
33
  createEntityInfo: (data: EntityInfoCreateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
34
34
  updateEntityInfo: (data: EntityInfoUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
35
+ createBankAccount: (data: EntityBankUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
35
36
  };
36
37
  availabilityServices: {
37
38
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -50,6 +51,6 @@ declare const API: {
50
51
  getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
51
52
  };
52
53
  };
53
- export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoCreateBody, EntityInfoUpdateBody, CreateAccountBody };
54
+ export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoCreateBody, EntityInfoUpdateBody, CreateAccountBody, EntityBankUpdateBody };
54
55
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders };
55
56
  export default API;
@@ -154,7 +154,7 @@ export var settingsSlice = createSlice({
154
154
  },
155
155
  handleActiveFlowScreens: function (state, action) {
156
156
  state.data.featureScreensNavigation = action.payload;
157
- state.data.activeScreen = action.payload[0];
157
+ state.data.activeScreen = action.payload[5];
158
158
  },
159
159
  handleSetAppConfig: function (state, action) {
160
160
  var _a = action.payload, appInfo = _a.appInfo, businessCountryCode = _a.businessCountryCode, language = _a.language, onError = _a.onError, onFlowCompleted = _a.onFlowCompleted, publicKey = _a.publicKey;
@@ -215,6 +215,9 @@
215
215
  "select_brand_label": "Brand List",
216
216
  "choose_brand": "Choose Brand",
217
217
  "confirm_enter_iban": "الايبان",
218
+ "open_gmail": "Gmail",
219
+ "open_outlook": "Outlook",
220
+ "open_apple": "Apple",
218
221
  "choose_any_license": "Choose Licene",
219
222
  "future_work": "Future Work",
220
223
  "add_other_fl": "Add Freelance",
@@ -229,6 +229,9 @@
229
229
  "select_brand_label": "Brand List",
230
230
  "choose_brand": "Choose Brand",
231
231
  "confirm_enter_iban": "IBAN",
232
+ "open_gmail": "Gmail",
233
+ "open_outlook": "Outlook",
234
+ "open_apple": "Apple",
232
235
  "choose_any_license": "Choose Licene",
233
236
  "future_work": "Future Work",
234
237
  "add_other_fl": "Add Freelance",
@@ -18,4 +18,5 @@ export declare const ENDPOINT_PATHS: {
18
18
  CUSTOMER_BASES: string;
19
19
  SALES: string;
20
20
  EXPECTED_CUSTOMERS: string;
21
+ BANK: string;
21
22
  };
@@ -9,6 +9,7 @@ var LEAD_IDENTITY_PATH = '/lead/identity';
9
9
  var LEAD_IDENTITY_VERIFY_PATH = 'lead/identity/verify';
10
10
  var RETRIEVE_ENTITY_LIST_PATH = '/lead/entity/list';
11
11
  var ENTITY_PATH = '/entity';
12
+ var BANK_PATH = '/entity/bankaccount';
12
13
  var CHECK_EMAIL = '/lead/identity/emailcheck';
13
14
  var CHECK_BRAND = 'lead/profile/profile_name';
14
15
  var CREATE_ACCOUNT_PATH = '/account/create';
@@ -36,5 +37,6 @@ export var ENDPOINT_PATHS = {
36
37
  CHANNEL: CHANNEL_PATH,
37
38
  CUSTOMER_BASES: CUSTOMER_BASES_PATH,
38
39
  SALES: SALES_PATH,
39
- EXPECTED_CUSTOMERS: EXPECTED_CUSTOMERS_PATH
40
+ EXPECTED_CUSTOMERS: EXPECTED_CUSTOMERS_PATH,
41
+ BANK: BANK_PATH
40
42
  };
@@ -103,27 +103,21 @@ export var BUSINESS_SCREENS_NAVIGATION = [
103
103
  export var INDIVIDUAL_SCREENS_NAVIGATION = [
104
104
  {
105
105
  name: 'INDIVIDUAL_VERIFY_STEP',
106
- next: 'INDIVIDUAL_SHOW_INDIVIDUAL_INFO_STEP',
106
+ next: ['INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_SUCCESS_STEP'],
107
107
  prev: '',
108
108
  order: 1
109
109
  },
110
- {
111
- name: 'INDIVIDUAL_SHOW_INDIVIDUAL_INFO_STEP',
112
- next: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
113
- prev: 'INDIVIDUAL_VERIFY_STEP',
114
- order: 2
115
- },
116
110
  {
117
111
  name: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
118
112
  next: 'INDIVIDUAL_SUCCESS_STEP',
119
- prev: 'INDIVIDUAL_SHOW_INDIVIDUAL_INFO_STEP',
120
- order: 3
113
+ prev: 'INDIVIDUAL_VERIFY_STEP',
114
+ order: 2
121
115
  },
122
116
  {
123
117
  name: 'INDIVIDUAL_SUCCESS_STEP',
124
118
  next: '',
125
119
  prev: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
126
- order: 4
120
+ order: 3
127
121
  }
128
122
  ];
129
123
  export var PASSWORD_SCREENS_NAVIGATION = [
@@ -149,7 +143,7 @@ export var PASSWORD_SCREENS_NAVIGATION = [
149
143
  export var BANK_SCREENS_NAVIGATION = [
150
144
  {
151
145
  name: 'BANK_VERIFY_STEP',
152
- next: 'BANK_BANK_DETAILS_STEP',
146
+ next: ['BANK_BANK_DETAILS_STEP', 'BANK_DETAILS_SUCCESS_STEP'],
153
147
  prev: '',
154
148
  order: 1
155
149
  },
@@ -34,4 +34,7 @@ export declare const ICONS_NAMES: {
34
34
  ABSHER_LOGO: string;
35
35
  EMAIL_ICON: string;
36
36
  MOBILE_ICON: string;
37
+ GMAIL_ICON: string;
38
+ OUTLOOK_ICON: string;
39
+ APPLE_MAIL_ICON: string;
37
40
  };
@@ -33,5 +33,8 @@ export var ICONS_NAMES = {
33
33
  SUCCESS: 'https://tap-connecet.b-cdn.net/imgs/success.svg',
34
34
  ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
35
35
  EMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/email.png',
36
- MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg'
36
+ MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg',
37
+ GMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/gmail-icon.svg',
38
+ OUTLOOK_ICON: 'https://dash.b-cdn.net/icons/menu/outlook-mail.svg',
39
+ APPLE_MAIL_ICON: 'https://dash.b-cdn.net/icons/menu/mail-ios.svg'
37
40
  };
@@ -7,10 +7,12 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
7
7
  }, string, {}>;
8
8
  export declare const verifyBankLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  data: any;
10
- formData: {
11
- otp: string;
12
- };
10
+ formData: OTPFormValues;
13
11
  }, OTPFormValues, {}>;
12
+ export declare const createBankAccount: import("@reduxjs/toolkit").AsyncThunk<{
13
+ data: any;
14
+ formData: BankFormValues;
15
+ }, BankFormValues, {}>;
14
16
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
15
17
  response: any;
16
18
  formData: void;
@@ -77,10 +77,10 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
77
77
  });
78
78
  }); });
79
79
  export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
- var _a, bank, settings, responseBody, payload, data;
81
- var _b, _c, _d;
82
- return __generator(this, function (_e) {
83
- switch (_e.label) {
80
+ var _a, bank, settings, responseBody, payload, data, steps, hasBankCompleted;
81
+ var _b, _c, _d, _e;
82
+ return __generator(this, function (_f) {
83
+ switch (_f.label) {
84
84
  case 0:
85
85
  _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
86
86
  responseBody = bank.data.verify.responseBody;
@@ -93,33 +93,73 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
93
93
  };
94
94
  return [4, API.leadService.verifyLeadOTP(payload)];
95
95
  case 1:
96
- data = (_e.sent()).data;
96
+ data = (_f.sent()).data;
97
97
  if (!data.errors) {
98
98
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
99
+ steps = (_e = bank.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.steps;
100
+ hasBankCompleted = Object.keys(steps).find(function (key) { return key === BANK_STEP_NAMES.BANK_SUCCESS; });
101
+ if (hasBankCompleted) {
102
+ thunkApi.dispatch(handleNextScreenStep('BANK_DETAILS_SUCCESS_STEP'));
103
+ }
104
+ else {
105
+ thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
106
+ }
107
+ }
108
+ return [2, { data: data, formData: params }];
109
+ }
110
+ });
111
+ }); });
112
+ export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var _a, settings, bank, iban, beneficiaryName, bank_name, requestBody, data;
114
+ var _b, _c, _d, _e;
115
+ return __generator(this, function (_f) {
116
+ switch (_f.label) {
117
+ case 0:
118
+ _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
119
+ iban = params.iban;
120
+ beneficiaryName = params.beneficiaryName;
121
+ bank_name = params.bankName;
122
+ requestBody = {
123
+ entity_id: (_c = (_b = bank.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
124
+ bank_account: {
125
+ iban: iban,
126
+ beneficiary_name: beneficiaryName,
127
+ bank_name: bank_name
128
+ },
129
+ step_name: BANK_STEP_NAMES.BANK_INFO
130
+ };
131
+ return [4, API.entityService.createBankAccount(requestBody)];
132
+ case 1:
133
+ data = (_f.sent()).data;
134
+ if (!data.errors) {
99
135
  thunkApi.dispatch(handleNextScreenStep());
136
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
100
137
  }
101
- return [2, { data: data, formData: __assign({}, params) }];
138
+ return [2, { data: data, formData: params }];
102
139
  }
103
140
  });
104
141
  }); });
105
142
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
106
- var _a, settings, bank, payload, data;
107
- var _b, _c, _d, _e, _f;
108
- return __generator(this, function (_g) {
109
- switch (_g.label) {
143
+ var _a, settings, bank, response, payload;
144
+ var _b, _c, _d, _e, _f, _g;
145
+ return __generator(this, function (_h) {
146
+ switch (_h.label) {
110
147
  case 0:
111
148
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
149
+ response = undefined;
150
+ if (!!!((_b = bank.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
112
151
  payload = {
113
152
  step_name: BANK_STEP_NAMES.BANK_SUCCESS,
114
- id: ((_b = bank.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
153
+ id: ((_c = bank.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
115
154
  encryption_contract: []
116
155
  };
117
156
  return [4, API.leadService.updateLead(payload)];
118
157
  case 1:
119
- data = (_g.sent()).data;
120
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
121
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
122
- return [2, { response: data, formData: params }];
158
+ response = _h.sent();
159
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
160
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
161
+ _h.label = 2;
162
+ case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
123
163
  }
124
164
  });
125
165
  }); });
@@ -136,7 +176,7 @@ var initialState = {
136
176
  bankData: {
137
177
  iban: '',
138
178
  beneficiaryName: '',
139
- bankName: ''
179
+ bankName: 'Global Bank'
140
180
  }
141
181
  }
142
182
  };
@@ -156,6 +196,9 @@ export var bankSlice = createSlice({
156
196
  },
157
197
  extraReducers: function (builder) {
158
198
  builder
199
+ .addCase(verifyLeadToken.pending, function (state) {
200
+ state.error = null;
201
+ })
159
202
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
160
203
  var _a;
161
204
  state.error = null;
@@ -186,6 +229,7 @@ export var bankSlice = createSlice({
186
229
  return;
187
230
  }
188
231
  state.data.otpData = formData;
232
+ state.data.otpData.responseBody = data;
189
233
  })
190
234
  .addCase(verifyBankLeadOTP.rejected, function (state, action) {
191
235
  state.loading = false;
@@ -210,6 +254,27 @@ export var bankSlice = createSlice({
210
254
  .addCase(updateLeadSuccess.rejected, function (state, action) {
211
255
  state.loading = false;
212
256
  state.error = action.error.message;
257
+ })
258
+ .addCase(createBankAccount.pending, function (state) {
259
+ state.loading = true;
260
+ state.error = null;
261
+ })
262
+ .addCase(createBankAccount.fulfilled, function (state, action) {
263
+ var _a;
264
+ state.loading = false;
265
+ state.error = null;
266
+ var _b = action.payload, data = _b.data, formData = _b.formData;
267
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
268
+ if (description) {
269
+ state.error = description;
270
+ return;
271
+ }
272
+ state.data.bankData = formData;
273
+ state.data.bankData.responseBody = data;
274
+ })
275
+ .addCase(createBankAccount.rejected, function (state, action) {
276
+ state.loading = false;
277
+ state.error = action.error.message;
213
278
  });
214
279
  }
215
280
  });
@@ -11,6 +11,10 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
11
11
  otp: string;
12
12
  };
13
13
  }, OTPFormValues, {}>;
14
+ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
15
+ data: any;
16
+ formData: IndividualExtraFormValues;
17
+ }, IndividualExtraFormValues, {}>;
14
18
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
15
19
  response: any;
16
20
  formData: void;
@@ -50,7 +50,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { removeRequestHeaders } from '../../../utils';
52
52
  import { handleNextScreenStep } from '../../../app/settings';
53
- import { defaultCountry, INDIVIDUAl_STEP_NAMES, SOURCE_OF_INCOME } from '../../../constants';
53
+ import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
55
  var payload, data, leadResponse;
56
56
  return __generator(this, function (_a) {
@@ -77,10 +77,10 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
77
77
  });
78
78
  }); });
79
79
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
- var _a, individual, settings, responseBody, payload, data;
81
- var _b, _c, _d;
82
- return __generator(this, function (_e) {
83
- switch (_e.label) {
80
+ var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
81
+ var _b, _c, _d, _e;
82
+ return __generator(this, function (_f) {
83
+ switch (_f.label) {
84
84
  case 0:
85
85
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
86
86
  responseBody = individual.data.verify.responseBody;
@@ -93,33 +93,71 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
93
93
  };
94
94
  return [4, API.leadService.verifyLeadOTP(payload)];
95
95
  case 1:
96
- data = (_e.sent()).data;
96
+ data = (_f.sent()).data;
97
97
  if (!data.errors) {
98
98
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
99
- thunkApi.dispatch(handleNextScreenStep());
99
+ steps = (_e = individual.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.steps;
100
+ hasIndividualCompleted = Object.keys(steps).find(function (key) { return key === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS; });
101
+ if (hasIndividualCompleted) {
102
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_STEP'));
103
+ }
104
+ else {
105
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
106
+ }
100
107
  }
101
108
  return [2, { data: data, formData: __assign({}, params) }];
102
109
  }
103
110
  });
104
111
  }); });
112
+ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var _a, settings, individual, requestBody, data;
114
+ var _b, _c, _d, _e, _f, _g;
115
+ return __generator(this, function (_h) {
116
+ switch (_h.label) {
117
+ case 0:
118
+ _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
119
+ requestBody = {
120
+ id: (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
121
+ employer_name: params.employerName,
122
+ employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
123
+ source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.title],
124
+ actual_income: params.monthlyIncome,
125
+ is_relative_PEP: params.isPEP,
126
+ is_influencer: params.isInfluencer,
127
+ step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
128
+ };
129
+ return [4, API.entityService.updateEntityInfo(requestBody)];
130
+ case 1:
131
+ data = (_h.sent()).data;
132
+ if (!data.errors) {
133
+ thunkApi.dispatch(handleNextScreenStep());
134
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
135
+ }
136
+ return [2, { data: data, formData: params }];
137
+ }
138
+ });
139
+ }); });
105
140
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
106
- var _a, settings, individual, payload, data;
107
- var _b, _c, _d, _e, _f;
108
- return __generator(this, function (_g) {
109
- switch (_g.label) {
141
+ var _a, settings, individual, response, payload;
142
+ var _b, _c, _d, _e, _f, _g;
143
+ return __generator(this, function (_h) {
144
+ switch (_h.label) {
110
145
  case 0:
111
146
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
147
+ response = undefined;
148
+ if (!!!((_b = individual.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
112
149
  payload = {
113
150
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
114
- id: ((_b = individual.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
151
+ id: ((_c = individual.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
115
152
  encryption_contract: []
116
153
  };
117
154
  return [4, API.leadService.updateLead(payload)];
118
155
  case 1:
119
- data = (_g.sent()).data;
120
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
121
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
122
- return [2, { response: data, formData: params }];
156
+ response = _h.sent();
157
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
158
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
159
+ _h.label = 2;
160
+ case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
123
161
  }
124
162
  });
125
163
  }); });
@@ -134,10 +172,10 @@ var initialState = {
134
172
  otp: ''
135
173
  },
136
174
  individualData: {
137
- sourceIncome: SOURCE_OF_INCOME[0],
175
+ sourceIncome: undefined,
138
176
  monthlyIncome: '',
139
177
  employerName: '',
140
- employerLocation: defaultCountry,
178
+ employerLocation: undefined,
141
179
  isPEP: null,
142
180
  isInfluencer: null
143
181
  }
@@ -159,6 +197,9 @@ export var individualSlice = createSlice({
159
197
  },
160
198
  extraReducers: function (builder) {
161
199
  builder
200
+ .addCase(verifyLeadToken.pending, function (state) {
201
+ state.error = null;
202
+ })
162
203
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
163
204
  var _a;
164
205
  state.error = null;
@@ -194,6 +235,27 @@ export var individualSlice = createSlice({
194
235
  .addCase(verifyLeadOTP.rejected, function (state, action) {
195
236
  state.loading = false;
196
237
  state.error = action.error.message;
238
+ })
239
+ .addCase(updateIndividualInfo.pending, function (state) {
240
+ state.loading = true;
241
+ state.error = null;
242
+ })
243
+ .addCase(updateIndividualInfo.fulfilled, function (state, action) {
244
+ var _a;
245
+ state.loading = false;
246
+ state.error = null;
247
+ var _b = action.payload, data = _b.data, formData = _b.formData;
248
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
249
+ if (description) {
250
+ state.error = description;
251
+ return;
252
+ }
253
+ state.data.individualData = formData;
254
+ state.data.individualData.responseBody = data;
255
+ })
256
+ .addCase(updateIndividualInfo.rejected, function (state, action) {
257
+ state.loading = false;
258
+ state.error = action.error.message;
197
259
  })
198
260
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
199
261
  var _a;
@@ -16,14 +16,15 @@ import IBAN from './IBAN';
16
16
  import BankName from './BankName';
17
17
  import Button from '../../../shared/Button';
18
18
  import { useAppDispatch } from '../../../../hooks';
19
- import { handleNextScreenStep } from '../../../../app/settings';
20
19
  import { BankValidation } from './validation';
21
20
  import { useTranslation } from 'react-i18next';
22
21
  import { useForm, FormProvider } from 'react-hook-form';
23
22
  import { yupResolver } from '@hookform/resolvers/yup';
24
23
  import { useLanguage } from '../../../../hooks';
25
24
  import { styled } from '@mui/material/styles';
25
+ import { bankSelector, createBankAccount } from '../../../app/bank/bankStore';
26
26
  import Form from '../../../../components/Form';
27
+ import { useSelector } from 'react-redux';
27
28
  var FormStyled = styled(Form)(function () { return ({
28
29
  display: 'flex',
29
30
  flexDirection: 'column',
@@ -37,20 +38,17 @@ var ButtonStyled = styled(Button)(function (_a) {
37
38
  });
38
39
  var BankDetails = function () {
39
40
  var dispatch = useAppDispatch();
41
+ var _a = useSelector(bankSelector), data = _a.data, loading = _a.loading, error = _a.error;
40
42
  var methods = useForm({
41
43
  resolver: yupResolver(BankValidation),
42
- defaultValues: {
43
- iban: '',
44
- beneficiaryName: '',
45
- bankName: 'National Bank'
46
- },
44
+ defaultValues: data.bankData,
47
45
  mode: 'onChange'
48
46
  });
49
- var onSubmit = function () {
50
- dispatch(handleNextScreenStep());
47
+ var onSubmit = function (data) {
48
+ dispatch(createBankAccount(data));
51
49
  };
52
50
  var t = useTranslation().t;
53
51
  var isAr = useLanguage().isAr;
54
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IBAN, {}), _jsx(Beneficiary, {}), _jsx(BankName, {}), _jsx(ButtonStyled, __assign({ disableBack: true, disabled: !methods.formState.isValid, isAr: isAr }, { children: t('confirm') }))] })) })) }));
52
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IBAN, {}), _jsx(Beneficiary, {}), _jsx(BankName, {}), _jsx(ButtonStyled, __assign({ disableBack: true, disabled: !methods.formState.isValid, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
55
53
  };
56
54
  export default BankDetails;
@@ -13,6 +13,14 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
13
  marginBlockEnd: theme.spacing(3)
14
14
  });
15
15
  });
16
+ var InputStyled = styled(Input)(function (_a) {
17
+ var theme = _a.theme;
18
+ return ({
19
+ input: {
20
+ textTransform: 'capitalize'
21
+ }
22
+ });
23
+ });
16
24
  var Beneficiary = function () {
17
25
  var _a, _b;
18
26
  var t = useTranslation().t;
@@ -29,6 +37,6 @@ var Beneficiary = function () {
29
37
  var clearValue = function () {
30
38
  beneficiaryControl.field.onChange('');
31
39
  };
32
- return (_jsx(FeatureStyled, { children: _jsx(Input, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
40
+ return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
33
41
  };
34
42
  export default Beneficiary;
@@ -2,8 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { useAppDispatch } from '../../../../hooks';
6
+ import { updateLeadSuccess } from '../../../app/bank/bankStore';
5
7
  var Success = function (_a) {
6
8
  var t = useTranslation().t;
9
+ var dispatch = useAppDispatch();
10
+ React.useEffect(function () {
11
+ dispatch(updateLeadSuccess());
12
+ }, []);
7
13
  var onSuccess = function () {
8
14
  window.open('mailto:');
9
15
  };
@@ -10,9 +10,6 @@ var ThankYou = function (_a) {
10
10
  React.useEffect(function () {
11
11
  dispatch(updateLeadSuccess());
12
12
  }, []);
13
- var onSuccess = function () {
14
- window.open('mailto:');
15
- };
16
- return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
13
+ return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), showEmailProviders: true });
17
14
  };
18
15
  export default React.memo(ThankYou);
@@ -15,7 +15,6 @@ import PasswordVerifyPage from './password/screens/Verify';
15
15
  import CreatePasswordPage from './password/screens/CreatePassword';
16
16
  import SuccessPasswordPage from './password/screens/Success';
17
17
  import IndividualVerifyPage from './individual/screens/Verify';
18
- import ShowIndividualInfoPage from './individual/screens/ShowIndividualInfo';
19
18
  import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
20
19
  import SuccessOwnerPage from './individual/screens/Success';
21
20
  import BankVerifyPage from './bank/screens/Verify';
@@ -97,10 +96,6 @@ export var individualFeatureScreens = [
97
96
  name: 'INDIVIDUAL_VERIFY_STEP',
98
97
  element: IndividualVerifyPage
99
98
  },
100
- {
101
- name: 'INDIVIDUAL_SHOW_INDIVIDUAL_INFO_STEP',
102
- element: ShowIndividualInfoPage
103
- },
104
99
  {
105
100
  name: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
106
101
  element: AdditionalIndividualInfoPage
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box';
17
17
  import { useTranslation } from 'react-i18next';
18
18
  import { useAppDispatch } from '../../../../hooks';
19
- import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
19
+ import { handlePrevScreenStep } from '../../../../app/settings';
20
20
  import { styled } from '@mui/material/styles';
21
21
  import Form from '../../../../components/Form';
22
22
  import Collapse from '../../../../components/Collapse';
@@ -31,6 +31,8 @@ import EmployerName from './EmployerName';
31
31
  import EmployerLocation from './EmployerLocation';
32
32
  import SourceOfIncome from './SourceOfIncome';
33
33
  import { countriesCode, SOURCE_OF_INCOME } from '../../../../constants';
34
+ import { useSelector } from 'react-redux';
35
+ import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
34
36
  var InputsContainerStyled = styled(Box)(function (_a) {
35
37
  var _b;
36
38
  var theme = _a.theme, listActive = _a.listActive;
@@ -47,25 +49,26 @@ var InputsContainerStyled = styled(Box)(function (_a) {
47
49
  },
48
50
  _b);
49
51
  });
52
+ var ButtonStyled = styled(Button)(function (_a) {
53
+ var theme = _a.theme;
54
+ return ({
55
+ marginBlockStart: theme.spacing(-5)
56
+ });
57
+ });
50
58
  var AdditionalIndividualInfo = function (_a) {
59
+ var t = useTranslation().t;
60
+ var isAr = useLanguage().isAr;
61
+ var dispatch = useAppDispatch();
62
+ var _b = useSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
51
63
  var methods = useForm({
52
64
  resolver: yupResolver(IndividualInfoValidationSchema),
53
- defaultValues: {
54
- monthlyIncome: '',
55
- employerName: '',
56
- isPEP: null,
57
- isInfluencer: null
58
- },
65
+ defaultValues: data.individualData,
59
66
  mode: 'onChange'
60
67
  });
61
- var t = useTranslation().t;
62
- var isAr = useLanguage().isAr;
63
- var dispatch = useAppDispatch();
64
- var _b = React.useState(false), listActive = _b[0], setListActive = _b[1];
65
- var _c = React.useState(false), employerFieldsActive = _c[0], setEmployerFieldsActive = _c[1];
68
+ var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
69
+ var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
66
70
  var onSubmit = function (data) {
67
- console.log('data', data);
68
- dispatch(handleNextScreenStep());
71
+ dispatch(updateIndividualInfo(data));
69
72
  };
70
73
  var handleSelectSource = function (country) {
71
74
  var _a;
@@ -78,7 +81,7 @@ var AdditionalIndividualInfo = function (_a) {
78
81
  var onBack = function () {
79
82
  dispatch(handlePrevScreenStep());
80
83
  };
81
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive, list: SOURCE_OF_INCOME, onSelectSource: handleSelectSource }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: countriesCode, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') })) }))] })) })) }));
84
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive, list: SOURCE_OF_INCOME, onSelectSource: handleSelectSource }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: countriesCode, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
82
85
  };
83
86
  export default React.memo(AdditionalIndividualInfo);
84
87
  AdditionalIndividualInfo.defaultProps = {};
@@ -19,6 +19,15 @@ import Input from '../../../shared/Input';
19
19
  import CheckIcon from '../../../shared/CheckIcon';
20
20
  import Collapse from '../../../../components/Collapse';
21
21
  import ClearIcon from '../../../shared/ClearIcon';
22
+ import { styled } from '@mui/material/styles';
23
+ var InputStyled = styled(Input)(function (_a) {
24
+ var theme = _a.theme;
25
+ return ({
26
+ input: {
27
+ textTransform: 'capitalize'
28
+ }
29
+ });
30
+ });
22
31
  var EmployerName = function (_a) {
23
32
  var _b;
24
33
  var show = _a.show;
@@ -35,6 +44,6 @@ var EmployerName = function (_a) {
35
44
  var clearValue = function () {
36
45
  employerNameControl.field.onChange('');
37
46
  };
38
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { pt: 2.5 } }, { children: _jsx(Input, { required: true, label: t('tap_js_employer_name'), onChange: handleEmployerNameChange, value: employerNameValue, endAdornment: !error && employerNameValue ? _jsx(CheckIcon, {}) : employerNameValue && _jsx(ClearIcon, { onClick: clearValue }), placeholder: t('tap_js_enter_employer_name'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
47
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { pt: 2.5 } }, { children: _jsx(InputStyled, { required: true, label: t('tap_js_employer_name'), onChange: handleEmployerNameChange, value: employerNameValue, endAdornment: !error && employerNameValue ? _jsx(CheckIcon, {}) : employerNameValue && _jsx(ClearIcon, { onClick: clearValue }), placeholder: t('tap_js_enter_employer_name'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
39
48
  };
40
49
  export default React.memo(EmployerName);
@@ -80,7 +80,7 @@ var SourceOfIncome = function (_a) {
80
80
  };
81
81
  var source = sourceIncomeControl.field.value;
82
82
  var error = (_b = sourceIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
83
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name : source === null || source === void 0 ? void 0 : source.nameEn) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'nameEn', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
83
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.titleAr : source === null || source === void 0 ? void 0 : source.title) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'nameEn', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
84
84
  return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.titleAr : item === null || item === void 0 ? void 0 : item.title })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
85
85
  } }) }))] })) })));
86
86
  };
@@ -5,7 +5,7 @@ export var IndividualInfoValidationSchema = yup.object().shape({
5
5
  monthlyIncome: yup.string().optional(),
6
6
  employerName: yup.string().when('sourceIncome', function (sourceIncomeValue) {
7
7
  var _a;
8
- if (((_a = sourceIncomeValue === null || sourceIncomeValue === void 0 ? void 0 : sourceIncomeValue.nameEn) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
8
+ if (((_a = sourceIncomeValue === null || sourceIncomeValue === void 0 ? void 0 : sourceIncomeValue.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
9
9
  return yup.string().matches(REGEX_FULL_NAME, 'employer_name_invalid').required('please_enter_employer_name');
10
10
  }
11
11
  else {
@@ -14,7 +14,7 @@ export var IndividualInfoValidationSchema = yup.object().shape({
14
14
  }),
15
15
  employerLocation: yup.object().when('sourceIncome', function (sourceIncome) {
16
16
  var _a;
17
- if (((_a = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.nameEn) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
17
+ if (((_a = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
18
18
  return yup
19
19
  .object({
20
20
  name: yup.object().shape({
@@ -1,9 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
+ import { useAppDispatch } from '../../../../hooks';
5
+ import { updateLeadSuccess } from '../../../app/individual/individualStore';
4
6
  import SuccessScreen from '../../../shared/SuccessScreen';
5
7
  var Success = function (_a) {
6
8
  var t = useTranslation().t;
9
+ var dispatch = useAppDispatch();
10
+ React.useEffect(function () {
11
+ dispatch(updateLeadSuccess());
12
+ }, []);
7
13
  var onSuccess = function () {
8
14
  window.open('mailto:');
9
15
  };
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from '../../../components/Button';
3
+ declare type buttonProps = {
4
+ title: string;
5
+ href: string;
6
+ };
7
+ export interface EmailProvidersButtonsProps extends ButtonProps {
8
+ gmail: buttonProps;
9
+ outlook: buttonProps;
10
+ apple: buttonProps;
11
+ }
12
+ export default function EmailProvidersButtons({ gmail, outlook, apple }: EmailProvidersButtonsProps): JSX.Element;
13
+ export {};
@@ -0,0 +1,92 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import Button from '../../../components/Button';
14
+ import { alpha, styled } from '@mui/material/styles';
15
+ import Box from '@mui/material/Box';
16
+ import Link from '@mui/material/Link';
17
+ import { ICONS_NAMES } from '../../../constants';
18
+ var Image = styled('img')(function (_a) {
19
+ var theme = _a.theme;
20
+ return ({
21
+ width: theme.spacing(3),
22
+ height: theme.spacing(3),
23
+ fontSize: theme.spacing(3),
24
+ marginInlineStart: theme.spacing(1)
25
+ });
26
+ });
27
+ var ButtonBoxStyled = styled(Box)(function (_a) {
28
+ var theme = _a.theme;
29
+ return ({
30
+ margin: theme.spacing(0, 2.5, 2.5, 2.5)
31
+ });
32
+ });
33
+ var GMailButtonStyled = styled(Button)(function (_a) {
34
+ var theme = _a.theme;
35
+ return ({
36
+ width: '100%',
37
+ paddingInlineStart: theme.spacing(0.75),
38
+ marginBottom: theme.spacing(1.875),
39
+ backgroundColor: theme.palette.common.white,
40
+ border: "1px solid ".concat(theme.palette.primary.main),
41
+ color: theme.palette.primary.main,
42
+ '&:hover': {
43
+ backgroundColor: theme.palette.primary.main,
44
+ color: theme.palette.common.white
45
+ },
46
+ '&:disabled': {
47
+ backgroundColor: theme.palette.common.white,
48
+ color: alpha(theme.palette.primary.main, 0.3)
49
+ }
50
+ });
51
+ });
52
+ var OutlookButtonStyled = styled(Button)(function (_a) {
53
+ var theme = _a.theme;
54
+ return ({
55
+ width: '100%',
56
+ paddingInlineStart: theme.spacing(0.75),
57
+ marginBottom: theme.spacing(1.875),
58
+ backgroundColor: theme.palette.common.white,
59
+ border: "1px solid ".concat(theme.palette.primary.main),
60
+ color: theme.palette.primary.main,
61
+ '&:hover': {
62
+ backgroundColor: theme.palette.primary.main,
63
+ color: theme.palette.common.white
64
+ },
65
+ '&:disabled': {
66
+ backgroundColor: theme.palette.common.white,
67
+ color: alpha(theme.palette.primary.main, 0.3)
68
+ }
69
+ });
70
+ });
71
+ var AppleButtonStyled = styled(Button)(function (_a) {
72
+ var theme = _a.theme;
73
+ return ({
74
+ width: '100%',
75
+ paddingInlineStart: theme.spacing(0.75),
76
+ backgroundColor: theme.palette.common.white,
77
+ border: "1px solid ".concat(theme.palette.primary.main),
78
+ color: theme.palette.primary.main,
79
+ '&:hover': {
80
+ backgroundColor: theme.palette.primary.main,
81
+ color: theme.palette.common.white
82
+ },
83
+ '&:disabled': {
84
+ backgroundColor: theme.palette.common.white,
85
+ color: alpha(theme.palette.primary.main, 0.3)
86
+ }
87
+ });
88
+ });
89
+ export default function EmailProvidersButtons(_a) {
90
+ var gmail = _a.gmail, outlook = _a.outlook, apple = _a.apple;
91
+ return (_jsxs(ButtonBoxStyled, { children: [_jsx(Link, __assign({ href: gmail.href, underline: 'none', target: '_blank' }, { children: _jsx(GMailButtonStyled, __assign({ startIcon: _jsx(Image, { src: ICONS_NAMES.GMAIL_ICON, alt: gmail.title }), type: 'button' }, { children: gmail.title })) })), _jsx(Link, __assign({ href: outlook.href, underline: 'none', target: '_blank' }, { children: _jsx(OutlookButtonStyled, __assign({ startIcon: _jsx(Image, { src: ICONS_NAMES.OUTLOOK_ICON, alt: outlook.title }), type: 'button' }, { children: outlook.title })) })), _jsx(Link, __assign({ href: apple.href, underline: 'none', target: '_blank' }, { children: _jsx(AppleButtonStyled, __assign({ startIcon: _jsx(Image, { src: ICONS_NAMES.APPLE_MAIL_ICON, alt: apple.title }), type: 'button' }, { children: apple.title })) }))] }));
92
+ }
@@ -1,5 +1,6 @@
1
1
  import Button from './Button';
2
2
  import AbsherButton from './AbsherButton';
3
3
  import MobileButton from './MobileButton';
4
- export { AbsherButton, MobileButton };
4
+ import EmailProvidersButton from './EmailProvidersButtons';
5
+ export { AbsherButton, MobileButton, EmailProvidersButton };
5
6
  export default Button;
@@ -1,5 +1,6 @@
1
1
  import Button from './Button';
2
2
  import AbsherButton from './AbsherButton';
3
3
  import MobileButton from './MobileButton';
4
- export { AbsherButton, MobileButton };
4
+ import EmailProvidersButton from './EmailProvidersButtons';
5
+ export { AbsherButton, MobileButton, EmailProvidersButton };
5
6
  export default Button;
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  export interface ThankYouProps {
3
- onSuccess?: () => void;
4
3
  title?: string;
4
+ onSuccess?: () => void;
5
+ showEmailProviders?: boolean;
5
6
  }
6
- declare const _default: React.MemoExoticComponent<({ onSuccess, title }: ThankYouProps) => JSX.Element>;
7
+ declare const _default: React.MemoExoticComponent<({ title, showEmailProviders, onSuccess }: ThankYouProps) => JSX.Element>;
7
8
  export default _default;
@@ -14,12 +14,12 @@ import Box from '@mui/material/Box/Box';
14
14
  import { styled } from '@mui/material/styles';
15
15
  import * as React from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
- import { useLanguage } from '../../../hooks';
18
17
  import Text from '../../../components/Text';
19
18
  import Container from '../Containers/ScreenContainer';
20
- import { AbsherButton } from '../../shared/Button';
19
+ import { AbsherButton, EmailProvidersButton } from '../../shared/Button';
21
20
  import Icon from '../../../components/Icon';
22
21
  import { ICONS_NAMES } from '../../../constants';
22
+ import { useLanguage } from '../../../hooks';
23
23
  var MailBoxStyled = styled(Box)(function () { return ({
24
24
  width: '100%'
25
25
  }); });
@@ -64,9 +64,9 @@ var IconStyled = styled(Icon)(function (_a) {
64
64
  _b);
65
65
  });
66
66
  var ThankYou = function (_a) {
67
- var onSuccess = _a.onSuccess, title = _a.title;
67
+ var title = _a.title, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess;
68
68
  var t = useTranslation().t;
69
69
  var isAr = useLanguage().isAr;
70
- return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), _jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t('open_mail_box') })) })] }));
70
+ return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('open_gmail'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('open_outlook'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('open_apple'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t('open_mail_box') })) }))] }));
71
71
  };
72
72
  export default React.memo(ThankYou);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",