@frontegg/react-hooks 5.60.0 → 6.0.1-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/FronteggProvider.d.ts +11 -10
- package/FronteggProvider.js +137 -0
- package/FronteggStoreContext.d.ts +8 -8
- package/FronteggStoreContext.js +13 -0
- package/audits/auditLogs.d.ts +5 -5
- package/audits/auditLogs.js +4 -0
- package/audits/auditsMetadata.d.ts +5 -5
- package/audits/auditsMetadata.js +4 -0
- package/audits/hooks.d.ts +12 -12
- package/audits/hooks.js +35 -0
- package/audits/index.d.ts +3 -3
- package/audits/index.js +3 -5
- package/auth/acceptInvitation.d.ts +5 -5
- package/auth/acceptInvitation.js +4 -0
- package/auth/activateAccount.d.ts +5 -5
- package/auth/activateAccount.js +4 -0
- package/auth/apiTokens.d.ts +5 -5
- package/auth/apiTokens.js +4 -0
- package/auth/forgotPassword.d.ts +5 -5
- package/auth/forgotPassword.js +4 -0
- package/auth/hooks.d.ts +62 -62
- package/auth/hooks.js +79 -0
- package/auth/index.d.ts +16 -16
- package/auth/index.js +16 -7
- package/auth/login.d.ts +5 -5
- package/auth/login.js +4 -0
- package/auth/mfa.d.ts +4 -4
- package/auth/mfa.js +4 -0
- package/auth/profile.d.ts +6 -6
- package/auth/profile.js +16 -0
- package/auth/resetPhoneNumber.d.ts +5 -5
- package/auth/resetPhoneNumber.js +4 -0
- package/auth/roles.d.ts +5 -5
- package/auth/roles.js +4 -0
- package/auth/securityPolicy.d.ts +11 -11
- package/auth/securityPolicy.js +25 -0
- package/auth/signup.d.ts +5 -5
- package/auth/signup.js +4 -0
- package/auth/socialLogin.d.ts +5 -5
- package/auth/socialLogin.js +4 -0
- package/auth/sso.d.ts +4 -4
- package/auth/sso.js +4 -0
- package/auth/team.d.ts +5 -5
- package/auth/team.js +4 -0
- package/auth/tenants.d.ts +5 -5
- package/auth/tenants.js +4 -0
- package/common/index.d.ts +17 -17
- package/common/index.js +30 -0
- package/common/package.json +6 -0
- package/connectivity/hooks.d.ts +5 -5
- package/connectivity/hooks.js +15 -0
- package/connectivity/index.d.ts +1 -1
- package/connectivity/index.js +1 -5
- package/index.d.ts +8 -8
- package/index.js +13 -93
- package/node/FronteggProvider.js +160 -0
- package/node/FronteggStoreContext.js +49 -0
- package/node/audits/auditLogs.js +18 -0
- package/node/audits/auditsMetadata.js +18 -0
- package/node/audits/hooks.js +62 -0
- package/node/audits/index.js +46 -13
- package/node/auth/acceptInvitation.js +18 -0
- package/node/auth/activateAccount.js +18 -0
- package/node/auth/apiTokens.js +18 -0
- package/node/auth/forgotPassword.js +18 -0
- package/node/auth/hooks.js +127 -0
- package/node/auth/index.js +275 -54
- package/node/auth/login.js +18 -0
- package/node/auth/mfa.js +18 -0
- package/node/auth/profile.js +34 -0
- package/node/auth/resetPhoneNumber.js +18 -0
- package/node/auth/roles.js +18 -0
- package/node/auth/securityPolicy.js +43 -0
- package/node/auth/signup.js +18 -0
- package/node/auth/socialLogin.js +18 -0
- package/node/auth/sso.js +18 -0
- package/node/auth/team.js +18 -0
- package/node/auth/tenants.js +18 -0
- package/node/common/index.js +44 -0
- package/node/connectivity/hooks.js +31 -0
- package/node/connectivity/index.js +17 -12
- package/node/index.js +111 -187
- package/node/subscriptions/hooks.js +131 -0
- package/node/subscriptions/index.js +15 -27
- package/node/vendor/hooks.js +31 -0
- package/node/vendor/index.js +17 -12
- package/package.json +12 -7
- package/subscriptions/hooks.d.ts +19 -19
- package/subscriptions/hooks.js +69 -0
- package/subscriptions/index.d.ts +1 -1
- package/subscriptions/index.js +1 -5
- package/vendor/hooks.d.ts +5 -5
- package/vendor/hooks.js +15 -0
- package/vendor/index.d.ts +1 -1
- package/vendor/index.js +1 -5
- package/FronteggStoreContext-d6c3b684.js +0 -9
- package/auditsMetadata-9ab88593.js +0 -35
- package/hooks-6400e233.js +0 -14
- package/hooks-7fc5d634.js +0 -64
- package/hooks-eaf879c9.js +0 -14
- package/node/FronteggStoreContext-6cfac56c.js +0 -18
- package/node/auditsMetadata-d15799a1.js +0 -42
- package/node/hooks-429ffd3a.js +0 -83
- package/node/hooks-5d5a445e.js +0 -17
- package/node/hooks-cf739b27.js +0 -17
- package/node/roles-f45dbc50.js +0 -215
- package/roles-f87bc6a0.js +0 -172
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { bindActionCreators, subscriptionActions, subscriptionsStoreName } from '@frontegg/redux-store';
|
|
2
|
+
import { useDispatch, useSelector } from '../FronteggStoreContext';
|
|
3
|
+
import { shallowEqual } from 'react-redux';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
function getSubscriptionState(state) {
|
|
7
|
+
return state[subscriptionsStoreName];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const usePaymentProvider = () => {
|
|
11
|
+
return useSelector(state => getSubscriptionState(state).config, shallowEqual);
|
|
12
|
+
};
|
|
13
|
+
export const usePaymentProviderActions = () => {
|
|
14
|
+
const dispatch = useDispatch();
|
|
15
|
+
return useMemo(() => bindActionCreators(subscriptionActions.config, dispatch), [dispatch]);
|
|
16
|
+
};
|
|
17
|
+
export const usePlans = () => {
|
|
18
|
+
return useSelector(state => getSubscriptionState(state).plans, shallowEqual);
|
|
19
|
+
};
|
|
20
|
+
export const usePlansActions = () => {
|
|
21
|
+
const dispatch = useDispatch();
|
|
22
|
+
return useMemo(() => bindActionCreators(subscriptionActions.plans, dispatch), [dispatch]);
|
|
23
|
+
};
|
|
24
|
+
export const useCheckout = () => {
|
|
25
|
+
return useSelector(state => getSubscriptionState(state).checkout, shallowEqual);
|
|
26
|
+
};
|
|
27
|
+
export const useCheckoutActions = () => {
|
|
28
|
+
const dispatch = useDispatch();
|
|
29
|
+
return useMemo(() => bindActionCreators(subscriptionActions.checkout, dispatch), [dispatch]);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const useBillingActions = billingKey => {
|
|
33
|
+
const dispatch = useDispatch();
|
|
34
|
+
return useMemo(() => bindActionCreators(subscriptionActions.billing[billingKey], dispatch), [billingKey, dispatch]);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const useBillingInformation = () => useSelector(state => getSubscriptionState(state).billing.information, shallowEqual);
|
|
38
|
+
export const useBillingInformationActions = () => useBillingActions('information');
|
|
39
|
+
export const usePaymentMethod = () => useSelector(state => getSubscriptionState(state).billing.paymentMethod, shallowEqual);
|
|
40
|
+
export const usePaymentMethodActions = () => useBillingActions('paymentMethod');
|
|
41
|
+
export const useInvoices = () => useSelector(state => getSubscriptionState(state).billing.invoices, shallowEqual);
|
|
42
|
+
export const useInvoicesActions = () => useBillingActions('invoices');
|
|
43
|
+
export const useStripeState = () => {
|
|
44
|
+
return useSelector(state => getSubscriptionState(state).stripe, shallowEqual);
|
|
45
|
+
};
|
|
46
|
+
export const useStripeActions = () => {
|
|
47
|
+
const dispatch = useDispatch();
|
|
48
|
+
return useMemo(() => bindActionCreators(subscriptionActions.stripe, dispatch), [dispatch]);
|
|
49
|
+
};
|
|
50
|
+
export const useSubscriptionCancellation = () => {
|
|
51
|
+
return useSelector(state => getSubscriptionState(state).billing.subscription.cancellation, shallowEqual);
|
|
52
|
+
};
|
|
53
|
+
export const useSubscriptionRenewal = () => {
|
|
54
|
+
return useSelector(state => getSubscriptionState(state).billing.subscription.renewal, shallowEqual);
|
|
55
|
+
};
|
|
56
|
+
export const useSubscription = () => {
|
|
57
|
+
return useSelector(state => {
|
|
58
|
+
const {
|
|
59
|
+
billing: {
|
|
60
|
+
subscription
|
|
61
|
+
}
|
|
62
|
+
} = getSubscriptionState(state);
|
|
63
|
+
return subscription;
|
|
64
|
+
}, shallowEqual);
|
|
65
|
+
};
|
|
66
|
+
export const useSubscriptionActions = () => {
|
|
67
|
+
const dispatch = useDispatch();
|
|
68
|
+
return useMemo(() => bindActionCreators(subscriptionActions.billing.subscription, dispatch), [dispatch]);
|
|
69
|
+
};
|
package/subscriptions/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './hooks';
|
|
1
|
+
export * from './hooks';
|
package/subscriptions/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
import '@frontegg/redux-store';
|
|
3
|
-
import '../FronteggStoreContext-d6c3b684.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'react-redux';
|
|
1
|
+
export * from './hooks';
|
package/vendor/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VendorActions, VendorState } from '@frontegg/redux-store';
|
|
2
|
-
export declare type VendorStateMapper<S extends object> = (state: VendorState) => S;
|
|
3
|
-
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
4
|
-
export declare const useVendorState: <S extends object>(stateMapper?: VendorStateMapper<S> | undefined) => S;
|
|
5
|
-
export declare const useVendorActions: () => VendorActions;
|
|
1
|
+
import { VendorActions, VendorState } from '@frontegg/redux-store';
|
|
2
|
+
export declare type VendorStateMapper<S extends object> = (state: VendorState) => S;
|
|
3
|
+
export declare type StateHookFunction<T> = (() => T) & (<S extends object>(mapper: (state: T) => S) => S);
|
|
4
|
+
export declare const useVendorState: <S extends object>(stateMapper?: VendorStateMapper<S> | undefined) => S;
|
|
5
|
+
export declare const useVendorActions: () => VendorActions;
|
package/vendor/hooks.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { bindActionCreators, vendorActions, vendorStoreName } from '@frontegg/redux-store';
|
|
3
|
+
import { shallowEqual } from 'react-redux';
|
|
4
|
+
import { useSelector, useDispatch } from '../FronteggStoreContext';
|
|
5
|
+
export const useVendorState = stateMapper => {
|
|
6
|
+
return useSelector(state => {
|
|
7
|
+
var _stateMapper;
|
|
8
|
+
|
|
9
|
+
return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[vendorStoreName])) != null ? _stateMapper : state[vendorStoreName];
|
|
10
|
+
}, shallowEqual);
|
|
11
|
+
};
|
|
12
|
+
export const useVendorActions = () => {
|
|
13
|
+
const dispatch = useDispatch();
|
|
14
|
+
return useMemo(() => bindActionCreators(vendorActions, dispatch), [vendorActions]);
|
|
15
|
+
};
|
package/vendor/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useVendorActions, useVendorState } from './hooks';
|
|
1
|
+
export { useVendorActions, useVendorState } from './hooks';
|
package/vendor/index.js
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createSelectorHook, createDispatchHook, createStoreHook } from 'react-redux';
|
|
3
|
-
|
|
4
|
-
const FronteggStoreContext = React.createContext(null);
|
|
5
|
-
const useSelector = createSelectorHook(FronteggStoreContext);
|
|
6
|
-
const useDispatch = createDispatchHook(FronteggStoreContext);
|
|
7
|
-
const useStore = createStoreHook(FronteggStoreContext);
|
|
8
|
-
|
|
9
|
-
export { FronteggStoreContext as F, useDispatch as a, useStore as b, useSelector as u };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { auditsStoreName, bindActionCreators, auditsActions, auditLogsActions, auditLogsReducers, auditsMetadataActions, auditsMetadataReducers } from '@frontegg/redux-store';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { shallowEqual } from 'react-redux';
|
|
4
|
-
import { u as useSelector, a as useDispatch } from './FronteggStoreContext-d6c3b684.js';
|
|
5
|
-
|
|
6
|
-
const useAuditsState = (stateMapper) => {
|
|
7
|
-
return useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[auditsStoreName])) !== null && _a !== void 0 ? _a : state[auditsStoreName]; }, shallowEqual);
|
|
8
|
-
};
|
|
9
|
-
const useAuditsActions = () => {
|
|
10
|
-
const dispatch = useDispatch();
|
|
11
|
-
return useMemo(() => bindActionCreators(auditsActions, dispatch), [auditsActions]);
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* hooks helpers
|
|
15
|
-
*/
|
|
16
|
-
const sliceReducerActionsBy = (reducer) => {
|
|
17
|
-
const reducerKeys = Object.keys(reducer);
|
|
18
|
-
const reducerActions = reducerKeys.map((key) => ({ [key]: auditsActions[key] }));
|
|
19
|
-
return reducerActions.reduce((p, n) => (Object.assign(Object.assign({}, p), n)), {});
|
|
20
|
-
};
|
|
21
|
-
const stateHookGenerator = (stateMapper, subState) => {
|
|
22
|
-
return useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[auditsStoreName][subState])) !== null && _a !== void 0 ? _a : state[auditsStoreName][subState]; }, shallowEqual);
|
|
23
|
-
};
|
|
24
|
-
const reducerActionsGenerator = (actions, reducers) => {
|
|
25
|
-
const dispatch = useDispatch();
|
|
26
|
-
return useMemo(() => bindActionCreators(Object.assign(Object.assign({}, actions), sliceReducerActionsBy(reducers)), dispatch), [dispatch]);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const useAuditLogsState = (stateMapper) => stateHookGenerator(stateMapper, 'auditLogsState');
|
|
30
|
-
const useAuditLogsActions = () => reducerActionsGenerator(auditLogsActions, auditLogsReducers);
|
|
31
|
-
|
|
32
|
-
const useAuditsMetadataState = (stateMapper) => stateHookGenerator(stateMapper, 'auditsMetadataState');
|
|
33
|
-
const useAuditsMetadataActions = () => reducerActionsGenerator(auditsMetadataActions, auditsMetadataReducers);
|
|
34
|
-
|
|
35
|
-
export { useAuditsActions as a, useAuditLogsState as b, useAuditLogsActions as c, useAuditsMetadataState as d, useAuditsMetadataActions as e, useAuditsState as u };
|
package/hooks-6400e233.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { shallowEqual } from 'react-redux';
|
|
3
|
-
import { u as useSelector, a as useDispatch } from './FronteggStoreContext-d6c3b684.js';
|
|
4
|
-
import { connectivityStoreName, bindActionCreators, connectivityActions } from '@frontegg/redux-store';
|
|
5
|
-
|
|
6
|
-
const useConnectivityState = (stateMapper) => {
|
|
7
|
-
return useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[connectivityStoreName])) !== null && _a !== void 0 ? _a : state[connectivityStoreName]; }, shallowEqual);
|
|
8
|
-
};
|
|
9
|
-
const useConnectivityActions = () => {
|
|
10
|
-
const dispatch = useDispatch();
|
|
11
|
-
return useMemo(() => bindActionCreators(connectivityActions, dispatch), [connectivityActions]);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { useConnectivityState as a, useConnectivityActions as u };
|
package/hooks-7fc5d634.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { subscriptionsStoreName, bindActionCreators, subscriptionActions } from '@frontegg/redux-store';
|
|
2
|
-
import { u as useSelector, a as useDispatch } from './FronteggStoreContext-d6c3b684.js';
|
|
3
|
-
import { shallowEqual } from 'react-redux';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
|
-
|
|
6
|
-
function getSubscriptionState(state) {
|
|
7
|
-
return state[subscriptionsStoreName];
|
|
8
|
-
}
|
|
9
|
-
const usePaymentProvider = () => {
|
|
10
|
-
return useSelector((state) => getSubscriptionState(state).config, shallowEqual);
|
|
11
|
-
};
|
|
12
|
-
const usePaymentProviderActions = () => {
|
|
13
|
-
const dispatch = useDispatch();
|
|
14
|
-
return useMemo(() => bindActionCreators(subscriptionActions.config, dispatch), [dispatch]);
|
|
15
|
-
};
|
|
16
|
-
const usePlans = () => {
|
|
17
|
-
return useSelector((state) => getSubscriptionState(state).plans, shallowEqual);
|
|
18
|
-
};
|
|
19
|
-
const usePlansActions = () => {
|
|
20
|
-
const dispatch = useDispatch();
|
|
21
|
-
return useMemo(() => bindActionCreators(subscriptionActions.plans, dispatch), [dispatch]);
|
|
22
|
-
};
|
|
23
|
-
const useCheckout = () => {
|
|
24
|
-
return useSelector((state) => getSubscriptionState(state).checkout, shallowEqual);
|
|
25
|
-
};
|
|
26
|
-
const useCheckoutActions = () => {
|
|
27
|
-
const dispatch = useDispatch();
|
|
28
|
-
return useMemo(() => bindActionCreators(subscriptionActions.checkout, dispatch), [dispatch]);
|
|
29
|
-
};
|
|
30
|
-
const useBillingActions = (billingKey) => {
|
|
31
|
-
const dispatch = useDispatch();
|
|
32
|
-
return useMemo(() => bindActionCreators(subscriptionActions.billing[billingKey], dispatch), [billingKey, dispatch]);
|
|
33
|
-
};
|
|
34
|
-
const useBillingInformation = () => useSelector((state) => getSubscriptionState(state).billing.information, shallowEqual);
|
|
35
|
-
const useBillingInformationActions = () => useBillingActions('information');
|
|
36
|
-
const usePaymentMethod = () => useSelector((state) => getSubscriptionState(state).billing.paymentMethod, shallowEqual);
|
|
37
|
-
const usePaymentMethodActions = () => useBillingActions('paymentMethod');
|
|
38
|
-
const useInvoices = () => useSelector((state) => getSubscriptionState(state).billing.invoices, shallowEqual);
|
|
39
|
-
const useInvoicesActions = () => useBillingActions('invoices');
|
|
40
|
-
const useStripeState = () => {
|
|
41
|
-
return useSelector((state) => getSubscriptionState(state).stripe, shallowEqual);
|
|
42
|
-
};
|
|
43
|
-
const useStripeActions = () => {
|
|
44
|
-
const dispatch = useDispatch();
|
|
45
|
-
return useMemo(() => bindActionCreators(subscriptionActions.stripe, dispatch), [dispatch]);
|
|
46
|
-
};
|
|
47
|
-
const useSubscriptionCancellation = () => {
|
|
48
|
-
return useSelector((state) => getSubscriptionState(state).billing.subscription.cancellation, shallowEqual);
|
|
49
|
-
};
|
|
50
|
-
const useSubscriptionRenewal = () => {
|
|
51
|
-
return useSelector((state) => getSubscriptionState(state).billing.subscription.renewal, shallowEqual);
|
|
52
|
-
};
|
|
53
|
-
const useSubscription = () => {
|
|
54
|
-
return useSelector((state) => {
|
|
55
|
-
const { billing: { subscription }, } = getSubscriptionState(state);
|
|
56
|
-
return subscription;
|
|
57
|
-
}, shallowEqual);
|
|
58
|
-
};
|
|
59
|
-
const useSubscriptionActions = () => {
|
|
60
|
-
const dispatch = useDispatch();
|
|
61
|
-
return useMemo(() => bindActionCreators(subscriptionActions.billing.subscription, dispatch), [dispatch]);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export { usePaymentProviderActions as a, usePlans as b, usePlansActions as c, useCheckout as d, useCheckoutActions as e, useBillingInformation as f, useBillingInformationActions as g, usePaymentMethod as h, usePaymentMethodActions as i, useInvoices as j, useInvoicesActions as k, useStripeState as l, useStripeActions as m, useSubscriptionCancellation as n, useSubscriptionRenewal as o, useSubscription as p, useSubscriptionActions as q, usePaymentProvider as u };
|
package/hooks-eaf879c9.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { vendorStoreName, bindActionCreators, vendorActions } from '@frontegg/redux-store';
|
|
3
|
-
import { shallowEqual } from 'react-redux';
|
|
4
|
-
import { u as useSelector, a as useDispatch } from './FronteggStoreContext-d6c3b684.js';
|
|
5
|
-
|
|
6
|
-
const useVendorState = (stateMapper) => {
|
|
7
|
-
return useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[vendorStoreName])) !== null && _a !== void 0 ? _a : state[vendorStoreName]; }, shallowEqual);
|
|
8
|
-
};
|
|
9
|
-
const useVendorActions = () => {
|
|
10
|
-
const dispatch = useDispatch();
|
|
11
|
-
return useMemo(() => bindActionCreators(vendorActions, dispatch), [vendorActions]);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { useVendorState as a, useVendorActions as u };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var reactRedux = require('react-redux');
|
|
5
|
-
|
|
6
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
|
-
|
|
8
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
9
|
-
|
|
10
|
-
const FronteggStoreContext = React__default['default'].createContext(null);
|
|
11
|
-
const useSelector = reactRedux.createSelectorHook(FronteggStoreContext);
|
|
12
|
-
const useDispatch = reactRedux.createDispatchHook(FronteggStoreContext);
|
|
13
|
-
const useStore = reactRedux.createStoreHook(FronteggStoreContext);
|
|
14
|
-
|
|
15
|
-
exports.FronteggStoreContext = FronteggStoreContext;
|
|
16
|
-
exports.useDispatch = useDispatch;
|
|
17
|
-
exports.useSelector = useSelector;
|
|
18
|
-
exports.useStore = useStore;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var reduxStore = require('@frontegg/redux-store');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var reactRedux = require('react-redux');
|
|
6
|
-
var FronteggStoreContext = require('./FronteggStoreContext-6cfac56c.js');
|
|
7
|
-
|
|
8
|
-
const useAuditsState = (stateMapper) => {
|
|
9
|
-
return FronteggStoreContext.useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[reduxStore.auditsStoreName])) !== null && _a !== void 0 ? _a : state[reduxStore.auditsStoreName]; }, reactRedux.shallowEqual);
|
|
10
|
-
};
|
|
11
|
-
const useAuditsActions = () => {
|
|
12
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
13
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.auditsActions, dispatch), [reduxStore.auditsActions]);
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* hooks helpers
|
|
17
|
-
*/
|
|
18
|
-
const sliceReducerActionsBy = (reducer) => {
|
|
19
|
-
const reducerKeys = Object.keys(reducer);
|
|
20
|
-
const reducerActions = reducerKeys.map((key) => ({ [key]: reduxStore.auditsActions[key] }));
|
|
21
|
-
return reducerActions.reduce((p, n) => (Object.assign(Object.assign({}, p), n)), {});
|
|
22
|
-
};
|
|
23
|
-
const stateHookGenerator = (stateMapper, subState) => {
|
|
24
|
-
return FronteggStoreContext.useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[reduxStore.auditsStoreName][subState])) !== null && _a !== void 0 ? _a : state[reduxStore.auditsStoreName][subState]; }, reactRedux.shallowEqual);
|
|
25
|
-
};
|
|
26
|
-
const reducerActionsGenerator = (actions, reducers) => {
|
|
27
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
28
|
-
return React.useMemo(() => reduxStore.bindActionCreators(Object.assign(Object.assign({}, actions), sliceReducerActionsBy(reducers)), dispatch), [dispatch]);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const useAuditLogsState = (stateMapper) => stateHookGenerator(stateMapper, 'auditLogsState');
|
|
32
|
-
const useAuditLogsActions = () => reducerActionsGenerator(reduxStore.auditLogsActions, reduxStore.auditLogsReducers);
|
|
33
|
-
|
|
34
|
-
const useAuditsMetadataState = (stateMapper) => stateHookGenerator(stateMapper, 'auditsMetadataState');
|
|
35
|
-
const useAuditsMetadataActions = () => reducerActionsGenerator(reduxStore.auditsMetadataActions, reduxStore.auditsMetadataReducers);
|
|
36
|
-
|
|
37
|
-
exports.useAuditLogsActions = useAuditLogsActions;
|
|
38
|
-
exports.useAuditLogsState = useAuditLogsState;
|
|
39
|
-
exports.useAuditsActions = useAuditsActions;
|
|
40
|
-
exports.useAuditsMetadataActions = useAuditsMetadataActions;
|
|
41
|
-
exports.useAuditsMetadataState = useAuditsMetadataState;
|
|
42
|
-
exports.useAuditsState = useAuditsState;
|
package/node/hooks-429ffd3a.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var reduxStore = require('@frontegg/redux-store');
|
|
4
|
-
var FronteggStoreContext = require('./FronteggStoreContext-6cfac56c.js');
|
|
5
|
-
var reactRedux = require('react-redux');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
|
|
8
|
-
function getSubscriptionState(state) {
|
|
9
|
-
return state[reduxStore.subscriptionsStoreName];
|
|
10
|
-
}
|
|
11
|
-
const usePaymentProvider = () => {
|
|
12
|
-
return FronteggStoreContext.useSelector((state) => getSubscriptionState(state).config, reactRedux.shallowEqual);
|
|
13
|
-
};
|
|
14
|
-
const usePaymentProviderActions = () => {
|
|
15
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
16
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.subscriptionActions.config, dispatch), [dispatch]);
|
|
17
|
-
};
|
|
18
|
-
const usePlans = () => {
|
|
19
|
-
return FronteggStoreContext.useSelector((state) => getSubscriptionState(state).plans, reactRedux.shallowEqual);
|
|
20
|
-
};
|
|
21
|
-
const usePlansActions = () => {
|
|
22
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
23
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.subscriptionActions.plans, dispatch), [dispatch]);
|
|
24
|
-
};
|
|
25
|
-
const useCheckout = () => {
|
|
26
|
-
return FronteggStoreContext.useSelector((state) => getSubscriptionState(state).checkout, reactRedux.shallowEqual);
|
|
27
|
-
};
|
|
28
|
-
const useCheckoutActions = () => {
|
|
29
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
30
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.subscriptionActions.checkout, dispatch), [dispatch]);
|
|
31
|
-
};
|
|
32
|
-
const useBillingActions = (billingKey) => {
|
|
33
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
34
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.subscriptionActions.billing[billingKey], dispatch), [billingKey, dispatch]);
|
|
35
|
-
};
|
|
36
|
-
const useBillingInformation = () => FronteggStoreContext.useSelector((state) => getSubscriptionState(state).billing.information, reactRedux.shallowEqual);
|
|
37
|
-
const useBillingInformationActions = () => useBillingActions('information');
|
|
38
|
-
const usePaymentMethod = () => FronteggStoreContext.useSelector((state) => getSubscriptionState(state).billing.paymentMethod, reactRedux.shallowEqual);
|
|
39
|
-
const usePaymentMethodActions = () => useBillingActions('paymentMethod');
|
|
40
|
-
const useInvoices = () => FronteggStoreContext.useSelector((state) => getSubscriptionState(state).billing.invoices, reactRedux.shallowEqual);
|
|
41
|
-
const useInvoicesActions = () => useBillingActions('invoices');
|
|
42
|
-
const useStripeState = () => {
|
|
43
|
-
return FronteggStoreContext.useSelector((state) => getSubscriptionState(state).stripe, reactRedux.shallowEqual);
|
|
44
|
-
};
|
|
45
|
-
const useStripeActions = () => {
|
|
46
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
47
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.subscriptionActions.stripe, dispatch), [dispatch]);
|
|
48
|
-
};
|
|
49
|
-
const useSubscriptionCancellation = () => {
|
|
50
|
-
return FronteggStoreContext.useSelector((state) => getSubscriptionState(state).billing.subscription.cancellation, reactRedux.shallowEqual);
|
|
51
|
-
};
|
|
52
|
-
const useSubscriptionRenewal = () => {
|
|
53
|
-
return FronteggStoreContext.useSelector((state) => getSubscriptionState(state).billing.subscription.renewal, reactRedux.shallowEqual);
|
|
54
|
-
};
|
|
55
|
-
const useSubscription = () => {
|
|
56
|
-
return FronteggStoreContext.useSelector((state) => {
|
|
57
|
-
const { billing: { subscription }, } = getSubscriptionState(state);
|
|
58
|
-
return subscription;
|
|
59
|
-
}, reactRedux.shallowEqual);
|
|
60
|
-
};
|
|
61
|
-
const useSubscriptionActions = () => {
|
|
62
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
63
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.subscriptionActions.billing.subscription, dispatch), [dispatch]);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
exports.useBillingInformation = useBillingInformation;
|
|
67
|
-
exports.useBillingInformationActions = useBillingInformationActions;
|
|
68
|
-
exports.useCheckout = useCheckout;
|
|
69
|
-
exports.useCheckoutActions = useCheckoutActions;
|
|
70
|
-
exports.useInvoices = useInvoices;
|
|
71
|
-
exports.useInvoicesActions = useInvoicesActions;
|
|
72
|
-
exports.usePaymentMethod = usePaymentMethod;
|
|
73
|
-
exports.usePaymentMethodActions = usePaymentMethodActions;
|
|
74
|
-
exports.usePaymentProvider = usePaymentProvider;
|
|
75
|
-
exports.usePaymentProviderActions = usePaymentProviderActions;
|
|
76
|
-
exports.usePlans = usePlans;
|
|
77
|
-
exports.usePlansActions = usePlansActions;
|
|
78
|
-
exports.useStripeActions = useStripeActions;
|
|
79
|
-
exports.useStripeState = useStripeState;
|
|
80
|
-
exports.useSubscription = useSubscription;
|
|
81
|
-
exports.useSubscriptionActions = useSubscriptionActions;
|
|
82
|
-
exports.useSubscriptionCancellation = useSubscriptionCancellation;
|
|
83
|
-
exports.useSubscriptionRenewal = useSubscriptionRenewal;
|
package/node/hooks-5d5a445e.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var reactRedux = require('react-redux');
|
|
5
|
-
var FronteggStoreContext = require('./FronteggStoreContext-6cfac56c.js');
|
|
6
|
-
var reduxStore = require('@frontegg/redux-store');
|
|
7
|
-
|
|
8
|
-
const useConnectivityState = (stateMapper) => {
|
|
9
|
-
return FronteggStoreContext.useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[reduxStore.connectivityStoreName])) !== null && _a !== void 0 ? _a : state[reduxStore.connectivityStoreName]; }, reactRedux.shallowEqual);
|
|
10
|
-
};
|
|
11
|
-
const useConnectivityActions = () => {
|
|
12
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
13
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.connectivityActions, dispatch), [reduxStore.connectivityActions]);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.useConnectivityActions = useConnectivityActions;
|
|
17
|
-
exports.useConnectivityState = useConnectivityState;
|
package/node/hooks-cf739b27.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var reduxStore = require('@frontegg/redux-store');
|
|
5
|
-
var reactRedux = require('react-redux');
|
|
6
|
-
var FronteggStoreContext = require('./FronteggStoreContext-6cfac56c.js');
|
|
7
|
-
|
|
8
|
-
const useVendorState = (stateMapper) => {
|
|
9
|
-
return FronteggStoreContext.useSelector((state) => { var _a; return (_a = stateMapper === null || stateMapper === void 0 ? void 0 : stateMapper(state[reduxStore.vendorStoreName])) !== null && _a !== void 0 ? _a : state[reduxStore.vendorStoreName]; }, reactRedux.shallowEqual);
|
|
10
|
-
};
|
|
11
|
-
const useVendorActions = () => {
|
|
12
|
-
const dispatch = FronteggStoreContext.useDispatch();
|
|
13
|
-
return React.useMemo(() => reduxStore.bindActionCreators(reduxStore.vendorActions, dispatch), [reduxStore.vendorActions]);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.useVendorActions = useVendorActions;
|
|
17
|
-
exports.useVendorState = useVendorState;
|