@tap-payments/auth-jsconnect 2.0.61 → 2.0.62

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 }) }))] })));
@@ -98,7 +98,7 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
98
98
  thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
99
99
  }
100
100
  else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
101
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
101
+ thunkApi.dispatch(handleNextScreenStep());
102
102
  }
103
103
  return [2, {
104
104
  data: data,
@@ -121,7 +121,7 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
121
121
  return [4, API.dataService.getTeamSize({ page: 0 })];
122
122
  case 8:
123
123
  teamSizeList = _j.sent();
124
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
124
+ thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
125
125
  _j.label = 9;
126
126
  case 9: return [2, {
127
127
  data: data,
@@ -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, brandRes, _c, message, error, 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,33 @@ 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, 5, , 6]);
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 [4, API.brandService.retrieveBrand(brand === null || brand === void 0 ? void 0 : brand.id)];
512
+ case 4:
513
+ brandRes = (_f.sent()).brand;
514
+ brandData = brandRes;
515
+ return [3, 6];
516
+ case 5:
519
517
  _c = _f.sent();
520
518
  message = _c.message;
521
519
  error = message;
522
- if (!((error === null || error === void 0 ? void 0 : error.toLowerCase()) === 'entity with license already exist')) return [3, 8];
523
- return [4, API.brandService.retrieveBrand(brand === null || brand === void 0 ? void 0 : brand.id)];
520
+ if ((error === null || error === void 0 ? void 0 : error.toLowerCase()) === 'entity with license already exist') {
521
+ stepName = 'BUSINESS_VERIFY_BRAND_INFO';
522
+ }
523
+ else
524
+ throw new Error(error);
525
+ return [3, 6];
526
+ case 6: return [4, API.dataService.getActivitiesIsIc()];
524
527
  case 7:
525
- brandRes = (_f.sent()).brand;
526
- brandData = brandRes;
527
- 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:
528
+ list = (_f.sent()).list;
532
529
  entityData = undefined;
533
530
  entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
534
- if (!((certificateId || []).length > 0)) return [3, 12];
531
+ if (!((certificateId || []).length > 0)) return [3, 9];
535
532
  documentBody = {
536
533
  entity_id: entityId || '',
537
534
  documents: [
@@ -542,55 +539,77 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
542
539
  ]
543
540
  };
544
541
  return [4, API.documentService.updateDocumentInfo(documentBody)];
545
- case 11:
542
+ case 8:
546
543
  documentData = _f.sent();
547
- _f.label = 12;
548
- case 12:
549
- if (!(articleId && entityId)) return [3, 14];
544
+ _f.label = 9;
545
+ case 9:
546
+ if (!(articleId && entityId)) return [3, 11];
550
547
  payload_1 = {
551
548
  id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
552
549
  AOA_file_id: articleId
553
550
  };
554
551
  return [4, API.entityService.updateEntity(payload_1)];
555
- case 13:
552
+ case 10:
556
553
  entityData = _f.sent();
557
- _f.label = 14;
558
- case 14:
554
+ _f.label = 11;
555
+ case 11:
559
556
  thunkApi.dispatch(handleNextScreenStep(stepName));
560
557
  (_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 }];
558
+ return [2, { data: __assign(__assign({}, data), { brand: brandData }), formData: params, accountData: accountData, documentData: documentData, entityData: entityData, isicActivityList: list || [] }];
562
559
  }
563
560
  });
564
561
  }); });
565
562
  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) {
563
+ var _a, settings, business, _b, brand, entity_activities, entity, _c, brandActivities, brandId, activities, operationStartDate, stepName, id, removedActivities, payload, newBrandActivities, newEntityActivities, activityPayload, requestBody, data;
564
+ var _d, _e;
565
+ return __generator(this, function (_f) {
566
+ switch (_f.label) {
570
567
  case 0:
571
568
  _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
- });
569
+ _b = business.data.verify.responseBody || {}, brand = _b.brand, entity_activities = _b.entity_activities, entity = _b.entity;
570
+ _c = brand || {}, brandActivities = _c.activities, brandId = _c.id;
571
+ activities = params.activities, operationStartDate = params.operationStartDate;
576
572
  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 = {
573
+ id = brandId;
574
+ removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
575
+ if (!(removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length)) return [3, 2];
576
+ payload = {
579
577
  id: id,
580
- activities: activities,
581
- operations: {
582
- start_date: params.operationStartDate
583
- },
584
- step_name: stepName,
585
- encryption_contract: ['operations.start_date']
578
+ activities: removedActivities
586
579
  };
587
- return [4, API.brandService.updateBrandInfo(requestBody)];
580
+ return [4, API.brandService.removeBrandActivity(payload)];
588
581
  case 1:
589
- data = _g.sent();
582
+ _f.sent();
583
+ _f.label = 2;
584
+ case 2:
585
+ newBrandActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(brandActivities || []).some(function (brandActivity) { return act.id === brandActivity.id; }); });
586
+ newEntityActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(entity_activities || []).some(function (entityActivity) { return act.id === entityActivity.id; }); });
587
+ if (!(newEntityActivities === null || newEntityActivities === void 0 ? void 0 : newEntityActivities.length)) return [3, 4];
588
+ activityPayload = {
589
+ id: entity === null || entity === void 0 ? void 0 : entity.id,
590
+ activities: newEntityActivities.map(function (_a) {
591
+ var id = _a.id;
592
+ return ({ id: id });
593
+ })
594
+ };
595
+ return [4, API.entityService.updateEntityActivity(activityPayload)];
596
+ case 3:
597
+ _f.sent();
598
+ _f.label = 4;
599
+ case 4:
600
+ requestBody = __assign(__assign({ id: id }, ((newBrandActivities === null || newBrandActivities === void 0 ? void 0 : newBrandActivities.length) && { activities: newBrandActivities.map(function (_a) {
601
+ var id = _a.id;
602
+ return ({ id: id });
603
+ }) })), { operations: {
604
+ start_date: operationStartDate
605
+ }, step_name: stepName, encryption_contract: ['operations.start_date'] });
606
+ return [4, API.brandService.updateBrandInfo(requestBody)];
607
+ case 5:
608
+ data = _f.sent();
590
609
  thunkApi.dispatch(retrieveDataList());
