@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
package/dist/react-sdk.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Stigg__default, { EntitlementResetPeriod, WidgetType, SubscriptionScheduleType, BillingModel, TiersMode, BillingPeriod, PricingType, Currency, SubscriptionStatus, FontWeight as FontWeight$1, Alignment, MeterType, DiscountType, DiscountDurationType, BillingVendorIdentifier, PaymentCollection, BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT, NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT, METERED_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';
|
|
1
|
+
import Stigg__default, { EntitlementResetPeriod, WidgetType, SubscriptionScheduleType, BillingModel, TiersMode, BillingPeriod, PricingType, Currency, SubscriptionStatus, FontWeight as FontWeight$1, Alignment, MeterType, DiscountType, DiscountDurationType, BillingVendorIdentifier, PaymentCollection, BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT, NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT, METERED_DEFAULT_FALLBACK_ENTITLEMENT, ENUM_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';
|
|
2
2
|
export * from '@stigg/js-client-sdk';
|
|
3
3
|
import React__default, { forwardRef, createElement, useState, useCallback, useMemo, useRef, useEffect, useContext } from 'react';
|
|
4
4
|
import _styled from '@emotion/styled/base';
|
|
@@ -4405,7 +4405,7 @@ function mapPaywallData(paywall, showOnlyEligiblePlans, currentSubscriptionOverr
|
|
|
4405
4405
|
};
|
|
4406
4406
|
}
|
|
4407
4407
|
|
|
4408
|
-
var version = "6.
|
|
4408
|
+
var version = "6.4.0";
|
|
4409
4409
|
var name = "@stigg/react-sdk";
|
|
4410
4410
|
|
|
4411
4411
|
var StiggContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -15280,6 +15280,21 @@ function useMeteredEntitlement(params) {
|
|
|
15280
15280
|
return stigg.getMeteredEntitlement(params);
|
|
15281
15281
|
}
|
|
15282
15282
|
|
|
15283
|
+
function useEnumEntitlement(params) {
|
|
15284
|
+
var stiggContext = useStiggContext({
|
|
15285
|
+
optional: true
|
|
15286
|
+
});
|
|
15287
|
+
var stigg = stiggContext == null ? void 0 : stiggContext.stigg;
|
|
15288
|
+
|
|
15289
|
+
if (!stigg) {
|
|
15290
|
+
var _params$options;
|
|
15291
|
+
|
|
15292
|
+
return _extends({}, ENUM_DEFAULT_FALLBACK_ENTITLEMENT, (_params$options = params.options) == null ? void 0 : _params$options.fallback);
|
|
15293
|
+
}
|
|
15294
|
+
|
|
15295
|
+
return stigg.getEnumEntitlement(params);
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15283
15298
|
function useFetch(_ref) {
|
|
15284
15299
|
var func = _ref.func;
|
|
15285
15300
|
|
|
@@ -15469,5 +15484,21 @@ function MeteredEntitlementGuard(_ref) {
|
|
|
15469
15484
|
return children;
|
|
15470
15485
|
}
|
|
15471
15486
|
|
|
15472
|
-
|
|
15487
|
+
var _excluded$b = ["noAccessComponent", "children"];
|
|
15488
|
+
function EnumEntitlementGuard(_ref) {
|
|
15489
|
+
var noAccessComponent = _ref.noAccessComponent,
|
|
15490
|
+
children = _ref.children,
|
|
15491
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
15492
|
+
|
|
15493
|
+
var _useEnumEntitlement = useEnumEntitlement(rest),
|
|
15494
|
+
hasAccess = _useEnumEntitlement.hasAccess;
|
|
15495
|
+
|
|
15496
|
+
if (!hasAccess) {
|
|
15497
|
+
return React__default.createElement(React__default.Fragment, null, noAccessComponent != null ? noAccessComponent : null);
|
|
15498
|
+
}
|
|
15499
|
+
|
|
15500
|
+
return children;
|
|
15501
|
+
}
|
|
15502
|
+
|
|
15503
|
+
export { AddonsList$1 as AddonsList, BooleanEntitlementGuard, Checkout, CustomerPortal, CustomerPortalIntentionType, CustomerPortalProvider, CustomerUsageData, EnumEntitlementGuard, InvoicesSection, MeteredEntitlementGuard, NumericEntitlementGuard, PaymentDetailsSection, PaywallContainer$1 as Paywall, Promotions, ProvisionStatus, StiggContext, StiggProvider, SubscribeIntentionType, SubscriptionsOverview, useActiveSubscriptions, useBooleanEntitlement, useCustomerPortal$1 as useCustomerPortal, useEnumEntitlement, useMeteredEntitlement, useNumericEntitlement, usePaywall, useStiggContext, useWaitForCheckoutCompleted };
|
|
15473
15504
|
//# sourceMappingURL=react-sdk.esm.js.map
|