@tap-payments/auth-jsconnect 2.1.7-test → 2.1.8-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,16 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
6
6
  token: string;
7
- brandInfo: any;
7
+ brandData: any;
8
8
  boardId: any;
9
+ isRequireOTP?: undefined;
10
+ } | {
11
+ data: any;
12
+ isRequireOTP: boolean;
13
+ leadData?: undefined;
14
+ token?: undefined;
15
+ brandData?: undefined;
16
+ boardId?: undefined;
9
17
  }, string, {}>;
10
18
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
11
19
  data: any;
@@ -16,7 +24,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
16
24
  isNID: boolean;
17
25
  otp: string;
18
26
  };
19
- brandInfo: any;
27
+ brand: any;
20
28
  leadData: any;
21
29
  }, OTPFormValues, {}>;
22
30
  interface verifyPACIParams {
@@ -68,6 +76,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
68
76
  customerBases: any;
69
77
  expectedSales: any;
70
78
  expectedCustomerSales: any;
79
+ countryISO2: string;
71
80
  }, void, {}>;
72
81
  export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<{
73
82
  data: any;
@@ -60,13 +60,13 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA } from '../../../utils';
63
+ import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA, dateFormat } from '../../../utils';
64
64
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var payload, data, leadResponse, brandInfo, boardResponse, countryIso2, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, entity_activities, data_1, board_id, board_info_id;
67
- var _a, _b, _c, _d, _e, _f, _g;
68
- return __generator(this, function (_h) {
69
- switch (_h.label) {
66
+ var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, board_info_id, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
67
+ var _a;
68
+ return __generator(this, function (_b) {
69
+ switch (_b.label) {
70
70
  case 0:
71
71
  payload = {
72
72
  service_name: 'tap_email',
@@ -74,101 +74,100 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
74
74
  };
75
75
  return [4, API.leadService.verifyLeadToken(payload)];
76
76
  case 1:
77
- data = (_h.sent()).data;
78
- leadResponse = undefined;
79
- brandInfo = undefined;
80
- boardResponse = undefined;
81
- countryIso2 = undefined;
82
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 18];
83
- if (data === null || data === void 0 ? void 0 : data.country_code) {
84
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
77
+ data = (_b.sent()).data;
78
+ if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
79
+ throw new Error(data.errors[0].description);
80
+ if (data.mw_error)
81
+ throw new Error(data.mw_error);
82
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
83
+ if (countryIso2)
85
84
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
86
- }
87
- if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 18];
85
+ if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 20];
86
+ boardData = undefined;
87
+ brandData = undefined;
88
88
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
89
89
  case 2:
90
- leadResponse = _h.sent();
91
- if (!countryIso2) {
92
- countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
93
- if (countryIso2)
94
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
95
- }
90
+ leadData = (_b.sent()).data;
91
+ countryIso2 = leadData === null || leadData === void 0 ? void 0 : leadData.country_code;
92
+ if (!countryIso2)
93
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
96
94
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
97
95
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
98
96
  }
99
97
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
100
98
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
101
99
  }
102
- if (!(data.step_name === 'business_info')) return [3, 18];
103
- steps = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.steps;
104
- brandID = (_d = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
100
+ if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
101
+ entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id, board_info_id = leadData.board_info_id;
102
+ brandID = brand === null || brand === void 0 ? void 0 : brand.id;
105
103
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
106
- hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) &&
107
- hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
104
+ hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
108
105
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
109
106
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
110
- entity_activities = leadResponse.data.entity_activities;
111
107
  if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 4];
112
108
  return [4, API.dataService.getActivities()];
113
109
  case 3:
114
- data_1 = _h.sent();
115
- leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_1.list });
116
- _h.label = 4;
110
+ activityList = (_b.sent()).list;
111
+ leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
112
+ _b.label = 4;
117
113
  case 4:
