@tap-payments/auth-jsconnect 2.8.51-development → 2.8.52-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 (229) 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/axios.js +1 -2
  5. package/build/api/entity.d.ts +2 -2
  6. package/build/api/entity.js +4 -12
  7. package/build/api/index.d.ts +2 -2
  8. package/build/constants/api.d.ts +1 -0
  9. package/build/constants/api.js +2 -0
  10. package/build/constants/app.d.ts +2 -0
  11. package/build/constants/app.js +2 -0
  12. package/build/features/app/auth/authStore.js +23 -2
  13. package/build/features/app/bank/bankStore.d.ts +18 -13
  14. package/build/features/app/bank/bankStore.js +165 -184
  15. package/build/features/app/board/boardStore.js +30 -52
  16. package/build/features/app/brand/brandStore.d.ts +33 -16
  17. package/build/features/app/brand/brandStore.js +242 -239
  18. package/build/features/app/business/businessStore.d.ts +5 -0
  19. package/build/features/app/business/businessStore.js +87 -76
  20. package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -15
  21. package/build/features/app/connectExpress/connectExpressStore.js +68 -107
  22. package/build/features/app/entity/entityStore.d.ts +36 -20
  23. package/build/features/app/entity/entityStore.js +246 -196
  24. package/build/features/app/individual/individualStore.d.ts +38 -22
  25. package/build/features/app/individual/individualStore.js +266 -263
  26. package/build/features/app/password/passwordStore.d.ts +23 -40
  27. package/build/features/app/password/passwordStore.js +233 -226
  28. package/build/features/app/tax/taxStore.d.ts +7 -13
  29. package/build/features/app/tax/taxStore.js +147 -168
  30. package/build/features/auth/Auth.js +5 -1
  31. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +1 -13
  32. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +26 -4
  33. package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +1 -7
  34. package/build/features/auth/screens/OTP/OTP.js +6 -1
  35. package/build/features/auth/screens/OTP/OTPInput.js +11 -0
  36. package/build/features/bank/Bank.d.ts +0 -1
  37. package/build/features/bank/Bank.js +4 -7
  38. package/build/features/bank/screens/BankDetails/BankDetails.js +5 -18
  39. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  40. package/build/features/bank/screens/Verify/Verify.js +5 -5
  41. package/build/features/board/Board.js +4 -8
  42. package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -3
  43. package/build/features/brand/Brand.d.ts +0 -1
  44. package/build/features/brand/Brand.js +4 -7
  45. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +35 -8
  46. package/build/features/brand/screens/BrandActivities/BrandActivities.js +12 -49
  47. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +3 -3
  48. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -6
  49. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +18 -5
  50. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -1
  51. package/build/features/brand/screens/BrandActivities/TAC.d.ts +7 -2
  52. package/build/features/brand/screens/BrandActivities/TAC.js +1 -1
  53. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -1
  54. package/build/features/brand/screens/BrandInfo/BrandInfo.js +5 -23
  55. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +7 -23
  56. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  57. package/build/features/brand/screens/Verify/Verify.js +1 -1
  58. package/build/features/business/Business.js +4 -9
  59. package/build/features/business/screens/Activities/Activities.js +3 -12
  60. package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
  61. package/build/features/business/screens/Activities/OperationStartDate.d.ts +1 -1
  62. package/build/features/business/screens/BrandDetails/SalesChannel.d.ts +1 -1
  63. package/build/features/business/screens/BusinessType/BusinessType.js +2 -10
  64. package/build/features/business/screens/BusinessType/LicenseType.d.ts +26 -4
  65. package/build/features/business/screens/CivilID/CivilID.js +1 -1
  66. package/build/features/business/screens/Customers/CustomerLocations.d.ts +36 -9
  67. package/build/features/business/screens/Customers/Customers.js +3 -12
  68. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -6
  69. package/build/features/business/screens/Customers/RefundPolicy.d.ts +18 -5
  70. package/build/features/business/screens/IDBOD/IDBOD.js +2 -10
  71. package/build/features/business/screens/OTP/OTP.js +1 -1
  72. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -14
  73. package/build/features/business/screens/Verify/Verify.js +3 -13
  74. package/build/features/connect/Connect.js +4 -5
  75. package/build/features/connect/screens/BrandSegment/BrandSegment.js +1 -1
  76. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +2 -9
  77. package/build/features/connect/screens/CivilID/CivilID.js +7 -2
  78. package/build/features/connect/screens/Individual/Email.js +1 -3
  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 +8 -11
  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 +18 -5
  87. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +2 -5
  88. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +1 -6
  89. package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +0 -3
  90. package/build/features/connectExpress/screens/AuthenticationList/validation.js +0 -10
  91. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +1 -7
  92. package/build/features/connectExpress/screens/CivilID/CivilID.js +7 -2
  93. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +1 -1
  94. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +9 -2
  95. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +26 -4
  96. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +7 -2
  97. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +9 -2
  98. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +1 -3
  99. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +24 -14
  100. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +8 -7
  101. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +7 -5
  102. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -9
  103. package/build/features/connectExpress/screens/NID/NID.js +7 -2
  104. package/build/features/connectExpress/screens/NID/TAC.d.ts +7 -2
  105. package/build/features/connectExpress/screens/NIDMissed/NID.js +1 -1
  106. package/build/features/connectExpress/screens/OTP/OTP.js +6 -1
  107. package/build/features/connectExpress/screens/OTP/OTPInput.js +11 -1
  108. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  109. package/build/features/entity/Entity.d.ts +0 -1
  110. package/build/features/entity/Entity.js +4 -7
  111. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -2
  112. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +4 -8
  113. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +4 -8
  114. package/build/features/entity/screens/EntityCapital/EntityCapital.js +10 -34
  115. package/build/features/entity/screens/EntityName/EntityName.js +15 -32
  116. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +35 -8
  117. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +1 -1
  118. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +1 -1
  119. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  120. package/build/features/entity/screens/Verify/Verify.js +1 -1
  121. package/build/features/featuresScreens.js +7 -67
  122. package/build/features/individual/Individual.d.ts +0 -1
  123. package/build/features/individual/Individual.js +4 -7
  124. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +1 -1
  125. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -54
  126. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +2 -5
  127. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +26 -4
  128. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
  129. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -4
  130. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -3
  131. package/build/features/individual/screens/IndividualList/Email.js +2 -3
  132. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +2 -2
  133. package/build/features/individual/screens/IndividualList/IndividualList.js +5 -18
  134. package/build/features/individual/screens/IndividualList/UserList.js +9 -13
  135. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
  136. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +26 -4
  137. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +1 -1
  138. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +20 -76
  139. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
  140. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  141. package/build/features/individual/screens/Verify/Verify.js +1 -1
  142. package/build/features/password/Password.d.ts +0 -1
  143. package/build/features/password/Password.js +28 -75
  144. package/build/features/password/screens/CreatePassword/CreatePassword.js +4 -8
  145. package/build/features/password/screens/OTP/OTP.js +1 -1
  146. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  147. package/build/features/password/screens/Verify/Verify.js +5 -5
  148. package/build/features/shared/Address/CountryList.d.ts +23 -7
  149. package/build/features/shared/Address/InputSelect.d.ts +23 -7
  150. package/build/features/shared/Button/FlowsButtons.js +3 -13
  151. package/build/features/shared/Containers/FeatureContainer.d.ts +0 -1
  152. package/build/features/shared/Containers/FeatureContainer.js +3 -3
  153. package/build/features/shared/Input/Input.d.ts +2 -2
  154. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +1 -5
  155. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -3
  156. package/build/features/shared/UploadFile/FileUpload.d.ts +7 -2
  157. package/build/features/shared/UploadFile/UploadFile.d.ts +7 -2
  158. package/build/features/shared/UploadFile/UploadWrapper.d.ts +7 -2
  159. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +7 -2
  160. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +7 -2
  161. package/build/features/signIn/SignIn.js +3 -12
  162. package/build/features/tax/Tax.d.ts +0 -1
  163. package/build/features/tax/Tax.js +4 -7
  164. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  165. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -7
  166. package/build/features/tax/screens/Verify/Verify.js +5 -5
  167. package/build/hooks/index.d.ts +0 -1
  168. package/build/hooks/index.js +0 -1
  169. package/build/hooks/useVerifyToken.d.ts +2 -5
  170. package/build/hooks/useVerifyToken.js +5 -10
  171. package/build/utils/common.js +4 -4
  172. package/build/utils/locale.js +1 -2
  173. package/build/utils/string.d.ts +2 -5
  174. package/build/utils/string.js +5 -34
  175. package/package.json +2 -2
  176. package/build/features/bank/screens/OperatorError/OperatorError.d.ts +0 -5
  177. package/build/features/bank/screens/OperatorError/OperatorError.js +0 -9
  178. package/build/features/bank/screens/OperatorError/index.d.ts +0 -3
  179. package/build/features/bank/screens/OperatorError/index.js +0 -2
  180. package/build/features/board/screens/OperatorError/OperatorError.d.ts +0 -5
  181. package/build/features/board/screens/OperatorError/OperatorError.js +0 -9
  182. package/build/features/board/screens/OperatorError/index.d.ts +0 -3
  183. package/build/features/board/screens/OperatorError/index.js +0 -2
  184. package/build/features/brand/screens/OperatorError/OperatorError.d.ts +0 -5
  185. package/build/features/brand/screens/OperatorError/OperatorError.js +0 -9
  186. package/build/features/brand/screens/OperatorError/index.d.ts +0 -3
  187. package/build/features/brand/screens/OperatorError/index.js +0 -2
  188. package/build/features/business/screens/OperatorError/OperatorError.d.ts +0 -5
  189. package/build/features/business/screens/OperatorError/OperatorError.js +0 -9
  190. package/build/features/business/screens/OperatorError/index.d.ts +0 -3
  191. package/build/features/business/screens/OperatorError/index.js +0 -2
  192. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +0 -9
  193. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +0 -90
  194. package/build/features/connectExpress/screens/OperatorError/OperatorError.d.ts +0 -5
  195. package/build/features/connectExpress/screens/OperatorError/OperatorError.js +0 -9
  196. package/build/features/connectExpress/screens/OperatorError/index.d.ts +0 -3
  197. package/build/features/connectExpress/screens/OperatorError/index.js +0 -2
  198. package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.d.ts +0 -5
  199. package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.js +0 -34
  200. package/build/features/connectExpress/screens/PrepareDataLoading/index.d.ts +0 -2
  201. package/build/features/connectExpress/screens/PrepareDataLoading/index.js +0 -2
  202. package/build/features/entity/screens/OperatorError/OperatorError.d.ts +0 -5
  203. package/build/features/entity/screens/OperatorError/OperatorError.js +0 -9
  204. package/build/features/entity/screens/OperatorError/index.d.ts +0 -3
  205. package/build/features/entity/screens/OperatorError/index.js +0 -2
  206. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +0 -14
  207. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +0 -76
  208. package/build/features/individual/screens/OperatorError/OperatorError.d.ts +0 -5
  209. package/build/features/individual/screens/OperatorError/OperatorError.js +0 -9
  210. package/build/features/individual/screens/OperatorError/index.d.ts +0 -3
  211. package/build/features/individual/screens/OperatorError/index.js +0 -2
  212. package/build/features/password/screens/OperatorError/OperatorError.d.ts +0 -5
  213. package/build/features/password/screens/OperatorError/OperatorError.js +0 -9
  214. package/build/features/password/screens/OperatorError/index.d.ts +0 -3
  215. package/build/features/password/screens/OperatorError/index.js +0 -2
  216. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.d.ts +0 -4
  217. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.js +0 -10
  218. package/build/features/password/screens/PrepareDataLoading/index.d.ts +0 -2
  219. package/build/features/password/screens/PrepareDataLoading/index.js +0 -2
  220. package/build/features/signIn/screens/OperatorError/OperatorError.d.ts +0 -5
  221. package/build/features/signIn/screens/OperatorError/OperatorError.js +0 -9
  222. package/build/features/signIn/screens/OperatorError/index.d.ts +0 -3
  223. package/build/features/signIn/screens/OperatorError/index.js +0 -2
  224. package/build/features/tax/screens/OperatorError/OperatorError.d.ts +0 -5
  225. package/build/features/tax/screens/OperatorError/OperatorError.js +0 -9
  226. package/build/features/tax/screens/OperatorError/index.d.ts +0 -3
  227. package/build/features/tax/screens/OperatorError/index.js +0 -2
  228. package/build/hooks/useFormDirtyCheck.d.ts +0 -10
  229. package/build/hooks/useFormDirtyCheck.js +0 -66
