@frontegg/react-hooks 6.69.0 → 6.70.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.
Files changed (72) hide show
  1. package/FronteggProvider/index.js +2 -18
  2. package/FronteggStoreContext/index.js +2 -2
  3. package/audits/auditLogs.js +0 -2
  4. package/audits/auditsMetadata.js +0 -2
  5. package/audits/hooks.js +1 -2
  6. package/auth/acceptInvitation.js +1 -2
  7. package/auth/activateAccount.js +0 -2
  8. package/auth/apiTokens.js +0 -2
  9. package/auth/forgotPassword.js +0 -2
  10. package/auth/hooks.js +4 -8
  11. package/auth/impersonate.js +0 -2
  12. package/auth/login.js +0 -2
  13. package/auth/mfa.js +0 -2
  14. package/auth/profile.js +0 -2
  15. package/auth/provisioning.js +0 -2
  16. package/auth/resetPhoneNumber.js +0 -2
  17. package/auth/restrictions.js +4 -4
  18. package/auth/roles.js +0 -2
  19. package/auth/securityPolicy.js +4 -4
  20. package/auth/sessions.js +0 -2
  21. package/auth/sessionsPolicy.js +0 -2
  22. package/auth/signup.js +0 -2
  23. package/auth/socialLogin.js +0 -2
  24. package/auth/sso.js +0 -2
  25. package/auth/team.js +0 -2
  26. package/auth/tenants.js +0 -2
  27. package/common/index.d.ts +1 -1
  28. package/common/index.js +8 -10
  29. package/connectivity/hooks.js +0 -2
  30. package/flags/useFeatureFlags.js +0 -1
  31. package/index.js +1 -1
  32. package/node/FronteggProvider/index.js +2 -32
  33. package/node/FronteggStoreContext/index.js +2 -8
  34. package/node/audits/auditLogs.js +0 -6
  35. package/node/audits/auditsMetadata.js +0 -6
  36. package/node/audits/hooks.js +1 -18
  37. package/node/audits/index.js +0 -5
  38. package/node/auth/acceptInvitation.js +1 -6
  39. package/node/auth/activateAccount.js +0 -6
  40. package/node/auth/apiTokens.js +0 -6
  41. package/node/auth/forgotPassword.js +0 -6
  42. package/node/auth/hooks.js +4 -38
  43. package/node/auth/impersonate.js +0 -6
  44. package/node/auth/index.js +0 -41
  45. package/node/auth/login.js +0 -6
  46. package/node/auth/mfa.js +0 -6
  47. package/node/auth/profile.js +0 -9
  48. package/node/auth/provisioning.js +0 -6
  49. package/node/auth/resetPhoneNumber.js +0 -6
  50. package/node/auth/restrictions.js +4 -13
  51. package/node/auth/roles.js +0 -6
  52. package/node/auth/securityPolicy.js +4 -13
  53. package/node/auth/sessions.js +0 -6
  54. package/node/auth/sessionsPolicy.js +0 -6
  55. package/node/auth/signup.js +0 -6
  56. package/node/auth/socialLogin.js +0 -6
  57. package/node/auth/sso.js +0 -6
  58. package/node/auth/team.js +0 -6
  59. package/node/auth/tenants.js +0 -6
  60. package/node/common/index.js +8 -19
  61. package/node/connectivity/hooks.js +0 -8
  62. package/node/connectivity/index.js +0 -1
  63. package/node/flags/index.js +0 -2
  64. package/node/flags/useFeatureFlags.js +0 -4
  65. package/node/index.js +1 -19
  66. package/node/subscriptions/hooks.js +0 -46
  67. package/node/subscriptions/index.js +0 -2
  68. package/node/vendor/hooks.js +0 -8
  69. package/node/vendor/index.js +0 -1
  70. package/package.json +3 -3
  71. package/subscriptions/hooks.js +0 -4
  72. package/vendor/hooks.js +0 -2
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useFeatureFlags = void 0;
7
-
8
7
  var _common = require("../common");
9
-
10
8
  const useFeatureFlags = (...flags) => {
11
9
  var _injector$flags;
12
-
13
10
  const {
14
11
  injector
15
12
  } = (0, _common.useShadowDom)();
16
13
  const featureFlags = (_injector$flags = injector.flags) != null ? _injector$flags : {};
17
14
  return flags.map(flag => featureFlags[flag] === 'on');
18
15
  };
