@stigg/react-sdk 5.27.0 → 5.28.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/dist/components/NumericEntitlementGuard.d.ts +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/react-sdk.cjs.development.js +24 -4
- 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 +24 -5
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NumericEntitlementGuard.tsx +22 -0
- package/src/components/utils/currencyUtils.ts +2 -0
- package/src/components/utils/getPaidPriceText.ts +1 -1
- package/src/index.ts +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GetNumericEntitlement } from '@stigg/js-client-sdk';
|
|
3
|
+
declare type NumericEntitlementGuardProps = GetNumericEntitlement & {
|
|
4
|
+
noAccessComponent?: React.ReactNode;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
};
|
|
7
|
+
export declare function NumericEntitlementGuard({ noAccessComponent, children, ...rest }: NumericEntitlementGuardProps): JSX.Element;
|
|
8
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export { useBooleanEntitlement, useMeteredEntitlement, useNumericEntitlement, us
|
|
|
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
|
+
export { NumericEntitlementGuard } from './components/NumericEntitlementGuard';
|
|
12
13
|
export { MeteredEntitlementGuard } from './components/MeteredEntitlementGuard';
|
|
@@ -1165,7 +1165,9 @@ var currencyPriceFormatter = function currencyPriceFormatter(_ref) {
|
|
|
1165
1165
|
maximumFractionDigits: maximumFractionDigits,
|
|
1166
1166
|
minimumFractionDigits: minimumFractionDigits,
|
|
1167
1167
|
style: 'currency',
|
|
1168
|
-
currency: currencyString
|
|
1168
|
+
currency: currencyString,
|
|
1169
|
+
// @ts-ignore
|
|
1170
|
+
trailingZeroDisplay: 'stripIfInteger'
|
|
1169
1171
|
}, currencySymbol ? {
|
|
1170
1172
|
currencyDisplay: 'code'
|
|
1171
1173
|
} : {})).format(amount || 0);
|
|
@@ -1235,7 +1237,8 @@ function getPaidPriceText(_ref) {
|
|
|
1235
1237
|
price: currencyPriceFormatter({
|
|
1236
1238
|
amount: priceNumber,
|
|
1237
1239
|
currency: currency,
|
|
1238
|
-
locale: locale
|
|
1240
|
+
locale: locale,
|
|
1241
|
+
minimumFractionDigits: 2
|
|
1239
1242
|
}),
|
|
1240
1243
|
unit: unit,
|
|
1241
1244
|
tiers: tiers,
|
|
@@ -3421,7 +3424,7 @@ function mapPaywallData(paywall, showOnlyEligiblePlans) {
|
|
|
3421
3424
|
};
|
|
3422
3425
|
}
|
|
3423
3426
|
|
|
3424
|
-
var version = "5.
|
|
3427
|
+
var version = "5.28.1";
|
|
3425
3428
|
var name = "@stigg/react-sdk";
|
|
3426
3429
|
|
|
3427
3430
|
var StiggContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -14629,11 +14632,27 @@ function BooleanEntitlementGuard(_ref) {
|
|
|
14629
14632
|
}
|
|
14630
14633
|
|
|
14631
14634
|
var _excluded$9 = ["noAccessComponent", "children"];
|
|
14632
|
-
function
|
|
14635
|
+
function NumericEntitlementGuard(_ref) {
|
|
14633
14636
|
var noAccessComponent = _ref.noAccessComponent,
|
|
14634
14637
|
children = _ref.children,
|
|
14635
14638
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
14636
14639
|
|
|
14640
|
+
var _useNumericEntitlemen = useNumericEntitlement(rest),
|
|
14641
|
+
hasAccess = _useNumericEntitlemen.hasAccess;
|
|
14642
|
+
|
|
14643
|
+
if (!hasAccess) {
|
|
14644
|
+
return React__default.createElement(React__default.Fragment, null, noAccessComponent != null ? noAccessComponent : null);
|
|
14645
|
+
}
|
|
14646
|
+
|
|
14647
|
+
return children;
|
|
14648
|
+
}
|
|
14649
|
+
|
|
14650
|
+
var _excluded$a = ["noAccessComponent", "children"];
|
|
14651
|
+
function MeteredEntitlementGuard(_ref) {
|
|
14652
|
+
var noAccessComponent = _ref.noAccessComponent,
|
|
14653
|
+
children = _ref.children,
|
|
14654
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
14655
|
+
|
|
14637
14656
|
var _useMeteredEntitlemen = useMeteredEntitlement(rest),
|
|
14638
14657
|
hasAccess = _useMeteredEntitlemen.hasAccess;
|
|
14639
14658
|
|
|
@@ -14660,6 +14679,7 @@ exports.CustomerPortalProvider = CustomerPortalProvider;
|
|
|
14660
14679
|
exports.CustomerUsageData = CustomerUsageData;
|
|
14661
14680
|
exports.InvoicesSection = InvoicesSection;
|
|
14662
14681
|
exports.MeteredEntitlementGuard = MeteredEntitlementGuard;
|
|
14682
|
+
exports.NumericEntitlementGuard = NumericEntitlementGuard;
|
|
14663
14683
|
exports.PaymentDetailsSection = PaymentDetailsSection;
|
|
14664
14684
|
exports.Paywall = PaywallContainer$1;
|
|
14665
14685
|
exports.Promotions = Promotions;
|