@@ -49,58 +49,79 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
52
+ import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
53
53
  import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
54
- import { retrieveIndividualData, sleep } from '../../../utils';
55
- export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (_a, thunkApi) {
56
- var token = _a.token, isInternally = _a.isInternally;
57
- return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, _b, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_1;
59
- var _c, _d;
60
- return __generator(this, function (_e) {
61
- switch (_e.label) {
62
- case 0:
63
- payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
- notification: {
65
- sms: false
66
- }
67
- }));
68
- return [4, API.leadService.verifyLeadToken(payload)];
69
- case 1:
70
- data = (_e.sent()).data;
71
- if (((_c = data === null || data === void 0 ? void 0 : data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
72
- throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
73
- if (isInternally)
74
- data.step_name = PASSWORD_STEP_NAMES.PASSWORD_INFO;
75
- _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.board_id;
54
+ import { retrieveIndividualData } from '../../../utils';
55
+ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
+ var payload, data, boardStatusData, boardInfoData, boardData, individualData, countryIso2, _a, board_id, board_info_id, config, country_code, publicKey, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, info, hasPasswordCompleted;
57
+ var _d, _e, _f, _g, _h;
58
+ return __generator(this, function (_j) {
59
+ switch (_j.label) {
60
+ case 0:
61
+ payload = {
62
+ service_name: 'tap_email',
63
+ verify_token: token
64
+ };
65
+ return [4, API.leadService.verifyLeadToken(payload)];
66
+ case 1:
67
+ data = (_j.sent()).data;
68
+ countryIso2 = undefined;
69
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
70
+ _a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id, config = _a.config, country_code = _a.country_code;
71
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
72
+ if (publicKey) {
73
+ thunkApi.dispatch(handlePublicKey(publicKey));
74
+ }
75
+ if (country_code) {
76
76
  countryIso2 = country_code;
77
- if (countryIso2)
78
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
79
- publicKey = config === null || config === void 0 ? void 0 : config.public_key;
80
- if (publicKey)
81
- thunkApi.dispatch(handlePublicKey(publicKey));
82
- if (!!country_code) return [3, 3];
83
- return [4, API.boardService.retrieveBoardDetails(board_id)];
84
- case 2:
85
- data_1 = _e.sent();
86
- if ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country)
87
- thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
88
- _e.label = 3;
89
- case 3:
90
- if (data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH) {
91
- thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
92
- }
93
- else if (board_info_password_status === 'completed') {
94
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
95
- }
96
- else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
97
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
98
- }
99
- return [2, { data: data, token: token }];
100
- }
101
- });
77
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
78
+ }
79
+ if (!board_id) return [3, 7];
80
+ if (!board_info_id) return [3, 3];
81
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
82
+ case 2:
83
+ boardInfoData = _j.sent();
84
+ _j.label = 3;
85
+ case 3: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
86
+ case 4:
87
+ boardStatusData = _j.sent();
88
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
89
+ case 5:
90
+ boardData = _j.sent();
91
+ _b = ((_d = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
92
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
93
+ return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
94
+ case 6:
95
+ _c = _j.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
96
+ boardData = boardRes;
97
+ individualData = individualRes;
98
+ _j.label = 7;
99
+ case 7:
100
+ if (!country_code && ((_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country)) {
101
+ countryIso2 = boardData.entity.country;
102
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
103
+ }
104
+ info = (boardStatusData || {}).info;
105
+ hasPasswordCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
106
+ if (data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH) {
107
+ thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
108
+ }
109
+ else if (hasPasswordCompleted) {
110
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
111
+ }
112
+ else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
113
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
114
+ }
115
+ _j.label = 8;
116
+ case 8: return [2, {
117
+ data: data,
118
+ individualData: individualData,
119
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardStatusData === null || boardStatusData === void 0 ? void 0 : boardStatusData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names, contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
120
+ token: token
121
+ }];
122
+ }
102
123
  });
103
- });
124
+ }); });
104
125
  export var resendOTP = createAsyncThunk('resendOTPPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
105
126
  var password, payload, data;
106
127
  return __generator(this, function (_a) {
@@ -118,74 +139,54 @@ export var resendOTP = createAsyncThunk('resendOTPPassword', function (params, t
118
139
  }
119
140
  });
120
141
  }); });