118
- if (!hasBusinessCompleted) return [3, 8];
119
- board_id = (_e = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _e === void 0 ? void 0 : _e.board_id;
120
- board_info_id = (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_info_id;
121
- if (!(!!board_id && !!board_info_id)) return [3, 6];
114
+ if (!hasBusinessCompleted) return [3, 9];
115
+ if (!(board_id && board_info_id)) return [3, 6];
122
116
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
123
117
  case 5:
124
- boardResponse = _h.sent();
125
- _h.label = 6;
126
- case 6: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
118
+ boardData = _b.sent();
119
+ _b.label = 6;
120
+ case 6:
121
+ if (!board_id) return [3, 8];
122
+ return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
127
123
  case 7:
128
- _h.sent();
129
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
130
- return [3, 18];
124
+ _b.sent();
125
+ _b.label = 8;
131
126
  case 8:
132
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
133
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
134
- return [3, 18];
127
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
128
+ return [3, 19];
135
129
  case 9:
136
- if (!hasBusinessCustomersCompleted) return [3, 10];
137
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
138
- return [3, 18];
130
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 10];
131
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
132
+ return [3, 19];
139
133
  case 10:
140
- if (!hasBusinessCRActivitiesCompleted) return [3, 13];
141
- return [4, thunkApi.dispatch(retrieveDataList())];
134
+ if (!hasBusinessCustomersCompleted) return [3, 11];
135
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
136
+ return [3, 19];
142
137
  case 11:
143
- _h.sent();
138
+ if (!hasBusinessCRActivitiesCompleted) return [3, 14];
139
+ return [4, thunkApi.dispatch(retrieveDataList())];
140
+ case 12:
141
+ _b.sent();
144
142
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
145
143
  return [4, API.brandService.retrieveBrand(brandID)];
146
- case 12:
147
- brandInfo = _h.sent();
148
- return [3, 18];
149
144
  case 13:
150
- if (!hasBusinessCRInfoCompleted) return [3, 15];
151
- return [4, API.brandService.retrieveBrand(brandID)];
145
+ brandData = _b.sent();
146
+ return [3, 19];
152
147
  case 14:
153
- brandInfo = _h.sent();
154
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
155
- return [3, 18];
148
+ if (!hasBusinessCRInfoCompleted) return [3, 16];
149
+ return [4, API.brandService.retrieveBrand(brandID)];
156
150
  case 15:
157
- if (!isSA(countryIso2)) return [3, 17];
158
- return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
151
+ brandData = _b.sent();
152
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
153
+ return [3, 19];
159
154
  case 16:
160
- _h.sent();
161
- _h.label = 17;
155
+ if (!isSA(countryIso2)) return [3, 18];
156
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
162
157
  case 17:
158
+ _b.sent();
159
+ _b.label = 18;
160
+ case 18:
163
161
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
164
- _h.label = 18;
165
- case 18: return [2, {
162
+ _b.label = 19;
163
+ case 19: return [2, {
166
164
  data: data,
167
- leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || []) }),
165
+ leadData: __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardData === null || boardData === void 0 ? void 0 : boardData.info) || []) }),
168
166
  token: token,
169
- brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
170
- boardId: (_g = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _g === void 0 ? void 0 : _g.board_id
167
+ brandData: brandData,
168
+ boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
171
169
  }];
170
+ case 20: return [2, { data: data, isRequireOTP: true }];
172
171
  }
173
172
  });
174
173
  }); });
@@ -190,8 +189,8 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
190
189
  });
191
190
  }); });
