@basiq/connect-auth 0.1.88 → 1.0.0
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 +40 -140
- package/dist/App.d.ts +2 -1
- package/dist/actions/actions.d.ts +16 -2
- package/dist/components/BasiqConnect.d.ts +4 -1
- package/dist/components/pages/AuthScreen.d.ts +3 -2
- package/dist/components/pages/StartScreen.d.ts +2 -1
- package/dist/connect-auth.cjs.development.js +176 -105
- package/dist/connect-auth.cjs.development.js.map +1 -1
- package/dist/connect-auth.cjs.production.min.js +1 -1
- package/dist/connect-auth.cjs.production.min.js.map +1 -1
- package/dist/connect-auth.esm.js +177 -106
- package/dist/connect-auth.esm.js.map +1 -1
- package/dist/helpers/constants.d.ts +1 -0
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/styledComponents/pages/auth.d.ts +4 -1
- package/package.json +2 -4
package/dist/connect-auth.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState,
|
|
1
|
+
import React, { useState, useEffect, useCallback, createRef } from 'react';
|
|
2
2
|
import styled, { css, keyframes, createGlobalStyle, ThemeProvider } from 'styled-components';
|
|
3
3
|
import { useTranslation, Trans, initReactI18next } from 'react-i18next';
|
|
4
4
|
import i18n from 'i18next';
|
|
@@ -466,8 +466,15 @@ var hexToRGBa = function hexToRGBa(hex, opacity) {
|
|
|
466
466
|
var opp = opacity > 1 && opacity < 0 ? 1 : opacity;
|
|
467
467
|
return "rgba(" + (hexToRGBA == null ? void 0 : hexToRGBA.concat(opp).join()) + ")";
|
|
468
468
|
};
|
|
469
|
+
var handleUserKeyPress = function handleUserKeyPress(e, onEnter) {
|
|
470
|
+
var keyCode = e.keyCode;
|
|
469
471
|
|
|
470
|
-
|
|
472
|
+
if (keyCode === 13) {
|
|
473
|
+
onEnter();
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
var DASHBOARD_API_URL_TEST = 'https://c9joivz12f.execute-api.ap-southeast-2.amazonaws.com/Development/';
|
|
471
478
|
var DASHBOARD_API_URL = 'https://p4c8zn20r9.execute-api.ap-southeast-2.amazonaws.com/Production_v1/';
|
|
472
479
|
|
|
473
480
|
var _templateObject$2, _templateObject2$2, _templateObject3$1;
|
|
@@ -527,10 +534,10 @@ var theme = {
|
|
|
527
534
|
},
|
|
528
535
|
mixin: {
|
|
529
536
|
subtitle: function subtitle() {
|
|
530
|
-
return " margin-top:
|
|
537
|
+
return " margin-top: 32px;\n margin-bottom: 4px;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;";
|
|
531
538
|
},
|
|
532
539
|
title: function title() {
|
|
533
|
-
return " font-size: 26px;\n line-height: 30px;\n letter-spacing: -0.2px;\n margin-top: 0;\n margin-bottom:
|
|
540
|
+
return " font-size: 26px;\n line-height: 30px;\n letter-spacing: -0.2px;\n margin-top: 0;\n margin-bottom: 0;\n color: #130f26;\n white-space: pre-line;\n ";
|
|
534
541
|
}
|
|
535
542
|
}
|
|
536
543
|
};
|
|
@@ -594,7 +601,7 @@ var PageShadowWrapper = /*#__PURE__*/styled.div(_templateObject5$2 || (_template
|
|
|
594
601
|
return horizontal && 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);
|
|
595
602
|
});
|
|
596
603
|
var PageShadow = /*#__PURE__*/styled.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));
|
|
597
|
-
var PageHeader = /*#__PURE__*/styled.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) {
|
|
604
|
+
var PageHeader = /*#__PURE__*/styled.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 0\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"])), function (_ref7) {
|
|
598
605
|
var theme = _ref7.theme;
|
|
599
606
|
return theme.color.porcelainSecond;
|
|
600
607
|
}, devices.phone, devices.phone);
|
|
@@ -626,13 +633,17 @@ var InputStyled = /*#__PURE__*/styled.input(_templateObject3$3 || (_templateObje
|
|
|
626
633
|
return error ? theme.color.cerise : theme.color.endeavour;
|
|
627
634
|
});
|
|
628
635
|
var InputContainer = /*#__PURE__*/styled.div(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n"])));
|
|
629
|
-
var DivAsLink = /*#__PURE__*/styled.div(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tdisplay: inherit;\n\tcursor:
|
|
630
|
-
var theme = _ref4.theme
|
|
631
|
-
|
|
636
|
+
var DivAsLink = /*#__PURE__*/styled.div(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tdisplay: inherit;\n\tcursor: ", ";\n"])), function (_ref4) {
|
|
637
|
+
var theme = _ref4.theme,
|
|
638
|
+
disabled = _ref4.disabled;
|
|
639
|
+
return disabled ? theme.color.casper : theme.color.endeavour;
|
|
640
|
+
}, function (_ref5) {
|
|
641
|
+
var disabled = _ref5.disabled;
|
|
642
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
632
643
|
});
|
|
633
644
|
|
|
634
645
|
var _templateObject$5;
|
|
635
|
-
var InnerContainer = /*#__PURE__*/styled.div(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\
|
|
646
|
+
var InnerContainer = /*#__PURE__*/styled.div(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\twidth: 100%;\n"])));
|
|
636
647
|
|
|
637
648
|
var _templateObject$6, _templateObject2$5, _templateObject3$4, _templateObject4$4;
|
|
638
649
|
var PageStatusScreenMain = /*#__PURE__*/styled(PageMainContainer)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n\theight: 100%;\n"])));
|
|
@@ -691,7 +702,7 @@ var MarkW1GBold = "data:font/otf;base64,T1RUTwANAIAAAwBQQ0ZGICwMZMIAACp0AAFDmERT
|
|
|
691
702
|
var _templateObject$8;
|
|
692
703
|
var GlobalStyles = /*#__PURE__*/createGlobalStyle(_templateObject$8 || (_templateObject$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n \n@font-face {\n font-family: MarkW1G;\n src: url(", ") format('opentype');\n }\n @font-face {\n font-family: MarkW1G;\n font-weight: bold;\n src: url(", ") format('opentype');\n }\n\nbody{\n font-family: 'MarkW1G', sans-serif;\n}\nbody * {\n font-family: 'MarkW1G', sans-serif;\n font-size: 14px;\n font-style: normal;\n}\n"])), MarkW1GBook, MarkW1GBold);
|
|
693
704
|
|
|
694
|
-
var img = "data:image/svg+xml,%
|
|
705
|
+
var img = "data:image/svg+xml,%3csvg width='21' height='21' viewBox='0 0 21 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M10.25 1.75C5.55621 1.75 1.75 5.55621 1.75 10.25C1.75 14.9447 5.55616 18.75 10.25 18.75C14.9438 18.75 18.75 14.9447 18.75 10.25C18.75 5.55621 14.9438 1.75 10.25 1.75ZM0.25 10.25C0.25 4.72779 4.72779 0.25 10.25 0.25C15.7722 0.25 20.25 4.72779 20.25 10.25C20.25 15.7733 15.7722 20.25 10.25 20.25C4.72784 20.25 0.25 15.7733 0.25 10.25ZM12.2238 6.25001C12.516 6.54354 12.515 7.01841 12.2215 7.31067L9.26925 10.2502L12.2215 13.1897C12.515 13.482 12.516 13.9569 12.2238 14.2504C11.9315 14.5439 11.4566 14.5449 11.1631 14.2527L7.67711 10.7817C7.53576 10.6409 7.4563 10.4497 7.4563 10.2502C7.4563 10.0507 7.53576 9.85947 7.67711 9.71873L11.1631 6.24773C11.4566 5.95547 11.9315 5.95649 12.2238 6.25001Z' fill='black'/%3e%3c/svg%3e";
|
|
695
706
|
|
|
696
707
|
function Button(props) {
|
|
697
708
|
var onClick = props.onClick,
|
|
@@ -773,12 +784,13 @@ function NotFound(_ref) {
|
|
|
773
784
|
}
|
|
774
785
|
|
|
775
786
|
var verifySmsCode = /*#__PURE__*/function () {
|
|
776
|
-
var
|
|
777
|
-
var body, reqData, result, json;
|
|
787
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
788
|
+
var authRequestId, smsCode, test, body, reqData, result, json;
|
|
778
789
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
779
790
|
while (1) {
|
|
780
791
|
switch (_context.prev = _context.next) {
|
|
781
792
|
case 0:
|
|
793
|
+
authRequestId = _ref.authRequestId, smsCode = _ref.smsCode, test = _ref.test;
|
|
782
794
|
body = {
|
|
783
795
|
'sms-code': smsCode
|
|
784
796
|
};
|
|
@@ -790,34 +802,34 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
790
802
|
method: 'POST',
|
|
791
803
|
body: JSON.stringify(body)
|
|
792
804
|
};
|
|
793
|
-
_context.next =
|
|
794
|
-
return fetch(DASHBOARD_API_URL + "client_auth/" + authRequestId + "/token", reqData);
|
|
805
|
+
_context.next = 5;
|
|
806
|
+
return fetch((test ? DASHBOARD_API_URL_TEST : DASHBOARD_API_URL) + "client_auth/" + authRequestId + "/token", reqData);
|
|
795
807
|
|
|
796
|
-
case
|
|
808
|
+
case 5:
|
|
797
809
|
result = _context.sent;
|
|
798
810
|
|
|
799
811
|
if (!(result.status >= 200 && result.status < 300)) {
|
|
800
|
-
_context.next =
|
|
812
|
+
_context.next = 16;
|
|
801
813
|
break;
|
|
802
814
|
}
|
|
803
815
|
|
|
804
816
|
if (!(result.status === 204)) {
|
|
805
|
-
_context.next =
|
|
817
|
+
_context.next = 11;
|
|
806
818
|
break;
|
|
807
819
|
}
|
|
808
820
|
|
|
809
821
|
_context.t0 = null;
|
|
810
|
-
_context.next =
|
|
822
|
+
_context.next = 14;
|
|
811
823
|
break;
|
|
812
824
|
|
|
813
|
-
case
|
|
814
|
-
_context.next =
|
|
825
|
+
case 11:
|
|
826
|
+
_context.next = 13;
|
|
815
827
|
return result.json();
|
|
816
828
|
|
|
817
|
-
case
|
|
829
|
+
case 13:
|
|
818
830
|
_context.t0 = _context.sent;
|
|
819
831
|
|
|
820
|
-
case
|
|
832
|
+
case 14:
|
|
821
833
|
json = _context.t0;
|
|
822
834
|
return _context.abrupt("return", {
|
|
823
835
|
data: json,
|
|
@@ -826,9 +838,9 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
826
838
|
ok: true
|
|
827
839
|
});
|
|
828
840
|
|
|
829
|
-
case
|
|
841
|
+
case 16:
|
|
830
842
|
if (!(result.status >= 400)) {
|
|
831
|
-
_context.next =
|
|
843
|
+
_context.next = 18;
|
|
832
844
|
break;
|
|
833
845
|
}
|
|
834
846
|
|
|
@@ -839,7 +851,7 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
839
851
|
ok: false
|
|
840
852
|
});
|
|
841
853
|
|
|
842
|
-
case
|
|
854
|
+
case 18:
|
|
843
855
|
return _context.abrupt("return", {
|
|
844
856
|
headers: result.headers,
|
|
845
857
|
statusCode: result.status,
|
|
@@ -847,7 +859,7 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
847
859
|
ok: false
|
|
848
860
|
});
|
|
849
861
|
|
|
850
|
-
case
|
|
862
|
+
case 19:
|
|
851
863
|
case "end":
|
|
852
864
|
return _context.stop();
|
|
853
865
|
}
|
|
@@ -855,56 +867,54 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
855
867
|
}, _callee);
|
|
856
868
|
}));
|
|
857
869
|
|
|
858
|
-
return function verifySmsCode(_x
|
|
859
|
-
return
|
|
870
|
+
return function verifySmsCode(_x) {
|
|
871
|
+
return _ref2.apply(this, arguments);
|
|
860
872
|
};
|
|
861
873
|
}();
|
|
862
874
|
var authUser = /*#__PURE__*/function () {
|
|
863
|
-
var
|
|
864
|
-
var reqData, result, json, _json;
|
|
875
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
876
|
+
var authRequestId, method, test, reqData, result, json, _json;
|
|
865
877
|
|
|
866
878
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
867
879
|
while (1) {
|
|
868
880
|
switch (_context2.prev = _context2.next) {
|
|
869
881
|
case 0:
|
|
870
|
-
|
|
871
|
-
method = 'POST';
|
|
872
|
-
}
|
|
873
|
-
|
|
882
|
+
authRequestId = _ref3.authRequestId, method = _ref3.method, test = _ref3.test;
|
|
874
883
|
reqData = {
|
|
875
884
|
headers: {
|
|
876
885
|
'Content-Type': 'application/json'
|
|
877
886
|
},
|
|
878
|
-
method: method
|
|
887
|
+
method: method || 'POST'
|
|
879
888
|
};
|
|
880
|
-
_context2.
|
|
881
|
-
|
|
889
|
+
_context2.prev = 2;
|
|
890
|
+
_context2.next = 5;
|
|
891
|
+
return fetch((test ? DASHBOARD_API_URL_TEST : DASHBOARD_API_URL) + "client_auth/" + authRequestId, reqData);
|
|
882
892
|
|
|
883
|
-
case
|
|
893
|
+
case 5:
|
|
884
894
|
result = _context2.sent;
|
|
885
895
|
|
|
886
896
|
if (!(result.status >= 200 && result.status < 300)) {
|
|
887
|
-
_context2.next =
|
|
897
|
+
_context2.next = 16;
|
|
888
898
|
break;
|
|
889
899
|
}
|
|
890
900
|
|
|
891
901
|
if (!(result.status === 204)) {
|
|
892
|
-
_context2.next =
|
|
902
|
+
_context2.next = 11;
|
|
893
903
|
break;
|
|
894
904
|
}
|
|
895
905
|
|
|
896
906
|
_context2.t0 = null;
|
|
897
|
-
_context2.next =
|
|
907
|
+
_context2.next = 14;
|
|
898
908
|
break;
|
|
899
909
|
|
|
900
|
-
case
|
|
901
|
-
_context2.next =
|
|
910
|
+
case 11:
|
|
911
|
+
_context2.next = 13;
|
|
902
912
|
return result.json();
|
|
903
913
|
|
|
904
|
-
case
|
|
914
|
+
case 13:
|
|
905
915
|
_context2.t0 = _context2.sent;
|
|
906
916
|
|
|
907
|
-
case
|
|
917
|
+
case 14:
|
|
908
918
|
json = _context2.t0;
|
|
909
919
|
return _context2.abrupt("return", {
|
|
910
920
|
data: json,
|
|
@@ -913,29 +923,29 @@ var authUser = /*#__PURE__*/function () {
|
|
|
913
923
|
ok: true
|
|
914
924
|
});
|
|
915
925
|
|
|
916
|
-
case
|
|
926
|
+
case 16:
|
|
917
927
|
if (!(result.status >= 400)) {
|
|
918
|
-
_context2.next =
|
|
928
|
+
_context2.next = 26;
|
|
919
929
|
break;
|
|
920
930
|
}
|
|
921
931
|
|
|
922
932
|
if (![403, 404].includes(result.status)) {
|
|
923
|
-
_context2.next =
|
|
933
|
+
_context2.next = 21;
|
|
924
934
|
break;
|
|
925
935
|
}
|
|
926
936
|
|
|
927
937
|
_context2.t1 = null;
|
|
928
|
-
_context2.next =
|
|
938
|
+
_context2.next = 24;
|
|
929
939
|
break;
|
|
930
940
|
|
|
931
|
-
case
|
|
932
|
-
_context2.next =
|
|
941
|
+
case 21:
|
|
942
|
+
_context2.next = 23;
|
|
933
943
|
return result.json();
|
|
934
944
|
|
|
935
|
-
case
|
|
945
|
+
case 23:
|
|
936
946
|
_context2.t1 = _context2.sent;
|
|
937
947
|
|
|
938
|
-
case
|
|
948
|
+
case 24:
|
|
939
949
|
_json = _context2.t1;
|
|
940
950
|
return _context2.abrupt("return", {
|
|
941
951
|
headers: result.headers,
|
|
@@ -944,7 +954,7 @@ var authUser = /*#__PURE__*/function () {
|
|
|
944
954
|
ok: false
|
|
945
955
|
});
|
|
946
956
|
|
|
947
|
-
case
|
|
957
|
+
case 26:
|
|
948
958
|
return _context2.abrupt("return", {
|
|
949
959
|
headers: result.headers,
|
|
950
960
|
statusCode: result.status,
|
|
@@ -952,16 +962,25 @@ var authUser = /*#__PURE__*/function () {
|
|
|
952
962
|
ok: false
|
|
953
963
|
});
|
|
954
964
|
|
|
955
|
-
case
|
|
965
|
+
case 29:
|
|
966
|
+
_context2.prev = 29;
|
|
967
|
+
_context2.t2 = _context2["catch"](2);
|
|
968
|
+
return _context2.abrupt("return", {
|
|
969
|
+
statusCode: 500,
|
|
970
|
+
error: 'Something went wrong',
|
|
971
|
+
ok: false
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
case 32:
|
|
956
975
|
case "end":
|
|
957
976
|
return _context2.stop();
|
|
958
977
|
}
|
|
959
978
|
}
|
|
960
|
-
}, _callee2);
|
|
979
|
+
}, _callee2, null, [[2, 29]]);
|
|
961
980
|
}));
|
|
962
981
|
|
|
963
|
-
return function authUser(
|
|
964
|
-
return
|
|
982
|
+
return function authUser(_x2) {
|
|
983
|
+
return _ref4.apply(this, arguments);
|
|
965
984
|
};
|
|
966
985
|
}();
|
|
967
986
|
|
|
@@ -1009,8 +1028,9 @@ function StartScreen(props) {
|
|
|
1009
1028
|
var onContinue = props.onContinue,
|
|
1010
1029
|
appName = props.appName,
|
|
1011
1030
|
shadow = props.shadow,
|
|
1012
|
-
|
|
1013
|
-
showErrorScreen = props.showErrorScreen
|
|
1031
|
+
authRequestId = props.authRequestId,
|
|
1032
|
+
showErrorScreen = props.showErrorScreen,
|
|
1033
|
+
test = props.test;
|
|
1014
1034
|
|
|
1015
1035
|
var _useState = useState(false),
|
|
1016
1036
|
loading = _useState[0],
|
|
@@ -1019,6 +1039,17 @@ function StartScreen(props) {
|
|
|
1019
1039
|
var _useTranslation = useTranslation(),
|
|
1020
1040
|
t = _useTranslation.t;
|
|
1021
1041
|
|
|
1042
|
+
useEffect(function () {
|
|
1043
|
+
window.addEventListener('keydown', function (e) {
|
|
1044
|
+
return handleUserKeyPress(e, onContinue);
|
|
1045
|
+
});
|
|
1046
|
+
return function () {
|
|
1047
|
+
window.removeEventListener('keydown', function (e) {
|
|
1048
|
+
return handleUserKeyPress(e, onContinue);
|
|
1049
|
+
});
|
|
1050
|
+
};
|
|
1051
|
+
}, []);
|
|
1052
|
+
|
|
1022
1053
|
var handleContinue = /*#__PURE__*/function () {
|
|
1023
1054
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1024
1055
|
var response;
|
|
@@ -1028,13 +1059,16 @@ function StartScreen(props) {
|
|
|
1028
1059
|
case 0:
|
|
1029
1060
|
setLoading(true);
|
|
1030
1061
|
|
|
1031
|
-
if (!
|
|
1062
|
+
if (!authRequestId) {
|
|
1032
1063
|
_context.next = 6;
|
|
1033
1064
|
break;
|
|
1034
1065
|
}
|
|
1035
1066
|
|
|
1036
1067
|
_context.next = 4;
|
|
1037
|
-
return authUser(
|
|
1068
|
+
return authUser({
|
|
1069
|
+
authRequestId: authRequestId,
|
|
1070
|
+
test: test
|
|
1071
|
+
});
|
|
1038
1072
|
|
|
1039
1073
|
case 4:
|
|
1040
1074
|
response = _context.sent;
|
|
@@ -1103,9 +1137,13 @@ function StartScreen(props) {
|
|
|
1103
1137
|
bold: React.createElement("strong", null)
|
|
1104
1138
|
}
|
|
1105
1139
|
}))), React.createElement(H4Styled, null, t('things_you_should_know')), React.createElement("ul", null, React.createElement("li", null, t('we_dont_share_your_data_without_your_consent')), React.createElement("li", null, t('you_can_easily_stop_sharing_your_data_at_any_time')), React.createElement("li", null, t('you_can_choose_to_delete_shared_data_when_we_no_longer_need_it'))), React.createElement(Spacer, null), React.createElement("span", null, React.createElement(React.Fragment, null, t('by_proceeding_you_agree_to_the'), ' ', React.createElement("a", {
|
|
1106
|
-
href: "https://docs.basiq.io/en/articles/415750-basiq-terms-of-service"
|
|
1140
|
+
href: "https://docs.basiq.io/en/articles/415750-basiq-terms-of-service",
|
|
1141
|
+
rel: "noreferrer",
|
|
1142
|
+
target: "_blank"
|
|
1107
1143
|
}, t('terms_of_service')), " ", t('and'), ' ', React.createElement("a", {
|
|
1108
|
-
href: "https://docs.basiq.io/en/articles/382581-basiq-privacy-policy"
|
|
1144
|
+
href: "https://docs.basiq.io/en/articles/382581-basiq-privacy-policy",
|
|
1145
|
+
rel: "noreferrer",
|
|
1146
|
+
target: "_blank"
|
|
1109
1147
|
}, t('privacy_notice')))), React.createElement(LoadingModal, {
|
|
1110
1148
|
isOpen: loading
|
|
1111
1149
|
})));
|
|
@@ -1114,8 +1152,9 @@ function StartScreen(props) {
|
|
|
1114
1152
|
function AuthScreen(_ref) {
|
|
1115
1153
|
var onBack = _ref.onBack,
|
|
1116
1154
|
number = _ref.number,
|
|
1117
|
-
|
|
1118
|
-
shadow = _ref.shadow
|
|
1155
|
+
authRequestId = _ref.authRequestId,
|
|
1156
|
+
shadow = _ref.shadow,
|
|
1157
|
+
test = _ref.test;
|
|
1119
1158
|
|
|
1120
1159
|
var _useTranslation = useTranslation(),
|
|
1121
1160
|
t = _useTranslation.t;
|
|
@@ -1125,40 +1164,51 @@ function AuthScreen(_ref) {
|
|
|
1125
1164
|
setError = _useState[1];
|
|
1126
1165
|
|
|
1127
1166
|
var _useState2 = useState(''),
|
|
1128
|
-
|
|
1129
|
-
|
|
1167
|
+
smsCode = _useState2[0],
|
|
1168
|
+
setSmsCode = _useState2[1];
|
|
1130
1169
|
|
|
1131
1170
|
var _useState3 = useState(false),
|
|
1132
1171
|
resend = _useState3[0],
|
|
1133
1172
|
setResend = _useState3[1];
|
|
1134
1173
|
|
|
1135
1174
|
var _useState4 = useState(false),
|
|
1136
|
-
|
|
1137
|
-
|
|
1175
|
+
resendLoading = _useState4[0],
|
|
1176
|
+
setResendLoading = _useState4[1];
|
|
1138
1177
|
|
|
1139
|
-
var
|
|
1140
|
-
|
|
1141
|
-
|
|
1178
|
+
var _useState5 = useState(false),
|
|
1179
|
+
loading = _useState5[0],
|
|
1180
|
+
setLoading = _useState5[1];
|
|
1142
1181
|
|
|
1143
|
-
|
|
1182
|
+
var handleCodeApply = useCallback( /*#__PURE__*/function () {
|
|
1183
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
1184
|
+
var _response$data, response, _response$data2;
|
|
1144
1185
|
|
|
1145
1186
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1146
1187
|
while (1) {
|
|
1147
1188
|
switch (_context.prev = _context.next) {
|
|
1148
1189
|
case 0:
|
|
1190
|
+
if (!(smsCode.length === 4 && error.length === 0 && (!e || (e == null ? void 0 : e.charCode) === 13))) {
|
|
1191
|
+
_context.next = 7;
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1149
1195
|
setLoading(true);
|
|
1150
|
-
_context.next =
|
|
1151
|
-
return verifySmsCode(
|
|
1196
|
+
_context.next = 4;
|
|
1197
|
+
return verifySmsCode({
|
|
1198
|
+
authRequestId: authRequestId,
|
|
1199
|
+
smsCode: smsCode,
|
|
1200
|
+
test: test
|
|
1201
|
+
});
|
|
1152
1202
|
|
|
1153
|
-
case
|
|
1203
|
+
case 4:
|
|
1154
1204
|
response = _context.sent;
|
|
1155
|
-
setLoading(false);
|
|
1156
1205
|
|
|
1157
1206
|
if (response != null && (_response$data = response.data) != null && _response$data.access_token) {
|
|
1158
|
-
window.open("https://consent.basiq.io/home?token=" + (response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.access_token));
|
|
1207
|
+
window.open("https://consent.basiq.io/home?token=" + (response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.access_token), "_self");
|
|
1159
1208
|
}
|
|
1160
1209
|
|
|
1161
1210
|
if (response != null && response.error) {
|
|
1211
|
+
setLoading(false);
|
|
1162
1212
|
setError(t('this_code_doesnt_appear_to_be_valid'));
|
|
1163
1213
|
}
|
|
1164
1214
|
|
|
@@ -1170,16 +1220,16 @@ function AuthScreen(_ref) {
|
|
|
1170
1220
|
}, _callee);
|
|
1171
1221
|
}));
|
|
1172
1222
|
|
|
1173
|
-
return function
|
|
1223
|
+
return function (_x) {
|
|
1174
1224
|
return _ref2.apply(this, arguments);
|
|
1175
1225
|
};
|
|
1176
|
-
}();
|
|
1177
|
-
|
|
1226
|
+
}(), [smsCode, error, authRequestId]);
|
|
1178
1227
|
var buttons = [{
|
|
1179
1228
|
label: t('continue'),
|
|
1180
1229
|
onClick: function onClick() {
|
|
1181
1230
|
return handleCodeApply();
|
|
1182
|
-
}
|
|
1231
|
+
},
|
|
1232
|
+
disabled: smsCode.length < 4 || !!error
|
|
1183
1233
|
}];
|
|
1184
1234
|
|
|
1185
1235
|
var handleResend = /*#__PURE__*/function () {
|
|
@@ -1190,14 +1240,18 @@ function AuthScreen(_ref) {
|
|
|
1190
1240
|
switch (_context2.prev = _context2.next) {
|
|
1191
1241
|
case 0:
|
|
1192
1242
|
setError('');
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1243
|
+
setSmsCode('');
|
|
1244
|
+
setResend(false);
|
|
1245
|
+
setResendLoading(true);
|
|
1246
|
+
_context2.next = 6;
|
|
1247
|
+
return authUser({
|
|
1248
|
+
authRequestId: authRequestId,
|
|
1249
|
+
test: test
|
|
1250
|
+
});
|
|
1197
1251
|
|
|
1198
|
-
case
|
|
1252
|
+
case 6:
|
|
1199
1253
|
response = _context2.sent;
|
|
1200
|
-
|
|
1254
|
+
setResendLoading(false);
|
|
1201
1255
|
|
|
1202
1256
|
if (response.error) {
|
|
1203
1257
|
setError(t('failed_to_send_sms'));
|
|
@@ -1205,7 +1259,7 @@ function AuthScreen(_ref) {
|
|
|
1205
1259
|
setResend(true);
|
|
1206
1260
|
}
|
|
1207
1261
|
|
|
1208
|
-
case
|
|
1262
|
+
case 9:
|
|
1209
1263
|
case "end":
|
|
1210
1264
|
return _context2.stop();
|
|
1211
1265
|
}
|
|
@@ -1221,7 +1275,10 @@ function AuthScreen(_ref) {
|
|
|
1221
1275
|
var handleInput = function handleInput(e) {
|
|
1222
1276
|
setError('');
|
|
1223
1277
|
setResend(false);
|
|
1224
|
-
|
|
1278
|
+
|
|
1279
|
+
if (/^([0-9]+)$/.test(e.target.value) || e.target.value === '') {
|
|
1280
|
+
setSmsCode(e.target.value);
|
|
1281
|
+
}
|
|
1225
1282
|
};
|
|
1226
1283
|
|
|
1227
1284
|
return React.createElement(Page, {
|
|
@@ -1239,21 +1296,26 @@ function AuthScreen(_ref) {
|
|
|
1239
1296
|
type: "text",
|
|
1240
1297
|
maxLength: 4,
|
|
1241
1298
|
onChange: handleInput,
|
|
1242
|
-
value:
|
|
1243
|
-
filled:
|
|
1244
|
-
error: !!error
|
|
1299
|
+
value: smsCode,
|
|
1300
|
+
filled: smsCode.length === 4,
|
|
1301
|
+
error: !!error,
|
|
1302
|
+
onKeyPress: function onKeyPress(e) {
|
|
1303
|
+
return handleCodeApply(e);
|
|
1304
|
+
}
|
|
1245
1305
|
})), React.createElement(PageConnectFooterControl, null, resend && React.createElement(StatusMessage, null, t('new_sms_code_has_been_sent')), !!error && React.createElement(StatusMessage, {
|
|
1246
1306
|
error: true
|
|
1247
1307
|
}, error), React.createElement(PageConnectFooterText, null, React.createElement("span", null, React.createElement(React.Fragment, null, t('didnt_receive_the_code'), " ", React.createElement(DivAsLink, {
|
|
1308
|
+
disabled: resendLoading,
|
|
1248
1309
|
onClick: function onClick() {
|
|
1249
|
-
return handleResend();
|
|
1310
|
+
return !resendLoading && handleResend();
|
|
1250
1311
|
}
|
|
1251
1312
|
}, t('resend_sms')))))), React.createElement(LoadingModal, {
|
|
1252
1313
|
isOpen: loading
|
|
1253
1314
|
})));
|
|
1254
1315
|
}
|
|
1255
1316
|
|
|
1256
|
-
function App() {
|
|
1317
|
+
function App(props) {
|
|
1318
|
+
var test = props.test;
|
|
1257
1319
|
var ref = createRef();
|
|
1258
1320
|
|
|
1259
1321
|
var _useState = useState(false),
|
|
@@ -1292,6 +1354,11 @@ function App() {
|
|
|
1292
1354
|
setShadow(detectScrollToBottom(event));
|
|
1293
1355
|
};
|
|
1294
1356
|
|
|
1357
|
+
var showErrorScreen = function showErrorScreen(code) {
|
|
1358
|
+
setErrorCode(code);
|
|
1359
|
+
setCurrentScreen(3);
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1295
1362
|
useEffect(function () {
|
|
1296
1363
|
var getData = /*#__PURE__*/function () {
|
|
1297
1364
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -1311,7 +1378,11 @@ function App() {
|
|
|
1311
1378
|
setAuthId(id);
|
|
1312
1379
|
setLoading(true);
|
|
1313
1380
|
_context.next = 6;
|
|
1314
|
-
return authUser(
|
|
1381
|
+
return authUser({
|
|
1382
|
+
authRequestId: id,
|
|
1383
|
+
method: 'GET',
|
|
1384
|
+
test: test
|
|
1385
|
+
});
|
|
1315
1386
|
|
|
1316
1387
|
case 6:
|
|
1317
1388
|
response = _context.sent;
|
|
@@ -1356,11 +1427,6 @@ function App() {
|
|
|
1356
1427
|
getData();
|
|
1357
1428
|
}, []);
|
|
1358
1429
|
|
|
1359
|
-
var showErrorScreen = function showErrorScreen(code) {
|
|
1360
|
-
setErrorCode(code);
|
|
1361
|
-
setCurrentScreen(3);
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
1430
|
var getScreen = function getScreen() {
|
|
1365
1431
|
switch (currentScreen) {
|
|
1366
1432
|
case 0:
|
|
@@ -1379,7 +1445,8 @@ function App() {
|
|
|
1379
1445
|
onContinue: function onContinue() {
|
|
1380
1446
|
return setCurrentScreen(2);
|
|
1381
1447
|
},
|
|
1382
|
-
|
|
1448
|
+
authRequestId: authId,
|
|
1449
|
+
test: test
|
|
1383
1450
|
});
|
|
1384
1451
|
|
|
1385
1452
|
case 2:
|
|
@@ -1389,7 +1456,8 @@ function App() {
|
|
|
1389
1456
|
return setCurrentScreen(1);
|
|
1390
1457
|
},
|
|
1391
1458
|
shadow: shadow,
|
|
1392
|
-
|
|
1459
|
+
authRequestId: authId,
|
|
1460
|
+
test: test
|
|
1393
1461
|
});
|
|
1394
1462
|
|
|
1395
1463
|
case 3:
|
|
@@ -1486,10 +1554,13 @@ i18n.use(initReactI18next) // passes i18n down to react-i18next
|
|
|
1486
1554
|
}
|
|
1487
1555
|
});
|
|
1488
1556
|
|
|
1489
|
-
function BasiqConnect() {
|
|
1557
|
+
function BasiqConnect(props) {
|
|
1558
|
+
var test = props.test;
|
|
1490
1559
|
return React.createElement(React.StrictMode, null, React.createElement(ThemeProvider, {
|
|
1491
1560
|
theme: theme
|
|
1492
|
-
}, React.createElement(App,
|
|
1561
|
+
}, React.createElement(App, {
|
|
1562
|
+
test: test
|
|
1563
|
+
})));
|
|
1493
1564
|
}
|
|
1494
1565
|
|
|
1495
1566
|
export { BasiqConnect };
|