@tap-payments/auth-jsconnect 1.0.79 → 1.0.84

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 (44) hide show
  1. package/build/api/entity.d.ts +1 -2
  2. package/build/assets/locales/ar.json +2 -1
  3. package/build/assets/locales/en.json +2 -1
  4. package/build/constants/app.js +8 -12
  5. package/build/constants/assets.d.ts +1 -0
  6. package/build/constants/assets.js +2 -1
  7. package/build/features/app/bank/bankStore.d.ts +1 -1
  8. package/build/features/app/bank/bankStore.js +40 -41
  9. package/build/features/app/business/businessStore.js +29 -28
  10. package/build/features/app/connect/connectStore.js +9 -7
  11. package/build/features/app/individual/individualStore.d.ts +1 -1
  12. package/build/features/app/individual/individualStore.js +29 -29
  13. package/build/features/app/password/passwordStore.d.ts +1 -1
  14. package/build/features/app/password/passwordStore.js +34 -36
  15. package/build/features/app/tax/taxStore.d.ts +1 -1
  16. package/build/features/app/tax/taxStore.js +34 -35
  17. package/build/features/bank/Bank.js +3 -2
  18. package/build/features/bank/screens/Success/Success.js +2 -2
  19. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  20. package/build/features/business/screens/Success/Success.js +2 -2
  21. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  22. package/build/features/connect/screens/Merchant/Merchant.js +5 -3
  23. package/build/features/connect/screens/Merchant/SocialMedia.js +11 -7
  24. package/build/features/connect/screens/Merchant/validation.js +9 -3
  25. package/build/features/individual/screens/Success/Success.js +2 -2
  26. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  27. package/build/features/password/Password.js +3 -2
  28. package/build/features/password/screens/Success/Success.js +2 -2
  29. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  30. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.d.ts +7 -0
  31. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +65 -0
  32. package/build/features/shared/AcceptancePayouts/index.d.ts +2 -0
  33. package/build/features/shared/AcceptancePayouts/index.js +2 -0
  34. package/build/features/shared/Button/Button.d.ts +2 -1
  35. package/build/features/shared/Button/Button.js +4 -2
  36. package/build/features/shared/Button/FlowsButtons.js +22 -7
  37. package/build/features/shared/Button/index.d.ts +1 -1
  38. package/build/features/shared/Button/index.js +1 -1
  39. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -2
  40. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -3
  41. package/build/features/tax/Tax.js +3 -2
  42. package/build/features/tax/screens/Success/Success.js +2 -2
  43. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +26 -11
  44. package/package.json +1 -1
@@ -89,9 +89,9 @@ export var retrieveEntityInfo = createAsyncThunk('retrievePasswordEntityInfo', f
89
89
  }); });
90
90
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
91
91
  var _a, password, settings, responseBody, payload, data, steps, hasPasswordCompleted;
92
- var _b, _c, _d, _e, _f, _g, _h, _j;
93
- return __generator(this, function (_k) {
94
- switch (_k.label) {
92
+ var _b, _c, _d, _e;
93
+ return __generator(this, function (_f) {
94
+ switch (_f.label) {
95
95
  case 0:
96
96
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
97
97
  responseBody = password.data.verify.responseBody;
@@ -104,23 +104,21 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
104
104
  };
105
105
  return [4, API.leadService.verifyLeadOTP(payload)];
106
106
  case 1:
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))];
107
+ data = (_f.sent()).data;
108
+ if (!!data.errors) return [3, 4];
109
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
110
+ steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
111
+ hasPasswordCompleted = Object.keys(steps).find(function (key) { return key === PASSWORD_STEP_NAMES.PASSWORD_SUCCESS; });
112
+ if (!hasPasswordCompleted) return [3, 3];
113
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
109
114
  case 2:
110
- _k.sent();
111
- if (!data.errors) {
112
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
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;
115
- hasPasswordCompleted = Object.keys(steps).find(function (key) { return key === PASSWORD_STEP_NAMES.PASSWORD_SUCCESS; });
116
- if (hasPasswordCompleted) {
117
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
118
- }
119
- else {
120
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
121
- }
122
- }
123
- return [2, { data: data, formData: __assign({}, params) }];
115
+ _f.sent();
116
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
117
+ return [3, 4];
118
+ case 3:
119
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
120
+ _f.label = 4;
121
+ case 4: return [2, { data: data, formData: __assign({}, params) }];
124
122
  }
125
123
  });