121
- export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails', function (_a) {
122
- var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
123
- return __awaiter(void 0, void 0, void 0, function () {
124
- var data, individualData, boardData, serviceCallBack, _b, boardRes, individualRes;
125
- var _c, _d, _e;
126
- return __generator(this, function (_f) {
127
- switch (_f.label) {
128
- case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
129
- case 1:
130
- data = _f.sent();
131
- individualData = data === null || data === void 0 ? void 0 : data.user;
132
- boardData = data;
133
- if (!(((_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.id) !== id && id)) return [3, 3];
134
- serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
135
- return [4, retrieveIndividualData(type, data, serviceCallBack)];
136
- case 2:
137
- _b = _f.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
138
- individualData = individualRes;
139
- boardData = boardRes;
140
- _f.label = 3;
141
- case 3: return [2, __assign(__assign({}, boardData), { brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact, user: individualData })];
142
- }
143
- });
142
+ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
143
+ var data;
144
+ var _a, _b;
145
+ return __generator(this, function (_c) {
146
+ switch (_c.label) {
147
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
148
+ case 1:
149
+ data = _c.sent();
150
+ return [2, {
151
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, 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: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
152
+ }];
153
+ }
144
154
  });
145
- });
155
+ }); });
146
156
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
147
- var _a, password, settings, responseBody, payload, data, _b, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_2;
148
- var _c, _d, _e, _f, _g;
149
- return __generator(this, function (_h) {
150
- switch (_h.label) {
157
+ var _a, password, settings, responseBody, payload, data, publicKey, flows, hasPasswordCompleted;
158
+ var _b, _c, _d, _e, _f;
159
+ return __generator(this, function (_g) {
160
+ switch (_g.label) {
151
161
  case 0:
152
162
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
153
163
  responseBody = password.data.verify.responseBody;
154
164
  payload = {
155
165
  data: params.otp,
156
- service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
166
+ service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
157
167
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
158
168
  step_name: PASSWORD_STEP_NAMES.PHONE_AUTH,
159
169
  encryption_contract: ['data']
160
170
  };
161
171
  return [4, API.leadService.verifyLeadOTP(payload)];
162
172
  case 1:
163
- data = (_h.sent()).data;
164
- if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
165
- throw new Error(data.errors[0].description);
166
- _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.board_id;
167
- countryIso2 = country_code;
168
- if (countryIso2)
169
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
170
- publicKey = config === null || config === void 0 ? void 0 : config.public_key;
171
- if (publicKey)
172
- thunkApi.dispatch(handlePublicKey(publicKey));
173
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
174
- if (!(board_info_password_status === 'completed')) return [3, 2];
175
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
176
- return [3, 5];
177
- case 2:
178
- if (!!country_code) return [3, 4];
179
- return [4, API.boardService.retrieveBoardDetails(board_id)];
180
- case 3:
181
- data_2 = _h.sent();
182
- if ((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _g === void 0 ? void 0 : _g.country)
183
- thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
184
- _h.label = 4;
185
- case 4:
186
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
187
- _h.label = 5;
188
- case 5: return [2, { data: data, formData: __assign({}, params) }];
173
+ data = (_g.sent()).data;
174
+ if (!data.errors) {
175
+ publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
176
+ if (publicKey) {
177
+ thunkApi.dispatch(handlePublicKey(publicKey));
178
+ }
179
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
180
+ flows = (responseBody || {}).flows;
181
+ hasPasswordCompleted = ((_f = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
182
+ if (hasPasswordCompleted) {
183
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
184
+ }
185
+ else {
186
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
187
+ }
188
+ }
189
+ return [2, { data: data, formData: __assign({}, params) }];
189
190
  }
190
191
  });
191
192
  }); });
@@ -205,108 +206,98 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
205
206
  return [4, API.authService.createPassword(requestBody)];
206
207
  case 1:
207
208
  data = _f.sent();
208
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP')); });
209
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
209
210
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
210
211
  return [2, { data: data, formData: params }];
211
212
  }
212
213
  });
