@tap-payments/auth-jsconnect 1.0.53 → 1.0.54

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.
@@ -46,7 +46,7 @@ export declare type ActivitiesFormValues = {
46
46
  };
47
47
  export declare type CustomersFormValues = {
48
48
  customerLocations: Array<CustomerLocation>;
49
- expectedCustomers: ExpectedCustomer | undefined;
49
+ expectedCustomer: ExpectedCustomer | undefined;
50
50
  expectedSalesRange: ExpectedSaleRange | undefined;
51
51
  refundPolicy: boolean;
52
52
  transactionPolicy: boolean;
@@ -2,6 +2,6 @@ declare const dataService: {
2
2
  getChannelsOfServices: () => Promise<import("axios").AxiosResponse<any, any>>;
3
3
  getCustomerBases: () => Promise<import("axios").AxiosResponse<any, any>>;
4
4
  getExpectedSales: () => Promise<import("axios").AxiosResponse<any, any>>;
5
- getExpectedCutomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
5
+ getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
6
6
  };
7
7
  export { dataService };
package/build/api/data.js CHANGED
@@ -9,13 +9,13 @@ var getCustomerBases = function () {
9
9
  var getExpectedSales = function () {
10
10
  return instance.get("".concat(ENDPOINT_PATHS.SALES));
11
11
  };
12
- var getExpectedCutomerSales = function () {
12
+ var getExpectedCustomerSales = function () {
13
13
  return instance.get("".concat(ENDPOINT_PATHS.EXPECTED_CUSTOMERS));
14
14
  };
15
15
  var dataService = {
16
16
  getChannelsOfServices: getChannelsOfServices,
17
17
  getCustomerBases: getCustomerBases,
18
18
  getExpectedSales: getExpectedSales,
19
- getExpectedCutomerSales: getExpectedCutomerSales
19
+ getExpectedCustomerSales: getExpectedCustomerSales
20
20
  };
21
21
  export { dataService };
@@ -47,7 +47,7 @@ declare const API: {
47
47
  getChannelsOfServices: () => Promise<import("axios").AxiosResponse<any, any>>;
48
48
  getCustomerBases: () => Promise<import("axios").AxiosResponse<any, any>>;
49
49
  getExpectedSales: () => Promise<import("axios").AxiosResponse<any, any>>;
50
- getExpectedCutomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
50
+ getExpectedCustomerSales: () => Promise<import("axios").AxiosResponse<any, any>>;
51
51
  };
52
52
  };
53
53
  export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoCreateBody, EntityInfoUpdateBody, CreateAccountBody };
@@ -6,6 +6,6 @@ export interface AnimationFlowProps {
6
6
  type?: 'PUPOP' | 'BOTTOMSHEET';
7
7
  breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
8
  loading?: boolean;
9
- error?: string;
9
+ error?: string | null;
10
10
  }
11
11
  export default function AnimationFlow({ open, children, breakpoint, type, footer, loading, error }: AnimationFlowProps): JSX.Element;
@@ -15,6 +15,7 @@ import useMediaQuery from '@mui/material/useMediaQuery';
15
15
  import Dialog from './Dialog';
16
16
  import BottomSheet from './BottomSheet';
17
17
  import Loader from './Loader';
18
+ import Error from './Error';
18
19
  export default function AnimationFlow(_a) {
19
20
  var open = _a.open, children = _a.children, breakpoint = _a.breakpoint, type = _a.type, footer = _a.footer, loading = _a.loading, error = _a.error;
20
21
  var theme = useTheme();
@@ -22,6 +23,9 @@ export default function AnimationFlow(_a) {
22
23
  if (loading) {
23
24
  return _jsx(Loader, {});
24
25
  }
26
+ if (error) {
27
+ return _jsx(Error, { error: error });
28
+ }
25
29
  if (type === 'PUPOP') {
26
30
  return (_jsx(Dialog, __assign({ footer: footer, open: open }, { children: children })));
27
31
  }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ error: string;
4
+ }
5
+ export default function Error({ error }: Props): JSX.Element;
6
+ export {};
@@ -0,0 +1,32 @@
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 { jsx as _jsx } from "react/jsx-runtime";
13
+ import { styled } from '@mui/material/styles';
14
+ import Box from '@mui/material/Box';
15
+ import Text from '../Text';
16
+ var BoxStyled = styled(Box)(function () { return ({
17
+ width: '100%',
18
+ height: '100%',
19
+ display: 'flex',
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ backgroundColor: 'rgba(0,0,0,0.5)',
23
+ zIndex: 2
24
+ }); });
25
+ export default function Error(_a) {
26
+ var error = _a.error;
27
+ return (_jsx(BoxStyled, { children: _jsx(Text, __assign({ sx: {
28
+ fontSize: '17px',
29
+ color: '#fff',
30
+ textAlign: 'center'
31
+ } }, { children: error })) }));
32
+ }
@@ -7,7 +7,9 @@ var BoxStyled = styled(Box)(function () { return ({
7
7
  height: '100%',
8
8
  display: 'flex',
9
9
  justifyContent: 'center',
10
- alignItems: 'center'
10
+ alignItems: 'center',
11
+ backgroundColor: 'rgba(0,0,0,0.5)',
12
+ zIndex: 2
11
13
  }); });
12
14
  export default function FlowLoading() {
13
15
  return (_jsx(BoxStyled, { children: _jsx(Loader, { svgStyle: { width: 60, height: 60 }, innerColor: '#000', outerColor: '#000', toggleAnimation: true }) }));
@@ -168,7 +168,7 @@ export var BANK_SCREENS_NAVIGATION = [
168
168
  export var TAX_SCREENS_NAVIGATION = [
169
169
  {
170
170
  name: 'TAX_VERIFY_STEP',
171
- next: 'TAX_TAX_DETAILS_STEP',
171
+ next: ['TAX_TAX_DETAILS_STEP', 'TAX_DETAILS_SUCCESS_STEP'],
172
172
  prev: '',
173
173
  order: 1
174
174
  },
@@ -55,7 +55,7 @@ export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<
55
55
  data: any;
56
56
  formData: {
57
57
  customerLocations: import("../../../@types").CustomerLocation[];
58
- expectedCustomers: import("../../../@types").ExpectedCustomer | undefined;
58
+ expectedCustomer: import("../../../@types").ExpectedCustomer | undefined;
59
59
  expectedSalesRange: import("../../../@types").ExpectedSaleRange | undefined;
60
60
  refundPolicy: boolean;
61
61
  transactionPolicy: boolean;
@@ -270,32 +270,32 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
270
270
  return [4, API.entityService.createEntityInfo(requestBody, { headers: headers })];
271
271
  case 1:
272
272
  data = (_f.sent()).data;
273
- if (!data.errors) {
274
- thunkApi.dispatch(retrieveDataList());
275
- thunkApi.dispatch(handleNextScreenStep());
276
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
277
- }
278
- return [2, { data: data, formData: __assign({}, params) }];
273
+ if (!!data.errors) return [3, 3];
274
+ return [4, thunkApi.dispatch(retrieveDataList())];
275
+ case 2:
276
+ _f.sent();
277
+ thunkApi.dispatch(handleNextScreenStep());
278
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
279
+ _f.label = 3;
280
+ case 3: return [2, { data: data, formData: __assign({}, params) }];
279
281
  }
280
282
  });
281
283
  }); });
