@tap-payments/auth-jsconnect 2.0.48 → 2.0.49

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 (172) hide show
  1. package/build/@types/app.d.ts +8 -6
  2. package/build/@types/form.d.ts +23 -22
  3. package/build/@types/theme.d.ts +1 -1
  4. package/build/api/account.d.ts +2 -2
  5. package/build/api/auth.d.ts +11 -11
  6. package/build/api/availabilityServices.d.ts +3 -3
  7. package/build/api/axios.js +1 -1
  8. package/build/api/board.d.ts +3 -3
  9. package/build/api/country.d.ts +1 -1
  10. package/build/api/data.d.ts +10 -10
  11. package/build/api/document.d.ts +25 -0
  12. package/build/api/document.js +38 -0
  13. package/build/api/entity.d.ts +10 -20
  14. package/build/api/entity.js +6 -5
  15. package/build/api/file.d.ts +2 -1
  16. package/build/api/file.js +14 -1
  17. package/build/api/index.d.ts +10 -3
  18. package/build/api/index.js +3 -1
  19. package/build/api/individual.d.ts +8 -8
  20. package/build/api/lead.d.ts +10 -10
  21. package/build/api/operator.d.ts +1 -1
  22. package/build/api/operator.js +1 -1
  23. package/build/api/user.d.ts +2 -2
  24. package/build/app/settings.d.ts +11 -2
  25. package/build/app/settings.js +1 -1
  26. package/build/app/store.d.ts +4 -4
  27. package/build/assets/locales/ar.json +3 -1
  28. package/build/assets/locales/en.json +3 -1
  29. package/build/components/Lottie/Lottie.d.ts +1 -2
  30. package/build/components/Lottie/Lottie.js +1 -1
  31. package/build/components/Lottie/index.d.ts +2 -2
  32. package/build/components/Lottie/index.js +2 -2
  33. package/build/components/Slide/Slide.d.ts +1 -1
  34. package/build/constants/app.d.ts +31 -0
  35. package/build/constants/app.js +43 -1
  36. package/build/features/app/bank/bankStore.d.ts +73 -10
  37. package/build/features/app/bank/bankStore.js +29 -15
  38. package/build/features/app/brand/brandStore.d.ts +104 -12
  39. package/build/features/app/brand/brandStore.js +65 -66
  40. package/build/features/app/business/businessStore.d.ts +163 -19
  41. package/build/features/app/business/businessStore.js +3 -3
  42. package/build/features/app/connect/connectStore.d.ts +121 -13
  43. package/build/features/app/connect/connectStore.js +1 -1
  44. package/build/features/app/connectExpress/connectExpressStore.d.ts +181 -19
  45. package/build/features/app/connectExpress/connectExpressStore.js +1 -1
  46. package/build/features/app/entity/entityStore.d.ts +76 -20
  47. package/build/features/app/entity/entityStore.js +67 -93
  48. package/build/features/app/individual/individualStore.d.ts +182 -20
  49. package/build/features/app/individual/individualStore.js +278 -135
  50. package/build/features/app/password/passwordStore.d.ts +102 -12
  51. package/build/features/app/password/passwordStore.js +1 -1
  52. package/build/features/app/signIn/signInStore.d.ts +61 -7
  53. package/build/features/app/signIn/signInStore.js +1 -1
  54. package/build/features/app/tax/taxStore.d.ts +62 -8
  55. package/build/features/app/tax/taxStore.js +25 -12
  56. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +1 -1
  57. package/build/features/bank/screens/BankDetails/BankStatement.js +4 -3
  58. package/build/features/bank/screens/BankDetails/IBAN.js +1 -1
  59. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  60. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +13 -13
  61. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +6 -7
  62. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +11 -11
  63. package/build/features/brand/screens/BrandActivities/CustomerBase.js +5 -7
  64. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +5 -7
  65. package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +2 -2
  66. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +5 -5
  67. package/build/features/brand/screens/BrandInfo/BrandName.js +1 -1
  68. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  69. package/build/features/business/screens/Activities/ActivitiesList.d.ts +13 -13
  70. package/build/features/business/screens/Activities/OperationStartDate.d.ts +2 -2
  71. package/build/features/business/screens/BusinessType/Article.d.ts +1 -1
  72. package/build/features/business/screens/BusinessType/Article.js +1 -1
  73. package/build/features/business/screens/BusinessType/LicenseCertificate.js +2 -1
  74. package/build/features/business/screens/BusinessType/LicenseType.d.ts +5 -5
  75. package/build/features/business/screens/Customers/CustomerLocations.d.ts +11 -11
  76. package/build/features/business/screens/Customers/RefundPolicy.d.ts +5 -5
  77. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  78. package/build/features/connect/screens/Individual/Email.js +1 -1
  79. package/build/features/connect/screens/Merchant/BrandName.js +1 -1
  80. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +1 -1
  81. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +5 -5
  82. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +1 -1
  83. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +13 -13
  84. package/build/features/entity/screens/EntityCapital/ActivityList.js +7 -7
  85. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -4
  86. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +3 -4
  87. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -4
  88. package/build/features/entity/screens/EntityName/Article.d.ts +1 -1
  89. package/build/features/entity/screens/EntityName/Article.js +16 -53
  90. package/build/features/entity/screens/EntityName/EntityName.js +2 -3
  91. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +13 -13
  92. package/build/features/entity/screens/EntityName/EntityTypeList.js +4 -6
  93. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +2 -2
  94. package/build/features/entity/screens/EntityName/ExpiryDate.js +6 -6
  95. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +2 -2
  96. package/build/features/entity/screens/EntityName/IssuingDate.js +4 -5
  97. package/build/features/entity/screens/EntityName/LegalName.js +2 -4
  98. package/build/features/entity/screens/EntityName/LicenseCertificate.js +4 -3
  99. package/build/features/entity/screens/EntityName/LicenseNumber.js +4 -4
  100. package/build/features/entity/screens/EntityName/UnifiedNumber.js +3 -4
  101. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  102. package/build/features/featuresScreens.js +5 -0
  103. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +2 -2
  104. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +4 -3
  105. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +2 -4
  106. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +5 -6
  107. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +5 -6
  108. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +4 -4
  109. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +2 -4
  110. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +4 -3
  111. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +5 -6
  112. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.d.ts +2 -0
  113. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.js +3 -2
  114. package/build/features/individual/screens/IndividualList/Email.d.ts +5 -1
  115. package/build/features/individual/screens/IndividualList/Email.js +73 -8
  116. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +4 -4
  117. package/build/features/individual/screens/IndividualList/UserList.js +36 -19
  118. package/build/features/individual/screens/IndividualList/validation.js +2 -1
  119. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -3
  120. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +3 -4
  121. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +5 -5
  122. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -3
  123. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +2 -2
  124. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +6 -7
  125. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +5 -6
  126. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -3
  127. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +6 -7
  128. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +12 -0
  129. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +143 -0
  130. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.d.ts +5 -0
  131. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +60 -0
  132. package/build/features/individual/screens/IndividualPhoneInfo/index.d.ts +3 -0
  133. package/build/features/individual/screens/IndividualPhoneInfo/index.js +2 -0
  134. package/build/features/individual/screens/IndividualPhoneInfo/validation.d.ts +8 -0
  135. package/build/features/individual/screens/IndividualPhoneInfo/validation.js +31 -0
  136. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  137. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  138. package/build/features/shared/Address/CountryList.d.ts +9 -9
  139. package/build/features/shared/Address/InputSelect.d.ts +9 -9
  140. package/build/features/shared/Address/InputSelect.js +1 -1
  141. package/build/features/shared/Button/Button.js +1 -1
  142. package/build/features/shared/Button/EmailProvidersButtons.d.ts +1 -1
  143. package/build/features/shared/Button/FlowsButtons.d.ts +1 -1
  144. package/build/features/shared/Button/FlowsButtons.js +1 -1
  145. package/build/features/shared/Button/{ListButton.d.ts → IndividualActionButtons.d.ts} +5 -4
  146. package/build/features/shared/Button/IndividualActionButtons.js +132 -0
  147. package/build/features/shared/Button/index.d.ts +1 -1
  148. package/build/features/shared/Button/index.js +1 -1
  149. package/build/features/shared/Containers/FeatureContainer.d.ts +1 -1
  150. package/build/features/shared/Containers/ScreenContainer.d.ts +1 -1
  151. package/build/features/shared/Input/Input.d.ts +3 -3
  152. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +11 -1
  153. package/build/features/shared/UploadFile/FileUpload.d.ts +29 -0
  154. package/build/features/shared/UploadFile/FileUpload.js +263 -0
  155. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
  156. package/build/features/shared/UploadFile/UploadWrapper.d.ts +33 -0
  157. package/build/features/shared/UploadFile/UploadWrapper.js +114 -0
  158. package/build/features/shared/UploadFile/index.d.ts +2 -1
  159. package/build/features/shared/UploadFile/index.js +2 -1
  160. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +9 -20
  161. package/build/features/shared/UploadMultipleFile/UploadFile.js +109 -24
  162. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +6 -4
  163. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +26 -19
  164. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +1 -1
  165. package/build/features/tax/screens/TaxDetails/TaxDocument.js +4 -3
  166. package/build/features/tax/screens/TaxDetails/VATId.js +3 -4
  167. package/build/index.d.ts +2 -2
  168. package/build/index.js +4 -3
  169. package/build/utils/array.d.ts +3 -1
  170. package/build/utils/array.js +35 -6
  171. package/package.json +1 -1
  172. package/build/features/shared/Button/ListButton.js +0 -125