126
124
  }); });
@@ -149,31 +147,30 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
149
147
  });
150
148
  }); });
151
149
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
152
- var _a, settings, password, response, payload;
153
- var _b, _c, _d, _e, _f, _g, _h, _j;
154
- return __generator(this, function (_k) {
155
- switch (_k.label) {
150
+ var _a, settings, password, id, payload, data;
151
+ var _b, _c, _d, _e, _f;
152
+ return __generator(this, function (_g) {
153
+ switch (_g.label) {
156
154
  case 0:
157
155
  _a = thunkApi.getState(), settings = _a.settings, password = _a.password;
158
- response = undefined;
159
- if (!!!((_b = password.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 3];
156
+ id = (password.data.verify.responseBody || {}).id;
157
+ if (!id)
158
+ return [2];
160
159
  payload = {
161
160
  step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
162
- id: ((_c = password.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
161
+ id: id,
163
162
  encryption_contract: []
164
163
  };
165
164
  return [4, API.leadService.updateLead(payload)];
166
165
  case 1:
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))];
166
+ data = (_g.sent()).data;
167
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
169
168
  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:
169
+ _g.sent();
170
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
171
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
175
172
  thunkApi.dispatch(handleNextScreenStep());
176
- return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
173
+ return [2, { response: data, formData: params }];
177
174
  }
178
175
  });
179
176
  }); });
@@ -286,7 +283,7 @@ export var passwordSlice = createSlice({
286
283
  state.error = description;
287
284
  return;
288
285
  }
289
- state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
286
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
290
287
  })
291
288
  .addCase(retrieveEntityInfo.rejected, function (state, action) {
292
289
  state.error = action.error.message;
@@ -296,12 +293,13 @@ export var passwordSlice = createSlice({
296
293
  var _a;
297
294
  state.loading = false;
298
295
  state.error = null;
299
- var response = action.payload.response;
296
+ var response = (action.payload || {}).response;
300
297
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
301
298
  if (description) {
302
299
  state.error = description;
303
300
  return;
304
301
  }
302
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: response.flows });
305
303
  removeRequestHeaders();
306
304
  })
307
305
  .addCase(updateLeadSuccess.pending, function (state) {
@@ -19,7 +19,7 @@ export declare const updateTaxInfo: import("@reduxjs/toolkit").AsyncThunk<{
19
19
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
20
20
  response: any;
21
21
  formData: void;
22
- }, void, {}>;
22
+ } | undefined, void, {}>;
23
23
  declare type VerifyData = {
24
24
  token: string;
25
25
  };
@@ -89,9 +89,9 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', functi
89
89
  }); });
90
90
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
91
91
  var _a, tax, settings, responseBody, payload, data, steps, hasTaxCompleted;
92
- var _b, _c, _d, _e, _f, _g;
93
- return __generator(this, function (_h) {
94
- switch (_h.label) {
92
+ var _b, _c, _d, _e;
93
+ return __generator(this, function (_f) {
94
+ switch (_f.label) {
95
95
  case 0:
96
96
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
97
97
  responseBody = tax.data.verify.responseBody;
@@ -104,22 +104,21 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
104
104
  };
105
105
  return [4, API.leadService.verifyLeadOTP(payload)];
106
106
  case 1:
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))];
107
+ data = (_f.sent()).data;
108
+ if (!!data.errors) return [3, 4];
109
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
110
+ steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
111
+ hasTaxCompleted = Object.keys(steps).find(function (key) { return key === TAX_STEP_NAMES.TAX_SUCCESS; });
112
+ if (!hasTaxCompleted) return [3, 3];
113
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
109
114
  case 2:
110
- _h.sent();
111
- if (!data.errors) {
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;
114
- hasTaxCompleted = Object.keys(steps).find(function (key) { return key === TAX_STEP_NAMES.TAX_SUCCESS; });
115
- if (hasTaxCompleted) {
116
- thunkApi.dispatch(handleNextScreenStep('TAX_DETAILS_SUCCESS_STEP'));
117
- }
118
- else {
119
- thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
120
- }
121
- }
122
- return [2, { data: data, formData: params }];
115
+ _f.sent();
116
+ thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
117
+ return [3, 4];
118
+ case 3:
119
+ thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
120
+ _f.label = 4;
121
+ case 4: return [2, { data: data, formData: params }];
123
122
  }
124
123
  });
