@tap-payments/auth-jsconnect 2.8.55-beta → 2.8.55-development

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