@tap-payments/auth-jsconnect 1.0.84 → 1.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/build/@types/app.d.ts +2 -0
  2. package/build/app/settings.d.ts +4 -1
  3. package/build/app/settings.js +13 -2
  4. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  5. package/build/components/AnimationFlow/AnimationFlow.js +3 -3
  6. package/build/components/AnimationFlow/BottomSheet.js +3 -0
  7. package/build/components/AnimationFlow/Dialog.d.ts +2 -1
  8. package/build/components/AnimationFlow/Dialog.js +6 -4
  9. package/build/constants/assets.d.ts +1 -0
  10. package/build/constants/assets.js +1 -0
  11. package/build/features/app/bank/bankStore.js +1 -1
  12. package/build/features/app/business/businessStore.js +2 -1
  13. package/build/features/app/individual/individualStore.js +1 -1
  14. package/build/features/app/password/passwordStore.js +1 -1
  15. package/build/features/app/tax/taxStore.js +1 -1
  16. package/build/features/bank/Bank.js +8 -8
  17. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  18. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
  19. package/build/features/business/Business.js +8 -8
  20. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -5
  21. package/build/features/connect/Connect.js +8 -8
  22. package/build/features/connect/screens/Individual/MobileNumber.js +10 -4
  23. package/build/features/connect/screens/Mobile/MobileNumber.js +10 -4
  24. package/build/features/individual/Individual.js +8 -8
  25. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +16 -5
  26. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
  27. package/build/features/password/Password.js +8 -8
  28. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
  29. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
  30. package/build/features/shared/Background/Background.d.ts +10 -0
  31. package/build/features/shared/Background/Background.js +29 -0
  32. package/build/features/shared/Background/LogoBackground.d.ts +6 -0
  33. package/build/features/shared/Background/LogoBackground.js +47 -0
  34. package/build/features/shared/Background/index.d.ts +2 -0
  35. package/build/features/shared/Background/index.js +2 -0
  36. package/build/features/shared/Button/Button.d.ts +1 -2
  37. package/build/features/shared/Button/SuccessButton.d.ts +3 -3
  38. package/build/features/shared/Button/SuccessButton.js +32 -37
  39. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  40. package/build/features/tax/Tax.js +8 -8
  41. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -5
  42. package/build/hooks/useAppConfig.js +12 -3
  43. package/build/theme/components.js +9 -0
  44. package/build/utils/array.d.ts +1 -0
  45. package/build/utils/array.js +7 -0
  46. package/build/utils/validation.d.ts +1 -0
  47. package/build/utils/validation.js +3 -0
  48. package/package.json +1 -1
@@ -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 locationCountries = React.useState(countries)[0];
56
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
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) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
78
- 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, {})] }));
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 = statuses.filter(function (status) { return status; }).length === flows.length;
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 React, { memo, useEffect } from 'react';
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
- 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
- }) }) })) })));
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 = statuses.filter(function (status) { return status; }).length === flows.length;
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.6, 1),
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,6 @@
1
+ import React from 'react';
2
+ declare type LogoBackgroundProps = {
3
+ isTapOrigin: boolean;
4
+ };
5
+ declare const _default: React.MemoExoticComponent<({ isTapOrigin }: LogoBackgroundProps) => JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,47 @@
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 { 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 theme = _a.theme;
23
+ return ({
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ justifyContent: 'center',
27
+ alignItems: 'center',
28
+ marginTop: theme.spacing(5)
29
+ });
30
+ });
31
+ var LogoBadgeStyled = styled(Icon)(function () { return ({
32
+ height: '100%',
33
+ width: '100%'
34
+ }); });
35
+ var LogoIconBoxStyled = styled(Box)(function (_a) {
36
+ var theme = _a.theme;
37
+ return ({
38
+ height: theme.spacing(14.625),
39
+ width: theme.spacing(8.875)
40
+ });
41
+ });
42
+ var LogoBackground = function (_a) {
43
+ var isTapOrigin = _a.isTapOrigin;
44
+ var isAr = useLanguage().isAr;
45
+ return (_jsx(Collapse, __assign({ in: isTapOrigin }, { children: _jsx(Fade, __assign({ in: isTapOrigin }, { children: _jsx(BoxStyled, { children: _jsx(LogoIconBoxStyled, { children: _jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO_EN_ICON }) }) }) })) })));
46
+ };
47
+ export default memo(LogoBackground);
@@ -0,0 +1,2 @@
1
+ import Background from './Background';
2
+ export default Background;
@@ -0,0 +1,2 @@
1
+ import Background from './Background';
2
+ export default Background;
@@ -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 {};
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { ButtonProps } from '../../../components/Button';
3
- interface SuccessButtonProps extends ButtonProps {
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, hideIcon, disabled, ...props }: SuccessButtonProps): JSX.Element;
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 Button from '../../../components/Button';
25
- import Icon from '../../../components/Icon';
26
- import { alpha, styled } from '@mui/material/styles';
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
- import { ICONS_NAMES } from '../../../constants';
29
- var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
30
- var theme = _a.theme, disabled = _a.disabled;
31
- return (__assign({ width: theme.spacing(3), height: theme.spacing(3), marginInlineStart: theme.spacing(0.75) }, (disabled && {
32
- opacity: 0.3
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, hideIcon = _a.hideIcon, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "hideIcon", "disabled"]);
70
- return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { disabled: disabled, src: ICONS_NAMES.MOBILE_ICON }) }, props, { children: children })) }));
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
  }
