@tap-payments/auth-jsconnect 2.1.23-test → 2.1.25-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 (167) hide show
  1. package/build/@types/app.d.ts +48 -1
  2. package/build/@types/app.js +12 -0
  3. package/build/@types/form.d.ts +24 -8
  4. package/build/api/axios.js +2 -2
  5. package/build/api/data.d.ts +8 -0
  6. package/build/api/data.js +16 -0
  7. package/build/api/entity.d.ts +28 -1
  8. package/build/api/entity.js +26 -1
  9. package/build/api/index.d.ts +13 -3
  10. package/build/api/index.js +2 -2
  11. package/build/api/individual.d.ts +4 -0
  12. package/build/api/location.d.ts +5 -0
  13. package/build/api/location.js +19 -0
  14. package/build/app/rootReducer.d.ts +1 -0
  15. package/build/app/rootReducer.js +3 -1
  16. package/build/app/settings.js +1 -1
  17. package/build/app/store.d.ts +2 -0
  18. package/build/assets/locales/ar.json +21 -1
  19. package/build/assets/locales/en.json +21 -1
  20. package/build/components/SimpleList/SimpleList.d.ts +2 -1
  21. package/build/components/SimpleList/SimpleList.js +22 -10
  22. package/build/constants/api.d.ts +3 -0
  23. package/build/constants/api.js +7 -1
  24. package/build/constants/app.d.ts +7 -1
  25. package/build/constants/app.js +51 -8
  26. package/build/constants/validation.d.ts +1 -0
  27. package/build/constants/validation.js +1 -0
  28. package/build/features/app/brand/brandStore.d.ts +97 -0
  29. package/build/features/app/brand/brandStore.js +618 -0
  30. package/build/features/app/entity/entityStore.d.ts +11 -23
  31. package/build/features/app/entity/entityStore.js +212 -295
  32. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -2
  33. package/build/features/brand/Brand.d.ts +7 -0
  34. package/build/features/brand/Brand.js +69 -0
  35. package/build/features/brand/index.d.ts +1 -0
  36. package/build/features/brand/index.js +1 -0
  37. package/build/features/{entity/screens/Customers/CustomerLocations.d.ts → brand/screens/BrandActivities/ActivitiesList.d.ts} +34 -61
  38. package/build/features/{entity/screens/EntityInfoConfirm → brand/screens/BrandActivities}/ActivitiesList.js +59 -40
  39. package/build/features/brand/screens/BrandActivities/BrandActivities.d.ts +5 -0
  40. package/build/features/brand/screens/BrandActivities/BrandActivities.js +72 -0
  41. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +82 -0
  42. package/build/features/{entity/screens/Customers/CustomerLocations.js → brand/screens/BrandActivities/CustomerBase.js} +8 -35
  43. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedCustomers.d.ts +0 -0
  44. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedCustomers.js +6 -6
  45. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedSalesRange.d.ts +0 -0
  46. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedSalesRange.js +6 -6
  47. package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +20 -0
  48. package/build/features/brand/screens/BrandActivities/OperationStartDate.js +45 -0
  49. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/RefundPolicy.d.ts +0 -0
  50. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/RefundPolicy.js +2 -2
  51. package/build/features/brand/screens/BrandActivities/TAC.d.ts +6 -0
  52. package/build/features/brand/screens/BrandActivities/TAC.js +87 -0
  53. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/TransactionPolicy.d.ts +0 -0
  54. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/TransactionPolicy.js +0 -0
  55. package/build/features/brand/screens/BrandActivities/index.d.ts +2 -0
  56. package/build/features/brand/screens/BrandActivities/index.js +2 -0
  57. package/build/features/brand/screens/BrandActivities/validation.d.ts +71 -0
  58. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/validation.js +9 -1
  59. package/build/features/brand/screens/BrandInfo/BrandInfo.d.ts +5 -0
  60. package/build/features/brand/screens/BrandInfo/BrandInfo.js +72 -0
  61. package/build/features/brand/screens/BrandInfo/BrandName.d.ts +8 -0
  62. package/build/features/brand/screens/BrandInfo/BrandName.js +142 -0
  63. package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +5 -0
  64. package/build/features/brand/screens/BrandInfo/SalesChannels.js +30 -0
  65. package/build/features/brand/screens/BrandInfo/Segments.d.ts +8 -0
  66. package/build/features/brand/screens/BrandInfo/Segments.js +83 -0
  67. package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +8 -0
  68. package/build/features/brand/screens/BrandInfo/TeamSize.js +83 -0
  69. package/build/features/brand/screens/BrandInfo/index.d.ts +2 -0
  70. package/build/features/brand/screens/BrandInfo/index.js +2 -0
  71. package/build/features/brand/screens/BrandInfo/validation.d.ts +41 -0
  72. package/build/features/brand/screens/BrandInfo/validation.js +106 -0
  73. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  74. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  75. package/build/features/brand/screens/ResetPasswordSuccess/index.d.ts +3 -0
  76. package/build/features/brand/screens/ResetPasswordSuccess/index.js +2 -0
  77. package/build/features/brand/screens/Success/Success.d.ts +5 -0
  78. package/build/features/brand/screens/Success/Success.js +20 -0
  79. package/build/features/brand/screens/Success/index.d.ts +3 -0
  80. package/build/features/brand/screens/Success/index.js +2 -0
  81. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  82. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +117 -0
  83. package/build/features/brand/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  84. package/build/features/brand/screens/SuccessWithFlowButtons/index.js +2 -0
  85. package/build/features/brand/screens/Verify/OTPInput.d.ts +7 -0
  86. package/build/features/brand/screens/Verify/OTPInput.js +47 -0
  87. package/build/features/brand/screens/Verify/Verify.d.ts +5 -0
  88. package/build/features/brand/screens/Verify/Verify.js +91 -0
  89. package/build/features/brand/screens/Verify/index.d.ts +2 -0
  90. package/build/features/brand/screens/Verify/index.js +2 -0
  91. package/build/features/brand/screens/Verify/validation.d.ts +8 -0
  92. package/build/features/brand/screens/Verify/validation.js +4 -0
  93. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  94. package/build/features/connect/screens/Merchant/validation.js +2 -2
  95. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +90 -0
  96. package/build/features/entity/screens/EntityCapital/ActivityList.js +178 -0
  97. package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +5 -0
  98. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +47 -0
  99. package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +5 -0
  100. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +42 -0
  101. package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +5 -0
  102. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +47 -0
  103. package/build/features/entity/screens/EntityCapital/EntityCapital.d.ts +5 -0
  104. package/build/features/entity/screens/EntityCapital/EntityCapital.js +75 -0
  105. package/build/features/entity/screens/EntityCapital/index.d.ts +2 -0
  106. package/build/features/entity/screens/EntityCapital/index.js +2 -0
  107. package/build/features/entity/screens/EntityCapital/validation.d.ts +62 -0
  108. package/build/features/entity/screens/EntityCapital/validation.js +25 -0
  109. package/build/features/entity/screens/EntityName/EntityName.d.ts +5 -0
  110. package/build/features/entity/screens/EntityName/EntityName.js +87 -0
  111. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +90 -0
  112. package/build/features/entity/screens/EntityName/EntityTypeList.js +151 -0
  113. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +19 -0
  114. package/build/features/entity/screens/EntityName/ExpiryDate.js +46 -0
  115. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +19 -0
  116. package/build/features/entity/screens/EntityName/IssuingDate.js +46 -0
  117. package/build/features/entity/screens/EntityName/LegalName.d.ts +5 -0
  118. package/build/features/entity/screens/EntityName/LegalName.js +48 -0
  119. package/build/features/entity/screens/{EntityInfoConfirm → EntityName}/LicenseNumber.d.ts +0 -0
  120. package/build/features/entity/screens/{EntityInfoConfirm → EntityName}/LicenseNumber.js +12 -18
  121. package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +6 -0
  122. package/build/features/entity/screens/EntityName/UnifiedNumber.js +43 -0
  123. package/build/features/entity/screens/EntityName/index.d.ts +2 -0
  124. package/build/features/entity/screens/EntityName/index.js +2 -0
  125. package/build/features/entity/screens/EntityName/validation.d.ts +48 -0
  126. package/build/features/entity/screens/EntityName/validation.js +112 -0
  127. package/build/features/featuresScreens.d.ts +1 -0
  128. package/build/features/featuresScreens.js +35 -6
  129. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  130. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  131. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
  132. package/build/features/shared/Address/Address.d.ts +11 -0
  133. package/build/features/shared/Address/Address.js +63 -0
  134. package/build/features/shared/Address/CountryList.d.ts +72 -0
  135. package/build/features/shared/Address/CountryList.js +89 -0
  136. package/build/features/{entity/screens/EntityInfoConfirm/ActivitiesList.d.ts → shared/Address/InputSelect.d.ts} +27 -11
  137. package/build/features/shared/Address/InputSelect.js +172 -0
  138. package/build/features/shared/Address/InputText.d.ts +11 -0
  139. package/build/features/shared/Address/InputText.js +12 -0
  140. package/build/features/shared/Address/index.d.ts +2 -0
  141. package/build/features/shared/Address/index.js +2 -0
  142. package/build/features/shared/Input/Input.d.ts +7 -5
  143. package/build/features/shared/Input/Input.js +2 -2
  144. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  145. package/build/hooks/useAppDispatch.d.ts +1 -0
  146. package/build/index.d.ts +3 -2
  147. package/build/index.js +4 -1
  148. package/package.json +1 -1
  149. package/build/api/ip.d.ts +0 -4
  150. package/build/api/ip.js +0 -12
  151. package/build/features/entity/screens/Customers/Customers.d.ts +0 -5
  152. package/build/features/entity/screens/Customers/Customers.js +0 -90
  153. package/build/features/entity/screens/Customers/index.d.ts +0 -3
  154. package/build/features/entity/screens/Customers/index.js +0 -2
  155. package/build/features/entity/screens/Customers/validation.d.ts +0 -20
  156. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +0 -3
  157. package/build/features/entity/screens/EntityInfoConfirm/Article.js +0 -76
  158. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +0 -5
  159. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +0 -84
  160. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +0 -5
  161. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +0 -32
  162. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +0 -6
  163. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +0 -33
  164. package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +0 -2
  165. package/build/features/entity/screens/EntityInfoConfirm/index.js +0 -2
  166. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +0 -141
  167. package/build/features/entity/screens/EntityInfoConfirm/validation.js +0 -83
