@stigg/react-sdk 6.3.0 → 6.4.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/dist/components/EnumEntitlementGuard.d.ts +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useEnumEntitlement.d.ts +6 -0
- package/dist/index.d.ts +2 -1
- package/dist/react-sdk.cjs.development.js +34 -1
- package/dist/react-sdk.cjs.development.js.map +1 -1
- package/dist/react-sdk.cjs.production.min.js +1 -1
- package/dist/react-sdk.cjs.production.min.js.map +1 -1
- package/dist/react-sdk.esm.js +34 -3
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/EnumEntitlementGuard.tsx +18 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useEnumEntitlement.ts +20 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GetEnumEntitlement } from '@stigg/js-client-sdk';
|
|
3
|
+
declare type EnumEntitlementGuardProps = GetEnumEntitlement & {
|
|
4
|
+
noAccessComponent?: React.ReactNode;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
};
|
|
7
|
+
export declare function EnumEntitlementGuard({ noAccessComponent, children, ...rest }: EnumEntitlementGuardProps): JSX.Element;
|
|
8
|
+
export {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { useBooleanEntitlement } from './useBooleanEntitlement';
|
|
2
2
|
export { useNumericEntitlement } from './useNumericEntitlement';
|
|
3
3
|
export { useMeteredEntitlement } from './useMeteredEntitlement';
|
|
4
|
+
export { useEnumEntitlement } from './useEnumEntitlement';
|
|
4
5
|
export { useActiveSubscriptions } from './useActiveSubscriptions';
|
|
5
6
|
export { usePaywall } from './usePaywall';
|
|
6
7
|
export { useCustomerPortal } from './useCustomerPortal';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GetEnumEntitlement, EnumEntitlement } from '@stigg/js-client-sdk';
|
|
2
|
+
declare type TypedGetEnumEntitlement<T> = Omit<GetEnumEntitlement, 'featureId'> & {
|
|
3
|
+
featureId: T;
|
|
4
|
+
};
|
|
5
|
+
export declare function useEnumEntitlement<T extends string>(params: TypedGetEnumEntitlement<T>): EnumEntitlement;
|
|
6
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export { CustomerPortalProvider, CustomerPortal, CustomerPortalProps, CustomerPo
|
|
|
5
5
|
export { StiggProvider, StiggProviderProps, StiggContextValue, StiggContext } from './components/StiggProvider';
|
|
6
6
|
export { Checkout, CheckoutProps, CheckoutProviderProps, CheckoutContainerProps, CheckoutLocalization, CheckoutResult, OnCheckoutCompletedParams, OnCheckoutParams, CheckoutTheme, CheckoutMockProps, MockCheckoutPreviewCallback, MockCheckoutStateCallback, BillingInformation, TaxDetailsInput, } from './components/checkout';
|
|
7
7
|
export { useWaitForCheckoutCompleted, ProvisionStatus } from './components/hooks';
|
|
8
|
-
export { useBooleanEntitlement, useMeteredEntitlement, useNumericEntitlement, useActiveSubscriptions, useCustomerPortal, useStiggContext, usePaywall, } from './hooks';
|
|
8
|
+
export { useBooleanEntitlement, useMeteredEntitlement, useEnumEntitlement, useNumericEntitlement, useActiveSubscriptions, useCustomerPortal, useStiggContext, usePaywall, } from './hooks';
|
|
9
9
|
export { HorizontalAlignment, TextAlignment, FontVariant, FontWeight, StiggTheme } from './theme/types';
|
|
10
10
|
export { CustomizedTheme as Theme } from './theme/Theme';
|
|
11
11
|
export { BooleanEntitlementGuard } from './components/BooleanEntitlementGuard';
|
|
12
12
|
export { NumericEntitlementGuard } from './components/NumericEntitlementGuard';
|
|
13
13
|
export { MeteredEntitlementGuard } from './components/MeteredEntitlementGuard';
|
|
14
|
+
export { EnumEntitlementGuard } from './components/EnumEntitlementGuard';
|
|
@@ -4219,7 +4219,7 @@ function mapPaywallData(paywall, showOnlyEligiblePlans, currentSubscriptionOverr
|
|
|
4219
4219
|
};
|
|
4220
4220
|
}
|
|
4221
4221
|
|
|
4222
|
-
var version = "6.
|
|
4222
|
+
var version = "6.4.0";
|
|
4223
4223
|
var name = "@stigg/react-sdk";
|
|
4224
4224
|
|
|
4225
4225
|
var StiggContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -14788,6 +14788,21 @@ function useMeteredEntitlement(params) {
|
|
|
14788
14788
|
return stigg.getMeteredEntitlement(params);
|
|
14789
14789
|
}
|
|
14790
14790
|
|
|
14791
|
+
function useEnumEntitlement(params) {
|
|
14792
|
+
var stiggContext = useStiggContext({
|
|
14793
|
+
optional: true
|
|
14794
|
+
});
|
|
14795
|
+
var stigg = stiggContext == null ? void 0 : stiggContext.stigg;
|
|
14796
|
+
|
|
14797
|
+
if (!stigg) {
|
|
14798
|
+
var _params$options;
|
|
14799
|
+
|
|
14800
|
+
return _extends({}, Stigg.ENUM_DEFAULT_FALLBACK_ENTITLEMENT, (_params$options = params.options) == null ? void 0 : _params$options.fallback);
|
|
14801
|
+
}
|
|
14802
|
+
|
|
14803
|
+
return stigg.getEnumEntitlement(params);
|
|
14804
|
+
}
|
|
14805
|
+
|
|
14791
14806
|
function useFetch(_ref) {
|
|
14792
14807
|
var func = _ref.func;
|
|
14793
14808
|
|
|
@@ -14977,6 +14992,22 @@ function MeteredEntitlementGuard(_ref) {
|
|
|
14977
14992
|
return children;
|
|
14978
14993
|
}
|
|
14979
14994
|
|
|
14995
|
+
var _excluded$b = ["noAccessComponent", "children"];
|
|
14996
|
+
function EnumEntitlementGuard(_ref) {
|
|
14997
|
+
var noAccessComponent = _ref.noAccessComponent,
|
|
14998
|
+
children = _ref.children,
|
|
14999
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
15000
|
+
|
|
15001
|
+
var _useEnumEntitlement = useEnumEntitlement(rest),
|
|
15002
|
+
hasAccess = _useEnumEntitlement.hasAccess;
|
|
15003
|
+
|
|
15004
|
+
if (!hasAccess) {
|
|
15005
|
+
return React__default.createElement(React__default.Fragment, null, noAccessComponent != null ? noAccessComponent : null);
|
|
15006
|
+
}
|
|
15007
|
+
|
|
15008
|
+
return children;
|
|
15009
|
+
}
|
|
15010
|
+
|
|
14980
15011
|
Object.keys(Stigg).forEach(function (k) {
|
|
14981
15012
|
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
14982
15013
|
enumerable: true,
|
|
@@ -14991,6 +15022,7 @@ exports.Checkout = Checkout;
|
|
|
14991
15022
|
exports.CustomerPortal = CustomerPortal;
|
|
14992
15023
|
exports.CustomerPortalProvider = CustomerPortalProvider;
|
|
14993
15024
|
exports.CustomerUsageData = CustomerUsageData;
|
|
15025
|
+
exports.EnumEntitlementGuard = EnumEntitlementGuard;
|
|
14994
15026
|
exports.InvoicesSection = InvoicesSection;
|
|
14995
15027
|
exports.MeteredEntitlementGuard = MeteredEntitlementGuard;
|
|
14996
15028
|
exports.NumericEntitlementGuard = NumericEntitlementGuard;
|
|
@@ -15003,6 +15035,7 @@ exports.SubscriptionsOverview = SubscriptionsOverview;
|
|
|
15003
15035
|
exports.useActiveSubscriptions = useActiveSubscriptions;
|
|
15004
15036
|
exports.useBooleanEntitlement = useBooleanEntitlement;
|
|
15005
15037
|
exports.useCustomerPortal = useCustomerPortal$1;
|
|
15038
|
+
exports.useEnumEntitlement = useEnumEntitlement;
|
|
15006
15039
|
exports.useMeteredEntitlement = useMeteredEntitlement;
|
|
15007
15040
|
exports.useNumericEntitlement = useNumericEntitlement;
|
|
15008
15041
|
exports.usePaywall = usePaywall;
|