@tap-payments/auth-jsconnect 2.8.59-beta → 2.8.59-sandbox

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 (221) 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/components/Tooltip/Tooltip.js +1 -1
  8. package/build/constants/api.d.ts +0 -1
  9. package/build/constants/api.js +0 -2
  10. package/build/constants/app.d.ts +0 -1
  11. package/build/constants/app.js +0 -1
  12. package/build/features/app/bank/bankStore.d.ts +13 -18
  13. package/build/features/app/bank/bankStore.js +184 -165
  14. package/build/features/app/board/boardStore.js +52 -30
  15. package/build/features/app/brand/brandStore.d.ts +16 -33
  16. package/build/features/app/brand/brandStore.js +239 -242
  17. package/build/features/app/business/businessStore.d.ts +0 -5
  18. package/build/features/app/business/businessStore.js +76 -87
  19. package/build/features/app/connectExpress/connectExpressStore.d.ts +15 -6
  20. package/build/features/app/connectExpress/connectExpressStore.js +111 -52
  21. package/build/features/app/entity/entityStore.d.ts +20 -36
  22. package/build/features/app/entity/entityStore.js +196 -246
  23. package/build/features/app/individual/individualStore.d.ts +22 -38
  24. package/build/features/app/individual/individualStore.js +263 -266
  25. package/build/features/app/password/passwordStore.d.ts +40 -23
  26. package/build/features/app/password/passwordStore.js +226 -233
  27. package/build/features/app/tax/taxStore.d.ts +13 -7
  28. package/build/features/app/tax/taxStore.js +168 -147
  29. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +13 -1
  30. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -26
  31. package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +7 -1
  32. package/build/features/bank/Bank.d.ts +1 -0
  33. package/build/features/bank/Bank.js +7 -4
  34. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  35. package/build/features/bank/screens/OperatorError/OperatorError.d.ts +5 -0
  36. package/build/features/bank/screens/OperatorError/OperatorError.js +9 -0
  37. package/build/features/bank/screens/OperatorError/index.d.ts +3 -0
  38. package/build/features/bank/screens/OperatorError/index.js +2 -0
  39. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  40. package/build/features/bank/screens/Verify/Verify.js +5 -5
  41. package/build/features/board/Board.js +8 -4
  42. package/build/features/board/screens/OperatorError/OperatorError.d.ts +5 -0
  43. package/build/features/board/screens/OperatorError/OperatorError.js +9 -0
  44. package/build/features/board/screens/OperatorError/index.d.ts +3 -0
  45. package/build/features/board/screens/OperatorError/index.js +2 -0
  46. package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -4
  47. package/build/features/brand/Brand.d.ts +1 -0
  48. package/build/features/brand/Brand.js +7 -4
  49. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +8 -35
  50. package/build/features/brand/screens/BrandActivities/BrandActivities.js +49 -12
  51. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +3 -3
  52. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +6 -3
  53. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +5 -18
  54. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -1
  55. package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -7
  56. package/build/features/brand/screens/BrandActivities/TAC.js +1 -1
  57. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -1
  58. package/build/features/brand/screens/BrandInfo/BrandInfo.js +23 -5
  59. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +23 -7
  60. package/build/features/brand/screens/OperatorError/OperatorError.d.ts +5 -0
  61. package/build/features/brand/screens/OperatorError/OperatorError.js +9 -0
  62. package/build/features/brand/screens/OperatorError/index.d.ts +3 -0
  63. package/build/features/brand/screens/OperatorError/index.js +2 -0
  64. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  65. package/build/features/brand/screens/Verify/Verify.js +1 -1
  66. package/build/features/business/Business.js +9 -4
  67. package/build/features/business/screens/Activities/Activities.js +12 -3
  68. package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
  69. package/build/features/business/screens/Activities/OperationStartDate.d.ts +1 -1
  70. package/build/features/business/screens/BrandDetails/SalesChannel.d.ts +1 -1
  71. package/build/features/business/screens/BusinessType/BusinessType.js +10 -2
  72. package/build/features/business/screens/BusinessType/LicenseType.d.ts +4 -26
  73. package/build/features/business/screens/CivilID/CivilID.js +1 -1
  74. package/build/features/business/screens/Customers/CustomerLocations.d.ts +9 -36
  75. package/build/features/business/screens/Customers/Customers.js +12 -3
  76. package/build/features/business/screens/Customers/ExpectedSalesRange.js +6 -3
  77. package/build/features/business/screens/Customers/RefundPolicy.d.ts +5 -18
  78. package/build/features/business/screens/IDBOD/IDBOD.js +10 -2
  79. package/build/features/business/screens/OTP/OTP.js +1 -1
  80. package/build/features/business/screens/OperatorError/OperatorError.d.ts +5 -0
  81. package/build/features/business/screens/OperatorError/OperatorError.js +9 -0
  82. package/build/features/business/screens/OperatorError/index.d.ts +3 -0
  83. package/build/features/business/screens/OperatorError/index.js +2 -0
  84. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -2
  85. package/build/features/business/screens/Verify/Verify.js +13 -3
  86. package/build/features/connect/Connect.js +3 -2
  87. package/build/features/connect/screens/BrandSegment/BrandSegment.js +1 -1
  88. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +9 -2
  89. package/build/features/connect/screens/CivilID/CivilID.js +1 -1
  90. package/build/features/connect/screens/Individual/Email.js +3 -1
  91. package/build/features/connect/screens/Individual/Individual.js +1 -1
  92. package/build/features/connect/screens/Merchant/BrandList.js +3 -3
  93. package/build/features/connect/screens/Merchant/Merchant.js +1 -1
  94. package/build/features/connect/screens/Merchant/SalesChannels.js +1 -1
  95. package/build/features/connect/screens/Mobile/Mobile.js +11 -8
  96. package/build/features/connect/screens/NID/NID.js +1 -1
  97. package/build/features/connect/screens/OperatorError/OperatorError.js +1 -1
  98. package/build/features/connectExpress/ConnectExpress.js +2 -1
  99. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +5 -2
  100. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +9 -0
  101. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +90 -0
  102. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +6 -1
  103. package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +3 -0
  104. package/build/features/connectExpress/screens/AuthenticationList/validation.js +10 -0
  105. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +7 -1
  106. package/build/features/connectExpress/screens/CivilID/CivilID.js +1 -1
  107. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +1 -1
  108. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -1
  109. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +4 -26
  110. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +2 -7
  111. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +1 -1
  112. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -1
  113. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +14 -24
  114. package/build/features/connectExpress/screens/Mobile/Mobile.js +9 -2
  115. package/build/features/connectExpress/screens/NID/NID.js +1 -1
  116. package/build/features/connectExpress/screens/NID/TAC.d.ts +2 -7
  117. package/build/features/connectExpress/screens/NIDMissed/NID.js +1 -1
  118. package/build/features/connectExpress/screens/OperatorError/OperatorError.d.ts +5 -0
  119. package/build/features/connectExpress/screens/OperatorError/OperatorError.js +9 -0
  120. package/build/features/connectExpress/screens/OperatorError/index.d.ts +3 -0
  121. package/build/features/connectExpress/screens/OperatorError/index.js +2 -0
  122. package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.d.ts +5 -0
  123. package/build/features/connectExpress/screens/PrepareDataLoading/PrepareDataLoading.js +34 -0
  124. package/build/features/connectExpress/screens/PrepareDataLoading/index.d.ts +2 -0
  125. package/build/features/connectExpress/screens/PrepareDataLoading/index.js +2 -0
  126. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  127. package/build/features/entity/Entity.d.ts +1 -0
  128. package/build/features/entity/Entity.js +7 -4
  129. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -2
  130. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +8 -4
  131. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +8 -4
  132. package/build/features/entity/screens/EntityCapital/EntityCapital.js +34 -10
  133. package/build/features/entity/screens/EntityName/EntityName.js +32 -15
  134. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +8 -35
  135. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +1 -1
  136. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +1 -1
  137. package/build/features/entity/screens/OperatorError/OperatorError.d.ts +5 -0
  138. package/build/features/entity/screens/OperatorError/OperatorError.js +9 -0
  139. package/build/features/entity/screens/OperatorError/index.d.ts +3 -0
  140. package/build/features/entity/screens/OperatorError/index.js +2 -0
  141. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  142. package/build/features/entity/screens/Verify/Verify.js +1 -1
  143. package/build/features/featuresScreens.js +67 -7
  144. package/build/features/individual/Individual.d.ts +1 -0
  145. package/build/features/individual/Individual.js +7 -4
  146. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +1 -1
  147. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +54 -14
  148. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +14 -0
  149. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +76 -0
  150. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +5 -2
  151. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +4 -26
  152. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +8 -3
  153. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +4 -1
  154. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +3 -2
  155. package/build/features/individual/screens/IndividualList/Email.js +3 -2
  156. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +2 -2
  157. package/build/features/individual/screens/IndividualList/IndividualList.js +18 -5
  158. package/build/features/individual/screens/IndividualList/UserList.js +13 -9
  159. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +4 -2
  160. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +4 -26
  161. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +1 -1
  162. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +76 -20
  163. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
  164. package/build/features/individual/screens/OperatorError/OperatorError.d.ts +5 -0
  165. package/build/features/individual/screens/OperatorError/OperatorError.js +9 -0
  166. package/build/features/individual/screens/OperatorError/index.d.ts +3 -0
  167. package/build/features/individual/screens/OperatorError/index.js +2 -0
  168. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  169. package/build/features/individual/screens/Verify/Verify.js +1 -1
  170. package/build/features/password/Password.d.ts +1 -0
  171. package/build/features/password/Password.js +75 -28
  172. package/build/features/password/screens/CreatePassword/CreatePassword.js +8 -4
  173. package/build/features/password/screens/OTP/OTP.js +1 -1
  174. package/build/features/password/screens/OperatorError/OperatorError.d.ts +5 -0
  175. package/build/features/password/screens/OperatorError/OperatorError.js +9 -0
  176. package/build/features/password/screens/OperatorError/index.d.ts +3 -0
  177. package/build/features/password/screens/OperatorError/index.js +2 -0
  178. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  179. package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.js +10 -0
  180. package/build/features/password/screens/PrepareDataLoading/index.d.ts +2 -0
  181. package/build/features/password/screens/PrepareDataLoading/index.js +2 -0
  182. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  183. package/build/features/password/screens/Verify/Verify.js +5 -5
  184. package/build/features/shared/Address/CountryList.d.ts +7 -23
  185. package/build/features/shared/Address/InputSelect.d.ts +7 -23
  186. package/build/features/shared/Button/FlowsButtons.js +13 -3
  187. package/build/features/shared/Containers/FeatureContainer.d.ts +1 -0
  188. package/build/features/shared/Containers/FeatureContainer.js +3 -3
  189. package/build/features/shared/Input/Input.d.ts +2 -2
  190. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +5 -1
  191. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
  192. package/build/features/shared/UploadFile/FileUpload.d.ts +2 -7
  193. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -7
  194. package/build/features/shared/UploadFile/UploadWrapper.d.ts +2 -7
  195. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -7
  196. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -7
  197. package/build/features/signIn/SignIn.js +12 -3
  198. package/build/features/signIn/screens/OperatorError/OperatorError.d.ts +5 -0
  199. package/build/features/signIn/screens/OperatorError/OperatorError.js +9 -0
  200. package/build/features/signIn/screens/OperatorError/index.d.ts +3 -0
  201. package/build/features/signIn/screens/OperatorError/index.js +2 -0
  202. package/build/features/tax/Tax.d.ts +1 -0
  203. package/build/features/tax/Tax.js +7 -4
  204. package/build/features/tax/screens/OperatorError/OperatorError.d.ts +5 -0
  205. package/build/features/tax/screens/OperatorError/OperatorError.js +9 -0
  206. package/build/features/tax/screens/OperatorError/index.d.ts +3 -0
  207. package/build/features/tax/screens/OperatorError/index.js +2 -0
  208. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  209. package/build/features/tax/screens/TaxDetails/TaxDetails.js +7 -2
  210. package/build/features/tax/screens/Verify/Verify.js +5 -5
  211. package/build/hooks/index.d.ts +1 -0
  212. package/build/hooks/index.js +1 -0
  213. package/build/hooks/useFormDirtyCheck.d.ts +10 -0
  214. package/build/hooks/useFormDirtyCheck.js +66 -0
  215. package/build/hooks/useVerifyToken.d.ts +5 -2
  216. package/build/hooks/useVerifyToken.js +10 -5
  217. package/build/utils/common.js +3 -3
  218. package/build/utils/locale.js +2 -1
  219. package/build/utils/string.d.ts +5 -2
  220. package/build/utils/string.js +34 -5
  221. package/package.json +2 -2
