@tap-payments/auth-jsconnect 2.8.58-development → 2.8.59-beta

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 (220) hide show
  1. package/build/@types/app.d.ts +0 -1
  2. package/build/@types/form.d.ts +0 -1
  3. package/build/@types/redux.d.ts +0 -1
  4. package/build/api/entity.d.ts +2 -2
  5. package/build/api/entity.js +4 -12
  6. package/build/api/index.d.ts +2 -2
  7. package/build/constants/api.d.ts +1 -0
  8. package/build/constants/api.js +2 -0
  9. package/build/constants/app.d.ts +2 -0
  10. package/build/constants/app.js +2 -0
  11. package/build/features/app/bank/bankStore.d.ts +18 -13
  12. package/build/features/app/bank/bankStore.js +165 -184
  13. package/build/features/app/board/boardStore.js +30 -52
  14. package/build/features/app/brand/brandStore.d.ts +33 -16
  15. package/build/features/app/brand/brandStore.js +242 -239
  16. package/build/features/app/business/businessStore.d.ts +5 -0
  17. package/build/features/app/business/businessStore.js +87 -76
  18. package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -15
  19. package/build/features/app/connectExpress/connectExpressStore.js +52 -110
  20. package/build/features/app/entity/entityStore.d.ts +36 -20
  21. package/build/features/app/entity/entityStore.js +246 -196
  22. package/build/features/app/individual/individualStore.d.ts +38 -22
  23. package/build/features/app/individual/individualStore.js +266 -263
  24. package/build/features/app/password/passwordStore.d.ts +23 -40
  25. package/build/features/app/password/passwordStore.js +233 -226
  26. package/build/features/app/tax/taxStore.d.ts +7 -13
  27. package/build/features/app/tax/taxStore.js +147 -168
  28. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +1 -13
  29. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +26 -4
  30. package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +1 -7
  31. package/build/features/bank/Bank.d.ts +0 -1
  32. package/build/features/bank/Bank.js +4 -7
  33. package/build/features/bank/screens/BankDetails/BankDetails.js +5 -18
  34. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  35. package/build/features/bank/screens/Verify/Verify.js +5 -5
  36. package/build/features/board/Board.js +4 -8
  37. package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -3
  38. package/build/features/brand/Brand.d.ts +0 -1
  39. package/build/features/brand/Brand.js +4 -7
  40. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +35 -8
  41. package/build/features/brand/screens/BrandActivities/BrandActivities.js +12 -49
  42. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +3 -3
  43. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -6
  44. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +18 -5
  45. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -1
  46. package/build/features/brand/screens/BrandActivities/TAC.d.ts +7 -2
  47. package/build/features/brand/screens/BrandActivities/TAC.js +1 -1
  48. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -1
  49. package/build/features/brand/screens/BrandInfo/BrandInfo.js +5 -23
  50. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +7 -23
  51. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  52. package/build/features/brand/screens/Verify/Verify.js +1 -1
  53. package/build/features/business/Business.js +4 -9
  54. package/build/features/business/screens/Activities/Activities.js +3 -12
  55. package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
  56. package/build/features/business/screens/Activities/OperationStartDate.d.ts +1 -1
  57. package/build/features/business/screens/BrandDetails/SalesChannel.d.ts +1 -1
  58. package/build/features/business/screens/BusinessType/BusinessType.js +2 -10
  59. package/build/features/business/screens/BusinessType/LicenseType.d.ts +26 -4
  60. package/build/features/business/screens/CivilID/CivilID.js +1 -1
  61. package/build/features/business/screens/Customers/CustomerLocations.d.ts +36 -9
  62. package/build/features/business/screens/Customers/Customers.js +3 -12
  63. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -6
  64. package/build/features/business/screens/Customers/RefundPolicy.d.ts +18 -5
  65. package/build/features/business/screens/IDBOD/IDBOD.js +2 -10
  66. package/build/features/business/screens/OTP/OTP.js +1 -1
  67. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -13
  68. package/build/features/business/screens/Verify/Verify.js +3 -13
  69. package/build/features/connect/Connect.js +2 -3
  70. package/build/features/connect/screens/BrandSegment/BrandSegment.js +1 -1
  71. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +2 -9
  72. package/build/features/connect/screens/CivilID/CivilID.js +1 -1
  73. package/build/features/connect/screens/Individual/Email.js +1 -3
  74. package/build/features/connect/screens/Individual/Individual.js +1 -1
  75. package/build/features/connect/screens/Merchant/BrandList.js +3 -3
  76. package/build/features/connect/screens/Merchant/Merchant.js +1 -1
  77. package/build/features/connect/screens/Merchant/SalesChannels.js +1 -1
  78. package/build/features/connect/screens/Mobile/Mobile.js +8 -11
  79. package/build/features/connect/screens/NID/NID.js +1 -1
  80. package/build/features/connect/screens/OperatorError/OperatorError.js +1 -1
  81. package/build/features/connectExpress/ConnectExpress.js +1 -2
  82. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +2 -5
  83. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +1 -6
  84. package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +0 -3
  85. package/build/features/connectExpress/screens/AuthenticationList/validation.js +0 -10
  86. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +1 -7
  87. package/build/features/connectExpress/screens/CivilID/CivilID.js +1 -1
  88. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +1 -1
  89. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -1
  90. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +26 -4
  91. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +7 -2
  92. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +1 -1
  93. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +1 -3
  94. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +24 -14
  95. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -9
  96. package/build/features/connectExpress/screens/NID/NID.js +1 -1
  97. package/build/features/connectExpress/screens/NID/TAC.d.ts +7 -2
  98. package/build/features/connectExpress/screens/NIDMissed/NID.js +1 -1
  99. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  100. package/build/features/entity/Entity.d.ts +0 -1
  101. package/build/features/entity/Entity.js +4 -7
  102. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -2
  103. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +4 -8
  104. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +4 -8
  105. package/build/features/entity/screens/EntityCapital/EntityCapital.js +10 -34
  106. package/build/features/entity/screens/EntityName/EntityName.js +15 -32
  107. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +35 -8
  108. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +1 -1
  109. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +1 -1
  110. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  111. package/build/features/entity/screens/Verify/Verify.js +1 -1
  112. package/build/features/featuresScreens.js +7 -67
  113. package/build/features/individual/Individual.d.ts +0 -1
  114. package/build/features/individual/Individual.js +4 -7
  115. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +1 -1
  116. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -54
  117. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +2 -5
  118. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +26 -4
  119. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
  120. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -4
  121. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -3
  122. package/build/features/individual/screens/IndividualList/Email.js +2 -3
  123. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +2 -2
  124. package/build/features/individual/screens/IndividualList/IndividualList.js +5 -18
  125. package/build/features/individual/screens/IndividualList/UserList.js +9 -13
  126. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
  127. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +26 -4
  128. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +1 -1
  129. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +20 -76
  130. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
  131. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  132. package/build/features/individual/screens/Verify/Verify.js +1 -1
  133. package/build/features/password/Password.d.ts +0 -1
  134. package/build/features/password/Password.js +28 -75
  135. package/build/features/password/screens/CreatePassword/CreatePassword.js +4 -8
  136. package/build/features/password/screens/OTP/OTP.js +1 -1
  137. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  138. package/build/features/password/screens/Verify/Verify.js +5 -5
  139. package/build/features/shared/Address/CountryList.d.ts +23 -7
  140. package/build/features/shared/Address/InputSelect.d.ts +23 -7
  141. package/build/features/shared/Button/FlowsButtons.js +3 -13
  142. package/build/features/shared/Containers/FeatureContainer.d.ts +0 -1
  143. package/build/features/shared/Containers/FeatureContainer.js +3 -3
  144. package/build/features/shared/Input/Input.d.ts +2 -2
  145. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +1 -5
  146. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
  147. package/build/features/shared/UploadFile/FileUpload.d.ts +7 -2
  148. package/build/features/shared/UploadFile/UploadFile.d.ts +7 -2
  149. package/build/features/shared/UploadFile/UploadWrapper.d.ts +7 -2
  150. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +7 -2
  151. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +7 -2
  152. package/build/features/signIn/SignIn.js +3 -12
  153. package/build/features/tax/Tax.d.ts +0 -1
  154. package/build/features/tax/Tax.js +4 -7
  155. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  156. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -7
  157. package/build/features/tax/screens/Verify/Verify.js +5 -5
  158. package/build/hooks/index.d.ts +0 -1
  159. package/build/hooks/index.js +0 -1
  160. package/build/hooks/useVerifyToken.d.ts +2 -5
  161. package/build/hooks/useVerifyToken.js +5 -10
  162. package/build/utils/common.js +4 -4
  163. package/build/utils/locale.js +1 -2
  164. package/build/utils/string.d.ts +2 -5
  165. package/build/utils/string.js +5 -34
  166. package/package.json +2 -2
  167. package/build/features/bank/screens/OperatorError/OperatorError.d.ts +0 -5
  168. package/build/features/bank/screens/OperatorError/OperatorError.js +0 -9
  169. package/build/features/bank/screens/OperatorError/index.d.ts +0 -3
  170. package/build/features/bank/screens/OperatorError/index.js +0 -2
  171. package/build/features/board/screens/OperatorError/OperatorError.d.ts +0 -5
  172. package/build/features/board/screens/OperatorError/OperatorError.js +0 -9
  173. package/build/features/board/screens/OperatorError/index.d.ts +0 -3
  174. package/build/features/board/screens/OperatorError/index.js +0 -2
  175. package/build/features/brand/screens/OperatorError/OperatorError.d.ts +0 -5
  176. package/build/features/brand/screens/OperatorError/OperatorError.js +0 -9
  177. package/build/features/brand/screens/OperatorError/index.d.ts +0 -3
  178. package/build/features/brand/screens/OperatorError/index.js +0 -2
  179. package/build/features/business/screens/OperatorError/OperatorError.d.ts +0 -5
  180. package/build/features/business/screens/OperatorError/OperatorError.js +0 -9
  181. package/build/features/business/screens/OperatorError/index.d.ts +0 -3
  182. package/build/features/business/screens/OperatorError/index.js +0 -2
  183. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +0 -9
  184. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +0 -90
  185. package/build/features/connectExpress/screens/OperatorError/OperatorError.d.ts +0 -5
  186. package/build/features/connectExpress/screens/OperatorError/OperatorError.js +0 -9
  187. package/build/features/connectExpress/screens/OperatorError/index.d.ts +0 -3
  188. package/build/features/connectExpress/screens/OperatorError/index.js +0 -2
  189. package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.d.ts +0 -5
  190. package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.js +0 -34
  191. package/build/features/connectExpress/screens/PrepareDataLoading/index.d.ts +0 -2
  192. package/build/features/connectExpress/screens/PrepareDataLoading/index.js +0 -2
  193. package/build/features/entity/screens/OperatorError/OperatorError.d.ts +0 -5
  194. package/build/features/entity/screens/OperatorError/OperatorError.js +0 -9
  195. package/build/features/entity/screens/OperatorError/index.d.ts +0 -3
  196. package/build/features/entity/screens/OperatorError/index.js +0 -2
  197. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +0 -14
  198. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +0 -76
  199. package/build/features/individual/screens/OperatorError/OperatorError.d.ts +0 -5
  200. package/build/features/individual/screens/OperatorError/OperatorError.js +0 -9
  201. package/build/features/individual/screens/OperatorError/index.d.ts +0 -3
  202. package/build/features/individual/screens/OperatorError/index.js +0 -2
  203. package/build/features/password/screens/OperatorError/OperatorError.d.ts +0 -5
  204. package/build/features/password/screens/OperatorError/OperatorError.js +0 -9
  205. package/build/features/password/screens/OperatorError/index.d.ts +0 -3
  206. package/build/features/password/screens/OperatorError/index.js +0 -2
  207. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.d.ts +0 -4
  208. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.js +0 -10
  209. package/build/features/password/screens/PrepareDataLoading/index.d.ts +0 -2
  210. package/build/features/password/screens/PrepareDataLoading/index.js +0 -2
  211. package/build/features/signIn/screens/OperatorError/OperatorError.d.ts +0 -5
  212. package/build/features/signIn/screens/OperatorError/OperatorError.js +0 -9
  213. package/build/features/signIn/screens/OperatorError/index.d.ts +0 -3
  214. package/build/features/signIn/screens/OperatorError/index.js +0 -2
  215. package/build/features/tax/screens/OperatorError/OperatorError.d.ts +0 -5
  216. package/build/features/tax/screens/OperatorError/OperatorError.js +0 -9
  217. package/build/features/tax/screens/OperatorError/index.d.ts +0 -3
  218. package/build/features/tax/screens/OperatorError/index.js +0 -2
  219. package/build/hooks/useFormDirtyCheck.d.ts +0 -10
  220. package/build/hooks/useFormDirtyCheck.js +0 -66