282
284
  export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
283
- var customerBases, expectedSales, expectedCustomerSales;
284
- return __generator(this, function (_a) {
285
- switch (_a.label) {
286
- case 0: return [4, API.dataService.getCustomerBases()];
285
+ var _a, customerBases, expectedSales, expectedCustomerSales;
286
+ return __generator(this, function (_b) {
287
+ switch (_b.label) {
288
+ case 0: return [4, Promise.all([
289
+ API.dataService.getCustomerBases(),
290
+ API.dataService.getExpectedSales(),
291
+ API.dataService.getExpectedCustomerSales()
292
+ ])];
287
293
  case 1:
288
- customerBases = _a.sent();
289
- return [4, API.dataService.getExpectedSales()];
290
- case 2:
291
- expectedSales = _a.sent();
292
- return [4, API.dataService.getExpectedCutomerSales()];
293
- case 3:
294
- expectedCustomerSales = _a.sent();
294
+ _a = _b.sent(), customerBases = _a[0].data, expectedSales = _a[1].data, expectedCustomerSales = _a[2].data;
295
295
  return [2, {
296
- customerBases: customerBases === null || customerBases === void 0 ? void 0 : customerBases.data,
297
- expectedSales: expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.data,
298
- expectedCustomerSales: expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.data
296
+ customerBases: customerBases,
297
+ expectedSales: expectedSales,
298
+ expectedCustomerSales: expectedCustomerSales
299
299
  }];
300
300
  }
301
301
  });
@@ -314,7 +314,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
314
314
  requestBody = {
315
315
  customers_base: customerBase,
316
316
  id: (_b = business.data.businessTypeData.responseBody) === null || _b === void 0 ? void 0 : _b.entity_id,
317
- customers_served_monthly: parseInt(((_c = params.expectedCustomers) === null || _c === void 0 ? void 0 : _c.id) || '0'),
317
+ customers_served_monthly: parseInt(((_c = params.expectedCustomer) === null || _c === void 0 ? void 0 : _c.id) || '0'),
318
318
  yearly_sales_range: ((_d = params.expectedSalesRange) === null || _d === void 0 ? void 0 : _d.title) || '',
319
319
  agree_refund: params.refundPolicy,
320
320
  agree_chargeback: params.transactionPolicy,
@@ -387,7 +387,7 @@ var initialState = {
387
387
  },
388
388
  customersData: {
389
389
  customerLocations: [],
390
- expectedCustomers: undefined,
390
+ expectedCustomer: undefined,
391
391
  expectedSalesRange: undefined,
392
392
  refundPolicy: false,
393
393
  transactionPolicy: false
@@ -598,15 +598,9 @@ export var businessSlice = createSlice({
598
598
  state.error = null;
599
599
  })
600
600
  .addCase(retrieveDataList.fulfilled, function (state, action) {
601
- var _a, _b, _c;
602
601
  state.loading = false;
603
602
  state.error = null;
604
- var _d = action.payload, customerBases = _d.customerBases, expectedSales = _d.expectedSales, expectedCustomerSales = _d.expectedCustomerSales;
605
- var description = (((_a = customerBases === null || customerBases === void 0 ? void 0 : customerBases.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.errors) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.errors) === null || _c === void 0 ? void 0 : _c[0]) || {}).description;
606
- if (description) {
607
- state.error = description;
608
- return;
609
- }
603
+ var _a = action.payload, customerBases = _a.customerBases, expectedSales = _a.expectedSales, expectedCustomerSales = _a.expectedCustomerSales;
610
604
  var data = state.data.activitiesData.responseBody;
611
605
  state.data.activitiesData.responseBody = __assign(__assign({}, data), { customerBases: customerBases || [], expectedSales: expectedSales || [], expectedCustomerSales: expectedCustomerSales || [] });
612
606
  var selectedCustomerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[0];
@@ -617,7 +611,7 @@ export var businessSlice = createSlice({
617
611
  state.data.customersData.expectedSalesRange = selectedExpectedSale;
618
612
  var selectedExpectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[(expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.length) - 1];
619
613
  if (!!selectedExpectedCustomerSale)
620
- state.data.customersData.expectedCustomers = selectedExpectedCustomerSale;
614
+ state.data.customersData.expectedCustomer = selectedExpectedCustomerSale;
621
615
  })
622
616
  .addCase(retrieveDataList.rejected, function (state, action) {
623
617
  state.loading = false;
@@ -7,10 +7,12 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
7
7
  }, string, {}>;
8
8
  export declare const verifyTaxLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  data: any;
10
- formData: {
11
- otp: string;
12
- };
10
+ formData: OTPFormValues;
13
11
  }, OTPFormValues, {}>;
12
+ export declare const updateTaxInfo: import("@reduxjs/toolkit").AsyncThunk<{
13
+ data: any;
14
+ formData: TaxFormValues;
15
+ }, TaxFormValues, {}>;
14
16
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
15
17
  response: any;
16
18
  formData: void;
@@ -77,10 +77,10 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
77
77
  });
78
78
  }); });