@@ -62,14 +62,14 @@ import API from '../../../api';
62
62
  import { FlowsTypes } from '../../../@types';
63
63
  import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
64
64
  import { BRAND_STEP_NAMES, EXPECTED_SALES_LIST } from '../../../constants';
65
- import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sleep } from '../../../utils';
66
- export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
65
+ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
66
+ export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function (_a, thunkApi) {
67
67
  var token = _a.token, isInternally = _a.isInternally;
68
68
  return __awaiter(void 0, void 0, void 0, function () {
69
- var payload, data, countryIso2, _b, board_id, board_info_id, config, publicKey, salesChannels, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
70
- var _e, _f, _g, _h;
71
- return __generator(this, function (_j) {
72
- switch (_j.label) {
69
+ var payload, data, _b, config, brand_id, entity_id, board_id, country_code, publicKey, salesChannels, brandData, data_1;
70
+ var _c, _d, _e;
71
+ return __generator(this, function (_f) {
72
+ switch (_f.label) {
73
73
  case 0:
74
74
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
75
75
  notification: {
@@ -78,69 +78,47 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
78
78
  }));
79
79
  return [4, API.leadService.verifyLeadToken(payload)];
80
80
  case 1:
81
- data = (_j.sent()).data;
82
- if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
83
- throw new Error(data.errors[0].description);
84
- }
85
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
86
- if (countryIso2)
87
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
88
- _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
81
+ data = (_f.sent()).data;
82
+ 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))
83
+ throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
84
+ _b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id, board_id = _b.id, country_code = _b.country_code;
89
85
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
90
- if (publicKey) {
86
+ if (country_code)
87
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
88
+ if (publicKey)
91
89
  thunkApi.dispatch(handlePublicKey(publicKey));
92
- }
93
- if (!board_id) {
94
- throw new Error('Internal server error');
95
- }
96
- individualData = undefined;
90
+ brandData = undefined;
97
91
  if (isInternally)
98
92
  data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
99
93
  if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
100
- if (!board_info_id) return [3, 3];
101
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
94
+ if (!(!brand_id || !country_code)) return [3, 3];
95
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
102
96
  case 2:
103
- boardInfoData = _j.sent();
104
- _j.label = 3;
105
- case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
97
+ data_1 = _f.sent();
98
+ if (!country_code && ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country))
99
+ thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
100
+ if (!((_e = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand) === null || _e === void 0 ? void 0 : _e.id))
101
+ throw new Error('brand_id_missing');
102
+ brandData = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand;
103
+ return [3, 5];
104
+ case 3: return [4, API.brandService.retrieveBrand(brand_id)];
106
105
  case 4:
107
- boardData = _j.sent();
108
- _c = ((_e = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
109
- serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
110
- return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
111
- case 5:
112
- _d = _j.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
113
- boardData = boardRes;
114
- individualData = individualRes;
115
- if (!countryIso2 && ((_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country)) {
116
- countryIso2 = boardData.entity.country;
117
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
118
- }
119
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
106
+ brandData = _f.sent();
107
+ _f.label = 5;
108
+ case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
120
109
  case 6:
121
- salesChannels = _j.sent();
110
+ salesChannels = _f.sent();
122
111
  if (isInternally)
123
112
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
124
113
  else
125
114
  thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
126
- _j.label = 7;
115
+ _f.label = 7;
127
116
  case 7: return [2, {
128
117
  data: data,
129
- individualData: individualData,
130
- boardResponse: {
131
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
132
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
133
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
134
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
135
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
136
- name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
137
- contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
138
- individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
139
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
140
- notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
141
- },
118
+ brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
142
119
  salesChannels: salesChannels,
143
- token: token
120
+ token: token,
121
+ entityInfoId: entity_id
144
122
  }];
145
123
  }
146
124
  });
@@ -163,78 +141,58 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
163
141
  }
164
142
  });