@@ -71,113 +71,120 @@ import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES, MONTHLY_INCOME_LIST } from '../../../constants';
74
- import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA } from '../../../utils';
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA } from '../../../utils';
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var settings, payload, data, userList, recipientData, countries, _b, country_code, config, boardId, countryCode, publicKey, data_1, _c, business_id, recipient, board_id, board_info_id, notification, _d, id_1, type, individualData, birthCountry;
79
- var _e, _f, _g, _h;
80
- return __generator(this, function (_j) {
81
- switch (_j.label) {
78
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, publicKey, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
79
+ var _d, _e, _f, _g, _h, _j, _k, _l;
80
+ return __generator(this, function (_m) {
81
+ switch (_m.label) {
82
82
  case 0:
83
- settings = thunkApi.getState().settings;
84
83
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
85
84
  notification: {
86
85
  sms: false
87
86
  }
88
87
  }));
88
+ settings = thunkApi.getState().settings;
89
89
  return [4, API.leadService.verifyLeadToken(payload)];
90
90
  case 1:
91
- data = (_j.sent()).data;
92
- recipientData = undefined;
91
+ data = (_m.sent()).data;
92
+ boardInfoStatus = undefined;
93
93
  countries = settings.data.countries;
94
- if (((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
94
+ if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
95
95
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
96
96
  if (isInternally)
97
97
  data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
98
- _b = data || {}, country_code = _b.country_code, config = _b.config, boardId = _b.id;
99
- countryCode = country_code;
100
- publicKey = config === null || config === void 0 ? void 0 : config.public_key;
101
- if (country_code)
102
- thunkApi.dispatch(handleSetCountryByIso2(country_code));
103
- if (publicKey)
98
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
99
+ countryCode = data === null || data === void 0 ? void 0 : data.country_code;
100
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
101
+ }
102
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
103
+ if (publicKey) {
104
104
  thunkApi.dispatch(handlePublicKey(publicKey));
105
- if (!!country_code) return [3, 3];
106
- return [4, API.boardService.retrieveBoardDetails(boardId)];
105
+ }
106
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
107
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
108
+ return [3, 16];
107
109
  case 2:
108
- data_1 = _j.sent();
109
- countryCode = (_f = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _f === void 0 ? void 0 : _f.country;
110
- if (countryCode)
111
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
112
- _j.label = 3;
110
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 15];
111
+ board_id = data === null || data === void 0 ? void 0 : data.id;
112
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
113
+ if (!(board_id && board_info_id)) return [3, 5];
114
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
113
115
  case 3:
114
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 4];
115
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
116
- return [3, 18];
116
+ boardInfoData = _m.sent();
117
+ notification = (boardInfoData || {}).notification;
118
+ _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
119
+ if (!(id && type)) return [3, 5];
120
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
117
121
  case 4:
118
- if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 17];
119
- _c = data || {}, business_id = _c.business_id, recipient = _c.recipient, board_id = _c.id, board_info_id = _c.board_info_id;
120
- recipientData = recipient;
121
- if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 6];
122
- if (!(board_id && board_info_id)) return [3, 6];
123
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
122
+ data_1 = (_m.sent()).data;
123
+ individualData = data_1 || {};
124
+ _m.label = 5;
124
125
  case 5:
125
- notification = (_j.sent()).notification;
126
- recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
127
- if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
128
- throw new Error('individual_id_missing');
129
- _j.label = 6;
126
+ if (!board_id) return [3, 7];
127
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
130
128
  case 6:
131
- _d = recipientData || {}, id_1 = _d.id, type = _d.type;
132
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
129
+ boardData = _m.sent();
130
+ _m.label = 7;
133
131
  case 7:
134
- individualData = (_j.sent()).data;
135
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 10];
136
- if (!business_id) return [3, 9];
137
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
132
+ if (!countryCode && ((_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country)) {
133
+ countryCode = boardData.entity.country;
134
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
135
+ }
136
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
137
+ if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 9];
138
+ return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id))];
138
139
  case 8:
139
- userList = _j.sent();
140
- _j.label = 9;
141
- case 9:
142
- userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id_1; });
143
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
144
- return [3, 16];
140
+ _m.sent();
141
+ _m.label = 9;
142
+ case 9: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
145
143
  case 10:
146
- if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 13];
147
- if (!business_id) return [3, 12];
148
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
144
+ boardInfoStatus = _m.sent();
145
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
146
+ return [3, 14];
149
147
  case 11:
150
- userList = _j.sent();
151
- _j.label = 12;
148
+ birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
149
+ if (!birthCountry) return [3, 13];
150
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
152
151
  case 12:
153
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
154
- return [3, 16];
152
+ _m.sent();
153
+ _m.label = 13;
155
154
  case 13:
156
- birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
157
- if (!birthCountry) return [3, 15];
158
- return [4, thunkApi.dispatch(getCityList(birthCountry))];
159
- case 14:
160
- _j.sent();
161
- _j.label = 15;
162
- case 15:
163
155
  if (isInternally)
164
156
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
165
157
  else
166
158
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
167
- _j.label = 16;
168
- case 16: return [3, 18];
169
- case 17:
159
+ _m.label = 14;
160
+ case 14: return [3, 16];
161
+ case 15:
170
162
  if (isUpdatePhoneInfo) {
171
163
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
172
164
  }
