@tap-payments/auth-jsconnect 2.1.3-test → 2.1.6-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.
Files changed (39) hide show
  1. package/build/@types/form.d.ts +1 -0
  2. package/build/api/entity.d.ts +1 -1
  3. package/build/constants/app.d.ts +1 -0
  4. package/build/constants/app.js +11 -4
  5. package/build/features/app/bank/bankStore.js +3 -3
  6. package/build/features/app/business/businessStore.js +2 -2
  7. package/build/features/app/entity/entityStore.d.ts +13 -1
  8. package/build/features/app/entity/entityStore.js +189 -33
  9. package/build/features/app/individual/individualStore.js +5 -5
  10. package/build/features/app/password/passwordStore.d.ts +1 -7
  11. package/build/features/app/password/passwordStore.js +30 -19
  12. package/build/features/app/tax/taxStore.js +3 -3
  13. package/build/features/business/screens/BusinessType/LicenseList.js +4 -2
  14. package/build/features/business/screens/BusinessType/LicenseNumber.js +6 -6
  15. package/build/features/business/screens/BusinessType/LicenseType.js +12 -1
  16. package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
  17. package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
  18. package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
  19. package/build/features/entity/screens/Customers/Customers.js +90 -0
  20. package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
  21. package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
  22. package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
  23. package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
  24. package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
  25. package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
  26. package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
  27. package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
  28. package/build/features/entity/screens/Customers/index.d.ts +3 -0
  29. package/build/features/entity/screens/Customers/index.js +2 -0
  30. package/build/features/entity/screens/Customers/validation.d.ts +20 -0
  31. package/build/features/entity/screens/Customers/validation.js +13 -0
  32. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +14 -5
  33. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
  34. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +15 -7
  35. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +73 -0
  36. package/build/features/entity/screens/EntityInfoConfirm/validation.js +61 -2
  37. package/build/features/featuresScreens.js +5 -0
  38. package/build/features/password/screens/Success/Success.js +7 -3
  39. package/package.json +1 -1
@@ -84,6 +84,7 @@ export declare type PasswordCreateFormValues = {
84
84
  export declare type EntityFormValues = {
85
85
  licenseNumber: string;
86
86
  licenseName: string;
87
+ licenseType: string;
87
88
  activities: Array<Activity>;
88
89
  operationStartDate: string;
89
90
  uploading?: boolean;
@@ -56,7 +56,7 @@ export declare type UploadFileBody = {
56
56
  };
57
57
  export declare type UpdateEntityBody = {
58
58
  id: string;
59
- license: {
59
+ license?: {
60
60
  type?: string;
61
61
  number?: string;
62
62
  additional_info?: {
@@ -132,6 +132,7 @@ export declare const PASSWORD_STEP_NAMES: {
132
132
  export declare const ENTITY_STEP_NAMES: {
133
133
  PHONE_AUTH: string;
134
134
  ENTITY_INFO: string;
135
+ ENTITY_CUSTOMER: string;
135
136
  ENTITY_SUCCESS: string;
136
137
  };
137
138
  export declare const RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
@@ -316,21 +316,27 @@ export var ENTITY_SCREENS_NAVIGATION = [
316
316
  },
317
317
  {
318
318
  name: 'ENTITY_INFO_STEP',
319
- next: 'ENTITY_DETAILS_SUCCESS_STEP',
319
+ next: 'ENTITY_CUSTOMERS_STEP',
320
320
  prev: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
321
321
  order: 2
322
322
  },
323
323
  {
324
- name: 'ENTITY_DETAILS_SUCCESS_STEP',
325
- next: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
324
+ name: 'ENTITY_CUSTOMERS_STEP',
325
+ next: 'ENTITY_DETAILS_SUCCESS_STEP',
326
326
  prev: 'ENTITY_INFO_STEP',
327
327
  order: 3
328
328
  },
329
+ {
330
+ name: 'ENTITY_DETAILS_SUCCESS_STEP',
331
+ next: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
332
+ prev: 'ENTITY_CUSTOMERS_STEP',
333
+ order: 4
334
+ },
329
335
  {
330
336
  name: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
331
337
  next: 'ENTITY_RESET_PASSWORD_SUCCESS',
332
338
  prev: '',
333
- order: 4
339
+ order: 5
334
340
  },
335
341
  {
336
342
  name: 'ENTITY_RESET_PASSWORD_SUCCESS',
@@ -461,6 +467,7 @@ export var PASSWORD_STEP_NAMES = {
461
467
  export var ENTITY_STEP_NAMES = {
462
468
  PHONE_AUTH: 'entity_phone_auth',
463
469
  ENTITY_INFO: 'entity_info',
470
+ ENTITY_CUSTOMER: 'entity_customer',
464
471
  ENTITY_SUCCESS: 'entity_completed'
465
472
  };
466
473
  export var RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
@@ -79,7 +79,7 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
79
79
  countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
80
80
  if (countryIso2)
81
81
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
82
- info = boardInfoData.info;
82
+ info = (boardInfoData || {}).info;
83
83
  hasBankCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
84
84
  if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
85
85
  thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
@@ -102,7 +102,7 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
102
102
  name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
103
103
  contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
104
104
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
105
- flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
105
+ flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [])
106
106
  },
107
107
  token: token
108
108
  }];
@@ -275,7 +275,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
275
275
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
276
276
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
277
277
  thunkApi.dispatch(handleNextScreenStep());
278
- return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
278
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((data === null || data === void 0 ? void 0 : data.info) || []) }), formData: params }];
279
279
  }