@@ -45,6 +45,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
48
59
  var _a;
49
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
61
  import API from '../../../api';
@@ -54,7 +65,7 @@ import { ENTITY_STEP_NAMES } from '../../../constants';
54
65
  import moment from 'moment';
55
66
  import { convertNumbers2English } from '../../../utils';
56
67
  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, entityId, activities, data_1, info, hasEntityCompleted;
68
+ var payload, data, boardData, entityData, boardInfoData, entityTypes, countryIso2, board_id, entityId, info, hasEntityCompleted;
58
69
  var _a, _b, _c, _d;
59
70
  return __generator(this, function (_e) {
60
71
  switch (_e.label) {
@@ -67,13 +78,13 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
67
78
  case 1:
68
79
  data = (_e.sent()).data;
69
80
  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];
81
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 9];
71
82
  if (data === null || data === void 0 ? void 0 : data.country_code) {
72
83
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
73
84
  if (countryIso2)
74
85
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
75
86
  }
76
- if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
87
+ if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 9];
77
88
  board_id = data === null || data === void 0 ? void 0 : data.id;
78
89
  if (!board_id) return [3, 4];
79
90
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
@@ -85,18 +96,12 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
85
96
  _e.label = 4;
86
97
  case 4:
87
98
  entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
88
- if (!entityId) return [3, 7];
99
+ if (!entityId) return [3, 6];
89
100
  return [4, API.entityService.retrieveEntity(entityId)];