173
- _j.label = 18;
174
- case 18: return [2, {
175
- data: data,
176
- countries: countries,
177
- countryCode: countryCode,
178
- token: token,
179
- userList: userList || []
180
- }];
165
+ _m.label = 16;
166
+ case 16:
167
+ individuals = (boardData || {}).individuals;
168
+ _c = individualData || {}, is_authorized = _c.is_authorized, data_state = _c.data_state;
169
+ return [2, {
170
+ data: data,
171
+ boardResponse: {
172
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
173
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
174
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
175
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
176
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
177
+ name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
178
+ contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
179
+ individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
180
+ countries: countries,
181
+ countryCode: countryCode,
182
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
183
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
184
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
185
+ },
186
+ token: token
187
+ }];
181
188
  }
182
189
  });
183
190
  });
@@ -390,141 +397,133 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
390
397
  });
391
398
  }); });
392
399
  export var retrieveBoardStatus = createAsyncThunk('individual/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
393
- var individual, _a, board_id, board_info_id, data;
394
- return __generator(this, function (_b) {
395
- switch (_b.label) {
400
+ var individual, board_id, data;
401
+ return __generator(this, function (_a) {
402
+ switch (_a.label) {
396
403
  case 0:
397
404
  individual = thunkApi.getState().individual;
398
- _a = individual.data.verify.responseBody || {}, board_id = _a.board_id, board_info_id = _a.board_info_id;
399
- if (!board_id || !board_info_id)
400
- throw new Error('Internal server error');
405
+ board_id = (individual.data.verify.responseBody || {}).board_id;
401
406
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
402
407
  case 1:
403
- data = _b.sent();
404
- return [4, thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id })).unwrap()];
405
- case 2:
406
- _b.sent();
408
+ data = _a.sent();
407
409
  thunkApi.dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
408
410
  return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
409
411
  }
410
412
  });
411
413
  }); });
412
- export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (_a, thunkApi) {
413
- var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
414
- return __awaiter(void 0, void 0, void 0, function () {
415
- var _b, individual, settings, individualData, _c, user, data, data_3, data_state;
416
- var _d, _e, _f;
417
- return __generator(this, function (_g) {
418
- switch (_g.label) {
419
- case 0:
420
- _b = thunkApi.getState(), individual = _b.individual, settings = _b.settings;
421
- individualData = (_d = individual.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.user;
422
- return [4, API.boardService.retrieveBoardDetails(boardId)];
423
- case 1:
424
- _c = _g.sent(), user = _c.user, data = __rest(_c, ["user"]);
425
- if (!((individualData === null || individualData === void 0 ? void 0 : individualData.id) === (user === null || user === void 0 ? void 0 : user.id))) return [3, 2];
426
- individualData = user;
427
- return [3, 4];
428
- case 2:
429
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && id && type)) return [3, 4];
430
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: settings.data.businessCountry.iso2 })).unwrap()];
431
- case 3:
432
- data_3 = (_g.sent()).data;
433
- individualData = data_3;
434
- _g.label = 4;
435
- case 4:
436
- data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && (data === null || data === void 0 ? void 0 : data.individuals) ? data === null || data === void 0 ? void 0 : data.individuals : individualData) || {}).data_state;
437
- return [2, {
438
- data: __assign(__assign(__assign(__assign({}, data), { brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_f = data === null || data === void 0 ? void 0 : data.user) === null || _f === void 0 ? void 0 : _f.contact }), (data_state && {
439
- individuals: __assign(__assign({}, data === null || data === void 0 ? void 0 : data.individuals), { data_state: data_state })
440
- })), { board_status: data === null || data === void 0 ? void 0 : data.status })
441
- }];
442
- }
443
- });
414
+ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
415
+ var _a, user, data;
416
+ var _b, _c;
417
+ return __generator(this, function (_d) {
418
+ switch (_d.label) {
419
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
420
+ case 1:
421
+ _a = _d.sent(), user = _a.user, data = __rest(_a, ["user"]);
422
+ return [2, {
423
+ data: __assign(__assign({}, data), { brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.contact, board_status: data === null || data === void 0 ? void 0 : data.status })
424
+ }];
425
+ }
444
426
  });
