@stigg/react-sdk 4.4.2 → 4.4.4
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/promotionCode/AppliedPromotionCode.d.ts +6 -0
- package/dist/components/checkout/summary/CheckoutSummary.d.ts +12 -2
- package/dist/index.d.ts +1 -1
- package/dist/react-sdk.cjs.development.js +51 -36
- 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 +64 -39
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/checkout/CheckoutContainer.tsx +1 -0
- package/src/components/checkout/promotionCode/AppliedPromotionCode.tsx +14 -2
- package/src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx +2 -1
- package/src/components/checkout/summary/CheckoutSummary.tsx +7 -2
- package/src/components/checkout/summary/CheckoutSummarySkeleton.tsx +3 -4
- package/src/components/checkout/summary/components/CheckoutCaptions.tsx +1 -1
- package/src/components/checkout/summary/components/LineItems.tsx +1 -1
- package/src/components/paywall/BillingPeriodPicker.tsx +3 -5
- package/src/index.ts +17 -1
- package/src/theme/getResolvedTheme.ts +1 -1
package/package.json
CHANGED
|
@@ -16,6 +16,18 @@ const AppliedCouponContainer = styled(Grid)`
|
|
|
16
16
|
border: 1px solid ${({ theme }) => theme.stigg.palette.primary};
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
+
export const StyledIcon = styled(Icon, { shouldForwardProp: (prop) => prop !== 'style' })<{ $shouldFill?: boolean }>`
|
|
20
|
+
display: flex;
|
|
21
|
+
|
|
22
|
+
g {
|
|
23
|
+
stroke: ${({ theme }) => theme.stigg.palette.primary};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
path {
|
|
27
|
+
fill: ${({ theme, $shouldFill }) => ($shouldFill ? theme.stigg.palette.primary : undefined)};
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
19
31
|
export type AppliedPromotionCodeProps = {
|
|
20
32
|
promotionCode: string;
|
|
21
33
|
onClearPromotionCode: () => void;
|
|
@@ -24,14 +36,14 @@ export type AppliedPromotionCodeProps = {
|
|
|
24
36
|
export const AppliedPromotionCode = ({ promotionCode, onClearPromotionCode }: AppliedPromotionCodeProps) => (
|
|
25
37
|
<AppliedCouponContainer container>
|
|
26
38
|
<Grid item display="flex" gap={1} alignItems="center">
|
|
27
|
-
<
|
|
39
|
+
<StyledIcon icon="Coupon" />
|
|
28
40
|
<Typography variant="body1" color="primary.main" lineHeight="auto">
|
|
29
41
|
{promotionCode}
|
|
30
42
|
</Typography>
|
|
31
43
|
</Grid>
|
|
32
44
|
<Grid item>
|
|
33
45
|
<Button variant="text" sx={{ minWidth: 'unset', padding: 0 }} onClick={onClearPromotionCode}>
|
|
34
|
-
<
|
|
46
|
+
<StyledIcon icon="Close" $shouldFill />
|
|
35
47
|
</Button>
|
|
36
48
|
</Grid>
|
|
37
49
|
</AppliedCouponContainer>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/styled/macro';
|
|
2
2
|
import { Box, Chip } from '@mui/material';
|
|
3
|
+
import Color from 'color';
|
|
3
4
|
|
|
4
5
|
export const BillingPeriodPickerContainer = styled(Box)`
|
|
5
6
|
margin: 16px 0;
|
|
@@ -32,7 +33,7 @@ export const BillingPeriodButton = styled.button<{
|
|
|
32
33
|
return 'transparent';
|
|
33
34
|
}
|
|
34
35
|
if ($isActive) {
|
|
35
|
-
return theme.stigg.palette.
|
|
36
|
+
return Color(theme.stigg.palette.primary).alpha(0.15).toString();
|
|
36
37
|
}
|
|
37
38
|
return 'transparent';
|
|
38
39
|
}};
|
|
@@ -34,6 +34,11 @@ import { CheckoutLocalization } from '../textOverrides';
|
|
|
34
34
|
import { CheckoutSuccess } from './CheckoutSuccess';
|
|
35
35
|
import { getFeatureDisplayNameText } from '../../utils/getFeatureName';
|
|
36
36
|
|
|
37
|
+
export const SummaryContainer = styled(Box)`
|
|
38
|
+
max-width: 470px;
|
|
39
|
+
flex: 1.5;
|
|
40
|
+
`;
|
|
41
|
+
|
|
37
42
|
export const SummaryCard = styled(Paper)`
|
|
38
43
|
border-radius: 10px;
|
|
39
44
|
background: ${({ theme }) => theme.stigg.palette.backgroundHighlight};
|
|
@@ -169,7 +174,7 @@ export const CheckoutSummary = ({
|
|
|
169
174
|
: checkoutLocalization.summary.baseChargeText;
|
|
170
175
|
|
|
171
176
|
return (
|
|
172
|
-
<
|
|
177
|
+
<SummaryContainer>
|
|
173
178
|
<SummaryCard>
|
|
174
179
|
<SummaryTitle variant="h6">{checkoutLocalization.summary.title}</SummaryTitle>
|
|
175
180
|
|
|
@@ -395,6 +400,6 @@ export const CheckoutSummary = ({
|
|
|
395
400
|
{!disableSuccessAnimation && isCheckoutCompletedSuccessfully && (
|
|
396
401
|
<CheckoutSuccess checkoutLocalization={checkoutLocalization} />
|
|
397
402
|
)}
|
|
398
|
-
</
|
|
403
|
+
</SummaryContainer>
|
|
399
404
|
);
|
|
400
405
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box } from '@mui/material';
|
|
3
2
|
import { PoweredByStigg } from '../../common/PoweredByStigg';
|
|
4
|
-
import { SummaryCard } from './CheckoutSummary';
|
|
3
|
+
import { SummaryCard, SummaryContainer } from './CheckoutSummary';
|
|
5
4
|
import { FlexedSkeleton, Skeleton, SkeletonsContainer } from '../components/Skeletons.style';
|
|
6
5
|
|
|
7
6
|
export const CheckoutSummarySkeleton = () => {
|
|
8
7
|
return (
|
|
9
|
-
<
|
|
8
|
+
<SummaryContainer>
|
|
10
9
|
<SummaryCard>
|
|
11
10
|
<SkeletonsContainer $flexDirection="column" $gap={24}>
|
|
12
11
|
<Skeleton width={120} height={20} />
|
|
@@ -35,6 +34,6 @@ export const CheckoutSummarySkeleton = () => {
|
|
|
35
34
|
showWatermark
|
|
36
35
|
style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}
|
|
37
36
|
/>
|
|
38
|
-
</
|
|
37
|
+
</SummaryContainer>
|
|
39
38
|
);
|
|
40
39
|
};
|
|
@@ -74,7 +74,7 @@ const NextBillingCaption = ({
|
|
|
74
74
|
isFetchingSubscriptionPreview,
|
|
75
75
|
billingPeriod,
|
|
76
76
|
}: CheckoutCaptionProps) => {
|
|
77
|
-
if (!subscriptionPreview?.recurringSubscription?.total) {
|
|
77
|
+
if (!subscriptionPreview?.recurringSubscription?.total.amount) {
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -63,8 +63,7 @@ export function BillingPeriodPicker({
|
|
|
63
63
|
<PeriodText
|
|
64
64
|
variant="h6"
|
|
65
65
|
className="stigg-monthly-period-text"
|
|
66
|
-
color={isMonthlyBillingPeriod ? 'primary' : 'disabled'}
|
|
67
|
-
>
|
|
66
|
+
color={isMonthlyBillingPeriod ? 'primary' : 'disabled'}>
|
|
68
67
|
Monthly
|
|
69
68
|
</PeriodText>
|
|
70
69
|
<StyledSwitch
|
|
@@ -73,7 +72,7 @@ export function BillingPeriodPicker({
|
|
|
73
72
|
checkedIcon={false}
|
|
74
73
|
height={16}
|
|
75
74
|
width={33}
|
|
76
|
-
onChange={isAnnuallySelected =>
|
|
75
|
+
onChange={(isAnnuallySelected) =>
|
|
77
76
|
onBillingPeriodChanged(isAnnuallySelected ? BillingPeriod.Annually : BillingPeriod.Monthly)
|
|
78
77
|
}
|
|
79
78
|
checked={!isMonthlyBillingPeriod}
|
|
@@ -83,8 +82,7 @@ export function BillingPeriodPicker({
|
|
|
83
82
|
<PeriodText
|
|
84
83
|
variant="h6"
|
|
85
84
|
className="stigg-annual-period-text"
|
|
86
|
-
color={!isMonthlyBillingPeriod ? 'primary' : 'disabled'}
|
|
87
|
-
>
|
|
85
|
+
color={!isMonthlyBillingPeriod ? 'primary' : 'disabled'}>
|
|
88
86
|
Annual
|
|
89
87
|
</PeriodText>
|
|
90
88
|
{discountRate !== 0 && <DiscountRate discount={discountRate} disabled={isMonthlyBillingPeriod} />}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './styles.css';
|
|
2
|
+
|
|
2
3
|
export * from '@stigg/js-client-sdk';
|
|
3
4
|
export {
|
|
4
5
|
Paywall,
|
|
@@ -29,7 +30,22 @@ export {
|
|
|
29
30
|
StiggContextValue,
|
|
30
31
|
StiggContext,
|
|
31
32
|
} from './components/StiggProvider';
|
|
32
|
-
export {
|
|
33
|
+
export {
|
|
34
|
+
Checkout,
|
|
35
|
+
CheckoutProps,
|
|
36
|
+
CheckoutProviderProps,
|
|
37
|
+
CheckoutContainerProps,
|
|
38
|
+
CheckoutLocalization,
|
|
39
|
+
CheckoutResult,
|
|
40
|
+
OnCheckoutCompletedParams,
|
|
41
|
+
OnCheckoutParams,
|
|
42
|
+
CheckoutTheme,
|
|
43
|
+
CheckoutMockProps,
|
|
44
|
+
MockCheckoutPreviewCallback,
|
|
45
|
+
MockCheckoutStateCallback,
|
|
46
|
+
BillingInformation,
|
|
47
|
+
TaxDetailsInput,
|
|
48
|
+
} from './components/checkout';
|
|
33
49
|
export { useWaitForCheckoutCompleted, ProvisionStatus } from './components/hooks';
|
|
34
50
|
export { HorizontalAlignment, TextAlignment } from './theme/types';
|
|
35
51
|
export { CustomizedTheme as Theme } from './theme/Theme';
|
|
@@ -21,7 +21,7 @@ export const getResolvedTheme = (customizedTheme?: CustomizedTheme): StiggTheme
|
|
|
21
21
|
palette: {
|
|
22
22
|
primary: primaryColor.hex(),
|
|
23
23
|
primaryDark: primaryColor.darken(0.3).hex(),
|
|
24
|
-
primaryLight: primaryColor.
|
|
24
|
+
primaryLight: primaryColor.alpha(0.5).toString(),
|
|
25
25
|
backgroundPaper: '#FFFFFF',
|
|
26
26
|
backgroundHighlight: '#F5F6F9',
|
|
27
27
|
backgroundSection: primaryColor.alpha(0.1).toString(),
|