90
101
  case 5:
91
102
  entityData = _e.sent();
92
- activities = (entityData || {}).activities;
93
- if (!!activities) return [3, 7];
94
- return [4, API.dataService.getActivities()];
103
+ _e.label = 6;
95
104
  case 6:
96
- data_1 = _e.sent();
97
- entityData = __assign(__assign({}, entityData), { entity_activities: data_1.list });
98
- _e.label = 7;
99
- case 7:
100
105
  if (!countryIso2) {
101
106
  countryIso2 = entityData.country;
102
107
  if (countryIso2)
@@ -104,14 +109,15 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
104
109
  }
105
110
  info = (boardInfoData || {}).info;
106
111
  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';
107
- if (hasEntityCompleted) {
108
- thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
109
- }
110
- else {
111
- thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
112
- }
113
- _e.label = 8;
114
- case 8: return [2, {
112
+ if (!hasEntityCompleted) return [3, 7];
113
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
114
+ return [3, 9];
115
+ case 7: return [4, API.entityService.retrieveEntityType()];
116
+ case 8:
117
+ entityTypes = _e.sent();
118
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
119
+ _e.label = 9;
120
+ case 9: return [2, {
115
121
  data: data,
116
122
  boardResponse: {
117
123
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
@@ -122,7 +128,7 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
122
128
  name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
123
129
  contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
124
130
  flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info,
125
- entity_activities: entityData === null || entityData === void 0 ? void 0 : entityData.entity_activities
131
+ entityTypes: entityTypes
126
132
  },
127
133
  token: token
128
134
  }];
@@ -147,7 +153,7 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
147
153
  });
148
154
  }); });
149
155
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
150
- var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, entityId, activities, data_2, info, hasEntityCompleted;
156
+ var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, boardInfoData, board_id, entityId, info, hasEntityCompleted;
151
157
  var _b, _c, _d, _e, _f, _g, _h;
152
158
  return __generator(this, function (_j) {
153
159
  switch (_j.label) {
@@ -165,7 +171,7 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
165
171
  case 1:
166
172
  data = (_j.sent()).data;
167
173
  boardInfoData = undefined;
168
- if (!!data.errors) return [3, 8];
174
+ if (!!data.errors) return [3, 9];
169
175
  board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
170
176
  if (!board_id) return [3, 4];
171
177
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
@@ -177,29 +183,24 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
177
183
  _j.label = 4;
178
184
  case 4:
179
185
  entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
180
- if (!entityId) return [3, 7];
186
+ if (!entityId) return [3, 6];
181
187
  return [4, API.entityService.retrieveEntity(entityId)];
182
188
  case 5:
183
189
  entityData = _j.sent();
184
- activities = (entityData || {}).activities;
185
- if (!!activities) return [3, 7];
186
- return [4, API.dataService.getActivities()];
190
+ _j.label = 6;
187
191
  case 6:
188
- data_2 = _j.sent();
189
- entityData = __assign(__assign({}, entityData), { entity_activities: data_2.list });
190
- _j.label = 7;
191
- case 7:
192
192
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
193
193
  info = (boardInfoData || {}).info;
194
194
  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';
195
- if (hasEntityCompleted) {
196
- thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
197
- }
198
- else {
199
- thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
200
- }
201
- _j.label = 8;
202
- case 8: return [2, {
195
+ if (!hasEntityCompleted) return [3, 7];
196
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
197
+ return [3, 9];
198
+ case 7: return [4, API.entityService.retrieveEntityType()];
199
+ case 8:
200
+ entityTypes = _j.sent();
201
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
202
+ _j.label = 9;
203
+ case 9: return [2, {
203
204
  data: data,
204
205
  boardResponse: {
205
206
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
@@ -210,7 +211,7 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
210
211
  name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
211
212
  contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
212
213
  flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info,
213
- entity_activities: entityData === null || entityData === void 0 ? void 0 : entityData.entity_activities
214
+ entityTypes: entityTypes
214
215
  },
215
216
  formData: params
216
217
  }];
@@ -231,139 +232,81 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
231
232
  }
232
233
  });
233
234
  }); });
