@basiq/connect-auth 0.1.7 → 0.1.8
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/LICENSE +21 -0
- package/README.md +159 -1
- package/dist/App.d.ts +3 -0
- package/dist/BasiqConnect.d.ts +3 -0
- package/dist/actions/actions.d.ts +22 -0
- package/dist/components/modals/LoadingModal.d.ts +8 -0
- package/{src/components/modals/index.ts → dist/components/modals/index.d.ts} +1 -1
- package/dist/components/pages/AuthScreen.d.ts +9 -0
- package/dist/components/pages/NotFound.d.ts +6 -0
- package/dist/components/pages/Page.d.ts +18 -0
- package/dist/components/pages/StartScreen.d.ts +10 -0
- package/{src/components/pages/index.ts → dist/components/pages/index.d.ts} +4 -4
- package/dist/components/ui/Button.d.ts +10 -0
- package/dist/components/ui/Modal.d.ts +9 -0
- package/dist/components/ui/icon.d.ts +7 -0
- package/{src/components/ui/index.ts → dist/components/ui/index.d.ts} +1 -1
- package/dist/connect-auth.cjs.development.js +1494 -0
- package/dist/connect-auth.cjs.development.js.map +1 -0
- package/dist/connect-auth.cjs.production.min.js +2 -0
- package/dist/connect-auth.cjs.production.min.js.map +1 -0
- package/dist/connect-auth.esm.js +1486 -0
- package/dist/connect-auth.esm.js.map +1 -0
- package/dist/helpers/constants.d.ts +1 -0
- package/dist/helpers/hookUtils.d.ts +2 -0
- package/{src/helpers/index.ts → dist/helpers/index.d.ts} +3 -3
- package/dist/helpers/utils.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/locales/i18n.d.ts +36 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/styledComponents/base.d.ts +4 -0
- package/dist/styledComponents/breakpoints.d.ts +15 -0
- package/{src/styledComponents/index.ts → dist/styledComponents/index.d.ts} +4 -4
- package/dist/styledComponents/pages/auth.d.ts +10 -0
- package/dist/styledComponents/pages/basic.d.ts +23 -0
- package/{src/styledComponents/pages/index.ts → dist/styledComponents/pages/index.d.ts} +4 -4
- package/dist/styledComponents/pages/notFound.d.ts +9 -0
- package/dist/styledComponents/pages/start.d.ts +1 -0
- package/dist/styledComponents/styles.d.ts +2 -0
- package/dist/styledComponents/theme.d.ts +45 -0
- package/dist/styledComponents/ui/basic.d.ts +10 -0
- package/dist/styledComponents/ui/button.d.ts +9 -0
- package/{src/styledComponents/ui/index.ts → dist/styledComponents/ui/index.d.ts} +3 -3
- package/dist/styledComponents/ui/modals.d.ts +7 -0
- package/package.json +55 -90
- package/.babelrc +0 -3
- package/.eslintrc.json +0 -47
- package/.prettierrc +0 -12
- package/config-overrides.js +0 -12
- package/index.js +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/src/App.css +0 -38
- package/src/App.test.tsx +0 -9
- package/src/App.tsx +0 -81
- package/src/actions/actions.ts +0 -71
- package/src/components/modals/LoadingModal.tsx +0 -28
- package/src/components/pages/AuthScreen.tsx +0 -94
- package/src/components/pages/NotFound.tsx +0 -44
- package/src/components/pages/Page.tsx +0 -46
- package/src/components/pages/StartScreen.tsx +0 -77
- 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/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 -3
- package/src/helpers/hookUtils.ts +0 -8
- 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.css +0 -11
- package/src/index.tsx +0 -28
- package/src/locales/en/translation.json +0 -28
- 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/reportWebVitals.ts +0 -15
- 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/pages/auth.ts +0 -49
- package/src/styledComponents/pages/basic.ts +0 -126
- 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/modals.ts +0 -48
- package/tsconfig.json +0 -21
package/src/App.tsx
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, { createRef, SyntheticEvent, useEffect, useState } from 'react';
|
|
2
|
-
import './App.css';
|
|
3
|
-
import { AppContainer, AppContainerPage, AppContainerWrapper, PageHeader, Root } from './styledComponents';
|
|
4
|
-
import GlobalStyles from './styledComponents/styles';
|
|
5
|
-
import { detectScrollToBottom } from './helpers';
|
|
6
|
-
import { AuthScreen, NotFound, StartScreen } from './components/pages';
|
|
7
|
-
import { authUser } from './actions/actions';
|
|
8
|
-
import { LoadingModal } from './components/modals';
|
|
9
|
-
|
|
10
|
-
function App() {
|
|
11
|
-
const ref = createRef<HTMLDivElement>();
|
|
12
|
-
|
|
13
|
-
const [shadow, setShadow] = useState(false);
|
|
14
|
-
const [currentScreen, setCurrentScreen] = useState(1);
|
|
15
|
-
const [loading, setLoading] = useState(false);
|
|
16
|
-
const [authId, setAuthId] = useState(null as string | null);
|
|
17
|
-
const [mobile, setMobile] = useState('');
|
|
18
|
-
const [logo, setLogo] = useState('');
|
|
19
|
-
const [appName, setAppName] = useState('');
|
|
20
|
-
const [errorCode, setErrorCode] = useState('');
|
|
21
|
-
|
|
22
|
-
const handleConnectionsScroll = (event: SyntheticEvent<HTMLDivElement>) => {
|
|
23
|
-
setShadow(detectScrollToBottom(event));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
const id = window.location.pathname.substring(1);
|
|
28
|
-
const getData = async () => {
|
|
29
|
-
if (id.length > 0) {
|
|
30
|
-
setAuthId(id);
|
|
31
|
-
setLoading(true);
|
|
32
|
-
const response = await authUser(id, 'GET');
|
|
33
|
-
if (response?.data?.status === 'code-not-sent') {
|
|
34
|
-
setMobile(response?.data?.mobile);
|
|
35
|
-
if(response?.data?.appName){
|
|
36
|
-
setAppName(response?.data?.appName);
|
|
37
|
-
}
|
|
38
|
-
if(response?.data?.partner?.logoUrl){
|
|
39
|
-
setLogo(response?.data?.partner?.logoUrl);
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
setErrorCode(response?.statusCode.toString());
|
|
43
|
-
setCurrentScreen(3);
|
|
44
|
-
}
|
|
45
|
-
setLoading(false);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
getData();
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const getScreen = () => {
|
|
52
|
-
switch (currentScreen) {
|
|
53
|
-
case 0:
|
|
54
|
-
return <LoadingModal isOpen={loading} disableTransparency />;
|
|
55
|
-
case 1:
|
|
56
|
-
return <StartScreen appName={appName} shadow={shadow} onContinue={() => setCurrentScreen(2)} authId={authId} />;
|
|
57
|
-
case 2:
|
|
58
|
-
return <AuthScreen number={mobile} onBack={() => setCurrentScreen(1)} shadow={shadow} authId={authId} />;
|
|
59
|
-
default:
|
|
60
|
-
return <NotFound messageCode={errorCode} />;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Root>
|
|
66
|
-
<GlobalStyles />
|
|
67
|
-
<AppContainerWrapper>
|
|
68
|
-
<AppContainer onScroll={handleConnectionsScroll} ref={ref}>
|
|
69
|
-
{logo && (
|
|
70
|
-
<PageHeader>
|
|
71
|
-
<img src={logo} alt="logo" />
|
|
72
|
-
</PageHeader>
|
|
73
|
-
)}
|
|
74
|
-
<AppContainerPage>{getScreen()}</AppContainerPage>
|
|
75
|
-
</AppContainer>
|
|
76
|
-
</AppContainerWrapper>
|
|
77
|
-
</Root>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default App;
|
package/src/actions/actions.ts
DELETED
|
@@ -1,71 +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
|
-
return {
|
|
61
|
-
headers: result.headers,
|
|
62
|
-
statusCode: result.status,
|
|
63
|
-
error: result.statusText || 'Something went wrong'
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
headers: result.headers,
|
|
68
|
-
statusCode: result.status,
|
|
69
|
-
error: result.statusText || 'Something went wrong'
|
|
70
|
-
};
|
|
71
|
-
};
|
|
@@ -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('loading')}</LoadingModalText>
|
|
23
|
-
</LoadingModalStyled>
|
|
24
|
-
</Modal>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default LoadingModal;
|
|
@@ -1,94 +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('new_sms_code_has_been_sent')}</StatusMessage>}
|
|
81
|
-
{!!error && <StatusMessage error>{error}</StatusMessage>}
|
|
82
|
-
<PageConnectFooterText>
|
|
83
|
-
<span>
|
|
84
|
-
{t('didnt_receive_the_code')} <DivAsLink onClick={() => handleResend()}>{t('resend_sms')}</DivAsLink>
|
|
85
|
-
</span>
|
|
86
|
-
</PageConnectFooterText>
|
|
87
|
-
</PageConnectFooterControl>
|
|
88
|
-
<LoadingModal isOpen={loading} />
|
|
89
|
-
</InnerContainer>
|
|
90
|
-
</Page>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
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('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,77 +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
|
-
shadow: boolean;
|
|
11
|
-
appName: string;
|
|
12
|
-
authId: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function StartScreen(props: IProps) {
|
|
16
|
-
const { onContinue, appName, shadow, authId } = props;
|
|
17
|
-
const [loading, setLoading] = useState(false);
|
|
18
|
-
const { t } = useTranslation();
|
|
19
|
-
const handleContinue = async () => {
|
|
20
|
-
setLoading(true);
|
|
21
|
-
const response = await authUser(authId);
|
|
22
|
-
if (response?.data?.status === 'code-sent') {
|
|
23
|
-
setLoading(false);
|
|
24
|
-
onContinue();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const buttons: IButton[] = [
|
|
28
|
-
{
|
|
29
|
-
label: t('continue'),
|
|
30
|
-
onClick: () => handleContinue()
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
return (
|
|
34
|
-
<Page
|
|
35
|
-
title={
|
|
36
|
-
appName ? (
|
|
37
|
-
<Trans t={t} i18nKey="use_basiq_to_connect_your_accounts" values={{ name: appName }} components={{ bold: <strong /> }} />
|
|
38
|
-
) : (
|
|
39
|
-
<Trans t={t} i18nKey="we_use_basiq_to_connect_your_accounts" components={{ bold: <strong /> }} />
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
shadow={shadow}
|
|
43
|
-
buttons={buttons}
|
|
44
|
-
>
|
|
45
|
-
<InnerContainer>
|
|
46
|
-
<Spacer />
|
|
47
|
-
<H4Styled>{t('to_do_this_we_will_ask_you_to')}</H4Styled>
|
|
48
|
-
<ul>
|
|
49
|
-
<li>
|
|
50
|
-
<Trans t={t} i18nKey="verify_your_mobile_number_bold" components={{ bold: <strong /> }} />
|
|
51
|
-
</li>
|
|
52
|
-
<li>
|
|
53
|
-
<Trans t={t} i18nKey="consent_to_share_your_data_with_us" components={{ bold: <strong /> }} />
|
|
54
|
-
</li>
|
|
55
|
-
<li>
|
|
56
|
-
<Trans t={t} i18nKey="share_your_financial_data" components={{ bold: <strong /> }} />
|
|
57
|
-
</li>
|
|
58
|
-
</ul>
|
|
59
|
-
<H4Styled>{t('things_you_should_know')}</H4Styled>
|
|
60
|
-
<ul>
|
|
61
|
-
<li>{t('we_dont_share_your_data_without_your_consent')}</li>
|
|
62
|
-
<li>{t('you_can_easily_stop_sharing_your_data_at_any_time')}</li>
|
|
63
|
-
<li>{t('you_can_choose_to_delete_shared_data_when_we_no_longer_need_it')}</li>
|
|
64
|
-
</ul>
|
|
65
|
-
<Spacer />
|
|
66
|
-
<span>
|
|
67
|
-
{t('by_proceeding_you_agree_to_the')}{' '}
|
|
68
|
-
<a href="https://docs.basiq.io/en/articles/415750-basiq-terms-of-service">{t('terms_of_service')}</a> {t('and')}{' '}
|
|
69
|
-
<a href="https://docs.basiq.io/en/articles/382581-basiq-privacy-policy">{t('privacy_notice')}</a>
|
|
70
|
-
</span>
|
|
71
|
-
<LoadingModal isOpen={loading} />
|
|
72
|
-
</InnerContainer>
|
|
73
|
-
</Page>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
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;
|
|
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/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>
|
package/src/images/error.svg
DELETED
|
@@ -1,10 +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="#fabe34" d="M512 0c282.77 0 512 229.23 512 512s-229.23 512-512 512c-282.77 0-512-229.23-512-512s229.23-512 512-512z"></path>
|
|
7
|
-
<path fill="#fff" d="M336.968 320.978c-33.427 33.427-49.307 89.357-49.307 183.024 0 93.669 15.88 149.598 49.307 183.026 33.429 33.429 89.357 49.309 183.026 49.309s149.597-15.88 183.026-49.309c33.427-33.427 49.307-89.357 49.307-183.026 0-93.667-15.88-149.597-49.307-183.024-33.429-33.429-89.357-49.309-183.026-49.309s-149.597 15.88-183.026 49.309zM307.978 291.986c45.586-45.586 116.074-61.317 212.016-61.317s166.43 15.731 212.016 61.317c45.586 45.586 61.317 116.074 61.317 212.016 0 95.944-15.731 166.432-61.317 212.018s-116.074 61.317-212.016 61.317c-95.942 0-166.43-15.731-212.016-61.317-45.587-45.586-61.317-116.074-61.317-212.018 0-95.942 15.73-166.43 61.317-212.016z"></path>
|
|
8
|
-
<path fill="#fff" d="M519.992 377.037c11.322 0 20.501 9.178 20.501 20.499v106.464c0 11.322-9.179 20.499-20.501 20.499s-20.499-9.178-20.499-20.499v-106.464c0-11.322 9.178-20.499 20.499-20.499z"></path>
|
|
9
|
-
<path fill="#fff" d="M499.379 599.667c0-11.323 9.178-20.501 20.499-20.501h0.246c11.322 0 20.501 9.178 20.501 20.501s-9.179 20.499-20.501 20.499h-0.246c-11.322 0-20.499-9.178-20.499-20.499z"></path>
|
|
10
|
-
</svg>
|
|
@@ -1,14 +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 d="M511.992 163.041c8.157 0 14.769 6.612 14.769 14.769v204.227c0 8.157-6.613 14.769-14.769 14.769s-14.769-6.613-14.769-14.769v-204.227c0-8.157 6.613-14.769 14.769-14.769z"></path>
|
|
7
|
-
<path d="M511.998 627.192c8.157 0 14.769 6.613 14.769 14.769v204.227c0 8.157-6.613 14.769-14.769 14.769s-14.769-6.613-14.769-14.769v-204.227c0-8.157 6.613-14.769 14.769-14.769z"></path>
|
|
8
|
-
<path d="M860.952 512c0 8.157-6.613 14.769-14.769 14.769h-204.227c-8.159 0-14.769-6.613-14.769-14.769s6.611-14.769 14.769-14.769h204.227c8.157 0 14.769 6.613 14.769 14.769z"></path>
|
|
9
|
-
<path d="M396.8 512c0 8.157-6.613 14.769-14.769 14.769h-204.227c-8.157 0-14.769-6.613-14.769-14.769s6.612-14.769 14.769-14.769h204.227c8.157 0 14.769 6.613 14.769 14.769z"></path>
|
|
10
|
-
<path d="M758.754 265.251c5.766 5.768 5.766 15.12 0 20.886l-144.412 144.412c-5.768 5.768-15.118 5.768-20.886 0s-5.768-15.12 0-20.888l144.41-144.41c5.768-5.768 15.12-5.768 20.888 0z"></path>
|
|
11
|
-
<path d="M430.545 593.455c5.768 5.768 5.768 15.12 0 20.888l-144.412 144.41c-5.766 5.768-15.118 5.768-20.886 0s-5.768-15.12 0-20.888l144.41-144.41c5.768-5.768 15.12-5.768 20.888 0z"></path>
|
|
12
|
-
<path d="M758.752 758.752c-5.768 5.768-15.12 5.768-20.888 0l-144.41-144.41c-5.768-5.768-5.768-15.12 0-20.888s15.12-5.768 20.888 0l144.41 144.41c5.768 5.768 5.768 15.12 0 20.888z"></path>
|
|
13
|
-
<path d="M430.543 430.549c-5.768 5.768-15.12 5.768-20.888 0l-144.41-144.412c-5.768-5.768-5.768-15.118 0-20.886s15.118-5.768 20.886 0l144.412 144.41c5.768 5.768 5.768 15.12 0 20.888z"></path>
|
|
14
|
-
</svg>
|
package/src/index.css
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
4
|
-
sans-serif;
|
|
5
|
-
-webkit-font-smoothing: antialiased;
|
|
6
|
-
-moz-osx-font-smoothing: grayscale;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
code {
|
|
10
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
|
|
11
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import './index.css';
|
|
4
|
-
import { ThemeProvider } from 'styled-components';
|
|
5
|
-
import App from './App';
|
|
6
|
-
import './locales/i18n';
|
|
7
|
-
import { theme } from './styledComponents';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const BasiqConnect = (inputs: {
|
|
11
|
-
containerId: string;
|
|
12
|
-
}) => {
|
|
13
|
-
if (inputs && inputs.containerId !== null) {
|
|
14
|
-
ReactDOM.render(
|
|
15
|
-
<React.StrictMode>
|
|
16
|
-
<ThemeProvider theme={theme}>
|
|
17
|
-
<App />
|
|
18
|
-
</ThemeProvider>
|
|
19
|
-
</React.StrictMode>,
|
|
20
|
-
document.getElementById(inputs.containerId)
|
|
21
|
-
);
|
|
22
|
-
} else {
|
|
23
|
-
// eslint-disable-next-line no-console
|
|
24
|
-
console.error("BASIQ CONNECT CONTROL ERROR: Provided container node doesn't exist.");
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default BasiqConnect;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"back": "Back",
|
|
3
|
-
"error": "Error",
|
|
4
|
-
"loading": "Loading",
|
|
5
|
-
"continue": "Continue",
|
|
6
|
-
"to_do_this_we_will_ask_you_to": "To do this we will ask you to",
|
|
7
|
-
"verify_your_mobile_number_bold": "<strong>Verify</strong> your mobile number",
|
|
8
|
-
"verify_your_mobile_number": "Verify your mobile number",
|
|
9
|
-
"consent_to_share_your_data_with_us": "<strong>Consent</strong> to share your data with us",
|
|
10
|
-
"share_your_financial_data": "<strong>Share</strong> your financial data",
|
|
11
|
-
"things_you_should_know": "Things you should know",
|
|
12
|
-
"we_dont_share_your_data_without_your_consent": "We don’t share your data without your consent",
|
|
13
|
-
"you_can_easily_stop_sharing_your_data_at_any_time": "You can easily stop sharing your data at any time",
|
|
14
|
-
"you_can_choose_to_delete_shared_data_when_we_no_longer_need_it": "You can choose to delete shared data when we no longer need it",
|
|
15
|
-
"by_proceeding_you_agree_to_the": "By proceeding, you agree to the",
|
|
16
|
-
"terms_of_service": "Terms of service",
|
|
17
|
-
"privacy_notice": "Privacy notice",
|
|
18
|
-
"and": "and",
|
|
19
|
-
"use_basiq_to_connect_your_accounts": "${name} use <strong>Basiq</strong> to connect your accounts",
|
|
20
|
-
"we_use_basiq_to_connect_your_accounts": "We use <strong>Basiq</strong> to connect your accounts",
|
|
21
|
-
"please_enter_the_sms_code_sent_to_your_mobile_number": "Please enter the SMS code sent to your mobile number (ending in xxx${number}).",
|
|
22
|
-
"new_sms_code_has_been_sent": "New SMS code has been sent.",
|
|
23
|
-
"this_code_doesnt_appear_to_be_valid": "This code doesn't appear to be valid.",
|
|
24
|
-
"didnt_receive_the_code": "Didn’t receive the code?",
|
|
25
|
-
"resend_sms": "Resend SMS",
|
|
26
|
-
"failed_to_send_sms": "Failed to send SMS.",
|
|
27
|
-
"page_not_found": "Page not found"
|
|
28
|
-
}
|