@@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
24
24
  function verb(n) { return function (v) { return step([n, v]); }; }
25
25
  function step(op) {
26
26
  if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
28
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
29
  if (y = 0, t) op = [op[0] & 2, t.value];
30
30
  switch (op[0]) {
@@ -68,14 +68,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
68
68
  var _a;
69
69
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
70
70
  import API from '../../../api';
71
- import { FlowsTypes, IndividualGender, IndividualType, FieldType } from '../../../@types';
71
+ import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
- import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getUserNameObject, getUserName, sleep, isValidEmail } from '../../../utils';
75
- export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
76
- var token = _a.token, isInternally = _a.isInternally;
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose } from '../../../utils';
75
+ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
+ var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, payload_1, info, hasIndividualCompleted, birthCountry;
78
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, data_1, info, hasIndividualCompleted, birthCountry;
79
79
  var _c, _d, _e, _f, _g, _h, _j, _k;
80
80
  return __generator(this, function (_l) {
81
81
  switch (_l.label) {
@@ -98,31 +98,35 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
98
98
  countryCode = data === null || data === void 0 ? void 0 : data.country_code;
99
99
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
100
100
  }
101
- if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 14];
101
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
102
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
103
+ return [3, 17];
104
+ case 2:
105
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 16];
102
106
  board_id = data === null || data === void 0 ? void 0 : data.id;