234
- export var updateEntity = createAsyncThunk('entityUpdateEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
235
- var _a, settings, entity, id, brandId, articleId, requestBody, brandData, payload, data;
236
- var _b, _c, _d, _e, _f, _g, _h;
237
- return __generator(this, function (_j) {
238
- switch (_j.label) {
235
+ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
236
+ var _a, settings, entity, id, issuingDate, expiryDate, isFL, payload, data, list;
237
+ var _b, _c, _d, _e;
238
+ return __generator(this, function (_f) {
239
+ switch (_f.label) {
239
240
  case 0:
240
241
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
241
242
  id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
242
- brandId = (_e = (_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
243
- articleId = entity.data.entityData.articleId;
244
- requestBody = {
245
- id: brandId,
246
- activities: (_f = (params.activities || [])) === null || _f === void 0 ? void 0 : _f.map(function (_a) {
247
- var id = _a.id;
248
- return ({ id: id });
249
- }),
250
- operations: {
251
- start_date: params.operationStartDate
252
- },
253
- encryption_contract: ['operations.start_date']
254
- };
255
- return [4, API.brandService.updateBrandInfo(requestBody)];
256
- case 1:
257
- brandData = (_j.sent()).data;
243
+ issuingDate = new Date(params.issuingDate).getTime();
244
+ expiryDate = new Date(params.expiryDate).getTime();
245
+ isFL = params.licenseType === BusinessType.FL;
258
246
  payload = {
259
247
  id: id,
260
248
  license: {
261
249
  number: params.licenseNumber && params.licenseNumber,
262
- type: params.licenseType
263
- },
264
- legal_name: {
265
- ar: params.licenseName,
266
- en: params.licenseName
250
+ type: isFL ? 'freelance' : 'commercial_registration',
251
+ issuing_date: issuingDate === null || issuingDate === void 0 ? void 0 : issuingDate.toString(),
252
+ expiry_date: expiryDate === null || expiryDate === void 0 ? void 0 : expiryDate.toString(),
253
+ additional_info: params.unifiedNumber
254
+ ? {
255
+ unified_number: params.unifiedNumber
256
+ }
257
+ : undefined
267
258
  },
268
- AOA_file_id: articleId,
259
+ type: params.entityType,
260
+ legal_name: params.legalName
261
+ ? {
262
+ ar: params.legalName,
263
+ en: params.legalName
264
+ }
265
+ : undefined,
269
266
  encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en', 'license.type']
270
267
  };
271
268
  return [4, API.entityService.updateEntity(payload)];
269
+ case 1:
270
+ data = _f.sent();
271
+ return [4, API.dataService.getActivities()];
272
272
  case 2:
273
- data = _j.sent();
274
- thunkApi.dispatch(retrieveDataList());
273
+ list = (_f.sent()).list;
274
+ data.activityList = list;
275
275
  thunkApi.dispatch(handleNextScreenStep());
276
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
277
- return [2, { data: __assign(__assign({}, data), brandData), formData: params }];
276
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, id);
277
+ return [2, { data: data, formData: params }];
278
278
  }
279
279
  });
280
280
  }); });
281
- export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
282
- var file = _a.file, onProgress = _a.onProgress;
283
- return __awaiter(void 0, void 0, void 0, function () {
284
- var typeArray, type, uploadPayload, onUploadProgress, data;
285
- var _b;
286
- return __generator(this, function (_c) {
287
- switch (_c.label) {
288
- case 0:
289
- typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
290
- type = typeArray[1] || '';
291
- uploadPayload = {
292
- file_link_create: true,
293
- title: file === null || file === void 0 ? void 0 : file.name,
294
- purpose: 'article_of_association',
295
- type: type,
296
- file: file
297
- };
298
- onUploadProgress = function (progressEvent) {
299
- var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
300
- onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
301
- };
302
- return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
303
- case 1:
304
- data = _c.sent();
305
- return [2, { data: data }];
306
- }
307
- });
308
- });
309
- });
310
- export var updateCustomersInfo = createAsyncThunk('entityUpdateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
311
- var _a, settings, entity, id, customerLocation, customerBase, sales, requestBody, data;
312
- var _b, _c, _d, _e, _f, _g;
313
- return __generator(this, function (_h) {
314
- switch (_h.label) {
281
+ export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
282
+ var _a, settings, entity, id, activities, payload, data;
283
+ var _b, _c, _d, _e, _f;
284
+ return __generator(this, function (_g) {
285
+ switch (_g.label) {
315
286
  case 0:
316
287
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
317
- id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
318
- customerLocation = params.customerLocations.map(function (location) { return ({
319
- id: location === null || location === void 0 ? void 0 : location.id
320
- }); });
321
- customerBase = { id: ((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '', period: 'monthly', locations: customerLocation };
322
- sales = { id: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '', period: 'monthly' };
323
- requestBody = {
324
- operations: {
325
- customer_base: customerBase,
326
- sales: sales,
327
- start_date: entity.data.entityData.operationStartDate
328
- },
329
- term: ['refund', 'chargeback'],
288
+ id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
289
+ activities = (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
290
+ var id = _a.id;
291
+ return ({ id: id, action: 'add' });
292
+ });
293
+ payload = {
330
294
  id: id,
331
- encryption_contract: []
295
+ activities: (activities === null || activities === void 0 ? void 0 : activities.length) > 0 ? activities : undefined,
296
+ capital: {
297
+ paid: params.capitalPaid,
298
+ shares: {
299
+ count: params.capitalShareCount,
300
+ value: params.capitalShareValue
301
+ }
302
+ }
332
303
  };
333
- return [4, API.brandService.updateBrandInfo(requestBody)];
304
+ return [4, API.entityService.updateEntity(payload)];
334
305
  case 1:
335
- data = _h.sent();
306
+ data = _g.sent();
336
307
  thunkApi.dispatch(handleNextScreenStep());
337
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
338
- return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: params }];
339
- }
340
- });
341
- }); });
342
- export var retrieveDataList = createAsyncThunk('entityRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
343
- var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
344
- return __generator(this, function (_b) {
345
- switch (_b.label) {
346
- case 0:
347
- settings = thunkApi.getState().settings;
348
- dataBody = {
349
- page: 0
350
- };
351
- salesDataBody = {
352
- page: 0,
353
- country_code: [settings.data.businessCountry.iso2]
354
- };
355
- return [4, Promise.all([
356
- API.dataService.getCustomerBases(dataBody),
357
- API.dataService.getExpectedSales(salesDataBody),
358
- API.dataService.getExpectedCustomerSales(dataBody)
359
- ])];
360
- case 1:
361
- _a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
362
- return [2, {
363
- customerBases: customerBases,
364
- expectedSales: expectedSales,
365
- expectedCustomerSales: expectedCustomerSales
366
- }];
308
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
309
+ return [2, { data: data, formData: params }];
367
310
  }
368
311
  });
369
312
  }); });
