authscape 1.0.182 → 1.0.188
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
CHANGED
|
@@ -50,8 +50,8 @@ function AuthScapeApp(_ref) {
|
|
|
50
50
|
|
|
51
51
|
(0, _react.useEffect)(function () {
|
|
52
52
|
if (loadedUser) {
|
|
53
|
-
if (process.env.
|
|
54
|
-
init(process.env.
|
|
53
|
+
if (process.env.googleAnalytics4 != null) {
|
|
54
|
+
init(process.env.googleAnalytics4);
|
|
55
55
|
}
|
|
56
56
|
if (router.query.r != null) {
|
|
57
57
|
localStorage.setItem("ref", router.query.r);
|
|
@@ -72,7 +72,7 @@ function AuthScapeApp(_ref) {
|
|
|
72
72
|
theme: muiTheme
|
|
73
73
|
}, loadingLogin && /*#__PURE__*/_react["default"].createElement(_material.Box, null, "Please wait. Loading..."), !loadingLogin && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(AuthorizationComponent, {
|
|
74
74
|
setCurrentUser: setCurrentUser,
|
|
75
|
-
isEnabled: process.env.
|
|
75
|
+
isEnabled: process.env.enableAuth,
|
|
76
76
|
userLoaded: function userLoaded() {
|
|
77
77
|
setLoadedUser(true);
|
|
78
78
|
if (onAuthenticationLoaded != null) {
|
|
@@ -93,9 +93,9 @@ function AuthScapeApp(_ref) {
|
|
|
93
93
|
open: isLoading
|
|
94
94
|
}, /*#__PURE__*/_react["default"].createElement(_CircularProgress["default"], {
|
|
95
95
|
color: "inherit"
|
|
96
|
-
})), /*#__PURE__*/_react["default"].createElement(_reactToastify.ToastContainer, null))), process.env.
|
|
96
|
+
})), /*#__PURE__*/_react["default"].createElement(_reactToastify.ToastContainer, null))), process.env.microsoftClarityTrackingCode != null && /*#__PURE__*/_react["default"].createElement("script", {
|
|
97
97
|
dangerouslySetInnerHTML: {
|
|
98
|
-
__html: "\n (function(c,l,a,r,i,t,y){\n c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) };\n t=l.createElement(r);\n t.async=1;\n t.src=\"https://www.clarity.ms/tag/\"+i;\n y=l.getElementsByTagName(r)[0];\n y.parentNode.insertBefore(t,y);\n })(window, document, \"clarity\", \"script\", \"" + process.env.
|
|
98
|
+
__html: "\n (function(c,l,a,r,i,t,y){\n c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) };\n t=l.createElement(r);\n t.async=1;\n t.src=\"https://www.clarity.ms/tag/\"+i;\n y=l.getElementsByTagName(r)[0];\n y.parentNode.insertBefore(t,y);\n })(window, document, \"clarity\", \"script\", \"" + process.env.microsoftClarityTrackingCode + "\");"
|
|
99
99
|
}
|
|
100
100
|
}));
|
|
101
101
|
}
|
|
@@ -1375,7 +1375,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
1375
1375
|
elements: elements,
|
|
1376
1376
|
redirect: "if_required"
|
|
1377
1377
|
// confirmParams: {
|
|
1378
|
-
// return_url: process.env.
|
|
1378
|
+
// return_url: process.env.websiteBaseUri + '/confirmSetup?redirectUrl=' + encodeURIComponent(window.location.search),
|
|
1379
1379
|
// },
|
|
1380
1380
|
});
|
|
1381
1381
|
case 7:
|
|
@@ -1432,7 +1432,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
|
|
|
1432
1432
|
elements: elements,
|
|
1433
1433
|
redirect: "if_required",
|
|
1434
1434
|
confirmParams: {
|
|
1435
|
-
return_url: process.env.
|
|
1435
|
+
return_url: process.env.websiteBaseUri + '/confirmPayment?redirectUrl=' + encodeURIComponent(window.location.search)
|
|
1436
1436
|
}
|
|
1437
1437
|
});
|
|
1438
1438
|
case 37:
|
|
@@ -1928,7 +1928,7 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
1928
1928
|
accessToken = (0, _nookies.parseCookies)().access_token || '';
|
|
1929
1929
|
refreshToken = (0, _nookies.parseCookies)().refresh_token || '';
|
|
1930
1930
|
_context2.next = 4;
|
|
1931
|
-
return instance.post(process.env.
|
|
1931
|
+
return instance.post(process.env.authorityUri + "/connect/token", _queryString["default"].stringify({
|
|
1932
1932
|
grant_type: 'refresh_token',
|
|
1933
1933
|
client_id: process.env.client_id,
|
|
1934
1934
|
client_secret: process.env.client_secret,
|
|
@@ -1950,7 +1950,7 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
1950
1950
|
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
1951
1951
|
maxAge: 2147483647,
|
|
1952
1952
|
path: '/',
|
|
1953
|
-
domain: process.env.
|
|
1953
|
+
domain: process.env.cookieDomain,
|
|
1954
1954
|
secure: true
|
|
1955
1955
|
});
|
|
1956
1956
|
case 9:
|
|
@@ -1958,7 +1958,7 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
1958
1958
|
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
1959
1959
|
maxAge: 2147483647,
|
|
1960
1960
|
path: '/',
|
|
1961
|
-
domain: process.env.
|
|
1961
|
+
domain: process.env.cookieDomain,
|
|
1962
1962
|
secure: true
|
|
1963
1963
|
});
|
|
1964
1964
|
case 11:
|
|
@@ -1966,7 +1966,7 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
1966
1966
|
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
1967
1967
|
maxAge: 2147483647,
|
|
1968
1968
|
path: '/',
|
|
1969
|
-
domain: process.env.
|
|
1969
|
+
domain: process.env.cookieDomain,
|
|
1970
1970
|
secure: true
|
|
1971
1971
|
});
|
|
1972
1972
|
case 13:
|
|
@@ -1981,11 +1981,11 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
1981
1981
|
}();
|
|
1982
1982
|
var apiService = function apiService() {
|
|
1983
1983
|
var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1984
|
-
var env = process.env.
|
|
1984
|
+
var env = process.env.stage;
|
|
1985
1985
|
if (env == "development") {
|
|
1986
1986
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
1987
1987
|
}
|
|
1988
|
-
var baseUri = process.env.
|
|
1988
|
+
var baseUri = process.env.apiUri + "/api";
|
|
1989
1989
|
var instance = _axios["default"].create({
|
|
1990
1990
|
baseURL: baseUri,
|
|
1991
1991
|
//timeout: 10000,
|
|
@@ -2029,17 +2029,17 @@ var apiService = function apiService() {
|
|
|
2029
2029
|
(0, _nookies.destroyCookie)(null, "access_token", {
|
|
2030
2030
|
maxAge: 2147483647,
|
|
2031
2031
|
path: '/',
|
|
2032
|
-
domain: process.env.
|
|
2032
|
+
domain: process.env.cookieDomain
|
|
2033
2033
|
});
|
|
2034
2034
|
(0, _nookies.destroyCookie)(null, "refresh_token", {
|
|
2035
2035
|
maxAge: 2147483647,
|
|
2036
2036
|
path: '/',
|
|
2037
|
-
domain: process.env.
|
|
2037
|
+
domain: process.env.cookieDomain
|
|
2038
2038
|
});
|
|
2039
2039
|
(0, _nookies.destroyCookie)(null, "expires_in", {
|
|
2040
2040
|
maxAge: 2147483647,
|
|
2041
2041
|
path: '/',
|
|
2042
|
-
domain: process.env.
|
|
2042
|
+
domain: process.env.cookieDomain
|
|
2043
2043
|
});
|
|
2044
2044
|
}
|
|
2045
2045
|
return _context3.abrupt("return", Promise.reject(error));
|
|
@@ -2441,7 +2441,7 @@ var authService = function authService() {
|
|
|
2441
2441
|
challenge = _context2.sent;
|
|
2442
2442
|
window.localStorage.setItem("verifier", verifier);
|
|
2443
2443
|
redirectUri = window.location.origin + "/signin-oidc";
|
|
2444
|
-
loginUri = process.env.
|
|
2444
|
+
loginUri = process.env.authorityUri + "/connect/authorize?response_type=code&state=" + state + "&client_id=" + process.env.client_id + "&scope=email%20openid%20offline_access%20profile%20api1&redirect_uri=" + redirectUri + "&code_challenge=" + challenge + "&code_challenge_method=S256";
|
|
2445
2445
|
if (deviceId) {
|
|
2446
2446
|
loginUri += "&deviceId=" + deviceId; // will be for chrome extention and mobile apps later
|
|
2447
2447
|
}
|
|
@@ -2460,7 +2460,7 @@ var authService = function authService() {
|
|
|
2460
2460
|
}(),
|
|
2461
2461
|
signUp: function signUp() {
|
|
2462
2462
|
var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2463
|
-
var AuthUri = process.env.
|
|
2463
|
+
var AuthUri = process.env.authorityUri;
|
|
2464
2464
|
var url = "";
|
|
2465
2465
|
if (redirectUrl == null) {
|
|
2466
2466
|
url = AuthUri + "/Identity/Account/Register?returnUrl=" + window.location.href;
|
|
@@ -2476,7 +2476,7 @@ var authService = function authService() {
|
|
|
2476
2476
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2477
2477
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2478
2478
|
case 0:
|
|
2479
|
-
window.location.href = process.env.
|
|
2479
|
+
window.location.href = process.env.authorityUri + "/Identity/Account/Manage";
|
|
2480
2480
|
case 1:
|
|
2481
2481
|
case "end":
|
|
2482
2482
|
return _context3.stop();
|
|
@@ -2498,8 +2498,8 @@ var authService = function authService() {
|
|
|
2498
2498
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2499
2499
|
case 0:
|
|
2500
2500
|
redirectUri = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
|
|
2501
|
-
AuthUri = process.env.
|
|
2502
|
-
cookieDomain = process.env.
|
|
2501
|
+
AuthUri = process.env.authorityUri;
|
|
2502
|
+
cookieDomain = process.env.cookieDomain;
|
|
2503
2503
|
(0, _nookies.destroyCookie)({}, "access_token", {
|
|
2504
2504
|
maxAge: 2147483647,
|
|
2505
2505
|
path: '/',
|
|
@@ -2576,13 +2576,13 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
2576
2576
|
code_verifier: codeVerifier
|
|
2577
2577
|
});
|
|
2578
2578
|
_context.next = 6;
|
|
2579
|
-
return _axios["default"].post(process.env.
|
|
2579
|
+
return _axios["default"].post(process.env.authorityUri + '/connect/token', queryString, {
|
|
2580
2580
|
headers: headers
|
|
2581
2581
|
});
|
|
2582
2582
|
case 6:
|
|
2583
2583
|
response = _context.sent;
|
|
2584
2584
|
window.localStorage.removeItem("verifier");
|
|
2585
|
-
domain = process.env.
|
|
2585
|
+
domain = process.env.cookieDomain;
|
|
2586
2586
|
_context.next = 11;
|
|
2587
2587
|
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
2588
2588
|
maxAge: 2147483647,
|
package/package.json
CHANGED
|
@@ -18,9 +18,9 @@ export function AuthScapeApp({Component, pageProps, muiTheme = null, onAuthentic
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
if (loadedUser)
|
|
20
20
|
{
|
|
21
|
-
if (process.env.
|
|
21
|
+
if (process.env.googleAnalytics4 != null)
|
|
22
22
|
{
|
|
23
|
-
init(process.env.
|
|
23
|
+
init(process.env.googleAnalytics4);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (router.query.r != null)
|
|
@@ -58,7 +58,7 @@ export function AuthScapeApp({Component, pageProps, muiTheme = null, onAuthentic
|
|
|
58
58
|
|
|
59
59
|
{!loadingLogin &&
|
|
60
60
|
<>
|
|
61
|
-
<AuthorizationComponent setCurrentUser={setCurrentUser} isEnabled={process.env.
|
|
61
|
+
<AuthorizationComponent setCurrentUser={setCurrentUser} isEnabled={process.env.enableAuth} userLoaded={() => {
|
|
62
62
|
setLoadedUser(true);
|
|
63
63
|
|
|
64
64
|
if (onAuthenticationLoaded != null)
|
|
@@ -78,7 +78,7 @@ export function AuthScapeApp({Component, pageProps, muiTheme = null, onAuthentic
|
|
|
78
78
|
}
|
|
79
79
|
</ThemeProvider>
|
|
80
80
|
|
|
81
|
-
{process.env.
|
|
81
|
+
{process.env.microsoftClarityTrackingCode != null &&
|
|
82
82
|
<script
|
|
83
83
|
dangerouslySetInnerHTML={{
|
|
84
84
|
__html: `
|
|
@@ -89,7 +89,7 @@ export function AuthScapeApp({Component, pageProps, muiTheme = null, onAuthentic
|
|
|
89
89
|
t.src="https://www.clarity.ms/tag/"+i;
|
|
90
90
|
y=l.getElementsByTagName(r)[0];
|
|
91
91
|
y.parentNode.insertBefore(t,y);
|
|
92
|
-
})(window, document, "clarity", "script", "` + process.env.
|
|
92
|
+
})(window, document, "clarity", "script", "` + process.env.microsoftClarityTrackingCode + `");`,
|
|
93
93
|
}}
|
|
94
94
|
/>
|
|
95
95
|
}
|
|
@@ -48,7 +48,7 @@ const CheckoutForm = ({payButtonText, clientSecret, onResponse, amount}) => {
|
|
|
48
48
|
elements,
|
|
49
49
|
redirect:"if_required",
|
|
50
50
|
// confirmParams: {
|
|
51
|
-
// return_url: process.env.
|
|
51
|
+
// return_url: process.env.websiteBaseUri + '/confirmSetup?redirectUrl=' + encodeURIComponent(window.location.search),
|
|
52
52
|
// },
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -103,7 +103,7 @@ const CheckoutForm = ({payButtonText, clientSecret, onResponse, amount}) => {
|
|
|
103
103
|
elements,
|
|
104
104
|
redirect:"if_required",
|
|
105
105
|
confirmParams: {
|
|
106
|
-
return_url: process.env.
|
|
106
|
+
return_url: process.env.websiteBaseUri + '/confirmPayment?redirectUrl=' + encodeURIComponent(window.location.search),
|
|
107
107
|
},
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -40,7 +40,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
40
40
|
let accessToken = parseCookies().access_token || '';
|
|
41
41
|
let refreshToken = parseCookies().refresh_token || '';
|
|
42
42
|
|
|
43
|
-
let response = await instance.post(process.env.
|
|
43
|
+
let response = await instance.post(process.env.authorityUri + "/connect/token",
|
|
44
44
|
querystring.stringify({
|
|
45
45
|
grant_type: 'refresh_token',
|
|
46
46
|
client_id: process.env.client_id,
|
|
@@ -61,7 +61,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
61
61
|
{
|
|
62
62
|
maxAge: 2147483647,
|
|
63
63
|
path: '/',
|
|
64
|
-
domain: process.env.
|
|
64
|
+
domain: process.env.cookieDomain,
|
|
65
65
|
secure: true
|
|
66
66
|
});
|
|
67
67
|
|
|
@@ -69,7 +69,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
69
69
|
{
|
|
70
70
|
maxAge: 2147483647,
|
|
71
71
|
path: '/',
|
|
72
|
-
domain: process.env.
|
|
72
|
+
domain: process.env.cookieDomain,
|
|
73
73
|
secure: true
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -77,7 +77,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
77
77
|
{
|
|
78
78
|
maxAge: 2147483647,
|
|
79
79
|
path: '/',
|
|
80
|
-
domain: process.env.
|
|
80
|
+
domain: process.env.cookieDomain,
|
|
81
81
|
secure: true
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -85,13 +85,13 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
85
85
|
|
|
86
86
|
export const apiService = (ctx = null) => {
|
|
87
87
|
|
|
88
|
-
let env = process.env.
|
|
88
|
+
let env = process.env.stage;
|
|
89
89
|
if (env == "development")
|
|
90
90
|
{
|
|
91
91
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
let baseUri = process.env.
|
|
94
|
+
let baseUri = process.env.apiUri + "/api";
|
|
95
95
|
|
|
96
96
|
const instance = axios.create({
|
|
97
97
|
baseURL: baseUri,
|
|
@@ -126,19 +126,19 @@ export const apiService = (ctx = null) => {
|
|
|
126
126
|
destroyCookie(null, "access_token", {
|
|
127
127
|
maxAge: 2147483647,
|
|
128
128
|
path: '/',
|
|
129
|
-
domain: process.env.
|
|
129
|
+
domain: process.env.cookieDomain
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
destroyCookie(null, "refresh_token", {
|
|
133
133
|
maxAge: 2147483647,
|
|
134
134
|
path: '/',
|
|
135
|
-
domain: process.env.
|
|
135
|
+
domain: process.env.cookieDomain
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
destroyCookie(null, "expires_in", {
|
|
139
139
|
maxAge: 2147483647,
|
|
140
140
|
path: '/',
|
|
141
|
-
domain: process.env.
|
|
141
|
+
domain: process.env.cookieDomain
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -49,7 +49,7 @@ export const authService = () => {
|
|
|
49
49
|
window.localStorage.setItem("verifier", verifier);
|
|
50
50
|
|
|
51
51
|
let redirectUri = window.location.origin + "/signin-oidc";
|
|
52
|
-
let loginUri = process.env.
|
|
52
|
+
let loginUri = process.env.authorityUri + "/connect/authorize?response_type=code&state=" + state + "&client_id=" + process.env.client_id + "&scope=email%20openid%20offline_access%20profile%20api1&redirect_uri=" + redirectUri + "&code_challenge=" + challenge + "&code_challenge_method=S256";
|
|
53
53
|
|
|
54
54
|
if (deviceId)
|
|
55
55
|
{
|
|
@@ -60,7 +60,7 @@ export const authService = () => {
|
|
|
60
60
|
},
|
|
61
61
|
signUp: (redirectUrl = null) => {
|
|
62
62
|
|
|
63
|
-
let AuthUri = process.env.
|
|
63
|
+
let AuthUri = process.env.authorityUri;
|
|
64
64
|
|
|
65
65
|
let url = "";
|
|
66
66
|
if (redirectUrl == null)
|
|
@@ -78,13 +78,13 @@ export const authService = () => {
|
|
|
78
78
|
},
|
|
79
79
|
manageAccount: async () => {
|
|
80
80
|
|
|
81
|
-
window.location.href = process.env.
|
|
81
|
+
window.location.href = process.env.authorityUri + "/Identity/Account/Manage";
|
|
82
82
|
|
|
83
83
|
},
|
|
84
84
|
logout: async (redirectUri = null) => {
|
|
85
85
|
|
|
86
|
-
let AuthUri = process.env.
|
|
87
|
-
let cookieDomain = process.env.
|
|
86
|
+
let AuthUri = process.env.authorityUri;
|
|
87
|
+
let cookieDomain = process.env.cookieDomain;
|
|
88
88
|
|
|
89
89
|
destroyCookie({}, "access_token", {
|
|
90
90
|
maxAge: 2147483647,
|
|
@@ -19,13 +19,13 @@ export const signInValidator = async (queryCode) => {
|
|
|
19
19
|
code_verifier: codeVerifier
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
let response = await axios.post(process.env.
|
|
22
|
+
let response = await axios.post(process.env.authorityUri + '/connect/token', queryString, {
|
|
23
23
|
headers: headers
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
window.localStorage.removeItem("verifier");
|
|
27
27
|
|
|
28
|
-
let domain = process.env.
|
|
28
|
+
let domain = process.env.cookieDomain;
|
|
29
29
|
|
|
30
30
|
await setCookie(null, "access_token", response.data.access_token,
|
|
31
31
|
{
|