@stigg/react-sdk 5.5.0 → 5.6.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/react-sdk.cjs.development.js +13 -8
- 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 +13 -8
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- 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 +13 -6
|
@@ -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;
|
|
@@ -5821,7 +5821,7 @@ function ChargeItem(_ref) {
|
|
|
5821
5821
|
canUpgradeSubscription = _ref.canUpgradeSubscription,
|
|
5822
5822
|
hasCustomSubscription = _ref.hasCustomSubscription;
|
|
5823
5823
|
return React__default.createElement("div", {
|
|
5824
|
-
className: "stigg-charge-list-item",
|
|
5824
|
+
className: "stigg-charge-list-item stigg-charge-list-item-" + entitlement.feature.refId,
|
|
5825
5825
|
style: {
|
|
5826
5826
|
display: 'flex',
|
|
5827
5827
|
flexDirection: 'column',
|
|
@@ -6432,7 +6432,8 @@ function CustomerUsageLoader() {
|
|
|
6432
6432
|
var MAX_BOXES = 6;
|
|
6433
6433
|
function CustomerUsageData(_ref) {
|
|
6434
6434
|
var onManageSubscription = _ref.onManageSubscription,
|
|
6435
|
-
onBuyMore = _ref.onBuyMore
|
|
6435
|
+
onBuyMore = _ref.onBuyMore,
|
|
6436
|
+
filterEntitlements = _ref.filterEntitlements;
|
|
6436
6437
|
|
|
6437
6438
|
var _React$useState = React__default.useState(false),
|
|
6438
6439
|
showAll = _React$useState[0],
|
|
@@ -6470,10 +6471,11 @@ function CustomerUsageData(_ref) {
|
|
|
6470
6471
|
var otherEntitlements = lodash.compact(meteredEntitlements == null ? void 0 : meteredEntitlements.filter(function (entitlement) {
|
|
6471
6472
|
return !subscriptionPriceByFeature[entitlement.feature.refId];
|
|
6472
6473
|
}));
|
|
6473
|
-
var sortedEntitlements = [].concat(priceEntitlements, otherEntitlements);
|
|
6474
|
+
var sortedEntitlements = [].concat(priceEntitlements, otherEntitlements);
|
|
6475
|
+
var filteredEntitlements = filterEntitlements ? filterEntitlements(sortedEntitlements) : sortedEntitlements; // 4 -> 3 per row, 6 -> 2 per row
|
|
6474
6476
|
|
|
6475
|
-
var xs =
|
|
6476
|
-
var entitlementsToShow = showAll ?
|
|
6477
|
+
var xs = filteredEntitlements.length > 2 ? 4 : 6;
|
|
6478
|
+
var entitlementsToShow = showAll ? filteredEntitlements : filteredEntitlements.slice(0, MAX_BOXES);
|
|
6477
6479
|
|
|
6478
6480
|
var toggleShowAll = function toggleShowAll() {
|
|
6479
6481
|
return setShowAll(function (prevState) {
|
|
@@ -6498,6 +6500,7 @@ function CustomerUsageData(_ref) {
|
|
|
6498
6500
|
spacing: 4
|
|
6499
6501
|
}, entitlementsToShow.map(function (entitlement) {
|
|
6500
6502
|
return React__default.createElement(Grid, {
|
|
6503
|
+
className: "stigg-entitlement-usage-" + entitlement.feature.refId,
|
|
6501
6504
|
key: entitlement.feature.refId,
|
|
6502
6505
|
item: true,
|
|
6503
6506
|
xs: xs
|
|
@@ -6510,7 +6513,7 @@ function CustomerUsageData(_ref) {
|
|
|
6510
6513
|
hasCustomSubscription: hasCustomSubscription,
|
|
6511
6514
|
canUpgradeSubscription: canUpgradeSubscription
|
|
6512
6515
|
}));
|
|
6513
|
-
})),
|
|
6516
|
+
})), filteredEntitlements.length > MAX_BOXES && React__default.createElement(Footer, null, React__default.createElement(StyledButton$1, {
|
|
6514
6517
|
className: "stigg-usage-toggle-many-button",
|
|
6515
6518
|
variant: "text",
|
|
6516
6519
|
startIcon: showAll ? React__default.createElement(reactFeather.Minus, null) : React__default.createElement(reactFeather.Plus, null),
|
|
@@ -6524,7 +6527,8 @@ function CustomerPortalContainer(_ref) {
|
|
|
6524
6527
|
onCancelScheduledUpdates = _ref.onCancelScheduledUpdates,
|
|
6525
6528
|
onContactSupport = _ref.onContactSupport,
|
|
6526
6529
|
paywallComponent = _ref.paywallComponent,
|
|
6527
|
-
hiddenSections = _ref.hiddenSections
|
|
6530
|
+
hiddenSections = _ref.hiddenSections,
|
|
6531
|
+
filterEntitlements = _ref.filterEntitlements;
|
|
6528
6532
|
|
|
6529
6533
|
var _useStiggContext = useStiggContext(),
|
|
6530
6534
|
stigg = _useStiggContext.stigg;
|
|
@@ -6580,7 +6584,8 @@ function CustomerPortalContainer(_ref) {
|
|
|
6580
6584
|
cancelScheduledUpdatesButtonTitle: textOverrides.cancelScheduledUpdatesButtonTitle
|
|
6581
6585
|
}), shouldShowUsage && React__default.createElement(CustomerUsageData, {
|
|
6582
6586
|
onManageSubscription: onManageClick,
|
|
6583
|
-
onBuyMore: onBuyMore
|
|
6587
|
+
onBuyMore: onBuyMore,
|
|
6588
|
+
filterEntitlements: filterEntitlements
|
|
6584
6589
|
}), React__default.createElement(CustomerPortalPaywall, {
|
|
6585
6590
|
ref: customerPortalSectionRef,
|
|
6586
6591
|
paywallComponent: paywallComponent,
|