@@ -411,20 +354,20 @@ var initialState = {
411
354
  otpData: {
412
355
  otp: ''
413
356
  },
414
- entityData: {
415
- licenseName: '',
357
+ entityNameData: {
358
+ legalName: '',
416
359
  licenseNumber: '',
417
- licenseType: BusinessType.CR,
418
- activities: [],
419
- operationStartDate: moment(new Date()).format('YYYY-MM-DD'),
420
- uploading: false
360
+ licenseType: '',
361
+ entityType: '',
362
+ issuingDate: '',
363
+ expiryDate: '',
364
+ unifiedNumber: ''
421
365
  },
422
- customersData: {
423
- customerLocations: [],
424
- expectedCustomer: undefined,
425
- expectedSale: undefined,
426
- refundPolicy: false,
427
- transactionPolicy: false
366
+ entityCapitalData: {
367
+ activities: [],
368
+ capitalPaid: '',
369
+ capitalShareCount: '',
370
+ capitalShareValue: ''
428
371
  }
429
372
  }
430
373
  };
@@ -449,10 +392,10 @@ export var entitySlice = createSlice({
449
392
  state.customLoading = true;
450
393
  })
451
394
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
452
- var _a, _b, _c, _d, _e;
395
+ var _a, _b, _c, _d;
453
396
  state.error = null;
454
397
  state.customLoading = false;
455
- var _f = action.payload, data = _f.data, token = _f.token, boardResponse = _f.boardResponse;
398
+ var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse;
456
399
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
457
400
  if (description) {
458
401
  state.error = description;
@@ -460,28 +403,49 @@ export var entitySlice = createSlice({
460
403
  }
461
404
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
462
405
  state.data.verify.token = token;
463
- var _g = boardResponse || {}, brand = _g.brand, entity = _g.entity, entity_activities = _g.entity_activities;
464
- var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
465
- var licenseType = (_c = entity === null || entity === void 0 ? void 0 : entity.type) === null || _c === void 0 ? void 0 : _c.toLowerCase();
466
- var entityDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.issuing_date;
467
- var startDate = (_e = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _e === void 0 ? void 0 : _e.start_date;
468
- var issuingDate = undefined;
469
- if (entityDate) {
470
- var date = new Date(entityDate);
471
- var formattedDate = moment(date).format('YYYY-MM-DD');
472
- issuingDate = convertNumbers2English(formattedDate);
406
+ var _f = boardResponse || {}, entity = _f.entity, entityTypes = _f.entityTypes;
407
+ if (entity) {
408
+ var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name;
409
+ var legalName = legal_name;
410
+ var licenseNumber = license === null || license === void 0 ? void 0 : license.number;
411
+ var unifiedNumber = (_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number;
412
+ var licenseType = (license === null || license === void 0 ? void 0 : license.type) === 'freelance' ? BusinessType.FL : BusinessType.CR;
413
+ var entityType = type || (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes[0]);
414
+ var _h = capital || {}, paid = _h.paid, shares = _h.shares;
415
+ var entityIssueDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
416
+ var entityExpiredDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.expiry_date;
417
+ var issuingDate = void 0, expiryDate = undefined;
418
+ if (entityIssueDate) {
419
+ var date = new Date(entityIssueDate);
420
+ var formattedDate = moment(date).format('YYYY-MM-DD');
421
+ issuingDate = convertNumbers2English(formattedDate);
422
+ }
423
+ if (entityExpiredDate) {
424
+ var date = new Date(entityExpiredDate);
425
+ var formattedDate = moment(date).format('YYYY-MM-DD');
426
+ expiryDate = convertNumbers2English(formattedDate);
427
+ }
428
+ if ((legalName === null || legalName === void 0 ? void 0 : legalName.en) || (legalName === null || legalName === void 0 ? void 0 : legalName.ar))
429
+ state.data.entityNameData.legalName = (legalName === null || legalName === void 0 ? void 0 : legalName.en) || (legalName === null || legalName === void 0 ? void 0 : legalName.ar);
430
+ if (licenseNumber)
431
+ state.data.entityNameData.licenseNumber = licenseNumber;
432
+ if (unifiedNumber)
433
+ state.data.entityNameData.unifiedNumber = unifiedNumber;
434
+ state.data.entityNameData.licenseType = licenseType;
435
+ if (entityType)
436
+ state.data.entityNameData.entityType = entityType;
437
+ state.data.entityNameData.issuingDate = issuingDate || moment(new Date()).format('YYYY-MM-DD');
438
+ state.data.entityNameData.expiryDate = expiryDate || moment(new Date()).format('YYYY-MM-DD');
439
+ if (activities)
440
+ state.data.entityCapitalData.activities = activities;
441
+ if (paid)
442
+ state.data.entityCapitalData.capitalPaid = paid;
443
+ if (shares === null || shares === void 0 ? void 0 : shares.count)
444
+ state.data.entityCapitalData.capitalShareCount = shares === null || shares === void 0 ? void 0 : shares.count;
445
+ if (shares === null || shares === void 0 ? void 0 : shares.value)
446
+ state.data.entityCapitalData.capitalShareValue = shares === null || shares === void 0 ? void 0 : shares.value;
447
+ state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id });
473
448
  }
474
- if (licenseNumber)
475
- state.data.entityData.licenseNumber = licenseNumber;
476
- if (licenseType)
477
- state.data.entityData.licenseType = licenseType;
478
- var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || entity_activities || [];
479
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
480
- var _a;
481
- 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; });
482
- });
483
- state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
484
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [] });
485
449
  })