165
143
  }); });
166
- export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
167
- var _a, brand, settings, responseBody, payload, data, countryIso2, publicKey, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, salesChannels;
168
- var _e, _f, _g, _h, _j, _k, _l, _m, _o;
169
- return __generator(this, function (_p) {
170
- switch (_p.label) {
144
+ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
145
+ var _a, brand, settings, responseBody, payload, data, publicKey, countryIso2, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
146
+ var _c, _d, _e, _f, _g, _h, _j;
147
+ return __generator(this, function (_k) {
148
+ switch (_k.label) {
171
149
  case 0:
172
150
  _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
173
151
  responseBody = brand.data.verify.responseBody;
174
152
  payload = {
175
153
  data: params.otp,
176
- service_name: (_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
154
+ service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
177
155
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
178
156
  step_name: BRAND_STEP_NAMES.PHONE_AUTH,
179
157
  encryption_contract: ['data']
180
158
  };
181
159
  return [4, API.leadService.verifyLeadOTP(payload)];
182
160
  case 1:
183
- data = (_p.sent()).data;
184
- if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
161
+ data = (_k.sent()).data;
162
+ if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
185
163
  throw new Error(data.errors[0].description);
186
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
164
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
165
+ countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
166
+ if (publicKey)
167
+ thunkApi.dispatch(handlePublicKey(publicKey));
187
168
  if (countryIso2)
188
169
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
189
- publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
190
- if (publicKey) {
191
- thunkApi.dispatch(handlePublicKey(publicKey));
192
- }
193
- _b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
194
- if (!board_id) {
195
- throw new Error('Internal server error');
196
- }
197
- individualData = undefined;
198
- if (!board_info_id) return [3, 3];
199
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
170
+ _b = data || {}, brand_id = _b.brand_id, entity_id = _b.entity_id, boardId = _b.id;
171
+ brandData = undefined;
172
+ if (!(!brand_id || !countryIso2)) return [3, 3];
173
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
200
174
  case 2:
201
- boardInfoData = _p.sent();
202
- _p.label = 3;
203
- case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
175
+ data_2 = _k.sent();
176
+ if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
177
+ thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
178
+ if (!((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _g === void 0 ? void 0 : _g.id))
179
+ throw new Error('brand_id_missing');
180
+ brandData = data_2;
181
+ return [3, 5];
182
+ case 3: return [4, API.brandService.retrieveBrand(brand_id)];
204
183
  case 4:
205
- boardData = _p.sent();
206
- _c = ((_h = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _h === void 0 ? void 0 : _h.recipient) || {}, id = _c.id, type = _c.type;
207
- serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
208
- return [4, retrieveIndividualData(type, boardData, serviceCallBack)];
209
- case 5:
210
- _d = _p.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
211
- boardData = boardRes;
212
- individualData = individualRes;
213
- if (!countryIso2 && ((_j = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _j === void 0 ? void 0 : _j.country)) {
214
- countryIso2 = boardData.entity.country;
215
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
216
- }
217
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
218
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
184
+ brandData = _k.sent();
185
+ _k.label = 5;
186
+ case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
219
187
  case 6:
220
- salesChannels = _p.sent();
188
+ salesChannels = _k.sent();
189
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
221
190
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
222
191
  return [2, {
223
192
  data: data,
224
- individualData: individualData,
225
- boardResponse: {
226
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
227
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
228
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
229
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
230
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
231
- name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
232
- contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
233
- individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
234
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
235
- notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
236
- },
193
+ brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
237
194
  salesChannels: salesChannels,
195
+ entityInfoId: entity_id,
238
196
  formData: params
239
197
  }];
240
198
  }
@@ -264,35 +222,52 @@ export var retrieveSegmentDataList = createAsyncThunk('brandRetrieveSegmentDataL
264
222
  }
265
223
  });
266
224
  }); });
267
- export var retrieveBoardStatus = createAsyncThunk('brand/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
268
- var brand, board_id, data;
269
- return __generator(this, function (_a) {
270
- switch (_a.label) {
225
+ export var retrieveBoardStatus = createAsyncThunk('brand/retrieveBoardStatus', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
226
+ var brand, _a, board_id, board_info_id, recipient, _b, id, type, data;
227
+ return __generator(this, function (_c) {
228
+ switch (_c.label) {
271
229
  case 0:
272
230
  brand = thunkApi.getState().brand;
273
- board_id = (brand.data.verify.responseBody || {}).board_id;
274
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
231
+ _a = brand.data.verify.responseBody || {}, board_id = _a.board_id, board_info_id = _a.board_info_id, recipient = _a.recipient;
232
+ if (!board_id || !board_info_id)
233
+ throw new Error('Internal server error');
234
+ _b = recipient || {}, id = _b.id, type = _b.type;
235
+ return [4, Promise.all([
236
+ API.boardService.retrieveBoardInfoStatus(board_id),
237
+ thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
238
+ ])];
275
239
  case 1:
276
- data = _a.sent();
240
+ data = (_c.sent())[0];
277
241
  thunkApi.dispatch(handlePrevScreenStep());
278
242
  return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
279
243
  }
280
244
  });
281
245
  }); });
282
- export var retrieveBoardDetails = createAsyncThunk('brandRetrieveBrandInfo', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
283
- var data;
284
- var _a, _b;
285
- return __generator(this, function (_c) {
286
- switch (_c.label) {
287
- case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
288
- case 1:
289
- data = _c.sent();
290
- return [2, {
291
- 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, board_status: data === null || data === void 0 ? void 0 : data.status })
292
- }];
293
- }
246
+ export var retrieveBoardDetails = createAsyncThunk('brand/retrieveBoardDetails', function (_a) {
247
+ var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
248
+ return __awaiter(void 0, void 0, void 0, function () {
249
+ var data, individualData, boardData, serviceCallBack, _b, boardRes, individualRes;
250
+ var _c, _d, _e;
251
+ return __generator(this, function (_f) {
252
+ switch (_f.label) {
253
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
254
+ case 1:
255
+ data = _f.sent();
256
+ individualData = data === null || data === void 0 ? void 0 : data.user;
257
+ boardData = data;
258
+ if (!(((_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.id) !== id)) return [3, 3];
259
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
260
+ return [4, retrieveIndividualData(type, data, serviceCallBack)];
261
+ case 2:
262
+ _b = _f.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
263
+ individualData = individualRes;
264
+ boardData = boardRes;
265
+ _f.label = 3;
266
+ 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, board_status: boardData === null || boardData === void 0 ? void 0 : boardData.status })];
267
+ }
268
+ });
294
269
  });
295
- }); });
270
+ });
296
271
  export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailability', function (_a, thunkApi) {
