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