@tap-payments/auth-jsconnect 2.4.32-test → 2.4.34-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.
@@ -28,8 +28,19 @@ import Box from '@mui/material/Box';
28
28
  import 'react-spring-bottom-sheet/dist/style.css';
29
29
  import { ICONS_NAMES } from '../../constants';
30
30
  import { useLanguage } from '../../hooks';
31
- import { PoweredByFooter } from '../../features/shared/Footer';
31
+ import { CustomFooter, PoweredByFooter } from '../../features/shared/Footer';
32
32
  import LogoBadge from '../LogoBadge';
33
+ var LanguageFooterStyled = styled(Box)(function (_a) {
34
+ var theme = _a.theme;
35
+ return ({
36
+ top: theme.spacing(2.5),
37
+ position: 'fixed',
38
+ alignItems: 'center',
39
+ width: '100%',
40
+ cursor: 'pointer',
41
+ zIndex: 99999
42
+ });
43
+ });
33
44
  var BottomSheetStyled = styled(BottomSheet, { shouldForwardProp: function (prop) { return prop !== 'isMaturityExpress'; } })(function (_a) {
34
45
  var theme = _a.theme, isMaturityExpress = _a.isMaturityExpress;
35
46
  return ({
@@ -38,7 +49,7 @@ var BottomSheetStyled = styled(BottomSheet, { shouldForwardProp: function (prop)
38
49
  backgroundColor: 'transparent'
39
50
  },
40
51
  '[data-rsbs-header]': __assign({ paddingBottom: theme.spacing(6), position: 'absolute', width: '100vw' }, (isMaturityExpress && { display: 'none' })),
41
- '[data-rsbs-overlay]': __assign({ backgroundColor: theme.palette.background.paper, zIndex: 9999 }, (isMaturityExpress && { maxHeight: 'calc(100vh - 80px)', marginBottom: theme.spacing(5.625), paddingTop: theme.spacing(5) })),
52
+ '[data-rsbs-overlay]': __assign({ backgroundColor: theme.palette.background.paper, zIndex: 9999, maxHeight: 'calc(100vh - 60px)' }, (isMaturityExpress && { maxHeight: 'calc(100vh - 140px)', marginBottom: theme.spacing(5.625), paddingTop: theme.spacing(5) })),
42
53
  '[data-rsbs-scroll]': {
43
54
  '&::-webkit-scrollbar': {
44
55
  width: '0px'
@@ -81,7 +92,7 @@ var BottomSheetComponent = function (_a) {
81
92
  }, 500);
82
93
  }
83
94
  }, [screenId]);
84
- return (_jsxs(BottomSheetStyled, __assign({ isMaturityExpress: isMaturityExpress, sx: { pointerEvents: pointerEvents }, ref: sheetRef, open: open, snapPoints: function (_a) {
95
+ return (_jsxs(BottomSheetStyled, __assign({ sibling: _jsx(LanguageFooterStyled, { children: _jsx(CustomFooter, {}) }), isMaturityExpress: isMaturityExpress, sx: { pointerEvents: pointerEvents }, ref: sheetRef, open: open, snapPoints: function (_a) {
85
96
  var maxHeight = _a.maxHeight;
86
97
  return [getMinHeight(maxHeight), maxHeight * 0.95];
87
98
  } }, rest, { children: [isMaturityExpress && _jsx(LogoBadge, { src: isMaturityExpress ? logo || ICONS_NAMES.LOGO_ICON : ICONS_NAMES.LOGO_ICON }), children, isMaturityExpress && (_jsx(FooterStyled, { children: _jsx(PoweredByFooter, { id: 'bottom-sheet-powered_by_footer', sx: { margin: '0px' }, textSx: { color: 'rgba(63, 66, 77, 0.6)' }, icon: isAr ? ICONS_NAMES.LOGO_WITH_NAME_DARK_AR_ICON : ICONS_NAMES.LOGO_WITH_NAME_DARK_EN_ICON }) }))] })));
@@ -2,6 +2,7 @@ import { RootState } from '../../../app/store';
2
2
  import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, CivilFormValues, ActionState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
+ isicActivityList: any;
5
6
  leadData: any;
6
7
  token: string;
7
8
  brandData: any;
@@ -11,6 +12,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
11
12
  data: any;
12
13
  isRequireOTP: boolean;
13
14
  token: string;
15
+ isicActivityList?: undefined;
14
16
  leadData?: undefined;
15
17
  brandData?: undefined;
16
18
  boardId?: undefined;
@@ -20,6 +22,7 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
20
22
  }, void, {}>;
21
23
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
22
24
  data: any;
25
+ isicActivityList: any;
23
26
  formData: {
24
27
  isNID: boolean;
25
28
  otp: string;
@@ -67,6 +70,7 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
67
70
  accountData: any;
68
71
  documentData: any;
69
72
  entityData: any;
73
+ isicActivityList: any;
70
74
  }, BusinessTypeFormValues, {}>;
71
75
  export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
72
76
  data: any;
@@ -62,10 +62,10 @@ import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTIT
62
62
  import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense } from '../../../utils';
63
63
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
- var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
66
- var _a;
67
- return __generator(this, function (_b) {
68
- switch (_b.label) {
65
+ var payload, data, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
66
+ var _b;
67
+ return __generator(this, function (_c) {
68
+ switch (_c.label) {
69
69
  case 0:
70
70
  payload = {
71
71
  service_name: 'tap_email',
@@ -73,8 +73,8 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
73
73
  };
74
74
  return [4, API.leadService.verifyLeadToken(payload)];
75
75
  case 1:
76
- data = (_b.sent()).data;
77
- if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
76
+ data = (_c.sent()).data;
77
+ if ((_b = data.errors) === null || _b === void 0 ? void 0 : _b.length)
78
78
  throw new Error(data.errors[0].description);
79
79
  if (data.mw_error)
80
80
  throw new Error(data.mw_error);
@@ -83,10 +83,10 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
83
83
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
84
84
  if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 20];
85
85
  boardData = undefined;
86
- brandData = undefined;
86
+ brandData = void 0, isicActivityList = undefined;
87
87
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
88
88
  case 2:
89
- leadData = (_b.sent()).data;
89
+ leadData = (_c.sent()).data;
90
90
  countryIso2 = leadData === null || leadData === void 0 ? void 0 : leadData.country_code;
91
91
  if (!countryIso2)
92
92
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -97,69 +97,71 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
97
97
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
98
98
  }
99
99
  if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
100
- entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
100
+ _a = leadData || {}, steps = _a.steps, brand = _a.brand, board_id = _a.board_id, business_id = _a.business_id, entity = _a.entity;
101
101
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
102
102
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
103
103
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
104
104
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
105
105
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
106
- if (!(!entity_activities && (hasBusinessCRInfoCompleted || hasBusinessCRActivitiesCompleted) && !hasBusinessCompleted)) return [3, 4];
107
- return [4, API.dataService.getActivities()];
106
+ if (!hasBusinessCompleted) return [3, 6];
107
+ if (!board_id) return [3, 5];
108
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
108
109
  case 3:
109
- activityList = (_b.sent()).list;
110
- leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
111
- _b.label = 4;
110
+ boardData = _c.sent();
111
+ return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
112
112
  case 4:
113
- if (!hasBusinessCompleted) return [3, 8];
114
- if (!board_id) return [3, 7];
115
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
113
+ _c.sent();
114
+ _c.label = 5;
116
115
  case 5:
117
- boardData = _b.sent();
118
- return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
119
- case 6:
120
- _b.sent();
121
- _b.label = 7;
122
- case 7:
123
116
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
124
117
  return [3, 19];
125
- case 8:
126
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
118
+ case 6:
119
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 7];
127
120
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
128
121
  return [3, 19];
129
- case 9:
130
- if (!hasBusinessCustomersCompleted) return [3, 10];
122
+ case 7:
123
+ if (!hasBusinessCustomersCompleted) return [3, 8];
131
124
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
132
125
  return [3, 19];
133
- case 10:
134
- if (!hasBusinessCRActivitiesCompleted) return [3, 13];
126
+ case 8:
127
+ if (!hasBusinessCRActivitiesCompleted) return [3, 12];
128
+ return [4, API.dataService.getActivitiesIsIc()];
129
+ case 9:
130
+ list = (_c.sent()).list;
131
+ isicActivityList = list || [];
135
132
  return [4, thunkApi.dispatch(retrieveDataList())];
136
- case 11:
137
- _b.sent();
133
+ case 10:
134
+ _c.sent();
138
135
  return [4, API.brandService.retrieveBrand(brandID)];
139
- case 12:
140
- brandData = _b.sent();
136
+ case 11:
137
+ brandData = _c.sent();
141
138
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
142
139
  return [3, 19];
143
- case 13:
140
+ case 12:
144
141
  if (!hasBusinessCRInfoCompleted) return [3, 15];
142
+ return [4, API.dataService.getActivitiesIsIc()];
143
+ case 13:
144
+ list = (_c.sent()).list;
145
+ isicActivityList = list || [];
145
146
  return [4, API.brandService.retrieveBrand(brandID)];
146
147
  case 14:
147
- brandData = _b.sent();
148
+ brandData = _c.sent();
148
149
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
149
150
  return [3, 19];
150
151
  case 15: return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
151
152
  case 16:
152
- _b.sent();
153
+ _c.sent();
153
154
  if (!isSA(countryIso2)) return [3, 18];
154
155
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
155
156
  case 17:
156
- _b.sent();
157
- _b.label = 18;
157
+ _c.sent();
158
+ _c.label = 18;
158
159
  case 18:
159
160
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
160
- _b.label = 19;
161
+ _c.label = 19;
161
162
  case 19: return [2, {
162
163
  data: data,
164
+ isicActivityList: isicActivityList,
163
165
  leadData: __assign(__assign({}, leadData), { flows: (boardData === null || boardData === void 0 ? void 0 : boardData.info) || [] }),
164
166
  token: token,
165
167
  brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
@@ -187,7 +189,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
187
189
  });
188
190
  }); });
189
191
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
190
- var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
192
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
191
193
  var _b, _c, _d, _e, _f, _g, _h;
192
194
  return __generator(this, function (_j) {
193
195
  switch (_j.label) {
@@ -208,7 +210,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
208
210
  data = (_j.sent()).data;
209
211
  if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
210
212
  throw new Error(data.errors[0].description);
211
- brandData = undefined;
213
+ isicActivityList = undefined;
212
214
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
213
215
  case 2:
214
216
  leadData = (_j.sent()).data;
@@ -236,55 +238,55 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
236
238
  _j.sent();
237
239
  _j.label = 6;
238
240
  case 6:
239
- entity_activities = leadData.entity_activities;
240
- if (!(!entity_activities && (hasBusinessCRInfoCompleted || hasBusinessCRActivitiesCompleted) && !hasBusinessCompleted)) return [3, 8];
241
- return [4, API.dataService.getActivities()];
242
- case 7:
243
- activityList = (_j.sent()).list;
244
- leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
245
- _j.label = 8;
246
- case 8:
247
- if (!isNID) return [3, 9];
241
+ if (!isNID) return [3, 7];
248
242
  thunkApi.dispatch(handleNextScreenStep());
249
243
  return [3, 22];
250
- case 9:
251
- if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 10];
244
+ case 7:
245
+ if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 8];
252
246
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
253
247
  return [3, 22];
254
- case 10:
255
- if (!hasBusinessCompleted) return [3, 14];
256
- if (!board_id) return [3, 13];
248
+ case 8:
249
+ if (!hasBusinessCompleted) return [3, 12];
250
+ if (!board_id) return [3, 11];
257
251
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
258
- case 11:
252
+ case 9:
259
253
  boardResponse = _j.sent();
260
254
  leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
261
255
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
262
- case 12:
256
+ case 10:
263
257
  _j.sent();
264
- _j.label = 13;
265
- case 13:
258
+ _j.label = 11;
259
+ case 11:
266
260
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
267
261
  return [3, 22];
268
- case 14:
269
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 15];
262
+ case 12:
263
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 13];
270
264
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
271
265
  return [3, 22];
272
- case 15:
273
- if (!hasBusinessCustomersCompleted) return [3, 16];
266
+ case 13:
267
+ if (!hasBusinessCustomersCompleted) return [3, 14];
274
268
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
275
269
  return [3, 22];
276
- case 16:
277
- if (!hasBusinessCRActivitiesCompleted) return [3, 19];
270
+ case 14:
271
+ if (!hasBusinessCRActivitiesCompleted) return [3, 18];
272
+ return [4, API.dataService.getActivitiesIsIc()];
273
+ case 15:
274
+ list = (_j.sent()).list;
275
+ isicActivityList = list || [];
278
276
  return [4, thunkApi.dispatch(retrieveDataList())];
279
- case 17:
277
+ case 16:
280
278
  _j.sent();
281
279
  return [4, API.brandService.retrieveBrand(brandID)];
282
- case 18:
280
+ case 17:
283
281
  brandData = _j.sent();
284
282
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
285
283
  return [3, 22];
286
- case 19:
284
+ case 18:
287
285
  if (!hasBusinessCRInfoCompleted) return [3, 21];
286
+ return [4, API.dataService.getActivitiesIsIc()];
287
+ case 19:
288
+ list = (_j.sent()).list;
289
+ isicActivityList = list || [];
288
290
  return [4, API.brandService.retrieveBrand(brandID)];
289
291
  case 20:
290
292
  brandData = _j.sent();
@@ -293,7 +295,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
293
295
  case 21:
294
296
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
295
297
  _j.label = 22;
296
- case 22: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
298
+ case 22: return [2, { data: data, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
297
299
  }
298
300
  });
299
301
  }); });