297
272
  var cancelToken = _a.cancelToken, name = _a.name, onSuccess = _a.onSuccess;
298
273
  return __awaiter(void 0, void 0, void 0, function () {
@@ -319,12 +294,12 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
319
294
  });
320
295
  });
321
296
  export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
322
- var formData = _a.formData, originalFormData = _a.originalFormData;
297
+ var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
323
298
  return __awaiter(void 0, void 0, void 0, function () {
324
- var _b, settings, brand, brandRes, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, salesChannels, brandName, brandLogoId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, _d, segmentLocation, segmentProfit, segmentTech, teamSizeList;
325
- var _e, _f;
326
- return __generator(this, function (_g) {
327
- switch (_g.label) {
299
+ var _b, settings, brand, brandRes, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, salesChannels, brandName, brandLogoId, brandData, getAddress, channel_services, brandNameIsEditable, requestBody, brand_1, _d, teamSizeList, _e, segmentLocation, segmentProfit, segmentTech, _f, _g, _h;
300
+ var _j, _k;
301
+ return __generator(this, function (_l) {
302
+ switch (_l.label) {
328
303
  case 0:
329
304
  _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
330
305
  brandRes = (brand.data.verify.responseBody || {}).brand;
@@ -333,6 +308,7 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
333
308
  isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
334
309
  isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
335
310
  salesChannels = formData.salesChannels, brandName = formData.brandName, brandLogoId = formData.brandLogoId;
311
+ brandData = brandRes;
336
312
  getAddress = function (value, isTwitter, isWeb) {
337
313
  if (isTwitter)
338
314
  return '@' + value.replaceAll('@', '');
@@ -359,17 +335,23 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
359
335
  ar: !isNameARNonEditable ? brandName : undefined
360
336
  }
361
337
  })), { logo: brandLogoId, channel_services: channel_services });
338
+ if (!isDirty) return [3, 2];
362
339
  return [4, API.brandService.updateBrandInfo(requestBody)];
363
340
  case 1:
364
- brandData = (_g.sent()).brand;
365
- return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
341
+ brand_1 = (_l.sent()).brand;
342
+ brandData = brand_1;
343
+ _l.label = 2;
366
344
  case 2:
367
- _d = _g.sent(), segmentLocation = _d.segmentLocation, segmentProfit = _d.segmentProfit, segmentTech = _d.segmentTech;
368
- return [4, API.dataService.getTeamSize({ page: 0 })];
369
- case 3:
370
- teamSizeList = _g.sent();
345
+ _g = (_f = Promise).all;
346
+ _h = [API.dataService.getTeamSize({ page: 0 })];
347
+ return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
348
+ case 3: return [4, _g.apply(_f, [_h.concat([
349
+ _l.sent()
350
+ ])])];
351
+ case 4:
352
+ _d = _l.sent(), teamSizeList = _d[0], _e = _d[1], segmentLocation = _e.segmentLocation, segmentProfit = _e.segmentProfit, segmentTech = _e.segmentTech;
371
353
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
372
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
354
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, id);
373
355
  return [2, {
374
356
  data: __assign({}, brandData),
375
357
  formData: originalFormData,
@@ -383,16 +365,16 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
383
365
  });
384
366
  });
385
367
  export var updateSegmentBrand = createAsyncThunk('brandUpdateBrandSegment', function (_a, thunkApi) {
386
- var formData = _a.formData, originalFormData = _a.originalFormData;
368
+ var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
387
369
  return __awaiter(void 0, void 0, void 0, function () {
388
- var _b, settings, brand, brandRes, _c, id, data_status, isSegmentLocationNonEditable, isSegmentProfitNonEditable, isSegmentTechNonEditable, isSegmentTeamsNonEditable, segmentLocation, segmentProfit, segmentTech, teamSize, segmentLocationId, segmentProfitId, segmentTechId, teamSizeId, hasSegment, requestBody, brandData, currencyData, activities, activityList;
389
- var _d, _e, _f;
370
+ var _b, settings, brand, _c, brandRes, entityInfoId, _d, id, data_status, isSegmentLocationNonEditable, isSegmentProfitNonEditable, isSegmentTechNonEditable, isSegmentTeamsNonEditable, segmentLocation, segmentProfit, segmentTech, teamSize, segmentLocationId, segmentProfitId, segmentTechId, teamSizeId, hasSegment, requestBody, entityData, brandData, brand_2, entity, activityList;
371
+ var _e, _f;
390
372
  return __generator(this, function (_g) {
391
373
  switch (_g.label) {
392
374
  case 0:
393
375
  _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
394
- brandRes = (brand.data.verify.responseBody || {}).brand;
395
- _c = brandRes || {}, id = _c.id, data_status = _c.data_status;
376
+ _c = brand.data.verify.responseBody || {}, brandRes = _c.brand, entityInfoId = _c.entityInfoId;
377
+ _d = brandRes || {}, id = _d.id, data_status = _d.data_status;
396
378
  isSegmentLocationNonEditable = hasNoneEditableValue(data_status, 'segment.location_type');
397
379
  isSegmentProfitNonEditable = hasNoneEditableValue(data_status, 'segment.profit_type');
398
380
  isSegmentTechNonEditable = hasNoneEditableValue(data_status, 'segment.tech_type');
@@ -406,29 +388,37 @@ export var updateSegmentBrand = createAsyncThunk('brandUpdateBrandSegment', func
406
388
  requestBody = __assign({ id: id }, (hasSegment && {
407
389
  segment: { location_type: segmentLocationId, profit_type: segmentProfitId, tech_type: segmentTechId, team: teamSizeId }
408
390
  }));
391
+ entityData = undefined;
392
+ brandData = brandRes;
393
+ if (!isDirty) return [3, 2];
409
394
  return [4, API.brandService.updateBrandInfo(requestBody)];
410
395
  case 1:
411
- brandData = (_g.sent()).brand;
412
- return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
396
+ brand_2 = (_g.sent()).brand;
397
+ brandData = brand_2;
398
+ _g.label = 2;
413
399
  case 2:
414
- currencyData = _g.sent();
415
- activities = (((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.entity) || {}).activities;
416
- return [4, thunkApi.dispatch(retrieveDataList())];
400
+ if (!entityInfoId) return [3, 4];
401
+ return [4, API.entityService.retrieveEntity(entityInfoId)];
417
402
  case 3:
418
- _g.sent();
419
- if (activities) {
420
- brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
403
+ entity = (_g.sent()).entity;
404
+ entityData = entity;
405
+ _g.label = 4;
406
+ case 4:
407
+ if (entityData === null || entityData === void 0 ? void 0 : entityData.activities) {
408
+ entityData = __assign(__assign({}, entityData), { entity_activities: entityData.activities });
421
409
  }
422
- if (!!activities) return [3, 5];
410
+ if (!!(entityData === null || entityData === void 0 ? void 0 : entityData.activities)) return [3, 6];
423
411
  return [4, API.dataService.getActivities()];
424
- case 4:
425
- activityList = (_g.sent()).list;
426
- brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
427
- _g.label = 5;
428
412
  case 5:
413
+ activityList = (_g.sent()).list;
414
+ entityData = __assign(__assign({}, entityData), { entity_activities: activityList });
415
+ _g.label = 6;
416
+ case 6: return [4, thunkApi.dispatch(retrieveDataList())];
417
+ case 7:
418
+ _g.sent();
429
419
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
430
420
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
431
- return [2, { data: __assign({}, brandData), formData: originalFormData, currencyData: currencyData }];
421
+ return [2, { data: __assign({}, brandData), entityData: entityData, formData: originalFormData }];
432
422
  }
433
423
  });
434
424
  });
@@ -445,15 +435,15 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
445
435
  });
446
436
  }); });