213
214
  }); });
214
215
  export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
215
- var _a, settings, password, _b, board_id, infoId, _c, showBoard, mode, payload, data, _d, id, type, boardInfoStatusData;
216
- var _e, _f, _g, _h, _j, _k, _l, _m, _o;
217
- return __generator(this, function (_p) {
218
- switch (_p.label) {
216
+ var _a, settings, password, _b, id, infoId, _c, showBoard, mode, payload, data, boardInfoData;
217
+ var _d, _e, _f, _g, _h, _j, _k, _l;
218
+ return __generator(this, function (_m) {
219
+ switch (_m.label) {
219
220
  case 0:
220
221
  _a = thunkApi.getState(), settings = _a.settings, password = _a.password;
221
- _b = password.data.verify.responseBody || {}, board_id = _b.board_id, infoId = _b.board_info_id;
222
+ _b = password.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
222
223
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
223
- if (!board_id)
224
+ if (!id)
224
225
  return [2];
225
226
  payload = {
226
227
  lang: settings.data.language,
227
- step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS
228
+ step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
229
+ id: id
228
230
  };
229
- return [4, API.boardService.updateBoardInfo(__assign({ id: board_id, infoId: infoId }, payload))];
231
+ return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
230
232
  case 1:
231
- data = _p.sent();
233
+ data = _m.sent();
232
234
  if (!showBoard && mode === 'content') {
233
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
234
- (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
235
- return [2, { data: data }];
235
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
236
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
237
+ return [2, { response: __assign({}, data), formData: params }];
236
238
  }
237
- _d = ((_j = data === null || data === void 0 ? void 0 : data.notification) === null || _j === void 0 ? void 0 : _j.recipient) || {}, id = _d.id, type = _d.type;
238
- return [4, Promise.all([
239
- API.boardService.retrieveBoardInfoStatus(board_id),
240
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
241
- ])];
239
+ return [4, API.boardService.retrieveBoardInfoStatus(id)];
242
240
  case 2:
243
- boardInfoStatusData = (_p.sent())[0];
244
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, {});
245
- (_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, { data: data });
241
+ boardInfoData = _m.sent();
242
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
243
+ case 3:
244
+ _m.sent();
245
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, {});
246
+ (_l = (_k = settings.data.appConfig).onFlowCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, { data: data });
246
247
  thunkApi.dispatch(handleNextScreenStep());
247
- return [2, { data: data, flows: (boardInfoStatusData === null || boardInfoStatusData === void 0 ? void 0 : boardInfoStatusData.info) || [] }];
248
- }
249
- });
250
- }); });
251
- export var retrieveBoardStatus = createAsyncThunk('password/retrieveBoardStatus', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
252
- var password, _a, board_id, board_info_id, recipient, _b, id, type, data;
253
- return __generator(this, function (_c) {
254
- switch (_c.label) {
255
- case 0:
256
- password = thunkApi.getState().password;
257
- _a = password.data.verify.responseBody || {}, board_id = _a.board_id, board_info_id = _a.board_info_id, recipient = _a.recipient;
258
- if (!board_id || !board_info_id)
259
- throw new Error('Internal server error');
260
- _b = recipient || {}, id = _b.id, type = _b.type;
261
- return [4, Promise.all([
262
- API.boardService.retrieveBoardInfoStatus(board_id),
263
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
264
- ])];
265
- case 1:
266
- data = (_c.sent())[0];
267
- thunkApi.dispatch(handlePrevScreenStep());
268
- return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
248
+ return [2, { response: __assign(__assign({}, data), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [] }), formData: params }];
269
249
  }
270
250
  });