486
450
  .addCase(verifyLeadToken.rejected, function (state, action) {
487
451
  state.error = action.error.message;
@@ -509,10 +473,10 @@ export var entitySlice = createSlice({
509
473
  state.error = null;
510
474
  })
511
475
  .addCase(verifyEntityLeadOTP.fulfilled, function (state, action) {
512
- var _a, _b, _c, _d, _e;
476
+ var _a, _b, _c, _d;
513
477
  state.loading = false;
514
478
  state.error = null;
515
- var _f = action.payload, data = _f.data, boardResponse = _f.boardResponse, formData = _f.formData;
479
+ var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData;
516
480
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
517
481
  if (description) {
518
482
  state.error = description;
@@ -521,132 +485,99 @@ export var entitySlice = createSlice({
521
485
  state.data.otpData = formData;
522
486
  state.data.otpData.responseBody = data;
523
487
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
524
- var _g = boardResponse || {}, brand = _g.brand, entity = _g.entity, entity_activities = _g.entity_activities;
525
- var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
526
- var licenseType = (_c = entity === null || entity === void 0 ? void 0 : entity.type) === null || _c === void 0 ? void 0 : _c.toLowerCase();
527
- var entityDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.issuing_date;
528
- var startDate = (_e = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _e === void 0 ? void 0 : _e.start_date;
529
- var issuingDate = undefined;
530
- if (entityDate) {
531
- var date = new Date(entityDate);
488
+ var _f = boardResponse || {}, entity = _f.entity, entityTypes = _f.entityTypes;
489
+ var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name;
490
+ var legalName = legal_name;
491
+ var licenseNumber = license === null || license === void 0 ? void 0 : license.number;
492
+ var unifiedNumber = (_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number;
493
+ var licenseType = (license === null || license === void 0 ? void 0 : license.type) === 'freelance' ? BusinessType.FL : BusinessType.CR;
494
+ var entityType = type || (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes[0]);
495
+ var _h = capital || {}, paid = _h.paid, shares = _h.shares;
496
+ var entityIssueDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
497
+ var entityExpiredDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.expiry_date;
498
+ var issuingDate, expiryDate = undefined;
499
+ if (entityIssueDate) {
500
+ var date = new Date(entityIssueDate);
532
501
  var formattedDate = moment(date).format('YYYY-MM-DD');
533
502
  issuingDate = convertNumbers2English(formattedDate);
534
503
  }
504
+ if (entityExpiredDate) {
505
+ var date = new Date(entityExpiredDate);
506
+ var formattedDate = moment(date).format('YYYY-MM-DD');
507
+ expiryDate = convertNumbers2English(formattedDate);
508
+ }
509
+ if ((legalName === null || legalName === void 0 ? void 0 : legalName.en) || (legalName === null || legalName === void 0 ? void 0 : legalName.ar))
510
+ state.data.entityNameData.legalName = (legalName === null || legalName === void 0 ? void 0 : legalName.en) || (legalName === null || legalName === void 0 ? void 0 : legalName.ar);
535
511
  if (licenseNumber)
536
- state.data.entityData.licenseNumber = licenseNumber;
537
- if (licenseType)
538
- state.data.entityData.licenseType = licenseType;
539
- var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || entity_activities || [];
540
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
541
- var _a;
542
- 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; });
543
- });
544
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [], operationStartDate: startDate || issuingDate });
512
+ state.data.entityNameData.licenseNumber = licenseNumber;
513
+ if (unifiedNumber)
514
+ state.data.entityNameData.unifiedNumber = unifiedNumber;
515
+ state.data.entityNameData.licenseType = licenseType;
516
+ if (entityType)
517
+ state.data.entityNameData.entityType = entityType;
518
+ state.data.entityNameData.issuingDate = issuingDate || moment(new Date()).format('YYYY-MM-DD');
519
+ state.data.entityNameData.expiryDate = expiryDate || moment(new Date()).format('YYYY-MM-DD');
520
+ if (activities)
521
+ state.data.entityCapitalData.activities = activities;
522
+ if (paid)
523
+ state.data.entityCapitalData.capitalPaid = paid;
524
+ if (shares === null || shares === void 0 ? void 0 : shares.count)
525
+ state.data.entityCapitalData.capitalShareCount = shares === null || shares === void 0 ? void 0 : shares.count;
526
+ if (shares === null || shares === void 0 ? void 0 : shares.value)
527
+ state.data.entityCapitalData.capitalShareValue = shares === null || shares === void 0 ? void 0 : shares.value;
528
+ state.data.entityNameData = __assign(__assign({}, state.data.entityNameData), { responseBody: __assign(__assign({}, state.data.entityNameData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id }) });
545
529
  })
546
530
  .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
547
531
  state.loading = false;
548
532
  state.error = action.error.message;
549
533
  })