447
437
  export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (_a, thunkApi) {
448
- var formData = _a.formData, originalFormData = _a.originalFormData;
438
+ var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
449
439
  return __awaiter(void 0, void 0, void 0, function () {
450
- var _b, settings, brand, _c, brandRes, notification, _d, data_status, id, brandActivities, terms, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, isAllTermsAgreed, isTermsAvailable, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
451
- var _e, _f, _g, _h;
452
- return __generator(this, function (_j) {
453
- switch (_j.label) {
440
+ var _b, settings, brand, _c, brandRes, recipient, _d, data_status, id, brandActivities, terms, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, isAllTermsAgreed, isTermsAvailable, brandData, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brand_3;
441
+ var _e, _f, _g;
442
+ return __generator(this, function (_h) {
443
+ switch (_h.label) {
454
444
  case 0:
455
445
  _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
456
- _c = brand.data.verify.responseBody || {}, brandRes = _c.brand, notification = _c.notification;
446
+ _c = brand.data.verify.responseBody || {}, brandRes = _c.brand, recipient = _c.recipient;
457
447
  _d = brandRes || {}, data_status = _d.data_status, id = _d.id, brandActivities = _d.activities, terms = _d.terms;
458
448
  isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
459
449
  isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
@@ -464,9 +454,10 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
464
454
  isTermsUndefined = termAndConditionChecked === undefined && refundPolicy === undefined && transactionPolicy === undefined;
465
455
  isAllTermsAgreed = ((_e = terms === null || terms === void 0 ? void 0 : terms.filter(function (t) { return t === null || t === void 0 ? void 0 : t.agree; })) === null || _e === void 0 ? void 0 : _e.length) === 3;
466
456
  isTermsAvailable = !(isTermsNonEditable && isTermsUndefined) && !isAllTermsAgreed;
457
+ brandData = brandRes;
467
458
  removedActivities = (activities === null || activities === void 0 ? void 0 : activities.length) > 0 &&
468
459
  (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
469
- if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
460
+ if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0 && isDirty)) return [3, 2];
470
461
  payload = {
471
462
  id: id,
472
463
  activities: removedActivities.map(function (a) { return ({
@@ -475,11 +466,11 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
475
466
  };
476
467
  return [4, API.brandService.removeBrandActivity(payload)];
477
468
  case 1:
478
- _j.sent();
479
- _j.label = 2;
469
+ _h.sent();
470
+ _h.label = 2;
480
471
  case 2:
481
472
  requestBody = __assign(__assign({ id: id, activities: isActivitiesNonEditable ? undefined : (activities || []).map(function (a) { return ({ id: a.id }); }) }, (isTermsAvailable && {
482
- term_by: (_f = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _f === void 0 ? void 0 : _f.id,
473
+ term_by: recipient === null || recipient === void 0 ? void 0 : recipient.id,
483
474
  term: ['general', 'refund', 'chargeback']
484
475
  })), { step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES });
485
476
  customerLocation = (customerLocations || []).map(function (location) { return ({
@@ -493,11 +484,15 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
493
484
  if (salesId && !isSalesRangeNonEditable) {
494
485
  requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
495
486
  }
487
+ if (!isDirty) return [3, 4];
496
488
  return [4, API.brandService.updateBrandInfo(requestBody)];
497
489
  case 3:
498
- brandData = (_j.sent()).data;
490
+ brand_3 = (_h.sent()).brand;
491
+ brandData = brand_3;
492
+ _h.label = 4;
493
+ case 4:
499
494
  thunkApi.dispatch(handleNextScreenStep());
500
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
495
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
501
496
  return [2, { data: __assign({}, brandData), formData: originalFormData }];
502
497
  }
503
498
  });
@@ -534,39 +529,45 @@ export var retrieveDataList = createAsyncThunk('brandRetrieveDataList', function
534
529
  });
535
530
  }); });
536
531
  export var updateBoardSuccess = createAsyncThunk('updateBoardBrandSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
537
- var _a, settings, brand, _b, id, infoId, _c, showBoard, mode, payload, data, boardInfoData;
538
- var _d, _e, _f, _g, _h, _j, _k, _l;
539
- return __generator(this, function (_m) {
540
- switch (_m.label) {
532
+ var _a, settings, brand, _b, board_id, infoId, _c, showBoard, mode, payload, data, _d, id, type, boardInfoStatusData;
533
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o;
534
+ return __generator(this, function (_p) {
535
+ switch (_p.label) {
541
536
  case 0:
542
537
  _a = thunkApi.getState(), settings = _a.settings, brand = _a.brand;
543
- _b = brand.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
538
+ _b = brand.data.verify.responseBody || {}, board_id = _b.board_id, infoId = _b.board_info_id;
544
539
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
545
- if (!id)
540
+ if (!board_id)
546
541
  return [2];
547
542
  payload = {
548
543
  lang: settings.data.language,
549
- step_name: BRAND_STEP_NAMES.BRAND_SUCCESS,
550
- id: id
544
+ step_name: BRAND_STEP_NAMES.BRAND_SUCCESS
551
545
  };
552
- return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
546
+ return [4, API.boardService.updateBoardInfo(__assign({ id: board_id, infoId: infoId }, payload))];
553
547
  case 1:
554
- data = _m.sent();
548
+ data = _p.sent();
549
+ sendCustomEventToGTM({
550
+ event: 'Send Event',
551
+ event_category: 'Board Flows - Brand',
552
+ event_action: 'Brand Update Success Page',
553
+ event_label: settings.data.businessCountry.iso2
554
+ });
555
555
  if (!showBoard && mode === 'content') {
556
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
557
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
558
- return [2, { response: __assign({}, data), formData: params }];
556
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
557
+ (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
558
+ return [2, { data: data }];
559
559
  }
560
- return [4, API.boardService.retrieveBoardInfoStatus(id)];
560
+ _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;
561
+ return [4, Promise.all([
562
+ API.boardService.retrieveBoardInfoStatus(board_id),
563
+ thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
564
+ ])];
561
565
  case 2:
562
- boardInfoData = _m.sent();
563
- return [4, thunkApi.dispatch(retrieveBoardDetails(id)).unwrap()];
564
- case 3:
565
- _m.sent();
566
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, {});
567
- (_l = (_k = settings.data.appConfig).onFlowCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, { data: data });
566
+ boardInfoStatusData = (_p.sent())[0];
567
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, {});
568
+ (_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, { data: data });
568
569
  thunkApi.dispatch(handleNextScreenStep());
569
- return [2, { response: __assign(__assign({}, data), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [] }), formData: params }];
570
+ return [2, { data: data, flows: (boardInfoStatusData === null || boardInfoStatusData === void 0 ? void 0 : boardInfoStatusData.info) || [] }];
570
571
  }
571
572
  });
572
573
  }); });
@@ -592,7 +593,6 @@ var initialState = {
592
593
  uploadingBrandLogo: false,
593
594
  data: {
594
595
  flowName: FlowsTypes.BRAND,
595
- currency: '',
596
596
  verify: {
597
597
  token: ''
598
598
  },
@@ -648,22 +648,18 @@ export var brandSlice = createSlice({
648
648
  state.customLoading = true;
649
649
  })
650
650
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
651
- var _a, _b;
651
+ var _a, _b, _c;
652
652
  state.error = null;
653
653
  state.customLoading = false;
654
- var _c = action.payload, data = _c.data, token = _c.token, boardResponse = _c.boardResponse, salesChannels = _c.salesChannels, individualData = _c.individualData;
655
- var brand = boardResponse.brand, entity = boardResponse.entity;
654
+ var _d = action.payload, data = _d.data, brand = _d.brandData, token = _d.token, salesChannels = _d.salesChannels, entityInfoId = _d.entityInfoId;
656
655
  state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
657
- (_b = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _b === void 0 ? void 0 : _b.forEach(function (element) {
658
- if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
659
- state.data.brandActivities.termAndConditionChecked = element.agree;
660
- state.data.brandActivities.transactionPolicy = element.agree;
661
- state.data.brandActivities.refundPolicy = element.agree;
662
- }
663
- });
656
+ var termFlag = ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _b === void 0 ? void 0 : _b.find(function (element) { return (element === null || element === void 0 ? void 0 : element.term) === 'general'; })) === null || _c === void 0 ? void 0 : _c.agree) || false;
657
+ state.data.brandActivities.termAndConditionChecked = termFlag;
658
+ state.data.brandActivities.transactionPolicy = termFlag;
659
+ state.data.brandActivities.refundPolicy = termFlag;
664
660
  var mappedSalesChannels = mapSalesChannel((brand === null || brand === void 0 ? void 0 : brand.channel_services) || []);
665
661
  state.data.brandData.salesChannels = mappedSalesChannels;
666
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, activities: entity === null || entity === void 0 ? void 0 : entity.activities, individualData: individualData });
662
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { brand: brand, board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, entityInfoId: entityInfoId });
667
663
  state.data.verify.token = token;
668
664
  })
669
665
  .addCase(verifyLeadToken.rejected, function (state, action) {
@@ -686,24 +682,20 @@ export var brandSlice = createSlice({
686
682
  state.error = null;
687
683
  })
688
684
  .addCase(verifyBrandLeadOTP.fulfilled, function (state, action) {
689
- var _a, _b;
685
+ var _a, _b, _c;
690
686
  state.loading = false;
691
687
  state.error = null;
692
- var _c = action.payload, data = _c.data, boardResponse = _c.boardResponse, formData = _c.formData, salesChannels = _c.salesChannels, individualData = _c.individualData;
693
- var brand = boardResponse.brand, entity = boardResponse.entity;
688
+ var _d = action.payload, data = _d.data, brand = _d.brandData, formData = _d.formData, salesChannels = _d.salesChannels, entityInfoId = _d.entityInfoId;
694
689
  state.data.otpData = formData;
695
690
  state.data.otpData.responseBody = data;
696
691
  state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
697
692
  var mappedSalesChannels = mapSalesChannel((brand === null || brand === void 0 ? void 0 : brand.channel_services) || []);
698
693
  state.data.brandData.salesChannels = mappedSalesChannels;
699
- (_b = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _b === void 0 ? void 0 : _b.forEach(function (element) {
700
- if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
701
- state.data.brandActivities.termAndConditionChecked = element.agree;
702
- state.data.brandActivities.transactionPolicy = element.agree;
703
- state.data.brandActivities.refundPolicy = element.agree;
704
- }
705
- });
706
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], activities: entity === null || entity === void 0 ? void 0 : entity.activities, salesChannels: mappedSalesChannels, individualData: individualData });
694
+ var termFlag = ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _b === void 0 ? void 0 : _b.find(function (element) { return (element === null || element === void 0 ? void 0 : element.term) === 'general'; })) === null || _c === void 0 ? void 0 : _c.agree) || false;
695
+ state.data.brandActivities.termAndConditionChecked = termFlag;
696
+ state.data.brandActivities.transactionPolicy = termFlag;
697
+ state.data.brandActivities.refundPolicy = termFlag;
698
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { brand: brand, board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, entityInfoId: entityInfoId });
707
699
  })
