@tap-payments/auth-jsconnect 2.0.45 → 2.0.46

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 (203) hide show
  1. package/build/@types/app.d.ts +47 -2
  2. package/build/@types/app.js +22 -0
  3. package/build/@types/form.d.ts +19 -1
  4. package/build/@types/index.d.ts +1 -0
  5. package/build/@types/index.js +1 -0
  6. package/build/@types/user.d.ts +141 -0
  7. package/build/@types/user.js +1 -0
  8. package/build/api/board.d.ts +16 -0
  9. package/build/api/board.js +10 -1
  10. package/build/api/country.d.ts +4 -0
  11. package/build/api/country.js +9 -1
  12. package/build/api/entity.d.ts +3 -3
  13. package/build/api/index.d.ts +8 -3
  14. package/build/api/individual.d.ts +54 -4
  15. package/build/api/individual.js +9 -1
  16. package/build/api/user.d.ts +6 -0
  17. package/build/api/user.js +9 -1
  18. package/build/app/settings.js +11 -8
  19. package/build/assets/locales/ar.json +28 -2
  20. package/build/assets/locales/en.json +28 -1
  21. package/build/components/SimpleList/SimpleList.d.ts +2 -0
  22. package/build/constants/api.d.ts +1 -0
  23. package/build/constants/api.js +3 -1
  24. package/build/constants/app.d.ts +1 -0
  25. package/build/constants/app.js +20 -7
  26. package/build/constants/assets.d.ts +4 -0
  27. package/build/constants/assets.js +4 -0
  28. package/build/features/app/bank/bankStore.d.ts +1 -0
  29. package/build/features/app/bank/bankStore.js +19 -13
  30. package/build/features/app/brand/brandStore.d.ts +2 -0
  31. package/build/features/app/brand/brandStore.js +69 -49
  32. package/build/features/app/business/businessStore.js +3 -3
  33. package/build/features/app/connect/connectStore.js +6 -6
  34. package/build/features/app/connectExpress/connectExpressStore.js +15 -9
  35. package/build/features/app/entity/entityStore.d.ts +2 -0
  36. package/build/features/app/entity/entityStore.js +5 -3
  37. package/build/features/app/individual/individualStore.d.ts +93 -4
  38. package/build/features/app/individual/individualStore.js +613 -129
  39. package/build/features/app/password/passwordStore.js +2 -2
  40. package/build/features/app/tax/taxStore.js +30 -29
  41. package/build/features/bank/Bank.js +2 -2
  42. package/build/features/bank/screens/BankDetails/BankDetails.js +8 -7
  43. package/build/features/bank/screens/BankDetails/BankName.js +13 -10
  44. package/build/features/bank/screens/BankDetails/BankStatement.js +8 -2
  45. package/build/features/bank/screens/BankDetails/Beneficiary.js +12 -13
  46. package/build/features/bank/screens/BankDetails/IBAN.js +14 -10
  47. package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
  48. package/build/features/bank/screens/BankDetails/validation.js +34 -15
  49. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  50. package/build/features/brand/Brand.js +2 -2
  51. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -3
  52. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +8 -6
  53. package/build/features/brand/screens/BrandActivities/BrandActivities.js +12 -2
  54. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -2
  55. package/build/features/brand/screens/BrandActivities/CustomerBase.js +9 -6
  56. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +10 -7
  57. package/build/features/brand/screens/BrandActivities/validation.d.ts +7 -7
  58. package/build/features/brand/screens/BrandActivities/validation.js +26 -15
  59. package/build/features/brand/screens/BrandInfo/BrandInfo.js +11 -4
  60. package/build/features/brand/screens/BrandInfo/BrandName.js +13 -12
  61. package/build/features/brand/screens/BrandInfo/SalesChannels.js +21 -9
  62. package/build/features/brand/screens/BrandInfo/validation.d.ts +7 -7
  63. package/build/features/brand/screens/BrandInfo/validation.js +46 -36
  64. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  65. package/build/features/business/Business.js +2 -2
  66. package/build/features/business/screens/Activities/ActivitiesList.d.ts +3 -3
  67. package/build/features/business/screens/BusinessType/LicenseCertificate.js +2 -1
  68. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  69. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  70. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  71. package/build/features/connect/Connect.js +2 -2
  72. package/build/features/connect/screens/Merchant/BrandList.js +4 -4
  73. package/build/features/connect/screens/Merchant/BrandName.js +6 -5
  74. package/build/features/connect/screens/Merchant/validation.js +2 -2
  75. package/build/features/connectExpress/ConnectExpress.js +2 -2
  76. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +1 -3
  77. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  78. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +5 -5
  79. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +23 -3
  80. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -3
  81. package/build/features/entity/Entity.js +2 -2
  82. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +3 -3
  83. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +3 -3
  84. package/build/features/entity/screens/EntityName/LicenseCertificate.js +9 -3
  85. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  86. package/build/features/featuresScreens.js +10 -0
  87. package/build/features/individual/Individual.js +2 -2
  88. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +13 -0
  89. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +48 -25
  90. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +6 -1
  91. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +9 -2
  92. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -17
  93. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -16
  94. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  95. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +9 -2
  96. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +6 -0
  97. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +35 -0
  98. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +6 -0
  99. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +41 -0
  100. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +8 -2
  101. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +9 -6
  102. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +25 -23
  103. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +19 -25
  104. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.d.ts +10 -0
  105. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.js +31 -0
  106. package/build/features/individual/screens/IndividualList/Email.d.ts +6 -0
  107. package/build/features/individual/screens/IndividualList/Email.js +48 -0
  108. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +31 -0
  109. package/build/features/individual/screens/IndividualList/IndividualList.js +58 -0
  110. package/build/features/individual/screens/IndividualList/MobileNumber.d.ts +12 -0
  111. package/build/features/individual/screens/IndividualList/MobileNumber.js +143 -0
  112. package/build/features/individual/screens/IndividualList/UserList.d.ts +5 -0
  113. package/build/features/individual/screens/IndividualList/UserList.js +186 -0
  114. package/build/features/individual/screens/IndividualList/index.d.ts +3 -0
  115. package/build/features/individual/screens/IndividualList/index.js +2 -0
  116. package/build/features/individual/screens/IndividualList/validation.d.ts +12 -0
  117. package/build/features/individual/screens/IndividualList/validation.js +39 -0
  118. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +8 -0
  119. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +109 -0
  120. package/build/features/individual/screens/{AdditionalIndividualInfo/EmployerLocation.d.ts → IndividualPersonalInfo/BirthCountry.d.ts} +2 -2
  121. package/build/features/individual/screens/{AdditionalIndividualInfo/EmployerLocation.js → IndividualPersonalInfo/BirthCountry.js} +14 -24
  122. package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +7 -0
  123. package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +46 -0
  124. package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +6 -0
  125. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +50 -0
  126. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +7 -0
  127. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +50 -0
  128. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +34 -0
  129. package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +81 -0
  130. package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +6 -0
  131. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +48 -0
  132. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +21 -0
  133. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +139 -0
  134. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +10 -0
  135. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +88 -0
  136. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +10 -0
  137. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +145 -0
  138. package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +6 -0
  139. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +52 -0
  140. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +10 -0
  141. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +88 -0
  142. package/build/features/individual/screens/IndividualPersonalInfo/index.d.ts +3 -0
  143. package/build/features/individual/screens/IndividualPersonalInfo/index.js +2 -0
  144. package/build/features/individual/screens/IndividualPersonalInfo/validation.d.ts +38 -0
  145. package/build/features/individual/screens/IndividualPersonalInfo/validation.js +68 -0
  146. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  147. package/build/features/individual/screens/Verify/Verify.js +10 -17
  148. package/build/features/password/Password.js +2 -2
  149. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  150. package/build/features/shared/Address/Address.d.ts +6 -1
  151. package/build/features/shared/Address/Address.js +40 -30
  152. package/build/features/shared/Address/CountryList.d.ts +1 -1
  153. package/build/features/shared/Address/InputSelect.d.ts +1 -1
  154. package/build/features/shared/Address/InputText.d.ts +2 -1
  155. package/build/features/shared/Address/InputText.js +2 -2
  156. package/build/features/shared/Button/Button.js +11 -0
  157. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  158. package/build/features/shared/Button/FlowsButtons.js +5 -5
  159. package/build/features/shared/Button/ListButton.d.ts +18 -0
  160. package/build/features/shared/Button/ListButton.js +125 -0
  161. package/build/features/shared/Button/index.d.ts +2 -1
  162. package/build/features/shared/Button/index.js +2 -1
  163. package/build/features/shared/CreateAccountLoading/CreateAccountLoading.d.ts +2 -1
  164. package/build/features/shared/CreateAccountLoading/CreateAccountLoading.js +2 -2
  165. package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
  166. package/build/features/shared/SalesChannels/SalesChannel.js +2 -2
  167. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
  168. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +8 -6
  169. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +6 -1
  170. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +33 -11
  171. package/build/features/signIn/SignIn.js +2 -2
  172. package/build/features/tax/Tax.js +2 -2
  173. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  174. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -1
  175. package/build/features/tax/screens/TaxDetails/TaxDocument.js +8 -2
  176. package/build/features/tax/screens/TaxDetails/VATId.js +8 -3
  177. package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
  178. package/build/features/tax/screens/TaxDetails/validation.js +10 -5
  179. package/build/utils/array.d.ts +1 -0
  180. package/build/utils/array.js +10 -2
  181. package/build/utils/common.d.ts +1 -0
  182. package/build/utils/common.js +6 -0
  183. package/build/utils/date.d.ts +1 -0
  184. package/build/utils/date.js +7 -1
  185. package/build/utils/error.d.ts +1 -0
  186. package/build/utils/error.js +3 -0
  187. package/build/utils/html.d.ts +1 -1
  188. package/build/utils/html.js +4 -1
  189. package/build/utils/index.d.ts +1 -0
  190. package/build/utils/index.js +1 -0
  191. package/build/utils/string.d.ts +15 -2
  192. package/build/utils/string.js +37 -3
  193. package/build/utils/validation.d.ts +1 -0
  194. package/build/utils/validation.js +3 -0
  195. package/package.json +129 -129
  196. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.d.ts +0 -6
  197. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +0 -46
  198. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.d.ts +0 -19
  199. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +0 -52
  200. package/build/features/individual/screens/ShowIndividualInfo/index.d.ts +0 -3
  201. package/build/features/individual/screens/ShowIndividualInfo/index.js +0 -2
  202. package/build/features/individual/screens/ShowIndividualInfo/info.d.ts +0 -7
  203. package/build/features/individual/screens/ShowIndividualInfo/info.js +0 -28