445
- });
427
+ }); });
446
428
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
447
- var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
448
- var _d, _e, _f, _g, _h, _j, _k, _l;
449
- return __generator(this, function (_m) {
450
- switch (_m.label) {
429
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, countryCode, publicKey, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
430
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
431
+ return __generator(this, function (_r) {
432
+ switch (_r.label) {
451
433
  case 0:
452
434
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
453
435
  responseBody = individual.data.verify.responseBody;
436
+ _b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
454
437
  countries = settings.data.countries;
455
438
  payload = {
456
439
  data: params.otp,
457
- service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
440
+ service_name: (_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
458
441
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
459
442
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
460
443
  encryption_contract: ['data']
461
444
  };
462
445
  return [4, API.leadService.verifyLeadOTP(payload)];
463
446
  case 1:
464
- data = (_m.sent()).data;
465
- recipientData = undefined;
466
- if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
447
+ data = (_r.sent()).data;
448
+ countryCode = undefined;
449
+ if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
467
450
  throw new Error(data.errors[0].description);
468
- publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
469
- countryCode = data === null || data === void 0 ? void 0 : data.country_code;
470
- if (publicKey)
451
+ publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
452
+ if (publicKey) {
471
453
  thunkApi.dispatch(handlePublicKey(publicKey));
472
- if (!((_g = settings.data.businessCountry) === null || _g === void 0 ? void 0 : _g.iso2) && countryCode)
473
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
474
- _b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
475
- recipientData = recipient;
476
- if (!!((_h = data === null || data === void 0 ? void 0 : data.recipient) === null || _h === void 0 ? void 0 : _h.id)) return [3, 3];
477
- if (!(board_id && board_info_id)) return [3, 3];
478
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
454
+ }
455
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
456
+ countryCode = data.country_code;
457
+ thunkApi.dispatch(handleSetCountryByIso2(data.country_code));
458
+ }
459
+ if (!board_id) return [3, 3];
460
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
479
461
  case 2:
480
- notification = (_m.sent()).notification;
481
- recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
482
- if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
483
- throw new Error('individual_id_missing');
484
- _m.label = 3;
462
+ boardData = _r.sent();
463
+ _r.label = 3;
485
464
  case 3:
486
- _c = recipientData || {}, id = _c.id, type = _c.type;
487
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
465
+ if (!countryCode && ((_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.country)) {
466
+ countryCode = boardData.entity.country;
467
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
468
+ }
469
+ if (!(board_id && board_info_id)) return [3, 6];
470
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
488
471
  case 4:
489
- individualData = (_m.sent()).data;
490
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
491
- if (!business_id) return [3, 6];
492
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
472
+ boardInfoData = _r.sent();
473
+ notification = (boardInfoData || {}).notification;
474
+ _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
475
+ if (!(id && type)) return [3, 6];
476
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
493
477
  case 5:
494
- userList = _m.sent();
495
- _m.label = 6;
478
+ data_3 = (_r.sent()).data;
479
+ individualData = data_3 || {};
480
+ _r.label = 6;
496
481
  case 6:
497
- userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
498
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
499
- return [3, 13];
500
- case 7:
482
+ if (countryCode)
483
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
501
484
  if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
502
- if (!business_id) return [3, 9];
503
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
504
- case 8:
505
- userList = _m.sent();
506
- _m.label = 9;
485
+ if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 8];
486
+ return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
487
+ case 7:
488
+ _r.sent();
489
+ _r.label = 8;
490
+ case 8: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
507
491
  case 9:
492
+ boardInfoStatus = _r.sent();
508
493
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
509
494
  return [3, 13];
510
495
  case 10:
511
- birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
496
+ birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
512
497
  if (!birthCountry) return [3, 12];
513
498
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
514
499
  case 11:
515
- _m.sent();
516
- _m.label = 12;
500
+ _r.sent();
501
+ _r.label = 12;
517
502
  case 12:
518
503
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
519
- _m.label = 13;
504
+ _r.label = 13;
520
505
  case 13:
521
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
506
+ (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, { otp: params.otp });
507
+ individuals = (boardData || {}).individuals;
508
+ _d = individualData || {}, is_authorized = _d.is_authorized, data_state = _d.data_state;
522
509
  return [2, {
523
510
  data: data,
524
- countries: countries,
525
- countryCode: countryCode,
526
- formData: __assign({}, params),
527
- userList: userList
511
+ boardResponse: {
512
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
513
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
514
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
515
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
516
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
517
+ name: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.names,
518
+ contact: (_q = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _q === void 0 ? void 0 : _q.contact,
519
+ individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
520
+ countries: countries,
521
+ countryCode: countryCode,
522
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
523
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
524
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
525
+ },
526
+ formData: __assign({}, params)
528
527
  }];
529
528
  }
530
529
  });
@@ -562,20 +561,21 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
562
561
  });
563
562
  });
564
563
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
565
- var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
564
+ var formData = _a.formData, originalFormData = _a.originalFormData;
566
565
  return __awaiter(void 0, void 0, void 0, function () {
567
- var _b, settings, individual, _c, recipient, user, entity, id, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, _d, data_status, objects, ids, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, individualData, data, _e, isUser, isBuyer, isUserORBuyerType;
566
+ var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, currencyData, _e, isUser, isBuyer, isUserORBuyerType;
568
567
  var _f, _g, _h, _j, _k;
569
568
  return __generator(this, function (_l) {
570
569
  switch (_l.label) {
571
570
  case 0:
572
571
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
573
- _c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, entity = _c.entity;
574
- id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
572
+ _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, entity = _c.entity;
573
+ id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
574
+ _d = user || {}, objects = _d.objects, ids = _d.ids;
575
575
  countryCode = (originalFormData || {}).countryCode;
576
576
  name = formData.name, email = formData.email, mobile = formData.mobile, gender = formData.gender, nid = formData.nid, issuedCountry = formData.issuedCountry, expiryDate = formData.expiryDate, dob = formData.dob, placeOfBirthCountry = formData.placeOfBirthCountry, placeOfBirthCity = formData.placeOfBirthCity, nationality = formData.nationality;
577
577
  code = entity === null || entity === void 0 ? void 0 : entity.country;
578
- _d = user || {}, data_status = _d.data_status, objects = _d.objects, ids = _d.ids;
578
+ data_status = (user || {}).data_status;
579
579
  userName = getUserNameObject(name);
580
580
  identification_id_type = nid ? (nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA) : undefined;
581
581
  if (isOtherThanKWOrSA(settings.data.businessCountry.iso2)) {
@@ -598,7 +598,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
598
598
  hasContact = email || mobile;
599
599
  hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
600
600
  hasIdentification = nid && (issuedCountry || identification_id_type || expiryDate);
601
- hasBirth = (placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.id) || (placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2);
601
+ hasBirth = placeOfBirthCity || placeOfBirthCountry;
602
602
  nameIsEditable = userName.first && !(isNameENNonEditable && isNameARNonEditable);
603
603
  contact = hasContact && !(isEmailNonEditable && isMobileCountryNonEditable && isMobileNumberNonEditable)
604
604
  ? __assign({ email: isEmailNonEditable ? undefined : email }, (!(isMobileCountryNonEditable && isMobileNumberNonEditable) &&
@@ -644,14 +644,12 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
644
644
  'date_of_birth',
645
645
  'nationality'
646
646
  ], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
647
- individualData = undefined;
648
- if (!isDirty) return [3, 2];
649
647
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
650
648
  case 1:
651
649
  data = _l.sent();
652
- individualData = data;
653
- _l.label = 2;
650
+ return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
654
651
  case 2:
652
+ currencyData = _l.sent();
655
653
  _e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
656
654
  isUserORBuyerType = isUser || isBuyer;
657
655
  if (!isUserORBuyerType) return [3, 4];
@@ -662,38 +660,35 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
662
660
  case 4:
663
661
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
664
662
  (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
665
- return [2, { data: individualData, formData: originalFormData }];
663
+ return [2, { data: data, formData: originalFormData, currencyData: currencyData }];
666
664
  }
667
665
  });
668
666
  });
669
667
  });
670
668
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
671
- var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
669
+ var formData = _a.formData, originalFormData = _a.originalFormData;
672
670
  return __awaiter(void 0, void 0, void 0, function () {
673
- var _b, settings, individual, _c, recipient, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, data, individualData, requestBody, user_2, userListRes;
671
+ var _b, settings, individual, _c, notification, user, id, _d, objects, ids, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, individualData;
674
672
  var _f, _g;
675
673
  return __generator(this, function (_h) {
676
674
  switch (_h.label) {
677
675
  case 0:
678
676
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
679
- _c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, userList = _c.userList, business = _c.business;
680
- id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
677
+ _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
678
+ id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
681
679
  _d = user || {}, objects = _d.objects, ids = _d.ids;
682
- isKWOrSAValue = isKWOrSA(settings.data.businessCountry.iso2);
683
- occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId, isAuthorized = formData.isAuthorized;
680
+ occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId;
684
681
  isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
685
682
  isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
686
683
  isPEPNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_relative_PEP');
687
684
  isInfluencerNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_influencer');
688
685
  isMonthlyIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'monthly_income');
689
- isAuthorizedNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_authorized');
690
686
  isSharesAvailable = shareCount || shareValue;
691
687
  pepInfo = isPEPNonEditable || isPEP === null ? undefined : isPEP;
692
688
  influencerInfo = isInfluencerNonEditable || isInfluencer === null ? undefined : isInfluencer;
693
689
  occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { chapter: { id: occupation.id } };
694
690
  sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
695
691
  monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
696
- isAuthorizedInfo = isAuthorizedNonEditable || isKWOrSAValue ? undefined : { is_authorized: isAuthorized };
697
692
  userPayload = {
698
693
  occupation: occupationInfo,
699
694
  source_income: sourceIncomeInfo,
@@ -722,70 +717,58 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
722
717
  isUserORBuyerType = isUser || isBuyer;
723
718
  payload = userPayload;
724
719
  if (objects === null || objects === void 0 ? void 0 : objects.length) {
725
- payload = __assign(__assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {})), (isAuthorizedInfo && isAuthorizedInfo));
720
+ payload = __assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {}));
726
721
  }
722
+ requestBody = __assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id] }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
723
+ return [4, API.individualService.updateMultipleIndividual(requestBody)];
724
+ case 1:
725
+ data = _h.sent();
727
726
  businessCountry = settings.data.businessCountry;