280
280
  });
281
281
  }); });
@@ -164,7 +164,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
164
164
  _h.label = 18;
165
165
  case 18: return [2, {
166
166
  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) }),
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) || []) }),
168
168
  token: token,
169
169
  brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
170
170
  boardId: (_g = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _g === void 0 ? void 0 : _g.board_id
@@ -254,7 +254,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
254
254
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
255
255
  case 9:
256
256
  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) });
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) || []) });
258
258
  _j.label = 10;
259
259
  case 10: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
260
260
  case 11:
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { EntityFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { CustomersFormValues, EntityFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  boardResponse: {
@@ -11,6 +11,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
11
11
  name: any;
12
12
  contact: any;
13
13
  flows: any;
14
+ entity_activities: any;
14
15
  };
15
16
  token: string;
16
17
  }, string, {}>;
@@ -28,6 +29,7 @@ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<
28
29
  name: any;
29
30
  contact: any;
30
31
  flows: any;
32
+ entity_activities: any;
31
33
  };
32
34
  formData: OTPFormValues;
33
35
  }, OTPFormValues, {}>;
@@ -45,6 +47,15 @@ interface UploadArticleParams {
45
47
  export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
46
48
  data: any;
47
49
  }, UploadArticleParams, {}>;
50
+ export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<{
51
+ data: any;
52
+ formData: CustomersFormValues;
53
+ }, CustomersFormValues, {}>;
54
+ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
55
+ customerBases: any;
56
+ expectedSales: any;
57
+ expectedCustomerSales: any;
58
+ }, void, {}>;
48
59
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
49
60
  response: any;
50
61
  formData: void;
@@ -56,6 +67,7 @@ export interface EntityData {
56
67
  verify: ResponseData & VerifyData;
57
68
  otpData: OTPFormValues & ResponseData;
58
69
  entityData: EntityFormValues & ResponseData;
70
+ customersData: CustomersFormValues & ResponseData;
59
71
  flowName: FlowsTypes;
60
72
  }