271
251
  }); });
272
252
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
273
- var token, boardId, boardInfoId, userId, userType, payload, data, countryIso2, publicKey, data_3;
274
- var _a, _b, _c;
275
- return __generator(this, function (_d) {
276
- switch (_d.label) {
253
+ var token, boardId, boardInfoId, boardInfoData, boardStatusData, individualData, boardData, payload, data, _a, id_2, type_2, serviceCallBack, _b, boardRes, individualRes;
254
+ var _c, _d, _e, _f;
255
+ return __generator(this, function (_g) {
256
+ switch (_g.label) {
277
257
  case 0:
278
- token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId, userId = params.userId, userType = params.userType;
258
+ token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId;
259
+ boardData = undefined;
279
260
  payload = {
280
261
  auth_type: 7,
281
262
  auth_token: token
282
263
  };
283
264
  return [4, API.authService.verifyAuth(payload)];
284
265
  case 1:
285
- data = (_d.sent()).data;
286
- if ((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a.length)
287
- throw new Error(data.errors[0].description);
288
- countryIso2 = data === null || data === void 0 ? void 0 : data.country;
289
- if (countryIso2)
290
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
291
- publicKey = (_b = data === null || data === void 0 ? void 0 : data.config) === null || _b === void 0 ? void 0 : _b.public_key;
292
- if (publicKey)
293
- thunkApi.dispatch(handlePublicKey(publicKey));
294
- if (!!(data === null || data === void 0 ? void 0 : data.country)) return [3, 3];
295
- return [4, API.boardService.retrieveBoardDetails(boardId)];
266
+ data = (_g.sent()).data;
267
+ if (!boardId) return [3, 7];
268
+ return [4, API.boardService.retrieveBoardInfoStatus(boardId)];
296
269
  case 2:
297
- data_3 = _d.sent();
298
- if ((_c = data_3 === null || data_3 === void 0 ? void 0 : data_3.entity) === null || _c === void 0 ? void 0 : _c.country)
299
- thunkApi.dispatch(handleSetCountryByIso2(data_3.entity.country));
300
- _d.label = 3;
270
+ boardStatusData = _g.sent();
271
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
301
272
  case 3:
273
+ boardData = _g.sent();
274
+ if ((_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country)
275
+ thunkApi.dispatch(handleSetCountryByIso2(boardData.entity.country));
276
+ if (!boardInfoId) return [3, 5];
277
+ return [4, API.boardService.retrieveBoardInfo({ id: boardId, infoId: boardInfoId })];
278
+ case 4:
279
+ boardInfoData = _g.sent();
280
+ _g.label = 5;
281
+ case 5:
282
+ _a = ((_d = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id_2 = _a.id, type_2 = _a.type;
283
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_2, type_2); };
284
+ return [4, retrieveIndividualData(type_2, boardData, serviceCallBack)];
285
+ case 6:
286
+ _b = _g.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
287
+ boardData = boardRes;
288
+ individualData = individualRes;
289
+ _g.label = 7;
290
+ case 7:
302
291
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
303
- return [2, __assign({ data: data, token: token, boardId: boardId, boardInfoId: boardInfoId }, (userId &&
304
- userType && {
305
- recipient: {
306
- id: userId,
307
- type: userType
308
- }
309
- }))];
292
+ return [2, {
293
+ data: data,
294
+ token: token,
295
+ boardId: boardId,
296
+ boardInfoId: boardInfoId,
297
+ individualData: individualData,
298
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.names, contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
299
+ flows: (boardStatusData === null || boardStatusData === void 0 ? void 0 : boardStatusData.info) || []
300
+ }];
310
301
  }
311
302
  });
312
303
  }); });
@@ -329,9 +320,9 @@ export var resendOperationOTP = createAsyncThunk('resendOperationOTPPassword', f
329
320
  }); });