550
- .addCase(updateEntity.pending, function (state) {
534
+ .addCase(updateEntityName.pending, function (state) {
551
535
  state.loading = true;
552
536
  state.error = null;
553
537
  })
554
- .addCase(updateEntity.fulfilled, function (state, action) {
555
- var _a;
556
- state.loading = false;
557
- state.error = null;
558
- var _b = action.payload, data = _b.data, formData = _b.formData;
559
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
560
- if (description) {
561
- state.error = description;
562
- return;
563
- }
564
- state.data.entityData = formData;
565
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { data: data });
566
- })
567
- .addCase(updateEntity.rejected, function (state, action) {
538
+ .addCase(updateEntityName.fulfilled, function (state, action) {
568
539
  state.loading = false;
569
- state.error = action.error.message;
570
- })
571
- .addCase(retrieveBoardDetails.pending, function (state) {
572
540
  state.error = null;
573
- state.loading = true;
541
+ var _a = action.payload, data = _a.data, formData = _a.formData;
542
+ var _b = data || {}, activityList = _b.activityList, rest = __rest(_b, ["activityList"]);
543
+ state.data.entityNameData = formData;
544
+ state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { rest: rest });
545
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activityList: activityList });
546
+ if (rest === null || rest === void 0 ? void 0 : rest.activities)
547
+ state.data.entityCapitalData = __assign(__assign({}, state.data.entityCapitalData), { activities: rest === null || rest === void 0 ? void 0 : rest.activities });
574
548
  })
