@tap-payments/auth-jsconnect 2.1.56-test → 2.1.59-test

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 (109) hide show
  1. package/README.md +34 -34
  2. package/build/@types/app.d.ts +1 -0
  3. package/build/app/settings.d.ts +0 -1
  4. package/build/app/settings.js +6 -16
  5. package/build/assets/locales/ar.json +3 -1
  6. package/build/assets/locales/en.json +3 -1
  7. package/build/constants/app.js +32 -2
  8. package/build/features/app/bank/bankStore.d.ts +5 -1
  9. package/build/features/app/bank/bankStore.js +62 -57
  10. package/build/features/app/brand/brandStore.d.ts +5 -1
  11. package/build/features/app/brand/brandStore.js +70 -65
  12. package/build/features/app/connectExpress/connectExpressStore.js +9 -3
  13. package/build/features/app/entity/entityStore.d.ts +5 -1
  14. package/build/features/app/entity/entityStore.js +75 -70
  15. package/build/features/app/individual/individualStore.d.ts +5 -1
  16. package/build/features/app/individual/individualStore.js +88 -83
  17. package/build/features/app/tax/taxStore.d.ts +5 -1
  18. package/build/features/app/tax/taxStore.js +51 -46
  19. package/build/features/auth/Auth.d.ts +3 -2
  20. package/build/features/auth/Auth.js +5 -13
  21. package/build/features/bank/Bank.d.ts +4 -2
  22. package/build/features/bank/Bank.js +35 -35
  23. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  24. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  25. package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
  26. package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
  27. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  28. package/build/features/brand/Brand.d.ts +4 -2
  29. package/build/features/brand/Brand.js +35 -34
  30. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  31. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  32. package/build/features/brand/screens/PrepareDataLoading/index.d.ts +2 -0
  33. package/build/features/brand/screens/PrepareDataLoading/index.js +2 -0
  34. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  35. package/build/features/business/Business.d.ts +3 -2
  36. package/build/features/business/Business.js +5 -13
  37. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
  38. package/build/features/connect/Connect.d.ts +3 -2
  39. package/build/features/connect/Connect.js +5 -13
  40. package/build/features/connectExpress/ConnectExpress.d.ts +0 -1
  41. package/build/features/connectExpress/ConnectExpress.js +3 -6
  42. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +1 -1
  43. package/build/features/connectExpress/screens/Mobile/Mobile.js +6 -3
  44. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
  45. package/build/features/connectExpress/screens/NID/IDNumber.js +7 -2
  46. package/build/features/connectExpress/screens/NID/NID.js +6 -5
  47. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +3 -7
  48. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -100
  49. package/build/features/entity/Entity.d.ts +4 -2
  50. package/build/features/entity/Entity.js +35 -36
  51. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  52. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  53. package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
  54. package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
  55. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  56. package/build/features/featuresScreens.js +25 -0
  57. package/build/features/individual/Individual.d.ts +4 -2
  58. package/build/features/individual/Individual.js +35 -36
  59. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  60. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  61. package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
  62. package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
  63. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  64. package/build/features/password/Password.d.ts +4 -2
  65. package/build/features/password/Password.js +5 -13
  66. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  67. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  68. package/build/features/shared/Button/FlowsButtons.js +6 -4
  69. package/build/features/shared/DataLoading/DataLoading.d.ts +5 -0
  70. package/build/features/shared/DataLoading/DataLoading.js +55 -0
  71. package/build/features/shared/DataLoading/index.d.ts +2 -0
  72. package/build/features/shared/DataLoading/index.js +2 -0
  73. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -1
  74. package/build/features/signIn/SignIn.d.ts +3 -2
  75. package/build/features/signIn/SignIn.js +4 -13
  76. package/build/features/tax/Tax.d.ts +4 -2
  77. package/build/features/tax/Tax.js +35 -37
  78. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  79. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  80. package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
  81. package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
  82. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  83. package/build/hooks/index.d.ts +1 -0
  84. package/build/hooks/index.js +1 -0
  85. package/build/hooks/useAppConfig.d.ts +2 -2
  86. package/build/hooks/useAppConfig.js +5 -3
  87. package/build/hooks/useVerifyToken.d.ts +15 -0
  88. package/build/hooks/useVerifyToken.js +25 -0
  89. package/build/index.d.ts +11 -11
  90. package/build/index.js +12 -22
  91. package/package.json +1 -1
  92. package/build/features/connectExpress/screens/Brand/Brand.d.ts +0 -0
  93. package/build/features/connectExpress/screens/Brand/Brand.js +0 -1
  94. package/build/features/connectExpress/screens/Brand/BrandList.d.ts +0 -10
  95. package/build/features/connectExpress/screens/Brand/BrandList.js +0 -106
  96. package/build/features/connectExpress/screens/Brand/BrandName.d.ts +0 -8
  97. package/build/features/connectExpress/screens/Brand/BrandName.js +0 -142
  98. package/build/features/connectExpress/screens/Brand/SalesChannels.d.ts +0 -5
  99. package/build/features/connectExpress/screens/Brand/SalesChannels.js +0 -38
  100. package/build/features/connectExpress/screens/Brand/Segments.d.ts +0 -8
  101. package/build/features/connectExpress/screens/Brand/Segments.js +0 -74
  102. package/build/features/connectExpress/screens/Brand/TAC.d.ts +0 -6
  103. package/build/features/connectExpress/screens/Brand/TAC.js +0 -84
  104. package/build/features/connectExpress/screens/Brand/TeamSize.d.ts +0 -8
  105. package/build/features/connectExpress/screens/Brand/TeamSize.js +0 -74
  106. package/build/features/connectExpress/screens/Brand/index.d.ts +0 -0
  107. package/build/features/connectExpress/screens/Brand/index.js +0 -1
  108. package/build/features/connectExpress/screens/Brand/validation.d.ts +0 -38
  109. package/build/features/connectExpress/screens/Brand/validation.js +0 -134