330
321
  export var resetPassword = createAsyncThunk('resetPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
331
322
  var _a, password, settings, responseBody, passwordData, payload, data;
332
- var _b, _c, _d;
333
- return __generator(this, function (_e) {
334
- switch (_e.label) {
323
+ var _b, _c;
324
+ return __generator(this, function (_d) {
325
+ switch (_d.label) {
335
326
  case 0:
336
327
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
337
328
  responseBody = password.data.verify.responseBody;
@@ -348,42 +339,39 @@ export var resetPassword = createAsyncThunk('resetPassword', function (params, t
348
339
  };
349
340
  return [4, API.authService.verifyAuth(payload)];
350
341
  case 1:
351
- data = (_e.sent()).data;
352
- if ((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length)
353
- throw new Error(data.errors[0].description);
342
+ data = (_d.sent()).data;
354
343
  if (!(data === null || data === void 0 ? void 0 : data.errors)) {
355
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP')); });
356
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, payload);
344
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
345
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, payload);
357
346
  }
358
347
  return [2, { data: data, formData: __assign(__assign({}, params), passwordData) }];
359
348
  }
360
349
  });
361
350
  }); });
362
351
  export var retrieveBoardResetPasswordSuccess = createAsyncThunk('retrieveBoardResetPasswordSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
363
- var _a, password, settings, _b, board_id, boardResponse, recipient, _c, showBoard, mode, _d, id, type, data;
364
- var _e, _f, _g, _h, _j, _k, _l, _m;
365
- return __generator(this, function (_o) {
366
- switch (_o.label) {
352
+ var _a, password, settings, _b, id, boardResponse, _c, showBoard, mode, boardInfoData;
353
+ var _d, _e, _f, _g, _h, _j, _k, _l;
354
+ return __generator(this, function (_m) {
355
+ switch (_m.label) {
367
356
  case 0:
368
357
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
369
- _b = password.data.verify.responseBody || { board_id: '' }, board_id = _b.board_id, boardResponse = _b.boardResponse, recipient = _b.recipient;
358
+ _b = password.data.verify.responseBody || { board_id: '' }, id = _b.board_id, boardResponse = _b.boardResponse;
370
359
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
371
360
  if (!showBoard && mode === 'content') {
372
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
373
- (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: boardResponse });
374
- return [2, { id: board_id, flows: [] }];
361
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
362
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: boardResponse });
363
+ return [2, { id: id, response: {} }];
375
364
  }
376
- _d = recipient || {}, id = _d.id, type = _d.type;
377
- return [4, Promise.all([
378
- API.boardService.retrieveBoardInfoStatus(board_id),
379
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
380
- ])];
365
+ return [4, API.boardService.retrieveBoardInfoStatus(id)];
381
366
  case 1:
382
- data = (_o.sent())[0];
367
+ boardInfoData = _m.sent();
368
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
369
+ case 2:
370
+ _m.sent();
383
371
  thunkApi.dispatch(handleNextScreenStep());
384
- (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { id: id });
385
- (_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, board_id);
386
- return [2, { id: board_id, flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
372
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { id: id });
373
+ (_l = (_k = settings.data.appConfig).onFlowCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, id);
374
+ return [2, { id: id, response: { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [] } }];
387
375
  }
388
376
  });
389
377
  }); });