192
191
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
193
- var _a, business, settings, isNID, responseBody, stepName, payload, data, brandInfo, leadResponse, _b, brand, country_code, steps, board_id, board_info_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, data_2, boardResponse;
194
- var _c, _d, _e, _f, _g, _h;
192
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, board_info_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
193
+ var _b, _c, _d, _e, _f, _g, _h;
195
194
  return __generator(this, function (_j) {
196
195
  switch (_j.label) {
197
196
  case 0:
@@ -201,22 +200,22 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
201
200
  stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
202
201
  payload = {
203
202
  data: params.otp,
204
- service_name: ((_d = (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _c === void 0 ? void 0 : _c.verification_by) === null || _d === void 0 ? void 0 : _d.service_name) || ((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name),
205
- verify_token: ((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _f === void 0 ? void 0 : _f.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
203
+ service_name: ((_c = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.service_name) || ((_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name),
204
+ verify_token: ((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _e === void 0 ? void 0 : _e.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
206
205
  step_name: stepName,
207
206
  encryption_contract: ['data']
208
207
  };
209
208
  return [4, API.leadService.verifyLeadOTP(payload)];
210
209
  case 1:
211
210
  data = (_j.sent()).data;
212
- brandInfo = undefined;
213
- leadResponse = undefined;
214
- if (!!data.errors) return [3, 20];
211
+ if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
212
+ throw new Error(data.errors[0].description);
213
+ brandData = undefined;
215
214
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
216
215
  case 2:
217
- leadResponse = _j.sent();
216
+ leadData = (_j.sent()).data;
218
217
  thunkApi.dispatch(updateStepName(stepName));
219
- _b = (leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) || {}, brand = _b.brand, country_code = _b.country_code, steps = _b.steps, board_id = _b.board_id, board_info_id = _b.board_info_id;
218
+ brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, board_info_id = leadData.board_info_id;
220
219
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
221
220
  countryIso2 = country_code;
222
221
  if (countryIso2)
@@ -233,12 +232,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
233
232
  _j.sent();
234
233
  _j.label = 4;
235
234
  case 4:
236
- entity_activities = ((leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) || {}).entity_activities;
235
+ entity_activities = leadData.entity_activities;
237
236
  if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 6];
238
237
  return [4, API.dataService.getActivities()];
239
238
  case 5:
240
- data_2 = _j.sent();
241
- leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_2.list });
239
+ activityList = (_j.sent()).list;
240
+ leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
242
241
  _j.label = 6;
243
242
  case 6:
244
243
  if (!isNID) return [3, 7];
@@ -250,11 +249,11 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
250
249
  return [3, 20];
251
250
  case 8:
252
251
  if (!hasBusinessCompleted) return [3, 12];
253
- if (!(!!board_id && !!board_info_id)) return [3, 10];
252
+ if (!(board_id && board_info_id)) return [3, 10];
254
253
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
255
254
  case 9:
256
255
  boardResponse = _j.sent();
257
- leadResponse.data = __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || []) });
256
+ leadData = __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || []) });
258
257
  _j.label = 10;
259
258
  case 10: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
260
259
  case 11:
@@ -277,19 +276,19 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
277
276
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
278
277
  return [4, API.brandService.retrieveBrand(brandID)];
279
278
  case 16:
280
- brandInfo = _j.sent();
279
+ brandData = _j.sent();
281
280
  return [3, 20];
282
281
  case 17:
283
282
  if (!hasBusinessCRInfoCompleted) return [3, 19];
284
283
  return [4, API.brandService.retrieveBrand(brandID)];
285
284
  case 18:
286
- brandInfo = _j.sent();
285
+ brandData = _j.sent();
287
286
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
288
287
  return [3, 20];
289
288
  case 19:
290
289
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
291
290
  _j.label = 20;
292
- case 20: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data }];
291
+ case 20: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
293
292
  }
294
293
  });
295
294
  }); });
@@ -573,17 +572,18 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
573
572
  });
574
573
  }); });
575
574
  export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
576
- var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
575
+ var settings, countryISO2, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
577
576
  return __generator(this, function (_b) {
578
577
  switch (_b.label) {
579
578
  case 0:
580
579
  settings = thunkApi.getState().settings;
580
+ countryISO2 = settings.data.businessCountry.iso2;
581
581
  dataBody = {
582
582
  page: 0
583
583
  };
584
584
  salesDataBody = {
585
585
  page: 0,
586
- country_code: [settings.data.businessCountry.iso2]
586
+ country_code: [countryISO2]
587
587
  };
588
588
  return [4, Promise.all([
589
589
  API.dataService.getCustomerBases(dataBody),
@@ -591,11 +591,12 @@ export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', funct
591
591
  API.dataService.getExpectedCustomerSales(dataBody)
592
592
  ])];
593
593
  case 1:
594
- _a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
594
+ _a = _b.sent(), customerBases = _a[0].list, expectedSales = _a[1].list, expectedCustomerSales = _a[2].list;
595
595
  return [2, {
596
596
  customerBases: customerBases,
597
597
  expectedSales: expectedSales,
598
- expectedCustomerSales: expectedCustomerSales
598
+ expectedCustomerSales: expectedCustomerSales,
599
+ countryISO2: countryISO2
599
600
  }];
600
601
  }
601
602
  });
@@ -755,49 +756,46 @@ export var businessSlice = createSlice({
755
756
  state.customLoading = true;
756
757
  })