61
73
  export interface EntityState extends SharedState<EntityData> {
@@ -48,13 +48,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
51
+ import { BusinessType, FlowsTypes } from '../../../@types';
52
52
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { ENTITY_STEP_NAMES } from '../../../constants';
54
54
  import moment from 'moment';
55
55
  import { convertNumbers2English } from '../../../utils';
56
56
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
57
- var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, board_info_id, entityId, info, hasEntityCompleted;
57
+ var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, board_info_id, entityId, activities, data_1, info, hasEntityCompleted;
58
58
  var _a, _b, _c, _d;
59
59
  return __generator(this, function (_e) {
60
60
  switch (_e.label) {
@@ -67,13 +67,13 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
67
67
  case 1:
68
68
  data = (_e.sent()).data;
69
69
  countryIso2 = undefined;
70
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 9];
71
71
  if (data === null || data === void 0 ? void 0 : data.country_code) {
72
72
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
73
73
  if (countryIso2)
74
74
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
75
75
  }
76
- if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
76
+ if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 9];
77
77
  board_id = data === null || data === void 0 ? void 0 : data.id;
78
78
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
79
79
  if (!(board_id && board_info_id)) return [3, 3];
@@ -89,18 +89,24 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
89
89
  _e.label = 5;
90
90
  case 5:
91
91
  entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
92
- if (!entityId) return [3, 7];
92
+ if (!entityId) return [3, 8];
93
93
  return [4, API.entityService.retrieveEntity(entityId)];
94
94
  case 6:
95
95
  entityData = _e.sent();
96
- _e.label = 7;
96
+ activities = (entityData || {}).activities;
97
+ if (!!activities) return [3, 8];
98
+ return [4, API.dataService.getActivities()];
97
99
  case 7:
100
+ data_1 = _e.sent();
101
+ entityData = __assign(__assign({}, entityData), { entity_activities: data_1.list });
102
+ _e.label = 8;
103
+ case 8:
98
104
  if (!countryIso2) {
99
105
  countryIso2 = entityData.country;
100
106
  if (countryIso2)
101
107
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
102
108
  }
103
- info = boardInfoData.info;
109
+ info = (boardInfoData || {}).info;
104
110
  hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
105
111
  if (hasEntityCompleted) {
106
112
  thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
@@ -108,8 +114,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
108
114
  else {
109
115
  thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
110
116
  }
111
- _e.label = 8;
112
- case 8: return [2, {
117
+ _e.label = 9;
118
+ case 9: return [2, {
113
119
  data: data,
114
120
  boardResponse: {
115
121
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
@@ -119,7 +125,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
119
125
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
120
126
  name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
121
127
  contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
122
- flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
128
+ flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info,
129
+ entity_activities: entityData === null || entityData === void 0 ? void 0 : entityData.entity_activities
123
130
  },
124
131
  token: token
125
132
  }];
@@ -144,7 +151,7 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
144
151
  });
145
152
  }); });
146
153
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
147
- var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, info, hasEntityCompleted;
154
+ var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, activities, data_2, info, hasEntityCompleted;
148
155
  var _b, _c, _d, _e, _f, _g, _h;
149
156
  return __generator(this, function (_j) {
150
157
  switch (_j.label) {
@@ -162,7 +169,7 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
162
169
  case 1:
163
170
  data = (_j.sent()).data;
164
171
  boardInfoData = undefined;
165
- if (!!data.errors) return [3, 8];
172
+ if (!!data.errors) return [3, 9];
166
173
  board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
167
174
  board_info_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.board_info_id;
168
175
  if (!(board_id && board_info_id)) return [3, 3];
@@ -178,14 +185,20 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
178
185
  _j.label = 5;
179
186
  case 5:
180
187
  entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
181
- if (!entityId) return [3, 7];
188
+ if (!entityId) return [3, 8];
182
189
  return [4, API.entityService.retrieveEntity(entityId)];
183
190
  case 6:
184
191
  entityData = _j.sent();
185
- _j.label = 7;
192
+ activities = (entityData || {}).activities;
193
+ if (!!activities) return [3, 8];
194
+ return [4, API.dataService.getActivities()];
186
195
  case 7:
196
+ data_2 = _j.sent();
197
+ entityData = __assign(__assign({}, entityData), { entity_activities: data_2.list });
198
+ _j.label = 8;
199
+ case 8:
187
200
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
188
- info = boardInfoData.info;
201
+ info = (boardInfoData || {}).info;
189
202
  hasEntityCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
190
203
  if (hasEntityCompleted) {
191
204
  thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
@@ -193,8 +206,8 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
193
206
  else {
194
207
  thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
195
208
  }
196
- _j.label = 8;
197
- case 8: return [2, {
209
+ _j.label = 9;
210
+ case 9: return [2, {
198
211
  data: data,
199
212
  boardResponse: {
200
213
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
@@ -204,7 +217,8 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
204
217
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
205
218
  name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
206
219
  contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
207
- flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
220
+ flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info,
221
+ entity_activities: entityData === null || entityData === void 0 ? void 0 : entityData.entity_activities
208
222
  },
209
223
  formData: params
210
224
  }];
@@ -252,18 +266,20 @@ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (param
252
266
  payload = {
253
267
  id: id,
254
268
  license: {
255
- number: params.licenseNumber
269
+ number: params.licenseNumber && params.licenseNumber,
270
+ type: params.licenseType
256
271
  },
257
272
  legal_name: {
258
273
  ar: params.licenseName,
259
274
  en: params.licenseName
260
275
  },
261
276
  AOA_file_id: articleId,
262
- encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en']
277
+ encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en', 'license.type']
263
278
  };
264
279
  return [4, API.entityService.updateEntity(payload)];
265
280
  case 2:
266
281
  data = _j.sent();
282
+ thunkApi.dispatch(retrieveDataList());
267
283
  thunkApi.dispatch(handleNextScreenStep());
268
284
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
269
285
  return [2, { data: __assign(__assign({}, data), brandData), formData: params }];
@@ -299,6 +315,66 @@ export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a)
299
315
  });
300
316
  });
301
317
  });
