@tap-payments/auth-jsconnect 1.0.38 → 1.0.40

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.
@@ -99,13 +99,13 @@ export interface Activity {
99
99
  }
100
100
  export interface SalesChannel {
101
101
  id: number;
102
- name: string;
103
- nameEn: string;
102
+ titleAr: string;
103
+ title: string;
104
104
  }
105
105
  export interface SourceOfIncome {
106
106
  id: number;
107
- name: string;
108
- nameEn: string;
107
+ titleAr: string;
108
+ title: string;
109
109
  }
110
110
  export interface AppInfo {
111
111
  name: string;
@@ -77,7 +77,7 @@ export var BUSINESS_SCREENS_NAVIGATION = [
77
77
  {
78
78
  name: 'BUSINESS_BUSINESS_TYPE_STEP',
79
79
  next: 'BUSINESS_CONFIRM_STEP',
80
- prev: 'BUSINESS_OTP_STEP',
80
+ prev: 'BUSINESS_IDBOD_STEP',
81
81
  order: 2
82
82
  },
83
83
  {
@@ -338,6 +338,6 @@ export declare const SALES_CHANNELS: {
338
338
  }[];
339
339
  export declare const SOURCE_OF_INCOME: {
340
340
  id: number;
341
- name: string;
342
- nameEn: string;
341
+ titleAr: string;
342
+ title: string;
343
343
  }[];
@@ -6425,10 +6425,10 @@ export var SALES_CHANNELS = [
6425
6425
  { id: 5, nameEn: 'Call Center', name: 'مركز اتصال' }
6426
6426
  ];
6427
6427
  export var SOURCE_OF_INCOME = [
6428
- { id: 1, name: 'راتب', nameEn: 'Salary' },
6429
- { id: 2, name: 'تمويل', nameEn: 'Investment' },
6430
- { id: 3, name: 'ورث', nameEn: 'Inheritance / inherit' },
6431
- { id: 4, name: 'اسهم', nameEn: 'Stocks' },
6432
- { id: 5, name: 'تجارة', nameEn: 'Trading' },
6433
- { id: 6, name: 'غير ذلك', nameEn: 'Other' }
6428
+ { id: 1, titleAr: 'راتب', title: 'Salary' },
6429
+ { id: 2, titleAr: 'تمويل', title: 'Investment' },
6430
+ { id: 3, titleAr: 'ورث', title: 'Inheritance / inherit' },
6431
+ { id: 4, titleAr: 'اسهم', title: 'Stocks' },
6432
+ { id: 5, titleAr: 'تجارة', title: 'Trading' },
6433
+ { id: 6, titleAr: 'غير ذلك', title: 'Other' }
6434
6434
  ];
@@ -57,11 +57,8 @@ export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<
57
57
  expectedSalesRange: import("../../../@types").ExpectedSaleRange | undefined;
58
58
  refundPolicy: boolean;
59
59
  transactionPolicy: boolean;
60
- isResend: boolean;
61
60
  };
62
- }, CustomersFormValues & {
63
- isResend: boolean;
64
- }, {}>;
61
+ }, CustomersFormValues, {}>;
65
62
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
66
63
  response: any;
67
64
  formData: void;
@@ -91,8 +88,9 @@ export interface BusinessState extends SharedState<BusinessData> {
91
88
  export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
92
89
  clearError: (state: BusinessState) => void;
93
90
  stopLoader: (state: BusinessState) => void;
91
+ resetOTPScreen: (state: BusinessState) => void;
94
92
  }, "business/store">;
95
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
93
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
96
94
  declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
97
95
  export default _default;
98
96
  export declare const businessSelector: (state: RootState) => BusinessState;
@@ -308,7 +308,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
308
308
  return [4, API.entityService.updateEntityInfo(requestBody, { headers: headers })];
309
309
  case 1:
310
310
  data = (_e.sent()).data;