757
758
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
758
- var _a, _b, _c, _d;
759
+ var _a, _b;
759
760
  state.error = null;
760
761
  state.customLoading = false;
761
- var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
762
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
763
- if (description) {
764
- state.error = description;
765
- return;
766
- }
767
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
768
- state.data.verify.token = token;
762
+ var _c = action.payload, data = _c.data, boardId = _c.boardId, brandData = _c.brandData, leadData = _c.leadData, token = _c.token, isRequireOTP = _c.isRequireOTP;
763
+ var responseBody = state.data.verify.responseBody;
764
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
765
+ if (token)
766
+ state.data.verify.token = token;
769
767
  state.data.otpData.isNID = false;
770
- var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type, business_name = _f.business_name;
771
- var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
772
- ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
773
- : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
774
- if (!!issuingDate) {
775
- var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
776
- state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
777
- }
768
+ if (isRequireOTP)
769
+ return;
770
+ var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type, business_name = _d.business_name;
771
+ var issuingDate = (brandData === null || brandData === void 0 ? void 0 : brandData.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
772
+ if (issuingDate)
773
+ state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
778
774
  var activities = entity_activities || [];
779
775
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
780
- var _a;
781
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return activity.id === value.id; });
776
+ var activities = brandData.activities;
777
+ return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
782
778
  });
783
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
784
- state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
779
+ state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
785
780
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
786
781
  state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
787
- if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
788
- var licenseNumber_1 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
789
- var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
790
- var licenseList = (responseBody || {}).licenseList;
782
+ var license = (entity || {}).license;
783
+ if (license) {
784
+ var number_1 = license.number;
785
+ var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
786
+ var licenseList = (busResData || {}).licenseList;
791
787
  var selectedLicenseData = selectedLicense;
792
- if (!!licenseNumber_1) {
793
- selectedLicenseData =
794
- ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
795
- var license = _a.license;
796
- return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
797
- })) ||
798
- business_type === BusinessType.FL
799
- ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } });
800
- state.data.businessTypeData.licenseNumber = licenseNumber_1 || '';
788
+ if (number_1) {
789
+ var findFL = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
790
+ var license = _a.license;
791
+ return (license === null || license === void 0 ? void 0 : license.number) === number_1;
792
+ });
793
+ if (findFL || business_type === BusinessType.FL) {
794
+ selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_1 } });
795
+ }
796
+ else
797
+ selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: number_1 } });
798
+ state.data.businessTypeData.licenseNumber = number_1;
801
799
  }
802
800
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
803
801
  }
@@ -828,49 +826,42 @@ export var businessSlice = createSlice({
828
826
  state.error = null;
829
827
  })
830
828
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
831
- var _a, _b, _c, _d;
829
+ var _a, _b;
832
830
  state.loading = false;
833
831
  state.error = null;
834
- var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo, leadData = _e.leadData;
835
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
836
- if (description) {
837
- state.error = description;
838
- return;
839
- }
832
+ var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData;
840
833
  state.data.otpData = formData;
841
834
  state.data.otpData.responseBody = data;
842
- state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: leadData === null || leadData === void 0 ? void 0 : leadData.flows });
843
- var _f = leadData || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type, business_name = _f.business_name;
844
- var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
845
- ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
846
- : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
847
- if (!!issuingDate) {
848
- var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
849
- state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
850
- }
835
+ state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
836
+ var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type, business_name = _d.business_name;
837
+ var issuingDate = (brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date);
838
+ if (issuingDate)
839
+ state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
851
840
  var activities = entity_activities || [];
852
841
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
853
- var _a;
854
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
842
+ var activities = brand.activities;
843
+ return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return value.id === activity.id; });
855
844
  });
856
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities[0]) ? [activities === null || activities === void 0 ? void 0 : activities[0]] : [];
857
- state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
845
+ state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
858
846
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
859
847
  state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
