authscape 1.0.67 → 1.0.70
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/index.js +17 -27
- package/package.json +13 -3
- package/src/services/apiService.js +3 -5
- package/src/services/authService.js +2 -4
- package/src/services/authorizationComponent.js +2 -2
- package/src/services/helper.js +2 -4
- package/src/services/signInValidator.js +2 -4
- package/src/services/slug.js +2 -4
- package/src/services/storeWithExpiry.js +2 -4
package/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
62
62
|
Object.defineProperty(exports, "__esModule", {
|
|
63
63
|
value: true
|
|
64
64
|
});
|
|
65
|
-
exports
|
|
65
|
+
exports.apiService = void 0;
|
|
66
66
|
|
|
67
67
|
var _axios = _interopRequireDefault(require("axios"));
|
|
68
68
|
|
|
@@ -74,8 +74,6 @@ var _nextCookies = _interopRequireDefault(require("next-cookies"));
|
|
|
74
74
|
|
|
75
75
|
var _nookies = require("nookies");
|
|
76
76
|
|
|
77
|
-
var _helper = _interopRequireDefault(require("./helper"));
|
|
78
|
-
|
|
79
77
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
80
78
|
|
|
81
79
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -90,6 +88,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
90
88
|
|
|
91
89
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
92
90
|
|
|
91
|
+
// import Helper from "./helper";
|
|
93
92
|
var setupDefaultOptions = /*#__PURE__*/function () {
|
|
94
93
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
95
94
|
var ctx,
|
|
@@ -103,7 +102,7 @@ var setupDefaultOptions = /*#__PURE__*/function () {
|
|
|
103
102
|
ctx = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
104
103
|
defaultOptions = {};
|
|
105
104
|
|
|
106
|
-
if ((
|
|
105
|
+
if (Helper().isObjectEmpty(ctx)) {
|
|
107
106
|
accessToken = (0, _nextCookies["default"])(ctx).access_token || '';
|
|
108
107
|
|
|
109
108
|
if (accessToken !== null && accessToken !== undefined && accessToken != "") {
|
|
@@ -577,8 +576,7 @@ var apiService = function apiService() {
|
|
|
577
576
|
};
|
|
578
577
|
};
|
|
579
578
|
|
|
580
|
-
|
|
581
|
-
exports["default"] = _default;
|
|
579
|
+
exports.apiService = apiService;
|
|
582
580
|
"use strict";
|
|
583
581
|
|
|
584
582
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
@@ -586,14 +584,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
586
584
|
Object.defineProperty(exports, "__esModule", {
|
|
587
585
|
value: true
|
|
588
586
|
});
|
|
589
|
-
exports
|
|
587
|
+
exports.AuthorizationComponent = AuthorizationComponent;
|
|
590
588
|
|
|
591
589
|
var _react = _interopRequireWildcard(require("react"));
|
|
592
590
|
|
|
593
|
-
var _apiService = _interopRequireDefault(require("./apiService"));
|
|
594
|
-
|
|
595
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
596
|
-
|
|
597
591
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
598
592
|
|
|
599
593
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -616,6 +610,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
616
610
|
|
|
617
611
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
618
612
|
|
|
613
|
+
//import apiService from './apiService';
|
|
619
614
|
function AuthorizationComponent(_ref) {
|
|
620
615
|
var children = _ref.children,
|
|
621
616
|
setCurrentUser = _ref.setCurrentUser,
|
|
@@ -636,7 +631,7 @@ function AuthorizationComponent(_ref) {
|
|
|
636
631
|
case 0:
|
|
637
632
|
setLoaded(true);
|
|
638
633
|
_context.next = 3;
|
|
639
|
-
return (
|
|
634
|
+
return apiService().GetCurrentUser();
|
|
640
635
|
|
|
641
636
|
case 3:
|
|
642
637
|
usr = _context.sent;
|
|
@@ -676,7 +671,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
676
671
|
Object.defineProperty(exports, "__esModule", {
|
|
677
672
|
value: true
|
|
678
673
|
});
|
|
679
|
-
exports
|
|
674
|
+
exports.authService = void 0;
|
|
680
675
|
|
|
681
676
|
var _react = _interopRequireDefault(require("react"));
|
|
682
677
|
|
|
@@ -859,14 +854,13 @@ var authService = function authService() {
|
|
|
859
854
|
};
|
|
860
855
|
};
|
|
861
856
|
|
|
862
|
-
|
|
863
|
-
exports["default"] = _default;
|
|
857
|
+
exports.authService = authService;
|
|
864
858
|
"use strict";
|
|
865
859
|
|
|
866
860
|
Object.defineProperty(exports, "__esModule", {
|
|
867
861
|
value: true
|
|
868
862
|
});
|
|
869
|
-
exports
|
|
863
|
+
exports.Helper = void 0;
|
|
870
864
|
|
|
871
865
|
var _react = _interopRequireDefault(require("react"));
|
|
872
866
|
|
|
@@ -880,8 +874,7 @@ var Helper = function Helper() {
|
|
|
880
874
|
};
|
|
881
875
|
};
|
|
882
876
|
|
|
883
|
-
|
|
884
|
-
exports["default"] = _default;
|
|
877
|
+
exports.Helper = Helper;
|
|
885
878
|
"use strict";
|
|
886
879
|
|
|
887
880
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
@@ -889,7 +882,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
889
882
|
Object.defineProperty(exports, "__esModule", {
|
|
890
883
|
value: true
|
|
891
884
|
});
|
|
892
|
-
exports
|
|
885
|
+
exports.signInValidator = void 0;
|
|
893
886
|
|
|
894
887
|
var _react = _interopRequireWildcard(require("react"));
|
|
895
888
|
|
|
@@ -994,14 +987,13 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
994
987
|
};
|
|
995
988
|
}();
|
|
996
989
|
|
|
997
|
-
|
|
998
|
-
exports["default"] = _default;
|
|
990
|
+
exports.signInValidator = signInValidator;
|
|
999
991
|
"use strict";
|
|
1000
992
|
|
|
1001
993
|
Object.defineProperty(exports, "__esModule", {
|
|
1002
994
|
value: true
|
|
1003
995
|
});
|
|
1004
|
-
exports
|
|
996
|
+
exports.Slug = void 0;
|
|
1005
997
|
|
|
1006
998
|
var Slug = function Slug(slug) {
|
|
1007
999
|
var index = slug.lastIndexOf("-") + 1;
|
|
@@ -1014,14 +1006,13 @@ var Slug = function Slug(slug) {
|
|
|
1014
1006
|
return null;
|
|
1015
1007
|
};
|
|
1016
1008
|
|
|
1017
|
-
|
|
1018
|
-
exports["default"] = _default;
|
|
1009
|
+
exports.Slug = Slug;
|
|
1019
1010
|
"use strict";
|
|
1020
1011
|
|
|
1021
1012
|
Object.defineProperty(exports, "__esModule", {
|
|
1022
1013
|
value: true
|
|
1023
1014
|
});
|
|
1024
|
-
exports
|
|
1015
|
+
exports.storeWithExpiry = void 0;
|
|
1025
1016
|
|
|
1026
1017
|
var storeWithExpiry = function storeWithExpiry() {
|
|
1027
1018
|
return {
|
|
@@ -1053,5 +1044,4 @@ var storeWithExpiry = function storeWithExpiry() {
|
|
|
1053
1044
|
};
|
|
1054
1045
|
};
|
|
1055
1046
|
|
|
1056
|
-
|
|
1057
|
-
exports["default"] = _default;
|
|
1047
|
+
exports.storeWithExpiry = storeWithExpiry;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,9 +10,14 @@
|
|
|
10
10
|
"author": "zuechb",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
+
"next": "^12.2.0",
|
|
13
14
|
"react": "^18.2.0",
|
|
14
15
|
"react-dom": "^18.2.0",
|
|
15
|
-
"
|
|
16
|
+
"axios": "^0.27.2",
|
|
17
|
+
"js-file-download": "^0.4.12",
|
|
18
|
+
"nookies": "^2.5.2",
|
|
19
|
+
"next-cookies": "^2.0.3",
|
|
20
|
+
"querystring": "^0.2.1"
|
|
16
21
|
},
|
|
17
22
|
"devDependencies": {
|
|
18
23
|
"@babel/cli": "^7.1.5",
|
|
@@ -23,6 +28,11 @@
|
|
|
23
28
|
"react-dom": "^18.2.0"
|
|
24
29
|
},
|
|
25
30
|
"dependencies": {
|
|
26
|
-
"
|
|
31
|
+
"axios": "^0.27.2",
|
|
32
|
+
"js-file-download": "^0.4.12",
|
|
33
|
+
"next": "^12.2.0",
|
|
34
|
+
"next-cookies": "^2.0.3",
|
|
35
|
+
"nookies": "^2.5.2",
|
|
36
|
+
"querystring": "^0.2.1"
|
|
27
37
|
}
|
|
28
38
|
}
|
|
@@ -3,7 +3,7 @@ import querystring from 'querystring';
|
|
|
3
3
|
import fileDownload from 'js-file-download';
|
|
4
4
|
import cookies from 'next-cookies';
|
|
5
5
|
import { setCookie, destroyCookie } from 'nookies';
|
|
6
|
-
import Helper from "./helper";
|
|
6
|
+
// import Helper from "./helper";
|
|
7
7
|
|
|
8
8
|
const setupDefaultOptions = async (ctx = {}) => {
|
|
9
9
|
|
|
@@ -87,7 +87,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const apiService = (ctx = {}) => {
|
|
90
|
+
export const apiService = (ctx = {}) => {
|
|
91
91
|
|
|
92
92
|
let env = process.env.STAGE;
|
|
93
93
|
if (env == "development")
|
|
@@ -248,6 +248,4 @@ const apiService = (ctx = {}) => {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export default apiService;
|
|
251
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { destroyCookie } from 'nookies';
|
|
3
3
|
|
|
4
|
-
const authService = () => {
|
|
4
|
+
export const authService = () => {
|
|
5
5
|
|
|
6
6
|
return {
|
|
7
7
|
|
|
@@ -105,6 +105,4 @@ const authService = () => {
|
|
|
105
105
|
|
|
106
106
|
},
|
|
107
107
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export default authService;
|
|
108
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import apiService from './apiService';
|
|
2
|
+
//import apiService from './apiService';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function AuthorizationComponent({children, setCurrentUser, userLoaded, isLoading}) {
|
|
5
5
|
|
|
6
6
|
const [loaded, setLoaded] = useState(false);
|
|
7
7
|
const validateUserSignedIn = async () => {
|
package/src/services/helper.js
CHANGED
|
@@ -3,7 +3,7 @@ import axios from 'axios';
|
|
|
3
3
|
import querystring from "querystring";
|
|
4
4
|
import { setCookie } from 'nookies';
|
|
5
5
|
|
|
6
|
-
const signInValidator = async (queryCode) => {
|
|
6
|
+
export const signInValidator = async (queryCode) => {
|
|
7
7
|
|
|
8
8
|
let codeVerifier = window.localStorage.getItem("verifier");
|
|
9
9
|
if (queryCode != null && codeVerifier != null)
|
|
@@ -63,6 +63,4 @@ const signInValidator = async (queryCode) => {
|
|
|
63
63
|
window.location.href = "/";
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default signInValidator;
|
|
66
|
+
}
|
package/src/services/slug.js
CHANGED