@basiq/connect-auth 0.1.91 → 1.0.2

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/README.md CHANGED
@@ -1,7 +1,60 @@
1
- # BASIQ CONNECT AUTH
1
+ # BASIQ CONNECT COMPONENT
2
2
 
3
- This is a code for npm package that is used in basiq-connect project. It is a new version and it has just sms code verification part.
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
4
 
5
- ## Implementation
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
6
 
7
- import `<BasiqConnect />` to the desired place in the project. If you want to test it, use `test` property and set it to `true`
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
+ ```
@@ -609,18 +609,15 @@ var PageShadowWrapper = /*#__PURE__*/styled__default.div(_templateObject5$2 || (
609
609
  return horizontal && styled.css(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\n\t\t\t", " {\n\t\t\t\tmargin-bottom: 0;\n\t\t\t\tmargin-right: 16px;\n\n\t\t\t\t&:last-child {\n\t\t\t\t\tmargin-right: unset;\n\t\t\t\t}\n\t\t\t}\n\t\t"])), ButtonStyled);
610
610
  });
611
611
  var PageShadow = /*#__PURE__*/styled__default.div(_templateObject7$1 || (_templateObject7$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\theight: 71px;\n\tleft: 0;\n\tright: 0;\n\ttop: -71px;\n\tbackground: linear-gradient(180deg, #cecece 0%, ", " 100%);\n\topacity: 0.8;\n\ttransform: rotate(-180deg);\n\tpointer-events: none;\n"])), /*#__PURE__*/hexToRGBa('#cecece', 0));
612
- var PageHeader = /*#__PURE__*/styled__default.header(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\tmargin-bottom: 32px;\n\twidth: 100%;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground-color: ", ";\n\tpadding: 16px;\n\tbox-sizing: border-box;\n\theight: 150px;\n\t", " {\n\t\tbackground-color: unset;\n\t\toverflow: initial;\n\t\theight: 150px;\n\t\tpadding: 16px;\n\t}\n\timg {\n\t\tborder-radius: 4px;\n\t\twidth: auto !important;\n\t\theight: auto;\n\t\tmax-width: 100%;\n\t\tmax-height: 100%;\n\t\t", " {\n\t\t\twidth: 100%;\n\t\t\tpadding: 16px;\n\t\t}\n\t}\n"])), function (_ref7) {
613
- var theme = _ref7.theme;
614
- return theme.color.porcelainSecond;
615
- }, devices.phone, devices.phone);
612
+ var PageHeader = /*#__PURE__*/styled__default.header(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\tmargin-bottom: 32px;\n\twidth: 100%;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground-color: unset;\n\tpadding: 16px 0;\n\tbox-sizing: border-box;\n\theight: 150px;\n\t", " {\n\t\toverflow: initial;\n\t\theight: 150px;\n\t\tmargin-bottom: 0;\n\t}\n\timg {\n\t\tborder-radius: 4px;\n\t\twidth: auto !important;\n\t\theight: auto;\n\t\tmax-width: 100%;\n\t\tmax-height: 100%;\n\t\t", " {\n\t\t\twidth: 100%;\n\t\t\tpadding: 16px;\n\t\t}\n\t}\n"])), devices.phone, devices.phone);
616
613
  var PageContent = /*#__PURE__*/styled__default.div(_templateObject9 || (_templateObject9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\twidth: 100%;\n"])));
617
- var StatusMessage = /*#__PURE__*/styled__default.div(_templateObject10 || (_templateObject10 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tbackground: ", ";\n\tborder-radius: 4px;\n\tpadding: 11px;\n\tbox-sizing: border-box;\n\ttext-align: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tfont-weight: 400;\n\tfont-size: 14px;\n\tcolor: ", ";\n\tmargin-bottom: 16px;\n"])), function (_ref8) {
614
+ var StatusMessage = /*#__PURE__*/styled__default.div(_templateObject10 || (_templateObject10 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tbackground: ", ";\n\tborder-radius: 4px;\n\tpadding: 11px;\n\tbox-sizing: border-box;\n\ttext-align: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tfont-weight: 400;\n\tfont-size: 14px;\n\tcolor: ", ";\n\tmargin-bottom: 16px;\n"])), function (_ref7) {
615
+ var theme = _ref7.theme,
616
+ error = _ref7.error;
617
+ return error ? theme.color.wePeep : theme.color.iceberg;
618
+ }, function (_ref8) {
618
619
  var theme = _ref8.theme,
619
620
  error = _ref8.error;
620
- return error ? theme.color.wePeep : theme.color.iceberg;
621
- }, function (_ref9) {
622
- var theme = _ref9.theme,
623
- error = _ref9.error;
624
621
  return error ? theme.color.cerise : theme.color.gossamer;
625
622
  });
626
623
 
@@ -1212,7 +1209,7 @@ function AuthScreen(_ref) {
1212
1209
  response = _context.sent;
1213
1210
 
1214
1211
  if (response != null && (_response$data = response.data) != null && _response$data.access_token) {
1215
- window.open("https://consent.basiq.io/home?token=" + (response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.access_token), "_self");
1212
+ window.open("https://consent.basiq.io/home?token=" + (response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.access_token) + "&action=connect", "_self");
1216
1213
  }
1217
1214
 
1218
1215
  if (response != null && response.error) {