311
- if (!data.errors && !params.isResend) {
311
+ if (!data.errors) {
312
312
  thunkApi.dispatch(handleNextScreenStep());
313
313
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
314
314
  }
@@ -393,6 +393,9 @@ export var businessSlice = createSlice({
393
393
  },
394
394
  stopLoader: function (state) {
395
395
  state.loading = false;
396
+ },
397
+ resetOTPScreen: function (state) {
398
+ state.data.otpData.otp = '';
396
399
  }
397
400
  },
398
401
  extraReducers: function (builder) {
@@ -449,8 +452,9 @@ export var businessSlice = createSlice({
449
452
  state.loading = false;
450
453
  state.error = action.error.message;
451
454
  })
452
- .addCase(updateLeadIdentity.pending, function (state) {
453
- state.loading = true;
455
+ .addCase(updateLeadIdentity.pending, function (state, action) {
456
+ var _a;
457
+ state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
454
458
  state.error = null;
455
459
  })
456
460
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
@@ -558,9 +562,9 @@ export var businessSlice = createSlice({
558
562
  state.loading = false;
559
563
  state.error = null;
560
564
  var _c = action.payload, data = _c.data, channelsData = _c.channelsData;
561
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
562
- if (description) {
563
- state.error = description;
565
+ var message = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).message;
566
+ if (message) {
567
+ state.error = message;
564
568
  return;
565
569
  }
566
570
  if ((data === null || data === void 0 ? void 0 : data.status) === 'ALREADY_TAKEN') {
@@ -640,6 +644,6 @@ export var businessSlice = createSlice({
640
644
  });
641
645
  }
642
646
  });
643
- export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
647
+ export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
644
648
  export default businessSlice.reducer;
645
649
  export var businessSelector = function (state) { return state.business; };
@@ -486,8 +486,9 @@ export var connectSlice = createSlice({
486
486
  state.data.mobileData.responseBody = response;
487
487
  state.data.otpData.isAbsher = false;
488
488
  })
489
- .addCase(createMobileAuth.pending, function (state) {
490
- state.loading = true;
489
+ .addCase(createMobileAuth.pending, function (state, action) {
490
+ var _a;
491
+ state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
491
492
  state.error = null;
492
493
  })
493
494
  .addCase(createMobileAuth.rejected, function (state, action) {
@@ -508,8 +509,9 @@ export var connectSlice = createSlice({
508
509
  state.data.nidData.responseBody = response;
509
510
  state.data.otpData.isAbsher = true;
510
511
  })
511
- .addCase(createNIDAuth.pending, function (state) {
512
- state.loading = true;
512
+ .addCase(createNIDAuth.pending, function (state, action) {
513
+ var _a;
514
+ state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
513
515
  state.error = null;
514
516
  })
515
517
  .addCase(createNIDAuth.rejected, function (state, action) {
@@ -25,7 +25,7 @@ import SalesChannels from './SalesChannels';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
26
26
  import Collapse from '../../../../components/Collapse';
27
27
  import OperationStartDate from './OperationStartDate';
28
- import { businessSelector, updateActivitiesInfo } from '../../../app/business/businessStore';
28
+ import { businessSelector, clearError, updateActivitiesInfo } from '../../../app/business/businessStore';
29
29
  import { ActivitiesValidationSchema } from './validation';
30
30
  var FormStyled = styled(Form)(function () { return ({
31
31
  display: 'flex',
@@ -38,8 +38,8 @@ var Activities = function () {
38
38
  var dispatch = useAppDispatch();
39
39
  var isAr = useLanguage().isAr;
40
40
  var t = useTranslation().t;
41
- var data = useSelector(businessSelector).data;
42
- var response = data.businessInfo.responseBody;
41
+ var _d = useSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
42
+ var businessTypeResponse = data.businessTypeData.responseBody;
43
43
  var methods = useForm({
44
44
  resolver: yupResolver(ActivitiesValidationSchema),
45
45
  defaultValues: data.activitiesData,
@@ -55,10 +55,15 @@ var Activities = function () {
55
55
  var onBack = function () {
56
56
  dispatch(handlePrevScreenStep());
57
57
  };
58
+ React.useEffect(function () {
59
+ if (error)
60
+ dispatch(clearError());
61
+ }, [methods.formState.isValid]);
58
62
  var handleMenuClick = function () {
59
63
  anchorEl ? setAnchorEl(false) : setAnchorEl(true);
60
64
  };
61
- var activities_list = ((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0;
62
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!activities_list && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
65
+ var activities_list = ((_a = businessTypeResponse === null || businessTypeResponse === void 0 ? void 0 : businessTypeResponse.activities) === null || _a === void 0 ? void 0 : _a.length) > 0;
66
+ var disabled = !methods.formState.isValid || !!error;
67
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!activities_list && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
63
68
  };
64
69
  export default Activities;
@@ -94,7 +94,7 @@ var ActivitiesList = function (_a) {
94
94
  if (((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
95
95
  setActivitiesMenuList(response === null || response === void 0 ? void 0 : response.activities);
96
96
  }
97
- }, [response === null || response === void 0 ? void 0 : response.activities]);
97
+ }, []);
98
98
  var onOpenList = function (event) {
99
99
  var _a;
100
100
  setAnchorEl(event.currentTarget);
@@ -1,14 +1,3 @@
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
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
2
  import { InputLabelStyled } from './ActivitiesList';
14
3
  import { useTranslation } from 'react-i18next';
@@ -26,6 +15,6 @@ var OperationStartDate = function (_a) {
26
15
  oDateControl.field.onChange(data);
27
16
  };
28
17
  var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
29
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] })));
18
+ return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] }));
30
19
  };
31
20
  export default OperationStartDate;
@@ -105,6 +105,6 @@ var SalesChannels = function () {
105
105
  if (channelsChecked)
106
106
  return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
107
107
  };
108
- return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id.toString(), disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name : channel.nameEn, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
108
+ return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id.toString(), disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.titleAr : channel.title, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
109
109
  };
110
110
  export default SalesChannels;
@@ -57,7 +57,7 @@ var Customers = function (_a) {
57
57
  });
58
58
  var onSubmit = function (data) {
59
59
  console.log('data', data);
60
- dispatch(updateCustomersInfo(__assign(__assign({}, data), { isResend: false })));
60
+ dispatch(updateCustomersInfo(__assign({}, data)));
61
61
  };
62
62
  var onBack = function () {
63
63
  dispatch(handlePrevScreenStep());
@@ -23,7 +23,7 @@ import { useLanguage } from '../../../../hooks';
23
23
  import Form from '../../../../components/Form';
24
24
  import Text from '../../../../components/Text';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
26
- import { businessSelector, clearError, verifyLeadOTP } from '../../../app/business/businessStore';
26
+ import { businessSelector, clearError, resetOTPScreen, verifyLeadOTP } from '../../../app/business/businessStore';
27
27
  import Button from '../../../shared/Button';
28
28
  import { maskID } from '../../../../utils';
29
29
  import { OTPValidation } from './validation';
@@ -41,7 +41,7 @@ var OTPTitleContainerStyled = styled(Box)(function (_a) {
41
41
  });
42
42
  var OTPTitleStyled = styled(Text)(function (_a) {
43
43
  var theme = _a.theme;
44
- return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightLight, color: theme.palette.text.primary, marginBlock: theme.spacing(1.75), marginInlineStart: theme.spacing(2.5), lineHeight: 1.75 }));
44
+ return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightLight, color: theme.palette.text.primary, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
45
45
  });
46
46
  var FormStyled = styled(Form)(function () { return ({
47
47
  display: 'flex',
@@ -60,6 +60,9 @@ var OTP = function (_a) {
60
60
  React.useEffect(function () {
61
61
  if (error)
62
62
  dispatch(clearError());
63
+ return function () {
64
+ dispatch(resetOTPScreen());
65
+ };
63
66
  }, [methods.formState.isValid]);
64
67
  var onSubmit = function (formData) {
65
68
  dispatch(verifyLeadOTP(formData));
@@ -24,7 +24,7 @@ import { maskPhone } from '../../../../utils';
24
24
  import Form from '../../../../components/Form';
25
25
  import Text from '../../../../components/Text';
26
26
  import { ScreenContainer } from '../../../shared/Containers';
27
- import { businessSelector, clearError, verifyLeadOTP } from '../../../app/business/businessStore';
27
+ import { businessSelector, clearError, resetOTPScreen, verifyLeadOTP } from '../../../app/business/businessStore';
28
28
  import Button from '../../../shared/Button';
29
29
  import { OTPValidation } from './validation';
30
30
  import OTPInput from './OTPInput';
@@ -61,6 +61,9 @@ var VerifyNumber = function (_a) {
61
61
  React.useEffect(function () {
62
62
  if (error)
63
63
  dispatch(clearError());
64
+ return function () {
65
+ dispatch(resetOTPScreen());
66
+ };
64
67
  }, [methods.formState.isValid]);
65
68
  var onSubmit = function (formData) {
66
69
  dispatch(verifyLeadOTP(formData));
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
+ import { useSelector } from 'react-redux';
14
15
  import { useTranslation } from 'react-i18next';
15
16
  import { useController, useFormContext } from 'react-hook-form';
16
17
  import Box from '@mui/material/Box';
@@ -24,7 +25,7 @@ import ClearIcon from '../../../shared/ClearIcon';
24
25
  import Tooltip from '../../../../components/Tooltip';
25
26
  import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
26
27
  import CheckIcon from '../../../shared/CheckIcon';
27
- import { checkBrandNameAvailability } from '../../../app/connect/connectStore';
28
+ import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
28
29
  import { useAppDispatch } from '../../../../hooks';
29
30
  import { debounce } from 'lodash-es';
30
31
  var LabelContainerStyled = styled(Box)(function (_a) {
@@ -66,6 +67,7 @@ var BrandName = function (_a) {
66
67
  var brandControl = useController({ control: control, name: 'brandName' });
67
68
  var brandNameValue = brandControl.field.value;
68
69
  var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
70
+ var data = useSelector(connectSelector).data;
69
71
  var checkBrand = debounce(function (value) {
70
72
  dispatch(checkBrandNameAvailability(value));
71
73
  }, 500);
@@ -75,9 +77,11 @@ var BrandName = function (_a) {
75
77
  brandControl.field.onChange(value);
76
78
  };
77
79
  React.useEffect(function () {
80
+ var _a;
78
81
  var isValid = brandNameValue && !error && brandNameValue.length > 2;
82
+ var brandName = brandNameValue + ((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2);
79
83
  if (isValid)
80
- checkBrand(brandNameValue);
84
+ checkBrand(brandName);
81
85
  }, [brandNameValue, error]);
82
86
  var clearBrandName = function () {
83
87
  brandControl.field.onChange('');
@@ -69,7 +69,7 @@ var AdditionalIndividualInfo = function (_a) {
69
69
  };
70
70
  var handleSelectSource = function (country) {
71
71
  var _a;
72
- if (((_a = country.nameEn) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary')
72
+ if (((_a = country.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary')
73
73
  setEmployerFieldsActive(true);
74
74
  else {
75
75
  setEmployerFieldsActive(false);
@@ -81,7 +81,7 @@ var SourceOfIncome = function (_a) {
81
81
  var source = sourceIncomeControl.field.value;
82
82
  var error = (_b = sourceIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
83
83
  return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name : source === null || source === void 0 ? void 0 : source.nameEn) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'nameEn', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
84
- return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name : item === null || item === void 0 ? void 0 : item.nameEn })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
84
+ return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.titleAr : item === null || item === void 0 ? void 0 : item.title })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
85
85
  } }) }))] })) })));
86
86
  };
87
87
  export default React.memo(SourceOfIncome);
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { Fragment } from 'react';
24
+ import React, { Fragment } from 'react';
25
25
  import Button from '../../../components/Button';
26
26
  import Icon from '../../../components/Icon';
27
27
  import { styled } from '@mui/material/styles';
@@ -84,6 +84,16 @@ var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { ret
84
84
  });
85
85
  export default function CustomButton(_a) {
86
86
  var children = _a.children, disabled = _a.disabled, isAr = _a.isAr, loading = _a.loading, disableBack = _a.disableBack, onBackClicked = _a.onBackClicked, error = _a.error, props = __rest(_a, ["children", "disabled", "isAr", "loading", "disableBack", "onBackClicked", "error"]);
87
- var isBackEnabled = !disableBack && !loading;
88
- return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled, isLoading: loading, type: !loading ? 'submit' : 'button', isBack: isBackEnabled, endIcon: !loading && _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props, { children: !loading ? (_jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '-15px' } }, { children: [" ", children] }))) : (_jsx(Loader, { innerColor: 'white', outerColor: 'white', size: 25, toggleAnimation: !!loading })) }))] })] }));
87
+ var _b = React.useState(false), btnLoading = _b[0], setBtnLoading = _b[1];
88
+ var isBackEnabled = !disableBack && !btnLoading;
89
+ React.useEffect(function () {
90
+ if (loading)
91
+ setBtnLoading(true);
92
+ if (error)
93
+ setBtnLoading(false);
94
+ }, [loading, error]);
95
+ React.useEffect(function () {
96
+ setBtnLoading(false);
97
+ }, []);
98
+ return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled, isLoading: btnLoading, type: !btnLoading ? 'submit' : 'button', isBack: isBackEnabled, endIcon: !btnLoading && _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props, { children: !btnLoading ? (_jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '-15px' } }, { children: [" ", children] }))) : (_jsx(Loader, { innerColor: 'white', outerColor: 'white', size: 15, toggleAnimation: !!loading })) }))] })] }));
89
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",