@frontegg/react-hooks 6.176.0 → 6.178.0-alpha.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/FronteggProvider/FronteggProvider.d.ts +12 -0
- package/FronteggProvider/FronteggProvider.js +134 -0
- package/FronteggProvider/index.d.ts +1 -12
- package/FronteggProvider/index.js +1 -133
- package/FronteggStoreContext/FronteggStoreContext.d.ts +9 -0
- package/FronteggStoreContext/FronteggStoreContext.js +16 -0
- package/FronteggStoreContext/index.d.ts +1 -13
- package/FronteggStoreContext/index.js +1 -14
- package/audits/auditLogs.d.ts +2 -4
- package/audits/auditLogs.js +8 -6
- package/audits/auditsMetadata.d.ts +2 -4
- package/audits/auditsMetadata.js +8 -6
- package/audits/hooks.d.ts +0 -8
- package/audits/hooks.js +6 -30
- package/auth/acceptInvitation.js +10 -5
- package/auth/activateAccount.js +10 -4
- package/auth/{MSP/allAccounts.d.ts → allAccounts.d.ts} +2 -4
- package/auth/allAccounts.js +20 -0
- package/auth/apiTokens.d.ts +0 -2
- package/auth/apiTokens.js +8 -6
- package/auth/customLogin.d.ts +2 -5
- package/auth/customLogin.js +10 -11
- package/auth/entitlements.d.ts +14 -14
- package/auth/entitlements.js +25 -21
- package/auth/forgotPassword.d.ts +0 -2
- package/auth/forgotPassword.js +8 -6
- package/auth/groups.d.ts +0 -4
- package/auth/groups.js +12 -13
- package/auth/hooks.d.ts +9 -11
- package/auth/hooks.js +27 -58
- package/auth/impersonate.d.ts +0 -2
- package/auth/impersonate.js +7 -6
- package/auth/index.d.ts +14 -17
- package/auth/index.js +15 -18
- package/auth/login.d.ts +1 -1
- package/auth/login.js +13 -4
- package/auth/mfa.d.ts +1 -1
- package/auth/mfa.js +13 -4
- package/auth/passkeys.d.ts +1 -4
- package/auth/passkeys.js +7 -6
- package/auth/profile.d.ts +2 -4
- package/auth/profile.js +9 -8
- package/auth/provisioning.d.ts +1 -3
- package/auth/provisioning.js +7 -6
- package/auth/resetPhoneNumber.d.ts +1 -3
- package/auth/resetPhoneNumber.js +7 -6
- package/auth/roles.d.ts +1 -3
- package/auth/roles.js +7 -6
- package/auth/security/index.d.ts +4 -0
- package/auth/security/index.js +4 -0
- package/auth/security/restrictions.d.ts +0 -2
- package/auth/security/restrictions.js +10 -10
- package/auth/security/securityCenter.d.ts +1 -4
- package/auth/security/securityCenter.js +8 -6
- package/auth/security/securityPolicy.d.ts +5 -11
- package/auth/security/securityPolicy.js +19 -30
- package/auth/security/sessionsPolicy.d.ts +1 -3
- package/auth/security/sessionsPolicy.js +8 -6
- package/auth/sessions.d.ts +1 -3
- package/auth/sessions.js +7 -6
- package/auth/signup.d.ts +1 -1
- package/auth/signup.js +13 -4
- package/auth/sms.d.ts +1 -4
- package/auth/sms.js +7 -6
- package/auth/socialLogin.d.ts +1 -1
- package/auth/socialLogin.js +10 -4
- package/auth/sso.d.ts +1 -1
- package/auth/sso.js +10 -4
- package/auth/{stepUp/stepUp.d.ts → stepUp.d.ts} +0 -2
- package/auth/{stepUp/stepUp.js → stepUp.js} +9 -6
- package/auth/team.d.ts +9 -1
- package/auth/team.js +22 -4
- package/auth/tenants.d.ts +1 -3
- package/auth/tenants.js +8 -6
- package/common/CustomComponentHolder.js +3 -1
- package/common/index.js +3 -3
- package/connectivity/hooks.d.ts +2 -5
- package/connectivity/hooks.js +6 -9
- package/index.d.ts +2 -2
- package/index.js +3 -3
- package/node/FronteggProvider/FronteggProvider.js +140 -0
- package/node/FronteggProvider/index.js +9 -134
- package/node/FronteggStoreContext/FronteggStoreContext.js +26 -0
- package/node/FronteggStoreContext/index.js +11 -35
- package/node/audits/auditLogs.js +8 -6
- package/node/audits/auditsMetadata.js +8 -6
- package/node/audits/hooks.js +7 -34
- package/node/auth/acceptInvitation.js +7 -5
- package/node/auth/activateAccount.js +7 -4
- package/node/auth/allAccounts.js +27 -0
- package/node/auth/apiTokens.js +8 -6
- package/node/auth/customLogin.js +11 -12
- package/node/auth/entitlements.js +24 -20
- package/node/auth/forgotPassword.js +8 -6
- package/node/auth/groups.js +12 -12
- package/node/auth/hooks.js +27 -61
- package/node/auth/impersonate.js +7 -6
- package/node/auth/index.js +84 -120
- package/node/auth/login.js +10 -4
- package/node/auth/mfa.js +10 -4
- package/node/auth/passkeys.js +7 -6
- package/node/auth/profile.js +10 -9
- package/node/auth/provisioning.js +7 -6
- package/node/auth/resetPhoneNumber.js +7 -6
- package/node/auth/roles.js +7 -6
- package/node/auth/security/index.js +49 -0
- package/node/auth/security/restrictions.js +10 -10
- package/node/auth/security/securityCenter.js +8 -6
- package/node/auth/security/securityPolicy.js +16 -30
- package/node/auth/security/sessionsPolicy.js +8 -6
- package/node/auth/sessions.js +7 -6
- package/node/auth/signup.js +10 -4
- package/node/auth/sms.js +7 -6
- package/node/auth/socialLogin.js +7 -4
- package/node/auth/sso.js +7 -4
- package/node/auth/{stepUp/stepUp.js → stepUp.js} +10 -7
- package/node/auth/team.js +25 -4
- package/node/auth/tenants.js +8 -6
- package/node/common/CustomComponentHolder.js +3 -1
- package/node/common/index.js +2 -2
- package/node/connectivity/hooks.js +5 -8
- package/node/index.js +16 -16
- package/node/subscriptions/hooks.js +84 -51
- package/node/vendor/hooks.js +5 -6
- package/package.json +3 -3
- package/subscriptions/hooks.d.ts +32 -10
- package/subscriptions/hooks.js +81 -49
- package/vendor/hooks.d.ts +0 -1
- package/vendor/hooks.js +9 -7
- package/auth/MSP/allAccounts.js +0 -15
- package/auth/stepUp/index.d.ts +0 -2
- package/auth/stepUp/index.js +0 -2
- package/auth/stepUp/interfaces.d.ts +0 -2
- package/auth/stepUp/interfaces.js +0 -1
- package/node/auth/MSP/allAccounts.js +0 -24
- package/node/auth/stepUp/index.js +0 -27
- package/node/auth/stepUp/interfaces.js +0 -5
- package/node/tests/hooks.tsc-test.js +0 -318
- package/tests/hooks.tsc-test.js +0 -317
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FronteggStoreProvider = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _reduxStore = require("@frontegg/redux-store");
|
|
12
|
+
var _restApi = require("@frontegg/rest-api");
|
|
13
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
14
|
+
var _auth = require("../auth");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["authenticatedUrl", "signUpSuccessUrl"];
|
|
17
|
+
const defaultSetLoading = loading => {
|
|
18
|
+
if (loading) {
|
|
19
|
+
document.body.classList.add('frontegg-loading');
|
|
20
|
+
} else {
|
|
21
|
+
document.body.classList.remove('frontegg-loading');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const HideChildrenIfFronteggRoutes = ({
|
|
25
|
+
children,
|
|
26
|
+
basename
|
|
27
|
+
}) => {
|
|
28
|
+
const routes = (0, _auth.useAuthRoutes)();
|
|
29
|
+
const uriRef = (0, _react.useRef)(window.location.pathname);
|
|
30
|
+
const animationFrameRef = (0, _react.useRef)(0);
|
|
31
|
+
const [uri, setUri] = (0, _react.useState)(window.location.pathname);
|
|
32
|
+
const checker = (0, _react.useCallback)(() => {
|
|
33
|
+
if (uriRef.current !== window.location.pathname) {
|
|
34
|
+
uriRef.current = window.location.pathname;
|
|
35
|
+
setUri(document.location.pathname);
|
|
36
|
+
}
|
|
37
|
+
animationFrameRef.current = window.requestAnimationFrame(checker);
|
|
38
|
+
}, []);
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
document.addEventListener('frontegg_onRedirectTo_fired', () => {
|
|
41
|
+
if (uriRef.current !== window.location.pathname) {
|
|
42
|
+
uriRef.current = window.location.pathname;
|
|
43
|
+
setUri(document.location.pathname);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
window.addEventListener('popstate', () => {
|
|
47
|
+
if (uriRef.current !== window.location.pathname) {
|
|
48
|
+
uriRef.current = window.location.pathname;
|
|
49
|
+
setUri(document.location.pathname);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
animationFrameRef.current = window.requestAnimationFrame(checker);
|
|
53
|
+
return () => {
|
|
54
|
+
window.cancelAnimationFrame(animationFrameRef.current);
|
|
55
|
+
};
|
|
56
|
+
}, [checker, setUri]);
|
|
57
|
+
const calculatedBasename = basename ? basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '' : '';
|
|
58
|
+
const checkRoutes = (0, _objectWithoutPropertiesLoose2.default)(routes, _excluded);
|
|
59
|
+
if (Object.values(checkRoutes).map(url => `${calculatedBasename}${url}`).indexOf(uri) !== -1) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
63
|
+
children: children
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const FronteggContent = ({
|
|
67
|
+
children,
|
|
68
|
+
app,
|
|
69
|
+
setLoading
|
|
70
|
+
}) => {
|
|
71
|
+
var _app$options, _app$options2;
|
|
72
|
+
const {
|
|
73
|
+
isLoading
|
|
74
|
+
} = (0, _auth.useAuth)();
|
|
75
|
+
const customLoginBox = !app || (app == null ? void 0 : (_app$options = app.options) == null ? void 0 : _app$options.customLoginBox) === true;
|
|
76
|
+
const isNextJS = (app == null ? void 0 : (_app$options2 = app.options) == null ? void 0 : _app$options2.framework) === 'nextjs';
|
|
77
|
+
const alwaysShowChildren = customLoginBox || isNextJS;
|
|
78
|
+
const loadingRef = (0, _react.useRef)(undefined);
|
|
79
|
+
if (isLoading !== loadingRef.current && !isNextJS) {
|
|
80
|
+
loadingRef.current = isLoading;
|
|
81
|
+
setLoading(isLoading);
|
|
82
|
+
}
|
|
83
|
+
if (alwaysShowChildren) {
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
85
|
+
children: children
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (isLoading && !isNextJS) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HideChildrenIfFronteggRoutes, {
|
|
92
|
+
basename: app == null ? void 0 : app.options.basename,
|
|
93
|
+
children: children
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const FronteggStoreProvider = props => {
|
|
97
|
+
var _app$options$contextO, _app$options3, _app$options$previewM, _app$options4, _app$options5, _app$options6;
|
|
98
|
+
const {
|
|
99
|
+
children,
|
|
100
|
+
app,
|
|
101
|
+
contextOptions,
|
|
102
|
+
setLoading = defaultSetLoading,
|
|
103
|
+
alwaysVisibleChildren
|
|
104
|
+
} = props;
|
|
105
|
+
|
|
106
|
+
// TODO: make this optionals more readable
|
|
107
|
+
const context = (_app$options$contextO = app == null ? void 0 : (_app$options3 = app.options) == null ? void 0 : _app$options3.contextOptions) != null ? _app$options$contextO : contextOptions;
|
|
108
|
+
if (!context) {
|
|
109
|
+
throw Error('contextOptions must not be null or undefined');
|
|
110
|
+
}
|
|
111
|
+
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : _app$options4.previewMode) != null ? _app$options$previewM : false;
|
|
112
|
+
const authOptions = app != null && (_app$options5 = app.options) != null && _app$options5.authOptions ? (0, _extends2.default)({}, app.options.authOptions, {
|
|
113
|
+
hostedLoginBox: app.options.hostedLoginBox
|
|
114
|
+
}) : {
|
|
115
|
+
hostedLoginBox: app == null ? void 0 : (_app$options6 = app.options) == null ? void 0 : _app$options6.hostedLoginBox
|
|
116
|
+
};
|
|
117
|
+
_restApi.ContextHolder.setContext(context);
|
|
118
|
+
const store = (0, _react.useMemo)(() => {
|
|
119
|
+
var _app$name, _app$options7;
|
|
120
|
+
return (0, _reduxStore.createStore)({
|
|
121
|
+
name: (_app$name = app == null ? void 0 : app.name) != null ? _app$name : 'default',
|
|
122
|
+
context,
|
|
123
|
+
previewMode,
|
|
124
|
+
initialState: {
|
|
125
|
+
auth: authOptions
|
|
126
|
+
},
|
|
127
|
+
urlStrategy: app == null ? void 0 : (_app$options7 = app.options) == null ? void 0 : _app$options7.urlStrategy,
|
|
128
|
+
storeHolder: app
|
|
129
|
+
});
|
|
130
|
+
}, [app, previewMode]);
|
|
131
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FronteggStoreContext.Provider, {
|
|
132
|
+
store: store,
|
|
133
|
+
children: [alwaysVisibleChildren, /*#__PURE__*/(0, _jsxRuntime.jsx)(FronteggContent, {
|
|
134
|
+
setLoading: setLoading,
|
|
135
|
+
app: app,
|
|
136
|
+
children: children
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
exports.FronteggStoreProvider = FronteggStoreProvider;
|
|
@@ -1,141 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["authenticatedUrl", "signUpSuccessUrl"];
|
|
17
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
-
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; }
|
|
19
|
-
const defaultSetLoading = loading => {
|
|
20
|
-
if (loading) {
|
|
21
|
-
document.body.classList.add('frontegg-loading');
|
|
22
|
-
} else {
|
|
23
|
-
document.body.classList.remove('frontegg-loading');
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const HideChildrenIfFronteggRoutes = ({
|
|
27
|
-
children,
|
|
28
|
-
basename
|
|
29
|
-
}) => {
|
|
30
|
-
const routes = (0, _auth.useAuthRoutes)();
|
|
31
|
-
const uriRef = (0, _react.useRef)(window.location.pathname);
|
|
32
|
-
const animationFrameRef = (0, _react.useRef)(0);
|
|
33
|
-
const [uri, setUri] = (0, _react.useState)(window.location.pathname);
|
|
34
|
-
const checker = (0, _react.useCallback)(() => {
|
|
35
|
-
if (uriRef.current !== window.location.pathname) {
|
|
36
|
-
uriRef.current = window.location.pathname;
|
|
37
|
-
setUri(document.location.pathname);
|
|
6
|
+
var _FronteggProvider = require("./FronteggProvider");
|
|
7
|
+
Object.keys(_FronteggProvider).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _FronteggProvider[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FronteggProvider[key];
|
|
38
14
|
}
|
|
39
|
-
animationFrameRef.current = window.requestAnimationFrame(checker);
|
|
40
|
-
}, []);
|
|
41
|
-
(0, _react.useEffect)(() => {
|
|
42
|
-
document.addEventListener('frontegg_onRedirectTo_fired', () => {
|
|
43
|
-
if (uriRef.current !== window.location.pathname) {
|
|
44
|
-
uriRef.current = window.location.pathname;
|
|
45
|
-
setUri(document.location.pathname);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
window.addEventListener('popstate', () => {
|
|
49
|
-
if (uriRef.current !== window.location.pathname) {
|
|
50
|
-
uriRef.current = window.location.pathname;
|
|
51
|
-
setUri(document.location.pathname);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
animationFrameRef.current = window.requestAnimationFrame(checker);
|
|
55
|
-
return () => {
|
|
56
|
-
window.cancelAnimationFrame(animationFrameRef.current);
|
|
57
|
-
};
|
|
58
|
-
}, [checker, setUri]);
|
|
59
|
-
const calculatedBasename = basename ? basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '' : '';
|
|
60
|
-
const checkRoutes = (0, _objectWithoutPropertiesLoose2.default)(routes, _excluded);
|
|
61
|
-
if (Object.values(checkRoutes).map(url => `${calculatedBasename}${url}`).indexOf(uri) !== -1) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
65
|
-
children: children
|
|
66
15
|
});
|
|
67
|
-
};
|
|
68
|
-
const FronteggContent = ({
|
|
69
|
-
children,
|
|
70
|
-
app,
|
|
71
|
-
setLoading
|
|
72
|
-
}) => {
|
|
73
|
-
var _app$options, _app$options2;
|
|
74
|
-
const {
|
|
75
|
-
isLoading
|
|
76
|
-
} = (0, _auth.useAuth)(({
|
|
77
|
-
isLoading
|
|
78
|
-
}) => ({
|
|
79
|
-
isLoading
|
|
80
|
-
}));
|
|
81
|
-
const customLoginBox = !app || (app == null ? void 0 : (_app$options = app.options) == null ? void 0 : _app$options.customLoginBox) === true;
|
|
82
|
-
const isNextJS = (app == null ? void 0 : (_app$options2 = app.options) == null ? void 0 : _app$options2.framework) === 'nextjs';
|
|
83
|
-
const alwaysShowChildren = customLoginBox || isNextJS;
|
|
84
|
-
const loadingRef = (0, _react.useRef)(undefined);
|
|
85
|
-
if (isLoading !== loadingRef.current && !isNextJS) {
|
|
86
|
-
loadingRef.current = isLoading;
|
|
87
|
-
setLoading(isLoading);
|
|
88
|
-
}
|
|
89
|
-
if (alwaysShowChildren) {
|
|
90
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
91
|
-
children: children
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if (isLoading && !isNextJS) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HideChildrenIfFronteggRoutes, {
|
|
98
|
-
basename: app == null ? void 0 : app.options.basename,
|
|
99
|
-
children: children
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
const FronteggStoreProvider = props => {
|
|
103
|
-
var _app$options$contextO, _app$options3, _app$options$previewM, _app$options4, _app$options5, _app$options6;
|
|
104
|
-
const {
|
|
105
|
-
children,
|
|
106
|
-
app,
|
|
107
|
-
contextOptions,
|
|
108
|
-
setLoading = defaultSetLoading,
|
|
109
|
-
alwaysVisibleChildren
|
|
110
|
-
} = props;
|
|
111
|
-
|
|
112
|
-
// TODO: make this optionals more readable
|
|
113
|
-
const context = (_app$options$contextO = app == null ? void 0 : (_app$options3 = app.options) == null ? void 0 : _app$options3.contextOptions) != null ? _app$options$contextO : contextOptions;
|
|
114
|
-
if (!context) {
|
|
115
|
-
throw Error('contextOptions must not be null or undefined');
|
|
116
|
-
}
|
|
117
|
-
const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : _app$options4.previewMode) != null ? _app$options$previewM : false;
|
|
118
|
-
const authOptions = app != null && (_app$options5 = app.options) != null && _app$options5.authOptions ? (0, _extends2.default)({}, app.options.authOptions, {
|
|
119
|
-
hostedLoginBox: app.options.hostedLoginBox
|
|
120
|
-
}) : {
|
|
121
|
-
hostedLoginBox: app == null ? void 0 : (_app$options6 = app.options) == null ? void 0 : _app$options6.hostedLoginBox
|
|
122
|
-
};
|
|
123
|
-
_restApi.ContextHolder.setContext(context);
|
|
124
|
-
const store = (0, _react.useMemo)(() => {
|
|
125
|
-
var _app$name, _app$options7;
|
|
126
|
-
return (0, _reduxStore.createFronteggStore)({
|
|
127
|
-
context,
|
|
128
|
-
appName: (_app$name = app == null ? void 0 : app.name) != null ? _app$name : 'default'
|
|
129
|
-
}, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options7 = app.options) == null ? void 0 : _app$options7.urlStrategy);
|
|
130
|
-
}, [app, previewMode]);
|
|
131
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FronteggStoreContext.Provider, {
|
|
132
|
-
context: _FronteggStoreContext.FronteggStoreContext,
|
|
133
|
-
store: store,
|
|
134
|
-
children: [alwaysVisibleChildren, /*#__PURE__*/(0, _jsxRuntime.jsx)(FronteggContent, {
|
|
135
|
-
setLoading: setLoading,
|
|
136
|
-
app: app,
|
|
137
|
-
children: children
|
|
138
|
-
})]
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
exports.FronteggStoreProvider = FronteggStoreProvider;
|
|
16
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStore = exports.default = exports.Provider = exports.FronteggStoreContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
const FronteggStoreContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
10
|
+
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
exports.FronteggStoreContext = FronteggStoreContext;
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
FronteggStoreContext.displayName = 'FronteggStoreContext';
|
|
15
|
+
}
|
|
16
|
+
const useStore = () => (0, _react.useContext)(FronteggStoreContext);
|
|
17
|
+
exports.useStore = useStore;
|
|
18
|
+
const Provider = /*#__PURE__*/(0, _react.memo)(props => {
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FronteggStoreContext.Provider, {
|
|
20
|
+
value: props.store,
|
|
21
|
+
children: props.children
|
|
22
|
+
});
|
|
23
|
+
}, () => true);
|
|
24
|
+
exports.Provider = Provider;
|
|
25
|
+
var _default = FronteggStoreContext;
|
|
26
|
+
exports.default = _default;
|
|
@@ -1,40 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
|
|
8
|
-
Object.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return _reactRedux.shallowEqual;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
exports.useStore = exports.useSelector = exports.useDispatch = void 0;
|
|
22
|
-
var _react = _interopRequireDefault(require("react"));
|
|
23
|
-
var _reactRedux = require("react-redux");
|
|
24
|
-
const FronteggStoreContext = /*#__PURE__*/_react.default.createContext(null);
|
|
25
|
-
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
exports.FronteggStoreContext = FronteggStoreContext;
|
|
28
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
-
FronteggStoreContext.displayName = 'FronteggStoreContext';
|
|
30
|
-
}
|
|
31
|
-
const useSelector = (0, _reactRedux.createSelectorHook)(FronteggStoreContext);
|
|
32
|
-
exports.useSelector = useSelector;
|
|
33
|
-
const useDispatch = (0, _reactRedux.createDispatchHook)(FronteggStoreContext);
|
|
34
|
-
exports.useDispatch = useDispatch;
|
|
35
|
-
const useStore = (0, _reactRedux.createStoreHook)(FronteggStoreContext);
|
|
36
|
-
exports.useStore = useStore;
|
|
37
|
-
const Provider = _reactRedux.Provider;
|
|
38
|
-
exports.Provider = Provider;
|
|
39
|
-
var _default = FronteggStoreContext;
|
|
40
|
-
exports.default = _default;
|
|
6
|
+
var _FronteggStoreContext = require("./FronteggStoreContext");
|
|
7
|
+
Object.keys(_FronteggStoreContext).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _FronteggStoreContext[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FronteggStoreContext[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/node/audits/auditLogs.js
CHANGED
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAuditLogsActions = void 0;
|
|
7
7
|
exports.useAuditLogsState = useAuditLogsState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0,
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useAuditLogsState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auditLogs.auditLogsState;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
13
13
|
}
|
|
14
|
-
const useAuditLogsActions = () =>
|
|
14
|
+
const useAuditLogsActions = () => {
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auditLogs;
|
|
16
|
+
};
|
|
15
17
|
exports.useAuditLogsActions = useAuditLogsActions;
|
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAuditsMetadataActions = void 0;
|
|
7
7
|
exports.useAuditsMetadataState = useAuditsMetadataState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0,
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useAuditsMetadataState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auditLogs.auditsMetadataState;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
13
13
|
}
|
|
14
|
-
const useAuditsMetadataActions = () =>
|
|
14
|
+
const useAuditsMetadataActions = () => {
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auditLogs;
|
|
16
|
+
};
|
|
15
17
|
exports.useAuditsMetadataActions = useAuditsMetadataActions;
|
package/node/audits/hooks.js
CHANGED
|
@@ -1,49 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.useAuditsActions =
|
|
6
|
+
exports.useAuditsActions = void 0;
|
|
8
7
|
exports.useAuditsState = useAuditsState;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _reduxStore = require("@frontegg/redux-store");
|
|
12
|
-
var _reactRedux = require("react-redux");
|
|
13
8
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
14
10
|
const defaultMapper = {
|
|
15
11
|
state: state => state,
|
|
16
12
|
actions: actions => actions
|
|
17
13
|
};
|
|
18
14
|
function useAuditsState(stateMapper = defaultMapper.state) {
|
|
19
|
-
|
|
15
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auditLogs;
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
return stateMapper((0, _react.useSnapshot)(state));
|
|
20
18
|
}
|
|
21
19
|
const useAuditsActions = () => {
|
|
22
|
-
|
|
23
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.auditsActions, dispatch), [_reduxStore.auditsActions]);
|
|
20
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auditLogs;
|
|
24
21
|
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* hooks helpers
|
|
28
|
-
*/
|
|
29
|
-
exports.useAuditsActions = useAuditsActions;
|
|
30
|
-
const sliceReducerActionsBy = reducer => {
|
|
31
|
-
const reducerKeys = Object.keys(reducer);
|
|
32
|
-
const reducerActions = reducerKeys.map(key => ({
|
|
33
|
-
[key]: _reduxStore.auditsActions[key]
|
|
34
|
-
}));
|
|
35
|
-
return reducerActions.reduce((p, n) => (0, _extends2.default)({}, p, n), {});
|
|
36
|
-
};
|
|
37
|
-
exports.sliceReducerActionsBy = sliceReducerActionsBy;
|
|
38
|
-
const stateHookGenerator = (stateMapper, subState) => {
|
|
39
|
-
return (0, _FronteggStoreContext.useSelector)(state => {
|
|
40
|
-
var _stateMapper;
|
|
41
|
-
return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[_reduxStore.auditsStoreName][subState])) != null ? _stateMapper : state[_reduxStore.auditsStoreName][subState];
|
|
42
|
-
}, _reactRedux.shallowEqual);
|
|
43
|
-
};
|
|
44
|
-
exports.stateHookGenerator = stateHookGenerator;
|
|
45
|
-
const reducerActionsGenerator = (actions, reducers) => {
|
|
46
|
-
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
47
|
-
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)((0, _extends2.default)({}, actions, sliceReducerActionsBy(reducers)), dispatch), [dispatch]);
|
|
48
|
-
};
|
|
49
|
-
exports.reducerActionsGenerator = reducerActionsGenerator;
|
|
22
|
+
exports.useAuditsActions = useAuditsActions;
|
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAcceptInvitationActions = void 0;
|
|
7
7
|
exports.useAcceptInvitationState = useAcceptInvitationState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
11
10
|
const defaultMapper = state => state;
|
|
12
11
|
function useAcceptInvitationState(stateMapper = defaultMapper) {
|
|
13
|
-
|
|
12
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.acceptInvitationState;
|
|
13
|
+
return stateMapper((0, _react.useSnapshot)(state));
|
|
14
14
|
}
|
|
15
|
-
const useAcceptInvitationActions = () =>
|
|
15
|
+
const useAcceptInvitationActions = () => {
|
|
16
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.acceptInvitationActions;
|
|
17
|
+
};
|
|
16
18
|
exports.useAcceptInvitationActions = useAcceptInvitationActions;
|
|
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useActivateAccountActions = void 0;
|
|
7
7
|
exports.useActivateAccountState = useActivateAccountState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
10
|
const defaultMapper = state => state;
|
|
11
11
|
function useActivateAccountState(stateMapper = defaultMapper) {
|
|
12
|
-
|
|
12
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.activateAccountState;
|
|
13
|
+
return stateMapper((0, _react.useSnapshot)(state));
|
|
13
14
|
}
|
|
14
|
-
const useActivateAccountActions = () =>
|
|
15
|
+
const useActivateAccountActions = () => {
|
|
16
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.activateAccountActions;
|
|
17
|
+
};
|
|
15
18
|
exports.useActivateAccountActions = useActivateAccountActions;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAllAccountsDialogsActions = exports.useAllAccountsActions = void 0;
|
|
7
|
+
exports.useAllAccountsDialogsState = useAllAccountsDialogsState;
|
|
8
|
+
exports.useAllAccountsState = useAllAccountsState;
|
|
9
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
10
|
+
var _react = require("valtio/react");
|
|
11
|
+
const defaultMapper = state => state;
|
|
12
|
+
function useAllAccountsState(stateMapper = defaultMapper) {
|
|
13
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.allAccountsState;
|
|
14
|
+
return stateMapper((0, _react.useSnapshot)(state));
|
|
15
|
+
}
|
|
16
|
+
const useAllAccountsActions = () => {
|
|
17
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.allAccountsActions;
|
|
18
|
+
};
|
|
19
|
+
exports.useAllAccountsActions = useAllAccountsActions;
|
|
20
|
+
function useAllAccountsDialogsState() {
|
|
21
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.allAccountsDialogsState;
|
|
22
|
+
return (0, _react.useSnapshot)(state);
|
|
23
|
+
}
|
|
24
|
+
const useAllAccountsDialogsActions = () => {
|
|
25
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.allAccountsDialogActions;
|
|
26
|
+
};
|
|
27
|
+
exports.useAllAccountsDialogsActions = useAllAccountsDialogsActions;
|
package/node/auth/apiTokens.js
CHANGED
|
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useApiTokensActions = void 0;
|
|
7
7
|
exports.useApiTokensState = useApiTokensState;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (0,
|
|
8
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
9
|
+
var _react = require("valtio/react");
|
|
10
|
+
function useApiTokensState() {
|
|
11
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.apiTokensState;
|
|
12
|
+
return (0, _react.useSnapshot)(state);
|
|
13
13
|
}
|
|
14
|
-
const useApiTokensActions = () =>
|
|
14
|
+
const useApiTokensActions = () => {
|
|
15
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.apiTokensActions;
|
|
16
|
+
};
|
|
15
17
|
exports.useApiTokensActions = useApiTokensActions;
|
package/node/auth/customLogin.js
CHANGED
|
@@ -7,22 +7,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useCustomLoginActions = void 0;
|
|
8
8
|
exports.useCustomLoginState = useCustomLoginState;
|
|
9
9
|
exports.useCustomLoginTheme = void 0;
|
|
10
|
-
var _reduxStore = require("@frontegg/redux-store");
|
|
11
|
-
var _hooks = require("./hooks");
|
|
12
|
-
var _getValue = _interopRequireDefault(require("get-value"));
|
|
13
10
|
var _react = require("react");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
var _getValue = _interopRequireDefault(require("get-value"));
|
|
12
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
13
|
+
var _react2 = require("valtio/react");
|
|
14
|
+
function useCustomLoginState() {
|
|
15
|
+
const state = (0, _FronteggStoreContext.useStore)().store.auth.customLoginState;
|
|
16
|
+
return (0, _react2.useSnapshot)(state);
|
|
17
17
|
}
|
|
18
|
-
const useCustomLoginActions = () =>
|
|
19
|
-
|
|
20
|
-
const themeMapper = state => {
|
|
21
|
-
var _state$tenantMetadata, _state$tenantMetadata2, _state$tenantMetadata3;
|
|
22
|
-
return (_state$tenantMetadata = state.tenantMetadata) == null ? void 0 : (_state$tenantMetadata2 = _state$tenantMetadata.configuration) == null ? void 0 : (_state$tenantMetadata3 = _state$tenantMetadata2.themeV2) == null ? void 0 : _state$tenantMetadata3.loginBox;
|
|
18
|
+
const useCustomLoginActions = () => {
|
|
19
|
+
return (0, _FronteggStoreContext.useStore)().stateActions.auth.customLoginActions;
|
|
23
20
|
};
|
|
21
|
+
exports.useCustomLoginActions = useCustomLoginActions;
|
|
24
22
|
const useCustomLoginTheme = () => {
|
|
25
|
-
|
|
23
|
+
var _useCustomLoginState$, _useCustomLoginState$2, _useCustomLoginState$3;
|
|
24
|
+
const customLoginTheme = (_useCustomLoginState$ = useCustomLoginState().tenantMetadata) == null ? void 0 : (_useCustomLoginState$2 = _useCustomLoginState$.configuration) == null ? void 0 : (_useCustomLoginState$3 = _useCustomLoginState$2.themeV2) == null ? void 0 : _useCustomLoginState$3.loginBox;
|
|
26
25
|
const getCustomLoginThemeValue = (0, _react.useCallback)(path => {
|
|
27
26
|
return path && customLoginTheme ? (0, _getValue.default)(customLoginTheme, path) : customLoginTheme;
|
|
28
27
|
}, [customLoginTheme]);
|