@basiq/connect-auth 0.1.7 → 0.1.10
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 +59 -1
- package/dist/App.d.ts +3 -0
- package/dist/actions/actions.d.ts +40 -0
- package/dist/components/BasiqConnect.d.ts +5 -0
- package/dist/components/modals/LoadingModal.d.ts +7 -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 +5 -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 +9 -0
- package/dist/components/ui/Modal.d.ts +9 -0
- package/dist/components/ui/icon.d.ts +6 -0
- package/{src/components/ui/index.ts → dist/components/ui/index.d.ts} +1 -1
- package/dist/connect-auth.cjs.development.js +1566 -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 +1558 -0
- package/dist/connect-auth.esm.js.map +1 -0
- package/dist/helpers/constants.d.ts +2 -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 +4 -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 +56 -89
- 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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 dushajni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,2 +1,60 @@
|
|
|
1
|
-
# BASIQ CONNECT
|
|
1
|
+
# BASIQ CONNECT COMPONENT
|
|
2
2
|
|
|
3
|
+
The Basiq Connect Auth is a ReactJS UI component exposed to partners who prefer to implement the auth flow as an external component with an SMS OTP built in. When rendered, it will take the user through an SMS OTP flow and then proceed to redirect them to the [Basiq Consent UI](https://api.basiq.io/docs/consent-ui) flow to connect their accounts.
|
|
4
|
+
|
|
5
|
+
Note: This has been offered as interim solution for partners who require access to v3 of the API before we have released the upgrades to `https://connect.basiq.io/`. If you have any questions regarding this please reach out to support@basiq.io.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
1. Install `@basiq/connect-auth` and import the component
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
$ npm install @basiq/basiq-connect-control
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { BasiqConnect } from "@basiq/connect-auth";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Generate a new Auth Link, and retrieve the auth link ID from the public URL that is returned.
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const { data } = await axios.get(
|
|
25
|
+
`https://au-api.basiq.io/users/{userId}/auth_link`,
|
|
26
|
+
{
|
|
27
|
+
method: 'post',
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${YOUR_SERVER_ACCESS_TOKEN}`,
|
|
30
|
+
Accept: 'application/json',
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
let auth_id = data.links.public.replace('https://connect.basiq.io/','');
|
|
37
|
+
|
|
38
|
+
return auth_id;
|
|
39
|
+
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.log(error)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. Drop the component in your code on the page you wish to call it. The component will retrieve the auth_id from the URL so failing to include it there will result in an error. **Note** that the component is full page and will eventually handle the redirect to the Basiq Consent UI, so it should be rendered on it's own page (or conditionally, after appending an auth_link ID)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
|
|
51
|
+
// Component rendered at /auth-link/:auth_id
|
|
52
|
+
|
|
53
|
+
export default function Auth() {
|
|
54
|
+
return (
|
|
55
|
+
<main>
|
|
56
|
+
<BasiqConnect />
|
|
57
|
+
</main>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const verifySmsCode: ({ authRequestId, smsCode, test }: {
|
|
2
|
+
authRequestId: string;
|
|
3
|
+
smsCode: string;
|
|
4
|
+
test?: boolean;
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
data: any;
|
|
7
|
+
headers: Headers;
|
|
8
|
+
statusCode: number;
|
|
9
|
+
ok: boolean;
|
|
10
|
+
error?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
headers: Headers;
|
|
13
|
+
statusCode: number;
|
|
14
|
+
error: string;
|
|
15
|
+
ok: boolean;
|
|
16
|
+
data?: undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const authUser: ({ authRequestId, method, test }: {
|
|
19
|
+
authRequestId: string;
|
|
20
|
+
method?: 'POST' | 'GET';
|
|
21
|
+
test?: boolean;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
data: any;
|
|
24
|
+
headers: Headers;
|
|
25
|
+
statusCode: number;
|
|
26
|
+
ok: boolean;
|
|
27
|
+
error?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
headers: Headers;
|
|
30
|
+
statusCode: number;
|
|
31
|
+
error: any;
|
|
32
|
+
ok: boolean;
|
|
33
|
+
data?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
statusCode: number;
|
|
36
|
+
error: string;
|
|
37
|
+
ok: boolean;
|
|
38
|
+
data?: undefined;
|
|
39
|
+
headers?: undefined;
|
|
40
|
+
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as LoadingModal } from './LoadingModal';
|
|
1
|
+
export { default as LoadingModal } from './LoadingModal';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonType } from '../ui/Button';
|
|
3
|
+
interface IProps {
|
|
4
|
+
buttons?: IButton[];
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
title?: string | ReactElement;
|
|
7
|
+
subTitle?: string;
|
|
8
|
+
shadow: boolean;
|
|
9
|
+
onBack?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface IButton {
|
|
12
|
+
label: string;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
buttonType?: ButtonType;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function Page(props: IProps): JSX.Element;
|
|
18
|
+
export default Page;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface IProps {
|
|
2
|
+
onContinue: () => void;
|
|
3
|
+
showErrorScreen: (code: string) => void;
|
|
4
|
+
shadow: boolean;
|
|
5
|
+
appName: string;
|
|
6
|
+
authRequestId?: string;
|
|
7
|
+
test?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function StartScreen(props: IProps): JSX.Element;
|
|
10
|
+
export default StartScreen;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Page } from './Page';
|
|
2
|
-
export { default as NotFound } from './NotFound';
|
|
3
|
-
export { default as StartScreen } from './StartScreen';
|
|
4
|
-
export { default as AuthScreen } from './AuthScreen';
|
|
1
|
+
export { default as Page } from './Page';
|
|
2
|
+
export { default as NotFound } from './NotFound';
|
|
3
|
+
export { default as StartScreen } from './StartScreen';
|
|
4
|
+
export { default as AuthScreen } from './AuthScreen';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare type ButtonType = 'secondary' | 'tiny' | 'link' | 'back';
|
|
2
|
+
interface Props {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
label: string;
|
|
5
|
+
buttonType?: ButtonType;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function Button(props: Props): JSX.Element;
|
|
9
|
+
export default Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button } from './Button';
|
|
1
|
+
export { default as Button } from './Button';
|