318
+ export var updateCustomersInfo = createAsyncThunk('entityUpdateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
319
+ var _a, settings, entity, id, customerLocation, customerBase, sales, requestBody, data;
320
+ var _b, _c, _d, _e, _f, _g;
321
+ return __generator(this, function (_h) {
322
+ switch (_h.label) {
323
+ case 0:
324
+ _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
325
+ id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
326
+ customerLocation = params.customerLocations.map(function (location) { return ({
327
+ id: location === null || location === void 0 ? void 0 : location.id
328
+ }); });
329
+ customerBase = { id: ((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '', period: 'monthly', locations: customerLocation };
330
+ sales = { id: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '', period: 'monthly' };
331
+ requestBody = {
332
+ operations: {
333
+ customer_base: customerBase,
334
+ sales: sales,
335
+ start_date: entity.data.entityData.operationStartDate
336
+ },
337
+ term: ['refund', 'chargeback'],
338
+ id: id,
339
+ encryption_contract: []
340
+ };
341
+ return [4, API.brandService.updateBrandInfo(requestBody)];
342
+ case 1:
343
+ data = _h.sent();
344
+ thunkApi.dispatch(handleNextScreenStep());
345
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
346
+ return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: params }];
347
+ }
348
+ });
349
+ }); });
350
+ export var retrieveDataList = createAsyncThunk('entityRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
351
+ var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
352
+ return __generator(this, function (_b) {
353
+ switch (_b.label) {
354
+ case 0:
355
+ settings = thunkApi.getState().settings;
356
+ dataBody = {
357
+ page: 0
358
+ };
359
+ salesDataBody = {
360
+ page: 0,
361
+ country_code: [settings.data.businessCountry.iso2]
362
+ };
363
+ return [4, Promise.all([
364
+ API.dataService.getCustomerBases(dataBody),
365
+ API.dataService.getExpectedSales(salesDataBody),
366
+ API.dataService.getExpectedCustomerSales(dataBody)
367
+ ])];
368
+ case 1:
369
+ _a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
370
+ return [2, {
371
+ customerBases: customerBases,
372
+ expectedSales: expectedSales,
373
+ expectedCustomerSales: expectedCustomerSales
374
+ }];
375
+ }
376
+ });
377
+ }); });
302
378
  export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
303
379
  var _a, settings, entity, _b, id, infoId, payload, data;
304
380
  var _c, _d, _e, _f;
@@ -343,9 +419,17 @@ var initialState = {
343
419
  entityData: {
344
420
  licenseName: '',
345
421
  licenseNumber: '',
422
+ licenseType: BusinessType.CR,
346
423
  activities: [],
347
424
  operationStartDate: '',
348
425
  uploading: false
426
+ },
427
+ customersData: {
428
+ customerLocations: [],
429
+ expectedCustomer: undefined,
430
+ expectedSale: undefined,
431
+ refundPolicy: false,
432
+ transactionPolicy: false
349
433
  }
350
434
  }
351
435
  };
@@ -370,10 +454,10 @@ export var entitySlice = createSlice({
370
454
  state.customLoading = true;
371
455
  })
372
456
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
373
- var _a, _b, _c, _d;
457
+ var _a, _b, _c, _d, _e;
374
458
  state.error = null;
375
459
  state.customLoading = false;