@@ -438,11 +426,17 @@ export var passwordSlice = createSlice({
438
426
  extraReducers: function (builder) {
439
427
  builder
440
428
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
429
+ var _a;
441
430
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
442
431
  state.error = null;
443
432
  state.customLoading = false;
444
- var _a = action.payload, data = _a.data, token = _a.token;
445
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id });
433
+ var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
434
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
435
+ if (description) {
436
+ state.error = description;
437
+ return;
438
+ }
439
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
446
440
  state.data.verify.token = token;
447
441
  })
448
442
  .addCase(verifyLeadToken.pending, function (state) {
@@ -475,12 +469,17 @@ export var passwordSlice = createSlice({
475
469
  state.error = null;
476
470
  })
477
471
  .addCase(verifyPasswordLeadOTP.fulfilled, function (state, action) {
472
+ var _a;
478
473
  state.loading = false;
479
474
  state.error = null;
480
- var _a = action.payload, data = _a.data, formData = _a.formData;
475
+ var _b = action.payload, data = _b.data, formData = _b.formData;
476
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
477
+ if (description) {
478
+ state.error = description;
479
+ return;
480
+ }
481
481
  state.data.otpData = formData;
482
482
  state.data.otpData.responseBody = data;
483
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id });
484
483
  })
485
484
  .addCase(verifyPasswordLeadOTP.rejected, function (state, action) {
486
485
  state.loading = false;
@@ -514,7 +513,7 @@ export var passwordSlice = createSlice({
514
513
  .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
515
514
  state.error = null;
516
515
  state.loading = false;
517
- var data = action.payload || {};
516
+ var data = (action.payload || {}).data;
518
517
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
519
518
  })
520
519
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
@@ -522,11 +521,15 @@ export var passwordSlice = createSlice({
522
521
  state.loading = false;
523
522
  })
524
523
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
525
- var _a;
526
524
  state.loading = false;
527
525
  state.error = null;
528
- var _b = action.payload || {}, flows = _b.flows, data = _b.data;
529
- 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 });
526
+ var response = (action.payload || {}).response;
527
+ var flows = response.flows;
528
+ var _a = state.data.verify.responseBody || {}, individuals = _a.individuals, individualData = _a.individualData;
529
+ var data_state = (individualData || {}).data_state;
530
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
531
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
532
+ }));
530
533
  })