@@ -466,7 +468,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
466
468
  });
467
469
  }); });
468
470
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
469
- var _a, settings, business, isNonSA, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, entity_activities, list, accountBody, accountData, brandData, _c, message, error, brandRes, documentData, entityData, entityId, documentBody, payload_1;
471
+ var _a, settings, business, isNonSA, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, brandData, _c, message, error, brandRes, list, documentData, entityData, entityId, documentBody, payload_1;
470
472
  var _d, _e;
471
473
  return __generator(this, function (_f) {
472
474
  switch (_f.label) {
@@ -489,14 +491,6 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
489
491
  return [4, API.leadService.updateLead(payload)];
490
492
  case 1:
491
493
  data = _f.sent();
492
- entity_activities = data.entity_activities;
493
- if (!!entity_activities) return [3, 3];
494
- return [4, API.dataService.getActivities()];
495
- case 2:
496
- list = (_f.sent()).list;
497
- data.entity_activities = list;
498
- _f.label = 3;
499
- case 3:
500
494
  accountBody = {
501
495
  lead_id: lead_id,
502
496
  notify: {
@@ -508,30 +502,32 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
508
502
  step_name: BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM
509
503
  };
510
504
  brandData = undefined;
511
- _f.label = 4;
512
- case 4:
513
- _f.trys.push([4, 6, , 10]);
505
+ _f.label = 2;
506
+ case 2:
507
+ _f.trys.push([2, 4, , 8]);
514
508
  return [4, API.accountService.createAccount(accountBody)];
515
- case 5:
509
+ case 3:
516
510
  accountData = _f.sent();
517
- return [3, 10];
518
- case 6:
511
+ return [3, 8];
512
+ case 4:
519
513
  _c = _f.sent();
520
514
  message = _c.message;
521
515
  error = message;
522
- if (!((error === null || error === void 0 ? void 0 : error.toLowerCase()) === 'entity with license already exist')) return [3, 8];
516
+ if (!((error === null || error === void 0 ? void 0 : error.toLowerCase()) === 'entity with license already exist')) return [3, 6];
523
517
  return [4, API.brandService.retrieveBrand(brand === null || brand === void 0 ? void 0 : brand.id)];
524
- case 7:
518
+ case 5:
525
519
  brandRes = (_f.sent()).brand;
526
520
  brandData = brandRes;
527
521
  stepName = 'BUSINESS_VERIFY_BRAND_INFO';
528
- return [3, 9];
529
- case 8: throw new Error(error);
530
- case 9: return [3, 10];
531
- case 10:
522
+ return [3, 7];
523
+ case 6: throw new Error(error);
524
+ case 7: return [3, 8];
525
+ case 8: return [4, API.dataService.getActivitiesIsIc()];
526
+ case 9:
527
+ list = (_f.sent()).list;
532
528
  entityData = undefined;
533
529
  entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
534
- if (!((certificateId || []).length > 0)) return [3, 12];
530
+ if (!((certificateId || []).length > 0)) return [3, 11];
535
531
  documentBody = {
536
532
  entity_id: entityId || '',
537
533
  documents: [
@@ -542,55 +538,77 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
542
538
  ]
543
539
  };
544
540
  return [4, API.documentService.updateDocumentInfo(documentBody)];
545
- case 11:
541
+ case 10:
546
542
  documentData = _f.sent();
547
- _f.label = 12;
548
- case 12:
549
- if (!(articleId && entityId)) return [3, 14];
543
+ _f.label = 11;
544
+ case 11:
545
+ if (!(articleId && entityId)) return [3, 13];
550
546
  payload_1 = {
551
547
  id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
552
548
  AOA_file_id: articleId
553
549
  };
554
550
  return [4, API.entityService.updateEntity(payload_1)];
555
- case 13:
551
+ case 12:
556
552
  entityData = _f.sent();
557
- _f.label = 14;
558
- case 14:
553
+ _f.label = 13;
554
+ case 13:
559
555
  thunkApi.dispatch(handleNextScreenStep(stepName));
560
556
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
561
- return [2, { data: __assign(__assign({}, data), { brand: brandData }), formData: params, accountData: accountData, documentData: documentData, entityData: entityData }];
557
+ return [2, { data: __assign(__assign({}, data), { brand: brandData }), formData: params, accountData: accountData, documentData: documentData, entityData: entityData, isicActivityList: list || [] }];
562
558
  }
563
559
  });
564
560
  }); });