@@ -93,7 +93,7 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
93
93
  _e.label = 5;
94
94
  case 5: return [2, {
95
95
  data: data,
96
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names, contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
96
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names, contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
97
97
  token: token
98
98
  }];
99
99
  }
@@ -125,7 +125,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
125
125
  case 1:
126
126
  data = _c.sent();
127
127
  return [2, {
128
- 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, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
128
+ 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 })
129
129
  }];
130
130
  }
131
131
  });
@@ -48,8 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
52
- import { hasKey } from '../../../utils';
51
+ import { FieldType, FlowsTypes } from '../../../@types';
53
52
  import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2 } from '../../../app/settings';
54
53
  import { TAX_STEP_NAMES } from '../../../constants';
55
54
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
@@ -97,7 +96,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
97
96
  }
98
97
  return [2, {
99
98
  data: data,
100
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
99
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
101
100
  token: token
102
101
  }];
103
102
  }
@@ -133,10 +132,10 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', functi
133
132
  });
134
133
  }); });
135
134
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
136
- var _a, tax, settings, responseBody, payload, data, steps, hasTaxCompleted;
137
- var _b, _c, _d, _e, _f;
138
- return __generator(this, function (_g) {
139
- switch (_g.label) {
135
+ var _a, tax, settings, responseBody, payload, data, flows, hasTaxCompleted;
136
+ var _b, _c, _d, _e, _f, _g;
137
+ return __generator(this, function (_h) {
138
+ switch (_h.label) {
140
139
  case 0:
141
140
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
142
141
  responseBody = tax.data.verify.responseBody;
@@ -149,43 +148,45 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
149
148
  };
150
149
  return [4, API.leadService.verifyLeadOTP(payload)];
151
150
  case 1:
152
- data = (_g.sent()).data;
151
+ data = (_h.sent()).data;
153
152
  if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
154
153
  throw new Error(data.errors[0].description);
155
154
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
156
- steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
157
- hasTaxCompleted = hasKey(steps, TAX_STEP_NAMES.TAX_SUCCESS);
155
+ flows = (responseBody || {}).flows;
156
+ hasTaxCompleted = ((_f = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'tax'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
158
157
  if (!hasTaxCompleted) return [3, 3];
159
- return [4, thunkApi.dispatch(retrieveEntityInfo((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.id))];
158
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_g = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _g === void 0 ? void 0 : _g.id))];
160
159
  case 2:
161
- _g.sent();
160
+ _h.sent();
162
161
  thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
163
162
  return [3, 4];
164
163
  case 3:
165
164
  thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
166
- _g.label = 4;
165
+ _h.label = 4;
167
166
  case 4: return [2, { data: data, formData: params }];
168
167
  }
169
168
  });
170
169
  }); });