708
700
  .addCase(verifyBrandLeadOTP.rejected, function (state, action) {
709
701
  state.loading = false;
@@ -732,27 +724,32 @@ export var brandSlice = createSlice({
732
724
  var _a = action.payload, data = _a.data, formData = _a.formData, segmentLocationList = _a.segmentLocationList, segmentProfitList = _a.segmentProfitList, segmentTechList = _a.segmentTechList, teamSizeList = _a.teamSizeList;
733
725
  var segment = data.segment;
734
726
  state.data.brandData = formData;
735
- var selectedSegmentLocation = segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList.find(function (location) {
727
+ var selectedSegmentLocation = (segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList.find(function (location) {
736
728
  var _a;
737
729
  return location.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.location_type) === null || _a === void 0 ? void 0 : _a.id);
738
- });
739
- var selectedSegmentProfit = segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList.find(function (profit) {
730
+ })) || (segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList[0]);
731
+ var selectedSegmentProfit = (segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList.find(function (profit) {
740
732
  var _a;
741
733
  return profit.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.profit_type) === null || _a === void 0 ? void 0 : _a.id);
742
- });
743
- var selectedSegmentTech = segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList.find(function (tech) {
734
+ })) || (segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList[0]);
735
+ var selectedSegmentTech = (segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList.find(function (tech) {
744
736
  var _a;
745
737
  return tech.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.tech_type) === null || _a === void 0 ? void 0 : _a.id);
746
- });
738
+ })) || (segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList[1]);
747
739
  var selectedTeamSize = teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.find(function (team) {
748
740
  var _a;
749
741
  return team.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.team) === null || _a === void 0 ? void 0 : _a.id);
