@basiq/connect-auth 0.1.79 → 0.1.83
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/package.json +9 -7
- package/src/App.tsx +0 -96
- package/src/BasiqConnect.tsx +0 -17
- package/src/actions/actions.ts +0 -72
- package/src/components/modals/LoadingModal.tsx +0 -28
- package/src/components/modals/index.ts +0 -1
- package/src/components/pages/AuthScreen.tsx +0 -96
- package/src/components/pages/NotFound.tsx +0 -44
- package/src/components/pages/Page.tsx +0 -46
- package/src/components/pages/StartScreen.tsx +0 -83
- package/src/components/pages/index.ts +0 -4
- package/src/components/ui/Button.tsx +0 -24
- package/src/components/ui/Modal.tsx +0 -29
- package/src/components/ui/icon.tsx +0 -18
- package/src/components/ui/index.ts +0 -1
- package/src/custom.d.ts +0 -9
- package/src/fonts/Mark-W1G-Bold.otf +0 -0
- package/src/fonts/Mark-W1G-Book.otf +0 -0
- package/src/fonts.d.ts +0 -1
- package/src/helpers/constants.ts +0 -2
- package/src/helpers/hookUtils.ts +0 -8
- package/src/helpers/index.ts +0 -3
- package/src/helpers/utils.ts +0 -12
- package/src/images/back.svg +0 -8
- package/src/images/error.svg +0 -10
- package/src/images/loading_indicator.svg +0 -14
- package/src/index.tsx +0 -1
- package/src/locales/en/translation.json +0 -29
- package/src/locales/i18n.ts +0 -27
- package/src/logo.svg +0 -1
- package/src/react-app-env.d.ts +0 -1
- package/src/react-i18next.d.ts +0 -9
- package/src/setupTests.ts +0 -5
- package/src/styled.d.ts +0 -6
- package/src/styledComponents/base.ts +0 -73
- package/src/styledComponents/breakpoints.ts +0 -32
- package/src/styledComponents/index.ts +0 -4
- package/src/styledComponents/pages/auth.ts +0 -49
- package/src/styledComponents/pages/basic.ts +0 -126
- package/src/styledComponents/pages/index.ts +0 -4
- package/src/styledComponents/pages/notFound.ts +0 -70
- package/src/styledComponents/pages/start.ts +0 -6
- package/src/styledComponents/styles.ts +0 -25
- package/src/styledComponents/theme.ts +0 -58
- package/src/styledComponents/ui/basic.ts +0 -96
- package/src/styledComponents/ui/button.ts +0 -112
- package/src/styledComponents/ui/index.ts +0 -3
- package/src/styledComponents/ui/modals.ts +0 -48
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.83",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
|
-
"files": ["dist"
|
|
6
|
+
"files": ["dist"],
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=10"
|
|
9
9
|
},
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"analyze": "size-limit --why"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"react": ">=16"
|
|
20
|
+
"react": ">=16",
|
|
21
|
+
"react-dom": ">=16"
|
|
21
22
|
},
|
|
22
23
|
"husky": {
|
|
23
24
|
"hooks": {
|
|
@@ -53,12 +54,13 @@
|
|
|
53
54
|
"typescript": "^3.9.10",
|
|
54
55
|
"rollup-plugin-url": "^3.0.1",
|
|
55
56
|
"@rollup/plugin-image": "^2.1.1",
|
|
56
|
-
"@types/styled-components": "^5.1.25"
|
|
57
|
-
|
|
58
|
-
"react-i18next": "^11.16.9"
|
|
57
|
+
"@types/styled-components": "^5.1.25"
|
|
58
|
+
|
|
59
59
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"styled-components": "^5.3.5"
|
|
62
|
+
"styled-components": "^5.3.5",
|
|
63
|
+
"i18next": "^21.8.1",
|
|
64
|
+
"react-i18next": "^11.16.9"
|
|
63
65
|
}
|
|
64
66
|
}
|
package/src/App.tsx
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React, { createRef, SyntheticEvent, useEffect, useState } from 'react';
|
|
2
|
-
import { AppContainer, AppContainerPage, AppContainerWrapper, PageHeader, Root } from './styledComponents';
|
|
3
|
-
import GlobalStyles from './styledComponents/styles';
|
|
4
|
-
import { detectScrollToBottom } from './helpers';
|
|
5
|
-
import {AuthScreen, NotFound, Page, StartScreen} from './components/pages';
|
|
6
|
-
import { authUser } from './actions/actions';
|
|
7
|
-
import { LoadingModal } from './components/modals';
|
|
8
|
-
|
|
9
|
-
function App() {
|
|
10
|
-
const ref = createRef<HTMLDivElement>();
|
|
11
|
-
const [shadow, setShadow] = useState(false);
|
|
12
|
-
const [currentScreen, setCurrentScreen] = useState(0);
|
|
13
|
-
const [loading, setLoading] = useState(true);
|
|
14
|
-
const [authId, setAuthId] = useState('');
|
|
15
|
-
const [mobile, setMobile] = useState('');
|
|
16
|
-
const [logo, setLogo] = useState('');
|
|
17
|
-
const [appName, setAppName] = useState('');
|
|
18
|
-
const [errorCode, setErrorCode] = useState('');
|
|
19
|
-
|
|
20
|
-
const handleConnectionsScroll = (event: SyntheticEvent<HTMLDivElement>) => {
|
|
21
|
-
setShadow(detectScrollToBottom(event));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const getData = async () => {
|
|
26
|
-
const id = window.location.pathname.substring(1);
|
|
27
|
-
if (id?.length > 0) {
|
|
28
|
-
setAuthId(id);
|
|
29
|
-
setLoading(true);
|
|
30
|
-
const response = await authUser(id, 'GET');
|
|
31
|
-
if (response?.data?.status === 'code-not-sent') {
|
|
32
|
-
setCurrentScreen(1);
|
|
33
|
-
setMobile(response?.data?.mobile);
|
|
34
|
-
if (response?.data?.appName) {
|
|
35
|
-
setAppName(response?.data?.appName);
|
|
36
|
-
}
|
|
37
|
-
if (response?.data?.partner?.logoUrl) {
|
|
38
|
-
setLogo(response?.data?.partner?.logoUrl);
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
showErrorScreen(response?.statusCode.toString());
|
|
42
|
-
}
|
|
43
|
-
setLoading(false);
|
|
44
|
-
} else {
|
|
45
|
-
showErrorScreen('404');
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
getData();
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const showErrorScreen = (code: string) => {
|
|
52
|
-
setErrorCode(code);
|
|
53
|
-
setCurrentScreen(3);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const getScreen = () => {
|
|
57
|
-
switch (currentScreen) {
|
|
58
|
-
case 0:
|
|
59
|
-
return <Page shadow={shadow}><LoadingModal isOpen={loading} disableTransparency /></Page>;
|
|
60
|
-
case 1:
|
|
61
|
-
return (
|
|
62
|
-
<StartScreen
|
|
63
|
-
appName={appName}
|
|
64
|
-
shadow={shadow}
|
|
65
|
-
showErrorScreen={showErrorScreen}
|
|
66
|
-
onContinue={() => setCurrentScreen(2)}
|
|
67
|
-
authId={authId}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
case 2:
|
|
71
|
-
return <AuthScreen number={mobile} onBack={() => setCurrentScreen(1)} shadow={shadow} authId={authId} />;
|
|
72
|
-
case 3:
|
|
73
|
-
return <NotFound messageCode={errorCode} />;
|
|
74
|
-
default:
|
|
75
|
-
return <NotFound messageCode={errorCode} />;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<Root>
|
|
81
|
-
<GlobalStyles />
|
|
82
|
-
<AppContainerWrapper>
|
|
83
|
-
<AppContainer onScroll={handleConnectionsScroll} ref={ref}>
|
|
84
|
-
{logo && (
|
|
85
|
-
<PageHeader>
|
|
86
|
-
<img src={logo} alt="logo" />
|
|
87
|
-
</PageHeader>
|
|
88
|
-
)}
|
|
89
|
-
<AppContainerPage>{getScreen()}</AppContainerPage>
|
|
90
|
-
</AppContainer>
|
|
91
|
-
</AppContainerWrapper>
|
|
92
|
-
</Root>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export default App;
|
package/src/BasiqConnect.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeProvider } from 'styled-components';
|
|
3
|
-
import App from './App';
|
|
4
|
-
import './locales/i18n';
|
|
5
|
-
import { theme } from './styledComponents';
|
|
6
|
-
|
|
7
|
-
export function BasiqConnect() {
|
|
8
|
-
return(
|
|
9
|
-
<React.StrictMode>
|
|
10
|
-
<ThemeProvider theme={theme}>
|
|
11
|
-
<App />
|
|
12
|
-
</ThemeProvider>
|
|
13
|
-
</React.StrictMode>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
package/src/actions/actions.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { DASHBOARD_API_URL } from '../helpers';
|
|
2
|
-
|
|
3
|
-
export const verifySmsCode = async (authRequestId: string, smsCode: string) => {
|
|
4
|
-
const body = {
|
|
5
|
-
'sms-code': smsCode
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const reqData = {
|
|
9
|
-
headers: {
|
|
10
|
-
'Content-Type': 'application/json',
|
|
11
|
-
Authorization: `Basic SMS_CODE:${authRequestId}`
|
|
12
|
-
},
|
|
13
|
-
method: 'POST',
|
|
14
|
-
body: JSON.stringify(body)
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const result = await fetch(`${DASHBOARD_API_URL}client_auth/${authRequestId}/token`, reqData);
|
|
18
|
-
|
|
19
|
-
if (result.status >= 200 && result.status < 300) {
|
|
20
|
-
const json = result.status === 204 ? null : await result.json();
|
|
21
|
-
return {
|
|
22
|
-
data: json,
|
|
23
|
-
headers: result.headers,
|
|
24
|
-
statusCode: result.status
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
if (result.status >= 400) {
|
|
28
|
-
return {
|
|
29
|
-
headers: result.headers,
|
|
30
|
-
statusCode: result.status,
|
|
31
|
-
error: result.statusText || 'Something went wrong'
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
headers: result.headers,
|
|
36
|
-
statusCode: result.status,
|
|
37
|
-
error: result.statusText || 'Something went wrong'
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const authUser = async (authRequestId: string, method: 'POST' | 'GET' = 'POST') => {
|
|
42
|
-
const reqData = {
|
|
43
|
-
headers: {
|
|
44
|
-
'Content-Type': 'application/json'
|
|
45
|
-
},
|
|
46
|
-
method
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const result = await fetch(`${DASHBOARD_API_URL}client_auth/${authRequestId}`, reqData);
|
|
50
|
-
|
|
51
|
-
if (result.status >= 200 && result.status < 300) {
|
|
52
|
-
const json = result.status === 204 ? null : await result.json();
|
|
53
|
-
return {
|
|
54
|
-
data: json,
|
|
55
|
-
headers: result.headers,
|
|
56
|
-
statusCode: result.status
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
if (result.status >= 400) {
|
|
60
|
-
const json = result.status === 403 ? null : await result.json();
|
|
61
|
-
return {
|
|
62
|
-
headers: result.headers,
|
|
63
|
-
statusCode: result.status,
|
|
64
|
-
error: json.message || result.statusText || 'Something went wrong'
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
headers: result.headers,
|
|
69
|
-
statusCode: result.status,
|
|
70
|
-
error: result.statusText || 'Something went wrong'
|
|
71
|
-
};
|
|
72
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import Modal from '../ui/Modal';
|
|
4
|
-
import { LoadingModalStyled, LoadingModalText } from '../../styledComponents';
|
|
5
|
-
import Icon from '../ui/icon';
|
|
6
|
-
import loadingIndicator from '../../images/loading_indicator.svg';
|
|
7
|
-
|
|
8
|
-
interface IProps {
|
|
9
|
-
isOpen: boolean;
|
|
10
|
-
disableTransparency?: boolean;
|
|
11
|
-
loadingText?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function LoadingModal(props: IProps) {
|
|
15
|
-
const { isOpen, disableTransparency, loadingText } = props;
|
|
16
|
-
const { t } = useTranslation();
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Modal isOpen={isOpen} disableTransparency={!!disableTransparency}>
|
|
20
|
-
<LoadingModalStyled disableTransparency={!!disableTransparency}>
|
|
21
|
-
<Icon img={loadingIndicator} rotating />
|
|
22
|
-
<LoadingModalText>{loadingText || t<string>('loading')}</LoadingModalText>
|
|
23
|
-
</LoadingModalStyled>
|
|
24
|
-
</Modal>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default LoadingModal;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as LoadingModal } from './LoadingModal';
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React, { ChangeEvent, useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import Page, { IButton } from './Page';
|
|
4
|
-
import { DivAsLink, InputContainer, InputStyled, PageConnectFooterControl, PageConnectFooterText, StatusMessage } from '../../styledComponents';
|
|
5
|
-
import { InnerContainer } from '../../styledComponents/pages/start';
|
|
6
|
-
import { LoadingModal } from '../modals';
|
|
7
|
-
import { authUser, verifySmsCode } from '../../actions/actions';
|
|
8
|
-
|
|
9
|
-
interface IProps {
|
|
10
|
-
shadow: boolean;
|
|
11
|
-
onBack: () => void;
|
|
12
|
-
number: string;
|
|
13
|
-
authId: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function AuthScreen({ onBack, number, authId, shadow }: IProps) {
|
|
17
|
-
const { t } = useTranslation();
|
|
18
|
-
const [error, setError] = useState('');
|
|
19
|
-
const [code, setCode] = useState('');
|
|
20
|
-
const [resend, setResend] = useState(false);
|
|
21
|
-
const [loading, setLoading] = useState(false);
|
|
22
|
-
const handleCodeApply = async () => {
|
|
23
|
-
setLoading(true);
|
|
24
|
-
const response = await verifySmsCode(authId, code);
|
|
25
|
-
setLoading(false);
|
|
26
|
-
if (response?.data?.access_token) {
|
|
27
|
-
window.open(`https://consent.basiq.io/home?token=${response?.data?.access_token}`);
|
|
28
|
-
}
|
|
29
|
-
if (response?.error) {
|
|
30
|
-
setError(t('this_code_doesnt_appear_to_be_valid'));
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const buttons: IButton[] = [
|
|
34
|
-
{
|
|
35
|
-
label: t('continue'),
|
|
36
|
-
onClick: () => handleCodeApply()
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
const handleResend = async () => {
|
|
41
|
-
setError('');
|
|
42
|
-
setCode('');
|
|
43
|
-
setLoading(true);
|
|
44
|
-
const response = await authUser(authId);
|
|
45
|
-
setLoading(false);
|
|
46
|
-
if (response.error) {
|
|
47
|
-
setError(t('failed_to_send_sms'));
|
|
48
|
-
} else {
|
|
49
|
-
setResend(true);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const handleInput = (e: ChangeEvent<HTMLInputElement>) => {
|
|
53
|
-
setError('');
|
|
54
|
-
setResend(false);
|
|
55
|
-
setCode(e.target.value);
|
|
56
|
-
};
|
|
57
|
-
return (
|
|
58
|
-
<Page
|
|
59
|
-
title={t('verify_your_mobile_number')}
|
|
60
|
-
subTitle={t('please_enter_the_sms_code_sent_to_your_mobile_number', { number })}
|
|
61
|
-
shadow={shadow}
|
|
62
|
-
buttons={buttons}
|
|
63
|
-
onBack={onBack}
|
|
64
|
-
>
|
|
65
|
-
<InnerContainer>
|
|
66
|
-
<InputContainer>
|
|
67
|
-
<InputStyled
|
|
68
|
-
pattern="\d{4}"
|
|
69
|
-
inputMode="numeric"
|
|
70
|
-
autoComplete="one-time-code"
|
|
71
|
-
type="text"
|
|
72
|
-
maxLength={4}
|
|
73
|
-
onChange={handleInput}
|
|
74
|
-
value={code}
|
|
75
|
-
filled={code.length === 4}
|
|
76
|
-
error={!!error}
|
|
77
|
-
/>
|
|
78
|
-
</InputContainer>
|
|
79
|
-
<PageConnectFooterControl>
|
|
80
|
-
{resend && <StatusMessage>{t<string>('new_sms_code_has_been_sent')}</StatusMessage>}
|
|
81
|
-
{!!error && <StatusMessage error>{error}</StatusMessage>}
|
|
82
|
-
<PageConnectFooterText>
|
|
83
|
-
<span>
|
|
84
|
-
<>
|
|
85
|
-
{t('didnt_receive_the_code')} <DivAsLink onClick={() => handleResend()}>{t<string>('resend_sms')}</DivAsLink>
|
|
86
|
-
</>
|
|
87
|
-
</span>
|
|
88
|
-
</PageConnectFooterText>
|
|
89
|
-
</PageConnectFooterControl>
|
|
90
|
-
<LoadingModal isOpen={loading} />
|
|
91
|
-
</InnerContainer>
|
|
92
|
-
</Page>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export default AuthScreen;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import {
|
|
4
|
-
PageControlsSection,
|
|
5
|
-
PageShadowWrapper,
|
|
6
|
-
PageStatusScreenContent,
|
|
7
|
-
PageStatusScreenMain,
|
|
8
|
-
PageStyled,
|
|
9
|
-
StatusScreenCircleContainer,
|
|
10
|
-
StatusScreenErrorCode
|
|
11
|
-
} from '../../styledComponents';
|
|
12
|
-
import Icon from '../ui/icon';
|
|
13
|
-
import Page from './Page';
|
|
14
|
-
import err from '../../images/error.svg';
|
|
15
|
-
|
|
16
|
-
interface IProps {
|
|
17
|
-
messageCode?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function NotFound({ messageCode = '404' }: IProps) {
|
|
21
|
-
const { t } = useTranslation();
|
|
22
|
-
return (
|
|
23
|
-
<Page shadow={false}>
|
|
24
|
-
<PageStyled>
|
|
25
|
-
<PageStatusScreenMain>
|
|
26
|
-
<PageStyled>
|
|
27
|
-
<PageStatusScreenContent>
|
|
28
|
-
<StatusScreenCircleContainer type="warning">
|
|
29
|
-
<Icon img={err} rotating={false} />
|
|
30
|
-
</StatusScreenCircleContainer>
|
|
31
|
-
<span>{t<string>('page_not_found')}</span>
|
|
32
|
-
<StatusScreenErrorCode>{`${t('error')}: ${messageCode}`}</StatusScreenErrorCode>
|
|
33
|
-
</PageStatusScreenContent>
|
|
34
|
-
</PageStyled>
|
|
35
|
-
</PageStatusScreenMain>
|
|
36
|
-
<PageControlsSection notEmpty={false}>
|
|
37
|
-
<PageShadowWrapper />
|
|
38
|
-
</PageControlsSection>
|
|
39
|
-
</PageStyled>
|
|
40
|
-
</Page>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default NotFound;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Button } from '../ui';
|
|
4
|
-
import { PageControlsSection, PageMainContainer, PageShadow, PageShadowWrapper, PageStyled, PageSubtitle } from '../../styledComponents';
|
|
5
|
-
import { ButtonType } from '../ui/Button';
|
|
6
|
-
|
|
7
|
-
interface IProps {
|
|
8
|
-
buttons?: IButton[];
|
|
9
|
-
children: ReactElement;
|
|
10
|
-
title?: string | ReactElement;
|
|
11
|
-
subTitle?: string;
|
|
12
|
-
shadow: boolean;
|
|
13
|
-
onBack?: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface IButton {
|
|
17
|
-
label: string;
|
|
18
|
-
onClick: () => void;
|
|
19
|
-
buttonType?: ButtonType;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function Page(props: IProps) {
|
|
24
|
-
const { buttons, children, title, subTitle, shadow, onBack } = props;
|
|
25
|
-
|
|
26
|
-
const { t } = useTranslation();
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<PageStyled buttonCount={buttons?.length}>
|
|
30
|
-
{onBack && <Button onClick={onBack} label={t('back')} buttonType="back" />}
|
|
31
|
-
{title && <h3>{title}</h3>}
|
|
32
|
-
{subTitle && <PageSubtitle>{subTitle}</PageSubtitle>}
|
|
33
|
-
<PageMainContainer>{children}</PageMainContainer>
|
|
34
|
-
<PageControlsSection notEmpty={(buttons?.length ?? 0) > 0}>
|
|
35
|
-
<PageShadowWrapper>
|
|
36
|
-
{shadow && <PageShadow />}
|
|
37
|
-
{buttons?.map((b, index) => (
|
|
38
|
-
<Button key={index} onClick={b.onClick} label={b.label} buttonType={b.buttonType} disabled={b.disabled} />
|
|
39
|
-
))}
|
|
40
|
-
</PageShadowWrapper>
|
|
41
|
-
</PageControlsSection>
|
|
42
|
-
</PageStyled>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default Page;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
3
|
-
import Page, { IButton } from './Page';
|
|
4
|
-
import { H4Styled, Spacer, InnerContainer } from '../../styledComponents';
|
|
5
|
-
import { authUser } from '../../actions/actions';
|
|
6
|
-
import { LoadingModal } from '../modals';
|
|
7
|
-
|
|
8
|
-
interface IProps {
|
|
9
|
-
onContinue: () => void;
|
|
10
|
-
showErrorScreen: (code:string) => void;
|
|
11
|
-
shadow: boolean;
|
|
12
|
-
appName: string;
|
|
13
|
-
authId?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function StartScreen(props: IProps) {
|
|
17
|
-
const { onContinue, appName, shadow, authId } = props;
|
|
18
|
-
const [loading, setLoading] = useState(false);
|
|
19
|
-
const { t } = useTranslation();
|
|
20
|
-
const handleContinue = async () => {
|
|
21
|
-
setLoading(true);
|
|
22
|
-
if(!!authId){
|
|
23
|
-
const response = await authUser(authId);
|
|
24
|
-
if (response?.data?.status === 'code-sent') {
|
|
25
|
-
setLoading(false);
|
|
26
|
-
onContinue();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
const buttons: IButton[] = [
|
|
32
|
-
{
|
|
33
|
-
label: t('continue'),
|
|
34
|
-
onClick: () => handleContinue()
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
return (
|
|
38
|
-
<Page
|
|
39
|
-
title={
|
|
40
|
-
appName ? (
|
|
41
|
-
<Trans t={t} i18nKey="use_basiq_to_connect_your_accounts" values={{ name: appName }} components={{ bold: <strong /> }} />
|
|
42
|
-
) : (
|
|
43
|
-
<Trans t={t} i18nKey="we_use_basiq_to_connect_your_accounts" components={{ bold: <strong /> }} />
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
shadow={shadow}
|
|
47
|
-
buttons={buttons}
|
|
48
|
-
>
|
|
49
|
-
<InnerContainer>
|
|
50
|
-
<Spacer />
|
|
51
|
-
<H4Styled>{t<string>('to_do_this_we_will_ask_you_to')}</H4Styled>
|
|
52
|
-
<ul>
|
|
53
|
-
<li>
|
|
54
|
-
<Trans t={t} i18nKey="verify_your_mobile_number_bold" components={{ bold: <strong /> }} />
|
|
55
|
-
</li>
|
|
56
|
-
<li>
|
|
57
|
-
<Trans t={t} i18nKey="consent_to_share_your_data_with_us" components={{ bold: <strong /> }} />
|
|
58
|
-
</li>
|
|
59
|
-
<li>
|
|
60
|
-
<Trans t={t} i18nKey="share_your_financial_data" components={{ bold: <strong /> }} />
|
|
61
|
-
</li>
|
|
62
|
-
</ul>
|
|
63
|
-
<H4Styled>{t<string>('things_you_should_know')}</H4Styled>
|
|
64
|
-
<ul>
|
|
65
|
-
<li>{t<string>('we_dont_share_your_data_without_your_consent')}</li>
|
|
66
|
-
<li>{t<string>('you_can_easily_stop_sharing_your_data_at_any_time')}</li>
|
|
67
|
-
<li>{t<string>('you_can_choose_to_delete_shared_data_when_we_no_longer_need_it')}</li>
|
|
68
|
-
</ul>
|
|
69
|
-
<Spacer />
|
|
70
|
-
<span>
|
|
71
|
-
<>
|
|
72
|
-
{t('by_proceeding_you_agree_to_the')}{' '}
|
|
73
|
-
<a href="https://docs.basiq.io/en/articles/415750-basiq-terms-of-service">{t<string>('terms_of_service')}</a> {t('and')}{' '}
|
|
74
|
-
<a href="https://docs.basiq.io/en/articles/382581-basiq-privacy-policy">{t<string>('privacy_notice')}</a>
|
|
75
|
-
</>
|
|
76
|
-
</span>
|
|
77
|
-
<LoadingModal isOpen={loading} />
|
|
78
|
-
</InnerContainer>
|
|
79
|
-
</Page>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export default StartScreen;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ButtonLabel, ButtonStyled } from '../../styledComponents';
|
|
3
|
-
import back from '../../images/back.svg';
|
|
4
|
-
|
|
5
|
-
export type ButtonType = 'secondary' | 'tiny' | 'link' | 'back';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
label: string;
|
|
10
|
-
buttonType?: ButtonType;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function Button(props: Props) {
|
|
15
|
-
const { onClick, label, buttonType, disabled } = props;
|
|
16
|
-
return (
|
|
17
|
-
<ButtonStyled buttonType={buttonType} disabled={disabled || false} onClick={onClick}>
|
|
18
|
-
{buttonType === 'back' && <img src={back} alt="" />}
|
|
19
|
-
<ButtonLabel> {label || ''}</ButtonLabel>
|
|
20
|
-
</ButtonStyled>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default Button;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, SyntheticEvent } from 'react';
|
|
2
|
-
import { ModalStyled } from '../../styledComponents';
|
|
3
|
-
|
|
4
|
-
interface IProps {
|
|
5
|
-
children: ReactElement;
|
|
6
|
-
onClose?: () => void;
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
disableTransparency: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function Modal(props: IProps) {
|
|
12
|
-
const { children, onClose, isOpen, disableTransparency } = props;
|
|
13
|
-
const handleOutsideClick = (e: SyntheticEvent<HTMLElement>) => {
|
|
14
|
-
if (onClose && (e.target as HTMLElement).id === 'ui-modal') {
|
|
15
|
-
onClose();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
{isOpen ? (
|
|
21
|
-
<ModalStyled id="ui-modal" disableTransparency={disableTransparency} onClick={handleOutsideClick}>
|
|
22
|
-
{children}
|
|
23
|
-
</ModalStyled>
|
|
24
|
-
) : null}
|
|
25
|
-
</>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default Modal;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IconWrapper } from '../../styledComponents';
|
|
3
|
-
|
|
4
|
-
interface IProps {
|
|
5
|
-
rotating: boolean;
|
|
6
|
-
img: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function Icon(props: IProps) {
|
|
10
|
-
const { rotating, img } = props;
|
|
11
|
-
return (
|
|
12
|
-
<IconWrapper rotating={rotating}>
|
|
13
|
-
<img src={img} alt="" />
|
|
14
|
-
</IconWrapper>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default Icon;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Button } from './Button';
|
package/src/custom.d.ts
DELETED
|
Binary file
|
|
Binary file
|
package/src/fonts.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '*.otf';
|
package/src/helpers/constants.ts
DELETED
package/src/helpers/hookUtils.ts
DELETED
package/src/helpers/index.ts
DELETED
package/src/helpers/utils.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SyntheticEvent } from 'react';
|
|
2
|
-
|
|
3
|
-
export function detectScrollToBottom(event: SyntheticEvent<HTMLDivElement>) {
|
|
4
|
-
const { scrollHeight, scrollTop, clientHeight } = event.currentTarget;
|
|
5
|
-
return scrollHeight - scrollTop > clientHeight;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const hexToRGBa = (hex: string, opacity: number) => {
|
|
9
|
-
const hexToRGBA = hex.match(/[A-Za-z0-9]{2}/g)?.map((v) => parseInt(v, 16));
|
|
10
|
-
const opp = opacity > 1 && opacity < 0 ? 1 : opacity;
|
|
11
|
-
return `rgba(${hexToRGBA?.concat(opp).join()})`;
|
|
12
|
-
};
|
package/src/images/back.svg
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<!-- Generated by IcoMoon.io -->
|
|
2
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
|
|
3
|
-
<title></title>
|
|
4
|
-
<g id="icomoon-ignore">
|
|
5
|
-
</g>
|
|
6
|
-
<path fill="#000" d="M682.667 469.333h-241.493l53.333-55.893c7.287-7.645 11.77-18.019 11.77-29.44 0-23.584-19.119-42.703-42.703-42.703-12.164 0-23.139 5.085-30.917 13.246l-0.016 0.017-122.027 128c-1.338 1.628-2.607 3.44-3.731 5.347l-0.109 0.199c-1.886 2.326-3.467 5.004-4.62 7.899l-0.073 0.207c-1.426 3.52-2.347 7.596-2.557 11.859l-0.003 0.088-0.853 3.84c0.073 5.873 1.322 11.435 3.52 16.489l-0.107-0.275c2.2 5.299 5.227 9.831 8.968 13.662l127.992 127.992c7.733 7.795 18.45 12.621 30.293 12.621s22.56-4.826 30.291-12.618l0.003-0.003c7.795-7.733 12.621-18.45 12.621-30.293s-4.826-22.56-12.618-30.291l-0.003-0.003-55.467-54.613h238.507c23.564 0 42.667-19.103 42.667-42.667s-19.103-42.667-42.667-42.667v0z"></path>
|
|
7
|
-
<path fill="#000" d="M512 85.333c-235.641 0-426.667 191.025-426.667 426.667s191.025 426.667 426.667 426.667c235.641 0 426.667-191.025 426.667-426.667v0c0-235.641-191.025-426.667-426.667-426.667v0zM512 853.333c-188.513 0-341.333-152.82-341.333-341.333s152.82-341.333 341.333-341.333c188.513 0 341.333 152.82 341.333 341.333v0c0 188.513-152.82 341.333-341.333 341.333v0z"></path>
|
|
8
|
-
</svg>
|