@frontegg/react-hooks 5.59.1 → 6.0.1-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.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
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useConnectivityActions", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _hooks.useConnectivityActions;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useConnectivityState", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _hooks.useConnectivityState;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
4
18
|
|
|
5
|
-
var
|
|
6
|
-
require('react');
|
|
7
|
-
require('react-redux');
|
|
8
|
-
require('../FronteggStoreContext-6cfac56c.js');
|
|
9
|
-
require('@frontegg/redux-store');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.useConnectivityActions = hooks.useConnectivityActions;
|
|
14
|
-
exports.useConnectivityState = hooks.useConnectivityState;
|
|
19
|
+
var _hooks = require("./hooks");
|
package/node/index.js
CHANGED
|
@@ -1,190 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const calculatedBasename = basename ? (basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '') : '';
|
|
63
|
-
const checkRoutes = tslib.__rest(routes, ["authenticatedUrl", "signUpSuccessUrl"]);
|
|
64
|
-
if (Object.values(checkRoutes).map(url => `${calculatedBasename}${url}`).indexOf(uri) !== -1) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
return React__default['default'].createElement(React__default['default'].Fragment, null, children);
|
|
68
|
-
};
|
|
69
|
-
const FronteggContent = ({ children, app, setLoading }) => {
|
|
70
|
-
var _a, _b, _c;
|
|
71
|
-
const { isLoading } = roles.useAuth(({ isLoading }) => ({ isLoading }));
|
|
72
|
-
const customLoginBox = !app || ((_a = app === null || app === void 0 ? void 0 : app.options) === null || _a === void 0 ? void 0 : _a.customLoginBox) === true;
|
|
73
|
-
const alwaysShowChildren = customLoginBox || (((_b = app === null || app === void 0 ? void 0 : app.options) === null || _b === void 0 ? void 0 : _b.hostedLoginBox) === true && ((_c = app === null || app === void 0 ? void 0 : app.options) === null || _c === void 0 ? void 0 : _c.framework) === 'nextjs');
|
|
74
|
-
const loadingRef = React.useRef(undefined);
|
|
75
|
-
if (isLoading !== loadingRef.current) {
|
|
76
|
-
loadingRef.current = isLoading;
|
|
77
|
-
setLoading(isLoading);
|
|
78
|
-
}
|
|
79
|
-
if (isLoading) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
if (alwaysShowChildren) {
|
|
83
|
-
return React__default['default'].createElement(React__default['default'].Fragment, null, children);
|
|
84
|
-
}
|
|
85
|
-
return React__default['default'].createElement(HideChildrenIfFronteggRoutes, { basename: app === null || app === void 0 ? void 0 : app.options.basename }, children);
|
|
86
|
-
};
|
|
87
|
-
const FronteggStoreProvider = ({ children, app, contextOptions, setLoading: setLoadingProps, }) => {
|
|
88
|
-
var _a, _b, _c, _d, _e, _f;
|
|
89
|
-
const context = (_b = (_a = app === null || app === void 0 ? void 0 : app.options) === null || _a === void 0 ? void 0 : _a.contextOptions) !== null && _b !== void 0 ? _b : contextOptions;
|
|
90
|
-
const previewMode = (_d = (_c = app === null || app === void 0 ? void 0 : app.options) === null || _c === void 0 ? void 0 : _c.previewMode) !== null && _d !== void 0 ? _d : false;
|
|
91
|
-
const authOptions = (_f = (_e = app === null || app === void 0 ? void 0 : app.options) === null || _e === void 0 ? void 0 : _e.authOptions) !== null && _f !== void 0 ? _f : {};
|
|
92
|
-
restApi.ContextHolder.setContext(context);
|
|
93
|
-
const store = React.useMemo(() => reduxStore.createFronteggStore({ context: context }, app, previewMode, authOptions), [app, previewMode]);
|
|
94
|
-
return (React__default['default'].createElement(reactRedux.Provider, { context: FronteggStoreContext.FronteggStoreContext, store: store },
|
|
95
|
-
React__default['default'].createElement(FronteggContent, { setLoading: setLoadingProps !== null && setLoadingProps !== void 0 ? setLoadingProps : setLoading, app: app }, children)));
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
exports.ShadowDomContext = roles.ShadowDomContext;
|
|
99
|
-
exports.reloadProfileIfNeeded = roles.reloadProfileIfNeeded;
|
|
100
|
-
exports.useAcceptInvitationActions = roles.useAcceptInvitationActions;
|
|
101
|
-
exports.useAcceptInvitationState = roles.useAcceptInvitationState;
|
|
102
|
-
exports.useActivateAccountActions = roles.useActivateAccountActions;
|
|
103
|
-
exports.useActivateAccountState = roles.useActivateAccountState;
|
|
104
|
-
exports.useApiTokensActions = roles.useApiTokensActions;
|
|
105
|
-
exports.useApiTokensState = roles.useApiTokensState;
|
|
106
|
-
exports.useAuth = roles.useAuth;
|
|
107
|
-
exports.useAuthActions = roles.useAuthActions;
|
|
108
|
-
exports.useAuthRoutes = roles.useAuthRoutes;
|
|
109
|
-
exports.useAuthTeamActions = roles.useAuthTeamActions;
|
|
110
|
-
exports.useAuthTeamState = roles.useAuthTeamState;
|
|
111
|
-
exports.useAuthUser = roles.useAuthUser;
|
|
112
|
-
exports.useAuthUserOrNull = roles.useAuthUserOrNull;
|
|
113
|
-
exports.useForgotPasswordActions = roles.useForgotPasswordActions;
|
|
114
|
-
exports.useForgotPasswordState = roles.useForgotPasswordState;
|
|
115
|
-
exports.useIsAuthenticated = roles.useIsAuthenticated;
|
|
116
|
-
exports.useLoginActions = roles.useLoginActions;
|
|
117
|
-
exports.useLoginState = roles.useLoginState;
|
|
118
|
-
exports.useLoginWithRedirect = roles.useLoginWithRedirect;
|
|
119
|
-
exports.useMfaActions = roles.useMfaActions;
|
|
120
|
-
exports.useMfaState = roles.useMfaState;
|
|
121
|
-
exports.useOnRedirectTo = roles.useOnRedirectTo;
|
|
122
|
-
exports.useProfileActions = roles.useProfileActions;
|
|
123
|
-
exports.useProfileState = roles.useProfileState;
|
|
124
|
-
exports.usePublicPolicySettings = roles.usePublicPolicySettings;
|
|
125
|
-
exports.useResetPhoneNumberActions = roles.useResetPhoneNumberActions;
|
|
126
|
-
exports.useResetPhoneNumberState = roles.useResetPhoneNumberState;
|
|
127
|
-
exports.useRolesActions = roles.useRolesActions;
|
|
128
|
-
exports.useRolesState = roles.useRolesState;
|
|
129
|
-
exports.useSSOActions = roles.useSSOActions;
|
|
130
|
-
exports.useSSOState = roles.useSSOState;
|
|
131
|
-
exports.useSecurityPolicyActions = roles.useSecurityPolicyActions;
|
|
132
|
-
exports.useSecurityPolicyState = roles.useSecurityPolicyState;
|
|
133
|
-
exports.useShadowDom = roles.useShadowDom;
|
|
134
|
-
exports.useSignUpActions = roles.useSignUpActions;
|
|
135
|
-
exports.useSignUpState = roles.useSignUpState;
|
|
136
|
-
exports.useSocialLoginActions = roles.useSocialLoginActions;
|
|
137
|
-
exports.useSocialLoginState = roles.useSocialLoginState;
|
|
138
|
-
exports.useTenantsActions = roles.useTenantsActions;
|
|
139
|
-
exports.useTenantsState = roles.useTenantsState;
|
|
140
|
-
exports.useAuditLogsActions = auditsMetadata.useAuditLogsActions;
|
|
141
|
-
exports.useAuditLogsState = auditsMetadata.useAuditLogsState;
|
|
142
|
-
exports.useAuditsActions = auditsMetadata.useAuditsActions;
|
|
143
|
-
exports.useAuditsMetadataActions = auditsMetadata.useAuditsMetadataActions;
|
|
144
|
-
exports.useAuditsMetadataState = auditsMetadata.useAuditsMetadataState;
|
|
145
|
-
exports.useAuditsState = auditsMetadata.useAuditsState;
|
|
146
|
-
exports.useConnectivityActions = hooks.useConnectivityActions;
|
|
147
|
-
exports.useConnectivityState = hooks.useConnectivityState;
|
|
148
|
-
exports.useBillingInformation = hooks$1.useBillingInformation;
|
|
149
|
-
exports.useBillingInformationActions = hooks$1.useBillingInformationActions;
|
|
150
|
-
exports.useCheckout = hooks$1.useCheckout;
|
|
151
|
-
exports.useCheckoutActions = hooks$1.useCheckoutActions;
|
|
152
|
-
exports.useInvoices = hooks$1.useInvoices;
|
|
153
|
-
exports.useInvoicesActions = hooks$1.useInvoicesActions;
|
|
154
|
-
exports.usePaymentMethod = hooks$1.usePaymentMethod;
|
|
155
|
-
exports.usePaymentMethodActions = hooks$1.usePaymentMethodActions;
|
|
156
|
-
exports.usePaymentProvider = hooks$1.usePaymentProvider;
|
|
157
|
-
exports.usePaymentProviderActions = hooks$1.usePaymentProviderActions;
|
|
158
|
-
exports.usePlans = hooks$1.usePlans;
|
|
159
|
-
exports.usePlansActions = hooks$1.usePlansActions;
|
|
160
|
-
exports.useStripeActions = hooks$1.useStripeActions;
|
|
161
|
-
exports.useStripeState = hooks$1.useStripeState;
|
|
162
|
-
exports.useSubscription = hooks$1.useSubscription;
|
|
163
|
-
exports.useSubscriptionActions = hooks$1.useSubscriptionActions;
|
|
164
|
-
exports.useSubscriptionCancellation = hooks$1.useSubscriptionCancellation;
|
|
165
|
-
exports.useSubscriptionRenewal = hooks$1.useSubscriptionRenewal;
|
|
166
|
-
exports.useVendorActions = hooks$2.useVendorActions;
|
|
167
|
-
exports.useVendorState = hooks$2.useVendorState;
|
|
168
|
-
Object.defineProperty(exports, 'Provider', {
|
|
169
|
-
enumerable: true,
|
|
170
|
-
get: function () {
|
|
171
|
-
return reactRedux.Provider;
|
|
172
|
-
}
|
|
1
|
+
/** @license Frontegg v6.0.1-alpha.0
|
|
2
|
+
*
|
|
3
|
+
* This source code is licensed under the MIT license found in the
|
|
4
|
+
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
*/
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
var _common = require("./common");
|
|
13
|
+
|
|
14
|
+
Object.keys(_common).forEach(function (key) {
|
|
15
|
+
if (key === "default" || key === "__esModule") return;
|
|
16
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _common[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _audits = require("./audits");
|
|
26
|
+
|
|
27
|
+
Object.keys(_audits).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (key in exports && exports[key] === _audits[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _audits[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var _auth = require("./auth");
|
|
39
|
+
|
|
40
|
+
Object.keys(_auth).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _auth[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _auth[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var _connectivity = require("./connectivity");
|
|
52
|
+
|
|
53
|
+
Object.keys(_connectivity).forEach(function (key) {
|
|
54
|
+
if (key === "default" || key === "__esModule") return;
|
|
55
|
+
if (key in exports && exports[key] === _connectivity[key]) return;
|
|
56
|
+
Object.defineProperty(exports, key, {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return _connectivity[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
173
62
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
63
|
+
|
|
64
|
+
var _subscriptions = require("./subscriptions");
|
|
65
|
+
|
|
66
|
+
Object.keys(_subscriptions).forEach(function (key) {
|
|
67
|
+
if (key === "default" || key === "__esModule") return;
|
|
68
|
+
if (key in exports && exports[key] === _subscriptions[key]) return;
|
|
69
|
+
Object.defineProperty(exports, key, {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () {
|
|
72
|
+
return _subscriptions[key];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
179
75
|
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
76
|
+
|
|
77
|
+
var _vendor = require("./vendor");
|
|
78
|
+
|
|
79
|
+
Object.keys(_vendor).forEach(function (key) {
|
|
80
|
+
if (key === "default" || key === "__esModule") return;
|
|
81
|
+
if (key in exports && exports[key] === _vendor[key]) return;
|
|
82
|
+
Object.defineProperty(exports, key, {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () {
|
|
85
|
+
return _vendor[key];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
185
88
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
89
|
+
|
|
90
|
+
var _FronteggProvider = require("./FronteggProvider");
|
|
91
|
+
|
|
92
|
+
Object.keys(_FronteggProvider).forEach(function (key) {
|
|
93
|
+
if (key === "default" || key === "__esModule") return;
|
|
94
|
+
if (key in exports && exports[key] === _FronteggProvider[key]) return;
|
|
95
|
+
Object.defineProperty(exports, key, {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () {
|
|
98
|
+
return _FronteggProvider[key];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
var _FronteggStoreContext = require("./FronteggStoreContext");
|
|
104
|
+
|
|
105
|
+
Object.keys(_FronteggStoreContext).forEach(function (key) {
|
|
106
|
+
if (key === "default" || key === "__esModule") return;
|
|
107
|
+
if (key in exports && exports[key] === _FronteggStoreContext[key]) return;
|
|
108
|
+
Object.defineProperty(exports, key, {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _FronteggStoreContext[key];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSubscriptionRenewal = exports.useSubscriptionCancellation = exports.useSubscriptionActions = exports.useSubscription = exports.useStripeState = exports.useStripeActions = exports.usePlansActions = exports.usePlans = exports.usePaymentProviderActions = exports.usePaymentProvider = exports.usePaymentMethodActions = exports.usePaymentMethod = exports.useInvoicesActions = exports.useInvoices = exports.useCheckoutActions = exports.useCheckout = exports.useBillingInformationActions = exports.useBillingInformation = void 0;
|
|
7
|
+
|
|
8
|
+
var _reduxStore = require("@frontegg/redux-store");
|
|
9
|
+
|
|
10
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
11
|
+
|
|
12
|
+
var _reactRedux = require("react-redux");
|
|
13
|
+
|
|
14
|
+
var _react = require("react");
|
|
15
|
+
|
|
16
|
+
function getSubscriptionState(state) {
|
|
17
|
+
return state[_reduxStore.subscriptionsStoreName];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const usePaymentProvider = () => {
|
|
21
|
+
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).config, _reactRedux.shallowEqual);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.usePaymentProvider = usePaymentProvider;
|
|
25
|
+
|
|
26
|
+
const usePaymentProviderActions = () => {
|
|
27
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
28
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.config, dispatch), [dispatch]);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.usePaymentProviderActions = usePaymentProviderActions;
|
|
32
|
+
|
|
33
|
+
const usePlans = () => {
|
|
34
|
+
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).plans, _reactRedux.shallowEqual);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.usePlans = usePlans;
|
|
38
|
+
|
|
39
|
+
const usePlansActions = () => {
|
|
40
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
41
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.plans, dispatch), [dispatch]);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.usePlansActions = usePlansActions;
|
|
45
|
+
|
|
46
|
+
const useCheckout = () => {
|
|
47
|
+
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).checkout, _reactRedux.shallowEqual);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.useCheckout = useCheckout;
|
|
51
|
+
|
|
52
|
+
const useCheckoutActions = () => {
|
|
53
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
54
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.checkout, dispatch), [dispatch]);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.useCheckoutActions = useCheckoutActions;
|
|
58
|
+
|
|
59
|
+
const useBillingActions = billingKey => {
|
|
60
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
61
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.billing[billingKey], dispatch), [billingKey, dispatch]);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const useBillingInformation = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.information, _reactRedux.shallowEqual);
|
|
65
|
+
|
|
66
|
+
exports.useBillingInformation = useBillingInformation;
|
|
67
|
+
|
|
68
|
+
const useBillingInformationActions = () => useBillingActions('information');
|
|
69
|
+
|
|
70
|
+
exports.useBillingInformationActions = useBillingInformationActions;
|
|
71
|
+
|
|
72
|
+
const usePaymentMethod = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.paymentMethod, _reactRedux.shallowEqual);
|
|
73
|
+
|
|
74
|
+
exports.usePaymentMethod = usePaymentMethod;
|
|
75
|
+
|
|
76
|
+
const usePaymentMethodActions = () => useBillingActions('paymentMethod');
|
|
77
|
+
|
|
78
|
+
exports.usePaymentMethodActions = usePaymentMethodActions;
|
|
79
|
+
|
|
80
|
+
const useInvoices = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.invoices, _reactRedux.shallowEqual);
|
|
81
|
+
|
|
82
|
+
exports.useInvoices = useInvoices;
|
|
83
|
+
|
|
84
|
+
const useInvoicesActions = () => useBillingActions('invoices');
|
|
85
|
+
|
|
86
|
+
exports.useInvoicesActions = useInvoicesActions;
|
|
87
|
+
|
|
88
|
+
const useStripeState = () => {
|
|
89
|
+
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).stripe, _reactRedux.shallowEqual);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.useStripeState = useStripeState;
|
|
93
|
+
|
|
94
|
+
const useStripeActions = () => {
|
|
95
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
96
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.stripe, dispatch), [dispatch]);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
exports.useStripeActions = useStripeActions;
|
|
100
|
+
|
|
101
|
+
const useSubscriptionCancellation = () => {
|
|
102
|
+
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.subscription.cancellation, _reactRedux.shallowEqual);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
exports.useSubscriptionCancellation = useSubscriptionCancellation;
|
|
106
|
+
|
|
107
|
+
const useSubscriptionRenewal = () => {
|
|
108
|
+
return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.subscription.renewal, _reactRedux.shallowEqual);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
exports.useSubscriptionRenewal = useSubscriptionRenewal;
|
|
112
|
+
|
|
113
|
+
const useSubscription = () => {
|
|
114
|
+
return (0, _FronteggStoreContext.useSelector)(state => {
|
|
115
|
+
const {
|
|
116
|
+
billing: {
|
|
117
|
+
subscription
|
|
118
|
+
}
|
|
119
|
+
} = getSubscriptionState(state);
|
|
120
|
+
return subscription;
|
|
121
|
+
}, _reactRedux.shallowEqual);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
exports.useSubscription = useSubscription;
|
|
125
|
+
|
|
126
|
+
const useSubscriptionActions = () => {
|
|
127
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
128
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.billing.subscription, dispatch), [dispatch]);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
exports.useSubscriptionActions = useSubscriptionActions;
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
|
|
5
|
-
var
|
|
6
|
-
require('@frontegg/redux-store');
|
|
7
|
-
require('../FronteggStoreContext-6cfac56c.js');
|
|
8
|
-
require('react');
|
|
9
|
-
require('react-redux');
|
|
7
|
+
var _hooks = require("./hooks");
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports
|
|
14
|
-
exports
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports.usePaymentProvider = hooks.usePaymentProvider;
|
|
22
|
-
exports.usePaymentProviderActions = hooks.usePaymentProviderActions;
|
|
23
|
-
exports.usePlans = hooks.usePlans;
|
|
24
|
-
exports.usePlansActions = hooks.usePlansActions;
|
|
25
|
-
exports.useStripeActions = hooks.useStripeActions;
|
|
26
|
-
exports.useStripeState = hooks.useStripeState;
|
|
27
|
-
exports.useSubscription = hooks.useSubscription;
|
|
28
|
-
exports.useSubscriptionActions = hooks.useSubscriptionActions;
|
|
29
|
-
exports.useSubscriptionCancellation = hooks.useSubscriptionCancellation;
|
|
30
|
-
exports.useSubscriptionRenewal = hooks.useSubscriptionRenewal;
|
|
9
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _hooks[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useVendorState = exports.useVendorActions = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _reduxStore = require("@frontegg/redux-store");
|
|
11
|
+
|
|
12
|
+
var _reactRedux = require("react-redux");
|
|
13
|
+
|
|
14
|
+
var _FronteggStoreContext = require("../FronteggStoreContext");
|
|
15
|
+
|
|
16
|
+
const useVendorState = stateMapper => {
|
|
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
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.useVendorState = useVendorState;
|
|
25
|
+
|
|
26
|
+
const useVendorActions = () => {
|
|
27
|
+
const dispatch = (0, _FronteggStoreContext.useDispatch)();
|
|
28
|
+
return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.vendorActions, dispatch), [_reduxStore.vendorActions]);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.useVendorActions = useVendorActions;
|
package/node/vendor/index.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useVendorActions", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _hooks.useVendorActions;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useVendorState", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _hooks.useVendorState;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
4
18
|
|
|
5
|
-
var
|
|
6
|
-
require('react');
|
|
7
|
-
require('@frontegg/redux-store');
|
|
8
|
-
require('react-redux');
|
|
9
|
-
require('../FronteggStoreContext-6cfac56c.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.useVendorActions = hooks.useVendorActions;
|
|
14
|
-
exports.useVendorState = hooks.useVendorState;
|
|
19
|
+
var _hooks = require("./hooks");
|
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/react-hooks",
|
|
3
|
-
"
|
|
4
|
-
"version": "5.59.1",
|
|
5
|
-
"author": "Frontegg LTD",
|
|
3
|
+
"version": "6.0.1-alpha.0",
|
|
6
4
|
"main": "./node/index.js",
|
|
7
|
-
"
|
|
8
|
-
"types": "./index.d.ts",
|
|
5
|
+
"license": "MIT",
|
|
9
6
|
"dependencies": {
|
|
10
|
-
"@
|
|
7
|
+
"@babel/runtime": "^7.17.2",
|
|
8
|
+
"@frontegg/redux-store": "6.0.1-alpha.0",
|
|
9
|
+
"@frontegg/types": "6.0.1-alpha.0",
|
|
10
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
11
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
11
12
|
"react-redux": "^7.x"
|
|
12
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"private": false,
|
|
16
|
+
"module": "./index.js",
|
|
17
|
+
"types": "./index.d.ts"
|
|
13
18
|
}
|
package/subscriptions/hooks.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { CheckoutActions, CheckoutState, PaymentProviderConfigActions, PaymentProviderConfigState, PlansActions, PlansState, StripeActions, StripeState, SubscriptionActions, SubscriptionState } from '@frontegg/redux-store';
|
|
2
|
-
export declare const usePaymentProvider: () => PaymentProviderConfigState;
|
|
3
|
-
export declare const usePaymentProviderActions: () => PaymentProviderConfigActions;
|
|
4
|
-
export declare const usePlans: () => PlansState;
|
|
5
|
-
export declare const usePlansActions: () => PlansActions;
|
|
6
|
-
export declare const useCheckout: () => CheckoutState;
|
|
7
|
-
export declare const useCheckoutActions: () => CheckoutActions;
|
|
8
|
-
export declare const useBillingInformation: () => import("@frontegg/redux-store").BillingInformationState;
|
|
9
|
-
export declare const useBillingInformationActions: () => import("@frontegg/redux-store").BillingInformationActions;
|
|
10
|
-
export declare const usePaymentMethod: () => import("@frontegg/redux-store").PaymentMethodState;
|
|
11
|
-
export declare const usePaymentMethodActions: () => import("@frontegg/redux-store").PaymentMethodActions;
|
|
12
|
-
export declare const useInvoices: () => import("@frontegg/redux-store").InvoicesState;
|
|
13
|
-
export declare const useInvoicesActions: () => import("@frontegg/redux-store").InvoicesActions;
|
|
14
|
-
export declare const useStripeState: () => StripeState;
|
|
15
|
-
export declare const useStripeActions: () => StripeActions;
|
|
16
|
-
export declare const useSubscriptionCancellation: () => SubscriptionState['cancellation'];
|
|
17
|
-
export declare const useSubscriptionRenewal: () => SubscriptionState['renewal'];
|
|
18
|
-
export declare const useSubscription: () => SubscriptionState;
|
|
19
|
-
export declare const useSubscriptionActions: () => SubscriptionActions;
|
|
1
|
+
import { CheckoutActions, CheckoutState, PaymentProviderConfigActions, PaymentProviderConfigState, PlansActions, PlansState, StripeActions, StripeState, SubscriptionActions, SubscriptionState } from '@frontegg/redux-store';
|
|
2
|
+
export declare const usePaymentProvider: () => PaymentProviderConfigState;
|
|
3
|
+
export declare const usePaymentProviderActions: () => PaymentProviderConfigActions;
|
|
4
|
+
export declare const usePlans: () => PlansState;
|
|
5
|
+
export declare const usePlansActions: () => PlansActions;
|
|
6
|
+
export declare const useCheckout: () => CheckoutState;
|
|
7
|
+
export declare const useCheckoutActions: () => CheckoutActions;
|
|
8
|
+
export declare const useBillingInformation: () => import("@frontegg/redux-store").BillingInformationState;
|
|
9
|
+
export declare const useBillingInformationActions: () => import("@frontegg/redux-store").BillingInformationActions;
|
|
10
|
+
export declare const usePaymentMethod: () => import("@frontegg/redux-store").PaymentMethodState;
|
|
11
|
+
export declare const usePaymentMethodActions: () => import("@frontegg/redux-store").PaymentMethodActions;
|
|
12
|
+
export declare const useInvoices: () => import("@frontegg/redux-store").InvoicesState;
|
|
13
|
+
export declare const useInvoicesActions: () => import("@frontegg/redux-store").InvoicesActions;
|
|
14
|
+
export declare const useStripeState: () => StripeState;
|
|
15
|
+
export declare const useStripeActions: () => StripeActions;
|
|
16
|
+
export declare const useSubscriptionCancellation: () => SubscriptionState['cancellation'];
|
|
17
|
+
export declare const useSubscriptionRenewal: () => SubscriptionState['renewal'];
|
|
18
|
+
export declare const useSubscription: () => SubscriptionState;
|
|
19
|
+
export declare const useSubscriptionActions: () => SubscriptionActions;
|