565
561
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
566
- var _a, settings, business, activities, stepName, id, requestBody, data;
567
- var _b, _c, _d, _e, _f;
568
- return __generator(this, function (_g) {
569
- switch (_g.label) {
562
+ var _a, settings, business, _b, brand, entity_activities, entity, _c, brandActivities, brandId, activities, operationStartDate, stepName, id, removedActivities, payload, newBrandActivities, newEntityActivities, activityPayload, requestBody, data;
563
+ var _d, _e;
564
+ return __generator(this, function (_f) {
565
+ switch (_f.label) {
570
566
  case 0:
571
567
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
572
- activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
573
- var id = _a.id;
574
- return ({ id: id });
575
- });
568
+ _b = business.data.verify.responseBody || {}, brand = _b.brand, entity_activities = _b.entity_activities, entity = _b.entity;
569
+ _c = brand || {}, brandActivities = _c.activities, brandId = _c.id;
570
+ activities = params.activities, operationStartDate = params.operationStartDate;
576
571
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
577
- id = (_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
578
- requestBody = {
572
+ id = brandId;
573
+ removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
574
+ if (!(removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length)) return [3, 2];
575
+ payload = {
579
576
  id: id,
580
- activities: activities,
581
- operations: {
582
- start_date: params.operationStartDate
583
- },
584
- step_name: stepName,
585
- encryption_contract: ['operations.start_date']
577
+ activities: removedActivities
586
578
  };
587
- return [4, API.brandService.updateBrandInfo(requestBody)];
579
+ return [4, API.brandService.removeBrandActivity(payload)];
588
580
  case 1:
589
- data = _g.sent();
581
+ _f.sent();
582
+ _f.label = 2;
583
+ case 2:
584
+ newBrandActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(brandActivities || []).some(function (brandActivity) { return act.id === brandActivity.id; }); });
585
+ newEntityActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(entity_activities || []).some(function (entityActivity) { return act.id === entityActivity.id; }); });
586
+ if (!(newEntityActivities === null || newEntityActivities === void 0 ? void 0 : newEntityActivities.length)) return [3, 4];
587
+ activityPayload = {
588
+ id: entity === null || entity === void 0 ? void 0 : entity.id,
589
+ activities: newEntityActivities.map(function (_a) {
590
+ var id = _a.id;
591
+ return ({ id: id });
592
+ })
593
+ };
594
+ return [4, API.entityService.updateEntityActivity(activityPayload)];
595
+ case 3:
596
+ _f.sent();
597
+ _f.label = 4;
598
+ case 4:
599
+ requestBody = __assign(__assign({ id: id }, ((newBrandActivities === null || newBrandActivities === void 0 ? void 0 : newBrandActivities.length) && { activities: newBrandActivities.map(function (_a) {
600
+ var id = _a.id;
601
+ return ({ id: id });
602
+ }) })), { operations: {
603
+ start_date: operationStartDate
604
+ }, step_name: stepName, encryption_contract: ['operations.start_date'] });
605
+ return [4, API.brandService.updateBrandInfo(requestBody)];
606
+ case 5:
607
+ data = _f.sent();
590
608
  thunkApi.dispatch(retrieveDataList());
591
609
  thunkApi.dispatch(updateStepName(stepName));
592
610
  thunkApi.dispatch(handleNextScreenStep());
593
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
611
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
594
612
  return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: __assign({}, params) }];