125
124
  }); });
@@ -147,31 +146,30 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
147
146
  });
148
147
  }); });
149
148
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
150
- var _a, settings, tax, response, payload;
151
- var _b, _c, _d, _e, _f, _g, _h, _j;
152
- return __generator(this, function (_k) {
153
- switch (_k.label) {
149
+ var _a, settings, tax, id, payload, data;
150
+ var _b, _c, _d, _e, _f;
151
+ return __generator(this, function (_g) {
152
+ switch (_g.label) {
154
153
  case 0:
155
154
  _a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
156
- response = undefined;
157
- if (!!!((_b = tax.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 3];
155
+ id = (tax.data.verify.responseBody || {}).id;
156
+ if (!id)
157
+ return [2];
158
158
  payload = {
159
159
  step_name: TAX_STEP_NAMES.TAX_SUCCESS,
160
- id: ((_c = tax.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
160
+ id: id,
161
161
  encryption_contract: []
162
162
  };
163
163
  return [4, API.leadService.updateLead(payload)];
164
164
  case 1:
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))];
165
+ data = (_g.sent()).data;
166
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
167
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:
168
+ _g.sent();
169
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
170
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
173
171
  thunkApi.dispatch(handleNextScreenStep());
174
- return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
172
+ return [2, { response: data, formData: params }];
175
173
  }
176
174
  });
177
175
  }); });
@@ -283,7 +281,7 @@ export var taxSlice = createSlice({
283
281
  state.error = description;
284
282
  return;
285
283
  }
286
- state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
284
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
287
285
  })
288
286
  .addCase(retrieveEntityInfo.rejected, function (state, action) {
289
287
  state.error = action.error.message;
@@ -293,12 +291,13 @@ export var taxSlice = createSlice({
293
291
  var _a;
294
292
  state.loading = false;
295
293
  state.error = null;
296
- var response = action.payload.response;
294
+ var response = (action.payload || {}).response;
297
295
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
298
296
  if (description) {
299
297
  state.error = description;
300
298
  return;
301
299
  }
300
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: response.flows });
302
301
  removeRequestHeaders();
303
302
  })