860
- if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
861
- var licenseNumber_2 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
862
- var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
863
- var licenseList = (responseBody || {}).licenseList;
848
+ var license = (entity || {}).license;
849
+ if (license) {
850
+ var number_2 = license.number;
851
+ var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
852
+ var licenseList = (busResData || {}).licenseList;
864
853
  var selectedLicenseData = selectedLicense;
865
- if (!!licenseNumber_2) {
866
- selectedLicenseData =
867
- ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
868
- var license = _a.license;
869
- return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
870
- })) ||
871
- business_type === BusinessType.FL
872
- ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } });
873
- state.data.businessTypeData.licenseNumber = licenseNumber_2 || '';
854
+ if (number_2) {
855
+ var findFL = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
856
+ var license = _a.license;
857
+ return (license === null || license === void 0 ? void 0 : license.number) === number_2;
858
+ });
859
+ if (findFL || business_type === BusinessType.FL) {
860
+ selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_2 } });
861
+ }
862
+ else
863
+ selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: number_2 } });
864
+ state.data.businessTypeData.licenseNumber = number_2;
874
865
  }
875
866
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
876
867
  }
@@ -1029,9 +1020,6 @@ export var businessSlice = createSlice({
1029
1020
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
1030
1021
  }
1031
1022
  var activities = entity_activities || [];
1032
- var selectedActivity = activities[0];
1033
- if (!!selectedActivity)
1034
- state.data.activitiesData.activities = [selectedActivity];
1035
1023
  state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
1036
1024
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity });
1037
1025
  })
@@ -1073,19 +1061,19 @@ export var businessSlice = createSlice({
1073
1061
  state.error = null;
1074
1062
  })
1075
1063
  .addCase(retrieveDataList.fulfilled, function (state, action) {
1076
- var _a, _b, _c, _d, _e;
1064
+ var _a, _b;
1077
1065
  state.loading = false;
1078
1066
  state.error = null;
1079
- var payload = action.payload;
1080
- var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
1081
- var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[1];
1082
- var expectedSales = ((_b = payload.expectedSales) === null || _b === void 0 ? void 0 : _b.list) || [];
1083
- var expectedSale = (_d = (_c = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[0]) === null || _c === void 0 ? void 0 : _c.sub) === null || _d === void 0 ? void 0 : _d[4];
1084
- var expectedCustomerSales = ((_e = payload.expectedCustomerSales) === null || _e === void 0 ? void 0 : _e.list) || [];
1085
- var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
1067
+ var _c = action.payload, customerBases = _c.customerBases, expectedSales = _c.expectedSales, expectedCustomerSales = _c.expectedCustomerSales, countryISO2 = _c.countryISO2;
1068
+ var regional = customerBases.at(1);
1069
+ var local = customerBases.at(0);
1070
+ var expectedSale = (_b = (_a = expectedSales.at(0)) === null || _a === void 0 ? void 0 : _a.sub) === null || _b === void 0 ? void 0 : _b.at(4);
1071
+ var expectedCustomerSale = expectedCustomerSales.at(3);
1086
1072
  state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
1087
- if (!!customerBase)
1088
- state.data.customersData.customerLocations = [customerBase, customerBases[0]];
1073
+ if (local && isKW(countryISO2))
1074
+ state.data.customersData.customerLocations = [local];
1075
+ if (regional && local && isSA(countryISO2))
1076
+ state.data.customersData.customerLocations = [regional, local];
1089
1077
  if (!!expectedSale)
1090
1078
  state.data.customersData.expectedSale = expectedSale;
1091
1079
  if (!!expectedCustomerSale)
@@ -485,9 +485,8 @@ export var entitySlice = createSlice({
485
485
  var _a;
486
486
  return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
487
487
  });
488
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
489
- state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
490
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities });
488
+ state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
489
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [] });
491
490
  })
492
491
  .addCase(verifyLeadToken.rejected, function (state, action) {
493
492
  state.error = action.error.message;
@@ -547,8 +546,7 @@ export var entitySlice = createSlice({
547
546
  var _a;
548
547
  return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
549
548
  });
550
- var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
551
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities, operationStartDate: startDate || issuingDate });
549
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [], operationStartDate: startDate || issuingDate });
552
550
  })
553
551
  .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
554
552
  state.loading = false;