103
107
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
104
- if (!(board_id && board_info_id)) return [3, 4];
108
+ if (!(board_id && board_info_id)) return [3, 5];
105
109
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
106
- case 2:
110
+ case 3:
107
111
  boardInfoData = _l.sent();
108
112
  notification = (boardInfoData || {}).notification;
109
113
  _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
110
- if (!(id && type)) return [3, 4];
111
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
112
- case 3:
113
- payload_1 = (_l.sent()).payload;
114
- individualData = payload_1.data || {};
115
- _l.label = 4;
114
+ if (!(id && type)) return [3, 5];
115
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
116
116
  case 4:
117
- if (!board_id) return [3, 7];
118
- return [4, API.boardService.retrieveBoardDetails(board_id)];
117
+ data_1 = (_l.sent()).data;
118
+ individualData = data_1 || {};
119
+ _l.label = 5;
119
120
  case 5:
121
+ if (!board_id) return [3, 8];
122
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
123
+ case 6:
120
124
  boardData = _l.sent();
121
125
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
122
- case 6:
123
- boardInfoStatus = _l.sent();
124
- _l.label = 7;
125
126
  case 7:
127
+ boardInfoStatus = _l.sent();
128
+ _l.label = 8;
129
+ case 8:
126
130
  if (!countryCode) {
127
131
  countryCode = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
128
132
  if (countryCode)
@@ -130,30 +134,36 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
130
134
  }
131
135
  info = (boardInfoStatus || {}).info;
132
136
  hasIndividualCompleted = ((_e = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
133
- if (!hasIndividualCompleted) return [3, 8];
137
+ if (!hasIndividualCompleted) return [3, 9];
134
138
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
135
- return [3, 14];
136
- case 8:
137
- if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
138
- if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 10];
139
- return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
139
+ return [3, 15];
140
140
  case 9:
141
- _l.sent();
142
- _l.label = 10;
141
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 12];
142
+ if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 11];
143
+ return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
143
144
  case 10:
144
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
145
- return [3, 14];
145
+ _l.sent();
146
+ _l.label = 11;
146
147
  case 11:
148
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
149
+ return [3, 15];
150
+ case 12:
147
151
  birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
148
- if (!birthCountry) return [3, 13];
152
+ if (!birthCountry) return [3, 14];
149
153
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
150
- case 12:
151
- _l.sent();
152
- _l.label = 13;
153
154
  case 13:
154
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
155
+ _l.sent();
155
156
  _l.label = 14;