79
79
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
80
- var _a, tax, settings, responseBody, payload, data;
81
- var _b, _c, _d;
82
- return __generator(this, function (_e) {
83
- switch (_e.label) {
80
+ 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) {
84
84
  case 0:
85
85
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
86
86
  responseBody = tax.data.verify.responseBody;
@@ -93,33 +93,66 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
93
93
  };
94
94
  return [4, API.leadService.verifyLeadOTP(payload)];
95
95
  case 1:
96
- data = (_e.sent()).data;
96
+ data = (_f.sent()).data;
97
97
  if (!data.errors) {
98
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;
100
+ hasTaxCompleted = Object.keys(steps).find(function (key) { return key === TAX_STEP_NAMES.TAX_SUCCESS; });
101
+ if (hasTaxCompleted) {
102
+ thunkApi.dispatch(handleNextScreenStep('TAX_DETAILS_SUCCESS_STEP'));
103
+ }
104
+ else {
105
+ thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
106
+ }
107
+ }
108
+ return [2, { data: data, formData: params }];
109
+ }
110
+ });
111
+ }); });
112
+ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var _a, settings, tax, requestBody, data;
114
+ var _b, _c, _d, _e;
115
+ return __generator(this, function (_f) {
116
+ switch (_f.label) {
117
+ case 0:
118
+ _a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
119
+ requestBody = {
120
+ id: (_c = (_b = tax.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
121
+ vat_id: params.vatId,
122
+ step_name: TAX_STEP_NAMES.TAX_INFO
123
+ };
124
+ return [4, API.entityService.updateEntityInfo(requestBody)];
125
+ case 1:
126
+ data = (_f.sent()).data;
127
+ if (!data.errors) {
99
128
  thunkApi.dispatch(handleNextScreenStep());
129
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
100
130
  }
101
- return [2, { data: data, formData: __assign({}, params) }];
131
+ return [2, { data: data, formData: params }];
102
132
  }
103
133
  });
104
134
  }); });
