@frontegg/react-hooks 6.2.5 → 6.5.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.js +1 -3
- package/FronteggStoreContext.d.ts +11 -6
- package/FronteggStoreContext.js +3 -2
- package/audits/auditLogs.d.ts +3 -3
- package/audits/auditLogs.js +6 -1
- package/audits/auditsMetadata.d.ts +3 -3
- package/audits/auditsMetadata.js +7 -2
- package/audits/hooks.d.ts +7 -2
- package/audits/hooks.js +8 -8
- package/auth/acceptInvitation.d.ts +3 -3
- package/auth/acceptInvitation.js +6 -1
- package/auth/activateAccount.d.ts +3 -3
- package/auth/activateAccount.js +6 -1
- package/auth/apiTokens.d.ts +3 -3
- package/auth/apiTokens.js +6 -1
- package/auth/forgotPassword.d.ts +3 -3
- package/auth/forgotPassword.js +6 -1
- package/auth/hooks.d.ts +4 -4
- package/auth/hooks.js +2 -2
- package/auth/login.d.ts +3 -3
- package/auth/login.js +6 -1
- package/auth/mfa.d.ts +4 -2
- package/auth/mfa.js +6 -1
- package/auth/profile.d.ts +3 -3
- package/auth/profile.js +6 -1
- package/auth/resetPhoneNumber.d.ts +3 -3
- package/auth/resetPhoneNumber.js +6 -1
- package/auth/roles.d.ts +3 -3
- package/auth/roles.js +6 -1
- package/auth/securityPolicy.d.ts +3 -3
- package/auth/securityPolicy.js +6 -1
- package/auth/sessions.d.ts +3 -3
- package/auth/sessions.js +6 -1
- package/auth/sessionsPolicy.d.ts +4 -5
- package/auth/sessionsPolicy.js +6 -1
- package/auth/signup.d.ts +3 -3
- package/auth/signup.js +6 -1
- package/auth/socialLogin.d.ts +3 -3
- package/auth/socialLogin.js +6 -1
- package/auth/sso.d.ts +4 -2
- package/auth/sso.js +6 -1
- package/auth/team.d.ts +3 -3
- package/auth/team.js +6 -1
- package/auth/tenants.d.ts +3 -3
- package/auth/tenants.js +6 -1
- package/connectivity/hooks.d.ts +3 -2
- package/connectivity/hooks.js +5 -6
- package/flags/index.d.ts +1 -0
- package/flags/index.js +1 -0
- package/flags/package.json +6 -0
- package/flags/useFeatureFlags.d.ts +1 -0
- package/flags/useFeatureFlags.js +10 -0
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/node/FronteggProvider.js +1 -5
- package/node/FronteggStoreContext.js +4 -8
- package/node/audits/auditLogs.js +6 -3
- package/node/audits/auditsMetadata.js +8 -5
- package/node/audits/hooks.js +10 -10
- package/node/auth/acceptInvitation.js +6 -3
- package/node/auth/activateAccount.js +6 -3
- package/node/auth/apiTokens.js +6 -3
- package/node/auth/forgotPassword.js +6 -3
- package/node/auth/hooks.js +5 -5
- package/node/auth/login.js +6 -3
- package/node/auth/mfa.js +6 -3
- package/node/auth/profile.js +6 -3
- package/node/auth/resetPhoneNumber.js +6 -3
- package/node/auth/roles.js +6 -3
- package/node/auth/securityPolicy.js +6 -3
- package/node/auth/sessions.js +6 -3
- package/node/auth/sessionsPolicy.js +6 -3
- package/node/auth/signup.js +6 -3
- package/node/auth/socialLogin.js +6 -3
- package/node/auth/sso.js +6 -3
- package/node/auth/team.js +6 -3
- package/node/auth/tenants.js +6 -3
- package/node/connectivity/hooks.js +6 -9
- package/node/flags/index.js +18 -0
- package/node/flags/useFeatureFlags.js +20 -0
- package/node/index.js +14 -1
- package/node/vendor/hooks.js +6 -9
- package/package.json +4 -4
- package/vendor/hooks.d.ts +3 -2
- package/vendor/hooks.js +5 -6
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useConnectivityActions = void 0;
|
|
7
|
+
exports.useConnectivityState = useConnectivityState;
|
|
7
8
|
|
|
8
9
|
var _react = require("react");
|
|
9
10
|
|
|
@@ -13,15 +14,11 @@ var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
|
13
14
|
|
|
14
15
|
var _reduxStore = require("@frontegg/redux-store");
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
return (0, _FronteggStoreContext.useSelector)(state => {
|
|
18
|
-
var _stateMapper;
|
|
19
|
-
|
|
20
|
-
return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[_reduxStore.connectivityStoreName])) != null ? _stateMapper : state[_reduxStore.connectivityStoreName];
|
|
21
|
-
}, _reactRedux.shallowEqual);
|
|
22
|
-
};
|
|
17
|
+
const defaultMapper = state => state;
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
function useConnectivityState(stateMapper = defaultMapper) {
|
|
20
|
+
return (0, _FronteggStoreContext.useSelector)(state => stateMapper(state[_reduxStore.connectivityStoreName]), _reactRedux.shallowEqual);
|
|
21
|
+
}
|
|
25
22
|
|
|
26
23
|
const useConnectivityActions = () => {
|
|
27
24
|
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _useFeatureFlags = require("./useFeatureFlags");
|
|
8
|
+
|
|
9
|
+
Object.keys(_useFeatureFlags).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _useFeatureFlags[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useFeatureFlags[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFeatureFlags = void 0;
|
|
7
|
+
|
|
8
|
+
var _common = require("../common");
|
|
9
|
+
|
|
10
|
+
const useFeatureFlags = (...flags) => {
|
|
11
|
+
var _injector$flags;
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
injector
|
|
15
|
+
} = (0, _common.useShadowDom)();
|
|
16
|
+
const featureFlags = (_injector$flags = injector.flags) != null ? _injector$flags : {};
|
|
17
|
+
return flags.map(flag => featureFlags[flag] === 'on');
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.useFeatureFlags = useFeatureFlags;
|
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license Frontegg v6.
|
|
1
|
+
/** @license Frontegg v6.5.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -87,6 +87,19 @@ Object.keys(_vendor).forEach(function (key) {
|
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
+
var _flags = require("./flags");
|
|
91
|
+
|
|
92
|
+
Object.keys(_flags).forEach(function (key) {
|
|
93
|
+
if (key === "default" || key === "__esModule") return;
|
|
94
|
+
if (key in exports && exports[key] === _flags[key]) return;
|
|
95
|
+
Object.defineProperty(exports, key, {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () {
|
|
98
|
+
return _flags[key];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
90
103
|
var _FronteggProvider = require("./FronteggProvider");
|
|
91
104
|
|
|
92
105
|
Object.keys(_FronteggProvider).forEach(function (key) {
|
package/node/vendor/hooks.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useVendorActions = void 0;
|
|
7
|
+
exports.useVendorState = useVendorState;
|
|
7
8
|
|
|
8
9
|
var _react = require("react");
|
|
9
10
|
|
|
@@ -13,15 +14,11 @@ var _reactRedux = require("react-redux");
|
|
|
13
14
|
|
|
14
15
|
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
return (0, _FronteggStoreContext.useSelector)(state => {
|
|
18
|
-
var _stateMapper;
|
|
19
|
-
|
|
20
|
-
return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[_reduxStore.vendorStoreName])) != null ? _stateMapper : state[_reduxStore.vendorStoreName];
|
|
21
|
-
}, _reactRedux.shallowEqual);
|
|
22
|
-
};
|
|
17
|
+
const defaultMapper = state => state;
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
function useVendorState(stateMapper = defaultMapper) {
|
|
20
|
+
return (0, _FronteggStoreContext.useSelector)(state => stateMapper(state[_reduxStore.vendorStoreName]), _reactRedux.shallowEqual);
|
|
21
|
+
}
|
|
25
22
|
|
|
26
23
|
const useVendorActions = () => {
|
|
27
24
|
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@babel/runtime": "^7.
|
|
9
|
-
"@frontegg/redux-store": "6.
|
|
10
|
-
"@frontegg/types": "6.
|
|
8
|
+
"@babel/runtime": "^7.18.6",
|
|
9
|
+
"@frontegg/redux-store": "6.5.0",
|
|
10
|
+
"@frontegg/types": "6.5.0",
|
|
11
11
|
"@types/react": "*",
|
|
12
12
|
"react-redux": "^7.x"
|
|
13
13
|
},
|
package/vendor/hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VendorActions, VendorState } from '@frontegg/redux-store';
|
|
2
|
-
export declare type VendorStateMapper<S
|
|
2
|
+
export declare type VendorStateMapper<S> = (state: VendorState) => S;
|
|
3
3
|
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
4
|
-
export declare
|
|
4
|
+
export declare function useVendorState(): VendorState;
|
|
5
|
+
export declare function useVendorState<S>(stateMapper: VendorStateMapper<S>): S;
|
|
5
6
|
export declare const useVendorActions: () => VendorActions;
|
package/vendor/hooks.js
CHANGED
|
@@ -2,13 +2,12 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { bindActionCreators, vendorActions, vendorStoreName } from '@frontegg/redux-store';
|
|
3
3
|
import { shallowEqual } from 'react-redux';
|
|
4
4
|
import { useSelector, useDispatch } from '../FronteggStoreContext';
|
|
5
|
-
export const useVendorState = stateMapper => {
|
|
6
|
-
return useSelector(state => {
|
|
7
|
-
var _stateMapper;
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const defaultMapper = state => state;
|
|
7
|
+
|
|
8
|
+
export function useVendorState(stateMapper = defaultMapper) {
|
|
9
|
+
return useSelector(state => stateMapper(state[vendorStoreName]), shallowEqual);
|
|
10
|
+
}
|
|
12
11
|
export const useVendorActions = () => {
|
|
13
12
|
const dispatch = useDispatch();
|
|
14
13
|
return useMemo(() => bindActionCreators(vendorActions, dispatch), [vendorActions]);
|