@tap-payments/auth-jsconnect 2.11.2-sandbox → 2.12.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +1 -2
- package/build/@types/app.js +0 -1
- package/build/@types/form.d.ts +0 -2
- package/build/@types/index.d.ts +0 -1
- package/build/@types/index.js +0 -1
- package/build/api/auth.d.ts +1 -9
- package/build/api/entity.d.ts +0 -3
- package/build/api/index.d.ts +1 -7
- package/build/api/index.js +1 -3
- package/build/api/lead.d.ts +0 -1
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +1 -3
- package/build/app/store.d.ts +0 -2
- package/build/assets/locales/ar.json +12 -48
- package/build/assets/locales/en.json +41 -51
- package/build/components/OTPTimer/OTPTimer.d.ts +1 -2
- package/build/components/OTPTimer/OTPTimer.js +4 -4
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +2 -0
- package/build/constants/app.d.ts +2 -21
- package/build/constants/app.js +4 -122
- package/build/constants/flows.d.ts +0 -15
- package/build/constants/flows.js +0 -15
- package/build/constants/validation.d.ts +0 -2
- package/build/constants/validation.js +0 -2
- package/build/features/app/business/businessStore.js +10 -15
- package/build/features/app/connectExpress/connectExpressStore.js +4 -19
- package/build/features/app/individual/individualStore.js +1 -0
- package/build/features/app/tax/taxStore.js +1 -1
- package/build/features/auth/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -13
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +5 -11
- package/build/features/business/screens/BusinessType/LicenseList.js +7 -15
- package/build/features/business/screens/BusinessType/validation.d.ts +3 -6
- package/build/features/business/screens/BusinessType/validation.js +10 -31
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +0 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +7 -23
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +3 -6
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +21 -57
- package/build/features/entity/screens/EntityName/EntityName.js +1 -2
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +3 -14
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +0 -67
- package/build/features/shared/Button/Button.js +1 -1
- package/build/features/shared/Button/FlowsButtons.d.ts +0 -1
- package/build/features/shared/Button/FlowsButtons.js +2 -2
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +1 -2
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +4 -5
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -3
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +2 -4
- package/build/theme/palette.js +0 -12
- package/build/theme/typography.js +0 -4
- package/build/utils/common.js +3 -3
- package/build/utils/string.d.ts +1 -2
- package/build/utils/string.js +2 -11
- package/package.json +2 -2
- package/build/@types/terminal.d.ts +0 -116
- package/build/@types/terminal.js +0 -1
- package/build/api/terminal.d.ts +0 -28
- package/build/api/terminal.js +0 -45
- package/build/components/DeviceCard/DeviceCard.d.ts +0 -18
- package/build/components/DeviceCard/DeviceCard.js +0 -103
- package/build/components/DeviceCard/index.d.ts +0 -3
- package/build/components/DeviceCard/index.js +0 -2
- package/build/features/app/terminal/terminalStore.d.ts +0 -110
- package/build/features/app/terminal/terminalStore.js +0 -676
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +0 -35
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +0 -84
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +0 -36
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +0 -81
- package/build/features/shared/PushNotification/PushNotification.d.ts +0 -11
- package/build/features/shared/PushNotification/PushNotification.js +0 -34
- package/build/features/shared/PushNotification/index.d.ts +0 -2
- package/build/features/shared/PushNotification/index.js +0 -2
- package/build/features/terminal/Terminal.d.ts +0 -14
- package/build/features/terminal/Terminal.js +0 -95
- package/build/features/terminal/index.d.ts +0 -1
- package/build/features/terminal/index.js +0 -1
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts +0 -3
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +0 -69
- package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkNewTerminal/index.js +0 -2
- package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +0 -10
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +0 -28
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +0 -3
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +0 -51
- package/build/features/terminal/screens/LinkedSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkedSuccess/index.js +0 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +0 -3
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +0 -55
- package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/index.js +0 -2
- package/build/features/terminal/screens/Loading/Loading.d.ts +0 -4
- package/build/features/terminal/screens/Loading/Loading.js +0 -10
- package/build/features/terminal/screens/Loading/index.d.ts +0 -2
- package/build/features/terminal/screens/Loading/index.js +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +0 -3
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +0 -58
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +0 -36
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +0 -34
- package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +0 -5
- package/build/features/terminal/screens/OperatorError/OperatorError.js +0 -9
- package/build/features/terminal/screens/OperatorError/index.d.ts +0 -2
- package/build/features/terminal/screens/OperatorError/index.js +0 -2
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +0 -3
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +0 -21
- package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/ResetPasswordSuccess/index.js +0 -2
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +0 -3
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +0 -32
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +0 -2
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +0 -9
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +0 -20
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +0 -3
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +0 -153
- package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/index.js +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +0 -9
- package/build/features/terminal/screens/TerminalDeviceList/styles.js +0 -13
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +0 -3
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +0 -47
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +0 -3
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +0 -53
- package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/UnlinkedSuccess/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +0 -3
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +0 -98
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +0 -26
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +0 -30
- package/build/features/terminal/screens/Verify/OTPInput.d.ts +0 -7
- package/build/features/terminal/screens/Verify/OTPInput.js +0 -51
- package/build/features/terminal/screens/Verify/Verify.d.ts +0 -5
- package/build/features/terminal/screens/Verify/Verify.js +0 -85
- package/build/features/terminal/screens/Verify/index.d.ts +0 -2
- package/build/features/terminal/screens/Verify/index.js +0 -2
- package/build/features/terminal/screens/Verify/validation.d.ts +0 -8
- package/build/features/terminal/screens/Verify/validation.js +0 -4
- package/build/features/terminal/screens/shared/Header.d.ts +0 -10
- package/build/features/terminal/screens/shared/Header.js +0 -30
- package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
- package/build/features/terminal/screens/shared/TerminalList.js +0 -25
- package/build/features/terminal/screens/shared/index.d.ts +0 -5
- package/build/features/terminal/screens/shared/index.js +0 -5
- package/build/features/terminal/screens/shared/styles.d.ts +0 -196
- package/build/features/terminal/screens/shared/styles.js +0 -155
- package/build/features/terminal/screens/shared/utils.d.ts +0 -7
- package/build/features/terminal/screens/shared/utils.js +0 -24
|
@@ -177,7 +177,7 @@ export default function FlowsButtons(_a) {
|
|
|
177
177
|
});
|
|
178
178
|
if (flowName === item.name && !isResetPassword(item.name, item.status)) {
|
|
179
179
|
var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
|
|
180
|
-
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry
|
|
180
|
+
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
|
|
@@ -242,6 +242,6 @@ export default function FlowsButtons(_a) {
|
|
|
242
242
|
onResetPassword();
|
|
243
243
|
else
|
|
244
244
|
onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
|
|
245
|
-
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [name !== 'password' &&
|
|
245
|
+
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [name !== 'password' && _jsx(Dot, { completed: ['complete', 'completed', 'reviewed'].includes(status === null || status === void 0 ? void 0 : status.toLowerCase()) }), _jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)', marginInlineStart: 0 }, 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));
|
|
246
246
|
}), onClose && (_jsx(SharedButton, __assign({ sx: { mt: 2.5, ml: 0, mr: 0 }, isAr: isAr, disableBack: true, loading: storeLoading, onClick: onClose }, { children: t('close_and_complete_later') })))] }));
|
|
247
247
|
}
|
|
@@ -19,7 +19,6 @@ interface SuccessFlowButtonsProps {
|
|
|
19
19
|
onClose?: () => void;
|
|
20
20
|
loading?: boolean;
|
|
21
21
|
status: 'complete' | 'incomplete';
|
|
22
|
-
terminalStepName?: string;
|
|
23
22
|
}
|
|
24
|
-
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status
|
|
23
|
+
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status }: SuccessFlowButtonsProps) => JSX.Element>;
|
|
25
24
|
export default _default;
|
|
@@ -45,7 +45,7 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
45
45
|
});
|
|
46
46
|
var SuccessFlowButtons = function (_a) {
|
|
47
47
|
var _b, _c, _d;
|
|
48
|
-
var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status
|
|
48
|
+
var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status;
|
|
49
49
|
var _e = useState([]), buttons = _e[0], setButtons = _e[1];
|
|
50
50
|
var t = useTranslation().t;
|
|
51
51
|
var isAr = useLanguage().isAr;
|
|
@@ -72,8 +72,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
72
72
|
{ name: 'entity', status: entity === null || entity === void 0 ? void 0 : entity.data_state },
|
|
73
73
|
{ name: 'bank', status: bank === null || bank === void 0 ? void 0 : bank.data_state },
|
|
74
74
|
{ name: 'tax', status: entity === null || entity === void 0 ? void 0 : entity.tax_data_state },
|
|
75
|
-
{ name: 'individual', status: individuals === null || individuals === void 0 ? void 0 : individuals.data_state }
|
|
76
|
-
{ name: 'terminal', status: '' }
|
|
75
|
+
{ name: 'individual', status: individuals === null || individuals === void 0 ? void 0 : individuals.data_state }
|
|
77
76
|
];
|
|
78
77
|
var reMapFlowData = function (flows) {
|
|
79
78
|
if (flows === void 0) { flows = []; }
|
|
@@ -118,6 +117,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
118
117
|
}, [flows, isAr]);
|
|
119
118
|
useEffect(function () {
|
|
120
119
|
var _a, _b;
|
|
120
|
+
console.log('status', status);
|
|
121
121
|
if ((status === null || status === void 0 ? void 0 : status.toLocaleLowerCase()) === 'complete') {
|
|
122
122
|
(_b = (_a = settings.data.appConfig).onBoardCompleted) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
123
123
|
}
|
|
@@ -127,8 +127,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
127
127
|
email: email || '',
|
|
128
128
|
emailUrl: url,
|
|
129
129
|
brandName: shortenBrand(brandName),
|
|
130
|
-
isAuthorizedUser: is_authorized
|
|
131
|
-
terminalStepName: terminalStepName
|
|
130
|
+
isAuthorizedUser: is_authorized
|
|
132
131
|
} }) })] }));
|
|
133
132
|
};
|
|
134
133
|
export default memo(SuccessFlowButtons);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
export interface ThankYouProps {
|
|
4
3
|
title?: string;
|
|
@@ -10,7 +9,6 @@ export interface ThankYouProps {
|
|
|
10
9
|
description?: string | React.ReactElement;
|
|
11
10
|
enableBack?: boolean;
|
|
12
11
|
onBack?: () => void;
|
|
13
|
-
sx?: SxProps<Theme>;
|
|
14
12
|
}
|
|
15
|
-
declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle, loading, error, enableBack, onBack
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle, loading, error, enableBack, onBack }: ThankYouProps) => JSX.Element>;
|
|
16
14
|
export default _default;
|
|
@@ -55,9 +55,9 @@ var IconStyled = styled(Icon)(function (_a) {
|
|
|
55
55
|
_b);
|
|
56
56
|
});
|
|
57
57
|
var ThankYou = function (_a) {
|
|
58
|
-
var title = _a.title, description = _a.description, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle, loading = _a.loading, error = _a.error, enableBack = _a.enableBack, onBack = _a.onBack
|
|
58
|
+
var title = _a.title, description = _a.description, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle, loading = _a.loading, error = _a.error, enableBack = _a.enableBack, onBack = _a.onBack;
|
|
59
59
|
var t = useTranslation().t;
|
|
60
60
|
var isAr = useLanguage().isAr;
|
|
61
|
-
return (_jsxs(ContainerStyled,
|
|
61
|
+
return (_jsxs(ContainerStyled, { children: [_jsx(IconStyled, { src: ICONS_NAMES.SUCCESS_GIF, alt: 'loading...' }), _jsxs(TitleStyled, { children: [title, " "] }), description && _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: 'mailto:' }, mail: { title: t('mail_btn_open_title'), href: 'mailto:' } }) })), 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 || '') })) })), enableBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 0 }, onClick: function () { return onBack === null || onBack === void 0 ? void 0 : onBack(); }, variant: 'text' }, { children: t('back') })))] }));
|
|
62
62
|
};
|
|
63
63
|
export default React.memo(ThankYou);
|
|
@@ -13,5 +13,4 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
|
13
13
|
auth: import("../features/app/auth/authStore").AuthState;
|
|
14
14
|
board: import("../features/app/board/boardStore").BoardState;
|
|
15
15
|
kyc: import("../features/app/kyc/kycStore").KYCDataState;
|
|
16
|
-
terminal: import("../features/app/terminal/terminalStore").TerminalDataState;
|
|
17
16
|
}, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").AnyAction>;
|
package/build/index.d.ts
CHANGED
|
@@ -13,6 +13,5 @@ import { EntityElement, EntityLibProps } from './features/entity';
|
|
|
13
13
|
import { BrandElement, BrandLibProps } from './features/brand';
|
|
14
14
|
import { BoardLibProps, BoardElement } from './features/board';
|
|
15
15
|
import { KYCLibProps, KYCElement } from './features/kyc';
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
export { ConnectElement, ConnectExpressElement, AuthElement, BusinessElement, PasswordElement, IndividualElement, BankElement, TaxElement, EntityElement, BrandElement, SignInElement, BoardElement, KYCElement, TerminalElement };
|
|
16
|
+
export type { ConnectLibProps, ConnectExpressLibProps, AuthLibProps, BusinessLibProps, PasswordLibProps, IndividualLibProps, BankLibProps, TaxLibProps, EntityLibProps, BrandLibProps, SignInLibProps, BoardLibProps, KYCLibProps };
|
|
17
|
+
export { ConnectElement, ConnectExpressElement, AuthElement, BusinessElement, PasswordElement, IndividualElement, BankElement, TaxElement, EntityElement, BrandElement, SignInElement, BoardElement, KYCElement };
|
package/build/index.js
CHANGED
|
@@ -13,8 +13,7 @@ import { EntityElement, renderEntityLib } from './features/entity';
|
|
|
13
13
|
import { BrandElement, renderBrandLib } from './features/brand';
|
|
14
14
|
import { BoardElement, renderBoardLib } from './features/board';
|
|
15
15
|
import { KYCElement, renderKYCLib } from './features/kyc';
|
|
16
|
-
|
|
17
|
-
export { ConnectElement, ConnectExpressElement, AuthElement, BusinessElement, PasswordElement, IndividualElement, BankElement, TaxElement, EntityElement, BrandElement, SignInElement, BoardElement, KYCElement, TerminalElement };
|
|
16
|
+
export { ConnectElement, ConnectExpressElement, AuthElement, BusinessElement, PasswordElement, IndividualElement, BankElement, TaxElement, EntityElement, BrandElement, SignInElement, BoardElement, KYCElement };
|
|
18
17
|
window['TapAuth'] = {
|
|
19
18
|
renderConnectLib: renderConnectLib,
|
|
20
19
|
renderConnectExpressLib: renderConnectExpressLib,
|
|
@@ -28,7 +27,6 @@ window['TapAuth'] = {
|
|
|
28
27
|
renderBrandLib: renderBrandLib,
|
|
29
28
|
renderSignInLib: renderSignInLib,
|
|
30
29
|
renderBoardLib: renderBoardLib,
|
|
31
|
-
renderKYCLib: renderKYCLib
|
|
32
|
-
renderTerminalLib: renderTerminalLib
|
|
30
|
+
renderKYCLib: renderKYCLib
|
|
33
31
|
};
|
|
34
32
|
console.log("TapAuth version: ".concat(require('../package.json').version));
|
package/build/theme/palette.js
CHANGED
|
@@ -48,18 +48,6 @@ export var lightPalette = {
|
|
|
48
48
|
main: '#808592',
|
|
49
49
|
light: '#EAECEF',
|
|
50
50
|
dark: '#3B4152'
|
|
51
|
-
},
|
|
52
|
-
components: {
|
|
53
|
-
deviceCard: {
|
|
54
|
-
title: '#20232B',
|
|
55
|
-
statusText: '#1F222A80',
|
|
56
|
-
statusBackground: ' #F0F0F0',
|
|
57
|
-
deviceInfoBackground: 'linear-gradient(127.37deg, rgba(255, 255, 255, 0.6) 59.07%, rgba(255, 255, 255, 0.444) 100.12%);',
|
|
58
|
-
border: '#e8ecf2'
|
|
59
|
-
},
|
|
60
|
-
toastDeviceSelectorDropdown: {
|
|
61
|
-
border: '#f2f2f2'
|
|
62
|
-
}
|
|
63
51
|
}
|
|
64
52
|
};
|
|
65
53
|
export var darkPalette = {
|
|
@@ -5,7 +5,6 @@ export var typography = {
|
|
|
5
5
|
fontWeightLight: 300,
|
|
6
6
|
fontWeightRegular: 400,
|
|
7
7
|
fontWeightMedium: 500,
|
|
8
|
-
fontWeightSemiBold: 600,
|
|
9
8
|
fontWeightBold: 700,
|
|
10
9
|
allVariants: {
|
|
11
10
|
fontFamily: '"Lato", "Tajawal", "Roboto"',
|
|
@@ -20,7 +19,6 @@ export var typography = {
|
|
|
20
19
|
h2: { fontSize: '3rem' },
|
|
21
20
|
h3: { fontSize: '2.5rem' },
|
|
22
21
|
h4: { fontSize: '2rem' },
|
|
23
|
-
h4_small: { fontSize: '1.625rem' },
|
|
24
22
|
h5: { fontSize: '1.5rem' },
|
|
25
23
|
h6: { fontSize: '1.25rem' },
|
|
26
24
|
subtitle1: { fontSize: '1.125rem' },
|
|
@@ -28,8 +26,6 @@ export var typography = {
|
|
|
28
26
|
body1: { fontSize: '1rem' },
|
|
29
27
|
body2: { fontSize: '0.875rem' },
|
|
30
28
|
button: { fontSize: '0.875rem' },
|
|
31
|
-
button_small: { fontSize: '0.813rem' },
|
|
32
29
|
caption: { fontSize: '0.75rem' },
|
|
33
|
-
caption_small: { fontSize: '0.625rem' },
|
|
34
30
|
overline: { fontSize: '0.5rem' }
|
|
35
31
|
};
|
package/build/utils/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { axiosInstance } from '../api';
|
|
2
|
-
import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL,
|
|
2
|
+
import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_BETA_URL } from '../constants';
|
|
3
3
|
import { objectHasValues } from './object';
|
|
4
4
|
import { isSA } from './string';
|
|
5
5
|
export var sleep = function (milliseconds) {
|
|
@@ -15,7 +15,7 @@ export var dangerousMessage = function (message, callBack) {
|
|
|
15
15
|
export var setBaseUrl = function (publicKey, region) {
|
|
16
16
|
var isProd = publicKey.includes('pk_live');
|
|
17
17
|
if (isProd) {
|
|
18
|
-
axiosInstance.defaults.baseURL = isSA(region) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.
|
|
18
|
+
axiosInstance.defaults.baseURL = isSA(region) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.BETA_BASE_URL;
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
|
|
@@ -37,7 +37,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
|
|
|
37
37
|
window.history.replaceState({}, '', newUrl);
|
|
38
38
|
};
|
|
39
39
|
export var openConnect = function (pk, countryCode) {
|
|
40
|
-
var newUrl = new URL(pk.includes('pk_live') ?
|
|
40
|
+
var newUrl = new URL(pk.includes('pk_live') ? CONNECT_BETA_URL : CONNECT_SANDBOX_URL);
|
|
41
41
|
if (countryCode) {
|
|
42
42
|
newUrl.pathname = "/".concat(countryCode.toLowerCase());
|
|
43
43
|
}
|
package/build/utils/string.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
|
|
|
43
43
|
};
|
|
44
44
|
export declare const removeRequestHeaders: () => void;
|
|
45
45
|
export declare const getBaseUrl: () => string;
|
|
46
|
-
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean
|
|
46
|
+
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP" | "INDIVIDUAL_LIST_STEP" | "PASSWORD_CREATE_PASSWORD_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP" | "ENTITY_NAME_STEP" | "BRAND_INFO_STEP";
|
|
47
47
|
export declare const getEighteenYearsAgo: () => string;
|
|
48
48
|
export declare const isKW: (flag: string) => boolean;
|
|
49
49
|
export declare const isSA: (flag: string | undefined) => boolean;
|
|
@@ -78,4 +78,3 @@ export declare const formatNumberAsCurrency: (number: string) => string;
|
|
|
78
78
|
export declare const getCurrencyByCountryIso2: (countryCode?: string) => string;
|
|
79
79
|
export declare const getMobileNumberLen: (initialLen: number, number: string) => number;
|
|
80
80
|
export declare const getWebsiteLink: (isAr: boolean, countryCode: string, path: string) => string;
|
|
81
|
-
export declare function formatCode(code: string, chunkSize?: number, delimiter?: string): string;
|
package/build/utils/string.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowsTypes } from '../@types';
|
|
2
2
|
import { concatenateObjectValues, encryptString } from '.';
|
|
3
3
|
import { removeAxiosGlobalHeaders } from '../api';
|
|
4
|
-
import {
|
|
4
|
+
import { COUNTRY_TO_CURRENCY, ENDPOINT_PATHS, ICONS_FULL_PATH, LANGUAGE_ABBREVIATIONS, TAP_WEBSITE } from '../constants';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
export var maskPhone = function (str) {
|
|
7
7
|
if (str === void 0) { str = ''; }
|
|
@@ -179,7 +179,7 @@ export var getBaseUrl = function () {
|
|
|
179
179
|
}
|
|
180
180
|
return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
181
181
|
};
|
|
182
|
-
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry
|
|
182
|
+
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry) {
|
|
183
183
|
if (flow === FlowsTypes.BANK) {
|
|
184
184
|
return 'BANK_BANK_DETAILS_STEP';
|
|
185
185
|
}
|
|
@@ -204,9 +204,6 @@ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherT
|
|
|
204
204
|
if (flow === FlowsTypes.PASSWORD) {
|
|
205
205
|
return 'PASSWORD_CREATE_PASSWORD_STEP';
|
|
206
206
|
}
|
|
207
|
-
if (flow === FlowsTypes.TERMINAL) {
|
|
208
|
-
return terminalStepName !== null && terminalStepName !== void 0 ? terminalStepName : CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
209
|
-
}
|
|
210
207
|
return '';
|
|
211
208
|
};
|
|
212
209
|
export var getEighteenYearsAgo = function () {
|
|
@@ -349,9 +346,3 @@ export var getWebsiteLink = function (isAr, countryCode, path) {
|
|
|
349
346
|
var language = isAr ? LANGUAGE_ABBREVIATIONS.ARABIC : LANGUAGE_ABBREVIATIONS.ENGLISH;
|
|
350
347
|
return TAP_WEBSITE + language + '-' + countryCode + path;
|
|
351
348
|
};
|
|
352
|
-
export function formatCode(code, chunkSize, delimiter) {
|
|
353
|
-
var _a;
|
|
354
|
-
if (chunkSize === void 0) { chunkSize = 3; }
|
|
355
|
-
if (delimiter === void 0) { delimiter = ' - '; }
|
|
356
|
-
return ((_a = code.match(new RegExp(".{1,".concat(chunkSize, "}"), 'g'))) === null || _a === void 0 ? void 0 : _a.join(delimiter)) || code;
|
|
357
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.1-beta",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
22
|
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
23
|
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
-
"push": "npm publish --access public --tag
|
|
24
|
+
"push": "npm publish --access public --tag beta"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [],
|
|
27
27
|
"author": {
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
declare type Name = {
|
|
2
|
-
en: string;
|
|
3
|
-
};
|
|
4
|
-
export interface TerminalDeviceInfo {
|
|
5
|
-
id: string;
|
|
6
|
-
status: string;
|
|
7
|
-
object?: string;
|
|
8
|
-
live_mode: boolean;
|
|
9
|
-
api_version?: string;
|
|
10
|
-
feature_version?: string;
|
|
11
|
-
serial_number: string;
|
|
12
|
-
linked: boolean;
|
|
13
|
-
display_name: string;
|
|
14
|
-
model: {
|
|
15
|
-
id: string;
|
|
16
|
-
status: string;
|
|
17
|
-
object?: string;
|
|
18
|
-
live_mode: boolean;
|
|
19
|
-
api_version?: string;
|
|
20
|
-
feature_version?: string;
|
|
21
|
-
model: string;
|
|
22
|
-
type: string;
|
|
23
|
-
name: {
|
|
24
|
-
text: string;
|
|
25
|
-
lang: string;
|
|
26
|
-
}[];
|
|
27
|
-
image: string;
|
|
28
|
-
image_url: string;
|
|
29
|
-
};
|
|
30
|
-
merchant?: {
|
|
31
|
-
id: string;
|
|
32
|
-
brand: {
|
|
33
|
-
id: string;
|
|
34
|
-
name: {
|
|
35
|
-
text: string;
|
|
36
|
-
lang: string;
|
|
37
|
-
}[];
|
|
38
|
-
logo: string;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
terminal?: {
|
|
42
|
-
id: string;
|
|
43
|
-
legacy_id: string;
|
|
44
|
-
name: Name;
|
|
45
|
-
device: {
|
|
46
|
-
id: string;
|
|
47
|
-
created: string;
|
|
48
|
-
display_name: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
platform?: {
|
|
52
|
-
id: string;
|
|
53
|
-
segment: string;
|
|
54
|
-
brand?: {
|
|
55
|
-
id: string;
|
|
56
|
-
name: {
|
|
57
|
-
text: string;
|
|
58
|
-
lang: string;
|
|
59
|
-
}[];
|
|
60
|
-
logo: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export interface TerminalInfo {
|
|
65
|
-
acceptance_status?: string;
|
|
66
|
-
acceptance_status_control?: string;
|
|
67
|
-
api_version?: string;
|
|
68
|
-
authorizes?: {
|
|
69
|
-
status: string;
|
|
70
|
-
status_message: string;
|
|
71
|
-
};
|
|
72
|
-
brand?: {
|
|
73
|
-
id: string;
|
|
74
|
-
};
|
|
75
|
-
charges?: {
|
|
76
|
-
status: string;
|
|
77
|
-
status_message: string;
|
|
78
|
-
};
|
|
79
|
-
feature_version?: string;
|
|
80
|
-
id: string;
|
|
81
|
-
legacy_id: string;
|
|
82
|
-
live_mode?: boolean;
|
|
83
|
-
merchant: {
|
|
84
|
-
base_currency?: string;
|
|
85
|
-
country?: string;
|
|
86
|
-
id: string;
|
|
87
|
-
};
|
|
88
|
-
name: Name;
|
|
89
|
-
platform?: {
|
|
90
|
-
brand: {
|
|
91
|
-
id: string;
|
|
92
|
-
logo: string;
|
|
93
|
-
name: {
|
|
94
|
-
text: string;
|
|
95
|
-
lang: string;
|
|
96
|
-
}[];
|
|
97
|
-
};
|
|
98
|
-
id: string;
|
|
99
|
-
segment: string;
|
|
100
|
-
};
|
|
101
|
-
object?: string;
|
|
102
|
-
refunds?: {
|
|
103
|
-
status: string;
|
|
104
|
-
status_message: string;
|
|
105
|
-
};
|
|
106
|
-
virtual?: boolean;
|
|
107
|
-
wallet?: {
|
|
108
|
-
id: string;
|
|
109
|
-
};
|
|
110
|
-
device?: {
|
|
111
|
-
id: string;
|
|
112
|
-
created: string;
|
|
113
|
-
display_name: string;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
export {};
|
package/build/@types/terminal.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/api/terminal.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface GenerateAuthLinkNewTerminalProps {
|
|
2
|
-
merchant: {
|
|
3
|
-
id: string;
|
|
4
|
-
terminal: {
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export interface UnlinkTerminalDeviceProps {
|
|
10
|
-
deviceId: string;
|
|
11
|
-
initiator: string;
|
|
12
|
-
terminal: {
|
|
13
|
-
id: string;
|
|
14
|
-
};
|
|
15
|
-
merchant: {
|
|
16
|
-
id: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface LinkTerminalDeviceProps {
|
|
20
|
-
id: string;
|
|
21
|
-
action: string;
|
|
22
|
-
}
|
|
23
|
-
declare const terminalService: {
|
|
24
|
-
retrieveTerminalDeviceList: (merchants: string[]) => Promise<any>;
|
|
25
|
-
unlinkTerminalDevice: ({ deviceId, ...payload }: UnlinkTerminalDeviceProps) => Promise<any>;
|
|
26
|
-
retrieveTerminalList: (merchantIds: string[]) => Promise<any>;
|
|
27
|
-
};
|
|
28
|
-
export { terminalService };
|
package/build/api/terminal.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { ENDPOINT_PATHS } from '../constants';
|
|
13
|
-
import { httpClient } from './axios';
|
|
14
|
-
var retrieveTerminalDeviceList = function (merchants) {
|
|
15
|
-
return httpClient({
|
|
16
|
-
method: 'post',
|
|
17
|
-
url: "".concat(ENDPOINT_PATHS.TERMINAL, "/device/list"),
|
|
18
|
-
data: {
|
|
19
|
-
merchants: merchants
|
|
20
|
-
}
|
|
21
|
-
}).catch(function () { });
|
|
22
|
-
};
|
|
23
|
-
var retrieveTerminalList = function (merchantIds) {
|
|
24
|
-
return httpClient({
|
|
25
|
-
method: 'post',
|
|
26
|
-
url: "".concat(ENDPOINT_PATHS.TERMINAL, "/list"),
|
|
27
|
-
data: {
|
|
28
|
-
merchant_id: merchantIds
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
var unlinkTerminalDevice = function (_a) {
|
|
33
|
-
var deviceId = _a.deviceId, payload = __rest(_a, ["deviceId"]);
|
|
34
|
-
return httpClient({
|
|
35
|
-
method: 'put',
|
|
36
|
-
url: "".concat(ENDPOINT_PATHS.TERMINAL, "/device/").concat(deviceId, "/unlink"),
|
|
37
|
-
data: payload
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var terminalService = {
|
|
41
|
-
retrieveTerminalDeviceList: retrieveTerminalDeviceList,
|
|
42
|
-
unlinkTerminalDevice: unlinkTerminalDevice,
|
|
43
|
-
retrieveTerminalList: retrieveTerminalList
|
|
44
|
-
};
|
|
45
|
-
export { terminalService };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CardProps } from '@mui/material/Card';
|
|
3
|
-
export interface DeviceCardProps extends CardProps {
|
|
4
|
-
image?: string;
|
|
5
|
-
name: string;
|
|
6
|
-
deviceId: string;
|
|
7
|
-
deviceIdLabel?: string;
|
|
8
|
-
isLinked?: boolean;
|
|
9
|
-
pairedWith?: string;
|
|
10
|
-
badge?: boolean;
|
|
11
|
-
border?: boolean;
|
|
12
|
-
loading?: boolean;
|
|
13
|
-
arrow?: boolean;
|
|
14
|
-
endAdornment?: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare const DeviceCard: ({ image, name, deviceId, deviceIdLabel, isLinked, pairedWith, onClick, badge, border, arrow, loading, endAdornment, ...rest }: DeviceCardProps) => JSX.Element;
|
|
17
|
-
declare const _default: React.MemoExoticComponent<({ image, name, deviceId, deviceIdLabel, isLinked, pairedWith, onClick, badge, border, arrow, loading, endAdornment, ...rest }: DeviceCardProps) => JSX.Element>;
|
|
18
|
-
export default _default;
|
|
@@ -1,103 +0,0 @@
|
|
|
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
|
-
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
|
-
};
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { memo } from 'react';
|
|
25
|
-
import { useTranslation } from 'react-i18next';
|
|
26
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
27
|
-
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
|
28
|
-
import Card from '@mui/material/Card';
|
|
29
|
-
import Box from '@mui/material/Box';
|
|
30
|
-
import Typography from '@mui/material/Typography';
|
|
31
|
-
import Icon from '../Icon';
|
|
32
|
-
import Loader from '../Loader';
|
|
33
|
-
var DeviceCardContainer = styled(Card, { shouldForwardProp: function (prop) { return !['showBorder'].includes(prop.toString()); } })(function (_a) {
|
|
34
|
-
var _b = _a.theme, spacing = _b.spacing, _c = _b.palette, background = _c.background, components = _c.components, showBorder = _a.showBorder;
|
|
35
|
-
return (__assign({ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: spacing(2), borderRadius: spacing(0.5), boxShadow: 'none', width: '100%', backgroundColor: background.default, minHeight: spacing(14.125), position: 'relative' }, (showBorder && {
|
|
36
|
-
border: "1px solid ".concat(components.deviceCard.border)
|
|
37
|
-
})));
|
|
38
|
-
});
|
|
39
|
-
var DeviceDetails = styled(Box)(function (_a) {
|
|
40
|
-
var spacing = _a.theme.spacing;
|
|
41
|
-
return ({
|
|
42
|
-
display: 'flex',
|
|
43
|
-
alignItems: 'center',
|
|
44
|
-
gap: spacing(3.125)
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
var DeviceImage = styled(Icon)(function (_a) {
|
|
48
|
-
var spacing = _a.theme.spacing;
|
|
49
|
-
return ({
|
|
50
|
-
width: spacing(4.5),
|
|
51
|
-
height: 'auto',
|
|
52
|
-
objectFit: 'contain'
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
var DeviceInfo = styled(Box)(function (_a) {
|
|
56
|
-
var spacing = _a.theme.spacing;
|
|
57
|
-
return ({
|
|
58
|
-
display: 'flex',
|
|
59
|
-
flexDirection: 'column',
|
|
60
|
-
gap: spacing(1)
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
var DeviceTitle = styled(Typography)(function (_a) {
|
|
64
|
-
var _b = _a.theme, typography = _b.typography, palette = _b.palette;
|
|
65
|
-
return (__assign(__assign({}, typography.subtitle1), { color: palette.components.deviceCard.title, fontWeight: typography.fontWeightBold }));
|
|
66
|
-
});
|
|
67
|
-
var DeviceIdInfo = styled(Box)(function (_a) {
|
|
68
|
-
var _b = _a.theme, typography = _b.typography, palette = _b.palette, spacing = _b.spacing;
|
|
69
|
-
return (__assign(__assign({}, typography.caption_small), { color: alpha(palette.text.primary, 0.6), display: 'flex', flexDirection: 'column', gap: spacing(0.5) }));
|
|
70
|
-
});
|
|
71
|
-
var DeviceIdBold = styled('strong')(function (_a) {
|
|
72
|
-
var palette = _a.theme.palette;
|
|
73
|
-
return ({
|
|
74
|
-
color: palette.components.deviceCard.title
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
var Badge = styled(Box, { shouldForwardProp: function (prop) { return !['active'].includes(prop.toString()); } })(function (_a) {
|
|
78
|
-
var _b = _a.theme, direction = _b.direction, spacing = _b.spacing, palette = _b.palette, typography = _b.typography, active = _a.active;
|
|
79
|
-
return (__assign(__assign(__assign({ backgroundColor: palette.components.deviceCard.statusBackground, color: palette.components.deviceCard.statusText }, typography.caption), { fontWeight: typography.fontWeightSemiBold, padding: spacing(0.5, 1, 0.5, 1), position: 'absolute', top: 0, left: direction === 'rtl' ? 0 : 'unset', right: direction === 'rtl' ? 'unset' : '0', borderBottomLeftRadius: spacing(0.5) }), (active && {
|
|
80
|
-
backgroundColor: alpha(palette.primary.main, 0.1),
|
|
81
|
-
color: palette.primary.main
|
|
82
|
-
})));
|
|
83
|
-
});
|
|
84
|
-
var ArrowIcon = styled(ArrowForwardIosIcon)(function (_a) {
|
|
85
|
-
var _b = _a.theme, palette = _b.palette, direction = _b.direction;
|
|
86
|
-
return (__assign({ color: palette.components.deviceCard.title, fontSize: '16px' }, (direction === 'rtl' && {
|
|
87
|
-
transform: 'rotate(180deg)'
|
|
88
|
-
})));
|
|
89
|
-
});
|
|
90
|
-
export var DeviceCard = function (_a) {
|
|
91
|
-
var image = _a.image, name = _a.name, deviceId = _a.deviceId, deviceIdLabel = _a.deviceIdLabel, isLinked = _a.isLinked, pairedWith = _a.pairedWith, onClick = _a.onClick, badge = _a.badge, border = _a.border, arrow = _a.arrow, loading = _a.loading, endAdornment = _a.endAdornment, rest = __rest(_a, ["image", "name", "deviceId", "deviceIdLabel", "isLinked", "pairedWith", "onClick", "badge", "border", "arrow", "loading", "endAdornment"]);
|
|
92
|
-
var t = useTranslation().t;
|
|
93
|
-
var getEndComponent = function () {
|
|
94
|
-
if (endAdornment)
|
|
95
|
-
return endAdornment;
|
|
96
|
-
if (loading)
|
|
97
|
-
return _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 10, style: { height: 24, width: 24 }, toggleAnimation: !!loading });
|
|
98
|
-
if (arrow)
|
|
99
|
-
return _jsx(ArrowIcon, {});
|
|
100
|
-
};
|
|
101
|
-
return (_jsxs(DeviceCardContainer, __assign({ onClick: onClick, sx: { cursor: onClick ? 'pointer' : 'default' }, showBorder: border }, rest, { children: [_jsxs(DeviceDetails, { children: [image && _jsx(DeviceImage, { src: image, alt: 'Device' }), _jsxs(DeviceInfo, { children: [_jsx(DeviceTitle, { children: name }), _jsxs(DeviceIdInfo, { children: [pairedWith && (_jsxs("span", { children: [t('terminal_paired_with'), ": ", _jsx(DeviceIdBold, { children: pairedWith })] })), _jsxs("span", { children: [t(deviceIdLabel !== null && deviceIdLabel !== void 0 ? deviceIdLabel : 'terminal_device_id'), ": ", _jsx(DeviceIdBold, { children: deviceId }), "`"] })] })] })] }), badge && _jsx(Badge, __assign({ active: isLinked }, { children: isLinked ? t('terminal_linked') : t('terminal_unlinked') })), _jsx(Box, __assign({ display: 'flex', alignItems: 'center' }, { children: getEndComponent() }))] })));
|
|
102
|
-
};
|
|
103
|
-
export default memo(DeviceCard);
|