@stigg/react-sdk 4.5.1 → 4.5.3
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/CheckoutContainer.style.d.ts +4 -14
- package/dist/components/checkout/components/Button.d.ts +1 -1
- package/dist/components/checkout/components/DowngradeToFreeContainer.d.ts +2 -7
- package/dist/components/checkout/components/InputField.d.ts +5 -7
- package/dist/components/checkout/components/Skeletons.style.d.ts +6 -75
- package/dist/components/checkout/progressBar/CheckoutProgressBar.style.d.ts +2 -32
- package/dist/components/checkout/steps/addons/CheckoutAddonsStep.style.d.ts +8 -82
- package/dist/components/checkout/steps/payment/PaymentMethods.style.d.ts +8 -100
- package/dist/components/checkout/steps/plan/BillingPeriodPicker.style.d.ts +6 -30
- package/dist/components/checkout/steps/plan/CheckoutPlanStep.style.d.ts +2 -7
- package/dist/components/checkout/summary/CheckoutSummary.d.ts +4 -16
- package/dist/components/common/InformationTooltip.d.ts +1 -1
- package/dist/components/common/LongText.d.ts +1 -1
- package/dist/components/customerPortal/common/StyledButton.d.ts +2 -32
- package/dist/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.style.d.ts +5 -31
- package/dist/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.d.ts +2 -12
- package/dist/react-sdk.cjs.development.js +187 -166
- 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 +100 -82
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/checkout/components/Button.tsx +1 -1
- package/src/components/checkout/components/ChangePlanButton.tsx +1 -2
- package/src/components/checkout/components/ContentLoadingSkeleton.tsx +2 -1
- package/src/components/checkout/components/DowngradeToFreeContainer.tsx +2 -1
- package/src/components/checkout/components/InputField.tsx +2 -1
- package/src/components/checkout/components/Skeletons.style.ts +1 -1
- package/src/components/checkout/configurations/theme.ts +2 -1
- package/src/components/checkout/planHeader/PlanHeader.tsx +2 -1
- package/src/components/checkout/progressBar/CheckoutProgressBar.style.ts +2 -1
- package/src/components/checkout/progressBar/CheckoutProgressBar.tsx +3 -1
- package/src/components/checkout/promotionCode/AddPromotionCode.tsx +2 -1
- package/src/components/checkout/promotionCode/AppliedPromotionCode.tsx +1 -1
- package/src/components/checkout/steps/addons/CheckoutAddonsStep.style.tsx +1 -1
- package/src/components/checkout/steps/addons/CheckoutAddonsStep.tsx +1 -1
- package/src/components/checkout/steps/payment/PaymentMethods.style.ts +1 -1
- package/src/components/checkout/steps/payment/PaymentMethods.tsx +3 -1
- package/src/components/checkout/steps/payment/PaymentStep.tsx +2 -1
- package/src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx +1 -1
- package/src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx +2 -1
- package/src/components/checkout/steps/plan/BillingPeriodPicker.tsx +2 -1
- package/src/components/checkout/steps/plan/CheckoutChargeList.tsx +1 -1
- package/src/components/checkout/steps/plan/CheckoutPlanStep.style.tsx +1 -1
- package/src/components/checkout/summary/CheckoutSuccess.tsx +1 -1
- package/src/components/checkout/summary/CheckoutSummary.tsx +5 -1
- package/src/components/checkout/summary/components/LineItems.tsx +1 -1
- package/src/components/common/InformationTooltip.tsx +13 -9
- package/src/components/common/LongText.tsx +3 -5
- package/src/components/common/TiersSelectContainer.tsx +3 -1
- package/src/components/customerPortal/billing/PaymentDetailsSection.tsx +2 -3
- package/src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdateRow.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert.tsx +6 -7
- package/src/components/customerPortal/subscriptionOverview/subscriptionView/TrialPanel.tsx +1 -1
- package/src/components/customerPortal/usage/CustomerUsageData.style.tsx +2 -2
- package/src/components/customerPortal/usage/CustomerUsageData.tsx +24 -16
- package/src/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.tsx +3 -9
- package/src/components/paywall/PlanOffering.tsx +5 -6
- package/src/theme/Theme.tsx +3 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.5.
|
|
2
|
+
"version": "4.5.3",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"dependencies": {
|
|
109
109
|
"@emotion/react": "^11.10.5",
|
|
110
110
|
"@emotion/styled": "^11.10.5",
|
|
111
|
-
"@mui/material": "^5.
|
|
111
|
+
"@mui/material": "^5.12.0",
|
|
112
112
|
"@stigg/js-client-sdk": "2.24.1",
|
|
113
113
|
"@stripe/react-stripe-js": "^2.1.1",
|
|
114
114
|
"@stripe/stripe-js": "^1.54.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import styled from '@emotion/styled/macro';
|
|
4
|
-
import
|
|
4
|
+
import MuiButton, { ButtonProps } from '@mui/material/Button';
|
|
5
5
|
|
|
6
6
|
export type StyledButtonProps = { $success?: boolean; $error?: boolean };
|
|
7
7
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
-
import { Button } from '@mui/material';
|
|
2
|
+
import Button, { ButtonProps } from '@mui/material/Button';
|
|
4
3
|
import { Typography } from '../../common/Typography';
|
|
5
4
|
import { CheckoutLocalization } from '../configurations/textOverrides';
|
|
6
5
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Divider from '@mui/material/Divider';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
3
4
|
import styled from '@emotion/styled/macro';
|
|
4
5
|
import { FlexedSkeleton, FlexedSkeletonContainer, Skeleton, SkeletonsContainer } from './Skeletons.style';
|
|
5
6
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled/macro';
|
|
3
|
-
import
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Alert from '@mui/material/Alert';
|
|
4
5
|
import { CheckoutStatePlan, Subscription } from '@stigg/js-client-sdk';
|
|
5
6
|
import { StyledArrowRightIcon } from './StyledArrow';
|
|
6
7
|
import { Typography } from '../../common/Typography';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import { OutlinedInputProps
|
|
2
|
+
import { OutlinedInputProps } from '@mui/material/OutlinedInput';
|
|
3
|
+
import TextField from '@mui/material/TextField';
|
|
3
4
|
|
|
4
5
|
export const InputField = styled(TextField)<OutlinedInputProps>(({ theme }) => ({
|
|
5
6
|
'& .MuiOutlinedInput-root': {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
|
-
import
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
3
|
import ReactSkeleton from 'react-loading-skeleton';
|
|
4
4
|
|
|
5
5
|
export const SkeletonsContainer = styled(Grid, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{
|
|
@@ -21,7 +21,8 @@ const defaultCheckoutTheme: CheckoutTheme = {
|
|
|
21
21
|
export function getResolvedCheckoutTheme(
|
|
22
22
|
globalTheme: StiggTheme,
|
|
23
23
|
themeOverride?: DeepPartial<CheckoutTheme>,
|
|
24
|
-
|
|
24
|
+
// all the remote colors override theme colors, no need to use them here
|
|
25
|
+
_remoteConfiguration?: CheckoutConfiguration | null,
|
|
25
26
|
): CheckoutTheme {
|
|
26
27
|
const { palette: globalPalette } = globalTheme || {};
|
|
27
28
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Divider from '@mui/material/Divider';
|
|
4
5
|
|
|
5
6
|
import { Typography } from '../../common/Typography';
|
|
6
7
|
import { useCheckoutModel } from '../hooks/useCheckoutModel';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
|
-
import
|
|
2
|
+
import LinearProgress, { linearProgressClasses } from '@mui/material/LinearProgress';
|
|
3
|
+
import Button, { buttonClasses } from '@mui/material/Button';
|
|
3
4
|
import { Icon } from '../../common/Icon';
|
|
4
5
|
|
|
5
6
|
export const StyledProgress = styled(LinearProgress, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import StepIcon from '@mui/material/StepIcon';
|
|
3
5
|
import { useCheckoutModel, useProgressBarModel } from '../hooks';
|
|
4
6
|
import { Typography } from '../../common/Typography';
|
|
5
7
|
import { StyledProgress, StyledStepButton, StyledIcon } from './CheckoutProgressBar.style';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import styled from '@emotion/styled/macro';
|
|
4
|
-
import
|
|
4
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
|
+
import Grid from '@mui/material/Grid';
|
|
5
6
|
|
|
6
7
|
import { Icon } from '../../common/Icon';
|
|
7
8
|
import { Typography } from '../../common/Typography';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled/macro';
|
|
3
|
-
import
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
4
4
|
import { Icon } from '../../common/Icon';
|
|
5
5
|
import { Typography } from '../../common/Typography';
|
|
6
6
|
import { Button } from '../components';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import Collapse from '@mui/material/Collapse';
|
|
4
|
+
import Grid from '@mui/material/Grid';
|
|
5
|
+
import Radio from '@mui/material/Radio';
|
|
4
6
|
import { Customer } from '@stigg/js-client-sdk';
|
|
5
7
|
|
|
6
8
|
import { Icon, Icons } from '../../../common/Icon';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import
|
|
3
|
+
import Alert from '@mui/material/Alert';
|
|
4
|
+
import Grid from '@mui/material/Grid';
|
|
4
5
|
import { useCheckoutModel, usePaymentStepModel } from '../../hooks';
|
|
5
6
|
import { ExistingPaymentMethod, NewPaymentMethod } from './PaymentMethods';
|
|
6
7
|
import { Typography } from '../../../common/Typography';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StripeAddressElementChangeEvent } from '@stripe/stripe-js';
|
|
3
|
-
import
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
4
4
|
import { BillingAddress } from '@stigg/js-client-sdk';
|
|
5
5
|
import { AddressElement, PaymentElement } from '@stripe/react-stripe-js';
|
|
6
6
|
import { Typography } from '../../../../common/Typography';
|
|
@@ -2,7 +2,8 @@ import { partition } from 'lodash';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FontWeight } from 'styled-typography';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import Radio from '@mui/material/Radio';
|
|
6
7
|
import { BillingPeriod, Plan } from '@stigg/js-client-sdk';
|
|
7
8
|
|
|
8
9
|
import { Typography } from '../../../common/Typography';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
5
|
import { BillableFeatureInput } from '@stigg/api-client-js/src/generated/sdk';
|
|
6
6
|
import { BillingModel, BillingPeriod, Plan, Price, PriceTierFragment } from '@stigg/js-client-sdk';
|
|
7
7
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import partition from 'lodash/partition';
|
|
3
3
|
import styled from '@emotion/styled/macro';
|
|
4
|
-
import
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import Divider from '@mui/material/Divider';
|
|
7
|
+
import Grid from '@mui/material/Grid';
|
|
8
|
+
import Paper from '@mui/material/Paper';
|
|
5
9
|
import { BillingModel } from '@stigg/js-client-sdk';
|
|
6
10
|
import { PoweredByStigg } from '../../common/PoweredByStigg';
|
|
7
11
|
import { Typography } from '../../common/Typography';
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Tooltip, { tooltipClasses, TooltipProps } from '@mui/material/Tooltip';
|
|
3
3
|
import styled from '@emotion/styled/macro';
|
|
4
4
|
|
|
5
|
-
export type InformationTooltipProps = TooltipProps & { $padding?: number; $maxWidth?: number
|
|
5
|
+
export type InformationTooltipProps = TooltipProps & { $padding?: number; $maxWidth?: number };
|
|
6
6
|
|
|
7
|
-
export const InformationTooltip = styled(
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export const InformationTooltip = styled(
|
|
8
|
+
({ children, className, placement = 'top', ...props }: InformationTooltipProps) => (
|
|
9
|
+
<Tooltip
|
|
10
|
+
arrow
|
|
11
|
+
placement={placement}
|
|
12
|
+
{...props}
|
|
13
|
+
classes={{ popper: className, tooltip: 'stigg-tooltip', arrow: 'stigg-tooltip-arrow' }}>
|
|
14
|
+
<div>{children}</div>
|
|
15
|
+
</Tooltip>
|
|
16
|
+
),
|
|
17
|
+
)(({ theme, $padding = 8, $maxWidth = 300 }) => ({
|
|
14
18
|
[`& .${tooltipClasses.tooltip}`]: {
|
|
15
19
|
backgroundColor: theme.stigg.palette.white,
|
|
16
20
|
maxWidth: $maxWidth,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { TooltipProps } from '@mui/material';
|
|
3
|
+
import { TooltipProps } from '@mui/material/Tooltip';
|
|
4
4
|
import { InformationTooltip } from './InformationTooltip';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Typography, TypographyProps } from './Typography';
|
|
@@ -70,8 +70,7 @@ export const LongText = ({
|
|
|
70
70
|
className={className}
|
|
71
71
|
$display={display}
|
|
72
72
|
style={style}
|
|
73
|
-
data-testid={dataTestId}
|
|
74
|
-
>
|
|
73
|
+
data-testid={dataTestId}>
|
|
75
74
|
{children}
|
|
76
75
|
</StyledText>
|
|
77
76
|
);
|
|
@@ -91,8 +90,7 @@ export const LongText = ({
|
|
|
91
90
|
<InformationTooltip
|
|
92
91
|
placement={tooltipPlacement}
|
|
93
92
|
leaveDelay={leaveDelay}
|
|
94
|
-
title={<Typography variant="body1">{children}</Typography>}
|
|
95
|
-
>
|
|
93
|
+
title={<Typography variant="body1">{children}</Typography>}>
|
|
96
94
|
{content}
|
|
97
95
|
</InformationTooltip>
|
|
98
96
|
) : (
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PriceTierFragment } from '@stigg/js-client-sdk';
|
|
2
|
-
import
|
|
2
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
3
|
+
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
4
|
+
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
|
3
5
|
import { map } from 'lodash';
|
|
4
6
|
import React, { ReactNode } from 'react';
|
|
5
7
|
import styled from '@emotion/styled/macro';
|
|
@@ -3,7 +3,7 @@ import { useCustomerPortalContext } from '../CustomerPortalProvider';
|
|
|
3
3
|
import { SectionTitle } from '../common/SectionTitle';
|
|
4
4
|
import { SectionContainer } from '../common/SectionContainer';
|
|
5
5
|
import { ExternalLinkButton } from '../common/ExternalLinkButton';
|
|
6
|
-
import
|
|
6
|
+
import Divider from '@mui/material/Divider';
|
|
7
7
|
import { InformationGrid, InformationGridContainer } from './InformationGrid';
|
|
8
8
|
import { padStart } from 'lodash';
|
|
9
9
|
import { SectionHeader } from '../common/SectionHeader';
|
|
@@ -108,8 +108,7 @@ export function PaymentDetailsSection() {
|
|
|
108
108
|
<SectionContainer
|
|
109
109
|
className="stigg-payment-details-section-layout"
|
|
110
110
|
$backgroundColor={theme.backgroundColor}
|
|
111
|
-
$borderColor={theme.borderColor}
|
|
112
|
-
>
|
|
111
|
+
$borderColor={theme.borderColor}>
|
|
113
112
|
<SectionHeader className="stigg-payment-details-section-header">
|
|
114
113
|
<SectionTitle
|
|
115
114
|
isLoading={isLoadingData}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ArrowDown } from 'react-feather';
|
|
3
|
-
import
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
4
4
|
import {
|
|
5
5
|
CustomerPortalSubscription,
|
|
6
6
|
CustomerPortalSubscriptionScheduledUpdateDataFragment,
|
|
@@ -67,7 +67,7 @@ function SubscriptionScheduledUpdateUnitQuantityChangeRow({
|
|
|
67
67
|
const newQuantityUnits = newUnitAmount === 1 ? featureUnits : featureUnitsPlural;
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
|
-
<Grid container alignItems="flex-start" flexWrap=
|
|
70
|
+
<Grid container alignItems="flex-start" flexWrap="nowrap">
|
|
71
71
|
<Grid>
|
|
72
72
|
<ArrowDown color="#D94052" height={20} className="stigg-scheduled-updates-arrow-down" />
|
|
73
73
|
</Grid>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
3
4
|
import { CustomerPortalSubscription } from '@stigg/js-client-sdk';
|
|
4
5
|
import styled from '@emotion/styled/macro';
|
|
5
6
|
import { Theme, useTheme } from '@emotion/react';
|
|
@@ -51,7 +52,7 @@ function MultipleScheduledUpdates({ subscription }: Pick<SubscriptionScheduledUp
|
|
|
51
52
|
</Grid>
|
|
52
53
|
</Grid>
|
|
53
54
|
<Grid>
|
|
54
|
-
{(scheduledUpdates || []).map(scheduleUpdate => (
|
|
55
|
+
{(scheduledUpdates || []).map((scheduleUpdate) => (
|
|
55
56
|
<SubscriptionScheduledUpdateRow
|
|
56
57
|
key={scheduleUpdate.subscriptionScheduleType}
|
|
57
58
|
scheduleUpdate={scheduleUpdate}
|
|
@@ -115,11 +116,10 @@ export function SubscriptionScheduledUpdatesAlert({
|
|
|
115
116
|
return (
|
|
116
117
|
<SubscriptionScheduleUpdateAlertContainer
|
|
117
118
|
$borderColor={theme.borderColor}
|
|
118
|
-
className="stigg-scheduled-updates-alert-container"
|
|
119
|
-
>
|
|
119
|
+
className="stigg-scheduled-updates-alert-container">
|
|
120
120
|
<Grid container alignItems={isSingleScheduledUpdate ? 'center' : 'flex-start'} gap={2}>
|
|
121
121
|
<Grid item display="flex">
|
|
122
|
-
<Icon icon=
|
|
122
|
+
<Icon icon="ScheduleBox" svgPathColor={theme.iconsColor} svgRectColor={theme.iconsBackgroundColor} />
|
|
123
123
|
</Grid>
|
|
124
124
|
|
|
125
125
|
<Grid item flex={1}>
|
|
@@ -137,8 +137,7 @@ export function SubscriptionScheduledUpdatesAlert({
|
|
|
137
137
|
onClick={() => {
|
|
138
138
|
setIsLoading(true);
|
|
139
139
|
Promise.resolve(onCancelScheduledUpdates(subscription)).finally(() => setIsLoading(false));
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
140
|
+
}}>
|
|
142
141
|
{isLoading ? (
|
|
143
142
|
<LoadingIndicator loading size={16} color={stiggTheme.stigg.palette.text.disabled} />
|
|
144
143
|
) : (
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import SandClockIcon from '../../../../assets/sand-clock.svg';
|
|
4
4
|
import { Typography } from '../../../common/Typography';
|
|
5
5
|
import { CustomerPortalSubscription, SubscriptionStatus } from '@stigg/js-client-sdk';
|
|
6
|
-
import
|
|
6
|
+
import Link from '@mui/material/Link';
|
|
7
7
|
import { LongText } from '../../../common/LongText';
|
|
8
8
|
|
|
9
9
|
const OnTrialBadge = styled.div`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
|
-
import
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
3
|
import { range } from 'lodash';
|
|
4
4
|
import Skeleton from 'react-loading-skeleton';
|
|
5
5
|
import React from 'react';
|
|
@@ -18,4 +18,4 @@ export function CustomerUsageLoader() {
|
|
|
18
18
|
))}
|
|
19
19
|
</Grid>
|
|
20
20
|
);
|
|
21
|
-
}
|
|
21
|
+
}
|
|
@@ -9,7 +9,7 @@ import { SectionTitle } from '../common/SectionTitle';
|
|
|
9
9
|
import { compact, keyBy } from 'lodash';
|
|
10
10
|
import { StyledButton } from '../common/StyledButton';
|
|
11
11
|
import { Minus, Plus } from 'react-feather';
|
|
12
|
-
import
|
|
12
|
+
import Grid from '@mui/material/Grid';
|
|
13
13
|
import { OnBuyMoreCallbackFn } from '../types';
|
|
14
14
|
|
|
15
15
|
const MAX_BOXES = 6;
|
|
@@ -25,20 +25,26 @@ export function CustomerUsageData({ onManageSubscription, onBuyMore }: CustomerU
|
|
|
25
25
|
const isLoadingData = isLoading || !customerPortal;
|
|
26
26
|
const { entitlements, subscriptions } = customerPortal || {};
|
|
27
27
|
const meteredEntitlements = entitlements?.filter(
|
|
28
|
-
entitlement =>
|
|
28
|
+
(entitlement) =>
|
|
29
29
|
entitlement.feature?.meterType === MeterType.Fluctuating ||
|
|
30
30
|
entitlement.feature?.meterType === MeterType.Incremental,
|
|
31
31
|
);
|
|
32
32
|
const activeSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.Active);
|
|
33
33
|
const hasCustomSubscription = activeSubscription?.pricingType === PricingType.Custom;
|
|
34
|
-
const canUpgradeSubscription = !!customerPortal?.canUpgradeSubscription
|
|
34
|
+
const canUpgradeSubscription = !!customerPortal?.canUpgradeSubscription;
|
|
35
35
|
|
|
36
36
|
const subscriptionPriceByFeature = keyBy(activeSubscription?.prices, 'feature.refId');
|
|
37
37
|
const entitlementByFeature = keyBy(meteredEntitlements, 'feature.refId');
|
|
38
38
|
|
|
39
39
|
// sort features by prices first, then other entitlements
|
|
40
|
-
const priceEntitlements = compact(
|
|
41
|
-
|
|
40
|
+
const priceEntitlements = compact(
|
|
41
|
+
activeSubscription?.prices.map(
|
|
42
|
+
(subscriptionPrice) => subscriptionPrice.feature && entitlementByFeature[subscriptionPrice.feature.refId],
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
const otherEntitlements = compact(
|
|
46
|
+
meteredEntitlements?.filter((entitlement) => !subscriptionPriceByFeature[entitlement.feature!.refId]),
|
|
47
|
+
);
|
|
42
48
|
const sortedEntitlements = [...priceEntitlements, ...otherEntitlements];
|
|
43
49
|
|
|
44
50
|
// 4 -> 3 per row, 6 -> 2 per row
|
|
@@ -46,7 +52,7 @@ export function CustomerUsageData({ onManageSubscription, onBuyMore }: CustomerU
|
|
|
46
52
|
|
|
47
53
|
const entitlementsToShow = showAll ? sortedEntitlements : sortedEntitlements.slice(0, MAX_BOXES);
|
|
48
54
|
|
|
49
|
-
const toggleShowAll = () => setShowAll(prevState => !prevState);
|
|
55
|
+
const toggleShowAll = () => setShowAll((prevState) => !prevState);
|
|
50
56
|
|
|
51
57
|
if (!isLoadingData && !meteredEntitlements?.length) {
|
|
52
58
|
return null;
|
|
@@ -57,9 +63,12 @@ export function CustomerUsageData({ onManageSubscription, onBuyMore }: CustomerU
|
|
|
57
63
|
className="stigg-subscription-usage-layout"
|
|
58
64
|
$backgroundColor={theme.backgroundColor}
|
|
59
65
|
$borderColor={theme.borderColor}>
|
|
60
|
-
|
|
61
66
|
<SectionHeader>
|
|
62
|
-
<SectionTitle
|
|
67
|
+
<SectionTitle
|
|
68
|
+
title={textOverrides.usageTabTitle}
|
|
69
|
+
className="stigg-customer-portal-usage-section-title"
|
|
70
|
+
isLoading={isLoadingData}
|
|
71
|
+
/>
|
|
63
72
|
</SectionHeader>
|
|
64
73
|
|
|
65
74
|
{isLoadingData ? (
|
|
@@ -71,7 +80,7 @@ export function CustomerUsageData({ onManageSubscription, onBuyMore }: CustomerU
|
|
|
71
80
|
<Grid item xs={xs}>
|
|
72
81
|
<FeatureUsage
|
|
73
82
|
key={entitlement.feature!.refId}
|
|
74
|
-
subscriptionPrice={subscriptionPriceByFeature[
|
|
83
|
+
subscriptionPrice={subscriptionPriceByFeature[entitlement.feature!.refId]}
|
|
75
84
|
entitlement={entitlement}
|
|
76
85
|
onManageSubscription={onManageSubscription}
|
|
77
86
|
onBuyMore={onBuyMore}
|
|
@@ -85,17 +94,16 @@ export function CustomerUsageData({ onManageSubscription, onBuyMore }: CustomerU
|
|
|
85
94
|
{sortedEntitlements.length > MAX_BOXES && (
|
|
86
95
|
<Footer>
|
|
87
96
|
<StyledButton
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
>
|
|
97
|
+
className="stigg-usage-toggle-many-button"
|
|
98
|
+
variant="text"
|
|
99
|
+
startIcon={showAll ? <Minus /> : <Plus />}
|
|
100
|
+
onClick={toggleShowAll}>
|
|
93
101
|
{showAll ? 'Show less' : 'Show more'}
|
|
94
102
|
</StyledButton>
|
|
95
103
|
</Footer>
|
|
96
104
|
)}
|
|
97
|
-
|
|
105
|
+
</>
|
|
98
106
|
)}
|
|
99
107
|
</SectionContainer>
|
|
100
108
|
);
|
|
101
|
-
}
|
|
109
|
+
}
|
|
@@ -3,15 +3,12 @@ import LinearProgress from '@mui/material/LinearProgress';
|
|
|
3
3
|
import { getUsagePercentage, getUsageProgressStatus } from './FeatureUsage.helper';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';
|
|
6
|
-
import
|
|
6
|
+
import Divider from '@mui/material/Divider';
|
|
7
7
|
import Color from 'color';
|
|
8
8
|
|
|
9
9
|
export const StyledLinearProgress = styled(LinearProgress)<{ $progressStatus: 'standard' | 'warning' | 'error' }>`
|
|
10
10
|
height: 4px;
|
|
11
|
-
background-color: ${({ theme }) =>
|
|
12
|
-
Color(theme.stigg.palette.primary)
|
|
13
|
-
.alpha(0.4)
|
|
14
|
-
.string()};
|
|
11
|
+
background-color: ${({ theme }) => Color(theme.stigg.palette.primary).alpha(0.4).string()};
|
|
15
12
|
|
|
16
13
|
span {
|
|
17
14
|
background-color: ${({ $progressStatus, theme }) => {
|
|
@@ -32,10 +29,7 @@ export const StyledLinearProgress = styled(LinearProgress)<{ $progressStatus: 's
|
|
|
32
29
|
export const StyledDivider = styled(Divider)`
|
|
33
30
|
border-style: dotted;
|
|
34
31
|
border-bottom-width: 2px;
|
|
35
|
-
border-color: ${({ theme }) =>
|
|
36
|
-
Color(theme.stigg.palette.outlinedRestingBorder)
|
|
37
|
-
.alpha(0.4)
|
|
38
|
-
.string()};
|
|
32
|
+
border-color: ${({ theme }) => Color(theme.stigg.palette.outlinedRestingBorder).alpha(0.4).string()};
|
|
39
33
|
`;
|
|
40
34
|
|
|
41
35
|
export type FeatureUsageProgressBarProps = {
|
|
@@ -8,7 +8,7 @@ import { PaywallLocalization } from './paywallTextOverrides';
|
|
|
8
8
|
import { flexLayoutMapper } from '../../theme/getResolvedTheme';
|
|
9
9
|
import { Typography } from '../common/Typography';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
|
-
import
|
|
11
|
+
import Grid from '@mui/material/Grid';
|
|
12
12
|
import MiniSchedule from '../../assets/mini-schedule.svg';
|
|
13
13
|
import { PlanPrice } from './PlanPrice';
|
|
14
14
|
import { getSelectedTier } from '../utils/priceTierUtils';
|
|
@@ -134,9 +134,9 @@ export function PlanOffering({
|
|
|
134
134
|
withStartingAtRow,
|
|
135
135
|
}: PlanOfferingProps) {
|
|
136
136
|
const isNextPlan = plan.isNextPlan && plan.isNextPlan(billingPeriod);
|
|
137
|
-
const planPrices = plan.pricePoints.filter(pricePoint => pricePoint.billingPeriod === billingPeriod);
|
|
137
|
+
const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);
|
|
138
138
|
const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(
|
|
139
|
-
pricePoint => pricePoint.billingPeriod === billingPeriod,
|
|
139
|
+
(pricePoint) => pricePoint.billingPeriod === billingPeriod,
|
|
140
140
|
);
|
|
141
141
|
const showStartingAt = planPrices.length > 1 && !!paywallCalculatedPrice?.additionalChargesMayApply;
|
|
142
142
|
|
|
@@ -162,7 +162,7 @@ export function PlanOffering({
|
|
|
162
162
|
}, [billingPeriod]);
|
|
163
163
|
|
|
164
164
|
const onPlanButtonClick = (intentionType: SubscribeIntentionType) => {
|
|
165
|
-
const billableFeatures: BillableFeature[] = Object.keys(selectedTierByFeature).map(featureId => ({
|
|
165
|
+
const billableFeatures: BillableFeature[] = Object.keys(selectedTierByFeature).map((featureId) => ({
|
|
166
166
|
featureId,
|
|
167
167
|
quantity: selectedTierByFeature[featureId].upTo,
|
|
168
168
|
}));
|
|
@@ -176,8 +176,7 @@ export function PlanOffering({
|
|
|
176
176
|
'stigg-current-plan': plan.isCurrentCustomerPlan,
|
|
177
177
|
})}
|
|
178
178
|
$isHighlighted={isHighlighted}
|
|
179
|
-
$isCurrentPlan={plan.isCurrentCustomerPlan}
|
|
180
|
-
>
|
|
179
|
+
$isCurrentPlan={plan.isCurrentCustomerPlan}>
|
|
181
180
|
{planBadge}
|
|
182
181
|
|
|
183
182
|
<HeaderWrapper className="stigg-header-wrapper">
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { ThemeProvider as StyledThemeProvider } from 'styled-components';
|
|
|
4
4
|
import { TypographyProps } from 'styled-typography';
|
|
5
5
|
import { css, ThemeProvider } from '@emotion/react';
|
|
6
6
|
import styled from '@emotion/styled/macro';
|
|
7
|
-
import { createTheme, ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
|
|
7
|
+
import { createTheme, ThemeProvider as MuiThemeProvider, THEME_ID } from '@mui/material/styles';
|
|
8
8
|
import { useStiggContext } from '../components/StiggProvider';
|
|
9
9
|
import { DeepPartial } from '../types';
|
|
10
10
|
import { Fonts } from './Fonts';
|
|
@@ -72,11 +72,12 @@ const createMuiPalette = (theme: StiggTheme) => {
|
|
|
72
72
|
export const SdkThemeProvider: React.FC<PropsWithChildren<SdkThemeProviderProps>> = ({ children, componentTheme }) => {
|
|
73
73
|
const theme = useStiggTheme(componentTheme);
|
|
74
74
|
const muiPalette = createMuiPalette(theme);
|
|
75
|
+
const materialTheme = createTheme({ palette: muiPalette, stigg: theme });
|
|
75
76
|
|
|
76
77
|
return (
|
|
77
78
|
// We are using styled-components theme here only because we are using styled-typography
|
|
78
79
|
// which depends on styled-components for the typography theming
|
|
79
|
-
<MuiThemeProvider theme={
|
|
80
|
+
<MuiThemeProvider theme={{ [THEME_ID]: materialTheme }}>
|
|
80
81
|
<ThemeProvider theme={{ stigg: theme }}>
|
|
81
82
|
<CustomCssGlobal customCss={theme.customCss}>
|
|
82
83
|
<Fonts externalFontUrl={theme.typography.fontFamilyUrl} />
|