@@ -16,7 +16,7 @@ import * as React from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import Text from '../../../components/Text';
18
18
  import Container from '../Containers/ScreenContainer';
19
- import { EmailProvidersButton, Button } from '../../shared/Button';
19
+ import { EmailProvidersButton, SuccessButton } from '../../shared/Button';
20
20
  import Icon from '../../../components/Icon';
21
21
  import { ICONS_NAMES } from '../../../constants';
22
22
  import { useLanguage } from '../../../hooks';
@@ -56,6 +56,6 @@ var ThankYou = function (_a) {
56
56
  var title = _a.title, description = _a.description, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle, loading = _a.loading, error = _a.error;
57
57
  var t = useTranslation().t;
58
58
  var isAr = useLanguage().isAr;
59
- return (_jsxs(ContainerStyled, { children: [_jsx(IconStyled, { src: ICONS_NAMES.SUCCESS_GIF, alt: 'loading...' }), _jsxs(TitleStyled, { children: [title, " "] }), _jsx(DescriptionStyled, { children: description }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(Button, __assign({ onClick: onSuccess, disableBack: true, disableNextIcon: true, disabled: loading, isAr: isAr, loading: loading, error: t(error || '') }, { children: t(successTitle || '') })) }))] }));
59
+ return (_jsxs(ContainerStyled, { children: [_jsx(IconStyled, { src: ICONS_NAMES.SUCCESS_GIF, alt: 'loading...' }), _jsxs(TitleStyled, { children: [title, " "] }), _jsx(DescriptionStyled, { children: description }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(SuccessButton, __assign({ onClick: onSuccess, disableBack: true, disableNextIcon: true, disabled: loading, isAr: isAr, loading: loading, error: t(error || '') }, { children: t(successTitle || '') })) }))] }));
60
60
  };
61
61
  export default React.memo(ThankYou);
@@ -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 React, { memo, useEffect } from 'react';
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 { TAX_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { taxFeatureScreens } from '../featuresScreens';
24
24
  import CustomFooter from '../shared/Footer';
25
25
  import { taxSelector, verifyLeadToken } from '../app/tax/taxStore';
26
+ import Background from '../shared/Background';
26
27
  var Tax = 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(taxSelector).customLoading;
32
32
  var loading = useAppConfig(__assign({ navigation: TAX_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 Tax = memo(function (props) {
42
42
  if (!loading)
43
43
  verifyToken();
44
44
  }, [loading]);
45
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, error: error, loading: settingLoading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.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
- }) }) })) })));
45
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, open: open, error: error, loading: settingLoading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.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 TaxLib(props) {
52
52
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Tax, __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 { taxSelector } from '../../../app/tax/taxStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
@@ -76,9 +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
- if (name !== 'password')
81
- statuses.push(isCompleted);
82
79
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
83
80
  var hoverSrc = "".concat(name, "_white_icon");
84
81
  return {
@@ -91,7 +88,7 @@ var SuccessWithFlowButtons = function () {
91
88
  };
92
89
  });
93
90
  setButtons(mappedFlows);
94
- var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length;
91
+ var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
95
92
  if (isAllCompleted)
96
93
  setIsPayout(true);
97
94
  };
@@ -57,11 +57,11 @@ var __rest = (this && this.__rest) || function (s, e) {
57
57
  return t;
58
58
  };