728
727
  hasCivilIdDocument = (civilID || []).length > 0;
729
728
  hasSignatureDocument = (signatureFileId || []).length > 0;
730
- isSendSignatureFile = isAuthorized && isUserORBuyerType;
729
+ isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && isUserORBuyerType;
731
730
  civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
732
731
  signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
733
- if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 2];
732
+ if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 3];
734
733
  documentBody = {
735
734
  id: civilIdDocument.id,
736
735
  images: civilID
737
736
  };
738
737
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
739
- case 1:
740
- _h.sent();
741
- _h.label = 2;
742
738
  case 2:
743
- if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 4];
739
+ _h.sent();
740
+ _h.label = 3;
741
+ case 3:
742
+ if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 5];
744
743
  documentBody = {
745
744
  id: signatureDocument.id,
746
745
  images: signatureFileId
747
746
  };
748
747
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
749
- case 3:
750
- _h.sent();
751
- _h.label = 4;
752
748
  case 4:
749
+ _h.sent();
750
+ _h.label = 5;
751
+ case 5:
753
752
  documentsList = [];
754
753
  if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
755
754
  documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
756
755
  if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
757
756
  documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
758
- if (!(documentsList.length > 0)) return [3, 6];
757
+ if (!(documentsList.length > 0)) return [3, 7];
759
758
  documentBody = {
760
759
  individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids.find(function (i) { return i.includes('usr_'); }) : id) || '',
761
760
  country: businessCountry.iso2,
762
761
  documents: documentsList
763
762
  };
764
763
  return [4, API.documentService.updateDocumentInfo(documentBody)];
765
- case 5:
766
- _h.sent();
767
- _h.label = 6;
768
764
  case 6:
769
- data = undefined, individualData = user || {};
770
- requestBody = __assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id] }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
771
- if (!isDirty) return [3, 8];
772
- return [4, API.individualService.updateMultipleIndividual(requestBody)];
765
+ _h.sent();
766
+ _h.label = 7;
773
767
  case 7:
774
- data = _h.sent();
775
- user_2 = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
776
- individualData = user_2;
777
- _h.label = 8;
778
- case 8:
779
- userListRes = userList || [];
780
- if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3, 10];
781
- return [4, thunkApi.dispatch(getIndividualList(business === null || business === void 0 ? void 0 : business.id)).unwrap()];
782
- case 9:
783
- userListRes = _h.sent();
784
- _h.label = 10;
785
- case 10:
768
+ individualData = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
786
769
  thunkApi.dispatch(handleNextScreenStep());
787
770
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
788
- return [2, { data: data, formData: originalFormData, individualData: individualData, userList: userListRes, isKWOrSACountry: isKWOrSAValue }];
771
+ return [2, { data: data, formData: originalFormData, individualData: individualData }];
789
772
  }
790
773
  });
791
774
  });
@@ -816,39 +799,49 @@ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', f
816
799
  });
817
800
  });