750
742
  });
751
- state.data.brandSegmentData.segmentLocation = selectedSegmentLocation || (segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList[0]);
752
- state.data.brandSegmentData.segmentProfit = selectedSegmentProfit || (segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList[0]);
753
- state.data.brandSegmentData.segmentTech = selectedSegmentTech || (segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList[1]);
743
+ state.data.brandSegmentData.segmentLocation = selectedSegmentLocation;
744
+ state.data.brandSegmentData.segmentProfit = selectedSegmentProfit;
745
+ state.data.brandSegmentData.segmentTech = selectedSegmentTech;
754
746
  state.data.brandSegmentData.teamSize = selectedTeamSize;
755
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { teamSizeList: teamSizeList, segmentLocationList: segmentLocationList, segmentProfitList: segmentProfitList, segmentTechList: segmentTechList });
747
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { brand: data, teamSizeList: teamSizeList, segmentLocationList: segmentLocationList, segmentProfitList: segmentProfitList, segmentTechList: segmentTechList, segmentDefaultValues: {
748
+ segmentLocation: selectedSegmentLocation,
749
+ segmentProfit: selectedSegmentProfit,
750
+ segmentTech: selectedSegmentTech,
751
+ teamSize: selectedTeamSize
752
+ } });
756
753
  })