59
59
  import { useEffect, useState } from 'react';
60
- import { handleActiveFlowScreens, settingsSelector, getClientIp, getLocale, getBrowserFingerPrint, getOperator, handleSetAppConfig, handleLanguage } from '../app/settings';
60
+ import { handleActiveFlowScreens, settingsSelector, getClientIp, getLocale, getBrowserFingerPrint, getOperator, handleSetAppConfig, handleLanguage, handleOpen, handleIsTapOrigin } from '../app/settings';
61
61
  import { useAppDispatch } from './useAppDispatch';
62
62
  import { useAppSelector } from './useAppSelector';
63
63
  import { setAxiosGlobalHeaders } from '../api';
64
- import { getRequestHeaders, encryptString } from '../utils';
64
+ import { getRequestHeaders, encryptString, isTapDomain } from '../utils';
65
65
  export var useAppConfig = function (_a) {
66
66
  var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, rest = __rest(_a, ["appInfo", "navigation", "publicKey"]);
67
67
  var _b = useState(true), loading = _b[0], setLoading = _b[1];
@@ -79,10 +79,16 @@ export var useAppConfig = function (_a) {
79
79
  return [2];
80
80
  });
81
81
  }); };
82
+ var checkDomain = function () {
83
+ var isTap = isTapDomain(rest.merchantDomain);
84
+ dispatch(handleIsTapOrigin(isTap));
85
+ };
82
86
  var handleAppApiConfig = function () { return __awaiter(void 0, void 0, void 0, function () {
83
87
  return __generator(this, function (_a) {
84
88
  switch (_a.label) {
85
- case 0: return [4, dispatch(getLocale())];
89
+ case 0:
90
+ checkDomain();
91
+ return [4, dispatch(getLocale())];
86
92
  case 1:
87
93
  _a.sent();
88
94
  return [4, dispatch(getClientIp())];
@@ -116,6 +122,9 @@ export var useAppConfig = function (_a) {
116
122
  }
117
123
  });
118
124
  }); };
125
+ useEffect(function () {
126
+ dispatch(handleOpen(rest.open));
127
+ }, [rest.open]);
119
128
  useEffect(function () {
120
129
  if (data.appConfig.language)
121
130
  dispatch(handleLanguage(data.appConfig.language));
@@ -6,5 +6,14 @@ export var components = {
6
6
  height: '0.8em'
7
7
  }
8
8
  }
9
+ },
10
+ MuiBackdrop: {
11
+ styleOverrides: {
12
+ root: {
13
+ '&.MuiDialog-backdrop': {
14
+ backgroundColor: 'transparent'
15
+ }
16
+ }
17
+ }
9
18
  }
10
19
  };
@@ -7,3 +7,4 @@ export declare const splitString: (string: string, splitter?: string) => string[
7
7
  export declare const isInclude: (items: Array<string | number>, item: any) => boolean;
8
8
  export declare const findItem: (items: Array<string | number>, key: any) => string | number | undefined;
9
9
  export declare const isExist: (items: Array<any>, id: string) => any;
10
+ export declare const allAreTruthy: (items: Array<any>, condition: boolean | string, key: string, exclude?: string) => boolean;
@@ -42,3 +42,10 @@ export var isExist = function (items, id) {
42
42
  return sub === null || sub === void 0 ? void 0 : sub.some(function (item) { return item.id === id; });
43
43
  });
44
44
  };
45
+ export var allAreTruthy = function (items, condition, key, exclude) {
46
+ return items.every(function (item) {
47
+ if (exclude && item['name'] === exclude)
48
+ return true;
49
+ return item[key] === condition;
50
+ });
51
+ };
@@ -12,3 +12,4 @@ export declare function isPasswordHasUpperLetter(password: string): boolean;
12
12
  export declare function isPasswordHasLowerLetter(password: string): boolean;
13
13
  export declare function isPasswordHasSpecialLetter(password: string): boolean;
14
14
  export declare const keepLettersAndSpace: (str: string) => string;
15
+ export declare const isTapDomain: (domain: string) => boolean;
@@ -40,3 +40,6 @@ export function isPasswordHasSpecialLetter(password) {
40
40
  export var keepLettersAndSpace = function (str) {
41
41
  return str.replace(/[^a-zA-Z] /g, '');
42
42
  };
43
+ export var isTapDomain = function (domain) {
44
+ return domain.includes('tap.company');
45
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",