authscape 1.0.430 → 1.0.432
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 +14 -5
- package/package.json +1 -1
- package/src/components/AuthScapeApp.js +15 -2
package/index.js
CHANGED
|
@@ -31,6 +31,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
31
31
|
function AuthScapeApp(_ref) {
|
|
32
32
|
var Component = _ref.Component,
|
|
33
33
|
layout = _ref.layout,
|
|
34
|
+
loadingLayout = _ref.loadingLayout,
|
|
34
35
|
pageProps = _ref.pageProps,
|
|
35
36
|
_ref$muiTheme = _ref.muiTheme,
|
|
36
37
|
muiTheme = _ref$muiTheme === void 0 ? {} : _ref$muiTheme,
|
|
@@ -42,10 +43,14 @@ function AuthScapeApp(_ref) {
|
|
|
42
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
44
|
frontEndLoadedState = _useState2[0],
|
|
44
45
|
setFrontEndLoadedState = _useState2[1];
|
|
45
|
-
var _useState3 = (0, _react.useState)(
|
|
46
|
+
var _useState3 = (0, _react.useState)(false),
|
|
46
47
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
isLoadingShow = _useState4[0],
|
|
49
|
+
setIsLoadingShow = _useState4[1];
|
|
50
|
+
var _useState5 = (0, _react.useState)(null),
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
signedInUserState = _useState6[0],
|
|
53
|
+
setSignedInUserState = _useState6[1];
|
|
49
54
|
var loadingAuth = (0, _react.useRef)(false);
|
|
50
55
|
var frontEndLoaded = (0, _react.useRef)(false);
|
|
51
56
|
var signedInUser = (0, _react.useRef)(null);
|
|
@@ -185,6 +190,9 @@ function AuthScapeApp(_ref) {
|
|
|
185
190
|
authService().login();
|
|
186
191
|
}
|
|
187
192
|
}, [signedInUserState, enforceLoggedIn, frontEndLoadedState]);
|
|
193
|
+
var setIsLoading = function setIsLoading(isLoading) {
|
|
194
|
+
setIsLoadingShow(isLoading);
|
|
195
|
+
};
|
|
188
196
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
|
|
189
197
|
name: "viewport",
|
|
190
198
|
content: "width=device-width, initial-scale=0.86, maximum-scale=5.0, minimum-scale=0.86"
|
|
@@ -202,8 +210,9 @@ function AuthScapeApp(_ref) {
|
|
|
202
210
|
}), layout == null && /*#__PURE__*/_react["default"].createElement(Component, _extends({}, pageProps, {
|
|
203
211
|
currentUser: signedInUser.current,
|
|
204
212
|
toast: _reactToastify.toast,
|
|
205
|
-
loadedUser: frontEndLoadedState
|
|
206
|
-
|
|
213
|
+
loadedUser: frontEndLoadedState,
|
|
214
|
+
setIsLoading: setIsLoading
|
|
215
|
+
}))), /*#__PURE__*/_react["default"].createElement(_reactToastify.ToastContainer, null)), loadingLayout && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, loadingLayout(isLoadingShow)), frontEndLoaded.current && process.env.microsoftClarityTrackingCode != null && process.env.staging == "production" && /*#__PURE__*/_react["default"].createElement("script", {
|
|
207
216
|
dangerouslySetInnerHTML: {
|
|
208
217
|
__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 + "\");"
|
|
209
218
|
}
|
package/package.json
CHANGED
|
@@ -8,10 +8,12 @@ import querystring from "query-string";
|
|
|
8
8
|
import { setCookie } from 'nookies'
|
|
9
9
|
// import { authService, apiService, setupOEMProps, OEMStyleSheet } from 'authscape';
|
|
10
10
|
|
|
11
|
-
export function AuthScapeApp ({Component, layout, pageProps, muiTheme = {}, enforceLoggedIn = false, enableAuth = true}) {
|
|
11
|
+
export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiTheme = {}, enforceLoggedIn = false, enableAuth = true}) {
|
|
12
12
|
|
|
13
13
|
const [frontEndLoadedState, setFrontEndLoadedState] = useState(false);
|
|
14
14
|
|
|
15
|
+
const [isLoadingShow, setIsLoadingShow] = useState(false);
|
|
16
|
+
|
|
15
17
|
const [signedInUserState, setSignedInUserState] = useState(null);
|
|
16
18
|
|
|
17
19
|
const loadingAuth = useRef(false);
|
|
@@ -142,6 +144,11 @@ export function AuthScapeApp ({Component, layout, pageProps, muiTheme = {}, enfo
|
|
|
142
144
|
|
|
143
145
|
}, [signedInUserState, enforceLoggedIn, frontEndLoadedState]);
|
|
144
146
|
|
|
147
|
+
|
|
148
|
+
const setIsLoading = (isLoading) => {
|
|
149
|
+
setIsLoadingShow(isLoading);
|
|
150
|
+
}
|
|
151
|
+
|
|
145
152
|
return (
|
|
146
153
|
<>
|
|
147
154
|
<Head>
|
|
@@ -163,7 +170,7 @@ export function AuthScapeApp ({Component, layout, pageProps, muiTheme = {}, enfo
|
|
|
163
170
|
})}
|
|
164
171
|
|
|
165
172
|
{layout == null &&
|
|
166
|
-
<Component {...pageProps} currentUser={signedInUser.current} toast={toast} loadedUser={frontEndLoadedState} />
|
|
173
|
+
<Component {...pageProps} currentUser={signedInUser.current} toast={toast} loadedUser={frontEndLoadedState} setIsLoading={setIsLoading} />
|
|
167
174
|
}
|
|
168
175
|
</>
|
|
169
176
|
}
|
|
@@ -171,6 +178,12 @@ export function AuthScapeApp ({Component, layout, pageProps, muiTheme = {}, enfo
|
|
|
171
178
|
|
|
172
179
|
</ThemeProvider>
|
|
173
180
|
|
|
181
|
+
{loadingLayout &&
|
|
182
|
+
<>
|
|
183
|
+
{loadingLayout(isLoadingShow)}
|
|
184
|
+
</>
|
|
185
|
+
}
|
|
186
|
+
|
|
174
187
|
{(frontEndLoaded.current && process.env.microsoftClarityTrackingCode != null && process.env.staging == "production") &&
|
|
175
188
|
<script
|
|
176
189
|
dangerouslySetInnerHTML={{
|