@basiq/connect-auth 0.1.88 → 0.1.89
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/dist/App.d.ts +2 -1
- package/dist/actions/actions.d.ts +10 -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 +67 -49
- 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 +67 -49
- package/dist/connect-auth.esm.js.map +1 -1
- package/dist/helpers/constants.d.ts +1 -0
- package/package.json +1 -1
package/dist/App.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export declare const verifySmsCode: (authRequestId
|
|
1
|
+
export declare const verifySmsCode: ({ authRequestId, smsCode, test }: {
|
|
2
|
+
authRequestId: string;
|
|
3
|
+
smsCode: string;
|
|
4
|
+
test?: boolean;
|
|
5
|
+
}) => Promise<{
|
|
2
6
|
data: any;
|
|
3
7
|
headers: Headers;
|
|
4
8
|
statusCode: number;
|
|
@@ -11,7 +15,11 @@ export declare const verifySmsCode: (authRequestId: string, smsCode: string) =>
|
|
|
11
15
|
ok: boolean;
|
|
12
16
|
data?: undefined;
|
|
13
17
|
}>;
|
|
14
|
-
export declare const authUser: (authRequestId
|
|
18
|
+
export declare const authUser: ({ authRequestId, method, test }: {
|
|
19
|
+
authRequestId: string;
|
|
20
|
+
method?: 'POST' | 'GET';
|
|
21
|
+
test?: boolean;
|
|
22
|
+
}) => Promise<{
|
|
15
23
|
data: any;
|
|
16
24
|
headers: Headers;
|
|
17
25
|
statusCode: number;
|
|
@@ -3,7 +3,8 @@ interface IProps {
|
|
|
3
3
|
shadow: boolean;
|
|
4
4
|
onBack: () => void;
|
|
5
5
|
number: string;
|
|
6
|
-
|
|
6
|
+
authRequestId: string;
|
|
7
|
+
test?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare function AuthScreen({ onBack, number,
|
|
9
|
+
declare function AuthScreen({ onBack, number, authRequestId, shadow, test }: IProps): JSX.Element;
|
|
9
10
|
export default AuthScreen;
|
|
@@ -475,7 +475,7 @@ var hexToRGBa = function hexToRGBa(hex, opacity) {
|
|
|
475
475
|
return "rgba(" + (hexToRGBA == null ? void 0 : hexToRGBA.concat(opp).join()) + ")";
|
|
476
476
|
};
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
var DASHBOARD_API_URL_TEST = 'https://c9joivz12f.execute-api.ap-southeast-2.amazonaws.com/Development/';
|
|
479
479
|
var DASHBOARD_API_URL = 'https://p4c8zn20r9.execute-api.ap-southeast-2.amazonaws.com/Production_v1/';
|
|
480
480
|
|
|
481
481
|
var _templateObject$2, _templateObject2$2, _templateObject3$1;
|
|
@@ -781,12 +781,13 @@ function NotFound(_ref) {
|
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
var verifySmsCode = /*#__PURE__*/function () {
|
|
784
|
-
var
|
|
785
|
-
var body, reqData, result, json;
|
|
784
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
785
|
+
var authRequestId, smsCode, test, body, reqData, result, json;
|
|
786
786
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
787
787
|
while (1) {
|
|
788
788
|
switch (_context.prev = _context.next) {
|
|
789
789
|
case 0:
|
|
790
|
+
authRequestId = _ref.authRequestId, smsCode = _ref.smsCode, test = _ref.test;
|
|
790
791
|
body = {
|
|
791
792
|
'sms-code': smsCode
|
|
792
793
|
};
|
|
@@ -798,34 +799,34 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
798
799
|
method: 'POST',
|
|
799
800
|
body: JSON.stringify(body)
|
|
800
801
|
};
|
|
801
|
-
_context.next =
|
|
802
|
-
return fetch(DASHBOARD_API_URL + "client_auth/" + authRequestId + "/token", reqData);
|
|
802
|
+
_context.next = 5;
|
|
803
|
+
return fetch((test ? DASHBOARD_API_URL_TEST : DASHBOARD_API_URL) + "client_auth/" + authRequestId + "/token", reqData);
|
|
803
804
|
|
|
804
|
-
case
|
|
805
|
+
case 5:
|
|
805
806
|
result = _context.sent;
|
|
806
807
|
|
|
807
808
|
if (!(result.status >= 200 && result.status < 300)) {
|
|
808
|
-
_context.next =
|
|
809
|
+
_context.next = 16;
|
|
809
810
|
break;
|
|
810
811
|
}
|
|
811
812
|
|
|
812
813
|
if (!(result.status === 204)) {
|
|
813
|
-
_context.next =
|
|
814
|
+
_context.next = 11;
|
|
814
815
|
break;
|
|
815
816
|
}
|
|
816
817
|
|
|
817
818
|
_context.t0 = null;
|
|
818
|
-
_context.next =
|
|
819
|
+
_context.next = 14;
|
|
819
820
|
break;
|
|
820
821
|
|
|
821
|
-
case
|
|
822
|
-
_context.next =
|
|
822
|
+
case 11:
|
|
823
|
+
_context.next = 13;
|
|
823
824
|
return result.json();
|
|
824
825
|
|
|
825
|
-
case
|
|
826
|
+
case 13:
|
|
826
827
|
_context.t0 = _context.sent;
|
|
827
828
|
|
|
828
|
-
case
|
|
829
|
+
case 14:
|
|
829
830
|
json = _context.t0;
|
|
830
831
|
return _context.abrupt("return", {
|
|
831
832
|
data: json,
|
|
@@ -834,9 +835,9 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
834
835
|
ok: true
|
|
835
836
|
});
|
|
836
837
|
|
|
837
|
-
case
|
|
838
|
+
case 16:
|
|
838
839
|
if (!(result.status >= 400)) {
|
|
839
|
-
_context.next =
|
|
840
|
+
_context.next = 18;
|
|
840
841
|
break;
|
|
841
842
|
}
|
|
842
843
|
|
|
@@ -847,7 +848,7 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
847
848
|
ok: false
|
|
848
849
|
});
|
|
849
850
|
|
|
850
|
-
case
|
|
851
|
+
case 18:
|
|
851
852
|
return _context.abrupt("return", {
|
|
852
853
|
headers: result.headers,
|
|
853
854
|
statusCode: result.status,
|
|
@@ -855,7 +856,7 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
855
856
|
ok: false
|
|
856
857
|
});
|
|
857
858
|
|
|
858
|
-
case
|
|
859
|
+
case 19:
|
|
859
860
|
case "end":
|
|
860
861
|
return _context.stop();
|
|
861
862
|
}
|
|
@@ -863,30 +864,27 @@ var verifySmsCode = /*#__PURE__*/function () {
|
|
|
863
864
|
}, _callee);
|
|
864
865
|
}));
|
|
865
866
|
|
|
866
|
-
return function verifySmsCode(_x
|
|
867
|
-
return
|
|
867
|
+
return function verifySmsCode(_x) {
|
|
868
|
+
return _ref2.apply(this, arguments);
|
|
868
869
|
};
|
|
869
870
|
}();
|
|
870
871
|
var authUser = /*#__PURE__*/function () {
|
|
871
|
-
var
|
|
872
|
-
var reqData, result, json, _json;
|
|
872
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
873
|
+
var authRequestId, method, test, reqData, result, json, _json;
|
|
873
874
|
|
|
874
875
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
875
876
|
while (1) {
|
|
876
877
|
switch (_context2.prev = _context2.next) {
|
|
877
878
|
case 0:
|
|
878
|
-
|
|
879
|
-
method = 'POST';
|
|
880
|
-
}
|
|
881
|
-
|
|
879
|
+
authRequestId = _ref3.authRequestId, method = _ref3.method, test = _ref3.test;
|
|
882
880
|
reqData = {
|
|
883
881
|
headers: {
|
|
884
882
|
'Content-Type': 'application/json'
|
|
885
883
|
},
|
|
886
|
-
method: method
|
|
884
|
+
method: method || 'POST'
|
|
887
885
|
};
|
|
888
886
|
_context2.next = 4;
|
|
889
|
-
return fetch(DASHBOARD_API_URL + "client_auth/" + authRequestId, reqData);
|
|
887
|
+
return fetch((test ? DASHBOARD_API_URL_TEST : DASHBOARD_API_URL) + "client_auth/" + authRequestId, reqData);
|
|
890
888
|
|
|
891
889
|
case 4:
|
|
892
890
|
result = _context2.sent;
|
|
@@ -968,8 +966,8 @@ var authUser = /*#__PURE__*/function () {
|
|
|
968
966
|
}, _callee2);
|
|
969
967
|
}));
|
|
970
968
|
|
|
971
|
-
return function authUser(
|
|
972
|
-
return
|
|
969
|
+
return function authUser(_x2) {
|
|
970
|
+
return _ref4.apply(this, arguments);
|
|
973
971
|
};
|
|
974
972
|
}();
|
|
975
973
|
|
|
@@ -1017,8 +1015,9 @@ function StartScreen(props) {
|
|
|
1017
1015
|
var onContinue = props.onContinue,
|
|
1018
1016
|
appName = props.appName,
|
|
1019
1017
|
shadow = props.shadow,
|
|
1020
|
-
|
|
1021
|
-
showErrorScreen = props.showErrorScreen
|
|
1018
|
+
authRequestId = props.authRequestId,
|
|
1019
|
+
showErrorScreen = props.showErrorScreen,
|
|
1020
|
+
test = props.test;
|
|
1022
1021
|
|
|
1023
1022
|
var _useState = React.useState(false),
|
|
1024
1023
|
loading = _useState[0],
|
|
@@ -1036,13 +1035,16 @@ function StartScreen(props) {
|
|
|
1036
1035
|
case 0:
|
|
1037
1036
|
setLoading(true);
|
|
1038
1037
|
|
|
1039
|
-
if (!
|
|
1038
|
+
if (!authRequestId) {
|
|
1040
1039
|
_context.next = 6;
|
|
1041
1040
|
break;
|
|
1042
1041
|
}
|
|
1043
1042
|
|
|
1044
1043
|
_context.next = 4;
|
|
1045
|
-
return authUser(
|
|
1044
|
+
return authUser({
|
|
1045
|
+
authRequestId: authRequestId,
|
|
1046
|
+
test: test
|
|
1047
|
+
});
|
|
1046
1048
|
|
|
1047
1049
|
case 4:
|
|
1048
1050
|
response = _context.sent;
|
|
@@ -1122,8 +1124,9 @@ function StartScreen(props) {
|
|
|
1122
1124
|
function AuthScreen(_ref) {
|
|
1123
1125
|
var onBack = _ref.onBack,
|
|
1124
1126
|
number = _ref.number,
|
|
1125
|
-
|
|
1126
|
-
shadow = _ref.shadow
|
|
1127
|
+
authRequestId = _ref.authRequestId,
|
|
1128
|
+
shadow = _ref.shadow,
|
|
1129
|
+
test = _ref.test;
|
|
1127
1130
|
|
|
1128
1131
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1129
1132
|
t = _useTranslation.t;
|
|
@@ -1133,8 +1136,8 @@ function AuthScreen(_ref) {
|
|
|
1133
1136
|
setError = _useState[1];
|
|
1134
1137
|
|
|
1135
1138
|
var _useState2 = React.useState(''),
|
|
1136
|
-
|
|
1137
|
-
|
|
1139
|
+
smsCode = _useState2[0],
|
|
1140
|
+
setSmsCode = _useState2[1];
|
|
1138
1141
|
|
|
1139
1142
|
var _useState3 = React.useState(false),
|
|
1140
1143
|
resend = _useState3[0],
|
|
@@ -1156,7 +1159,11 @@ function AuthScreen(_ref) {
|
|
|
1156
1159
|
case 0:
|
|
1157
1160
|
setLoading(true);
|
|
1158
1161
|
_context.next = 3;
|
|
1159
|
-
return verifySmsCode(
|
|
1162
|
+
return verifySmsCode({
|
|
1163
|
+
authRequestId: authRequestId,
|
|
1164
|
+
smsCode: smsCode,
|
|
1165
|
+
test: test
|
|
1166
|
+
});
|
|
1160
1167
|
|
|
1161
1168
|
case 3:
|
|
1162
1169
|
response = _context.sent;
|
|
@@ -1198,10 +1205,13 @@ function AuthScreen(_ref) {
|
|
|
1198
1205
|
switch (_context2.prev = _context2.next) {
|
|
1199
1206
|
case 0:
|
|
1200
1207
|
setError('');
|
|
1201
|
-
|
|
1208
|
+
setSmsCode('');
|
|
1202
1209
|
setLoading(true);
|
|
1203
1210
|
_context2.next = 5;
|
|
1204
|
-
return authUser(
|
|
1211
|
+
return authUser({
|
|
1212
|
+
authRequestId: authRequestId,
|
|
1213
|
+
test: test
|
|
1214
|
+
});
|
|
1205
1215
|
|
|
1206
1216
|
case 5:
|
|
1207
1217
|
response = _context2.sent;
|
|
@@ -1229,7 +1239,7 @@ function AuthScreen(_ref) {
|
|
|
1229
1239
|
var handleInput = function handleInput(e) {
|
|
1230
1240
|
setError('');
|
|
1231
1241
|
setResend(false);
|
|
1232
|
-
|
|
1242
|
+
setSmsCode(e.target.value);
|
|
1233
1243
|
};
|
|
1234
1244
|
|
|
1235
1245
|
return React__default.createElement(Page, {
|
|
@@ -1247,8 +1257,8 @@ function AuthScreen(_ref) {
|
|
|
1247
1257
|
type: "text",
|
|
1248
1258
|
maxLength: 4,
|
|
1249
1259
|
onChange: handleInput,
|
|
1250
|
-
value:
|
|
1251
|
-
filled:
|
|
1260
|
+
value: smsCode,
|
|
1261
|
+
filled: smsCode.length === 4,
|
|
1252
1262
|
error: !!error
|
|
1253
1263
|
})), React__default.createElement(PageConnectFooterControl, null, resend && React__default.createElement(StatusMessage, null, t('new_sms_code_has_been_sent')), !!error && React__default.createElement(StatusMessage, {
|
|
1254
1264
|
error: true
|
|
@@ -1261,7 +1271,7 @@ function AuthScreen(_ref) {
|
|
|
1261
1271
|
})));
|
|
1262
1272
|
}
|
|
1263
1273
|
|
|
1264
|
-
function App() {
|
|
1274
|
+
function App(props) {
|
|
1265
1275
|
var ref = React.createRef();
|
|
1266
1276
|
|
|
1267
1277
|
var _useState = React.useState(false),
|
|
@@ -1319,7 +1329,11 @@ function App() {
|
|
|
1319
1329
|
setAuthId(id);
|
|
1320
1330
|
setLoading(true);
|
|
1321
1331
|
_context.next = 6;
|
|
1322
|
-
return authUser(
|
|
1332
|
+
return authUser({
|
|
1333
|
+
authRequestId: id,
|
|
1334
|
+
method: 'GET',
|
|
1335
|
+
test: props.test
|
|
1336
|
+
});
|
|
1323
1337
|
|
|
1324
1338
|
case 6:
|
|
1325
1339
|
response = _context.sent;
|
|
@@ -1387,7 +1401,8 @@ function App() {
|
|
|
1387
1401
|
onContinue: function onContinue() {
|
|
1388
1402
|
return setCurrentScreen(2);
|
|
1389
1403
|
},
|
|
1390
|
-
|
|
1404
|
+
authRequestId: authId,
|
|
1405
|
+
test: props.test
|
|
1391
1406
|
});
|
|
1392
1407
|
|
|
1393
1408
|
case 2:
|
|
@@ -1397,7 +1412,8 @@ function App() {
|
|
|
1397
1412
|
return setCurrentScreen(1);
|
|
1398
1413
|
},
|
|
1399
1414
|
shadow: shadow,
|
|
1400
|
-
|
|
1415
|
+
authRequestId: authId,
|
|
1416
|
+
test: props.test
|
|
1401
1417
|
});
|
|
1402
1418
|
|
|
1403
1419
|
case 3:
|
|
@@ -1494,10 +1510,12 @@ i18n.use(reactI18next.initReactI18next) // passes i18n down to react-i18next
|
|
|
1494
1510
|
}
|
|
1495
1511
|
});
|
|
1496
1512
|
|
|
1497
|
-
function BasiqConnect() {
|
|
1513
|
+
function BasiqConnect(props) {
|
|
1498
1514
|
return React__default.createElement(React__default.StrictMode, null, React__default.createElement(styled.ThemeProvider, {
|
|
1499
1515
|
theme: theme
|
|
1500
|
-
}, React__default.createElement(App,
|
|
1516
|
+
}, React__default.createElement(App, {
|
|
1517
|
+
test: props.test
|
|
1518
|
+
})));
|
|
1501
1519
|
}
|
|
1502
1520
|
|
|
1503
1521
|
exports.BasiqConnect = BasiqConnect;
|