171
170
  export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
172
- var _a, settings, tax, entityId, requestBody, data, documentBody, _b;
173
- var _c, _d, _e, _f, _g;
174
- return __generator(this, function (_h) {
175
- switch (_h.label) {
171
+ var _a, settings, tax, entity, entityId, isTaxNumberEditable, requestBody, data, documentBody, _b;
172
+ var _c, _d, _e, _f;
173
+ return __generator(this, function (_g) {
174
+ switch (_g.label) {
176
175
  case 0:
177
176
  _a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
178
- entityId = (_d = (_c = tax.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id;
177
+ entity = (tax.data.verify.responseBody || {}).entity;
178
+ entityId = entity === null || entity === void 0 ? void 0 : entity.id;
179
+ isTaxNumberEditable = ((_c = entity === null || entity === void 0 ? void 0 : entity.data_status) === null || _c === void 0 ? void 0 : _c.tax_number) === FieldType.EDITABLE;
179
180
  requestBody = {
180
181
  id: entityId,
181
- vat_id: params.vatId,
182
+ vat_id: isTaxNumberEditable ? params.vatId : undefined,
182
183
  step_name: TAX_STEP_NAMES.TAX_INFO,
183
184
  is_vat_acknowledged: params.confirmPolicy
184
185
  };
185
186
  return [4, API.entityService.updateEntityInfo(requestBody)];
186
187
  case 1:
187
- data = (_h.sent()).data;
188
- if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
188
+ data = (_g.sent()).data;
189
+ if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
189
190
  throw new Error(data.errors[0].description);
190
191
  if (!((params.documentId || []).length > 0)) return [3, 3];
191
192
  documentBody = {
@@ -199,11 +200,11 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
199
200
  _b = data;
200
201
  return [4, API.entityService.updateDocumentInfo(documentBody)];
201
202
  case 2:
202
- _b.documentData = _h.sent();
203
- _h.label = 3;
203
+ _b.documentData = _g.sent();
204
+ _g.label = 3;
204
205
  case 3:
205
206
  thunkApi.dispatch(handleNextScreenStep());
206
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
207
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
207
208
  return [2, { data: data, formData: params }];
208
209
  }
209
210
  });
@@ -235,7 +236,7 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
235
236
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
236
237
  thunkApi.dispatch(handleNextScreenStep());
237
238
  return [2, {
238
- response: __assign(__assign({}, data), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
239
+ response: __assign(__assign({}, data), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
239
240
  formData: params
240
241
  }];
241
242
  }
@@ -282,8 +283,8 @@ export var taxSlice = createSlice({
282
283
  state.error = null;
283
284
  state.customLoading = false;
284
285
  var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
285
- var user = boardResponse.user, bank_account = boardResponse.bank_account, vatID = boardResponse.vatID, merchant = boardResponse.merchant;
286
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant });
286
+ var user = boardResponse.user, bank_account = boardResponse.bank_account, vatID = boardResponse.vatID, merchant = boardResponse.merchant, individuals = boardResponse.individuals;
287
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant, individuals: individuals });
287
288
  state.data.verify.token = token;
288
289
  state.data.taxData.vatId = vatID;
289
290
  })
@@ -373,8 +374,8 @@ export var taxSlice = createSlice({
373
374
  state.error = description;
374
375
  return;
375
376
  }
376
- var flows = response.flows, steps = response.steps, user = response.user, bank_account = response.bank_account, vatID = response.vatID, merchant = response.merchant;
377
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user === null || user === void 0 ? void 0 : user.names, vatID: vatID, merchant: merchant });
377
+ var flows = response.flows, steps = response.steps, user = response.user, bank_account = response.bank_account, vatID = response.vatID, merchant = response.merchant, individuals = response.individuals, entity = response.entity, brand = response.brand;
378
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user === null || user === void 0 ? void 0 : user.names, vatID: vatID, merchant: merchant, individuals: individuals, entity: entity, brand: brand });
378
379
  })