156
- case 14: return [2, {
157
+ case 14:
158
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
159
+ _l.label = 15;
160
+ case 15: return [3, 17];
161
+ case 16:
162
+ if (isUpdatePhoneInfo) {
163
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
164
+ }
165
+ _l.label = 17;
166
+ case 17: return [2, {
157
167
  data: data,
158
168
  boardResponse: {
159
169
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
@@ -167,6 +177,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
167
177
  countries: countries,
168
178
  countryCode: countryCode,
169
179
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
180
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
170
181
  flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
171
182
  },
172
183
  token: token
@@ -175,6 +186,19 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
175
186
  });
176
187
  });
177
188
  });
189
+ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
190
+ var token = _a.token, isInternally = _a.isInternally;
191
+ return __awaiter(void 0, void 0, void 0, function () {
192
+ return __generator(this, function (_b) {
193
+ switch (_b.label) {
194
+ case 0: return [4, thunkApi.dispatch(verifyToken({ token: token, isInternally: isInternally }))];
195
+ case 1:
196
+ _b.sent();
197
+ return [2];
198
+ }
199
+ });
200
+ });
201
+ });
178
202
  export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
179
203
  var individual, payload, data;
180
204
  return __generator(this, function (_a) {
@@ -215,7 +239,7 @@ export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', func
215
239
  });
216
240
  }); });
217
241
  export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
218
- var individual, _a, merchant_id, board_id, user, collectInfo, id, type, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_1, payload, data;
242
+ var individual, _a, merchant_id, board_id, user, collectInfo, id, type, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_2, payload, data;
219
243
  var _c;
220
244
  return __generator(this, function (_d) {
221
245
  switch (_d.label) {
@@ -246,16 +270,16 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
246
270
  };
247
271
  return [4, API.individualService.updateIndividual(requestBody)];
248
272
  case 1:
249
- data_1 = _d.sent();
250
- individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.user;
273
+ data_2 = _d.sent();
274
+ individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.user;
251
275
  if (type === IndividualType.SHARE_HOLDER)
252
- individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.shareholder;
276
+ individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.shareholder;
253
277
  else if (type === IndividualType.BOARD_MEMBER)
254
- individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.board_member;
278
+ individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.board_member;
255
279
  else if (type === IndividualType.BUYER)
256
- individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.buyer;
280
+ individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.buyer;
257
281
  else if (type === IndividualType.CUSTOMER)
258
- individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.customer;
282
+ individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.customer;
259
283
  _d.label = 2;
260
284
  case 2:
261
285
  payload = {
@@ -382,10 +406,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
382
406
  });
383
407
  }); });