@@ -11,6 +11,7 @@ export declare type ButtonItemProps = {
11
11
  hoverSrc: string;
12
12
  isCompleted: boolean;
13
13
  sx?: SxProps<Theme> | undefined;
14
+ token?: string;
14
15
  };
15
16
  export interface DataProps {
16
17
  flowName: FlowsTypes;
@@ -153,12 +153,14 @@ export default function FlowsButtons(_a) {
153
153
  var _b = useState(false), loading = _b[0], setLoading = _b[1];
154
154
  var isAr = useLanguage().isAr;
155
155
  var onRedirect = function (item) {
156
- if (item.isCompleted)
157
- return;
158
156
  if (flowName === item.name && item.name !== 'password') {
159
157
  dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name)));
160
158
  return;
161
159
  }
160
+ if (typeof settingsData.appConfig.onFlowButtonClick === 'function') {
161
+ settingsData.appConfig.onFlowButtonClick(item);
162
+ return;
163
+ }
162
164
  dispatch(handleOpen(false));
163
165
  setTimeout(function () {
164
166
  window.location.href = item.href;
@@ -210,13 +212,13 @@ export default function FlowsButtons(_a) {
210
212
  });
211
213
  }); };
212
214
  return (_jsx(ButtonBoxStyled, { children: buttons.map(function (_a, idx) {
213
- var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted, sx = _a.sx, name = _a.name, status = _a.status;
215
+ var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted, sx = _a.sx, name = _a.name, status = _a.status, token = _a.token;
214
216
  var isLast = idx === buttons.length - 1;
215
217
  return (_jsx(Link, __assign({ underline: 'none', onClick: function () {
216
218
  if (isResetPassword(name, status))
217
219
  onResetPassword();
218
220
  else
219
- onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status });
221
+ onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
220
222
  } }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
221
223
  }) }));
222
224
  }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface DataLoadingProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: DataLoadingProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,55 @@
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box/Box';
15
+ import { styled } from '@mui/material/styles';
16
+ import { useTranslation } from 'react-i18next';
17
+ import Text from '../../../components/Text';
18
+ import { ScreenContainer } from '../../shared/Containers';
19
+ import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
20
+ var TitleContainerStyled = styled(Box)(function (_a) {
21
+ var theme = _a.theme;
22
+ return ({
23
+ direction: theme.direction,
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ alignItems: 'center',
27
+ marginBottom: theme.spacing(2.5)
28
+ });
29
+ });
30
+ var VerifyPACITitleStyled = styled(Text)(function (_a) {
31
+ var theme = _a.theme;
32
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBottom: theme.spacing(2.4), lineHeight: '19.2px' }));
33
+ });
34
+ var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return (__assign(__assign({}, theme.typography.body2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, lineHeight: '16.8px' }));
37
+ });
38
+ var Container = styled(Box)(function (_a) {
39
+ var theme = _a.theme;
40
+ return ({
41
+ position: 'relative',
42
+ display: 'flex',
43
+ justifyContent: 'center',
44
+ alignItems: 'center',
45
+ maxHeight: '300px',
46
+ height: '200px',
47
+ width: '100%',
48
+ marginBottom: theme.spacing(3.25)
49
+ });
50
+ });
51
+ var DataLoading = function (_a) {
52
+ var t = useTranslation().t;
53
+ return (_jsx(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: _jsxs(TitleContainerStyled, { children: [_jsx(Container, { children: _jsx(LottieFile, { file: LottieAnimationFiles.account_creation, loop: true, height: '375px' }) }), _jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t('prepare_data_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('prepare_data_description') })] })] }) })));
54
+ };
55
+ export default React.memo(DataLoading);
@@ -0,0 +1,2 @@
1
+ import DataLoading from './DataLoading';
2
+ export default DataLoading;
@@ -0,0 +1,2 @@
1
+ import DataLoading from './DataLoading';
2
+ export default DataLoading;
@@ -70,7 +70,7 @@ var SuccessFlowButtons = function (_a) {
70
70
  var mappedFlows = flows
71
71
  .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
72
72
  .map(function (_a) {
73
- var name = _a.name, url = _a.url, status = _a.status;
73
+ var name = _a.name, url = _a.url, status = _a.status, token = _a.token;
74
74
  var type = status === 'completed' ? 'completed' : 'pending';
75
75
  var title = t("".concat(name, "_flow_").concat(type), {
76
76
  individual_name: username.toLowerCase() + maskedId,
@@ -86,6 +86,7 @@ var SuccessFlowButtons = function (_a) {
86
86
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
87
87
  var hoverSrc = "".concat(name, "_white_icon");
88
88
  return {
89
+ token: token,
89
90
  name: name,
90
91
  status: status,
91
92
  title: title,
@@ -3,5 +3,6 @@ import { LibConfig } from '../../@types';
3
3
  export interface SignInLibProps extends LibConfig {
4
4
  }
5
5
  export declare function SignInLib(props: SignInLibProps): JSX.Element;
6
- export declare function renderSignInLib(config: SignInLibProps, elementId: string): void;
7
- export declare function unmountSignInLib(elementId: string, unmountTimeout?: number): void;
6
+ export declare function renderSignInLib(config: SignInLibProps, elementId: string): {
7
+ unmount: () => void;
8
+ };
@@ -19,7 +19,7 @@ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
19
  import Collapse from '../../components/Collapse';
20
20
  import { reactElement } from '../../utils';
21
21
  import { FeatureContainer } from '../shared/Containers';
22
- import { DIALOG_ID, SigIn_SCREENS_NAVIGATION } from '../../constants';
22
+ import { SigIn_SCREENS_NAVIGATION } from '../../constants';
23
23
  import { signInFeatureScreens } from '../featuresScreens';
24
24
  import CustomFooter from '../shared/Footer';
25
25
  import { signInSelector } from '../app/signIn/signInStore';
@@ -42,16 +42,7 @@ export function SignInLib(props) {
42
42
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(SignIn, __assign({}, props)) })));
43
43
  }
44
44
  export function renderSignInLib(config, elementId) {
45
- reactElement(elementId).render(_jsx(SignInLib, __assign({}, config)));
46
- }
47
- export function unmountSignInLib(elementId, unmountTimeout) {
48
- if (unmountTimeout === void 0) { unmountTimeout = 1000; }
49
- var element = document.getElementById(elementId);
50
- var dialogEl = document.getElementById(DIALOG_ID);
51
- setTimeout(function () {
52
- var _a;
53
- ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
54
- dialogEl && dialogEl.remove();
55
- elementId && reactElement(elementId).unmount();
56
- }, unmountTimeout);
45
+ var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
46
+ render(_jsx(SignInLib, __assign({}, config)));
47
+ return { unmount: unmount };
57
48
  }
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { LibConfig } from '../../@types';
3
3
  export interface TaxLibProps extends LibConfig {
4
+ verifyToken?: string;
4
5
  }
5
6
  export declare function TaxLib(props: TaxLibProps): JSX.Element;
6
- export declare function renderTaxLib(config: TaxLibProps, elementId: string): void;
7
- export declare function unmountTaxLib(elementId: string, unmountTimeout?: number): void;
7
+ export declare function renderTaxLib(config: TaxLibProps, elementId: string): {
8
+ unmount: () => void;
9
+ };
@@ -9,44 +9,51 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
15
- import { handleLanguage, settingsSelector } from '../../app/settings';
24
+ import { memo } from 'react';
25
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useVerifyToken } from '../../hooks';
26
+ import { settingsSelector } from '../../app/settings';
16
27
  import AnimationFlow from '../../components/AnimationFlow';
17
28
  import { store } from '../../app/store';
18
29
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
30
  import Collapse from '../../components/Collapse';
20
- import { getParameterByName, reactElement } from '../../utils';
31
+ import { reactElement } from '../../utils';
21
32
  import { FeatureContainer } from '../shared/Containers';
22
- import { DIALOG_ID, TAX_SCREENS_NAVIGATION } from '../../constants';
33
+ import { TAX_SCREENS_NAVIGATION } from '../../constants';
23
34
  import { taxFeatureScreens } from '../featuresScreens';
24
35
  import CustomFooter from '../shared/Footer';
25
36
  import { taxSelector, verifyLeadToken } from '../app/tax/taxStore';
26
37
  import Background from '../shared/Background';
27
- var Tax = memo(function (props) {
38
+ var Tax = memo(function (_a) {
39
+ var verifyToken = _a.verifyToken, props = __rest(_a, ["verifyToken"]);
28
40
  var theme = useAppTheme().theme;
29
- var dispatch = useAppDispatch();
30
- var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var _b = useAppSelector(taxSelector), customLoading = _b.customLoading, taxError = _b.error, loading = _b.loading;
32
- useAppConfig(__assign({ navigation: TAX_SCREENS_NAVIGATION }, props));
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
+ var _c = useAppSelector(taxSelector), customLoading = _c.customLoading, taxError = _c.error, loading = _c.loading;
43
+ useAppConfig(__assign(__assign({ navigation: TAX_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
33
44
  useErrorListener(taxError || error);
34
45
  useStepStartedListener();
35
- var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
36
- var verifyToken = function () {
37
- var token = getParameterByName('token');
38
- var lang = getParameterByName('lang');
39
- if (lang)
40
- dispatch(handleLanguage(lang));
41
- if (!token)
42
- throw new Error('Auth token is not found!');
43
- dispatch(verifyLeadToken(token));
44
- };
45
- useEffect(function () {
46
- if (!settingLoading && open)
47
- verifyToken();
48
- }, [settingLoading]);
49
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: settingLoading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
46
+ var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation;
47
+ useVerifyToken({
48
+ verify: verifyLeadToken,
49
+ loadingScreenName: 'TAX_LOADING_DATA_STEP',
50
+ navigation: featureScreensNavigation,
51
+ open: open,
52
+ internalToken: verifyToken,
53
+ settingLoading: settingLoading
54
+ });
55
+ var initialLoading = verifyToken ? settingLoading : settingLoading || customLoading;
56
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: initialLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
50
57
  var Element = _a.element, name = _a.name;
51
58
  var isActive = activeScreen.name === name;
52
59
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -56,16 +63,7 @@ export function TaxLib(props) {
56
63
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Tax, __assign({}, props)) })));
57
64
  }
58
65
  export function renderTaxLib(config, elementId) {
59
- reactElement(elementId).render(_jsx(TaxLib, __assign({}, config)));
60
- }
61
- export function unmountTaxLib(elementId, unmountTimeout) {
62
- if (unmountTimeout === void 0) { unmountTimeout = 1000; }
63
- var element = document.getElementById(elementId);
64
- var dialogEl = document.getElementById(DIALOG_ID);
65
- setTimeout(function () {
66
- var _a;
67
- ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
68
- dialogEl && dialogEl.remove();
69
- elementId && reactElement(elementId).unmount();
70
- }, unmountTimeout);
66
+ var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
67
+ render(_jsx(TaxLib, __assign({}, config)));
68
+ return { unmount: unmount };
71
69
  }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const PrepareDataLoading: () => JSX.Element;
3
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import DataLoading from '../../../shared/DataLoading';
4
+ export var PrepareDataLoading = function () {
5
+ return _jsx(DataLoading, {});
6
+ };
7
+ export default memo(PrepareDataLoading);
@@ -0,0 +1,2 @@
1
+ import PrepareDataLoading from './PrepareDataLoading';
2
+ export default PrepareDataLoading;
@@ -0,0 +1,2 @@
1
+ import PrepareDataLoading from './PrepareDataLoading';
2
+ export default PrepareDataLoading;
@@ -9,107 +9,14 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect, useState } from 'react';
14
- import { useTranslation } from 'react-i18next';
15
- import { styled } from '@mui/material/styles';
16
- import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
- import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenString, shortenBrand } from '../../../../utils';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo } from 'react';
14
+ import { useAppSelector } from '../../../../hooks';
20
15
  import { taxSelector } from '../../../app/tax/taxStore';
21
- import Box from '@mui/material/Box';
22
- import Text from '../../../../components/Text';
23
- import Container from '../../../shared/Containers/ScreenContainer';
24
- import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
- import { settingsSelector } from '../../../../app/settings';
26
- var TitleStyled = styled(Text)(function (_a) {
27
- var _b;
28
- var theme = _a.theme;
29
- return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
30
- });
31
- var ContainerStyled = styled(Container)(function (_a) {
32
- var theme = _a.theme;
33
- return ({
34
- justifyContent: 'space-between',
35
- minHeight: theme.spacing(30),
36
- alignItems: 'center'
37
- });
38
- });
39
- var ButtonGroupStyled = styled(Box)(function (_a) {
40
- var theme = _a.theme;
41
- return ({
42
- width: '100%',
43
- paddingTop: theme.spacing(3)
44
- });
45
- });
16
+ import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
46
17
  var SuccessWithFlowButtons = function () {
47
- var _a, _b, _c, _d, _e, _f;
48
- var t = useTranslation().t;
49
- var isAr = useLanguage().isAr;
50
18
  var data = useAppSelector(taxSelector).data;
51
- var _g = data.verify.responseBody || {}, flows = _g.flows, nameObj = _g.name, entity = _g.entity, brand = _g.brand, bank = _g.bank, merchant = _g.merchant, vatID = _g.vatID, user = _g.user, business = _g.business;
52
- var _h = useState([]), buttons = _h[0], setButtons = _h[1];
53
- var _j = nameObj || {}, en = _j.en, ar = _j.ar;
54
- var username = isAr ? concatenateObjectValues(ar || en, ['first', 'last']) : concatenateObjectValues(en, ['first', 'last']);
55
- var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
56
- var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.bank_name, 20) || t('bank');
57
- var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
58
- var taxID = vatID || '';
59
- var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
60
- var entityLegalName = shortenString(isAr ? (_d = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _d === void 0 ? void 0 : _d.ar : (_e = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _e === void 0 ? void 0 : _e.en, 20) || '';
61
- var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
62
- var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
63
- var identification = user.identification;
64
- var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_f = identification === null || identification === void 0 ? void 0 : identification.id) === null || _f === void 0 ? void 0 : _f.slice(-2)) : '';
65
- var settings = useAppSelector(settingsSelector);
66
- var _k = data.verify.responseBody || { contact: {}, board_id: '' }, board_id = _k.board_id, board_info_id = _k.board_info_id;
67
- var contact = business === null || business === void 0 ? void 0 : business.primary_contact;
68
- var email = (contact || { email: '' }).email;
69
- var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, board_id, board_info_id);
70
- var reMapFlowData = function (flows) {
71
- if (flows === void 0) { flows = []; }
72
- var images = ICONS_NAMES;
73
- var mappedFlows = flows
74
- .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
75
- .map(function (_a) {
76
- var name = _a.name, url = _a.url, status = _a.status;
77
- var type = status === 'initiated' || status === 'in_progress' ? 'pending' : 'completed';
78
- var title = t("".concat(name, "_flow_").concat(type), {
79
- individual_name: username.toLowerCase() + maskedId,
80
- business_type: entityLegalName,
81
- brand: brandName,
82
- license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
83
- bank_name: bankName,
84
- iban: iban ? t('masking_symbols') + iban : '',
85
- tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
86
- });
87
- var isCompleted = status === 'completed' && name !== 'password';
88
- var isIndividual = name === 'individual';
89
- var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
90
- var hoverSrc = "".concat(name, "_white_icon");
91
- return {
92
- name: name,
93
- status: status,
94
- title: title,
95
- href: url,
96
- src: images[src],
97
- hoverSrc: images[hoverSrc],
98
- isCompleted: isCompleted,
99
- sx: isIndividual ? { textTransform: 'capitalize' } : {}
100
- };
101
- });
102
- setButtons(mappedFlows);
103
- };
104
- useEffect(function () {
105
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
106
- reMapFlowData(flows);
107
- }, [flows, isAr]);
108
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
109
- flowName: data.flowName,
110
- email: email,
111
- emailUrl: url,
112
- brandName: shortenBrand(brandName)
113
- } }) })] }));
19
+ var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name;
20
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, flows: flows || [] }));
114
21
  };