379
380
  .addCase(updateLeadSuccess.pending, function (state) {
380
381
  state.loading = true;
@@ -29,7 +29,7 @@ import AnimationFlow from '../../components/AnimationFlow';
29
29
  import { store } from '../../app/store';
30
30
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
31
31
  import Collapse from '../../components/Collapse';
32
- import { createElementAndInject } from '../../utils';
32
+ import { findOrCreateElementAndInject } from '../../utils';
33
33
  import { FeatureContainer } from '../shared/Containers';
34
34
  import { BANK_SCREENS_NAVIGATION } from '../../constants';
35
35
  import { bankFeatureScreens } from '../featuresScreens';
@@ -64,7 +64,7 @@ export function BankElement(props) {
64
64
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Bank, __assign({}, props)) })));
65
65
  }
66
66
  export function renderBankLib(config, elementId) {
67
- var element = createElementAndInject(elementId);
67
+ var element = findOrCreateElementAndInject(elementId);
68
68
  var root = createRoot(element);
69
69
  root.render(_jsx(BankElement, __assign({}, config)));
70
70
  var unmount = function () { return root.unmount(); };
@@ -42,18 +42,19 @@ var ButtonStyled = styled(Button)(function (_a) {
42
42
  });
43
43
  });
44
44
  var BankDetails = function () {
45
- var _a, _b, _c, _d, _e, _f, _g;
46
- var _h = React.useState(false), ibanChecking = _h[0], setIbanChecking = _h[1];
45
+ var _a, _b, _c;
46
+ var _d = React.useState(false), ibanChecking = _d[0], setIbanChecking = _d[1];
47
47
  var dispatch = useAppDispatch();
48
- var _j = useAppSelector(bankSelector), data = _j.data, loading = _j.loading, error = _j.error;
48
+ var _e = useAppSelector(bankSelector), data = _e.data, loading = _e.loading, error = _e.error;
49
49
  var settingsData = useAppSelector(settingsSelector).data;
50
- var _k = data.bankData, iban = _k.iban, beneficiaryName = _k.beneficiaryName, bankName = _k.bankName, bankStatementId = _k.bankStatementId, bankStatementUploading = _k.uploading, confirmPolicy = _k.confirmPolicy;
50
+ var _f = data.bankData, iban = _f.iban, beneficiaryName = _f.beneficiaryName, bankName = _f.bankName, bankStatementId = _f.bankStatementId, bankStatementUploading = _f.uploading, confirmPolicy = _f.confirmPolicy;
51
51
  var verify = data.verify;
52
+ var _g = verify.responseBody || {}, bank_account = _g.bank_account, entity = _g.entity;
52
53
  var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
53
- var isFL = ((_c = (_b = (_a = verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === BusinessType.FL ? true : false;
54
- var bankHasDocument = ((_g = (_f = (_e = (_d = verify.responseBody) === null || _d === void 0 ? void 0 : _d.bank_account) === null || _e === void 0 ? void 0 : _e.document) === null || _f === void 0 ? void 0 : _f.file_details) === null || _g === void 0 ? void 0 : _g.length) > 0;
54
+ var isFL = ((_a = entity === null || entity === void 0 ? void 0 : entity.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === BusinessType.FL ? true : false;
55
+ var bankHasDocument = ((_c = (_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.document) === null || _b === void 0 ? void 0 : _b.file_details) === null || _c === void 0 ? void 0 : _c.length) > 0;
55
56
  var methods = useForm({
56
- resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation : BankValidation),
57
+ resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation(bank_account) : BankValidation(bank_account)),
57
58
  defaultValues: {
58
59
  iban: iban,
59
60
  beneficiaryName: beneficiaryName,
@@ -11,17 +11,18 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import { ScreenContainer } from '../../../shared/Containers';
15
- import Input from '../../../shared/Input';
16
- import { useTranslation } from 'react-i18next';
17
14
  import { useController, useFormContext } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
18
16
  import { styled } from '@mui/material/styles';
19
- import ClearIcon from '../../../shared/ClearIcon';
20
- import CheckIcon from '../../../shared/CheckIcon';
21
- import { bankSelector } from '../../../app/bank/bankStore';
22
17
  import { useAppSelector } from '../../../../hooks';
23
18
  import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
19
+ import { FieldType } from '../../../../@types';
24
20
  import Collapse from '../../../../components/Collapse';
21
+ import { ScreenContainer } from '../../../shared/Containers';
22
+ import Input from '../../../shared/Input';
23
+ import ClearIcon from '../../../shared/ClearIcon';
24
+ import CheckIcon from '../../../shared/CheckIcon';
25
+ import { bankSelector } from '../../../app/bank/bankStore';
25
26
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
26
27
  var theme = _a.theme;
27
28
  return ({
@@ -34,13 +35,15 @@ var InputStyled = styled(Input)(function () { return ({
34
35
  }
35
36
  }); });
36
37
  var BankName = function () {
37
- var _a, _b;
38
+ var _a, _b, _c;
38
39
  var t = useTranslation().t;
39
- var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
40
+ var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
40
41
  var data = useAppSelector(bankSelector).data;
41
42
  var bankNameControl = useController({ name: 'bankName', control: control });
42
43
  var bankNameValue = bankNameControl.field.value;
43
44
  var hasError = !!((_a = bankNameControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
45
+ var bank_account = (data.verify.responseBody || {}).bank_account;
46
+ var isNonEditable = ((_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _b === void 0 ? void 0 : _b.bank_name) === FieldType.NON_EDITABLE;
44
47
  var clearValue = function () {
45
48
  bankNameControl.field.onChange('');
46
49
  };
@@ -49,12 +52,12 @@ var BankName = function () {
49
52
  var bankName = (_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.bank_name;
50
53
  if (bankName && !bankNameValue)
51
54
  setValue('bankName', bankName);
52
- }, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name]);
55
+ }, [(_c = data.bankData.responseBody) === null || _c === void 0 ? void 0 : _c.bank_name]);
53
56
  var handleBankChange = function (_a) {
54
57
  var target = _a.target;
55
58
  var value = removeAllOtherThanAlphabetAndSpace(target.value);
56
59
  bankNameControl.field.onChange(value);
57
60
  };
58
- return (_jsx(Collapse, __assign({ in: !!bankNameValue }, { children: _jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, readOnly: true, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }) })));
61
+ return (_jsx(Collapse, __assign({ in: !!bankNameValue }, { children: _jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, disabled: isNonEditable, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }) })));
59
62
  };
60
63
  export default BankName;
@@ -1,9 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { ScreenContainer } from '../../../shared/Containers';
4
5
  import { useTranslation } from 'react-i18next';
5
6
  import { useController, useFormContext } from 'react-hook-form';
6
7
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
+ import { DocumentPurpose } from '../../../../@types';
9
+ import { getRecentDocumentFiles } from '../../../../utils';
7
10
  import { bankSelector, bankStatementUploadingStatus } from '../../../app/bank/bankStore';
8
11
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
9
12
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
@@ -13,18 +16,21 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
16
  });
14
17
  });
15
18
  var BankStatement = function (_a) {
19
+ var _b;
16
20
  var required = _a.required;
17
21
  var t = useTranslation().t;
18
22
  var control = useFormContext().control;
19
23
  var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
20
- var loading = useAppSelector(bankSelector).loading;
24
+ var _c = useAppSelector(bankSelector), loading = _c.loading, data = _c.data;
21
25
  var dispatch = useAppDispatch();
26
+ var document = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.bank_account) || {}).document;
22
27
  var handleBankStatementChange = function (ids) {
23
28
  bankStatementIdControl.field.onChange(ids);
24
29
  };
25
30
  var handleReset = function (ids) {
26
31
  bankStatementIdControl.field.onChange(ids);
27
32
  };
28
- return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: 'bank_statement', maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); } }) }));
33
+ var defaultFiles = React.useMemo(function () { return getRecentDocumentFiles(document ? [document] : [], DocumentPurpose.BANK_STATEMENT); }, [document]);
34
+ return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'bankStatementId', control: control, label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: DocumentPurpose.BANK_STATEMENT, defaultFiles: defaultFiles, maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); } }) }));
29
35
  };
30
36
  export default BankStatement;
@@ -4,35 +4,34 @@ import Input from '../../../shared/Input';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useController, useFormContext } from 'react-hook-form';
6
6
  import { styled } from '@mui/material/styles';
7
- import { ScreenContainer } from '../../../shared/Containers';
8
- import { bankSelector } from '../../../app/bank/bankStore';
9
7
  import { useAppSelector } from '../../../../hooks';
8
+ import { FieldType } from '../../../../@types';
10
9
  import ClearIcon from '../../../shared/ClearIcon';
11
10
  import CheckIcon from '../../../shared/CheckIcon';
11
+ import { ScreenContainer } from '../../../shared/Containers';
12
+ import { bankSelector } from '../../../app/bank/bankStore';
12
13
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
14
  var theme = _a.theme;
14
15
  return ({
15
16
  marginBlockEnd: theme.spacing(3)
16
17
  });
17
18
  });
18
- var InputStyled = styled(Input)(function (_a) {
19
- var theme = _a.theme;
20
- return ({
21
- input: {
22
- textTransform: 'capitalize'
23
- }
24
- });
25
- });
19
+ var InputStyled = styled(Input)(function () { return ({
20
+ input: {
21
+ textTransform: 'capitalize'
22
+ }
23
+ }); });
26
24
  var Beneficiary = function () {
27
- var _a, _b;
25
+ var _a, _b, _c;
28
26
  var t = useTranslation().t;
29
- var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
27
+ var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
30
28
  var data = useAppSelector(bankSelector).data;
31
29
  var beneficiaryControl = useController({ name: 'beneficiaryName', control: control });
32
30
  var beneficiaryValue = beneficiaryControl.field.value;
33
31
  var hasError = (_a = beneficiaryControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
34
32
  var error = (_b = beneficiaryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
35
33
  var bank_account = (data.verify.responseBody || {}).bank_account;
34
+ var isNonEditable = ((_c = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _c === void 0 ? void 0 : _c.beneficiary_name) === FieldType.NON_EDITABLE;
36
35
  React.useEffect(function () {
37
36
  var beneficiary_name = (bank_account || {}).beneficiary_name;
38
37
  if (beneficiary_name)
@@ -45,6 +44,6 @@ var Beneficiary = function () {
45
44
  var clearValue = function () {
46
45
  beneficiaryControl.field.onChange('');
47
46
  };
48
- return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
47
+ return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, disabled: isNonEditable, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
49
48
  };
50
49
  export default Beneficiary;
@@ -36,22 +36,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { jsx as _jsx } from "react/jsx-runtime";
38
38
  import * as React from 'react';
39
- import Input from '../../../shared/Input';
39
+ import { debounce } from 'lodash-es';
40
40
  import { useTranslation } from 'react-i18next';
41
+ import axios from 'axios';
41
42
  import { useController, useFormContext } from 'react-hook-form';
42
- import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
43
43
  import { styled } from '@mui/material';
44
+ import CircularProgress from '@mui/material/CircularProgress';
45
+ import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
46
+ import { settingsSelector } from '../../../../app/settings';
47
+ import { useAppSelector, useAppDispatch } from '../../../../hooks';
48
+ import { FieldType } from '../../../../@types';
44
49
  import { MAX_IBAN_VALUE } from '../../../../constants';
45
50
  import { ScreenContainer } from '../../../shared/Containers';
46
- import { debounce } from 'lodash-es';
47
51
  import { checkIbanBank } from '../../../app/bank/bankStore';
48
- import { useAppDispatch } from '../../../../hooks';
49
- import axios from 'axios';
50
52
  import ClearIcon from '../../../shared/ClearIcon';
51
53
  import CheckIcon from '../../../shared/CheckIcon';
52
- import CircularProgress from '@mui/material/CircularProgress';
53
- import { settingsSelector } from '../../../../app/settings';
54
- import { useAppSelector } from '../../../../hooks';
54
+ import Input from '../../../shared/Input';
55
+ import { bankSelector } from '../../../app/bank/bankStore';
55
56
  var InputStyled = styled(Input)(function () { return ({
56
57
  input: {
57
58
  textTransform: 'uppercase'
@@ -59,15 +60,18 @@ var InputStyled = styled(Input)(function () { return ({
59
60
  }); });
60
61
  var cancelToken = null;
61
62
  var IBAN = function (_a) {
62
- var _b;
63
+ var _b, _c;
63
64
  var fetchingIban = _a.fetchingIban, ibanChecking = _a.ibanChecking;
64
65
  var dispatch = useAppDispatch();
65
66
  var settingsData = useAppSelector(settingsSelector).data;
67
+ var data = useAppSelector(bankSelector).data;
66
68
  var t = useTranslation().t;
67
69
  var control = useFormContext().control;
68
70
  var ibanControl = useController({ name: 'iban', control: control });
69
71
  var ibanValue = ibanControl.field.value;
70
72
  var error = (_b = ibanControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
73
+ var bank_account = (data.verify.responseBody || {}).bank_account;
74
+ var isNonEditable = ((_c = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _c === void 0 ? void 0 : _c.iban) === FieldType.NON_EDITABLE;
71
75
  var checkBank = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
72
76
  var onSuccess;
73
77
  return __generator(this, function (_a) {
@@ -95,6 +99,6 @@ var IBAN = function (_a) {
95
99
  var clearValue = function () {
96
100
  ibanControl.field.onChange('');
97
101
  };
98
- return (_jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('iban_input_placeholder', { countrycode: settingsData.businessCountry.iso2.toUpperCase() }), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
102
+ return (_jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('iban_input_placeholder', { countrycode: settingsData.businessCountry.iso2.toUpperCase() }), warningType: 'alert', warningMessage: error && t(error), required: true, disabled: isNonEditable, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
99
103
  };
100
104
  export default IBAN;
@@ -1,39 +1,39 @@
1
1
  import * as yup from 'yup';
2
- export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
2
+ export declare const BankValidation: (bankAccount: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
4
4
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
- beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
+ beneficiaryName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
6
  bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
7
7
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
8
8
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
9
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
10
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
- beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
+ beneficiaryName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
12
  bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
13
13
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
14
14
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
16
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
- beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ beneficiaryName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
18
  bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
19
19
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
20
20
  }>>>;
21
- export declare const BankKWFLValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
22
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ export declare const BankKWFLValidation: (bankAccount: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
22
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
23
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
24
- beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
24
+ beneficiaryName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
25
  bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
26
26
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
27
27
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
28
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
29
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
30
- beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
30
+ beneficiaryName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
31
  bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
32
32
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
33
33
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
34
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
34
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
35
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
36
- beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
36
+ beneficiaryName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
37
37
  bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
38
38
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
39
39
  }>>>;
@@ -1,16 +1,35 @@
1
- import { REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
2
1
  import * as yup from 'yup';
3
- export var BankValidation = yup.object().shape({
4
- iban: yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
5
- bankName: yup.string().optional(),
6
- beneficiaryName: yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
7
- bankStatementId: yup.array().optional(),
8
- confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
9
- });
10
- export var BankKWFLValidation = yup.object().shape({
11
- iban: yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
12
- bankName: yup.string().optional(),
13
- beneficiaryName: yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
14
- bankStatementId: yup.array().min(1, 'bank_statement_required').required('bank_statement_required'),
15
- confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
16
- });
2
+ import { FieldType } from '../../../../@types';
3
+ import { REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
4
+ export var BankValidation = function (bankAccount) {
5
+ var _a = bankAccount || {}, iban = _a.iban, beneficiary_name = _a.beneficiary_name, data_status = _a.data_status;
6
+ var isIBANOptional = !iban && (data_status === null || data_status === void 0 ? void 0 : data_status.iban) === FieldType.NON_EDITABLE;
7
+ var isBeneficiaryNameOptional = !beneficiary_name && (data_status === null || data_status === void 0 ? void 0 : data_status.beneficiary_name) === FieldType.NON_EDITABLE;
8
+ return yup.object().shape({
9
+ iban: isIBANOptional
10
+ ? yup.string().optional()
11
+ : yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
12
+ bankName: yup.string().optional(),
13
+ beneficiaryName: isBeneficiaryNameOptional
14
+ ? yup.string().optional()
15
+ : yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
16
+ bankStatementId: yup.array().optional(),
17
+ confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
18
+ });
19
+ };
20
+ export var BankKWFLValidation = function (bankAccount) {
21
+ var _a = bankAccount || {}, iban = _a.iban, beneficiary_name = _a.beneficiary_name, data_status = _a.data_status;
22
+ var isIBANOptional = !iban && (data_status === null || data_status === void 0 ? void 0 : data_status.iban) === FieldType.NON_EDITABLE;
23
+ var isBeneficiaryNameOptional = !beneficiary_name && (data_status === null || data_status === void 0 ? void 0 : data_status.beneficiary_name) === FieldType.NON_EDITABLE;
24
+ return yup.object().shape({
25
+ iban: isIBANOptional
26
+ ? yup.string().optional()
27
+ : yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
28
+ bankName: yup.string().optional(),
29
+ beneficiaryName: isBeneficiaryNameOptional
30
+ ? yup.string().optional()
31
+ : yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
32
+ bankStatementId: yup.array().min(1, 'bank_statement_required').required('bank_statement_required'),
33
+ confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
34
+ });
35
+ };
@@ -16,7 +16,7 @@ import { bankSelector } from '../../../app/bank/bankStore';
16
16
  import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
17
17
  var SuccessWithFlowButtons = function () {
18
18
  var data = useAppSelector(bankSelector).data;
19
- var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name;
20
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, flows: flows || [] }));
19
+ var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name, individuals = _a.individuals;
20
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [] }));
21
21
  };
22
22
  export default memo(SuccessWithFlowButtons);
@@ -29,7 +29,7 @@ import AnimationFlow from '../../components/AnimationFlow';
29
29
  import { store } from '../../app/store';
30
30
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
31
31
  import Collapse from '../../components/Collapse';
32
- import { createElementAndInject } from '../../utils';
32
+ import { findOrCreateElementAndInject } from '../../utils';
33
33
  import { FeatureContainer } from '../shared/Containers';
34
34
  import { BRAND_SCREENS_NAVIGATION } from '../../constants';
35
35
  import { brandFeatureScreens } from '../featuresScreens';
@@ -64,7 +64,7 @@ export function BrandElement(props) {
64
64
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Brand, __assign({}, props)) })));
65
65
  }
66
66
  export function renderBrandLib(config, elementId) {
67
- var element = createElementAndInject(elementId);
67
+ var element = findOrCreateElementAndInject(elementId);
68
68
  var root = createRoot(element);
69
69
  root.render(_jsx(BrandElement, __assign({}, config)));
70
70
  var unmount = function () { return root.unmount(); };
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
20
20
  export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<{
21
21
  children?: React.ReactNode;
22
22
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
23
- color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
23
+ color?: "inherit" | "disabled" | "error" | "info" | "success" | "primary" | "secondary" | "action" | "warning" | undefined;
24
24
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
25
25
  htmlColor?: string | undefined;
26
26
  inheritViewBox?: boolean | undefined;
@@ -34,7 +34,7 @@ export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledCom
34
34
  export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
35
35
  children?: React.ReactNode;
36
36
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
37
- color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
37
+ color?: "inherit" | "disabled" | "error" | "info" | "success" | "primary" | "secondary" | "action" | "warning" | undefined;
38
38
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
39
39
  htmlColor?: string | undefined;
40
40
  inheritViewBox?: boolean | undefined;
@@ -56,7 +56,7 @@ export declare const LabelContainerStyled: import("@emotion/styled").StyledCompo
56
56
  export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
57
57
  children?: React.ReactNode;
58
58
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
59
- color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
59
+ color?: "inherit" | "disabled" | "error" | "info" | "success" | "primary" | "secondary" | "action" | "warning" | undefined;
60
60
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
61
61
  htmlColor?: string | undefined;
62
62
  inheritViewBox?: boolean | undefined;