@tap-payments/auth-jsconnect 1.0.84 → 1.0.87
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.
- package/build/@types/app.d.ts +11 -7
- package/build/app/settings.d.ts +4 -1
- package/build/app/settings.js +14 -3
- package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
- package/build/components/AnimationFlow/AnimationFlow.js +3 -3
- package/build/components/AnimationFlow/BottomSheet.js +7 -2
- package/build/components/AnimationFlow/Dialog.d.ts +2 -1
- package/build/components/AnimationFlow/Dialog.js +6 -4
- package/build/components/AnimationFlow/Loader.js +1 -1
- package/build/constants/api.js +1 -1
- package/build/constants/assets.d.ts +3 -0
- package/build/constants/assets.js +3 -0
- package/build/features/app/bank/bankStore.js +1 -1
- package/build/features/app/business/businessStore.js +12 -10
- package/build/features/app/individual/individualStore.js +1 -1
- package/build/features/app/password/passwordStore.js +1 -1
- package/build/features/app/tax/taxStore.js +1 -1
- package/build/features/bank/Bank.js +8 -8
- package/build/features/bank/screens/BankDetails/validation.js +2 -2
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
- package/build/features/business/Business.js +8 -8
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +1 -1
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -6
- package/build/features/connect/Connect.js +8 -8
- package/build/features/connect/screens/Individual/MobileNumber.js +10 -4
- package/build/features/connect/screens/Mobile/MobileNumber.js +10 -4
- package/build/features/individual/Individual.js +8 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +16 -5
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
- package/build/features/password/Password.js +8 -8
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
- package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
- package/build/features/shared/Background/Background.d.ts +10 -0
- package/build/features/shared/Background/Background.js +29 -0
- package/build/features/shared/Background/LogoBackground.d.ts +6 -0
- package/build/features/shared/Background/LogoBackground.js +70 -0
- package/build/features/shared/Background/index.d.ts +2 -0
- package/build/features/shared/Background/index.js +2 -0
- package/build/features/shared/Button/Button.d.ts +1 -2
- package/build/features/shared/Button/FlowsButtons.js +35 -20
- package/build/features/shared/Button/SuccessButton.d.ts +3 -3
- package/build/features/shared/Button/SuccessButton.js +32 -37
- package/build/features/shared/Containers/FeatureContainer.js +3 -0
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/features/tax/Tax.js +8 -8
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -5
- package/build/hooks/useAppConfig.js +12 -3
- package/build/theme/components.js +9 -0
- package/build/utils/array.d.ts +1 -0
- package/build/utils/array.js +13 -2
- package/build/utils/locale.d.ts +1 -1
- package/build/utils/locale.js +5 -3
- package/build/utils/validation.d.ts +1 -0
- package/build/utils/validation.js +3 -0
- package/package.json +1 -1
|
@@ -113,14 +113,18 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
113
113
|
};
|
|
114
114
|
var onCloseCountryList = function () {
|
|
115
115
|
var _a;
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
if (anchorEl) {
|
|
117
|
+
setAnchorEl(null);
|
|
118
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
119
|
+
}
|
|
120
|
+
setCountries(countries);
|
|
118
121
|
};
|
|
119
122
|
var toggleCountryList = function () {
|
|
120
123
|
var _a, _b;
|
|
121
124
|
if (anchorEl) {
|
|
122
125
|
setAnchorEl(null);
|
|
123
126
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
127
|
+
setCountries(countries);
|
|
124
128
|
}
|
|
125
129
|
else {
|
|
126
130
|
(_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
|
|
@@ -134,12 +138,14 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
134
138
|
};
|
|
135
139
|
var handleSearch = function (value) {
|
|
136
140
|
var filteredCountries = countries.filter(function (country) {
|
|
137
|
-
return country.
|
|
141
|
+
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
142
|
+
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
143
|
+
country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
138
144
|
country.name.english.toLowerCase().startsWith(value.toLowerCase());
|
|
139
145
|
});
|
|
140
146
|
setCountries(filteredCountries);
|
|
141
147
|
};
|
|
142
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
148
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
143
149
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
144
150
|
} })] }))] })) })));
|
|
145
151
|
});
|
|
@@ -115,14 +115,18 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
115
115
|
};
|
|
116
116
|
var onCloseCountryList = function () {
|
|
117
117
|
var _a;
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
if (anchorEl) {
|
|
119
|
+
setAnchorEl(null);
|
|
120
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
121
|
+
}
|
|
122
|
+
setCountries(countries);
|
|
120
123
|
};
|
|
121
124
|
var toggleCountryList = function () {
|
|
122
125
|
var _a, _b;
|
|
123
126
|
if (anchorEl) {
|
|
124
127
|
setAnchorEl(null);
|
|
125
128
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
129
|
+
setCountries(countries);
|
|
126
130
|
}
|
|
127
131
|
else {
|
|
128
132
|
(_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
|
|
@@ -136,12 +140,14 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
136
140
|
};
|
|
137
141
|
var handleSearch = function (value) {
|
|
138
142
|
var filteredCountries = countries.filter(function (country) {
|
|
139
|
-
return country.
|
|
143
|
+
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
144
|
+
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
145
|
+
country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
140
146
|
country.name.english.toLowerCase().startsWith(value.toLowerCase());
|
|
141
147
|
});
|
|
142
148
|
setCountries(filteredCountries);
|
|
143
149
|
};
|
|
144
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
150
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
145
151
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
146
152
|
} })] }))] })) })));
|
|
147
153
|
});
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
13
|
+
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
15
|
import { settingsSelector } from '../../app/settings';
|
|
16
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
@@ -23,15 +23,15 @@ import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
|
|
|
23
23
|
import { individualFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import { getCountries, individualSelector, verifyLeadToken } from '../app/individual/individualStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
|
+
import Background from '../shared/Background';
|
|
26
27
|
var Individual = memo(function (props) {
|
|
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
31
|
var customLoading = useAppSelector(individualSelector).customLoading;
|
|
32
32
|
var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
|
|
33
33
|
useErrorListener();
|
|
34
|
-
var activeScreen = data.activeScreen;
|
|
34
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
37
|
if (!token)
|
|
@@ -45,11 +45,11 @@ var Individual = memo(function (props) {
|
|
|
45
45
|
useEffect(function () {
|
|
46
46
|
dispatch(getCountries());
|
|
47
47
|
}, []);
|
|
48
|
-
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: individualFeatureScreens.map(function (_a, index) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
|
|
49
|
+
var Element = _a.element, name = _a.name;
|
|
50
|
+
var isActive = activeScreen.name === name;
|
|
51
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
52
|
+
}) }) })) })) })));
|
|
53
53
|
});
|
|
54
54
|
export function IndividualLib(props) {
|
|
55
55
|
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Individual, __assign({}, props)) })));
|
|
@@ -34,6 +34,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
34
34
|
import Input from '../../../shared/Input';
|
|
35
35
|
import SimpleList from '../../../../components/SimpleList';
|
|
36
36
|
import { useLanguage } from '../../../../hooks';
|
|
37
|
+
import Search from '../../../shared/Search';
|
|
37
38
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
38
39
|
display: 'flex'
|
|
39
40
|
}); });
|
|
@@ -52,8 +53,8 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
52
53
|
var EmployerLocation = React.forwardRef(function (_a, ref) {
|
|
53
54
|
var _b, _c, _d;
|
|
54
55
|
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
55
|
-
var
|
|
56
|
-
var
|
|
56
|
+
var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
|
|
57
|
+
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
57
58
|
var t = useTranslation().t;
|
|
58
59
|
var isAr = useLanguage().isAr;
|
|
59
60
|
var control = useFormContext().control;
|
|
@@ -67,15 +68,25 @@ var EmployerLocation = React.forwardRef(function (_a, ref) {
|
|
|
67
68
|
var _a;
|
|
68
69
|
setAnchorEl(null);
|
|
69
70
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
71
|
+
setCountries(countries);
|
|
70
72
|
};
|
|
71
73
|
var onSelectItem = function (country) {
|
|
72
74
|
onCloseCountrySelect();
|
|
73
75
|
employerLocationControl.field.onChange(country);
|
|
74
76
|
};
|
|
77
|
+
var handleSearch = function (value) {
|
|
78
|
+
var filteredCountries = countries.filter(function (country) {
|
|
79
|
+
return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
|
|
80
|
+
country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
81
|
+
country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
82
|
+
country.name.english.toLowerCase().startsWith(value.toLowerCase());
|
|
83
|
+
});
|
|
84
|
+
setCountries(filteredCountries);
|
|
85
|
+
};
|
|
75
86
|
var location = employerLocationControl.field.value;
|
|
76
87
|
var error = (_b = employerLocationControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
77
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_employer_address_city'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_employee_location'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }),
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_employer_address_city'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_employee_location'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
89
|
+
return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
|
|
90
|
+
} })] }))] })) })));
|
|
80
91
|
});
|
|
81
92
|
export default React.memo(EmployerLocation);
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { showLastFour } from '../../../../utils';
|
|
19
|
+
import { allAreTruthy, showLastFour } from '../../../../utils';
|
|
20
20
|
import { individualSelector } from '../../../app/individual/individualStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -76,8 +76,6 @@ var SuccessWithFlowButtons = function () {
|
|
|
76
76
|
setIsAcceptance(true);
|
|
77
77
|
var isCompleted = status === 'completed' && name !== 'password';
|
|
78
78
|
var isIndividual = name === 'individual';
|
|
79
|
-
if (name !== 'password')
|
|
80
|
-
statuses.push(isCompleted);
|
|
81
79
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
82
80
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
83
81
|
return {
|
|
@@ -90,7 +88,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
90
88
|
};
|
|
91
89
|
});
|
|
92
90
|
setButtons(mappedFlows);
|
|
93
|
-
var isAllCompleted =
|
|
91
|
+
var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
|
|
94
92
|
if (isAllCompleted)
|
|
95
93
|
setIsPayout(true);
|
|
96
94
|
};
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
13
|
+
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
15
|
import { settingsSelector } from '../../app/settings';
|
|
16
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
@@ -23,15 +23,15 @@ import { PASSWORD_SCREENS_NAVIGATION } from '../../constants';
|
|
|
23
23
|
import { passwordFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import { passwordSelector, verifyLeadToken } from '../app/password/passwordStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
|
+
import Background from '../shared/Background';
|
|
26
27
|
var Password = memo(function (props) {
|
|
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
31
|
var customLoading = useAppSelector(passwordSelector).customLoading;
|
|
32
32
|
var loading = useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props)).loading;
|
|
33
33
|
useErrorListener();
|
|
34
|
-
var activeScreen = data.activeScreen;
|
|
34
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
37
|
if (!token)
|
|
@@ -42,11 +42,11 @@ var Password = memo(function (props) {
|
|
|
42
42
|
if (!loading)
|
|
43
43
|
verifyToken();
|
|
44
44
|
}, [loading]);
|
|
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: passwordFeatureScreens.map(function (_a, index) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
46
|
+
var Element = _a.element, name = _a.name;
|
|
47
|
+
var isActive = activeScreen.name === name;
|
|
48
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
49
|
+
}) }) })) })) })));
|
|
50
50
|
});
|
|
51
51
|
export function PasswordLib(props) {
|
|
52
52
|
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Password, __assign({}, props)) })));
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { showLastFour } from '../../../../utils';
|
|
19
|
+
import { allAreTruthy, showLastFour } from '../../../../utils';
|
|
20
20
|
import { passwordSelector } from '../../../app/password/passwordStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -76,8 +76,6 @@ var SuccessWithFlowButtons = function () {
|
|
|
76
76
|
setIsAcceptance(true);
|
|
77
77
|
var isCompleted = status === 'completed' && name !== 'password';
|
|
78
78
|
var isIndividual = name === 'individual';
|
|
79
|
-
if (name !== 'password')
|
|
80
|
-
statuses.push(isCompleted);
|
|
81
79
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
82
80
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
83
81
|
return {
|
|
@@ -90,7 +88,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
90
88
|
};
|
|
91
89
|
});
|
|
92
90
|
setButtons(mappedFlows);
|
|
93
|
-
var isAllCompleted =
|
|
91
|
+
var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
|
|
94
92
|
if (isAllCompleted)
|
|
95
93
|
setIsPayout(true);
|
|
96
94
|
};
|
|
@@ -24,7 +24,7 @@ var BoxStyled = styled(Box, { shouldForwardProp: function (prop) { return prop !
|
|
|
24
24
|
backgroundColor: enabled ? alpha(theme.palette.success.main, 0.1) : alpha(theme.palette.text.primary, 0.1),
|
|
25
25
|
color: enabled ? theme.palette.success.main : alpha(theme.palette.text.primary, 0.6),
|
|
26
26
|
borderRadius: theme.spacing(12.625),
|
|
27
|
-
padding: theme.spacing(0.6, 1, 0.
|
|
27
|
+
padding: theme.spacing(0.6, 1, 0.7, 1),
|
|
28
28
|
display: 'flex',
|
|
29
29
|
minHeight: theme.spacing(3.125),
|
|
30
30
|
minWidth: isAr ? theme.spacing(19.3) : theme.spacing(14.5),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type TapOrigin = {
|
|
3
|
+
isTapOrigin: boolean;
|
|
4
|
+
};
|
|
5
|
+
interface BackgroundProps extends TapOrigin {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ children, isTapOrigin, loading }: BackgroundProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo } from 'react';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import LogoBackground from './LogoBackground';
|
|
17
|
+
var BackgroundStyled = styled(Box)(function (_a) {
|
|
18
|
+
var isTapOrigin = _a.isTapOrigin;
|
|
19
|
+
return ({
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: '100%',
|
|
22
|
+
background: isTapOrigin ? 'linear-gradient(180deg, #98ABAF 0%, #D9D6CC 100%)' : 'rgba(0, 0, 0, 0.5)'
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
var Background = function (_a) {
|
|
26
|
+
var children = _a.children, isTapOrigin = _a.isTapOrigin, loading = _a.loading;
|
|
27
|
+
return (_jsxs(BackgroundStyled, __assign({ isTapOrigin: isTapOrigin }, { children: [_jsx(LogoBackground, { isTapOrigin: !loading && isTapOrigin }), children] })));
|
|
28
|
+
};
|
|
29
|
+
export default memo(Background);
|
|
@@ -0,0 +1,70 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo } from 'react';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import Collapse from '@mui/material/Collapse';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import Icon from '../../../components/Icon';
|
|
18
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
19
|
+
import { useLanguage } from '../../../hooks';
|
|
20
|
+
import Fade from '@mui/material/Fade';
|
|
21
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
22
|
+
var _b;
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return (_b = {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
paddingTop: theme.spacing(5)
|
|
30
|
+
},
|
|
31
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
32
|
+
paddingTop: theme.spacing(11.5)
|
|
33
|
+
},
|
|
34
|
+
_b);
|
|
35
|
+
});
|
|
36
|
+
var LogoBadgeStyled = styled(Icon)(function (_a) {
|
|
37
|
+
var theme = _a.theme;
|
|
38
|
+
return ({
|
|
39
|
+
height: theme.spacing(8.875),
|
|
40
|
+
width: theme.spacing(8.875)
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
var LogoIconBoxStyled = styled(Box)(function (_a) {
|
|
44
|
+
var _b;
|
|
45
|
+
var theme = _a.theme;
|
|
46
|
+
return (_b = {
|
|
47
|
+
paddingTop: theme.spacing(2.125),
|
|
48
|
+
width: '100%',
|
|
49
|
+
display: 'flex',
|
|
50
|
+
justifyContent: 'center'
|
|
51
|
+
},
|
|
52
|
+
_b[theme.transitions.create(['top'])] = {
|
|
53
|
+
duration: theme.transitions.duration.standard
|
|
54
|
+
},
|
|
55
|
+
_b);
|
|
56
|
+
});
|
|
57
|
+
var LogoIconStyled = styled(Icon)(function (_a) {
|
|
58
|
+
var theme = _a.theme;
|
|
59
|
+
return ({
|
|
60
|
+
width: theme.spacing(5.875),
|
|
61
|
+
height: theme.spacing(3.625),
|
|
62
|
+
padding: theme.spacing(0)
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
var LogoBackground = function (_a) {
|
|
66
|
+
var isTapOrigin = _a.isTapOrigin;
|
|
67
|
+
var isAr = useLanguage().isAr;
|
|
68
|
+
return (_jsx(Collapse, __assign({ in: isTapOrigin }, { children: _jsx(Fade, __assign({ in: isTapOrigin }, { children: _jsxs(BoxStyled, { children: [_jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO_EN_ICON }), _jsx(LogoIconBoxStyled, { children: _jsx(LogoIconStyled, { src: isAr ? ICONS_NAMES.TAP_LOGO_TEXT_AR : ICONS_NAMES.TAP_LOGO_TEXT_EN, alt: 'tap logo' }) })] }) })) })));
|
|
69
|
+
};
|
|
70
|
+
export default memo(LogoBackground);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ButtonProps } from '../../../components/Button';
|
|
3
|
-
interface CustomButtonProps extends ButtonProps {
|
|
3
|
+
export interface CustomButtonProps extends ButtonProps {
|
|
4
4
|
isAr: boolean;
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
disableBack?: boolean;
|
|
@@ -9,4 +9,3 @@ interface CustomButtonProps extends ButtonProps {
|
|
|
9
9
|
error?: string;
|
|
10
10
|
}
|
|
11
11
|
export default function CustomButton({ children, disabled, isAr, loading, disableBack, onBackClicked, error, disableNextIcon, ...props }: CustomButtonProps): JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -10,14 +10,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { createElement as _createElement } from "react";
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import Button from '../../../components/Button';
|
|
16
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
15
|
+
import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
17
16
|
import Box from '@mui/material/Box';
|
|
18
17
|
import Link from '@mui/material/Link';
|
|
19
18
|
import { ICONS_NAMES } from '../../../constants';
|
|
20
19
|
import CheckIcon from '@mui/icons-material/Check';
|
|
20
|
+
import { useAppDispatch } from '../../../hooks';
|
|
21
|
+
import { handleOpen } from '../../../app/settings';
|
|
22
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
21
23
|
var Image = styled('img', { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
22
24
|
var theme = _a.theme;
|
|
23
25
|
return ({
|
|
@@ -43,23 +45,23 @@ var ButtonStyled = styled(Button, {
|
|
|
43
45
|
paddingInlineEnd: theme.spacing(1.625),
|
|
44
46
|
color: theme.palette.success.main,
|
|
45
47
|
border: "1px solid ".concat(theme.palette.success.main)
|
|
46
|
-
})), { '&:hover': __assign(
|
|
47
|
-
backgroundColor: theme.palette.common.white,
|
|
48
|
-
border: "1px solid ".concat(theme.palette.success.main),
|
|
49
|
-
color: theme.palette.success.main,
|
|
50
|
-
cursor: 'initial'
|
|
51
|
-
})), (_b = {}, _b[theme.breakpoints.down('sm')] = {
|
|
52
|
-
'&:hover': __assign({ backgroundColor: touched ? theme.palette.primary.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), color: touched ? theme.palette.common.white : theme.palette.primary.main }, (isCompleted && {
|
|
48
|
+
})), (_b = { '&:hover': __assign({ backgroundColor: theme.palette.primary.main, color: theme.palette.common.white }, (isCompleted && {
|
|
53
49
|
backgroundColor: theme.palette.common.white,
|
|
54
50
|
border: "1px solid ".concat(theme.palette.success.main),
|
|
55
|
-
paddingInlineEnd: theme.spacing(1.625),
|
|
56
51
|
color: theme.palette.success.main,
|
|
57
52
|
cursor: 'initial'
|
|
58
|
-
}))
|
|
59
|
-
|
|
53
|
+
})) }, _b[theme.breakpoints.down('sm')] = {
|
|
54
|
+
'&:hover': __assign({ backgroundColor: touched ? theme.palette.primary.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), color: touched ? theme.palette.common.white : theme.palette.primary.main }, (isCompleted && {
|
|
60
55
|
backgroundColor: theme.palette.common.white,
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
border: "1px solid ".concat(theme.palette.success.main),
|
|
57
|
+
paddingInlineEnd: theme.spacing(1.625),
|
|
58
|
+
color: theme.palette.success.main,
|
|
59
|
+
cursor: 'initial'
|
|
60
|
+
}))
|
|
61
|
+
}, _b['&:disabled'] = {
|
|
62
|
+
backgroundColor: theme.palette.common.white,
|
|
63
|
+
color: alpha(theme.palette.primary.main, 0.3)
|
|
64
|
+
}, _b)));
|
|
63
65
|
});
|
|
64
66
|
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
65
67
|
var theme = _a.theme;
|
|
@@ -73,17 +75,30 @@ export default function FlowsButtons(_a) {
|
|
|
73
75
|
var buttons = _a.buttons;
|
|
74
76
|
var _b = React.useState(), index = _b[0], setIndex = _b[1];
|
|
75
77
|
var _c = React.useState(false), touched = _c[0], setTouched = _c[1];
|
|
78
|
+
var dispatch = useAppDispatch();
|
|
79
|
+
var theme = useTheme();
|
|
80
|
+
var isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
|
76
81
|
var handleTouch = function () {
|
|
77
82
|
setTouched(true);
|
|
78
83
|
};
|
|
84
|
+
var onRedirect = function (item) {
|
|
85
|
+
if (item.isCompleted)
|
|
86
|
+
return;
|
|
87
|
+
dispatch(handleOpen(false));
|
|
88
|
+
setTimeout(function () {
|
|
89
|
+
window.location.href = item.href;
|
|
90
|
+
}, 500);
|
|
91
|
+
};
|
|
79
92
|
return (_jsx(ButtonBoxStyled, { children: buttons.map(function (_a, idx) {
|
|
80
93
|
var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted, sx = _a.sx;
|
|
81
94
|
var isLast = idx === buttons.length - 1;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
return (_jsx(Link, __assign({ underline: 'none', onMouseEnter: function () { return !isCompleted && setIndex(idx); }, onMouseLeave: function () { return setIndex(undefined); }, onClick: function () {
|
|
96
|
+
setTouched(false);
|
|
97
|
+
onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted });
|
|
98
|
+
} }, { children: _jsx(ButtonStyled, __assign({ onTouchStart: handleTouch, touched: touched, isCompleted: isCompleted, sx: __assign({ mb: isLast ? 0 : 1.8 }, sx), endIcon: isCompleted ? (_jsx(CheckIconStyled, {})) : isMobile ? (_jsx(Image, { sx: { height: 15 }, src: index === idx
|
|
99
|
+
? touched
|
|
100
|
+
? ICONS_NAMES.Arrow_white_right_icon
|
|
101
|
+
: ICONS_NAMES.Arrow_filled_right_icon
|
|
102
|
+
: ICONS_NAMES.Arrow_filled_right_icon })) : (_jsx(Image, { sx: { height: 15 }, src: index === idx ? ICONS_NAMES.Arrow_white_right_icon : ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isMobile ? (_jsx(Image, { src: index === idx ? (touched ? hoverSrc : src) : src, alt: title })) : (_jsx(Image, { src: index === idx ? hoverSrc : src, alt: title })), type: 'button' }, { children: title })) }), idx));
|
|
88
103
|
}) }));
|
|
89
104
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
interface SuccessButtonProps extends
|
|
2
|
+
import { CustomButtonProps } from './Button';
|
|
3
|
+
interface SuccessButtonProps extends CustomButtonProps {
|
|
4
4
|
isAr: boolean;
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
hideIcon?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export default function SuccessButton({ children, isAr,
|
|
8
|
+
export default function SuccessButton({ children, isAr, disabled, loading, error, ...props }: SuccessButtonProps): JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -21,15 +21,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import Button from './Button';
|
|
26
|
+
import { styled } from '@mui/material/styles';
|
|
27
27
|
import Box from '@mui/material/Box';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
var ButtonStyled = styled(Button, {
|
|
29
|
+
shouldForwardProp: function (prop) { return prop !== 'isLoading'; }
|
|
30
|
+
})(function (_a) {
|
|
31
|
+
var theme = _a.theme, isLoading = _a.isLoading;
|
|
32
|
+
return (__assign({ width: '100%', textTransform: 'none', paddingInlineStart: theme.spacing(0.75), backgroundColor: theme.palette.common.white, color: theme.palette.primary.main, border: "1px solid ".concat(theme.palette.primary.main), '&:hover': {
|
|
33
|
+
backgroundColor: theme.palette.common.white,
|
|
34
|
+
color: theme.palette.primary.main
|
|
35
|
+
}, '&:disabled': {
|
|
36
|
+
backgroundColor: theme.palette.primary.main,
|
|
37
|
+
color: theme.palette.common.white
|
|
38
|
+
}, transition: theme.transitions.create(['width', 'padding'], {
|
|
39
|
+
easing: theme.transitions.easing.easeInOut,
|
|
40
|
+
duration: theme.transitions.duration.complex * 2
|
|
41
|
+
}) }, (isLoading && {
|
|
42
|
+
minWidth: 0,
|
|
43
|
+
width: theme.spacing(6),
|
|
44
|
+
borderRadius: 30
|
|
33
45
|
})));
|
|
34
46
|
});
|
|
35
47
|
var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
@@ -38,34 +50,17 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
|
38
50
|
margin: theme.spacing(0, 2.5, 2.5, 2.5)
|
|
39
51
|
});
|
|
40
52
|
});
|
|
41
|
-
var ButtonStyled = styled(Button)(function (_a) {
|
|
42
|
-
var _b;
|
|
43
|
-
var theme = _a.theme;
|
|
44
|
-
return (_b = {
|
|
45
|
-
paddingInlineStart: theme.spacing(0.75),
|
|
46
|
-
textTransform: 'none',
|
|
47
|
-
backgroundColor: theme.palette.common.white,
|
|
48
|
-
border: "1px solid ".concat(theme.palette.primary.main),
|
|
49
|
-
color: theme.palette.primary.main,
|
|
50
|
-
'&:hover': {
|
|
51
|
-
backgroundColor: theme.palette.common.white,
|
|
52
|
-
color: theme.palette.primary.main
|
|
53
|
-
},
|
|
54
|
-
'&:disabled': {
|
|
55
|
-
backgroundColor: theme.palette.common.white,
|
|
56
|
-
color: alpha(theme.palette.primary.main, 0.3)
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
_b[theme.breakpoints.down('sm')] = {
|
|
60
|
-
'&:hover': {
|
|
61
|
-
backgroundColor: theme.palette.common.white,
|
|
62
|
-
border: "1px solid ".concat(theme.palette.primary.main),
|
|
63
|
-
color: theme.palette.primary.main
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
_b);
|
|
67
|
-
});
|
|
68
53
|
export default function SuccessButton(_a) {
|
|
69
|
-
var children = _a.children, isAr = _a.isAr,
|
|
70
|
-
|
|
54
|
+
var children = _a.children, isAr = _a.isAr, disabled = _a.disabled, loading = _a.loading, error = _a.error, props = __rest(_a, ["children", "isAr", "disabled", "loading", "error"]);
|
|
55
|
+
var _b = React.useState(false), btnLoading = _b[0], setBtnLoading = _b[1];
|
|
56
|
+
React.useEffect(function () {
|
|
57
|
+
if (loading)
|
|
58
|
+
setBtnLoading(true);
|
|
59
|
+
if (error)
|
|
60
|
+
setBtnLoading(false);
|
|
61
|
+
}, [loading, error]);
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
setBtnLoading(false);
|
|
64
|
+
}, []);
|
|
65
|
+
return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ isAr: isAr, isLoading: btnLoading, loading: btnLoading, disabled: disabled, type: 'button' }, props, { children: children })) }));
|
|
71
66
|
}
|