@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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.4.2",
2
+ "version": "4.4.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -111,6 +111,7 @@ export function CheckoutContainer({
111
111
 
112
112
  return (
113
113
  <Elements
114
+ key={setupIntentClientSecret}
114
115
  stripe={stripePromise}
115
116
  options={{
116
117
  ...stripeElementsMode,
@@ -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
- <Icon icon="Coupon" style={{ display: 'flex' }} />
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
- <Icon icon="Close" style={{ display: 'flex' }} />
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.primaryLight;
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
- <Box flex={1}>
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
- </Box>
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
- <Box flex={1}>
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
- </Box>
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
 
@@ -72,7 +72,7 @@ export const BilledPriceLineItem = ({
72
72
 
73
73
  return (
74
74
  <LineItemContainer>
75
- <LineItemRow style={{ alignItems: 'flex-end' }}>
75
+ <LineItemRow style={{ alignItems: 'flex-start' }}>
76
76
  <Grid item>
77
77
  <Typography variant="body1" color="secondary">
78
78
  {label}
@@ -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 { Checkout, CheckoutProps, CheckoutTheme } from './components/checkout';
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.lighten(0.6).hex(),
24
+ primaryLight: primaryColor.alpha(0.5).toString(),
25
25
  backgroundPaper: '#FFFFFF',
26
26
  backgroundHighlight: '#F5F6F9',
27
27
  backgroundSection: primaryColor.alpha(0.1).toString(),