105
135
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
106
- var _a, settings, tax, payload, data;
107
- var _b, _c, _d, _e, _f;
108
- return __generator(this, function (_g) {
109
- switch (_g.label) {
136
+ var _a, settings, tax, response, payload;
137
+ var _b, _c, _d, _e, _f, _g;
138
+ return __generator(this, function (_h) {
139
+ switch (_h.label) {
110
140
  case 0:
111
141
  _a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
142
+ response = undefined;
143
+ if (!!!((_b = tax.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
112
144
  payload = {
113
145
  step_name: TAX_STEP_NAMES.TAX_SUCCESS,
114
- id: ((_b = tax.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
146
+ id: ((_c = tax.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
115
147
  encryption_contract: []
116
148
  };
117
149
  return [4, API.leadService.updateLead(payload)];
118
150
  case 1:
119
- data = (_g.sent()).data;
120
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
121
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
122
- return [2, { response: data, formData: params }];
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 }];
123
156
  }
124
157
  });
125
158
  }); });
@@ -189,6 +222,27 @@ export var taxSlice = createSlice({
189
222
  .addCase(verifyTaxLeadOTP.rejected, function (state, action) {
190
223
  state.loading = false;
191
224
  state.error = action.error.message;
225
+ })
226
+ .addCase(updateTaxInfo.pending, function (state) {
227
+ state.loading = true;
228
+ state.error = null;
229
+ })
230
+ .addCase(updateTaxInfo.fulfilled, function (state, action) {
231
+ var _a;
232
+ state.loading = false;
233
+ state.error = null;
234
+ var _b = action.payload, data = _b.data, formData = _b.formData;
235
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
236
+ if (description) {
237
+ state.error = description;
238
+ return;
239
+ }
240
+ state.data.taxData = formData;
241
+ state.data.taxData.responseBody = data;
242
+ })
243
+ .addCase(updateTaxInfo.rejected, function (state, action) {
244
+ state.loading = false;
245
+ state.error = action.error.message;
192
246
  })
193
247
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
194
248
  var _a;
@@ -27,7 +27,7 @@ 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
- var data = useAppSelector(settingsSelector).data;
30
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var loading = useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props)).loading;
32
32
  useErrorListener();
33
33
  var activeScreen = data.activeScreen;
@@ -41,7 +41,7 @@ var Bank = memo(function (props) {
41
41
  if (!loading)
42
42
  verifyToken();
43
43
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
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
45
  var Element = _a.element, name = _a.name;
46
46
  var isActive = activeScreen.name === name;
47
47
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -27,7 +27,7 @@ var Business = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
- var data = useAppSelector(settingsSelector).data;
30
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var loading = useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props)).loading;
32
32
  useErrorListener();
33
33
  var activeScreen = data.activeScreen;
@@ -44,7 +44,7 @@ var Business = memo(function (props) {
44
44
  useEffect(function () {
45
45
  dispatch(getCountries());
46
46
  }, []);
47
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
47
+ 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: businessFeatureScreens.map(function (_a, index) {
48
48
  var Element = _a.element, name = _a.name;
49
49
  var isActive = activeScreen.name === name;
50
50
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -68,11 +68,11 @@ var Customers = function (_a) {
68
68
  dispatch(clearError());
69
69
  }, [methods.formState.isValid]);
70
70
  React.useEffect(function () {
71
- var customerLocations = customerData.customerLocations, expectedCustomers = customerData.expectedCustomers, expectedSalesRange = customerData.expectedSalesRange;
71
+ var customerLocations = customerData.customerLocations, expectedCustomer = customerData.expectedCustomer, expectedSalesRange = customerData.expectedSalesRange;
72
72
  methods.setValue('customerLocations', customerLocations);
73
- methods.setValue('expectedCustomers', expectedCustomers);
73
+ methods.setValue('expectedCustomer', expectedCustomer);
74
74
  methods.setValue('expectedSalesRange', expectedSalesRange);
75
- }, [customerData.customerLocations, customerData.expectedCustomers, customerData.expectedSalesRange]);
75
+ }, [customerData.customerLocations, customerData.expectedCustomer, customerData.expectedSalesRange]);
76
76
  var isCustomerLocationsListActive = listActive === ListType.CustomerLocationsList;
77
77
  var isExpectedCustomersListActive = listActive === ListType.ExpectedCustomersList;
78
78
  var isExpectedSalesListActive = listActive === ListType.ExpectedSalesList;
@@ -51,7 +51,7 @@ var ExpectedCustomers = function (_a) {
51
51
  var t = useTranslation().t;
52
52
  var isAr = useLanguage().isAr;
53
53
  var control = useFormContext().control;
54
- var expectedCustomersControl = useController({ name: 'expectedCustomers', control: control });
54
+ var expectedCustomerControl = useController({ name: 'expectedCustomer', control: control });
55
55
  var data = useSelector(businessSelector).data;
56
56
  var activitiesData = data.activitiesData;
57
57
  var response = activitiesData.responseBody;
@@ -72,10 +72,10 @@ var ExpectedCustomers = function (_a) {
72
72
  }
73
73
  }, [response === null || response === void 0 ? void 0 : response.expectedCustomerSales]);
74
74
  var onSelectItem = function (expectedCustomers) {
75
- expectedCustomersControl.field.onChange(expectedCustomers);
75
+ expectedCustomerControl.field.onChange(expectedCustomers);
76
76
  onCloseList();
77
77
  };
78
- var expectedCustomersValue = expectedCustomersControl.field.value;
78
+ var expectedCustomersValue = expectedCustomerControl.field.value;
79
79
  var expectedCustomersSelected = expectedCustomersValue;
80
80
  return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.titleAr : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.title, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
81
81
  return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.titleAr : item.title })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIconStyled, {})] }));