376
- var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse;
460
+ var _f = action.payload, data = _f.data, token = _f.token, boardResponse = _f.boardResponse;
377
461
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
378
462
  if (description) {
379
463
  state.error = description;
@@ -381,10 +465,11 @@ export var entitySlice = createSlice({
381
465
  }
382
466
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
383
467
  state.data.verify.token = token;
384
- var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
468
+ var _g = boardResponse || {}, brand = _g.brand, entity = _g.entity, entity_activities = _g.entity_activities;
385
469
  var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
386
- var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
387
- var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
470
+ var licenseType = (_c = entity === null || entity === void 0 ? void 0 : entity.type) === null || _c === void 0 ? void 0 : _c.toLowerCase();
471
+ var entityDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.issuing_date;
472
+ var startDate = (_e = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _e === void 0 ? void 0 : _e.start_date;
388
473
  var issuingDate = undefined;
389
474
  if (entityDate) {
390
475
  var date = new Date(entityDate);
@@ -393,7 +478,9 @@ export var entitySlice = createSlice({
393
478
  }
394
479
  if (licenseNumber)
395
480
  state.data.entityData.licenseNumber = licenseNumber;
396
- var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
481
+ if (licenseType)
482
+ state.data.entityData.licenseType = licenseType;
483
+ var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || entity_activities || [];
397
484
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
398
485
  var _a;
399
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; });
@@ -428,10 +515,10 @@ export var entitySlice = createSlice({
428
515
  state.error = null;
429
516
  })
430
517
  .addCase(verifyEntityLeadOTP.fulfilled, function (state, action) {
431
- var _a, _b, _c, _d;
518
+ var _a, _b, _c, _d, _e;
432
519
  state.loading = false;
433
520
  state.error = null;
434
- var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData;
521
+ var _f = action.payload, data = _f.data, boardResponse = _f.boardResponse, formData = _f.formData;
435
522
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
436
523
  if (description) {
437
524
  state.error = description;
@@ -440,10 +527,11 @@ export var entitySlice = createSlice({
440
527
  state.data.otpData = formData;
441
528
  state.data.otpData.responseBody = data;
442
529
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
443
- var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
530
+ var _g = boardResponse || {}, brand = _g.brand, entity = _g.entity, entity_activities = _g.entity_activities;
444
531
  var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
445
- var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
446
- var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
532
+ var licenseType = (_c = entity === null || entity === void 0 ? void 0 : entity.type) === null || _c === void 0 ? void 0 : _c.toLowerCase();
533
+ var entityDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.issuing_date;
534
+ var startDate = (_e = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _e === void 0 ? void 0 : _e.start_date;
447
535
  var issuingDate = undefined;
448
536
  if (entityDate) {
449
537
  var date = new Date(entityDate);
@@ -452,7 +540,9 @@ export var entitySlice = createSlice({
452
540
  }
453
541
  if (licenseNumber)
454
542
  state.data.entityData.licenseNumber = licenseNumber;
455
- var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
543
+ if (licenseType)
544
+ state.data.entityData.licenseType = licenseType;
545
+ var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || entity_activities || [];
456
546
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
457
547
  var _a;
458
548
  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; });
@@ -479,7 +569,7 @@ export var entitySlice = createSlice({
479
569
  return;
480
570
  }
481
571
  state.data.entityData = formData;
482
- state.data.entityData.responseBody = data;
572
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { data: data });
483
573
  })
484
574
  .addCase(updateEntity.rejected, function (state, action) {
485
575
  state.loading = false;
@@ -498,6 +588,72 @@ export var entitySlice = createSlice({
498
588
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
499
589
  state.error = action.error.message;
500
590
  state.loading = false;
591
+ })
592
+ .addCase(retrieveDataList.pending, function (state) {
593
+ state.loading = true;
594
+ state.error = null;
595
+ })
596
+ .addCase(retrieveDataList.fulfilled, function (state, action) {
597
+ var _a, _b, _c, _d, _e, _f;
598
+ state.loading = false;
599
+ state.error = null;
600
+ var payload = action.payload;
601
+ state.data.customersData.responseBody = payload;
602
+ var brand = (state.data.verify.responseBody || {}).brand;
603
+ var _g = (brand === null || brand === void 0 ? void 0 : brand.operations) || {}, customer_base = _g.customer_base, sales = _g.sales;
604
+ var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
605
+ var customerBase = undefined;
606
+ if ((customerBases === null || customerBases === void 0 ? void 0 : customerBases.length) > 1)
607
+ customerBase = [customerBases === null || customerBases === void 0 ? void 0 : customerBases[1], customerBases[0]];
608
+ else if ((customerBases === null || customerBases === void 0 ? void 0 : customerBases.length) === 1)
609
+ customerBase = [customerBases[0]];
610
+ if (((_b = customer_base === null || customer_base === void 0 ? void 0 : customer_base.locations) === null || _b === void 0 ? void 0 : _b.length) > 0) {
611
+ customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases.filter(function (base) {
612
+ var _a;
613
+ return (_a = customer_base === null || customer_base === void 0 ? void 0 : customer_base.locations) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === base.id; });
614
+ });
615
+ }
616
+ var expectedSales = ((_c = payload.expectedSales) === null || _c === void 0 ? void 0 : _c.list) || [];
617
+ var expectedSale = (_e = (_d = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[0]) === null || _d === void 0 ? void 0 : _d.sub) === null || _e === void 0 ? void 0 : _e[4];
618
+ if ((sales === null || sales === void 0 ? void 0 : sales.length) > 0) {
619
+ expectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.find(function (sale) {
620
+ var _a;
621
+ return (_a = sales === null || sales === void 0 ? void 0 : sales.sub) === null || _a === void 0 ? void 0 : _a.find(function (s) { return s.id === sale.id; });
622
+ });
623
+ }
624
+ var expectedCustomerSales = ((_f = payload.expectedCustomerSales) === null || _f === void 0 ? void 0 : _f.list) || [];
625
+ var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
626
+ if ((customer_base === null || customer_base === void 0 ? void 0 : customer_base.length) > 0) {
627
+ expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.find(function (base) {
628
+ return customer_base.id === base.id;
629
+ });
630
+ }
631
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
632
+ if (!!customerBase)
633
+ state.data.customersData.customerLocations = customerBase;
634
+ if (!!expectedSale)
635
+ state.data.customersData.expectedSale = expectedSale;
636
+ if (!!expectedCustomerSale)
637
+ state.data.customersData.expectedCustomer = expectedCustomerSale;
638
+ })
639
+ .addCase(retrieveDataList.rejected, function (state, action) {
640
+ state.loading = false;
641
+ state.error = action.error.message;
642
+ })
643
+ .addCase(updateCustomersInfo.pending, function (state) {
644
+ state.loading = true;
645
+ state.error = null;
646
+ })
647
+ .addCase(updateCustomersInfo.fulfilled, function (state, action) {
648
+ state.loading = false;
649
+ state.error = null;
650
+ var _a = action.payload, data = _a.data, formData = _a.formData;
651
+ state.data.customersData = formData;
652
+ state.data.customersData.responseBody = data;
653
+ })
654
+ .addCase(updateCustomersInfo.rejected, function (state, action) {
655
+ state.loading = false;
656
+ state.error = action.error.message;
501
657
  })
502
658
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
503
659
  var _a;
@@ -98,7 +98,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
98
98
  if (countryCode)
99
99
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
100
100
  }
101
- info = boardInfoData.info;
101
+ info = (boardInfoData || {}).info;
102
102
  hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
103
103
  if (!hasIndividualCompleted) return [3, 7];
104
104
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
@@ -125,7 +125,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
125
125
  countries: countries,
126
126
  countryCode: countryCode,
127
127
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
128
- flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
128
+ flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [])
129
129
  },
130
130
  token: token
131
131
  }];
@@ -231,7 +231,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
231
231
  _l.label = 6;
232
232
  case 6:
233
233
  countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
234
- info = boardInfoData.info;
234
+ info = (boardInfoData || {}).info;
235
235
  hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
236
236
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
237
237
  if (!hasIndividualCompleted) return [3, 7];
@@ -259,7 +259,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
259
259
  countries: countries,
260
260
  countryCode: countryCode,
261
261
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
262
- flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
262
+ flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [])
263
263
  },
264
264
  formData: __assign({}, params)
265
265
  }];
@@ -322,7 +322,7 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
322
322
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
323
323
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
324
324
  thunkApi.dispatch(handleNextScreenStep());
325
- return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
325
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((data === null || data === void 0 ? void 0 : data.info) || []) }), formData: params }];
326
326
  }
327
327
  });
328
328
  }); });
@@ -2,13 +2,7 @@ import { RootState } from '../../../app/store';
2
2
  import { FlowsTypes, OTPFormValues, PasswordCreateFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
- boardResponse: {
6
- flows: {
7
- name: string;
8
- status: string;
9
- url: string;
10
- }[];
11
- };
5
+ boardResponse: any;
12
6
  token: string;
13
7
  }, string, {}>;
14
8
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{