384
408
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
385
- var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, payload_2, info, hasIndividualCompleted, birthCountry;
386
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
387
- return __generator(this, function (_p) {
388
- switch (_p.label) {
409
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, countryCode, notification, _c, id, type, data_3, info, hasIndividualCompleted, birthCountry;
410
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
411
+ return __generator(this, function (_q) {
412
+ switch (_q.label) {
389
413
  case 0:
390
414
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
391
415
  responseBody = individual.data.verify.responseBody;
@@ -400,84 +424,119 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
400
424
  };
401
425
  return [4, API.leadService.verifyLeadOTP(payload)];
402
426
  case 1:
403
- data = (_p.sent()).data;
427
+ data = (_q.sent()).data;
404
428
  boardInfoStatus = undefined;
405
- if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 14];
429
+ if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
430
+ throw new Error(data.errors[0].description);
406
431
  if (!board_id) return [3, 4];
407
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
408
- case 2:
409
- boardInfoStatus = _p.sent();
410
432
  return [4, API.boardService.retrieveBoardDetails(board_id)];
433
+ case 2:
434
+ boardData = _q.sent();
435
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
411
436
  case 3:
412
- boardData = _p.sent();
413
- _p.label = 4;
437
+ boardInfoStatus = _q.sent();
438
+ _q.label = 4;
414
439
  case 4:
415
- countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
440
+ countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
416
441
  if (!(board_id && board_info_id)) return [3, 7];
417
442
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
418
443
  case 5:
419
- boardInfoData = _p.sent();
444
+ boardInfoData = _q.sent();
420
445
  notification = (boardInfoData || {}).notification;
421
446
  _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
422
447
  if (!(id && type)) return [3, 7];
423
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
448
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
424
449
  case 6:
425
- payload_2 = (_p.sent()).payload;
426
- individualData = payload_2.data || {};
427
- _p.label = 7;
450
+ data_3 = (_q.sent()).data;
451
+ individualData = data_3 || {};
452
+ _q.label = 7;
428
453
  case 7:
454
+ if (countryCode)
455
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
429
456
  info = (boardInfoStatus || {}).info;
430
- 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';
431
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
457
+ hasIndividualCompleted = ((_g = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _g === void 0 ? void 0 : _g.status) === 'completed';
432
458
  if (!hasIndividualCompleted) return [3, 8];
433
459
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
434
460
  return [3, 14];
435
461
  case 8:
436
462
  if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
437
- if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 10];
438
- return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
463
+ if (!((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)) return [3, 10];
464
+ return [4, thunkApi.dispatch(getIndividualList((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id))];
439
465
  case 9:
440
- _p.sent();
441
- _p.label = 10;
466
+ _q.sent();
467
+ _q.label = 10;
442
468
  case 10:
443
469
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
444
470
  return [3, 14];
445
471
  case 11:
446
- birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
472
+ birthCountry = ((_k = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _k === void 0 ? void 0 : _k.country) || countryCode;
447
473
  if (!birthCountry) return [3, 13];
448
474
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
449
475
  case 12:
450
- _p.sent();
451
- _p.label = 13;
476
+ _q.sent();
477
+ _q.label = 13;
452
478
  case 13:
453
479
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
454
- _p.label = 14;
455
- case 14: return [2, {
456
- data: data,
457
- boardResponse: {
458
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
459
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
460
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
461
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
462
- merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
463
- name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
464
- contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
465
- individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
466
- countries: countries,
467
- countryCode: countryCode,
468
- notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
469
- flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
470
- },
471
- formData: __assign({}, params)
472
- }];
480
+ _q.label = 14;
481
+ case 14:
482
+ (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
483
+ return [2, {
484
+ data: data,
485
+ boardResponse: {
486
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
487
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
488
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
489
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
490
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
491
+ name: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.names,
492
+ contact: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.contact,
493
+ individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
494
+ countries: countries,
495
+ countryCode: countryCode,
496
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
497
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
498
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
499
+ },
500
+ formData: __assign({}, params)
501
+ }];
502
+ }
503
+ });
504
+ }); });
505
+ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
506
+ var individual, _a, token, responseBody, _b, id, type, mobile, countryCode, requestBody, data;
507
+ var _c;
508
+ return __generator(this, function (_d) {
509
+ switch (_d.label) {
510
+ case 0:
511
+ individual = thunkApi.getState().individual;
512
+ _a = individual.data.verify, token = _a.token, responseBody = _a.responseBody;
513
+ _b = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.source) || {}, id = _b.id, type = _b.type;
514
+ mobile = params.mobile, countryCode = params.countryCode;
515
+ requestBody = {
516
+ id: id,
517
+ type: type,
518
+ contact: {
519
+ phone: {
520
+ country_code: (_c = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString(),
521
+ number: mobile || ''
522
+ }
523
+ }
524
+ };
525
+ return [4, API.individualService.updateIndividual(requestBody)];
526
+ case 1:
527
+ data = _d.sent();
528
+ return [4, thunkApi.dispatch(verifyToken({ token: token, isUpdatePhoneInfo: true }))];
529
+ case 2:
530
+ _d.sent();
531
+ return [2, { data: data, formData: params }];
473
532
  }
474
533
  });
475
534
  }); });
476
535
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
477
536
  var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameEditable, isEmailEditable, isMobileNumberEditable, isMobileCountryEditable, isNidEditable, isIssuedCountryEditable, isExpiryEditable, isIdTypeEditable, isNationalityEditable, hasContact, hasPhone, hasIdentification, hasBirth, names, contact, requestBody, data;