595
613
  }
596
614
  });
@@ -793,7 +811,7 @@ export var businessSlice = createSlice({
793
811
  var _a, _b;
794
812
  state.error = null;
795
813
  state.customLoading = false;
796
- var _c = action.payload, data = _c.data, boardId = _c.boardId, brandData = _c.brandData, leadData = _c.leadData, token = _c.token, isRequireOTP = _c.isRequireOTP;
814
+ var _c = action.payload, data = _c.data, boardId = _c.boardId, brandData = _c.brandData, leadData = _c.leadData, token = _c.token, isRequireOTP = _c.isRequireOTP, isicActivityList = _c.isicActivityList;
797
815
  var responseBody = state.data.verify.responseBody;
798
816
  state.data.verify.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id }), (brandData && { brand: brandData }));
799
817
  if (token)
@@ -807,20 +825,19 @@ export var businessSlice = createSlice({
807
825
  var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
808
826
  if (issuingDate)
809
827
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
810
- var activities = entity_activities || [];
811
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
812
- var activities = (brandData || {}).activities;
813
- return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
814
- });
815
- var terms = (brandData || {}).terms;
828
+ var _e = brandData || {}, terms = _e.terms, activities = _e.activities;
829
+ var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
830
+ return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
831
+ })) || [];
832
+ var selectedActivity = __spreadArray(__spreadArray([], (activities || []), true), entityActivities, true);
816
833
  terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