818
801
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
819
- var _a, settings, individual, _b, board_id, infoId, _c, showBoard, mode, payload, data, _d, id, iType, boardInfoStatusData;
820
- var _e, _f, _g, _h, _j, _k, _l, _m, _o;
821
- return __generator(this, function (_p) {
822
- switch (_p.label) {
802
+ var _a, settings, individual, _b, id, infoId, primaryUser, _c, showBoard, mode, payload, data, boardInfoStatus, individualDataRes, _d, is_authorized, userId, type;
803
+ var _e, _f, _g, _h, _j, _k, _l, _m;
804
+ return __generator(this, function (_o) {
805
+ switch (_o.label) {
823
806
  case 0:
824
807
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
825
- _b = individual.data.verify.responseBody || {}, board_id = _b.board_id, infoId = _b.board_info_id;
808
+ _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id, primaryUser = _b.primaryUser;
826
809
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
827
- if (!board_id)
810
+ if (!id)
828
811
  return [2];
829
812
  payload = {
830
813
  lang: settings.data.language,
831
- step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS
814
+ step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
815
+ id: id
832
816
  };
833
- return [4, API.boardService.updateBoardInfo(__assign({ id: board_id, infoId: infoId }, payload))];
817
+ return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
834
818
  case 1:
835
- data = _p.sent();
819
+ data = _o.sent();
836
820
  if (!showBoard && mode === 'content') {
837
821
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
838
822
  (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
839
823
  return [2, { response: __assign({}, data), formData: params }];
840
824
  }
841
- _d = ((_j = data === null || data === void 0 ? void 0 : data.notification) === null || _j === void 0 ? void 0 : _j.recipient) || {}, id = _d.id, iType = _d.type;
842
- return [4, Promise.all([
843
- API.boardService.retrieveBoardInfoStatus(board_id),
844
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: iType })).unwrap()
845
- ])];
825
+ return [4, API.boardService.retrieveBoardInfoStatus(id)];
846
826
  case 2:
847
- boardInfoStatusData = (_p.sent())[0];
848
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, {});
849
- (_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, { data: data });
827
+ boardInfoStatus = _o.sent();
828
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
829
+ case 3:
830
+ _o.sent();
831
+ individualDataRes = undefined;
832
+ _d = primaryUser || {}, is_authorized = _d.is_authorized, userId = _d.id, type = _d.object;
833
+ if (!!is_authorized) return [3, 5];
834
+ return [4, thunkApi
835
+ .dispatch(retrieveIndividualInfo({ id: userId, type: type, countryCode: settings.data.businessCountry.iso2 }))
836
+ .unwrap()];
837
+ case 4:
838
+ individualDataRes = _o.sent();
839
+ _o.label = 5;
840
+ case 5:
841
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, {});
842
+ (_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, { data: data });
850
843
  thunkApi.dispatch(handleNextScreenStep());
851
- return [2, { data: data, flows: (boardInfoStatusData === null || boardInfoStatusData === void 0 ? void 0 : boardInfoStatusData.info) || [] }];
844
+ return [2, { response: __assign(__assign({}, data), { flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [] }), formData: params, individualData: individualDataRes === null || individualDataRes === void 0 ? void 0 : individualDataRes.data }];
852
845
  }
853
846
  });
854
847
  }); });
@@ -870,9 +863,9 @@ var initialState = {
870
863
  error: null,
871
864
  loading: false,
872
865
  cityLoading: false,
873
- addOrRequestDetailLoading: false,
874
866
  data: {
875
867
  flowName: FlowsTypes.INDIVIDUAL,
868
+ currency: '',
876
869
  verify: {
877
870
  token: ''
878
871
  },
@@ -910,8 +903,7 @@ var initialState = {
910
903
  isPEP: null,
911
904
  isInfluencer: null,
912
905
  shareCount: '',
913
- shareValue: '',
914
- isAuthorized: false
906
+ shareValue: ''
915
907
  }
916
908
  }
917
909
  };
@@ -946,8 +938,8 @@ export var individualSlice = createSlice({
946
938
  })
947
939
  .addCase(verifyToken.fulfilled, function (state, action) {
948
940
  state.error = null;
949
- var _a = action.payload, data = _a.data, token = _a.token, countries = _a.countries, countryCode = _a.countryCode, userList = _a.userList;
950
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, board_id: data.id, userList: userList });
941
+ var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
942
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
951
943
  state.data.verify.token = token;
952
944
  })
953
945
  .addCase(verifyToken.rejected, function (state, action) {
@@ -987,31 +979,37 @@ export var individualSlice = createSlice({
987
979
  state.error = null;
988
980
  })
989
981
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
982
+ var _a;
990
983
  state.loading = false;
991
984
  state.error = null;
992
- var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode, userList = _a.userList, formData = _a.formData;
985
+ var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
986
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
987
+ if (description) {
988
+ state.error = description;
989
+ return;
990
+ }
993
991
  state.data.otpData = formData;
994
992
  state.data.otpData.responseBody = data;
995
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, userList: userList });
993
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
996
994
  })
997
995
  .addCase(verifyLeadOTP.rejected, function (state, action) {
998
996
  state.loading = false;
999
997
  state.error = action.error.message;
1000
998
  })
1001
999
  .addCase(addDetailsAsync.pending, function (state) {
1002
- state.addOrRequestDetailLoading = true;
1000
+ state.loading = true;
1003
1001
  state.error = null;
1004
1002
  })
1005
1003
  .addCase(addDetailsAsync.fulfilled, function (state, action) {
1006
1004
  var _a, _b, _c, _d;
1007
- state.addOrRequestDetailLoading = false;
1005
+ state.loading = false;
1008
1006
  state.error = null;
1009
1007
  var _e = action.payload, userList = _e.userList, individualId = _e.individualId, countries = _e.countries;
1010
1008
  var primaryUser = (state.data.verify.responseBody || {}).user;
1011
1009
  var user = (userList || []).find(function (user) { return user.individual_id === individualId; });
1012
1010
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
1013
1011
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList, user: __assign(__assign({}, user), { is_authorized: (user === null || user === void 0 ? void 0 : user.is_authorized) !== undefined ? user === null || user === void 0 ? void 0 : user.is_authorized : primaryUser === null || primaryUser === void 0 ? void 0 : primaryUser.is_authorized }) });
1014
- var _f = user || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares, is_authorized = _f.is_authorized;
1012
+ var _f = user || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
1015
1013
  var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
1016
1014
  var cityList = (state.data.verify.responseBody || {}).cityList;
