@frontegg/react-hooks 6.102.0 → 6.103.0-alpha.1
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/auth/MSP/allAccounts.d.ts +9 -0
- package/auth/MSP/allAccounts.js +15 -0
- package/auth/entitlements.d.ts +11 -0
- package/auth/entitlements.js +19 -0
- package/auth/index.d.ts +2 -0
- package/auth/index.js +3 -1
- package/index.js +1 -1
- package/node/auth/MSP/allAccounts.js +24 -0
- package/node/auth/entitlements.js +28 -0
- package/node/auth/index.js +24 -0
- package/node/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAllAccountsState, AllAccountsActions, IAllAccountsDialogsState, AllAccountsDialogsActions } from '@frontegg/redux-store';
|
|
2
|
+
export declare type AllAccountsStateMapper<S> = (state: IAllAccountsState) => S;
|
|
3
|
+
export declare function useAllAccountsState(): IAllAccountsState;
|
|
4
|
+
export declare function useAllAccountsState<S>(stateMapper: AllAccountsStateMapper<S>): S;
|
|
5
|
+
export declare const useAllAccountsActions: () => AllAccountsActions;
|
|
6
|
+
export declare type AllAccountsDialogsStateMapper<S> = (state: IAllAccountsDialogsState) => S;
|
|
7
|
+
export declare function useAllAccountsDialogsState(): IAllAccountsDialogsState;
|
|
8
|
+
export declare function useAllAccountsDialogsState<S>(stateMapper: AllAccountsDialogsStateMapper<S>): S;
|
|
9
|
+
export declare const useAllAccountsDialogsActions: () => AllAccountsDialogsActions;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { allAccountsActions, allAccountsReducers, allAccountsDialogsReducers } from '@frontegg/redux-store';
|
|
2
|
+
import { reducerActionsGenerator, stateHookGenerator } from '../hooks';
|
|
3
|
+
const defaultMapper = state => state;
|
|
4
|
+
export function useAllAccountsState(stateMapper = defaultMapper) {
|
|
5
|
+
return stateHookGenerator(stateMapper, 'allAccountsState');
|
|
6
|
+
}
|
|
7
|
+
export const useAllAccountsActions = () => reducerActionsGenerator(allAccountsActions, allAccountsReducers);
|
|
8
|
+
|
|
9
|
+
//dialogs
|
|
10
|
+
|
|
11
|
+
const defaultDialogsMapper = state => state;
|
|
12
|
+
export function useAllAccountsDialogsState(stateMapper = defaultDialogsMapper) {
|
|
13
|
+
return stateHookGenerator(stateMapper, 'allAccountsDialogsState');
|
|
14
|
+
}
|
|
15
|
+
export const useAllAccountsDialogsActions = () => reducerActionsGenerator({}, allAccountsDialogsReducers);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntitlementsState, EntitlementsActions, Entitlements } from '@frontegg/redux-store';
|
|
2
|
+
export declare type EntitlementsStateMapper<S> = (state: EntitlementsState) => S;
|
|
3
|
+
export declare function useEntitlementsState(): EntitlementsState;
|
|
4
|
+
export declare function useEntitlementsState<S>(stateMapper: EntitlementsStateMapper<S>): S;
|
|
5
|
+
export declare const useEntitlementsActions: () => EntitlementsActions;
|
|
6
|
+
/**
|
|
7
|
+
@param keys The requested features entitlements
|
|
8
|
+
|
|
9
|
+
Returns Entitlements contains true/false for every key (state of is key entitled)
|
|
10
|
+
*/
|
|
11
|
+
export declare const useEntitlements: (keys: string[]) => Entitlements;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { entitlementsActions, entitlementsReducers, getEntitlements } from '@frontegg/redux-store';
|
|
2
|
+
import { reducerActionsGenerator, stateHookGenerator } from './hooks';
|
|
3
|
+
const defaultMapper = state => state;
|
|
4
|
+
export function useEntitlementsState(stateMapper = defaultMapper) {
|
|
5
|
+
return stateHookGenerator(stateMapper, 'entitlementsState');
|
|
6
|
+
}
|
|
7
|
+
export const useEntitlementsActions = () => reducerActionsGenerator(entitlementsActions, entitlementsReducers);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
@param keys The requested features entitlements
|
|
11
|
+
|
|
12
|
+
Returns Entitlements contains true/false for every key (state of is key entitled)
|
|
13
|
+
*/
|
|
14
|
+
export const useEntitlements = keys => {
|
|
15
|
+
const {
|
|
16
|
+
entitlements = {}
|
|
17
|
+
} = useEntitlementsState();
|
|
18
|
+
return getEntitlements(entitlements, keys);
|
|
19
|
+
};
|
package/auth/index.d.ts
CHANGED
package/auth/index.js
CHANGED
|
@@ -21,4 +21,6 @@ export * from './provisioning';
|
|
|
21
21
|
export * from './impersonate';
|
|
22
22
|
export * from './passkeys';
|
|
23
23
|
export * from './groups';
|
|
24
|
-
export * from './customLogin';
|
|
24
|
+
export * from './customLogin';
|
|
25
|
+
export * from './MSP/allAccounts';
|
|
26
|
+
export * from './entitlements';
|
package/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
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 _reduxStore = require("@frontegg/redux-store");
|
|
10
|
+
var _hooks = require("../hooks");
|
|
11
|
+
const defaultMapper = state => state;
|
|
12
|
+
function useAllAccountsState(stateMapper = defaultMapper) {
|
|
13
|
+
return (0, _hooks.stateHookGenerator)(stateMapper, 'allAccountsState');
|
|
14
|
+
}
|
|
15
|
+
const useAllAccountsActions = () => (0, _hooks.reducerActionsGenerator)(_reduxStore.allAccountsActions, _reduxStore.allAccountsReducers);
|
|
16
|
+
|
|
17
|
+
//dialogs
|
|
18
|
+
exports.useAllAccountsActions = useAllAccountsActions;
|
|
19
|
+
const defaultDialogsMapper = state => state;
|
|
20
|
+
function useAllAccountsDialogsState(stateMapper = defaultDialogsMapper) {
|
|
21
|
+
return (0, _hooks.stateHookGenerator)(stateMapper, 'allAccountsDialogsState');
|
|
22
|
+
}
|
|
23
|
+
const useAllAccountsDialogsActions = () => (0, _hooks.reducerActionsGenerator)({}, _reduxStore.allAccountsDialogsReducers);
|
|
24
|
+
exports.useAllAccountsDialogsActions = useAllAccountsDialogsActions;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEntitlementsActions = exports.useEntitlements = void 0;
|
|
7
|
+
exports.useEntitlementsState = useEntitlementsState;
|
|
8
|
+
var _reduxStore = require("@frontegg/redux-store");
|
|
9
|
+
var _hooks = require("./hooks");
|
|
10
|
+
const defaultMapper = state => state;
|
|
11
|
+
function useEntitlementsState(stateMapper = defaultMapper) {
|
|
12
|
+
return (0, _hooks.stateHookGenerator)(stateMapper, 'entitlementsState');
|
|
13
|
+
}
|
|
14
|
+
const useEntitlementsActions = () => (0, _hooks.reducerActionsGenerator)(_reduxStore.entitlementsActions, _reduxStore.entitlementsReducers);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
@param keys The requested features entitlements
|
|
18
|
+
|
|
19
|
+
Returns Entitlements contains true/false for every key (state of is key entitled)
|
|
20
|
+
*/
|
|
21
|
+
exports.useEntitlementsActions = useEntitlementsActions;
|
|
22
|
+
const useEntitlements = keys => {
|
|
23
|
+
const {
|
|
24
|
+
entitlements = {}
|
|
25
|
+
} = useEntitlementsState();
|
|
26
|
+
return (0, _reduxStore.getEntitlements)(entitlements, keys);
|
|
27
|
+
};
|
|
28
|
+
exports.useEntitlements = useEntitlements;
|
package/node/auth/index.js
CHANGED
|
@@ -337,4 +337,28 @@ Object.keys(_customLogin).forEach(function (key) {
|
|
|
337
337
|
return _customLogin[key];
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
|
+
});
|
|
341
|
+
var _allAccounts = require("./MSP/allAccounts");
|
|
342
|
+
Object.keys(_allAccounts).forEach(function (key) {
|
|
343
|
+
if (key === "default" || key === "__esModule") return;
|
|
344
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
345
|
+
if (key in exports && exports[key] === _allAccounts[key]) return;
|
|
346
|
+
Object.defineProperty(exports, key, {
|
|
347
|
+
enumerable: true,
|
|
348
|
+
get: function () {
|
|
349
|
+
return _allAccounts[key];
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
var _entitlements = require("./entitlements");
|
|
354
|
+
Object.keys(_entitlements).forEach(function (key) {
|
|
355
|
+
if (key === "default" || key === "__esModule") return;
|
|
356
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
357
|
+
if (key in exports && exports[key] === _entitlements[key]) return;
|
|
358
|
+
Object.defineProperty(exports, key, {
|
|
359
|
+
enumerable: true,
|
|
360
|
+
get: function () {
|
|
361
|
+
return _entitlements[key];
|
|
362
|
+
}
|
|
363
|
+
});
|
|
340
364
|
});
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.103.0-alpha.1",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/redux-store": "6.
|
|
10
|
-
"@frontegg/types": "6.
|
|
9
|
+
"@frontegg/redux-store": "6.103.0-alpha.1",
|
|
10
|
+
"@frontegg/types": "6.103.0-alpha.1",
|
|
11
11
|
"@types/react": "*",
|
|
12
12
|
"get-value": "^3.0.1",
|
|
13
13
|
"react-redux": "^7.x"
|