478
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
479
- return __generator(this, function (_s) {
480
- switch (_s.label) {
537
+ var _d, _e, _f, _g;
538
+ return __generator(this, function (_h) {
539
+ switch (_h.label) {
481
540
  case 0:
482
541
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
483
542
  _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user, entity = _b.entity;
@@ -487,15 +546,15 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
487
546
  data_status = (user || {}).data_status;
488
547
  userName = getUserNameObject(name);
489
548
  identification_id_type = nid && (nid === null || nid === void 0 ? void 0 : nid.startsWith('1')) ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
490
- isNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.name) === FieldType.EDITABLE && userName.first;
491
- isEmailEditable = ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _d === void 0 ? void 0 : _d.email) === FieldType.EDITABLE;
492
- isMobileNumberEditable = ((_f = (_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone) === null || _f === void 0 ? void 0 : _f.number) === FieldType.EDITABLE && mobile;
493
- isMobileCountryEditable = ((_h = (_g = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _g === void 0 ? void 0 : _g.phone) === null || _h === void 0 ? void 0 : _h.country_code) === FieldType.EDITABLE;
494
- isNidEditable = ((_j = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _j === void 0 ? void 0 : _j.id) === FieldType.EDITABLE && nid;
495
- isIssuedCountryEditable = ((_k = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _k === void 0 ? void 0 : _k.issuer_country) === FieldType.EDITABLE;
496
- isExpiryEditable = ((_l = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _l === void 0 ? void 0 : _l.expiry) === FieldType.EDITABLE && expiryDate;
497
- isIdTypeEditable = ((_m = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _m === void 0 ? void 0 : _m.type) === FieldType.EDITABLE && identification_id_type;
498
- isNationalityEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.nationality) === FieldType.EDITABLE;
549
+ isNameEditable = true;
550
+ isEmailEditable = true;
551
+ isMobileNumberEditable = true;
552
+ isMobileCountryEditable = true;
553
+ isNidEditable = true;
554
+ isIssuedCountryEditable = true;
555
+ isExpiryEditable = true;
556
+ isIdTypeEditable = true;
557
+ isNationalityEditable = true;
499
558
  hasContact = email || mobile || countryCode;
500
559
  hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
501
560
  hasIdentification = nid || issuedCountry || identification_id_type || expiryDate;
@@ -511,7 +570,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
511
570
  email: isEmailEditable ? email : undefined,
512
571
  phone: hasPhone
513
572
  ? {
514
- country_code: isMobileCountryEditable ? (_o = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _o === void 0 ? void 0 : _o.toString() : undefined,
573
+ country_code: isMobileCountryEditable ? (_d = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString() : undefined,
515
574
  number: isMobileNumberEditable ? mobile : undefined
516
575
  }
517
576
  : undefined
@@ -533,7 +592,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
533
592
  : undefined,
534
593
  date_of_birth: dob,
535
594
  birth: hasBirth && {
536
- city: (_p = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _p === void 0 ? void 0 : _p.en,
595
+ city: (_e = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _e === void 0 ? void 0 : _e.en,
537
596
  country: placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
538
597
  },
539
598
  nationality: isNationalityEditable ? nationality === null || nationality === void 0 ? void 0 : nationality.iso2 : undefined,
@@ -555,57 +614,81 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
555
614
  };
556
615
  return [4, API.individualService.updateIndividual(requestBody)];
557
616
  case 1:
558
- data = (_s.sent()).data;
617
+ data = (_h.sent()).data;
559
618
  if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
560
619
  return [4, thunkApi.dispatch(retrieveDataList(code))];
561
620
  case 2:
562
- _s.sent();
563
- _s.label = 3;
621
+ _h.sent();
622
+ _h.label = 3;
564
623
  case 3:
565
624
  thunkApi.dispatch(handleNextScreenStep());
566
- (_r = (_q = settings.data.appConfig).onStepCompleted) === null || _r === void 0 ? void 0 : _r.call(_q, settings.data.activeScreen.name, requestBody);
625
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
567
626
  return [2, { data: data, formData: params }];
568
627
  }
569
628
  });
570
629
  }); });
571
630
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
572
- var _a, settings, individual, _b, notification, user, _c, id, type, civilID, signatureFileId, businessCountry, documentsList, isSendSignatureFile, documentBody, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data;
573
- var _d, _e, _f, _g, _h, _j;
574
- return __generator(this, function (_k) {
575
- switch (_k.label) {
631
+ var _a, settings, individual, _b, notification, user, _c, id, type, civilID, signatureFileId, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data;
632
+ var _d, _e;
633
+ return __generator(this, function (_f) {
634
+ switch (_f.label) {
576
635
  case 0:
577
636
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
578
637
  _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
579
638
  _c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
580
639
  civilID = params.civilID, signatureFileId = params.signatureFileId;
581
640
  businessCountry = settings.data.businessCountry;
582
- documentsList = [];
641
+ hasCivilIdDocument = (civilID || []).length > 0;
642
+ hasSignatureDocument = (signatureFileId || []).length > 0;
583
643
  isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (type === IndividualType.USER || type === IndividualType.BUYER);
584
- if ((civilID || []).length > 0)
644
+ civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
645
+ signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
646
+ if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 2];
647
+ documentBody = {
648
+ id: civilIdDocument.id,
649
+ images: civilID
650
+ };
651
+ return [4, API.documentService.addFilesToExistingDocument(documentBody)];
652
+ case 1:
653
+ _f.sent();
654
+ _f.label = 2;
655
+ case 2:
656
+ if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 4];
657
+ documentBody = {
658
+ id: signatureDocument.id,
659
+ images: signatureFileId
660
+ };
661
+ return [4, API.documentService.addFilesToExistingDocument(documentBody)];
662
+ case 3:
663
+ _f.sent();
664
+ _f.label = 4;
665
+ case 4:
666
+ documentsList = [];
667
+ if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
585
668
  documentsList.push({ type: 'Civil ID File', images: civilID });
586
- if (isSendSignatureFile && (signatureFileId || []).length > 0)
669
+ if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
587
670
  documentsList.push({ type: 'Signature File', images: signatureFileId });
671
+ if (!(documentsList.length > 0)) return [3, 6];
588
672
  documentBody = {
589
673
  individual_type_id: id || '',
590
674
  country: businessCountry.iso2,
591
675
  documents: documentsList
592
676
  };
593
- if (!(documentsList.length > 0)) return [3, 2];
594
- return [4, API.entityService.updateDocumentInfo(documentBody)];
595
- case 1:
596
- _k.sent();
597
- _k.label = 2;
598
- case 2:
677
+ return [4, API.documentService.updateDocumentInfo(documentBody)];
678
+ case 5:
679
+ _f.sent();
680
+ _f.label = 6;
681
+ case 6:
599
682
  occupation = params.occupation, sourceIncome = params.sourceIncome, monthlyIncome = params.monthlyIncome, isPEP = params.isPEP, isInfluencer = params.isInfluencer, shareCount = params.shareCount, shareValue = params.shareValue;
600
- isOccupationEditable = ((_d = user === null || user === void 0 ? void 0 : user.data_status) === null || _d === void 0 ? void 0 : _d.occupation) === FieldType.EDITABLE && (occupation === null || occupation === void 0 ? void 0 : occupation.id);
601
- isSourceIncomeEditable = ((_e = user === null || user === void 0 ? void 0 : user.data_status) === null || _e === void 0 ? void 0 : _e.source_of_income) === FieldType.EDITABLE && (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id);
602
- isPEPEditable = ((_f = user === null || user === void 0 ? void 0 : user.data_status) === null || _f === void 0 ? void 0 : _f.is_relative_PEP) === FieldType.EDITABLE;
603
- isInfluencerEditable = ((_g = user === null || user === void 0 ? void 0 : user.data_status) === null || _g === void 0 ? void 0 : _g.is_influencer) === FieldType.EDITABLE;
683
+ isOccupationEditable = true;
684
+ isSourceIncomeEditable = true;
685
+ isPEPEditable = true;
686
+ isInfluencerEditable = true;
604
687
  isSharesAvailable = shareCount || shareValue;
605
688
  pepInfo = isPEPEditable ? isPEP : undefined;
606
689
  influencerInfo = isInfluencerEditable ? isInfluencer : undefined;
607
- occupationInfo = isOccupationEditable ? { id: occupation.id } : undefined;
608
- sourceIncomeInfo = isSourceIncomeEditable ? [{ id: sourceIncome.id }] : undefined;
690
+ occupationInfo = isOccupationEditable ? (occupation === null || occupation === void 0 ? void 0 : occupation.id) && { id: occupation.id } : undefined;
691
+ sourceIncomeInfo = isSourceIncomeEditable ? (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) && [{ id: sourceIncome.id }] : undefined;
609
692
  monthlyIncomeInfo = (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) && { id: monthlyIncome.id };
610
693
  userPayload = {
611
694
  occupation: occupationInfo,
@@ -642,14 +725,36 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
642
725
  payload = {};
643
726
  requestBody = __assign(__assign({ id: id, type: type }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
644
727
  return [4, API.individualService.updateIndividual(requestBody)];
645
- case 3:
646
- data = (_k.sent()).data;
728
+ case 7:
729
+ data = (_f.sent()).data;
647
730
  thunkApi.dispatch(handleNextScreenStep());
648
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
731
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
649
732
  return [2, { data: data, formData: params }];
650
733
  }
651
734
  });
652
735
  }); });
736
+ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (_a) {
737
+ var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
738
+ return __awaiter(void 0, void 0, void 0, function () {
739
+ var requestBody, data;
740
+ return __generator(this, function (_b) {
741
+ switch (_b.label) {
742
+ case 0:
743
+ requestBody = {
744
+ email: email,
745
+ encryption_contract: ['email']
746
+ };
747
+ return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
748
+ case 1:
749
+ data = (_b.sent()).data;
750
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
751
+ if (!data.errors)
752
+ return [2, { response: data, formData: email }];
753
+ return [2];
754
+ }
755
+ });
756
+ });
757
+ });
653
758
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
654
759
  var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
655
760
  var _c, _d, _e, _f;
@@ -693,6 +798,10 @@ var initialState = {
693
798
  otpData: {
694
799
  otp: ''
695
800
  },
801
+ individualPhoneInfo: {
802
+ mobile: '',
803
+ countryCode: defaultCountry
804
+ },
696
805
  individualCollectData: {
697
806
  email: '',
698
807
  mobile: '',
@@ -751,16 +860,25 @@ export var individualSlice = createSlice({
751
860
  },
752
861
  extraReducers: function (builder) {
753
862
  builder
754
- .addCase(verifyLeadToken.pending, function (state) {
863
+ .addCase(verifyToken.pending, function (state) {
755
864
  state.error = null;
756
- state.customLoading = true;
757
865
  })
758
- .addCase(verifyLeadToken.fulfilled, function (state, action) {
866
+ .addCase(verifyToken.fulfilled, function (state, action) {
759
867
  state.error = null;
760
- state.customLoading = false;
761
868
  var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
762
869
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
763
870
  state.data.verify.token = token;
871
+ })
872
+ .addCase(verifyToken.rejected, function (state, action) {
873
+ state.error = action.error.message;
874
+ })
875
+ .addCase(verifyLeadToken.pending, function (state) {
876
+ state.error = null;
877
+ state.customLoading = true;
878
+ })
879
+ .addCase(verifyLeadToken.fulfilled, function (state) {
880
+ state.error = null;
881
+ state.customLoading = false;
764
882
  })
765
883
  .addCase(verifyLeadToken.rejected, function (state, action) {
766
884
  state.error = action.error.message;
@@ -841,12 +959,10 @@ export var individualSlice = createSlice({
841
959
  state.error = action.error.message;
842
960
  })
843
961
  .addCase(retrieveIndividualInfo.pending, function (state) {
844
- state.loading = true;
845
962
  state.error = null;
846
963
  })
847
964
  .addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
848
965
  var _a, _b, _c, _d;
849
- state.loading = false;
850
966
  state.error = null;
851
967
  var _e = action.payload, data = _e.data, countries = _e.countries, countryCode = _e.countryCode;
852
968
  var user = (state.data.verify.responseBody || {}).user;
@@ -916,7 +1032,6 @@ export var individualSlice = createSlice({
916
1032
  state.data.individualData.isInfluencer = is_influencer;
917
1033
  })
918
1034
  .addCase(retrieveIndividualInfo.rejected, function (state, action) {
919
- state.loading = false;
920
1035
  state.error = action.error.message;
921
1036
  })
922
1037
  .addCase(getIndividualList.pending, function (state) {
@@ -986,6 +1101,21 @@ export var individualSlice = createSlice({
986
1101
  .addCase(getCityList.rejected, function (state, action) {
987
1102
  state.cityLoading = false;
988
1103
  state.error = action.error.message;
1104
+ })
1105
+ .addCase(updatePhoneInfo.pending, function (state) {
1106
+ state.loading = true;
1107
+ state.error = null;
1108
+ })
1109
+ .addCase(updatePhoneInfo.fulfilled, function (state, action) {
1110
+ state.loading = false;
1111
+ state.error = null;
1112
+ var _a = action.payload, data = _a.data, formData = _a.formData;
1113
+ state.data.individualPhoneInfo = formData;
1114
+ state.data.individualPhoneInfo.responseBody = data;
1115
+ })
1116
+ .addCase(updatePhoneInfo.rejected, function (state, action) {
1117
+ state.loading = false;
1118
+ state.error = action.error.message;
989
1119
  })
990
1120
  .addCase(updateIndividualPersonalInfo.pending, function (state) {
991
1121
  state.loading = true;
@@ -1031,6 +1161,19 @@ export var individualSlice = createSlice({
1031
1161
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
1032
1162
  state.error = action.error.message;
1033
1163
  state.loading = false;
1164
+ })
1165
+ .addCase(checkEmailAvailability.fulfilled, function (state, action) {
1166
+ var _a;
1167
+ state.error = null;
1168
+ state.data.individualCollectData.responseBody = __assign(__assign({}, state.data.individualCollectData.responseBody), (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response);
1169
+ })
1170
+ .addCase(checkEmailAvailability.pending, function (state) {
1171
+ state.error = null;
1172
+ })
1173
+ .addCase(checkEmailAvailability.rejected, function (state, action) {
1174
+ if (action.error.message === 'Aborted')
1175
+ return;
1176
+ state.error = action.error.message;
1034
1177
  })
1035
1178
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
1036
1179
  var _a;