817
834
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
818
835
  state.data.customersData.transactionPolicy = element.agree;
819
836
  state.data.customersData.refundPolicy = element.agree;
820
837
  }
821
838
  });
822
- state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
823
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
839
+ state.data.activitiesData.activities = selectedActivity;
840
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList });
824
841
  })
825
842
  .addCase(verifyLeadToken.rejected, function (state, action) {
826
843
  state.error = action.error.message;
@@ -851,7 +868,7 @@ export var businessSlice = createSlice({
851
868
  var _a, _b;
852
869
  state.loading = false;
853
870
  state.error = null;
854
- var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData;
871
+ var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData, isicActivityList = _c.isicActivityList;
855
872
  state.data.otpData = formData;
856
873
  state.data.otpData.responseBody = data;
857
874
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, leadData), state.data.verify.responseBody), (brand && { brand: brand })), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
@@ -861,20 +878,19 @@ export var businessSlice = createSlice({
861
878
  var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
862
879
  if (issuingDate)
863
880
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
864
- var activities = entity_activities || [];
865
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
866
- var activities = (brand || {}).activities;
867
- return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return value.id === activity.id; });
868
- });
869
- var terms = (brand || {}).terms;
881
+ var _e = brand || {}, terms = _e.terms, activities = _e.activities;
882
+ var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
883
+ return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
884
+ })) || [];
885
+ var selectedActivity = __spreadArray(__spreadArray([], (activities || []), true), entityActivities, true);
870
886
  terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
