@tap-payments/auth-jsconnect 2.1.9-test → 2.1.11-test

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 (74) hide show
  1. package/build/@types/form.d.ts +4 -3
  2. package/build/api/board.d.ts +1 -0
  3. package/build/api/board.js +8 -1
  4. package/build/api/entity.d.ts +1 -1
  5. package/build/api/index.d.ts +1 -0
  6. package/build/assets/locales/ar.json +7 -0
  7. package/build/assets/locales/en.json +7 -0
  8. package/build/components/FileInput/DragAndDrop.d.ts +3 -2
  9. package/build/components/FileInput/DragAndDrop.js +4 -4
  10. package/build/components/Lottie/Lottie.d.ts +2924 -127
  11. package/build/components/Lottie/Lottie.js +8 -4
  12. package/build/components/Lottie/files/error.json +692 -0
  13. package/build/components/Lottie/files/start_loading.json +1140 -0
  14. package/build/components/Lottie/files/still_loading.json +1140 -0
  15. package/build/constants/validation.d.ts +1 -0
  16. package/build/constants/validation.js +1 -0
  17. package/build/features/app/bank/bankStore.js +13 -10
  18. package/build/features/app/business/businessStore.d.ts +8 -1
  19. package/build/features/app/business/businessStore.js +123 -66
  20. package/build/features/app/connect/connectStore.d.ts +1 -1
  21. package/build/features/app/connect/connectStore.js +47 -38
  22. package/build/features/app/entity/entityStore.js +37 -42
  23. package/build/features/app/individual/individualStore.js +47 -38
  24. package/build/features/app/password/passwordStore.js +19 -20
  25. package/build/features/app/tax/taxStore.js +13 -10
  26. package/build/features/bank/screens/BankDetails/BankDetails.js +13 -6
  27. package/build/features/bank/screens/BankDetails/BankStatement.js +14 -11
  28. package/build/features/bank/screens/BankDetails/validation.d.ts +22 -0
  29. package/build/features/bank/screens/BankDetails/validation.js +29 -2
  30. package/build/features/business/screens/BusinessType/Article.d.ts +6 -0
  31. package/build/features/business/screens/BusinessType/Article.js +89 -0
  32. package/build/features/business/screens/BusinessType/BusinessType.js +16 -10
  33. package/build/features/business/screens/BusinessType/EntityName.js +1 -1
  34. package/build/features/business/screens/BusinessType/LicenseCertificate.js +14 -9
  35. package/build/features/business/screens/BusinessType/LicenseList.js +3 -2
  36. package/build/features/business/screens/BusinessType/LicenseType.js +3 -3
  37. package/build/features/business/screens/BusinessType/validation.js +17 -8
  38. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
  39. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +9 -134
  40. package/build/features/connect/screens/Merchant/Merchant.js +4 -24
  41. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -5
  42. package/build/features/connect/screens/Merchant/SalesChannels.js +29 -99
  43. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
  44. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +9 -73
  45. package/build/features/entity/screens/EntityInfoConfirm/Article.js +14 -11
  46. package/build/features/shared/PaciVerification/PaciVerification.d.ts +12 -0
  47. package/build/features/shared/PaciVerification/PaciVerification.js +91 -0
  48. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACILoading.d.ts +1 -0
  49. package/build/features/shared/PaciVerification/VerifyPACILoading.js +13 -0
  50. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.d.ts +0 -0
  51. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.js +1 -1
  52. package/build/features/shared/PaciVerification/index.d.ts +2 -0
  53. package/build/features/shared/PaciVerification/index.js +2 -0
  54. package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +11 -0
  55. package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +100 -0
  56. package/build/features/shared/SalesChannels/SalesChannel.d.ts +10 -0
  57. package/build/features/shared/SalesChannels/SalesChannel.js +132 -0
  58. package/build/features/shared/SalesChannels/index.d.ts +2 -0
  59. package/build/features/shared/SalesChannels/index.js +2 -0
  60. package/build/features/shared/UploadFile/UploadFile.d.ts +3 -2
  61. package/build/features/shared/UploadFile/UploadFile.js +13 -13
  62. package/build/hooks/index.d.ts +1 -0
  63. package/build/hooks/index.js +1 -0
  64. package/build/hooks/useCountUp.d.ts +9 -0
  65. package/build/hooks/useCountUp.js +17 -0
  66. package/package.json +1 -1
  67. package/build/components/Lottie/files/pulsating_circle_waves.json +0 -236
  68. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +0 -23
  69. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +0 -8
  70. package/build/features/connect/screens/Merchant/SocialMedia.js +0 -156
  71. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +0 -6
  72. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +0 -23
  73. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +0 -5
  74. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +0 -8
@@ -22,3 +22,4 @@ export declare const LINKEDIN_URL: RegExp;
22
22
  export declare const SOCIAL_USERNAME: RegExp;
23
23
  export declare const DIGITS_ONLY: RegExp;
24
24
  export declare const REGEX_PHONE_APP_NAME: RegExp;
25
+ export declare const REGEX_IBAN: RegExp;
@@ -22,3 +22,4 @@ export var LINKEDIN_URL = /[a-zA-Z0-9-\/:._]+$/;
22
22
  export var SOCIAL_USERNAME = /^[A-Za-z-0-9\d._]{3,}$/;
23
23
  export var DIGITS_ONLY = /^\d+$/;
24
24
  export var REGEX_PHONE_APP_NAME = /^[a-zA-Z0-9[._-]*$/;
25
+ export var REGEX_IBAN = /^[a-zA-Z]{2}[a-zA-Z0-9]{13,34}$/g;
@@ -52,7 +52,7 @@ import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, data, boardInfoData, boardData, board_id, board_info_id, countryIso2, info, hasBankCompleted;
55
+ var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasBankCompleted;
56
56
  var _a, _b, _c, _d;
57
57
  return __generator(this, function (_e) {
58
58
  switch (_e.label) {
@@ -67,15 +67,15 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
67
67
  boardData = undefined;
68
68
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
69
69
  board_id = data === null || data === void 0 ? void 0 : data.id;
70
- board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
71
- if (!(!!board_id && !!board_info_id)) return [3, 3];
72
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
70
+ if (!board_id) return [3, 4];
71
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
73
72
  case 2:
74
73
  boardInfoData = _e.sent();
75
- _e.label = 3;
76
- case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
77
- case 4:
74
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
75
+ case 3:
78
76
  boardData = _e.sent();
77
+ _e.label = 4;
78
+ case 4:
79
79
  countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
80
80
  if (countryIso2)
81
81
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -252,7 +252,7 @@ export var uploadBankStatement = createAsyncThunk('uploadBankStatement', functio
252
252
  });
253
253
  });
254
254
  export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
255
- var _a, settings, bank, _b, id, infoId, payload, data;
255
+ var _a, settings, bank, _b, id, infoId, payload, data, boardInfoData;
256
256
  var _c, _d, _e, _f;
257
257
  return __generator(this, function (_g) {
258
258
  switch (_g.label) {
@@ -269,13 +269,16 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
269
269
  return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
270
270
  case 1:
271
271
  data = _g.sent();
272
- return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
272
+ return [4, API.boardService.retrieveBoardInfoStatus(id)];
273
273
  case 2:
274
+ boardInfoData = _g.sent();
275
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
276
+ case 3:
274
277
  _g.sent();
275
278
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
276
279
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
277
280
  thunkApi.dispatch(handleNextScreenStep());
278
- return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((data === null || data === void 0 ? void 0 : data.info) || []) }), formData: params }];
281
+ return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []) }), formData: params }];
279
282
  }
280
283
  });
281
284
  }); });
@@ -28,7 +28,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
28
28
  leadData: any;
29
29
  }, OTPFormValues, {}>;
30
30
  interface verifyPACIParams {
31
- onSuccess?: () => void | Promise<void>;
31
+ onSuccess?: () => void;
32
32
  }
33
33
  export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
34
34
  response: any;
@@ -57,6 +57,7 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
57
57
  formData: BusinessTypeFormValues;
58
58
  accountData: any;
59
59
  documentData: any;
60
+ entityData: any;
60
61
  }, BusinessTypeFormValues, {}>;
61
62
  interface UploadLicenseCertificateParams {
62
63
  file: File;
@@ -65,6 +66,11 @@ interface UploadLicenseCertificateParams {
65
66
  export declare const uploadLicenseCertificate: import("@reduxjs/toolkit").AsyncThunk<{
66
67
  data: any;
67
68
  }, UploadLicenseCertificateParams, {}>;
69
+ interface UploadArticleParams extends UploadLicenseCertificateParams {
70
+ }
71
+ export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
72
+ data: any;
73
+ }, UploadArticleParams, {}>;
68
74
  export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
69
75
  data: any;
70
76
  formData: {
@@ -109,6 +115,7 @@ export interface BusinessData {
109
115
  export interface BusinessState extends SharedState<BusinessData> {
110
116
  customLoading?: boolean;
111
117
  uploading?: boolean;
118
+ uploadingArticle?: boolean;
112
119
  }
113
120
  export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
114
121
  clearError: (state: BusinessState) => void;
@@ -63,7 +63,7 @@ import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_
63
63
  import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA, dateFormat } from '../../../utils';
64
64
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, board_info_id, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
66
+ var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
67
67
  var _a;
68
68
  return __generator(this, function (_b) {
69
69
  switch (_b.label) {
@@ -82,7 +82,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
82
82
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
83
83
  if (countryIso2)
84
84
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
85
- if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 20];
85
+ if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 19];
86
86
  boardData = undefined;
87
87
  brandData = undefined;
88
88
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
@@ -97,8 +97,8 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
97
97
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
98
98
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
99
99
  }
100
- if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
101
- entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id, board_info_id = leadData.board_info_id;
100
+ if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 18];
101
+ entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id;
102
102
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
103
103
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
104
104
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
@@ -111,63 +111,60 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
111
111
  leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
112
112
  _b.label = 4;
113
113
  case 4:
114
- if (!hasBusinessCompleted) return [3, 9];
115
- if (!(board_id && board_info_id)) return [3, 6];
116
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
114
+ if (!hasBusinessCompleted) return [3, 8];
115
+ if (!board_id) return [3, 7];
116
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
117
117
  case 5:
118
118
  boardData = _b.sent();
119
- _b.label = 6;
120
- case 6:
121
- if (!board_id) return [3, 8];
122
119
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
123
- case 7:
120
+ case 6:
124
121
  _b.sent();
125
- _b.label = 8;
126
- case 8:
122
+ _b.label = 7;
123
+ case 7:
127
124
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
128
- return [3, 19];
129
- case 9:
130
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 10];
125
+ return [3, 18];
126
+ case 8:
127
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
131
128
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
132
- return [3, 19];
133
- case 10:
134
- if (!hasBusinessCustomersCompleted) return [3, 11];
129
+ return [3, 18];
130
+ case 9:
131
+ if (!hasBusinessCustomersCompleted) return [3, 10];
135
132
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
136
- return [3, 19];
137
- case 11:
138
- if (!hasBusinessCRActivitiesCompleted) return [3, 14];
133
+ return [3, 18];
134
+ case 10:
135
+ if (!hasBusinessCRActivitiesCompleted) return [3, 13];
139
136
  return [4, thunkApi.dispatch(retrieveDataList())];
140
- case 12:
137
+ case 11:
141
138
  _b.sent();
142
139
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
143
140
  return [4, API.brandService.retrieveBrand(brandID)];
144
- case 13:
141
+ case 12:
145
142
  brandData = _b.sent();
146
- return [3, 19];
147
- case 14:
148
- if (!hasBusinessCRInfoCompleted) return [3, 16];
143
+ return [3, 18];
144
+ case 13:
145
+ if (!hasBusinessCRInfoCompleted) return [3, 15];
149
146
  return [4, API.brandService.retrieveBrand(brandID)];
150
- case 15:
147
+ case 14:
151
148
  brandData = _b.sent();
152
149
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
153
- return [3, 19];
154
- case 16:
155
- if (!isSA(countryIso2)) return [3, 18];
150
+ return [3, 18];
151
+ case 15:
152
+ if (!isSA(countryIso2)) return [3, 17];
156
153
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
157
- case 17:
154
+ case 16:
158
155
  _b.sent();
159
- _b.label = 18;
160
- case 18:
156
+ _b.label = 17;
157
+ case 17:
161
158
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
162
- _b.label = 19;
163
- case 19: return [2, {
159
+ _b.label = 18;
160
+ case 18: return [2, {
164
161
  data: data,
165
162
  leadData: __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardData === null || boardData === void 0 ? void 0 : boardData.info) || []) }),
166
163
  token: token,
167
164
  brandData: brandData,
168
165
  boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
169
166
  }];
170
- case 20: return [2, { data: data, isRequireOTP: true }];
167
+ case 19: return [2, { data: data, isRequireOTP: true }];
171
168
  }
172
169
  });
173
170
  }); });
@@ -189,7 +186,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
189
186
  });
190
187
  }); });
191
188
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
- var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, board_info_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
189
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
193
190
  var _b, _c, _d, _e, _f, _g, _h;
194
191
  return __generator(this, function (_j) {
195
192
  switch (_j.label) {
@@ -215,7 +212,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
215
212
  case 2:
216
213
  leadData = (_j.sent()).data;
217
214
  thunkApi.dispatch(updateStepName(stepName));
218
- brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, board_info_id = leadData.board_info_id;
215
+ brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id;
219
216
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
220
217
  countryIso2 = country_code;
221
218
  if (countryIso2)
@@ -249,15 +246,16 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
249
246
  return [3, 20];
250
247
  case 8:
251
248
  if (!hasBusinessCompleted) return [3, 12];
252
- if (!(board_id && board_info_id)) return [3, 10];
253
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
249
+ if (!board_id) return [3, 11];
250
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
254
251
  case 9:
255
252
  boardResponse = _j.sent();
256
253
  leadData = __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || []) });
257
- _j.label = 10;
258
- case 10: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
259
- case 11:
254
+ return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
255
+ case 10:
260
256
  _j.sent();
257
+ _j.label = 11;
258
+ case 11:
261
259
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
262
260
  return [3, 20];
263
261
  case 12:
@@ -316,7 +314,8 @@ export var verifyPACI = createAsyncThunk('businessVerifyPACI', function (params,
316
314
  isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
317
315
  if (!isSuccess) return [3, 4];
318
316
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, {});
319
- return [4, ((_e = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _e === void 0 ? void 0 : _e.call(params))];
317
+ (_e = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _e === void 0 ? void 0 : _e.call(params);
318
+ return [4, sleep(3000)];
320
319
  case 3:
321
320
  _f.sent();
322
321
  thunkApi.dispatch(handleNextScreenStep());
@@ -453,19 +452,21 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
453
452
  });
454
453
  }); });
455
454
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
456
- var _a, settings, business, payload, data, entity_activities, list, accountBody, accountData, documentData, documentBody;
455
+ var _a, settings, business, isNonSA, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, articleId, documentBody, payload_1;
457
456
  var _b, _c, _d, _e, _f, _g;
458
457
  return __generator(this, function (_h) {
459
458
  switch (_h.label) {
460
459
  case 0:
461
460
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
461
+ isNonSA = !isSA(settings.data.businessCountry.iso2);
462
+ isFL = ((_b = params.selectedLicense) === null || _b === void 0 ? void 0 : _b.type) === BusinessType.FL;
462
463
  payload = {
463
- id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
464
- license_number: params.licenseNumber,
465
- license_type: ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL ? 'freelance' : 'commercial_registration',
464
+ id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id) || '',
465
+ license_number: isNonSA && isFL ? '' : params.licenseNumber,
466
+ license_type: isFL ? 'freelance' : 'commercial_registration',
466
467
  business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
467
468
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
468
- business: { ar: params.entityLegalName, en: params.entityLegalName },
469
+ business: isNonSA && isFL ? undefined : { ar: params.entityLegalName, en: params.entityLegalName },
469
470
  encryption_contract: ['license_number', 'business_type', 'license_type']
470
471
  };
471
472
  return [4, API.leadService.updateLead(payload)];
@@ -492,13 +493,15 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
492
493
  return [4, API.accountService.createAccount(accountBody)];
493
494
  case 4:
494
495
  accountData = _h.sent();
495
- documentData = undefined;
496
- if (!!!business.data.businessTypeData.certificateId) return [3, 6];
496
+ entityData = undefined;
497
+ entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
498
+ articleId = business.data.businessTypeData.articleId;
499
+ if (!((business.data.businessTypeData.certificateId || []).length > 0)) return [3, 6];
497
500
  documentBody = {
498
- entity_id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
501
+ entity_id: entityId || '',
499
502
  documents: [
500
503
  {
501
- images: [business.data.businessTypeData.certificateId]
504
+ images: business.data.businessTypeData.certificateId
502
505
  }
503
506
  ]
504
507
  };
@@ -507,9 +510,19 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
507
510
  documentData = _h.sent();
508
511
  _h.label = 6;
509
512
  case 6:
513
+ if (!(articleId && entityId)) return [3, 8];
514
+ payload_1 = {
515
+ id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
516
+ AOA_file_id: articleId
517
+ };
518
+ return [4, API.entityService.updateEntity(payload_1)];
519
+ case 7:
520
+ entityData = _h.sent();
521
+ _h.label = 8;
522
+ case 8:
510
523
  thunkApi.dispatch(handleNextScreenStep());
511
524
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
512
- return [2, { data: data, formData: params, accountData: accountData, documentData: documentData }];
525
+ return [2, { data: data, formData: params, accountData: accountData, documentData: documentData, entityData: entityData }];
513
526
  }
514
527
  });
515
528
  }); });
@@ -538,6 +551,35 @@ export var uploadLicenseCertificate = createAsyncThunk('uploadLicenseCertificate
538
551
  });
539
552
  });
540
553
  });
554
+ export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
555
+ var file = _a.file, onProgress = _a.onProgress;
556
+ return __awaiter(void 0, void 0, void 0, function () {
557
+ var typeArray, type, uploadPayload, onUploadProgress, data;
558
+ var _b;
559
+ return __generator(this, function (_c) {
560
+ switch (_c.label) {
561
+ case 0:
562
+ typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
563
+ type = typeArray[1] || '';
564
+ uploadPayload = {
565
+ file_link_create: true,
566
+ title: file === null || file === void 0 ? void 0 : file.name,
567
+ purpose: 'identity_document',
568
+ type: type,
569
+ file: file
570
+ };
571
+ onUploadProgress = function (progressEvent) {
572
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
573
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
574
+ };
575
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
576
+ case 1:
577
+ data = _c.sent();
578
+ return [2, { data: data }];
579
+ }
580
+ });
581
+ });
582
+ });
541
583
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
542
584
  var _a, settings, business, activities, stepName, id, requestBody, data;
543
585
  var _b, _c, _d, _e, _f;
@@ -636,7 +678,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
636
678
  });
637
679
  }); });
638
680
  export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
639
- var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id, board_info_id;
681
+ var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id;
640
682
  var _c, _d, _e, _f;
641
683
  return __generator(this, function (_g) {
642
684
  switch (_g.label) {
@@ -657,15 +699,15 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
657
699
  case 1:
658
700
  data = _g.sent();
659
701
  board_id = data === null || data === void 0 ? void 0 : data.board_id;
660
- board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
661
- if (!(!!board_id && !!board_info_id)) return [3, 3];
662
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
702
+ if (!board_id) return [3, 4];
703
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
663
704
  case 2:
664
705
  boardResponse = _g.sent();
665
- _g.label = 3;
666
- case 3: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
667
- case 4:
706
+ return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
707
+ case 3:
668
708
  _g.sent();
709
+ _g.label = 4;
710
+ case 4:
669
711
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
670
712
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
671
713
  thunkApi.dispatch(handleNextScreenStep());
@@ -700,6 +742,7 @@ var initialState = {
700
742
  loading: false,
701
743
  customLoading: false,
702
744
  uploading: false,
745
+ uploadingArticle: false,
703
746
  data: {
704
747
  flowName: FlowsTypes.BUSINESS,
705
748
  verify: {
@@ -719,8 +762,7 @@ var initialState = {
719
762
  },
720
763
  businessTypeData: {
721
764
  licenseNumber: '',
722
- entityLegalName: '',
723
- uploading: false
765
+ entityLegalName: ''
724
766
  },
725
767
  activitiesData: {
726
768
  activities: [],
@@ -870,7 +912,7 @@ export var businessSlice = createSlice({
870
912
  state.loading = false;
871
913
  state.error = action.error.message;
872
914
  })
873
- .addCase(createCivilIdAuth.pending, function (state, action) {
915
+ .addCase(createCivilIdAuth.pending, function (state) {
874
916
  state.loading = true;
875
917
  state.error = null;
876
918
  })
@@ -1035,11 +1077,26 @@ export var businessSlice = createSlice({
1035
1077
  state.error = null;
1036
1078
  state.uploading = false;
1037
1079
  var data = action.payload.data;
1038
- state.data.businessTypeData.certificateId = data === null || data === void 0 ? void 0 : data.id;
1080
+ var ids = state.data.businessTypeData.certificateId || [];
1081
+ state.data.businessTypeData.certificateId = __spreadArray(__spreadArray([], ids, true), [data === null || data === void 0 ? void 0 : data.id], false);
1039
1082
  })
1040
1083
  .addCase(uploadLicenseCertificate.rejected, function (state) {
1041
1084
  state.uploading = false;
1042
1085
  state.error = 'file_upload_error';
1086
+ })
1087
+ .addCase(uploadArticle.pending, function (state) {
1088
+ state.error = null;
1089
+ state.uploadingArticle = true;
1090
+ })
1091
+ .addCase(uploadArticle.fulfilled, function (state, action) {
1092
+ state.error = null;
1093
+ state.uploadingArticle = false;
1094
+ var data = action.payload.data;
1095
+ state.data.businessTypeData.articleId = data === null || data === void 0 ? void 0 : data.id;
1096
+ })
1097
+ .addCase(uploadArticle.rejected, function (state) {
1098
+ state.uploadingArticle = false;
1099
+ state.error = 'file_upload_error';
1043
1100
  })
1044
1101
  .addCase(updateActivitiesInfo.pending, function (state) {
1045
1102
  state.loading = true;
@@ -27,7 +27,7 @@ export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
27
27
  userInfoMissed: boolean;
28
28
  }, OTPFormValues, {}>;
29
29
  interface verifyPACIParams {
30
- onSuccess?: () => void | Promise<void>;
30
+ onSuccess?: () => void;
31
31
  }
32
32
  export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
33
33
  authResponse: any;
@@ -307,9 +307,9 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
307
307
  }); });
308
308
  export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
309
309
  var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, individual_id, leadBody, leadResponse, _b, isNewUser, countryCode, contact, name_1, _c, phone, email, userInfoMissed, channels, brands, err_2;
310
- var _d, _e, _f, _g, _h;
311
- return __generator(this, function (_j) {
312
- switch (_j.label) {
310
+ var _d, _e, _f, _g, _h, _j;
311
+ return __generator(this, function (_k) {
312
+ switch (_k.label) {
313
313
  case 0:
314
314
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
315
315
  responseBody = connect.data.civilIdData.responseBody;
@@ -317,77 +317,86 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
317
317
  interval = 3;
318
318
  maxCalls = Math.floor(expiry / interval);
319
319
  count = 1;
320
- _j.label = 1;
320
+ _k.label = 1;
321
321
  case 1:
322
- if (!(count <= maxCalls)) return [3, 16];
322
+ if (!(count <= maxCalls)) return [3, 19];
323
323
  if (thunkApi.signal.aborted) {
324
- return [3, 16];
324
+ return [3, 19];
325
325
  }
326
326
  return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
327
327
  case 2:
328
- authResponse = _j.sent();
328
+ authResponse = _k.sent();
329
329
  isSuccess = ((_d = authResponse.status) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === 'success';
330
- if (!isSuccess) return [3, 13];
331
- return [4, ((_e = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _e === void 0 ? void 0 : _e.call(params))];
332
- case 3:
333
- _j.sent();
330
+ if (!isSuccess) return [3, 16];
334
331
  lead_id = authResponse.lead_id, individual_id = authResponse.individual_id;
335
332
  leadBody = {
336
333
  country_code: settings.data.businessCountry.iso2,
337
334
  individual_id: individual_id
338
335
  };
339
- if (!lead_id) return [3, 5];
336
+ if (!lead_id) return [3, 4];
340
337
  return [4, API.leadService.retrieveLead(lead_id)];
341
- case 4:
342
- _b = _j.sent();
343
- return [3, 7];
344
- case 5: return [4, API.leadService.createLead(leadBody)];
338
+ case 3:
339
+ _b = _k.sent();
340
+ return [3, 6];
341
+ case 4: return [4, API.leadService.createLead(leadBody)];
342
+ case 5:
343
+ _b = _k.sent();
344
+ _k.label = 6;
345
345
  case 6:
346
- _b = _j.sent();
347
- _j.label = 7;
348
- case 7:
349
346
  leadResponse = (_b).data;
350
- if ((_f = leadResponse.errors) === null || _f === void 0 ? void 0 : _f.length)
347
+ if ((_e = leadResponse.errors) === null || _e === void 0 ? void 0 : _e.length)
351
348
  throw new Error(leadResponse.errors[0].description);
352
349
  isNewUser = leadResponse.is_new_individual;
353
350
  countryCode = settings.data.businessCountry;
354
351
  contact = leadResponse.contact, name_1 = leadResponse.name;
355
352
  _c = contact || {}, phone = _c.phone, email = _c.email;
356
353
  userInfoMissed = (!phone || !email || !name_1) && !isNewUser;
357
- if (!!isNewUser) return [3, 12];
354
+ if (!!isNewUser) return [3, 13];
358
355
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
359
- case 8:
360
- channels = (_j.sent()).list;
356
+ case 7:
357
+ channels = (_k.sent()).list;
361
358
  leadResponse.channel_list = channels;
362
- _j.label = 9;
363
- case 9:
364
- _j.trys.push([9, 11, , 12]);
359
+ _k.label = 8;
360
+ case 8:
361
+ _k.trys.push([8, 10, , 11]);
365
362
  return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
366
- case 10:
367
- brands = (_j.sent()).brands;
363
+ case 9:
364
+ brands = (_k.sent()).brands;
368
365
  leadResponse.brand_list = fixBrandList(brands, channels);
369
- return [3, 12];
366
+ return [3, 11];
367
+ case 10:
368
+ err_2 = _k.sent();
369
+ return [3, 11];
370
370
  case 11:
371
- err_2 = _j.sent();
372
- return [3, 12];
371
+ (_f = params.onSuccess) === null || _f === void 0 ? void 0 : _f.call(params);
372
+ return [4, sleep(3000)];
373
373
  case 12:
374
+ _k.sent();
375
+ return [3, 15];
376
+ case 13:
377
+ (_g = params.onSuccess) === null || _g === void 0 ? void 0 : _g.call(params);
378
+ return [4, sleep(3000)];
379
+ case 14:
380
+ _k.sent();
381
+ _k.label = 15;
382
+ case 15:
374
383
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
375
384
  countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
376
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, {});
385
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, {});
377
386
  if (isNewUser || userInfoMissed) {
378
387
  thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
379
388
  return [2, { authResponse: authResponse, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
380
389
  }
381
390
  thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
382
391
  return [2, { authResponse: authResponse, leadResponse: leadResponse, isNewUser: isNewUser, countryCode: countryCode, userInfoMissed: userInfoMissed }];
383
- case 13: return [4, sleep(interval * 1000)];
384
- case 14:
385
- _j.sent();
386
- _j.label = 15;
387
- case 15:
392
+ case 16: return [4, sleep(interval * 1000)];
393
+ case 17:
394
+ _k.sent();
395
+ _k.label = 18;
396
+ case 18:
388
397
  count++;
389
398
  return [3, 1];
390
- case 16: throw new Error('paci_verification_failed');
399
+ case 19: throw new Error('paci_verification_failed');
391
400
  }
392
401
  });
393
402
  }); });