591
610
  thunkApi.dispatch(updateStepName(stepName));
592
611
  thunkApi.dispatch(handleNextScreenStep());
593
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
612
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
594
613
  return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: __assign({}, params) }];
595
614
  }
596
615
  });
@@ -793,7 +812,7 @@ export var businessSlice = createSlice({
793
812
  var _a, _b;
794
813
  state.error = null;
795
814
  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;
815
+ 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
816
  var responseBody = state.data.verify.responseBody;
798
817
  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
818
  if (token)
@@ -807,20 +826,19 @@ export var businessSlice = createSlice({
807
826
  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
827
  if (issuingDate)
809
828
  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;
829
+ var _e = brandData || {}, terms = _e.terms, activities = _e.activities;
830
+ var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
831
+ return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
832
+ })) || [];
833
+ var selectedActivity = __spreadArray(__spreadArray([], (activities || []), true), entityActivities, true);
816
834
  terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
817
835
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
818
836
  state.data.customersData.transactionPolicy = element.agree;
819
837
  state.data.customersData.refundPolicy = element.agree;
820
838
  }
821
839
  });
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 });
840
+ state.data.activitiesData.activities = selectedActivity;
841
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList });
824
842
  })
825
843
  .addCase(verifyLeadToken.rejected, function (state, action) {
826
844
  state.error = action.error.message;
@@ -851,7 +869,7 @@ export var businessSlice = createSlice({
851
869
  var _a, _b;
852
870
  state.loading = false;
853
871
  state.error = null;
854
- var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData;
872
+ var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData, isicActivityList = _c.isicActivityList;
855
873
  state.data.otpData = formData;
856
874
  state.data.otpData.responseBody = data;
857
875
  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 +879,19 @@ export var businessSlice = createSlice({
861
879
  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
880
  if (issuingDate)
863
881
  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;
882
+ var _e = brand || {}, terms = _e.terms, activities = _e.activities;
883
+ var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
884
+ return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
885
+ })) || [];
886
+ var selectedActivity = __spreadArray(__spreadArray([], (activities || []), true), entityActivities, true);
870
887
  terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
871
888
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
872
889
  state.data.customersData.transactionPolicy = element.agree;
873
890
  state.data.customersData.refundPolicy = element.agree;
874
891
  }
875
892
  });
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 });
893
+ state.data.activitiesData.activities = selectedActivity;
894
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList });
878
895
  })
879
896
  .addCase(verifyLeadOTP.rejected, function (state, action) {
880
897
  state.loading = false;
@@ -1058,7 +1075,7 @@ export var businessSlice = createSlice({
1058
1075
  var _a;
1059
1076
  state.loading = false;
1060
1077
  state.error = null;
1061
- var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData;
1078
+ var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData, isicActivityList = _b.isicActivityList;
1062
1079
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
1063
1080
  var entity = data.entity, entity_activities = data.entity_activities, brand = data.brand;
1064
1081
  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,19 +1083,25 @@ export var businessSlice = createSlice({
1066
1083
  state.error = 'signup_user_exists_error';
1067
1084
  return;
1068
1085
  }
1086
+ var activities = (brand || {}).activities;
1087
+ var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
1088
+ return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
1089
+ })) || [];
1090
+ var selectedActivity = __spreadArray(__spreadArray([], (activities || []), true), entityActivities, true);
1091
+ state.data.activitiesData.activities = selectedActivity;
1069
1092
  if (issuingDate) {
1070
1093
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
1071
1094
  }
1072
- var activities = entity_activities || [];
1073
- state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
1095
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activityList: isicActivityList }), accountData), documentData);
1074
1096
  var terms = (brand || {}).terms;
1097
+ var entity_id = (accountData || {}).entity_id;
1075
1098
  terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
1076
1099
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
1077
1100
  state.data.customersData.transactionPolicy = element.agree;
1078
1101
  state.data.customersData.refundPolicy = element.agree;
1079
1102
  }
1080
1103
  });
1081
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), { entity: entity }), (brand && { brand: brand }));
1104
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), { entity: __assign(__assign({}, entity), (entity_id && { id: entity_id })) }), (brand && { brand: brand }));
1082
1105
  })
1083
1106
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
1084
1107
  state.loading = false;