1017
1015
  if (user)
@@ -1069,19 +1067,17 @@ export var individualSlice = createSlice({
1069
1067
  state.data.individualData.isPEP = is_relative_PEP;
1070
1068
  if (is_influencer !== undefined)
1071
1069
  state.data.individualData.isInfluencer = is_influencer;
1072
- if (is_authorized !== undefined)
1073
- state.data.individualData.isAuthorized = is_authorized;
1074
1070
  })
1075
1071
  .addCase(addDetailsAsync.rejected, function (state, action) {
1076
- state.addOrRequestDetailLoading = false;
1072
+ state.loading = false;
1077
1073
  state.error = action.error.message;
1078
1074
  })
1079
1075
  .addCase(requestDetailsByEmail.pending, function (state) {
1080
- state.addOrRequestDetailLoading = true;
1076
+ state.loading = true;
1081
1077
  state.error = null;
1082
1078
  })
1083
1079
  .addCase(requestDetailsByEmail.fulfilled, function (state, action) {
1084
- state.addOrRequestDetailLoading = false;
1080
+ state.loading = false;
1085
1081
  state.error = null;
1086
1082
  var _a = action.payload, data = _a.data, individualData = _a.individualData;
1087
1083
  var userList = (state.data.verify.responseBody || {}).userList;
@@ -1094,7 +1090,7 @@ export var individualSlice = createSlice({
1094
1090
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { requestEmailData: data, userList: list });
1095
1091
  })
1096
1092
  .addCase(requestDetailsByEmail.rejected, function (state, action) {
1097
- state.addOrRequestDetailLoading = false;
1093
+ state.loading = false;
1098
1094
  state.error = action.error.message;
1099
1095
  })
1100
1096
  .addCase(retrieveIndividualInfo.pending, function (state) {
@@ -1106,7 +1102,7 @@ export var individualSlice = createSlice({
1106
1102
  var _e = action.payload, data = _e.data, countries = _e.countries;
1107
1103
  var user = (state.data.verify.responseBody || {}).user;
1108
1104
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { primaryUser: data, user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
1109
- var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares, is_authorized = _f.is_authorized;
1105
+ var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
1110
1106
  var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
1111
1107
  var cityList = (state.data.verify.responseBody || {}).cityList;
1112
1108
  if (data)
@@ -1162,8 +1158,6 @@ export var individualSlice = createSlice({
1162
1158
  state.data.individualData.occupation = selectedOccupation;
1163
1159
  state.data.individualData.isPEP = is_relative_PEP;
1164
1160
  state.data.individualData.isInfluencer = is_influencer;
1165
- if (is_authorized !== undefined)
1166
- state.data.individualData.isAuthorized = is_authorized;
1167
1161
  })
1168
1162
  .addCase(retrieveIndividualInfo.rejected, function (state, action) {
1169
1163
  state.error = action.error.message;
@@ -1254,11 +1248,14 @@ export var individualSlice = createSlice({
1254
1248
  state.error = null;
1255
1249
  })
1256
1250
  .addCase(updateIndividualPersonalInfo.fulfilled, function (state, action) {
1251
+ var _a;
1257
1252
  state.loading = false;
1258
1253
  state.error = null;
1259
- var _a = action.payload, data = _a.data, formData = _a.formData;
1254
+ var _b = action.payload, data = _b.data, formData = _b.formData, currencyData = _b.currencyData;
1260
1255
  state.data.individualPersonalData = formData;
1261
1256
  state.data.individualPersonalData.responseBody = data;
1257
+ if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
1258
+ state.data.currency = currencyData.code.english;
1262
1259
  })
1263
1260
  .addCase(updateIndividualPersonalInfo.rejected, function (state, action) {
1264
1261
  state.loading = false;
@@ -1271,20 +1268,16 @@ export var individualSlice = createSlice({
1271
1268
  .addCase(updateIndividualInfo.fulfilled, function (state, action) {
1272
1269
  state.loading = false;
1273
1270
  state.error = null;
1274
- var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData, userList = _a.userList, isKWOrSACountry = _a.isKWOrSACountry;
1275
- state.data.individualData = __assign(__assign({}, formData), { civilID: undefined, signatureFileId: undefined });
1271
+ var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData;
1272
+ state.data.individualData = formData;
1276
1273
  state.data.individualData.responseBody = data;
1277
- var user = (state.data.verify.responseBody || {}).user;
1278
- var isSameUser = (user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id);
1279
- var userInfo = __assign(__assign({}, user), (isSameUser && individualData && __assign({}, individualData)));
1280
- if (isSameUser && !isKWOrSACountry)
1281
- userInfo = __assign(__assign({}, user), { is_authorized: individualData.is_authorized });
1274
+ var userList = (state.data.verify.responseBody || {}).userList;
1282
1275
  var list = userList || [];
1283
1276
  list = list.map(function (user) {
1284
1277
  var userInfo = user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id) ? individualData : user;
1285
1278
  return userInfo;
1286
1279
  });
1287
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { user: userInfo, userList: list });
1280
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: list });
1288
1281
  })
1289
1282
  .addCase(updateIndividualInfo.rejected, function (state, action) {
1290
1283
  state.loading = false;
@@ -1336,8 +1329,18 @@ export var individualSlice = createSlice({
1336
1329
  var _a;
1337
1330
  state.loading = false;
1338
1331
  state.error = null;
1339
- var _b = action.payload || {}, flows = _b.flows, data = _b.data;
1340
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, recipient: (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient });
1332
+ var _b = action.payload || {}, response = _b.response, individualData = _b.individualData;
1333
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1334
+ if (description) {
1335
+ state.error = description;
1336
+ return;
1337
+ }
1338
+ var flows = response.flows;
1339
+ var individuals = (state.data.verify.responseBody || {}).individuals;
1340
+ var data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) ? individuals : individualData) || {}).data_state;
1341
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (data_state && {
1342
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
1343
+ }));
1341
1344
  })
1342
1345
  .addCase(updateBoardSuccess.pending, function (state) {
1343
1346
  state.loading = true;