@stigg/react-sdk 4.10.0 → 4.12.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/checkout/hooks/useAddonsStepModel.d.ts +2 -2
- package/dist/components/checkout/steps/addons/addon.utils.d.ts +3 -3
- package/dist/components/common/LongText.d.ts +3 -4
- package/dist/components/customerPortal/CustomerPortal.d.ts +1 -1
- package/dist/components/customerPortal/billing/InformationGrid.d.ts +1 -1
- package/dist/components/customerPortal/hooks/useCustomerPortal.d.ts +2 -2
- package/dist/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.d.ts +0 -2
- package/dist/components/paywall/hooks/useLoadPaywallData.d.ts +2 -2
- package/dist/components/paywall/utils/hasPricePoints.d.ts +2 -2
- package/dist/components/utils/getFeatureName.d.ts +1 -1
- package/dist/components/utils/getPlanPrice.d.ts +1 -2
- package/dist/components/utils/priceTierUtils.d.ts +1 -1
- package/dist/react-sdk.cjs.development.js +98 -72
- 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 +98 -72
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/checkout/CheckoutContainer.tsx +2 -0
- package/src/components/checkout/components/Button.tsx +4 -2
- package/src/components/checkout/hooks/useAddonsStepModel.ts +2 -2
- package/src/components/checkout/steps/addons/addon.utils.ts +26 -26
- package/src/components/common/LongText.tsx +2 -4
- package/src/components/common/PoweredByStigg.tsx +1 -1
- package/src/components/common/Typography.tsx +1 -1
- package/src/components/customerPortal/CustomerPortal.tsx +1 -1
- package/src/components/customerPortal/CustomerPortalProvider.tsx +1 -0
- package/src/components/customerPortal/billing/InformationGrid.tsx +1 -1
- package/src/components/customerPortal/billing/PaymentDetailsSection.tsx +3 -3
- package/src/components/customerPortal/common/ExternalLinkButton.tsx +1 -1
- package/src/components/customerPortal/common/SectionTitle.tsx +2 -2
- package/src/components/customerPortal/hooks/useCustomerPortal.ts +3 -3
- package/src/components/customerPortal/subscriptionOverview/ContactCustomerSupport.tsx +4 -2
- package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.tsx +2 -1
- package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.tsx +1 -3
- package/src/components/customerPortal/subscriptionOverview/charges/ChargeItem.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/charges/ChargeList.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdateRow.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/subscriptionView/TrialPanel.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/tabs/Promotions.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/upcomingBilling/NextEstimatedBill.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/upcomingBilling/NoUpcomingBilling.tsx +1 -1
- package/src/components/customerPortal/usage/CustomerUsageData.tsx +4 -4
- package/src/components/customerPortal/usage/featureUsage/EntitlementCTAButton.tsx +3 -3
- package/src/components/customerPortal/usage/featureUsage/FeatureUsage.tsx +3 -3
- package/src/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.tsx +1 -1
- package/src/components/hooks/useWaitForCheckoutCompleted.ts +12 -4
- package/src/components/paywall/hooks/useLoadPaywallData.ts +4 -4
- package/src/components/paywall/utils/computeDefaultBillingPeriod.ts +1 -1
- package/src/components/paywall/utils/hasPricePoints.ts +5 -5
- package/src/components/utils/getFeatureName.ts +4 -4
- package/src/components/utils/getPaidPriceText.ts +4 -4
- package/src/components/utils/getPlanPrice.ts +2 -3
- package/src/components/utils/getSubscriptionScheduleUpdateTexts.tsx +1 -1
- package/src/components/utils/priceTierUtils.ts +13 -13
- package/src/components/utils/priceUtils.ts +2 -1
- package/src/custom.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.12.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@emotion/react": "^11.10.5",
|
|
113
113
|
"@emotion/styled": "^11.10.5",
|
|
114
114
|
"@mui/material": "^5.12.0",
|
|
115
|
-
"@stigg/js-client-sdk": "2.24.
|
|
115
|
+
"@stigg/js-client-sdk": "2.24.6",
|
|
116
116
|
"@stripe/react-stripe-js": "^2.1.1",
|
|
117
117
|
"@stripe/stripe-js": "^1.54.1",
|
|
118
118
|
"@types/styled-components": "^5.1.26",
|
|
@@ -102,7 +102,9 @@ export function CheckoutContainer({
|
|
|
102
102
|
<>
|
|
103
103
|
{isFreeDowngrade ? (
|
|
104
104
|
<DowngradeToFreePlan
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
105
106
|
freePlan={plan!}
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
106
108
|
activeSubscription={activeSubscription!}
|
|
107
109
|
allowChangePlan
|
|
108
110
|
checkoutLocalization={checkoutLocalization}
|
|
@@ -12,7 +12,8 @@ const StyledButton = styled(MuiButton, { shouldForwardProp: (prop) => !prop.star
|
|
|
12
12
|
background-color: ${({ theme, $success, $error }) => {
|
|
13
13
|
if ($success) {
|
|
14
14
|
return theme.stigg.palette.success;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
|
+
if ($error) {
|
|
16
17
|
return theme.stigg.palette.error;
|
|
17
18
|
}
|
|
18
19
|
return '';
|
|
@@ -22,7 +23,8 @@ const StyledButton = styled(MuiButton, { shouldForwardProp: (prop) => !prop.star
|
|
|
22
23
|
background-color: ${({ theme, $success, $error }) => {
|
|
23
24
|
if ($success) {
|
|
24
25
|
return theme.stigg.palette.successDark;
|
|
25
|
-
}
|
|
26
|
+
}
|
|
27
|
+
if ($error) {
|
|
26
28
|
return theme.stigg.palette.errorDark;
|
|
27
29
|
}
|
|
28
30
|
return '';
|
|
@@ -15,7 +15,7 @@ export type AddonsStepState = {
|
|
|
15
15
|
availableAddons?: Addon[];
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type GetAddonsStepInitialStateProps = {
|
|
19
19
|
plan?: Plan;
|
|
20
20
|
billingPeriod: BillingPeriod;
|
|
21
21
|
activeSubscription?: Subscription | null;
|
|
@@ -27,7 +27,7 @@ export function getAddonsStepInitialState({
|
|
|
27
27
|
plan,
|
|
28
28
|
billingPeriod,
|
|
29
29
|
billingCountryCode,
|
|
30
|
-
}:
|
|
30
|
+
}: GetAddonsStepInitialStateProps): AddonsStepState {
|
|
31
31
|
let addons: SubscriptionAddon[] = [];
|
|
32
32
|
const currency = plan?.pricePoints?.[0]?.currency || Currency.Usd;
|
|
33
33
|
const availableAddons = sortAddons(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import sortBy from 'lodash/sortBy';
|
|
2
2
|
import { Addon, BillingPeriod, Currency, SubscriptionAddon } from '@stigg/js-client-sdk';
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type FilterAddonsBaseProps = {
|
|
5
5
|
billingPeriod: BillingPeriod;
|
|
6
6
|
currency: Currency;
|
|
7
7
|
billingCountryCode?: string;
|
|
@@ -15,12 +15,35 @@ export const sortSubscriptionAddons = (addons: SubscriptionAddon[]) => {
|
|
|
15
15
|
return sortBy(addons, 'addon.displayName');
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
function filterAddonPricePointsByBillingPeriod(addon: Addon, billingPeriod: BillingPeriod) {
|
|
19
|
+
return addon.pricePoints.some((pricePoint) => pricePoint.billingPeriod === billingPeriod);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function mapAddonPricePointsByBillingCountryCode({
|
|
23
|
+
addon,
|
|
24
|
+
currency,
|
|
25
|
+
billingCountryCode,
|
|
26
|
+
}: {
|
|
27
|
+
addon: Addon;
|
|
28
|
+
currency: Currency;
|
|
29
|
+
billingCountryCode?: string;
|
|
30
|
+
}) {
|
|
31
|
+
return {
|
|
32
|
+
...addon,
|
|
33
|
+
pricePoints: addon.pricePoints.filter(
|
|
34
|
+
(pricePoint) =>
|
|
35
|
+
pricePoint.currency === currency &&
|
|
36
|
+
(billingCountryCode ? pricePoint.billingCountryCode === billingCountryCode : true),
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
18
41
|
export function filterAddons({
|
|
19
42
|
addons,
|
|
20
43
|
billingPeriod,
|
|
21
44
|
billingCountryCode,
|
|
22
45
|
currency,
|
|
23
|
-
}: { addons?: Addon[] } &
|
|
46
|
+
}: { addons?: Addon[] } & FilterAddonsBaseProps): Addon[] {
|
|
24
47
|
return (
|
|
25
48
|
addons
|
|
26
49
|
?.filter((addon) => filterAddonPricePointsByBillingPeriod(addon, billingPeriod))
|
|
@@ -33,7 +56,7 @@ export function filterSubscriptionAddons({
|
|
|
33
56
|
billingPeriod,
|
|
34
57
|
billingCountryCode,
|
|
35
58
|
currency,
|
|
36
|
-
}: { addons?: SubscriptionAddon[] } &
|
|
59
|
+
}: { addons?: SubscriptionAddon[] } & FilterAddonsBaseProps): SubscriptionAddon[] {
|
|
37
60
|
return (
|
|
38
61
|
addons
|
|
39
62
|
?.filter((addon) => filterAddonPricePointsByBillingPeriod(addon.addon, billingPeriod))
|
|
@@ -43,26 +66,3 @@ export function filterSubscriptionAddons({
|
|
|
43
66
|
})) || []
|
|
44
67
|
);
|
|
45
68
|
}
|
|
46
|
-
|
|
47
|
-
function filterAddonPricePointsByBillingPeriod(addon: Addon, billingPeriod: BillingPeriod) {
|
|
48
|
-
return addon.pricePoints.some((pricePoint) => pricePoint.billingPeriod === billingPeriod);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function mapAddonPricePointsByBillingCountryCode({
|
|
52
|
-
addon,
|
|
53
|
-
currency,
|
|
54
|
-
billingCountryCode,
|
|
55
|
-
}: {
|
|
56
|
-
addon: Addon;
|
|
57
|
-
currency: Currency;
|
|
58
|
-
billingCountryCode?: string;
|
|
59
|
-
}) {
|
|
60
|
-
return {
|
|
61
|
-
...addon,
|
|
62
|
-
pricePoints: addon.pricePoints.filter(
|
|
63
|
-
(pricePoint) =>
|
|
64
|
-
pricePoint.currency === currency &&
|
|
65
|
-
(billingCountryCode ? pricePoint.billingCountryCode === billingCountryCode : true),
|
|
66
|
-
),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { TooltipProps } from '@mui/material/Tooltip';
|
|
4
4
|
import { InformationTooltip } from './InformationTooltip';
|
|
5
|
-
import React from 'react';
|
|
6
5
|
import { Typography, TypographyProps } from './Typography';
|
|
7
6
|
|
|
8
7
|
const StyledText = styled(Typography)<{ $maxLines: number; $wordBreak?: boolean; $display: string; $bold?: boolean }>`
|
|
@@ -41,7 +40,7 @@ export const LongText = ({
|
|
|
41
40
|
className,
|
|
42
41
|
display = '-webkit-box',
|
|
43
42
|
style,
|
|
44
|
-
|
|
43
|
+
'data-testid': dataTestId,
|
|
45
44
|
}: {
|
|
46
45
|
children: ReactNode;
|
|
47
46
|
leaveDelay?: number;
|
|
@@ -54,7 +53,6 @@ export const LongText = ({
|
|
|
54
53
|
className?: string;
|
|
55
54
|
display?: string;
|
|
56
55
|
style?: CSSProperties;
|
|
57
|
-
leftMargin?: boolean;
|
|
58
56
|
['data-testid']?: string;
|
|
59
57
|
}) => {
|
|
60
58
|
const [isTextClamped, setIsTextClamped] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PoweredByStiggSvg from '../../assets/powered-by-stigg.svg';
|
|
3
2
|
import styled from '@emotion/styled/macro';
|
|
3
|
+
import PoweredByStiggSvg from '../../assets/powered-by-stigg.svg';
|
|
4
4
|
|
|
5
5
|
export const STIGG_WATERMARK_CLASSNAME = 'stigg-watermark';
|
|
6
6
|
|
|
@@ -107,7 +107,7 @@ export const Typography = forwardRef((props: TypographyProps, ref) => {
|
|
|
107
107
|
bold,
|
|
108
108
|
...rest
|
|
109
109
|
} = props;
|
|
110
|
-
const theme = useTheme()
|
|
110
|
+
const theme = useTheme();
|
|
111
111
|
const level = getLevel(variant);
|
|
112
112
|
const levelClassName = `typography-level-${level}`;
|
|
113
113
|
const className = props.className ? `${props.className} ${levelClassName}` : levelClassName;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
2
3
|
import { CustomerPortalProvider } from './CustomerPortalProvider';
|
|
3
4
|
import { CustomerPortalContainer } from './CustomerPortalContainer';
|
|
4
5
|
import { DeepPartial } from '../../types';
|
|
5
6
|
import { CustomerPortalLocalization } from './customerPortalTextOverrides';
|
|
6
7
|
import { CustomerPortalTheme } from './customerPortalTheme';
|
|
7
|
-
import { CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
8
8
|
import { OnBuyMoreCallbackFn } from './types';
|
|
9
9
|
|
|
10
10
|
export type CustomerPortalSection =
|
|
@@ -7,6 +7,7 @@ import { CustomerPortalTheme, getResolvedCustomerPortalTheme } from './customerP
|
|
|
7
7
|
import { SdkThemeProvider, useStiggTheme } from '../../theme/Theme';
|
|
8
8
|
import { useStiggContext } from '../..';
|
|
9
9
|
import { mapCustomerPortalConfiguration } from '../common/mapExternalTheme';
|
|
10
|
+
|
|
10
11
|
export interface CustomerPortalContextValue {
|
|
11
12
|
customerPortal?: CustomerPortal | null;
|
|
12
13
|
textOverrides: CustomerPortalLocalization;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
|
-
import { Typography, TypographyProps } from '../../common/Typography';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { FontWeight } from 'styled-typography';
|
|
4
|
+
import { Typography, TypographyProps } from '../../common/Typography';
|
|
5
5
|
|
|
6
6
|
export const InformationGridContainer = styled.div`
|
|
7
7
|
display: flex;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
|
+
import Divider from '@mui/material/Divider';
|
|
3
|
+
import { padStart } from 'lodash';
|
|
4
|
+
import Skeleton from 'react-loading-skeleton';
|
|
2
5
|
import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
3
6
|
import { SectionTitle } from '../common/SectionTitle';
|
|
4
7
|
import { SectionContainer } from '../common/SectionContainer';
|
|
5
8
|
import { ExternalLinkButton } from '../common/ExternalLinkButton';
|
|
6
|
-
import Divider from '@mui/material/Divider';
|
|
7
9
|
import { InformationGrid, InformationGridContainer } from './InformationGrid';
|
|
8
|
-
import { padStart } from 'lodash';
|
|
9
10
|
import { SectionHeader } from '../common/SectionHeader';
|
|
10
11
|
import { SkeletonButton } from '../common/SkeletonButton';
|
|
11
|
-
import Skeleton from 'react-loading-skeleton';
|
|
12
12
|
|
|
13
13
|
export const EMPTY_CHAR = '-';
|
|
14
14
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled/macro';
|
|
3
|
+
import { ExternalLink as ExternalLinkIcon } from 'react-feather';
|
|
3
4
|
import { Typography } from '../../common/Typography';
|
|
4
5
|
import { StyledButton } from './StyledButton';
|
|
5
|
-
import { ExternalLink as ExternalLinkIcon } from 'react-feather';
|
|
6
6
|
|
|
7
7
|
const ExternalLinkText = styled(Typography)`
|
|
8
8
|
text-transform: none;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Typography } from '../../common/Typography';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
4
2
|
import Skeleton from 'react-loading-skeleton';
|
|
3
|
+
import { Typography } from '../../common/Typography';
|
|
4
|
+
import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
5
5
|
|
|
6
6
|
export type SectionTitleProps = {
|
|
7
7
|
title: string;
|
|
@@ -3,12 +3,12 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import logger from '../../../services/logger';
|
|
4
4
|
import { useStiggContext } from '../../StiggProvider';
|
|
5
5
|
|
|
6
|
-
type
|
|
6
|
+
type UseCustomerPortalProps = {
|
|
7
7
|
resourceId?: string;
|
|
8
8
|
productId?: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export function useCustomerPortal({ resourceId, productId }:
|
|
11
|
+
export function useCustomerPortal({ resourceId, productId }: UseCustomerPortalProps) {
|
|
12
12
|
const { stigg, customerPortalUpdatedAt } = useStiggContext();
|
|
13
13
|
const [isLoading, setIsLoading] = useState(false);
|
|
14
14
|
const [customerPortal, setCustomerPortal] = useState<CustomerPortal | null>();
|
|
@@ -29,7 +29,7 @@ export function useCustomerPortal({ resourceId, productId }: useCustomerPortalPr
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
void loadCustomerPortal();
|
|
32
|
-
}, [stigg, stigg.isCustomerLoaded, customerPortalUpdatedAt, resourceId]);
|
|
32
|
+
}, [stigg, stigg.isCustomerLoaded, customerPortalUpdatedAt, resourceId, productId]);
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
35
|
customerPortal,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Typography } from '../../common/Typography';
|
|
3
2
|
import styled from '@emotion/styled/macro';
|
|
4
3
|
import Button from '@mui/material/Button';
|
|
4
|
+
import { Typography } from '../../common/Typography';
|
|
5
5
|
|
|
6
6
|
const ContactCustomerSupportLayout = styled.div`
|
|
7
7
|
display: flex;
|
|
@@ -27,7 +27,9 @@ type ContactCustomerSupportProps = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export function ContactCustomerSupport({ onContactSupport, label, linkLabel }: ContactCustomerSupportProps) {
|
|
30
|
-
|
|
30
|
+
const contactSupportText = (
|
|
31
|
+
<Typography color={onContactSupport ? 'primary.main' : 'secondary'}>{linkLabel}</Typography>
|
|
32
|
+
);
|
|
31
33
|
return (
|
|
32
34
|
<ContactCustomerSupportLayout className="stigg-contact-support-layout">
|
|
33
35
|
<Typography className="stigg-contact-support-label" color="secondary">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CustomerPortalSubscription, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';
|
|
2
3
|
import { SubscriptionsOverviewHeader } from './SubscriptionsOverviewHeader';
|
|
3
4
|
import { SubscriptionTabs } from './tabs/SubscriptionTabs';
|
|
4
5
|
import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
5
|
-
import { CustomerPortalSubscription, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';
|
|
6
6
|
import { SubscriptionOverviewLoader } from './SubscriptionOverviewLoader';
|
|
7
7
|
import { CustomerPortalSection } from '../CustomerPortal';
|
|
8
8
|
import { SubscriptionScheduledUpdatesAlert } from './subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert';
|
|
@@ -82,6 +82,7 @@ export function SubscriptionsOverview({
|
|
|
82
82
|
)}
|
|
83
83
|
|
|
84
84
|
<SubscriptionTabs
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
85
86
|
customerPortal={customerPortal!}
|
|
86
87
|
hiddenSections={hiddenSections}
|
|
87
88
|
textOverrides={textOverrides}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import styled from '@emotion/styled/macro';
|
|
3
3
|
import { StyledButton } from '../common/StyledButton';
|
|
4
4
|
import { Typography } from '../../common/Typography';
|
|
5
5
|
import EditIcon from '../../../assets/edit-icon.svg';
|
|
6
6
|
import { CustomerPortalLocalization } from '../customerPortalTextOverrides';
|
|
7
|
-
import styled from '@emotion/styled/macro';
|
|
8
7
|
import { SectionHeader } from '../common/SectionHeader';
|
|
9
8
|
import { SectionTitle } from '../common/SectionTitle';
|
|
10
9
|
|
|
11
10
|
type SubscriptionsOverviewHeaderProps = {
|
|
12
|
-
customerPortal?: CustomerPortal | null;
|
|
13
11
|
onManageSubscription: () => void;
|
|
14
12
|
hideManageButton: boolean;
|
|
15
13
|
textOverrides: CustomerPortalLocalization;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Currency, CustomerPortalEntitlement } from '@stigg/js-client-sdk';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
3
4
|
import { Typography } from '../../../common/Typography';
|
|
4
5
|
import { currencyPriceFormatter } from '../../../utils/currencyUtils';
|
|
5
6
|
import { FeatureUsageProgressBar } from '../../usage/featureUsage/FeatureUsageProgressBar';
|
|
6
7
|
import { LongText } from '../../../common/LongText';
|
|
7
|
-
import { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
8
8
|
import { EntitlementCtaButton } from '../../usage/featureUsage/EntitlementCTAButton';
|
|
9
9
|
import { OnBuyMoreCallbackFn } from '../../types';
|
|
10
10
|
|
|
@@ -49,7 +49,7 @@ export function ChargeItem({
|
|
|
49
49
|
<EntitlementCtaButton
|
|
50
50
|
entitlement={entitlement}
|
|
51
51
|
feature={feature}
|
|
52
|
-
canBuyMore
|
|
52
|
+
canBuyMore
|
|
53
53
|
onBuyMore={onBuyMore}
|
|
54
54
|
onManageSubscription={onManageSubscription}
|
|
55
55
|
canUpgradeSubscription={canUpgradeSubscription}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BillingModel, CustomerPortalEntitlement, CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
2
|
-
import { ChargeItem } from './ChargeItem';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { keyBy } from 'lodash';
|
|
4
|
+
import { ChargeItem } from './ChargeItem';
|
|
5
5
|
import { OnBuyMoreCallbackFn } from '../../types';
|
|
6
6
|
|
|
7
7
|
export type ChargesProps = {
|
|
@@ -46,7 +46,7 @@ export function ChargeList({
|
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
48
|
<ChargeItem
|
|
49
|
-
key={feature
|
|
49
|
+
key={feature.refId}
|
|
50
50
|
entitlement={entitlement}
|
|
51
51
|
feature={entitlement.feature}
|
|
52
52
|
amount={price.amount}
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
SubscriptionScheduleType,
|
|
8
8
|
BillingPeriod,
|
|
9
9
|
} from '@stigg/js-client-sdk';
|
|
10
|
+
import { compact, map } from 'lodash';
|
|
10
11
|
import { Typography } from '../../../common/Typography';
|
|
11
12
|
import { BillingPeriodChangeVariables, UnitAmountChangeVariables } from '../../../../types';
|
|
12
|
-
import { compact, map } from 'lodash';
|
|
13
13
|
|
|
14
14
|
export type SubscriptionScheduledUpdateRowProps = {
|
|
15
15
|
scheduleUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment;
|
|
@@ -3,7 +3,7 @@ import Box from '@mui/material/Box';
|
|
|
3
3
|
import Grid from '@mui/material/Grid';
|
|
4
4
|
import { CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
5
5
|
import styled from '@emotion/styled/macro';
|
|
6
|
-
import {
|
|
6
|
+
import { useTheme } from '@emotion/react';
|
|
7
7
|
import ClipLoader from 'react-spinners/ClipLoader';
|
|
8
8
|
import { CustomerPortalTheme } from '../../customerPortalTheme';
|
|
9
9
|
import Restore from '../../../../assets/restore.svg';
|
|
@@ -103,7 +103,7 @@ export function SubscriptionScheduledUpdatesAlert({
|
|
|
103
103
|
theme,
|
|
104
104
|
cancelScheduledUpdatesButtonTitle,
|
|
105
105
|
}: SubscriptionScheduledUpdatesAlertProps) {
|
|
106
|
-
const stiggTheme = useTheme()
|
|
106
|
+
const stiggTheme = useTheme();
|
|
107
107
|
const [isLoading, setIsLoading] = useState(false);
|
|
108
108
|
const { scheduledUpdates } = subscription;
|
|
109
109
|
|
package/src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Typography } from '../../../common/Typography';
|
|
3
2
|
import { CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
3
|
+
import { Typography } from '../../../common/Typography';
|
|
4
4
|
import { TrialPanel } from './TrialPanel';
|
|
5
5
|
import { CustomerPortalTheme } from '../../customerPortalTheme';
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import SandClockIcon from '../../../../assets/sand-clock.svg';
|
|
4
|
-
import { Typography } from '../../../common/Typography';
|
|
5
3
|
import { CustomerPortalSubscription, SubscriptionStatus } from '@stigg/js-client-sdk';
|
|
6
4
|
import Link from '@mui/material/Link';
|
|
5
|
+
import SandClockIcon from '../../../../assets/sand-clock.svg';
|
|
6
|
+
import { Typography } from '../../../common/Typography';
|
|
7
7
|
import { LongText } from '../../../common/LongText';
|
|
8
8
|
|
|
9
9
|
const OnTrialBadge = styled.div`
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CustomerPortalPromotionalEntitlement } from '@stigg/js-client-sdk';
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import styled from '@emotion/styled/macro';
|
|
4
5
|
import { Typography } from '../../../common/Typography';
|
|
5
6
|
import { useCustomerPortalContext } from '../../CustomerPortalProvider';
|
|
6
|
-
import styled from '@emotion/styled/macro';
|
|
7
7
|
|
|
8
8
|
const Row = styled.div<{ $borderColor: string }>`
|
|
9
9
|
display: flex;
|
|
@@ -3,6 +3,7 @@ import { CustomerPortal } from '@stigg/js-client-sdk';
|
|
|
3
3
|
import flatMap from 'lodash/flatMap';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
5
|
import Tab from '@mui/material/Tab';
|
|
6
|
+
import { FontWeight } from 'styled-typography';
|
|
6
7
|
import { Typography } from '../../../common/Typography';
|
|
7
8
|
import { AddonsList } from './AddonsList';
|
|
8
9
|
import { Promotions } from './Promotions';
|
|
@@ -11,7 +12,6 @@ import { CustomerPortalLocalization } from '../../customerPortalTextOverrides';
|
|
|
11
12
|
import { StyledTabs, TabContent, TabsLayout } from './SubscriptionTabs.style';
|
|
12
13
|
import { CustomerPortalTheme } from '../../customerPortalTheme';
|
|
13
14
|
import { Icon, Icons } from '../../../common/Icon';
|
|
14
|
-
import { FontWeight } from 'styled-typography';
|
|
15
15
|
|
|
16
16
|
type TabPanelProps = {
|
|
17
17
|
children?: React.ReactNode;
|
package/src/components/customerPortal/subscriptionOverview/upcomingBilling/NextEstimatedBill.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Typography } from '../../../common/Typography';
|
|
2
|
-
import { currencyPriceFormatter } from '../../../utils/currencyUtils';
|
|
3
1
|
import { BillingPeriod, Currency } from '@stigg/js-client-sdk';
|
|
4
2
|
import moment from 'moment';
|
|
5
3
|
import React from 'react';
|
|
4
|
+
import { currencyPriceFormatter } from '../../../utils/currencyUtils';
|
|
5
|
+
import { Typography } from '../../../common/Typography';
|
|
6
6
|
|
|
7
7
|
export type NextEstimatedBillProps = {
|
|
8
8
|
billingPeriod: BillingPeriod;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
2
1
|
import { MeterType, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';
|
|
3
2
|
import React from 'react';
|
|
3
|
+
import { compact, keyBy } from 'lodash';
|
|
4
|
+
import { Minus, Plus } from 'react-feather';
|
|
5
|
+
import Grid from '@mui/material/Grid';
|
|
6
|
+
import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
4
7
|
import { FeatureUsage } from './featureUsage/FeatureUsage';
|
|
5
8
|
import { Footer, CustomerUsageLoader } from './CustomerUsageData.style';
|
|
6
9
|
import { SectionContainer } from '../common/SectionContainer';
|
|
7
10
|
import { SectionHeader } from '../common/SectionHeader';
|
|
8
11
|
import { SectionTitle } from '../common/SectionTitle';
|
|
9
|
-
import { compact, keyBy } from 'lodash';
|
|
10
12
|
import { StyledButton } from '../common/StyledButton';
|
|
11
|
-
import { Minus, Plus } from 'react-feather';
|
|
12
|
-
import Grid from '@mui/material/Grid';
|
|
13
13
|
import { OnBuyMoreCallbackFn } from '../types';
|
|
14
14
|
|
|
15
15
|
const MAX_BOXES = 6;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';
|
|
2
2
|
import { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
3
|
-
import { getUsagePercentage, USAGE_PERCENTAGE_WARNING_THRESHOLD } from './FeatureUsage.helper';
|
|
4
3
|
import Button from '@mui/material/Button';
|
|
5
|
-
import { Typography } from '../../../common/Typography';
|
|
6
4
|
import React from 'react';
|
|
7
|
-
import { OnBuyMoreCallbackFn } from '../../types';
|
|
8
5
|
import styled from 'styled-components';
|
|
6
|
+
import { getUsagePercentage, USAGE_PERCENTAGE_WARNING_THRESHOLD } from './FeatureUsage.helper';
|
|
7
|
+
import { Typography } from '../../../common/Typography';
|
|
8
|
+
import { OnBuyMoreCallbackFn } from '../../types';
|
|
9
9
|
|
|
10
10
|
const StyledButton = styled(Button)`
|
|
11
11
|
text-transform: none;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Typography } from '../../../common/Typography';
|
|
2
1
|
import isUndefined from 'lodash/isUndefined';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { useCustomerPortalContext } from '../../CustomerPortalProvider';
|
|
5
3
|
import { BillingModel, CustomerPortalEntitlement } from '@stigg/js-client-sdk';
|
|
4
|
+
import { CustomerPortalSubscriptionPriceFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
5
|
+
import { Typography } from '../../../common/Typography';
|
|
6
|
+
import { useCustomerPortalContext } from '../../CustomerPortalProvider';
|
|
6
7
|
import { getResetUsageText, getUsagePercentage } from './FeatureUsage.helper';
|
|
7
8
|
import { getFeatureDisplayName } from '../../../utils/getFeatureName';
|
|
8
9
|
import { FeatureUsageContainer } from './FeatureUsage.style';
|
|
9
10
|
import { FeatureUsageProgressBar } from './FeatureUsageProgressBar';
|
|
10
11
|
import { Icon } from '../../../common/Icon';
|
|
11
12
|
import { InformationTooltip } from '../../../common/InformationTooltip';
|
|
12
|
-
import { CustomerPortalSubscriptionPriceFragment } from '@stigg/api-client-js/src/generated/sdk';
|
|
13
13
|
import { LongText } from '../../../common/LongText';
|
|
14
14
|
import { EntitlementCtaButton } from './EntitlementCTAButton';
|
|
15
15
|
import { OnBuyMoreCallbackFn } from '../../types';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
2
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
3
|
-
import { getUsagePercentage, getUsageProgressStatus } from './FeatureUsage.helper';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';
|
|
6
5
|
import Divider from '@mui/material/Divider';
|
|
7
6
|
import Color from 'color';
|
|
7
|
+
import { getUsagePercentage, getUsageProgressStatus } from './FeatureUsage.helper';
|
|
8
8
|
|
|
9
9
|
export const StyledLinearProgress = styled(LinearProgress)<{ $progressStatus: 'standard' | 'warning' | 'error' }>`
|
|
10
10
|
height: 4px;
|
|
@@ -6,6 +6,7 @@ function useQueryParams(paramName?: string) {
|
|
|
6
6
|
return useMemo(() => {
|
|
7
7
|
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
8
8
|
return paramName ? urlSearchParams.get(paramName) : urlSearchParams;
|
|
9
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9
10
|
}, [paramName, window.location.search]);
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -36,21 +37,28 @@ export const useWaitForCheckoutCompleted = ({
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
setIsAwaitingCheckout(true);
|
|
39
|
-
|
|
40
|
+
if (onProvisionStart) {
|
|
41
|
+
onProvisionStart();
|
|
42
|
+
}
|
|
40
43
|
try {
|
|
41
44
|
const subscription = await stigg.waitForCheckoutCompleted();
|
|
42
45
|
setProvisionStatus(ProvisionStatus.SUCCEEDED);
|
|
43
|
-
|
|
46
|
+
if (onProvisionSucceeded) {
|
|
47
|
+
onProvisionSucceeded(subscription);
|
|
48
|
+
}
|
|
44
49
|
} catch (err) {
|
|
45
50
|
console.error('Failed to wait for checkout to complete', err);
|
|
46
51
|
setProvisionStatus(ProvisionStatus.FAILED);
|
|
47
|
-
|
|
52
|
+
if (onProvisionFailed) {
|
|
53
|
+
onProvisionFailed(err);
|
|
54
|
+
}
|
|
48
55
|
} finally {
|
|
49
56
|
setIsAwaitingCheckout(false);
|
|
50
57
|
}
|
|
51
58
|
};
|
|
52
59
|
|
|
53
|
-
waitForCheckoutToComplete();
|
|
60
|
+
void waitForCheckoutToComplete();
|
|
61
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
62
|
}, [stigg, checkoutCompleted]);
|
|
55
63
|
|
|
56
64
|
return { isAwaitingCheckout, provisionStatus };
|
|
@@ -6,7 +6,7 @@ import { PaywallData } from '../types';
|
|
|
6
6
|
import { computeBillingPeriods } from '../utils/computeDefaultBillingPeriod';
|
|
7
7
|
import { mapPaywallData } from '../utils/mapPaywallData';
|
|
8
8
|
|
|
9
|
-
type
|
|
9
|
+
type UseLoadPaywallDataProps = {
|
|
10
10
|
productId?: string;
|
|
11
11
|
resourceId?: string;
|
|
12
12
|
showOnlyEligiblePlans?: boolean;
|
|
@@ -20,7 +20,7 @@ export function useLoadPaywallData({
|
|
|
20
20
|
showOnlyEligiblePlans,
|
|
21
21
|
billingCountryCode,
|
|
22
22
|
preferredBillingPeriod,
|
|
23
|
-
}:
|
|
23
|
+
}: UseLoadPaywallDataProps): PaywallData {
|
|
24
24
|
const { stigg, locale } = useStiggContext();
|
|
25
25
|
const [selectedBillingPeriod, setSelectedBillingPeriod] = useState(BillingPeriod.Annually);
|
|
26
26
|
const [availableBillingPeriods, setAvailableBillingPeriods] = useState<BillingPeriod[]>([]);
|
|
@@ -55,13 +55,13 @@ export function useLoadPaywallData({
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
void loadPaywall();
|
|
58
|
-
}, [stigg, productId, stigg.isCustomerLoaded, billingCountryCode, resourceId]);
|
|
58
|
+
}, [stigg, productId, stigg.isCustomerLoaded, billingCountryCode, resourceId, preferredBillingPeriod]);
|
|
59
59
|
|
|
60
60
|
const paywallData = mapPaywallData(paywall, showOnlyEligiblePlans);
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
63
|
customer: paywall?.customer || null,
|
|
64
|
-
isLoading
|
|
64
|
+
isLoading,
|
|
65
65
|
selectedBillingPeriod,
|
|
66
66
|
setSelectedBillingPeriod,
|
|
67
67
|
availableBillingPeriods,
|