575
- .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
576
- state.error = null;
549
+ .addCase(updateEntityName.rejected, function (state, action) {
577
550
  state.loading = false;
578
- var data = (action.payload || {}).data;
579
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
580
- })
581
- .addCase(retrieveBoardDetails.rejected, function (state, action) {
582
551
  state.error = action.error.message;
583
- state.loading = false;
584
552
  })
585
- .addCase(retrieveDataList.pending, function (state) {
553
+ .addCase(updateEntityCapital.pending, function (state) {
586
554
  state.loading = true;
587
555
  state.error = null;
588
556
  })
589
- .addCase(retrieveDataList.fulfilled, function (state, action) {
590
- var _a, _b, _c, _d, _e, _f;
557
+ .addCase(updateEntityCapital.fulfilled, function (state, action) {
591
558
  state.loading = false;
592
559
  state.error = null;
593
- var payload = action.payload;
594
- state.data.customersData.responseBody = payload;
595
- var brand = (state.data.verify.responseBody || {}).brand;
596
- var _g = (brand === null || brand === void 0 ? void 0 : brand.operations) || {}, customer_base = _g.customer_base, sales = _g.sales;
597
- var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
598
- var customerBase = undefined;
599
- if ((customerBases === null || customerBases === void 0 ? void 0 : customerBases.length) > 1)
600
- customerBase = [customerBases === null || customerBases === void 0 ? void 0 : customerBases[1], customerBases[0]];
601
- else if ((customerBases === null || customerBases === void 0 ? void 0 : customerBases.length) === 1)
602
- customerBase = [customerBases[0]];
603
- if (((_b = customer_base === null || customer_base === void 0 ? void 0 : customer_base.locations) === null || _b === void 0 ? void 0 : _b.length) > 0) {
604
- customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases.filter(function (base) {
605
- var _a;
606
- 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; });
607
- });
608
- }
609
- var expectedSales = ((_c = payload.expectedSales) === null || _c === void 0 ? void 0 : _c.list) || [];
610
- 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];
611
- if ((sales === null || sales === void 0 ? void 0 : sales.length) > 0) {
612
- expectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.find(function (sale) {
613
- var _a;
614
- 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; });
615
- });
616
- }
617
- var expectedCustomerSales = ((_f = payload.expectedCustomerSales) === null || _f === void 0 ? void 0 : _f.list) || [];
618
- var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
619
- if ((customer_base === null || customer_base === void 0 ? void 0 : customer_base.length) > 0) {
620
- expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.find(function (base) {
621
- return customer_base.id === base.id;
622
- });
623
- }
624
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
625
- if (!!customerBase)
626
- state.data.customersData.customerLocations = customerBase;
627
- if (!!expectedSale)
628
- state.data.customersData.expectedSale = expectedSale;
629
- if (!!expectedCustomerSale)
630
- state.data.customersData.expectedCustomer = expectedCustomerSale;
560
+ var _a = action.payload, data = _a.data, formData = _a.formData;
561
+ state.data.entityCapitalData = formData;
562
+ state.data.entityCapitalData.responseBody = __assign(__assign({}, state.data.entityCapitalData.responseBody), { data: data });
631
563
  })
632
- .addCase(retrieveDataList.rejected, function (state, action) {
564
+ .addCase(updateEntityCapital.rejected, function (state, action) {
633
565
  state.loading = false;
634
566
  state.error = action.error.message;
635
567
  })
636
- .addCase(updateCustomersInfo.pending, function (state) {
637
- state.loading = true;
568
+ .addCase(retrieveBoardDetails.pending, function (state) {
638
569
  state.error = null;
570
+ state.loading = true;
639
571
  })
640
- .addCase(updateCustomersInfo.fulfilled, function (state, action) {
641
- state.loading = false;
572
+ .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
642
573
  state.error = null;
643
- var _a = action.payload, data = _a.data, formData = _a.formData;
644
- state.data.customersData = formData;
645
- state.data.customersData.responseBody = data;
646
- })
647
- .addCase(updateCustomersInfo.rejected, function (state, action) {
648
574
  state.loading = false;
575
+ var data = (action.payload || {}).data;
576
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
577
+ })
578
+ .addCase(retrieveBoardDetails.rejected, function (state, action) {
649
579
  state.error = action.error.message;
580
+ state.loading = false;
650
581
  })
651
582
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
652
583
  var _a;
@@ -668,20 +599,6 @@ export var entitySlice = createSlice({
668
599
  .addCase(updateBoardSuccess.rejected, function (state, action) {
669
600
  state.loading = false;
670
601
  state.error = action.error.message;
671
- })
672
- .addCase(uploadArticle.pending, function (state) {
673
- state.error = null;
674
- state.uploading = true;
675
- })
676
- .addCase(uploadArticle.fulfilled, function (state, action) {
677
- state.error = null;
678
- state.uploading = false;
679
- var data = action.payload.data;
680
- state.data.entityData.articleId = data === null || data === void 0 ? void 0 : data.id;
681
- })
682
- .addCase(uploadArticle.rejected, function (state) {
683
- state.uploading = false;
684
- state.error = 'file_upload_error';
685
602
  });
686
603
  }
687
604
  });