871
887
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
872
888
  state.data.customersData.transactionPolicy = element.agree;
873
889
  state.data.customersData.refundPolicy = element.agree;
874
890
  }
875
891
  });
876
- state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
877
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
892
+ state.data.activitiesData.activities = selectedActivity;
893
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList });
878
894
  })
879
895
  .addCase(verifyLeadOTP.rejected, function (state, action) {
880
896
  state.loading = false;
@@ -1058,7 +1074,7 @@ export var businessSlice = createSlice({
1058
1074
  var _a;
1059
1075
  state.loading = false;
1060
1076
  state.error = null;
1061
- var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData;
1077
+ var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData, isicActivityList = _b.isicActivityList;
1062
1078
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
1063
1079
  var entity = data.entity, entity_activities = data.entity_activities, brand = data.brand;
1064
1080
  var issuingDate = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date) || new Date().getTime();
@@ -1066,11 +1082,16 @@ export var businessSlice = createSlice({
1066
1082
  state.error = 'signup_user_exists_error';
1067
1083
  return;
1068
1084
  }
1085
+ var activities = (brand || {}).activities;
1086
+ var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
1087
+ return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
1088
+ })) || [];
1089
+ var selectedActivity = __spreadArray(__spreadArray([], (activities || []), true), entityActivities, true);
1090
+ state.data.activitiesData.activities = selectedActivity;
1069
1091
  if (issuingDate) {
1070
1092
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
1071
1093
  }
1072
- var activities = entity_activities || [];
1073
- state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
1094
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activityList: isicActivityList }), accountData), documentData);
1074
1095
  var terms = (brand || {}).terms;
1075
1096
  terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
1076
1097
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {