@tap-payments/auth-jsconnect 1.0.77 → 1.0.78

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 (33) hide show
  1. package/build/components/AnimationFlow/BottomSheet.js +3 -0
  2. package/build/constants/app.js +23 -7
  3. package/build/features/app/bank/bankStore.js +11 -8
  4. package/build/features/app/business/businessStore.js +5 -3
  5. package/build/features/app/individual/individualStore.js +12 -9
  6. package/build/features/app/password/passwordStore.d.ts +3 -0
  7. package/build/features/app/password/passwordStore.js +55 -16
  8. package/build/features/app/tax/taxStore.d.ts +3 -0
  9. package/build/features/app/tax/taxStore.js +54 -15
  10. package/build/features/bank/screens/BankDetails/IBAN.js +7 -1
  11. package/build/features/bank/screens/Success/Success.js +5 -8
  12. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +7 -5
  13. package/build/features/business/screens/Success/Success.js +1 -5
  14. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  15. package/build/features/connect/screens/Mobile/Mobile.js +4 -1
  16. package/build/features/featuresScreens.js +10 -0
  17. package/build/features/individual/screens/Success/Success.js +5 -8
  18. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +7 -5
  19. package/build/features/password/screens/Success/Success.js +6 -6
  20. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  21. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +89 -0
  22. package/build/features/password/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  23. package/build/features/password/screens/SuccessWithFlowButtons/index.js +2 -0
  24. package/build/features/tax/screens/Success/Success.js +6 -6
  25. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  26. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +89 -0
  27. package/build/features/tax/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  28. package/build/features/tax/screens/SuccessWithFlowButtons/index.js +2 -0
  29. package/build/hooks/useRedirectionListener.d.ts +4 -0
  30. package/build/hooks/useRedirectionListener.js +12 -0
  31. package/build/utils/object.d.ts +2 -0
  32. package/build/utils/object.js +11 -0
  33. package/package.json +1 -1
@@ -32,6 +32,9 @@ var BottomSheetStyled = styled(BottomSheet)(function (_a) {
32
32
  width: '75px',
33
33
  height: '5px'
34
34
  },
35
+ '[data-rsbs-header]': {
36
+ paddingBottom: theme.spacing(3)
37
+ },
35
38
  '[data-rsbs-overlay]': {
36
39
  backgroundColor: theme.palette.background.paper
37
40
  },
@@ -109,7 +109,11 @@ export var BUSINESS_SCREENS_NAVIGATION = [
109
109
  export var INDIVIDUAL_SCREENS_NAVIGATION = [
110
110
  {
111
111
  name: 'INDIVIDUAL_VERIFY_STEP',
112
- next: ['INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
112
+ next: [
113
+ 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
114
+ 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
115
+ 'INDIVIDUAL_SUCCESS_STEP'
116
+ ],
113
117
  prev: '',
114
118
  order: 1
115
119
  },
@@ -129,13 +133,13 @@ export var INDIVIDUAL_SCREENS_NAVIGATION = [
129
133
  name: 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
130
134
  next: '',
131
135
  prev: 'INDIVIDUAL_SUCCESS_STEP',
132
- order: 3
136
+ order: 4
133
137
  }
134
138
  ];
135
139
  export var PASSWORD_SCREENS_NAVIGATION = [
136
140
  {
137
141
  name: 'PASSWORD_VERIFY_STEP',
138
- next: ['PASSWORD_CREATE_PASSWORD_STEP', 'PASSWORD_SUCCESS_STEP'],
142
+ next: ['PASSWORD_CREATE_PASSWORD_STEP', 'PASSWORD_SUCCESS_STEP', 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
139
143
  prev: '',
140
144
  order: 1
141
145
  },
@@ -147,15 +151,21 @@ export var PASSWORD_SCREENS_NAVIGATION = [
147
151
  },
148
152
  {
149
153
  name: 'PASSWORD_SUCCESS_STEP',
150
- next: '',
154
+ next: 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
151
155
  prev: 'PASSWORD_CREATE_PASSWORD_STEP',
152
156
  order: 3
157
+ },
158
+ {
159
+ name: 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
160
+ next: '',
161
+ prev: 'PASSWORD_SUCCESS_STEP',
162
+ order: 4
153
163
  }
154
164
  ];
155
165
  export var BANK_SCREENS_NAVIGATION = [
156
166
  {
157
167
  name: 'BANK_VERIFY_STEP',
158
- next: ['BANK_BANK_DETAILS_STEP', 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
168
+ next: ['BANK_BANK_DETAILS_STEP', 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP', 'BANK_DETAILS_SUCCESS_STEP'],
159
169
  prev: '',
160
170
  order: 1
161
171
  },
@@ -181,7 +191,7 @@ export var BANK_SCREENS_NAVIGATION = [
181
191
  export var TAX_SCREENS_NAVIGATION = [
182
192
  {
183
193
  name: 'TAX_VERIFY_STEP',
184
- next: ['TAX_TAX_DETAILS_STEP', 'TAX_DETAILS_SUCCESS_STEP'],
194
+ next: ['TAX_TAX_DETAILS_STEP', 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP', 'TAX_DETAILS_SUCCESS_STEP'],
185
195
  prev: '',
186
196
  order: 1
187
197
  },
@@ -193,9 +203,15 @@ export var TAX_SCREENS_NAVIGATION = [
193
203
  },
194
204
  {
195
205
  name: 'TAX_DETAILS_SUCCESS_STEP',
196
- next: '',
206
+ next: 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
197
207
  prev: 'TAX_TAX_DETAILS_STEP',
198
208
  order: 3
209
+ },
210
+ {
211
+ name: 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
212
+ next: '',
213
+ prev: 'TAX_DETAILS_SUCCESS_STEP',
214
+ order: 4
199
215
  }
200
216
  ];
201
217
  export var LANDING_SCREENS_NAVIGATION = [
@@ -176,13 +176,13 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
176
176
  });
177
177
  export var updateLeadSuccess = createAsyncThunk('updateLeadBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
178
178
  var _a, settings, bank, response, payload;
179
- var _b, _c, _d, _e, _f, _g;
180
- return __generator(this, function (_h) {
181
- switch (_h.label) {
179
+ var _b, _c, _d, _e, _f, _g, _h, _j;
180
+ return __generator(this, function (_k) {
181
+ switch (_k.label) {
182
182
  case 0:
183
183
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
184
184
  response = undefined;
185
- if (!!!((_b = bank.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
185
+ if (!!!((_b = bank.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 3];
186
186
  payload = {
187
187
  step_name: BANK_STEP_NAMES.BANK_SUCCESS,
188
188
  id: ((_c = bank.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
@@ -190,11 +190,14 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadBankSuccess', functio
190
190
  };
191
191
  return [4, API.leadService.updateLead(payload)];
192
192
  case 1:
193
- response = _h.sent();
194
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
195
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
196
- _h.label = 2;
193
+ response = _k.sent();
194
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.id))];
197
195
  case 2:
196
+ _k.sent();
197
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
198
+ (_j = (_h = settings.data.appConfig).onFlowCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, { data: response === null || response === void 0 ? void 0 : response.data });
199
+ _k.label = 3;
200
+ case 3:
198
201
  thunkApi.dispatch(handleNextScreenStep());
199
202
  return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
200
203
  }
@@ -405,6 +405,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
405
405
  return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data === null || data === void 0 ? void 0 : data.entity) === null || _g === void 0 ? void 0 : _g.id))];
406
406
  case 2:
407
407
  _h.sent();
408
+ thunkApi.dispatch(handleNextScreenStep());
408
409
  return [2, { response: data, formData: params }];
409
410
  }
410
411
  });
@@ -715,15 +716,16 @@ export var businessSlice = createSlice({
715
716
  state.error = null;
716
717
  })
717
718
  .addCase(retrieveDataList.fulfilled, function (state, action) {
719
+ var _a, _b;
718
720
  state.loading = false;
719
721
  state.error = null;
720
722
  var payload = action.payload;
721
723
  var customerBases = payload.customerBases || [];
722
- var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[0];
724
+ var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[1];
723
725
  var expectedSales = payload.expectedSales || [];
724
- var expectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[expectedSales.length - 1];
726
+ var expectedSale = (_b = (_a = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[0]) === null || _a === void 0 ? void 0 : _a.sub) === null || _b === void 0 ? void 0 : _b[4];
725
727
  var expectedCustomerSales = payload.expectedCustomerSales || [];
726
- var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[expectedCustomerSales.length - 1];
728
+ var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
727
729
  state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
728
730
  if (!!customerBase)
729
731
  state.data.customersData.customerLocations = [customerBase];
@@ -176,7 +176,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
176
176
  actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
177
177
  is_relative_PEP: params.isPEP,
178
178
  is_influencer: params.isInfluencer,
179
- encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'is_relative_PEP', 'is_influencer'],
179
+ encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
180
180
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
181
181
  };
182
182
  return [4, API.entityService.updateEntityInfo(requestBody)];
@@ -192,13 +192,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
192
192
  }); });
193
193
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
194
194
  var _a, settings, individual, response, payload;
195
- var _b, _c, _d, _e, _f, _g;
196
- return __generator(this, function (_h) {
197
- switch (_h.label) {
195
+ var _b, _c, _d, _e, _f, _g, _h, _j;
196
+ return __generator(this, function (_k) {
197
+ switch (_k.label) {
198
198
  case 0:
199
199
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
200
200
  response = undefined;
201
- if (!!!((_b = individual.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
201
+ if (!!!((_b = individual.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 3];
202
202
  payload = {
203
203
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
204
204
  id: ((_c = individual.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
@@ -206,11 +206,14 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
206
206
  };
207
207
  return [4, API.leadService.updateLead(payload)];
208
208
  case 1:
209
- response = _h.sent();
210
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
211
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
212
- _h.label = 2;
209
+ response = _k.sent();
210
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.id))];
213
211
  case 2:
212
+ _k.sent();
213
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
214
+ (_j = (_h = settings.data.appConfig).onFlowCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, { data: response === null || response === void 0 ? void 0 : response.data });
215
+ _k.label = 3;
216
+ case 3:
214
217
  thunkApi.dispatch(handleNextScreenStep());
215
218
  return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
216
219
  }
@@ -5,6 +5,9 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  leadData: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
+ export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ }, string, {}>;
8
11
  export declare const verifyPasswordLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
12
  data: any;
10
13
  formData: {
@@ -76,11 +76,22 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
76
76
  }
77
77
  });
78
78
  }); });
79
+ export var retrieveEntityInfo = createAsyncThunk('retrievePasswordEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
80
+ var data;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
84
+ case 1:
85
+ data = (_a.sent()).data;
86
+ return [2, { data: data }];
87
+ }
88
+ });
89
+ }); });
79
90
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
91
  var _a, password, settings, responseBody, payload, data, steps, hasPasswordCompleted;
81
- var _b, _c, _d, _e, _f, _g;
82
- return __generator(this, function (_h) {
83
- switch (_h.label) {
92
+ var _b, _c, _d, _e, _f, _g, _h, _j;
93
+ return __generator(this, function (_k) {
94
+ switch (_k.label) {
84
95
  case 0:
85
96
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
86
97
  responseBody = password.data.verify.responseBody;
@@ -93,14 +104,17 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
93
104
  };
94
105
  return [4, API.leadService.verifyLeadOTP(payload)];
95
106
  case 1:
96
- data = (_h.sent()).data;
107
+ data = (_k.sent()).data;
108
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_d = (_c = password.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id))];
109
+ case 2:
110
+ _k.sent();
97
111
  if (!data.errors) {
98
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
99
112
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
100
- steps = (_g = password.data.verify.responseBody) === null || _g === void 0 ? void 0 : _g.steps;
113
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
114
+ steps = (_j = password.data.verify.responseBody) === null || _j === void 0 ? void 0 : _j.steps;
101
115
  hasPasswordCompleted = Object.keys(steps).find(function (key) { return key === PASSWORD_STEP_NAMES.PASSWORD_SUCCESS; });
102
116
  if (hasPasswordCompleted) {
103
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
117
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
104
118
  }
105
119
  else {
106
120
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
@@ -136,13 +150,13 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
136
150
  }); });
137
151
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
138
152
  var _a, settings, password, response, payload;
139
- var _b, _c, _d, _e, _f, _g;
140
- return __generator(this, function (_h) {
141
- switch (_h.label) {
153
+ var _b, _c, _d, _e, _f, _g, _h, _j;
154
+ return __generator(this, function (_k) {
155
+ switch (_k.label) {
142
156
  case 0:
143
157
  _a = thunkApi.getState(), settings = _a.settings, password = _a.password;
144
158
  response = undefined;
145
- if (!!!((_b = password.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
159
+ if (!!!((_b = password.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 3];
146
160
  payload = {
147
161
  step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
148
162
  id: ((_c = password.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
@@ -150,11 +164,16 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
150
164
  };
151
165
  return [4, API.leadService.updateLead(payload)];
152
166
  case 1:
153
- response = _h.sent();
154
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
155
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
156
- _h.label = 2;
157
- case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
167
+ response = _k.sent();
168
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.id))];
169
+ case 2:
170
+ _k.sent();
171
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
172
+ (_j = (_h = settings.data.appConfig).onFlowCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, { data: response === null || response === void 0 ? void 0 : response.data });
173
+ _k.label = 3;
174
+ case 3:
175
+ thunkApi.dispatch(handleNextScreenStep());
176
+ return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
158
177
  }
159
178
  });
160
179
  }); });
@@ -252,6 +271,26 @@ export var passwordSlice = createSlice({
252
271
  .addCase(createPassword.rejected, function (state, action) {
253
272
  state.loading = false;
254
273
  state.error = action.error.message;
274
+ })
275
+ .addCase(retrieveEntityInfo.pending, function (state) {
276
+ state.error = null;
277
+ state.loading = true;
278
+ })
279
+ .addCase(retrieveEntityInfo.fulfilled, function (state, action) {
280
+ var _a;
281
+ state.error = null;
282
+ state.loading = false;
283
+ var data = (action.payload || {}).data;
284
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
285
+ if (description) {
286
+ state.error = description;
287
+ return;
288
+ }
289
+ state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
290
+ })
291
+ .addCase(retrieveEntityInfo.rejected, function (state, action) {
292
+ state.error = action.error.message;
293
+ state.loading = false;
255
294
  })
256
295
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
257
296
  var _a;
@@ -5,6 +5,9 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  leadData: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
+ export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ }, string, {}>;
8
11
  export declare const verifyTaxLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
12
  data: any;
10
13
  formData: OTPFormValues;
@@ -76,11 +76,22 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
76
76
  }
77
77
  });
78
78
  }); });
79
+ export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
80
+ var data;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
84
+ case 1:
85
+ data = (_a.sent()).data;
86
+ return [2, { data: data }];
87
+ }
88
+ });
89
+ }); });
79
90
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
91
  var _a, tax, settings, responseBody, payload, data, steps, hasTaxCompleted;
81
- var _b, _c, _d, _e;
82
- return __generator(this, function (_f) {
83
- switch (_f.label) {
92
+ var _b, _c, _d, _e, _f, _g;
93
+ return __generator(this, function (_h) {
94
+ switch (_h.label) {
84
95
  case 0:
85
96
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
86
97
  responseBody = tax.data.verify.responseBody;
@@ -93,10 +104,13 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
93
104
  };
94
105
  return [4, API.leadService.verifyLeadOTP(payload)];
95
106
  case 1:
96
- data = (_f.sent()).data;
107
+ data = (_h.sent()).data;
108
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_d = (_c = tax.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id))];
109
+ case 2:
110
+ _h.sent();
97
111
  if (!data.errors) {
98
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
99
- steps = (_e = tax.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.steps;
112
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
113
+ steps = (_g = tax.data.verify.responseBody) === null || _g === void 0 ? void 0 : _g.steps;
100
114
  hasTaxCompleted = Object.keys(steps).find(function (key) { return key === TAX_STEP_NAMES.TAX_SUCCESS; });
101
115
  if (hasTaxCompleted) {
102
116
  thunkApi.dispatch(handleNextScreenStep('TAX_DETAILS_SUCCESS_STEP'));
@@ -134,13 +148,13 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
134
148
  }); });
135
149
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
136
150
  var _a, settings, tax, response, payload;
137
- var _b, _c, _d, _e, _f, _g;
138
- return __generator(this, function (_h) {
139
- switch (_h.label) {
151
+ var _b, _c, _d, _e, _f, _g, _h, _j;
152
+ return __generator(this, function (_k) {
153
+ switch (_k.label) {
140
154
  case 0:
141
155
  _a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
142
156
  response = undefined;
143
- if (!!!((_b = tax.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
157
+ if (!!!((_b = tax.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 3];
144
158
  payload = {
145
159
  step_name: TAX_STEP_NAMES.TAX_SUCCESS,
146
160
  id: ((_c = tax.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
@@ -148,11 +162,16 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
148
162
  };
149
163
  return [4, API.leadService.updateLead(payload)];
150
164
  case 1:
151
- response = _h.sent();
152
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
153
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
154
- _h.label = 2;
155
- case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
165
+ response = _k.sent();
166
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.id))];
167
+ case 2:
168
+ _k.sent();
169
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
170
+ (_j = (_h = settings.data.appConfig).onFlowCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, { data: response === null || response === void 0 ? void 0 : response.data });
171
+ _k.label = 3;
172
+ case 3:
173
+ thunkApi.dispatch(handleNextScreenStep());
174
+ return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
156
175
  }
157
176
  });
158
177
  }); });
@@ -249,6 +268,26 @@ export var taxSlice = createSlice({
249
268
  .addCase(updateTaxInfo.rejected, function (state, action) {
250
269
  state.loading = false;
251
270
  state.error = action.error.message;
271
+ })
272
+ .addCase(retrieveEntityInfo.pending, function (state) {
273
+ state.error = null;
274
+ state.loading = true;
275
+ })
276
+ .addCase(retrieveEntityInfo.fulfilled, function (state, action) {
277
+ var _a;
278
+ state.error = null;
279
+ state.loading = false;
280
+ var data = (action.payload || {}).data;
281
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
282
+ if (description) {
283
+ state.error = description;
284
+ return;
285
+ }
286
+ state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
287
+ })
288
+ .addCase(retrieveEntityInfo.rejected, function (state, action) {
289
+ state.error = action.error.message;
290
+ state.loading = false;
252
291
  })
253
292
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
254
293
  var _a;
@@ -40,6 +40,7 @@ import Input from '../../../shared/Input';
40
40
  import { useTranslation } from 'react-i18next';
41
41
  import { useController, useFormContext } from 'react-hook-form';
42
42
  import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
43
+ import { styled } from '@mui/material';
43
44
  import { MAX_IBAN_VALUE } from '../../../../constants';
44
45
  import { ScreenContainer } from '../../../shared/Containers';
45
46
  import { debounce } from 'lodash-es';
@@ -49,6 +50,11 @@ import axios from 'axios';
49
50
  import ClearIcon from '../../../shared/ClearIcon';
50
51
  import CheckIcon from '../../../shared/CheckIcon';
51
52
  import CircularProgress from '@mui/material/CircularProgress';
53
+ var InputStyled = styled(Input)(function () { return ({
54
+ input: {
55
+ textTransform: 'uppercase'
56
+ }
57
+ }); });
52
58
  var cancelToken = null;
53
59
  var IBAN = function (_a) {
54
60
  var _b;
@@ -86,6 +92,6 @@ var IBAN = function (_a) {
86
92
  var clearValue = function () {
87
93
  ibanControl.field.onChange('');
88
94
  };
89
- return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), 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 })) }) }));
95
+ return (_jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), 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 })) }) }));
90
96
  };
91
97
  export default IBAN;
@@ -2,18 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
- import { useAppDispatch } from '../../../../hooks';
6
- import { updateLeadSuccess } from '../../../app/bank/bankStore';
7
- import { handleNextScreenStep } from '../../../../app/settings';
5
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
6
+ import { bankSelector, updateLeadSuccess } from '../../../app/bank/bankStore';
8
7
  var Success = function (_a) {
9
8
  var t = useTranslation().t;
10
9
  var dispatch = useAppDispatch();
11
- React.useEffect(function () {
12
- dispatch(updateLeadSuccess());
13
- }, []);
10
+ var loading = useAppSelector(bankSelector).loading;
14
11
  var onSuccess = function () {
15
- dispatch(handleNextScreenStep());
12
+ dispatch(updateLeadSuccess());
16
13
  };
17
- return _jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue') });
14
+ return (_jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue'), disabledSuccessButton: loading }));
18
15
  };
19
16
  export default React.memo(Success);
@@ -44,13 +44,13 @@ var SuccessWithFlowButtons = function () {
44
44
  var t = useTranslation().t;
45
45
  var isAr = useLanguage().isAr;
46
46
  var data = useAppSelector(bankSelector).data;
47
- var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank, tax = _b.tax_id;
47
+ var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
48
  var _c = useState([]), buttons = _c[0], setButtons = _c[1];
49
49
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
- var licenseNumber = ((_a = entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
50
+ var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
51
51
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
52
52
  var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
53
- var taxID = tax || '';
53
+ var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
54
54
  var reMapFlowData = function (flows) {
55
55
  if (flows === void 0) { flows = []; }
56
56
  var images = ICONS_NAMES;
@@ -58,7 +58,7 @@ var SuccessWithFlowButtons = function () {
58
58
  var name = _a.name, url = _a.url, status = _a.status;
59
59
  var type = status === 'initiated' ? 'pending' : 'completed';
60
60
  var title = t("".concat(name, "_flow_").concat(type), {
61
- individual_name: username,
61
+ individual_name: username.toLowerCase(),
62
62
  business_type: businessType,
63
63
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
64
  bank_name: bankName,
@@ -66,6 +66,7 @@ var SuccessWithFlowButtons = function () {
66
66
  tax_id: t('masking_symbols') + taxID
67
67
  });
68
68
  var isCompleted = status === 'completed' && name !== 'password';
69
+ var isIndividual = name === 'individual';
69
70
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
70
71
  var hoverSrc = "".concat(name, "_white_icon");
71
72
  return {
@@ -73,7 +74,8 @@ var SuccessWithFlowButtons = function () {
73
74
  href: url,
74
75
  src: images[src],
75
76
  hoverSrc: images[hoverSrc],
76
- isCompleted: isCompleted
77
+ isCompleted: isCompleted,
78
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
77
79
  };
78
80
  });
79
81
  setButtons(mappedFlows);
@@ -4,16 +4,12 @@ import { useAppDispatch, useAppSelector } from '../../../../hooks';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import SuccessScreen from '../../../shared/SuccessScreen';
6
6
  import { businessSelector, updateLeadSuccess } from '../../../app/business/businessStore';
7
- import { handleNextScreenStep } from '../../../../app/settings';
8
7
  var Success = function (_a) {
9
8
  var t = useTranslation().t;
10
9
  var dispatch = useAppDispatch();
11
10
  var loading = useAppSelector(businessSelector).loading;
12
- React.useEffect(function () {
13
- dispatch(updateLeadSuccess());
14
- }, []);
15
11
  var onSuccess = function () {
16
- dispatch(handleNextScreenStep());
12
+ dispatch(updateLeadSuccess());
17
13
  };
18
14
  return (_jsx(SuccessScreen, { title: t('business_completed_title'), description: t('business_completed_description'), onSuccess: onSuccess, successTitle: t('business_completed_button'), disabledSuccessButton: loading }));
19
15
  };
@@ -44,13 +44,13 @@ var SuccessWithFlowButtons = function () {
44
44
  var t = useTranslation().t;
45
45
  var isAr = useLanguage().isAr;
46
46
  var data = useAppSelector(businessSelector).data;
47
- var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank, tax = _b.tax_id;
47
+ var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
48
  var _c = useState([]), buttons = _c[0], setButtons = _c[1];
49
49
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
50
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
51
51
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
52
52
  var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
53
- var taxID = tax || '';
53
+ var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
54
54
  var reMapFlowData = function (flows) {
55
55
  if (flows === void 0) { flows = []; }
56
56
  var images = ICONS_NAMES;
@@ -105,6 +105,9 @@ var Mobile = function (_a) {
105
105
  var isCountryListActive = listType === ListType.CountryCodeList;
106
106
  var listActive = isBusinessListActive || isCountryListActive;
107
107
  var disabled = !methods.formState.isValid || !!error;
108
- return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, isAr: isAr }, { children: t('absher_button_label') }))] }))] })) }))] }));
108
+ var title = t('join_our_community');
109
+ var subTitle = t('ide_terms_and_conditions_description');
110
+ console.log(!title, !subTitle);
111
+ return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, isAr: isAr }, { children: t('absher_button_label') }))] }))] })) }))] }));
109
112
  };
110
113
  export default React.memo(Mobile);
@@ -15,6 +15,7 @@ import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButton
15
15
  import PasswordVerifyPage from './password/screens/Verify';
16
16
  import CreatePasswordPage from './password/screens/CreatePassword';
17
17
  import SuccessPasswordPage from './password/screens/Success';
18
+ import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
18
19
  import IndividualVerifyPage from './individual/screens/Verify';
19
20
  import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
20
21
  import SuccessOwnerPage from './individual/screens/Success';
@@ -26,6 +27,7 @@ import BankSuccessWithFlowPage from './bank/screens/SuccessWithFlowButtons';
26
27
  import TaxVerifyPage from './tax/screens/Verify';
27
28
  import TaxDetailsPage from './tax/screens/TaxDetails';
28
29
  import TaxSuccessPage from './tax/screens/Success';
30
+ import TaxSuccessWithFlowPage from './tax/screens/SuccessWithFlowButtons';
29
31
  import VerifyAndRedirectPage from './Landing/screens/VerifyAndRedirect';
30
32
  export var connectFeatureScreens = [
31
33
  {
@@ -93,6 +95,10 @@ export var passwordFeatureScreens = [
93
95
  {
94
96
  name: 'PASSWORD_SUCCESS_STEP',
95
97
  element: SuccessPasswordPage
98
+ },
99
+ {
100
+ name: 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
101
+ element: PasswordSuccessWithFlowPage
96
102
  }
97
103
  ];
98
104
  export var individualFeatureScreens = [
@@ -143,6 +149,10 @@ export var taxFeatureScreens = [
143
149
  {
144
150
  name: 'TAX_DETAILS_SUCCESS_STEP',
145
151
  element: TaxSuccessPage
152
+ },
153
+ {
154
+ name: 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
155
+ element: TaxSuccessWithFlowPage
146
156
  }
147
157
  ];
148
158
  export var landingFeatureScreens = [
@@ -1,19 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { useAppDispatch } from '../../../../hooks';
5
- import { updateLeadSuccess } from '../../../app/individual/individualStore';
4
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
5
+ import { individualSelector, updateLeadSuccess } from '../../../app/individual/individualStore';
6
6
  import SuccessScreen from '../../../shared/SuccessScreen';
7
- import { handleNextScreenStep } from '../../../../app/settings';
8
7
  var Success = function (_a) {
9
8
  var t = useTranslation().t;
10
9
  var dispatch = useAppDispatch();
11
- React.useEffect(function () {
12
- dispatch(updateLeadSuccess());
13
- }, []);
10
+ var loading = useAppSelector(individualSelector).loading;
14
11
  var onSuccess = function () {
15
- dispatch(handleNextScreenStep());
12
+ dispatch(updateLeadSuccess());
16
13
  };
17
- return _jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue') });
14
+ return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'), disabledSuccessButton: loading }));
18
15
  };
19
16
  export default React.memo(Success);
@@ -44,13 +44,13 @@ var SuccessWithFlowButtons = function () {
44
44
  var t = useTranslation().t;
45
45
  var isAr = useLanguage().isAr;
46
46
  var data = useAppSelector(individualSelector).data;
47
- var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank, tax = _b.tax_id;
47
+ var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
48
  var _c = useState([]), buttons = _c[0], setButtons = _c[1];
49
49
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
- var licenseNumber = ((_a = entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
50
+ var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
51
51
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
52
52
  var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
53
- var taxID = tax || '';
53
+ var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
54
54
  var reMapFlowData = function (flows) {
55
55
  if (flows === void 0) { flows = []; }
56
56
  var images = ICONS_NAMES;
@@ -58,7 +58,7 @@ var SuccessWithFlowButtons = function () {
58
58
  var name = _a.name, url = _a.url, status = _a.status;
59
59
  var type = status === 'initiated' ? 'pending' : 'completed';
60
60
  var title = t("".concat(name, "_flow_").concat(type), {
61
- individual_name: username,
61
+ individual_name: username.toLowerCase(),
62
62
  business_type: businessType,
63
63
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
64
  bank_name: bankName,
@@ -66,6 +66,7 @@ var SuccessWithFlowButtons = function () {
66
66
  tax_id: t('masking_symbols') + taxID
67
67
  });
68
68
  var isCompleted = status === 'completed' && name !== 'password';
69
+ var isIndividual = name === 'individual';
69
70
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
70
71
  var hoverSrc = "".concat(name, "_white_icon");
71
72
  return {
@@ -73,7 +74,8 @@ var SuccessWithFlowButtons = function () {
73
74
  href: url,
74
75
  src: images[src],
75
76
  hoverSrc: images[hoverSrc],
76
- isCompleted: isCompleted
77
+ isCompleted: isCompleted,
78
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
77
79
  };
78
80
  });
79
81
  setButtons(mappedFlows);
@@ -1,16 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { useAppDispatch } from '../../../../hooks';
5
- import { updateLeadSuccess } from '../../../app/password/passwordStore';
4
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
5
+ import { updateLeadSuccess, passwordSelector } from '../../../app/password/passwordStore';
6
6
  import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- React.useEffect(function () {
10
+ var loading = useAppSelector(passwordSelector).loading;
11
+ var onSuccess = function () {
11
12
  dispatch(updateLeadSuccess());
12
- }, []);
13
- var onSuccess = function () { };
14
- return _jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue') });
13
+ };
14
+ return (_jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue'), disabledSuccessButton: loading }));
15
15
  };
16
16
  export default React.memo(Success);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,89 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo, useEffect, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { styled } from '@mui/material/styles';
16
+ import { FlowsButtons } from '../../../shared/Button';
17
+ import { ICONS_NAMES } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { showLastFour } from '../../../../utils';
20
+ import { passwordSelector } from '../../../app/password/passwordStore';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../../components/Text';
23
+ import Container from '../../../shared/Containers/ScreenContainer';
24
+ var TitleStyled = styled(Text)(function (_a) {
25
+ var theme = _a.theme;
26
+ return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), marginBlockStart: theme.spacing(2.875), lineHeight: 1.75, padding: '0px 20px' }));
27
+ });
28
+ var ContainerStyled = styled(Container)(function (_a) {
29
+ var theme = _a.theme;
30
+ return ({
31
+ justifyContent: 'space-between',
32
+ minHeight: theme.spacing(30),
33
+ alignItems: 'center'
34
+ });
35
+ });
36
+ var ButtonGroupStyled = styled(Box)(function (_a) {
37
+ var theme = _a.theme;
38
+ return ({
39
+ width: '100%'
40
+ });
41
+ });
42
+ var SuccessWithFlowButtons = function () {
43
+ var _a;
44
+ var t = useTranslation().t;
45
+ var isAr = useLanguage().isAr;
46
+ var data = useAppSelector(passwordSelector).data;
47
+ var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
+ var _c = useState([]), buttons = _c[0], setButtons = _c[1];
49
+ var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
+ var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
51
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
52
+ var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
53
+ var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
54
+ var reMapFlowData = function (flows) {
55
+ if (flows === void 0) { flows = []; }
56
+ var images = ICONS_NAMES;
57
+ var mappedFlows = flows.map(function (_a) {
58
+ var name = _a.name, url = _a.url, status = _a.status;
59
+ var type = status === 'initiated' ? 'pending' : 'completed';
60
+ var title = t("".concat(name, "_flow_").concat(type), {
61
+ individual_name: username.toLowerCase(),
62
+ business_type: businessType,
63
+ license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
+ bank_name: bankName,
65
+ iban: t('masking_symbols') + iban,
66
+ tax_id: t('masking_symbols') + taxID
67
+ });
68
+ var isCompleted = status === 'completed' && name !== 'password';
69
+ var isIndividual = name === 'individual';
70
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
+ var hoverSrc = "".concat(name, "_white_icon");
72
+ return {
73
+ title: title,
74
+ href: url,
75
+ src: images[src],
76
+ hoverSrc: images[hoverSrc],
77
+ isCompleted: isCompleted,
78
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
79
+ };
80
+ });
81
+ setButtons(mappedFlows);
82
+ };
83
+ useEffect(function () {
84
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
+ reMapFlowData(flows);
86
+ }, [flows, isAr]);
87
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
+ };
89
+ export default memo(SuccessWithFlowButtons);
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -1,16 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { useAppDispatch } from '../../../../hooks';
5
- import { updateLeadSuccess } from '../../../app/tax/taxStore';
4
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
5
+ import { updateLeadSuccess, taxSelector } from '../../../app/tax/taxStore';
6
6
  import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- React.useEffect(function () {
10
+ var loading = useAppSelector(taxSelector).loading;
11
+ var onSuccess = function () {
11
12
  dispatch(updateLeadSuccess());
12
- }, []);
13
- var onSuccess = function () { };
14
- return _jsx(SuccessScreen, { title: t('tax_success_title'), onSuccess: onSuccess, successTitle: t('continue') });
13
+ };
14
+ return (_jsx(SuccessScreen, { title: t('tax_success_title'), onSuccess: onSuccess, successTitle: t('continue'), disabledSuccessButton: loading }));
15
15
  };
16
16
  export default React.memo(Success);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,89 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo, useEffect, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { styled } from '@mui/material/styles';
16
+ import { FlowsButtons } from '../../../shared/Button';
17
+ import { ICONS_NAMES } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { showLastFour } from '../../../../utils';
20
+ import { taxSelector } from '../../../app/tax/taxStore';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../../components/Text';
23
+ import Container from '../../../shared/Containers/ScreenContainer';
24
+ var TitleStyled = styled(Text)(function (_a) {
25
+ var theme = _a.theme;
26
+ return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), marginBlockStart: theme.spacing(2.875), lineHeight: 1.75, padding: '0px 20px' }));
27
+ });
28
+ var ContainerStyled = styled(Container)(function (_a) {
29
+ var theme = _a.theme;
30
+ return ({
31
+ justifyContent: 'space-between',
32
+ minHeight: theme.spacing(30),
33
+ alignItems: 'center'
34
+ });
35
+ });
36
+ var ButtonGroupStyled = styled(Box)(function (_a) {
37
+ var theme = _a.theme;
38
+ return ({
39
+ width: '100%'
40
+ });
41
+ });
42
+ var SuccessWithFlowButtons = function () {
43
+ var _a;
44
+ var t = useTranslation().t;
45
+ var isAr = useLanguage().isAr;
46
+ var data = useAppSelector(taxSelector).data;
47
+ var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
+ var _c = useState([]), buttons = _c[0], setButtons = _c[1];
49
+ var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
+ var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
51
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
52
+ var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
53
+ var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
54
+ var reMapFlowData = function (flows) {
55
+ if (flows === void 0) { flows = []; }
56
+ var images = ICONS_NAMES;
57
+ var mappedFlows = flows.map(function (_a) {
58
+ var name = _a.name, url = _a.url, status = _a.status;
59
+ var type = status === 'initiated' ? 'pending' : 'completed';
60
+ var title = t("".concat(name, "_flow_").concat(type), {
61
+ individual_name: username.toLowerCase(),
62
+ business_type: businessType,
63
+ license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
+ bank_name: bankName,
65
+ iban: t('masking_symbols') + iban,
66
+ tax_id: t('masking_symbols') + taxID
67
+ });
68
+ var isCompleted = status === 'completed' && name !== 'password';
69
+ var isIndividual = name === 'individual';
70
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
+ var hoverSrc = "".concat(name, "_white_icon");
72
+ return {
73
+ title: title,
74
+ href: url,
75
+ src: images[src],
76
+ hoverSrc: images[hoverSrc],
77
+ isCompleted: isCompleted,
78
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
79
+ };
80
+ });
81
+ setButtons(mappedFlows);
82
+ };
83
+ useEffect(function () {
84
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
+ reMapFlowData(flows);
86
+ }, [flows, isAr]);
87
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
+ };
89
+ export default memo(SuccessWithFlowButtons);
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,4 @@
1
+ export declare const useRedirectionData: <T>(dataKey?: string) => {
2
+ data?: T | undefined;
3
+ error: boolean;
4
+ };
@@ -0,0 +1,12 @@
1
+ import { decodeObjectBase64, getParameterByName } from '../utils';
2
+ export var useRedirectionData = function (dataKey) {
3
+ if (dataKey === void 0) { dataKey = 'data'; }
4
+ var dataToken = getParameterByName(dataKey);
5
+ if (!dataToken)
6
+ return { error: true };
7
+ var data = decodeObjectBase64(dataToken);
8
+ return {
9
+ data: data,
10
+ error: false
11
+ };
12
+ };
@@ -1 +1,3 @@
1
1
  export declare const compareTwoObjects: (obj1: any, obj2: any) => boolean;
2
+ export declare const encodeObjectBase64: (obj: any) => string;
3
+ export declare const decodeObjectBase64: (str: string) => any;
@@ -5,3 +5,14 @@ export var compareTwoObjects = function (obj1, obj2) {
5
5
  return false;
6
6
  return JSON.stringify(obj1) === JSON.stringify(obj2);
7
7
  };
8
+ export var encodeObjectBase64 = function (obj) {
9
+ return Buffer.from(JSON.stringify(obj)).toString('base64');
10
+ };
11
+ export var decodeObjectBase64 = function (str) {
12
+ try {
13
+ return JSON.parse(Buffer.from(str, 'base64').toString('ascii'));
14
+ }
15
+ catch (error) {
16
+ throw new Error('Invalid base64 string or invalid json format. try to check [decodeObjectBase64]');
17
+ }
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",