@@ -27,14 +27,14 @@ var Connect = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
- var _a = useAppSelector(settingsSelector), data = _a.data, loading = _a.loading;
30
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  useAppConfig(__assign({ navigation: CONNECT_SCREENS_NAVIGATION }, props));
32
32
  useErrorListener();
33
33
  var activeScreen = data.activeScreen;
34
34
  useEffect(function () {
35
35
  dispatch(getCountries());
36
36
  }, []);
37
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: false, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
37
+ 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: connectFeatureScreens.map(function (_a, index) {
38
38
  var Element = _a.element, name = _a.name;
39
39
  var isActive = activeScreen.name === name;
40
40
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -87,7 +87,7 @@ var SocialMedia = function (_a) {
87
87
  };
88
88
  React.useEffect(function () {
89
89
  if (!!brandName) {
90
- var website = "www.".concat(brandName.replace(' ', '-'), ".com");
90
+ var website = "www.".concat(brandName.replaceAll(' ', '-'), ".com");
91
91
  setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
92
92
  }
93
93
  if (!brandName && isNewUser === false) {
@@ -27,7 +27,7 @@ var Individual = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
- var data = useAppSelector(settingsSelector).data;
30
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
32
32
  useErrorListener();
33
33
  var activeScreen = data.activeScreen;
@@ -41,7 +41,7 @@ var Individual = memo(function (props) {
41
41
  if (!loading)
42
42
  verifyToken();
43
43
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
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: individualFeatureScreens.map(function (_a, index) {
45
45
  var Element = _a.element, name = _a.name;
46
46
  var isActive = activeScreen.name === name;
47
47
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -27,7 +27,7 @@ var Password = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
- var data = useAppSelector(settingsSelector).data;
30
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var loading = useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props)).loading;
32
32
  useErrorListener();
33
33
  var activeScreen = data.activeScreen;
@@ -41,7 +41,7 @@ var Password = memo(function (props) {
41
41
  if (!loading)
42
42
  verifyToken();
43
43
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
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: passwordFeatureScreens.map(function (_a, index) {
45
45
  var Element = _a.element, name = _a.name;
46
46
  var isActive = activeScreen.name === name;
47
47
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -27,7 +27,7 @@ var Tax = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
- var data = useAppSelector(settingsSelector).data;
30
+ var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
31
  var loading = useAppConfig(__assign({ navigation: TAX_SCREENS_NAVIGATION }, props)).loading;
32
32
  useErrorListener();
33
33
  var activeScreen = data.activeScreen;
@@ -41,7 +41,7 @@ var Tax = memo(function (props) {
41
41
  if (!loading)
42
42
  verifyToken();
43
43
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
44
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, error: error, loading: settingLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
45
45
  var Element = _a.element, name = _a.name;
46
46
  var isActive = activeScreen.name === name;
47
47
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -1,9 +1,15 @@
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
6
  import SuccessScreen from '../../../shared/SuccessScreen';
5
7
  var Success = function (_a) {
6
8
  var t = useTranslation().t;
9
+ var dispatch = useAppDispatch();
10
+ React.useEffect(function () {
11
+ dispatch(updateLeadSuccess());
12
+ }, []);
7
13
  var onSuccess = function () {
8
14
  window.open('mailto:');
9
15
  };
@@ -17,29 +17,28 @@ import { useTranslation } from 'react-i18next';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { useForm, FormProvider } from 'react-hook-form';
19
19
  import Form from '../../../../components/Form';
20
- import { handleNextScreenStep } from '../../../../app/settings';
21
20
  import { Validation } from './validation';
22
21
  import { yupResolver } from '@hookform/resolvers/yup';
22
+ import { taxSelector, updateTaxInfo } from '../../../app/tax/taxStore';
23
23
  import VATId from './VATId';
24
+ import { useSelector } from 'react-redux';
24
25
  var FormStyled = styled(Form)(function () { return ({
25
26
  display: 'flex',
26
27
  flexDirection: 'column'
27
28
  }); });
28
29
  var TaxDetails = function () {
29
30
  var dispatch = useAppDispatch();
31
+ var _a = useSelector(taxSelector), data = _a.data, loading = _a.loading, error = _a.error;
30
32
  var methods = useForm({
31
33
  resolver: yupResolver(Validation),
32
- defaultValues: {
33
- vatId: ''
34
- },
34
+ defaultValues: data.taxData,
35
35
  mode: 'onChange'
36
36
  });
37
37
  var t = useTranslation().t;
38
38
  var isAr = useLanguage().isAr;
39
39
  var onSubmit = function (data) {
40
- console.log('data', data);
41
- dispatch(handleNextScreenStep());
40
+ dispatch(updateTaxInfo(data));
42
41
  };
43
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, {}), _jsx(Button, __assign({ disableBack: true, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') }))] })) })) }));
42
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, {}), _jsx(Button, __assign({ disableBack: true, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
44
43
  };
45
44
  export default TaxDetails;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",