19
-
20
16
  exports.useFeatureFlags = useFeatureFlags;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.69.0
1
+ /** @license Frontegg v6.70.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.
@@ -8,9 +8,7 @@
8
8
  Object.defineProperty(exports, "__esModule", {
9
9
  value: true
10
10
  });
11
-
12
11
  var _common = require("./common");
13
-
14
12
  Object.keys(_common).forEach(function (key) {
15
13
  if (key === "default" || key === "__esModule") return;
16
14
  if (key in exports && exports[key] === _common[key]) return;
@@ -21,9 +19,7 @@ Object.keys(_common).forEach(function (key) {
21
19
  }
22
20
  });
23
21
  });
24
-
25
22
  var _audits = require("./audits");
26
-
27
23
  Object.keys(_audits).forEach(function (key) {
28
24
  if (key === "default" || key === "__esModule") return;
29
25
  if (key in exports && exports[key] === _audits[key]) return;
@@ -34,9 +30,7 @@ Object.keys(_audits).forEach(function (key) {
34
30
  }
35
31
  });
36
32
  });
37
-
38
33
  var _auth = require("./auth");
39
-
40
34
  Object.keys(_auth).forEach(function (key) {
41
35
  if (key === "default" || key === "__esModule") return;
42
36
  if (key in exports && exports[key] === _auth[key]) return;
@@ -47,9 +41,7 @@ Object.keys(_auth).forEach(function (key) {
47
41
  }
48
42
  });
49
43
  });
50
-
51
44
  var _connectivity = require("./connectivity");
52
-
53
45
  Object.keys(_connectivity).forEach(function (key) {
54
46
  if (key === "default" || key === "__esModule") return;
55
47
  if (key in exports && exports[key] === _connectivity[key]) return;
@@ -60,9 +52,7 @@ Object.keys(_connectivity).forEach(function (key) {
60
52
  }
61
53
  });
62
54
  });
63
-
64
55
  var _subscriptions = require("./subscriptions");
65
-
66
56
  Object.keys(_subscriptions).forEach(function (key) {
67
57
  if (key === "default" || key === "__esModule") return;
68
58
  if (key in exports && exports[key] === _subscriptions[key]) return;
@@ -73,9 +63,7 @@ Object.keys(_subscriptions).forEach(function (key) {
73
63
  }
74
64
  });
75
65
  });
76
-
77
66
  var _vendor = require("./vendor");
78
-
79
67
  Object.keys(_vendor).forEach(function (key) {
80
68
  if (key === "default" || key === "__esModule") return;
81
69
  if (key in exports && exports[key] === _vendor[key]) return;
@@ -86,9 +74,7 @@ Object.keys(_vendor).forEach(function (key) {
86
74
  }
87
75
  });
88
76
  });
89
-
90
77
  var _flags = require("./flags");
91
-
92
78
  Object.keys(_flags).forEach(function (key) {
93
79
  if (key === "default" || key === "__esModule") return;
94
80
  if (key in exports && exports[key] === _flags[key]) return;
@@ -99,9 +85,7 @@ Object.keys(_flags).forEach(function (key) {
99
85
  }
100
86
  });
101
87
  });
102
-
103
88
  var _FronteggProvider = require("./FronteggProvider");
104
-
105
89
  Object.keys(_FronteggProvider).forEach(function (key) {
106
90
  if (key === "default" || key === "__esModule") return;
107
91
  if (key in exports && exports[key] === _FronteggProvider[key]) return;
@@ -112,9 +96,7 @@ Object.keys(_FronteggProvider).forEach(function (key) {
112
96
  }
113
97
  });
114
98
  });
115
-
116
99
  var _FronteggStoreContext = require("./FronteggStoreContext");
117
-
118
100
  Object.keys(_FronteggStoreContext).forEach(function (key) {
119
101
  if (key === "default" || key === "__esModule") return;
120
102
  if (key in exports && exports[key] === _FronteggStoreContext[key]) return;
@@ -4,112 +4,73 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useVendorPublicConfigActions = exports.useVendorPublicConfig = 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
7
  var _reduxStore = require("@frontegg/redux-store");
9
-
10
8
  var _FronteggStoreContext = require("../FronteggStoreContext");
11
-
12
9
  var _reactRedux = require("react-redux");
13
-
14
10
  var _react = require("react");
15
-
16
11
  function getSubscriptionState(state) {
17
12
  return state[_reduxStore.subscriptionsStoreName];
18
13
  }
19
-
20
14
  const usePaymentProvider = () => {
21
15
  return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).config, _reactRedux.shallowEqual);
22
16
  };
23
-
24
17
  exports.usePaymentProvider = usePaymentProvider;
25
-
26
18
  const usePaymentProviderActions = () => {
27
19
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
28
20
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.config, dispatch), [dispatch]);
29
21
  };
30
-
31
22
  exports.usePaymentProviderActions = usePaymentProviderActions;
32
-
33
23
  const usePlans = () => {
34
24
  return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).plans, _reactRedux.shallowEqual);
35
25
  };
36
-
37
26
  exports.usePlans = usePlans;
38
-
39
27
  const usePlansActions = () => {
40
28
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
41
29
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.plans, dispatch), [dispatch]);
42
30
  };
43
-
44
31
  exports.usePlansActions = usePlansActions;
45
-
46
32
  const useCheckout = () => {
47
33
  return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).checkout, _reactRedux.shallowEqual);
48
34
  };
49
-
50
35
  exports.useCheckout = useCheckout;
51
-
52
36
  const useCheckoutActions = () => {
53
37
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
54
38
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.checkout, dispatch), [dispatch]);
55
39
  };
56
-
57
40
  exports.useCheckoutActions = useCheckoutActions;
58
-
59
41
  const useBillingActions = billingKey => {
60
42
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
61
43
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.billing[billingKey], dispatch), [billingKey, dispatch]);
62
44
  };
63
-
64
45
  const useBillingInformation = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.information, _reactRedux.shallowEqual);
65
-
66
46
  exports.useBillingInformation = useBillingInformation;
67
-
68
47
  const useBillingInformationActions = () => useBillingActions('information');
69
-
70
48
  exports.useBillingInformationActions = useBillingInformationActions;
71
-
72
49
  const usePaymentMethod = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.paymentMethod, _reactRedux.shallowEqual);
73
-
74
50
  exports.usePaymentMethod = usePaymentMethod;
75
-
76
51
  const usePaymentMethodActions = () => useBillingActions('paymentMethod');
77
-
78
52
  exports.usePaymentMethodActions = usePaymentMethodActions;
79
-
80
53
  const useInvoices = () => (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.invoices, _reactRedux.shallowEqual);
81
-
82
54
  exports.useInvoices = useInvoices;
83
-
84
55
  const useInvoicesActions = () => useBillingActions('invoices');
85
-
86
56
  exports.useInvoicesActions = useInvoicesActions;
87
-
88
57
  const useStripeState = () => {
89
58
  return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).stripe, _reactRedux.shallowEqual);
90
59
  };
91
-
92
60
  exports.useStripeState = useStripeState;
93
-
94
61
  const useStripeActions = () => {
95
62
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
96
63
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.stripe, dispatch), [dispatch]);
97
64
  };
98
-
99
65
  exports.useStripeActions = useStripeActions;
100
-
101
66
  const useSubscriptionCancellation = () => {
102
67
  return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.subscription.cancellation, _reactRedux.shallowEqual);
103
68
  };
104
-
105
69
  exports.useSubscriptionCancellation = useSubscriptionCancellation;
106
-
107
70
  const useSubscriptionRenewal = () => {
108
71
  return (0, _FronteggStoreContext.useSelector)(state => getSubscriptionState(state).billing.subscription.renewal, _reactRedux.shallowEqual);
109
72
  };
110
-
111
73
  exports.useSubscriptionRenewal = useSubscriptionRenewal;
112
-
113
74
  const useSubscription = () => {
114
75
  return (0, _FronteggStoreContext.useSelector)(state => {
115
76
  const {
@@ -120,16 +81,12 @@ const useSubscription = () => {
120
81
  return subscription;
121
82
  }, _reactRedux.shallowEqual);
122
83
  };
123
-
124
84
  exports.useSubscription = useSubscription;
125
-
126
85
  const useSubscriptionActions = () => {
127
86
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
128
87
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.billing.subscription, dispatch), [dispatch]);
129
88
  };
130
-
131
89
  exports.useSubscriptionActions = useSubscriptionActions;
132
-
133
90
  const useVendorPublicConfig = () => {
134
91
  return (0, _FronteggStoreContext.useSelector)(state => {
135
92
  const {
@@ -138,12 +95,9 @@ const useVendorPublicConfig = () => {
138
95
  return vendorPublicConfig;
139
96
  }, _reactRedux.shallowEqual);
140
97
  };
141
-
142
98
  exports.useVendorPublicConfig = useVendorPublicConfig;
143
-
144
99
  const useVendorPublicConfigActions = () => {
145
100
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
146
101
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.subscriptionActions.vendorPublicConfig, dispatch), [dispatch]);
147
102
  };
148
-
149
103
  exports.useVendorPublicConfigActions = useVendorPublicConfigActions;
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _hooks = require("./hooks");
8
-
9
7
  Object.keys(_hooks).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _hooks[key]) return;
@@ -5,24 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useVendorActions = void 0;
7
7
  exports.useVendorState = useVendorState;
8
-
9
8
  var _react = require("react");
10
-
11
9
  var _reduxStore = require("@frontegg/redux-store");
12
-
13
10
  var _reactRedux = require("react-redux");
14
-
15
11
  var _FronteggStoreContext = require("../FronteggStoreContext");
16
-
17
12
  const defaultMapper = state => state;
18
-
19
13
  function useVendorState(stateMapper = defaultMapper) {
20
14
  return (0, _FronteggStoreContext.useSelector)(state => stateMapper(state[_reduxStore.vendorStoreName]), _reactRedux.shallowEqual);
21
15
  }
22
-
23
16
  const useVendorActions = () => {
24
17
  const dispatch = (0, _FronteggStoreContext.useDispatch)();
25
18
  return (0, _react.useMemo)(() => (0, _reduxStore.bindActionCreators)(_reduxStore.vendorActions, dispatch), [_reduxStore.vendorActions]);
26
19
  };
27
-
28
20
  exports.useVendorActions = useVendorActions;
@@ -15,5 +15,4 @@ Object.defineProperty(exports, "useVendorState", {
15
15
  return _hooks.useVendorState;
16
16
  }
17
17
  });
18
-
19
18
  var _hooks = require("./hooks");
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/react-hooks",
3
- "version": "6.69.0",
3
+ "version": "6.70.0",
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.69.0",
10
- "@frontegg/types": "6.69.0",
9
+ "@frontegg/redux-store": "6.70.0",
10
+ "@frontegg/types": "6.70.0",
11
11
  "@types/react": "*",
12
12
  "react-redux": "^7.x"
13
13
  },
@@ -2,11 +2,9 @@ import { bindActionCreators, subscriptionActions, subscriptionsStoreName } from
2
2
  import { useDispatch, useSelector } from '../FronteggStoreContext';
3
3
  import { shallowEqual } from 'react-redux';
4
4
  import { useMemo } from 'react';
5
-
6
5
  function getSubscriptionState(state) {
7
6
  return state[subscriptionsStoreName];
8
7
  }
9
-
10
8
  export const usePaymentProvider = () => {
11
9
  return useSelector(state => getSubscriptionState(state).config, shallowEqual);
12
10
  };
@@ -28,12 +26,10 @@ export const useCheckoutActions = () => {
28
26
  const dispatch = useDispatch();
29
27
  return useMemo(() => bindActionCreators(subscriptionActions.checkout, dispatch), [dispatch]);
30
28
  };
31
-
32
29
  const useBillingActions = billingKey => {
33
30
  const dispatch = useDispatch();
34
31
  return useMemo(() => bindActionCreators(subscriptionActions.billing[billingKey], dispatch), [billingKey, dispatch]);
35
32
  };
36
-
37
33
  export const useBillingInformation = () => useSelector(state => getSubscriptionState(state).billing.information, shallowEqual);
38
34
  export const useBillingInformationActions = () => useBillingActions('information');
39
35
  export const usePaymentMethod = () => useSelector(state => getSubscriptionState(state).billing.paymentMethod, shallowEqual);
package/vendor/hooks.js CHANGED
@@ -2,9 +2,7 @@ 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
-
6
5
  const defaultMapper = state => state;
7
-
8
6
  export function useVendorState(stateMapper = defaultMapper) {
9
7
  return useSelector(state => stateMapper(state[vendorStoreName]), shallowEqual);
10
8
  }