@stigg/react-sdk 5.5.1 → 5.7.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/customerPortal/CustomerPortal.d.ts +2 -1
- package/dist/components/customerPortal/CustomerPortalContainer.d.ts +1 -1
- package/dist/components/customerPortal/types.d.ts +1 -0
- package/dist/components/customerPortal/usage/CustomerUsageData.d.ts +3 -2
- package/dist/components/utils/onWheelBlur.d.ts +2 -0
- package/dist/react-sdk.cjs.development.js +20 -12
- 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 +20 -12
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/checkout/steps/addons/CheckoutAddonsStep.tsx +2 -0
- package/src/components/checkout/steps/plan/CheckoutChargeList.tsx +2 -1
- package/src/components/common/VolumePerUnitInput.tsx +2 -0
- package/src/components/customerPortal/CustomerPortal.tsx +2 -1
- package/src/components/customerPortal/CustomerPortalContainer.tsx +8 -1
- package/src/components/customerPortal/subscriptionOverview/charges/ChargeItem.tsx +3 -1
- package/src/components/customerPortal/types.ts +2 -0
- package/src/components/customerPortal/usage/CustomerUsageData.tsx +8 -5
- package/src/components/utils/onWheelBlur.ts +3 -0
|
@@ -3,7 +3,7 @@ import { CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
|
3
3
|
import { DeepPartial } from '../../types';
|
|
4
4
|
import { CustomerPortalLocalization } from './customerPortalTextOverrides';
|
|
5
5
|
import { CustomerPortalTheme } from './customerPortalTheme';
|
|
6
|
-
import { OnBuyMoreCallbackFn, OnManageSubscriptionFn } from './types';
|
|
6
|
+
import { FilterEntitlementsFn, OnBuyMoreCallbackFn, OnManageSubscriptionFn } from './types';
|
|
7
7
|
export declare type CustomerPortalSection = 'usage' | 'addons' | 'promotionalEntitlements' | 'billingInformation' | 'paymentDetails' | 'invoices';
|
|
8
8
|
export declare type CustomerPortalProps = {
|
|
9
9
|
onManageSubscription?: OnManageSubscriptionFn;
|
|
@@ -14,6 +14,7 @@ export declare type CustomerPortalProps = {
|
|
|
14
14
|
hiddenSections?: CustomerPortalSection[];
|
|
15
15
|
textOverrides?: DeepPartial<CustomerPortalLocalization>;
|
|
16
16
|
theme?: DeepPartial<CustomerPortalTheme>;
|
|
17
|
+
filterEntitlements?: FilterEntitlementsFn;
|
|
17
18
|
resourceId?: string;
|
|
18
19
|
productId?: string;
|
|
19
20
|
};
|
|
@@ -4,4 +4,4 @@ import { CustomerPortalIntentionType } from './types';
|
|
|
4
4
|
export declare type OnManageClick = ({ intentionType }: {
|
|
5
5
|
intentionType: CustomerPortalIntentionType;
|
|
6
6
|
}) => void;
|
|
7
|
-
export declare function CustomerPortalContainer({ onManageSubscription, onBuyMore, onCancelScheduledUpdates, onContactSupport, paywallComponent, hiddenSections, }: CustomerPortalProps): JSX.Element;
|
|
7
|
+
export declare function CustomerPortalContainer({ onManageSubscription, onBuyMore, onCancelScheduledUpdates, onContactSupport, paywallComponent, hiddenSections, filterEntitlements, }: CustomerPortalProps): JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CustomerPortalEntitlement, CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
2
2
|
import { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
3
3
|
export declare type OnBuyMoreCallbackFn = (feature: FeatureFragment, entitlement: CustomerPortalEntitlement) => void;
|
|
4
|
+
export declare type FilterEntitlementsFn = (entitlements: CustomerPortalEntitlement[]) => CustomerPortalEntitlement[];
|
|
4
5
|
export declare enum CustomerPortalIntentionType {
|
|
5
6
|
MANAGE_SUBSCRIPTION = "MANAGE_SUBSCRIPTION",
|
|
6
7
|
UPGRADE_PLAN = "UPGRADE_PLAN",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { OnBuyMoreCallbackFn } from '../types';
|
|
2
|
+
import { FilterEntitlementsFn, OnBuyMoreCallbackFn } from '../types';
|
|
3
3
|
import { OnManageClick } from '../CustomerPortalContainer';
|
|
4
4
|
export declare type CustomerUsageDataProps = {
|
|
5
5
|
onManageSubscription?: OnManageClick;
|
|
6
6
|
onBuyMore?: OnBuyMoreCallbackFn;
|
|
7
|
+
filterEntitlements?: FilterEntitlementsFn;
|
|
7
8
|
};
|
|
8
|
-
export declare function CustomerUsageData({ onManageSubscription, onBuyMore }: CustomerUsageDataProps): JSX.Element | null;
|
|
9
|
+
export declare function CustomerUsageData({ onManageSubscription, onBuyMore, filterEntitlements }: CustomerUsageDataProps): JSX.Element | null;
|
|
@@ -1445,6 +1445,10 @@ function ContentLoadingSkeleton() {
|
|
|
1445
1445
|
})))));
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
1448
|
+
var ON_WHEEL_BLUR = function ON_WHEEL_BLUR(e) {
|
|
1449
|
+
return e.target.blur();
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1448
1452
|
function VolumePerUnitInput(_ref) {
|
|
1449
1453
|
var width = _ref.width,
|
|
1450
1454
|
tierUnits = _ref.tierUnits,
|
|
@@ -1452,6 +1456,7 @@ function VolumePerUnitInput(_ref) {
|
|
|
1452
1456
|
handleChange = _ref.handleChange;
|
|
1453
1457
|
return React__default.createElement(InputField, {
|
|
1454
1458
|
type: "number",
|
|
1459
|
+
onWheel: ON_WHEEL_BLUR,
|
|
1455
1460
|
fullWidth: true,
|
|
1456
1461
|
sx: {
|
|
1457
1462
|
minHeight: '46px',
|
|
@@ -5821,7 +5826,7 @@ function ChargeItem(_ref) {
|
|
|
5821
5826
|
canUpgradeSubscription = _ref.canUpgradeSubscription,
|
|
5822
5827
|
hasCustomSubscription = _ref.hasCustomSubscription;
|
|
5823
5828
|
return React__default.createElement("div", {
|
|
5824
|
-
className: "stigg-charge-list-item",
|
|
5829
|
+
className: "stigg-charge-list-item stigg-charge-list-item-" + entitlement.feature.refId,
|
|
5825
5830
|
style: {
|
|
5826
5831
|
display: 'flex',
|
|
5827
5832
|
flexDirection: 'column',
|
|
@@ -6432,7 +6437,8 @@ function CustomerUsageLoader() {
|
|
|
6432
6437
|
var MAX_BOXES = 6;
|
|
6433
6438
|
function CustomerUsageData(_ref) {
|
|
6434
6439
|
var onManageSubscription = _ref.onManageSubscription,
|
|
6435
|
-
onBuyMore = _ref.onBuyMore
|
|
6440
|
+
onBuyMore = _ref.onBuyMore,
|
|
6441
|
+
filterEntitlements = _ref.filterEntitlements;
|
|
6436
6442
|
|
|
6437
6443
|
var _React$useState = React__default.useState(false),
|
|
6438
6444
|
showAll = _React$useState[0],
|
|
@@ -6470,10 +6476,11 @@ function CustomerUsageData(_ref) {
|
|
|
6470
6476
|
var otherEntitlements = lodash.compact(meteredEntitlements == null ? void 0 : meteredEntitlements.filter(function (entitlement) {
|
|
6471
6477
|
return !subscriptionPriceByFeature[entitlement.feature.refId];
|
|
6472
6478
|
}));
|
|
6473
|
-
var sortedEntitlements = [].concat(priceEntitlements, otherEntitlements);
|
|
6479
|
+
var sortedEntitlements = [].concat(priceEntitlements, otherEntitlements);
|
|
6480
|
+
var filteredEntitlements = filterEntitlements ? filterEntitlements(sortedEntitlements) : sortedEntitlements; // 4 -> 3 per row, 6 -> 2 per row
|
|
6474
6481
|
|
|
6475
|
-
var xs =
|
|
6476
|
-
var entitlementsToShow = showAll ?
|
|
6482
|
+
var xs = filteredEntitlements.length > 2 ? 4 : 6;
|
|
6483
|
+
var entitlementsToShow = showAll ? filteredEntitlements : filteredEntitlements.slice(0, MAX_BOXES);
|
|
6477
6484
|
|
|
6478
6485
|
var toggleShowAll = function toggleShowAll() {
|
|
6479
6486
|
return setShowAll(function (prevState) {
|
|
@@ -6511,7 +6518,7 @@ function CustomerUsageData(_ref) {
|
|
|
6511
6518
|
hasCustomSubscription: hasCustomSubscription,
|
|
6512
6519
|
canUpgradeSubscription: canUpgradeSubscription
|
|
6513
6520
|
}));
|
|
6514
|
-
})),
|
|
6521
|
+
})), filteredEntitlements.length > MAX_BOXES && React__default.createElement(Footer, null, React__default.createElement(StyledButton$1, {
|
|
6515
6522
|
className: "stigg-usage-toggle-many-button",
|
|
6516
6523
|
variant: "text",
|
|
6517
6524
|
startIcon: showAll ? React__default.createElement(reactFeather.Minus, null) : React__default.createElement(reactFeather.Plus, null),
|
|
@@ -6525,7 +6532,8 @@ function CustomerPortalContainer(_ref) {
|
|
|
6525
6532
|
onCancelScheduledUpdates = _ref.onCancelScheduledUpdates,
|
|
6526
6533
|
onContactSupport = _ref.onContactSupport,
|
|
6527
6534
|
paywallComponent = _ref.paywallComponent,
|
|
6528
|
-
hiddenSections = _ref.hiddenSections
|
|
6535
|
+
hiddenSections = _ref.hiddenSections,
|
|
6536
|
+
filterEntitlements = _ref.filterEntitlements;
|
|
6529
6537
|
|
|
6530
6538
|
var _useStiggContext = useStiggContext(),
|
|
6531
6539
|
stigg = _useStiggContext.stigg;
|
|
@@ -6581,7 +6589,8 @@ function CustomerPortalContainer(_ref) {
|
|
|
6581
6589
|
cancelScheduledUpdatesButtonTitle: textOverrides.cancelScheduledUpdatesButtonTitle
|
|
6582
6590
|
}), shouldShowUsage && React__default.createElement(CustomerUsageData, {
|
|
6583
6591
|
onManageSubscription: onManageClick,
|
|
6584
|
-
onBuyMore: onBuyMore
|
|
6592
|
+
onBuyMore: onBuyMore,
|
|
6593
|
+
filterEntitlements: filterEntitlements
|
|
6585
6594
|
}), React__default.createElement(CustomerPortalPaywall, {
|
|
6586
6595
|
ref: customerPortalSectionRef,
|
|
6587
6596
|
paywallComponent: paywallComponent,
|
|
@@ -13022,6 +13031,7 @@ function AddonListItem(_ref) {
|
|
|
13022
13031
|
}, "Undo")), isAdded && React__default.createElement(React__default.Fragment, null, React__default.createElement(InputField, {
|
|
13023
13032
|
id: addon.id + "-input",
|
|
13024
13033
|
type: "number",
|
|
13034
|
+
onWheel: ON_WHEEL_BLUR,
|
|
13025
13035
|
sx: {
|
|
13026
13036
|
width: 120,
|
|
13027
13037
|
marginX: 2
|
|
@@ -13577,6 +13587,7 @@ function PlanCharge(_ref) {
|
|
|
13577
13587
|
},
|
|
13578
13588
|
id: featureId + "-input",
|
|
13579
13589
|
type: "number",
|
|
13590
|
+
onWheel: ON_WHEEL_BLUR,
|
|
13580
13591
|
error: !isValid,
|
|
13581
13592
|
helperText: !isValid ? getValidationText(charge, billableFeature == null ? void 0 : billableFeature.quantity) : undefined,
|
|
13582
13593
|
FormHelperTextProps: {
|
|
@@ -13585,10 +13596,7 @@ function PlanCharge(_ref) {
|
|
|
13585
13596
|
}
|
|
13586
13597
|
},
|
|
13587
13598
|
value: (_billableFeature$quan = billableFeature == null ? void 0 : billableFeature.quantity) != null ? _billableFeature$quan : '',
|
|
13588
|
-
onChange: handleQuantityChange
|
|
13589
|
-
onWheel: function onWheel(e) {
|
|
13590
|
-
return e.target.blur();
|
|
13591
|
-
}
|
|
13599
|
+
onChange: handleQuantityChange
|
|
13592
13600
|
});
|
|
13593
13601
|
}
|
|
13594
13602
|
|