757
754
  .addCase(updateBrand.rejected, function (state, action) {
758
755
  state.loading = false;
@@ -766,14 +763,13 @@ export var brandSlice = createSlice({
766
763
  var _a;
767
764
  state.loading = false;
768
765
  state.error = null;
769
- var _b = action.payload, data = _b.data, formData = _b.formData, currencyData = _b.currencyData;
770
- var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations, terms = data.terms;
766
+ var _b = action.payload, data = _b.data, entityData = _b.entityData, formData = _b.formData;
767
+ var activities = data.activities, operations = data.operations, terms = data.terms;
768
+ var entity_activities = (entityData || {}).entity_activities;
771
769
  var selectedActivity = entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
772
770
  return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
773
771
  });
774
772
  state.data.brandSegmentData = formData;
775
- if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
776
- state.data.currency = currencyData.code.english;
777
773
  state.data.brandActivities.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
778
774
  var _c = operations || {}, customer_base = _c.customer_base, sales = _c.sales;
779
775
  var _d = customer_base || {}, locations = _d.locations, customerBase = __rest(_d, ["locations"]);
@@ -783,14 +779,19 @@ export var brandSlice = createSlice({
783
779
  state.data.brandActivities.expectedSale = sales;
784
780
  if (!!customerBase)
785
781
  state.data.brandActivities.expectedCustomer = customerBase;
786
- terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
787
- if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
788
- state.data.brandActivities.termAndConditionChecked = element.agree;
789
- state.data.brandActivities.transactionPolicy = element.agree;
790
- state.data.brandActivities.refundPolicy = element.agree;
791
- }
792
- });
793
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activities: entity_activities });
782
+ var termFlag = ((_a = terms === null || terms === void 0 ? void 0 : terms.find(function (element) { return (element === null || element === void 0 ? void 0 : element.term) === 'general'; })) === null || _a === void 0 ? void 0 : _a.agree) || false;
783
+ state.data.brandActivities.termAndConditionChecked = termFlag;
784
+ state.data.brandActivities.transactionPolicy = termFlag;
785
+ state.data.brandActivities.refundPolicy = termFlag;
786
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { activities: entity_activities }), (entityData && { entity: entityData })), { activitiesDefaultValues: {
787
+ activities: selectedActivity,
788
+ customerLocations: locations,
789
+ expectedSale: sales,
790
+ expectedCustomer: customerBase,
791
+ termAndConditionChecked: termFlag,
792
+ transactionPolicy: termFlag,
793
+ refundPolicy: termFlag
794
+ }, segmentDefaultValues: formData });
794
795
  })
795
796
  .addCase(updateSegmentBrand.rejected, function (state, action) {
796
797
  state.loading = false;
@@ -844,7 +845,7 @@ export var brandSlice = createSlice({
844
845
  .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
845
846
  state.error = null;
846
847
  state.loading = false;
847
- var data = (action.payload || {}).data;
848
+ var data = action.payload || {};
848
849
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
849
850
  })
850
851
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
@@ -858,7 +859,7 @@ export var brandSlice = createSlice({
858
859
  .addCase(retrieveBoardStatus.fulfilled, function (state, action) {
859
860
  state.error = null;
860
861
  state.loading = false;
861
- var flows = action.payload.flows;
862
+ var flows = (action.payload || {}).flows;
862
863
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
863
864
  })
864
865
  .addCase(retrieveBoardStatus.rejected, function (state, action) {
@@ -869,12 +870,8 @@ export var brandSlice = createSlice({
869
870
  var _a;
870
871
  state.loading = false;
871
872
  state.error = null;
872
- var flows = (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.response) || {}).flows;
873
- var _b = state.data.verify.responseBody || {}, individuals = _b.individuals, individualData = _b.individualData;
874
- var data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) ? individuals : individualData) || {}).data_state;
875
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
876
- individuals: __assign(__assign({}, individuals), { data_state: data_state })
877
- }));
873
+ var _b = action.payload || {}, flows = _b.flows, data = _b.data;
874
+ 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 });
878
875
  })
879
876
  .addCase(updateBoardSuccess.pending, function (state) {
880
877
  state.loading = true;