115
22
  export default memo(SuccessWithFlowButtons);
@@ -14,3 +14,4 @@ export * from './useScreen';
14
14
  export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountry';
17
+ export * from './useVerifyToken';
@@ -14,3 +14,4 @@ export * from './useScreen';
14
14
  export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountry';
17
+ export * from './useVerifyToken';
@@ -3,7 +3,7 @@ interface AppConfigProps extends LibConfig {
3
3
  navigation: ScreenStepNavigation[];
4
4
  disableCountries?: boolean;
5
5
  disableLocale?: boolean;
6
- prepare?: () => Promise<void>;
6
+ disableSettingFetching?: boolean;
7
7
  }
8
- export declare const useAppConfig: ({ appInfo, navigation, publicKey, disableCountries, disableLocale, prepare, ...rest }: AppConfigProps) => void;
8
+ export declare const useAppConfig: ({ appInfo, navigation, publicKey, disableCountries, disableLocale, disableSettingFetching, ...rest }: AppConfigProps) => void;
9
9
  export {};
@@ -27,7 +27,7 @@ import { axiosInstance } from '../api';
27
27
  import { isTapDomain, removeRequestHeaders } from '../utils';
28
28
  import { ENDPOINT_PATHS } from '../constants';
29
29
  export var useAppConfig = function (_a) {
30
- var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, disableCountries = _a.disableCountries, disableLocale = _a.disableLocale, prepare = _a.prepare, rest = __rest(_a, ["appInfo", "navigation", "publicKey", "disableCountries", "disableLocale", "prepare"]);
30
+ var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, disableCountries = _a.disableCountries, disableLocale = _a.disableLocale, disableSettingFetching = _a.disableSettingFetching, rest = __rest(_a, ["appInfo", "navigation", "publicKey", "disableCountries", "disableLocale", "disableSettingFetching"]);
31
31
  var dispatch = useAppDispatch();
32
32
  var setBaseUrl = function () {
33
33
  var isProd = publicKey.includes('pk_live');
@@ -51,11 +51,13 @@ export var useAppConfig = function (_a) {
51
51
  useEffect(function () {
52
52
  if (rest.open === false)
53
53
  return;
54
- removeRequestHeaders();
54
+ if (!disableSettingFetching)
55
+ removeRequestHeaders();
55
56
  checkDomain();
56
57
  setBaseUrl();
57
58
  setAppConfig();
58
59
  dispatch(handleLanguage(rest.language));
59
- dispatch(fetchAppSettingsSync({ disableCountries: disableCountries, disableLocale: disableLocale, mdn: rest.merchantDomain, prepare: prepare }));
60
+ if (!disableSettingFetching)
61
+ dispatch(fetchAppSettingsSync({ disableCountries: disableCountries, disableLocale: disableLocale, mdn: rest.merchantDomain }));
60
62
  }, []);
61
63
  };
@@ -0,0 +1,15 @@
1
+ import { ScreenStepNavigation } from '../@types';
2
+ interface VerifyLeadTokenProps {
3
+ token: string;
4
+ isInternally?: boolean;
5
+ }
6
+ interface IVerifyToken {
7
+ verify: (props: VerifyLeadTokenProps) => any;
8
+ internalToken?: string;
9
+ open: boolean;
10
+ settingLoading: boolean;
11
+ navigation: ScreenStepNavigation[];
12
+ loadingScreenName: string;
13
+ }
14
+ export declare const useVerifyToken: ({ verify, internalToken, navigation, open, settingLoading, loadingScreenName }: IVerifyToken) => void;
15
+ export {};
@@ -0,0 +1,25 @@
1
+ import { handleCurrentActiveScreen, handleLanguage } from '../app/settings';
2
+ import { getParameterByName } from '../utils';
3
+ import { useAppDispatch } from './useAppDispatch';
4
+ import { useEffect } from 'react';
5
+ export var useVerifyToken = function (_a) {
6
+ var verify = _a.verify, internalToken = _a.internalToken, navigation = _a.navigation, open = _a.open, settingLoading = _a.settingLoading, loadingScreenName = _a.loadingScreenName;
7
+ var dispatch = useAppDispatch();
8
+ var verifyTokenFun = function () {
9
+ var token = getParameterByName('token') || internalToken;
10
+ var lang = getParameterByName('lang');
11
+ if (lang)
12
+ dispatch(handleLanguage(lang));
13
+ if (!token)
14
+ throw new Error('Auth token is not found!');
15
+ dispatch(verify({ token: token, isInternally: !!internalToken }));
16
+ };
17
+ useEffect(function () {
18
+ if (!settingLoading && open)
19
+ verifyTokenFun();
20
+ }, [settingLoading, open]);
21
+ useEffect(function () {
22
+ if (internalToken && open)
23
+ dispatch(handleCurrentActiveScreen(loadingScreenName));
24
+ }, [navigation]);
25
+ };
package/build/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import './index.css';
2
2
  import './i18n';
3
- import { ConnectLib, renderConnectLib, ConnectLibProps, unmountConnectLib } from './features/connect';
3
+ import { ConnectLib, renderConnectLib, ConnectLibProps } from './features/connect';
4
4
  import { ConnectExpressLib, renderConnectExpressLib, ConnectExpressLibProps } from './features/connectExpress';
5
- import { BusinessLib, renderBusinessLib, BusinessLibProps, unmountBusinessLib } from './features/business';
6
- import { PasswordLib, renderPasswordLib, PasswordLibProps, unmountPasswordLib } from './features/password';
7
- import { IndividualLib, renderIndividualLib, IndividualLibProps, unmountIndividualLib } from './features/individual';
8
- import { BankLib, renderBankLib, BankLibProps, unmountBankLib } from './features/bank';
9
- import { TaxLib, renderTaxLib, TaxLibProps, unmountTaxLib } from './features/tax';
10
- import { SignInLib, renderSignInLib, SignInLibProps, unmountSignInLib } from './features/signIn';
11
- import { EntityLib, EntityLibProps, renderEntityLib, unmountEntityLib } from './features/entity';
12
- import { BrandLib, BrandLibProps, renderBrandLib, unmountBrandLib } from './features/brand';
13
- import { AuthLib, AuthLibProps, renderAuthLib, unmountAuthLib } from './features/auth';
5
+ import { BusinessLib, renderBusinessLib, BusinessLibProps } from './features/business';
6
+ import { PasswordLib, renderPasswordLib, PasswordLibProps } from './features/password';
7
+ import { IndividualLib, renderIndividualLib, IndividualLibProps } from './features/individual';
8
+ import { BankLib, renderBankLib, BankLibProps } from './features/bank';
9
+ import { TaxLib, renderTaxLib, TaxLibProps } from './features/tax';
10
+ import { SignInLib, renderSignInLib, SignInLibProps } from './features/signIn';
11
+ import { EntityLib, EntityLibProps, renderEntityLib } from './features/entity';
12
+ import { BrandLib, BrandLibProps, renderBrandLib } from './features/brand';
13
+ import { AuthLib, AuthLibProps, renderAuthLib } from './features/auth';
14
14
  export type { ConnectLibProps, ConnectExpressLibProps, BusinessLibProps, PasswordLibProps, IndividualLibProps, BankLibProps, TaxLibProps, EntityLibProps, BrandLibProps, AuthLibProps, SignInLibProps };
15
- export { ConnectLib, renderConnectLib, unmountConnectLib, ConnectExpressLib, renderConnectExpressLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib, EntityLib, renderEntityLib, unmountEntityLib, BrandLib, unmountBrandLib, renderBrandLib, SignInLib, renderSignInLib, unmountSignInLib, AuthLib, renderAuthLib, unmountAuthLib };
15
+ export { ConnectLib, renderConnectLib, ConnectExpressLib, renderConnectExpressLib, BusinessLib, renderBusinessLib, PasswordLib, renderPasswordLib, IndividualLib, renderIndividualLib, BankLib, renderBankLib, TaxLib, renderTaxLib, EntityLib, renderEntityLib, BrandLib, renderBrandLib, SignInLib, renderSignInLib, AuthLib, renderAuthLib };
package/build/index.js CHANGED
@@ -1,38 +1,28 @@
1
1
  import './index.css';
2
2
  import './i18n';
3
- import { ConnectLib, renderConnectLib, unmountConnectLib } from './features/connect';
3
+ import { ConnectLib, renderConnectLib } from './features/connect';
4
4
  import { ConnectExpressLib, renderConnectExpressLib } from './features/connectExpress';
5
- import { BusinessLib, renderBusinessLib, unmountBusinessLib } from './features/business';
6
- import { PasswordLib, renderPasswordLib, unmountPasswordLib } from './features/password';
7
- import { IndividualLib, renderIndividualLib, unmountIndividualLib } from './features/individual';
8
- import { BankLib, renderBankLib, unmountBankLib } from './features/bank';
9
- import { TaxLib, renderTaxLib, unmountTaxLib } from './features/tax';
10
- import { SignInLib, renderSignInLib, unmountSignInLib } from './features/signIn';
11
- import { EntityLib, renderEntityLib, unmountEntityLib } from './features/entity';
12
- import { BrandLib, renderBrandLib, unmountBrandLib } from './features/brand';
13
- import { AuthLib, renderAuthLib, unmountAuthLib } from './features/auth';
14
- export { ConnectLib, renderConnectLib, unmountConnectLib, ConnectExpressLib, renderConnectExpressLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib, EntityLib, renderEntityLib, unmountEntityLib, BrandLib, unmountBrandLib, renderBrandLib, SignInLib, renderSignInLib, unmountSignInLib, AuthLib, renderAuthLib, unmountAuthLib };
5
+ import { BusinessLib, renderBusinessLib } from './features/business';
6
+ import { PasswordLib, renderPasswordLib } from './features/password';
7
+ import { IndividualLib, renderIndividualLib } from './features/individual';
8
+ import { BankLib, renderBankLib } from './features/bank';
9
+ import { TaxLib, renderTaxLib } from './features/tax';
10
+ import { SignInLib, renderSignInLib } from './features/signIn';
11
+ import { EntityLib, renderEntityLib } from './features/entity';
12
+ import { BrandLib, renderBrandLib } from './features/brand';
13
+ import { AuthLib, renderAuthLib } from './features/auth';
14
+ export { ConnectLib, renderConnectLib, ConnectExpressLib, renderConnectExpressLib, BusinessLib, renderBusinessLib, PasswordLib, renderPasswordLib, IndividualLib, renderIndividualLib, BankLib, renderBankLib, TaxLib, renderTaxLib, EntityLib, renderEntityLib, BrandLib, renderBrandLib, SignInLib, renderSignInLib, AuthLib, renderAuthLib };
15
15
  window['TapAuth'] = {
16
16
  renderConnectLib: renderConnectLib,
17
- unmountConnectLib: unmountConnectLib,
18
17
  renderConnectExpressLib: renderConnectExpressLib,
19
18
  renderBusinessLib: renderBusinessLib,
20
- unmountBusinessLib: unmountBusinessLib,
21
19
  renderPasswordLib: renderPasswordLib,
22
- unmountPasswordLib: unmountPasswordLib,
23
20
  renderIndividualLib: renderIndividualLib,
24
- unmountIndividualLib: unmountIndividualLib,
25
21
  renderBankLib: renderBankLib,
26
- unmountBankLib: unmountBankLib,
27
22
  renderTaxLib: renderTaxLib,
28
- unmountTaxLib: unmountTaxLib,
29
23
  renderEntityLib: renderEntityLib,
30
- unmountEntityLib: unmountEntityLib,
31
24
  renderBrandLib: renderBrandLib,
32
- unmountBrandLib: unmountBrandLib,
33
25
  renderSignInLib: renderSignInLib,
34
- unmountSignInLib: unmountSignInLib,
35
- renderAuthLib: renderAuthLib,
36
- unmountAuthLib: unmountAuthLib
26
+ renderAuthLib: renderAuthLib
37
27
  };
38
28
  console.log("TapAuth version: ".concat(require('../package.json').version));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.56-test",
3
+ "version": "2.1.59-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { BrandInfo } from '../../../../@types';
3
- interface BrandListProps {
4
- show: boolean;
5
- list: Array<BrandInfo>;
6
- onListOpen?: () => void;
7
- onListClose?: () => void;
8
- }
9
- declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => JSX.Element>;
10
- export default _default;