@@ -387,18 +387,11 @@ export var individualSlice = createSlice({
387
387
  (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
388
388
  if (!!selectedSourceIncome)
389
389
  state.data.individualData.sourceIncome = selectedSourceIncome;
390
- var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
391
- (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
392
- if (!!selectedMonthlyIncome)
393
- state.data.individualData.monthlyIncome = selectedMonthlyIncome;
394
390
  var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
395
391
  if (!!code) {
396
392
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
397
393
  state.data.individualData.employerLocation = employerLocation;
398
394
  }
399
- var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
400
- if (!!selectedOccupation)
401
- state.data.individualData.occupation = selectedOccupation;
402
395
  state.data.individualData.isPEP = is_relative_PEP;
403
396
  state.data.individualData.isInfluencer = is_influencer;
404
397
  })
@@ -447,18 +440,11 @@ export var individualSlice = createSlice({
447
440
  (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
448
441
  if (!!selectedSourceIncome)
449
442
  state.data.individualData.sourceIncome = selectedSourceIncome;
450
- var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
451
- (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
452
- if (!!selectedMonthlyIncome)
453
- state.data.individualData.monthlyIncome = selectedMonthlyIncome;
454
443
  var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
455
444
  if (!!code) {
456
445
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
457
446
  state.data.individualData.employerLocation = employerLocation;
458
447
  }
459
- var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
460
- if (!!selectedOccupation)
461
- state.data.individualData.occupation = selectedOccupation;
462
448
  state.data.individualData.isPEP = is_relative_PEP;
463
449
  state.data.individualData.isInfluencer = is_influencer;
464
450
  })
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { getResetFlowUrl, showLastFour, concatenateObjectValues } from '../../../../utils';
19
+ import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenBankName } from '../../../../utils';
20
20
  import { bankSelector } from '../../../app/bank/bankStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
55
55
  ? concatenateObjectValues(ar || en, ['first', 'last'])
56
56
  : concatenateObjectValues(en, ['first', 'last']);
57
57
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
58
- var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || t('bank');
58
+ var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.name) || t('bank');
59
59
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
60
60
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
61
61
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
@@ -1,6 +1,9 @@
1
1
  import * as yup from 'yup';
2
2
  export var ActivitiesValidationSchema = yup.object().shape({
3
- activities: yup.array().of(yup.object().shape({
3
+ activities: yup
4
+ .array()
5
+ .min(1, 'activities_list_alert')
6
+ .of(yup.object().shape({
4
7
  ar: yup.string(),
5
8
  en: yup.string()
6
9
  })),
@@ -17,7 +17,7 @@ import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
19
  import { businessSelector } from '../../../app/business/businessStore';
20
- import { concatenateObjectValues, getResetFlowUrl, showLastFour } from '../../../../utils';
20
+ import { concatenateObjectValues, getResetFlowUrl, shortenBankName, showLastFour } from '../../../../utils';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
55
55
  ? concatenateObjectValues(ar || en, ['first', 'last'])
56
56
  : concatenateObjectValues(en, ['first', 'last']);
57
57
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
58
- var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
+ var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
59
59
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
60
60
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
61
61
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
@@ -1,9 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { useTranslation, Trans } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { connectSelector } from '../../../../features/app/connect/connectStore';
6
+ import { useAppSelector } from '../../../../hooks';
7
+ import { maskEmail } from '../../../../utils';
5
8
  var ThankYou = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("connect_completed_title"), description: t("connect_completed_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(connectSelector).data;
12
+ var email = maskEmail((_c = (_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.email);
13
+ return (_jsx(SuccessScreen, { title: t("connect_completed_title"), description: _jsx(Trans, { i18nKey: 'connect_completed_description', values: { email: email } }), showEmailProviders: true }));
8
14
  };
9
15
  export default React.memo(ThankYou);
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { getResetFlowUrl, showLastFour } from '../../../../utils';
19
+ import { getResetFlowUrl, shortenBankName, showLastFour } from '../../../../utils';
20
20
  import { entitySelector } from '../../../app/entity/entityStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -52,7 +52,7 @@ var SuccessWithFlowButtons = function () {
52
52
  var _f = useState([]), buttons = _f[0], setButtons = _f[1];
53
53
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
54
54
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
55
- var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
55
+ var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
56
56
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
57
57
  var taxID = vatID || '';
58
58
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { concatenateObjectValues, getResetFlowUrl, showLastFour } from '../../../../utils';
19
+ import { concatenateObjectValues, getResetFlowUrl, shortenBankName, showLastFour } from '../../../../utils';
20
20
  import { individualSelector } from '../../../app/individual/individualStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
55
55
  ? concatenateObjectValues(ar || en, ['first', 'last'])
56
56
  : concatenateObjectValues(en, ['first', 'last']);
57
57
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
58
- var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
+ var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
59
59
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
60
60
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
61
61
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { getResetFlowUrl, showLastFour, concatenateObjectValues } from '../../../../utils';
19
+ import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenBankName } from '../../../../utils';
20
20
  import { passwordSelector } from '../../../app/password/passwordStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
55
55
  ? concatenateObjectValues(ar || en, ['first', 'last'])
56
56
  : concatenateObjectValues(en, ['first', 'last']);
57
57
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
58
- var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
+ var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
59
59
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
60
60
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
61
61
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
@@ -54,6 +54,7 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
54
54
  return ({
55
55
  margin: theme.spacing(0, 2.5, 2.5, 2.5),
56
56
  marginBlockStart: theme.spacing(5),
57
+ maxHeight: theme.spacing(5.375),
57
58
  display: 'flex',
58
59
  alignItems: 'center',
59
60
  justifyContent: 'center'
@@ -6,7 +6,7 @@ export interface ThankYouProps {
6
6
  successTitle?: string;
7
7
  loading?: boolean;
8
8
  error?: string;
9
- description?: string;
9
+ description?: string | React.ReactElement;
10
10
  }
11
11
  declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle, loading, error }: ThankYouProps) => JSX.Element>;
12
12
  export default _default;
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
17
  import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { getResetFlowUrl, showLastFour, concatenateObjectValues } from '../../../../utils';
19
+ import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenBankName } from '../../../../utils';
20
20
  import { taxSelector } from '../../../app/tax/taxStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
55
55
  ? concatenateObjectValues(ar || en, ['first', 'last'])
56
56
  : concatenateObjectValues(en, ['first', 'last']);
57
57
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
58
- var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
+ var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
59
59
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
60
60
  var taxID = vatID || '';
61
61
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
@@ -0,0 +1 @@
1
+ export declare const dateFormat: (date: Date, fmt?: string) => string;
@@ -0,0 +1,5 @@
1
+ import moment from 'moment';
2
+ export var dateFormat = function (date, fmt) {
3
+ if (fmt === void 0) { fmt = 'YYYY-MM-DD'; }
4
+ return moment(date).format('YYYY-MM-DD');
5
+ };
@@ -8,3 +8,4 @@ export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
10
  export * from './common';
11
+ export * from './date';
@@ -8,3 +8,4 @@ export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
10
  export * from './common';
11
+ export * from './date';
@@ -1,5 +1,6 @@
1
1
  import { DeviceInfo } from '../@types';
2
2
  export declare const maskPhone: (str?: string) => string;
3
+ export declare const shortenBankName: (str: string) => string;
3
4
  export declare const maskID: (str: string) => string;
4
5
  export declare const maskEmail: (str: string) => string;
5
6
  export declare const showLastFour: (str: string) => string;
@@ -8,13 +8,25 @@ export var maskPhone = function (str) {
8
8
  var lastTwo = str.substring(str.length - 2, str.length);
9
9
  return ' ••••' + lastTwo;
10
10
  };
11
+ export var shortenBankName = function (str) {
12
+ if (str)
13
+ return str.slice(0, 20);
14
+ return '';
15
+ };
11
16
  export var maskID = function (str) {
12
17
  var lastTwo = str.substring(str.length - 2, str.length);
13
18
  return ' ••••' + lastTwo;
14
19
  };
15
20
  export var maskEmail = function (str) {
16
- var lastTwo = str.substring(str.length - 2, str.length);
17
- return ' ••••' + lastTwo;
21
+ if (str) {
22
+ var name_1 = str.split('@')[0];
23
+ var maskedName = name_1[0] + '*' + name_1[name_1.length - 1];
24
+ var domain = str.split('@')[1].split('.')[0];
25
+ var maskedDomain = '@' + domain[0] + '*' + domain[domain.length - 1];
26
+ var TLD = '.' + str.split('@')[1].split('.')[1];
27
+ return maskedName + maskedDomain + TLD;
28
+ }
29
+ return '';
18
30
  };
19
31
  export var showLastFour = function (str) {
20
32
  if (str && str.length >= 4) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.7-test",
3
+ "version": "2.1.8-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",