304
303
  .addCase(updateLeadSuccess.pending, function (state) {
@@ -22,12 +22,13 @@ import { FeatureContainer } from '../shared/Containers';
22
22
  import { BANK_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { bankFeatureScreens } from '../featuresScreens';
24
24
  import CustomFooter from '../shared/Footer';
25
- import { verifyLeadToken } from '../app/bank/bankStore';
25
+ import { bankSelector, verifyLeadToken } from '../app/bank/bankStore';
26
26
  var Bank = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
+ var customLoading = useAppSelector(bankSelector).customLoading;
31
32
  var loading = useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props)).loading;
32
33
  useErrorListener();
33
34
  var activeScreen = data.activeScreen;
@@ -41,7 +42,7 @@ var Bank = memo(function (props) {
41
42
  if (!loading)
42
43
  verifyToken();
43
44
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
45
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
45
46
  var Element = _a.element, name = _a.name;
46
47
  var isActive = activeScreen.name === name;
47
48
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -7,10 +7,10 @@ import { bankSelector, updateLeadSuccess } from '../../../app/bank/bankStore';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var loading = useAppSelector(bankSelector).loading;
10
+ var _b = useAppSelector(bankSelector), loading = _b.loading, error = _b.error;
11
11
  var onSuccess = function () {
12
12
  dispatch(updateLeadSuccess());
13
13
  };
14
- return (_jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue'), disabledSuccessButton: loading }));
14
+ return (_jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
15
15
  };
16
16
  export default React.memo(Success);
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect, useState } from 'react';
13
+ import React, { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
@@ -21,9 +21,11 @@ import { bankSelector } from '../../../app/bank/bankStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
+ import AcceptancePayouts from '../../../shared/AcceptancePayouts';
24
25
  var TitleStyled = styled(Text)(function (_a) {
26
+ var _b;
25
27
  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' }));
28
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
27
29
  });
28
30
  var ContainerStyled = styled(Container)(function (_a) {
29
31
  var theme = _a.theme;
@@ -36,37 +38,46 @@ var ContainerStyled = styled(Container)(function (_a) {
36
38
  var ButtonGroupStyled = styled(Box)(function (_a) {
37
39
  var theme = _a.theme;
38
40
  return ({
39
- width: '100%'
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
40
43
  });
41
44
  });
42
45
  var SuccessWithFlowButtons = function () {
43
- var _a;
46
+ var _a, _b, _c;
44
47
  var t = useTranslation().t;
45
48
  var isAr = useLanguage().isAr;
49
+ var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
50
+ var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
46
51
  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;
48
- var _c = useState([]), buttons = _c[0], setButtons = _c[1];
52
+ var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
53
+ var _g = useState([]), buttons = _g[0], setButtons = _g[1];
49
54
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
55
  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) || '';
56
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || t('bank');
57
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
53
58
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
+ var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
54
60
  var reMapFlowData = function (flows) {
55
61
  if (flows === void 0) { flows = []; }
56
62
  var images = ICONS_NAMES;
63
+ var statuses = [];
57
64
  var mappedFlows = flows.map(function (_a) {
58
65
  var name = _a.name, url = _a.url, status = _a.status;
59
66
  var type = status === 'initiated' ? 'pending' : 'completed';
60
67
  var title = t("".concat(name, "_flow_").concat(type), {
61
68
  individual_name: username.toLowerCase(),
62
- business_type: businessType,
69
+ business_type: brandName,
63
70
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
71
  bank_name: bankName,
65
72
  iban: t('masking_symbols') + iban,
66
- tax_id: t('masking_symbols') + taxID
73
+ tax_id: t('masking_symbols') + showLastFour(taxID)
67
74
  });
75
+ if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
76
+ setIsAcceptance(true);
68
77
  var isCompleted = status === 'completed' && name !== 'password';
69
78
  var isIndividual = name === 'individual';
79
+ if (name !== 'password')
80
+ statuses.push(isCompleted);
70
81
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
82
  var hoverSrc = "".concat(name, "_white_icon");
72
83
  return {
@@ -79,11 +90,14 @@ var SuccessWithFlowButtons = function () {
79
90
  };
80
91
  });
81
92
  setButtons(mappedFlows);
93
+ var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length;
94
+ if (isAllCompleted)
95
+ setIsPayout(true);
82
96
  };
83
97
  useEffect(function () {
84
98
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
99
  reMapFlowData(flows);
86
100
  }, [flows, isAr]);
87
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
101
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
102
  };
89
103
  export default memo(SuccessWithFlowButtons);
@@ -7,10 +7,10 @@ import { businessSelector, updateLeadSuccess } from '../../../app/business/busin
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var loading = useAppSelector(businessSelector).loading;
10
+ var _b = useAppSelector(businessSelector), loading = _b.loading, error = _b.error;
11
11
  var onSuccess = function () {
12
12
  dispatch(updateLeadSuccess());
13
13
  };
14
- return (_jsx(SuccessScreen, { title: t('business_completed_title'), description: t('business_completed_description'), onSuccess: onSuccess, successTitle: t('business_completed_button'), disabledSuccessButton: loading }));
14
+ return (_jsx(SuccessScreen, { title: t('business_completed_title'), description: t('business_completed_description'), onSuccess: onSuccess, successTitle: t('business_completed_button'), loading: loading, error: error || '' }));
15
15
  };
16
16
  export default React.memo(Success);
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect, useState } from 'react';
13
+ import React, { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
@@ -21,9 +21,11 @@ import { showLastFour } from '../../../../utils';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
+ import AcceptancePayouts from '../../../shared/AcceptancePayouts';
24
25
  var TitleStyled = styled(Text)(function (_a) {
26
+ var _b;
25
27
  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' }));
28
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
27
29
  });
28
30
  var ContainerStyled = styled(Container)(function (_a) {
29
31
  var theme = _a.theme;
@@ -36,37 +38,46 @@ var ContainerStyled = styled(Container)(function (_a) {
36
38
  var ButtonGroupStyled = styled(Box)(function (_a) {
37
39
  var theme = _a.theme;
38
40
  return ({
39
- width: '100%'
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
40
43
  });
41
44
  });
42
45
  var SuccessWithFlowButtons = function () {
43
- var _a;
46
+ var _a, _b, _c;
44
47
  var t = useTranslation().t;
45
48
  var isAr = useLanguage().isAr;
49
+ var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
50
+ var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
46
51
  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;
48
- var _c = useState([]), buttons = _c[0], setButtons = _c[1];
52
+ var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
53
+ var _g = useState([]), buttons = _g[0], setButtons = _g[1];
49
54
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
55
  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) || '';
56
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
57
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
53
58
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
+ var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
54
60
  var reMapFlowData = function (flows) {
55
61
  if (flows === void 0) { flows = []; }
56
62
  var images = ICONS_NAMES;
63
+ var statuses = [];
57
64
  var mappedFlows = flows.map(function (_a) {
58
65
  var name = _a.name, url = _a.url, status = _a.status;
59
66
  var type = status === 'initiated' ? 'pending' : 'completed';
60
67
  var title = t("".concat(name, "_flow_").concat(type), {
61
68
  individual_name: username.toLowerCase(),
62
- business_type: businessType,
69
+ business_type: brandName,
63
70
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
71
  bank_name: bankName,
65
72
  iban: t('masking_symbols') + iban,
66
- tax_id: t('masking_symbols') + taxID
73
+ tax_id: t('masking_symbols') + showLastFour(taxID)
67
74
  });
75
+ if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
76
+ setIsAcceptance(true);
68
77
  var isCompleted = status === 'completed' && name !== 'password';
69
78
  var isIndividual = name === 'individual';
79
+ if (name !== 'password')
80
+ statuses.push(isCompleted);
70
81
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
82
  var hoverSrc = "".concat(name, "_white_icon");
72
83
  return {
@@ -79,11 +90,14 @@ var SuccessWithFlowButtons = function () {
79
90
  };
80
91
  });
81
92
  setButtons(mappedFlows);
93
+ var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length;
94
+ if (isAllCompleted)
95
+ setIsPayout(true);
82
96
  };
83
97
  useEffect(function () {
84
98
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
99
  reMapFlowData(flows);
86
100
  }, [flows, isAr]);
87
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
101
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
102
  };
89
103
  export default memo(SuccessWithFlowButtons);
@@ -73,7 +73,7 @@ var Merchant = function (_a) {
73
73
  if (isNewUser === true) {
74
74
  setUserType(ValidationOptions.NEW_USER);
75
75
  }
76
- if (isNewUser === false && methods.getValues('selectedBrandItem').id === 'other') {
76
+ if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && methods.getValues('selectedBrandItem').id === 'other') {
77
77
  setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
78
78
  methods.clearErrors();
79
79
  setTimeout(function () {
@@ -82,7 +82,7 @@ var Merchant = function (_a) {
82
82
  methods.setValue('links', sites);
83
83
  }, 100);
84
84
  }
85
- if (isNewUser === false && methods.getValues('selectedBrandItem').id !== 'other') {
85
+ if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && methods.getValues('selectedBrandItem').id !== 'other') {
86
86
  setUserType(ValidationOptions.EXISTING_USER_WITH_EXIST_BRAND);
87
87
  methods.clearErrors();
88
88
  var twitter = ((_a = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) || '';
@@ -98,7 +98,9 @@ var Merchant = function (_a) {
98
98
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
99
99
  var disabled = brandErrChecks || brandNameChecking || ((_d = data.brandData.responseBody) === null || _d === void 0 ? void 0 : _d.response_code) === '5';
100
100
  var isBrandListAvailable = userType !== ValidationOptions.NEW_USER && brandList.length > 0;
101
- var askingForBrandInfo = userType === ValidationOptions.NEW_USER || userType === ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND;
101
+ var askingForBrandInfo = userType === ValidationOptions.NEW_USER ||
102
+ brandList.length === 0 ||
103
+ userType === ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND;
102
104
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: isBrandListAvailable, list: brandList, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(BrandName, { show: !listActive && askingForBrandInfo, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(SocialMedia, { show: !listActive, isNewUser: isNewUser }), _jsx(TAC, { show: !listActive && askingForBrandInfo }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
103
105
  };
104
106
  export default React.memo(Merchant);
@@ -22,6 +22,8 @@ import Collapse from '../../../../components/Collapse';
22
22
  import SocialMediaGroup from '../../../../components/SocialMediaGroup';
23
23
  import { ScreenContainer } from '../../../shared/Containers';
24
24
  import CheckIcon from '../../../shared/CheckIcon';
25
+ import { useAppSelector } from '../../../../hooks';
26
+ import { connectSelector } from '../../../app/connect/connectStore';
25
27
  var SocialMediaGroupStyled = styled(SocialMediaGroup)(function (_a) {
26
28
  var theme = _a.theme, defaultValue = _a.defaultValue;
27
29
  return ({
@@ -56,14 +58,16 @@ var ClearIconStyled = styled(ClearIcon)(function (_a) {
56
58
  });
57
59
  });
58
60
  var SocialMedia = function (_a) {
59
- var _b, _c, _d;
61
+ var _b, _c, _d, _e;
60
62
  var show = _a.show, sx = _a.sx, isNewUser = _a.isNewUser;
61
- var _e = React.useState(SocialMediaTypes.WEB), socialMediaType = _e[0], setSocialMediaType = _e[1];
63
+ var _f = React.useState(SocialMediaTypes.WEB), socialMediaType = _f[0], setSocialMediaType = _f[1];
62
64
  var t = useTranslation().t;
63
- var _f = useFormContext(), control = _f.control, setValue = _f.setValue, watch = _f.watch;
65
+ var _g = useFormContext(), control = _g.control, setValue = _g.setValue, watch = _g.watch;
64
66
  var linksControl = useController({ control: control, name: 'links' });
65
67
  var links = linksControl.field.value;
66
68
  var brandName = watch('brandName');
69
+ var data = useAppSelector(connectSelector).data;
70
+ var brandList = ((_b = data.brandData.responseBody) === null || _b === void 0 ? void 0 : _b.brands) || [];
67
71
  var handleChange = function (_a) {
68
72
  var _b;
69
73
  var target = _a.target;
@@ -90,7 +94,7 @@ var SocialMedia = function (_a) {
90
94
  var website = "www.".concat(brandName.replaceAll(' ', '-'), ".com");
91
95
  setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
92
96
  }
93
- if (!brandName && isNewUser === false) {
97
+ if (!brandName && isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0) {
94
98
  var website = "other.com";
95
99
  setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
96
100
  }
@@ -103,9 +107,9 @@ var SocialMedia = function (_a) {
103
107
  var twitterValue = links.twitter || '';
104
108
  var instagramValue = links.instagram || '';
105
109
  var errors = linksControl.fieldState.error;
106
- var websiteError = (_b = errors === null || errors === void 0 ? void 0 : errors.website) === null || _b === void 0 ? void 0 : _b.message;
107
- var twitterError = (_c = errors === null || errors === void 0 ? void 0 : errors.twitter) === null || _c === void 0 ? void 0 : _c.message;
108
- var instagramError = (_d = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _d === void 0 ? void 0 : _d.message;
110
+ var websiteError = (_c = errors === null || errors === void 0 ? void 0 : errors.website) === null || _c === void 0 ? void 0 : _c.message;
111
+ var twitterError = (_d = errors === null || errors === void 0 ? void 0 : errors.twitter) === null || _d === void 0 ? void 0 : _d.message;
112
+ var instagramError = (_e = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _e === void 0 ? void 0 : _e.message;
109
113
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: __assign({ mt: 3, mb: 3, direction: 'ltr' }, sx) }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, exclusive: true, onChange: function (e, value) {
110
114
  setSocialMediaType(value);
111
115
  } }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, onBlur: function () { return handleBlueWebsite(); }, startAdornment: _jsx(TextStyled, { children: "https://" }), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? _jsx(CheckIcon, {}) : twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })));
@@ -12,9 +12,15 @@ export var MerchantValidationSchema = function (userType) {
12
12
  return yup.object().shape({
13
13
  brandName: yup
14
14
  .string()
15
- .min(3, 'enter_brand_name_english_chars_numbers_space')
16
- .max(250, 'enter_brand_name_english_chars_numbers_space')
17
- .required('enter_valid_brand_name'),
15
+ .test({
16
+ test: function (value) {
17
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
18
+ if (length === 0)
19
+ return true;
20
+ return length < 3 ? this.createError({ message: 'enter_brand_name_english_chars_numbers_space' }) : true;
21
+ }
22
+ })
23
+ .required(''),
18
24
  termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond'),
19
25
  links: yup.object().shape({
20
26
  website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
@@ -7,10 +7,10 @@ import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var loading = useAppSelector(individualSelector).loading;
10
+ var _b = useAppSelector(individualSelector), loading = _b.loading, error = _b.error;
11
11
  var onSuccess = function () {
12
12
  dispatch(updateLeadSuccess());
13
13
  };
14
- return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'), disabledSuccessButton: loading }));
14
+ return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
15
15
  };
16
16
  export default React.memo(Success);