531
534
  .addCase(updateBoardSuccess.pending, function (state) {
532
535
  state.loading = true;
@@ -535,27 +538,20 @@ export var passwordSlice = createSlice({
535
538
  .addCase(updateBoardSuccess.rejected, function (state, action) {
536
539
  state.loading = false;
537
540
  state.error = action.error.message;
538
- })
539
- .addCase(retrieveBoardStatus.pending, function (state) {
540
- state.error = null;
541
- state.loading = true;
542
- })
543
- .addCase(retrieveBoardStatus.fulfilled, function (state, action) {
544
- state.error = null;
545
- state.loading = false;
546
- var flows = (action.payload || {}).flows;
547
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
548
- })
549
- .addCase(retrieveBoardStatus.rejected, function (state, action) {
550
- state.error = action.error.message;
551
- state.loading = false;
552
541
  })
553
542
  .addCase(verifyOperationToken.fulfilled, function (state, action) {
543
+ var _a;
554
544
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
555
545
  state.error = null;
556
546
  state.customLoading = false;
557
- var _a = action.payload, data = _a.data, token = _a.token, boardId = _a.boardId, boardInfoId = _a.boardInfoId, recipient = _a.recipient;
558
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId }), (recipient && { recipient: recipient }));
547
+ var _b = action.payload, data = _b.data, token = _b.token, boardId = _b.boardId, flows = _b.flows, boardResponse = _b.boardResponse, boardInfoId = _b.boardInfoId;
548
+ state.data.verify.responseBody = __assign(__assign(__assign({}, boardResponse), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId, flows: flows });
549
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
550
+ if (description) {
551
+ state.error = description;
552
+ return;
553
+ }
554
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId, flows: flows });
559
555
  state.data.verify.token = token;
560
556
  })
561
557
  .addCase(verifyOperationToken.pending, function (state) {
@@ -584,10 +580,16 @@ export var passwordSlice = createSlice({
584
580
  state.error = action.error.message;
585
581
  })
586
582
  .addCase(resetPassword.fulfilled, function (state, action) {
583
+ var _a;
587
584
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
588
585
  state.error = null;
589
586
  state.loading = false;
590
- var _a = action.payload, data = _a.data, formData = _a.formData;
587
+ var _b = action.payload, data = _b.data, formData = _b.formData;
588
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
589
+ if (description) {
590
+ state.error = description;
591
+ return;
592
+ }
591
593
  state.data.passwordData = formData;
592
594
  state.data.passwordData.responseBody = data;
593
595
  })
@@ -602,8 +604,13 @@ export var passwordSlice = createSlice({
602
604
  .addCase(retrieveBoardResetPasswordSuccess.fulfilled, function (state, action) {
603
605
  state.loading = false;
604
606
  state.error = null;
605
- var flows = (action.payload || {}).flows;
606
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
607
+ var response = (action.payload || {}).response;
608
+ var flows = response.flows;
609
+ var _a = state.data.verify.responseBody || {}, individuals = _a.individuals, individualData = _a.individualData;
610
+ var data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) ? individuals : individualData) || {}).data_state;
611
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
612
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
613
+ }));
607
614
  })
608
615
  .addCase(retrieveBoardResetPasswordSuccess.pending, function (state) {
609
616
  state.loading = true;