@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.
Files changed (55) hide show
  1. package/build/@types/app.d.ts +11 -7
  2. package/build/app/settings.d.ts +4 -1
  3. package/build/app/settings.js +14 -3
  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 +7 -2
  7. package/build/components/AnimationFlow/Dialog.d.ts +2 -1
  8. package/build/components/AnimationFlow/Dialog.js +6 -4
  9. package/build/components/AnimationFlow/Loader.js +1 -1
  10. package/build/constants/api.js +1 -1
  11. package/build/constants/assets.d.ts +3 -0
  12. package/build/constants/assets.js +3 -0
  13. package/build/features/app/bank/bankStore.js +1 -1
  14. package/build/features/app/business/businessStore.js +12 -10
  15. package/build/features/app/individual/individualStore.js +1 -1
  16. package/build/features/app/password/passwordStore.js +1 -1
  17. package/build/features/app/tax/taxStore.js +1 -1
  18. package/build/features/bank/Bank.js +8 -8
  19. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  20. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
  21. package/build/features/business/Business.js +8 -8
  22. package/build/features/business/screens/Customers/ExpectedSalesRange.js +1 -1
  23. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -6
  24. package/build/features/connect/Connect.js +8 -8
  25. package/build/features/connect/screens/Individual/MobileNumber.js +10 -4
  26. package/build/features/connect/screens/Mobile/MobileNumber.js +10 -4
  27. package/build/features/individual/Individual.js +8 -8
  28. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +16 -5
  29. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
  30. package/build/features/password/Password.js +8 -8
  31. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -4
  32. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
  33. package/build/features/shared/Background/Background.d.ts +10 -0
  34. package/build/features/shared/Background/Background.js +29 -0
  35. package/build/features/shared/Background/LogoBackground.d.ts +6 -0
  36. package/build/features/shared/Background/LogoBackground.js +70 -0
  37. package/build/features/shared/Background/index.d.ts +2 -0
  38. package/build/features/shared/Background/index.js +2 -0
  39. package/build/features/shared/Button/Button.d.ts +1 -2
  40. package/build/features/shared/Button/FlowsButtons.js +35 -20
  41. package/build/features/shared/Button/SuccessButton.d.ts +3 -3
  42. package/build/features/shared/Button/SuccessButton.js +32 -37
  43. package/build/features/shared/Containers/FeatureContainer.js +3 -0
  44. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  45. package/build/features/tax/Tax.js +8 -8
  46. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -5
  47. package/build/hooks/useAppConfig.js +12 -3
  48. package/build/theme/components.js +9 -0
  49. package/build/utils/array.d.ts +1 -0
  50. package/build/utils/array.js +13 -2
  51. package/build/utils/locale.d.ts +1 -1
  52. package/build/utils/locale.js +5 -3
  53. package/build/utils/validation.d.ts +1 -0
  54. package/build/utils/validation.js +3 -0
  55. package/package.json +1 -1
@@ -25,6 +25,9 @@ var Container = styled(Box)(function (_a) {
25
25
  easing: theme.transitions.easing.easeInOut,
26
26
  property: 'all'
27
27
  },
28
+ _b[theme.breakpoints.down('sm')] = {
29
+ paddingTop: theme.spacing(5)
30
+ },
28
31
  _b);
29
32
  });
30
33
  var FeatureContainer = React.forwardRef(function (props, ref) {
@@ -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;
@@ -38,7 +38,18 @@ export var findItem = function (items, key) {
38
38
  };
39
39
  export var isExist = function (items, id) {
40
40
  return items.find(function (_a) {
41
- var sub = _a.sub;
42
- return sub === null || sub === void 0 ? void 0 : sub.some(function (item) { return item.id === id; });
41
+ var sub = _a.sub, itemID = _a.id;
42
+ if (!sub)
43
+ return itemID === id;
44
+ return sub.some(function (item) {
45
+ return item.id === id;
46
+ });
47
+ });
48
+ };
49
+ export var allAreTruthy = function (items, condition, key, exclude) {
50
+ return items.every(function (item) {
51
+ if (exclude && item['name'] === exclude)
52
+ return true;
53
+ return item[key] === condition;
43
54
  });
44
55
  };
@@ -1,2 +1,2 @@
1
1
  import { LocalProps } from '../@types';
2
- export declare const updateLocale: (locale: LocalProps) => void;
2
+ export declare const updateLocale: (locale: LocalProps, country: string) => void;
@@ -1,10 +1,12 @@
1
1
  import { initReactI18next } from 'react-i18next';
2
2
  import i18n from '../i18n';
3
- export var updateLocale = function (locale) {
3
+ export var updateLocale = function (locale, country) {
4
+ var data = locale[country] || locale['default'];
5
+ console.log('sssssssssssss', data);
4
6
  if (i18n.isInitialized) {
5
7
  i18n.removeResourceBundle('*', 'translation');
6
- i18n.addResourceBundle('en', 'translation', locale.en.translation);
7
- i18n.addResourceBundle('ar', 'translation', locale.ar.translation);
8
+ i18n.addResourceBundle('en', 'translation', data.en.translation);
9
+ i18n.addResourceBundle('ar', 'translation', data.ar.translation);
8
10
  }
9
11
  else {
10
12
  i18n.use(initReactI18next).init({
@@ -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.87",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",